Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2048051
  • 博文数量: 354
  • 博客积分: 4955
  • 博客等级: 上校
  • 技术积分: 4579
  • 用 户 组: 普通用户
  • 注册时间: 2009-07-21 11:46
文章分类

全部博文(354)

文章存档

2015年(1)

2013年(4)

2012年(86)

2011年(115)

2010年(67)

2009年(81)

我的朋友

分类:

2010-05-02 23:47:11

在CentOS和Fedora Core的发行版中,采用了一种叫做yum得软件包综合管理工具,它的全称是Yellowdog Updater,Modified,这个工具并不是CentOS开发的,而是由Yellow Dog Linux开发的软件包综合管理工具。作为软件包综合管理工具除了yum外,还有DebianGNU/Linux所采用的APT和Red Hat Enterprise Linux等所采用的up2date(在RHEL5开始采用了YUM的软件包管理)。它们的共同特点是:通过网络安装和升级软件包;

自动解决软件包间的依存关系;这里请注意:Yum的软件包升级的软件包并非是最新 的软件,它是基于RPM软件包形式的软件,是CentOS(RHEL)确 认的安全稳定包。要安装最新的软件,最好采用编译安装的方式。定义yum的非官方库,在服务器构建的过程中,我们将要用到的一些工具不存在于CentOS 中yum的官方库中,所以需要定义yum的非官方库文件,让一些必需的工 具通过yum也能够安装。
[root@centos5 ~]# cat /etc/yum.repos.d/dag.repo (此文件默认不存在,需要手工创建。建立dag.repo,定义非官方库)
[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=
gpgcheck=1
enabled=1
[root@centos5 ~]# rpm --import
(导入非官方库的GPG)

[root@centos5 ~]# yum --help
usage: yum [options] < grouplist, localinstall, groupinfo, localupdate, resolvedep, erase, deplist, groupremove, makecache,

upgrade, provides, shell, install, whatprovides, groupinstall, update, repolist, groupupdate, info, search, check-update,

list, remove, clean, grouperase >

options:
-h, --help            show this help message and exit
-t, --tolerant        be tolerant of errors
-C                    run entirely from cache, don't update cache
-c [config file]     config file location
-R [minutes]         maximum command wait time
-d [debug level]     debugging output level
-e [error level]     error output level
-q, --quiet           quiet operation
-v, --verbose         verbose operation
-y                    answer yes for all questions
--version             show Yum version and exit
--installroot=[path] set install root
--enablerepo=[repo]   enable one or more repositories (wildcards allowed)
--disablerepo=[repo] disable one or more repositories (wildcards allowed)
-x [package], --exclude=[package]
                        exclude package(s) by name or glob
--disableexcludes=[repo]
                        disable exclude from main, for a repo or for
                        everything
--obsoletes           enable obsoletes processing during updates
--noplugins           disable Yum plugins
--nogpgcheck          disable gpg signature checking
--disableplugin=[plugin]
                        disable plugins by name

[root@centos5 ~]# yum check-update (检查可用的更新包)

Deployment_Guide-en-US.noarch            5.2-11.el5.centos      updates
Deployment_Guide-zh-CN.noarch            5.2-11.el5.centos      updates
Deployment_Guide-zh-TW.noarch            5.2-11.el5.centos      updates
avahi.i386                               0.6.16-1.el5_2.1       updates
avahi-glib.i386                          0.6.16-1.el5_2.1       updates
bind-libs.i386                           30:9.3.4-6.0.3.P1.el5_ updates
bind-utils.i386                          30:9.3.4-6.0.3.P1.el5_ updates
bluez-libs.i386                          3.7-1.1                updates
bluez-utils.i386                         3.7-2.2.el5.centos     updates
bzip2.i386                               1.0.3-4.el5_2          updates
bzip2-libs.i386                          1.0.3-4.el5_2          updates
cadaver.i386                             0.22.5-1.el5.rf        dag
cups.i386                                1:1.2.4-11.18.el5_2.3 updates
cups-libs.i386                           1:1.2.4-11.18.el5_2.3 updates
dbus.i386                                1.0.0-7.el5_2.1        updates
dhcpv6-client.i386                       1.0.10-4.el5_2.3       updates
dmraid.i386                              1.0.0.rc13-15.el5_2.1 updates
ed.i386                                  0.2-39.el5_2           updates
freetype.i386                            2.2.1-20.el5_2         updates
glibc.i686                               2.5-24.el5_2.2         updates
glibc-common.i386                        2.5-24.el5_2.2         updates
gnutls.i386                              1.4.1-3.el5_2.1        updates
initscripts.i386                         8.45.19.1.EL-1.el5.cen updates
ipsec-tools.i386                         0.6.5-9.el5_2.3        updates
kernel.i686                              2.6.18-92.1.22.el5     updates
krb5-libs.i386                           1.6.1-25.el5_2.2       updates
krb5-workstation.i386                    1.6.1-25.el5_2.2       updates
lftp.i386                                3.7.8-1.el5.rf         dag
libtiff.i386                             3.8.2-7.el5_2.2        updates
libxml2.i386                             2.6.26-2.1.2.7         updates
libxml2-python.i386                      2.6.26-2.1.2.7         updates
libxslt.i386                             1.1.17-2.el5_2.2       updates
lvm2.i386                                2.02.32-4.el5_2.1      updates
mtr.i386                                 2:0.75-1.el5.rf        dag
nfs-utils.i386                           1:1.0.9-35z.el5_2      updates
nscd.i386                                2.5-24.el5_2.2         updates
nspr.i386                                4.7.3-2.el5            updates
nss.i386                                 3.12.2.0-4.el5.centos updates
nss-tools.i386                           3.12.2.0-4.el5.centos updates
nss_ldap.i386                            253-13.el5_2.1         updates
openldap.i386                            2.3.27-8.el5_2.4       updates
openssh.i386                             4.3p2-26.el5_2.1       updates
openssh-clients.i386                     4.3p2-26.el5_2.1       updates
openssh-server.i386                      4.3p2-26.el5_2.1       updates
openssl.i686                             0.9.8b-10.el5_2.1      updates
pam_krb5.i386                            2.2.14-1.el5_2.1       updates
paps.i386                                0.6.6-18.el5           updates
perl.i386                                4:5.8.8-15.el5_2.1     updates
rsync.i386                               3.0.5-1.el5.rf         dag
scim.i386                                1.4.4-41.el5           updates
scim-bridge.i386                         0.4.5-8.el5            updates
scim-bridge-gtk.i386                     0.4.5-8.el5            updates
scim-libs.i386                           1.4.4-41.el5           updates
selinux-policy.noarch                    2.4.6-137.1.el5        updates
selinux-policy-targeted.noarch           2.4.6-137.1.el5        updates
sos.noarch                               1.7-9.2.el5_2.2        updates
syslinux.i386                            3.73-1.el5.rf          dag
tzdata.noarch                            2008i-1.el5            updates
udftools.i386                            1.0.0b3-3.el5.rf       dag
vim-common.i386                          2:7.0.109-4.el5_2.4z   updates
vim-enhanced.i386                        2:7.0.109-4.el5_2.4z   updates
vim-minimal.i386                         2:7.0.109-4.el5_2.4z   updates
yum.noarch                               3.2.8-9.el5.centos.2.1 updates

[root@centos5 ~]# yum update yum.noarch (升级)
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package yum.noarch 0:3.2.8-9.el5.centos.2.1 set to be updated
--> Processing Dependency: yum-fastestmirror for package: yum
--> Running transaction check
---> Package yum-fastestmirror.noarch 0:1.1.10-9.el5.centos set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
Package                 Arch       Version          Repository        Size
=============================================================================
Updating:
yum                     noarch     3.2.8-9.el5.centos.2.1 updates           58                                            

2 k
Installing for dependencies:
yum-fastestmirror       noarch     1.1.10-9.el5.centos base               13 k

Transaction Summary
=============================================================================
Install      1 Package(s)
Update       1 Package(s)
Remove       0 Package(s)

Total download size: 595 k
Is this ok [y/N]: y
Downloading Packages:
.                                          

                             


(1/2): yum-3.2.8-9.el5.ce 100% |=========================| 582 kB    00:23
                                            

                                   


(2/2): yum-fastestmirror- 100% |=========================| 13 kB    00:00
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID e8562897
Importing GPG key 0xE8562897 "CentOS-5 Key (CentOS 5 Official Signing Key) <
>" from


Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : yum                          ######################### [1/3]
Installing: yum-fastestmirror            ######################### [2/3]
Cleanup   : yum                          ######################### [3/3]

Dependency Installed: yum-fastestmirror.noarch 0:1.1.10-9.el5.centos
Updated: yum.noarch 0:3.2.8-9.el5.centos.2.1
Complete!

[root@centos5 ~]# yum install bind (安装)
Loading "fastestmirror" plugin
Determining fastest mirrors
* base:

* updates:
* addons:
* extras:
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package bind.i386 30:9.3.4-6.0.3.P1.el5_2 set to be updated
--> Processing Dependency: bind-libs = 30:9.3.4-6.0.3.P1.el5_2 for package: bind
--> Running transaction check
--> Processing Dependency: bind-libs = 30:9.3.4-6.P1.el5 for package: bind-utils
---> Package bind-libs.i386 30:9.3.4-6.0.3.P1.el5_2 set to be updated
--> Running transaction check
---> Package bind-utils.i386 30:9.3.4-6.0.3.P1.el5_2 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
bind                    i386       30:9.3.4-6.0.3.P1.el5_2 updates           959 k
Updating:
bind-libs               i386       30:9.3.4-6.0.3.P1.el5_2 updates           846 k
Updating for dependencies:
bind-utils              i386       30:9.3.4-6.0.3.P1.el5_2 updates           166 k

Transaction Summary
=============================================================================
Install      1 Package(s)
Update       2 Package(s)
Remove       0 Package(s)

Total download size: 1.9 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): bind-libs-9.3.4-6. 100% |=========================| 846 kB    00:41
(2/3): bind-9.3.4-6.0.3.P 100% |=========================| 959 kB    00:18
(3/3): bind-utils-9.3.4-6 100% |=========================| 166 kB    00:06
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : bind-libs                    ######################### [1/5]
Updating : bind-utils                   ######################### [2/5]
Installing: bind                         ######################### [3/5]
Cleanup   : bind-utils                   ######################### [4/5]
Cleanup   : bind-libs                    ######################### [5/5]

