1、删除redhat原有的yum
由于redhat 原来的yum 没有注册为redhat用户是用不了的。
rpm -aq|grep yum|xargs rpm -e --nodeps rpm -aq|grep python-iniparse|xargs rpm -e --nodeps 2、下载163的yum 安装包
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpmwget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpmwget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-158.el7.centos.noarch.rpmwget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpmwget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpmwget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-45.el7.noarch.rpm3、安装下载的rpm包
rpm -ivh .rpm
如果涌现依赖包的问题或者包冲突的问题,可以添加以下两个参数,进行强制安装。
--force 纵然覆盖属于其它包的文件也强制安装--nodeps 如果该RPM包的安装依赖其它包,纵然其它包没装,也强制安装。rpm -ivh --force --nodeps yum 终极的逼迫安装指令4、配置网络yum源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo sed -i 's/$releasever/7/g' /etc/yum.repos.d/CentOS-Base.repo yum clean all yum list5、yum配置文件
[base]name=CentOS-7 - Base - mirrors.aliyun.comfailovermethod=prioritybaseurl=http://mirrors.aliyun.com/centos/7/os/$basearch/ http://mirrors.aliyuncs.com/centos/7/os/$basearch/ http://mirrors.cloud.aliyuncs.com/centos/7/os/$basearch/gpgcheck=1gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #released updates [updates]name=CentOS-7 - Updates - mirrors.aliyun.comfailovermethod=prioritybaseurl=http://mirrors.aliyun.com/centos/7/updates/$basearch/ http://mirrors.aliyuncs.com/centos/7/updates/$basearch/ http://mirrors.cloud.aliyuncs.com/centos/7/updates/$basearch/gpgcheck=1gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful[extras]name=CentOS-7 - Extras - mirrors.aliyun.comfailovermethod=prioritybaseurl=http://mirrors.aliyun.com/centos/7/extras/$basearch/ http://mirrors.aliyuncs.com/centos/7/extras/$basearch/ http://mirrors.cloud.aliyuncs.com/centos/7/extras/$basearch/gpgcheck=1gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages[centosplus]name=CentOS-7 - Plus - mirrors.aliyun.comfailovermethod=prioritybaseurl=http://mirrors.aliyun.com/centos/7/centosplus/$basearch/ http://mirrors.aliyuncs.com/centos/7/centosplus/$basearch/ http://mirrors.cloud.aliyuncs.com/centos/7/centosplus/$basearch/gpgcheck=1enabled=0gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #contrib - packages by Centos Users[contrib]name=CentOS-7 - Contrib - mirrors.aliyun.comfailovermethod=prioritybaseurl=http://mirrors.aliyun.com/centos/7/contrib/$basearch/ http://mirrors.aliyuncs.com/centos/7/contrib/$basearch/ http://mirrors.cloud.aliyuncs.com/centos/7/contrib/$basearch/gpgcheck=1enabled=0gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
前面文章分享的配置yum源是在7以下版本的,本日禀享的是7以上的版本,大家可以试一下。
后面会分享更多devops和DBA方面的内容,感兴趣的朋友可以关注下~