本文节选自阿里云提供的更新源脚本,请以 root 用户操作如果使用的是阿里云服务器,将源的域名从 mirrors.aliyun.com 改为 mirrors.aliyuncs.com,不占用公网流量。
.
- 本文节选自阿里云提供的更新源脚本,请以 root 用户操作
- 如果使用的是阿里云服务器,将源的域名从 mirrors.aliyun.com 改为 mirrors.aliyuncs.com,不占用公网流量。详见这里
CentOS
版本:5、6、7
# centos5.xwget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repowget -qO /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-5.repoyum clean metadatayum makecache
Ubuntu
版本:12.04 precise、14.04 trusty、16.04 xenial、17.04 zesty
cp -fp /etc/apt/sources.list /etc/apt/sources.list.backcat > /etc/apt/sources.list <<EOF# 14.04deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverseEOFapt-get update
Debian
版本:6 squeeze、7 wheezy、8 jessie
cp -fp /etc/apt/sources.list /etc/apt/sources.list.backcat > /etc/apt/sources.list <<EOF#debian8deb http://mirrors.aliyun.com/debian/ jessie main non-free contribdeb http://mirrors.aliyun.com/debian/ jessie-proposed-updates main non-free contribdeb-src http://mirrors.aliyun.com/debian/ jessie main non-free contribdeb-src http://mirrors.aliyun.com/debian/ jessie-proposed-updates main non-free contribEOFapt-get update