1.首先配置国内本地镜像源

打开源文件

 nano /etc/apt/sources.list

复制导入清华源

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware

# 以下安全更新软件源包含了官方源与镜像站配置,如有需要可自行修改注释切换
deb https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
deb-src https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware

重新拉一下索引文件

sudo apt update

更新依赖

 sudo apt-get upgrade

2.安装Vim

sudo apt-get install vim

3.以root身份通过ssh登录操作系统

修改

vim /etc/ssh/sshd_config
#PermitRootLogin prohibit-password
#修改为
PermitRootLogin yes
#重启ssh即可
sudo service ssh restart

4.Debian系统比较干净,安装常用的软件

apt install wget curl sudo vim git -y

更新、安装必备软件

apt-get update && apt-get install -y wget vim

5.大陆机器安装Docker和docker-compose

由于网络问题,我们只能尝试使用国内的Docker镜像源。

步骤1:添加阿里云的Docker GPG密钥

curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

步骤2:配置阿里云的Docker APT源

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://mirrors.aliyun.com/docker-ce/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

步骤3:更新APT包索引

sudo apt-get update

步骤4:安装Docker引擎

sudo apt-get install docker-ce docker-ce-cli containerd.io

等安装好之后,输入:

docker -v      #查看docker的版本号

docker compose version   #查看docker compose的版本号,注意新版本没有-啦
cat > /etc/docker/daemon.json <<EOF
{
    "log-driver": "json-file",
    "log-opts": {
        "max-size": "20m",
        "max-file": "3"
    },
    "ipv6": true,
    "fixed-cidr-v6": "fd00:dead:beef:c0::/80",
    "experimental":true,
    "ip6tables":true,
    "registry-mirrors": [
      "https://docker.m.daocloud.io",
      "https://dockerhub.icu",
      "https://docker.anyhub.us.kg",
      "https://docker.1panel.live"
    ]
}
EOF

然后重启一下daemon和docker服务:

sudo systemctl daemon-reload		#重启daemon进程
sudo systemctl restart docker		#重启docker

设置一下docker开机自动启动:

systemctl enable docker

但是可能pull不了会出现问题

解决docker-compose: command not found问题的方法

sudo apt  install docker-compose

最后使用 docker-compose -version 命令查看是否安装成功