There are three ways to install software in Linux:
rpm installation software
rpm(redhat package manager), red hat package manager.
The rpm software in Linux is interdependent.
Package names are usually package names + version numbers
Among them, the version number is generally divided into three levels.
For example:
apache package name: httpd-2.2.15-53.el6.centos.x86_64.rpm
2.2.15 stands for large version number, small version number, patch package (repair version)
rpm -ivh [package] #Install rpm packages. If dependent packages need to be installed, there will be an error message rpm -e [package] #Unloading package rpm -ql [Package name before version number] #Query the specified package installation directory rpm -q [Package name before version number] #Query whether a package is installed rpm -qa [Package name before version number] #Query all rpm packages installed locally rpm -qa | grep [Fuzzy matching package name] #Fuzzy query about whether a package is installed rpm -qa | wc -l #Statistics the number of all rpm packages installed locally rpm -Uvh [package] #Upgrade package rpm -qf [package] #Query which package a file belongs to rpm -qi [package] #Display details of a softwareyum software installation artifact
yum will help us automatically install dependency packages
yum install httpd #Installation software without interaction yum install -y httpd #Installation software with interaction service httpd restart #Restart apache service
In fact, yum installs or installs rpm packages, only to help us resolve dependencies.
The package installed by yum comes from our own yum source.
The Yum source is stored in / etc/yum.repos.d by default.
In fact, yum can also specify a CD, mobile hard disk as the source, so when we have a CD or mobile hard disk, we can not even get the package we want online.
service [Software Name] start # start a Software Restart # restart a software service [software name] stop stop a software The premise is that the software must be installed by yum or specified by itself.Other operations of yum:
yum remove [Package name] #Using yum to remove a software, you can add the - y parameter yum list #See how many packages are in the specified source yum list | wc -l ##Statistics of the number of yum packages installed locally yum search [Package name] #Search for packages in yum sources yum update [Package name] #Upgrade a software to add - y parameters
Compilation and installation
Use the compiler to compile the source code of the package so that it can run.
Usually our commonly used Linux software packages are written in c/c++, so we need to use a compiler.
The common compilers are gcc[C language compiler], gcc-c++[C++ language compiler]
Source code packages must be downloaded on their own official websites.
After downloading, compile and install according to the documents provided by the official website.
1. / configure - prefix = configuration
(2) make compilation [compiled according to machine environment and software environment],
makefile is generated after compilation
Makeinstall compiler will help you install
Why compile and install, why others recommend this
Because of the configuration and compilation process.
The most stable is the goal we expect to achieve.
Official Server in Formal Production Server, Official Server Running Online
lnmp is a script, compiled and installed.
Install httpd
wget -c http://mirrors.hust.edu.cn/apache//httpd/httpd-2.4.25.tar.gz tar -zxvf httpd-2.4.25.tar.gz cd httpd-2.4.25 yum install -y gcc gcc-c++ #Install the compiler required for compilation ./configure --prefix=/usr/local/apache2 #Notice that this step will make a mistake. Look at the following echo $? #To see if this step has been successfully executed, follow it up. 1 Error 0 Error ####Here is the part of installing the apr, which can be done ahead of time cd ../ #Be careful to come out wget -c http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.5.2.tar.gz tar -zxvf apr-1.5.2.tar.gz cd apr-1.5.2 ./configure --prefix=/usr/local/apr make make install ### cd ../ wget -c http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.5.4.tar.gz tar -zxvf apr-util-1.5.4.tar.gz cd apr-util-1.5.4 ./configure --prefix=/usr/local/apt-util --with-apr=/usr/local/apr/ make && make install #There is no problem with the previous execution, but only later. ####Install pcre wget -c ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz tar -zxvf pcre-8.39.tar.gz cd pcre-8.39 ./configure --prefix=/usr/local/pcre && make && make install cd ../ cd httpd-2.4.25 ##This is the complete configuration statement. ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre ##Designated file execution $apache/bin/apachectl start #Open apache $apache/bin/apachectl stop #Close apache $apache/bin/apachectl restart #Restart apache cp /usr/local/apache2/bin/apachectl /sbin #Execution by command ##Add apache to the service to run cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd