Linux修改預設yum源為國內的阿里雲

2021-09-12 15:02:38 字數 1606 閱讀 8488

眾所周知,官方的yum源在國內訪問效果不佳,需要改為國內比較好的阿里雲yum源

首先確保安裝wget命令

yum install wget -y
# 備份當前的yum源

mv /etc/yum.repos.d /etc/yum.repos.d.backup4comex

# 新建空的yum源設定目錄

mkdir /etc/yum.repos.d

wget -o /etc/yum.repos.d/centos-base.repo

# 重建快取

yum clean all

yum makecache

centos-base.repo

# unless you are manually picking other mirrors.

## if the mirrorlist= does not work for you, as a fall back you can try the

# remarked out baseurl= line instead.##

[base]

name=centos-$releasever - base - mirrors.aliyun.com

failovermethod=priority

baseurl=

gpgcheck=1

gpgkey=

#released updates

[updates]

name=centos-$releasever - updates - mirrors.aliyun.com

failovermethod=priority

baseurl=

gpgcheck=1

gpgkey=

#additional packages that may be useful

[extras]

name=centos-$releasever - extras - mirrors.aliyun.com

failovermethod=priority

baseurl=

gpgcheck=1

gpgkey=

#additional packages that extend functionality of existing packages

[centosplus]

name=centos-$releasever - plus - mirrors.aliyun.com

failovermethod=priority

baseurl=

gpgcheck=1

enabled=0

gpgkey=

#contrib - packages by centos users

[contrib]

name=centos-$releasever - contrib - mirrors.aliyun.com

failovermethod=priority

baseurl=

gpgcheck=1

enabled=0

gpgkey=

修改CentOS預設yum源為國內yum映象源

修改centos預設yum源為mirrors.163.com 1 首先備份系統自帶yum源配置檔案 etc yum.repos.d centos base.repo 1 root localhost mv etc yum.repos.d centos base.repo etc yum.repos....

修改CentOS預設yum源為國內yum映象源

修改centos預設yum源為mirrors.163.com 1 首先備份系統自帶yum源配置檔案 etc yum.repos.d centos base.repo 1 root localhost mv etc yum.repos.d centos base.repo etc yum.repos....

修改CentOS預設yum源為國內yum映象源

修改centos預設yum源為mirrors.163.com 1 首先備份系統自帶yum源配置檔案 etc yum.repos.d centos base.repo mv etc yum.repos d centos base.repo etc yum.repos d centos base.rep...