How to Add the RPMforge Repository on CentOS 6/RHEL 6 Linux Server

In this post i will show on how to add the RPMforge repository into Linux Red Hat Enterprise Linux 6 (RHEL 6) and also applicable on CentOS 6. RPMforge repository is a collaboration of Dag, Dries, and other packagers. This steps has been tested on RHEL 6 and should be working on CentOS 6. Assumed only one repository exist in /etc/yum.repos.d which is local yum repository using DVD Media.

RHEL 6 and CentOS 6 x86 32bit
RHEL 6 and CentOS 6 x86 64bit

1. Download the rpmforge-release package

[root@rhel6 ~]# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
--2012-03-12 03:37:06--  http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
Resolving pkgs.repoforge.org... 78.46.17.228
Connecting to pkgs.repoforge.org|78.46.17.228|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://rpmforge.sw.be/redhat/el6/en/i386/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.i686.rpm [following]
--2012-03-12 03:37:07--  http://rpmforge.sw.be/redhat/el6/en/i386/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
Resolving rpmforge.sw.be... 78.46.17.228
Connecting to rpmforge.sw.be|78.46.17.228|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://tree.repoforge.org/redhat/el6/en/i386/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.i686.rpm [following]
--2012-03-12 03:37:09--  http://tree.repoforge.org/redhat/el6/en/i386/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
Resolving tree.repoforge.org... 78.46.17.228
Connecting to tree.repoforge.org|78.46.17.228|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://apt.sw.be/redhat/el6/en/i386/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.i686.rpm [following]
--2012-03-12 03:37:10--  http://apt.sw.be/redhat/el6/en/i386/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
Resolving apt.sw.be... 193.1.193.67
Connecting to apt.sw.be|193.1.193.67|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12732 (12K) [application/x-redhat-package-manager]
Saving to: ârpmforge-release-0.5.2-2.el6.rf.i686.rpmâ

100%[==========================================================>] 12,732      16.7K/s   in 0.7s

2012-03-12 03:37:12 (16.7 KB/s) - ârpmforge-release-0.5.2-2.el6.rf.i686.rpmâ

2. Download DAG’s GPG key :

[root@rhel6 ~]# wget http://apt.sw.be/RPM-GPG-KEY.dag.txt
--2012-03-12 03:41:16--  http://apt.sw.be/RPM-GPG-KEY.dag.txt
Resolving apt.sw.be... 193.1.193.67
Connecting to apt.sw.be|193.1.193.67|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1672 (1.6K) [text/plain]
Saving to: âRPM-GPG-KEY.dag.txtâ

100%[==========================================================>] 1,672       --.-K/s   in 0.007s

2012-03-12 03:41:18 (249 KB/s) - âRPM-GPG-KEY.dag.txtâ

3. Install DAG’s GPG key :

[root@rhel6 ~]# rpm --import RPM-GPG-KEY.dag.txt

4. Verify the rpmforge-release package you have downloaded :

[root@rhel6 ~]# rpm -K rpmforge-release-0.5.2-2.el6.rf.i686.rpm
rpmforge-release-0.5.2-2.el6.rf.i686.rpm: (sha1) dsa sha1 md5 gpg OK

5. If ok, proceed to install the rpmforge-release package using this command :

[root@rhel6 ~]# rpm -ivh rpmforge-release-0.5.2-2.el6.rf.i686.rpm
Preparing...                ########################################### [100%]
   1:rpmforge-release       ########################################### [100%]

6. Proceed to configure RPMforge repository. Open the RPMforge configuration file and insert “priority=3” after “enabled = 1” in the [rpmforge] section as below :

[root@rhel6 ~]# vi /etc/yum.repos.d/rpmforge.repo
### Name: RPMforge RPM Repository for RHEL 6 - dag
### URL: http://rpmforge.net/
[rpmforge]
name = RHEL $releasever - RPMforge.net - dag
baseurl = http://apt.sw.be/redhat/el6/en/$basearch/rpmforge
mirrorlist = http://apt.sw.be/redhat/el6/en/mirrors-rpmforge
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge
enabled = 1
priority=3
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1

