Install apache2.4 in linux

Source: Internet
Author: User
The vast majority of linux operating systems on the market are used as servers. that is to say, linux is not suitable for use as a personal computer operating system. We will share with you the installation of apache on linux. this installation is based on ubu.

The vast majority of linux operating systems on the market are used as servers. that is to say, linux is not suitable for use as a personal computer operating system. We will share with you the installation of apache on linux. the installation of apache is based on the ubuntu operating system.

1. preparations before installation

1. install the c compiler

C compilation programs installed on different linux distributions are slightly different. the redhat is gcc but the ubuntu is g ++. use ubuntu as an example to install g ++ and use sudo apt-get install g ++ to install it.

2. install apr and aprutil

(1) first download the source package of apr and aprutil, is http://apr.apache.org/download.cgi

(2) decompress tar.gz after Download

(3) enter the extract directory and configure apr

The prefix is followed by the apr installation directory. you are advised to install the prefix in your own directory. the configuration page is as follows:

(4) compile apr

(5) install apr

(6) decompress aprutil

(7) enter the aprutil directory to configure aprutil

Note the directory after with-apr. this directory is the directory where you just installed apr.

(8) compile and install aprutil

The installation command is still "make install". it cannot be used here.

3. download and install pcre

Pcre is: http://sourceforge.net/projects/pcre/files/pcre/

Next, configure pcre.

After the configuration is complete, it is still compiled and installed. the command for compiling pcre is as follows:

Next, install

2. start installing apache for linux

The most important thing to install apache is to ensure that the installation of apr, aprutil, and pcre is successful, so that the installation of apache will be smooth.

1. download and decompress apache

2. configure apache

This step is also the key to whether apache can be successfully installed. you need to configure apr, aprutil, and pcre here. the command is as follows:

. /Configure -- prefix =/home/chenruiyin/apache -- enable-so -- enable-rewrite = shared -- with-mpm = prefork -- with-apr =/home/chenruiyin/apr -- -apr-util =/home/chenruiyin/aprutil -- with-pcre =/home/chenruiyin/pcre

3. compile apache source code

Apache compilation is a little slow. please wait.

4. install apache

5. modify httpd. conf of apache

Some apache cannot be started after installation. in this case, you only need to add ServerName 127.0.0.1: 8081 at the beginning of the httpd. conf file. The port is defined by yourself.

6. start apache

First enter the apache installation directory, and then enter./bin/httpd-k start. if it is stopped, use./bin/httpd-k stop.

7. to ensure that apache is successfully started, run the following command:

The command used is: netstat-apn | grep 8081. this command mainly depends on whether 8081 has a program listening.

8. enter the address in the browser to check whether apache can be used.

This indicates that apache has been correctly started and can be used. Finally, we will introduce the command ps aux | grep httpd. httpd is the apache service. This command is used to view the process number running apache.

For example, 3127,3128 is the apache process number. if you want to kill a process, you can use kill-9 3127 (here is the process number)

The installation of apache is not a little different from that of mysql and php. next time, I will share how to install apache on linux.

Related Article

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.