When I use Yum to install software, I feel most uncomfortable when the network is poor, the speed of installation is particularly slow. So, the individual on the Internet search how to use the Linux installation files as its Yum source. Several attempts have been made to successfully configure it. The following is a detailed description:
(1) Personal use of the environment
My CentOS is installed on VMware: VMware Workstation 7.1.1 + CentOS 5.5
(2) Introduction to the relevant documents used by Yum
The yum source used by CentOS is in/etc/yum.repos.d/ Two files in the directory are configured in Centos-base.repo and Centos-media.repo, where Centos-base.repo is configuring the network Yum source, and Centos-media.repo is configuring the local Yum source.
[Email protected] ~]# cd/etc/yum.repos.d/
[email protected] yum.repos.d]# LL
Total 16
-rw-r--r--1 root root 2245 Apr Centos-base.repo
-rw-r--r--1 root root 626 Apr Centos-media.repo
We can look at the content in Centos-media.repo:
[Email protected] yum.repos.d]# more Centos-media.repo
# Centos-media.repo
#
# This repo was used to mount the default locations for a CDROM/DVD on
# CentOS-5. You can use this repo and yum to install items directly off the
# DVD ISO that we release.
#
# To use this repo, put on your DVD and use it with the other repos too:
# yum--enablerepo=c5-media [command]
#
# or for the media repo, does this:
#
# yum--disablerepo=/*--enablerepo=c5-media [command]
[C5-media]
name=centos-$releasever-media
baseurl=file:///media/centos/
file:///media/cdrom/
file:///media/cdrecorder/
Gpgcheck=1
Enabled=0
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-5
Where BaseURL is the location of the local Yum source and, of course, it can be modified according to the location of our ISO configuration. However, I just attached the ISO file to the/media/centos/directory, so I didn't make any changes.
(3) mounting ISO fileMy ISO file is on the host, so, with VMware file sharing, mount the ISO file on the host to the/mnt/hgfs/directory: Vm->settings->options tab->shared folders- >set folder sharing as ' always enabled ' use the Add button to select the directory of the local ISO file, my CentOS is placed in the d:/software/os/directory, so, after adding the following: Click ' OK ', end into shared. In CentOS, we can find a os/subdirectory in the/mnt/hgfs/directory, the CentOS ISO file is in this directory, I share later, the path of the ISO file in CentOS is:/mnt/hgfs/os/ Centos-5.5-i386-bin-dvd.iso mount the image file to/media/centos/
[email protected] yum.repos.d]# Mount-o loop/mnt/hgfs/os/centos-5.5-i386-bin-dvd.iso/media/centos/
(4) Install software using local Yum sourceThe method of using the local Yum source has been described in Centos-media.repo: (4.1) In addition to using the local Yum source, it will also be using a different Yum source
yum--enablerepo=c5-media [command](4.2) Just use local Yum source
Yum--disablerepo=/*--enablerepo=c5-media [command]Here is the installation of MySQL with local Yum source
[[email protected] yum.repos.d]# yum--disablerepo=/*--enablerepo=c5-media Install Mysql-server Loaded plugins:fastestmirrorloading mirror speeds from cached hostfile * c5-media: c5-media &NBS P , &NB Sp | 1.1 KB 00:00 c5-media/primary &NB Sp | 920 KB 00:00 c5-media &NBS P , &NB Sp 2599/2599setting up Install processresolving dependencies--> Running transaction Check---> Package mysql-server.i386 0:5.0.77-4.el5_4.2 set to is updated--> processing dependency:mysql = 5.0.77-4.el5_4.2 for P Ackage:mysql-server--> ProceSsing Dependency:perl (DBI) for package:mysql-server--> processing dependency:libmysqlclient.so.15 (libmysqlclient _15) for package:mysql-server--> processing dependency:perl-dbi for package:mysql-server--> Processing Dependenc y:libmysqlclient_r.so.15 (libmysqlclient_15) for package:mysql-server--> processing Dependency: libmysqlclient.so.15 for package:mysql-server--> processing dependency:perl-dbd-mysql for package:mysql-server--& Gt Processing dependency:libmysqlclient_r.so.15 for package:mysql-server--> Running transaction Check---> Package Mysql.i386 0:5.0.77-4.el5_4.2 set to is updated---> Package perl-dbd-mysql.i386 0:3.0007-2.el5 set to be updated---> Package perl-dbi.i386 0:1.52-2.el5 set to be updated--> finished Dependency resolution dependencies Resolved&nbs P;================================================================================ package arch VersioN Repository size====================== ==========================================================installing: mysql-server i386 5.0.77-4.el5_4.2 c5-media 9.8 MIns Talling for Dependencies: mysql i386 5.0. 77-4.el5_4.2 c5-media 4.8 m perl-dbd-mysql &NBSP ; I386 3.0007-2.EL5 c5-media 148 K  PERL-DBI i386 1.52-2.EL5 c5-media K transaction summary================================ ================================================install 4 package (s) Upgrade 0 package (s) total download size:15 MIs this OK [y/n]: ydownloading Packages:-------------------------------------------------------------------------- ------Total &NBSP ; 469 MB/s | 15 MB 00:00 warning:rpmts_hdrfromfdno:header V3 DSA signature:nokey, key ID e856 2897c5-media/gpgkey &NBS P | 1.5 KB 00:00 importing GPG key 0xe8562897 "CentOS-5 key (CentOS 5 official Signing Key) & Lt [email protected]> "From/etc/pki/rpm-gpg/rpm-gpg-key-centos-5is This OK [y/n]: yrunning rpm_check_ Debugrunning Transaction testfinished Transaction testtransaction TestSucceededrunning transaction installing : perl-dbi &NBS P , 1/4 installing : MySQL and nbsp  2/4  &NB sp;installing : perl-dbd-mysql 3/4 installing : mysq L-server nbsp 4/4 installed: mysql-server.i386 0:5.0.77-4.el5_4.2 & nbsp    &NBS P;dependency installed: mysql.i386 0:5.0.77-4.el5_4.2 perl-dbd-mysql.i386 0:3.0007-2.el5 perl-dbi.i386 0:1.52-2.el5 Complete! Fast, faster than using the network Yum source installation!
CentOS configuration local Yum source (using mirrored ISO file)