Learn how to setup Local Yum Repository in RHEL 8 with our step-by-step guide. Follow detailed instructions to configure a local repository for efficient package management on your RHEL 8 system. #centlinux #linux
A Local Yum Repository is a local storage location for RPM (Red Hat Package Manager) packages and metadata used by the Yum package manager to install, update, and manage software on Red Hat-based Linux distributions like RHEL 8 (Red Hat Enterprise Linux) and CentOS. It serves as an alternative to the remote repositories provided by Red Hat or other sources on the internet.
Here are several reasons why you might set up a local Yum repository:
A Local Yum Repository consists of:
createrepo
tool that include package lists, dependency information, and other data needed for package management.Recommended Online Training: Learn Bash Shell in Linux for Beginners
In the latest release of Red Hat Enterprise Linux (RHEL) 8, the legacy yum (Yellowdog Updater Modifier) has been replaced by Fedora package manager i.e. dnf (Dandified yum). Although, yum command is still available for backward compatibility, but it is actually an alias that is redirecting to dnf command.
As you aware that, Red Hat Enterprise Linux (RHEL) 8 is a commercial software and we need a paid subscription to access online yum repositories to install software packages.
However, we can also configure a local yum repository of our own. So, we can conveniently install software packages on our RHEL 8 system without having a paid subscription.
In this article, we will setup Local yum Repository in RHEL 8 server.
We have configured a Red hat Enterprise Linux (RHEL) 8 virtual machine with following specifications.
Copy RHEL 8 ISO file to our rhel-8-server.example.com.
# ls anaconda-ks.cfg rhel-8.0-x86_64-dvd.iso
Create a directory to mount rhel-8.0-x86_64-dvd.iso file.
# mkdir /mnt/iso
Persistently mount rhel-8.0-x86_64-dvd.iso at /mnt/iso directory.
# echo "/root/rhel-8.0-x86_64-dvd.iso /mnt/iso iso9660 defaults 0 0" >> /etc/fstab # mount -a mount: /mnt/iso: WARNING: device write-protected, mounted read-only.
In RHEL 8, the yum repository has been divided into two parts.
Add BaseOS section for our local yum repository.
# cat > /etc/yum.repos.d/localyum.repo << EOF > [localyum_BaseOS] > name=localyum_BaseOS > baseurl=file:///mnt/iso/BaseOS > enabled=1 > gpgcheck=1 > gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release > EOF
Add AppStream section for our local yum repository.
# cat >> /etc/yum.repos.d/localyum.repo << EOF > [localyum_AppStream] > name=localyum_AppStream > baseurl=file:///mnt/iso/AppStream > enabled=1 > gpgcheck=1 > gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release > EOF
Build cache for our local yum repository.
# dnf makecache Updating Subscription Management repositories. Unable to read consumer identity This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. localyum_AppStream 13 MB/s | 5.3 MB 00:00 localyum_BaseOS 13 MB/s | 2.2 MB 00:00 Metadata cache created.
Install Apache HTTP Server using dnf command.
# dnf install -y httpd
Our local yum repository is working fine. Now, we are going to share the same local yum repository to our network RHEL 8 clients.
For this purpose, we required Apache HTTP server (that we have installed already) and a couple of amendments in configurations of our local yum repository.
Put SELinux in permissive mode, so we can mount the ISO file in /var/www/html and the same can be accessible by the network clients.
# sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/sysconfig/selinux # setenforce permissive
Enable and start Apache HTTP Service.
# systemctl enable httpd.service Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service â /usr/lib/systemd/system/httpd.service. # systemctl start httpd.service
Allow HTTP service in Linux firewall.
# firewall-cmd --permanent --add-service=http success # firewall-cmd --reload success
Create a directory in /var/www/html to mount RHEL 8 ISO.
# mkdir /var/www/html/rhel8
Edit /etc/fstab file to change the mount point of /dev/cdrom.
/root/rhel-8.0-x86_64-dvd.iso /var/www/html/rhel8 iso9660 defaults 0 0
Remount the ISO file.
# mount -a mount: /var/www/html/rhel8: WARNING: device write-protected, mounted read-only.
Edit localyum.repo file and update baseurls as follows.
[localyum_BaseOS] name=localyum_BaseOS baseurl=http://192.168.116.165/rhel8/BaseOS enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release [localyum_AppStream] name=localyum_AppStream baseurl=http://192.168.116.165/rhel8/AppStream enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Rebuild yum cache.
# dnf clean all
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
12 files removed
# dnf makecache
Updating Subscription Management repositories.
Unable to read consumer identity This system is not registered to Red Hat Subscription Management.
You can use subscription-manager to register.
localyum_AppStream 24 MB/s | 5.3 MB 00:00
localyum_BaseOS 76 MB/s | 2.2 MB 00:00
Metadata cache created.
Check list of repositories on our RHEL 8 server.
# dnf repolist Updating Subscription Management repositories. Unable to read consumer identity This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Last metadata expiration check: 0:22:17 ago on Fri 05 Jul 2019 12:51:12 AM PKT. repo id repo name status localyum_AppStream localyum_AppStream 4,672 localyum_BaseOS localyum_BaseOS 1,658
If you are new to Linux and facing difficulty in working at Linux Bash prompt. We recommend that, you should read The Linux Command Line, 2nd Edition: A Complete Introduction by William Shotts.
If you found this guide on setting up a Local Yum Repository in RHEL 8 helpful and need further assistance with package management or other technical support, consider hiring a professional. Visit my Fiverr profile for expert services in repository management, system configuration, and more. Let’s work together to achieve your IT goals!
Learn how to change Apache document root in Linux by following this step-by-step guide. Adjust…
Discover how to change Apache port in Linux easily. Follow our simple guide to modify…
Learn how to create a virtual host in Apache Server with this comprehensive guide. Set…
Discover 10 practical tasks for the RHCSA exam with step-by-step solutions. Boost your Linux skills…
Discover the ultimate Fail2ban configuration guide. Learn how to set up, customize, and optimize Fail2ban…
Explore the ultimate guide to VPS servers and learn everything about Virtual Private Servers, including…
This website uses cookies.