[rpmforge-extras]
name = RHEL $releasever - RPMforge.net - extras
baseurl = http://apt.sw.be/redhat/el6/en/$basearch/extras
mirrorlist = http://apt.sw.be/redhat/el6/en/mirrors-rpmforge-extras
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge-extras
enabled = 0
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1

[rpmforge-testing]
name = RHEL $releasever - RPMforge.net - testing
baseurl = http://apt.sw.be/redhat/el6/en/$basearch/testing
mirrorlist = http://apt.sw.be/redhat/el6/en/mirrors-rpmforge-testing
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge-testing
enabled = 0
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1

7. Check the updated repository list in /etc/yum.repos.d using the following command :

[root@rhel6 ~]# yum repolist
Loaded plugins: rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
repo id                                 repo name                                             status
DVD-RHEL6-Repository                    DVD-RHEL6 repository                                  2,646
rpmforge                                RHEL 6Server - RPMforge.net - dag                     4,289
repolist: 6,935

8. You can start using RPMforge Repository on your RHEL 6 or CentOS 6 linux server.

Start install, remove and update using RPMforge :

[root@rhel6 ~]# yum install package-name -y
[root@rhel6 ~]# yum remove package-name -y
[root@rhel6 ~]# yum update package-name -y

Reference :
RPMforge CentOS Wiki

How to Add Atomic Repository to RHEL 6

In This post, i will show on how to install Atomic repository to Red Hat Enterprise Linux 6 (RHEL 6). Atomic repository was archived here :
http://www6.atomicorp.com/channels/atomic/

Follow this steps to download and prepare Atomic yum repository RHEL 6.
1. Download using wget command :

    [root@rhel6 ~]# wget http://www6.atomicorp.com/channels/atomic/redhat/6/i386/RPMS/atomic-release-1.0-13.el6.art.noarch.rpm
    --2012-01-24 19:42:14--  http://www6.atomicorp.com/channels/atomic/redhat/6/i386/RPMS/atomic-release-1.0-13.el6.art.noarch.rpm
    Resolving www6.atomicorp.com... 69.20.6.166
    Connecting to www6.atomicorp.com|69.20.6.166|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 6332 (6.2K) [application/x-rpm]
    Saving to: âatomic-release-1.0-13.el6.art.noarch.rpmâ
    
    100%[==========================================================>] 6,332       20.7K/s   in 0.3s
    
    2012-01-24 19:42:15 (20.7 KB/s) - âatomic-release-1.0-13.el6.art.noarch.rpmâ
    

2. View the downloaded files :

    [root@rhel6 ~]# ls
    atomic-release-1.0-13.el6.art.noarch.rpm
    

3. Install using rpm command as below :

    [root@rhel6 ~]# rpm -Uvh atomic-release-1.0-13.el6.art.noarch.rpm
    warning: atomic-release-1.0-13.el6.art.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 5ebd2744: NOKEY
    Preparing...                ########################################### [100%]
       1:atomic-release         ########################################### [100%]
    

How to Install Extra Repository for Redhat Enterprise Linux 6 (RHEL6)

In this post, i will show you on how to setup Extra Yum Repository for Redhat Enterprise Linux 6 (RHEL6).

1. How to Setup Local Yum Repository from CD-ROM/DVD-ROM image on RHEL 6

2. Setup epel yum repository for RHEL 6.

    [root@rhel6 ~]# cd /tmp
    [root@rhel6 tmp]# wget http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm
    --2012-01-24 08:54:00--  http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm
    Resolving download.fedora.redhat.com... 209.132.181.26, 209.132.181.27, 209.132.181.23, ...
    Connecting to download.fedora.redhat.com|209.132.181.26|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 14064 (14K) [application/x-rpm]
    Saving to: âepel-release-6-5.noarch.rpmâ
    
    100%[==========================================================>] 14,064      41.3K/s   in 0.3s
    
    2012-01-24 08:54:01 (41.3 KB/s) - âepel-release-6-5.noarch.rpmâ
    
    [root@rhel6 tmp]# rpm -Uvh epel-release-6-5.noarch.rpm
    warning: epel-release-6-5.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
    Preparing...                ########################################### [100%]
       1:epel-release           ########################################### [100%]
    
    [root@rhel6 tmp]# yum repolist
    Loaded plugins: rhnplugin
    This system is not registered with RHN.
    RHN support will be disabled.
    epel/metalink                                                                | 3.8 kB     00:00
    epel                                                                         | 4.3 kB     00:00
    epel/primary_db                                                              | 3.4 MB     00:38
    repo id                          repo name                                                    status
    RHEL6-Repository                 RHEL6 repository                                             13,395
    epel                             Extra Packages for Enterprise Linux 6 - i386                  5,625
    repolist: 19,020
    

