欢迎来到好人卡资源网,专注网络技术资源收集,我们不仅是网络资源的搬运工,也生产原创资源。寻找资源请留言

VPS服务器使用教程之CentOS/Ubuntu/Debian依赖源配置教程

linux sky995 2年前 (2020-11-30) 558次浏览 0个评论

本篇文章仅以配置阿里云源为例,如需配置其他源可将地址替换为其它源,如清华: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>

好人卡资源网 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:VPS服务器使用教程之CentOS/Ubuntu/Debian依赖源配置教程
喜欢 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址