Installing Lua on Ubuntu 20.04

March 10, 2021  ‐ 1 min read

The programming language Lua is somewhat lesser known. Though, it has been around since 1993. What got me interested in learning some Lua is that Neovim allows you to use it as a substitute for VimL in your config file.

By default Lua isn't available on Ubuntu. Luckily it's available in the repositories and therefore easy installable via apt. Currently, the latest available version of Lua on Ubuntu 20.04 is version 5.3. You can install it using the following command.

$ sudo apt install lua5.3

If all went well you can now start the Lua shell with the lua command in your terminal.

$ lua
Lua 5.3.3  Copyright (C) 1994-2016 Lua.org, PUC-Rio
>

Feel free to enter print('Hello World') in this terminal, if that makes the tutorial feel more complete ;).

Once you're done you can exit out the Lua shell by pressing CTRL+C.

Building Lua from source

You can easily build Lua from source. The [https://www.lua.org/download.html](download page on the Lua website) contains more information on this.

$ curl -R -O http://www.lua.org/ftp/lua-5.4.2.tar.gz
$ tar zxf lua-5.4.2.tar.gz
$ cd lua-5.4.2
$ make all test