Install packages in CentOS from DVD without connection to internet
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 /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.
- 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
/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)
-
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
/media/CentOS
using themount
command with-o loop
option.mount -o loop CentOS-6.4-x86_64-bin-DVD1.iso /media/CentOS/
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 isc6-media
by default. Also, see the locations specified forbaseurl
property. These URLs point to local directories/media/CentOS
,/media/cdrom
and/media/cdrecorder/
by default.-
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 thebaseurl
property with the mount point as its target. An example follows.ln -s /media/CentOS_6.4_Final /media/CentOS
-
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