在linux下Yum的使用

linux(为了防止安装安装出错一般在虚拟机下进行实验),安装包时候会存在安装包的依赖关系,安装起来麻烦,所以要使用yum的安装,但是你直接使用它一般来说会报错,因为它默认的联网状态,因此,需要调为桥接模式下..

下面演示一下yum的配置,如何才能够正常使用

服务器安装

 [root@localhost ~]# cat /etc/redhat-release

Red Hat Enterprise Linux Server release 6.4 (Santiago)

[root@localhost ~]# uname -a

Linux localhost.localdomain 2.6.32-358.el6.x86_64 #1 SMP Tue Jan 29 11:47:41 EST 2013 x86_64 x86_64 x86_64 GNU/Linux

服务器基本配置

[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE="eth1"

BOOTPROTO="static"

NM_CONTROLLED="yes"

ONBOOT="yes"

TYPE="Ethernet"

IPADDR=192.168.188.111

NETMASK=255.255.255.0

GATEWAY=192.168.188.2

 

[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth1

[root@localhost ~]# service network restart

Shutting down interface eth1:                              [  OK  ]

Shutting down loopback interface:                          [  OK  ]

Bringing up loopback interface:                            [  OK  ]

上面的以前肯定配置过了,先在就是走一个流程.显得专业一些.

 

[root@localhost ~]# cat /proc/sys/dev/cdrom/info

CD-ROM information, Id: cdrom.c 3.20 2003/12/17

 

drive name:             sr0

drive speed:            1

drive # of slots:       1

Can close tray:         1

Can open tray:          1

Can lock tray:          1

Can change speed:       1

Can select disk:        0

Can read multisession:  1

Can read MCN:           1

Reports media changed:  1

Can play audio:         1

Can write CD-R:         1

Can write CD-RW:        1

Can read DVD:           1

Can write DVD-R:        1

Can write DVD-RAM:      1

Can read MRW:           1

Can write MRW:          1

Can write RAM:          1

 

[root@localhost ~]# mkdir /mnt/Server

[root@localhost ~]# mount /dev/cdrom /mnt/Server/

mount: block device /dev/sr0 is write-protected, mounting read-only

 

[root@localhost Server]# ll |wc –l     wc显示一共的数量

50

 

[root@localhost yum.repos.d]# vi /etc/yum.repos.d/yum.repo

 

[base]

name=Red Hat Enterprise Linux base

baseurl=file:///mnt/Server

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

 

(红色为添加的内容)

 

进行yum清除,再更新缓存

[root@localhost yum.repos.d]# cd /etc/pki/rpm-gpg/

[root@localhost rpm-gpg]# yum clean all

Loaded plugins: product-id, security, subscription-manager

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

Cleaning repos: base

Cleaning up Everything

 

这样就可以成功,如果有什么疑问,大家可以留言解决。不同版本有着不同的方法。

本文出自 “李景祥” 博客,请务必保留此出处http://9283898.blog.51cto.com/9273898/1550322

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。