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?
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
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.
- 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.
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
/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)
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
If the ISO is present on the file system, mount it to
mount -o loop CentOS-6.4-x86_64-bin-DVD1.iso /media/CentOS/
cat /etc/yum.repos.d/CentOS-Media.repoand read the information provided as comments in this file. See the repo name within square brackets. It is
c6-mediaby default. Also, see the locations specified for
baseurlproperty. These URLs point to local directories
If the DVD is mounted to a mount point specified in the
baseurlproperty, then ignore this step. Otherwise, create a symbolic link at a location specified in the
baseurlproperty with the mount point as its target. An example follows.
ln -s /media/CentOS_6.4_Final /media/CentOS
In the shell, execute the
yumcommand while disabling all repos except the repo specified in
yum --disablerepo=\* --enablerepo=c6-media install gcc
Installing CentOS packages from CentOS DVD iso on VirtualBox
Insert CentOS DVD image in VM:
DVD will be visible at following location:
Login as root:
Create Directory /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>