Skip to content

Instantly share code, notes, and snippets.

@yusureabc
Last active February 12, 2021 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yusureabc/fb444229193b56c758aea7c277ea4c7f to your computer and use it in GitHub Desktop.
Save yusureabc/fb444229193b56c758aea7c277ea4c7f to your computer and use it in GitHub Desktop.
ubuntu 16.04换阿里云源
cd /etc/apt/
cp sources.list sources.list.bak
# 替换以下文件 #
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
##测试版源
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
# 源码
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
##测试版源
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
第三步:更新源和软件
sudo apt-get update 更新源
sudo apt-get upgrade 更新软件
# https://www.skiy.net/201805035157.html
sudo vi /etc/apt/sources.list
:%s#cn\.archive\.ubuntu\.com#mirrors\.aliyun\.com#g
sudo apt update
@zhangguanzhang
Copy link

cp /etc/apt/sources.list /etc/apt/sourses.list.backup && \
    sed -ri 's#[^/]+?.ubuntu.com#mirrors.aliyun.com#' /etc/apt/sources.list

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment