Table of Contents

Software list

Installation instructions

Install ruby 1.8.7

wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p174.tar.gz
tar -xzvf ruby-1.8.7-p174.tar.gz
cd ruby-1.8.7-p174
./configure
make
sudo make install

Note - On Fedora, it was found that ruby.1.8.7-p174 does not compile openssl. So, please install a patch level above 299. The latest till date is - ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p358.tar.gz

Install rubygems 1.3.7

wget http://rubyforge.org/frs/download.php/70696/rubygems-1.3.7.tgz
tar -xzvf rubygems-1.3.7.tgz
cd rubygems-1.3.7
sudo ruby setup.rb

Install Phusion Passenger

sudo gem install passenger

If you want run the passenger behind apache then install passenger module for apache

export PATH=/opt/apache2/bin:$PATH (required to put apxs in path; set the apxs path as per your apache installation)
sudo passenger-install-apache2-module

#Add following in httpd.conf (the passenger PATH will vary depending on version installed, change LoadModule and PassengerRoot accordingly)

LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0
PassengerRuby /usr/local/bin/ruby

For development purpose a standalone version of Passenger should suffice

cd /path/to/your/webapp
passenger start

Setup CruiseControl.rb

[Note: This step is not required on the development machine]

wget http://rubyforge.org/frs/download.php/59598/cruisecontrol-1.4.0.tgz
tar -xzvf cruisecontrol-1.4.0.tgz

copy the cruisecontrol folder over to the /opt/apache2/htdocs/cruisecontrol and add following virtual host entry in the httpd.conf file

<VirtualHost 184.106.207.71:80>
  ServerName tracker.exphosted.com:80
  ErrorLog "logs/cruisecontrol-error.log"
  CustomLog "logs/cruisecontrol-access-log" common
  DocumentRoot /opt/apache2/htdocs/cruisecontrol/public
  <Directory /opt/apache2/htdocs/cruisecontrol/public>
    AllowOverride all
    Options -MultiViews
  </Directory>
  RailsDefaultUser root
</VirtualHost>

Restart the apache

sudo /opt/apache2/bin/httpd -k restart

The cruisecontrol dashboard should now be available at http://tracker.exphosted.com

Now add the crossbow/trunk to the cruisecontrol

cd /opt/apache2/htdocs/cruisecontrol
sudo ./cruise add crossbow-trunk -u file:///svnroot/crossbow/trunk

Install ImageMagick

ImageMagick is used by RMagick gem. The application uses RMagick to process the images.

sudo yum install ImageMagick
sudo yum install ImageMagick-devel

Install Memcached

Memcached is required as it will be used as the cache store for the rails application. Before installing memcached install the dependency required for it. Follow the below mentioned steps

sudo yum install libevent-devel

wget http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz
tar -zxvf memcached-1.4.5.tar.gz
cd memcached-1.4.5
./configure
make
make test
sudo make install
memcached    (or, memcached -d -P pidfile -l 127.0.0.1)

Once the memcached is installed and running we need to put some startup scripts to make sure that memcached server starts when the machine boots.

Create the configuration file

sudo touch /etc/memcached.conf

And put in:

#Memory
-m 16
# default port
-p 11211
# user to run daemon nobody/apache/www-data
-u nobody
# only listen locally
-l 127.0.0.1

Create the startups files

sudo touch /etc/init.d/memcached
sudo chmod +x /etc/init.d/memcached

And put in

#!/bin/bash
#
# memcached    This shell script takes care of starting and stopping
#              standalone memcached.
#
# chkconfig: - 80 12
# description: memcached is a high-performance, distributed memory
#              object caching system, generic in nature, but
#              intended for use in speeding up dynamic web
#              applications by alleviating database load.
# processname: memcached
# config: /etc/memcached.conf
# Source function library.
. /etc/rc.d/init.d/functions
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/bin/memcached
DAEMONBOOTSTRAP=/usr/local/bin/start-memcached
DAEMONCONF=/etc/memcached.conf
NAME=memcached
DESC=memcached
PIDFILE=/var/run/$NAME.pid
[ -x $DAEMON ] || exit 0
[ -x $DAEMONBOOTSTRAP ] || exit 0
RETVAL=0
start() {
 echo -n $"Starting $DESC: "
 daemon $DAEMONBOOTSTRAP $DAEMONCONF
 RETVAL=$?
 [ $RETVAL -eq 0 ] && touch $PIDFILE
 echo
 return $RETVAL
}
stop() {
 echo -n $"Shutting down $DESC: "
 killproc $NAME
 RETVAL=$?
 echo
 [ $RETVAL -eq 0 ] && rm -f $PIDFILE
 return $RETVAL
}
# See how we were called.
case "$1" in
 start)
  start
  ;;
 stop)
  stop
  ;;
 restart|reload)
  stop
  start
  RETVAL=$?
  ;;
 status)
  status $prog
  RETVAL=$?
  ;;
 *)
  echo $"Usage: $0 {start|stop|restart|status}"
  exit 1
