Install ruby 2.0.0, rails 4.0.0 with rbenv on Ubuntu 12.04 LTS

I use rbenv instead of rvm siimply because rails recommended it.  If you had set up rails/ruby/rvm on your machine before, remember to uninstall them first.

To uninstall ruby

$ sudo apt-get remove ruby

To uninstall rvm

$ rvm implode

also remember to clear rvm reference in .profile .bashrc .bash_profile (hope I don’t miss any).

Let’s get started, assuming git is installed.

Update your ubuntu

$ sudo apt-get update
$ sudo apt-get upgrade

Install common libraries: (though I’m not sure whether all are necessary)

$ sudo apt-get install build-essential libreadline-dev libssl-dev zlib1g-dev libxml2-dev libxslt-dev

Install javascript runtime

$ sudo apt-add-repository -y ppa:chris-lea/node.js
$ sudo apt-get -y update
$ sudo apt-get -y install nodejs

Install rbenv

$ git clone ~/.rbenv
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile
$ echo 'eval "$(rbenv init -)"' >> ~/.profile
$ exec $SHELL -l$ source ~/.profile

check rbenv

$ rbenv

Install ruby-build

$ git clone ~/.rbenv/plugins/ruby-build

Install ruby

$ rbenv install 2.0.0-p247
$ rbenv global 2.0.0-p247
$ rbenv rehash

check ruby

$ ruby -v

Install rails

$ gem install rails --version 4.0.0 --no-ri --no-rdoc
$ rbenv rehash

check rails

$ rails -v

Credit:  I want to thank Tim Abell as I borrow his steps from installing rails. I spent quite sometime on figuring out to use the rbenv rehash after gem install rails. You can check Tim’s post at:


Install Tracmor on LAMP (ubuntu 12.04 LTS)

1. Install ubuntu 12.04

2. Install LAMP, ref:

$ sudo apt-get install tasksel
$ sudo tasksel install lamp-server

3. Configure LAMP, ref:

$ sudo usermod -a -G www-data 
$ sudo chgrp -R www-data /var/www
$ sudo chmod -R g+w /var/www

log out and log in to reflect changes, also install the extra


$ sudo apt-get install php5-curl

Mod rewrite:

$ sudo a2enmod rewrite

GD2 Graphics Lib:

$ sudo apt-get install php5-gd


$ sudo apt-get install php5-xsl

4. download Tracmor from Github, extract the file to /var/www

5. open MySQL, create database ‘tracmor’ source ‘create.sql’ and ‘data.sql’ in folder /data_model

6. setup in folder /includes, ref: INSTALL in tracmor folder.

Remember to put ‘/var/www’ in __DOC_ROOT__ , and put ‘/<tracmor folder name>  in __SUBDIRECTORY__.

change // Location of tmp directory as DEFINE(‘__TRACMOR_TMP__’, __SUBDIRECTORY__ . ‘/tmp’);

Useful Command:

Restart Apache

$ sudo service apache2 restart

Trouble Shooting

1. If there’s something wrong about PHP, reinstall PHP 5

$ sudo apt-get install libapache2-mod-php5

Enable this module by doing

$ sudo a2enmod php5

2. If you have this error

apache2: Could not determine the server’s fully qualified domain name, using for ServerName

then use a text editor such as “sudo nano” at the command line to create a new file,

$ sudo nano /etc/apache2/conf.d/fqdn

then add

ServerName localhost

to the file and save. This can all be done in a single command with the following:

$ echo "ServerName localhost" | sudo tee /etc/apache2/conf.d/fqdn

3. If you happen to encounter this error after signing out

dir(/tmp,/tmp) [function.dir]: The system cannot find the file specified. (code: 2)

add this line to the file “” in folder /includes/:

QFileFormStateHandler::$StatePath = "your path to/Tracmor";