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 :
Method 1:
1. Insert DVD/ISO into DVD-Drive.
2. Mount the ISO from the DVD-ROM into /mnt directory :
[root@rhel6 ~]# mount /dev/cdrom /mnt mount: block device /dev/sr0 is write-protected, mounting read-only
3. Check the existing partition on your RHEL 6 server :
[root@rhel6 ~]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/VolGroup-lv_root 9845280 1328824 8016336 15% / tmpfs 515660 0 515660 0% /dev/shm /dev/sda1 495844 28689 441555 7% /boot /dev/sr0 2862360 2862360 0 100% /mnt
4. Go to /mnt and check current directory :
[root@rhel6 ~]# cd /mnt [root@rhel6 mnt]# pwd /mnt
5. List out what is in DVD.
[root@rhel6 mnt]# ls EULA RELEASE-NOTES-es-ES.html RELEASE-NOTES-ru-RU.html GPL RELEASE-NOTES-fr-FR.html RELEASE-NOTES-si-LK.html HighAvailability RELEASE-NOTES-gu-IN.html RELEASE-NOTES-ta-IN.html images RELEASE-NOTES-hi-IN.html RELEASE-NOTES-te-IN.html isolinux RELEASE-NOTES-it-IT.html RELEASE-NOTES-zh-CN.html LoadBalancer RELEASE-NOTES-ja-JP.html RELEASE-NOTES-zh-TW.html media.repo RELEASE-NOTES-kn-IN.html repodata Packages RELEASE-NOTES-ko-KR.html ResilientStorage README RELEASE-NOTES-ml-IN.html RPM-GPG-KEY-redhat-beta RELEASE-NOTES-as-IN.html RELEASE-NOTES-mr-IN.html RPM-GPG-KEY-redhat-release RELEASE-NOTES-bn-IN.html RELEASE-NOTES-or-IN.html Server RELEASE-NOTES-de-DE.html RELEASE-NOTES-pa-IN.html TRANS.TBL RELEASE-NOTES-en-US.html RELEASE-NOTES-pt-BR.html
6. Read what is in media.repo. Take note on the mediaid :
[root@rhel6 mnt]# cat media.repo
[InstallMedia] name=Red Hat Enterprise Linux 6.0 mediaid=1235481171.125642 metadata_expire=-1 gpgcheck=0 cost=500
7. Create dvdrhel.repo text file in /etc/yum.repos.d/ with the following content. Please create something as follow:
[root@rhel6 ~]# vi /etc/yum.repos.d/dvdrhel.repo
[DVD-RHEL6-Repository] mediaid=1235481171.125642 name=DVD-RHEL6 repository baseurl=file:///mnt/Server enabled=1 gpgcheck=0
8. Finish. You can start install, remove and update using yum command :
Method 2 :
1. Check the existing partition on your RHEL 6 server :
[root@rhel6 ~]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/VolGroup-lv_root 9845280 1221632 8123528 14% / tmpfs 515660 0 515660 0% /dev/shm /dev/sda1 495844 28689 441555 7% /boot
2. Create repo directory in /media :
[root@rhel6 ~]# mkdir /media/repo
3. Create 1 2 3 directory in /media/repo :
[root@rhel6 ~]# mkdir -p /media/repo/{1,2,3}
4. Mount the ISO from the DVDROM into /media/repo/1 directory :
[root@rhel6 ~]# mount -o loop /dev/cdrom /media/repo/1
[root@rhel6 ~]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/VolGroup-lv_root 9845280 1221644 8123516 14% / tmpfs 515660 0 515660 0% /dev/shm /dev/sda1 495844 28689 441555 7% /boot /dev/loop0 2862360 2862360 0 100% /media/repo/1
5. Create temporary repo folder under /tmp to put required rpm’s packages for createrepo installation :
[root@rhel6 ~]# mkdir /tmp/repo
6. Copy the require packages to install create repo :
[root@rhel6 ~]# cp /media/repo/1/Packages/createrepo* /tmp/repo [root@rhel6 ~]# cp /media/repo/1/Packages/deltarpm* /tmp/repo [root@rhel6 ~]# cp /media/repo/1/Packages/python-deltarpm* /tmp/repo
7. Install the rpm packages using below command :
[root@rhel6 ~]# rpm -ivh /tmp/repo/* warning: /tmp/repo/createrepo-0.9.8-4.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY Preparing... ########################################### [100%] 1:deltarpm ########################################### [ 33%] 2:python-deltarpm ########################################### [ 67%] 3:createrepo ########################################### [100%]
8. Go to /media/repo directory :
[root@rhel6 ~]# cd /media/repo/ [root@rhel6 repo]# pwd /media/repo
9. Run createrepo command :
[root@rhel6 repo]# createrepo . 2358/13395 - 1/HighAvailability/Packages/system-config-keyboard-1.3.1-3.el6.i68 iso-8859-1 encoding on Ville Skyttä- 2.8.2-2 5037/13395 - 1/LoadBalancer/Packages/system-config-keyboard-1.3.1-3.el6.i686.rp iso-8859-1 encoding on Ville Skyttä - 2.8.2-2 7716/13395 - 1/Packages/system-config-keyboard-1.3.1-3.el6.i686.rpm iso-8859-1 encoding on Ville Skyttä - 2.8.2-2 10395/13395 - 1/ResilientStorage/Packages/system-config-keyboard-1.3.1-3.el6.i68 iso-8859-1 encoding on Ville Skyttä - 2.8.2-2 13074/13395 - 1/Server/Packages/system-config-keyboard-1.3.1-3.el6.i686.rpm iso-8859-1 encoding on Ville Skyttä - 2.8.2-2 13395/13395 - 1/Server/Packages/zsh-4.3.10-4.1.el6.i686.rpm Saving Primary metadata Saving file lists metadata Saving other metadata
10. Clean up the repo :
[root@rhel6 ~]# yum clean all Loaded plugins: rhnplugin Cleaning up Everything
11. Create a repo config file in /etc/yum.repos.d/ directory :
[root@rhel6 ~]# vi /etc/yum.repos.d/rhel.repo
[RHEL6-Repository] name=RHEL6 repository baseurl=file:///media/repo enabled=1 gpgcheck=0
12. Start install using yum command as below :
[root@rhel6 ~]# yum install httpd Loaded plugins: rhnplugin This system is not registered with RHN. RHN support will be disabled. RHEL6-Repository | 1.3 kB 00:00 ... RHEL6-Repository/primary | 5.4 MB 00:00 ... RHEL6-Repository 13395/13395 Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package httpd.i686 0:2.2.15-5.el6 set to be updated --> Finished Dependency Resolution Dependencies Resolved ==================================================================================================== Package Arch Version Repository Size ==================================================================================================== Installing: httpd i686 2.2.15-5.el6 RHEL6-Repository 813 k Transaction Summary ==================================================================================================== Install 1 Package(s) Upgrade 0 Package(s) Total download size: 813 k Installed size: 2.8 M Is this ok [y/N]: y Downloading Packages: Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : httpd-2.2.15-5.el6.i686 1/1 Installed: httpd.i686 0:2.2.15-5.el6 Complete!