Ubuntu如何切换为清华镜像源

附上清华大学源的发布地址(该站包含Ubuntu、CnetOS、Fedora等主流Linux发行版下各版本的清华源):

 

第1步获取清华源信息:

打开下面的连接选择对应的系统版本,将会在页面生成对应的源信息

https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/

https://mirrors4.tuna.tsinghua.edu.cn/help/ubuntu/

ubuntu3604ffa2ad34cc41.png

第2步,备份原来的源文件:

#备份原来的源文件

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

第3步,写入清华源:

cat>/etc/apt/sources.list <<-EOF
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
EOF

第4步更新源:

apt-get update

阅读剩余
THE END