全部博文(151)
2011年(151)
分类: LINUX
2011-04-19 00:19:46
系统平台:RHEL6.0
软件版本:
libevent-1.4.13-1.i386.rpm
libevent-devel-1.4.13-1.i386.rpm
libiconv-1.9.2.tar.gz
libmcrypt-2.5.8.tar.gz
mcrypt-2.6.8.tar.gz
mhash-0.9.9.9.tar.bz2
mysql-community-5.1.56-1.rhel5.src.rpm
php-5.3.6.tar.bz2
nginx-1.0.0.tar.gz
imagemagick-6.6.9-5.tar.bz2
imagick-3.0.1.tar.gz
memcache-2.2.6.tar.gz
eaccelerator-0.9.6.1.tar.bz2
icu-4.2.1-7.el6.i686.rpm
icu-4.2.1-9.el6.i686.rpm
安装配置
1.install libiconv-1.9.2.tar.gz
tar -xzvf libiconv-1.9.2.tar.gz
cd libiconv
./configure --prefix=/usr/local
make && make install
2.install libmcrypt-2.5.8.tar.gz
tar -zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt
./configure
make && make install
cd libltdl/
./configure --enable-ltdl-install
make && make install
3.install mhash-0.9.9.9.tar.bz2
tar -xjvf mhash-0.9.9.9.tar.bz2
cd mhash
./configure
make && make install
4.将加密函数库链接到系统标准目录下
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
ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
5. install mcrypt-2.6.8.tar.gz
tar -xzvf mcrypt-2.6.8.tar.gz
cd mcrypt
./configure
make && make install
6. install mysql
rpm -ivh Mysql-community-5.1.56-src.rpm
cd rpmbuild
cd SOURCE
tar -xzvf mysq-5.1.56.tar.gz
cd mysql
groupadd mysql
useradd -g mysql -s /sbin/nologin -d /dev/null mysql
./configure --prefix=/usr/local/mysql
--localstatedir=/usr/local/mysql/data
--sysconfdir=/etc
--with-unix-socket-path=/usr/local/mysql/tmp/mysql.socket
--enable-assembler
--with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static
--with-pthread--with-charset=utf8
--with-extra-charsets=complex
--enable-thread-safe-client
--with-big-tables
--with-readline
--with-ssl
--enable-local-infile
--with-plugins=all
--with-mysqld-user=mysql
--with-zlib-dir=/usr
--enable-largefile
--without-debug
--without-comment
--with-mysqlmanager
make && make install
cp support/my-medium.cnf /etc/my.cnf
/usr/local/mysql/bin/mysql_install_db 初始化数据库文件和data目录
cd /usr/local/mysql
mkdir tmp mysql的socket文件存放目录
chown -R root.mysql .
chown -R mysql.mysql data 改变数据库的我数据目录权限
chown -R mysql.mysql tmp 改变socket目录权限
bin/mysqld_safe --user=mysql & 以mysql身份在后台启动mysql
bin/mysqladmin -u root -password 'password' 修改mysql 的root 帐号 密码
7.添加mysql 到系统服务
进入到mysql的源代码目录
cp support/mysql.server /etc/init.d/mysql
chmod +x /etc/init.d/mysql
chkconfig --add mysql
chkconfig mysql on
8.install php-5.3.6.tar.bz2
tar -xjvf php-5.3.6.tar.bz2
groupadd fpm
useradd -g fpm -s /sbin/nologin -d /dev/null fpm
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-mysql-sock=/usr/local/mysql/tmp/mysql.socket --enable-ftp --with-zlib-dir --with-bz2 --enable-zip --with-iconv-dir=/usr/local/ --with-freetype-dir --with-jpeg-dir --with-png-dir --with-gd --enable-gd-native-ttf --with-gettext --enable-bcmath --enable-exif --enable-calendar --enable-intl --with-mhash --with-mcrypt=/usr/lib --enable-fpm --enable-xml --with-xsl --enable-xmlwriter --with-libxml-dir=/usr/ --disable-rpath --enable-safe-mode --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-zend-multibyte --with-curl --with-curlwrappers --enable-mbregex --enable-mbstring --with-pcre-regex --with-openssl --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-pear --enable-soap --enable-pdo --enable-phar --with-xmlrpc --with-fpm-user=fpm --with-fpm-group=fpm
make ZEND_EXTRA_LIBS='-liconv' (不加后面的参数会报错)
make install
cp php.ini-prodution /usr/local/php/etc/php.ini (PHP配置文件)
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm (拷贝php-fpm系统启动目录随机启动)
/sbin/chkconfig --add php-fpm (添加到开机服务列表)
安装PHP扩展库
9. install memcache-2.2.6.tar.gz
tar -xzvf memcache-2.2.6.tar.gz
cd memcache
/usr/local/php/bin/phpize (先执行此添加扩展库文件的命令)
./configure --enable-memcache --with-php-config=/usr/local/php/bin/php-config
--with-zlib-dir
make && make install
tar -xzvf imagemagick-6.6.9-5.tar.gz
cd imagemagick
./configure --preix=/usr/local/imagemagick
make && make install
11.install imagick-3.0.1.tar.gz
tar -xzvf imagick-3.0.1.tar.gz
cd imagick
./configure --with-php-config=/usr/local/php/bin/php-config --with-imagick=/usr/local/imagemagick/
make && make install
12. install eaccelerator-0.9.6.1.tar.fz
tar -xzvf eaccelerator-0.9.6.1.tar.gz
cd eaccelerator
./configure --enable-eaccelerator --with-php-config=/usr/local/php/bin/php-config
make && make install
13. 修改php.ini ,添加扩展库文件的目录及扩展库
vim /usr/local/php/etc/php.ini 找到“ ; extension_dir = "./" ” 这一行,在此行下面添加:
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/"
extension = "memcache.so"
extension = "imagick.so"
然后保存退出
14. 配置eaccelerator 加速PHP
mkdir -p /usr/local/php/eaccelerator_cache_dir 建立加速缓存目录
chmod 777 /usr/local/php/eaccelerator_cache_dir
vi /usr/local/php/etc/php.ini 在文件末尾添加如下
[eaccelerator]
zend_extension = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so"
eaccelerator.shm_size = "16"
eaccelerator.cache_dir = "/usr/local/php/eaccelerator_cache_dir"
eaccelerator.enable = "1"
eaccelerator.optimizer = "1"
eaccelerator.check_mtime = "1"
eaccelerator.debug = "0"
eaccelerator.filter = ""
eaccelerator.shm_max = "0"
eaccelerator.shm_ttl = "0"
eaccelerator.shm_prune_period = "0"
eaccelerator.shm_only = "0"
eaccelerator.compress = "1"
eaccelerator.compress_level = "9"
保存退出
以上参数只修改了缓存和扩展库的的路径,其他相关参数可自行参考修改
15. 测试 eaccelerator 是否成功
php -v 执行此命令,显示如下,即表示成功
PHP 5.3.6 (cli) (built: Apr 18 2011 22:50:21)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
with eAccelerator v0.9.6.1, Copyright (c) 2004-2010 eAccelerator, by eAccelerator
16.php-fpm配置 php的安装路径为/usr/local/php,已下配置文件路径都是以此路径为根路径,
17. php-fpm 启动命令
/usr/local/php/sbin/php-fpm (start|stop|reload)等命令,需要使用信号控制:18.install nginx 1.0.0.tar.gz
tar -xzvf nginx-1.0.0.tar.gz
groupadd nginx
useradd -g nginx -s /sbin/nologin -d /dev/null nginx
cd nginx
./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module --with-http_xslt_module --with-http_gzip_static_module --without-http_uwsgi_module --with-http_ssl_module --with-pcre --with-http_perl_module
/*本来想用自己安装perl 和 pcre模块,可是装上了后,一直configure 不过去,可能还是路径问题,只好用了RHEL6.0自带的Perl 和pcre*/
make && make install
19.配置Nginx
20.启动Nginx
cd /usr/local/nginx/sbin
./nginx (不用带参数即可启动)
浏览器访问 出现如下图,nginx 安装成功
21. 查看PHP extension 库文件命令
php -m
22.查看PHP.INI配置文件
php -i /usr/local/php/etc/php.ini
23.测试php 的fastcgi 是否运行正常
从网上下载一个php probe:test.php文件 放入/usr/local/nginx/html (网站根目录下)
访问: 我截图如下
测试php 于 mysql 的连接
htckiller20102011-04-19 16:58:28