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

本篇文章仅以配置阿里云源为例,如需配置其他源可将地址替换为其它源,如清华:mirrors.tuna.tsinghua.edu.cn

一、CentOS 7 yum源

rm -rf /etc/yum.repos.d/*.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 #更新缓存

二、CentOS 6 yum源

rm -rf /etc/yum.repos.d/*.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 #更新缓存

三、Ubuntu 18 apt源

mv /etc/apt/sources.list{,bak} #备份sources.list
cat > /etc/apt/sources.list  /etc/apt/sources.list  /etc/apt/sources.list  /etc/apt/sources.list