Create a local yum repository in RHEL8

Package management in Linux is very important thing to know. 
You must know how you can install, remove and upgrade packages.
But before that you must have an active repository on the
system. Let's we have a RHEL8 system, So we can have either a
RedHat Subscription to have repo or we can create a local repo
using ISO image. Here we will see how we can create a local
repo in RHEL8.

In RHEL8, we have two package repositories.

BaseOS
Application Stream

BaseOS repository have all OS packages where as Application
Stream has all application related packages.

Below are the steps to create a local repo using ISO. First
thing is that mount an connected ISO to your machine.
# mount /dev/cdrom /mnt

or

# mount -o loop /home/my-is-image.iso /mnt	(If you have ISO on system)
Create a directory named /repo and copy all content of /mnt in 
it.
# cp -a /mnt/* /repo/
Now create a .repo file in /etc/yum.repos.d/ with below details.
# cd /etc/yum.repos.d/

# vi local.repo
# cat local.repo

[AppStream]
name=AppStream
baseurl=file:///repo/AppStream
enabled=1
mediaid=None
metadata_expire=-1
gpgcheck=0
cost=500

[BaseOS]
name=BaseOS
baseurl=file:///repo/BaseOS
enabled=1
mediaid=None
metadata_expire=-1
gpgcheck=0
cost=500
Now you have enabled a local repo. Run commands to see repo and 
play with packages.
# dnf repolist
# dnf install elinks
Keep exploring. Continue reading on our blog.

RPM and YUM

Subscription Manager

One thought on “Create a local yum repository in RHEL8

  • Leave a Reply

    Your email address will not be published. Required fields are marked *