根據本身的系統版本選擇複製粘貼執行便可
# 163yum源:(Centos五、六、7版本)ubuntu
cd /etc/yum.repos.d/
wget http://mirrors.163.com/.help/CentOS5-Base-163.repo
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
# 阿里雲yum源(Centos五、六、7版本)vim
CentOS 5
wget -O /etc/yum.repos.d/aliyun-CentOS5-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
wget -O /etc/yum.repos.d/aliyun-epel5.repo http://mirrors.aliyun.com/repo/epel-5.repo
CentOS 6
wget -O /etc/yum.repos.d/aliyun-CentOS6-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
wget -O /etc/yum.repos.d/aliyun-epel6.repo http://mirrors.aliyun.com/repo/epel-6.repo
CentOS 7
wget -O /etc/yum.repos.d/aliyun-CentOS7-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo wget -O /etc/yum.repos.d/aliyun-epel7.repo http://mirrors.aliyun.com/repo/epel-7.repo
#清除緩存,生成本地緩存,下次安裝速度快 yum clean all && yum makecache
ubuntu各版本更換apt源緩存
mv /etc/apt/sources.list /etc/apt/sources.list.bak
# 更改阿里源ionic
首先備份本地的源阿里雲
cp /etc/apt/sources.list /etc/apt/sources.list.bak-`date +%F`
#修改文件 刪除原有內容,添加下面內容spa
vim /etc/apt/sources.list
#Ubuntu 14.04.5 LTS deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
#Ubuntu 16.04 LTSrest
deb http://mirrors.aliyun.com/ubuntu/ xenial main deb-src http://mirrors.aliyun.com/ubuntu/ xenial main deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main deb http://mirrors.aliyun.com/ubuntu/ xenial universe deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe deb http://mirrors.aliyun.com/ubuntu/ xenial-security main deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe
#Ubuntu 18.04 LTS (bionic)code
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse # 更新apt源,讀取新apt源到本地 apt updata # 更新本地全部軟件包 apt upgrade