2

I have a CentOS 6.4 system with no connection to internet. I have the installer DVD though. How can I install a package, say gcc, using this DVD alone?

2 Answers 2

4

Let us assume the ISO is already burnt into a DVD, or the ISO is present as a file on your file system. First, we need to mount it. The preferred mount point to mount it is /media/CentOS, because yum is configured to look for repositories from this location by default while installing packages from DVD. The steps below describe how to mount the ISO (whether present as a file or burnt into DVD) and install packages from the ISO.

  1. If you have the ISO burnt into a DVD, insert the DVD into the CentOS system. If the ISO is not burnt into a DVD, but present as a separate file on the file system, then skip the next two steps and go directly to step 4 in this list.
  2. Check if the DVD has been mounted automatically. To do this execute the following command:

    mount | grep CentOS
    

    If this command returns an output, it means the DVD has been mounted. For example, the following example output shows that the DVD has been mounted to /media/CentOS_6.4_Final automatically.

    /dev/sr0 on /media/CentOS_6.4_Final type iso9660 (ro,nosuid,nodev,uhelper=udisks,uid=500,gid=500,iocharset=utf8,mode=0400,dmode=0500)
    
  3. If the CD has been mounted automatically, then ignore this step. Otherwise, mount it manually.

    mkdir /media/CentOS
    mount -t iso9660 /dev/sr0 /media/CentOS
    
  4. If the ISO is present on the file system, mount it to /media/CentOS using the mount command with -o loop option.

    mount -o loop CentOS-6.4-x86_64-bin-DVD1.iso /media/CentOS/
    
  5. Execute: cat /etc/yum.repos.d/CentOS-Media.repo and read the information provided as comments in this file. See the repo name within square brackets. It is c6-media by default. Also, see the locations specified for baseurl property. These URLs point to local directories /media/CentOS, /media/cdrom and /media/cdrecorder/ by default.

  6. If the DVD is mounted to a mount point specified in the baseurl property, then ignore this step. Otherwise, create a symbolic link at a location specified in the baseurl property with the mount point as its target. An example follows.

    ln -s /media/CentOS_6.4_Final /media/CentOS
    
  7. In the shell, execute the yum command while disabling all repos except the repo specified in /etc/yum.repos.d/CentOS-Media.repo:

    yum --disablerepo=\* --enablerepo=c6-media install gcc
    
0

Installing CentOS packages from CentOS DVD iso on VirtualBox

Insert CentOS DVD image in VM:

Devices->Optical drives->CentOS-8.5.2111-x86_64-dvd1.iso

DVD will be visible at following location:

/run/media/user/CentOS-8-5-2111-x86_64-dvd/

Login as root:

su root

Create Directory /media/CentOS

mkdir /media/CentOS

Run following commands to mount package repositories under /media/CentOS:

$> ln -s /run/media/user/CentOS-8-5-2111-x86_64-dvd/BaseOS/ /media/CentOS
$> ln -s /run/media/user/CentOS-8-5-2111-x86_64-dvd/AppStream /media/CentOS

$> ls /media/CentOS/  
AppStream BaseOS

Check status of repositories using command:

$> yum repolist all

Enable our media repos:

$> yum config-manager --enable=media-appstream
$> yum config-manager --enable=media-baseos

Disable all other repos:

$> yum config-manager --disable=[repoid]

Run following command and you will see all available packages:

$> yum list

Install package using command:

$> yum install <package-name>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .