How to install Apache server in Linux

Source: Internet
Author: User

How to install Apache server in Linux

due to learning needs, all manually installed Apache source package, the installation process of the problem is strange, but it's not too difficult to figure out where the problem is. If you have a learner who has problems with the installation, you can read the tutorial carefully.

Download the HTTPD software package (Http://httpd.apache.org/download.cgi#apache24) first.

Since I am installing the CentOs7.0 in the virtual machine, we also need to download a software to place the package files downloaded in Windows on Linux. (:http://winscp.net/eng/docs/lang:chs)

Click Install WINSCP, the interface will appear after successful installation:

: Enter the virtual machine's IP address, user name and password, and click Login. Find the downloaded package file, you can drag the package file into the Linux folder, note: You need to put the downloaded httpd package file in the/usr/local/src file directory, which is commonly used to place a variety of source packages.

Below we log in to Linux, to the SRC directory (cd/usr/local/src), to unpack the httpd package file #tar-zxvf httpd package file ( Note There may be an episode where you unzip it that may appear:

Gzip:stdin:not in gzip format
Tar:child returned status 1
Tar:error exit delayed from previous errors

Such errors, the reason is very simple because the compression package is not compressed in gzip format, all decompression can be removed ' z ', so that the successful decompression):

#cd httpd folder

#cd./configure--prefix=/usr/local/apache

At this point, the following problem occurred:

[Email protected] httpd-2.4.17]#/configure--prefix=/usr/local/apache2

Checking for chosen layout ... Apache

Checking for working mkdir-p ... yes

Checking for grep that handles long lines and-e .../usr/bin/grep

Checking for egrep .../usr/bin/grep-e

Checking build system Type ... X86_64-unknown-linux-gnu

Checking host system Type ... X86_64-unknown-linux-gnu

Checking target system Type ... X86_64-unknown-linux-gnu

Configure

Configure:configuring Apache Portable Runtime Library ...

Configure

Checking for APR ... no

Configure:error:APR not found. Please read the documentation.

From the last line of configuration information you can tell: Apr is not found, then what is Apr?

Note: You should not confuse Apr with ARP, the former is (Apache portable run-time Libraries,Apache Portable Runtime, Its primary role is to provide a bottom-level support interface library for upper-level applications that can be used across multiple operating system platforms , while the latter is (address Resolution Protocol, addresses Resolution Protocol ).

OK, now we can download the APR package, but to tell you that APR is also dependent on the package apr-util, all we also need to download apr-util

: (http://apr.apache.org/)

We still use the method at the beginning of the article to put it under the/USR/LOCAL/SRC directory. Unzip the installation below:

#cd/USR/LOCAL/SRC

#tar-XVF Apr Package file

#cd Apr Folder

#cd./configure--prefix=/usr/local/apr-util

However, the following configuration problems have occurred:

From the configuration information can be found: we need to install the GCC compiler

We can use the online installation of GCC

#yum Install GCC

#yum Install gcc-c++ (this must be installed, if not installed, the following installation will also require the installation of the package)

After the installation is complete, you can reinstall the APR-UTIL,APR, still follow the previous method of installation, you can install the pass.

When we installed the httpd package file, we found that it appeared in the installation:

Checking whether we are using the GNU C compiler ... yes

Checking whether GCC accepts-g ... yes

Checking for GCC option to accept ISO C89 ... none needed

Checking how to run the C preprocessor ... gcc-e

Checking for GCC option to accept ISO C99 ...-std=gnu99

Checking for pcre-config ... false

Configure:error:pcre-config for Libpcre not found. PCRE is required and available from http://pcre.org/

from the configuration information: We also need to install the Pcre package files, in fact, installed here I think everyone is very collapsed, thought how so many things to install, here we will say about the Linux software package dependencies, if you are installing Apache server for example, that is: httpd package file-->PCRE-->ARP-->APR-UTIL-->GCC

All if we choose to install the source code, it must be carefully installed step-by-step.

We can find the Pcre in the configuration information on the Internet (mainly used for pattern segmentation, matching, finding and replacing of strings)

:http://download.chinaunix.net/download/0008000/7913.shtml

#unzip Pcre Package file

#cd Pcre Folder

#configure--prefix=/usr/local/pcre--with-apr=/usr/local/apr/bin/apr-1-config

#make

#make Install

We can install the HTTPD installation package again after the successful installation, then we can rest assured that there will be no other dependent installation package software, we still follow the previous method:

#cd httpd Package file

#cd./configure--prefix=/usr/local/apache--with-pcre=/usr/local/pcre--with-apr=/usr/local/apr--with-apr-util=/ Usr/local/apr-util

#make

#make Install

OK, finally the installation is successful, then we open the Apache service, but before we open it we have to modify a small place:

#cd/usr/local/apache/conf

#vi httpd.conf

Find #servername www.example.com:80

Add the servername 192.168.9.122:80 below

Save to exit

Finally, let's start by:

Next we can view it in the browser:

It Works! You will be able to demonstrate that your Apache server was successfully installed.

How to install Apache server in Linux

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.