redhat6.7 yum network source configuration

The yum source provided by RedHat can only be used after the current system has registered RHN. If there is no registration, when using yum, you will be prompted to register RHN

If RHN is not registered, it means that we cannot use the yum source of RedHat. At this time, we can use the yum source of CentOS system. Here, take configuring Netease 163yum source as an example.

1. First uninstall the yum program of RedHat resources

[root@Oracle12CDB yum.repos.d]# rpm -qa|grep yum|xargs rpm -e --nodeps
[root@Oracle12CDB yum.repos.d]# rpm -aq|grep python-iniparse|xargs rpm -e --nodeps

2. Delete the source of RedHat yum

[root@Oracle12CDB ~]# cd /etc/yum.repos.d/
[root@Oracle12CDB yum.repos.d]# ls
redhat.repo  rhel-source.repo
[root@Oracle12CDB yum.repos.d]# rm -rf *

3. Install the CentOS source. rpm package requires the installation sequence. I successfully installed it in the following sequence.

rpm -ivh http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm                      
rpm -ivh http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm                  
rpm -ivh http://mirrors.163.com/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm -nodeps --force    

#The following two packages failed to be installed separately, and they were installed together
rpm -ivh http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm \             
http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm
Here, install yum plugin fastestmirror first, which indicates that the package change depends on yum package, and when installing yum package, it indicates that the package depends on yum plugin fastestmirror package, so two packages are installed together directly

4. Create repo file

[root@Oracle12CDB yum.repos.d]# pwd
/etc/yum.repos.d
[root@Oracle12CDB yum.repos.d]# ls
centos6.repo  redhat.repo

Here are two files

redhat.repo has no content, don't worry. centos6.repo is as follows:

[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.163.com/centos/6/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/6/os/x86_64/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.163.com/centos/6/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/6/os/x86_64/RPM-GPG-KEY-CentOS-6


[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.163.com/centos/6/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/6/os/x86_64/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://mirrors.163.com/centos/6./centosplus/$basearch/
gpgcheck=1
enabled=0

5. Clear cache, re cache, update

[root@Oracle12CDB yum.repos.d]# yum clean all
[root@Oracle12CDB yum.repos.d]# yum makecache
[root@Oracle12CDB yum.repos.d]# yum update

 

[finish]

Tags: PHP yum CentOS RPM Python

Posted on Mon, 04 Nov 2019 14:02:25 -0500 by drag0n