Setting up Digital Ocean for Elixir and Phoenix

While learning how to do Erlang/OTP releases with Brandon Richey’s excellent post on the subject, I ran into some issues with setting up my server, so I decided to write this post on properly setting up Digital Ocean for Elixir and Phoenix.


You’re obviously going to need an account with Digital Ocean. If you don’t have one, you can sign up here (yes, that’s an affiliate link). You’ll get $10 free if you use that link which will last you 2 months on the cheapest tier. Great for testing things out!

Getting Started

Once you’ve created your account, the next steps are simple. Click the green “Create Droplet” button and that will take you to the page where you can name your server and choose your payment plan.

My recommendation is to choose the $5/month plan. You can always increase that as you need, but why pay more than you have to?

When you scroll down, you’ll see a section called Choose an image. Here, you’ll want to choose Ubuntu 16.04 x64. This is the LTS version of Ubuntu which means it is very stable and will be supported for a couple years.

You may glance through the one-click apps section when choosing an image and notice that there is one with Elixir on Ubuntu 16.04. Do not choose that one! Two reasons, in my opinion, are that it requires you to upgrade to the $10/month plan and it’s better to start from a clean server to make sure everything is set up properly. That’s the whole reason I’m writing this guide!

There are additional options you can set after choosing an image but I won’t be going into those. Although, you will probably want to set up ssh keys with Digital Ocean.

The Fun Stuff

Now we get to the good parts. Once your droplet is created, you will see an IP address associated with the name of your server. This is how you will access the server to prep it for Elixir and Phoenix.

Open up your terminal and ssh into the server using that IP address. Like this:

ssh root@

After that, the next thing you’ll want to do is install the build-essential package:

sudo apt-get install build-essential

Now we need to install Elixir!

wget && sudo dpkg -i erlang-solutions_1.0_all.deb
sudo apt-get update
sudo apt-get install esl-erlang
sudo apt-get install elixir

That should be it! Now, you can setup git on your server and clone an Elixir/Phoenix repo from GitHub. once you do that, you should be able to cd into the project’s root directory and run the command:

mix do deps.get, compile

If everything is set up correctly you should have no issues with compiling!

One Last Step

In order for you to be able to use tools like or Webpack, you will need to install Node.js. Here is the easiest way to do that (using NVM):

sudo apt-get update && sudo apt-get install libssl-dev

After that is done, you’ll need to download NVM itself. I’m using the current version as of this writing but there may be an updated version which you can find here:

curl -o- | bash

Then, to find out which versions of Node are available, you can type:

nvm ls-remote

Choose a version and then do:

nvm install v6.9.0 && nvm use 6.9.0

The End

If you get confused along the way or need to ask for help, feel free to comment or join the Elixir slack group and message me there @sircharleswatson