一.刷入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添加后,往下
一鍵安裝omv腳本項目地址:OpenMediaVault-Plugin-Developers/installScript: script that installs omv-extras and openmediavault if not installed already. (github.com)
離線安裝:
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