当前位置: 技术问答>linux和unix
rpm upgrade
来源: 互联网 发布时间:2016-06-17
本文导语: 现有一 rpm 包,之前的版本未考虑到升级问题 在后续版本中需要支持 rpm -U 命令,在spec 中如何 更改可以从旧版本升级到新版本? | How to install or updata RPM package ? 2008-10-31 23:52:24 ...
现有一 rpm 包,之前的版本未考虑到升级问题
在后续版本中需要支持 rpm -U 命令,在spec 中如何
更改可以从旧版本升级到新版本?
在后续版本中需要支持 rpm -U 命令,在spec 中如何
更改可以从旧版本升级到新版本?
|
How to install or updata RPM package ?
2008-10-31 23:52:24
标签:linux 安装 RPM 升级 [推送到技术圈]
In order to install an RPM package you must first have the RPM you are trying to install on your system. Many people will download RPMs from a website and of course, Red Hat Network (RHN) provides all the RPM packages included in our distributions. There are two main flags that are used to install or upgrade RPM packages:
-i is used to install a new package. Always use this for kernel installations and upgrades.
-U is used to upgrade an RPM package but will also install a package if it does not exist in the RPM database.
Usage and additional options can be found in the RPM man page. Type man rpm from the command line. Here is some information about the -i and -U flags:
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.
Examples:
Note: These examples assume the packages are in a directory on your system. The below RPM commands are executed in the current working directory where the new RPM files reside.
To install an RPM package, we use of the -i flag. As mentioned before, you use this flag when you are installing a kernel RPM. In this case, you will want to leave your old kernel in place, at least temporarily, in case the new kernel does not boot. In this example, we first check to see the names of the new RPM packages with the ls command. Then we query the RPM database to see which kernel packages are already installed. You do not need to include the version number in the query, but the usage is: rpm -q . We can install the RPM package with the following command: rpm -ivh . Note the -v option will show verbose output and the -h will show the hash marks, which represents action of the progress of the RPM upgrade. Lastly, we run another RPM query to verify the package will be available.
·
·
· # 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
To upgrade an RPM package, we use of the -U flag. In this example, we verify the new package name with the ls command. Then we will run an RPM query to see if the package we want to install exists in the RPM database, rpm -q . Next, we execute the RPM installation with the following command: rpm -Uvh . Note the -v option will show verbose output and the -h will show the hash marks, which represents action of the progress of the RPM upgrade. Lastly, we run another RPM query to verify the package will be available.
·
· # 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
·
Note: The httpd and mod_ssl needed to be installed at the same time because of dependency issues. If you try to install one without the other, you would get an error similar to the following:
# 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
2008-10-31 23:52:24
标签:linux 安装 RPM 升级 [推送到技术圈]
In order to install an RPM package you must first have the RPM you are trying to install on your system. Many people will download RPMs from a website and of course, Red Hat Network (RHN) provides all the RPM packages included in our distributions. There are two main flags that are used to install or upgrade RPM packages:
-i is used to install a new package. Always use this for kernel installations and upgrades.
-U is used to upgrade an RPM package but will also install a package if it does not exist in the RPM database.
Usage and additional options can be found in the RPM man page. Type man rpm from the command line. Here is some information about the -i and -U flags:
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.
Examples:
Note: These examples assume the packages are in a directory on your system. The below RPM commands are executed in the current working directory where the new RPM files reside.
To install an RPM package, we use of the -i flag. As mentioned before, you use this flag when you are installing a kernel RPM. In this case, you will want to leave your old kernel in place, at least temporarily, in case the new kernel does not boot. In this example, we first check to see the names of the new RPM packages with the ls command. Then we query the RPM database to see which kernel packages are already installed. You do not need to include the version number in the query, but the usage is: rpm -q . We can install the RPM package with the following command: rpm -ivh . Note the -v option will show verbose output and the -h will show the hash marks, which represents action of the progress of the RPM upgrade. Lastly, we run another RPM query to verify the package will be available.
·
·
· # 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
To upgrade an RPM package, we use of the -U flag. In this example, we verify the new package name with the ls command. Then we will run an RPM query to see if the package we want to install exists in the RPM database, rpm -q . Next, we execute the RPM installation with the following command: rpm -Uvh . Note the -v option will show verbose output and the -h will show the hash marks, which represents action of the progress of the RPM upgrade. Lastly, we run another RPM query to verify the package will be available.
·
· # 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
·
Note: The httpd and mod_ssl needed to be installed at the same time because of dependency issues. If you try to install one without the other, you would get an error similar to the following:
# 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
|
也可以用 yum update xxx 来在线升级
|
-ivh
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。