Creating custom repositories

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:

You can use any other application such as a web server or an NFS server for sharing the packages of the YUM server (system serving the packages) to the YUM client (system downloading the packages). We also need to open the corresponding application port in the firewall to allow access for YUM clients for downloading packages from the YUM server.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.173.112