如何设置CentOS 6.x的yum源?

RHEL-Like

1 前言

CentOS 6.x由于已经超过官方的支持期限,所以当前大部分的yum源服务器都已经关闭,但vault的源仍然存在,所以我们可以重新定义源服务器指向该服务器来使用(可能会有点慢)。

2 最佳实践

2.1 清理旧的yum源定义

mkdir /etc/yum.repos.d/backup
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/backup/

2.2 重新定义yum源

vim /etc/yum.repos.d/CentOS-Base.repo

加入如下配置,

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# 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-6.10 - Base
baseurl=https://vault.centos.org/6.10/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-6.10 - Updates
baseurl=https://vault.centos.org/6.10/updates/$basearch/
gpgcheck=1
gpgkey=https://vault.centos.org/6.10/os/x86_64/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-6.10 - Extras
baseurl=https://vault.centos.org/6.10/extras/$basearch/
gpgcheck=1
gpgkey=https://vault.centos.org/6.10/os/x86_64/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.10 - Plus
baseurl=https://vault.centos.org/6.10/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://vault.centos.org/6.10/os/x86_64/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-6.10 - Contrib
baseurl=https://vault.centos.org/6.10/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://vault.centos.org/6.10/os/x86_64/RPM-GPG-KEY-CentOS-6

2.3 清理旧的缓存

yum clean all

2.4 尝试列出安装包

yum list
没有评论

发表回复

RHEL-Like
如何配置rsyncd服务?

1 前言 一个问题,一篇文章,一出故事。 由于笔者想实现文件通过rsync自动传输,但是又不想使用o …

RHEL-Like
如何用pam_google_authenticator认证模块实现SSH 2FA?

1 前言 一个问题,一篇文章,一出故事。 笔者想开启2FA以便增强SSH服务的安全性,于是便整理此文 …

RHEL-Like
如何升级RHEL clamav杀毒?

1 前言 一个问题,一篇文章,一出故事。 笔者需要卸载旧的病毒软件,然后更新rpm包的病毒软件,于是 …