在CentOS 7中配置国内源可以提高软件包安装和更新的速度。以下是配置中国科技大学源的步骤:
首先备份你当前的YUM仓库配置,以防需要恢复:
cp -ar /etc/yum.repos.d /etc/yum.repos.d.bak
清理原有的YUM仓库配置:
rm -f /etc/yum.repos.d/*.repo
新建一个新的YUM仓库配置文件,例如CentOS-Base.repo:
vi /etc/yum.repos.d/CentOS-Base.repo
将以下内容复制并粘贴到该文件中:
[base]
name=CentOS-$releasever - Base - 科技大学
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
enabled=1
gpgcheck=1
gpgkey=https://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates - 科技大学
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
enabled=1
gpgcheck=1
gpgkey=https://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 科技大学
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
enabled=1
gpgcheck=1
gpgkey=https://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - 科技大学
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
enabled=1
gpgcheck=1
gpgkey=https://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-7
保存文件并退出编辑器。
清除YUM缓存并列出可用的仓库:
sudo yum clean all
sudo yum repolist enabled
这样就配置好了中国科技大学的YUM仓库,可以使用yum或dnf进行软件的安装和更新。
标签:中国科技大学,basearch,centos,CentOS,配置,centos7,mirrorlist,releasever,edu From: https://www.cnblogs.com/windlog/p/18332466