esac
exit $RETVAL
sudo touch /usr/local/bin/start-memcached
sudo chmod +x  /usr/local/bin/start-memcached
#!/usr/bin/perl -w
# start-memcached
# 2003/2004 - Jay Bonci <jaybonci@debian.org>
# This script handles the parsing of the /etc/memcached.conf file
# and was originally created for the Debian distribution.
# Anyone may use this little script under the same terms as
# memcached itself.
use strict;
if ($> != 0 and $< != 0) {
 print STDERR "Only root wants to run start-memcached.\n";
 exit;
}
my $etcfile = shift || "/etc/memcached.conf";
my $params = [];
my $etchandle; 
# This script assumes that memcached is located at /usr/bin/memcached, and
# that the pidfile is writable at /var/run/memcached.pid
my $memcached = "/usr/local/bin/memcached";
my $pidfile = "/var/run/memcached.pid";
# If we don't get a valid logfile parameter in the /etc/memcached.conf file,
# we'll just throw away all of our in-daemon output. We need to re-tie it so
# that non-bash shells will not hang on logout. Thanks to Michael Renner for 
# the tip
my $fd_reopened = "/dev/null";
sub handle_logfile {
 my ($logfile) = @_;
 $fd_reopened = $logfile;
}
sub reopen_logfile {
 my ($logfile) = @_;
 open *STDERR, ">>$logfile";
 open *STDOUT, ">>$logfile";
 open *STDIN, ">>/dev/null";
 $fd_reopened = $logfile;
}
# This is set up in place here to support other non -[a-z] directives
my $conf_directives = {
 "logfile" => \&handle_logfile
};
if (open $etchandle, $etcfile) {
 foreach my $line (<$etchandle>) {
  $line =~ s/\#.*//go;
  $line = join ' ', split ' ', $line;
  next unless $line;
  next if $line =~ /^\-[dh]/o;
  if ($line =~ /^[^\-]/o) {
   my ($directive, $arg) = $line =~ /^(.*?)\s+(.*)/; 
   $conf_directives->{$directive}->($arg);
   next;
  }
  push @$params, $line;
 }
}
unshift @$params, "-u root" unless (grep $_ eq '-u', @$params);
$params = join " ", @$params;
if (-e $pidfile) {
 open PIDHANDLE, "$pidfile";
 my $localpid = <PIDHANDLE>;
 close PIDHANDLE;
 chomp $localpid;
 if (-d "/proc/$localpid") {
  print STDERR "memcached is already running.\n"; 
  exit;
 } else {
  `rm -f $localpid`;
 }
}
my $pid = fork();
if ($pid == 0) {
 reopen_logfile($fd_reopened);
 exec "$memcached $params";
 exit(0);
} elsif (open PIDHANDLE,">$pidfile") {
 print PIDHANDLE $pid;
 close PIDHANDLE;
} else {
 print STDERR "Can't write pidfile to $pidfile.\n";
}

Test the scripts

sudo /etc/init.d/memcached start

Starting memcached:                                        [  OK  ]

Add memcached as autostart daemon

# /sbin/chkconfig memcached on
# /sbin/chkconfig --list | grep memcached
memcached       0:off   1:off   2:on    3:on    4:on    5:on    6:off

Install JRE

Download the JRE RPM Installation for Linux (64-bit) from http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html#jre-6u23-oth-JPR The name of the downloaded file would be jre-6u23-linux-x64-rpm.bin

JRE is required to run Solr search server.

chmod a+x jre-6u23-linux-x64-rpm.bin
./jre-6u23-linux-x64-rpm.bin
rpm -ivvh jre-6u23-linux-amd64.rpm

Install headless OpenOffice

Headless OpenOffice is required for document conversion.

sudo yum install openoffice.org-base
sudo yum install openoffice.org-calc
sudo yum install openoffice.org-writer
sudo yum install openoffice.org-impress
sudo yum install openoffice.org-headless

