Installation Guide (CentOS4+Apache+SCGI)

Version

This document applies to Rubricks-0.5.x
We don't check of operations for latest version.

Install CentOS 4.4

IP Address    : 192.168.0.10
Gateway       : 192.168.0.254
Host Name     : rubricks
Package Group : Minimal
SELinux       : Disabled

Turn off unused daemons

chkconfig acpid off
chkconfig anacron off
chkconfig apmd off
chkconfig atd off
chkconfig autofs off
chkconfig canna off
chkconfig cups off
chkconfig gpm off
chkconfig haldaemon off
chkconfig iiim off
chkconfig isdn off
chkconfig kudzu off
chkconfig mdmonitor off
chkconfig messagebus off
chkconfig microcode_ctl off
chkconfig netfs off
chkconfig nfslock off
chkconfig openibd off
chkconfig pcmcia off
chkconfig portmap off
chkconfig psacct off
chkconfig rawdevices off
chkconfig readahead off
chkconfig readahead_early off
chkconfig rhnsd off
chkconfig rpcgssd off
chkconfig rpcidmapd off
chkconfig sendmail off
chkconfig smartd off
chkconfig xfs off
chkconfig xinetd off

Update

rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-4
yum -y update

shutdown -r now

Install and Configure MySQL

yum -y install mysql mysql-server perl-DBI perl-DBD-MySQL
vi /etc/my.cnf
==[/etc/my.cnf]=============================================
[mysql]
user=root
socket=/var/lib/mysql/mysql.sock
default-character-set=utf8

[mysqladmin]
user=root
socket=/var/lib/mysql/mysql.sock

[mysqld]
user=mysql
socket=/var/lib/mysql/mysql.sock
default-character-set=utf8
datadir=/var/lib/mysql/data
old_passwords=1

[mysql.server]
user=mysql
default-character-set=utf8
basedir=/var/lib/mysql/data

[mysqld_safe]
pid-file=/var/lib/mysql/mysqld.pid
err-log=/var/log/mysqld.log

[client]
default-character-set=utf8

[mysqldump]
default-character-set=utf8
==[/etc/my.cnf]=============================================
mysql_install_db --defaults-file=/etc/my.cnf
chkconfig --level 2345 mysqld on
service mysqld start
mysql
mysql> REVOKE GRANT OPTION on *.* from ''@localhost;
mysql> DROP USER ''@rubricks;
mysql> DROP USER ''@localhost;
mysql> DROP DATABASE test;
mysql> CREATE DATABASE rubricks;
mysql> GRANT ALL ON rubricks.* TO rubricks@localhost;
mysql> CREATE DATABASE rubricks_test;
mysql> GRANT ALL ON rubricks_test.* TO rubricks@localhost;
mysql> EXIT

Install and Configure Ruby/Apache/SCGI

Caution'''
The RPMs at repos.rubricks.org are not official packages of CentOS.
So it's good for the trial, but we don't recommend to use for release.

yum -y install httpd httpd-suexec apr apr-util
vi /etc/yum.repos.d/u-jp.repo
==[/etc/yum.repos.d/u-jp.repo]==========================
[u-jp]
name=CentOS-$releasever - u-jp
baseurl=http://repos.u-jp.com/$basearch/
enabled=1
gpgcheck=0
==[/etc/yum.repos.d/u-jp.repo]==========================

yum -y install ruby rubygems rake mod_scgi cmdparse highline scgi_rails

vi /etc/httpd/conf/httpd.conf
==[/etc/httpd/conf/httpd.conf]==============================
LoadModule              access_module           modules/mod_access.so
LoadModule              log_config_module       modules/mod_log_config.so
LoadModule              mime_module             modules/mod_mime.so
LoadModule              dir_module              modules/mod_dir.so

ServerRoot              /etc/httpd
DocumentRoot            /var/www/html
PidFile                 /var/run/httpd.pid
User                    apache
Group                   apache
ServerName              192.168.0.10
Listen                  80
ServerSignature         Off
ServerTokens            Prod
DirectoryIndex          index.html
HostnameLookups         Off
TypesConfig             /etc/mime.types
DefaultType             text/plain
AddDefaultCharset       utf-8

<Directory />
    Options             None
    AllowOverride       None
    Deny                from all
</Directory>
<Directory /var/www/html>
    Options             None
    AllowOverride       None
    Allow               from all
</Directory>

Timeout                 300
KeepAlive               On
MaxKeepAliveRequests    10000
KeepAliveTimeout        10
StartServers            8
MinSpareServers         5
MaxSpareServers         20
ServerLimit             256
MaxClients              256
MaxRequestsPerChild     10000

ErrorLog                /var/log/httpd/error.log
LogLevel                error
LogFormat               "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
CustomLog               /var/log/httpd/access.log combined

#===[Setting for Rails]=========================================================#
<Directory /var/www/html/rubricks>
        Options         None
        AllowOverride   None
        Deny            from all
</Directory>
<Directory /var/www/html/rubricks/public>
        Options         FollowSymLinks
        AllowOverride   None
        Allow           from all
</Directory>

LoadModule              alias_module            modules/mod_alias.so
Alias                   /rubricks/images        /var/www/html/rubricks/public/images
Alias                   /rubricks/javascripts   /var/www/html/rubricks/public/javascripts
Alias                   /rubricks/stylesheets   /var/www/html/rubricks/public/stylesheets
Alias                   /rubricks/errors        /var/www/html/rubricks/public/errors

LoadModule              scgi_module             modules/mod_scgi.so
SCGIMount               /rubricks               127.0.0.1:9999
<LocationMatch "\/(stylesheets|images|javascripts|errors)\/.+\..+$">
        SCGIHandler     Off
</LocationMatch>
==[/etc/httpd/conf/httpd.conf]==============================
chkconfig --level 2345 httpd on
service httpd start

Setup Rubricks

wget http://rubyforge.org/frs/download.php/xxxxx/rubricks-0.X.X.tar.gz
tar -zxf rubricks-0.X.X.tar.gz -C /var/www/html/
chown -R apache.apache /var/www/html/rubricks
mv /var/www/html/rubricks/config/sample1_database.yml /var/www/html/rubricks/config/database.yml

cd /var/www/html/rubricks
scgi_ctrl config
export RAILS_ENV=production
rake migrate
ruby script/change_lang -l japanese
chown -R apache.apache /var/www/html/rubricks

vi /etc/init.d/scgi_rubricks
==[/etc/init.d/scgi_rubricks]===============================
#!/bin/bash
#
# chkconfig: - 84 16
# description: SCGI_RAILS
# processname: scgi_service

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

RETVAL=0
prog="scgi_rubricks"

RUBRICKS="/var/www/html/rubricks"
SCGICTRL="/usr/bin/scgi_ctrl"
TEMPFILE="/tmp/temp_rubricks_return_file.txt"
PASSWORD=""

if ! [ -x $SCGICTRL ]; then
        echo $SCGICTRL is not executable.
        exit 1
fi

start()
{
        if [ -e /var/lock/subsys/$prog ]; then
                echo "now $prog running!"
                echo "if $prog is not running, remove \"/var/lock/subsys/$prog\""
                exit 1
        fi
        echo -n $"Starting $prog:"
        cd $RUBRICKS
        $SCGICTRL start > /dev/null 2>&1
        RETVAL=$?
        if [ $RETVAL -eq 0 ]; then
                daemon true
                touch /var/lock/subsys/$prog
        else
                daemon false
        fi
        echo
}

stop()
{
        echo -n $"Stopping $prog: "
        echo $PASSWORD > $TEMPFILE
        cd $RUBRICKS
        $SCGICTRL stop < $TEMPFILE
        RETVAL=$?
        if [ $RETVAL -eq 0 ]; then
                daemon true
                rm -f /var/lock/subsys/$prog
        else
                daemon false
        fi
        rm -f $TEMPFILE
        echo
}

case "$1" in
        start)
                start
                ;;
        stop)
                stop
                ;;
        restart)
                stop
                start
                ;;
        *)
                echo $"Usage: $0 {start|stop|restart}"
                RETVAL=1
esac
exit $RETVAL
==[/etc/init.d/scgi_rubricks]===============================
chmod 755 /etc/init.d/scgi_rubricks
chkconfig --add scgi_rubricks
chkconfig --level 2345 scgi_rubricks on
service scgi_rubricks start

Start Rubricks

Access 'http://192.168.0.10/rubricks/' on your browser and get the Rubricks top page.
Login as administrator, account name and password is follows.

account name'admin'
password'pass'