Installation of Apache under CentOS step
First, the experimental environment
Linux:centos Release 6.7 (Final)
Apache:httpd-2.4.23.tar.gz
Vmware:vmware 10.0
Host: Win10 x64
II. introduction of Apache
Apache a Web server software. It can run on almost all widely used computer platforms and is one of the most popular Web server-side software due to its widespread use across platforms and security. It is fast, reliable, and can be augmented with simple APIs to compile perl/python and other interpreters into the server. Apache, meanwhile, is a tribe of North American Indians called the Apache clan.
Third, installation package download and its environmental requirements
Apache relies on environments such as APR, Apr-util, Pcre, and GCC and gcc-c++ to compile the source code, as shown in the installation package and the version I use
install package |
|
I download the version used |
apache |
http://httpd.apache.org/download.cgi |
httpd-2.4.23.tar.gz |
APR |
http://apr.apache.org/ |
apr-1.5.2.tar.gz |
apr-util |
http://apr.apache.org/ |
apr-util-1.5.4.tar.gz |
Pcre |
http://www.pcre.org/ |
Pcre-8.39.tar.gz |
Note: gcc and gcc-c++ use RPM or yum installation, Pcre download must see clearly is pcre or pcre2, because I downloaded Pcre2, installed several times failed, and finally found because the installation package download error.
It is highly recommended to take a look at the official document: http://httpd.apache.org/docs/2.4/install.html
Iv. installation Process
1, configure the Centos-base.repo, install GCC, gcc-c++ Configure the network Yum Source Method (http://blog.chinaunix.net/uid-23683795-id-3477603.html), the configuration is completed after the execution:
[Email protected]~]# yum-y Install gcc
[Email protected]~]# yum-y Install gcc-c++
2. Install the dependency pack and Apache Httpserver
2.1 Uploading httpd, Apr, Apr-util, pcre to/usr/local/mypackages/using the FTP tool
[[Email protected]~]# cd/usr/local/mypackagers/
[Email protected]]# ls
apr-1.5.2.tar.gzapr-util-1.5.4.tar.gz httpd-2.4.23.tar.gz pcre-8.39.tar.gz
2.2 Installing Apr:
[Email protected]]# tar xvf apr-1.5.2
[[Email protected]]# CD apr-1.5.2
[[Email Protected]]#./configure--prefix=/usr/local/apr
[[email protected]] #make && Install
2.3 Installing APR
[Email protected]]# tar xvf apr-util-1.5.4.tar.gz
[[Email protected]]# CD apr-util-1.5.4
[[Email Protected]]#./configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr
[[email protected]] #make && Install
2.3 Installing Pcre
[Email protected]]# tar xvf pcre-8.39.tar.gz
[[Email protected]]# CD pcre-8.39
[[Email protected]]#./configure--prefix=/usr/local/pcre
[[Email protected]]# make && make install
2.4 Installing HTTPD
[[email protected]] #tar XVF httpd-2.4.23.tar.gz
[[Email protected]]# CD httpd-2.4.23
[[Email protected]]#./configure--prefix=/usr/local/apache--with-apr=/usr/local/apr--with-apr-util=/usr/local/ Apr-util--with-pcre=/usr/local/pcre/
[[email protected]] #make && make install
V. Start and set boot
1, open 80 port or shut down the firewall, see below firewall configuration, start Apache service:
[email protected] ~]#/usr/local/apache/bin/apachectl start, Browser input: Http://IP address: 80, appears It works! prove that Apache has been installed successfully.
2. Set Boot from boot
echo "/usr/local/apache/bin/apachectl start" >>/etc/rc.d/rc.local
Vi. Troubleshooting the installation start-up process
1,Configure:error:apr/apr-util not found. Pleaseread the documentation.representsApr/apr-utilnot installed, install firstApr, then installApr-util, becauseApr-utilDependentApr, installationAprand theApr-utilBefore you installGCCtool, or you will be promptedconfigure:error:no acceptable C compiler found in $PATH.
2, Configure:error:pcre-config forlibpcre not found. PCRE is required and available from http://pcre.org/because PCRE is not installed, PCRE is required before installing gcc-c++, Otherwise, Configure:error:You need ac++ compiler for C + + support will be prompted.
3. ServerName Server domain name
[[Email protected]~]#/usr/local/apache/bin/apachectl Start
AH00558:httpd:Could not reliably determine the server ' s fully qualified domain name,using::1. Set the ' ServerName ' directive globally to suppress this message
[[Email protected]]# cd/usr/local/apache/conf/
[Email protected]]# VI httpd.conf
Add a ServerName under the #servername www.example.com:80 localhost:80
4. Port occupancy
[[Email protected]~]#/usr/local/apache/bin/apachectl Start
HTTPD (PID 38477) already running
[[email protected]~]# ps aux | grep httpd
[[Email protected]~]# kill-9 38477//There are several processes to kill
[[Email protected]~]#/usr/local/apache/bin/apachectl Start
5, firewall open 80 port or directly shut down the firewall
such as Apache background service has started, but the browser can not access, may be blocked by the firewall, two ways to resolve:
5.1 Open 80 port, recommended use
[[email protected] ~]# iptables-i input-p TCP--dport 80-jaccept//Open 80 port
[[Email protected] ~]# service iptables save/Save Policy
iptables:saving firewall rules to/etc/sysconfig/iptables:[OK]
[[Email protected] ~]# service iptables status//has the following line to prove that port 80 is open
1 ACCEPT TCP--0.0.0.0/0 0.0.0.0/0 TCP dpt:80
5.2 Turn off the firewall and set the firewall on without booting
[[Email protected]~]# service iptables stop//Turn off firewall
Iptables:setting chains to Policy Accept:filter [OK]
iptables:flushing firewall rules: [OK]
iptables:unloading modules: [OK]
[[Email protected]~]# chkconfig |grep iptables//2345 is on to start
Iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[[Email protected]~]# chkconfig iptables off//set iptables boot not self-booting
[[Email protected]~]# chkconfig |grep iptables//2345 is off for boot not self-booting
Iptables 0:off 1:off 2:off 3:off 4:off 5:off 6:off
-----chopped green onion 2016-12-20
-----Reprint Please specify the source http://myitpp.blog.51cto.com
This article is from the "green onion Son" blog, please be sure to keep this source http://myitpp.blog.51cto.com/12252179/1884395
Installation of Apache under CentOS step