First, compile and install Httpd2.4.10
1. Solve the dependency relationship
HTTPD-2.4.10 requires a newer version of APR and Apr-util, so it needs to be upgraded beforehand. There are two ways to upgrade, one is to compile the installation through source code, and the other is to upgrade the RPM package directly. Here choose the way to compile source code, download Apr and Apr-util code source package on Apache official website.
1) Compile and install Apr
# Tar XF apr-1.5.1.tar.bz2
# CD apr-1.5.1
#./configure--PREFIX=/USR/LOCAL/APR
# Make && make install
2) Compile and install Apr-util
# Tar XF apr-util-1.5.4.tar.bz2
# CD apr-util-1.5.4
#./configure--prefix=/usr/local/apr-util--WITH-APR=/USR/LOCAL/APR
# Make && make install
3) The httpd-2.4.10 compilation process also relies on the Pcre-devel software package, which needs to be installed beforehand. This package system CD comes with it, so find it and install it with Yum, and load the server Platform development pack with "development tools"
2. Compile and install Httpd2.4.10
First download httpd-2.4.4 to local, then execute the following command to compile the installation process:
# Tar XF httpd-2.4.10.tar.bz2
# CD httpd-2.4.10
#./configure--prefix=/usr/local/apache--sysconfdir=/etc/httpd--enable-so--enable-ssl--enable-cgi-- Enable-rewrite--with-zlib--with-pcre--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util-- Enable-modules=most--enable-mpms-shared=all--with-mpm=event
# Make && make install
Parameter description:
--prefix=/usr/local/apache Installation Path
--SYSCONFDIR=/ETC/HTTPD configuration file path
--ENABLE-SO allow the DSO module to load at runtime
--enable-ssl if not loaded will not work with HTTPS
--enable-cgi allow CGI scripts to be used
--enable-rewrite support URL rewriting mechanism
--with-zlib Support Network Universal Compression Library
--with-pcre Support Pcre
--WITH-APR=/USR/LOCAL/APR the installation path for the specified APR
--with-apr-util=/usr/local/apr-util/specifying the installation path for Apr-util
--enable-modules=most to enable most common modules
--enable-mpms-shared=all enable MPM for all supported modes
--with-mpm=event using ENEVT mode by default
Add:
(1) Constructing MPM as static module
In all platforms, MPM can be built as a static module. Select a mpm at build time, linked to the server. If you want to change MPM, you must rebuild it. In order to use the specified MPM, use the parameter--with-mpm=name when executing the Configure script. Name is the specified MPM name. After the compilation is complete, you can use./httpd-l to determine the selected MPM. This command lists all modules that are compiled into the server program, including MPM.
(2) Build MPM as dynamic module
In UNIX or similar platforms, MPM can be built as a dynamic module and loaded at run time as with other dynamic modules. Building MPM as a dynamic module allows you to change the MPM by modifying the contents of the LoadModule directive without rebuilding the server program. Use the--enable-mpms-shared option to enable this feature when you execute a configure script. All MPM modules supported by this platform will be installed when the given parameter is all. You can also give a list of modules in the parameters. The default MPM, which can be automatically selected or specified by the--WITH-MPM option when the Configure script is executed, then appears in the generated server configuration file. Edit the loadmodule instruction content to select a different mpm.
1) Export the header file and implement it in the form of a directory link
ln-sv/usr/local/apache/include//usr/include/httpd
2) Output Binary program
# vim/etc/profile.d/httpd.sh
Export Path=/usr/local/apache/bin: $PATH
# . /etc/profile.d/httpd.sh
# HTTPD-V Display httpd version information
3) Export Man file
# Vim/etc/man.config
Manpath/usr/local/apache/man
3. Modify the main configuration file of httpd and set the path of its PID file.
To edit the/etc/httpd/httpd.conf, add the following line:
Pidfile "/var/run/httpd.pid"
4, provide SYSV service script/etc/rc.d/init.d/httpd, the content is as follows:
#!/bin/bash
#
# httpd Startup script for the Apache HTTP Server
#
# Chkconfig:-85 15
# Description:apache is a world Wide Web server. It's used to serve \
# HTML files and CGI.
# PROCESSNAME:HTTPD
# config:/etc/httpd/conf/httpd.conf
# config:/etc/sysconfig/httpd
# Pidfile:/var/run/httpd.pid
# Source function library.
. /etc/rc.d/init.d/functions
if [-F/ETC/SYSCONFIG/HTTPD]; Then
. /etc/sysconfig/httpd
Fi
# Start httpd in the C locale by default.
httpd_lang=${httpd_lang-"C"}
# This would prevent Initlog from swallowing up a pass-phrase prompt if
# Mod_ssl needs a pass-phrase from the user.
Initlog_args= ""
# Set Httpd=/usr/sbin/httpd.worker in/etc/sysconfig/httpd to use a server
# with the thread-based "worker" MPM; Be warned this some modules may not
# work correctly with a thread-based MPM; Notably PHP would refuse to start.
# Path to the Apachectl script, server binary, and short-form for messages.
Apachectl=/usr/local/apache/bin/apachectl
HTTPD=${HTTPD-/USR/LOCAL/APACHE/BIN/HTTPD}
Prog=httpd
Pidfile=${pidfile-/var/run/httpd.pid}
LOCKFILE=${LOCKFILE-/VAR/LOCK/SUBSYS/HTTPD}
Retval=0
Start () {
Echo-n $ "Starting $prog:"
lang= $HTTPD _lang Daemon--pidfile=${pidfile} $httpd $OPTIONS
Retval=$?
Echo
[$RETVAL = 0] && Touch ${lockfile}
Return $RETVAL
}
Stop () {
Echo-n $ "Stopping $prog:"
Killproc-p ${pidfile}-D $httpd
Retval=$?
Echo
[$RETVAL = 0] && rm-f ${lockfile} ${pidfile}
}
Reload () {
Echo-n $ "Reloading $prog:"
if! lang= $HTTPD _lang $httpd $OPTIONS-T >&/dev/null; Then
Retval=$?
echo $ "not reloading due to configuration syntax error"
Failure $ "not reloading $HTTPD due to configuration syntax error"
Else
Killproc-p ${pidfile} $httpd-hup
Retval=$?
Fi
Echo
}
# See how we were called.
Case "$" in
Start
Start
;;
Stop
Stop
;;
Status
Status-p ${pidfile} $httpd
Retval=$?
;;
Restart
Stop
Start
;;
Condrestart)
If [-f ${pidfile}]; Then
Stop
Start
Fi
;;
Reload
Reload
;;
Graceful|help|configtest|fullstatus)
$apachectl [email protected]
Retval=$?
;;
*)
echo$ "Usage: $prog
{Start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest} "
Exit 1
Esac
Exit $RETVAL
Then give execute permission for this script:
# chmod +X/ETC/RC.D/INIT.D/HTTPD
Join the Service list:
# chkconfig--add httpd
Next, you can start the service and test it.
Service httpd Start
SS-TUNL | grep 80
TCP LISTEN 0::: +:::*
Then access the server IP address, the page shows It works! proven normal
Tip: If you cannot stop httpd because the Pidfile file path is not written correctly.
Second, installation mysql-5.6.21
1. Prepare the file system for data storage (because the database will continue to increase, so choose to place on a logical volume)
Create a new logical volume and mount it to a specific directory. The process is no longer given here.
This assumes that the mounted directory of its logical volume is/mydata, and then needs to create the/mydata/data directory as the storage directory for MySQL data.
2. The new user runs the process in a secure manner:
# groupadd-r MySQL
# useradd-g mysql-r-s/sbin/nologin-m-d/mydata/data MySQL
# Chown-r Mysql:mysql/mydata/data
3. Install and initialize the mysql-5.6.21
# Tar XF mysql-5.6.21-linux-glibc2.5-i686-c/usr/local
# cd/usr/local/
# LN-SV mysql-5.5.28-linux2.6-i686 MySQL
# CD MySQL
# Chown-r Mysql:mysql.
# scripts/mysql_install_db--user=mysql--datadir=/mydata/data
# Chown-r Root.
4. Provide the main configuration file for MySQL:
# Cd/usr/local/mysql
# CP SUPPORT-FILES/MY-LARGE.CNF/ETC/MY.CNF
and modify the value of thread_concurrency in this file to multiply your number of CPUs by 2, for example using the following line:
Thread_concurrency = 2
Also add the following line to specify where the MySQL data file will be stored:
DataDir =/mydata/data
5. Provide SYSV service script for MySQL:
# Cd/usr/local/mysql
# CP Support-files/mysql.server/etc/rc.d/init.d/mysqld
# chmod +x/etc/rc.d/init.d/mysqld
Add to Service list:
# chkconfig--add mysqld
# Chkconfig Mysqld on
You can then start the service test using.
6, output the MySQL man manual to the man command to find the path:
To edit the/etc/man.config, add the following line:
Manpath/usr/local/mysql/man
7, output MySQL header file to the System header file path/usr/include:
This can be achieved by simply creating a link:
# Ln-sv/usr/local/mysql/include/usr/include/mysql
8. Output MySQL library file to the system library to find the path:
# echo '/usr/local/mysql/lib ' >/etc/ld.so.conf.d/mysql.conf
The system is then re-loaded into the system library:
# Ldconfig
9, modify the PATH environment variable, so that the system can directly use the relevant commands MySQL
vim/etc/profile.d/mysqld.sh
Export Path=/usr/local/mysql/bin: $PATH
. /etc/profile.d/mysqld.sh
Third, compile and install php-5.4.13
1, to resolve the dependency relationship:
After configuring the Yum source (which can be the local system CD), execute the following command:
# yum-y Groupinstall "Desktop Platform Development"
If you want to let the compiled PHP support mcrypt extension, download it in http://rpm.pbone.net
and installation of:
libmcrypt-2.5.7-5.el5.i386.rpm
libmcrypt-devel-2.5.7-5.el5.i386.rpm
2. Compile and install php-5.6.1
Download source package to local directory first
# Tar XF php-5.6.1.tar.xz
# CD php-5.6.1
#./configure--prefix=/usr/local/php--with-mysql=/usr/local/mysql--with-openssl--with-
Mysqli=/usr/local/mysql/bin/mysql_config--enable-mbstring--with-freetype-dir--with-jpeg-dir
--with-png-dir--with-zlib--with-libxml-dir=/usr--enable-xml--enable-sockets--with-
Apxs2=/usr/local/apache/bin/apxs--with-mcrypt--with-config-file-path=/etc--with-config-
FILE-SCAN-DIR=/ETC/PHP.D--with-bz2--enable-maintainer-zts
Description
1. In order to support the two mpm of the Apache worker or event, the--ENABLE-MAINTAINER-ZTS option is used at compile time.
2, if the use of PHP5.3 above, in order to link the MySQL database, you can specify MYSQLND, so that you do not need to install MySQL on the computer first
Or a MySQL development package. MYSQLND is available from PHP 5.3 and can be bound to it at compile time (instead of binding to a specific MySQL client library
dependencies), but starting with PHP 5.4, it's the default setting.
#./configure--with-mysql=mysqlnd--with-pdo-mysql=mysqlnd--with-mysqli=mysqlnd
APXS2=/USR/LOCAL/APACHE/BIN/APXS is a module that compiles PHP into httpd to run
If the RPM package is missing during the compilation process, you can download it at rpm.pbone.net
# make
# Make Test
# Make Intall
#切换到PHP源码包拷贝
To provide a configuration file for PHP:
# CP Php.ini-production/etc/php.ini
3, edit Apache configuration file httpd.conf, with Apache support PHP
# vim/etc/httpd/httpd.conf
1, add the following two lines
AddType application/x-httpd-php. php
AddType Application/x-httpd-php-source. Phps
2. Locate to DirectoryIndex index.html
Modified to:
DirectoryIndex index.php index.html
Then restart httpd, or reload the configuration file to test, modify the index.php under/usr/local/apache/htdocs/to
<?php
Phpinfo ();
?>
Iv. Install the XCache for PHP acceleration :
1, installation XCache
Download XCache, Address: http://xcache.lighttpd.net/
# Tar XF xcache-3.2.0.tar.gz
# CD xcache-3.2.0
#/usr/local/php/bin/phpize
#./configure--enable-xcache--with-php-config=/usr/local/php/bin/php-config
# Make && make install
At the end of the installation, a line similar to the following appears:
Installing Shared extensions:/usr/local/php/lib/php/extensions/no-debug-zts-20131226/
2, edit php.ini, integrate PHP and XCache:
The sample configuration provided by XCache is first imported into the php.ini
# MKDIR/ETC/PHP.D
# CP XCACHE.INI/ETC/PHP.D
Description: The Xcache.ini file is in the XCache source directory.
Next edit/etc/php.d/xcache.ini, locate the line that begins with zend_extension, and modify it to the following line:
Zend_extension =/usr/local/php/lib/php/extensions/no-debug-zts-20131226/xcache.so
Note: If you have more than one zend_extension line in the php.ini file, make sure that this new row is ranked first.
This article is from the "Icesnowfq blog" blog, make sure to keep this source http://icesnowfq.blog.51cto.com/2785832/1565216
httpd2.4.10+mysql5.6.21+php5.61 Compile and install (PHP set becomes httpd module)