How to Create Local YUM Repository
YUM package manager can be used to update or install packages for Red Hat Enterprise Linux systems from a customized repository.
To create a YUM repository follow these steps:
1. Install the createrepo tool
To do so, run the following command as root:
yum install createrepo
Also there is mostly compatible C implementation of the createrepo tool named createrepo_c
,
which may be installed with:
yum install createrepo_c
2. Then, create repository directory and place packages there:
mkdir /path/to/repository
cp /path/to/packages /path/to/repository
3. Run “createrepo”
The createrepo
tool traverse through the repository directory and
creates a new directory called repodata
. This is the place where the
metadata for the newly created repository will be stored:
createrepo /path/to/repository
4. Create a YUM configuration file for the repository
The configuration file should be placed under the /etc/yum.repos.d/
directory and could look like:
# /etc/yum.repos.d/myrepo.repo
[myrepo]
name=My Repository
baseurl=file:///path/to/repository/
enabled=1
gpgcheck=0
When you have downloaded, created or rebuilt Rpm packages locally, you may want to place them on your local net or use RpmDeb capabilities to create, host and distribute your packages worldwide without the neccessity to set up and maintain infrastructure.