Installed: bind.i386 30:9.3.4-6.0.3.P1.el5_2
Updated: bind-libs.i386 30:9.3.4-6.0.3.P1.el5_2
Dependency Updated: bind-utils.i386 30:9.3.4-6.0.3.P1.el5_2
Complete!

[root@centos5 ~]# yum remove bind (卸载)
Loading "fastestmirror" plugin
Setting up Remove Process
Loading mirror speeds from cached hostfile
* base:

* updates:
* addons:
* extras:
Resolving Dependencies
--> Running transaction check
---> Package bind.i386 30:9.3.4-6.0.3.P1.el5_2 set to be erased
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
Package                 Arch       Version          Repository        Size
=============================================================================
Removing:
bind                    i386       30:9.3.4-6.0.3.P1.el5_2 installed         2                                            

.1 M

Transaction Summary
=============================================================================
Install      0 Package(s)
Update       0 Package(s)
Remove       1 Package(s)

Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Erasing   : bind                         ######################### [1/1]

Removed: bind.i386 30:9.3.4-6.0.3.P1.el5_2
Complete!

[root@centos5 ~]# vi /etc/yum.conf (代理服务器设置)

proxy=http:// 服务器IP:端口   ← 最后一行添加

[root@centos5 ~]# /etc/rc.d/init.d/yum-updatesd stop (关闭自动更新)
[root@centos5 ~]# chkconfig yum-updatesd off

