CentOS 7 更新源 YUM存储库
- [CentOS 系统版本](#CentOS 系统版本)
- [1 备份现有的YUM存储库文件](#1 备份现有的YUM存储库文件)
- [2 创建新的CentOS-Base.repo文件](#2 创建新的CentOS-Base.repo文件)
- [3 清理YUM缓存并更新YUM数据库](#3 清理YUM缓存并更新YUM数据库)
- [4 启用EPEL存储库](#4 启用EPEL存储库)
- [5 更新YUM缓存](#5 更新YUM缓存)
- [6 安装htop](#6 安装htop)
CentOS 系统版本
go
# cat /etc/redhat-release
CentOS Linux release 7.8.2003 (Core)
1 备份现有的YUM存储库文件
go
mkdir -p /etc/yum.repos.d/backup
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/backup/
2 创建新的CentOS-Base.repo文件
go
vim /etc/yum.repos.d/CentOS-Base.repo
go
[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
3 清理YUM缓存并更新YUM数据库
go
yum clean all
yum makecache
4 启用EPEL存储库
go
yum install epel-release -y
5 更新YUM缓存
go
yum makecache
6 安装htop
go
yum install htop -y