Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mzaidannas/ba64b2538ca8a3a494f11b9ec7997bba to your computer and use it in GitHub Desktop.
Save mzaidannas/ba64b2538ca8a3a494f11b9ec7997bba to your computer and use it in GitHub Desktop.
Ubuntu setup for rails

Skip this section, unless you know what you are doing

sudo dpkg --add-architecture i386
sudo add-apt-repository ppa:danielrichter2007/grub-customizer
wget --quiet -O - https://dl.winehq.org/wine-builds/Release.key | sudo apt-key add -
sudo apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/
sudo apt update
sudo apt install -y unace unrar zip unzip p7zip-full p7zip-rar sharutils rar uudeview mpack arj cabextract file-roller

Actual Development Setup

Essentials

sudo apt install -y curl git gitk

RVM

curl -L get.rvm.io | bash -s stable 

ALTERNATIVELY, if you face any issues than follow https://github.com/rvm/ubuntu_rvm and skip this section)

  • CAREFULLY READ OUTPUT OF THIS COMMAND, THERE WILLL BE FAILURE PROBABLY, AND IT WILL TELL HOW TO FIX THIS FAILURE
  • IT WILL GIVE SOME LINE SIMILAR TO BELOW LINE, SEE PREVIOUS COMMAND OUTPUT FOR ACTUAL COMMAND
gpg2 --keyserver hkp://keys.gnupg.net --recv-keys XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  • AFTER FOLLOWING INSTRUCTIONS RE-RUN THE COMMAND I.E:
curl -L get.rvm.io | bash -s stable
rvm -v

if it fails, try closing and re-opening terminal window

rvm list

Other dependencies

sudo apt install build-essential openssl 'libreadline[0-9]'
rvm install 2.5.8
rvm install 2.7.2
curl -sL https://deb.nodesource.com/setup_15.x | sudo -E bash - 
#(https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions for details of above command)
sudo apt install -y nodejs
gem -v
rvm list
echo "source \$HOME/.rvm/scripts/rvm" >> ~/.bash_profile
rvm -v
rvm list
rvm use 2.7.2 --default
rvm list
gem -v
gem install bundler nokogiri rails
bundle (only if you are in the rails project directory)

Postgres and PGAdmin4

echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt update

For simple instalation

sudo apt install -y postgresql pgadmin4

For PL/Python support*

sudo apt install -y postgresql postgresql-13 postgresql-plpython-13 pgadmin4 libpq-dev

Below are common steps*

sudo -u postgres psql postgres 
# \password postgres (SET PASSWORD FOR POSTGRES USER)
# \q (to exit psql terminal)
exit

Redis

sudo apt install -y redis-server

Memcached

sudo apt install  -y memcached

GDebi and linters for stylesheets(css/scss/sass), html, javascript and coffeescript

sudo apt install -y gdebi
sudo npm install -g eslint stylelint coffeelint htmlhint

Random (not needed 99% of times)

sudo ln -s ~/git_rails /usr/bin/git_rails

IF YOU NEED, postgres backup and restore...(with roles etc)

pg_dumpall -U dbname -h localhost > db_backupall(to backup from old system)

psql -f db_backupall postgres -U postgres -h localhost (to restore on new system)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment