CentOS安装Cherokee php mysql

文章目录
[隐藏]

Cherokee 号称是目前最快的 Web 服务器软件,Cherokee 的功能包括支持 FastCGI、SCGI、PHP、CGI、TLS 及 SSL 加密连接,虚拟主机,授权认证,实时编码,载入均衡,与 Apache 兼容的 log 文件等等。Cherokee 内含一个名为 cherokee-admin 的工具,执行后,允许管理员直接通过浏览器进入 http://localhost:9090/ 对其进行管理和配置。比如,开启或关闭服务器,进行一般选项的设定,配置虚拟服务器、信息源、图标、Mime 类型等项目。下面以centos 5.5 32位系统为例介绍如何安装cherokee php mysql

安装mysql

安装必要软件包

  1. yum -y install make gcc gcc-c++ ncurses-devel

下面的rpm只适用于CentOS-5 32位,其它的到http://mirrors.sohu.com/fedora-epel/这里查找。

  1. rpm -Uvh http://mirrors.sohu.com/fedora-epel/5/i386/epel-release-5-4.noarch.rpm

下载软件

  1. cd /tmp
  2. wget -c http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.17.tar.gz/from/http://mysql.he.net/
  3. wget -c http://www.cmake.org/files/v2.8/cmake-2.8.6.tar.gz
  4. wget -c http://ftp.gnu.org/gnu/bison/bison-2.5.tar.gz

安装cmake和bison

  1. cd /tmp
  2. tar zxvf cmake-2.8.6.tar.gz
  3. cd cmake-2.8.6
  4. ./bootstrap
  5. make && make install
  6. cd /tmp
  7. tar zxvf bison-2.5.tar.gz
  8. cd bison-2.5
  9. ./configure
  10. make && make install

开始安装mysql

  1. /usr/sbin/groupadd mysql
  2. /usr/sbin/useradd -g mysql mysql
  3. cd /tmp
  4. tar xvf mysql-5.5.17.tar.gz
  5. cd mysql-5.5.17/
  6. cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
  7. -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
  8. -DDEFAULT_CHARSET=utf8 \
  9. -DDEFAULT_COLLATION=utf8_general_ci \
  10. -DWITH_EXTRA_CHARSETS=all \
  11. -DWITH_MYISAM_STORAGE_ENGINE=1 \
  12. -DWITH_INNOBASE_STORAGE_ENGINE=1 \
  13. -DWITH_MEMORY_STORAGE_ENGINE=1 \
  14. -DWITH_READLINE=1 \
  15. -DENABLED_LOCAL_INFILE=1 \
  16. -DMYSQL_DATADIR=/var/mysql/data \
  17. -DMYSQL_USER=mysql
  18.  
  19. make && make install

一些相关设置

  1. chmod +w /usr/local/mysql
  2. chown -R mysql:mysql /usr/local/mysql
  3. ln -s /usr/local/mysql/lib/libmysqlclient.so.16 /usr/lib/libmysqlclient.so.16
  4. mkdir -p /var/mysql/
  5. mkdir -p /var/mysql/data/
  6. mkdir -p /var/mysql/log/
  7. chown -R mysql:mysql /var/mysql/
  8. cd support-files/
  9. cp my-medium.cnf /var/mysql/my.cnf
  10. cp mysql.server /etc/rc.d/init.d/mysqld
  11.  
  12. /usr/local/mysql/scripts/mysql_install_db \
  13. --defaults-file=/var/mysql/my.cnf \
  14. --basedir=/usr/local/mysql \
  15. --datadir=/var/mysql/data \
  16. --user=mysql
  17.  
  18. chmod +x /etc/init.d/mysqld

vi /etc/init.d/mysqld(编辑此文件,查找并修改以下变量内容:)

  1. basedir=/usr/local/mysql
  2. datadir=/var/mysql/data
  1. chkconfig --add mysqld
  2. chkconfig --level 345 mysqld on
  3. service mysqld start
  4. /usr/local/mysql/bin/mysqladmin password [new-password]

安装PHP

安装必要软件包

  1. yum -y install libxml2-devel openssl-devel curl-devel libjpeg-devel libpng-devel autoconf pcre-devel libtool-libs freetype-devel gd libmcrypt-devel zlib-devel zip unzip gettext

开始安装php

  1. cd /tmp
  2. groupadd www
  3. useradd -s /sbin/nologin -g www www
  4. wget -c http://cn2.php.net/get/php-5.3.8.tar.gz/from/this/mirror
  5. tar xzvf php-5.3.8.tar.gz
  6. cd php-5.3.8
  7. ./configure --prefix=/usr/local/php --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d  --with-libxml-dir --with-openssl --with-zlib --with-curl --enable-ftp --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir  --with-freetype-dir --enable-gd-native-ttf --with-gettext --enable-mbstring --with-mcrypt  --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --without-pear
  8. make && make install
  9. cp php.ini-production /etc/php.ini
  10. cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
  11. cp sapi/fpm/php-fpm.conf /usr/local/php/etc/php-fpm.conf

编辑php-fpm.conf,找到如下字段,删除前面的”;”号

  1. pid = run/php-fpm.pid
  2. pm.start_servers = 20
  3. pm.min_spare_servers = 5
  4. pm.max_spare_servers = 35

找到:

  1. listen = 127.0.0.1:9000

改为:

  1. listen = /tmp/php-cgi.sock
  1. chmod 755 /etc/init.d/php-fpm
  2. chkconfig --add php-fpm
  3. chkconfig --level 345 php-fpm on
  4. /etc/init.d/php-fpm start

安装cherokee

  1. yum -y install rrdtool
  2. groupadd www
  3. useradd -s /sbin/nologin -g www www
  4. wget http://www.cherokee-project.com/cherokee-latest-tarball -O -| tar zxvf -
  5. cd cherokee-1.2.101
  6. ./configure --prefix=/usr/local/cherokee --with-wwwroot=/home/www --with-wwwuser=www --with-wwwgroup=www
  7. make && make install
  8. wget https://www.centos.bz/wp-content/uploads/2011/11/cherokee -O /etc/init.d/cherokee
  9. chmod +x /etc/init.d/cherokee
  10. chkconfig --add cherokee
  11. chkconfig --level 345 cherokee on
  12. ln -s /usr/local/cherokee/sbin/cherokee-admin /usr/sbin/
  13. service cherokee start

现在你已经可以访问默认的chreokee页面,执行cherokee-admin -b命令得到后台密码,并通过localhost:9090进入后台。关于配置cherokee支持PHP请看https://www.centos.bz/2011/11/cherokee-vhost-configure/

转载请保留原文链接:Linux运维日志 » CentOS安装Cherokee php mysql

打赏

如果此文对你有所帮助,请随意打赏鼓励作者^_^