How To Install erlang-luerl on Ubuntu 18.04

In this tutorial we learn how to install erlang-luerl on Ubuntu 18.04. erlang-luerl is implementation of Lua in Erlang

Introduction

In this tutorial we learn how to install erlang-luerl on Ubuntu 18.04.

What is erlang-luerl

erlang-luerl is:

An experimental implementation of Lua 5.2 written solely in pure Erlang

When to use Luerl:

Fast Language Switch: Luerl should allow you to switch between Erlang and Lua incredibly fast, introducing a way to use very small bits of logic programmed in Lua, inside an Erlang application, with good performance.

Multicore: Luerl provides a way to transparently utilize multicores. The underlying Erlang VM takes care of the distribution.

Microprocesses: It should give you a Lua environment that allows you to effortlessly run tens of thousands of Lua processes in parallel, leveraging the famed microprocesses implementation of the Erlang VM. The empty Luerl State footprint will be yet smaller than the C Lua State footprint.

Forking Up: Because of the immutable nature of the Luerl VM, it becomes a natural operation to use the same Lua State as a starting point for multiple parallel calculations.

However, Luerl will generally run slower than a reasonable native Lua implementation. This is mainly due the emulation of mutable data on top of an immutable world. There is really no way around this. An alternative would be to implement a special Lua memory outside of the normal Erlang, but this would defeat the purpose of Luerl. It would instead be then more logical to connect to a native Lua.

Some valid use cases for Luerl are:

  • Lua code will be run only occasionally and it wouldn’t be worth managing an extra language implementation in the application;
  • the Lua code chunks are small so the slower speed is weighed up by Luerl’s faster interface;
  • the Lua code calculates and reads variables more than changing them;
  • the same Lua State is repeatedly used to ‘fork up’ as a basis for massively many parallel calculations, based on the same state;
  • it is easy to run multiple instances of Luerl which could better utilise multicores.

There are three methods to install erlang-luerl on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install erlang-luerl Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install erlang-luerl using apt-get by running the following command:

sudo apt-get -y install erlang-luerl

Install erlang-luerl Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install erlang-luerl using apt by running the following command:

sudo apt -y install erlang-luerl

Install erlang-luerl Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install erlang-luerl using aptitude by running the following command:

sudo aptitude -y install erlang-luerl

How To Uninstall erlang-luerl on Ubuntu 18.04

To uninstall only the erlang-luerl package we can use the following command:

sudo apt-get remove erlang-luerl

Uninstall erlang-luerl And Its Dependencies

To uninstall erlang-luerl and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove erlang-luerl

Remove erlang-luerl Configurations and Data

To remove erlang-luerl configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge erlang-luerl

Remove erlang-luerl configuration, data, and all of its dependencies

We can use the following command to remove erlang-luerl configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge erlang-luerl

References

Summary

In this tutorial we learn how to install erlang-luerl package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.