Linux application basics

The relationship between an application and system commands

1. System commands

2. Apps

The directory structure of a typical application

Common package encapsulation types

RPM package management tool

Introduction to the

●RPM Red-hat Package Manager

① Developed by Red Hat and adopted by many Linux distributions

② Establish a unified file database

3 Record changes in software package installation, uninstallation, and upgrade

④ Automatically analyze software package dependencies

Low RPM packages

① Software material reference: www.rpm.org

② General naming format:

El7 stands for centos 7

Df-h look at the cd-rom package

Mount the CD to the MNT directory

Viewing the DISK Type

Format of the RPM command

The RPM command can manage almost all RPM packages

To obtain detailed help information about RPM commands, run the “man RPM “command

● RPM Function

(1) Query and verify information about RPM packages

(2) Install, upgrade, and uninstall RPM packages

(3) Maintenance and reconstruction of RPM database information and other comprehensive management operations

Example Query information about installed RPM software

  • RPM -q software name # — Check whether the specified software is installed

  • RPM -qi software name # — Displays details of the specified software that has been installed

  • RPM -ql software name # — Displays a list of installed files for the specified software

  • RPM -QC software name # — Lists the installed configuration files for the specified software

  • RPM -qd software name # — Lists the location of the installed package documentation for the specified software

  • RPM -QR software name # — Lists the installed dependencies of the specified software packages and files

  • RPM -qf file or directory # — Query which installation package the specified software belongs to

  • RPM -qa # — Displays a list of all software installed by RPM in the current system

  • The RPM – qa | grep -i postfix # – the query software postfix is installed

-q Queries whether the specified software is installed

-qa Uses grep to filter other RPM software

-qi Displays detailed information about the installed software

-ql Displays the list of installed files of specified software

– QC lists the installed configuration files of the specified software

-qd Lists the locations of installed software package files

-qR lists the installed software packages and files dependent on the specified software

-qf Queries the installation package to which the specified software belongs

Example Query information about RPM software packages

  • RPM -qpi RPM package name # — Query details about the specified software package

  • RPM -qpl RPM package name # — Query the file list of the specified software package

  • RPM -qpc RPM package name # — Query the configuration file of the specified software package

  • RPM -qpd RPM package file name # — Query the package file bits of the specified package

Install, upgrade, and uninstall RPM packages

Low formats:

RPM [option] RPM package file

2. RPM -ivh RPM package

● Common options:

①-i: Installs a new RPM package.

② -u: Upgrade a software package. If the software package has not been installed, install it.

③ -f: Upgrade a software package. If the software package has not been installed, the installation is abandoned.

④-h: During the installation or upgrade process, the installation progress is displayed with #.

⑤-v: displays detailed information about the software installation process.

⑥- -force: forcibly installs a software package, for example, an earlier version.

⑦-e: uninstalls the specified software package.

⑧- -nodeps: Does not check dependencies between a software package and other software packages when installing, upgrading, or uninstalling a software package.

Maintaining the RPM Database

1. Rebuild the RPM database

● When the RPM database is damaged, it can be repaired by rebuilding the RPM database

RPM –rebuilddb or RPM –initdb

2. Import the authentication public key

● An error occurs when some RPM packages in the installation CD-ROM are not imported before the public key file used for digital signature verification. You need to import the public key file in the root directory of the CD-ROM to the RPM database

1.mount /dev/sr0 /mnt/

2.rpm –import /mnt/RPM-GPG-KEY-CentOS-7

To install the source code package, you need to install a compiler that supports C and C ++ programming languages, such as GCC, gCC-C ++, and make

If RPM is used, multiple dependency packages need to be installed first, which is tedious. This can be done using yum for one-click installation.

Solutions to software package dependencies

When installing multiple software dependencies

Dependent software packages must be installed first

You can specify multiple. RPM packages for installation

Uninstall multiple software dependencies

Software packages that depend on other programs must be uninstalled first

Multiple software names can be specified for uninstallation

Ignore dependencies

Combined with the “–nodeps” option, but may cause a software exception

Specify multiple. RPM package files for installation

[root@localhost Packages]##rpm -ivh
Copy the code

Yum configuration

Configure the local YUM repository

D/mkdir repos.bak mv *.repo repos.bak CD /etc/yum.repos.d/ Vim local.repo [local] # -- local.baseurl =file:///mnt # -- local.repo [local] # -- local.baseurl =file:///mnt # Gpgcheck =0 # yum Clean all && yum makecache # yum Clean remove yum cache and update yum Clean ● Yun Makecache can be broken into two stepsCopy the code

Common operation commands for yum

# yum -y install # yum -y install # yum -y install # yum -y install # yum list installed # Yum list available # yum list installed # # yum info HTTPD yum search [all] # yum info HTTPD yum search [all] # Yum search all HTTPD yum whatprovides netstat yum search all HTTPD yum Whatprovides netstatCopy the code

Install using YUM

yum install -y gcc gcc-c++ make
Copy the code