Status: This OS is no longer supported
This article, “How to Install LCMP on CentOS 6 / RHEL 6 / Scientific Linux 6,” covers a version of CentOS that reached end of life (EOL). The developing company no longer supports it. As such, we no longer maintain this guide. If you are currently operating a server running CentOS 6, we highly recommend contacting RoseHosting’s fully managed support. They can upgrade or migrate you to a supported version of AlmaLinux.

Installation Instructions
Apache is usually installed by default, so to check if Apache is running, execute the following command:
ps aux | grep httpd
If it is up and running, you need to stop the Apache service:
/etc/init.d/httpd stop
To disable Apache, execute the following command:
chkconfig httpd off
Or, to completely remove Apache from your virtual server, run the following command:
yum remove httpd
Download and install Cherokee and its dependencies:
cd /opt/ wget http://dl.fedoraproject.org/pub/epel/6/i386/cherokee-1.2.101-3.el6.i686.rpm wget http://dl.fedoraproject.org/pub/epel/6/i386/GeoIP-1.4.8-1.el6.i686.rpm wget http://dl.fedoraproject.org/pub/epel/6/i386/spawn-fcgi-1.6.3-1.el6.i686.rpm rpm -Uvh cherokee-1.2.101-3.el6.i686.rpm GeoIP-1.4.8-1.el6.i686.rpm spawn-fcgi-1.6.3-1.el6.i686.rpm chkconfig cherokee --add chkconfig cherokee on chkconfig --list | grep cherokee
The output should be as follows:
cherokee 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Install mysql:
yum install mysql mysql-server chkconfig --levels 235 mysqld on /etc/init.d/mysqld star
Create a password for the MySQL ‘root’ user:
mysqladmin -u root password xxxxxxxx
where ‘xxxxxxxx’ will be your new MySQL root password. Install rrdtool and php using the following command:
yum install rrdtool php php-bcmath php-cli php-common php-devel php-gd php-imap php-mbstring php-mcrypt php-mysql php-pdo php-pecl-apc php-pecl-memcache php-pear php-soap php-xml php-xmlrpc
Edit the ‘/etc/php.ini’ file and uncomment this line:
cgi.fix_pathinfo = 1
Execute the following commands:
vi /usr/bin/php-fastcgi
#!/bin/sh /usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -C 6 -u cherokee -f /usr/bin/php-cgi
chmod 755 /usr/bin/php-fastcgi
Create an init script like this:
vi /etc/init.d/php-fastcgi
#!/bin/bash
#
# php-fastcgi - Use PHP as a FastCGI process via nginx.
#
# chkconfig: - 85 15
# description: Use PHP as a FastCGI process via nginx.
# processname: php-fastcgi
# pidfile: /var/run/php-fastcgi.pid
. /etc/rc.d/init.d/functions
phpfastcgi="/usr/bin/php-fastcgi"
prog=$(basename php-cgi)
cgi='/usr/bin/php-cgi'
lockfile=/var/lock/subsys/php-fastcgi
start() {
[ -x $phpfastcgi ] || exit 5
echo -n $"Starting $prog: "
daemon $phpfastcgi
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
killproc $prog
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
stop
start
}
rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart)
$1
;;
status)
rh_status
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
exit 2
esac
chmod 755 /etc/init.d/php-fastcgi chkconfig --add php-fastcgi chkconfig php-fastcgi on service php-fastcgi start
Create a self signed certificate:
mkdir /etc/cherokee/ssl/ openssl req -days 720 -new -x509 -nodes -out /etc/cherokee/ssl/cherokee.pem -keyout /etc/cherokee/ssl/cherokee.pem
Edit the Cherokee configuration file (/etc/cherokee/cherokee.conf): Look for the following line:
server!bind!1!port = 80
And add the following lines:
server!bind!2!port = 443 server!bind!2!tls = 1
Add the following lines before # Icons:
vserver!1!rule!105!document_root = /var/www/cherokee vserver!1!rule!105!handler = fcgi vserver!1!rule!105!handler!balancer = round_robin vserver!1!rule!105!handler!balancer!source!10 = 1 vserver!1!rule!105!match = extensions vserver!1!rule!105!match!check_local_file = 0 vserver!1!rule!105!match!extensions = php,php5 vserver!1!rule!5!encoder!gzip = allow vserver!1!rule!5!handler = server_info vserver!1!rule!5!handler!type = just_about vserver!1!rule!5!match = directory vserver!1!rule!5!match!directory = /about source!1!env_inherited = 1 source!1!host = 127.0.0.1:9000 source!1!interpreter = /usr/bin/php-fastcgi source!1!nick = PHP-FastCGI source!1!type = interpreter
Restart the Cherokee service for the changes to take effect:
/etc/init.d/cherokee restart
Cherokee can be configured via web interface, which can be started using the following command:
cherokee-admin -b xxx.xxx.xxx.xxx
where ‘xxx.xxx.xxx.xxx’ is your virtual server IP address. The output of this command will show the login credentials and the URL of the web interface:
Login: User: admin One-time Password: 6rvl9m0HD4Zr7bP5 Web Interface: URL: http://Your_VPS-IP-address:9090
Congratulations
Cherokee’s admin will now be listening on port 9090 of your virtual server, so you can open http://Your_VPS-IP-address:9090 using a web browser: 

Could you elaborate on the reasons/advantages for the init script and /usr/bin/spawn-fcgi over the cherokee default of setting the interpreter to /usr/bin/php-cgi -b localhost:port ?
Unfortunately the directions for making phpfastcgi init service (/etc/init.d/php-fastcgi) as it seems, not working….
In centos 6.5 with epel & remi repos.
If you just copy/paste the init file, you getting:
[root@**** init.d]# chkconfig –add php-fastcgi
service php-fastcgi does not support chkconfig
and if you try to run it (/etc/init.d/php-fastcgi start) you getting:
Starting : /etc/init.d/php-fastcgi: line 4: daemon: command not found
So i think this tutorial/article, needs some fixing. Currently it does not working :)
“and is a great tutorial :) “
Add the following line:
#!/bin/bash
to the beginning of /etc/init.d/php-fastcgi
Hi There,
I get the same error….
[root@**** init.d]# chkconfig –add php-fastcgi
service php-fastcgi does not support chkconfig
and if you try to run it (/etc/init.d/php-fastcgi start) you getting:
Starting : /etc/init.d/php-fastcgi: line 4: daemon: command not found
If I just go by this and do everything else and try to open a php file it tries to download the file instead of running it.
Use the following command to enable php-fastcgi on boot:
As for the php-fastcgi init script, make sure it has the following line: