How to Configure YUM in RHEL6

Easy way to create your own repo
1. Put your RHEL6 media on DVD drive
2. Create a partition with size 6GB and mount it as /yum
3. Download the below script to /yum
https://sites.google.com/site/ansilh/rhel6_repo.sh
4. Give execute permission to the downloaded script
5. Please open the file and try to understand it. If you found all safe ,then go to next step
6. Execute it...You will get an RHEL repo accessible through ftp


***Please feel free to comment your experience ***

=======================================

Manual Steps (*Different approach from above script .The repo file not look like usual one)

YouTube Link : http://www.youtube.com/watch?v=scBtTTwLze0
 
1.create a directory to store packages .(Better you create a partition with 5GB size and mount it as /YUM)
mkdir /YUM
2.mount RHEL6 DVD
mount /dev/dvd /mnt
3.go to the mounted directory
cd /mnt/Packages/
4.copy all contents of DVD to /YUM (Note the "." in command )
cp . /YUM/
5.Install createrepo package with dependancies
rpm -ivh deltarpm-**.el6.x86_64.rpm python-deltarpm-**.el6.x86_64.rpm createrepo-**.rpm
6.install FTP server
rpm -ivh vsftpd-2.2.2-6.el6.x86_64.rpm
7.Create repository using
createrepo -g /YUM/HighAvailability/repodata/****-comps-rhel6-HighAvailability.xml –o \
/YUM/HighAvailability/ /YUM/Packages/

createrepo -g /YUM/LoadBalancer/repodata/*****-comps-rhel6-LoadBalancer.xml –o \
 /YUM/LoadBalancer/ /YUM/Packages/

createrepo -g /YUM/ResilientStorage/repodata/****-comps-rhel6-ResilientStorage.xml –o  \
 /YUM/ResilientStorage/ /YUM/Packages/

createrepo -g /YUM/ScalableFileSystem/repodata/****-comps-rhel6-ScalableFileSystem.xml –o \
 /YUM/ScalableFileSystem/ /YUM/Packages/

createrepo -g /YUM/Server/repodata/****-comps-rhel6-Server.xml -o /YUM/Server/ /YUM/Packages/
8.Create a repo file in /etc/yum.repos.d/

The Server id contains the main path to the packages.(bold in [Server] baseurl )

vi /etc/yum.repos.d/rhel6-1.repo
[Server]
name=rhel6-1 Server repo
baseurl=ftp://192.168.8.2/Server
              ftp://192.168.8.2/Packages
enabled=1
gpgcheck=0
[HighAvailability]
name=rhel6-1 HighAvailability repo
baseurl=ftp://192.168.8.2/HighAvailability
enabled=1
gpgcheck=0
[ScalableFileSystem]
name=rhel6-1 ScalableFileSystem repo
baseurl=ftp://192.168.8.2/ScalableFileSystem
enabled=1
gpgcheck=0
[ResilientStorage]
name=rhel6-1 ResilientStorage repo
baseurl=ftp://192.168.8.2/ResilientStorage
enabled=1
gpgcheck=0
[LoadBalancer]
name=rhel6-1 LoadBalancer repo
baseurl=ftp://192.168.8.2/LoadBalancer
enabled=1
gpgcheck=0
9.Edit ftp server configuration file to make /YUM as anonymous root
vi /etc/vsftpd/vsftpd.conf 
anon_root=/YUM
10.Restart ftp service
service vsftpd restart
11.Add a rule in iptables to accept ftp connections in /etc/sysconfig/iptables
vi /etc/sysconfig/iptables
-A INPUT -p tcp -s 192.168.8.0/24 --dport 21 -i eth0 -j ACCEPT

12.Add ip_conntrack_ftp module in /etc/sysconfig/iptables-config which is needs to be added for FTP support[ip_nat_ftp]

vi /etc/sysconfig/iptables-config
IPTABLES_MODULES="ip_conntrack_ftp" 
service iptables restart
13.Install the following packages[both clients and server need these packages] to transfer files
You need to install it from DVD
Follow step 2 and 3 and then
rpm -ivh libedit-2.11-4.20080712cvs.1.el6.x86_64 openssh-clients-5.3p1-20.el6.x86_64 ftp-0.17-51.1.el6.x86_64.rpm
14.transfer yum configuraion files to clients

scp /etc/yum.repos.d/rhel6-1.repo *.*.*.*:/etc/yum.repos.d/
15.Check yum configuratoin

yum grouplist will give you these ouputs

Installed Groups:
E-mail server
FTP server
Available Groups:
Additional Development
Afrikaans Support

...

Enjoy RHEL6 Package Management

I've made a video for easy understanding

http://www.youtube.com/watch?v=scBtTTwLze0

Comments

  1. nice work man.....thanx.its really helpfull .....im new to linux....:)

    ReplyDelete
    Replies
    1. Thanks ..Did you faced any trouble while configuring ..?

      Delete
  2. how to install yum in rhel6 without using rpm...coz i can do that thing in rhel5 bt i cant in rhel6...tell me if u know anything regarding dis..mah email id is (arundasouni@ymail.com)

    ReplyDelete
  3. hey ansil...... i still has confusion in it, i am using vmware 8 with linux 6.1 installed on it , i connected my iso to it and copied the content of iso along with packages to /root/dvd directory i am facing confusion what to write in base url of my *.repo file??? please suggest!!

    ReplyDelete
    Replies
    1. Just you need to type the ip address of your computer or write baseurl=file:///var/ftp/pub/Server If you have created in this location other wise write the location where you have created.

      Delete
    2. Thanks for the prompt reply Chandra

      Delete
  4. I am also confusion for this steps.Please explane clearly

    ReplyDelete
    Replies
    1. I hope you copied all DVD contents to /YUM directory

      Please add "anon_root=/YUM" on /etc/vsftpd/vsftpd.conf file and restart vsftpd service

      (Anonymous user will get directory /YUM on ftp login)

      Delete
  5. Hii..
    I am new to Linux....i am finding difficult in installing the JDK1.7 on rhel6.....plz help...

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. Hi,
      Please download the JDK 7 from Oracle download portal.You can either download RPM or "Compressed Binary package"

      Download the package to /tmp from below URL

      http://www.oracle.com/technetwork/java/javase/downloads/java-se-jdk-7-download-432154.html

      1) RPM base installation is straight forward..
      * rpm -ivh --test /tmp/java-xxx.rpm
      If everything is fine go with
      * rpm -ivh /tmp/java-xxx.rpm
      2) Compressed Binary Installation is also easy.
      * tar -xvf /tmp/.tar.gz
      * chmod /tmp/java-xxx.bin
      * cd /usr/
      * /tmp/java-xxx.bin <- Execute the binary file
      * Set JAVA_HOME variable accordingly

      Please let me know if you need any help
      Thanks

      Delete
    3. 1)Inser Linux os Disk
      2)Os disk copy to another Location in Root(/)
      cp -vr /media/RHEL^..... /Destnation
      3)Install The createrepo Package
      rpm -ivh createrepo* --force --aid
      4)After we goto this Location
      cd /etc/yum.repos.d/
      5)to create database
      createrepo --database /desination dir path
      6)edit the file
      vi rhel-source.repo
      Shift+G
      [localhost/localdomain]
      name=rhel6
      baseurl=file://destination dir path
      gpqchech=0
      enabled=1
      :wq
      7)yum repolist
      8)yum clean all



      Delete
  6. i want to create a .repo file that will enable installation of fusecompress using yum. (yum install fusecompress).

    How do we create the .repo file

    Thanks in advance.

    ReplyDelete
    Replies
    1. Which Linux you are using - Fedora or RedHat ?

      Fedora OS itself having the repository details to download all the packages and fusecompress is already present on Fedora repo.

      Try using fedora and you will get the way to RHEL

      Delete
    2. i manually configured yum using these steps
      # Mount the CDROM #

      # mount -t iso9660 /dev/sr0 /mnt
      # df -h /mnt
      Filesystem Size Used Avail Use% Mounted on
      /dev/sr0 3.2G 3.2G 0 100% /mnt

      # Preparation for Yum Master Server #

      1) Install the required packages.

      [root@server Packages]# pwd
      /mnt/Packages
      [root@server Packages]# rpm -ivh vsftpd-2.2.2-6.el6.x86_64.rpm
      warning: vsftpd-2.2.2-6.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
      Preparing... ########################################### [100%]
      1:vsftpd ########################################### [100%]
      [root@server Packages]# rpm -ivh createrepo-0.9.8-4.el6.noarch.rpm
      warning: createrepo-0.9.8-4.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
      error: Failed dependencies:
      deltarpm is needed by createrepo-0.9.8-4.el6.noarch
      python-deltarpm is needed by createrepo-0.9.8-4.el6.noarch
      [root@server Packages]# rpm -ivh deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
      warning: deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
      Preparing... ########################################### [100%]
      1:deltarpm ########################################### [100%]
      [root@server Packages]# rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
      warning: python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
      Preparing... ########################################### [100%]
      1:python-deltarpm ########################################### [100%]
      [root@server Packages]# rpm -ivh createrepo-0.9.8-4.el6.noarch.rpm
      warning: createrepo-0.9.8-4.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
      Preparing... ########################################### [100%]
      1:createrepo ########################################### [100%]
      [root@server Packages]#

      2) Copy the Packages from CDROM to /var/ftp/pub folder. The folder will be automatically created once we install the vsftpd rpm.
      [root@server /]# cp -r /mnt/Packages /var/ftp/pub/
      [root@server /]#

      3) Create a repodata which will be used as a repository of packages for Yum configuration [including master itself and clients].

      [root@server Packages]# createrepo -v .
      1/3431 - augeas-libs-0.7.2-3.el6.i686.rpm
      2/3431 - hunspell-vi-0.20080604-3.1.el6.noarch.rpm
      3/3431 - urw-fonts-2.4-10.el6.noarch.rpm
      |
      |
      |
      |
      3429/3431 - libusb-0.1.12-23.el6.x86_64.rpm
      3430/3431 - tigervnc-server-1.0.90-0.10.20100115svn3945.el6.x86_64.rpm
      3431/3431 - kde-l10n-Spanish-4.3.4-5.el6.noarch.rpm

      Saving Primary metadata
      Saving file lists metadata
      Saving other metadata
      [root@server Packages]#

      4) Configuration of YUM Master.

      [root@server /]# cd /etc/yum.repos.d
      [root@server yum.repos.d]# vi server.repo
      [server]
      name=server.hp.com
      baseurl=ftp://10.1.2.47/pub/Packages
      enabled=1
      gpgcheck=0
      [root@server yum.repos.d]#

      But after this i got an error
      [root@m47 ~]# yum update
      Loaded plugins: refresh-packagekit, rhnplugin
      This system is not registered with RHN.
      RHN support will be disabled.
      ftp://10.1.2.47/pub/Packages/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - ""
      Trying other mirror.
      Error: Cannot retrieve repository metadata (repomd.xml) for repository: server. Please verify its path and try again

      Delete
    3. Hi

      Did you check anonymous ftp access to your FTP server ?
      and are you able to see "pub" directory after you got login ?

      Delete
  7. hi nice info..


    some times while creating yum repositories by default redhat.repo is automatically creating even after deleting it comes again and again y?
    and how can i solve the problem

    ReplyDelete
  8. its wonderful help for Linux survivor...........
    tx 2 do dat..>>>>

    ReplyDelete
    Replies
    1. heh i am confused after that 8th point where we give the server address should we copy the same address and 13th command i copy and run it its not running
      plz help me in this regard
      when i fins and
      root@local Packages]# yum install mysql-server
      Loaded plugins: refresh-packagekit, rhnplugin
      This system is not registered with RHN.
      RHN support will be disabled.
      ftp://192.168.8.2/HighAvailability/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - ""
      Trying other mirror.
      Error: Cannot retrieve repository metadata (repomd.xml) for repository: HighAvailability. Please verify its path and try again

      Delete
  9. heh i am confused after that 8th point where we give the server address should we copy the same address and 13th command i copy and run it its not running
    plz help me in this regard
    when i fins and
    root@local Packages]# yum install mysql-server
    Loaded plugins: refresh-packagekit, rhnplugin
    This system is not registered with RHN.
    RHN support will be disabled.
    ftp://192.168.8.2/HighAvailability/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - ""
    Trying other mirror.
    Error: Cannot retrieve repository metadata (repomd.xml) for repository: HighAvailability. Please verify its path and try again

    ReplyDelete
    Replies
    1. Hi Sabari,

      I would suggust to check on FTP configuration.

      1.Are you able to see "HighAvailability" directory after just logged on to ftp server using anonymous user ?
      2.Check the contents inside "HighAvailability"
      3.If it is not there , then you need to execute "createrepo" command for "HighAvailability"
      4.Aslo check for DVD copied content permissions.

      We used two url on setp 8
      baseurl=ftp://192.168.8.2/Server
      ftp://192.168.8.2/Packages
      Because the second one will act as a mirror and it wil bypass all package download request from clients to second ftp url.All our packages are in "Packages".Other directories only contains metadata files (xml and gz files).

      Delete
  10. [root@sercon2 Packages]# createrepo -g /down/RHEL6/HighAvailability/repodata/2ae2772083e8ae96b26fb7b9c871a5a0ea988308ad91a1918744986ba200c4aa-comps-rhel6-HighAvailability.xml -o /down/RHEL6/Packages/
    Error: Must specify a directory to index.
    Usage: genpkgmetadata.py [options]

    ReplyDelete
    Replies
    1. Syntax error , you Should specify where you need to store metadata files.I've marked the same in quotes below

      createrepo -g /YUM/HighAvailability/repodata/****-comps-rhel6-HighAvailability.xml –o \
      "/YUM/HighAvailability/" /YUM/Packages/

      Delete
  11. hi sir iam using RHEL 6 on vmware8 and in that i am trying to configure yum i was configure yum server successfully but i dont where i have configure yum client pls help me how to configure yum client in vmware8 rhel6 plssssssss

    ReplyDelete
    Replies
    1. Hi,

      I'm preparing a video for this, I hope it will be finished end of this month (end of July 2013)

      Delete
    2. Here it is :- http://www.youtube.com/watch?v=scBtTTwLze0

      Cheers ..:)

      Delete
  12. Thank Ansil It's realy worked .........!

    ReplyDelete
  13. Hello
    i am using RHEL6 on vmware. and i use iso of rhel6 32 bit.. plz tell me how i can configure yum. when i follow the step there gives me a some error :
    mount: /root/Desktop/media/rhel6.0-32bit.iso is not a block device (maybe try `-o loop'?)
    it the error

    plzz tell me..

    ReplyDelete
    Replies
    1. you can try :
      mount iso image of RHEL 6 in Vmware settings then,
      mount /dev/dvd/ /mnt
      cd /mnt

      & rest given in above article .. Plz read...
      Regards,
      PGA

      Delete
  14. Good work dude...nicely wrote.
    Regards,
    PGA

    ReplyDelete
  15. Hello, I have a unique twist on a repo server. I'd like to respin the RHEL6.5 DVD to include the latest packages. I switched out the old packages in the build tree (the RHEL6.5 iso) (under the Packages directory) then used createrepo -g repodata/*comps*.xml . Which should use the Server comps file from repodata and since my CWD has the Packages directory in it all should be well. I create the repository OK and during the install the dependency check is just fine, but then the install just hangs. I'm using a VM and getting to the alternate screens isn't working (ugh). I feel like I'm either really close or I've completely missed the boat. Suggestions would be greatly appreciated. Michelle

    ReplyDelete
  16. Hello, i have wifi internet connection but iam not able to connect in redhat linux 6.0.
    could you please tell the configuration settings ?? thanks in advance.
    you can rpy in my mail also... sharique.javed@gmail.com

    ReplyDelete
  17. just copy all packages to a folder /var/ftp/pub/rhel6. and create a repo file inside /etc/yum.repos.d/test.repo. and edit this test.repo as following
    [server]
    name=test
    baseurl=file:///var/ftp/pub/rhel6/
    gpgcheck=0
    enabled=1

    ReplyDelete
  18. Hi Ansil,
    Thanks for the post, but could you please help me with the error I am getting at step 7 as below:

    [root@prud-linux Desktop]# createrepo -g /YUM/ResilientStorage/repodata/****-comps-rhel6-ResilientStorage.xml –o /YUM/ResilientStorage/ /YUM/Packages/
    Error: Only one directory allowed per run.
    Usage: genpkgmetadata.py [options]

    [root@prud-linux Desktop]# createrepo -g /YUM/ResilientStorage/repodata/****-comps-rhel6-ResilientStorage.xml –o \ /YUM/ResilientStorage/ /YUM/Packages/
    Error: Only one directory allowed per run.
    Usage: genpkgmetadata.py [options]

    ReplyDelete
  19. Cool and that i have a keen supply: Who Repair House Windows house renovation contractors

    ReplyDelete

Post a Comment

Popular posts from this blog

How to Configure Squid with Mysql DB authentication

HMC vtmenu exit