How To Install luarocks on Debian 11

In this tutorial we learn how to install luarocks on Debian 11. luarocks is deployment and management system for Lua modules

Introduction

In this tutorial we learn how to install luarocks on Debian 11.

What is luarocks

luarocks is:

This package contains LuaRocks, a tool for managing rocks. A Lua rock is a bundle containing a module and some metadata like compilation instructions and copyright. The command line utility luarocks can download, build, install and remove rocks, properly handling dependencies among them and allowing multiple versions of the same rock to coexist.

The tool installs system-wide rocks in /usr/local when run by the superuser, but a regular user can easily tune it to install rocks in his home directory.

This package also provides the luarocks-admin tool, needed to create a rocks repository, and the documentation for luarocks, describing the command line tools as well as the library to manipulate rocks.

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

Install luarocks Using apt-get

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

sudo apt-get update

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

sudo apt-get -y install luarocks

Install luarocks Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install luarocks using apt by running the following command:

sudo apt -y install luarocks

Install luarocks 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 Debian. Update apt database with aptitude using the following command.

sudo aptitude update

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

sudo aptitude -y install luarocks

How To Uninstall luarocks on Debian 11

To uninstall only the luarocks package we can use the following command:

sudo apt-get remove luarocks

Uninstall luarocks And Its Dependencies

To uninstall luarocks and its dependencies that are no longer needed by Debian 11, we can use the command below:

sudo apt-get -y autoremove luarocks

Remove luarocks Configurations and Data

To remove luarocks configuration and data from Debian 11 we can use the following command:

sudo apt-get -y purge luarocks

Remove luarocks configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge luarocks

Dependencies

luarocks have the following dependencies:

References

Summary

In this tutorial we learn how to install luarocks package on Debian 11 using different package management tools: apt, apt-get and aptitude.