Because the CentOS configuration in virtual box host-only shared win7 Internet connection, the configuration fails, so you can only use the CentOS DVD to configure the Yum software source. Otherwise it will not be finished.
1. first to insert the DVD's ISO CD in virtual box, believe this step, everyone will, otherwise how to install CentOS in virtual box?
2. mount the ISO CD
After the first step, we found that executing the DF command, altogether did not see the ISO disc that we mounted above, what's going on?
[Email protected] ~]# dffilesystem 1K-blocks Used Available use% mountedon/dev/sda1 287673564690696 22608708 %/tmpfs 515272 228 515044 1 %/dev/shm/dev/sda2 999320 1436 945456 1%/tmp
We execute:lsblk to see the ISO discs that we mounted in the first step:
[[Email protected] ~]# lsblkname maj:min RM SIZE RO TYPE MOUNTPOINTsr0 One:0 1 3.8G0RomSDA8:0 030G0disk├─sda18:1 028G0Part/├─sda28:2 01G0Part/Tmp└─sda38:3 01G0Part [SWAP]
The sr0 size 3.8G above is the ISO disc we mounted above. We see that he has no mount point, the value below the mountpoint column is empty, which is why we can not see the ISO disc with the DF command above. So we need to mount the sr0 on a mount point:
3. mount the ISO:
[Email protected] ~]# ll/dev/13 Sep 9:/dev/cdrom- >~]# mkdir/mnt/
The results of Ll/dev/cdrom see that it is a connection to the SR0;
Mkdir/mnt/cdrom set up a mount point;
Mount/dev/cdrom/mnt/cdrom mount the disc to the/mnt/cdrom;
Mount execution is not successful, you need to add parameters: Mount- t iso9660 /dev/cdrom/mnt/cdrom/
[[Email protected] ~]# Dffilesystem 1K-blocks used Available use%mounted on/dev/sda128767356 4690684 22608720 -% /Tmpfs515272 228 515044 1%/dev/SHM/dev/sda2999320 1436 945456 1% /tmp/dev/sr03934618 3934618 0 -%/mnt/cdrom
When I look at the results of DF, I see that/dev/sr0 is attached to the/mnt/cdrom
Let's go and check the contents of the disc:
[Email protected] ~]# cd/mnt/Cdrom[[email protected] cdrom]# lltotal562-r--r--r--.2Root root -Oct - theCentos_buildtag-r--r--r--.2Root root212Nov - -EULA-r--r--r--.2Root root18009Nov - -Gpldr-xr-xr-x.3Root root2048Oct - theIMAGESDR-xr-xr-x.2Root root2048Oct - theisolinuxdr-xr-xr-x.2Root root534528Oct - thePackages-r--r--r--.2Root root1354Oct + therelease-notes-en-Us.htmldr-xr-xr-x.2Root root4096Oct - theRepodata-r--r--r--.2Root root1706Nov - -rpm-gpg-key-centos-6-r--r--r--.2Root root1730Nov - -rpm-gpg-key-centos-debug-6-r--r--r--.2Root root1730Nov - -rpm-gpg-key-centos-security-6-r--r--r--.2Root root1734Nov - -rpm-gpg-key-centos-testing-6-r--r--r--.1Root root3165Oct - theTRANS. TBL
In order to avoid the need to mount the operation each time, we modify the/etc/fstab, let the system automatically help us mount:
[Email protected] cdrom]# cat/etc/fstab##/etc/fstab# Created by Anaconda on Wed A Ten: -: Wu -# # Accessible filesystems, by reference, is maintained under'/dev/disk'# See mans pages Fstab (5), Findfs (8), Mount (8) and/or Blkid (8) forMore Info#uuid=050bfcba-55c7-4618-9159-497232ACCA9D/EXT4 defaults1 1UUID=35cc903b-a973-4fe8-84b5-69c1aaa9d7f2/tmp EXT4 Defaults1 2UUID=7900da09-a872-4be0-95b7-7668eea54179 Swap swap Defaults0 0Tmpfs/DEV/SHM TMPFS Defaults0 0devpts/dev/pts devpts gid=5, mode=620 0 0Sysfs/sys SYSFS Defaults0 0proc/PROC proc Defaults0 0/dev/cdrom/mnt/cdrom iso9660 Defaults0 2
The last line is the content we added. When the system starts, the file mounts in the/etc/fstab are executed.
4. Configure the mounted DVD disc to do the Yum software source
[Email protected] cdrom]# cd/etc/yum.repos.d/[email protected] yum.repos.d]# lltotal --rw-r--r--.1Root root1991Oct at thecentos-Base.repo-rw-r--r--.1Root root647Oct at thecentos-Debuginfo.repo-rw-r--r--.1Root root289Oct at thecentos-Fasttrack.repo-rw-r--r--.1Root root628Sep9 the: -centos-Media.repo
-rw-r--r--.1Root root5394Oct at theCentos-vault.repo
Software source So the configuration is under the directory/etc/yum/repso.d/
Make a backup first:
[[Email protected] yum.repos.d]# mv Centos-base.repo centos-base.repo.backup[[email protected] yum.repos.d]# CP CentOS-media.repo Centos-media.repo.backup
mv Drop Centos-base.repo reason, which includes all the Yum software source on the network, if not MV off, each time will go to the network of Yum Software source search, waste time .
After backing up Centos-media.repo , then we modify it and edit Centos-media.repo :
1> Change Gpgcheck and enabled to: gpgcheck=0 enabled=1
2> Change the second line in the baseurl parameter to the original "File:///media/cdrom" value to:file:///mnt/cdrom/
The result of the modification is as follows:
[email protected] yum.repos.d]# cat centos-media.repo# CentOS-media.repo## This repo can is used with mounted DVD Media, verify the Mount point for# CentOS-6. You can use Thisrepo and yum to install items directly off the# DVD ISO, we release.## to use ThisRepo, putinchYour DVD and use it with the other repos too:# Yum--enablerepo=c6-Media [command]## or forOnly the media repo, Do This: # # Yum--disablerepo=\*--enablerepo=c6-Media [Command][c6-Media]name=centos-$releasever-Mediabaseurl=file:///media/centos/File///mnt/cdrom/File///media/cdrecorder/gpgcheck=0enabled=1Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-6
3> Clean yum cache and update Yum:
[email protected] yum.repos.d]# Yum clean allloaded plugins:fastestmirror, refresh-PackageKit, Securitycleaning repos:c6-mediacleaning up everythingcleaning up list of fastest mirrors[[email protected] yum. repos.d]#
[email protected] yum.repos.d]# yum updateloaded plugins:fastestmirror, refresh-PackageKit, securitysetting up Update processdetermining fastest mirrors* c6-Media:file:///media/centos/repodata/repomd.xml: [Errno] Could not open/read file:///Media/centos/repodata/repomd.xmlTrying other Mirror.file:///media/cdrecorder/repodata/repomd.xml: [Errno] Could not open/read file:///Media/cdrecorder/repodata/repomd.xmlTrying Other Mirror.c6-media |4.0Kbxx:xx. .. c6-media/primary_db |3.5MBxx:xx ... No Packages marked forUpdate[[email protected] yum.repos.d]#
You can then use the local ISO CD's software source to install the software.
[email protected] yum.repos.d]# Yum install pcre-develloaded plugins:fastestmirror, refresh- from * c6-media:package pcre-devel-7.8-6do[email Protected] yum.repos.d]#
Shows that I have installed the pcre-devel.
Configure the local DVD disc for CentOS 6.6 in Virtual box to do the Yum software source