Translate

November 14, 2012

Rails On Ubuntu 12.10 Quantal Quetzal

Here's my quick guide to setting up Rails on Ubuntu 12.10 Quantal Quetzal

Step 1: Install Dependencies
The following two commands are going to upgrade any existing packages we have as well as install the dependencies we are going to need to build Ruby properly.

$sudo apt-get -y update && sudo apt-get -y upgrade

$sudo apt-get -y install build-essential zlib1g-dev libssl-dev curl libreadline-dev git-core libcurl4-openssl-dev libyaml-dev python-software-properties 

Step 2: Install Ruby 1.9.3
Grab the latest version of Ruby from ruby-lang.org
The following commands will download the Ruby source, extract it, configure and compile it, and then finally install Bundler.

wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p286.tar.gz
tar -xvzf ruby-1.9.3-p286.tar.gz
cd ruby-1.9.3-p286/
./configure
make
sudo make install
sudo gem install bundler


Step 3: Install Your Database
Choose the database you like.

Install Postgres 9.2

sudo apt-add-repository ppa:pitti/postgresql
sudo apt-get -y update
sudo apt-get -y install postgresql-9.2 libpq-dev

OR

Install MySQL 5.X.XX

sudo apt-get install mysql-server mysql-client libmysqlclient-dev

Step 4: Install Nginx and Passenger
To install Nginx, We will use Passenger's install script. Its simple and straight.

gem install passenger
passenger-install-nginx-module

Just choose the first option (1) to download and install it for you. Accept any defaults it suggests, like installation directories.
After installation is finished, you'll get some configuration tips for Nginx to use Passenger.
Since we are compiling nginx from source, we don't get the start/stop script from Ubuntu's package.
You can get an init script from Linode's website and install it.

wget -O init-deb.sh http://library.linode.com/assets/660-init-deb.sh
sudo mv init-deb.sh /etc/init.d/nginx
sudo chmod +x /etc/init.d/nginx
sudo /usr/sbin/update-rc.d -f nginx defaults

Once that's done, you can start and stop nginx like:

sudo /etc/init.d/nginx start
sudo /etc/init.d/nginx stop

Rails On Ubuntu 12.10

gem install rails

and get started.

No comments: