Skip to content

Instantly share code, notes, and snippets.

@GRoguelon
Last active April 12, 2024 00:07
Show Gist options
  • Save GRoguelon/2ad4c23488b6561bfacf90a8990c9b08 to your computer and use it in GitHub Desktop.
Save GRoguelon/2ad4c23488b6561bfacf90a8990c9b08 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e
## Installing Erlang
export ERLANG_VERSION=26.2.3
export ERL_TOP=/tmp/otp_src_${ERLANG_VERSION}
sudo dnf install -y \
gcc \
gcc-c++ \
gzip \
libxslt \
m4 \
make \
ncurses-devel \
openssl-devel \
perl \
tar \
unixODBC \
unixODBC-devel \
git
curl -Lo /tmp/otp_src_${ERLANG_VERSION}.tar.gz https://github.com/erlang/otp/releases/download/OTP-${ERLANG_VERSION}/otp_src_${ERLANG_VERSION}.tar.gz
tar -C /tmp -xzf /tmp/otp_src_${ERLANG_VERSION}.tar.gz
cd $ERL_TOP
./configure --prefix=/opt/erlang/${ERLANG_VERSION} --without-wx --without-javac
make -j$(nproc) && sudo make install
## Installing Elixir
export ELIXIR_VERSION=1.16.2
sudo dnf install -y unzip
sudo mkdir -p /opt/elixir/${ELIXIR_VERSION}/
curl -Lo /tmp/elixir.zip https://github.com/elixir-lang/elixir/releases/download/v${ELIXIR_VERSION}/elixir-otp-26.zip
sudo unzip /tmp/elixir.zip -d /opt/elixir/${ELIXIR_VERSION}/
sudo chown -R $(whoami):$(whoami) /opt/elixir /opt/erlang
export PATH="/opt/erlang/${ERLANG_VERSION}/bin:/opt/elixir/${ELIXIR_VERSION}/bin:$PATH"
mix do local.rebar --force, local.hex --force
## Setup environment
echo "export PATH=\"/opt/erlang/${ERLANG_VERSION}/bin:/opt/elixir/${ELIXIR_VERSION}/bin:\$PATH\"" >>~/.bashrc
## Clean environment
rm -rf /tmp/otp_src_${ERLANG_VERSION}.tar.gz /tmp/otp_src_${ERLANG_VERSION} /tmp/elixir.zip
## Install livebook
# mix escript.install github livebook-dev/livebook
# cd /home/ec2-user
# mix escript.install hex livebook
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment