Skip to content

Instantly share code, notes, and snippets.

@eikes
Created December 28, 2015 22:29
Show Gist options
  • Save eikes/e2ce65e8f02e99d54010 to your computer and use it in GitHub Desktop.
Save eikes/e2ce65e8f02e99d54010 to your computer and use it in GitHub Desktop.
run phoenix on amazon linux
# app deps
sudo yum install git
# erlang deps
sudo yum groupinstall "Development Tools"
sudo yum install ncurses-devel
# erlang
wget http://www.erlang.org/download/otp_src_18.1.tar.gz
tar -zxvf otp_src_18.1.tar.gz
rm otp_src_18.1.tar.gz
cd otp_src_18.1/
./configure
make
sudo make install
# elixir
wget https://github.com/elixir-lang/elixir/archive/v1.1.1.zip
unzip v1.1.1.zip
cd elixir-1.1.1/
make
echo "PATH=\$PATH:/home/ec2-user/elixir-1.1.1/bin" >> .bashrc
# phoenix deps
sudo yum install postgresql
mix local.hex
sudo yum install nodejs npm --enablerepo=epel
sudo npm -g install brunch
# listen on port 80 as well
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 4001
git clone git://github.com/user_name/my-phonix-app
cd my-phoenix-app
npm install
mix deps.get
MIX_ENV=prod mix ecto.create
MIX_ENV=prod mix ecto.migrate
brunch build --production
MIX_ENV=prod mix phoenix.digest
MIX_ENV=prod PORT=4001 elixir --detached -S mix do compile, phoenix.server
@jagtesh
Copy link

jagtesh commented Oct 21, 2016

Can update the OTP version to 19.1: http://erlang.org/download/otp_src_19.1.tar.gz

@ChefAndy
Copy link

ChefAndy commented Dec 3, 2016

Nice, simple script. For people using Amazon Linux on a Lightsail instance, before you compile Erlang, you need to:
sudo yum install openssl-devel

Or just replace:
sudo yum install ncurses-devel

with:
sudo yum install ncurses-devel openssl-devel

If you don't, you'll get a rebar error when running Elixir's make.

@mike-north
Copy link

Update for OTP 19.1, Elixir 1.4.2, and use of bcrypt (requires openssl and a few other things)
https://gist.github.com/mike-north/cbaf06acb75e7a605f757df1036feff7

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