Creating Local Yum Repository on Red Hat Enterprise linux 6

Creating a Local Yum Repository on Red Hat Enterprise Linux 6 (mounting CD Rom / ISO image) Before going in details how to create local YUM repository… little information...
CREATING LOCAL YUM REPOSITORY ON RED HAT ENTERPRISE LINUX 6

Creating a Local Yum Repository on Red Hat Enterprise Linux 6 (mounting CD Rom / ISO image)

Before going in details how to create local YUM repository… little information about YUM.

YUM – Yellowdog Updater, Modified (yum) is an open-source command-line package management utility.

Yum is the primary tool for installing, deleting, querying and managing Red Hat Enterprise Linux RPM software packages from Official as well as third party repositories.

Mount CD ROM as local repository in Red Hat Enterprise Linux 6

Please put the Red hat 6 DVD inside CDROM. Open terminal and go to root prompt

# su                         - put the password and enter in to root
# mkdir /dvdrom              - create a folder named dvdrom, better to create it on desktop
# mount /dev/cdrom /dvdrom   - Red hat 6 DVD contents now mounted as read only
# cd /etc/yum.repos.d/       - CD to this location
# vi local.repo              - Create a file and add the below details quoted with in double quotes.
"
[LocalRepo]
name=Local Repository
baseurl=file:///cdrom
enabled=1
gpgcheck=0
"

now to save and exit from vi editor command is :wq

# cd /etc/yum.repos.d/        - Remove all other repository files except the new one created local.repo. you can just move it to some other folder as backup then delete using rm -rf command.

# yum clean all               - Clear the repository cache by executing this command
# yum update                  - To update (better when you have external repositories)

To check if the local repository working fine.. let's try with a small installation like vsftpd 
# yum install vsftpd          - It will install from local repository that is (DVD ROM)

Done !

Mount the ISO image file as local repository in Red Hat Enterprise Linux 6

Before going in details… little information about ISO.

ISO Image – It’s a type of disk image file composed of the data contents from every written sector on an optical disc.

# su                          - put the password and enter in to root
# mkdir /mnt/localiso         - create a local mount folder
Copy the iso file to any of directory let's copy inside /home/mindfire/Documents
# mount -t iso9660 -ro loop /home/mindfire/Documents/rhel-server-6.4-x86_64-dvd.iso /mnt/localiso/
It will mount as read only so that none of the files can be modified.

it’s now mounted the Red hat 6 iso image file

Now create a new local.repo file and add the local repository path.

# cd /etc/yum.repos.d/       - CD to this location
# vi local.repo              - Create a file and add the below details quoted with in double quotes.
"
[LocalRepo]
name=Local Repository
baseurl=file:///mnt/localiso
enabled=1
gpgcheck=0
"

localrepo-iso2

now to save and exit from vi editor command is :wq

# cd /etc/yum.repos.d/        - Remove all other repository files except the new one created local.repo. you can just move it to some other folder as backup then delete using rm -rf command.

# yum clean all               - Clear the repository cache by executing this command
# yum update                  - To update (better when you have external repositories)

To check if the local repository working fine.. let's try with a small installation like vsftpd 
# yum install vsftpd          - It will install from local repository that is (ISO)
# df -aTh - To check status of mounted devices/files in human readable format
# mount -l - To check status of mounted devices/files
# umount /mnt/localiso - To un mount the device

Let’s add an entry in /etc/fstab so that the system always mounts the DVD image after a restart of machine.

# vi /etc/fstab               - Open fstab as root and add the entry

/home/mindfire/Documents/rhel-server-6.4-x86_64-dvd.iso /mnt/localiso iso9660 loop, ro 0 0

You might also like : To take backup and restore Mozilla Thunderbird mail client (Windows/Ubuntu/Mac)

Categories
Linux

I am a proud Indian, proud father, a blogger, Being in a profession as System administrator, my passion is troubleshooting computer issues, I do like sharing solutions through blogging making videos of solving issues.
No Comment

Leave a Reply

*

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.

RELATED BY