9
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【2025年版、スマホ版もあるよ】Ubuntu 24.04/22.04 Elixir/Phoenix最短インストール手順(ベアメタル or mise)

Last updated at Posted at 2025-11-26

この記事は、Elixir Advent Calendar 2025その3 の4日目です

昨日は @t-yamanashi さんで、「LiveViewとthree.jsを使ってアニメーションを作ろう」 でした


piacere です、ご覧いただいてありがとございます :bow:

下記のUbuntu 24.04/22.04にElixir/Phoenixを導入する最短手順です

  • 実機
  • Windows WSL2 Ubuntu
  • スマホ上のUserLAndアプリUbuntu

なおUbuntu 22.04だと、ベアメタルのErlang/Elixirのバージョンが多少古いかも知れませんので、気になる方は、後半のmiseの手順をお試しください(ただしUserLAndはgpgのバージョンが古くてmiseが入れられませんでした ⋯ 時間あるときにリトライするかも知れません)

Elixirアドベントカレンダー、応援よろしくお願いします :bow:

今年もやっています

※(Windowsのみ)WSL2 Ubuntu 24.04導入

wsl --install -d Ubuntu-24.04
(略)
Create a default Unix user account: 【Ubuntuユーザー名を入力】
New password:【パスワードを入力】
Retype new password:【パスワードを入力】

少し前のWindowsでは、dism.exewsl_update_x64.msi が事前に必要でしたが、2020年5月27日にリリースされたWindows 10バージョン2004(May 2020 Update)以降は、WSL2が標準装備となったため、Ubuntu 24.04のみインストールすればOKとなり、だいぶ楽チンになりました

ベアメタル or miseを選んでください

下記のようなElixir/Phoenixの利用目的に応じて、ベアメタル(ホストに直接)へのインストールか、miseを使ったインストールかを選んでください

①ベアメタルへのインストール

ElixirとPhoenixのインストール

sudo apt update -y
sudo add-apt-repository ppa:rabbitmq/rabbitmq-erlang
sudo apt update -y
sudo apt install git inotify-tools elixir erlang -y
mix archive.install hex phx_new

UserLAnd(スマホでUbuntu等を動かせるアプリ)のUbuntuの場合は、add-apt-repositoryが無くて怒られるため、下記を先に実行してから上記を実行してください

sudo apt update -y
sudo apt install software-properties-common

下記でElixirとPhoenixが入ったことを確認してください

$ elixir --version
Erlang/OTP 27 [erts-15.2.7.4] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit:ns]

Elixir 1.17.3 (compiled with Erlang/OTP 26)
$ mix archive
* hex-2.3.1
* phx_new-1.8.1
Archives installed at: /home/piacere/.mix/archives

②miseを使ったインストール

miseのインストール

sudo apt update -y
sudo install -dm 755 /etc/apt/keyrings
wget -qO - https://mise.jdx.dev/gpg-key.pub | gpg --dearmor | sudo tee /etc/apt/keyrings/mise-archive-keyring.gpg 1> /dev/null
echo "deb [signed-by=/etc/apt/keyrings/mise-archive-keyring.gpg arch=amd64] https://mise.jdx.dev/deb stable main" | sudo tee /etc/apt/sources.list.d/mise.list
sudo apt update -y
sudo apt install mise -y
echo eval "$(mise activate bash)" >> ~/.bashrc
source ~/.bashrc

ElixirとPhoenixのインストール

mise use -g erlang@latest
mise use -g elixir@latest

下記でElixirとPhoenixが入ったことを確認してください

$ elixir --version
Erlang/OTP 28 [erts-16.1.2] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit:ns]

Elixir 1.19.3 (compiled with Erlang/OTP 28)
$ mix archive
* hex-2.3.1
* phx_new-1.8.1
Archives installed at: /home/piacere/.mix/archives

任意のバージョンをインストールしたい場合は、下記コマンドで調べられます

 mise ls-remote elixir

終わりに

ベアメタルへのインストールは、少し前と比べると随分ラクになっており、miseもasdfと比べるとインストール/設定がカンタンで良いですね


明日も私で 「音声で会話できるローカルLLM AIボットをElixir/LiveViewで作ってみた」 です

9
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?