In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to install, update and uninstall RPM packages under Linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Under the Linux operating system, almost all software is installed, uninstalled and managed through RPM. The full name of RPM is Redhat Package Manager, which is proposed by Redhat Company to manage software packages under Linux. When Linux is installed, except for a few core modules, almost all the other modules are installed through RPM. RPM has five modes of operation: install, uninstall, upgrade, query, and verify.
RPM installation operation
Command:
Rpm-I package filename that needs to be installed
Examples are as follows:
Rpm-I example.rpm installs the example.rpm package; rpm-iv example.rpm installs the example.rpm package and displays the file information that is being installed during the installation process; rpm-ivh example.rpm installs the example.rpm package and displays the file information and installation progress during the installation process
RPM query operation
Command:
Rpm-Q...
Additional query commands:
A query all installed packages the following two additional commands are used to query the information of the installation package
I display information about the installation package
L shows the directories to which all the files in the installation package are installed
S shows the status of all files in the installation version and the directories to which they are installed; the following two additional commands are used to specify whether to query the installation package or the installed files
P queries the information about the installation package
F queries the information of a file that has been installed
Examples are as follows:
Rpm-qa | grep tomcat4 to check whether tomcat4 is installed; rpm-qip example.rpm to view the information of the example.rpm installation package; rpm-qif / bin/df to view the information of the installation package where the / bin/df file is located; rpm-qlf / bin/df to view the directory to which each file in the installation package is installed
RPM uninstall operation
Command:
Rpm-e installation packages that need to be uninstalled
Before uninstalling, you usually need to use rpm-Q … Command to find out the name of the installation package that needs to be uninstalled.
Examples are as follows:
Rpm-e tomcat4 Uninstalls the tomcat4 package
RPM upgrade operation
Command:
Rpm-U packages that need to be upgraded
Examples are as follows:
Rpm-Uvh example.rpm upgrade example.rpm package
RPM authentication operation
Command:
Rpm-V packages that need to be verified
Examples are as follows:
Rpm-Vf / etc/tomcat4/tomcat4.conf
The output information is similar to the following:
S.5....T c/ etc/tomcat4/tomcat4.conf
Where S indicates that the file size has been modified and T indicates that the file date has been modified. For more verification information, please refer to the rpm help file: man rpm
Other additional commands for RPM
-- force mandatory actions such as forced installation and deletion, etc.
-- requires shows the package's dependencies
-- nodeps ignores dependencies and continues
The rpm command is an administrative tool for RPM software packages. Rpm, originally a Red Hat Linux distribution program designed to manage Linux suites, is popular because it follows GPL rules and is powerful and convenient. Gradually adopted by other distributions. The emergence of RPM suite management makes Linux easy to install and upgrade, which indirectly improves the applicability of Linux.
Grammar
Rpm (option) (parameter) option
-a: query all packages;-b + or-t +: set the completion phase of the package and specify the file name of the package file;-c: list only the configuration file, this parameter should be used with the "- l" parameter;-d: list only the text file, this parameter should be used with the "- l" parameter;-e or-- erase: delete the specified package;-fallow: query the package with the specified file -h or-- hash: list tags during package installation;-I: display information about the package;-I or-- install: install the specified package file;-l: display the file list of the suite;-pause: query the specified RPM file;-Q: use the query mode, when any questions are encountered, the rpm instruction will ask the user first;-R: display the relevance information of the suite -s: display the file status, this parameter should be used with the "- l" parameter;-U or-- upgrade: upgrade the specified package file;-v: display the instruction execution process;-vv: show the instruction execution process in detail, easy to debug. Parameters.
Package: specifies the rpm package to manipulate.
Example
How to install the rpm package
The installation of the rpm package can be done using the program rpm. Execute the following command:
Rpm-ivh your-package.rpm
Where your-package.rpm is the file name of the rpm package you want to install, which is usually placed in the current directory.
The following warnings or prompts may appear during installation:
... Conflict with...
It is possible that some files in the package to be installed may overwrite existing files, which cannot be installed correctly by default. You can use rpm-- force-I to force the installation.
... Is needed by. Is not installed...
You can use rpm-- nodeps-I to ignore this information if you do not install some of the software required by this package, that is, rpm-I-- force-- nodeps can ignore all dependencies and file problems, and any package can be installed, but this forced installation of the package is not guaranteed to be fully functional.
How to install the .src.rpm package
Some packages end in .src.rpm, which are rpm packages that contain source code and need to be compiled at installation time. There are two ways to install such packages:
Method 1:
Rpm-I your-package.src.rpmcd / usr/src/redhat/SPECSrpmbuild-bp your-package.specs # A specs file cd / usr/src/redhat/BUILD/your-package/ # with the same name as your software package and a directory with the same name as your software package. / configure # this step is the same as compiling ordinary source software, with the parameter makemake install
Method 2:
Rpm-I you-package.src.rpmcd / usr/src/redhat/SPECS
The first two steps are the same as method one.
Rpmbuild-bb your-package.specs # an specs file with the same name as your software package
At this point in / usr/src/redhat/RPM/i386/ (depending on the package, it could be i686 no arch, etc.) in this directory, there is a new rpm package, which is a compiled binary.
Execute rpm-I new-package.rpm to complete the installation.
How to uninstall the rpm package
Use the command rpm-e package name, which can contain information such as the version number, but cannot have the suffix .rpm, such as uninstalling the package proftpd-1.2.8-1. You can use the following format:
Rpm-e proftpd-1.2.8-1rpm-e proftpd-1.2.8rpm-e proftpd-rpm-e proftpd
Cannot be in the following format:
Rpm-e proftpd-1.2.8-1.i386.rpmrpm-e proftpd-1.2.8-1.i386rpm-e proftpd-1.2rpm-e proftpd-1
Sometimes there are errors or warnings:
... Is needed by...
This shows that this software is needed by other software and cannot be uninstalled casually. It can be forced to be uninstalled with rpm-e-nodeps.
How to get the files in the rpm package without installing
Use the tools rpm2cpio and cpio
Rpm2cpio xxx.rpm | cpio-virpm2cpio xxx.rpm | cpio-idmvrpm2cpio xxx.rpm | cpio-- extract-- make-directories
The parameter I is the same as extract, which indicates that the file is extracted. V indicates the execution process, d is the same as make-directory, indicates that the directory is established according to the original path of the file in the package, and m indicates the update time of the file.
How to view files and other information related to rpm packages
All of the following examples assume the use of the package mysql-3.23.54a-11
1. Those rpm packages are installed on my system.
Rpm-qa will list all installed packages
If you want to find all installed packages that contain a string sql
Rpm-qa | grep sql
2. How to get the full file name of a software package.
Rpm-Q mysql
You can get the full name of the mysql package installed on the system, from which you can get information such as the version of the current package. In this example, you can get the information mysql-3.23.54a-11.
3. Where are the files in a rpm package installed?
Rpm-ql package name
Note that here is the name of the package that does not include the .rpm suffix, which means you can only use mysql or mysql-3.23.54a-11 instead of mysql-3.23.54a-11.rpm. If you just want to know where the executable is put, you can also use which, such as:
Which mysql
4. A rpm package contains those files.
An uninstalled software package, using rpm-qlp *. Rpm
A software package that has already been installed can also be used with rpm-ql *. Rpm
5. How to get information about the version and purpose of a software package?
An uninstalled software package, using rpm-qip *. Rpm
A software package that has already been installed can also be used with rpm-qi *. Rpm
6. Which package installed a program, or which package contains the program.
Rpm-qf `which program name` # returns the full name of the software package rpm-qif `which program name` # returns information about the software package rpm-qlf `which program name `# returns the file list of the package
Notice that this is not the quotation mark, but `, the key in the upper left corner of the keyboard. You can also use rpm-qilf to output package information and a list of files.
7. Which package installed a file, or which package contains the file.
Note that the method in the previous question applies only to executable programs, while the following methods can be used not only for executable programs, but also for any ordinary file. As long as you know the file name. First get the full path to the program, using whereis or which, and then use rpm-qf for example:
Whereis ftptopftptop: / usr/bin/ftptop / usr/share/man/man1/ftptop.1.gzrpm-qf / usr/bin/ftptopproftpd-1.2.8-1rpm-qf / usr/share/doc/proftpd-1.2.8/rfc/rfc0959.txtproftpd-1.2.8-1 Thank you for reading! This is the end of this article on "how to install, update and uninstall RPM software packages under Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
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.