为了安装一个RPM包,你必须有希望安装的软件的RPM包。你可以从一个网站来下载相应的RPM包,当然红帽网络提供在我们发行版中所有的软件包。有两个主要的选项用来安装和升级RPM软件包:
-i 用于安装一个新的软件包。经常用于内核的升级和安装 -U 用于升级一个RPM包,如果这个软件包在你系统的RPM数据库中不存在,它将安装这个软件包。
INSTALL AND UPGRADE OPTIONS The general form of an rpm install command is rpm {-i|--install} [install-options] PACKAGE_FILE ... This installs a new package. The general form of an rpm upgrade command is rpm {-U|--upgrade} [install-options] PACKAGE_FILE ... This install the package or upgrades the package currently installed to a newer version. This is the same as install, except all other version(s) of the package are removed after the new package is installed.
# ls kernel-2.4.21-15.0.3.EL.i686.rpm kernel-smp-2.4.21-15.0.3.EL.i686.rpm # rpm -q kernel; rpm -q kernel-smp kernel-2.4.21-4.0.1.EL kernel-2.4.21-15.0.2.EL kernel-smp-2.4.21-4.0.1.EL kernel-smp-2.4.21-15.0.2.EL # rpm -ivh kernel-2.4.21-15.0.3.EL.i686.rpm Preparing... ########################################### [100%] 1:kernel ########################################### [100%] # rpm -ivh kernel-smp-2.4.21-15.0.3.EL.i686.rpm Preparing... ########################################### [100%] 1:kernel-smp ########################################### [100%] # rpm -q kernel; rpm -q kernel-smp kernel-2.4.21-4.0.1.EL kernel-2.4.21-15.0.2.EL kernel-2.4.21-15.0.3.EL kernel-smp-2.4.21-4.0.1.EL kernel-smp-2.4.21-15.0.2.EL kernel-smp-2.4.21-15.0.3.EL
# ls httpd-2.0.46-32.ent.3.i386.rpm mod_ssl-2.0.46-32.ent.3.i386.rpm |# rpm -q httpd; rpm -q mod_ssl httpd-2.0.46-32.ent mod_ssl-2.0.46-32.ent # rpm -Uvh httpd-2.0.46-32.ent.3.i386.rpm mod_ssl-2.0.46-32.ent.3.i386.rpm Preparing... ########################################### [100%] 1:httpd ########################################### [ 50%] 2:mod_ssl ########################################### [100%] # rpm -q httpd; rpm -q mod_ssl httpd-2.0.46-32.ent.3 mod_ssl-2.0.46-32.ent.3 注:由于依赖关系httpd和mod_ssl需要同时安装。否则你就会得到下面的错误: # rpm -Uvh httpd-2.0.46-32.ent.3.i386.rpm error: Failed dependencies: httpd = 2.0.46-32.ent is needed by (installed) mod_ssl-2.0.46-32.ent