LAMP is Linux Apache MySQL PHP shorthand, in fact, is to Apache,mysql and PHP installed on the Linux system, form an environment to run the PHP scripting language. Apache is the most commonly used WEB services software, so the installation of Apache is essential, where the compilation and installation of Apache is particularly important, next I step by step to compile and install Apache.
Specific steps:
1, the preparation: first of all to ensure that there is a Linux system PC or server, I here is the CentOS6.8 64-bit system (minimal installation), and then have to ensure that your system can normally use wget, because it needs to download the things we say need, if not can be installed with Yum;
Yum install-y wget
2, download the installation package on Apache's official website (or any other way);
wget http://apache.fayea.com//httpd/httpd-2.2.31.tar.gz
3, unpack the installation package;
Tar zxvf httpd-2.2.31.tar.gz
4, create an installation directory;
Mkdir/usr/local/apache2
5, enter the extracted directory;
CD httpd-2.2.31
6, compile and install;
./configure--prefix=/usr/local/apache2--with-included-apr--enable-so--enable-deflate=shared--enable-expires= Shared--enable-rewrite=shared--with-pcre
Note:--prefix
indicates where the specified installation is,--enable-so
means to enable DSO--enable-deflate=shared
represents the shared way of compiling deflate, followed by the same parameters.
problems that arise:
6.1, lack of zlib-devel bag;
Checking whether to enable Mod_deflate ... configure:error:mod_deflate have been requested but can not is built due to Prerequisite Failures
Workaround:
Yum Install-y zlib-devel
6.2, lack of GCC situation;
Configure:error:no acceptable C compiler found in $PATH
Workaround:
Yum install-y gcc
6.3, if there are some other problems, you can follow the wrong meaning to install the appropriate package Yum, because the compilation of the installation package and the package will have a corresponding dependency, so the required packages are not missing.
7, compile, there will be a lot of dynamic code here, do not have to control it, wait for the good;
Make
8, installation;
Make install
Note: Tip: We can go through "echo $?" Every step of the way. To determine success? The output is 0, the success is not error, the output is 1 is the failure, depending on the error or log to find the error.
[Email protected] httpd-2.2.31]# echo $?0
9, enter the installation directory, start the service;
[Email protected] httpd-2.2.31]# Cd/usr/local/apache2/bin/[[email protected] bin]#./apachectl start
Error occurred:
Httpd:could not reliably determine the server ' s fully qualified domain name, using 127.0.0.1 for ServerName
Workaround: Modify the Apache configuration file;
[Email protected] bin]# vim/usr/local/apache2/conf/httpd.conf
In the 100 line position, vim command mode, the cursor is placed in 100 lines, press YY, and then press p;
#ServerName www.example.com:80
Then remove the # and replace the "www.example.com" with your own IP address, and I'll change it later.
101 ServerName 10.0.151.189:80
Finally: WP save quit, start the service again, start successfully;
[Email protected] bin]#/apachectl starthttpd (PID 29725) already running
Make sure it's foolproof and we can see if it starts:
[[email protected] bin]# NETSTAT-LNP |grep httpdtcp 0 0::: +:::* LISTEN 29827/httpd
Because it may be affected by the firewall, there is no way to detect success, so I first shut down the firewall;
[[Email protected] bin]# service iptables stopiptables: Set the chain as policy accept:filter [OK]iptables: Clear firewall rule: [OK]iptables: Unloading module: [OK]
Finally enter the IP address in the browser; success!
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/8A/54/wKiom1gtYcKjsDPGAAAYy2XiLXc416.jpg-wh_500x0-wm_3 -wmp_4-s_407049425.jpg "title=" qq20161117155218.jpg "alt=" Wkiom1gtyckjsdpgaaayy2xilxc416.jpg-wh_50 "/>
This allows our Apache to compile and install successfully.
This article is from the "Hello I am Forest" blog, please make sure to keep this source http://chensenlin.blog.51cto.com/10559465/1873922
Detailed procedures for installing Apache on Linux compilation