Wednesday 30 July 2014

Iso repository on Red Hat or Centos - EXPLAINED!

In case that you want to install some new or update already installed packages, you can do it by using rpm command and have possible problems considering dependency issues or you can do it by using yum and avoid dependency issue because yum will do all the work for you!

In case that your server do not have access to internet or you do not have central repository server you can always use iso image and add it to your yum repository.

How to do this?

1. Copy iso image to your server
2. Mount iso image

server#mount -t iso9660 /iso_location /mount_point -o loop

In my case

server#mount -t iso9660 rhel-server-5.9-x86_64-dvd.iso /mnt -o loop

Check if it is mounted

server# mount |grep mnt
/opt/iso/rhel-server-6.3-i386-dvd.iso on /mnt type iso9660 (rw,loop=/dev/loop0)

3. Go to yum configuration folder

server#cd /etc/yum.repos.d

Create new conf file. Extension has to be .repo. 

server# cat dvd.repo
[DVD]
name=RHEL $releasever - DVD
baseurl=file:///mnt/
enabled=1
gpgcheck=0
 

First line in name of repository and you have to have this line.
Second line is just for user to know what repository he is using. This line is not necessary but it is nice to
Third line is location of your mounted iso.
Fourth line is for enabling repository. 1 is for enable,0 is for disable
Fifth line is for gpg signature check. Because I am using iso from vendor I disabled this.

You can add more options to this file if you like but this is I think simplest configuration you can get.

4.  Insert new repository in yum
# yum repolist
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
repo id                        repo name                                  status
DVD                            RHEL 6Server - DVD                         2,797
repolist: 2,797
 


5. Test if it is working.Try to install some new package

server# yum install yp-tools
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package yp-tools.i686 0:2.9-12.el6 will be installed
--> Processing Dependency: ypbind for package: yp-tools-2.9-12.el6.i686
--> Running transaction check
---> Package ypbind.i686 3:1.20.4-29.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package           Arch          Version                     Repository    Size
================================================================================
Installing:
 yp-tools          i686          2.9-12.el6                  DVD           64 k
Installing for dependencies:
 ypbind            i686          3:1.20.4-29.el6             DVD           51 k

Transaction Summary
================================================================================
Install       2 Package(s)

Total download size: 115 k
Installed size: 241 k
Is this ok [y/N]: n
Exiting on user Command

server#



As you can see, you can install new package from DVD repository.

And that is it!


No comments: