Having played around with Erlang some twelve years ago, I felt it was time to experiment with the Elixir programming language. The install on Fedora was straightforward with Dandified YUM. Naturally, you need to be the root
user or a user found in the sudoer‘s list:
sudo dnf install -y elixir |
sudo dnf install -y elixir
Display detailed console log →
Last metadata expiration check: 4:47:05 ago on Wed 20 May 2020 05:57:25 PM MDT.
Dependencies resolved.
======================================================================================================
Package Architecture Version Repository Size
======================================================================================================
Installing:
elixir x86_64 1.9.0-1.fc30 updates 4.9 M
Installing dependencies:
erlang-asn1 x86_64 21.3.8.15-1.fc30 updates 742 k
erlang-compiler x86_64 21.3.8.15-1.fc30 updates 1.1 M
erlang-crypto x86_64 21.3.8.15-1.fc30 updates 141 k
erlang-erts x86_64 21.3.8.15-1.fc30 updates 2.2 M
erlang-hipe x86_64 21.3.8.15-1.fc30 updates 2.8 M
erlang-inets x86_64 21.3.8.15-1.fc30 updates 646 k
erlang-kernel x86_64 21.3.8.15-1.fc30 updates 1.4 M
erlang-mnesia x86_64 21.3.8.15-1.fc30 updates 767 k
erlang-parsetools x86_64 21.3.8.15-1.fc30 updates 175 k
erlang-public_key x86_64 21.3.8.15-1.fc30 updates 612 k
erlang-runtime_tools x86_64 21.3.8.15-1.fc30 updates 215 k
erlang-sasl x86_64 21.3.8.15-1.fc30 updates 279 k
erlang-ssl x86_64 21.3.8.15-1.fc30 updates 931 k
erlang-stdlib x86_64 21.3.8.15-1.fc30 updates 3.0 M
erlang-syntax_tools x86_64 21.3.8.15-1.fc30 updates 410 k
erlang-tools x86_64 21.3.8.15-1.fc30 updates 618 k
Transaction Summary
======================================================================================================
Install 17 Packages
Total download size: 21 M
Installed size: 42 M
Downloading Packages:
(1/17): erlang-compiler-21.3.8.15-1.fc30.x86_64.rpm 911 kB/s | 1.1 MB 00:01
(2/17): erlang-crypto-21.3.8.15-1.fc30.x86_64.rpm 1.1 MB/s | 141 kB 00:00
(3/17): erlang-asn1-21.3.8.15-1.fc30.x86_64.rpm 441 kB/s | 742 kB 00:01
(4/17): erlang-erts-21.3.8.15-1.fc30.x86_64.rpm 2.7 MB/s | 2.2 MB 00:00
(5/17): erlang-inets-21.3.8.15-1.fc30.x86_64.rpm 2.6 MB/s | 646 kB 00:00
(6/17): erlang-kernel-21.3.8.15-1.fc30.x86_64.rpm 1.9 MB/s | 1.4 MB 00:00
(7/17): erlang-mnesia-21.3.8.15-1.fc30.x86_64.rpm 922 kB/s | 767 kB 00:00
(8/17): erlang-parsetools-21.3.8.15-1.fc30.x86_64.rpm 669 kB/s | 175 kB 00:00
(9/17): erlang-public_key-21.3.8.15-1.fc30.x86_64.rpm 602 kB/s | 612 kB 00:01
(10/17): erlang-runtime_tools-21.3.8.15-1.fc30.x86_64.rpm 384 kB/s | 215 kB 00:00
(11/17): erlang-sasl-21.3.8.15-1.fc30.x86_64.rpm 421 kB/s | 279 kB 00:00
(12/17): erlang-hipe-21.3.8.15-1.fc30.x86_64.rpm 465 kB/s | 2.8 MB 00:06
(13/17): erlang-ssl-21.3.8.15-1.fc30.x86_64.rpm 325 kB/s | 931 kB 00:02
(14/17): erlang-syntax_tools-21.3.8.15-1.fc30.x86_64.rpm 246 kB/s | 410 kB 00:01
(15/17): elixir-1.9.0-1.fc30.x86_64.rpm 392 kB/s | 4.9 MB 00:12
(16/17): erlang-stdlib-21.3.8.15-1.fc30.x86_64.rpm 580 kB/s | 3.0 MB 00:05
(17/17): erlang-tools-21.3.8.15-1.fc30.x86_64.rpm 294 kB/s | 618 kB 00:02
------------------------------------------------------------------------------------------------------
Total 1.5 MB/s | 21 MB 00:13
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : erlang-crypto-21.3.8.15-1.fc30.x86_64 1/17
Running scriptlet: erlang-erts-21.3.8.15-1.fc30.x86_64 2/17
Installing : erlang-erts-21.3.8.15-1.fc30.x86_64 2/17
Installing : erlang-kernel-21.3.8.15-1.fc30.x86_64 3/17
Installing : erlang-stdlib-21.3.8.15-1.fc30.x86_64 4/17
Installing : erlang-hipe-21.3.8.15-1.fc30.x86_64 5/17
Installing : erlang-compiler-21.3.8.15-1.fc30.x86_64 6/17
Installing : erlang-syntax_tools-21.3.8.15-1.fc30.x86_64 7/17
Installing : erlang-mnesia-21.3.8.15-1.fc30.x86_64 8/17
Installing : erlang-runtime_tools-21.3.8.15-1.fc30.x86_64 9/17
Installing : erlang-asn1-21.3.8.15-1.fc30.x86_64 10/17
Installing : erlang-public_key-21.3.8.15-1.fc30.x86_64 11/17
Installing : erlang-inets-21.3.8.15-1.fc30.x86_64 12/17
Installing : erlang-ssl-21.3.8.15-1.fc30.x86_64 13/17
Installing : erlang-tools-21.3.8.15-1.fc30.x86_64 14/17
Installing : erlang-sasl-21.3.8.15-1.fc30.x86_64 15/17
Installing : erlang-parsetools-21.3.8.15-1.fc30.x86_64 16/17
Installing : elixir-1.9.0-1.fc30.x86_64 17/17
Running scriptlet: elixir-1.9.0-1.fc30.x86_64 17/17
Verifying : elixir-1.9.0-1.fc30.x86_64 1/17
Verifying : erlang-asn1-21.3.8.15-1.fc30.x86_64 2/17
Verifying : erlang-compiler-21.3.8.15-1.fc30.x86_64 3/17
Verifying : erlang-crypto-21.3.8.15-1.fc30.x86_64 4/17
Verifying : erlang-erts-21.3.8.15-1.fc30.x86_64 5/17
Verifying : erlang-hipe-21.3.8.15-1.fc30.x86_64 6/17
Verifying : erlang-inets-21.3.8.15-1.fc30.x86_64 7/17
Verifying : erlang-kernel-21.3.8.15-1.fc30.x86_64 8/17
Verifying : erlang-mnesia-21.3.8.15-1.fc30.x86_64 9/17
Verifying : erlang-parsetools-21.3.8.15-1.fc30.x86_64 10/17
Verifying : erlang-public_key-21.3.8.15-1.fc30.x86_64 11/17
Verifying : erlang-runtime_tools-21.3.8.15-1.fc30.x86_64 12/17
Verifying : erlang-sasl-21.3.8.15-1.fc30.x86_64 13/17
Verifying : erlang-ssl-21.3.8.15-1.fc30.x86_64 14/17
Verifying : erlang-stdlib-21.3.8.15-1.fc30.x86_64 15/17
Verifying : erlang-syntax_tools-21.3.8.15-1.fc30.x86_64 16/17
Verifying : erlang-tools-21.3.8.15-1.fc30.x86_64 17/17
Installed:
elixir-1.9.0-1.fc30.x86_64 erlang-asn1-21.3.8.15-1.fc30.x86_64
erlang-compiler-21.3.8.15-1.fc30.x86_64 erlang-crypto-21.3.8.15-1.fc30.x86_64
erlang-erts-21.3.8.15-1.fc30.x86_64 erlang-hipe-21.3.8.15-1.fc30.x86_64
erlang-inets-21.3.8.15-1.fc30.x86_64 erlang-kernel-21.3.8.15-1.fc30.x86_64
erlang-mnesia-21.3.8.15-1.fc30.x86_64 erlang-parsetools-21.3.8.15-1.fc30.x86_64
erlang-public_key-21.3.8.15-1.fc30.x86_64 erlang-runtime_tools-21.3.8.15-1.fc30.x86_64
erlang-sasl-21.3.8.15-1.fc30.x86_64 erlang-ssl-21.3.8.15-1.fc30.x86_64
erlang-stdlib-21.3.8.15-1.fc30.x86_64 erlang-syntax_tools-21.3.8.15-1.fc30.x86_64
erlang-tools-21.3.8.15-1.fc30.x86_64
Complete!
The installation said to add it to the $PATH
variable but on Fedora 30, a symbolic link of elixir
is installed in the /usr/bin directory
that points to /usr/share/elixir/1.9.0/bin/elixir
shell script. Next, a version check, like this:
it returned
Erlang/OTP 21 [erts-10.3.5.11] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1] [hipe]
Elixir 1.9.0 (compiled with Erlang/OTP 21) |
Erlang/OTP 21 [erts-10.3.5.11] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1] [hipe]
Elixir 1.9.0 (compiled with Erlang/OTP 21)
Next, I created a little elixir
test program, naturally after I glanced through the documentation for a Hello World program, like this hello.exs
file:
IO.puts "Hello, Elixir World!" |
IO.puts "Hello, Elixir World!"
Then, I ran it as stand alone file with only read and write, read, and read privileges:
It returns:
Next, I tried to read the file from the file system in the iex
interactive shell. I thought the example on the website was odd because it gave the impression that you were to call iex
recursively but I discovered that’s not the case. You can only run it from the OS shell, and the file must have read, write, execute privileges for whomever calls it. Then, this syntax works from the Linux CLI interfaace:
Then, you exit the shell by issuing a ^Z
(CTRL+Z
). If you try ^C
, you’ll need to follow that with ^D
, which I found in some notes. The ^Z
is the normal kill signal for the current process, which appears the proper way to exit the iex
interactive shell. Overall, the interactive shell is virtually useless except to validate small syntax examples.