Centos使用163yum源配置

yum使用原理说明

默认yum源的基础配置见:/etc/yum.repos.d/CentOS-Base.repo,这个配置文件里有两个配置项目比较重要。mirrorlist配置是一系列yum仓库,会根据快慢自动选择一个。baseurl可以直接指定一个yum源。

mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/

mirrorlist实战,mirrorlist变量替换

http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock

下面链接的访问结果是,会从下列yum源挑选其中一个,但大部分对于国内来说是比较慢的:

http://repos.cianhost.net/centos/7.6.1810/os/x86_64/
http://ftp.cuhk.edu.hk/pub/Linux/centos/7.6.1810/os/x86_64/
http://repo.virtualhosting.hk/centos/7.6.1810/os/x86_64/
http://mirror-hk.koddos.net/centos/7.6.1810/os/x86_64/
http://mirror.sunnyvision.com/centos/7.6.1810/os/x86_64/
http://centos.01link.hk/7.6.1810/os/x86_64/
http://mirror.vpshosting.com.hk/pub/linux/centos/7.6.1810/os/x86_64/
http://centos.nethub.com.hk/7.6.1810/os/x86_64/
http://centos.uhost.hk/7.6.1810/os/x86_64/
http://centos.communilink.net/7.6.1810/os/x86_64/

建议直接使用baseurl指定163 yum源

[base]
name=CentOS-$releasever - Base - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

实践哥带领学习Linux运维
https://edu.51cto.com/sd/22232

你可能感兴趣的:(Centos使用163yum源配置)