Learn how to configure yum/dnf local repository local & http remote repository on RHEL 8 or CentOS 8 system. point a client to the yum / dnf remote repository.
Contents
sequel to the last lesson on configuring yum local repository on RHEL 7 and RHEL 8 where we explained in details the necessary and important parameters that should be in yum configuration file, this lesson will guide us on the step by step process of how to configure an http based yum remote repository on RHEL 8.
This activity is important for one to be able to install packages if your system is not subscribed.
I will be using two servers for this scenario.
Server A is the (Apache HTTP Server) : HQDEV1, 192.168.170.173
On this server, we will configure yum local repository and httpd based remote repository
Server B is the (client) : DRDEV1, 192.168.170.
on this server, we will create a yum configuration file that will point to the http server so that packages can be downloaded and installed on the client from the server.
Configuring Server A (yum local repository and HTTP based remote repository )
1. Copy the ISO image to your system
If the ISO image is not on your system already, you can use FileZilla or any other tool or method to move it to your system
2. Mount the ISO to any mount point, perherps “/mnt”
[root@HQDEV1]# mount rhel-8.1-x86_64-dvd.iso /mnt
3. copy the ISO image files to the any path you wish
In my case, I will make a directory (/iso_files) and copy it here
[root@HQDEV1 ~]# mkdir /iso_files
[root@HQDEV1 ~]# cd /mnt
[root@HQDEV1 mnt]# ls
AppStream EFI extra_files.json images media.repo RPM-GPG-KEY-redhat-release
BaseOS EULA GPL isolinux RPM-GPG-KEY-redhat-beta TRANS.TBL
[root@HQDEV1 mnt]# cp -va * /iso_files
4. create the repository configuration file
NOTE: It must have the extension, “.repo”
[root@HQDEV1 ~]# vi /etc/yum.repos.d/local.repo
[rhel8_Appstream]
baseurl=file:///iso_files/AppStream
gpgcheck=0
name=Red Hat Ent Linux App_stream
enable=1
[rhel8_BaseOS]
baseurl=file:///iso_files/BaseOS
gpgcheck=0
name=Red Hat Ent Linux BaseOS
enable=1
5. Verify the yum local repository is well configured
[root@HQDEV1 ~]# yum repolist
Updating Subscription Management repositories.
for x86_64 - BaseOS (RPMs) 4,834
rhel8_Appstream Red Hat Ent Linux App_stream 4,817
rhel8_BaseOS Red Hat Ent Linux BaseOS 1,661
6. Now Install the httpd server
[root@HQDEV1 ~]# yum install httpd
Updating Subscription Management repositories.
Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs) 3.4 kB/s | 4.5 kB 00:01
Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs) 4.9 kB/s | 4.1 kB 00:00
Red Hat CodeReady Linux Builder for R
7. start the service and enable if you wish
[root@HQDEV1 ~]# systemctl start httpd
7. Test if the httpd sever is working If it is possible, but if not, go to the next step
you can use any browser within your network
To use a browser, specify the IP
http://192.168.170.217
NB: If your system is subscribed, you can use the text based browser such as elinks. Installing elinks in RHEL 8 is now different from the way it is done in RHEL 7. click here to see the steps of installing elinks in RHEL 8
NOW THAT THE HTTPD SERVER IS STARTED, LET’s CONFIGURE HTTP SERVER FOR yum REMOTE REPOSITORY
11. copy the ISO image files to the httpd default document root location (/var/www/html).
[root@HQDEV1 ~]# cp -va /iso_files /var/www/html
[root@HQDEV1 ~]# cd /var/www/html/
[root@HQDEV1 html]# ls
iso_files tekneed
9. Verify the ISO Content is in the /var/www/html location
[root@HQDEV1 html]# cd iso_files/
[root@HQDEV1 iso_files]# ls
AppStream EFI extra_files.json images media.repo RPM-GPG-KEY-redhat-release
BaseOS EULA GPL isolinux RPM-GPG-KEY-redhat-beta TRANS.TBL
[root@HQDEV1 iso_files]#
10. Allow http service in the firewall rule
[root@HQDEV1 iso_files]# firewall-cmd --add-service=http --permanent
[root@HQDEV1 iso_files]# systemctl restart firewalld
Configuring Server B (Client )
1. Create the yum repository configuration file
NOTE: must have the extension, “.repo”
[root@DRDEV1 html]# vi /etc/yum.repos.d/remote..repo
[rhel8_Appstream_remote]
baseurl=http://192.168.170.173/iso_files/AppStream
gpgcheck=0
name=Red Hat Ent Linux App_stream remote
enable=1
[rhel8_BaseOS_remote]
baseurl=http://192.168.170.173/iso_files/BaseOS
gpgcheck=0
name=Red Hat Ent Linux BaseOS remote
enable=1
where IP is the httpd server IP. FQDN can also be used
2. Verify
[root@DRDEV1 ~]# yum repolist
Updating Subscription Management repositories.
for x86_64 - BaseOS (RPMs) 4,834
rhel8_Appstream Red Hat Ent Linux App_stream 4,817
rhel8_BaseOS Red Hat Ent Linux BaseOS 1,661
[root@HQDEV1 ~]#
3. If you wish, you can install any package for confirmation as well
[root@DRDEV1 ~]# yum install httpd
Updating Subscription Management repositories.
Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs) 3.4 kB/s | 4.5 kB 00:01
Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs) 4.9 kB/s | 4.1 kB 00:00
Red Hat CodeReady Linux Builder for R
NOTE
If you are getting the message “This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register” and you want to stop it, edit the (/etc/yum/pluginconf.d/subscription-manager.conf) file and change the parameter “enable” to 0
[root@HQDEV1 iso_files]# vi /etc/yum/pluginconf.d/subscription-manager.conf
[main]
enabled=0
# When following option is set to 1, then all repositories defined outside redhat.repo will be disabled
# every time subscription-manager plugin is triggered by dnf or yum
disable_system_repos=0
~
Your feedback is welcomed. If you love others, you will share with others
when i did the exam i used dnf config-manager –add-repo to add the url links to create repositories and when i enter dnf repolist it did show the new repos but i could not download any packeges, why ?. when i cheke repofile there is no gpgcheck=0. because i was panic i forget to manually put that. can someone help me?
Hi,
You should relax when taking the exam. You can manually input a value in the repo file if what you see after using “dnf config-manager –add-repo” is not what you desired.
If you bought the premium package, send an email to info@tekneed.com so we can schedule a meeting with you.
Thnaks