Table of Contents
<span class="warning"><p></p>
<div name="status-deprecated" data-unique="status-deprecated"></div><h2 id="status-deprecated"><strong>Status:</strong> Deprecated</h2>
This article covers a version of Ubuntu that is no longer supported. If you are currently operate a server running Ubuntu 12.04, we highly recommend upgrading or migrating to a supported version of Ubuntu:
- Upgrade to Ubuntu 14.04.
- Upgrade from Ubuntu 14.04 to Ubuntu 16.04
- Migrate the server data to a supported version
Reason: Ubuntu 12.04 reached end of life (EOL) on April 28, 2017 and no longer receives security patches or updates. This guide is no longer maintained.
Ruby on Rails is an application stack that provides developers with a framework to quickly create a variety of web applications.
Rails can be installed on a virtual private server with a variety of packages, but it can also be download manually, from source. This tutorial will go over the manual installation.
Setup
The steps in this tutorial require the user to have root privileges. You can see how to set that up in theInitial Server Setup with Ubuntu in steps 3 and 4.
Step One—Download Ruby
Before you begin, make sure that your repository is up to date:
sudo apt-get update
Once the update finishes, we can start the ruby download:
Create a directory for the ruby download:
mkdir ~/downloads
Then switch into that directory:
cd ~/downloads
And begin downloading ruby:
sudo wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz
Keep in mind that you can always access the latest version of ruby from the Ruby on Rails website: http://rubyonrails.org/download
Once you have downloaded ruby, download the dependancies to your virtual server. These will help later to make the installation as smooth as possible.
sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison nodejs subversion
After the dependancies are installed on your VPS, unzip the ruby file:
tar xvfz ruby-1.9.3-p0.tar.gz
Once the process has completed, enter into the downloaded directory.
cd ruby-1.9.3-p0
Step Two—Install Ruby
Inside the Ruby directory we have to run the three standard commands to install the software.
First:
./configure
“Configure” generates the make file and also checks that the server has all of the required dependancies. After that, still in the directory, you need to run the “make” command:
make
This may take a bit longer. Once it finishes, use make install:
sudo make install
Step Three—Install Gems
Once you have thoroughly unpacked the ruby code, the next step is to address the ruby gems. Since you installed the ruby package from the source, the gems should already be downloaded. However, you may need to update them:
sudo gem update --system
Step Four—Install Rails
After the gems are all up to date, you can complete the manual installation by setting up rails:
sudo gem install rails
With that, you have Ruby on Rails installed on your server.
Step Five—See Rails Online
After you have installed Ruby on Rails, you will be all set to start putting your ruby apps online.
To access the Ruby server, you simply need to make a new Ruby on Rails project:
rails new <i>project_name</i>
Enter into that directory:
cd <i>project_name</i>
And then turn on the rails server:
rails server
Step Six—RESULTS: Access Your Ruby Server
Once Ruby on Rails is installed, you can access your virtual private server by accessing your domain or IP address (ie. 12.34.56.789:3000).
The page should look like this.
Excellent—you have now installed Ruby on Rails from source.
See More
Once you have installed Ruby on Rails, you can proceed to Create a SSL Certificate for your site or Install an FTP server