虚拟机下Centos本地光盘yum源配置

1.虚拟机中安装的Centos,只需将安装包ISO文件挂载到/mnt下面

mount dev/cdrom /mnt/Centos

2.进入到 /etc/yum.repos.d/  ,该目录下包含了四个文件:

-rw-r--r--. 1 root root 1926 11月 27 2013 CentOS-Base.repo1
-rw-r--r--. 1 root root  638 11月 27 2013 CentOS-Debuginfo.repo1
-rw-r--r--. 1 root root  628 3月  12 16:11 CentOS-Media.repo
-rw-r--r--. 1 root root 3664 11月 27 2013 CentOS-Vault.repo
3.将 CentOS-Base.repo和CentOS-Debuginfo.repo两个文件改名,绕过网络安装:

[root@sl yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repose_bak
[root@sl yum.repos.d]# mv CentOS-Debuginfo.repo CentOS-Debuginfo.repo_bak
4.编辑文件CentOS-Media.repo:(也可以自己新增一个repo文件,more用于查看,使用vi进行编辑)

 
  

5.测试yum是否配置成功

[root@sl yum.repos.d]# yum list
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
Installed Packages
ConsoleKit.x86_64                        0.4.1-3.el6                          @anaconda-CentOS-201303020151.x86_64/6.4
ConsoleKit-libs.x86_64                   0.4.1-3.el6                          @anaconda-CentOS-201303020151.x86_64/6.4
MAKEDEV.x86_64                           3.24-6.el6                           @anaconda-CentOS-201303020151.x86_64/6.4
MySQL-python.x86_64                      1.2.3-0.3.c1.1.el6                   @anaconda-CentOS-201303020151.x86_64/6.4
PyGreSQL.x86_64                          3.8.1-2.el6                          @anaconda-CentOS-201303020151.x86_64/6.4
SDL.x86_64                               1.2.14-3.el6                         @anaconda-CentOS-201303020151.x86_64/6.4
TurboGears2.noarch                       2.0.3-4.el6                          @anaconda-CentOS-201303020151.x86_64/6.4
abrt.x86_64                              2.0.8-15.el6.centos                  @anaconda-CentOS-201303020151.x86_
more.........

6.清除yum缓存:

[root@sl yum.repos.d]# yum clean all
Loaded plugins: fastestmirror, security
Cleaning repos:
Cleaning up Everything
Cleaning up list of fastest mirrors


转自并修改于:http://www.cnblogs.com/shenliang123/p/3829044.html


你可能感兴趣的:(linux命令)