第一步 添加 SWAP#
wget -O box.sh https://raw.githubusercontent.com/BlueSkyXN/SKY-BOX/main/box.sh && chmod +x box.sh && clear && sudo ./box.sh
- 18 大小輸入 4096,設置 4G 大小的 swap 空間
第二步 開啟 BBR#
wget -O box.sh https://raw.githubusercontent.com/BlueSkyXN/SKY-BOX/main/box.sh && chmod +x box.sh && clear && sudo ./box.sh
- 17 11 開啟 BBR-FQ
- sudo reboot
第三步 修改時區#
- timedatectl list-timezones
- sudo timedatectl set-timezone Asia/Shanghai
第四步 修改 SSH 端口#
- sudo nano /etc/ssh/sshd_config
- 修改 Port 22 為 Port 2022
- sudo service sshd restart
- 新開一個 SSH 連接測試修改是否成功
- 蜜罐:FakeSSH
docker run -d --restart=always -p 22:22 --name fakessh fffaraz/fakessh
docker logs -f fakessh
第五步 安裝 docker#
- 新版 docker 自帶 compose 命令,使用
docker compose
即可 - (國內)
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
- (國際)
curl -fsSL https://get.docker.com | bash
(換源) sudo sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
sudo apt update
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
ARCH_VERSION=$(if [[ $(arch) == "arm64" || $(arch) == 'aarch64' ]]; then echo 'arm64'; elif [[ $(arch) == "armhf" ]]; then echo 'armhf'; else echo 'amd64'; fi)
sudo add-apt-repository "deb [arch=$ARCH_VERSION] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update && sudo apt install docker-ce
sudo systemctl status docker
LATEST_VERSION=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | awk -F'"' '/tag_name/{print $4}')
(鏡像) sudo curl -L "https://get.daocloud.io/docker/compose/releases/download/$LATEST_VERSION/docker-compose-$(uname -s)-$(uname -m)" > /usr/local/bin/docker-compose
(國際) sudo curl -L "https://github.com/docker/compose/releases/download/$LATEST_VERSION/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
第六步 添加 docker 鏡像源#
{
"registry-mirrors":[
"https://hub-mirror.c.163.com/",
"https://docker.mirrors.ustc.edu.cn/"
]
}
nano /etc/docker/daemon.json
systemctl daemon-reload
systemctl restart docker
第七步 非 docker.io 倉庫#
- hub-mirror 項目使用 docker.io 或其他鏡像服務來提供(但不限於) gcr.io、registry.k8s.io、k8s.gcr.io、quay.io、ghcr.io 等國外鏡像加速下載服務
- file-proxy 項目使用 Cloudflare Workers 進行代下服務
第八步 離線獲取容器鏡像示例#
wget https://raw.githubusercontent.com/NotGlop/docker-drag/master/docker_pull.py
python3 docker_pull.py nkpro/chrome-novnc@sha256:379ef4901f65495fb200b60fe2f87ba1346ce7df91cbe807365dba57c5dcd8d5
# 通過U盤轉移 nkpro_chrome-novnc.tar 到目標電腦上
docker load < nkpro_chrome-novnc.tar
docker images
docker tag ba39b3ae6c10 nkpro/chrome-novnc:latest
第九步 更新容器鏡像#
- sudo docker-compose pull && sudo docker-compose up -d --remove-orphans
- sudo docker image prune
附加 關閉系統自動更新#
nano /etc/update-manager/release-upgrades
,修改 Prompt 為 neversudo sed -i.bak 's/1/0/' /etc/apt/apt.conf.d/10periodic
sudo sed -i.bak 's/1/0/' /etc/apt/apt.conf.d/20auto-upgrades
sudo systemctl stop unattended-upgrades
sudo systemctl disable unattended-upgrades
sudo apt remove unattended-upgrades
sudo apt purge snapd
- 最後重啟伺服器
sudo reboot
附加 清理 Docker 容器日誌#
nano ~/clean_docker_log.sh && chmod +x ~/clean_docker_log.sh
sudo ~/clean_docker_log.sh
#!/bin/sh
echo "======== start clean docker containers logs ========"
logs=$(find /var/lib/docker/containers/ -name *-json.log)
for log in $logs
do
echo "clean logs : $log"
cat /dev/null > $log
done
echo "======== end clean docker containers logs ========"
附加 非 root 用戶#
Podman#
- 用到的時候再更新
Singularity#
singularity pull --name vep.sif docker://ensemblorg/ensembl-vep
mkdir $HOME/vep_data
singularity exec vep.sif vep --dir $HOME/vep_data --help