3. Setup Atomic yum repository for RHEL 6.

    [root@rhel6 tmp]# wget http://www6.atomicorp.com/channels/atomic/redhat/6/i386/RPMS/atomic-release-1.0-13.el6.art.noarch.rpm
    --2012-01-24 19:42:14--  http://www6.atomicorp.com/channels/atomic/redhat/6/i386/RPMS/atomic-release-1.0-13.el6.art.noarch.rpm
    Resolving www6.atomicorp.com... 69.20.6.166
    Connecting to www6.atomicorp.com|69.20.6.166|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 6332 (6.2K) [application/x-rpm]
    Saving to: âatomic-release-1.0-13.el6.art.noarch.rpmâ
    
    100%[==========================================================>] 6,332       20.7K/s   in 0.3s
    
    2012-01-24 19:42:15 (20.7 KB/s) - âatomic-release-1.0-13.el6.art.noarch.rpmâ
    
    [root@rhel6 tmp]# rpm -Uvh atomic-release-1.0-13.el6.art.noarch.rpm
    warning: atomic-release-1.0-13.el6.art.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 5ebd2744: NOKEY
    Preparing...                ########################################### [100%]
       1:atomic-release         ########################################### [100%]
    
    [root@rhel6 ~]# yum repolist
    Loaded plugins: rhnplugin
    This system is not registered with RHN.
    RHN support will be disabled.
    repo id               repo name                                                               status
    RHEL6-Repository      RHEL6 repository                                                        13,395
    atomic                CentOS / Red Hat Enterprise Linux 6Server - atomicrocketturtle.com         394
    epel                  Extra Packages for Enterprise Linux 6 - i386                             5,625
    repolist: 19,414
    

How to Setup Local Yum Repository from CD-ROM/DVD-ROM image on RHEL 6

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!
    

How to Fix “Warning: RPMDB altered outside of yum.”

Symptom:

When i try to install the packages or software using the yum command, the following error or warning message appeared:

Warning: RPMDB altered outside of yum.

Example :

..
..                                          
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
..
..

This means some application has altered the rpm database (installed or removed a package) without going through the Yum APIs. To avoid this, it’s recommended to update, install or remove RPM packages using yum command, instead of ” rpm -e” or “rpm -i” or “rpm -ivh” or “rpm -Uvh”.

To fix this, just run this command :

[root@centos6 ~]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: CentOS6.2-Repository
Cleaning up Everything
Cleaning up list of fastest mirrors

How to Setup Local Yum Repository from CD-ROM/DVD-ROM image on CentOS 6.2

In this post, i will share on how to update and install the RPM packages from CD-ROM/DVD-ROM image on CentOS 6.2. This will very useful when you are running on slow internet connection. Instead of go through the internet connection, it is possible to use Local CD/DVD-ROM as your yum repository. There are two methods to install and configure local CentOS 6.2 yum repository. Both methods have been tested and working on CentOS 6.2 linux server. You can select any method that you most preferred. This may be also applicable on other version of CentOS server.

Method 1:
1. Insert DVD/ISO into DVD-Drive.
2. Mount the ISO from the DVD-ROM into /mnt directory :

    [root@centos62 ~]# mount /dev/cdrom /mnt
    mount: block device /dev/sr0 is write-protected, mounting read-only
    

3. Create centos62.repo text file in /etc/yum.repos.d/ with the following content. Please create something as follow:

    [root@centos62 ~]# vi /etc/yum.repos.d/centos62.repo
    
    [CentOS6.2-Repository]
    name=DVD-CentOS6.2 repository
    baseurl=file:///mnt
    enabled=1
    gpgcheck=0
    

4. Finish. You can start install, remove and update using yum command :
Example :

    [root@centos62 ~]# yum install httpd -y
    

