'Linux' app installation (rpm and yum)

1. Application installation

1. Solve the software package dependency method
When installing multiple software with dependencies
  • Dependent packages need to be installed first
  • Multiple .rpm package files can be specified for installation at the same time
When uninstalling multiple software with dependencies
  • Packages that depend on other programs need to be uninstalled first
  • Multiple software names can be specified for uninstallation at the same time
ignore dependencies
  • Combined with "--nodeps" option, but may cause software anomalies
2. Relationship between application programs and system commands
Role system command application
file location Usually in /bin和/sbina directory, or as an internal command of the shell usually in /usr/bin、/usr/sbin 和/usr/local/bin、/usr/local/sbinthe directory
The main purpose Complete the basic management of the system, such as IP configuration tools Complete other auxiliary tasks relatively independently, such as web browsers
Applicable environment Generally only run in the character operation interface According to actual needs, some programs can be run in the graphical interface
run format Generally includes command words, command options and command parameters Usually there is no fixed execution format, which is defined by the program developer
3. Directory structure of a typical application
file type system command illustrate
Ordinary executable program file /usr/bin All users can execute
Server program, hypervisor file /usr/sbin Only administrators can execute
application configuration file /etc Applications installed via rpm or yum
log file /var/log system log
Application Reference Documentation File /usr/share/doc Data such as reference documents about the application
Application man page files /usr/share/man Man pages for execution files and configuration files
4. Common package packaging types
file type save directory
RPM package The extension is “rpm”suitable for RHEL, CentOs and other systems
DEB package The extension is “deb”suitable for Ubuntu, Debian and other systems
source code package Generally, the compressed package in the format of ".tar.bz2" is usually "taraz", which contains the original code of the program, which needs to be compiled and installed
Package with installer The software package has different extensions, most of which are in TarBall format. The software package will provide executable programs or script files for installation, such as install.sh and setup. Prompt to complete the installation operation

2. RPM package management tool

1. RPM package

General naming format:
insert image description here

2. RPM package information

Query installed RPM software information:

rpm -q [子选项] [软件名]

insert image description here

3. Query installed rmp software information
rpm -q software name Query whether the specified software is installed
rpm -qi software name Display detailed information about the specified software installed
rpm -ql software name Display a list of installed files for the specified software
rpm -qc software name List installed configuration files for the specified software
rpm -qd software name List the location of the package documentation for the specified software installed
rpm -qR software name List the dependent packages and files of the specified software installed
rpm -qf file or directory Query which installation package the specified software that has been installed belongs to

Example: use rpm -ql yum(display all the files related to the yum package)
insert image description here
example: use rpm -qc yum(display all the configuration files of yum)
insert image description here
example: use rpm -qd yum(display the location of the yum document)
insert image description here
example: use rpm -qR yum(display the dependent packages of yum and Its files)
insert image description here
Example: use rpm -qc yum(use rmp -qf to select one of the file names to find which software package it belongs to)

insert image description here

4. The command to query the information in the RPM package file that is not installed
rpm -qpi RPM package file name Query the detailed information of the specified software package
rpm -qpl RPM package file name Query the file list of the specified package
rpm -qpc RPM package file name Query the configuration file of the specified package
rpm -qpd RPM package file name Queries the location of the package documentation for the specified package
5. Install, upgrade, uninstall, RPM, software package
rpm [选项] RPM包文件
rpm -ivh   RPM软件包

Common options:
-i: Install a new RPM 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, give up the installation.
-h: During the process of installing or upgrading the software package, the installation progress will be displayed with "#".
-v: Display detailed information during software installation.
–force: Forcibly install a software package, such as installing an older version of the software package
-e: Uninstall the software package with the specified name.
--nodeps: When installing or upgrading or uninstalling a package, do not check dependencies with other packages.

3. Use the yum tool to achieve quick installation

1. The file location filled in the configuration file must have a file (mount the CD image)
mount /dev/sr0 /mnt
mount /dev/cdrom /mnt

The virtual machine should also check whether there is an optical drive and connect to the virtual machine to mount it. Enter
to dfsee if the mount is successfulinsert image description here

2. Enter the yum warehouse configuration directory and back up the original file
cd /etc/yum.repos .d
mkdir repo.bak
mv *.repo repo.bak/

insert image description here

3. Create a local yum source configuration file
cd /etc/yum.repos.d/
vim local.repo
[local]					//仓库类别
name=local				//仓库名称
baseurl=file:///mnt		//指定URL 访问路径为光盘挂载目录
enabled=1				//开启此yum源,此为默认项,可省略
gpgcheck=0				//不验证软件包的签名

insert image description here

4. Use the yum clean all && yum makecache command to re-update the cache with the local yum source

insert image description here

5. Use yum install -y XXXX software name
Install pcre-devel

insert image description here

install tomcat

insert image description here

Common operating commands of yum:

yum -y install 软件名 #安装、升级软件包,-y 选项表示自动确认,-q 选项表示静默安装
yum -y remove/erase 软件名 #卸载软件包,可自动解决其依赖关系
yum -y update 软件名 #升级软件包
yum list #查询软件包列表
yum list installed #查询系统中已安装的软件包
yum list available #查询仓库中尚未安装的软件包
yum list updates #查询可以升级版本的软件包
yum info 软件名 #查询软件包的描述信息
yum info httpd
yum search [all] 关键词 #根据某个关键词来查找相关的软件包
yum search all httpd
yum whatprovides 命令 #查询命令属于哪个软件包
yum whatprovides netstat

使用yum whatprovides yum来查看哪个软件包提供的
insert image description here

四.编译安装的基本过程

(1)tar 解包
tar zxvf/jxvf xxx.tar.gz/xxx.tar.bz2 -C 目标路径
(2)配置软件模块(安装路径、开启或关闭模块功能、管理服务进程的用户设定)
./configure --prefix=目标路径(此软件安装到哪里去)
(3)编译(将源代码转换为可执行的程序)
make
(4)安装
make install

To install the source code software package, you need to compile and install it 安装支持c和c++程序语言的编译器. If you use rpm to install gcc, gcc-c++, and make, you need to install multiple dependent packages first, which will be very cumbersome. Here you can use the yum method for one-click installation.

Pull the file in:
insert image description here
specify the path:

insert image description here
Use make install to execute the installation.
Install cd /usr/local at the specified location
to view the configuration files in the nginx folder

Guess you like

Origin blog.csdn.net/Wanghwei17/article/details/130371066