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
安装必要软件包
yum -y install make gcc gcc-c++ ncurses-devel
下面的rpm只适用于CentOS-5 32位,其它的到http://mirrors.sohu.com/fedora-epel/这里查找。
rpm -Uvh http://mirrors.sohu.com/fedora-epel/5/i386/epel-release-5-4.noarch.rpm
下载软件
cd /tmp
wget -c http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.17.tar.gz/from/http://mysql.he.net/
wget -c http://www.cmake.org/files/v2.8/cmake-2.8.6.tar.gz
wget -c http://ftp.gnu.org/gnu/bison/bison-2.5.tar.gz
安装cmake和bison
cd /tmp
tar zxvf cmake-2.8.6.tar.gz
cd cmake-2.8.6
./bootstrap
make && make install
cd /tmp
tar zxvf bison-2.5.tar.gz
cd bison-2.5
./configure
make && make install
开始安装mysql
/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql
cd /tmp
tar xvf mysql-5.5.17.tar.gz
cd mysql-5.5.17/
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_DATADIR=/var/mysql/data \
-DMYSQL_USER=mysql
make && make install
一些相关设置
chmod +w /usr/local/mysql
chown -R mysql:mysql /usr/local/mysql
ln -s /usr/local/mysql/lib/libmysqlclient.so.16 /usr/lib/libmysqlclient.so.16
mkdir -p /var/mysql/
mkdir -p /var/mysql/data/
mkdir -p /var/mysql/log/
chown -R mysql:mysql /var/mysql/
cd support-files/
cp my-medium.cnf /var/mysql/my.cnf
cp mysql.server /etc/rc.d/init.d/mysqld
/usr/local/mysql/scripts/mysql_install_db \
–defaults-file=/var/mysql/my.cnf \
–basedir=/usr/local/mysql \
–datadir=/var/mysql/data \
–user=mysql
chmod +x /etc/init.d/mysqld
vi /etc/init.d/mysqld(编辑此文件,查找并修改以下变量内容:)
basedir=/usr/local/mysql
datadir=/var/mysql/data
chkconfig –add mysqld
chkconfig –level 345 mysqld on
service mysqld start
/usr/local/mysql/bin/mysqladmin password [new-password]
安装PHP
安装必要软件包
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
cd /tmp
groupadd www
useradd -s /sbin/nologin -g www www
wget -c http://cn2.php.net/get/php-5.3.8.tar.gz/from/this/mirror
tar xzvf php-5.3.8.tar.gz
cd php-5.3.8
./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
make && make install
cp php.ini-production /etc/php.ini
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
cp sapi/fpm/php-fpm.conf /usr/local/php/etc/php-fpm.conf
编辑php-fpm.conf,找到如下字段,删除前面的”;”号
pid = run/php-fpm.pid
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
找到:
listen = 127.0.0.1:9000
改为:
listen = /tmp/php-cgi.sock
chmod 755 /etc/init.d/php-fpm
chkconfig –add php-fpm
chkconfig –level 345 php-fpm on
/etc/init.d/php-fpm start
安装cherokee
yum -y install rrdtool
groupadd www
useradd -s /sbin/nologin -g www www
wget http://www.cherokee-project.com/cherokee-latest-tarball -O -| tar zxvf –
cd cherokee-1.2.101
./configure –prefix=/usr/local/cherokee –with-wwwroot=/home/www –with-wwwuser=www –with-wwwgroup=www
make && make install
wget https://www.centos.bz/wp-content/uploads/2011/11/cherokee -O /etc/init.d/cherokee
chmod +x /etc/init.d/cherokee
chkconfig –add cherokee
chkconfig –level 345 cherokee on
ln -s /usr/local/cherokee/sbin/cherokee-admin /usr/sbin/
service cherokee start
现在你已经可以访问默认的chreokee页面,执行cherokee-admin -b命令得到后台密码,并通过localhost:9090进入后台。关于配置cherokee支持PHP请看https://www.centos.bz/2011/11/cherokee-vhost-configure/