1. 安装mysql mysql-5.0.41-linux-i686-glibc23.tar.gz 由于mysql是二进制包。所以还是比较方便的。
直接解压。然后移动。
mv mysql-5.0.41-linux-x86_64-glibc23 /usr/local/mysql
cd /usr/local/mysql
groupadd mysql
useradd -g mysql mysql
chown -R mysql .
chgrp -R mysql .
chown -R root .
# 注:这里可能会出现错误。
[iyunv@localhost mysql]# Starting mysqld daemon with databases from /opt/module/mysql/data
STOPPING server from pid file /opt/module/mysql/data/localhost.localdomain.pid
101029 17:49:43 mysqld ended
这是因为basedir与datadir目录未设置的问题。那么在/etc/my.cnf [mysqld]里和 /etc/rc.d/init.d/mysqld里面都上
添加basedir = /opt/module/mysql datadir=/opt/data/mysql (这都是我的目录,相应改成你的目录)
再次启动。就应该可以了。
2. 安装扩展库 安装pcre
tar -zxvf pcre-7.8.tar.gz
cd pcre-7.8
./configure
make && make install clean
安装 GD库 安装 zlib
tar zxvf zlib-1.2.5.tar.gz
cd zlib-1.2.5
./configure --prefix=/usr
make && make install clean
cd .. 安装 libpng
tar zxvf libpng-1.2.44.tar.gz
cd libpng-1.2.44
./configure
make && make install clean
cd ..
安装 jpeg
tar zxvf jpegsrc.v8b.tar.gz
cd jpeg-8b
./configure -enable-shared -enable-static
make && make install clean
cd .. 安装 freetype
tar zxvf freetype-2.4.4.tar.gz
cd freetype-2.4.4
./configure
make && make install clean
cd .. 安装autoconf
tar zxvf autoconf-2.68.tar.gz
cd autoconf-2.68
./configure
make && make install clean
cd .. 安装 gd2.0.35
tar zxvf gd-2.0.35.tar.gz
cd gd-2.0.35
./configure --prefix=/usr/local/gd2 --with-zlib --with-freetype --with-jpeg --with-png
make && make install clean
cd .. 安装 libxml2
tar -zxvf libxml2-2.7.6.tar.gz
cd libxml2-2.7.6
./configure
make && make install clean
cd .. 安装libiconv
tar zxvf libiconv-1.13.1.tar.gz
cd libiconv-1.13.1/
./configure --prefix=/usr/local
make && make install clean
cd ..
安装libmcrypt
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make && make install clean
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make && make install clean
cd ../../
安装mhash
tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9/
./configure
make && make install clean
cd ../
ln命令在某个地方建立一个同步的链接
ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
mv -f /usr/local/src/conf/php-fpm.conf /usr/local/php/etc/php-fpm.conf echo 'ulimit -SHn 65535' >> /etc/rc.local echo '/usr/local/php/sbin/php-fpm start' >> /etc/rc.local cd ../ 4. 编译安装PHP5扩展模块 memcache
tar zxvf memcache-2.2.5.tgz
cd memcache-2.2.5/
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install clean
cd ../ eaccelerator
tar jxvf eaccelerator-0.9.5.3.tar.bz2
cd eaccelerator-0.9.5.3/
/usr/local/php/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config
make && make install clean
cd ../ 配置eAccelerator加速PHP:
mkdir -p /usr/local/eaccelerator_cache
vi /usr/local/php/etc/php.ini
[eaccelerator]
zend_extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"
eaccelerator.shm_size="128"
eaccelerator.cache_dir="/usr/local/eaccelerator_cache"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="300"
eaccelerator.shm_prune_period="120"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
修改配置文件:
vi /etc/sysctl.conf
# Controls the maximum size of a message, in bytes
kernel.msgmnb = 65536
# Controls the default maxmimum size of a mesage queue
kernel.msgmax = 65536
# Controls the maximum shared segment size, in bytes
# kernel.shmmax = 4294967295
kernel.shmmax = 134217728
# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 268435456
然后执行以下命令使配置生效:
/sbin/sysctl -p PDO_MYSQL
tar zxvf PDO_MYSQL-1.0.2.tgz
cd PDO_MYSQL-1.0.2/
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql
make && make install clean
cd ../ ImageMagick
tar zxvf ImageMagick.tar.gz
cd ImageMagick-6.5.1-2/
./configure
make && make install clean
cd ../ imagick
tar zxvf imagick-2.2.2.tgz
cd imagick-2.2.2/
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install clean
cd ../
Memcached
tar zxvf libevent-1.4.13-stable.tar.gz
cd libevent-1.4.13-stable
./configure --prefix=/usr/lib
make && make install clean
cd ../
tar zxvf memcached-1.4.5.tar.gz
cd memcached-1.4.5
./configure --prefix=/usr/local --with-libevent=/usr/lib/lib
make && make install clean
/usr/local/bin/memcached -d -u www -m 128
-p <num>
监听的TCP端口(缺省: 11211)
-d
以守护进程方式运行 以守护进程方式运行 Memcached Memcached
-u <username>
运行运行 Memcached的账户 非root用户
-m <num>
最大的内存使用单位是MB 缺省是64MB
-c <num>
软连接数量缺省是1024
-v
输出警告和错误信息
-vv
打印客户端的请求和返回信息
-h
打印帮助信息
-i
打印memcached和libevent的版权信息
# 注:这里可能会出现错误。
error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory 这样的问题是在安装memcached的时候遇到的。
我按别人的攻略安装了libevent和memcached之后却发现在执行的时候出现了。 error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory 这个错误提示。
解决类似问题的步骤我相信我的做法可以通用。
1. 首先 find / -name libevent-1.4.so.2 找到缺少的链接文件到底在那儿。
2. LD_DEBUG=libs /usr/local/bin/memcached -v
3. 从Debug信息中就知道程序去哪里找链接库了。我这边程序去 trying file=/usr/lib/libevent-1.4.so.2 而我的链接库的实际存储位置是 /usr/local/lib/libevent-1.4.so.2
4. 做一个软连接ln -s /usr/lib/lib/libevent-1.4.so.2 /usr/lib/libevent-1.4.so.2 5. 安装ZendOptimizer tar zxvf ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz cd ZendOptimizer-3.3.9-linux-glibc23-i386 cp data/5_2_x_comp/ZendOptimizer.so /usr/local/php/include/ 编辑php.ini
vi /usr/local/php/etc/php.ini
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"
extension=pdo_mysql.so
extension=memcache.so
extension=imagick.so
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200; 建立nginx启动脚本 vi /etc/init.d/nginx
#!/bin/bash
# nginx Startup script for the Nginx HTTP Server
# this script create it by jackbillow at 2007.10.15.
# it is v.0.0.2 version.
# if you find any errors on this scripts,please contact jackbillow.
# and send mail to jackbillow at gmail dot com.
#
# chkconfig: - 85 15
# description: Nginx is a high-performance web and proxy server.
# It has a lot of features, but it's not for everyone.
# processname: nginx
# pidfile: /usr/local/nginx/logs/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf
# Source function library.
. /etc/rc.d/init.d/functions
"/etc/init.d/nginx" [dos] 101L, 1996C
#!/bin/bash
# nginx Startup script for the Nginx HTTP Server
# this script create it by jackbillow at 2007.10.15.
# it is v.0.0.2 version.
# if you find any errors on this scripts,please contact jackbillow.
# and send mail to jackbillow at gmail dot com.
#
# chkconfig: - 85 15
# description: Nginx is a high-performance web and proxy server.
# It has a lot of features, but it's not for everyone.
# processname: nginx
# pidfile: /usr/local/nginx/logs/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf