CentOS - YUM Local Repository from ISO

Preface

In this document we’ll see how to use standard CentOS installation ISO image, as data source for our YUM Repository. This will enable us to use mentioned ISO as data source for installing of RPM’s with dependencies.

Create Local YUM Repository from ISO

Mount ISO

To access data in our ISO image we’ll need to mount it so that it will be accessible as read only filesystem

Command - Mount ISO

# mount -o loop <PATH_TO_ISO> <PATH_TO_MOUNT_POINT>

Example - Mount ISO

[root@CentOS /]# mkdir /mnt/iso                                                  # Create Mount Point

[root@CentOS /]# mount -o loop /tmp/CentOS-7.0-1406-x86_64-DVD.iso /mnt/iso/     # Mount ISO to Mount Point

[root@CentOS /]# df -h                                                           # Check if ISO is Mounted
Filesystem                           Size  Used Avail Use% Mounted on
/dev/mapper/vg_centos-lv_root        9.0G  5.7G  2.8G  68% /
tmpfs                                499M     0  499M   0% /dev/shm
/dev/sda1                            477M   33M  419M   8% /boot
/tmp/CentOS-7.0-1406-x86_64-DVD.iso  3.9G  3.9G     0 100% /mnt/iso              # Here it's mounted

Confige YUM Client

To configure YUM client we’ll need to create a Config File:

[root@CentOS /]# vi /etc/yum.repos.d/ISO-CentOS.repo      # Please create this file
[ISO-CentOS]
name=Temporary Repo from Instalaltion from ISO
baseurl=file:///mnt/iso/
enabled=1
gpgcheck=0
proxy=_none_

Explanation:

/etc/yum.repos.d/ISO-CentOS.repo                          # YUM config file where we'll specify the repository details
[ISO-CentOS]                                              # Local Repo ID of YUM Repository
name=Temporary Repo from Instalaltion from ISO            # Long Name of YUM Repository
baseurl=file:///mnt/iso/                                  # PATH to the Mounth Point of the ISO
enabled=1                                                 # If this YUM Repository shall be used: 0=NO ; 1=YES
gpgcheck=0                                                # If GPG validation of RPM's is enabled: 0=NO ; 1=YES
proxy=_none_                                              # If there is somme proxy that will provide access to the repo:
                                                          #     _none_ = NO
                                                          #     http[s]://<IP>:<PORT> = Definition of proxy

Validation

This is just quick test if we can use access the YUM Repository

[root@CentOS /]# yum clean all                                                 # Clean local linforamtion about YUM Repositories
Loaded plugins: fastestmirror, security
Cleaning repos: ISO-CentOS
Cleaning up Everything
Cleaning up list of fastest mirrors
[root@CentOS /]# yum repolist ISO-CentOS                                      # Download information from particular YUM Repository
Loaded plugins: fastestmirror, security
Determining fastest mirrors
repo id        repo name                                        status
ISO-CentOS     Temporary Repo from Instalaltion from ISO        3,538         # Summary about our Repository
repolist: 3,538
Navigation
Print/export
QR Code
QR Code wiki:os:centos:centos-yum_local_repository_from_iso (generated for current page)