Administrator
发布于 2026-05-17 / 3 阅读
0

镜像

Ubuntu20.04


#!/bin/bash



# 备份原有的软件源列表文件

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup.$(date +%Y%m%d%H%M%S)



# 写入阿里云的 Ubuntu 20.04 (focal) 镜像源

sudo tee /etc/apt/sources.list << 'EOF'

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释

deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

# deb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

# deb-src https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

# deb-src https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

# deb https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

# deb-src https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

# deb-src https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

EOF



# 更新软件包列表

sudo apt update