一.刷入Debian11
项目地址:https://github.com/OpenStick/OpenStick
wiki地址:https://www.kancloud.cn/handsomehacker/openstick/2637559
二.完成刷入后,通过adb shell指令进入控制台并连接网络
1.配置网络环境
export TERM=linux
2.进入网络管理
sudo nmtui
3.修改root用户密码
passwd root 密码
三.安装基本软件
1.更新软件列表并安装wget和curl
sudo apt-get update
apt-get install wget
apt-get install curl
2.安装docker和fastos docker面板/portainer面板
//安装docker
sudo apt-get update
curl -sSL https://get.daocloud.io/docker | sh
//设置docker自启
sudo systemctl enable docker
sudo systemctl start docker
//安装可视化面板fastos docker
docker run --restart always -p 8081:8081 -d -v /var/run/docker.sock:/var/run/docker.sock -v /etc/docker/:/etc/docker/ wangbinxingkong/fast:latest
ps:首次登录需要注册,注册成功后即可正常使用
可视化面板项目地址:https://hub.docker.com/r/wangbinxingkong/fast
//安装portainer面板
docker run -d -p 8080:9000 --restart=always -v /var/run/docker.sock:/var/run/docker.sock --name prtainer portainer/portainer
汉化包地址:https://www.u-share.cn/forum.php?mod=viewthread&tid=192866&highlight=portainer
3.设置DDNS
项目地址:https://github.com/jeessy2/ddns-go
//拉取ddns镜像并部署
docker run -d --name ddns-go --restart=always --net=host jeessy/ddns-go
在浏览器中打开
http://主机IP:9876
,修改你的配置,成功[可选] 支持启动带参数
-l
监听地址-f
间隔时间(秒)
docker run -d --name ddns-go --restart=always --net=host jeessy/ddns-go -l :9877 -f 600
四.进阶部分
1.开启ssh登陆root账户
安装nano编辑器
sudo apt-get install nano
编辑sshd_config
sudo nano /etc/ssh/sshd_config
将34行#PermitRootLogin prohibit-password
改为PermitRootLogin yes
将58行#PasswordAuthentication yes
的#去掉
重启
reboot
2.修改host加速GitHub访问
使用winscp打开/etc/hosts,并加入以下内容(末尾为项目地址)
# GitHub520 Host Start
140.82.112.25 alive.github.com
140.82.112.25 live.github.com
185.199.108.154 github.githubassets.com
140.82.112.21 central.github.com
185.199.108.133 desktop.githubusercontent.com
185.199.108.153 assets-cdn.github.com
185.199.108.133 camo.githubusercontent.com
185.199.108.133 github.map.fastly.net
199.232.69.194 github.global.ssl.fastly.net
140.82.113.4 gist.github.com
185.199.108.153 github.io
140.82.114.4 github.com
192.0.66.2 github.blog
140.82.114.6 api.github.com
185.199.108.133 raw.githubusercontent.com
185.199.108.133 user-images.githubusercontent.com
185.199.108.133 favicons.githubusercontent.com
185.199.108.133 avatars5.githubusercontent.com
185.199.108.133 avatars4.githubusercontent.com
185.199.108.133 avatars3.githubusercontent.com
185.199.108.133 avatars2.githubusercontent.com
185.199.108.133 avatars1.githubusercontent.com
185.199.108.133 avatars0.githubusercontent.com
185.199.108.133 avatars.githubusercontent.com
140.82.112.10 codeload.github.com
52.216.21.147 github-cloud.s3.amazonaws.com
52.217.229.65 github-com.s3.amazonaws.com
52.217.96.28 github-production-release-asset-2e65be.s3.amazonaws.com
52.217.77.92 github-production-user-asset-6210df.s3.amazonaws.com
52.217.172.9 github-production-repository-file-5c1aeb.s3.amazonaws.com
185.199.108.153 githubstatus.com
64.71.144.202 github.community
23.100.27.125 github.dev
140.82.114.21 collector.github.com
13.107.43.16 pipelines.actions.githubusercontent.com
185.199.108.133 media.githubusercontent.com
185.199.108.133 cloud.githubusercontent.com
185.199.108.133 objects.githubusercontent.com
# Update time: 2022-02-24T14:06:14+08:00
# Update url: https://raw.hellogithub.com/hosts
# Star me: https://github.com/521xueweihan/GitHub520
# GitHub520 Host End
重启生效
3.设置USB拓展
切换USB模式
sudo -s
echo host > /sys/kernel/debug/usb/ci_hdrc.0/role
挂载外接存储
fdisk -l
sudo mount -t /sd?1 /你要挂载的目录(?字母参考上条代码输出路径)
(如显示fdisk未安装)
sudo apt-get install -y fdisk
3.1显示没有写权限的解决方案(NTFS)
安装ntfs-3g
apt-get install -y ntfs-3g
修复NTFS
sudo ntfsfix /dev/sd?1
返回结果
Mounting volume… The disk contains an unclean file system (0, 0).
Metadata kept in Windows cache, refused to mount.
FAILED
Attempting to correct errors…
Processing $MFT and $MFTMirr…
Reading $MFT… OK
Reading $MFTMirr… OK
Comparing $MFTMirr to $MFT… OK
Processing of $MFT and $MFTMirr completed successfully.
Setting required flags on partition… OK
Going to empty the journal ($LogFile)… OK
Checking the alternate boot sector… OK
NTFS volume version is 3.1.
NTFS partition /dev/vdb2 was processed successfully.
最后正常挂载
mount -t ntfs /dev/ad?1 /xxx
3.2通过udisks2安全弹出外接硬盘
udisksctl unmount -b /dev/sda1
//卸载挂载点。相当与(umount /devsda1)
udisksctl power-off -b /dev/sda1
//安全关闭驱动器
参考:https://qastack.cn/unix/178638/eject-safely-remove-vs-umount
3.2-1通过udisks2断电外接硬盘
udisksctl power-off --block-device /dev/sdb
参考:https://forum.ubuntu.org.cn/viewtopic.php?t=480394
3.3关闭LED灯
参考openstick Wiki
cd /sys/class/leds/red:os
echo usb-gadget > trigger
cd /sys/class/leds/blue:wifi
echo usb-gadget > trigger
这样就可以把wifi灯和系统指示灯关了(开着太nm闪了)
3.4更新源出现报错的解决方案
更换默认源
安装CA
apt install apt-transport-https ca-certificates
更新源
sudo nano /etc/apt/sources.list
更换为以下内容
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb http://mirrors.ustc.edu.cn/debian/ bullseye main contrib non-free
#deb-src http://mirrors.ustc.edu.cn/debian/ bullseye main contrib non-free
deb http://mirrors.ustc.edu.cn/debian/ bullseye-updates main contrib non-free
#deb-src http://mirrors.ustc.edu.cn/debian/ bullseye-updates main contrib non-free
deb http://mirrors.ustc.edu.cn/debian/ bullseye-backports main contrib non-free
#deb-src http://mirrors.ustc.edu.cn/debian/ bullseye-backports main contrib non-free
deb http://mirrors.ustc.edu.cn/debian-security/ bullseye-security main contrib non-free
#deb-src http://mirrors.ustc.edu.cn/debian-security/ bullseye-security main contrib non-free
禁用Mobian源
sudo sed -i '1c #deb http://repo.mobian-project.org/ bullseye main non-free' /etc/apt/sources.list.d/mobian.list
删除不可用仓库
cd /etc/apt/source.list.d
rm -r ./需要删除的仓库
最后正常执行apt-get update
4.安装OMV
4.1.卸载重装python3
1、卸载python3
sudo apt-get remove python3
2、卸载python3及其依赖
sudo apt-get remove --auto-remove python3
3、清除python3
sudo apt-get purge python3
or
sudo apt-get purge --auto-remove python3
4.安装python3
sudo apt-get install python3
4.2.修改hosts,拉取一键安装脚本
通过该网站获取github以及raw的地址
raw.Githubusercontent.com | Easy, Fast and FREE (ipaddress.com)
把ip加入/etc/hosts中即可
例如
140.82.112.4 github.com
185.199.108.133 raw.githubusercontent.com
完成hosts添加后,往下
离线安装:
wget https://github.com/OpenMediaVault-Plugin-Developers/installScript/raw/master/install
chmod +x install
sudo ./install -n
curl拉取(适用于网络条件差的情况):
sudo curl -sSL https://github.com/OpenMediaVault-Plugin-Developers/installScript/raw/master/install | sudo bash
执行sudo ./install -n 开始自动安装,等待安装完成即可
4.3.报错解决办法
填坑:解决Unit file is masked问题
在某些机器(如VPS)上手动安装OMV时,常常会出现“Unit file is masked”的问题。该问题非常致命,会中断OMV后续的安装进程。
Failed to preset unit: Unit file /etc/systemd/system/openmediavault-cleanup-php.service is masked.
/usr/bin/deb-systemd-helper: error: systemctl preset failed on openmediavault-cleanup-php.service: No such file or directory
dpkg: error processing package openmediavault (--configure):
installed openmediavault package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
openmediavault
E: Sub-process /usr/bin/dpkg returned an error code (1)
实际上,了解systemd对服务的管理机制,就不难得知,这里的“mask”是系统服务的一个状态,相当于被“屏蔽”。据此,解决办法很简单,但凡有一个服务提示被masked,就运行下面的命令来unmask,然后重新安装,直到安装过程能够顺利继续:
# systemctl unmask <被报错的服务名>,例如:
systemctl unmask openmediavault-cleanup-php.service
5.安装snap和hacs
为确保蓝牙功能能正常使用,需要先安装蓝牙程序
apt install bluetooth
安装完成后确认蓝牙设备是否启动
hcioconfig -a
显示为DOWN则未开启,手动开启
hciconfig hci0 up
接下来安装snap和core
apt install snapd
安装完snap后注销用户或重启
snap install core
安装完成snap后,即可安装hacs(snapcraft.io)
sudo snap install home-assistant-hacs
安装完成后重启,之后进入localhost:8123,手动配置HACS