CentOS5.6+Apache2.2.22+PHP5.3.15+Mysql5.5.23编译安装
1. 升级系统,没啥好说的:
2、安装mysql
tar zxvf cmake-2.8.7.tar.gz
cd cmake-2.8.7
./bootstrap
gmake
gmake install
cd ../
tar zxvf bison-2.5.tar.gz
cd bison-2.5
./configure
make
make install
编译安装 MySQL 5.5.23
/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql
tar xvf mysql-5.5.23.tar.gz
cd mysql-5.5.23/
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/webserver/mysql5.5/ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/usr/local/webserver/mysql_data/
make
make install
chmod +w /usr/local/webserver/mysql5.5
chown -R mysql:mysql /usr/local/webserver/mysql5.5
ln -s /usr/local/webserver/mysql5.5/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18(记得以前是16来着,这次编译居然为18,不晓得为什么)
cd support-files/
cp my-large.cnf /usr/local/webserver/mysql5.5/my.cnf (注意:my-large.cnf适用于1G内存左右的服务器,可以根据自己配置情况选用my-large.cnf 或 my-huge.cnf 等不同配置)
cp mysql.server /etc/init.d/mysqld
1. 若有需要请先修改 mysql 的配置 my.cnf
vi /usr/local/webserver/mysql5.5/my.cnf
(自己配置吧)
2. mysql 初始化安装
/usr/local/mysql/scripts/mysql_install_db \
--defaults-file=/var/mysql/my.cnf \
--basedir=/usr/local/mysql \
--datadir=/var/mysql/data \
--user=mysql
3. 将 mysql 加入开机启动
chmod +x /etc/init.d/mysqld
vi /etc/init.d/mysqld (编辑此文件,查找并修改以下变量内容:)
basedir=/usr/local/mysql
datadir=/var/mysql/data
chkconfig --add mysqld
chkconfig --level 345 mysqld on
4. 启动 mysql
service mysqld start
第3步、安装apache
./configure --prefix=/usr/local/webserver/apache2.2/ --enable-so --enable-module=so --enable-mods-shared=most --enable-cache --enable-file-cache --enable-disk-cache --enable-mem-cache --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-static-rotatelogs --enable-headers --enable-authz-host --with-included-apr(必须加上)
make && make install
据说cache比较吃内存,可以将上述cache不直接编译进去。
第4步、安装PHP5.3.15
yum -y install libmcrypt libmcrypt-devel mhash libtool-ltdl libtool-ltdl-devel(在此使用yum安装,不知为什么libmcrypt死活编译不过去,只好这样了)
./configure --prefix=/usr/local/webserver/php5.3/ --with-config-file-path=/usr/local/webserver/php5.3/etc --with-apxs2=/usr/local/webserver/apache2.2/bin/apxs --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-pdo-sqlite --with-iconv=/usr/local/ --with-curl --with-gd --with-jpeg-dir --with-png-dir --with-zlib --with-freetype-dir --with-mhash --with-mcrypt --enable-gd-native-ttf --enable-mbstring --enable-mbregex --enable-xml --with-xmlrpc --enable-zip --enable-sockets --enable-shmop --enable-pcntl --enable-bcmath --enable-calendar --with-curlwrappers --enable-sysvsem --disable-safe-mode --disable-phar --disable-rpath
makeZEND_EXTRA_LIBS='-liconv'(iconv可能系统自带了,加上iconv等相关参数后后报错,去掉后,看PHPINFO里会有iconv模块)
make install
cp php.ini-production /usr/local/php5.3/php.ini
(编辑php.inif)
ln -s /usr/local/webserver/php5.3/bin/php /usr/bin
第5步、安装PHP的一些扩展
tar zxvf memcache-3.0.5.tgz
cd memcache-3.0.5/
/usr/local/php5.3/bin/phpize
./configure --with-php-config=/usr/local/php5.3/bin/php-config
make && make install
修改extion_dir
6、编译eaccelerator
/usr/local/webserver/php5.3/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config --with-eaccelerator-shared-memory
make
make install
安装后会显示路径
/usr/local/webserver/php5.3//lib/php/extensions/no-debug-non-zts-20090626/
注:上述配置在本人的VPS512M内存中运行(www.ggadb.com):CentOS5.6 + apache2.2.22 + mysql5.5.23 + php5.3.15,如有问题,请email联系。后面会将配置文件也发出来
sudo -s
LANG=C
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
LANG=C
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
2、安装mysql
tar zxvf cmake-2.8.7.tar.gz
cd cmake-2.8.7
./bootstrap
gmake
gmake install
cd ../
tar zxvf bison-2.5.tar.gz
cd bison-2.5
./configure
make
make install
编译安装 MySQL 5.5.23
/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql
tar xvf mysql-5.5.23.tar.gz
cd mysql-5.5.23/
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/webserver/mysql5.5/ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/usr/local/webserver/mysql_data/
make
make install
chmod +w /usr/local/webserver/mysql5.5
chown -R mysql:mysql /usr/local/webserver/mysql5.5
ln -s /usr/local/webserver/mysql5.5/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18(记得以前是16来着,这次编译居然为18,不晓得为什么)
cd support-files/
cp my-large.cnf /usr/local/webserver/mysql5.5/my.cnf (注意:my-large.cnf适用于1G内存左右的服务器,可以根据自己配置情况选用my-large.cnf 或 my-huge.cnf 等不同配置)
cp mysql.server /etc/init.d/mysqld
1. 若有需要请先修改 mysql 的配置 my.cnf
vi /usr/local/webserver/mysql5.5/my.cnf
(自己配置吧)
2. mysql 初始化安装
/usr/local/mysql/scripts/mysql_install_db \
--defaults-file=/var/mysql/my.cnf \
--basedir=/usr/local/mysql \
--datadir=/var/mysql/data \
--user=mysql
3. 将 mysql 加入开机启动
chmod +x /etc/init.d/mysqld
vi /etc/init.d/mysqld (编辑此文件,查找并修改以下变量内容:)
basedir=/usr/local/mysql
datadir=/var/mysql/data
chkconfig --add mysqld
chkconfig --level 345 mysqld on
4. 启动 mysql
service mysqld start
第3步、安装apache
./configure --prefix=/usr/local/webserver/apache2.2/ --enable-so --enable-module=so --enable-mods-shared=most --enable-cache --enable-file-cache --enable-disk-cache --enable-mem-cache --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-static-rotatelogs --enable-headers --enable-authz-host --with-included-apr(必须加上)
make && make install
据说cache比较吃内存,可以将上述cache不直接编译进去。
第4步、安装PHP5.3.15
yum -y install libmcrypt libmcrypt-devel mhash libtool-ltdl libtool-ltdl-devel(在此使用yum安装,不知为什么libmcrypt死活编译不过去,只好这样了)
./configure --prefix=/usr/local/webserver/php5.3/ --with-config-file-path=/usr/local/webserver/php5.3/etc --with-apxs2=/usr/local/webserver/apache2.2/bin/apxs --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-pdo-sqlite --with-iconv=/usr/local/ --with-curl --with-gd --with-jpeg-dir --with-png-dir --with-zlib --with-freetype-dir --with-mhash --with-mcrypt --enable-gd-native-ttf --enable-mbstring --enable-mbregex --enable-xml --with-xmlrpc --enable-zip --enable-sockets --enable-shmop --enable-pcntl --enable-bcmath --enable-calendar --with-curlwrappers --enable-sysvsem --disable-safe-mode --disable-phar --disable-rpath
make
make install
cp php.ini-production /usr/local/php5.3/php.ini
(编辑php.inif)
ln -s /usr/local/webserver/php5.3/bin/php /usr/bin
第5步、安装PHP的一些扩展
tar zxvf memcache-3.0.5.tgz
cd memcache-3.0.5/
/usr/local/php5.3/bin/phpize
./configure --with-php-config=/usr/local/php5.3/bin/php-config
make && make install
修改extion_dir
6、编译eaccelerator
/usr/local/webserver/php5.3/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config --with-eaccelerator-shared-memory
make
make install
安装后会显示路径
/usr/local/webserver/php5.3//lib/php/extensions/no-debug-non-zts-20090626/
注:上述配置在本人的VPS512M内存中运行(www.ggadb.com):CentOS5.6 + apache2.2.22 + mysql5.5.23 + php5.3.15,如有问题,请email联系。后面会将配置文件也发出来