Lamp installation (i) source code installation for Apache

Source: Internet
Author: User

What is lamp

LAMP is the acronym for a set of free software names that are typically used together to run dynamic Web sites or servers:

    • LInux, operating system
    • Apache, Web server
    • mariadb or mysql, Database management system (or database server)
    • P HP,Perl or python, scripting language

Lamp framework We need the source package as follows:

APACHE=HTTP://HTTPD.APACHE.ORG/HTTPD Main Package

Mysql=http://dev.mysql.com/downloads/mysql/mysql Main Package

php=http://php.net/downloads.php PHP Main Package

APR=HTTP://APR.APACHE.ORG/APR is HTTPd's dependency package

Apr-util=http://apr.apache.org/apr-util is the second dependent package of httpd

Apr and Apr-util This two software is optimized for back-end service software,

Apr-util only provides more data structures and operating system encapsulation interfaces on an APR basis.

Pcre is the third dependency package for httpd http://pcre.org/

Compile and install lamp required and the version of the source code used:

httpd version:httpd-2.4.16

Apr version:apr-1.5.2

Pcre version:pcre-8.37

Apr-util version:apr-util-1.5.4

MySQL version:mysql-5.6.26

PHP version:php-5.6.13

It is recommended to install the development Pack group before compiling:

"Development Tools" and "Development Libraries"

Yum Groupinstall "Development Tools" "Development Libraries"-y

Yum Install gcc gcc-c++ openssl-devel-y

Apr and Apr-util independently compiled

./configure--prefix=/usr/local/apr && make-j 2 && make install

./configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr && make-j 2 && make install

./configure--prefix=/usr/local/pcre && make-j 2 && make install && CD

Apache Source code compilation

Dependent environment installation complete, start compiling and installing Apache

Tar xvf httpd-2.4.16.tar.bz2-c/usr/local/src/&& cd/usr/local/src/httpd-2.4.16

./configure--prefix=/usr/local/apache2.4--enable-so--enable-rewrite--enable-ssl--with-pcre=/usr/local/pcre-- WITH-APR=/USR/LOCAL/APR--with-apr-util=/usr/local/apr-util--enable-modules=most--enable-mpms-shared=all-- With-mpm=event && make-j 2 && make install &&

--prefix=/usr/local/apache2.4 #安装路径

--enable-so #支持动态加载模块

--enable-rewrite #支持网站地址重写

--Enable-ssl #支持SSL加密

--with-pcre=/usr/local/pcre #pcre路径

--with-apr=/usr/local/Apr #apr路径

--with-apr-util=/usr/local/apr-util #apr-util Path

Encountered the following error:
1. Checking for OpenSSL ... checking for user-provided OpenSSL base directory ... none
Checking for OpenSSL version >= 0.9.8a ... FAILED
Configure:WARNING:OpenSSL version is too old
No
Checking whether to enable Mod_ssl ... Configure:error:mod_ssl have been requested but can

Not being built due to prerequisite failures

The SSL version should be too old, the workaround:

Yum Install Openssl-devel
Yum Update OpenSSL

Configuration Apache the startup script

cp/usr/local/apache2.4/bin/apachectl/etc/init.d/apache2.4

/ETC/INIT.D/HTTPD stop

Chkconfig httpd off

Edit the startup script file

vim/etc/init.d/apache2.4

#!/bin/sh

# chkconfig:2345 6436

#这个是启动级别的服务, 2345 refers to those level start, 64 is the open order, should be behind the network service, 36 is the closing order, should be in front of the network, here is not a comment

#默认network的是: 2345 10 90

# description:apache2.4.16 Startscript #描述字段, with these two fields, you can use the Chkconfig command to control

Service apache2.4 Start

Chkconfig apache2.4 on #设置开机自启动

Apache where to look when installation is complete

Ps-aux | Grepapache//source compiled Apache, run user for Deamon

Warning: bad Syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQs

Root 43191 0. 0 0.  0 70632 2184? Ss:0:xx/usr/local/apache2.4/bin/httpd-k Start

daemon 43192 0. 0 0.  1663500 4820? Sl:0:xx/usr/local/apache2.4/bin/ httpd-k Start

daemon 43193 0. 0 0.  1414892 4184? Sl:0:xx/usr/local/apache2.4/bin/httpd-k Start

daemon 43194 0. 0 0.  1414892 4188? Sl:0:xx/usr/local/apache2.4/bin/ httpd-k Start

Root 43344 0. 0 0. 0103244 864 pts/0 s+:0:grep Apache

Useradd-m-s/sbin/nologinapache//Create a user to run Apache

vim/usr/local/apache2.4/conf/httpd.conf//Modify configuration file to change Apache run identity

UserApache #修改运行用户daemon为apache

GroupApache #修改运行组为apache

Idapache

UID=(Apache) gid=(Apache) Groups=500 (Apache)

Change directory Permissions

chown-r apache:apache/usr/local/apache2.4/ //default is root, change to Apache

At this point the Apache partial installation is complete

Lamp installation (i) source code installation for 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.