如果系统存在的一些软件包有版本的依存问题,那么我们不能够,也不会轻易的升级它 们(除非你做过完善的测试工作)。我们可以告诉yum在

更新时不更新谁。
[root@centos5 ~]# vi /etc/yum.conf ←编辑yum设置文件

# 在文件的最后追加

exclude=openssh*    ←这里是不更新openssh相关的设置

exclude=httpd  ←不更新httpd


其他的选项和说明

check-update        显示可升级的软件包

clean               删除下载后的旧的header。和clean all相同

clean oldheaders   删除旧的headers

clean packages      删除下载后的软件包

info               显示可用软件包信息

info 软件包名     显示指定软件包信息

install 软件包名   安装指定软件包

list               显示可用软件包

list installed     显示安装了的软件包

list updates       显示可升级的软件包

provides 软件包名 显示软件包所包含的文件

remove 软件包名    删除制定的软件包,确认判定指定软件包的依存关系。

search 关键字      利用关键字搜索软件包。搜索对象是,RPM文件名,Packager(包),Dummary,Description的各型

update             升级所有的可升级的软件包

update 软件包名    升级指定的软件包

groupinstall      安装指定的组

groupupdate       安装了的组成员软件包更新

grouplist         安装了的组和可以安装的组一览显示

groupremove       删除指定的组

groupinfo         指定组所包含的软件包显示
阅读(1477) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~