One, install the compilation tool and the dependency package
[Email protected] src]# yum-y install GC gcc-c++ pcre-devel ncurses-devel openssl-devel libpng-devel libtool Libxslt-dev El Libxml2-devel Libxpm-devel Curl-devel
Second, the installation of PHP and MySQL required software
1, installation CMake
[Email protected] cmake-2.8.10.2]#./bootstrap
[[email protected] cmake-2.8.10.2]# make && make
2, Installation FreeType
[Email protected] freetype-2.4.0]#/configure--prefix=/usr/local/freetype
[[email protected] freetype-2.4.0]# make
3, Installation Libmcrypt
[Email protected] libmcrypt-2.5.8]#/configure--prefix=/usr/local/libmcrypt
[[email protected] libmcrypt-2.5.8]# make
4, Installation Libiconv
[Email protected] libiconv-1.14]#/configure--prefix=/usr/local/libiconv
[[email protected] libiconv-1.14]# make install
5, Installation jpeg-6b
[Email protected] src]# CD jpeg-6b/
[Email protected] jpeg-6b]# Mkdir/usr/local/jpeg6
[Email protected] jpeg-6b]# Mkdir/usr/local/jpeg6/bin
[Email protected] jpeg-6b]# Mkdir/usr/local/jpeg6/lib
[Email protected] jpeg-6b]# Mkdir/usr/local/jpeg6/include
[Email protected] jpeg-6b]# mkdir/usr/local/jpeg6/man/man1-p
[Email protected] jpeg-6b]# cp/usr/share/libtool/config/config.sub.
Cp:overwrite './config.sub '? Y
[Email protected] jpeg-6b]# cp/usr/share/libtool/config/config.guess.
Cp:overwrite './config.guess '? Y
[Email protected] jpeg-6b]#/configure--prefix=/usr/local/jpeg6--enable-shared--enable-static
[[email protected] jpeg-6b]# make
6, Installation GD2
[Email protected] libgd-2.1.1]#/configure--prefix=/usr/local/libgd2--with-zlib--with-jpeg=/usr/local/jpeg6-- With-png--with-freetype=/usr/local/freetype
Third, install MySQL
1. Create a MySQL user
[[email protected] mysql-5.6.27]# Groupadd MySQL
[[email protected] mysql-5.6.27]# useradd-r-g MySQL MySQL
2. Compile and install MySQL
[[email protected] mysql-5.6.27]# cmake. \
>-dcmake_install_prefix=/usr/local/mysql \
>-dmysql _datadir=/var/lib/mysql \
>-dsysconfdir=/etc \
>-dwith_innobase_storage_engine=1 \
>-dwith_ myisam_storage_engine=1 \
>-dwith_memory_storage_engine=1 \
>-dwith_readline=1 \
>-dmysql_unix_ Addr=/var/lib/mysql/mysql.sock \
>-dmysql_tcp_port=3306 \
>-denabled_local_infile=1 \
>-DWITH_ partition_storage_engine=1 \
>-dextra_charsets=all \
>-ddefault_charset=utf8 \
>-ddefault_ Collation=utf8_general_ci
--Configuring done
--generating done
CMake Warning:
Manually-specified variables were not used by the project:
with_memory_storage_engine
with_readline
--Build files has been written to:/usr/local/src/mysql-5.6.27
[Email protected] mysql-5.6.27]# Gmake
[[email protected] mysql-5.6.27]# gmake Install
3. Modify/usr/local/mysql file permissions
[Email protected] mysql-5.6.27]# chown-r mysql:mysql/usr/local/mysql
[Email protected] mysql-5.6.27]# ll-d/usr/local/mysql
drwxr-xr-x mysql mysql 4096 Dec 12:08/usr/local/mysql
4. Create DATABASE storage Directory
[Email protected] mysql-5.6.27]# Mkdir/var/lib/mysql
[[email protected] mysql-5.6.27]# chown MySQL. /var/lib/mysql
5. Installing the System Database
[Email protected] scripts]#/mysql_install_db--basedir=/usr/local/mysql--datadir=/var/lib/mysql--no-defaults-- User=mysql
[Email protected] scripts]# ls/var/lib/mysql/
Ibdata1 ib_logfile0 ib_logfile1 mysql performance_schema test
6. Copying configuration files
[Email protected] scripts]# cd/usr/local/mysql/support-files/
[[email protected] support-files]# ls
Binary-configure Magic my-default.cnf mysqld_multi.server mysql-log-rotate mysql.server
[email protected] support-files]# CP my-default.cnf/etc/my.cnf
Cp:overwrite '/etc/my.cnf '? Y
[[email protected] support-files]# VIM/ETC/MY.CNF//Modify Configuration
Basedir =/usr/local/mysql
DataDir =/var/lib/mysql
Port = 3306
# server_id = ...
Socket =/var/lib/mysql/mysql.sock
7. Add startup script and set boot start
[email protected] support-files]# CP mysql.server/etc/rc.d/init.d/mysqld
[Email protected] support-files]# chmod +x/etc/rc.d/init.d/mysqld
[[Email protected] support-files]# service mysqld start
Starting MySQL. success!
[Email protected] support-files]# chkconfig--add mysqld
[Email protected] support-files]# chkconfig mysqld on
8. Log in to MySQL
[Email protected] support-files]#/usr/local/mysql/bin/mysql
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 1
Server version:5.6.27 Source Distribution
Copyright (c), Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
Mysql>
Iv. installation of Apache2
1. Install Apr and Apr-util
[Email protected] apr-1.5.2]#/configure--PREFIX=/USR/LOCAL/APR
[Email protected] apr-util-1.5.4]#/configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr
2. Compile and install Apache2
[Email protected] httpd-2.2.31]#/configure \
--PREFIX=/USR/LOCAL/APACHE2 \
--SYSCONFDIR=/ETC/HTTPD \
--WITH-INCLUDED-APR \
--WITH-APR=/USR/LOCAL/APR \
--with-apr-util=/usr/local/apr-util \
--ENABLE-SO \
--enable-deflate=shared \
--enable-expires=shared \
--enable-rewrite=shared \
--with-pcre \
--enable-mem-cache \
--enable-cache \
--enable-static-support \
--with-z
[[email protected] httpd-2.2.31]# make
[[email protected] httpd-2.2.31]# make install
MAKE[1]: Leaving directory '/usr/local/src/httpd-2.2.31 '
[[email protected] httpd-2.2.31]# echo $?
0
[Email protected] ~]# ls/usr/local/apache2/
Bin build Cgi-bin Error htdocs icons include lib logs man manual modules
[[email protected] httpd-2.2.31]#/usr/local/apache2/bin/apachectl start
(98) Address already in use:make_sock:could not bind to address [::]:80
(98) Address already in use:make_sock:could don't bind to address 0.0.0.0:80
No listening sockets available, shutting down
Unable to open logs
[Email protected] httpd-2.2.31]# NETSTAT-TNLP | grep 80
TCP 0 0::: +:::* LISTEN 2112/httpd
[Email protected] ~]# rm-rf/usr/local/apache2
[Email protected] src]# RM-RF httpd-2.2.31
[Email protected] src]# RM-RF/ETC/HTTPD
Reboot
[Email protected] ~]# NETSTAT-TNLP | grep 80
[Email protected] httpd-2.2.31]#/configure--prefix=/usr/local/apache2--sysconfdir=/etc/httpd-- WITH-INCLUDED-APR--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util--enable-so--enable-deflate= Shared--enable-expires=shared--enable-rewrite=shared--with-pcre--enable-mem-cache--enable-cache-- Enable-static-support--with-z
[[email protected] httpd-2.2.31]#/usr/local/apache2/bin/apachectl start
[Email protected] httpd-2.2.31]# NETSTAT-TNLP | grep 80
TCP 0 0::: +:::* LISTEN 50223/httpd
[Email protected] httpd-2.2.31]#/usr/local/apache2/bin/apachectl-t
Syntax OK
3. Create a startup script
[Email protected] src]# CP/USR/LOCAL/APACHE2/BIN/APACHECTL/ETC/RC.D/INIT.D/HTTPD
V. Installation of PHP
1, compile and install PHP
[Email protected] php-5.6.14]#/configure \
>--prefix=/usr/local/php \
>--WITH-CONFIG-FILE-PATH=/USR/LOCAL/PHP/ETC \
>--WITH-APXS2=/USR/LOCAL/APACHE2/BIN/APXS \
>--with-mysql=/usr/local/mysql \
>--WITH-GD=/USR/LOCAL/LIBGD2 \
>--with-jpeg-dir=/usr/local/jpeg6 \
>--with-freetype-dir=/usr/local/freetype \
>--with-mcrypt=/usr/local/libmcrypt \
>--with-mysqli=/usr/local/mysql/bin/mysql_config \
>--with-libxml-dir \
>--with-zlib-dir \
>--with-png-dir \
>--with-iconv-dir=/usr/local/libiconv \
>--with-openssl \
>--with-curl \
>--enable-soap \
>--enable-gd-native-ttf \
>--enable-mbstring \
>--enable-sockets \
>--enable-exif \
>--disable-ipv6 \
>--enable-ftp \
>--with-mhash \
>--with-pcre-dir=/usr/bin/pcre-config \
>--enable-zip \
>--with-bz2
Error:
Configure:error:Please Reinstall the BZIP2 distribution
[email protected] php-5.6.14]# Yum install-y bzip2 bzip2-devel
Wrote PEAR system config file at:/usr/local/php/etc/pear.conf
Want to add:/usr/local/php/lib/php to your php.ini include_path
/usr/local/src/php-5.6.14/build/shtool install-c Ext/phar/phar.phar/usr/local/php/bin
Ln-s-F Phar.phar/usr/local/php/bin/phar
Installing PDO headers:/usr/local/php/include/php/ext/pdo/
[[email protected] php-5.6.14]# echo $?
0
[Email protected] php-5.6.14]# ls/usr/local/php/
Bin etc include Lib Php
2. Test PHP
[Email protected] php-5.6.14]# ls/usr/local/apache2/htdocs/index.html
/usr/local/apache2/htdocs/index.html
[email protected] php-5.6.14]# cat!$
Cat/usr/local/apache2/htdocs/index.html
[[email protected] php-5.6.14]# vim/etc/httpd/httpd.conf//Modify Configuration
<ifmodule dir_module>
DirectoryIndex index.html index.php
</IfModule>
AddType application/x-compress. Z
AddType application/x-gzip. gz. tgz
AddType application/x-httpd-php. php. phtml
Create a test page
[Email protected] php-5.6.14]# vim/usr/local/apache2/htdocs/index.php
<?php
Phpinfo ();
?>
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/77/F1/wKiom1ZxeCeDxmd4AAF37kYqq8g807.jpg "title=" Qq20151216224104.jpg "alt=" Wkiom1zxecedxmd4aaf37kyqq8g807.jpg "/>
[email protected] php-5.6.14]# CP Php.ini-production/usr/local/php/etc/php.ini
Reload the PHP configuration:
[Email protected] php-5.6.14]#/usr/local/apache2/bin/apachectl Graceful
1.5 Build Lamp Environment httpd-2.2.31+mysql-5.6.27+php-5.6.14