: How to Setup YUM repositories to update or install package from ISO CDROM Image :
yum (Yellow dog Updater Modified) is a package manager for RPM compatible Linux systems such as CentOS, Fedora core and latest Redhat Enterprise Linux.
So how do you use yum to update / install packages from an ISO of CentOS / FC / RHEL CD?
Creation of yum repositories is handled by a separate tool called createrepo, which generates the necessary XML metadata. If you have a slow internet connection or collection of all downloaded ISO images, use this hack to install rpms from iso images.
Step # 1: Mount an ISO file
a) First you need to have the ISO CDROM image of the respective operating system.
b) Then you need to mount that iso image. Mounted devices are stored at: /mnt folder.
So lets create a directory named as "ISO" in /mnt folder. To create a directory use the below command:
mkdir -p /mnt/ISO
Once the directory is created then the path will look like /mnt/ISO
c) Now mount the iso image (filename.iso) using the below command:
mount -o loop filename.iso /mnt/ISO
Then to install createrepo package, type the below command:
yum install createrepo
During this process if you get message as "reaterepo command not found, then that package (createrepo) may not have been availoable on that system and so you need to first install it using the rpm -ivh command and the name of the createrepo-xxx.rpm pakage availabel on your ISO image/DVD.
Step # 2: Create a repository
You need to creat a folder for storing the repository data.
You can create the folder to any desired path but we prefer to create a directory named as "repo" in /mnt folder only for ease of understanding. Once the directory is created then the path will look like /mnt/repo
Use createrepo to generate the necessary XML metadata. Type the below command to do so:
createrepo -o /mnt/repo .
Step # 3: Create config file
a) You need to create a repo config file in /etc/yum.repos.d/ directory.
Then add the below content in that file which shares the path where the ISO image has been mounted.
To create a file named as "iso.repo" in /etc/yum.repos.d/ directory, type the below command:
Then add the below content in that file and then save & close the file:
[My ISO Repository]
Step # 4: Install the required package from ISO image using the "yum" command
yum install <package name>
For example, if you want to install SAMBA (for file sharing) from the ISO image then type the below command:
yum install samba
(OR) Enter the below command:
yum install samba*
(where * indicates to install all relative dependencies of samba)
Whenever you restart the linux server system or if you have unmounted the ISO and if you want to install the dependencies from the repository then you need to first mount (extract the iso files) ISO to a folder and then you can install dependencies uisng the Yum install command.