0. 前置条件-添加host
vi /etc/hosts
### 追加一行 10.251.102.1 mirrors.shanhe.com
10.251.102.1 mirrors.shanhe.com
## 保存后退出 :wq
1. ubuntu18.04
cat > /etc/apt/sources.list << "EOF"
deb https://mirrors.shanhe.com/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.shanhe.com/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.shanhe.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.shanhe.com/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.shanhe.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.shanhe.com/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.shanhe.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.shanhe.com/ubuntu/ bionic-backports main restricted universe multiverse
## Not recommended
# deb http://mirrors.shanhe.com/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src http://mirrors.shanhe.com/ubuntu/ bionic-proposed main restricted universe multiverse
EOF
2. ubuntu20.04
cat > /etc/apt/sources.list << "EOF"
deb https://mirrors.shanhe.com/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.shanhe.com/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.shanhe.com/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.shanhe.com/ubuntu/ focal-security main restricted universe multiverse
deb https://mirrors.shanhe.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.shanhe.com/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.shanhe.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.shanhe.com/ubuntu/ focal-backports main restricted universe multiverse
## Not recommended
# deb http://mirrors.shanhe.com/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src http://mirrors.shanhe.com/ubuntu/ focal-proposed main restricted universe multiverse
EOF
3. ubuntu22.04
cat > /etc/apt/sources.list << "EOF"
deb https://mirrors.shanhe.com/ubuntu/ jammy main restricted universe multiverse
deb-src https://mirrors.shanhe.com/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.shanhe.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src https://mirrors.shanhe.com/ubuntu/ jammy-security main restricted universe multiverse
deb https://mirrors.shanhe.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src https://mirrors.shanhe.com/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.shanhe.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src https://mirrors.shanhe.com/ubuntu/ jammy-backports main restricted universe multiverse
## Not recommended
# deb http://mirrors.shanhe.com/ubuntu/ jammy-proposed main restricted universe multiverse
# deb-src http://mirrors.shanhe.com/ubuntu/ jammy-proposed main restricted universe multiverse
EOF
4. ubuntu24.04
echo "10.251.102.1 mirrors.shanhe.com" >> /etc/hosts
mv /etc/apt/sources.list /etc/apt/sources.list.bak
cat > /etc/apt/sources.list.d/ubuntu.sources << "EOF"
Types: deb
URIs: http://mirrors.shanhe.com/ubuntu/
Suites: noble noble-updates noble-backports
Components: main universe restricted multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
## Ubuntu security updates. Aside from URIs and Suites,
## this should mirror your choices in the previous section.
Types: deb
URIs: http://mirrors.shanhe.com/ubuntu/
Suites: noble-security
Components: main universe restricted multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
EOF
作者:admin 创建时间:2023-03-21 16:04
最后编辑:admin 更新时间:2025-04-03 10:17
最后编辑:admin 更新时间:2025-04-03 10:17