背景:redhat7.5的yum服务是付费的,就无法愉快的使用yum安装软件,所以采取了替换为CentOs的yum工具
1.登录redhat查看yum
rpm -qa |grep yum
2.卸载yum
rpm -qa | grep yum | xargs rpm -e --nodeps
3.下载安装centos7的yum依赖
http://mirrors.163.com/centos/7/os/x86_64/Packages/
从上边的地址下载如下包,然后安装 rpm -ivh yum-* python-*
rpm -ivh yum-* 如果报错
选择一起安装, rpm -ivh 依赖的安装包 依赖的安装包1
检查是否安装成功 rpm -qa | grep yum
4.新建repo 配置文件
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-$7 - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=7&arch=7&arch=basearch&repo=os
baseurl=http://mirrors.163.com/centos/7/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$7 - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=7&arch=7&arch=basearch&repo=updates
baseurl=http://mirrors.163.com/centos/7/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$7 - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=7&arch=7&arch=basearch&repo=extras
baseurl=http://mirrors.163.com/centos/7/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$7 - Plus - 163.com
baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
5.清除缓存:
yum clean all
6.测试下yum是否可用
安装个wget试试,安装成功即可
以上~
网友评论