in Nov 2016 I’ve published article Setup Ubuntu 16.04 for Ruby on Rails app (Cheatsheet) and it was quite a hit. As I’m reinstalling by Lenovo with fresh Ubuntu 18.04 I’ve decided to write up fresh revised article related to latest Feb 2019 technologies

Basic tools:

sudo apt install -y curl git

Generate ssh key

ssh-keygen -t rsa -b 4096 -C "[email protected]"

Install RVM + Ruby

gpg --keyserver hkp:// --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
sudo apt-get install software-properties-common
sudo apt-add-repository -y ppa:rael-gc/rvm
sudo apt-get update
sudo apt-get install rvm

As a next step RVM recommends to configure terminal to run “Login shell”:

At terminal window, click Edit > Profile Preferences, click on Title and Command tab and check Run command as login shell. source of info

But to be honest because I use Cinnamon IDE I didn’t have to do it it works ok without. I just needed do a laptop restart othewise I’ll get rvm command not found

rvm install 2.5.3

Install PostgreSQL 10.6

at the time Postgres 11.2 is available but since AWS RDS is only supporting 10.6 I don’t see the point going super edge.

# works without adding sources
sudo apt-get update
sudo apt-get install postgresql-10 postgresql-contrib libpq-dev
psql --version                      # psql (PostgreSQL) 10.6 (Ubuntu 10.6-0ubuntu0.18.04.1)

setup Postgres user

# bash
sudo -u postgres psql 
# inside psql

CREATE USER myuser WITH PASSWORD 'myPassword';

# if you want him to be superuser

# if you just want him to be able to create DB

be sure to set credentials in config/database.yml inside your Rails project and now you can run rake db:create or rake db:migrate

Install Redis

sudo add-apt-repository ppa:chris-lea/redis-server
sudo apt-get update
sudo apt-get install redis-server
redis-server --version     # Redis server v=5.0.3 sha=00000000:0 malloc=jemalloc-5.1.0 bits=64 build=45d60903d31a0894

Install MongoDB

Mongod v v3.6.3

# works without adding sources
sudo apt-get update
sudo apt install mongodb
sudo systemctl start mongodb

If you want Mongo DB v 4 check

Install Elasticsearch

sudo apt-get update

# install java
sudo apt-get install default-jre  default-jdk
wget -qO - | sudo apt-key add -
echo "deb stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list
sudo apt update
sudo apt install elasticsearch

sudo systemctl status elasticsearch.service  # status
sudo systemctl start elasticsearch.service   # start server
sudo systemctl stop elasticsearch.service    # stop server

curl -X GET "localhost:9200"


Main ref:

sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL | sudo apt-key add
sudo add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install docker-ce

# add your user to docker user group (so you don't have to sudo all the time)
sudo groupadd docker
sudo usermod -aG docker $USER
# log out and log back in

other ref:

Docker compose

sudo curl -L`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version    # docker-compose version 1.23.2, build 1110ad01


if you need image processing inside your Rails app with gems like Carrierwave, ActiveStorage or Dragonfly

sudo apt-get update
sudo apt-get install  imagemagick libmagickcore-dev libxslt-dev libmagickwand-dev


ActiveStorage in Rails 6 is using gem image_processing which requires vips lib

sudo apt install libvips libvips-dev libvips-tools


FATAL: Listen error: unable to monitor directories for changes.
Visit for info on how to fix this.


echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

Ok that’s it end of article. Down bellow is just some additional software you may need (or not)

DevOps tools

Heroku Toolbelt

sudo snap install --classic heroku


sudo apt update
sudo apt install awscli

AWS ElasticBenstalk CLI

sudo apt install python-pip
pip install awsebcli --upgrade --user

add this to your .bash.rb

export PATH=~/.local/bin:$PATH

Azure CLI

sudo apt-get install apt-transport-https lsb-release software-properties-common dirmngr -y
AZ_REPO=$(lsb_release -cs)
echo "deb [arch=amd64] $AZ_REPO main" | sudo tee /etc/apt/sources.list.d/azure-cli.list
sudo apt-key --keyring /etc/apt/trusted.gpg.d/Microsoft.gpg adv --keyserver  --recv-keys BC528686B50D79E339D3721CEB3E94ADBE1229CF
sudo apt-get update
sudo apt-get install azure-cli


sudo apt-get update
sudo apt install ansible

note this install ansible-vault as well

My personal favorite utilities

# vim
sudo apt install -y  vim vim-gnome

# 7 zip full for encrypting file archives
sudo apt install p7zip-full

Janus Vim

Janus Vim is powerful extension of Vim to give it IDE like experienc

curl -L | bash

Set up SSH server (Optional)

I have a history of destroying my laptops in accidents, so often I have two laptops that I keep up to date with in case I damage one. In order to do that I have SSH server on both of them so I can connect from other to it and do updates as it it was a server when needed.

So this is only optional if you need SSH server on your laptop. If you don’t then don’t do this

Given you are configuring SSH server on Laptop1:

# run on Laptop1:

sudo apt install openssh-server
sudo vim  /etc/ssh/sshd_config       # not the simmilary named /etc/ssh/ssh_config

and make sure values are set to :

PubkeyAuthentication yes
PasswordAuthentication no

Copy content of public key of the Laptop2 ~/.ssh/ to ~/.ssh/authorized_keys of the Laptop1

then run this on Laptop1:

sudo systemctl restart sshd.service

now try to ssh from Laptop2 to Laptop1