1. 自动挂载硬盘
-
使用lsblk 命令查看磁盘设备 -
使用blkid 命令查询硬盘的uuid -
创建挂载目录mkdir -p /data -
修改配置开机自动挂载vim /etc/fstab -
新增一行UUID=f6e23bcb-983f-1d4e-bea1-36bae2a72c33 /data ext4 defaults 0 0 -
立即挂载mount -a
2. 安装samba文件共享服务
- 使用
armbian-config 命令在软件中选中进行安装 - 修改配置文件
vim /etc/samba/smb.conf ,主要生效是_global_ 和最后一个_N1_,名字自定义
[global]
workgroup = root
server string = %h server
hosts allow = 192.168.2.
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
load printers = yes
printing = cups
printcap name = cups
min receivefile size = 16384
write cache size = 524288
getwd cache = yes
socket options = TCP_NODELAY IPTOS_LOWDELAY
[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
public = yes
guest ok = yes
writable = no
printable = yes
printer admin = root
[print$]
comment = Printer Drivers
path = /etc/samba/drivers
browseable = yes
guest ok = no
read only = yes
write list = root
[N1]
comment = Storage
path = /data
writable = yes
public = no
valid users = root
force create mode = 0644
- 启动服务
systemctl start smbd.service ,开机自启systemctl enable smbd.service - 添加账户密码,对应配置中的用户名
smbpasswd -a root
3. 安装qbittorrent下载服务
apt install qbittorrent-nox - 添加到系统服务
vim /etc/systemd/system/qbittorrent-nox.service
[Unit]
Description=qBittorrent-nox
After=network.target
[Service]
User=root
Type=forking
RemainAfterExit=yes
ExecStart=/usr/bin/qbittorrent-nox -d
[Install]
WantedBy=multi-user.target
开机自启systemctl enable qbittorrent-nox.service 启动服务systemctl start qbittorrent-nox.service
- 默认web访问端口8080,用户名admin,密码adminadmin
4. 阿里云盘webdav
- 安装步骤
mkdir -p /home/aliyun-webdav
cd /home/aliyun-webdav
vim auto_update.sh
vim restart.sh
auto_update.sh curl -G https://api2.pushdeer.com/message/push?pushkey... 为推送通知到手机的功能,需要的话可以研究一下开启。
cd "$(dirname $0)"
if [[ -f "/usr/local/bin/aliyundrive-webdav" ]]; then
current_version=`/usr/local/bin/aliyundrive-webdav --version|awk '{print $2}'`
if [[ -n $current_version ]];then
echo "[$(date '+%Y-%m-%d %H:%M:%S')]当前版本:$current_version"
else
echo "[$(date '+%Y-%m-%d %H:%M:%S')]获取当前版本失败!"
exit 1
fi
else
echo "[$(date '+%Y-%m-%d %H:%M:%S')]文件不存在,开始安装。"
current_version="None"
fi
api_data=`curl -s https://api.github.com/repos/messense/aliyundrive-webdav/releases/latest`
version=`echo "$api_data"|grep "tag_name"|awk -F "\"" '{ print $4 }'`
if [[ -z $version ]];then
echo "[$(date '+%Y-%m-%d %H:%M:%S')]获取最新版本号失败,请检查网络!"
exit 2
fi
echo "[$(date '+%Y-%m-%d %H:%M:%S')]最新版本:$version"
if [[ $version != *$current_version* ]];then
echo "[$(date '+%Y-%m-%d %H:%M:%S')]开始更新..."
rm -rf *.gz
download=`echo "$api_data"|grep "browser_download_url"|grep "aarch64-unknown-linux-musl"|grep -v "sha256"|awk -F "\"" '{ print $4 }'`
echo $download
wget $download
tar -xzvf aliyundrive*.tar.gz
mv /usr/local/bin/aliyundrive-webdav "aliyundrive-webdav.$current_version"
mv aliyundrive-webdav /usr/local/bin/aliyundrive-webdav
chmod +x /usr/local/bin/aliyundrive-webdav
echo "[$(date '+%Y-%m-%d %H:%M:%S')]重启程序..."
echo "[$(date '+%Y-%m-%d %H:%M:%S')]已更新到$version版本"
else
echo "[$(date '+%Y-%m-%d %H:%M:%S')]已是最新版本。"
fi
sh restart.sh `cat refresh_token`
restart.sh 可根据自己需求修改启动参数
killall -9 aliyundrive-webdav
nohup /usr/local/bin/aliyundrive-webdav --auto-index --workdir /home/aliyun-webdav/ --port 9090 --auth-user admin --auth-password admin123098 --refresh-token $1 > /dev/null &
- 直接运行
auto_update.sh 会自动安装、重启,启动会失败,第一次启动需要手动获取token,执行脚本./restart.sh 获取的token - 添加定时任务自动更新程序
crontab -e
0 5 * * * bash /home/aliyun-webdav/auto_update.sh >> /home/aliyun-webdav/update.log &
|