Source code compile and install Apache

Source: Internet
Author: User


Compile and install Apache

System Environment: CentOS 7.2

Premise:

Provide development tools and development environment

    • Development tools: Make, GCC, etc.

    • Development environment: Development Library, header file

    • GLIBC: Standard Library

Way:

To provide development components through "package groups"

CentOS 6[[email protected] ~]# yum groupinstall "Development Tools" [[email protected] ~]# Yum Groupinstall "Development to OLS "CentOS 7 [[email protected] ~]# Yum groupinstall" Development Tools "

1, first in the method website http://www.apache.org/Download Source Package

Download path: http://apache.fayea.com/httpd/httpd-2.2.31.tar.gz

2, we will download the good files in the/root directory

3, we can see the format of the source package is. tar.gz All here we're going to unzip and unpack the source package

[Email protected] ~]# tar xvzf httpd-2.2.31.tar.gz

4, after performing the above operation, in the current directory is (/root) directory, we can see the httpd-2.2.31 directory, enter the directory

[Email protected] ~]# CD httpd-2.2.31/

5, in this directory, there are many files, we first focus on the README file and the INSTALL file

The README file is basically a simple introduction [[email protected] httpd-2.2.31]# less readmewhat is it? The latest version documentation installation Licensingcryptographic software noticecontactsacknowledgments through the instructions above can be So we have a simple understanding of Apache the install file mainly describes the method of installation [[email protected] httpd-2.2.31]# less install$./configure--prefix=prefix$ make$ make install$ prefix/bin/apachectl start

6, by looking at the above file, we can perform Apache compilation and installation

[[Email protected] httpd-2.2.31]# ./configure --helpinstallation directories: Specify the default installation location   --prefix=PREFIX         install  architecture-independent files in prefix                           [/usr/ Local/apache2]fine tuning of the installation directories: Default File Installation location   -- bindir=dir            user executables [ Eprefix/bin]  --sbindir=dir           system  admin executables [EPREFIX/sbin]  --sysconfdir=DIR         read-only single-machine data [PREFIX/etc]  ......   ...... System types: Cross-compilation option   --build=build     configure for building on build [guessed]   --host=HOST       cross-compile to build  Programs to run on host [build]  --target=target   configure  for building compilers for target [host]optional features: Optional Features    --disable-option-checking  ignore unrecognized --enable/--with options  -- disable-feature       do not include feature  (same  as --enable-feature=no)   --enable-feature[=arg]  include feature [arg =yes]  --enable-v4-mapped      allow ipv6 sockets to  handle ipv4 connections  ......   Optional packages: Optional Package   --with-package[=arg]    use package [arg=yes]  --without-package        do not use PACKAGE  (Same as --with-package=no)   -- With-included-apr     use bundled copies of apr/apr-util

6 (1) Here we specify a few simple options:

[[email protected] httpd-2.2.31]#./configure--PREFIX=/USR/LOCAL/HTTP2--sysconfdir=/etc/http2//When the step is complete, it combines makefile.in file, generate Makefile file in current directory//error information, indicating configuration failure

6 (2) executing the Make and make install command (after successful execution of the previous step) Note: To always be in the current directory, do not leave the directory

[[email protected] httpd-2.2.31]# Make[[email protected] httpd-2.2.31]# make install

7. Start

[[email protected] httpd-2.2.31]# cd /usr/local/http2/bin[[email protected] bin ]# ./apachectl start[[email protected] bin]# netstat -tapn | grep   "TCP6       0      0 :::80"                     :::*                      listen      14611/http 

8. Testing

Test under CentOS 6.8 system

[Email protected] ~]# links 10.1.249.146//10.1.249.146 The IP of the CentOS 7 system for the above compilation and installation of Apache software

650) this.width=650; "src=" Http://i.imgur.com/ZOq3YW3.png "style=" margin:0px;padding:0px;border:0px; "alt=" Zoq3yw3.png "/>

Testing under Windows systems

Any browser under input: http://10.1.249.146/

650) this.width=650; "src=" Http://i.imgur.com/YOlk46U.png "style=" margin:0px;padding:0px;border:0px; "alt=" Yolk46u.png "/>

Note: If the boot succeeds but is not always accessible, it is possible that the CentOS 7 firewall is not turned off, so it is recommended that you do a test after shutting down the firewall

[Email protected] ~]# iptables-f

9, the final configuration

We know that a program consists mainly of 4 types of files

    • Binary file

    • Profile

    • Library file

    • Help document

The above 4 types of files should be placed in a system-specific directory or by modifying system-related configuration files

(1) Binary Files Bin directory add their path to the PATH environment variable to

[Email protected] http2]# vim/etc/profile.d/http.sh export path=/usr/local/http2/bin: $PATH [[email protected] http2]# Echo $PATH/usr/local/http2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

(2) configuration file We have specified through the--SYSCONFDIR=/ETC/HTTP2 option when compiling the installation

(3) library file lib directory

[Email protected] http2]# Vim/etc/ld.so.conf.d/http2.conf/usr/local/http2/lib

To have the system regenerate the library file path cache

[[email protected] apache2]# ldconfig-v cache file:/etc/ld.so.cache

(4) Help document Man

[[email protected] lib]# vim/etc/man_db.conf (CentOS 7) Add a line of content: Mandatory_manpath/usr/local/http2/man

(5) How to use soft links for include header files (/usr/include is the system header file location)

[Email protected] include]# ln-s/usr/local/http2/include//usr/include/http[[email protected] include]# ll-d/usr/inc Lude/httplrwxrwxrwx. 1 root 20:46/usr/include/http/usr/local/http2/include/[[email protected] include]# ll/usr/include/ http/
The installation configuration is complete


This article is from the "Homecoming" blog, make sure to keep this source http://sixijie123.blog.51cto.com/11880770/1841679

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.