Introduction to Linux software installation commands (1)

introduce

The introduction of Linux software packages is divided into source packages and binary packages. The advantages and disadvantages are as follows:

type advantage         shortcoming
source package

Open source, you can see the source code

Functions can be selected according to needs

Compile and install is more suitable for your own environment

Easy to uninstall, just delete the installation file

The installation process is complicated, especially for large software

Long install time (depends on machine performance, but overall time is longer than binary time)

It is difficult to install and is not friendly to novices. If there is a compilation error, it is difficult to solve

binary package

Simple management, few operation commands such as installation and upgrade

fast installation

poor dependence

Can't see the source code

Installation feature selection is not flexible enough

Under Redhat, the binary package produced is called an rpm package, and under Ubuntu, the installation package is a deb package.

rpm dependency

There are three dependencies:

1. Tree dependency

2. Circular dependencies, the solution can be to put several installations in one command

3. For module dependencies, you can check the www.rpmfind.net website to determine the rpm where the dependencies are located

command introduction

During the installation process, use the full name of the installation package, and use the absolute path or enter the path for installation

rpm install

rpm -ivh packagename

-i (install) means install

-v (verbose) means to display detailed information

-h (hash) means show progress

- --nodeps does not detect dependencies (it will not be used in practice, dependency issues must be resolved)

Rpm packages generally have multiple packages starting with the same name, such as httpd:

httpd-2.2.15 is his main package

devel means library package

manual indicates the document

tools means tools

rpm upgrade

rpm -Uvh package name

-U (upgrade) means upgrade

Using the upgrade command for packages that are not installed in the system is equivalent to installing

rpm uninstall

rpm -e packagename

-e (erase) means uninstall

- --nodeps does not detect dependencies (it will not be used in practice, dependency issues must be resolved)

rpm does not specify the installation location, it will be installed in the default location of the system

rpm query

  • rpm -q package name

-q (query) indicates whether the package is installed

  • rpm -qa package name

-qa (query all) means to query all installation packages

But there are many packages in the system, it is generally recommended to add |grep to filter

For example rpm -qa |grep llvm

  • rpm -qi package name

-i (information) means to query the information of the installation package (this information can be checked before and after installation, it is the information recorded by the developer)

-p (pakeage) indicates the parameters to be added to query the package that is not installed

  • rpm -ql package name

-l (list) means list list

-p (pakeage) indicates the parameter to be added when querying the package that is not installed

Default installation path
/etc/ configuration file directory
/usr/bin/ The installation directory of the executable command
/usr/lib/ The location where the program uses the function library to save
/usr/share/doc/ Where to save the software manual
/usr/share/man/ Where to save help files
  • rpm -qf system file name

-f (file) indicates which software package the system file belongs to

Only packages installed through rpm can be reverse tracked, and cannot be manually created

  • rpm -qr package name

-r (requires) means to query the dependencies of the package

-p (pakeage) indicates the parameter to be added when querying the package that is not installed

This dependency query is not very useful, because the dependencies of the package that are queried will include all dependencies. It is better to install and report errors directly, which is faster.

rpm check

  • rpm -V package name

-V (verify) means to verify the files of the installation package

The action indicates whether the installed file has been modified, and no prompt indicates that it has not been modified.

The meaning of the modification content prompt information is as follows:

S Indicates that the file size has changed
M Indicates a file type or permission change
5 Indicates that the MD5 checksum has changed (whether the content has changed, verify the integrity of the file)
D Indicates master-slave code change
L Indicates that the file path has changed
U Indicates that the file owner has changed
G Indicates that the file group has changed
T Indicates that the modification time of the file has changed

The file type information is as follows:

c(config file) configuration file
d(documentation) common document
G(ghost file) Files that should not appear, the system may be attacked
L (license file) authorization file
r(read file) description file

rpm2cpio extracts files from rpm packages

This command can deal with the loss of important files, but pay attention to the file location when using it.

  • rpm -V package name|cpio -idv .file absolute path

- rpm2cpio represents the command to convert rpm to cpio format

- cpio tool for creating archives and extracting files from archives

  • cpio -idv < file or device

-i (copy -in mode) restore

-d Automatically create a new directory when restoring

-v show restore process

Guess you like

Origin blog.csdn.net/hezhou876887962/article/details/129766499