@
you're reading...
General, Linux Tips and Tricks

How to setup yum repository using locally mounted DVD

Environment
CentOS/RHEL 6

Background
If you find yourself needing to install/update packages on your CentOS 6 system with no internet then the setup below can be used.
You just need to download a DVD/ISO of your current system and copied over to the server.
In this example, will present how to setup mysql-server package using a locally mounted DVD of CentOS 6 iso.

Once you have downloaded a DVD version of your current OS version and copied it over to a location on your server.
Mount the installation ISO to a directory like /mnt/media, e.g.:

# mkdir /mnt/media
# mount /dev/sr0 /mnt/media

Add a new repo utilizing your locally mounted DVD like below:

# vim /etc/yum.repos.d/media.repo
[centosiso]
name=CentOS-$releasever – Media
baseurl=file:///mnt/media
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

Clear the cache and check whether you can get the packages list from the DVD repo. In this example, I have disabled all other repos utilizing only locally mounted DVD

# yum –disablerepo=* –enablerepo=centosiso clean all
# yum –disablerepo=* –enablerepo=centosiso list|grep mysql-server

It should look like something below:
mysql-server.x86_64 5.1.73-8.el6_8 centosiso

# yum –disablerepo=* –enablerepo=centosiso install mysql-server
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
Resolving Dependencies
–> Running transaction check
—> Package mysql-server.x86_64 0:5.1.73-8.el6_8 will be installed
–> Processing Dependency: mysql = 5.1.73-8.el6_8 for package: mysql-server-5.1.73-8.el6_8.x86_64
–> Processing Dependency: perl-DBI for package: mysql-server-5.1.73-8.el6_8.x86_64
–> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5.1.73-8.el6_8.x86_64
–> Processing Dependency: perl(DBI) for package: mysql-server-5.1.73-8.el6_8.x86_64
–> Running transaction check
—> Package mysql.x86_64 0:5.1.73-8.el6_8 will be installed
—> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 will be installed
—> Package perl-DBI.x86_64 0:1.609-4.el6 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================
Installing:
mysql-server x86_64 5.1.73-8.el6_8 centosiso 8.6 M
Installing for dependencies:
mysql x86_64 5.1.73-8.el6_8 centosiso 895 k
perl-DBD-MySQL x86_64 4.013-3.el6 centosiso 134 k
perl-DBI x86_64 1.609-4.el6 centosiso 705 k

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

Total download size: 10 M
Installed size: 29 M
Is this ok [y/N]: y
Downloading Packages:
———————————————————————————————————————
Total 34 MB/s | 10 MB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : perl-DBI-1.609-4.el6.x86_64 1/4
Installing : perl-DBD-MySQL-4.013-3.el6.x86_64 2/4
Installing : mysql-5.1.73-8.el6_8.x86_64 3/4
Installing : mysql-server-5.1.73-8.el6_8.x86_64 4/4
Verifying : perl-DBD-MySQL-4.013-3.el6.x86_64 1/4
Verifying : mysql-server-5.1.73-8.el6_8.x86_64 2/4
Verifying : mysql-5.1.73-8.el6_8.x86_64 3/4
Verifying : perl-DBI-1.609-4.el6.x86_64 4/4

Installed:
mysql-server.x86_64 0:5.1.73-8.el6_8

Dependency Installed:
mysql.x86_64 0:5.1.73-8.el6_8 perl-DBD-MySQL.x86_64 0:4.013-3.el6 perl-DBI.x86_64 0:1.609-4.el6

Complete!

 

 

Discussion

No comments yet.

Leave a comment