【linux学习】 配置yum

做实验老遇到缺少linux各种包的情况,rpm安装会因为各种依赖而累死人,配置yum就不用考虑依赖性了,老得用到,所以在此做个分享,方法如下:

1、虚拟机挂载光盘镜像,vmware右下角第二个小图标,

 

 

里面选择好挂载的光盘位置,如黄色箭头部分,该部分需要手动指定你的iso光盘的位置

 

 

2、挂载光盘,之后才能用,出现红色字体说明成功

[root@dhsh ~]# ls -l /dev/cdrom |grep cd

lrwxrwxrwx 1 root root 3 Aug  5 15:57 /dev/cdrom -> hdc

[root@dhsh ~]# mount -o loop /dev/cdrom /aaa

[root@dhsh ~]# mount

……

/dev/hdc on /aaa type iso9660 (ro,loop=/dev/loop0)

 

3、编辑yum源文件

[root@dhsh ~]# cd /etc/yum.repos.d/

[root@dhsh yum.repos.d]# ll

total 8

-rw-r--r-- 1 root root 254 Aug  4  2009 rhel-debuginfo.repo

 

[root@dhsh yum.repos.d]# vim server.repo

[rhel-server]

name=rhe5

baseurl=file:///aaa/Server

注意;此处yum源为iso光盘,如果有ftp,则可以换成ftp://xxx的地址即可,走网络方式更加方便

enabled=1

gpgcheck=0

 

[rhel-VT]

name=rhe5

baseurl=file:///aaa/VT

enabled=1

gpgcheck=0

 

4、大功告成,测试一下,出现红色字体部分,则说明成功

[root@dhsh yum.repos.d]# yum install sysstat*

Loaded plugins: rhnplugin, security

This system is not registered with RHN.

RHN support will be disabled.

rhel-VT                                                  | 1.3 kB     00:00    

rhel-VT/primary                                          |  20 kB     00:00    

rhel-VT                                                                   72/72

rhel-server                                              | 1.3 kB     00:00    

rhel-server/primary                                      | 845 kB     00:00    

rhel-server                                                           3040/3040

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package sysstat.x86_64 0:7.0.2-3.el5 set to be updated

--> Finished Dependency Resolution

…...                                                

Complete!

 

5、开机自动挂载,省的下次还得手动挂载光盘才能用

[root@dhsh yum.repos.d]# vim /etc/rc.d/rc.local

mount -o loop /dev/cdrom /aaa

你可能感兴趣的:(linux,配置,yum)