Method 2 :
1. Check the existing partition on your CentOS 6.2 server

    [root@centos6 ~]# df
    Filesystem           1K-blocks      Used Available Use% Mounted on
    /dev/mapper/VolGroup-lv_root
                          18102140   1165764  16016824   7% /
    tmpfs                   515444         0    515444   0% /dev/shm
    /dev/sda1               495844     29842    440402   7% /boot
    

2. Create localrepo directory in /mnt :

    [root@centos6 ~]# mkdir /mnt/localrepo
    

3. Create 1 2 3 directory in /mnt/localrepo

    [root@centos6 ~]# mkdir -p /mnt/localrepo/{1,2,3}
    

4. Mount the ISO from the DVDROM into /mnt/localrepo/1 directory

    [root@centos6 ~]# mount -o loop /dev/cdrom /mnt/localrepo/1
    
    [root@centos6 ~]# df -lh
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/mapper/VolGroup-lv_root
                           18G  1.2G   16G   7% /
    tmpfs                 504M     0  504M   0% /dev/shm
    /dev/sda1             485M   30M  431M   7% /boot
    /dev/sr0              3.6G  3.6G     0 100% /mnt/localrepo/1
    

5. Create Temporary repo folder under /tmp to put required rpm’s packages for createrepo installation.

    [root@centos6 ~]# mkdir /tmp/repo
    

6. Copy the require pacckages to install create repo:

    [root@centos6 ~]# cp /mnt/localrepo/1/Packages/createrepo* /tmp/repo
    [root@centos6 ~]# cp /mnt/localrepo/1/Packages/deltarpm* /tmp/repo
    [root@centos6 ~]# cp /mnt/localrepo/1/Packages/libxml2-python* /tmp/repo
    [root@centos6 ~]# cp /mnt/localrepo/1/Packages/python-deltarpm* /tmp/repo
    [root@centos6 ~]# ls /tmp/repo
    createrepo-0.9.8-4.el6.noarch.rpm          libxml2-python-2.7.6-4.el6.i686.rpm
    deltarpm-3.5-0.5.20090913git.el6.i686.rpm  python-deltarpm-3.5-0.5.20090913git.el6.i686.rpm
    

7. Install the rpm packages using below command:

    [root@centos6 ~]# rpm -ivh /tmp/repo/*
    Preparing...                ########################################### [100%]
       1:deltarpm               ########################################### [ 25%]
       2:python-deltarpm        ########################################### [ 50%]
       3:libxml2-python         ########################################### [ 75%]
       4:createrepo             ########################################### [100%]
    

8. Go to /mnt/localrepo directory.

    [root@centos6 ~]# cd /mnt/localrepo/
    

9. Run createrepo command :

    [root@centos6 localrepo]# createrepo .
    2704/3042 - 1/Packages/system-config-users-docs-1.0.8-1.el6.noarch.rpm
    iso-8859-1 encoding on Ville Skyttä  - 2.8.2-2
    
    3042/3042 - 1/Packages/zsh-4.3.10-4.1.el6.i686.rpm
    Saving Primary metadata
    Saving file lists metadata
    Saving other metadata
    [root@centos6 localrepo]# ls
    1  2  3  repodata
    

10. Clean up the repo :

    [root@centos6 ~]# yum clean all
    Loaded plugins: fastestmirror
    Cleaning up Everything
    Cleaning up list of fastest mirrors
    

11. Create a repo config file in /etc/yum.repos.d/ directory :

    [root@centos6 ~]# vi /etc/yum.repos.d/local.repo
    
    [CentOS6.2-Repository]
    name=CentOS6.2 repository
    baseurl=file:///mnt/localrepo
    enabled=1
    gpgcheck=0
    

How to Fix “You could try using –skip-broken to work around the problem” Error

Question :
When I issue the command yum on CentOS server / RHEL , the message below appears and I can not continue with the next installation steps :

    You could try using --skip-broken to work around the problem
    You could try running: package-cleanup --problems
    package-cleanup --dupes
    rpm -Va --nofiles --nodigest
    The program package-cleanup is found in the yum-utils package.
    

Answer : You just need to run below command to install the yum utilities if never installed and cleaning up list of fastest mirrors:
1. Run Yum install :