Run it ( this is not required, as openoffice will be controlled by god)

soffice.bin -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard

Install headless Lireoffice (4.1.1)

Lireoffice preferred for document conversion.

For 64-bit machines


wget http://download.documentfoundation.org/libreoffice/stable/4.1.1/rpm/x86_64/LibreOffice_4.1.1_Linux_x86-64_rpm.tar.gz

#remove existing office installations
yum remove openoffice* libreoffice*

tar -xvf LibreOffice_4.1.1_Linux_x86-64_rpm.tar.gz

cd /tmp/LibreOffice_4.1.1_Linux_x86-64_rpm/RPMS/
yum localinstall *.rpm

For 32-bit machines

wget http://download.documentfoundation.org/libreoffice/stable/4.1.1/rpm/x86/LibreOffice_4.1.1_Linux_x86_rpm.tar.gz

#remove existing office installations
yum remove openoffice* libreoffice*

tar -xvf LibreOffice_4.1.1_Linux_x86_rpm.tar.gz

cd /tmp/LibreOffice_4.1.1_Linux_x86_rpm/RPMS/
yum localinstall *.rpm

Run it ( this is not required, as libreoffice will be controlled by god on dev,qa and prod)

libreoffice4.1 --headless --accept="socket,host=127.0.0.1,port=8100;urp;" --nofirststartwizard

Install ffmpeg (Ignore this. Please refer Install ffmpeg 0.8.10 below.)

ffmpeg is used to convert media files to flv format.

First of all, edit /etc/yum.repos.d/CentOS-Base.repo and add those lines at bottom of file:

[dag]
name=Dag RPM Repository for Centos
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
enabled=1

Install ffmpeg

sudo yum install ffmpeg ffmpeg-devel

If you get an error “Public key for faac-1.26-1.el5.rf.x86_64.rpm is not installed” then execute following command

sudo rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

Alternatively, you can import the GPG key for dag into rpm, and re-run "yum install ffmpeg ffmpeg-devel"

The key is at: http://apt.sw.be/RPM-GPG-KEY.dag.txt

Same has been shown below (copy the text below, including the BEGIN and END lines) to a file (eg: /etc/pki/rpm-gpg/RPM-GPG-KEY.dag and import into rpm with
"rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY.dag" command)

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.2.1 (GNU/Linux)

mQGiBD9JMT0RBAC9Q2B0AloUMTxaK73sD0cOu1MMdD8yuDagbMlDtUYA1aGeJVO6
TV02JLGr67OBY+UkYuC1c3PUwmb3+jakZd5bW1L8E2L705wS0129xQOZPz6J+alF
5rTzVkiefg8ch1yEcMayK20NdyOmhDGXQXNQS8OJFLTIC6bJs+7MZL83/wCg3cG3
3q7MWHm3IpJb+6QKpB9YH58D/2WjPDK+7YIky/JbFBT4JPgTSBy611+bLqHA6PXq
39tzY6un8KDznAMNtm+NAsr6FEG8PHe406+tbgd7tBkecz3HPX8nR5v0JtDT+gzN
8fM3kAiAzjCHUAFWVAMAZLr5TXuoq4lGTTxvZbwTjZfyjCm7gIieCu8+qnPWh6hm
30NgA/0ZyEHG6I4rOWqPks4vZuD+wlp5XL8moBXEKfEVOMh2MCNDRGnvVHu1P3eD
oHOooVMt9sWrGcgxpYuupPNL4Uf6B6smiLlH6D4tEg+qCxC17zABI5572XJTJ170
JklZJrPGtnkPrrKMamnN9MU4RjGmjh9JZPa7rKjZHyWP/z/CBrQ1RGFnIFdpZWVy
cyAoRGFnIEFwdCBSZXBvc2l0b3J5IHYxLjApIDxkYWdAd2llZXJzLmNvbT6IWQQT
EQIAGQUCP0kxPQQLBwMCAxUCAwMWAgECHgECF4AACgkQog5SFGuNeeYvDQCeKHST
hIq/WzFBXtJOnQkJGSqAoHoAnRtsJVWYmzYKHqzkRx1qAzL18Sd0iEYEEBECAAYF
Aj9JMWAACgkQoj2iXPqnmevnOACfRQaageMcESHVE1+RSuP3txPUvoEAoJAtOHon
g+3SzVNSZLn/g7/Ljfw+uQENBD9JMT8QBACj1QzRptL6hbpWl5DdQ2T+3ekEjJGt
llCwt4Mwt/yOHDhzLe8SzUNyYxTXUL4TPfFvVW9/j8WOkNGvffbs7g84k7a5h/+l
IJTTlP9V9NruDt1dlrBe+mWF6eCY55OFHjb6nOIkcJwKxRd3nGlWnLsz0ce9Hjrg
6lMrn0lPsMV6swADBQP9H42sss6mlqnJEFA97Fl3V9s+7UVJoAIA5uSVXxEOwVoh
Vq7uECQRvWzif6tzOY+vHkUxOBRvD6oIU6tlmuG3WByKyA1d0MTqMr3eWieSYf/L
n5VA9NuD7NwjFA1kLkoDwfSbsF51LppTMkUggzwgvwE46MB6yyuqAVI1kReAWw+I
RgQYEQIABgUCP0kxPwAKCRCiDlIUa4155oktAKDAzm9QYbDpk6SrQhkSFy016BjE
BACeJU1hpElFnUZCL4yKj4EuLnlo8kc=
=mqUt
-----END PGP PUBLIC KEY BLOCK-----

