create yum repository on local machine

If you want to install software/packages after installation of linux  (CentOS, Fedora etc.). You can create the yum repository to install all the software/packages which is present into the instillation CD. When you have try to install software/packages then some time it shows dependencies problems. To fix this problem I suggest your create the local machine yum repository by using the following steps.
1) Create directory
mkdir -p /root/install/RPMS
2) Copy all the software/packages RPMS from instillation CD/DVD to  /root/install/RPMS directory
3) Install createrepo RPM from /root/install/RPMS  directory using rpm command
rpm -ivh createrepo-0.4.11-3.el5.rpm
3) Now, we will have to create repo of the directory in which we have coied the RPMS. Following is the command to create the repo

[root@server ~] createrepo /root/install/RPMS

Once the above command gets completed you will find repodata directory in /root/install/RPMS folder
4) configuing YUM to work with local repository. Create a new file in /etc/yum.repo.d/ or open /etc/yum.conf and paste following

[local repo]
name = OS $release - MyLocalRepo
baseurl = file://root/install/RPMS
enabled=1
gpgcheck=0

Now Try to install any package using ” yum ” command
for example:
yum install mysql
yum install php*
Done

7 Thoughts to “create yum repository on local machine”

  1. dilip

    I have two linux machines on one system. one acts as server and another as client. Its working on VMware with windows as base machine. my question is one of linux machine(client) have to query the server for downloading packages.
    How should i proceed

    1. First you need to assign the IP address for server and client machine. If you are able to configure the yum repository on local machine (server) then configure the same yum repository on client machine but only change the base url to point to the server.
      baseurl=file:///path/to/your/repo
      Please refer the URL http://www.charlescurley.com/yum/repository.html
      Or you can configure ftp on the server and use the IP address to download the packgaes on client machine.
      Rishikesh Vispute

  2. vishal joshi

    Thank you so much .
    I tried whole night and nothing worked. Thanks your solutions worked but there are some dependencies ..

  3. hi!This was a really fabulous topic!
    I come from milan, I was luck to seek your topic in digg
    Also I get a lot in your website really thank your very much i will come later

  4. vinod

    working fine on server side but error downloading file at client
    error 14 ftp error 550
    please help me

  5. Chris

    On my system, the baseurl line required 3 slashes:
    baseurl = file:///root/install/RPMS
    Apparently two for the protocol + one for the root

Leave a Comment