Learn to configure yum server in RPM based Linux systems. Article explains yum server configs over http and ftp protocol.
In our last article we saw yum configurations. We learnt what is yum, why to use it, what is repository, yum config file locations, config file format, how to configure DVD, http locations as 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 setup yum server over ftp and http protocol. Before proceeding with configurations make sure you have below three packages installed on your yum server.
YUM server http configuration
First of all we need to install webserver on system so that http page can be served by 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 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 browser but YUM wont be able to recognize them.
For YUM (on client side) to fetch packages from above directory you need to create index of these files (.xml). You can create it using below command –
# createrepo /var/www/html/packages/
Spawning worker 0 with 3 pkgs
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 directory so you can see it started with 0 of 3 pkgs! After completion of above command you can observe directory repodata is created in packages directory. And it contains repo detail files along with xml file.
]# ll /var/www/html/packages/repodata/
-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. Next thing is 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 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 ftp share.
Go through createrepo step explained above for the ftp share directory. Once done you can configure client with FTP address to fetch packages from yum server. Repo location entry in client repo configuration file will be –