Install Yum in Linux Environment

If the following error occurs, it means you need to reinstall yum:

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
There are no enabled sources.
Execute "yum repolist all" to see the sources you own.
You can use yum-config-manager --enable  to enable the source

1.Check if it is installedyumbag. Check if RHELis installedyum, if it is installed, then what are there yumPackage:

 #rpm -qa |grep yum

2 Deleteredhatcomes withyumPackage

# rpm -qa|grep yum|xargs rpm -e --nodeps (do not check dependencies, directly delete the rpm package)
   #rpm -qa |grep yum (check confirmation)

3 Gohttp://mirrors.163.com/centos/7/os/x86_64/Packages/download the following file< /p>

Download:

yum-3.4.3-163.el7.centos.noarch.rpm

 yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm

 python-inotify-0.9.4-4.el7.noarch.rpm

4, createyumFileFolder

mkdir yumFile

5, will be downloaded4upload a file toyumFile span>Under the folder

rpm -ivh python-inotify-0.9.4-4.el7.noarch.rpm

rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

6, the installation is the following Error:

[email protected] yumFile]# rpm -ivh yum-3.4.3-163.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-52. el7.noarch.rpm

Warning:yum-3.4.3-163.el7.centos.noarch.rpm: HeadV3 RSA/SHA256 Signature, KeyID f4a80eb5: NOKEY

Error: Dependency check failed:

python-urlgrabber >= 3.10-8 yum-3.4.3-163.el7.centos.noarch required

rpm >= 0 :4.11.3-22 yum-3.4.3-163.el7.centos.noarch required

7, then run:

rpm -ivh yum-3.4.3- 163.el7.centos.noarch.rpm --force --nodeps yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm

8, modify the source file
(1 ) Enter the systemyumThe source directory: p>

 #cd /etc/yum.repos.d

(2) downloadyum span>Source:
Enter:http://mirrors.163 .com/.help/centos.htmlthere is a downloadable versionrepo< span style="font-family: 宋体;">File, Put in/etc/yum.repos.d/(Please make corresponding backup before operation)

(3) Modify CentOS6-Base-163.repo file< br>

vi CentOS6-Base-163.repo

  

# 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=$releasever&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=$releasever&arch=$basearch&repo=updates
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 may be useful
[extras]
name=CentOS-7-Extras-163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&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
"CentOS7-Base-163.repo" 41L, 1491C 

9, Importkey

rpm --import RPM-GPG-KEY-CentOS-7

10, runmakecache to generate cache

yum makecache 

11, run yum clean all (equivalent to yum cleanheaders; yum cleanpackages) ;

yum clean all

12, updateYUM file

yum update 

< /div>

13, whether the installation was successful
yum install dhcp -y
prompt to install, that means it’s fine.

The above content refers to the blogger: https://blog.csdn.net/chensongmol/article/details/84797453 The article, I wrote this blog mainly for the convenience of later viewing by myself

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
There are no enabled sources.
Execute "yum repolist all" to see the sources you own.
You can use yum-config-manager --enable  to enable the source

 #rpm -qa |grep yum

#rpm -qa|grep yum|xargs rpm -e --nodeps (do not check dependencies, delete rpm directly Bag)
   #rpm -qa |grep yum (check confirmation)

yum-3.4.3-163.el7.centos.noarch .rpm

 yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm

 python-inotify-0.9.4-4.el7.noarch.rpm

mkdir yumFile

rpm -ivh python-inotify-0.9.4-4.el7.noarch.rpm

rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

rpm -ivh yum -3.4.3-163.el7.centos.noarch.rpm --force --nodeps yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm

 #cd /etc/yum.repos.d

vi CentOS6-Base-163.repo

# 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=$releasever&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=$releasever&arch=$basearch&repo=updates
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 may be useful
[extras]
name=CentOS-7-Extras-163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&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
"CentOS7-Base-163.repo" 41L, 1491C 

rpm --import RPM-GPG- KEY-CentOS-7

yum makecache 

yum clean all

yum update 

Leave a Comment

Your email address will not be published.