Install Ruby on Rails on Ubuntu

This will be the shortest guide on installing ruby on rails on ubuntu. No different ubuntu versions, no special tools involved.

Just a few shell commands and it will fly!

So we suppose you are a ruby on rails developer and want to setup ruby on rails on your machine. That is how you do it.

Disclaimer On this web site you might read about or get access to various kinds of software and technology, including but not limited to libraries, operating systems, software for communications, mobile phones and tablets, Android software and Linux, even cars and motorcycles, security and penetration testing software, software used in security research and forensics, some samples of software which can be used (elsewhere) for malicious or illegal purposes. You will read about or be provided with the ways to change it, to operate it and to use it. You might find advice and recommendations, which are only an opinion, and not a legal advice or commercial recommendation..
Bear in mind, please, that everything you do, you do solely at your own risk and responsibility. In no way the author of this web site, information, graphics and other materials presented here or related to it can be made liable or anyhow else responsible for your own actions as well as actions of any third party and their direct or indirect results or consequences with or without the use of this information as well as the software, technology and systems mentioned and/or presented here, no matter if developed by the author or by any third party.
In no way it is guaranteed that you will meet any suitability for any particular purpose, safety, security, legality or even simply functioning of the software and systems described here. You have to make sure each time yourself, whether what you do, is really what you intend to do, and that you are ready to be yourself responsible for. All the recommendations and experiences described here are the opinions of corresponding authors and are to be taken with care and own full responsibility.
The software provided on or through this web site, linked to from this web site or anyhow else related to this web site is provided by the corresponding authors on their own terms. We provide all the software here as is without any guarantees to you. You are responsible for deciding whether it is suitable for you or not. You are also responsible for all direct or indirect consequences of using this software.
Other web sites linked to from the current one are out of the author's control, we can not guarantee anything about their content, its quality or even legality. We can not be liable for any use of the linked to web sites or of the information presented there.
We reasonably try to keep this website running smoothly and to deliver information to the best of our knowledge corresponding to the state of the art at the times when the information is composed, usually presented together with the information, and out of good intents. We can not however guarantee and can not be liable for this website being temporarily or permanently unavailable, presenting unreliable information or software, or any other similar or not malfunctioning or functioning not up to your expectations as well as any consequences which might result from this site's operation.

Step one is getting some prerequisites.

Updated for Ubuntu 18.04

sudo apt-get update
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 libpq-dev

This install a system ruby and node from Ubuntu, it might be better to use RVM and NVM instead: https://rvm.io/ and https://github.com/nvm-sh/nvm

sudo apt-get install nodejs ruby-dev ruby

Next, you are ready to install bundler and rails.

sudo gem install bundler
sudo gem install rails

Rails will install some more gems once you create your first app:

rails new blog

After that you have one working ruby version with all the gear to run the recent stable rails apps.

Not all apps are created the same. Google for rvm or rbenv and consider using those if you need multiple ruby and rails versions installed in parallel. But for now if you followed the steps above you are already set to go with Ruby on Rails!

Please, take a note, that this is not a way to install ruby on rails for production! Hardening is also not discussed here.



Thanks for reading my blog!
Created: 21/06/2017
Last edited on: 08/06/2019
Your comment: