1. Mount the CentOS installation CD
Mkdir/mnt/cdrom
Mount-t Iso9660/dev/cdrom/mnt/cdrom
2. Modify the Yum configuration file
cd/etc/yum.repos.d/
You will see three files, the first Centos-base.repo is the configuration file for the Yum network source, and the third Centos-media.repo is the configuration of the local source.
Modify Centos-media.repo
In BaseURL, modify the 2nd path to/mnt/cdrom (that is, the CD mount point)
Change Enabled=0 to 1
3, the Yum Network source configuration file renamed to Centos-base.repo.bak, will be first in the network source to find the appropriate package, renamed directly from the local source read.
OK, now you can install the package you want, such as you want to install GCC, enter the command yum install GCC!
CentOS virtual machine cannot be networked under the Yum mode install package from local (reprinted)