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

CentOS(RHEL)

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
没有评论

发表评论

CentOS(RHEL)
如何配置系统网桥?

1 前言 一个问题,一篇文章,一出故事。 笔者手里有一个1U的8端口服务器,正好当交换机用。 2 最 …

CentOS(RHEL)
如何修复非XFS文件系统逻辑坏道?

1 前言 一个问题,一篇文章,一出故事。 笔者服务器根分区出现逻辑坏道,于是整理此文。 另外,如果你 …

CentOS(RHEL)
如何破解CentOS或RHEL 7的root密码?

1 前言 一个问题,一篇文章,一出故事。 本章将讲述如何破解系统root的密码。 2 最佳实践 2. …