[Only 3 steps] manually install Apache and configure the source code (which is feasible in the test)

Source: Internet
Author: User
RedHatLinux6 uses the CentOSyum source. For more information about CentOSyum source configuration, see configure.

RedHat Linux 6 uses the CentOS yum source.

For CentOS yum source configuration, see http://www.linuxidc.com/Linux/2015-07/119782.htm

Step 1 download and install the software package on which Apache depends

Install apr

: Http://apr.apache.org/download.cgi

Decompress package: tar-jxvf apr-1.5.0.tar.bz2 note: the package format is tar.bz2format, if it is .tar format with tar-zxvf + package name command decompress.

Enter the folder of the package and execute the following commands in sequence:

./Configure -- prefix =/work/installed/apr (Note: You can customize the folder directory for configure installation)

Make

Make install

Install apr-util

: Http://apr.apache.org/download.cgi

Decompress package: tar-jxvf apr-util-1.5.3.tar.bz2

Go to the folder and execute:

./Configure -- prefix =/work/installed/apr-util -- with-apr =/work/installed/apr

Make

Make install

Install pcre

: Http://pcre.org/

Decompress package: tar-jxvf pcre-8.35.tar.bz2

./Configure -- prefix =/work/installed/pcre

Make

Make install

Note: If You encounter problems when installing pcre: configure: error: You need a C ++ compiler for C ++ support.

Ubuntu solution: sudo apt-get install build-essential

Redhat6/centos6 solution: yum installation package: yum install gcc-c ++ kernel-devel

Step 2 install Apache and configure:

Installation:

: Http://httpd.apache.org/

Extract: tar-jxvf httpd-2.4.9.tar.bz2

Enter the decompressed file and execute:

. /Configure -- prefix =/work/installed/apache -- with-apr =/work/installed/apr -- with-apr-util =/work/installed/apr-util --- pcre =/work/installed/pcre -- enable-module = shared

-- Enable-module = shared indicates that Apache can dynamically load modules, paving the way for future php installation.

Make

Make install

NOTE: If an installation error occurs and you want to reinstall the package, first Delete the installed folder, and then clear the compilation in the decompressed Folder: make clean all

Step 3 configure Apache:

Modify the configuration file. If the apache service is started without modification, the following problems may occur:

AH00558: httpd: cocould not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'servername' directive globally to suppress this message

Solution:

Modify the file in the installed directory:

Command: vim/work/installed/apache/conf/httpd. conf

Put:

# ServerName www.example.com: 80

Changed:

ServerName localhost: 80

You can also configure your own homepage directory:

You can also add the php homepage:

If there is a hosts file under/etc/, modify it:

Modify the file: vi/etc/hosts

Enter 192.168.8.119 server.example.com

Change the ip address to your own ip address.

Start the apache service:

Enter the command:/work/installed/apache/bin/apachectl start

Automatic Start upon startup: vim etc/rc. local

Add:/work/installed/apache/bin/apachectl start. Here is the configuration file in the apache installation directory. Let it start automatically when it is started!

If not, disable the firewall: iptables-F

Enter the IP address and you will see: it works!

However, in this case, you must disable the firewall, so you need to configure the firewall:

Open the iptables configuration file vi/etc/sysconfig/iptables.

Add a port 80: (if you have customized the port, enter your own port)

-A RH-Firewall-1-INPUT-m state-state NEW-m tcp-p tcp-dport 80-j ACCEPT

Another yum installation of Apache and Apache configuration, for reference only: http://www.linuxidc.com/Linux/2015-07/119781.htm

Allow Internet access to the Intranet port forwarding http://www.linuxidc.com/Linux/2015-07/119778.htm

Ubuntu Server 14.04 Install Web Server (Linux + Apache + MySQL + PHP) http://www.linuxidc.com/Linux/2015-06/119061.htm

Install and configure the PHP environment (Apache2) http://www.linuxidc.com/Linux/2015-05/118062.htm in Linux

How does Apache Rewrite in Ubuntu enable http://www.linuxidc.com/Linux/2010-10/29027.htm?

Several highlights of http://www.linuxidc.com/Linux/2015-01/111914.htm after Apache 14.04 upgrade to 2.2 in Ubuntu 2.4

Install the LAMP \ Vsftpd \ Webmin \ phpMyAdmin service and settings in Ubuntu 13.04Http://www.linuxidc.com/Linux/2013-06/86250.htm

Compile and install LAMP (Apache 2.2.44 + MySQL 5.6.10 + PHP 5.4.12) http://www.linuxidc.com/Linux/2013-03/80333p3.htm in CentOS 5.9

Source code construction of Web Server Architecture in RedHat 5.4 LAMP environment and application PHPWind http://www.linuxidc.com/Linux/2012-10/72484p2.htm

LAMP source environment to build WEB Server Linux + Apache + MySQL + PHP http://www.linuxidc.com/Linux/2013-05/84882.htm

Apache details: Click here
Apache: Click here

For more information about RedHat, see RedHat topic page http://www.linuxidc.com/topicnews.aspx? Tid = 10

This article permanently updates the link address: Http://www.linuxidc.com/Linux/2015-07/119783.htm

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.