本文适用于所有256M(含256M)以上VPS,不适用于128M VPS。安装环境为CENTOS
本文假设所有的操作均在/opt/software目录下执行

mkdir /opt/software

cd /opt/software/

**全编译前准备
**
准备1、安装编译器gcc

一般VPS都是最小化安装的,没有安装编译器

yum -y update

yum -y install gcc gcc-c++ automake

yum install -y openssl-devel

这一步只所以没有用源码装,试因为GCC牵扯到很多关联模块,并和系统kernel有关,搞得不好,VPS就无法使用了,所以不建议去编译GCC
在这里只给出yum的安装方式,如果有童鞋有兴趣研究GCC的编译方式,建议先去看LFS或者编译内核一类的。

准备2、设置库文件路径

echo "/usr/local/lib" >> /etc/ld.so.conf

ldconfig

准备3、安装libtool

wget http://ftp.gnu.org/gnu/libtool/libtool-2.4.tar.gz

tar xvf libtool-2.4.tar.gz

cd libtool-2.4

./configure

make && make install

cd ..

一、MYSQL-5.1.54

1.1、nucrse

wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.7.tar.gz

tar xvf ncurses-5.7.tar.gz

cd ncurses-5.7

./configure --with-shared --without-debug

make && make install

cd ..

1.2、mysql-5.1.54

wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.54.tar.gz/from/http://mysql.he.net/

tar xvf mysql-5.1.54.tar.gz

cd mysql-5.1.54

./configure --prefix=/usr/local/mysql \

--with-unix-socket-path=/var/lib/mysql/mysql.sock \
--localstatedir=/var/lib/mysql/data \
--with-charset=utf8 --with-collation=utf8_general_ci \
--with-extra-charsets=all --enable-assembler --with-pthread

make

make install

groupadd mysql

useradd mysql -s /sbin/nologin -g mysql -M

cp support-files/my-medium.cnf /etc/my.cnf

修改my.cnf
在skip-locking这句前面加上#号,添加
skip-external-locking

chown mysql.root -R /usr/local/mysql

cd /usr/local/mysql/

bin/mysql_install_db --user=mysql

chown mysql.mysql -R /var/lib/mysql/

ln -s /usr/local/mysql/bin/* /usr/local/bin

重要:

ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql

cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld

chmod 700 /etc/init.d/mysqld

mysql的启动和关闭
/etc/init.d/mysqld start
/etc/init.d/mysqld stop

二、PHP-5.3.5

回到我们的编译目录

cd /opt/software

2.1、ZLIB

wget http://zlib.net/zlib-1.2.5.tar.gz

tar xvf zlib-1.2.5.tar.gz

cd zlib-1.2.5

./configure --prefix=/usr/local/

make && make install

cd ..

2.2、LIBPNG

wget http://sourceforge.net/projects/libpng/files/libpng15/1.5.0/libpng-1.5.0.tar.gz/download

tar xvf libpng-1.5.0.tar.gz

cd libpng-1.5.0

./configure --prefix=/usr/local/

make && make install

cd ..

2.3、FREETYPE

wget http://download.savannah.gnu.org/releases/freetype/freetype-2.1.10.tar.bz2

tar xvf freetype-2.1.10.tar.bz2

cd freetype-2.1.10

./configure --prefix=/usr/local/ --enable-shared

make && make install

cd ..

2.4、LIBJPEG

wget http://freshmeat.net/urls/6228c609a20bb6f87b2fef4fd4b6a30c

tar xvf jpegsrc.v8b.tar.gz

cd jpeg-8b/

./configure --prefix=/usr/local --enable-shared --enable-static

make

make test

make install

cd ..

2.5、LIBICONV

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz

tar xvf libiconv-1.13.1.tar.gz

cd libiconv-1.13.1

./configure --prefix=/usr/local/

make && make install

cd ..

2.6、GD

wget http://www.libgd.org/releases/gd-latest.tar.gz

tar xvf gd-latest.tar.gz

cd gd-2.0.34

./configure --with-png --with-freetype --with-jpeg

make

make install

cd ..

2.7、libevent

wget http://monkey.org/~provos/libevent-2.0.10-stable.tar.gz

tar xvf libevent-2.0.10-stable.tar.gz

cd libevent-2.0.10-stable

./configure --prefix=/usr/local/

make

make install

cd ..

2.8、libxml2

wget [ftp://xmlsoft.org/libxml2/libxml2-2.7.8.tar.gz](ftp://xmlsoft.org/libxml2/libxml2-2.7.8.tar.gz)

tar xvf libxml2-2.7.8.tar.gz

cd libxml2-2.7.8

./configure --prefix=/usr/local/

make && make install

cd ..

[ 本帖最后由 tony1999 于 2011-1-14 21:44 编辑 ]