It seems every tutorial I find on the net has something wrong with it. Its either out of date, or for the wrong operating system. Many of the tutorials show you how to install Ruby on Windows or Mac, but no real instructions on how to install it in a production environment. This strikes me as odd, I mean, whats the point of only having a development environment if you can’t eventually move it into production?
I found one tutorial that was on the right track, but sadly it was outdated, so here is an up-to-date version as of today, April 11, 2015.
First make sure your system is up to date:
1 |
sudo yum update -y |
If your system doesn;t already have curl, you will need to install it
1 |
sudo yum install curl -y |
Now we are going to install Ruby Version Manager (RVM)
1 2 |
command curl -sSL https://rvm.io/mpapis.asc | gpg2 --import - curl -L get.rvm.io | bash -s stable |
Once installed you can start RVM with the following command:
1 |
source /etc/profile.d/rvm.sh |
To make sure RVM has the dependencies it needs to run, run the following command:
1 |
rvm requirements |
It will take a few minuted to install everything it needs.
Now we can install Ruby – Go to RubyOnRails.org/download/ to find the latest version
1 |
rvm install 2.2 |
Then tell the system to use this version by default
1 |
rvm use 2.2 --default |
RubyGems was already installed with the latest version of Ruby, so no need to install it. If you want to make sure just type:
1 |
rvm rubygems current |
Finally we install Rails
1 |
gem install rails |
This takes a little while as it installs Rails and a few different Gems.
If you are using a server from Vultr and DigitalOcean make sure to make a snapshot before following any other tutorial online. It will save you reinstalling when the commands they tell you to type don;t work because they are 15 versions out of date.