Install again

sudo yum install ffmpeg ffmpeg-devel

Post installation Check :

1. Please make sure that your ffmpeg version is the latest and it has libx264 and AAC support enabled.

The latest version till date is 0.8.10 If you are on Fedora or redhat the latest version you will get the latest version by default when you use yum command

To Check your configuration just type ffmpeg -i .

You should see something like this

ffmpeg -i
ffmpeg version 0.8.10, Copyright (c) 2000-2011 the FFmpeg developers
  built on Feb 29 2012 16:28:55 with gcc 4.6.2 20111027 (Red Hat 4.6.2-1)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib --mandir=/usr/share/man --arch=i686 --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables' --enable-bzlib --enable-libcelt --enable-libdc1394 --enable-libdirac --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab --enable-avfilter --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib --cpu=i686 --enable-runtime-cpudetect
  libavutil    51.  9. 1 / 51.  9. 1
  libavcodec   53.  8. 0 / 53.  8. 0
  libavformat  53.  5. 0 / 53.  5. 0
  libavdevice  53.  1. 1 / 53.  1. 1
  libavfilter   2. 23. 0 /  2. 23. 0
  libswscale    2.  0. 0 /  2.  0. 0
  libpostproc  51.  2. 0 / 51.  2. 0
ffmpeg: missing argument for option 'i'

It should have -enable-libx264. (AAC seems to by default always)

2. Once you have checked out the code, make sure that ffmpeg has a required preset for libx264. Get the preset from <CROSSBOW_RAILS_DIR>/config/ffmpeg and copy this file to your –datadir from the above ffmpeg command out put (generally /usr/share/ffmpeg).

Install ffmpeg 0.8.10

To upgrade the existing version or install from scratch, down the following rpms, packages and install in the given order

Mandatory (download and install) whether installing ffmpeg as rpm or from source code

