I’m hoping you guys can help me out, I’ve got myself in a bit of a pickle on my server - it’s not something I need to visit very often.
A couple of years ago I set up my Centos 7 server with Elixir and Erlang. I can’t remember how I installed Elixir, (I failed to record the process I followed and won’t make that mistake again).
So for the last two years I’ve had:
Elixir v1.7.0-dev (don’t know why I ended up with the dev build)
Erlang/OTP 20
And everything has been fine.
Yesterday I started a new project and had some problems building the release with edeliver. The error I received pointed me to: https://github.com/boldpoker/edeliver/issues/94 so I decided to try and upgrade my Elixir version assuming (rightly or wrongly) that it would fix the issue that is described relating to mix.
I initially assumed I would have used yum so I did yum upgrade elixir which resulted in Erlang upgrading to 22 but Elixir remaining the same at 1.7.0-dev. This seems to have just caused more problems, presumably because my Elixir version was compiled with Erlang 20.
So what I would like to do is to completely remove Elixir and install the latest stable version that is compatible with Erlang/OTP 22 on Centos 7.
yum erase elixir results in No Match for argument: elixir, so I mustn’t have used yum to install Elixir.
which elixir points to /usr/local/bin/elixir which appears to be a symlink to /opt/elixir/bin/elixir which I guess is the compiled binary, so I assume I could just delete that (with the corresponding mix build etc in the same dir). But I don’t want to start thrashing around with things without confirmation/advice - I’ve done enough damage already.
So can anyone suggest my next course of action for:
Completely removing Elixir, and
The recommended installation process and latest stable version that works with Erlang/OTP 22 on Centos 7.
You installed from source, a version of elixir that was newer than 1.6, but not reached 1.7 yet…
So you probably really updated the elixir package from the system to a version that is more recent then the system version you had before, but your “local” elixir version is at an earlier position in PATH.
Try which -a elixir to see how many elixir versions are visible from the PATH.
which elixir | while read line; do printf "%s:\n%s" "$line" "$($line --version)"; done should tell you the version of each (untested)
Depends on how exactly you installed it. So as you can’t remember that, its hard… Though perhaps search your users and roots homes for the elixir source repository, if you find it, open the Makefile and manually undo the steps done by the install task.
I can try to point you in the correct direction here, but I am not able to give you the exact set of instructions.
So you can grab the bash script I used in this Stackoverflow answer and adapt it from Ubuntu to Centos. I think it should not be too hard.
For your convenience the bash script for Ubuntu:
#!/bin/sh
set -eu
Main() {
local ERLANG_VERSION=${1? Missing Erlang version. Check the latest version at https://www.erlang-solutions.com/resources/download.html}
local ERLANG_DOWNLOAD_URL=https://packages.erlang-solutions.com/erlang/debian/pool/esl-erlang_${ERLANG_VERSION}-1~ubuntu~bionic_amd64.deb
local ELIXIR_VERSION=${2? Missing Erlang version. Check the latest version at https://www.erlang-solutions.com/resources/download.html}
local ELIXIR_DOWNLOAD_URL=https://packages.erlang-solutions.com/erlang/debian/pool/elixir_${ELIXIR_VERSION}-1~ubuntu~bionic_all.deb
local PHOENIX_VERSION="${3? Missing Phoenix version to install!!!}"
local NODEJS_VERSION="${4? Missing NodeJS version to install!!!}"
apt update
apt -y upgrade
apt -y -q install --no-install-recommends \
ca-certificates \
curl \
build-essential \
procps \
libncurses5 \
libwxbase3.0-0v5 \
libwxgtk3.0-0v5 \
libsctp1
apt -y -f install
printf "\nERLANG DOWNLOAD URL: ${ERLANG_DOWNLOAD_URL}\n"
curl -fsSL -o esl.deb "${ERLANG_DOWNLOAD_URL}"
dpkg -i esl.deb
rm -f esl.deb
printf "\nELIXIR DOWNLOAD URL: ${ELIXIR_DOWNLOAD_URL}\n"
curl -fsSL -o elixir.deb "${ELIXIR_DOWNLOAD_URL}"
dpkg -i elixir.deb
rm -f elixir.deb
printf "\nPHOENIX VERSION: ${PHOENIX_VERSION}\n"
# installs the package manager
mix local.hex --force
# installs rebar and rebar3
mix local.rebar --force
mkdir -p "${HOME}/bin"
ln -s "${HOME}"/.mix/rebar "${HOME}"/bin/rebar
ln -s "${HOME}"/.mix/rebar3 "${HOME}"/bin/rebar3
mix archive.install --force hex phx_new ${PHOENIX_VERSION}
# INSTALL NODEJS
printf "\nNODEJS VERSION: ${NODEJS_VERSION}\n"
curl -sL https://deb.nodesource.com/setup_"${NODEJS_VERSION}".x | sh -
apt install -y -q --no-install-recommends nodejs
}
Main ${@}
So after you convert it to Centos 7, you can install an Elixir Phoenix stack with bash install-stack.sh <erlang-version> <elixir-version> <phoenix-version> <nodejs-version>:
bash install-stack.sh 22.3.3 1.10.3 1.5.1 10
Now test it works:
mix phx.new hello --no-ecto && cd hello && mix test
If you really want to build by youself… I have Dockerfile for Redhat Universal Base Image 7 (ubi7) to build Erlang from source, and use pre-compiled Elixir (from Bob)