Construction and use of REDHAT YUM local source

Generally, there are two types of yum sources: local yum source and local network yum source. The former provides installation package through file, and the latter downloads installation package through network;

Because the yum source of RedHat 7.3 needs to be registered for payment, it often fails to download the yum source installation package, as shown in the following figure:

(1) Upload installation package

Transfer the installation package of Redhat to a path under root;

(2) Mount image file

Enter the directory of the installation package and execute:

mount -o loop rhel-server-7.3-x86_64-dvd.iso /cdrom

(3) Copy image file

#It is better to choose a path with large space

Implementation:

cp -r /cdrom /* /opt/yum/rhel-server-7.3-x86_64-dvd

(4) Generate repodata

cd /opt/yum/rhel-server-7.3-x86_64-dvd 
createrepo . 

repodata folder will be generated under / opt / Yum / rhel-server-7.3-x86 ʄ DVD. The following files are filelists.xml.gz other.xml.gz primary.xml.gz repomd.xml

(5) Configure the client / etc/yum.repos.d/source configuration file and create rhel-source.repo

[root@redhat73 selinux]# cd /etc/yum.repos.d/
[root@redhat73 yum.repos.d]# ls
dave.repo.bak  epel.repo.bak  epel-testing.repo.bak  redhat.repo  redhat.repo.bak  rhel-source.repo
[root@redhat73 yum.repos.d]# more rhel-source.repo 
[rhel-source]
baseurl=file:///opt/yum/rhel-server-7.3-x86_64-dvd
enabled=1
gpgcheck=0 
gpgkey=file:///opt/yum/rhel-server-7.3-x86_64-dvd/RPM-GPG-KEY-redhat-release

(6) Problems in the process of construction

There is an error running createrepo. Here is the error information

[root@localhost rhel-server-7.3-x86_64-dvd]# createrepo .

Traceback (most recent call last):

  File "/usr/share/createrepo/genpkgmetadata.py", line 28, in <module>

    import createrepo

  File "/usr/lib/python2.7/site-packages/createrepo/__init__.py", line 21, in <module>

    import yumbased

  File "/usr/lib/python2.7/site-packages/createrepo/yumbased.py", line 27, in <module>

    from yum.packages import YumLocalPackage

ImportError: No module named yum.packages

resolvent:

Execute the following three commands to install createrepo:

[root@localhost Packages]# rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
[root@localhost Packages]# rpm -ivh yum-3.4.3-150.el7.noarch.rpm
[root@localhost Packages]# rpm -ivh createrepo-0.9.9-26.el7.noarch.rpm

Finally, execute the createrepo. Command

 

Keywords: yum RHEL RPM xml

Added by pastet89 on Sat, 04 Jan 2020 08:12:55 +0200