CentOS5.4源码包安装LAMP环境
一、安装gcc环境
#yum install gcc gcc-c++ glibc glibc-devel gd gd-devel zlib zlib-devel libtool-ltdl-devel flex autoconf automake
二、
安装mysql数据库
#tar zxvf ncurses-5.6.tar.gz
#cd ncurses-5.6
#./configure
#make&&make install
#cd ..
#tar zxvf mysql-5.1.38.tar.gz
#cd myssql-5.1.38
# useradd -g mysql -s /bin/false -M mysql
#useradd –g mysql mysql
#./configure --prefix=/usr/local/mysql --localstatedir=/var/lib/mysql --with-mysqld-user=mysql --enable-static --with-charset=gbk --with-extra-charset=all --with-low-memory --sysconfdir=/etc --enable-thread-safe-client --enable-local-infile
#make&&make install
#cd /usr/local/mysql/bin/
#chown mysql -R /usr/local/mysql/
#chown root:mysql -R /usr/local/mysql/
#chgrp -R mysql /usr/local/mysql/
#./mysql_install_db --user=mysql
#./mysqld_safe --user=mysql &
#cd /usr/local/mysql/
#cp share/mysql/my-medium.cnf /etc/my.cnf
#cp share/mysql/mysql.server /etc/rc.d/init.d/mysqld
#chmod 755 /etc/rc.d/init.d/mysqld
#chkconfig --add mysqld
#/etc/rc.d/init.d/mysqld start
#/etc/rc.d/init.d/mysqld restart
#bin/mysqladmin -u root password webcc
#bin/mysql -u root –p
# bin/mysql -u root –p
配置库文件搜索路径
# echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
#ldconfig
# ldconfig –v
添加/usr/local/mysql/bin到环境变量PATH中
# export PATH=$PATH:/usr/local/mysql/bin
三、 安装Apache
cd /usr/src/
#tar xvjf httpd-2.2.10.tar.bz
#cd httpd-2.2.10
#./configure --prefix=/usr/local/apache2 --with-mysql=/usr/local/mysql --enable-so --enable-rewrite --enable-track-vars --with-zlib --enable-mods-shared=all --enable-suexec --with-suexec-caller=daemon --with-suexec-docroot=/var/www/
#make&&make install
# vi /usr/local/apache2/conf/httpd.conf
1、添加如下二行
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
2、定位至DirectoryIndex index.html
修改为:
DirectoryIndex index.php index.html
3、按照使用习惯,这里将网站根目录指定到/var/www:
找到DocumentRoot “/usr/local/apache/htdocs”
修改为:DocumentRoot “/var/www”(后文中我们还会注释掉此行,以启用虚拟主机)
找到<Directory “/usr/local/apache/htdocs”>
修改为:<Directory “/var/www”>
找到<#ServerName www.example.com:80>
修改为:<ServerName 192.168.1.11:80> 注意把#去掉
四、安装GD库
#tar xvjf freetype-2.3.8.tar.gz
#cd freetype-2.3.8
#./configure --prefix=/usr/local/freetype
#make
#make install
#cd ..
#tar zxvf jpegsrc.v6b.tar.gz
#cd jpeg-6b/
#mkdir /usr/local/jpeg6
#mkdir /usr/local/jpeg6/bin
#mkdir /usr/local/jpeg6/lib
#mkdir /usr/local/jpeg6/include
#mkdir /usr/local/jpeg6/man
#mkdir /usr/local/jpeg6/man1
#mkdir /usr/local/jpeg6/man/man1
#./configure --prefix=/usr/local/jpeg6/
#make
#make install
#cd ..
#tar zxvf libpng-1.2.10.tar.bz2
#cd libpng-1.2.10
#make
#./configure --prefix=/usr/local/libpng
#make
#make install
#cd ..
#tar xvjf libtool-1.5.24.tar.gz
#cd libtool-1.5.24
#./configure
#make
#make install
#cd ..
# tar xvjf zlib-1.2.3.tar.bz2
#cd zlib-1.2.3
#./configure --prefix=/usr/local/zlib
#make
#make install
#cd ..
#tar zxvf gd-2.0.33.tar.gz
#cd gd-2.0.33
#./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg6/ --with-png=/usr/local/libpng --with-zlib=/usr/local/zlib/ --with-freetype=/usr/local/freetype/
#make
#make install
#cd ..
五、 安装php
#cd /usr/src
#tar zxvf libxml2-2.6.28.tar.gz
#cd libxml2-2.6.28
#./configure
#make&&make install
#cd ..
#tar zxvf libmcrypt-2.5.8.tar.gz
#cd libmcrypt-2.5.8
#./configure --prefix=/usr/local/libmcrypt
#make&&make install
#cd ..
#tar zxvf php-5.2.10.tar.gz
#cd /usr/local/src/php-5.2.10
#./configure --prefix=/usr/local/php5 --with-mysql=/usr/local/mysql/ --with-apxs2=/usr/local/apache2/bin/apxs --with-mysqli=/usr/local/mysql/bin/mysql_config --with-gd=/usr/local/gd/ --with-freetype-dir=/usr/local/freetype/ --with-jpeg-dir=/usr/local/jpeg6/ --with-png-dir=/usr/local/libpng/ --with-zlib-dir=/usr/local/zlib/ --with-mcrypt=/usr/local/libmcrypt/ --enable-mbstring=all
#make
#make install
# cp php.ini-dist /usr/local/php5/php.ini
#vi /usr/local/apache2/conf/httpd.conf
添加:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
DirectoryIndex index.php index.html
# vi /usr/local/php5/php.ini
查找extension_dir- = "./"
修改为extension_dir- = "./include/php/ext"
#cd /usr/local/src/
#tar zxvf ZendOptimizer-3.3.0a-linux-glibc21-i386.tar.gz
#cd ZendOptimizer-3.3.0a-linux-glibc21-i386
#./install
#vi /var/www/index.php
<?php
phpinfo();
?>
输入ip测试