一、初始化配置
1. 更换国内源
(使用的是 Debian 源)https://mirrors.tuna.tsinghua.edu.cn/help/debian/
mv /etc/apt/sources.list /etc/apt/sources.list.bakvi /etc/apt/sources.list
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释deb https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch main contrib non-free# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch main contrib non-freedeb https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch-updates main contrib non-free# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch-updates main contrib non-freedeb https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch-backports main contrib non-free# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch-backports main contrib non-freedeb https://mirrors.tuna.tsinghua.edu.cn/debian-security stretch/updates main contrib non-free# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security stretch/updates main contrib non-free
apt update -y && apt upgrade -y
2. 安装中文字体,修改系统语言
apt install -y ttf-wqy-microhei ttf-wqy-zenhei
armbian-config
personal —> Locales 进入语言选择界面,勾选:
[ * ] en_US.UTF-8 UTF-8[ * ] zh_CN.GBK GBK[ * ] zh_CN.UTF-8 UTF-8
选择 OK,进入下一界面,选择 en_US.UTF-8 UTF-8
3.挂载外置存储
- 开机自动挂载 NTFS 分区
安装ntfs-3g
查看挂载点
新建一个目录,然后修改/etc/fstab
添加如下内容(比如挂载 /dev/sda3)apt install -y ntfs-3g
fdisk -l
Device Start End Sectors Size Type/dev/sda1 34 32767 32734 16M Microsoft reserved/dev/sda2 32768 268468223 268435456 128G Microsoft basic data/dev/sda3 268468224 1953521663 1685053440 803.5G Microsoft basic data
mkdir /mnt/disk_namevi /etc/fstab
/dev/sda3 /mnt/phidata ntfs-3g defaults 0 0
二、搭建 NAS
1. 云盘功能
1.1 NextCloud
apt install -y snapdsnap install nextcloud
访问 http://your_server_ip 按提示配置
Tips: 修改数据存储文件夹的方法 修改
/var/snap/nextcloud/current/nextcloud/config/config.php的datadirectory的值为/dest/nextcloud/data,然后重启nextcloud
cp -a /var/snap/nextcloud/common/nextcloud/data/ /dest/nextcloud
snap restart nextcloud
Tips:
你的数据目录可被其他用户读取 请更改权限为 0770 以避免其他用户查看目录.的解决办法 修改/etc/fstab或 修改 util.php(改法可能行不通,因为没有 util.php 的写权限) 将checkDataDirectoryPermissions修改为
/dev/sda3 /mnt/phidata ntfs-3g defaults,permissions 0 0
chmod -R 770 /dest/nextcloud/data
vi /snap/nextcloud/10318/htdocs/lib/private/legacy/util.php
public static function checkDataDirectoryPermissions($dataDirectory) {if(\OC::$server->getConfig()->getSystemValue('check_data_directory_permissions', true) === false) {return [];}$l = \OC::$server->getL10N('lib');$errors = [];// $permissionsModHint = $l->t('Please change the permissions to 0770 so that the directory'// . ' cannot be listed by other users.');// $perms = substr(decoct(@fileperms($dataDirectory)), -3);// if (substr($perms, -1) !== '0') {// chmod($dataDirectory, 0770);// clearstatcache();// $perms = substr(decoct(@fileperms($dataDirectory)), -3);// if ($perms[2] !== '0') {// $errors[] = [// 'error' => $l->t('Your data directory is readable by other users'),// 'hint' => $permissionsModHint// ];// }// }return $errors;}
1.2 Filebrowser
curl -fsSL https://filebrowser.github.io/get.sh | bash
编辑 /home/filebrowser/config.json
{"port": 8000,"database": "/home/filebrowser/database.db","scope": "/mnt/phidata","allowCommands": true,"allowEdit": true,"allowNew": true,"commands": ["wget"]}
filebrowser -c /home/filebrowser/config.json
访问 http://your_server_ip:8000 按提示配置
加入开机启动
1. 影音功能
2.1 Emby
下载页面 https://emby.media/linux-server.html
wget https://github.com/MediaBrowser/Emby.Releases/releases/download/3.6.0.82/emby-server-deb_3.6.0.82_arm64.debdpkg -i emby-server-deb_3.6.0.82_arm64.deb
访问 http://your_server_ip:8096 按提示配置
2.2 Plex Media Server
参考这里 https://dev2day.de/plex-media-server-arm/
# root 下执行# add public keywget -O - https://dev2day.de/pms/dev2day-pms.gpg.key | apt-key add -# add PMS repoecho "deb [arch=armhf] https://dev2day.de/pms/ stretch main" >> /etc/apt/sources.list.d/pms.list# activate httpsapt install apt-transport-https# enable armhf supportdpkg --add-architecture armhf# update the reposapt update# install PMSapt install plexmediaserver-installer:armhf
访问 http://your_server_ip:32400/web 按提示配置
3.下载功能
3.1 Aria2
apt install -y aria2mkdir /etc/aria2touch /etc/aria2/aria2.sessiontouch /etc/aria2/aria2.conf
编辑 /etc/aria2/aria2.conf
## RPC相关设置 ### 启用RPC, 默认:falseenable-rpc=true# 允许所有来源, 默认:falserpc-allow-origin-all=true# 允许外部访问, 默认:falserpc-listen-all=true# RPC端口, 仅当默认端口被占用时修改#rpc-listen-port=6800# 设置的RPC授权令牌, v1.18.4新增功能, 取代 --rpc-user 和 --rpc-passwd 选项#rpc-secret=yourpasswordhere## 文件保存相关 ### 文件保存目录dir=/mnt/phidata/download# 启用磁盘缓存, 0为禁用缓存, 需1.16以上版本, 默认:16Mdisk-cache=32M# 断点续传continue=true# 文件预分配方式, 能有效降低磁盘碎片, 默认:prealloc# 预分配所需时间: none < falloc ? trunc < prealloc# falloc和trunc则需要文件系统和内核支持# NTFS建议使用falloc, EXT3/4建议trunc, MAC 下需要注释此项#file-allocation=falloc## 下载连接相关 ### 最大同时下载任务数, 运行时可修改, 默认:5max-concurrent-downloads=2# 同一服务器连接数, 添加时可指定, 默认:1max-connection-per-server=5# 整体下载速度限制, 运行时可修改, 默认:0(不限制)#max-overall-download-limit=0# 单个任务下载速度限制, 默认:0(不限制)#max-download-limit=0# 整体上传速度限制, 运行时可修改, 默认:0(不限制)#max-overall-upload-limit=0# 单个任务上传速度限制, 默认:0(不限制)#max-upload-limit=0# 禁用IPv6, 默认:falsedisable-ipv6=true# 最小文件分片大小, 添加时可指定, 取值范围 1M -1024M , 默认:20M# 假定 size=10M , 文件为 20MiB 则使用两个来源下载; 文件为 15MiB 则使用一个来源下载min-split-size=10M# 单个任务最大线程数, 添加时可指定, 默认:5#split=10## 进度保存相关 ### 从会话文件中读取下载任务input-file=/etc/aria2/aria2.session# 在Aria2退出时保存错误的、未完成的下载任务到会话文件save-session=/etc/aria2/aria2.session# 定时保存会话, 0为退出时才保存, 需1.16.1以上版本, 默认:0save-session-interval=60## BT/PT下载相关 ### 当下载的是一个种子(以.torrent结尾)时, 自动开始BT任务, 默认:true#follow-torrent=true# 客户端伪装, PT需要peer-id-prefix=-TR2770-user-agent=Transmission/2.77# 强制保存会话, 即使任务已经完成, 默认:false# 较新的版本开启后会在任务完成后依然保留.aria2文件#force-save=false# 继续之前的BT任务时, 无需再次校验, 默认:falsebt-seed-unverified=true# 保存磁力链接元数据为种子文件(.torrent文件), 默认:falsebt-save-metadata=true
后台运行 Aria2
nohup aria2c --conf-path=/etc/aria2/aria2.conf &
将 Aria2-WebUI 文档放在 /home/aria2/www ,然后启动 nginx
docker run --name aria2-webui -v /home/aria2/www:/usr/share/nginx/html -p 6801:80 -d nginx
Aria2 的 WebUI:
将一下内容加入 /etc/rc.local
docker start 实例IDnohup aria2c --conf-path=/etc/aria2/aria2.conf &
4.高级功能
4.1 Webmin
4.2 Docker
4.3 LNMP
4.4 宝塔面板
不支持 arm,不用尝试了!!!
三、其他
1. 计划任务
- 定时关机
59 23 * * * /bin/sync && /sbin/poweroff
