本文及资源最后更新时间 2020-11-30 by sky995
本篇文章仅以配置阿里云源为例,如需配置其他源可将地址替换为其它源,如清华:mirrors.tuna.tsinghua.edu.cn
一、CentOS 7 yum源
<span class="pln">rm </span><span class="pun">-</span><span class="pln">rf </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">yum</span><span class="pun">.</span><span class="pln">repos</span><span class="pun">.</span><span class="pln">d</span><span class="com">/*.repo #删除repo文件,或者自己备份 curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo yum makecache #更新缓存</span>
二、CentOS 6 yum源
<span class="pln">rm </span><span class="pun">-</span><span class="pln">rf </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">yum</span><span class="pun">.</span><span class="pln">repos</span><span class="pun">.</span><span class="pln">d</span><span class="com">/*.repo #删除repo文件,或者自己备份 curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo yum makecache #更新缓存</span>
三、Ubuntu 18 apt源
<span class="pln">mv </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">apt</span><span class="pun">/</span><span class="pln">sources</span><span class="pun">.</span><span class="pln">list</span><span class="pun">{,</span><span class="pln">bak</span><span class="pun">}</span> <span class="com">#备份sources.list</span><span class="pln"> cat </span><span class="pun">></span> <span class="str">/etc/</span><span class="pln">apt</span><span class="pun">/</span><span class="pln">sources</span><span class="pun">.</span><span class="pln">list </span><span class="pun"><<</span><span class="pln"> EOF deb http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse</span><span class="pln"> deb</span><span class="pun">-</span><span class="pln">src http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse</span><span class="pln"> deb http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse</span><span class="pln"> deb</span><span class="pun">-</span><span class="pln">src http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse</span><span class="pln"> deb http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse</span><span class="pln"> deb</span><span class="pun">-</span><span class="pln">src http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse</span><span class="pln"> deb http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse</span><span class="pln"> deb</span><span class="pun">-</span><span class="pln">src http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse</span><span class="pln"> deb http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse</span><span class="pln"> deb</span><span class="pun">-</span><span class="pln">src http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse</span><span class="pln"> EOF apt update</span>
四、Ubuntu 16 apt源
<span class="pln">mv </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">apt</span><span class="pun">/</span><span class="pln">sources</span><span class="pun">.</span><span class="pln">list</span><span class="pun">{,</span><span class="pln">bak</span><span class="pun">}</span> <span class="com">#备份sources.list</span><span class="pln"> cat </span><span class="pun">></span> <span class="str">/etc/</span><span class="pln">apt</span><span class="pun">/</span><span class="pln">sources</span><span class="pun">.</span><span class="pln">list </span><span class="pun"><<</span><span class="pln"> EOF deb http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/ubuntu/ xenial main</span><span class="pln"> deb</span><span class="pun">-</span><span class="pln">src http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/ubuntu/ xenial main</span><span class="pln"> deb http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/ubuntu/ xenial-updates main</span><span class="pln"> deb</span><span class="pun">-</span><span class="pln">src http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/ubuntu/ xenial-updates main</span><span class="pln"> deb http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/ubuntu/ xenial universe</span><span class="pln"> deb</span><span class="pun">-</span><span class="pln">src http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/ubuntu/ xenial universe</span><span class="pln"> deb http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/ubuntu/ xenial-updates universe</span><span class="pln"> deb</span><span class="pun">-</span><span class="pln">src http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/ubuntu/ xenial-updates universe</span><span class="pln"> deb http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/ubuntu/ xenial-security main</span><span class="pln"> deb</span><span class="pun">-</span><span class="pln">src http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/ubuntu/ xenial-security main</span><span class="pln"> deb http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/ubuntu/ xenial-security universe</span><span class="pln"> deb</span><span class="pun">-</span><span class="pln">src http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/ubuntu/ xenial-security universe</span><span class="pln"> EOF apt update</span>
五、Debian 9 apt源
<span class="pln">mv </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">apt</span><span class="pun">/</span><span class="pln">sources</span><span class="pun">.</span><span class="pln">list</span><span class="pun">{,</span><span class="pln">bak</span><span class="pun">}</span> <span class="com">#备份sources.list</span><span class="pln"> cat </span><span class="pun">></span> <span class="str">/etc/</span><span class="pln">apt</span><span class="pun">/</span><span class="pln">sources</span><span class="pun">.</span><span class="pln">list </span><span class="pun"><<</span><span class="pln"> EOF deb http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/debian/ stretch main non-free contrib</span><span class="pln"> deb</span><span class="pun">-</span><span class="pln">src http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/debian/ stretch main non-free contrib</span><span class="pln"> deb http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/debian-security stretch/updates main</span><span class="pln"> deb</span><span class="pun">-</span><span class="pln">src http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/debian-security stretch/updates main</span><span class="pln"> deb http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/debian/ stretch-updates main non-free contrib</span><span class="pln"> deb</span><span class="pun">-</span><span class="pln">src http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/debian/ stretch-updates main non-free contrib</span><span class="pln"> deb http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/debian/ stretch-backports main non-free contrib</span><span class="pln"> deb</span><span class="pun">-</span><span class="pln">src http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/debian/ stretch-backports main non-free contrib</span><span class="pln"> EOF apt update</span>
六、Debian 8 apt源
<span class="pln">mv </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">apt</span><span class="pun">/</span><span class="pln">sources</span><span class="pun">.</span><span class="pln">list</span><span class="pun">{,</span><span class="pln">bak</span><span class="pun">}</span> <span class="com">#备份sources.list</span><span class="pln"> cat </span><span class="pun">></span> <span class="str">/etc/</span><span class="pln">apt</span><span class="pun">/</span><span class="pln">sources</span><span class="pun">.</span><span class="pln">list </span><span class="pun"><<</span><span class="pln"> EOF deb http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/debian/ jessie main non-free contrib</span><span class="pln"> deb http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/debian/ jessie-proposed-updates main non-free contrib</span><span class="pln"> deb</span><span class="pun">-</span><span class="pln">src http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/debian/ jessie main non-free contrib</span><span class="pln"> deb</span><span class="pun">-</span><span class="pln">src http</span><span class="pun">:</span><span class="com">//mirrors.aliyun.com/debian/ jessie-proposed-updates main non-free contrib</span><span class="pln"> EOF apt update</span>