In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Introduction to the RPM command:
The full name of RPM is "RedHat Package Manager" and the abbreviation is RPM. RPM is a set of management programs that install the packages you need into your Linux host in the form of database records.
1. Command format:
Rpm [options] [File]
2. Command function:
The most important feature of RPM is that the package you want to install is first compiled and packaged. Through the default database records in the packaged package, record the dependent attribute module that must be installed when the suite is to be installed (Linux host needs several necessary suites that exist in advance). When installing, RPM will first query whether the dependent attribute suite of the Linux host is satisfied according to the record data in the package, and if so, install it. If not satisfied, it will not be installed. Then the entire information of the suite is written into the RPM database during installation for future query, verification and anti-installation!
The advantages are:
a. Since it has been compiled and packaged, it is convenient to install (no need to recompile)
b. Since the information of the suite has been recorded in the database of the Linux host, it is easy to query, upgrade and reverse installation.
The disadvantages are:
a. The installed environment must be consistent with or equivalent to the environmental requirements at the time of packaging
b. Need to meet the dependent attribute requirements of the suite
c. You need to be very careful when anti-installation, the lowest package can not be removed first, otherwise it may cause problems for the whole system!
3. Command parameters:
3.1.RPM installation package
Rpm-I / PATH/TO/PACKAGE_FILE
-h: show progress in #; each # represents 2%
-v: show detailed process
-vv: a more detailed process
Rpm-ivh / PATH/TO/PACKAGE_FILE
-- nodeps: ignore dependencies
-- replacepkgs: reinstall and replace the original installation
-- force: forcibly installed, can be reinstalled or downgraded, which is a combination of-- replacefiles and-- replacepkgs.
-- test: test and install the software to find out whether there is a problem with attribute dependency.
Eg1: rpm-ivh pkgname.i386.rpm-- test
-- replacefiles: you can use this parameter to overwrite files directly when there is a message that "a file has been installed on your system" during installation, or when a message of a different version (confilcting files) appears.
Danger: the action of overwriting is irreversible! Otherwise, there will be no tears!
[root@localhost] ~ # rpm-ivh zsh-4.2.6-3.el5.x86_64.rpm
Rpm-ivh zsh-4.2.6-3.el5.x86_64.rpm
Warning: zsh-4.2.6-3.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... # [100%]
Package zsh-4.2.6-3.el5.x86_64 is already installed
[root@localhost] ~ # install a file on the network
[root@localhost] ~ # rpm-ivh http://website.name/path/pkgname.rpm
3.2.RPM query package
In the part of the query, all parameters need to be preceded by-Q to be the so-called query!
The query is mainly divided into two parts, one is to check the installed, and the other is to check the contents of a rpm file.
Parameters:
-Q: query only (query), followed by whether the package name is installed
-qa: list all (all), all the suite names that have been installed on the native Linux system
-qi: lists the details of the suite (information), including developer, version, description, etc.
-ql: list the full file name (list) of all the files and directories in the suite
-qc: list the configuration files of the suite (just find the file name under / etc/)
-qd: list all the documentation files for the package (find the file document related to man)
-qR: lists the files contained in the dependent package related to the package (Required)
-qf: find out which installed package the file belongs to by the following file name (file)
Rpm-Q-- scripts PACKAGE_NAME: query the script contained in the specified package (scripts)
-qp [I | c | d | l | R]: query the information to be contained in the RPM file (Package) when it is not installed
Note-all the parameters followed by qp are consistent with the above instructions.
But the purpose is only to find out the information in the RPM file, not the installed package information!
[root@localhost] / media/Server# rpm-qi bash
Name: bash Relocations: (not relocatable)
Version: 3.2 Vendor: Red Hat, Inc.
Release: 24.el5 Build Date: Tue 21 Oct 2008 08:15:56 PM CST
Install Date: Thu 17 Apr 2014 11:41:58 AM CST Build Host: hs20-bc1-5.build.redhat.com
Group: System Environment/Shells Source RPM: bash-3.2-24.el5.src.rpm
Size: 5388767 License: GPLv2+
Signature: DSA/SHA1, Mon 08 Dec 2008 08:25:44 PM CST, Key ID 5326810137017186
Packager: Red Hat, Inc.
URL: http://www.gnu.org/software/bash
Summary: The GNU Bourne Again shell (bash) version 3.1.
Description:
The GNU Bourne Again shell (Bash) is a shell or command language
Interpreter that is compatible with the Bourne shell (sh). Bash
Incorporates useful features from the Korn shell (ksh) and the C shell
(csh). Most sh scripts can be run by bash without modification. This
Package (bash) contains bash version 3.1, which improves POSIX
Compliance over previous versions.
[root@localhost] / media/Server# rpm-ql bash
/ bin/bash
/ bin/sh
/ etc/skel/.bash_logout
/ etc/skel/.bash_profile
/ etc/skel/.bashrc
/ usr/bin/bashbug-64
...
[root@localhost] / media/Server# rpm-qf / bin/ls
Coreutils-5.97-23.el5
[root@localhost] / media/Server# rpm-Q-- scripts zsh
Postinstall scriptlet (using / bin/sh): the program to be executed after installation
If [!-f / etc/shells]; then
Echo "/ bin/zsh" > / etc/shells
Else
Grep-Q "^ / bin/zsh$" / etc/shells | | echo "/ bin/zsh" > > / etc/shells
Fi
/ sbin/install-info / usr/share/info/zsh.info.gz / usr/share/info/dir\
-- entry= "* zsh: (zsh). An enhanced bourne shell."
Preuninstall scriptlet (using / bin/sh): the program to run before uninstalling
If ["$1" = 0]; then
/ sbin/install-info-delete / usr/share/info/zsh.info.gz / usr/share/info/dir\
-- entry= "* zsh: (zsh). An enhanced bourne shell."
Fi
Postuninstall scriptlet (using / bin/sh): the program to be executed after uninstalling
If ["$1" = 0]; then
If [- f / etc/shells]; then
TmpFile= `/ bin/mktemp / tmp/ .zshrpmXXXXXX`
Grep-v'^ / bin/zsh$' / etc/shells > $TmpFile
Cp-f $TmpFile / etc/shells
Rm-f $TmpFile
Chmod 644 / etc/shells
Fi
Fi
3.3.RPM upgrade package
Rpm-Uvh / PATH/TO/NEW_PACKAGE_FILE: upgrade if an older version is installed; otherwise, install
-Uvh-- oldpackage: downgrade
Rpm-Fvh / PATH/TO/NEW_PACKAGE_FILE: upgrade if an older version is installed; otherwise, exit
3.4.RPM check
Parameters:
-V: the package name is added after it. If the file contained in the package has been changed, it will be listed.
-Va: list all files that may have been changed on the current system
-Vp: followed by the name of the file, listing the files that may have been changed in the package
-Vf: lists whether a file (file) has been changed ~
[root@linux ~] # rpm-Va
[root@linux ~] # rpm-V installed package name
[root@linux ~] # rpm-Vp the file name of a RPM file
[root@linux ~] # rpm-Vf some file on the system
3.5.RPM uninstall package
[root@linux] # rpm-e logrotate
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.