132 lines
3.1 KiB
Markdown
132 lines
3.1 KiB
Markdown
# 环境搭建
|
|
|
|
### 找回剩余容量
|
|
|
|
> 参考 https://blog.csdn.net/weixin_42252435/article/details/116632826?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_title~default-0.essearch_pc_relevant&spm=1001.2101.3001.4242.1
|
|
|
|
> 首先来查看一下系统的磁盘情况
|
|
```bash
|
|
orangepi@orangepi:~$ sudo fdisk -l
|
|
|
|
Device Boot Start End Blocks Id System
|
|
/dev/mmcblk0p1 40960 124927 41984 83 Linux
|
|
/dev/mmcblk0p2 124928 7167999 3521536 83 Linux
|
|
```
|
|
|
|
> 查看第二分区的起始地址,后面会用到
|
|
|
|
```bash
|
|
orangepi@orangepi:~$ cat /sys/block/mmcblk0/mmcblk0p2/start
|
|
124928
|
|
```
|
|
|
|
> 操作磁盘,并调整ext文件系统的空间大小
|
|
|
|
```bash
|
|
orangepi@orangepi:~$ sudo fdisk /dev/mmcblk0
|
|
|
|
Command (m for help): d
|
|
Partition number (1-4): 2
|
|
|
|
Command (m for help): n
|
|
Partition type:
|
|
p primary (1 primary, 0 extended, 3 free)
|
|
e extended
|
|
Select (default p):
|
|
Using default response p
|
|
Partition number (1-4, default 2):
|
|
Using default value 2
|
|
First sector (2048-62333951, default 2048): 124928
|
|
Last sector, +sectors or +size{K,M,G} (124928-62333951, default 62333951):
|
|
Using default value 62333951
|
|
|
|
Command (m for help): w
|
|
The partition table has been altered!
|
|
|
|
Calling ioctl() to re-read partition table.
|
|
|
|
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
|
|
The kernel still uses the old table. The new table will be used at
|
|
the next reboot or after you run partprobe(8) or kpartx(8)
|
|
Syncing disks.
|
|
|
|
orangepi@orangepi:~$ sudo reboot
|
|
orangepi@orangepi:~$ sudo resize2fs /dev/mmcblk0p2
|
|
```
|
|
|
|
### 配置环境
|
|
|
|
* 配置
|
|
|
|
```bash
|
|
sudo apt-get update
|
|
sudo apt-get install --reinstall systemd -y
|
|
sudo apt install cups-bsd -y
|
|
cp /usr/lib/cups/backend/gutenprint52+usb /usr/lib/cups/backend/gutenprint52usb
|
|
```
|
|
|
|
* 配置 .net core 3.1 环境
|
|
|
|
```bash
|
|
wget --no-check-certificate https://download.visualstudio.microsoft.com/download/pr/1b2a2fb1-b04b-485b-8a25-caed97ebe601/0c6024a3814f664558dc39fc85b34192/dotnet-sdk-3.1.416-linux-arm.tar.gz
|
|
|
|
sudo mkdir /usr/share/dotnet
|
|
sudo tar -xvf dotnet-sdk-3.1.416-linux-arm.tar.gz -C /usr/share/dotnet
|
|
sudo ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
|
|
root@orangepi:~# dotnet --info
|
|
.NET Core SDK (reflecting any global.json):
|
|
Version: 3.1.416
|
|
Commit: 8d3765c609
|
|
```
|
|
|
|
* 拷贝 gcm.bin、 install.sh 进入系统
|
|
|
|
```
|
|
bash install.sh
|
|
chmod +x /usr/local/gcm/bin/*
|
|
source /etc/profile.d/gcm.sh
|
|
```
|
|
* 拷贝软件, 软件设置为服务
|
|
|
|
```
|
|
vim /etc/systemd/system/printerclient.service
|
|
```
|
|
```
|
|
[Unit]
|
|
Description=Printer Client
|
|
|
|
[Service]
|
|
WorkingDirectory=/root/netcoreapp3.1/
|
|
ExecStart=/root/netcoreapp3.1/autorun.sh
|
|
Restart=always
|
|
RestartSec=10
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
```
|
|
|
|
```
|
|
vim netcoreapp3.1/autorun.sh
|
|
```
|
|
|
|
```
|
|
#!/bin/sh
|
|
|
|
export GCM_HOME=/usr/local/gcm
|
|
export PATH=$GCM_HOME/bin:$PATH
|
|
LD_LIBRARY_PATH=$GCM_HOME/lib:$LD_LIBRARY_PATH
|
|
|
|
export LD_LIBRARY_PATH
|
|
|
|
cd /root/netcoreapp3.1
|
|
|
|
dotnet PrinterClient.dll
|
|
|
|
```
|
|
|
|
将服务设置为每次开机启动
|
|
systemctl enable printerclient.service
|
|
|
|
服务立即启动,下次不启动
|
|
systemctl start printerclient.service
|