How to Install Ruby on Rails on Ubuntu 18.04

r00t July 24, 2018

Install Ruby on Rails on Ubuntu 18.04

In this tutorial we are going to learn how to install Ruby on Rails on Ubuntu 18.04. We will also install and configure its prerequisites. Ruby on Rails is one of the most popular application stacks for developers who looking to create web apps with Ruby language. Using Ruby language combined with the Rails framework has been simplified the app development.

I recommend to use a minimal Ubuntu server setup as a basis for the tutorial, that can be a virtual or a root server image with an Ubuntu 18.04 LTS Bionic Beaver minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.

Install Ruby on Rails on Ubuntu 18.04 Bionic Beaver

Step 1. First, ensure your system and apt package lists are fully up-to-date by running the following:

apt-get update -y
apt-get upgrade -y

Step 2. Installing Ruby Version Manager.

First install the dependencies required for the RVM utility to build Ruby from source:

sudo apt install curl g++, gcc, autoconf, automake, bison, libc6-dev, libffi-dev, libgdbm-dev, libncurses5-dev, libsqlite3-dev, libtool, libyaml-dev, make, pkg-config, sqlite3, zlib1g-dev, libgmp-dev, libreadline-dev, libssl-dev

Next, run the following commands to install RVM:

gpg --keyserver hkp:// --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -sSL | bash -s stable

Start using RVM:

source ~/.rvm/scripts/rvm

Verify that Ruby was properly installed:

### ruby -v
ruby 2.5.1p57 (2018-07-21 revision 63029) [x86_64-linux]

Step 3. Installing Rails.

Rails is a Ruby gem and different versions of Rails are available for installation too. To install Rails you can use the command below:

gem install rails

Now that you’ve installed Rails, you can run the rails -v command to make sure you have everything installed correctly:

### rails -v
Rails 5.2.0

Step 5. Create a new Ruby on Rails application.

Now you are ready to start with your first Ruby on Rails project. Create a new Ruby on Rails application in your home directory:

cd ~
rails new firstMyproject

Congratulation’s! You have successfully install and configure Ruby on Rails on your Ubuntu 18.04 Bionic Beaver server. Thanks for using this tutorial for installing Ruby on Rails on Ubuntu system.

The Tags:

Leave a Comment

Comments are closed.