Preface
Although the redhat system is installed by default with yum, the redhat update package is only valid for registered users. For us poor people, we have to manually change to the CentOS update package.
Initially searching for information on the Internet: Redhat 7 uses the Yum network source of CentOS 7
The basic process is:
- Remove the yum package that comes with redhat7.0 system.
- Download the required software package by oneself;
- Installation according to dependencies;
- Create a new repo configuration file.
Generally speaking, it can be used normally afterwards. You may also encounter some dependency issues, which will be mentioned later.
Technological process
1. View the yum package
[root@xhb yum.repos.d]# rpm -qa | grep yum
yum-utils-1.1.31-24.el7.noarch
yum-langpacks-0.4.2-3.el7.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-rhn-plugin-2.0.1-4.el7.noarch
PackageKit-yum-0.8.9-11.el7.x86_64
yum-3.4.3-118.el7.noarch
The packages listed below, remember, will be searched for the rpm packages to install the new version. For example, "yum-utils", "yum-langpacks" and so on.
2. Unload these installation packages
rpm -qa | grep yum | xargs rpm -e --nodeps
3. Guarantee the Normal Access to the Internet
ping www.baidu.com
4. Go to the following website to download the corresponding rpm package
Aliyun Network Source Address: https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/
Netease 163 Network Source Address: http://mirrors.163.com/
CentOS Network Source Address: http://centos.ustc.edu.cn/centos/
Use CTRL+F keywords to find the corresponding installation package.
5. Find the installation package and download it.
Owing to the large number of output results, the following instructions are omitted:
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-154.el7.centos.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-42.el7.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-updateonboot-1.1.31-42.el7.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-42.el7.noarch.rpm
6, installation
Input instruction rpm-ivh yum-*, encounter error, dependency problem.
[root@xhb Packages]# rpm -ivh yum-*
warning: yum-3.4.3-154.el7.centos.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
error: Failed dependencies:
rpm >= 0:4.11.3-22 is needed by yum-3.4.3-154.el7.centos.noarch
In addition, go back to find the installation package and download it:
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-4.11.3-25.el7.x86_64.rpm
Input instruction updates rpm:
rpm -Uvh rpm-4.11.3-25.el7.x86_64.rpm --nodeps
Run rpm-ivh yum-*again and you can install it properly.
[root@xhb Packages]# rpm -ivh yum-*
warning: yum-3.4.3-154.el7.centos.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:yum-metadata-parser-1.1.4-10.el7 ################################# [ 20%]
2:yum-plugin-fastestmirror-1.1.31-4################################# [ 40%]
3:yum-3.4.3-154.el7.centos ################################# [ 60%]
4:yum-updateonboot-1.1.31-42.el7 ################################# [ 80%]
5:yum-utils-1.1.31-42.el7 ################################# [100%]
7. New repo configuration file
Create repo files:
vim /etc/yum.repos.d/CentOS-Base.repo
Enter the following:
#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=$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=$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=$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
8. Test whether yum is successfully configured
Take a look at the next software:
[root@xhb yum.repos.d]# yum -y install tree
Loaded plugins: fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
base | 3.6 kB 00:00
extras | 3.4 kB 00:00
updates | 3.4 kB 00:00
(1/4): base/x86_64/group_gz | 156 kB 00:00
(2/4): extras/x86_64/primary_db | 166 kB 00:00
(3/4): base/x86_64/primary_db | 5.7 MB 00:02
(4/4): updates/x86_64/primary_db | 6.0 MB 00:02
Determining fastest mirrors
Resolving Dependencies
--> Running transaction check
---> Package tree.x86_64 0:1.6.0-10.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
tree x86_64 1.6.0-10.el7 base 46 k
Transaction Summary
================================================================================
Install 1 Package
Total download size: 46 k
Installed size: 87 k
Downloading packages:
warning: /var/cache/yum/x86_64/$releasever/base/packages/tree-1.6.0-10.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for tree-1.6.0-10.el7.x86_64.rpm is not installed
tree-1.6.0-10.el7.x86_64.rpm | 46 kB 00:00
Retrieving key from http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
Userid : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
From : http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
** Found 4 pre-existing rpmdb problem(s), 'yum check' output follows:
PackageKit-0.8.9-11.el7.x86_64 has missing requires of PackageKit-backend
rhn-check-2.0.2-5.el7.noarch has missing requires of yum-rhn-plugin >= ('0', '1.6.4', '1')
rpm-libs-4.11.1-16.el7.x86_64 has missing requires of rpm = ('0', '4.11.1', '16.el7')
rpm-python-4.11.1-16.el7.x86_64 has missing requires of rpm = ('0', '4.11.1', '16.el7')
Installing : tree-1.6.0-10.el7.x86_64 1/1
Verifying : tree-1.6.0-10.el7.x86_64 1/1
Installed:
tree.x86_64 0:1.6.0-10.el7
Complete!