Linux installer and hypervisor: rpm and yum

1, Installation and management

1.1 relationship between application program and system command

role System command application program
file location Generally, it becomes an internal Shell instruction in the / bin and / sbin directories Usually in / usr/bin, / usr/sbin and / usr/local/bin, / usr/local/sbin directories
Main purpose Complete the basic management of the system, such as IP configuration tool Complete other relatively independent auxiliary tasks. For example, web browser
Applicable environment Generally, it is only carried out in the character operation interface According to the actual needs, some programs can be run in the graphical interface
Operation mode It generally includes command words, command options and command parameters There is usually no fixed execution mode, which is defined by the program developer

1.2 directory structure of typical applications

file type Save directory explain
Ordinary executable program file /usr/bin All users can execute
Server program and management program file /usr/sbin Only administrators can execute
Application profile /etc Applications installed via rpm or yum
log file /var/log system log
Application participation document file /var/share/doc Reference documents and other data about the application
Application man page file /usr/share/man man pages of execution files and configuration files

1.3 common package encapsulation types

file type Save directory
RPM package The extension is' ' rpm ", applicable to RHEL, CentOS and other systems
DEB package The extension is' ' deb ", applicable to Ubuntu, Debian and other systems
Source code package Generally, it is " tar.gz“,”tar.bz2 "and other compressed packages contain the original code of the program, which needs to be compiled and installed
Package with installer Software packages have different extensions, mostly in TarBall format. Executable programs or script files for installation will be provided in the software package, such as install When installing SH and setup, you only need to run the installation file to complete the installation according to the prompts of the wizard

2, RPM package management tool

2.1 RPM package manager red hat package manager

1. Proposed by Red Hat and adopted by many Linux distributions

(1) Establish a unified file database

(2) Record the change information of software package installation, uninstall and upgrade in detail

(3) Automatically analyze package dependencies

2. RPM package

Software material reference: http://www.rpm.org

General naming format

2.2 RPM command format

RPM command can realize almost all management functions of RPM software package

Execute the "man rpm" command to get detailed help on the rpm command

2.3 RPM command function

Query and verify relevant information of RPM software package

Install, upgrade, uninstall RPM packages

Maintain and rebuild RPM database information and other comprehensive management operations

2.4 query RPM package information

2.4.1 query the installed RPM software information

rpm -q [sub option] [software name]

Common options

-q   Software name: query whether the specified software has been installed
-qi  Software name: displays the details of the installed specified software
-ql  Software name: displays the file list of the specified software installed
-qf  File or directory: query which installation package the installed specified file belongs to
-qc  Software name: lists the configuration files of the installed specified software
-qd  Software name: lists the location of the package document of the installed specified software 
-qR  Software name: lists the dependent software packages and files of the installed specified software  
-qa  Software name: displays the software name in the current system RMP List of all software installed by

rpm  -qa  |  grep  -i  postfix             Query software postfix Whether to install             

2.4.2 query the information in RPM package file

rpm  -qp [Sub option]  RPM Package file

-qpi   RPM Package file name: query the details of the specified software package
-qpl   RPM Package file name: query the file list of the specified software package
-qpc   RPM Package file name: query the configuration file of the specified software package
-qpd   RPM Package file name: query the location of the package document of the specified package

2.4.3 install, upgrade and uninstall RMP software package

Format:

rpm [option] RPM Package file
rpm -ivh  RPM software package

Common options

-i: Install a new RPM software package
-U: Upgrade a software package. If it has not been installed, install it
-F: Upgrade a software package. If it has not been installed, the installation will be abandoned
-h: During the installation or upgrade of the software package, you can“#”The number shows the installation progress
-v: Displays details during software installation
--force: Force the installation of a package, such as a package with an older version
-e: Uninstall the package with the specified name
--nodeps: When installing or upgrading or uninstalling a software package, the dependency with other software packages is not checked

mount Is the mount command; mnt Is a temporary mount command. It is read-only after hanging and cannot be executed.

2.5 maintain RPM database

1. Rebuild RPM database

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

rpm  --rebuilddb    perhaps     rpm  --initdb

2. Import validation public key

Before importing the public key file used for digital signature verification, an error will be reported when installing some RPM packages on the CD. You need to import the public key file (noarch) located in the root directory of the CD into the RPM database

mount  /dev/sr0  /mnt        (The second mounting method)

rpm  --import  /mnt/RPM-GPG-KEY-Centos-7

2.6 solutions to software package dependencies

2.6.1 installing multiple software with dependencies

The dependent packages need to be installed first

Multiple can be specified at the same time Install with rpm package file

2.6.2 when uninstalling multiple dependent software

Packages that depend on other programs need to be uninstalled first

Multiple can be specified at the same time Uninstall rpm package file

2.6.3 ignore dependencies

Combined with the "– nodeps" option, but may cause software exceptions

2.7 source code compilation

2.7.1 advantages of using source code to install software

Get the latest software version and fix bug s in time

Flexibly customize software functions according to user needs

2.7.2 application examples

When installing a newer version of the application

When the currently installed program cannot meet the needs

When new features need to be added to the application

2.7.3 Tarball packet

.tar.gz and tar.bz2 format is in the majority

Software material reference: http://sourceforge.net

2.7.4 integrity verification

md5sum Calibration tool

[root@localhost~]# md5sum httpd-2.4.25.tar.gz

24fb8b9e36cf131d78caae864fea0f6a(MD5 Checksum)  httpd-2.4.25.tar.gz

2.7.5 confirm the source code compilation environment (yum install)

To install the source code package, you need to compile and install, and you need to install a compiler that supports c/c + + programming language, such as GCC gcc-c++,make…

If you install using rpm, you need to install multiple dependent packages first, which will be cumbersome. You can use yum to install one click here.

#Configure the local yum source warehouse first (key)

mount  /dev/cdrom  /mnt/     #Mount the CD to the / mnt directory	

cd /etc/yum.repos.d/
mkdir repos.bak
mv  *  repos.bak

vim local.repo
[local]                       #Warehouse category
name=local              #Warehouse name
baseurl=file:///mnt # specifies that the URL access path is the CD mount directory
enabled=1                #Open this yum source. This is the default item and can be omitted
gpgcheck=0             #Do not verify the signature of the package

yum clean all && yum makecache        #Delete the yum cache and update it

#yum common operation commands

yum  -y  install  Software name            #Install and upgrade software packages, and the "- y" option indicates automatic confirmation

yum  -y  remove  Software name         #Uninstalling a package automatically resolves its dependencies

yum  -y  update  Software name           #Upgrade package  

yum list             #Query package list

yum  list  installed           #Query the installed software packages in the system

yum  list  available         #Query the software packages not installed in the warehouse

yum  list  updates            #Query packages that can be upgraded

yun  info  Software name            #Query the description information of the software package
yum  info  httpd              

yum  search  [all] key word         #Find relevant software packages according to a keyword
yum  search  all  httpd

yum  whatprovides  command       #Which package does the query command belong to
yum  whatprovides  netstat

#Install using yum

yum  install  -y  gcc  gcc-c++  make

2.7.6 basic process of compilation and installation (key points)

1)tar unpacking

tar  zxvf/jxvf  xxx.tar.gz/xxx.tar.bz2 -C Target path

2) Configure software modules (installation path, turn on or off module functions, user settings for managing service processes)

./configure  --prefix=Target path(Where is this software installed)

3) Compile (convert source code into executable program)

make

4) Installation

make  install

Tags: Linux CentOS RPM yum

Posted by coldfission on Tue, 03 May 2022 17:23:00 +0300