{"id":1762,"date":"2012-01-24T00:35:05","date_gmt":"2012-01-23T16:35:05","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=1762"},"modified":"2023-04-28T09:49:57","modified_gmt":"2023-04-28T09:49:57","slug":"how-to-setup-local-yum-repository-from-cd-romdvd-rom-image-on-rhel-6","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/how-to-setup-local-yum-repository-from-cd-romdvd-rom-image-on-rhel-6\/","title":{"rendered":"How to Setup Local Yum Repository from CD-ROM\/DVD-ROM image on RHEL 6"},"content":{"rendered":"<p>In this article, I will share about how to update and install RPM packages from the image CD-ROM\/DVD-ROM in Red Hat Enterprise Linux 6 (RHEL 6). This step can also be used on CentOS 6 or older versions such as CentOS 5. It would be very useful if the server you have a slow internet connection, or no internet connection. Instead of using internet connection directly to RHEL repositories registered, it is possible to use the Local CD\/DVD- ROM as your yum repository. There are two methods to install and configure local yum repository RHEL 6. Both methods have been tested and works well on Linux RHEL 6 server. You can choose whichever method you choose :<\/p>\n<p><strong>Method 1:<\/strong><br \/>\n1. Insert DVD\/ISO into DVD-Drive.<br \/>\n2. Mount the ISO from the DVD-ROM into \/mnt directory :<\/p>\n<ol>\n<pre class=\"code\">\n[root@rhel6 ~]# mount \/dev\/cdrom \/mnt\nmount: block device \/dev\/sr0 is write-protected, mounting read-only\n<\/pre>\n<\/ol>\n<p>3. Check the existing partition on your RHEL 6 server :<\/p>\n<ol>\n<pre class=\"code\">\n[root@rhel6 ~]# df\nFilesystem           1K-blocks      Used Available Use% Mounted on\n\/dev\/mapper\/VolGroup-lv_root\n                       9845280   1328824   8016336  15% \/\ntmpfs                   515660         0    515660   0% \/dev\/shm\n\/dev\/sda1               495844     28689    441555   7% \/boot\n\/dev\/sr0               2862360   2862360         0 100% \/mnt\n<\/pre>\n<\/ol>\n<p>4. Go to \/mnt and check current directory :<\/p>\n<ol>\n<pre class=\"code\">\n[root@rhel6 ~]# cd \/mnt\n[root@rhel6 mnt]# pwd\n\/mnt\n<\/pre>\n<\/ol>\n<p>5. List out what is in DVD.<\/p>\n<ol>\n<pre class=\"code\">\n[root@rhel6 mnt]# ls\nEULA                      RELEASE-NOTES-es-ES.html  RELEASE-NOTES-ru-RU.html\nGPL                       RELEASE-NOTES-fr-FR.html  RELEASE-NOTES-si-LK.html\nHighAvailability          RELEASE-NOTES-gu-IN.html  RELEASE-NOTES-ta-IN.html\nimages                    RELEASE-NOTES-hi-IN.html  RELEASE-NOTES-te-IN.html\nisolinux                  RELEASE-NOTES-it-IT.html  RELEASE-NOTES-zh-CN.html\nLoadBalancer              RELEASE-NOTES-ja-JP.html  RELEASE-NOTES-zh-TW.html\nmedia.repo                RELEASE-NOTES-kn-IN.html  repodata\nPackages                  RELEASE-NOTES-ko-KR.html  ResilientStorage\nREADME                    RELEASE-NOTES-ml-IN.html  RPM-GPG-KEY-redhat-beta\nRELEASE-NOTES-as-IN.html  RELEASE-NOTES-mr-IN.html  RPM-GPG-KEY-redhat-release\nRELEASE-NOTES-bn-IN.html  RELEASE-NOTES-or-IN.html  Server\nRELEASE-NOTES-de-DE.html  RELEASE-NOTES-pa-IN.html  TRANS.TBL\nRELEASE-NOTES-en-US.html  RELEASE-NOTES-pt-BR.html\n<\/pre>\n<\/ol>\n<p>6. Read what is in media.repo. Take note on the mediaid :<\/p>\n<ol>\n<pre class=\"code\">\n[root@rhel6 mnt]# cat media.repo\n<\/pre>\n<\/ol>\n<ol>\n<pre class=\"code\">\n[InstallMedia]\nname=Red Hat Enterprise Linux 6.0\nmediaid=1235481171.125642\nmetadata_expire=-1\ngpgcheck=0\ncost=500\n<\/pre>\n<\/ol>\n<p>7. Create dvdrhel.repo  text file in \/etc\/yum.repos.d\/ with the following content. Please create something as follow:<\/p>\n<ol>\n<pre class=\"code\">\n[root@rhel6 ~]# vi \/etc\/yum.repos.d\/dvdrhel.repo\n<\/pre>\n<\/ol>\n<ol>\n<pre class=\"code\">\n[DVD-RHEL6-Repository]\nmediaid=1235481171.125642\nname=DVD-RHEL6 repository\nbaseurl=file:\/\/\/mnt\/Server\nenabled=1\ngpgcheck=0\n<\/pre>\n<\/ol>\n<p>8. Finish. You can start install, remove and update using yum command :<\/p>\n<p><strong>Method 2 :<\/strong><br \/>\n1. Check the existing partition on your RHEL 6 server :<\/p>\n<ol>\n<pre class=\"code\">\n[root@rhel6 ~]# df\nFilesystem           1K-blocks      Used Available Use% Mounted on\n\/dev\/mapper\/VolGroup-lv_root\n                       9845280   1221632   8123528  14% \/\ntmpfs                   515660         0    515660   0% \/dev\/shm\n\/dev\/sda1               495844     28689    441555   7% \/boot\n<\/pre>\n<\/ol>\n<p>2. Create repo directory in \/media :<\/p>\n<ol>\n<pre class=\"code\">\n[root@rhel6 ~]# mkdir \/media\/repo\n<\/pre>\n<\/ol>\n<p>3. Create 1 2 3 directory in \/media\/repo :<\/p>\n<ol>\n<pre class=\"code\">\n[root@rhel6 ~]# mkdir -p \/media\/repo\/{1,2,3}\n<\/pre>\n<\/ol>\n<p>4. Mount the ISO from the DVDROM into \/media\/repo\/1 directory :<\/p>\n<ol>\n<pre class=\"code\">\n[root@rhel6 ~]# mount -o loop \/dev\/cdrom \/media\/repo\/1\n<\/pre>\n<\/ol>\n<ol>\n<pre class=\"code\">\n[root@rhel6 ~]# df\nFilesystem           1K-blocks      Used Available Use% Mounted on\n\/dev\/mapper\/VolGroup-lv_root\n                       9845280   1221644   8123516  14% \/\ntmpfs                   515660         0    515660   0% \/dev\/shm\n\/dev\/sda1               495844     28689    441555   7% \/boot\n\/dev\/loop0             2862360   2862360         0 100% \/media\/repo\/1\n<\/pre>\n<\/ol>\n<p>5. Create temporary repo folder under \/tmp to put required rpm\u2019s packages for createrepo installation :<\/p>\n<ol>\n<pre class=\"code\">\n[root@rhel6 ~]# mkdir \/tmp\/repo \n<\/pre>\n<\/ol>\n<p>6. Copy the require packages to install create repo :<\/p>\n<ol>\n<pre class=\"code\">\n[root@rhel6 ~]# cp \/media\/repo\/1\/Packages\/createrepo* \/tmp\/repo\n[root@rhel6 ~]# cp \/media\/repo\/1\/Packages\/deltarpm* \/tmp\/repo\n[root@rhel6 ~]# cp \/media\/repo\/1\/Packages\/python-deltarpm* \/tmp\/repo\n<\/pre>\n<\/ol>\n<p>7. Install the rpm packages using below command :<\/p>\n<ol>\n<pre class=\"code\">\n[root@rhel6 ~]# rpm -ivh \/tmp\/repo\/*\nwarning: \/tmp\/repo\/createrepo-0.9.8-4.el6.noarch.rpm: Header V3 RSA\/SHA256 Signature, key ID fd431d51: NOKEY\nPreparing...                ########################################### [100%]\n   1:deltarpm               ########################################### [ 33%]\n   2:python-deltarpm        ########################################### [ 67%]\n   3:createrepo             ########################################### [100%]\n<\/pre>\n<\/ol>\n<p>8. Go to \/media\/repo directory :<\/p>\n<ol>\n<pre class=\"code\">\n[root@rhel6 ~]# cd \/media\/repo\/\n[root@rhel6 repo]# pwd\n\/media\/repo\n<\/pre>\n<\/ol>\n<p>9. Run createrepo command :<\/p>\n<ol>\n<pre class=\"code\">\n[root@rhel6 repo]# createrepo .\n 2358\/13395 - 1\/HighAvailability\/Packages\/system-config-keyboard-1.3.1-3.el6.i68\niso-8859-1 encoding on Ville Skytt\u00e4 <ville .skytta@iki.fi> - 2.8.2-2\n\n 5037\/13395 - 1\/LoadBalancer\/Packages\/system-config-keyboard-1.3.1-3.el6.i686.rp\niso-8859-1 encoding on Ville Skytt\u00e4 <\/ville><ville .skytta@iki.fi> - 2.8.2-2\n\n 7716\/13395 - 1\/Packages\/system-config-keyboard-1.3.1-3.el6.i686.rpm\niso-8859-1 encoding on Ville Skytt\u00e4 <\/ville><ville .skytta@iki.fi> - 2.8.2-2\n\n10395\/13395 - 1\/ResilientStorage\/Packages\/system-config-keyboard-1.3.1-3.el6.i68\niso-8859-1 encoding on Ville Skytt\u00e4 <\/ville><ville .skytta@iki.fi> - 2.8.2-2\n\n13074\/13395 - 1\/Server\/Packages\/system-config-keyboard-1.3.1-3.el6.i686.rpm\niso-8859-1 encoding on Ville Skytt\u00e4 <\/ville><ville .skytta@iki.fi> - 2.8.2-2\n\n13395\/13395 - 1\/Server\/Packages\/zsh-4.3.10-4.1.el6.i686.rpm\nSaving Primary metadata\nSaving file lists metadata\nSaving other metadata\n<\/ville><\/pre>\n<\/ol>\n<p>10. Clean up the repo :<\/p>\n<ol>\n<pre class=\"code\">\n[root@rhel6 ~]# yum clean all\nLoaded plugins: rhnplugin\nCleaning up Everything\n<\/pre>\n<\/ol>\n<p>11. Create a repo config file in \/etc\/yum.repos.d\/ directory :<\/p>\n<ol>\n<pre class=\"code\">\n[root@rhel6 ~]# vi \/etc\/yum.repos.d\/rhel.repo\n<\/pre>\n<\/ol>\n<ol>\n<pre class=\"code\">\n[RHEL6-Repository]\nname=RHEL6 repository\nbaseurl=file:\/\/\/media\/repo\nenabled=1\ngpgcheck=0\n<\/pre>\n<\/ol>\n<p>12. Start install using yum command as below :<\/p>\n<ol>\n<pre class=\"code\">\n[root@rhel6 ~]# yum install httpd\nLoaded plugins: rhnplugin\nThis system is not registered with RHN.\nRHN support will be disabled.\nRHEL6-Repository                                                             | 1.3 kB     00:00 ...\nRHEL6-Repository\/primary                                                     | 5.4 MB     00:00 ...\nRHEL6-Repository                                                                        13395\/13395\nSetting up Install Process\nResolving Dependencies\n--> Running transaction check\n---> Package httpd.i686 0:2.2.15-5.el6 set to be updated\n--> Finished Dependency Resolution\n\nDependencies Resolved\n\n====================================================================================================\n Package            Arch              Version                   Repository                     Size\n====================================================================================================\nInstalling:\n httpd              i686              2.2.15-5.el6              RHEL6-Repository              813 k\n\nTransaction Summary\n====================================================================================================\nInstall       1 Package(s)\nUpgrade       0 Package(s)\n\nTotal download size: 813 k\nInstalled size: 2.8 M\nIs this ok [y\/N]: y\nDownloading Packages:\nRunning rpm_check_debug\nRunning Transaction Test\nTransaction Test Succeeded\nRunning Transaction\n  Installing     : httpd-2.2.15-5.el6.i686                                                      1\/1\n\nInstalled:\n  httpd.i686 0:2.2.15-5.el6\n\nComplete!\n<\/pre>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>In this article, I will share about how to update and install RPM packages from the image CD-ROM\/DVD-ROM in Red Hat Enterprise Linux 6 (RHEL 6). This step can also&#8230;<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[2058,2062],"tags":[1251,1536,1713,1715,1944],"class_list":["post-1762","post","type-post","status-publish","format-standard","hentry","category-rhel","category-yum","tag-centos-6","tag-linux","tag-rhel","tag-rhel-6","tag-yum-repositories"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/1762","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=1762"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/1762\/revisions"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=1762"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=1762"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=1762"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}