CentOS5 下安装Apache2+PHP5+MySQL
扫描二维码
随时随地手机看文章
安装apache
# tar -zvxf httpd-2.2.14.tar.gz
# cd httpd-2.2.14
# ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite
# make
# make install
安装MySQL
#yum -y install mysql-server
#yum -y install mysql-devel
安装 jpeg7
建立目录:
# mkdir -p /usr/local/jpeg7
# mkdir -p /usr/local/jpeg7/bin
# mkdir -p /usr/local/jpeg7/lib
# mkdir -p /usr/local/jpeg7/include
# mkdir -p /usr/local/jpeg7/man
# mkdir -p /usr/local/jpeg7/man1
# mkdir -p /usr/local/jpeg7/man/man1
# tar -zvxf jpegsrc.v7.tar.gz
# cd jpeg-7
# ./configure --prefix=/usr/local/jpeg7/ --enable-shared --enable-static
# make; make install
安装libpng
# tar -zvxf libpng-1.2.40.tar.gz
# cd libpng-1.2.40
# cp scripts/makefile.linux makefile
# make
# make install
安装 freetype
# tar -zvxf freetype-2.1.10.tar.gz
# cd freetype-2.1.10
# mkdir -p /usr/local/freetype
# ./configure --prefix=/usr/local/freetype
# make
# make install
安装zlib
#tar -zxvf zlib-1.2.3.tar.gz
#cd zlib.1.2.3
# ./configure
# make
# make install
安装GD库
# tar -zvxf gd-2.0.35.tar.gz
# cd gd-2.0.35
# ./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg7/ --with-png=/usr/local/lib/ --with-zlib=/usr/local/lib/ --with-freetype=/usr/local/freetype/
# make
# make install
安装PHP
# rpm -ivh libxml2-2.6.26-2.1.2.8.i386.rpm
# rpm -ivh libxml2-devel-2.6.26-2.1.2.8.i386.rpm
# rpm -ivh pkgconfig-0.21-2.el5.i386.rpm
# yum -y install curl
# tar -zxvf php-5.2.10.tar.gz
# cd php-5.2.10
# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-gd=/usr/local/gd2/ --with-curl --with-jpeg-dir=/usr/local/jpeg7 --with-freetype-dir=/usr/local/freetype/
#如果上面的登录发生 mysql configure failed 错误 则先执行下面的配置,再执行上面配置就行(好像是第一次执行不能包括GD库)
# ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql
# make
# make install
# cp php.ini-recommended /usr/local/lib/php.ini
安装Zend Optimizer
#wget http://downloads.zend.com/optimizer/3.3.3/ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz
#tar -xzvf ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz
#./ZendOptimizer-3.3.3-linux-glibc23-i386/install.sh
附:需要从源码安装MYSQL时可用以下方式
#####./configure --prefix=/usr/local/mysql --with-mysqld-user=mysql --localstatedir=/var/lib/mysql --with-comment=Source --with-server-suffix=-ESUN_SERVER --without-debug --with-big-tables --with-charset=gbk --with-collation=gbk_chinese_ci --with-extra-charsets=all --with-pthread --enable-static --enable-thread-safe-client --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --enable-assembler --without-isam --without-innodb --without-ndb-debug
./configure --prefix=/usr/local/mysql --without-innodb --with-mysqld-user=mysql
/usr/local/mysql/bin/mysql_install_db
cp /usr/local/mysql/share/mysql/my-large.cnf /etc/my.cnf
chown -R mysql:mysql /var/lib/mysql
chown -R mysql:mysql /usr/local/mysql
chown -R mysql:mysql /usr/local/mysql/var
cp /usr/local/mysql/share/mysql/mysql.server /etc/rc.d/init.d/mysqld
#chkconfig --add mysqld
#chkconfig --level 3 mysqld on
/usr/local/mysql/bin/mysqladmin -uroot password '12345678'