How to install the Apache server and the linuxapache server in Linux

Source: Internet
Author: User

How to install the Apache server and the linuxapache server in Linux

How to install the Apache server in Linux

Due to the learning needs, all the Apache source code packages are manually installed, and the installation process has many strange problems. However, if you find out what the problem is, it is not too difficult. If you have any installation problems, read this tutorial carefully.

First download the httpd package (http://httpd.apache.org/download.cgi#apache24 ).

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

Click Install WinSCP. This page is displayed after the installation is successful:

 

: Enter the IP address, user name, and password of the VM, and click "Log on. Find the downloaded package file and drag it into the Linux folder. Note: You must place the downloaded httpd package file in the/usr/local/src directory, this directory is often used to place various source code packages.

 

Next, log on to Linux and go to the src directory (cd/usr/local/src ), decompress the httpd package file # tar-zxvf httpd package file (Note that there may be an episode here, when you decompress the file, it may appear:

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

The reason for this error is that the compressed package is not compressed in gzip format. You can remove 'Z' for all decompressed packages so that the package can be decompressed successfully ):

# Cd httpd folder

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

The following problem occurs:

[Root @ localhost 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: logging ing Apache Portable Runtime library...

Configure:

Checking for APR... no

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

From the configuration information of the last row, we can know that the APR is not found. What is APR?

Note: Do not confuse APR with ARP. The former is Apache portable Run-time libraries, which can be transplanted to the Runtime Library of Apache, its main function is to provide an underlying support interface library for upper-layer applications that can be used across multiple operating system platforms), while the latter is (Address Resolution Protocol, Address Resolution Protocol ).

Now, we can download the APR package, but we want to tell you that APR still depends on the package APR-util. We also need to download APR-util.

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

 

We still use the method mentioned at the beginning of the article to put it under the/usr/local/src directory. Unzip the package and install it as follows:

# Cd/usr/local/src

# Tar-xvf apr package file

# Cd apr folder

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

However, the following configuration problems occur:

From the configuration information, we can find that we need to install the Gcc compiler.

We can install gcc online.

# Yum install gcc

# Yum install gcc-c ++ (this must be installed. If it is not installed, the software package will be required to be installed in the following installation)

After the installation is complete, you can reinstall APR-util and APR. you can install APR by following the previous method.

When we install the httpd package file, we find that the following occurs during 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 can see that we still need to install the PCRE package file. In fact, the installation here is very crashing. I thought how to install so many things, here we will talk about the dependency of the software package in Linux. If the Apache server is installed as an example, the httpd package file --> PCRE --> ARP --> APR-util --> GCC

If we select source code for installation, We must install it step by step.

 

We can find the PCRE in the configuration information on the Internet (mainly used for string mode segmentation, matching, search and replacement operations)

: 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

After the installation is successful, we can install the httpd installation package again. Next, you 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

Now that the installation is successful, we can enable the Apache service, but before enabling it, we need to modify the following:

# Cd/usr/local/apache/conf

# Vi httpd. conf

Find # ServerName www.example.com: 80

Add ServerName 192.168.9.122: 80

Save and exit.

 

Finally, let's start:

:

 

Next, we can view it in the browser:

 

It Works appears! It indicates that your Apache server is successfully installed.

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.