导读 本文档以配置阿里云源为例,可将地址替换为其它源,如清华源地址:mirrors.tuna.tsinghua.edu.cn

本文档以配置阿里云源为例,可将地址替换为其它源,如清华源地址: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 //mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/epel.repo //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 //mirrors.aliyun.com/repo/Centos-6.repo
curl -o/etc/yum.repos.d/epel.repo //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 << EOF
deb //mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src //mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb //mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src //mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb //mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src //mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb //mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src //mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb //mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src //mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
EOF
apt update
Ubuntu 16 apt源
mv /etc/apt/sources.list{,bak} #备份sources.list
cat > /etc/apt/sources.list << EOF
deb //mirrors.aliyun.com/ubuntu/ xenial main
deb-src //mirrors.aliyun.com/ubuntu/ xenial main
deb //mirrors.aliyun.com/ubuntu/ xenial-updates main
deb-src //mirrors.aliyun.com/ubuntu/ xenial-updates main
deb //mirrors.aliyun.com/ubuntu/ xenial universe
deb-src //mirrors.aliyun.com/ubuntu/ xenial universe
deb //mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb-src //mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb //mirrors.aliyun.com/ubuntu/ xenial-security main
deb-src //mirrors.aliyun.com/ubuntu/ xenial-security main
deb //mirrors.aliyun.com/ubuntu/ xenial-security universe
deb-src //mirrors.aliyun.com/ubuntu/ xenial-security universe
EOF
apt update
Debian 9 apt源
mv /etc/apt/sources.list{,bak} #备份sources.list
cat > /etc/apt/sources.list << EOF
deb //mirrors.aliyun.com/debian/ stretch main non-free contrib
deb-src //mirrors.aliyun.com/debian/ stretch main non-free contrib
deb //mirrors.aliyun.com/debian-security stretch/updates main
deb-src //mirrors.aliyun.com/debian-security stretch/updates main
deb //mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb-src //mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb //mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
deb-src //mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
EOF
apt update
Debian 8 apt源
mv /etc/apt/sources.list{,bak} #备份sources.list
cat > /etc/apt/sources.list << EOF
deb //mirrors.aliyun.com/debian/ jessie main non-free contrib
deb //mirrors.aliyun.com/debian/ jessie-proposed-updates main non-free contrib
deb-src //mirrors.aliyun.com/debian/ jessie main non-free contrib
deb-src //mirrors.aliyun.com/debian/ jessie-proposed-updates main non-free contrib
EOF
apt update

原文来自:

本文地址://lrxjmw.cn/dependent-source-configuration.html编辑:J+1,审核员:逄增宝

Linux大全:

Linux系统大全:

红帽认证RHCE考试心得: