Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1422375
  • 博文数量: 122
  • 博客积分: 340
  • 博客等级: 一等列兵
  • 技术积分: 2967
  • 用 户 组: 普通用户
  • 注册时间: 2009-04-01 11:50
个人简介

说点什么呢

文章分类

全部博文(122)

文章存档

2018年(2)

2017年(1)

2015年(2)

2014年(30)

2013年(81)

2011年(5)

2009年(1)

分类: LINUX

2013-12-05 14:24:11

mysql+nginx+resin安装

(时间:2010-4-6

一、 Mysql 数据库的安装

# tar -zxvf mysql-5.1.42.tar.gz

mkdir /mysql/data

./configure --prefix=/usr/local/server/mysql  --sysconfdir=/usr/local/server/mysql/etc/my.cnf  --datadir=/mysql/data --with-big-tables  --with-plugins= partition,ftexample,archive,innodb_plugin,innobase,ndbcluster,myisam  --with-ndb-test --with-mysqlmanager --with-charset=utf8 --with-extra-charsets=all

# make

# make install

# mkdir /usr/local/server/mysql/etc

注意:

mysql5.2开始innodb的引擎默认是不安装的,如果要使用这个上引擎就需要在安装编译是加 with-plugins显示安装这个引擎,否这个引擎就不会安装的。

# cp /backup/software/mysql-5.1.42/support-files/my-medium.cnf /usr/local/server/mysql/etc/my.cnf

# mkdir /mysql/data/innodb

#./mysql_install_db --defaults-file=/usr/local/server/mysql/etc/my.cnf --basedir=/usr/local/server/mysql --datadir=/mysql/data --user=mysql --pid-file=/usr/local/server/mysql/var/mysql.pid --skip-locking --port=3306 --socket=/tmp/mysql.sock

# cp /backup/software/mysql-5.1.42/support-files/mysql.server /etc/init.d/mysql

# chkconfig add server

二、 PHP安装(Fast-CGI支持)

a. 安装libiconv  (这个软件包提供一个编码转换的动态库)

# tar -zxvf libiconv-1.13.1.tar.gz

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

# make 

# make install

       b. 安装libmcrypt-2.5.8 (为访问块设备和流设备提供统一的安全加密算法接口)

# wget http://blog.s135.com/soft/linux/nginx_php/mcrypt/libmcrypt-2.5.8.tar.gz

# tar -zxvf libmcrypt-2.5.8.tar.gz

# cd libmcrypt-2.5.8

# ./configure

# make

# make install

# /sbin/ldconfig

# ./configure --enable-ltdl-instal

# make

# make install

c. 安装mhash 生成和访问hash数据的动态库

# wget http://blog.s135.com/soft/linux/nginx_php/mhash/mhash-0.9.9.9.tar.gz

# tar -zxvf mhash-0.9.9.9.tar.gz

# cd mhash-0.9.9.9

# ./configure

# make && make install

# 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

d. 安装mcrypt 一个简单的加密程序

# wget http://blog.s135.com/soft/linux/nginx_php/mcrypt/mcrypt-2.6.8.tar.gz

# tar -zxvf mcrypt-2.6.8.tar.gz

# cd mcrypt-2.6.8

# /sbin/ldconfig

# ./configure

# make

# make install

e. 安装php-5.2.8

 # wget http://blog.s135.com/soft/linux/nginx_php/php/php-5.2.8.tar.gz

 # tar -zxvf php-5.2.8.tar.gz

 # wget http://blog.s135.com/soft/linux/nginx_php/phpfpm/php-5.2.8-fpm-0.5.10.diff.gz

 # gzip -cd php-5.2.8-fpm-0.5.10.diff.gz | patch -d php-5.2.8 -p1

 # cd php-5.2.8

 # ./configure --prefix=/usr/local/server/php --with-config-file-path=/usr/local/server/php/etc --with-mysql=/usr/local/server/mysql --with-mysqli=/usr/local/server/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl

  # make ZEND_EXTRA_LIBS='-liconv'

  # make install

# cp php.ini-dist /usr/local/server/php/etc/php.ini

   f. 安装memcache 内存共享缓充,一般用于集群上 (这个是PHPmemcached扩展)

# wget 

# tar -zxvf memcache-2.2.6.tgz

cd memcache-2.2.6

# /usr/local/server/php/bin/phpize

./configure  --with-php-config=/usr/local/server/php/bin/php-config

# make

# make install

注:

1、 memcachePHPmemcached扩展,个人理解就是客户端类似,这个是php的一个模块;

2、 最新版的memcache扩展模块的源代码的地址是:

3、 如果要在php中使用memcached 则需要安装memcached应用程序,类似如需要安装服务器端类似,这个软件包的地址是: 当前版本是1.4.5

4、 Memcached默认端口是11211

   g. 安装eaccelerator PHP的加速器

#wget %200.9.6.1/eaccelerator-0.9.6.1.zip

# unzip eaccelerator-0.9.6.1.zip

# eaccelerator-0.9.6.1

# /usr/local/server/php/bin/phpize

# ./configure --enable-eaccelerator=shared --with-php-config=/usr/local/server/php/bin/php-config

# make && make install

h.安装ImageMagic  支持对图片进行转化,修改的软件包,详情参看http://www.imagemagick.org/script/index.php网站

#  wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz

# tar -zxvf ImageMagick.tar.gz

# cd ImageMagick-6.6.7-10

# ./configure

# make && make install

i. 安装imagick PHP的一个扩展程序,它是默认的GD图象函数库的绝佳替代方案

# wget http://blog.s135.com/soft/linux/nginx_php/imagick/imagick-2.2.2.tgz

# tar zxvf imagick-2.2.2.tgz

# cd imagick-2.2.2

# /usr/local/server/php/bin/phpize

# ./configure --with-php-config=/usr/local/server/php/bin/php-config

# make && make install

j. 修改php.ini文件

# vi /usr/local/server/php/etc/php.ini

修改

extension_dir = "./"

extension_dir = "/usr/local/server/php/lib/php/extensions/no-debug-non-zts-20060613"

并在其下添加:

extension = memcache.so

extension = pdo_mysql.so

extension = imagick.so

修改 output_buffering = Off output_buffering = On

k. 配置eAccelerator加速PHP

# mkdir -p /jongo/webdata/eaccelerator_cache

[eaccelerator]

zend_extension="/usr/local/server/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"

eaccelerator.shm_size="128"

eaccelerator.cache_dir="/jongo/webdata/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"

l. 修改/usr/local/server/php/etc/ php-fpm.conf文件

# useradd www

修改

www

                        Unix group of processes

                        www

在这里修改启动fpm的用户和组为www 否则在启动的时候提示如下错误:

Starting php_fpm Apr 23 13:53:45.285639 [ERROR] fpm_unix_conf_wp(), line 124: please specify user and group other than root, pool 'default'

其它的根据需要来调整相应的参数。

三、 安装ngnix

# rpm -ihv pcre-4.5-3.i386.rpm

# rpm -ihv pcre-devel-4.5-3.i386.rpm

# tar -zxvf nginx-0.7.63.tar.gz

# cd nginx-0.7.63

#./configure --prefix=/usr/local/server/nginx --user=www --group=www  --with-poll_module --with-http_ssl_module --with-http_sub_module --with-http_dav_module  --with-http_gzip_static_module  --with-http_stub_status_module  --with-http_perl_module --with-mail --with-pcre

# make

# make install

# vi /usr/local/server/nginx/conf/nginx.conf

修改nginx的配置文件,修改其中运行的用户帐号,并在http块中添加如下内容:

 tcp_nodelay on;

  fastcgi_connect_timeout 300;
  fastcgi_send_timeout 300;
  fastcgi_read_timeout 300;
  fastcgi_buffer_size 64k;
  fastcgi_buffers 4 64k;
  fastcgi_busy_buffers_size 128k;
  fastcgi_temp_file_write_size 128k;

  gzip on;
  gzip_min_length  1k;
  gzip_buffers     4 16k;
  gzip_http_version 1.0;
  gzip_comp_level 2;
  gzip_types       text/plain application/x-javascript text/css application/xml;
  gzip_vary on;

server块里的location ~ \.php$ {里面修改成:

location ~ \.shtml$ {

            root           /jongo/webdata/web;

            fastcgi_pass   127.0.0.1:9000;

            fastcgi_index  index.shtml;

            include        fcgi.conf;

 }

然后建立fcgi.conf文件,内容如下:

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;

fastcgi_param  SERVER_SOFTWARE    nginx;

fastcgi_param  QUERY_STRING       $query_string;

fastcgi_param  REQUEST_METHOD     $request_method;

fastcgi_param  CONTENT_TYPE       $content_type;

fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;

fastcgi_param  REQUEST_URI        $request_uri;

fastcgi_param  DOCUMENT_URI       $document_uri;

fastcgi_param  DOCUMENT_ROOT      $document_root;

fastcgi_param  SERVER_PROTOCOL    $server_protocol;

fastcgi_param  REMOTE_ADDR        $remote_addr;

fastcgi_param  REMOTE_PORT        $remote_port;

fastcgi_param  SERVER_ADDR        $server_addr;

fastcgi_param  SERVER_PORT        $server_port;

fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect

fastcgi_param  REDIRECT_STATUS    200;

注意:

1、如果安装好后,没有任何错误提示,但是用游览器打开指定的页面,而显示为404找不到指定的页面时,则可能是上述的配置不正确造成的.

  2、关于如果设定上面的这个参数,可以参见在线手册

  3、实际上在安装好以后,不需要新建上面的fcgi.conf文件,在nginxconf目录下有一个fastcgi_params,只需要将这个文件包含进去就可以了。但是在这个文件里需要将fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;注释掉,否则会出现找不到页面的错误。然后,添加上fastcgi_param  SCRIPT_FILENAME  /$document_root$fastcgi_script_name; 这句重启服务就不会出现404错误了

四、 安装squid

wget 

useradd squid -M -c "Squid user" -d /dev/null -s /sbin/nologin

tar -zxvf squid-2.7.STABLE9.tar.gz 

cd squid-2.7.STABLE9  

./configure --prefix=/usr/local/server/squid --with-aufs-threads=32 --with-pthreads  --enable-disk-io --enable-storeio='aufs,diskd,ufs' --enable-icmp --enable-linux-tproxy  --disable-wccp --enable-kill-parent-hack --enable-snmp --enable-poll --enable-select --enable-auth=basic --with-aio --with-filedescriptors=655536  --enable-useragent-log  --enable-referer-log  --disable-htcp --enable-ssl --enable-linux-netfilter --enable-follow-x-forwarded-for --enable-x-accelerator-vary

make 

make install

阅读(878) | 评论(0) | 转发(0) |
0

上一篇:Linux 内核编译

下一篇:cobbler安装配置

给主人留下些什么吧!~~