cancel
Showing results for 
Search instead for 
Did you mean: 
  • 20.4K Views

Create a local repo in RHEL 9

Jump to solution

I have been struggling for days to be able to create a local repo in RHEL 9. Could someone please show me the correct steps with the same format that is on the exam?

1 Solution

Accepted Solutions
Chetan_Tiwary_
Community Manager
Community Manager
  • 20.4K Views

Hello @kylemuncie !
Thanks for reaching out !

Due to the NDA - discussions about exam scenarios is out of bound for us.

However, generally speaking - To create a local repo in RHEL 9, you have to do the following steps in a nutshell :

a. Mount the RHEL 9 ISO file ( download it from here : https://access.redhat.com/downloads/content/479/ver=/rhel---9/9.0/x86_64/product-software )  to a directory 

#mkdir -p /mnt/disc
# mount -o loop rhel-baseos-9.0-x86_64-dvd.iso /mnt/disc 

b. You need to create a local repository file in  “/etc/yum.repos.d” directory. This file will define the location of your local repository. Create a file with a name but with a .repo extension , eg.  rhel9.repo   with the correct file paths as per your system. The content of  /etc/yum.repos.d/rhel9.repo will look something like this 

# vi /etc/yum.repos.d/rhel9.repo 
[BaseOS]
name=BaseOS Packages Red Hat Enterprise Linux 9
metadata_expire=-1
gpgcheck=1
enabled=1
baseurl=file:///mnt/disc/BaseOS/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[AppStream]
name=AppStream Packages Red Hat Enterprise Linux 9
metadata_expire=-1
gpgcheck=1
enabled=1
baseurl=file:///mnt/disc/AppStream/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

c. Update the package index : #dnf clean all 

                                                 #dnf repolist

d. Done ! If everything is ok and without any issues , you can start installing packages with 

#dnf install <package-name>

#dnf check-update 

 

Refer : https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html-single/managing_softwa... 

 

 

View solution in original post

8 Replies
Chetan_Tiwary_
Community Manager
Community Manager
  • 20.4K Views

Hello @kylemuncie !
Thanks for reaching out !

Due to the NDA - discussions about exam scenarios is out of bound for us.

However, generally speaking - To create a local repo in RHEL 9, you have to do the following steps in a nutshell :

a. Mount the RHEL 9 ISO file ( download it from here : https://access.redhat.com/downloads/content/479/ver=/rhel---9/9.0/x86_64/product-software )  to a directory 

#mkdir -p /mnt/disc
# mount -o loop rhel-baseos-9.0-x86_64-dvd.iso /mnt/disc 

b. You need to create a local repository file in  “/etc/yum.repos.d” directory. This file will define the location of your local repository. Create a file with a name but with a .repo extension , eg.  rhel9.repo   with the correct file paths as per your system. The content of  /etc/yum.repos.d/rhel9.repo will look something like this 

# vi /etc/yum.repos.d/rhel9.repo 
[BaseOS]
name=BaseOS Packages Red Hat Enterprise Linux 9
metadata_expire=-1
gpgcheck=1
enabled=1
baseurl=file:///mnt/disc/BaseOS/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[AppStream]
name=AppStream Packages Red Hat Enterprise Linux 9
metadata_expire=-1
gpgcheck=1
enabled=1
baseurl=file:///mnt/disc/AppStream/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

c. Update the package index : #dnf clean all 

                                                 #dnf repolist

d. Done ! If everything is ok and without any issues , you can start installing packages with 

#dnf install <package-name>

#dnf check-update 

 

Refer : https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html-single/managing_softwa... 

 

 

Trevor
Starfighter Starfighter
Starfighter
  • 20.3K Views

Chetan has provided another complete and easy to
follow explanation.  I'll just add one something, that is
the equivalent of sprinkling a little salt on a gourmet
meal:

sudo  yum  list  available
- this will simply list all of the packages in all repos

 

 

Trevor "Red Hat Evangelist" Chandler
Chetan_Tiwary_
Community Manager
Community Manager
  • 20.3K Views

Thanks @Trevor for your addition. 

and one can use grep to filter out packages available only in a specific repo eg. epel repo :

yum list available | grep epel

0 Kudos
kmuncie
Cadet
Cadet
  • 19.8K Views

Hello @Chetan_Tiwary_ ,

I think my question is about part a now... I am currently booted in a VirtualBox instance of red hat 9.3. Inside of the vm, do i need to go into firefox and download that dvd.iso file or should it already be availiable? 
I am trying these two commands and it is giving me a failure to setup loop device for it:
#mkdir -p /mnt/disc
# mount -o loop rhel-baseos-9.3-x86_64-dvd.iso /mnt/disc 

I am using locate to see if I have the dvd.iso but it returns nothing:
# locate rhel-baseos-9.3-x86_64-dvd.iso

 

Thank you for the help!

Chetan_Tiwary_
Community Manager
Community Manager
  • 19.8K Views

Yes, you have to download the ISO through a browser and then you can proceed with the next steps. 

Wasim_Raja
Moderator
Moderator
  • 19.7K Views

As usual perfect explanation @Chetan_Tiwary_ 

nathan_p
Cadet
Cadet
  • 12.8K Views

Hey! Apologies for being late to the party.

Out of interest would you need to persistently mount the iso file, via fstab, for the repo to work after a reboot? 

Thanks!

0 Kudos
spelchk
Mission Specialist
Mission Specialist
  • 15.4K Views

Question, 

Correction, for a remote DVD repository, would you need to enter gpgkey? if so, would you still point to /etc/pki/rpm-gpg or would you point to http://x.x.x.x/dvd/RPM-GPG

Join the discussion
You must log in to join this conversation.