[root@server ~]# yum install yum-utils
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * addons: centos.ipserverone.com
 * base: centos.ipserverone.com
 * extras: centos.ipserverone.com
 * updates: centos.ipserverone.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package yum-utils.noarch 0:1.1.16-14.el5.centos.1 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================
 Package            Arch            Version                           Repository     Size
==========================================================================================
Installing:
 yum-utils          noarch          1.1.16-14.el5.centos.1            base           69 k

Transaction Summary
==========================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 69 k
Is this ok [y/N]: y
Downloading Packages:
yum-utils-1.1.16-14.el5.centos.1.noarch.rpm                        |  69 kB     00:04
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : yum-utils                                                          1/1

Installed:
  yum-utils.noarch 0:1.1.16-14.el5.centos.1

Complete!

2. Run Below command :

[root@server ~]# yum clean all
Loaded plugins: fastestmirror
Cleaning up Everything
Cleaning up list of fastest mirrors

How to Create Yum Repository from CDROM Media

In this post, I will guide you on how to install or update the Redhat RPM packages from mounted local CDROM. Assume that you want to install the Redhat 5 packages. Please follow below steps:

1. Mount the CDROM media.

    [root@server ~]# mount /dev/hdc /media

2. Create local.repo in yum.repos.d

    [root@server ~]# cd /etc/yum.repos.d
    [root@server yum.repos.d]# vi local.repos
    [RHEL-5-Repository]
    name=RHEL5 repository
    baseurl=file:///media/Server
    enabled=1
    gpgcheck=0

3. Save and you can start install or update using yum command.

How to Prepare Other Yum Repositories For RHEL/CentOS 5

There are three updated yum repositories for RHEL/ CentOS. Remi and Webtatic repository are my favorites. Follow below steps to install some other repositories into yum.repos.d.

Install epel Repository

64 Bit OS

    [root@myserver tmp]# wget http://download.fedora.redhat.com/pub/epel/5/x86_64/
    epel-release-5-4.noarch.rpm
    

32 Bit OS

    [root@myserver tmp]# wget http://download.fedora.redhat.com/pub/epel/5/i386/
    epel-release-5-4.noarch.rpm
    
    [root@myserver tmp]# rpm --import http://download.fedora.redhat.com/pub/epel/
    RPM-GPG-KEY-EPEL
    [root@myserver tmp]# rpm -K epel-release-5-4.noarch.rpm
    epel-release-5-4.noarch.rpm: (sha1) dsa sha1 md5 gpg OK
    [root@myserver tmp]# rpm -ivh epel-release-5-4.noarch.rpm
    Preparing...            ########################################### [100%]
    1:epel-release          ########################################### [100%]
    

Install Remi Repository

    [root@myserver tmp]# wget http://rpms.famillecollet.com/enterprise/
    remi-release-5.rpm
    [root@myserver tmp]# rpm -Uvh remi-release-5.rpm
    warning: remi-release-5.rpm: Header V4 DSA signature: NOKEY, key ID 00f97f56
    Preparing...            ########################################### [100%]
    1:remi-release          ########################################### [100%]
    

Install Webtatic Repository

64 Bit OS

    [root@myserver tmp]# wget http://repo.webtatic.com/yum/centos/5/x86_64/
    webtatic-release-5-2.noarch.rpm
    

32 Bit OS

    [root@myserver tmp]# wget http://repo.webtatic.com/yum/centos/5/i386/
    webtatic-release-5-2.noarch.rpm
    
    [root@myserver tmp]# rpm --import http://repo.webtatic.com/yum/RPM-GPG-KEY-webtatic-andy
    [root@myserver tmp]# rpm -K webtatic-release-5-2.noarch.rpm
    webtatic-release-5-2.noarch.rpm: (sha1) dsa sha1 md5 gpg OK
    [root@myserver tmp]# rpm -Uvh webtatic-release-5-2.noarch.rpm
    Preparing...            ########################################### [100%]
    1:webtatic-release      ########################################### [100%]
    

How To use these repositories
yum –enablerepo=epel install [rpm package]
yum –enablerepo=remi install [rpm package]
yum –enablerepo=webtatic install [rpm package]