In questa guida, installeremo Erlang/OTP in un Opensuse Leap 15.3.
Contenuti correlati
- Come installare RabbitMQ in OpenSUSE Leap 15.3
- Come installare Erlang su Fedora 35
- Come installare RabbitMQ in Fedora 35
- Come installare Erlang su Rocky Linux/Alma Linux/CentOS 8
- Come installare Rabbitmq in Rocky Linux/Alma Linux/Centos 8
Prerequisiti
Hai bisogno di quanto segue per seguire
- Server OpenSUSE Leap aggiornato
- Accesso root o utente con accesso root
- Accesso a Internet dal server
Indice dei contenuti
- Aggiornamento del sistema
- Installazione di Erlang
- Creazione del programma Hello world
1. Aggiornamento del sistema
Assicuriamoci che i nostri pacchetti server siano aggiornati usando questo comando:
sudo zypper ref
sudo zypper up -y
Installiamo anche alcuni pacchetti comuni
sudo zypper install -y vim
2. Installazione di Erlang
Il pacchetto erlang si trova nei repository OpenSUSE Leap di default. Installalo usando questo comando:
sudo zypper install -y erlang
Questo è l'output sul mio server
~> sudo zypper install -y erlang
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following recommended package was automatically selected:
psqlODBC
The following 6 NEW packages are going to be installed:
erlang erlang-epmd libltdl7 libpq5 psqlODBC unixODBC
6 new packages to install.
Overall download size: 28.9 MiB. Already cached: 0 B. After the operation, additional 52.3 MiB will be used.
Continue? [y/n/v/...? shows all options] (y): y
Retrieving package libltdl7-2.4.6-3.4.1.x86_64 (1/6), 32.6 KiB ( 38.6 KiB unpacked)
Retrieving: libltdl7-2.4.6-3.4.1.x86_64.rpm ....................................................................................[done]
Retrieving package libpq5-14.0-5.3.1.x86_64 (2/6), 172.2 KiB (679.2 KiB unpacked)
Retrieving: libpq5-14.0-5.3.1.x86_64.rpm .......................................................................................[done]
Retrieving package unixODBC-2.3.6-3.2.1.x86_64 (3/6), 306.1 KiB ( 1.0 MiB unpacked)
Retrieving: unixODBC-2.3.6-3.2.1.x86_64.rpm ....................................................................................[done]
Retrieving package psqlODBC-13.01.0000-3.9.1.x86_64 (4/6), 405.1 KiB ( 1.3 MiB unpacked)
Retrieving: psqlODBC-13.01.0000-3.9.1.x86_64.rpm ..................................................................[done (16.3 KiB/s)]
Retrieving package erlang-22.3-1.26.x86_64 (5/6), 27.9 MiB ( 49.2 MiB unpacked)
Retrieving: erlang-22.3-1.26.x86_64.rpm ...........................................................................[done (29.6 MiB/s)]
Retrieving package erlang-epmd-22.3-1.26.x86_64 (6/6), 145.4 KiB ( 55.3 KiB unpacked)
Retrieving: erlang-epmd-22.3-1.26.x86_64.rpm ......................................................................[done (16.4 KiB/s)]
Checking for file conflicts: ...................................................................................................[done]
(1/6) Installing: libltdl7-2.4.6-3.4.1.x86_64 ..................................................................................[done]
(2/6) Installing: libpq5-14.0-5.3.1.x86_64 .....................................................................................[done]
(3/6) Installing: unixODBC-2.3.6-3.2.1.x86_64 ..................................................................................[done]
(4/6) Installing: psqlODBC-13.01.0000-3.9.1.x86_64 .............................................................................[done]
Additional rpm output:
odbcinst: Driver installed. Usage count increased to 1.
Target directory is /etc/unixODBC
(5/6) Installing: erlang-22.3-1.26.x86_64 ......................................................................................[done]
(6/6) Installing: erlang-epmd-22.3-1.26.x86_64 .................................................................................[done]
Additional rpm output:
Created symlink /etc/systemd/system/sockets.target.wants/epmd.socket -> /usr/lib/systemd/system/epmd.socket.
3. Creazione del programma Hello world
Crea hello.erl
file
vim hello.erl
Aggiungilo al file
% This is a test Hello World Erlang Code
-module(hello).
-import(io,[fwrite/1]).
-export([helloworld/0]).
helloworld() ->
fwrite("Hello from Citizix, Erlang World!\n").
Compilalo dalla shell Erlang. Non dimenticare il punto ("punto") alla fine di ogni comando:
~> erl
Erlang/OTP 22 [erts-10.7] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [hipe]
Eshell V10.7 (abort with ^G)
1> c(hello).
{ok,hello}
2> hello:helloworld().
Hello from Citizix, Erlang World!
ok
3>
Hai installato correttamente Erlang nel tuo sistema.
Conclusione
Grazie per aver utilizzato questo tutorial per installare il linguaggio di programmazione Erlang sul tuo sistema OpenSUSE Leap. Per ulteriore assistenza o informazioni utili, ti consigliamo di controllare il sito Web ufficiale di Erlang.