Marco Linux Training Learning--compile and install Apache HTTP Server 2.4.10

Source: Internet
Author: User

Objective: To compile and install httpd, and to master the general methods and procedures of compiling and installing the source code based on Linux environment.

Environment:

Operating system: CentOS 6.5

Kernel version: 2.6.32-431.el6.i686

Software version: Apache HTTP Server 2.4.10

Software Download:

1. Apache HTTP Server 2.4.10 (httpd): http://apache.dataguru.cn//httpd/httpd-2.4.10.tar.bz2

2, Apache portable Runtime 1.5.1:http://apache.dataguru.cn//apr/apr-1.5.1.tar.bz2

3, Apr-util 1.5.3:http://apache.dataguru.cn//apr/apr-util-1.5.3.tar.bz2

Installation steps:

1. Upload the downloaded Httpd/apr/apr-util source code to the CentOS 6.5 system

2, decompression httpd-2.4.10.tar.bz2

# TAR-XVF HTTPD-2.4.10.TAR.BZ2

3, check whether the compilation environment to meet the compilation requirements, specify the installation path:--prefix=/usr/local/apache-2.4.10 configuration file path:--sysconfdir=/etc/apache-2.4.10

# cd httpd-2.4.10# ./configure --prefix=/usr/local/apache-2.4.10 --sysconfdir=/etc/ Apache-2.4.10checking for chosen layout... apachechecking for working mkdir  -p... yeschecking for grep that handles long lines and -e ... /bin/grepchecking for egrep... /bin/grep -echecking build system  type... i686-pc-linux-gnuchecking host system type... i686-pc-linux-gnuchecking  Target system type... i686-pc-linux-gnuconfigure: configure: configuring apache  Portable Runtime library...configure: checking for APR... configure:  warning: apr version 1.4.0 or later is required, found  1.3.9configure: warning: skipped apr at apr-1-config, version  Notacceptablenoconfigure: error:&nBsp Apr not found.  please read the documentation.

Check that the compilation environment encountered an error that does not conform to httpd-2.4.10 compilation requirements. Here I remember when I was just working. A teacher said that encountering errors is God's chance to solve problems and grow. Thank God, then solve the error to meet the requirements of the compilation. The current system provides a version of Apr that is 1.3.9 and requires a 1.4.0 or newer version at compile time.

4. Compile and install apr-1.5.1, specify the installation path:--prefix=/usr/local/apr1.5

# TAR-XVF apr-1.5.1.tar.gz# cd apr-1.5.1#./configure--prefix=/usr/local/apr1.5# make# make install

5, compile the installation apr-util-1.5.3, specify the installation path:--prefix=/usr/local/apr-util-1.5, specify the dependent apr:--with-apr=/usr/local/apr1.5

# TAR-XVF apr-util-1.5.3.tar.gz# cd apr-util-1.5.3#./configure--prefix=/usr/local/apr-util-1.5--with-apr=/usr/ local/apr1.5# make# make Install

6. Re-check the environment required for compiling httpd-2.4.10, specify the APR and apr-util required at compile time.

# CD httpd-2.4.10#./configure--prefix=/usr/local/apache-2.4.10--sysconfdir=/etc/apache-2.4.10--with-apr=/usr/ local/apr1.5--with-apr-util=/usr/local/apr-util-1.5

7. Compile and install

# make# make Install

8. Configure the PATH environment variable of the HTTPD binary program

# Vi/etc/profile.d/apache-2.4.10.shpath=/usr/local/apache-2.4.10/bin: $PATHexport PATH # source/etc/profile.d/ apache-2.4.10.sh

9, the httpd header file output to the system

# LN-SV/USR/LOCAL/APACHE-2.4.10/INCLUDE/USR/INCLUDE/HTTPD

10, the library file output to the system

# Vim/etc/ld.so.conf.d/httpd.conf/usr/local/apr1.5/lib/usr/local/apr-util-1.5/lib let system regenerate library file path Cache # Ldconfig

11. Export Man File

# Vim/etc/man.configmanpath/usr/local/apache-2.4.10/man

12. Start the HTTP Server

# Apachectl start# NETSTAT-TNL | grep 80

13. Verification

Http://Centos 6.5 IP address/will display It in the Web page works!

Summary: How source code is compiled and installed

First, prepare the development environment for CentOS 6.5, install development tools and Server Platform development two package groups.

Second, download the source code, and unzip

# TAR-XVF Package-version.tar. {GZ|BZ2|XZ}

Third, switch to the source code directory

# CD Package-version

Iv. Executing Configure scripts

#./configure

Five, compile

# make

VI. Installation

# make Install

Vii. output binaries, header files, library files, and man documents to the system

1) Two-stage program output

Under the/etc/profile.d/directory, create a script that ends in. SH, as follows:

Path= the directory path where the binaries are located: $PATH

Export PATH

2) header file output

Create a new soft link file under the/usr/include directory to point the linked file to the directory where the header file resides.

Ln-s header file directory/usr/include/link file

3) library file output

Under the/ETC/LD.SO.CONF.D directory, create a file that ends in. conf, which is the directory where the library file resides.

Use the Ldconfig command to have the system regenerate the library file path cache.

4) Man document output

Edit the/etc/man.config file and add a line that reads as follows:

MANPATH The directory of the man document

 

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.