Creating custom repositories for CentOS

Creating a YUM repository is one of the easiest and best ways to install software or security updates on multiple systems over LAN. We can download all the packages from the internet repository or from the DVD and host them on the local server, which will be known as the YUM server. Other Linux machines on the LAN can be configured to download the required packages from the local YUM server and they will be known as the YUM clients. This saves internet bandwidth, provides offline installation of packages to clients, and speeds up the update process.

In this section, we will create a custom repository of the packages shipped in the CentOS 7 DVD and share this repository to clients using an FTP server, as follows:

  1. Mount the media containing the packages. In our case, it will be the CentOS 7 DVD, as shown here:
  1. Install the FTP server package, vsftpd, from the mounted DVD, as shown here:
  1. Now, enable the service to start vsftpd on boot automatically and start the service, as shown here:
  1. Install the createrepo package to create a local repository database. If the internet is connected to our system, we can use YUM to install the createrepo package, as shown in command line here:
$ yum install createrepo -y

If you don’t have an internet connection, then install the package using the RPM package manager, as shown here:

We got the preceding error because in our system the createrepo package dependencies were not installed. So, we met the dependencies of createrepo package. First, install the following packages in the same order that’s shown here:

  1. Store the packages in the ftp folder to build the local repository, as shown here:
  1. Restore the SELinux tag on packages copied from the DVD, as per the vsftpd server files, as shown here:
  1. Create a YUM server configuration file with the .repo extension in the /etc/yum.repos.d/ directory, as shown in command line here:
$ vim /etc/yum.repos.d/localserver.repo

The content of the localserver.repo file is shown here:

  1. Enable the local YUM server repository and clean the yum cache by using the yum command, as shown here:
$ yum clean all

After cleaning the previous cache of the YUM database, build the YUM database of the repository from scratch with the command that’s shown here:

Related Articles

How to add swap space on Ubuntu 21.04 Operating System

How to add swap space on Ubuntu 21.04 Operating System

The swap space is a unique space on the disk that is used by the system when Physical RAM is full. When a Linux machine runout the RAM it use swap space to move inactive pages from RAM. Swap space can be created into Linux system in two ways, one we can create a...

read more

Lorem ipsum dolor sit amet consectetur

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

7 + 14 =