RPM, a package management tool in Linux
Lab environment:
One CentOS release 6.6 (Final)
IP Address: 172.16.249.230
RPM is the abbreviation of Red Hat Package Manager. It is intended to manage Red Hat software packages. As the name suggests, it is the software Package management contributed by Red Hat; mainstream Release versions such as CentOS, RedHat, Fedora, SUSE, and YellowDog, as well as the release versions developed on the basis of these versions;
1. Usage of RPM package management;
1. You can install, delete, upgrade, and manage software. Of course, you can also install and upgrade software online;
2. You can use RPM to check which files are included in the software package and which software package the file belongs;
3. check whether or not the software package in the query system is installed and its version;
4. As a developer, You can package your program as an RPM package for release;
5. Import, verify, and release of the software package signature GPG and MD5
6. Check the dependency to see if any software package has disrupted the system due to incompatibility;
Create your own rpm package
Directory structure and configuration after rpm installation in Linux
Brief Introduction and demo of rpm and yum
Redhat Linux --- rpm command details
Use FPM to easily create an RPM package
RPM for Linux Installation
2. RPM usage permission;
Only root permissions can be used to install, delete, and update RPM software. Any user can perform operations on the query function. If a common user has the permission to install directories, the RPM software can also be installed;
Iii. Simple rpm usage;
In addition to the Software Package Manager, we can also use rpm commands to install software packages. Can all software packages be installed using rpm commands? No, the file ends with a. rpm suffix. Sometimes we find file. rpm on some websites and install it with rpm;
1) initialize the rpm database;
Run the rpm command to check whether an rpm package is installed. The rpm database is also used. Therefore, we often use the following two commands to initialize the rpm database;
# Rpm-initdb initialize Database
Whether or not the current database exists, the existing database will be re-established and overwritten.
# Rpm -- rebuilddb rebuilding Note: This takes a long time;
If no data exists in advance, it will be created; otherwise, it will not be rebuilt.
Note: These two parameters are extremely useful. Sometimes the rpm system has a problem and cannot be installed or queried. Most of them have a problem here;
2) query functions of RPM software package management:
Command Format
Rpm {-q | -- query} [select-options] [query-options]
The query function of RPM is extremely powerful and one of the most important functions. For more details, refer to # man rpm.
1. query the software installed in the system;
1) query the installed software;
Syntax: rpm-q software name
Example:
[Root @ LinuxHost html] # rpm-q zsh
Zsh-4.3.10-7.el6.x86_64
-Q is -- query, which means "q" in Chinese. This command indicates whether zsh is installed in the system. If zsh is installed, information is output. If zsh is not installed, the information that zsh has not been installed will be output;
To view all installed packages in the system, add the-a parameter;
[Root @ LinuxHost html] # rpm-qa
If you view it by PAGE, add another pipeline | and more commands;
[Root @ LinuxHost html] # rpm-qa | more
Find a software in all installed software packages, such as zsh. You can use grep to extract the software;
[Root @ LinuxHost html] # rpm-qa | grep zsh
Zsh-4.3.10-7.el6.x86_64
The above function is the same as that output by rpm-q zsh;
2) query the software package of an installed file;
Syntax rpm-qf file name
Note: the absolute path of the file name must be specified.
Example:
[Root @ LinuxHost html] # rpm-qf/bin/zsh
Zsh-4.3.10-7.el6.x86_64
3) query where all installed software packages are installed;
Syntax: rpm-ql software name or rpm rpmquery-ql software name
Example:
[Root @ LinuxHost html] # rpm-ql zsh
[Root @ LinuxHost html] # rpm rpmquery-ql zsh
4) query the information of an installed software package
Syntax format: rpm-qi software name
Example:
[Root @ LinuxHost opt] # rpm-qi zsh
Name: zsh Relocations: (not relocatable)
Version: 4.3.10 Vendor: CentOS
Release: 7. el6 Build Date: Mon 25 Nov 2013 01:40:59 AM CST
Install Date: Mon 24 Nov 2014 04:05:58 am cst Build Host: c6b9.bsys.dev.centos.org
Group: System Environment/Shells Source RPM: zsh-4.3.10-7.el6.src.rpm
Size: 5009102 License: BSD
Signature: RSA/SHA1, Mon 25 Nov 2013 03:33:46 am cst, Key ID 0946fca2c105b9de
Packager: CentOS BuildSystem
URL: http://zsh.sunsite.dk/
Summary: A powerful interactive shell
Description:
The zsh shell is a command interpreter usable as an interactive login
Shell and as a shell script command processor. Zsh resembles the ksh
Shell (the Korn shell), but has des incluenhancements. Zsh supports
Command line editing, built-in spelling correction, programmable
Command completion, shell functions (with autoloading), a history
Mechanic, and more.
5) Check the configuration file of the installed software;
Syntax format: rpm-qc software name
Example:
[Root @ LinuxHost html] # rpm-qc zsh
/Etc/skel/. zshrc
/Etc/zlogin
/Etc/zlogout
/Etc/zprofile
/Etc/zshenv
/Etc/zshrc
6) view the installation location of a software installation document:
Syntax format: rpm-qd software name
Example:
[Root @ LinuxHost html] # rpm-qd zsh
7) Check the software packages and files on which the software is installed;
Syntax: rpm-qR software name
Example:
[Root @ LinuxHost html] # rpm-qR zsh
Query the summary of installed software: for a software package that has been installed, we can combine a series of parameters, such as rpm-qil. For example:
[Root @ LinuxHost html] # rpm-qil zsh
2. View uninstalled software packages:
The premise is that you have a. rpm file, that is, you can view the file. rpm of the existing software;
1) view the purpose and version of a software package;
Syntax: rpm-qpi file. rpm
Example:
# Rpm-qpi SDL_image-1.2.12-1.x86_64.rpm
Name: SDL_image Relocations:/usr
Version: 1.2.12 Vendor: (none)
Release: 1 Build Date: Sat 21 Jan 2012 09:53:22 AM CST
Install Date: (not installed) Build Host: localhost. localdomain
Group: System Environment/Libraries Source RPM: SDL_image-1.2.12-1.src.rpm
Size: 246207 License: LGPL
Signature: (none)
Packager: Hakan Tandogan
Summary: Simple DirectMedia Layer-Sample Image Loading Library
Description:
This is a simple library to load images of various formats as SDL surfaces.
This library supports BMP, PPM, PCX, GIF, JPEG, PNG, and TIFF formats.
2) view the files contained in a software package;
Syntax: rpm-qpl file. rpm
Example:
[[Root @ LinuxHost opt] # rpm-qpl SDL_image-1.2.12-1.x86_64.rpm
/Usr/lib/libSDL_image-1.2.so.0
/Usr/lib/libSDL_image-1.2.so.0.8.4
/Usr/share/doc/SDL_image-1.2.12
/Usr/share/doc/SDL_image-1.2.12/CHANGES
/Usr/share/doc/SDL_image-1.2.12/COPYING
/Usr/share/doc/SDL_image-1.2.12/README
3) view the document location of the software package;
Syntax: rpm-qpd file. rpm
Example:
[Root @ LinuxHost opt] # rpm-qpd SDL_image-1.2.12-1.x86_64.rpm
/Usr/share/doc/SDL_image-1.2.12/CHANGES
/Usr/share/doc/SDL_image-1.2.12/COPYING
/Usr/share/doc/SDL_image-1.2.12/README
For more details, please continue to read the highlights on the next page: