0. Install CentOS 6.5 minimal
1. Install MySQL
cd/usr/local/src/
Yum install–y wget # Installing wget
Yum install–y vim-enhanced # Install vim
wget http://syslab.comsenz.com/downloads/linux/mysql-5.1.40-linux-i686-icc-glibc23.tar.gz
Note: The above address is for 32-bit machines, if your machine is 64-bit, download this package (http://syslab.comsenz.com/downloads/linux/mysql-5.1.40-linux-x86_64- ICC-GLIBC23.TAR.GZ) installation method is the same.
Tar zxvf/usr/local/src/mysql-5.1.40-linux-i686-icc-glibc23.tar.gz
MV Mysql-5.1.40-linux-i686-icc-glibc23/usr/local/mysql
Useradd-s/sbin/nologin MySQL
Cd/usr/local/mysql
Mkdir-p/data/mysql
Chown-r Mysql:mysql/data/mysql
./scripts/mysql_install_db--user=mysql--datadir=/data/mysql
Two OK is a success, or you can use echo$? To see if the inverse value is 0
CP support-files/my-large.cnf/etc/my.cnf (actual production environment memory compare greatly support-files/my-huge.cnf) MySQL configuration file, hint No overwrite, select Overwrite
CP support-files/mysql.server/etc/init.d/mysqld MySQL startup files for the service
chmod 755/etc/init.d/mysqld granting permissions to mysqld files
Vim/etc/init.d/mysqld
# Modify DataDir and basedir such as right Datadir=/data/mysql Basedir=/usr/local/mysql and then save exit.
Chkconfig--add mysqld
Chkconfig mysqld on
Service mysqld Start will prompt "starting MySQL. Success! "
2. Installing Apache
Yum Install gcc installing the GCC compiler
Cd/usr/local/src
wget http://syslab.comsenz.com/downloads/linux/httpd-2.2.16.tar.gz
Tar zvxf httpd-2.2.16.tar.gz
CD httpd-2.2.16
./configure--prefix=/usr/local/apache2--enable-mods-shared=most--enable-so
Make &&make Install
3. Install PHP
Cd/usr/local/src
wget http://cn2.php.net/distributions/php-5.3.28.tar.gz
Tar zxf php-5.3.28.tar.gz
CD php-5.3.28
./configure--prefix=/usr/local/php--with-apxs2=/usr/local/apache2/bin/apxs--with-config-file-path=/usr/local/ Php/etc--with-mysql=/usr/local/mysql--with-libxml-dir--with-gd--with-jpeg-dir--with-png-dir--with-freetyp E-dir--with-iconv-dir--with-zlib-dir--with-bz2--with-openssl--with-mcrypt--enable-soap--enable-gd-nati Ve-ttf--enable-mbstring--enable-sockets--enable-exif--disable-ipv6
Error: Configure:error:xml2-config NotFound. Please check your LIBXML2 installation.
Yum install-y libxml2
Yum Install - y libxml2-devel
Error: Configure:error:Cannot Findopenssl ' s <evp.h>
Yum Install OpenSSL Openssl-devel
Error: Configure:error:Please reinstallthe BZip2 Distribution
Yum Install–y bzip2bzip2-devel
Error: Configure:error:jpeglib.h NotFound.
Yum Install Libjpeglibjpeg-devel
Error: Configure:error:png.h not found.
Yum Install Libpnglibpng-devel
Error: Configure:error:freetype.h NotFound.
Yum Installfreetype-devel
Error: Configure:error:mcrypt.h not found. Please reinstall Libmcrypt
RPM-IVH " http://www.lishiming.net/data/attachment/forum/month_1211/epel-release-6-7.noarch.rpm " # installation Epel Source
Yum Install-ylibmcrypt-devel
Make && make install
4. Configure Apache to support parsing PHP
Vim/usr/local/apache2/conf/httpd.conf
Found: AddType application/x-gzip. gz. tgz
Under this line, add the following:
AddType application/x-httpd-php. php
Found it:
< Ifmodule dir_module>
Directoryindexindex.html
</ifmodule>
Change the line to read:
< Ifmodule dir_module>
directoryindexindex.html index.htm index.php
</ifmodule>
Found it:
#ServerNamewww. example.com:80
Modified to:
ServerName localhost:80
5. Test parsing PHP
/usr/local/apache2/bin/apachectl-t
If there is an error, continue to modify the configuration file httpd.conf, if "Syntax OK" is displayed correctly
/usr/local/apache2/bin/apachectl start
NETSTAT-LNP |grep httpd
TCP 0 0::: +:::* LISTEN 26570/httpd
vim/usr/local/apache2/htdocs/1.php
Write:
<?php
echo "php OK";
Phpinfo ();
?>
After saving, continue testing:
Curl localhost/1.php
Extended Learning:
mysql5.5 Source Code Compilation installationhttp://www.aminglinux.com/bbs/thread-1059-1-1.html
mysql5.6 Source Installation Errorhttp://www.aminglinux.com/bbs/thread-7743-1-1.html
httpd-2.4 Version Compilation installation methodhttp://www.aminglinux.com/bbs/thread-7283-1-1.html
Apache startup script joins system Services listhttp://www.aminglinux.com/bbs/thread-7344-1-1.html
Apache Expansion Module Installationhttp://www.aminglinux.com/bbs/thread-848-1-1.html
How to specify the use of Worker/preforkhttp://www.lishiming.net/thread-944-1-1.html
Apache 3 Modes of operation (default 2.2 is Prefork, 2.4 is event)http://www.cnblogs.com/fnng/archive/2012/11/20/2779977.html
Apache's dynamic and statichttp://www.cnblogs.com/eoiioe/archive/2008/12/23/1360476.html(Same as 2.0 and 2.2)http://blog.sina.com.cn/s/blog_6238358c01017gdu.html
php5.5, 5.6 Compiling installation methodshttp://www.aminglinux.com/bbs/thread-7284-1-1.html
Httpd.conf detailedhttp://www.php100.com/html/webkaifa/apache/2009/0418/1192.html
This article is from the "Years Traces" blog, please be sure to keep this source http://junnyzhang.blog.51cto.com/6023/1640898
Lamp Environment Construction