Configuring Local RPM repository on RHEL and Cent OS


Sometimes we may need to install a bunch of rpm files at once . If we configure local yum repository , we can install all rpm files at once with yum command.

If a vendor is frequently updating the packages in the remote repository and you just want to stick with old packages , then you can download all rpm packages from teh vendor remote base URL and add them to local repository and then run yum install package.

To create a rpm repository first install “createrepo” package by running yum install createrepo

make a directory where you want to copy all rpm files.

# mkdir /My_repository

# cp from_rpms_directory/* /My_repository

Now run command

#createrepo /My_repository

Add repository file in /etc/yum.repos.d/

#vi /etc/yum.repos.d/my_app.repo

then add the entries like

name=My application from local repository

Now we can issue yum command to install my_app package

# yum install my_app

If you have a web server running ,you can upload rpm files to the web directory and just replace file:// with http:// .

this way you can share this repository with other servers when you needed .

example baseurl=http://mywebserver_ip/repo/ .