Installing Ruby on Rails on Ubuntu 14.04
in omd with 0 comment

Installing Ruby on Rails on Ubuntu 14.04

in omd with 0 comment

Ruby on Rails (RoR) is a framework written in the Ruby programming language that allows you to use Ruby in combination with HTML, CSS, and similar programming languages.

Step 1: Installing dependencies

First off, we'll need to install some dependencies. Update your apt-get first though:

apt-get update

Then, install these dependencies:

sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev

Step 2: Installing Git

To install Ruby, we'll need Git. To install Git:

apt-get install git

Configure Git:

git config --global "John Appleseed"
git config --global ""

Step 3: Installing rbenv

rbenv is a tool used for deploying Ruby environments.

To do this, execute the following commands after making sure you're in the ~ directory:

git clone git:// .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile

git clone git:// ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile

Step 4: Installing Ruby

After installing rbenv, we can install Ruby with it:

rbenv install -v 2.2.1
rbenv global 2.2.1

Install the the Bundler gem:

gem install bundler

Step 5: Installing RoR

After installing Ruby, we'll need to install RoR. You can install this gem:

gem install rails

Now check if Rails was successfully installed by checking its version:

rails -v

Step 6: Installing Node.js

In order to use some Rails features, we'll need a JavaScript runtime. We'll use Node.js. In order to install Node.js, add the repository to apt-get:

add-apt-repository ppa:chris-lea/node.js

Update your apt-get first, then install Node.js.

apt-get update
apt-get install nodejs

Step 7: Creating a test application

In order to determine if our Rails installation was successful, we're going to try to create a test application. Make sure you're in ~:

rails new test

Go to the ~/test directory which has just been created, then start your Rails application.

rails server --binding=YourServerIP

You can now visit your website at: http://YourServerIP:3000