Installing rails on ubuntu 10.04 Server

Installing rails on Ubuntu 10.04 Server was painful. Lessons I learnt were, don’t use the system ruby, don’t use the system gem, don’t try and use the system ruby with a downloaded copy of gem…

I ended up using rvm (Ruby Version Manager) for the install, you also need to install nodejs from an external repository…

sudo su # become root

apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion
sudo apt-get install python-software-properties 

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

bash < <(curl -s )

/usr/local/rvm/bin/rvm install 1.9.2
/usr/local/rvm/bin/rvm use 1.9.2

/usr/local/rvm/bin/gem install rails
/usr/local/rvm/bin/gem install execjs

exit # become a normal user again.

cd ~  # your project directory, could change user here.
rails new simpleweb # create a new rails project

cd simpleweb

rake db:create # create application databases (sqlite)

rails server # start the rails server!

Point a web browser at http://localhost:3000 and you should see the example Ruby site.

For blog updates and more follow me on twitter.