How to Setup Yum/DNF Local Repository on RHEL 9 Step-by-Step
3.6 هزار بار بازدید -
پارسال
-
In this video tutorial, I'm
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
sudo mount -o loop /root/rhel-baseos-9.1-x86_64-dvd.iso /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
sudo vi /etc/yum.repos.d/rhel.repo
add the following content
[BaseOS]
name=RHEL 9 - BaseOS
metadata_expire=-1
gpgcheck=1
enabled=1
baseurl=file:///var/www/html/localrepo/BaseOS/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[AppStream]
name=RHEL 9 - AppStream
metadata_expire=-1
gpgcheck=1
enabled=1
baseurl=file:///var/www/html/localrepo/AppStream/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Save and close the the file
Test local repositry by installing nginx package
Note: If you want to expose your local repository over the network using apache web server then add following content to rhel.repo file
[BaseOS]
name=RHEL 9 - BaseOS
metadata_expire=-1
gpgcheck=0
enabled=1
baseurl=http://192.168.1.2/localrepo/BaseOS/
[AppStream]
name=RHEL 9 - AppStream
metadata_expire=-1
gpgcheck=0
enabled=1
baseurl=http://192.168.1.2/localrepo/AppStream/
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
Edit /etc/httpd/conf/httpd.conf, look for DocumentRoot
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.
create /etc/yum.repos.d/rhel.repo
[BaseOS]
name=RHEL 9 - BaseOS
metadata_expire=-1
gpgcheck=0
enabled=1
baseurl=http://192.168.1.2/localrepo/BaseOS/
[AppStream]
name=RHEL 9 - AppStream
metadata_expire=-1
gpgcheck=0
enabled=1
baseurl=http://192.168.1.2/localrepo/AppStream/
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.
Web Site : www.linuxtechi.com
Youtube Channel : @linuxtechi9979
######################################
Thank you for Watching!!
######################################
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
sudo mount -o loop /root/rhel-baseos-9.1-x86_64-dvd.iso /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
sudo vi /etc/yum.repos.d/rhel.repo
add the following content
[BaseOS]
name=RHEL 9 - BaseOS
metadata_expire=-1
gpgcheck=1
enabled=1
baseurl=file:///var/www/html/localrepo/BaseOS/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[AppStream]
name=RHEL 9 - AppStream
metadata_expire=-1
gpgcheck=1
enabled=1
baseurl=file:///var/www/html/localrepo/AppStream/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Save and close the the file
Test local repositry by installing nginx package
Note: If you want to expose your local repository over the network using apache web server then add following content to rhel.repo file
[BaseOS]
name=RHEL 9 - BaseOS
metadata_expire=-1
gpgcheck=0
enabled=1
baseurl=http://192.168.1.2/localrepo/BaseOS/
[AppStream]
name=RHEL 9 - AppStream
metadata_expire=-1
gpgcheck=0
enabled=1
baseurl=http://192.168.1.2/localrepo/AppStream/
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
Edit /etc/httpd/conf/httpd.conf, look for DocumentRoot
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.
create /etc/yum.repos.d/rhel.repo
[BaseOS]
name=RHEL 9 - BaseOS
metadata_expire=-1
gpgcheck=0
enabled=1
baseurl=http://192.168.1.2/localrepo/BaseOS/
[AppStream]
name=RHEL 9 - AppStream
metadata_expire=-1
gpgcheck=0
enabled=1
baseurl=http://192.168.1.2/localrepo/AppStream/
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.
Web Site : www.linuxtechi.com
Youtube Channel : @linuxtechi9979
######################################
Thank you for Watching!!
######################################
پارسال
در تاریخ 1402/02/10 منتشر شده
است.
3,673
بـار بازدید شده