Ubuntu14.04 compile and install Apache

Source: Internet
Author: User
To compile and install apache in Ubuntu, You need to compile and Install Multiple dependencies in advance, including: apr, apr-util, pcre, zlib-devel, and so on, which is quite troublesome and recorded for future reference. C ++ is not installed in Ubuntu by default. Therefore, you must first install c ++ to compile relevant components. [Note] apt-cachepolicy package name // view the installed package information. -----------------------------------

To compile and install apache in Ubuntu, You need to compile and Install Multiple dependencies in advance, including: apr, apr-util, pcre, zlib-devel, and so on, which is quite troublesome and recorded for future reference.

C ++ is not installed in Ubuntu by default. Therefore, you must first install c ++ to compile relevant components.

[Note] apt-cache policy Package name // view the installed package information.

-------------------------------------- Split line --------------------------------------

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

Build http://www.linuxidc.com/Linux/2014-05/101087.htm in LAMP + Xcache Environment

-------------------------------------- Split line --------------------------------------

Installation steps:

1. First install c ++ to compile related components:

The newly installed Ubuntu system already has GCC, but no GCC file can be compiled. Because there are no necessary header files, you need to install the build-essential software package, installed with this package will automatically install g ++, libc6-dev, linux-libc-dev, libstdc ++ 6-4.1-dev and other necessary software and header file library.

Install the required software package:

Sudo apt-get install build-essential

2. Compile and install APR

(1) first download apr: Address: http://mirror.esocc.com/apache/apr/

Storage location:/usr/local/src/apr-1.5.1.tar.gz

(2) # cd/usr/local/src

(3) # tar-zxvf apr-1.5.1.tar.gz

(4) # cd apr-1.5.1

(5) #./configure-prefix =/usr/local/apr

(6) # make

(7) # make install

3. Compile and install apr-util, similar to installing apr in the previous step.

(1) first download apr-util: address with apr: http://mirror.esocc.com/apache/apr/

Storage location:/usr/local/src/apr-util-1.5.3.tar.gz

(2) # cd/usr/local/src

(3) # tar-zxvf apr-util-1.5.3.tar.gz

(4) # cd apr-util-1.5.3

(5) #./configure-prefix =/usr/local/apr-util -- with-apr =/usr/local/apr // the apr installation path is included here.

(6) # make

(7) # make install

4. Compile and install pcre.

(1) first download pcre: Address: http://sourceforge.net/projects/pcre/files/pcre/

Storage location:/usr/local/src/pcre-8.35.tar.gz

(2) # cd/usr/local/src

(3) # tar-zxvf pcre-8.35.tar.gz

(4) # cd pcre-8.35

(5) #./configure-prefix =/usr/local/pcre

(6) # make

(7) # make install

5. Install zlib-devel.

# Apt-get install zlib1g-dev

// Zlib-devel is a RedHat/Fedora name, zlib1g-dev and libz-dev are the Debian/Ubuntu names (zlib1g-dev provides libz-dev which is a virtual package ).

Or:

(1) download zlib: Address: http://sourceforge.net/projects/libpng/files/zlib/

Storage address:/home/xxx/Downloads

# Cp/home/xxx/Downloads/zlib-1.2.8.tar.gz/usr/local/src

# Cd/usr/local/src

# Tar-zxvf zlib-1.2.8.tar.gz

# Cd zlib-1.2.8

#./Configure-prefix =/usr/local/zlib

# Make & make install

6. Compile and install apache.

Download apache, address: http://httpd.apache.org/download.cgi

Storage location:/home/xxx/Downloads

# Cd/home/xxx/Downloads

# Cp httpd-2.4.9.tar.gz/usr/local/src

# Cd/usr/local/src

# Tar-zxvf httpd-2.4.9.tar.gz // unzip

# Cd httpd-2.4.9

#. /Configure-prefix =/usr/local/apache2 -- enable-deflate -- enable-expires -- enable-headers -- enable-modules = most -- enable-so -- with-mpm = worker -- enable-rewrite -- with-apr =/usr/local/apr -- with-apr-util =/usr/local/apr-util -- with-pcre =/usr/local/pcre

# Echo $? // Check for errors

#0 // If 0 is returned, it indicates no problem.

# Make

# Make install

The parameters following./cofigure are described as follows:

# -- Prefix = Indicates that the compiled binary file is installed Directory, replaced by the actual installation path For example, -- prefix =/usr/local/apache-2.4.9. If this configuration parameter is omitted, it is installed in/usr/local/apache2 by default.

# -- Enable-so indicates that the dynamic compilation load module (DSO) supports httpd binary files. This module enables the functional modules of Apache to be compiled separately from the core and dynamically loaded during runtime. With DSO support, you only need to compile the relevant modules when upgrading and adding modules. You do not have to re-compile the entire system. The latest version of Apache compiles this module to the httpd binary file by default. If you are using an earlier version of apache and need DSO support, you may need to explicitly specify this option.

# -- Enable-mod-shared = Specify the module to be compiled in DSO mode, List of module names separated by spaces, all or most. all indicates that all modules are included, and most indicates that most modules are included, such as -- enable-mod-share = "rewritedeflate ", -- enable-mod-share = most. The effect is equivalent to multiple -- enable- = Share

# -- With-mpm = Select the Apache multiplexing module first, = {Beos | event | worker | prefork | mpmt_os2}. The prefork is the default processing module in Unix systems. It runs a non-thread-type, pre-derived Web server, suitable for systems that do not have thread security libraries and need to avoid thread compatibility issues. It is the best MPM that requires that each request be independent of each other, in this way, if a request fails, other requests will not be affected. Worker is a multi-path processing module that supports mixed multi-thread, multi-process processing. because it uses threads to process requests, it can process massive requests. the overhead of system resources is less than the MPM Based on processes, it also uses multiple processes, and each process has multiple threads to obtain the stability of the process-based MPM. If your system is thread-safe, I suggest using worker instead of prefork, which will improve your system performance.

Installation is complete.

For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2

This article permanently updates the link address: Http://www.linuxidc.com/Linux/2014-05/101445.htm

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.