安装必须的包
[root@localhost ~]# yum -y install *gcc*
[root@localhost ~]# yum -y install lib*
[root@localhost ~]# yum -y install gd*
1、安装freeytpe
[root@localhost sijd]# tar zxvf freetype-2.4.3.tar.gz -C /usr/local/src/
[root@localhost src]# cd /usr/local/src/freetype-2.4.3/
[root@localhost freetype-2.4.3]# ./configure --prefix=/usr/local/freetype-2.4.3
[root@localhost freetype-2.4.3]# make
[root@localhost freetype-2.4.3]# make install
[root@localhost freetype-2.4.3]# ll /usr/local/freetype-2.4.3/ (确认安装成功)
2、安装libpng
[root@localhost libpng-1.4.4]# tar zxvf libpng-1.4.4.tar.gz -C /usr/local/src/
[root@localhost libpng-1.4.4]# cd /usr/local/src/libpng-1.4.4/
[root@localhost libpng-1.4.4]# ./configure --prefix=/usr/local/libpng-1.4.4
[root@localhost libpng-1.4.4]# make
[root@localhost libpng-1.4.4]# make install
[root@localhost libpng-1.4.4]# ll /usr/local/libpng-1.4.4/ (确认安装成功)
3、安装jpeg
[root@localhost jpeg-8b]# tar zxvf jpegsrc.v8b.tar.gz -C /usr/local/src/
[root@localhost jpeg-8b]# cd /usr/local/src/jpeg-8b/
[root@localhost jpeg-8b]# cp /usr/share/libtool/config/config.sub .
[root@localhost jpeg-8b]# cp /usr/share/libtool/config/config.guess .
[root@localhost jpeg-8b]# ldconfig
[root@localhost jpeg-8b]# ./configure --prefix=/usr/local/jpeg-8b --enable-shared --enable-static
[root@localhost jpeg-8b]# make
[root@localhost jpeg-8b]# make install
[root@localhost jpeg-8b]# ll /usr/local/jpeg-8b/
4、安装GD
[root@localhost gd-2.0.33]# tar zxvf gd-2.0.33.tar.gz -C /usr/local/src/
[root@localhost gd-2.0.33]# cd /usr/local/src/gd-2.0.33/
[root@localhost gd-2.0.33]# ls /usr/local/libpng-1.4.4/include/png.h
[root@localhost gd-2.0.33]# vim gd_png.c
注:找到“png.h”改成“/usr/local/libpng-1.4.4/include/png.h”
[root@localhost gd-2.0.33]# ./configure --prefix=/usr/local/gd-2.0.33 --with-jpeg=/usr/local/jpeg-8b/ --with-freetype=/usr/local/freetype-2.4.3/ --with-png=/usr/local/libpng-1.4.4/ --with-zlib --enable-m4_pattern_allow
[root@localhost gd-2.0.33]# make
[root@localhost gd-2.0.33]# make install
[root@localhost gd-2.0.33]# ll /usr/local/gd-2.0.33/
[root@localhost httpd-2.2.15]# rpm -e httpd --nodeps
[root@localhost httpd-2.2.15]# tar zxvf httpd-2.2.15.tar.gz -C /usr/local/src/
[root@localhost httpd-2.2.15]# cd /usr/local/src/httpd-2.2.15/
[root@localhost httpd-2.2.15]# ./configure --prefix=/usr/local/apache--2.2.15 --enable-so --enable-rewrite
[root@localhost httpd-2.2.15]# make
[root@localhost httpd-2.2.15]# make install
[root@localhost httpd-2.2.15]# ll /usr/local/apache--2.2.15/
[root@localhost httpd-2.2.15]# /usr/local/apache--2.2.15/bin/apachectl start (启动)
注:要在浏览器测试。“It works!”
[root@localhost sijd]# tar zxvf mysql-5.1.44.tar.gz -C /usr/local/src/
[root@localhost sijd]# cd /usr/local/src/mysql-5.1.44/
[root@localhost mysql-5.1.44]# useradd mysql -M -s /sbin/nologin
注:如果编译mysql是报以下错误:
/bin/rm: cannot remove `libtoolt': No such file or directory
[root@localhost mysql-5.1.44]# vim configure删除这一行 $RM "$cfgfile" 后从新编译OK
[root@localhost mysql-5.1.44]# ./configure --prefix=/usr/local/mysql-5.1.44 --with-unix-socket-path=/tmp/mysql.sock --localstatedir=/usr/local/mysql-5.1.44/data/ --without-debug --enable-thread-safe-client --enable-assembler --enable-profiling --enable-community-features --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-charset=latin1 -with-extra-charsets=utf8,gbk,gb2312 --with-extra-charsets=all --with-plugins=innobase --with-mysqld-user=mysql --without-embedded-server --with-server-suffix=-community
[root@localhost mysql-5.1.44]# make
[root@localhost mysql-5.1.44]# make install
[root@localhost mysql-5.1.44]# ./scripts/mysql_install_db --user=mysql
[root@localhost mysql-5.1.44]# cp support-files/my-medium.cnf /etc/my.cnf -fv
[root@localhost mysql-5.1.44]# chown -R root:mysql /usr/local/mysql-5.1.44/
[root@localhost mysql-5.1.44]# chown -R mysql.mysql /usr/local/mysql-5.1.44/data/
[root@localhost mysql-5.1.44]# cd /usr/local/mysql-5.1.44/libexec/
[root@localhost libexec]# cp mysqld mysqld.old
[root@localhost libexec]# strip mysqld
[root@localhost libexec]# echo "/usr/local/mysql-5.1.44/lib/mysql/" >> /etc/ld.so.conf
[root@localhost libexec]# ldconfig
[root@localhost ~]# export PATH=$PATH:/usr/local/mysql-5.1.44/bin/
[root@localhost ~]# echo "export PATH=$PATH:/usr/local/mysql-5.1.44/bin/" >> /etc/profile
[root@localhost libexec]# /usr/local/mysql-5.0.89/bin/mysqld_safe &
[root@localhost libexec]# /usr/local/mysql-5.1.44/bin/mysqladmin -u root password "youpassword"
[root@localhost libexec]# /usr/local/mysql-5.1.44/bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.44-community-log Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)
mysql> quit
Bye
[root@localhost libexec]# echo "/usr/local/mysql-5.1.44/bin/mysqld_safe &" >> /etc/rc.local
平滑关闭 mysqld
[root@localhost data]# /usr/local/mysql-5.0.89/bin/mysqladmin -u root -p shutdown
Enter password: (输入youpassword密码)
[root@localhost sijd]# tar zxvf php-5.2.9.tar.gz -C /usr/local/src/
[root@localhost sijd]# cd /usr/local/src/php-5.2.9/
[root@localhost php-5.2.9]# ./configure --prefix=/usr/local/php-5.2.9 --with-apxs2=/usr/local/apache-2.2.15/bin/apxs --with-zlib --with-libxml-dir --enable-gd-native-ttf --enable-mbstring --with-gd=/usr/local/gd-2.0.33/ --with-mysql=/usr/local/mysql-5.1.44/ --with-freetype-dir=/usr/local/freetype-2.4.3/ --with-jpeg-dir=/usr/local/jpeg-8b/ --with-png-dir=/usr/local/libpng-1.4.4/ --with-curl --enable-pdo --with-pdo-sqlite --with-pdo-mysql=/usr/local/mysql-5.1.44/bin/mysql_config --with-openssl
[root@localhost php-5.2.9]# make
[root@localhost php-5.2.9]# make install
[root@localhost php-5.2.9]# cp php.ini-dist /usr/local/php-5.2.9/lib/php.ini
在APACHE 整合PHP
vim /usr/local/apache-2.2.15/conf/httpd.conf
53 LoadModule php5_module modules/libphp5.so
54 AddType application/x-httpd-php .php
167 <IfModule dir_module>
168 DirectoryIndex index.php index.html
169 </IfModule>
1、安装libevent
[root@localhost sijd]# tar xvf libevent-1.4.6-stable.tar.gz -C /usr/local/src/
[root@localhost sijd]# cd /usr/local/src/libevent-1.4.6-stable/
[root@localhost libevent-1.4.6-stable]# ./configure --prefix=/usr/local/libevent/
[root@localhost libevent-1.4.6-stable]# make
[root@localhost libevent-1.4.6-stable]# make install
2、安装memcache
[root@localhost sijd]# cd /usr/local/src/memcache-2.2.6/
[root@localhost memcache-2.2.6]# ./configure --enable-memcache --with-php-config=/usr/local/php-5.2.13/bin/php-config
[root@localhost memcache-2.2.6]# make
[root@localhost memcache-2.2.6]# make install
添加memcache模块
/usr/local/php-5.2.13/lib/php.ini 中添加
extension_dir = "/usr/local/php-5.2.13/lib/php/extensions/no-debug-non-zts-20060613"
extension = "memcache.so"
3、安装memcached
[root@localhost sijd]# tar zxvf memcached-1.4.13.tar.gz -C /usr/local/src/
[root@localhost sijd]# cd /usr/local/src/memcached-1.4.13/
[root@localhost memcached-1.4.13]# /usr/local/php-5.2.9/bin/phpize
[root@localhost memcached-1.4.13]# ./configure --prefix=/usr/local/libevent/
[root@localhost memcached-1.4.13]# make
[root@localhost memcached-1.4.13]# make install
运行memcached
# /usr/local/servers/memcached -d -m 128 -l localhost -p 11211 -u root
-d 以守护程序(daemon)方式运行 memcached;
-m 设置 memcached 可以使用的内存大小,单位为 M;
-l 设置监听的 IP 地址,如果是本机的话,通常可以不设置此参数;
-p 设置监听的端口,默认为 11211,所以也可以不设置此参数;
-u 指定用户;