修改软件源为国内加速镜像

来自:互联网
时间:2019-01-07
阅读:

通用

阿里云镜像 http://mirrors.aliyun.com

网易镜像 http://mirrors.163.com

搜狐镜像 http://mirrors.sohu.com

教育网

清华大学开源软件镜像 https://mirrors.tuna.tsinghua.edu.cn

中国科学技术大学开源软件镜像 https://mirrors.ustc.edu.cn

更多源

各系统软件源修改方法

CentOS

# 系统代号     版本
# squeeze     6.x
# wheezy      7.x
# jessie      8.x
# 备份原文件
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
# 下载新的CentOS-Base.repo 到/etc/yum.repos.d/
# CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
# CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
# CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
# 生成缓存
yum makecache

Debina

# 备份原文件
mv /etc/apt/sources.list /etc/apt/sources.list.bak
# 修改为阿里云的镜像源
cat > /etc/apt/sources.list << END
deb http://mirrors.aliyun.com/debian/ jessie mAIn non-free contrib
deb http://mirrors.aliyun.com/debian/ jessie-proposed-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ jessie main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ jessie-proposed-updates main non-free contrib
END
# 更新源列表信息
apt-get update

Ubuntu

# 系统代号      版本    LTS
# precise     12.04   true
# trusty      14.04   true
# vivid       15.04
# xenial      16.04   true
# zesty       17.04
# 备份原文件
mv /etc/apt/sources.list /etc/apt/sources.list.bak
# 修改为阿里云的镜像源
cat > /etc/apt/sources.list << END
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
END
# 更新源列表信息
apt-get update

Alpine

# 备份原始文件
cp /etc/apk/repositories /etc/apk/repositories.bak
# 修改为国内镜像源
echo "https://mirrors.aliyun.com/alpine/latest-stable/main/" > /etc/apk/repositories
返回顶部
顶部