A yum repository holds the rpms and metadata about the rpms. A yum repository must be configured in order to use yum on any yum based Linux system. This post provides steps to configure a yum repository for installing packages on CentOS/RHEL systems.
Configuring yum repository server
1. Create a directory for you local repository, e.g. /home/mypackage_dir/repository. Move the RPMs into that directory.
# cp /media/packages/* /home/mypackage_dir/repo
2. Fix some ownership and filesystem permissions:
# chown -R root.root /home/mypackage_dir/repo
3. Install the createrepo package if not installed yet, and run
# createrepo /home/mypackage_dir/repo # chmod -R o-w+r /home/mypackage_dir/repo
4. Create a repository configuration file, e.g. /etc/yum.repos.d/customrepo.repo containing:
[local] name=My RPM System Package Repo baseurl=file:///home/mypackage_dir/repository enabled=1 gpgcheck=0
5. Install your package using yum command like below, replace package_name with the package you want to install and locate on mypackage_dir/repository:
# yum install package_name
6. To use the yum repository configured on node1 on node2 through http url please follow the below instructions.
# yum install httpd # ln -s /var/www/html/repo /home/mypackage_dir/repo # service httpd start
Then in a web browser access the URL http://[node1-ip]/repo
Configuring yum Client Server
In node 2 configure .repo file as below.
[node1-repo] name=My RPM System Package Repo baseurl=http:///repo enabled=1 gpgcheck=0
Then run the below command on node2 followed by yum update to update the machine.
# yum repolist # yum update