Ubuntu
Ubuntu20
- 备份源文件
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
- 编辑/etc/apt/sources.list
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# 以下安全更新软件源包含了官方源与镜像站配置,如有需要可自行修改注释切换
deb http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
Ubuntu server 24
- 备份源文件
sudo cp /etc/apt/sources.list.d/ubuntu.sources /etc/apt/sources.list.d/ubuntu.sources.bak
- 更换镜像源
# 以下两种方式二选一
## 方式一
sudo echo "Types: deb
URIs: http://mirrors.aliyun.com/ubuntu/
Suites: noble noble-updates noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg" > /etc/apt/sources.list.d/ubuntu.sources
## 方式二
sudo vim /etc/apt/sources.list.d/ubuntu.sources
# 输入阿里云
Types: deb
URIs: http://mirrors.aliyun.com/ubuntu/
Suites: noble noble-updates noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
# 清华
Types: deb
URIs: http://mirrors.tuna.tsinghua.edu.cn/ubuntu/
Suites: noble noble-updates noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
- 执行以下命令
sudo apt-get update
sudo apt-get upgrade
4.开启SSH
# ssh安装
sudo apt install openssh-server
# 开启ssh服务
sudo systemctl start ssh
# 开机自动启动ssh
sudo systemctl enable ssh
# 设置好后重启
reboot
# 查看ssh是否自动启动
sudo systemctl status ssh
# ftp
sudo apt install vsftpd
sudo systemctl start vsftpd
sudo systemctl enable vsftpd
sudo systemctl status vsftpd
Ubuntu 安装 Docker
- 卸载原有版本
sudo apt-get remove docker docker-engine docker-ce docker.io
sudo rm -rf /var/lib/docker
dpkg -l | grep docker
sudo apt-get purge docker-ce
- 更新索引包
sudo apt-get update
- 安装添加使用HTTPS传输软件包
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
4.添加软件源GPG密钥(中科大)
curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
5.向source.list添加Docker软件源
sudo add-apt-repository "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
6.更新索引包、且安装
sudo apt-get update
sudo apt-get install docker-ce
7.启动后台服务
sudo service docker start
- 查看Docker和Docker compose版本
docker version
docker compose version
- 镜像加速
sudo tee /etc/docker/daemon.json <<EOF
{
"registry-mirrors": ["https://dockerhub.icu"]
}
EOF
- 重启
service docker restart
标签:multiverse,sudo,apt,Ubuntu,ubuntu,docker,安装,deb
From: https://www.cnblogs.com/WTAGO/p/18353150