How to Setup Yum/DNF Local Repository on RHEL 9 Step-by-Step

preview_player
Показать описание
In this video tutorial, I'm going to show you how to set up a local YUM/DNF repository on RHEL 9 System.

First of all, what is a local YUM/DNF repository, and why would you want to setup local repository ? Well, a local repository is a collection of RPM packages that you can use to install or update packages on your system without having to connect to the internet. This is useful if you have multiple servers that need to be updated, or if you have limited bandwidth or no internet connection at all.

####### Steps to setup local yum/dnf repository ########

1) Install createrepo and httpd

sudo dnf install createrepo httpd -y

Remove the subscription

sudo subscription-manager unregister

2) Create a folder for local repositroy

sudo mkdir -p /var/www/html/localrepo

3) Mount RHEL 9 / 8 ISO file on /mnt

Now Copy contents for ISO files to /var/www/html/localrepo

sudo cp -av /mnt/* /var/www/html/localrepo

sudo createrepo /var/www/html/localrepo/

4) Create local yum/dnf repository file

add the following content

[BaseOS]
name=RHEL 9 - BaseOS
metadata_expire=-1
gpgcheck=1
enabled=1

[AppStream]
name=RHEL 9 - AppStream
metadata_expire=-1
gpgcheck=1
enabled=1

Save and close the the file

Test local repositry by installing nginx package

[BaseOS]
name=RHEL 9 - BaseOS
metadata_expire=-1
gpgcheck=0
enabled=1

[AppStream]
name=RHEL 9 - AppStream
metadata_expire=-1
gpgcheck=0
enabled=1

save and close the file.

5) Configure apache for serving your local yum/dnf repository

Allow apache web server's ports in firewall

sudo firewall-cmd --zone=public --permanent --add-service=http
sudo firewall-cmd --zone=public --permanent --add-service=https
sudo firewall-cmd --reload

Directory "/var/www/html"
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
Directory

Start Apache service
sudo systemctl start httpd
sudo systemctl enable httpd

Test installing net-tools locally first,

6) Test local repository over the network.

[BaseOS]
name=RHEL 9 - BaseOS
metadata_expire=-1
gpgcheck=0
enabled=1

[AppStream]
name=RHEL 9 - AppStream
metadata_expire=-1
gpgcheck=0
enabled=1

save and exit the file

Now try installing any package like nginx

If you found this guide useful, kindly do subscribe our channel and like the video.

######################################
Thank you for Watching!!
######################################
Рекомендации по теме
Комментарии
Автор

Well explained, worked in first go for me, good luck for next videos

aukha
Автор

Very useful content... suggestion.. video is blur.. please improve video and audio clarity.... Thanks for knowledge sharing...all the best

kiruthigasubramanian
Автор

Mount had error with absolute path.
mount -o loop -t iso9660 /media/cdrom
mount: /media/cdrom: failed to setup loop device for
had tp cd to directory and mount :
mount -o loop -t iso9660 rhel-9.3-x86_64-dvd.iso /media/cdrom
mount: /media/cdrom: WARNING: source write-protected, mounted read-only.

bonao