Configure Local YUM Repository on CentOS 6 / RHEL 6


YUM is the Linux package management tool that helps to install or update the packages; it does the automatic installation of dependent packages which is required by main installation package.

To setup the YUM repository we need ( For testing purpose ) one server system where all the packages are hosted and the client system where you want to install or update the packages.

Hosting Packages

The client must have to communicate through any one type of medium to get the packages from the server system. Normally server uses FTP or Apache as the medium to transfer the packages.

We need to copy those downloaded packages on to /var/ftp or /var/www/html receptively for FTP and Apache. You can use either FTP or Apache.

Mount the DVD on the /cdrom

mkdir cdrom;mount /dev/cdrom /cdrom


copy the packages from the DVD to FTP folder.

cp /cdrom/Packages/* /var/ftp


copy the packages from the DVD to apache home directory.

cp /cdrom/Packages/* /var/www/html/

Edit Apache configuration file to enable the indexes.

vi /etc/httpd/conf/httpd.conf


Options Indexes FollowSymLinks


Options All Indexes FollowSymLinks

Remove the welcome page.

rm -rf /etc/httpd/conf.d/welcome.conf

Verify the above using the web browser by visiting ftp://ip-address or http://ip-address.

Creating Repository

After hosting the packages, we need to create the repository of the packages that you have downloaded from the internet or copied from the disc.

CreateRepo is the tool that helps you to create the XML based rpm meta structure repository, and It is like an index file that points to the rpm files. This XML files used for resolving the dependency packages which is required by the main package.Install CreateRepo package.

rpm -Uvh deltarpm-**.el6.x86_64.rpm python-deltarpm-**.el6.x86_64.rpm createrepo-**.rpm


createrepo /var/ftp


createrepo /var/www/html

Configure Repository

Once created the repository, just go on to the client machine and add the repository file under the /etc/yum.repos.d directory. Change IP address to your server ip address.

vi /etc/yum.repos.d/remote.repo




name=RHEL Apache

Install Packages

Install the packages using the yum command. Once the command issued, it downloads metafile from the server and looks for the dependent rpm if required; otherwise, it will install package automatically.
yum install mysql-server


From the above you could see the MySQL Server packages installed with all dependent packages, It performs the same task that RPM can. It provides an easy installation of packages in the single command line. If you face any problem on FTP or Apache, do disabling the iptables.

Further Reading

You might also like