/ 中存储网

64位CentOS系统安装Apache+MySQL+PHP+gd服务器环境

2014-04-07 13:33:01 来源:itjs.cn
为了解决编译安装php后找不到libphp5.so的问题,搜到了这位大牛写的CentOS 64位系统安装步骤,按照做了一下,编译出的php果然有libphp5.so文件。

先易后难:

1.Mysql (注意,注意,要下载一个64位的mysql)

# wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.30-linux-x86_64-glibc23.tar.gz/from/http://mysql.he.net// //下载

# tar zxvf mysql-5.1.30-linux-x86_64-glibc23.tar.gz //解压

# ln -s mysql-5.1.30-linux-x86_64-glibc23 mysql //链接

# groupadd mysql //增加组

# useradd -g mysql mysql //增加用户

# cd mysql //改变目录

# scripts/mysql_install_db –user=mysql //安装

# chown -R root . //权限

# chown -R mysql data //权限

# chgrp -R mysql . //权限

# bin/mysqld_safe –user=mysql & //第一次运行

# bin/mysqladmin -u root password XXXXXX // 改mysql 的root 密码为 XXXXXX

# cp support-files/mysql.server /etc/rc.d/init.d/mysqld //系统启动时自动运行:

# chkconfig –add mysqld //系统启动时自动运行:

# /etc/rc.d/init.d/mysqld restart //测试一把

// mysql 搞定

2. Apache

没有安装gcc , 先yum install gcc.

# wget http://apache.freelamp.com/httpd/httpd-2.0.63.tar.bz2 //下载

# tar jxvf httpd-2.0.63.tar.bz2 //解压

# cd httpd* //改变目录

# ./configure –prefix=/usr/local/apache –enable-so –enable-rewrite –enable-info –enable-cgid –enable-mime-magic –enable-alias –enable-access –enable-forward //配置

# make //编译

# make install //安装

# /usr/local/apache/bin/apachectl start //第一次运行

3.GD

开始前先建一些目录方便安装(不建目录也可)

mkdir /usr/local/modules

#jpeg目录

mkdir /usr/local/modules/jpeg6

mkdir /usr/local/modules/jpeg6/bin

mkdir /usr/local/modules/jpeg6/lib

mkdir /usr/local/modules/jpeg6/include

mkdir /usr/local/modules/jpeg6/man

mkdir /usr/local/modules/jpeg6/man/man1

a.zlib (看来zlib停止升级了,到现在还是2005年发布的一个东东)

# wget http://www.zlib.net/zlib-1.2.5.tar.gz //下载

# tar zxvf zlib-1.2.5.tar.gz //解压

# cd zlib-1.2.5 //改变目录

# CFLAGS=”-O3 -fPIC” ./configure   //使用64位 的方法进行编译 (一般只需要./configure)

# make

# make install

b.FreeType

# wget http://downloads.sourceforge.net/freetype/freetype-2.3.5.tar.gz?modtime=1183336047&big_mirror=0 //下载

# tar zxvf freetype-2.3.5.tar.gz //解压

# cd freetype-2.3.5 //改变目录

# ./configure –prefix=/usr/local/modules/freetype  //配置

# make //编译

# make install //安装

c.Libpng

# wget http://prdownloads.sourceforge.net/libpng/libpng-1.2.8-config.tar.gz?download //下载

# tar zxvf libpng-1.2.8-config.tar.gz //解压

# cd libpng-1.2.8-config //改变目录

注意:首先看有没有装libtool (whereis libtool),没有就需要yum install libtool.

# ./configure //配置

# make //编译

# make install //安装

64位的机器这样搞

cp /usr/share/libtool/config.sub .

cp /usr/share/libtool/config.guess .

./configure –enable-shared –enable-static

make

make install

d.jpeg

# wget http://www.ijg.org/files/jpegsrc.v8b.tar.gz //下载

# tar jpegsrc.v8b.tar.gz //解压

# cd jpeg-8b //改变目录

# ./configure –prefix=/usr/local/modules/jpeg6 –enable-shared –enable-static  //配置

# make //编译

# make install  //安装

e.GD

# wget http://www.boutell.com/gd/http/gd-2.0.33.tar.gz //下载

# tar xzvf gd-2.0.33.tar.gz //解压

# cd gd-2.0.33 //改变目录

# ./configure –prefix=/usr/local/modules/gd –with-jpeg=/usr/local/modules/jpeg6 –with-png=/usr/local/libpng –with-zlib –with-freetype=/usr/local/modules/freetype  //配置

# make //编译

# make install  //安装

4.PHP

a.libxml2

# wget ftp://xmlsoft.org/libxml2/libxml2-2.7.2.tar.gz //下载

# tar zxvf libxml2-2.7.2.tar.gz //解压

# cd libxml2-2.7.2 //改变目录

# ./configure –prefix=/usr/local/libxml2 //配置

# make //编译

# make install //安装

b.curl (系统安装了就yum remove curl,然后下载一个新版的)

# wget http://curl.haxx.se/download/curl-7.19.0.tar.gz //下载

# tar -zxvf curl-7.19.0.tar.gz //解压

# cd curl-7.19.0 //改变目录

# ./configure –prefix=/usr/local/curl //配置

# make //编译

# make install //安装

c.PHP

# wget http://cn.php.net/get/php-5.2.8.tar.bz2/from/us.php.net/mirror

# tar jxvf php-5.2.8.tar.bz2

# cd php*

# ./configure –prefix=/usr/local/php –with-mysql=/usr/local/mysql –with-libxml-dir=/usr/local/libxml2 –with-gd=/usr/local/modules/gd –with-png-dir=/usr/local/libpng –with-jpeg-dir=/usr/local/modules/jpeg6 –with-zlib  –with-freetype-dir=/usr/local/modules/freetype –enable-magic-quotes –with-apxs2=/usr/local/apache/bin/apxs  –enable-ftp –with-config-file-path=/usr/local/php/etc –with-iconv –with-gettext –with-curl=/usr/local/curl

# make

# make install

# cp php.ini-dist /usr/local/php/etc/php.ini  (这句。。。)