CentOS Learning Notes-source code compile and install Apache

Source: Internet
Author: User

every time encountered error resolution error process, is the best time to accumulate knowledge, he will make you to this knowledge point memory more profound! Well, forgive me for being so shameless. The lack of knowledge reserves to justify, words do not say that the history of the record down.

The system still looks the same:

#cat/etc/redhat-release; Uname-rcentos release 6.7 (Final) 2.6.32-573.el6.x86_64

Learning to install the process encountered many of the detours, I guess I have already gone through, the need to prepare all ahead of time prepared:

Apache version 2.4.20 ( Apache website Address ), depends on the component pack APR (Apache portable run-time Libraries,apache Portable Runtime) version 1.5.2 ( Apr official Address ) Apr-util (same as Apr component

, which also contains some common development components) version 1.5.4 (apr-util official website with Apr), the final compilation process also requires Pcre (Perl Compatible Regular Expressions is a Perl library, including Perl Compatible regular expression library) component, version 8.39 (pcre official website ). As for why choose the latest version, sorry I still can't answer, are looking at which pleasing to choose which O (╯-╰) O.

Forget a little, compile these components before you need to put some compiler installed otherwise will not succeed, yes you guessed right, focus on the small white 30 years of these stupid things I have done, hehe ~. The compiler directly chooses Yum to install the

Yum install-y gcc gcc-c++

OK, start compiling, my choice this time is based on Bird brother's proposal to put the source of the download in the/USR/LOCAL/SRC directory below, and then install Apache installed to/usr/local/apache.

# wget-c Http://mirrors.cnnic.cn/apache//httpd/httpd-2.4.20.tar.bz2-P/usr/local/src# wget-c/http Archive.apache.org/dist/apr/apr-1.5.2.tar.bz2-p/usr/local/src# wget-c http://archive.apache.org/dist/apr/ Apr-util-1.5.4.tar.bz2-p/usr/local/src# wget-c ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ Pcre-8.39.tar.bz2-p/USR/LOCAL/SRC

Once the download is complete, unzip it individually:

# TAR-JXVF Httpd-2.4.20.tar.bz2-c # tar-jxvf apr-1.5.2.tar.bz2-c. # tar-jxvf apr-util-1.5.4.tar.bz2-c. # TAR-JXVF Pcre-8.39.tar.bz2-c.

After the decompression is completed in order, you should first compile and install the APR package, enter the directory after the execution:

#./configure--PREFIX=/USR/LOCAL/APR

Execute after successful compilation

# Make clean;make# make install

Next, install the Apr-util package and execute it after entering the directory:

#./configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr Note:--with is the other component on which the Util package is introduced, followed by a path, and the APR does not add " /"Otherwise the compilation is prone to problems. # Make clean;make# make install

Continue installing the Pcre package

#./configure--prefix=/usr/local/pcre# make, make install

Prerequisites are ready, the protagonist should debut, began to install apache! is really the original use of Yum installation files when found is how easy, I really found a lot of knowledge or need to study their own.

Go to HTTP Directory

#./configure--prefix=/usr/local/apache--with-apr=/usr/local/apr \ >--with-apr-util=/usr/local/apr-util-- with-pcre=/usr/local/pcre# make clean; make# make Install

If it's not an accident, the installation should be over.

Next to the Apache configuration work, can not be finished to forget, the purpose is to use it!

To add a service script for Apache:

# cp/usr/local/apache/bin/apachectl/etc/init.d/httpd# echo "Export path= $PATH:/usr/local/apache/bin >/etc/ profile.d/httpd.sh# chmod +x/etc/profile.d/httpd.sh# source/etc/profiled.d/httpd.sh

Last edit Apache config file, Online said is in the/etc/httpd/httpd.conf, found that I did not edit the

/usr/local/apache/conf/httpd.conf this file, and then join servername 127.0.0.1:80 save after exiting

Start Apache with the service command

# service httpd Start #

No result is the best result, it seems to be successful, open the browser input server IP address if the "It works" this page is successful!

All right! Front of the installation is OK, behind the Configuration service script or something is not very skilled, after finishing practice it

This article from "Product small stream, into Jianghai" blog, please be sure to keep this source http://goodjoe.blog.51cto.com/9173556/1790371

CentOS Learning Notes-source code compile and install Apache

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.