RedHat7.6 yum source配置

环境准备

  • RHEL7.6,已联网

一、查询已安装的yum

•   rpm -qa | grep yum

二、使用root权限卸载已安装的yum源

rpm -qa | grep yum | xargs rpm -e --nodeps

三、下载并安装阿里的yum源rpm包

# 创建安放rpm包的文件夹
cd /etc/yum.repos.d/
mkdir yum-rpm && cd yum-rpm
# 下载rpm包
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-3.4.3-163.el7.centos.noarch.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-52.el7.noarch.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-9.el7.noarch.rpm

如果失效,请在阿里云CentOS-yum源库寻找最新的rpm包

四、安装rpm包

cd /etc/yum.repos.d/yum-rpm
rpm -ivh *.rpm  --force --nodeps

五、下载阿里镜像到/etc/yum.repos.d/目录下

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

六、修改Centos-7.repo文件将所有$releasever替换为7

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

:%s/$releasever/7/g

七、运行以下命令

yum clean all 
yum makecache
yum update

博文原文参看:https://www.jianshu.com/p/4b1a98f0e1ca

你可能感兴趣的:(RedHat7.6 yum source配置)