Environment: centos7
rpm package repository: https://pkgs.org/ You can find all rpm packages and their dependencies
One, rpm package and source code package
Software installation on windows is implemented by downloading and installing programs. To install software on linux, you need to download the corresponding package (source code package, rpm package), and different package installation methods are different
(1) rpm package
1. Package naming format
2. Package installation method: use rpm, yum tool to install
3. Features of the package:
a. Dependency: http://www.rpmfind.net URL can find the package that the file depends on
Tree dependency: a>b>c>d
Circular dependency: a>b>c>d>a
Module dependencies:
b. is the compiled binary file
Advantages: 1 Fast installation speed 2 Simple package management system
Disadvantages: 1 Cannot see the source code 2 Inflexible function selection 3 There are dependency problems
c. Installation location
/etc/ configuration file
/usr/bin/ command
/usr/lib/ function library
/usr/share/doc/ Manual
/usr/share/man/ Help document
(2) Source code package
1. The naming format of the package: php-7.2.24.tar.gz
2. How to install the package
a. Unzip
xxx.tar.gz tar -zxvf package name
xxx.tar.bz2 tar -jxvf package name
b. Configuration
Enter the decompression directory, configure command configuration
c. Compile
make make test make clean make distclean
d. Installation
make install
3. Features of the package
Advantages: 1. Open source, you can develop twice by yourself 2. You can freely choose the required functions 3. The software is compiled and installed, with better compatibility 4. You can specify the installation location by yourself, and it is easy to uninstall
Disadvantages: 1 long installation time 2 complicated installation steps 3 troublesome handling once an error is reported
The installation location is arbitrarily specified, but there are conventions:
--prefix=/usr/local/xxx
Configuration file: /etc/xxx/
Command file: /usr/sbin/ or /usr/bin
Log: /var/log
Two, rpm tool command
Introduction: RedHat Package Manager (RedHat package management tool)
1. Package installation, upgrade, uninstall
rpm -ivh package full name#install package
rpm -Uvh 包名#Upgrade
rpm -e 包名#Uninstall
2. Package query
rpm -qi package (full) name#View package information
rpm -ql package (full) name#View package file list
rpm -qa package name #View all installed packages
rpm -qf file name#View which package the file (command) belongs to
3. Package dependency check
rpm -qR 包名#Query the dependencies of installed packages
rpm -qRp package full name#Query dependencies of uninstalled packages
4. File extraction in the package (used to recover after accidentally deleted files)
rpm2cpio package full name | cpio -idv .file name#Extract to the current folder
5. Package inspection
Three, yum tool command
(1) Introduction: yum (Yellow dog Updater, Modified) online RPM package management tool can automatically download and install RPM packages from a specified server, automatically handle dependencies, and install all dependent software packages at once,
No need to download and install tediously again and again.
(2) Commonly used commands
1. Update, install, uninstall
yum check-update #List all updateable software
yum -y update #Update all software
yum -y -install package name#install
yum -remove 包名#Uninstall
yum -y update package name#Update the specified package
2. Find
yum list #List all installable packages
yum serach keyword#Find software packages with keywords
yum provides file name#Query which package the file belongs to
(3) yum source
Replacing the domestic yum source can increase the speed of software package installation and update, and at the same time avoid the inability to find some common software versions. Proceed as follows:
1. Back up the original yum source
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2. Download domestic yum source (NetEase)
Address: http://mirrors.163.com/.help/CentOS7-Base-163.repo
weighs http://mirrors.163.com/.help/CentOS7-Base-163.repo
mv CentOS6-Base-163.repo CentOS-Base.repo
3. Clear yum cache and regenerate
yum clean all
yum make cache