Print Friendly, PDF & Email

 
REQUEST

I want to set up yum repository with downloaded iso image.

 
RELATED

 
SOLUTION

Every RHEL, OEL, CENTOS iso image has a preconfigured repository. Just mount iso image and create a .repo file pointing to iso repodata directory.

 
TESTCASE

Download and transfer iso image to your server. For instance, Oracle Linux Release 7 Update 3 for x86 (64 Bit)

[root@dbpilot ~] pwd
/oracle/iso
[root@dbpilot ~] ls -lthr --time-style='+'
total 4.4G
-rw-r--r--. 1 root root 4.4G  V834394-01.iso

Create a new directory or use an existing one for mounting iso image

[root@dbpilot ~] mount -t iso9660 -o loop /oracle/iso/V834394-01.iso /mnt
mount: /dev/loop0 is write-protected, mounting read-only

[root@dbpilot ~] cd /mnt
[root@dbpilot ~] ls -lthr --time-style='+'
total 1.1M
drwxr-xr-x. 5 root root 2.0K  addons
-rw-r--r--. 1 root root 1011  RPM-GPG-KEY-oracle
-rw-r--r--. 1 root root 1011  RPM-GPG-KEY
-rw-r--r--. 1 root root 183K  RELEASE-NOTES-U3-en.html
-rw-r--r--. 1 root root  63K  RELEASE-NOTES-U3-en
-rw-r--r--. 1 root root  18K  GPL
-rw-r--r--. 1 root root 8.5K  EULA
drwxr-xr-x. 2 root root 758K  Packages
drwxr-xr-x. 2 root root 4.0K  repodata
drwxr-xr-x. 2 root root 2.0K  LiveOS
drwxr-xr-x. 3 root root 2.0K  EFI
drwxr-xr-x. 3 root root 2.0K  images
-r--r--r--. 1 root root 3.3K  TRANS.TBL
drwxr-xr-x. 2 root root 2.0K  isolinux

Create a repository file. A name of the file can be anything you want but should be ended with .repo

[root@dbpilot ~] touch /etc/yum.repos.d/iso.repo

Place the following into the local.repo file

[ISO_REPOSITORY]
name=V834394-01.iso local repository
baseurl=file:///mnt
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY
gpgcheck=1
enabled=1

For details about repository parameters refer to man pages

[root@dbpilot ~] man yum.conf

Now the yum repository is ready for use

[root@dbpilot ~] yum clean all
Loaded plugins: ulninfo
Cleaning repos: ISO_REPOSITORY
Cleaning up everything

[root@dbpilot ~] yum search vim
Loaded plugins: ulninfo
ISO_REPOSITORY                                                                    | 3.6 kB  00:00:00
(1/2): ISO_REPOSITORY/group_gz                                                    | 134 kB  00:00:00
(2/2): ISO_REPOSITORY/primary_db                                                  | 4.5 MB  00:00:00
=========================================== N/S matched: vim ============================================
vim-X11.x86_64 : The VIM version of the vi editor for the X Window System
vim-common.x86_64 : The common files needed by any version of the VIM editor
vim-enhanced.x86_64 : A version of the VIM editor which includes recent enhancements
vim-filesystem.x86_64 : VIM filesystem layout
vim-minimal.x86_64 : A minimal version of the VIM editor

  Name and summary matches only, use "search all" for everything.
  
[root@dbpilot ~] yum info vim-X11.x86_64
Loaded plugins: ulninfo
Available Packages
Name        : vim-X11
Arch        : x86_64
Epoch       : 2
Version     : 7.4.160
Release     : 1.el7
Size        : 1.1 M
Repo        : ISO_REPOSITORY
Summary     : The VIM version of the vi editor for the X Window System
URL         : http://www.vim.org/
License     : Vim
Description : VIM (VIsual editor iMproved) is an updated and improved version of the
            : vi editor.  Vi was the first real screen-based editor for UNIX, and is
            : still very popular.  VIM improves on vi by adding new features:
            : multiple windows, multi-level undo, block highlighting and
            : more. VIM-X11 is a version of the VIM editor which will run within the
            : X Window System.  If you install this package, you can run VIM as an X
            : application with a full GUI interface and mouse support.
            :
            : Install the vim-X11 package if you'd like to try out a version of vi
            : with graphics and mouse capabilities.  You'll also need to install the
            : vim-common package.

 
if you have multiple iso images and want to create one single repository, refer to CREATING A LOCAL YUM REPOSITORY USING MANUALLY DOWNLOADED PACKAGES.

 
REFERENCES

Need to set up yum repository for locally-mounted DVD on Red Hat Enterprise Linux 7.

 
 

Version  : 14:03 06.02.2018
Platform : RHEL5 – RHEL7