yum服务器的搭建及yum指令

yum服务器的搭建及yum指令

Yum(全称为 Yellow dog Updater, Modified)是一个在Fedora中的Shell前端软件包管理器。基于RPM包管理,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软体包,无须繁琐地一次次下载、安装。

拓扑图:

clip_image002

服务器端的配置:

建挂载点,进行光盘挂载

[root@mh3570 ~]# mkdir /mnt/cdrom

[root@mh3570 ~]# mount /dev/cdrom /mnt/cdrom

进入 /mnt/cdrom/Server中安装ftp服务

[root@mh3570 Server]# rpm -ivh vsftpd-2.0.5-16.el5.i386.rpm

重启vsftpd服务

[root@mh3570 ~]# service vsftpd start

进入 /var/ftp/pub中,拷贝文件

[root@mh3570 pub]# cp -r /mnt/cdrom/. ./

客户端的配置:

用vim编辑rhel-debuginfo.repo文件

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

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

total 8

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

[root@localhost yum.repos.d]# vim rhel-debuginfo.repo

添加四类库文件

1 [rhel-server]

2 name=Red Hat Enterprise Linux server

3 baseurl=ftp://192.168.101.99/pub/Server

4 enabled=1

5 gpgcheck=1

6 gpgkey=ftp://192.168.101.99/pub/RPM-GPG-KEY-redhat-release

7

8

9

10 [rhel-vt]

11 name=Red Hat Enterprise Linux vt

12 baseurl=ftp://192.168.101.99/pub/VT

13 enabled=1

14 gpgcheck=1

15 gpgkey=ftp://192.168.101.99/pub/RPM-GPG-KEY-redhat-release

16

17

18 [rhel-cluster]

19 name=Red Hat Enterprise Linux cluster

20 baseurl=ftp://192.168.101.99/pub/Cluster

21 enabled=1

22 gpgcheck=1

23 gpgkey=ftp://192.168.101.99/pub/RPM-GPG-KEY-redhat-release

24

25

26 [rhel-clusterstorage]

27 name=Red Hat Enterprise Linux clusterstorage

28 baseurl=ftp://192.168.101.99/pub/Clusterstorage

29 enabled=1

30 gpgcheck=1

31 gpgkey=ftp://192.168.101.99/pub/RPM-GPG-KEY-redhat-release

查看仓库,第一次查看会显示缓存下载过程

[root@localhost ~]# yum repolist

Loaded plugins: rhnplugin, security

This system is not registered with RHN.

RHN support will be disabled.

rhel-cluster | 1.3 kB 00:00

rhel-cluster/primary | 6.5 kB 00:00

rhel-cluster 32/32

rhel-clusterstorage | 1.3 kB 00:00

rhel-clusterstorage/primary | 8.8 kB 00:00

rhel-clusterstorage 39/39

rhel-server | 1.3 kB 00:00

rhel-server/primary | 732 kB 00:00

rhel-server 2292/2292

rhel-vt | 1.3 kB 00:00

rhel-vt/primary | 9.0 kB 00:00

rhel-vt 36/36

repo id repo name status

rhel-cluster Red Hat Enterprise Linux cluster enabled: 32

rhel-clusterstorage Red Hat Enterprise Linux clusterstorage enabled: 39

rhel-server Red Hat Enterprise Linux server enabled: 2,292

rhel-vt Red Hat Enterprise Linux vt enabled: 36

repolist: 2,399

第二次查看仓库

[root@localhost ~]# yum repolist

Loaded plugins: rhnplugin, security

This system is not registered with RHN.

RHN support will be disabled.

repo id repo name status

rhel-cluster Red Hat Enterprise Linux cluster enabled: 32

rhel-clusterstorage Red Hat Enterprise Linux clusterstorage enabled: 39

rhel-server Red Hat Enterprise Linux server enabled: 2,292

rhel-vt Red Hat Enterprise Linux vt enabled: 36

repolist: 2,399

测试,在客户端上安装httpd服务

[root@localhost ~]# yum install httpd

Loaded plugins: rhnplugin, security

This system is not registered with RHN.

RHN support will be disabled.

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package httpd.i386 0:2.2.3-31.el5 set to be updated

rhel-cluster/filelists | 110 kB 00:00

rhel-clusterstorage/filelists | 11 kB 00:00

rhel-server/filelists | 2.3 MB 00:00

rhel-vt/filelists | 26 kB 00:00

--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================================

Package Arch Version Repository Size

===============================================================================================================================================================================================

Installing:

httpd i386 2.2.3-31.el5 rhel-server 1.2 M

Transaction Summary

===============================================================================================================================================================================================

Install 1 Package(s)

Update 0 Package(s)

Remove 0 Package(s)

Total download size: 1.2 M

Is this ok [y/N]: y

Downloading Packages:

httpd-2.2.3-31.el5.i386.rpm | 1.2 MB 00:00

warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 37017186

rhel-server/gpgkey | 1.1 kB 00:00

Importing GPG key 0x37017186 "Red Hat, Inc. (release key) <[email protected]>" from ftp://192.168.101.99/pub/RPM-GPG-KEY-redhat-release

Is this ok [y/N]: y

Running rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

Installing : httpd 1/1

Installed:

httpd.i386 0:2.2.3-31.el5

Complete!

至此yum服务搭建完毕

yum指令:

yum list all 查看所有的包,包括已安装的和未安装的

yum list available 查看未安装的包

yum list install 查看已安装的包

yum info 查看已安装的包的详细信息

yum install 安装包,可同时一次安装多个包(-y取消交互)

yum remove 卸载包

yum grouplist all 查看软件包组

yum groupinfo 查看软件包组信息

yum groupinstall 安装软件包组

yum groupremove 卸载软件包组

yum groupupdate 升级软件包组

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