Learn to configure the yum server in RPM-based Linux systems. The article explains yum server configs over HTTP and FTP protocol.
In our last article, we saw yum configurations. We learned what is yum, why to use it, what is repository, yum config file locations, config file format, how to configure DVD, HTTP locations as a repository. In this article, we will walk through YUM server configuration i.e. configuring serverA as a YUM server so that other clients can configure serverA as a repo location.
Other YUM related articles :
- How to download only, install, remove & upgrade package
- Yum automatic updates
- How to check if package is installed
- Package naming conventions
In this article, we will see how to set up a yum server over FTP and HTTP protocol. Before proceeding with configurations make sure you have three packages
createrepo installed on your yum server.
YUM server http configuration
First of all, we need to install a web server on the system so that the HTTP page can be served by the system. Install httpd package using yum. Post-installation you will have
/var/www/html directory which is home of your webserver. Create packages directory within it which will hold all packages. Now we have
/var/www/html/packages directory to hold packages of our YUM server.
Start httpd service and verify you are able to access
http://ip-address/packages in the browser. It should look like below :
Now, we need to copy package files (
.rpm) into this directory. You can manually copy them from your OS DVD or you can download using wget from online official package mirrors. Once you populate
/var/www/html/packages directory with .rpm files they are available to download from the browser but YUM won’t be able to recognize them.
For YUM (on client side) to fetch packages from the above directory you need to create an index of these files (
.xml). You can create it using below command –
# createrepo /var/www/html/packages/ Spawning worker 0 with 3 pkgs Workers Finished Gathering worker results Saving Primary metadata Saving file lists metadata Saving other metadata Generating sqlite DBs Sqlite DBs complete
Here I kept only 3 RPMs in the directory so you can see it started with 0 of 3 pkg! After completion of the above command, you can observe directory
repodata is created in
packages directory. And it contains repo detail files along with
# ll /var/www/html/packages/repodata/ total 40 -rw-r--r--. 1 root root 10121 Mar 23 15:38 196f88dd1e6b0b74bbd8b3a689e77a8f632650da7fa77db06f212536a2e75096-primary.sqlite.bz2 -rw-r--r--. 1 root root 4275 Mar 23 15:38 1fc168d13253247ba15d45806c8f33bfced19bb1bf5eca54fb1d6758c831085f-filelists.sqlite.bz2 -rw-r--r--. 1 root root 2733 Mar 23 15:38 59d6b723590f73c4a65162c2f6f378bae422c72756f3dec60b1c4ef87f954f4c-filelists.xml.gz -rw-r--r--. 1 root root 3874 Mar 23 15:38 656867c9894e31f39a1ecd3e14da8d1fbd68bbdf099e5a5f3ecbb581cf9129e5-other.sqlite.bz2 -rw-r--r--. 1 root root 2968 Mar 23 15:38 8d9cb58a2cf732deb12ce3796a5bc71b04e5c5c93247f4e2ab76bff843e7a747-primary.xml.gz -rw-r--r--. 1 root root 2449 Mar 23 15:38 b30ec7d46fafe3d5e0b375f9c8bc0df7e9e4f69dc404fdec93777ddf9b145ef3-other.xml.gz -rw-r--r--. 1 root root 2985 Mar 23 15:38 repomd.xml
Now your location
http://ip-address/packages is ready to be identified by client YUM to fetch packages. The next thing is to configure another Linux machine (client) with this HTTP path as repo and try installing packages (which you kept in packages directory obv).
YUM server ftp configuration
In the FTP scenario, we are keeping packages accessible to other machines over FTP rather than HTTP protocol. You need to configure FTP and keep packages directory in the FTP share.
createrepo step explained above for the FTP share directory. Once done you can configure the client with FTP address to fetch packages from the yum server. Repo location entry in the client repo configuration file will be –