YUM (Yellowdog Updater, Modified) provide more services and functionality than is available with the rpm command and other RPM-based tools.

With Yum tools and plug-ins, you can:

 

List software packages, both installed and available, in local or remote repositories

  • Check for package dependencies (packages required to install a package)
  • Create new repositories and enable or disable access to existing repositories
  • Speed up package installation by using cached information (Yum cache)
  • Extend Yum’s functionality with plug-ins such as the download-only plug-in (to download a package without installing it)

 

Configuring yum repository over httpd

 

1. Create a directory for your local repository, e.g. /home/mypackage_dir/repository:

# mkdir /home/mypackage_dir/repository

 

2. Move the RPMs from DVD installation media into the directory you just created.

# cp /media/packages/* /home/mypackage_dir/repo

 

3. Assign appropriate ownership and filesystem permissions to the local repo directory.

# chown -R root.root /home/mypackage_dir/repo

 

4. Install the createrepo package if not installed yet, and run:

# createrepo /home/mypackage_dir/repo
# chmod -R o-w+r /home/mypackage_dir/repo

 

The RHEL5 version of createrepo require a full path be given as an option or the repository will not be created correctly . To avoid problems, make sure you always use a full path.

 

5. Create a repository configuration file, e.g. /etc/yum.repos.d/customrepo.repo containing below configuration.

[myrepo]
name=My custom repository
baseurl=file:///home/mypackage_dir/repository
enabled=1
gpgcheck=0

 

6. Before you configure the repository over httpd make sure it is working on the local host where is it hosted. Install your package using yum, replace package_name with the package you want to install and locate on mypackage_dir/repository :

# yum install package_name

 

Installing and configuring httpd

 

To use the yum repository configured on repo_server on client_system through http url please follow the below instructions.

 

1. Install and setup Apache server.

 

2. You can either store the rpms in the default document root for httpd i.e., /var/www/html/repo or you can create a soft link between the document root and the repository directory. For the purpose of this post we are using a different directory that the document root.

# ln -s /var/www/html/repo /home/mypackage_dir/repo

 

3. Start the httpd service.

# service httpd start

 

Verify the repository access from the client system

 

1. Verify if you can access the repository url from the browser. The url in our case would be http://[repo_server-ip]/repo

 

2. On the client system configure .repo file as below. The .repo file can have any name of your choice and it resides in the directory /etc/yum.repos.d.

vi /etc/yum.repos.d/myrepo.repo
[repo_server-repo]
name=My RPM System Package Repo
baseurl=http://[repo_server-ip]/repo
enabled=1
gpgcheck=0

 

3. Then run the below command on client system followed by yum update to update the machine.

# yum repolist
# yum update

 

Note

The steps contained in this article work for any release, but the createrepo command must be run with the createrepo of the RHEL major release for its repository – this is due to formatting differences in rpm between major releases. This means you need to run createrepo on RHEL5 for a RHEL5 repository, on RHEL6 for a RHEL6 repository and so on.

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)