There is no much difference in package management in RHEL 7 when we compared to RHEL 6 . We can set up the yum repository using the DVD or you can dump the DVD contents to the filesystem and set-up it. Later on , you can make that filesystem to be available on other systems using http or ftp to make the current server as yum central repository. In this article, we will see that how we can setup the yum repository on Redhat Enterprise Linux 7 using the DVD.
1.Login to Redhat Enterprise Linxu 7 . (RHEL7)
2. Create the new directory and mount the RHEL 7 DVD.
[root@UnixArena-RHEL7]# mkdir /rhel7-repo/ [root@UnixArena-RHEL7]# mount /dev/cdrom /rhel7-repo/ [root@UnixArena-RHEL7]# cd /rhel7-repo/ [root@UnixArena-RHEL7 rhel7-repo ]# ls -lrt total 812 -r--r--r--. 1 root root 18092 Mar 6 2012 GPL -r--r--r--. 1 root root 3211 Apr 1 2014 RPM-GPG-KEY-redhat-release -r--r--r--. 1 root root 3375 Apr 1 2014 RPM-GPG-KEY-redhat-beta -r--r--r--. 1 root root 8266 Apr 4 2014 EULA -r--r--r--. 1 root root 108 May 7 2014 media.repo -r--r--r--. 1 root root 1568 May 7 2014 TRANS.TBL dr-xr-xr-x. 2 root root 4096 May 7 2014 repodata dr-xr-xr-x. 24 root root 6144 May 7 2014 release-notes dr-xr-xr-x. 2 root root 774144 May 7 2014 Packages dr-xr-xr-x. 2 root root 2048 May 7 2014 LiveOS dr-xr-xr-x. 2 root root 2048 May 7 2014 isolinux dr-xr-xr-x. 3 root root 2048 May 7 2014 images dr-xr-xr-x. 3 root root 2048 May 7 2014 EFI dr-xr-xr-x. 4 root root 2048 May 7 2014 addons [root@UnixArena-RHEL7 rhel7-repo]#
3.Navigate to /etc/yum.repos.d/ directory .
4. Create a new file with below contents with extension of “.repo” .
[root@UnixArena-RHEL7 yum.repos.d]# cat unixarena-rhel7.repo [rhel7_dvd] gpgcheck = 0 enabled = 1 baseurl = file:///rhel7-repo name = unixarena-repo [root@UnixArena-RHEL7 yum.repos.d]#
5. Run “yum clean all”
[root@UnixArena-RHEL7 yum.repos.d]# yum clean all Loaded plugins: langpacks, product-id, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Cleaning repos: rhel7_dvd Cleaning up everything [root@UnixArena-RHEL7 yum.repos.d]#
6.Test the new yum repository by installing new package.
[root@UnixArena-RHEL7 yum.repos.d]# yum install telnet Loaded plugins: langpacks, product-id, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. rhel7_dvd | 4.1 kB 00:00:00 (1/2): rhel7_dvd/group_gz | 134 kB 00:00:00 (2/2): rhel7_dvd/primary_db | 3.4 MB 00:00:00 Resolving Dependencies --> Running transaction check ---> Package telnet.x86_64 1:0.17-59.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================ Package Arch Version Repository Size ============================================================================================ Installing: telnet x86_64 1:0.17-59.el7 rhel7_dvd 63 k Transaction Summary ============================================================================================ Install 1 Package Total download size: 63 k Installed size: 113 k Is this ok [y/d/N]: y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : 1:telnet-0.17-59.el7.x86_64 1/1 rhel7_dvd/productid | 1.6 kB 00:00:00 Verifying : 1:telnet-0.17-59.el7.x86_64 1/1 Installed: telnet.x86_64 1:0.17-59.el7 Complete! [root@UnixArena-RHEL7 yum.repos.d]#
This test shows that we have successfully configured the Redhat Enterprise Linux 7’s yum repository using the DVD/ISO image.
Share it ! Comment it !! Be Sociable !!!.
MD. YEASIN MIRAZ says
Hello sir,
When I like copy all repos to folder like under /var/ftp/pub what would be baseurl=?
Sivakumar Sadhasivannair says
Perfectly its working fine in RHEL 7.. Thanks for sharing it…
I agree there are different ways to do it local repository.
Choti says
Awesum works perfectly thanks 🙂
Mark says
How is this question being set in the RHCSA exam since we wont be creating a yum repo from the DVD iso image??
Aman Ullah says
This Method is wrong for local RHEL yum.
Use This one:
1. yum install createrepo -y
2. createrepo –database /your/package/location
3. yum-config-manager –add-repo http/ftp:your server IP/URL
4. Add GPG key as follows: ‘rpm –import http / ftp ://x.x.x.x/RHEL/7/RPM-GPG-KEY-redhat-release’ in client machine
That’s it.
🙂
Lingeswaran R says
There are multiple ways to configure yum repository.
I have used RHEL 7 ISO image to act as local yum repo. By default DVD ships with required repo database & gpg keys.
If you ISO image , you no need to create any db. (Offcouse ISO is read only. You can’t write anything to that) .
Have tried what I have demonstrated in this article ? Do you think that this will not work ?
Regards
Lingesh