Skip to content

Instantly share code, notes, and snippets.

@chakming
Forked from brycejohnston/ubuntu1804_ruby_elixir.md
Created September 12, 2018 13:18
Show Gist options
  • Save chakming/501ea99bfb07d535f656aecf587d7180 to your computer and use it in GitHub Desktop.
Save chakming/501ea99bfb07d535f656aecf587d7180 to your computer and use it in GitHub Desktop.
Ubuntu 18.04 Ruby and Elixir Development Setup

Ubuntu 18.04 Ruby and Elixir Development Setup

Guide to setting up a new Ubuntu 18.04 dev environment with Ruby and Elixir installed with the asdf version management tool.

Update system and install prerequisite packages

Some of these packages may already be installed

sudo apt-get install mercurial make binutils bison gcc \
 build-essential git curl zlib1g-dev openssl libssl-dev libreadline-dev \
 libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev \
 software-properties-common wget dnsutils vim zip unzip screen tmux htop \
 libffi-dev redis-server imagemagick ntp ufw sudo dirmngr libxrender1

Install postfix SMTP server (Choose internet site configuration and use the server's domain name)

sudo apt-get install postfix

Edit postfix config file

sudo vim /etc/postfix/main.cf

Set inet_interfaces to be loopback-only

inet_interfaces = loopback-only

Git

Set name and email for commits

git config --global user.name "Your Name"
git config --global user.email [email protected]

Generate an SSH keypair

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

Copy the output of this command and paste into github SSH key settings.

cat ~/.ssh/id_rsa.pub

Check to make sure SSH to github works with your key

PostgreSQL

sudo apt-get install postgresql-10 libpq-dev

Set postgres user password

sudo -u postgres psql
postgres=# \password postgres

zsh and oh-my-zsh

sudo apt-get install zsh fonts-powerline
chsh -s $(which zsh)
# logout and back in
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

asdf version manager

sudo apt-get install automake autoconf libreadline-dev libncurses-dev \
libssl-dev libyaml-dev libxslt-dev libffi-dev libtool unixodbc-dev \
libwxgtk3.0-dev libgl1-mesa-dev  libglu1-mesa-dev libssh-dev xsltproc fop \
libxml2-utils

git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.5.1

# add to bottom of .zshrc
echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.zshrc
echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.zshrc

source ~/.zshrc

Ruby and Ruby on Rails

asdf plugin-add ruby
asdf install ruby 2.5.1
asdf global ruby 2.5.1
ruby -v

Tell RubyGems to not install documentation for each gem

echo "gem: --no-ri --no-rdoc" > ~/.gemrc

Install bundler and rails

gem install bundler
gem install rails

Node.js

asdf plugin-add nodejs https://github.com/asdf-vm/asdf-nodejs.git
bash ~/.asdf/plugins/nodejs/bin/import-release-team-keyring
asdf install nodejs 9.11.1
asdf global nodejs 9.11.1
node -v

Erlang, Elixir and Phoenix

Erlang

asdf plugin-add erlang
asdf install erlang 21.0.8
asdf global erlang 21.0.8

Elixir

asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git
asdf install elixir 1.7.3-otp-21
asdf global elixir 1.7.3-otp-21
elixir -v

Phoenix

sudo apt-get install inotify-tools
mix local.hex
mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez

Other Tools

wkhtmltopdf

The wkhtmltopdf packge available in debian repo is version with unpatched QT. You most likely want version with patched QT, so download the precompiled binaries for Linux as described below:

At the time of writing, the latest version is 0.12.4 which has an issue fetching remote images over https, so you will need to install libssl1.0-dev

sudo apt-get install libssl1.0-dev

Download the archive

wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz

Extract the archive and copy wkhtmltopdf and wkhtmltoimage binaries to /usr/bin/

tar -xf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
sudo cp wkhtmltox/bin/* /usr/bin/

PostGIS and Geospatial related tool dependencies

sudo apt-get install python-all-dev python-dev python3-pip \
 libaio-dev libbz2-dev libjpeg-turbo8-dev libpcre3-dev libexpat1-dev \
 liblzma-dev libevent-dev binutils libproj-dev xsltproc docbook-xsl \
 docbook-mathml libgeos-dev libgeos-3.6.2 postgresql-10-postgis-2.4 \
 libgdal-dev python3-gdal python3-numpy gdal-bin postgresql-10-postgis-scripts

Add to .zshrc

export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal

Make sure rgeo will be able to find geos

sudo ln -s /usr/lib/x86_64-linux-gnu/libgeos-3.6.2.so /usr/lib/libgeos.so
gem install rgeo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment