一、获取安装软件,存放到/usr/src/目录下
软件名称 |
下载地址 |
httpd-2.2.9.tar.gz |
http://www.apache.org/ |
mysql-5.0.41.tar.gz |
http://dev.mysql.com/downloads/ |
php-5.2.6.tar.gz |
http://www.php.net/downloads.php |
phpMyAdmin-3.0.0-rc1-all-languages.tar.gz |
http://www.phpmyadmin.com/ |
libxml2-2.6.30.tar.gz |
ftp://ftp.gnome.org/pub/GNOME/sources/libxml2/2.6/libxml2-2.6.30.tar.gz |
libmcrypt-2.5.8.tar.gz |
http://prdownloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz?use_mirror=peterhost |
zlib-1.2.3.tar.gz |
http://www.zlib.net/zlib-1.2.3.tar.gz |
gd-2.0.35.tar.gz |
http://www.libgd.org/releases/gd-2.0.35.tar.gz |
Autoconf-2.61.tar.gz |
ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.61.tar.gz |
freetype-2.3.5.tar.gz |
http://download.savannah.gnu.org/releases/freetype/freetype-2.3.5.tar.gz |
libpng-1.2.31.tar.gz |
ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.2.31.tar.gz |
jpegsrc.v6b.tar.gz |
http://www.ijg.org/files/jpegsrc.v6b.tar.gz |
ZendOptimizer330a.tar.gz |
http://wt1.mycodes.net/soft/20071108/ZendOptimizer330a.tar.gz |
二、检查安装时使用的编译工具
#gcc -v
安装:yum -y
install
gcc
yum -y
install
gcc-c++
yum
install
make
yum groupinstall
"Development Tools"
-- 或者
yum
install
gcc gcc-c++ kernel-devel
三、卸载默认安装环境
#rpm -qa|grep php #检查是否安装过php
#rpm -qa|grep mysql
#rpm -qa|grep httpd
#rpm -e httpd 2.2... --nodeps #强制卸载apache
#cd /etc/httpd #删除原有安装文件
#rm -r -f *
四、依次安装软件
解压tar.gz文件:#tar zxvf xx.tar.gz
(1)安装libxml2
#./configure --prefix=/usr/local/libxml2
#make && make install
(2)安装libmcrypt
#./configure --prefix=/usr/local/libmcrypt
#make && make install
(3)安装zlib
#./configure --prefix=/usr/local/zlib
#make && make install
(4)安装libpng
# ./configure --prefix=/usr/local/libpng
#make && make install
(5)安装jpeg6
#mkdir /usr/local/jpeg6 #建立jpeg6软件安装目录
#mkdir /usr/local/jpeg6/bin #建立存放命令的目录
#mkdir /usr/local/jpeg6/lib #创建jpeg6库文件所在目录
#mkdir /usr/local/jpeg6/include #建立存放头文件目录
#mkdir -p /usr/local/jpeg6/man/man1 #建立存放手册的目录
#./configure --prefix=/usr/local/jpeg6 --enable-shared --enable-static
# make && make install
(6)安装freetype
#./configure --prefix=/usr/local/freetype
#make && make install
(7) 安装autoconf
#./configure
#make && make install
(8) 安装GD
# ./configure --prefix=/usr/local/gd2 --with-zlib=/usr/local/zlib --with-jpeg=/usr/local/jpeg6 \
>--with-png=/usr/local/libpng/ --with-freetype=/usr/local/freetype
#make && make install
(9) 安装Apache
#./configure --prefix=/usr/local/apache2 --sysconfdir=/etc/httpd --with-z=/usr/local/zlib/ \
>--with-included-apr --enable-so --enable-deflate=shared --enable-expires=shared \
>--enable-rewrite=shared --enable-static-support
#make && make install
测试:
检查安装目录
检查配置文件目录
/usr/local/apache2/bin/apachect1 start //启动apache
/usr/local/apache2/bin/apachect1 stop //关闭apache
netstat -tnl |grep 80 //查看80端口是否开启
echo '/usr/local/apache2/bin/apachect1 start' >>/etc/rc.d/rc.local //添加开机自动启动apache服务
(10)安装MySQL
#groupadd mysql //添加一个mysql组
#useradd -g mysql mysql //添加mysql用户并加到mysql组
#./configure --prefix=/usr/local/mysql --with-extra-charsets=all
# make && make install
配置数据库
#cp support-files/my-medium.cnf /etc/my.cnf //创建MySQL配置文件
#bin/mysql_install_db --user=mysql //创建授权表
# chown -R root . //将文件的所有属性改为root用户
# chown -R mysql var //将数据目录的所有属性改为mysql用户
# chgrp -R mysql . //将组属性改为mysql组
# /usr/local/mysql/bin/mysqld_safe --user=mysql & 启动数据库
#netstat -tnl|grep 3306 //查看3306端口是否开启
# bin/mysqladmin version //简单的测试
# bin/mysqladmin variables //查看所有mysql参数
# bin/mysql -u root //没有密码可以直接登录本机服务器
mysql> DELETE FROM mysql.user WHERE Host='localhost' AND User='';
mysql> FLUSH PRIVILEGES;
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456');
# bin/mysql -u root -h localhost –p //回车进入MySQL客户端
# bin/mysqladmin -u root –p shutdown //关闭MySQL数据库
(11)安装PHP
#./configure \ //执行当前目录下软件自代的配置命令
> --prefix=/usr/local/php \ //设置PHP5 的安装路径
> --with-config-file-path=/usr/local/php/etc \ //指定PHP5配置文件存入的路径
> --with-apxs2=/usr/local/apache2/bin/apxs \ //告诉PHP查找Apache 2的地方
> --with-mysql=/usr/local/mysql/ \ //指定MySQL的安装目录
> --with-libxml-dir=/usr/local/libxml2/ \ //告诉PHP放置libxml2库的地方
> --with-png-dir=/usr/local/libpng/ \ //告诉PHP放置libpng库的地方
> --with-jpeg-dir=/usr/local/jpeg6/ \ //告诉PHP放置jpeg库的地方
> --with-freetype-dir=/usr/local/freetype/ \ //告诉PHP放置freetype库的地方
> --with-gd=/usr/local/gd2/ \ //告诉PHP放置gd库的地方
> --with-zlib-dir=/usr/local/zlib/ \ //告诉PHP放置zlib库的地方
> --with-mcrypt=/usr/local/libmcrypt/ \ //告诉PHP放置libmcrypt库的地方
> --with-mysqli=/usr/local/mysql/bin/mysql_config \ //变量激活新增加的MySQLi功能
>--enable-soap \ //变量激活SOAP和Web services支持
> --enable-mbstring=all \ //使多字节字符串支持
> --enable-sockets //变量激活socket通讯特性
#make && make install
(12)LAMP 环境整合
# cp php.ini-dist /usr/local/php/lib/php.ini //创建配置文件
#vi /etc/httpd/httpd.conf //使用vi编辑apache配置文件
Addtype application/x-httpd-php .php .phtml #添加这一条
# vi test.php //编辑test.php文件
<?php
phpinfo();
?>
(13)安装Zend加速器
# ./install.sh //执行安装