Install a elixir Precompiled package in GNU/Linux

Hi, Im a noob trying install Elixir 1.14.4 on Erlang 23 Precompiled package in my Debian 11 stable.

Ive installed Erlang 23 from debian repos, so I download the precompiled package then I unzip it in ~/elixir/ then I add to my ~/.bash_profile :

export PATH="$PATH:~/elixir/bin/elixir"
export PATH="$PATH:~/elixir/bin/mix"

But when I run: elixir --version return command not found.

How can I do? Im following the Installing Elixir - The Elixir programming language instructions

Hi,

Did you literally put /path/to/elixir/bin in your bash profile? If that is the case, replace it with the actual path to the elixir bin directory. I guess for you it would be ~/elixir/bin.

Then restart your terminal and check. If that doesn’t work, look at the result of echo $PATH. If the elixir bin directory is not there try running source ~/.bash_profile

2 Likes

I literally put in my bash profile:

export PATH="$PATH:~/elixir/bin/elixir"
export PATH="$PATH:~/elixir/bin/mix"

As @hochata said, it should be

export PATH="$PATH:~/elixir/bin"
2 Likes

Works! but only in the user terminal, it dont work by systemd :frowning:

Now I try run mix from systemd:

systemd unit:

[Unit]
Description=mix script

[Service]
Restart=on-failure

User=appuser

Environment="MIX_ENV=prod"

WorkingDirectory=/opt/app

; Path to the Mix binary. 
Environment="PATH=$PATH:/home/user/elixir/bin"

ExecStart=/home/user/elixir/bin/mix phx.server

PrivateTmp=true
ProtectHome=true
ProtectSystem=full
PrivateDevices=false
CapabilityBoundingSet=~CAP_SYS_ADMIN

[Install]
WantedBy=multi-user.target

In systemd unit user (appuser) .bash_profile I put:

export PATH="$PATH:/home/user/elixir/bin"

You shouldn’t use mix with systemd, you should build a release, and start that.

I need use mix with systemd