How to Install Ruby 2.6 & Rails 6 on Ubuntu 19.04
In this tutorial, we'll see how we can install the latest version of Ruby v2.6 on Ubuntu 19.04 Disco Dingo. and next we'll see how to set up a development environment for Ruby on Rails 6.
As of this writing, the current stable version of Ruby is v2.6.3.
How to Install Ruby 2.6 on Ubuntu 19.04?
You can install Ruby 2.6 on Ubuntu 19.04 using three different methods:
- Using RVM or Ruby Version Manager
- From the source
So let's use
Installing Ruby 2.6 with
You first need to install
rbenv and then use it to install Ruby v2.6.
Open your terminal and run the following command:
$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv
We simply clone
rbenv GitHub repository into the
You need to have Git installed on your system. If not, simply run
sudo apt install git from your command line.
Next, run the following commands to set up
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc $ echo 'eval "$(rbenv init -)"' >> ~/.bashrc $ exec $SHELL
Next, you need to download the ruby-build plugin into the
plugins folder of
rbenv as follows:
$ git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
ruby-build plugin adds the
install command to
Note: You can also install
sudo apt-get install rbenv ruby-buildcommand.
Finally, you can install Ruby 2.6.3 using the following command:
$ rbenv install 2.6.3 $ rbenv global 2.6.3
This is the output in the terminal:
Downloading ruby-2.6.3.tar.bz2... -> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.3.tar.bz2 Installing ruby-2.6.3... Installed ruby-2.6.3 to /home/<user_name>/.rbenv/versions/2.6.3
If your installation fails, make sure you install the
$ sudo apt-get install -y libreadline-dev zlib1g-dev
You can check out your Ruby version using the following command:
$ ruby -v
Next, you need to install
$ gem install bundler
This will install
bundler, you need to run:
$ rbenv rehash
Installing Ruby on Rails 6 on Ubuntu 19.04
After installing Ruby 2.6, let's now see how we can install Ruby on Rails 6.
As of this writing, Rails 6.0.0.rc1 is released. Let's see how to install it. Open a new terminal and run the following command:
$ gem install rails -v 6.0.0.rc1
Next, run the following command to make the rails executable available:
$ rbenv rehash
That's it! You can verify your installed Rails version by running the following command:
$ rails -v # Rails 6.0.0.rc1
Congratulations! You have set up your development environment for Ruby on Rails 6 development.
Note: We also publish our tutorials on Medium and DEV.to. If you prefer reading in these platforms, you can follow us there to get our newest articles.
You can reach the author via Twitter:Follow @ahmedbouchefra
About the author
Get our Learn Angular 8 in 15 Easy Steps ebook in pdf, epub and mobi formats, plus a new Angular 8 tutorial every 3 days.
Read our other tutorials
- Angular Tutorial
- Laravel 6 Tutorial
- React Tutorial
- React Hooks Tutorial
- React Native Tutorial
- Webpack Tutorial
- PHP Tutorial
- Django Tutorial
- Java Spring Tutorial
- Rails 6 Tutorial
- Ionic 4 Tutorial
- TypeScript Tutorial
- Bootstrap 4 Tutorial
- Electron Tutorial
- Cordova Tutorial
- HTML Tutorial
- GraphQL Tutorial
- CSS Grid Layout Tutorial
- PWA Tutorial