Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pikender/74690c1df556c65af3fcde86048e3cff to your computer and use it in GitHub Desktop.
Save pikender/74690c1df556c65af3fcde86048e3cff to your computer and use it in GitHub Desktop.
Ubuntu 18.04 / 18.10 Ruby and Elixir Development Setup

Ubuntu 18.04 / 18.10 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 make binutils 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 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 YOUR@EMAIL.com

Generate an SSH keypair

ssh-keygen -t rsa -C "YOUR@EMAIL.com"

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

ssh -T git@github.com

PostgreSQL

sudo apt-get install postgresql-10 libpq-dev

Set postgres user password

sudo -u postgres createuser myuser -s

sudo -u postgres psql
postgres=# \password myuser

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.6.3

# 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.6.1
asdf global ruby 2.6.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 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 10.15.1
asdf global nodejs 10.15.1
node -v

Erlang, Elixir and Phoenix

Erlang

asdf plugin-add erlang
asdf install erlang 21.2.4
asdf global erlang 21.2.4

Elixir

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

Phoenix

sudo apt-get install inotify-tools
mix local.hex
mix archive.install hex phx_new 1.4.1

Other Tools

wkhtmltopdf

sudo apt-get install libssl1.0-dev xfonts-75dpi fontconfig libjpeg-turbo8 xfonts-base

Download the latest ubuntu deb package

wget https://downloads.wkhtmltopdf.org/0.12/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb

Install

sudo dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb

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