wget ftp://rpmfind.net/linux/atrpms/el5-x86_64/atrpms/stable/libavcodec53-0.8.10-53.el5.x86_64.rpm
wget ftp://rpmfind.net/linux/atrpms/el5-x86_64/atrpms/stable/libavutil51-0.8.10-53.el5.x86_64.rpm
wget ftp://rpmfind.net/linux/atrpms/el5-x86_64/atrpms/stable/ffmpeg-devel-0.8.10-53.el5.x86_64.rpm
wget ftp://rpmfind.net/linux/atrpms/el5-x86_64/atrpms/stable/ffmpeg-0.8.10-53.el5.x86_64.rpm
wget ftp://rpmfind.net/linux/atrpms/el5-x86_64/atrpms/stable/libavdevice53-0.8.10-53.el5.x86_64.rpm
wget ftp://rpmfind.net/linux/atrpms/el5-x86_64/atrpms/stable/libavformat53-0.8.10-53.el5.x86_64.rpm
wget ftp://rpmfind.net/linux/atrpms/el5-x86_64/atrpms/stable/libavfilter2-0.8.10-53.el5.x86_64.rpm
wget ftp://rpmfind.net/linux/atrpms/el5-x86_64/atrpms/stable/libdc1394_22-2.0.2-11.el5.x86_64.rpm
wget ftp://rpmfind.net/linux/atrpms/el5-x86_64/atrpms/stable/libdc1394-devel-2.0.2-11.el5.x86_64.rpm
wget ftp://rpmfind.net/linux/atrpms/el5-x86_64/atrpms/stable/libdc1394-2.0.2-11.el5.x86_64.rpm
wget ftp://rpmfind.net/linux/atrpms/el5-x86_64/atrpms/stable/libdc1394_22-2.0.2-11.el5.i386.rpm
wget ftp://rpmfind.net/linux/atrpms/el5-x86_64/atrpms/stable/libpostproc51-0.8.10-53.el5.x86_64.rpm
wget ftp://rpmfind.net/linux/atrpms/el5-x86_64/atrpms/stable/libswscale2-0.8.10-53.el5.x86_64.rpm
wget ftp://rpmfind.net/linux/atrpms/el5-x86_64/atrpms/testing/libtheora-devel-1.1.1-13.el5.x86_64.rpm
wget ftp://rpmfind.net/linux/atrpms/el5-x86_64/atrpms/testing/libtheora0-1.1.1-13.el5.x86_64.rpm
wget ftp://rpmfind.net/linux/atrpms/el5-x86_64/atrpms/stable/xvidcore-devel-1.2.2-14.el5.x86_64.rpm
wget ftp://rpmfind.net/linux/atrpms/el5-x86_64/atrpms/testing/libtheoradec1-1.1.1-13.el5.x86_64.rpm
wget ftp://rpmfind.net/linux/atrpms/el5-x86_64/atrpms/stable/libva-0.32.0.2_1-0.32.0-4_sds2.el5.x86_64.rpm
wget ftp://rpmfind.net/linux/atrpms/el5-x86_64/atrpms/stable/libx264_118-0.118-17_20111111.2245.el5.x86_64.rpm
wget ftp://rpmfind.net/linux/atrpms/el5-x86_64/atrpms/stable/libxavs1-0.1.51-2.el5.x86_64.rpm
wget ftp://rpmfind.net/linux/atrpms/el5-x86_64/atrpms/stable/libxvidcore4-1.2.2-14.el5.x86_64.rpm
wget ftp://rpmfind.net/linux/atrpms/el5-x86_64/atrpms/stable/librtmp0-2.3-1.el5.x86_64.rpm
wget ftp://rpmfind.net/linux/atrpms/el5-x86_64/atrpms/testing/libtheoraenc1-1.1.1-13.el5.x86_64.rpm
wget ftp://rpmfind.net/linux/atrpms/el5-x86_64/atrpms/stable/libavutil50-0.7.11-52.el5.x86_64.rpm


yum install libswt3-gtk2.x86_64
rpm  -Uvvh libavutil51-0.8.10-53.el5.x86_64.rpm
rpm -Uvvh librtmp0-2.3-1.el5.x86_64.rpm
rpm -Uvvh libxvidcore4-1.2.2-14.el5.x86_64.rpm
rpm -Uvvh libxavs1-0.1.51-2.el5.x86_64.rpm
rpm -Uvvh libx264_118-0.118-17_20111111.2245.el5.x86_64.rpm
rpm -Uvvh libva-0.32.0.2_1-0.32.0-4_sds2.el5.x86_64.rpm
rpm -Uvvh libtheoradec1-1.1.1-13.el5.x86_64.rpm
rpm -Uvvh xvidcore-devel-1.2.2-14.el5.x86_64.rpm
rpm -Uvvh libtheoraenc1-1.1.1-13.el5.x86_64.rpm
rpm -Uvvh --force libtheora0-1.1.1-13.el5.x86_64.rpm
rpm -Uvvh libtheora-devel-1.1.1-13.el5.x86_64.rpm
rpm -Uvvh libswscale2-0.8.10-53.el5.x86_64.rpm
yum install libraw1394-devel.x86_64
yum install libraw1394-devel.i386
yum install libdc1394-devel.x86_64
rpm -Uvvh libavcodec53-0.8.10-53.el5.x86_64.rpm
rpm -Uvvh libavformat53-0.8.10-53.el5.x86_64.rpm
rpm -Uvvh libavfilter2-0.8.10-53.el5.x86_64.rpm
rpm -Uvvh libdc1394_22-2.0.2-11.el5.i386.rpm
rpm -Uvvh libdc1394_22-2.0.2-11.el5.x86_64.rpm
rpm -Uvvh libavdevice53-0.8.10-53.el5.x86_64.rpm
rpm -Uvvh --force libpostproc51-0.8.10-53.el5.x86_64.rpm
rpm -Uvvh --force ffmpeg-devel-0.8.10-53.el5.x86_64.rpm
rpm -Uvvh --force libavutil50-0.7.11-52.el5.x86_64.rpm

Installing ffmpeg as rpm

rpm -Uvvh ffmpeg-0.8.10-53.el5.x86_64.rpm

Installing ffmpeg from source (preferred to include libfaac), download and install as under

wget http://ffmpeg.org/releases/ffmpeg-0.8.10.tar.gz
wget ftp://rpmfind.net/linux/atrpms/el5-x86_64/atrpms/stable/libdc1394-devel-2.0.2-11.el5.x86_64.rpm
wget ftp://rpmfind.net/linux/atrpms/el5-x86_64/atrpms/stable/libnut-0.0.0-1_r661.el5.x86_64.rpm
wget ftp://ftp.pbone.net/mirror/atrpms.net/el5-x86_64/atrpms/stable/rtmpdump-devel-2.3-1.el5.x86_64.rpm
wget ftp://rpmfind.net/linux/atrpms/el5-x86_64/atrpms/stable/x264-devel-0.118-17_20111111.2245.el5.x86_64.rpm
wget ftp://rpmfind.net/linux/atrpms/el5-x86_64/atrpms/stable/x264-0.118-17_20111111.2245.el5.x86_64.rpm
wget ftp://rpmfind.net/linux/atrpms/el5-x86_64/atrpms/stable/xavs-devel-0.1.51-2.el5.x86_64.rpm
wget ftp://rpmfind.net/linux/atrpms/el5-x86_64/atrpms/stable/xavs-0.1.51-2.el5.x86_64.rpm

yum install yasm.x86_64 yasm-devel.x86_64
rpm -Uvvh --force libdc1394-devel-2.0.2-11.el5.x86_64.rpm
rpm -Uvvh libnut-0.0.0-1_r661.el5.x86_64.rpm
rpm -Uvvh rtmpdump-devel-2.3-1.el5.x86_64.rpm
rpm -Uvvh x264-devel-0.118-17_20111111.2245.el5.x86_64.rpm
rpm -Uvvh x264-0.118-17_20111111.2245.el5.x86_64.rpm
rpm -Uvvh xavs-devel-0.1.51-2.el5.x86_64.rpm
rpm -Uvvh xavs-0.1.51-2.el5.x86_64.rpm

tar -xzf ffmpeg-0.8.10.tar.gz
cd ffmpeg-0.8.10
./configure --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --enable-runtime-cpudetect --enable-gpl --enable-version3 --enable-postproc --enable-avfilter --enable-pthreads --enable-x11grab --enable-vdpau --disable-avisynth --enable-libdc1394 --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxavs --enable-libxvid --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' --disable-stripping --enable-libfaac --enable-nonfree
make
make install

Post installation check

1. Please make sure that your ffmpeg version is the latest and it has libx264, libfaac and AAC support enabled.

It should have -enable-libx264 and -enable-libfaac. (AAC seems to by default always)

2. Once you have checked out the code, make sure that ffmpeg has a required preset for libx264. Get the preset from <CROSSBOW_RAILS_DIR>/config/ffmpeg and copy this file to your –datadir from the above ffmpeg command out put (generally /usr/share/ffmpeg).

For installation on Ubuntu follow the steps given @ https://www.vimp.com/en/web/faq-installation/items/how-to-compile-ffmpeg-for-ubuntu-and-debian.html

Install ffmpeg 1.2 (Magic)

wget http://www.ffmpeg.org/releases/ffmpeg-1.2.tar.gz

tar xzvf ffmpeg-1.2.tar.gz
cd ffmpeg-1.2

./configure --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --enable-runtime-cpudetect --enable-gpl --enable-version3 --enable-postproc --enable-avfilter --enable-pthreads --enable-x11grab --enable-vdpau --disable-avisynth --enable-libdc1394 --enable-libgsm --enable-libmp3lame --enable-libnut --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxavs --enable-libxvid --disable-stripping --enable-libfaac --enable-nonfree

make
sudo make install

Post installation Check

1. check ffmpeg config(type ffmpeg -i and press ENTER). It should be some thing like this. (ignore the error asking for an input file)

 >> ffmpeg -i
ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers
  built on Apr 3 2013 14:18:32 with gcc 4.6.3 (GCC) 20120306 (Red Hat 4.6.3-2)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --enable-runtime-cpudetect --enable-gpl --enable-version3 --enable-postproc --enable-avfilter --enable-pthreads --enable-x11grab --enable-vdpau --disable-avisynth --enable-libdc1394 --enable-libgsm --enable-libmp3lame --enable-libnut --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxavs --enable-libxvid --disable-stripping --enable-libfaac --enable-nonfree
  libavutil 52. 18.100 / 52. 18.100
  libavcodec 54. 92.100 / 54. 92.100
  libavformat 54. 63.104 / 54. 63.104
  libavdevice 54. 3.103 / 54. 3.103
  libavfilter 3. 42.103 / 3. 42.103
  libswscale 2. 2.100 / 2. 2.100
  libswresample 0. 17.102 / 0. 17.102
  libpostproc 52. 2.100 / 52. 2.100
 

2. Once you have checked out the code, make sure that ffmpeg has a required presets for libx264. Three preset files (.ffpreset) should be present in the –datadir from the above ffmpeg command out put (generally /usr/share/ffmpeg). They should be same as the ones present in <CROSSBOW_RAILS_SOURCE_DIR>/config/ffmpeg. If the presets are not present in /usr/share/ffmpeg please copy them from <CROSSBOW_RAILS_SOURCE_DIR>/config/ffmpeg.

For installation on Ubuntu follow the steps given @ http://www.vimp.com/en/documentation-faq-article/items/howto-compile-ffmpeg-for-ubuntu-and-debian.html

Install SWFTools

pdf2swf utility available in SWFTools is used to convert a pdf document to SWF.

wget http://www.swftools.org/swftools-0.9.1.tar.gz
tar -xzf swftools-0.9.1.tar.gz

#make sure you have proper devel libs (you'll need giflib-devel.x86_64 if you've used yum groupinstall for development tools/libs)
sudo yum install gcc* automake zlib-devel libjpeg-devel giflib-devel freetype-devel

cd swftools-0.9.1
./configure
make
sudo make install

Install Pdf2json and mupdf

These tools are required to support serving documents on browsers that does not support flash e.g. on Ipad, iphone etc…

Install pdf2json

wget http://pdf2json.googlecode.com/files/pdf2json-0.61.tar.gz
mkdir pdf2json-0.61
cp pdf2json-0.61.tar.gz pdf2json-0.61
cd pdf2json-0.61
tar -zxvf pdf2json-0.61.tar.gz
./configure
make
sudo make install

Install mupdf

wget http://mupdf.googlecode.com/files/mupdf-1.2-source.zip
unzip mupdf-1.2-source.zip
cd mupdf-1.2-source
sudo make prefix=/usr/local install

Install and Configure Chat Server

Chat Installation and Configuration Steps

Install and Configure File Upload Module

File Upload Indicator Installation and Configuration

Process start/stop scripts on development build server

Solr process

NOTE: Edit file /home/expdevl/bin/solr_sss.sh to comment/uncomment following lines to reflect appropriate environments:

### Comment or Uncomment the rake environments as requied ###
#        rake sunspot:solr:start RAILS_ENV=staging
       rake sunspot:solr:start RAILS_ENV=development
       rake sunspot:solr:start RAILS_ENV=test

END NOTE:

Manage as expdevl user:

cd /home/expdevl/bin
./solr_sss.sh stop (to stop solr process/es)
./solr_sss.sh start (to start solr process/es)
./solr_sss.sh status (to check status of running solr process/es)

Manage as root:

service stop solr
service start solr
service status solr

Redis and Node

Manage as expdevl user:

cd /home/expdevl/bin
./redis_node_sss.sh stop
./redis_node_sss.sh start
./redis_node_sss.sh status

Manage as root:

service redis_nod stop
service redis_nod start
service redis_nod status

Apache httpd server

Manage as root:

service httpd stop
service httpd start
service httpd status

NOTE: If running as expdevl user, prefix the above with sudo /sbin/ (so end command would look like “sudo /sbin/service httpd status”)

soffice and svnserve

The svn server and soffice (headless) are started as part of system startup (along with the above processes). In case you need to restart (or start) if its not running, run the below as root or sudo:

svnserver

pkill -15 svnserve
/usr/bin/svnserve -d

soffice

pkill -15 soffice.bin
at now <<EOF
/usr/lib64/openoffice.org3/program/soffice.bin -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard
EOF

Setup the application on the staging

Add a Virtual hosts entry in the apache config file (httpd.conf) which looks similar to this

<VirtualHost 184.106.207.71:80>
  ServerName stage01.exphosted.com:80
  ServerAlias *.stage01.exphosted.com
  ErrorLog "logs/crossbow-error.log"
  CustomLog "logs/crossbow-access-log" common
  DocumentRoot /deploy/crossbow/current/public
  <Directory /deploy/crossbow/current/public>
    AllowOverride all
    Options -MultiViews
  </Directory>
  RailsEnv development
  RailsDefaultUser root
</VirtualHost>

To enable the application for https add another VirtualHost entry

<VirtualHost 184.106.207.71:443>
  ServerName stage01.exphosted.com
  ServerAlias *.stage01.exphosted.com
  ErrorLog "logs/crossbow-error.log"
  CustomLog "logs/crossbow-access-log" common
  DocumentRoot /deploy/crossbow/current/public
  <Directory /deploy/crossbow/current/public>
    AllowOverride all
    Options -MultiViews
  </Directory>
  RailsEnv development
  RailsDefaultUser root
  SSLEngine on
  SSLCertificateFile /etc/apache2/conf/server.crt
  SSLCertificateKeyFile /etc/apache2/conf/server.key

  SetEnvIf User-Aget ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
</VirtualHost>

To create a self-signed certificate use the following command

openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout server.key -out server.crt

This command generates 2 files, server.key and server.crt

For the application to work based on different subdomains, one needs to ensure that the DNS entries for these wildcard sub-domains points to the server where we have hosted the application. At present, it is on stage01.exphosted.com ( IP - 184.106.207.71). We should ensure that xyz.stage01.exphosted.com also resolves to the same IP address. (xyz - can be any subdomain). We need to make dns changes to ensure that *.stage01.exphosted.com points to 184.106.207.71

Setup the application locally

Install the gems used by the application

The Application uses bundler gem to manage the gem dependencies. Install the bundler gem first.

sudo gem install bundler

If you are on OSX, you will need to do the following to install the mysql gem

sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

Once the bundler gem is installed, from the application directory (eg: /deploy/crossbow/current), run

bundle install

This would install all the necessary gems required by the application.

If the rmagick gem fails, with an error: Installing rmagick (1.15.17) with native extensions /usr/local/lib/ruby/site_ruby/1.8/rubygems/installer.rb:483:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError) /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.17/./lib/rvg/misc.rb:321:in `get_type_metrics': unable to read font `/usr/share/fonts/default/TrueType/verdana.ttf' (Magick::ImageMagickError) and so on …, then install MS TrueType fonts (instructions for Redhat/CentOS)

yum install rpm-build cabextract
wget http://corefonts.sourceforge.net/msttcorefonts-2.0-1.spec
rpmbuild -ba msttcorefonts-2.0-1.spec
rpm -ivh /usr/src/redhat/RPMS/noarch/msttcorefonts-2.0-1.noarch.rpm
cd /usr/share/fonts/default/
ln -s ../msttcorefonts TrueType

If the sunspot_rails gem give a dependency error then install them using

$ sudo apt-get install libxslt-dev libxml2-dev   (on ubuntu)

sunspot-rails uses nokogiri gem. In case of any other issues when install the sunspot-rails gem refer to http://nokogiri.org/tutorials/installing_nokogiri.html

bundle install will end with this message:

Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

Database creation and loading seed data

Modify the database.yml file to reflect proper DB settings in development and test section and then run following rake task to create all the databases.

rake db:create:all

Once the DBs are created run the migrations to create necessary tables using following command.

rake db:migrate
rake db:migrate RAILS_ENV=test

Run the solr server in test environment

rake sunspot:solr:start RAILS_ENV=test

Run all the tests to make sure that the setup is done correctly

rake test

Run the rake db:seed to create the default company (This is just one time task)

rake db:seed

The default company will be created with name 'default' and subdomain as 'default'. No subdomain in url will refer to default company. e.g. http://localhost:3000 will take default company as a context. An admin user for the default company will also be created. The username for admin user is 'expertus_admin' and password is 'password'.

Create a company

- Click on “Create Company” tab option and enter the details for the company and email subdomains for the company

- The value of 'subdomain' field will have to be used in the url when access/refering to this company. e.g. if value of subdomain field is 'xxx' then http://xxx.demo.localhost.com:3000 will be the base url for the company.

- To run the application locally with the given subdomain you need to modify the /etc/hosts file to point xxx.localhost to loopback IP address 127.0.0.1. i.e. the hosts file should have following entry if companies with subdomain 'xxx' and 'yyy' is created. Note that the default.demo.localhost.com is for the default company.

127.0.0.1       demo.localhost.com default.demo.localhost.com airtelinc.demo.localhost.com