Nala is a command-line APT frontend that aims to provide a tidier alternative to the standard
apt user interface. Similar to Synaptic, Aptitude, and other APT frontends, Nala adapts the APT interface to a specific use case.
This article will introduce Nala and show you how to install and use this package manager.
- A Linux distribution running APT.
- Administrative system access.
What is Nala?
Nala is an APT package manager frontend designed to facilitate the use of APT from the command line. This tool provides a more user-friendly interface for interacting with APT and offers multiple features. This includes colored output, tab completion, and support for searching and filtering package lists.
Advantages of Nala over apt
Nala offers several additional features not available in the standard
apt interface. The features are the ability to view package dependencies and reverse dependencies and view and compare package versions.
However, the three most essential features Nala uses to improve the APT experience are:
- Parallel package downloads.
- The ability to select the fastest mirrors.
- Package transaction history.
The sections below discuss these advantages in more detail.
Parallel Package Downloads
One of the
apt frontend's limitations is that it can download only one package at a time. Nala introduces the ability to download three packages per mirror simultaneously. This feature significantly improves the download speed, especially when an installation requires numerous small packages.
Nala also improves the download speed by actively monitoring the state of the mirrors. If a mirror fails, the tool automatically replaces it with a working one.
Fast Mirror Selection
Various factors, such as the distance and the network bandwidth, influence the speed of download mirrors. Nala can measure the latency of each mirror and allow the user to choose the fastest ones, thereby improving the download speed.
Package Transaction History
Another way Nala improves APT's functionality is by allowing users to view the history of package transactions on the system. Each time Nala conducts a new transaction, such as installing, removing, or updating a package, it registers it in the JSON file under a unique ID. Users can list the transactions and, if necessary, undo them.
How To Install Nala?
Nala is available in Debian and Ubuntu repositories, but you can also download the DEB file or compile the tool from the source code available in the official Git repository. The following sections provide the steps for all the installation methods.
Install Nala with apt
The easiest way to install Nala is from the APT repositories available on your system.
1. Update the repositories to ensure you receive the latest packages.
sudo apt update
2. Install Nala.
sudo apt install nala
apt downloads and installs the main package, along with all the dependencies not present on your system.
Install Nala with DEB file
Another way to install Nala is by using a prepackaged DEB file.
1. Download the DEB file from the Releases section of the Nala project's GitLab page.
2. In the terminal, start the DEB installation with
sudo apt install [path-to-deb-file]
Install Nala via Pacstall
Pacstall is a command-line package manager for Ubuntu that aims to provide bleeding-edge packages using the stable OS base.
To install Nala with Pacstall:
1. Install Pacstall by executing the command below.
sudo bash -c "$(curl -fsSL https://git.io/JsADh || wget -q https://git.io/JsADh -O -)"
Wait for the installation process to complete.
2. Use the new
pacstall command to install Nala.
pacstall -I nala-deb
Install Nala From Source
Finally, you can install Nala by manually compiling the source available in the project's official Git repository. To do so:
1. Clone the Git repository to your local system.
git clone https://gitlab.com/volian/nala.git
The output confirms the success of the operation.
2. Go to the
nala Git directory.
Note: Pip, Python's package manager, is required for this procedure. If you do not have Pip on your system, install it by typing:
sudo apt install python3-pip
3. Execute the make command to install Nala.
sudo make install
How to Use Nala?
Once Nala is installed, use it to install and manage packages on the system. The sections below provide a guide on using Nala to perform standard package management operations.
Use the following command to install a package with Nala:
sudo nala install [package-name]
The installer shows a formatted list of packages that will be installed. Type
Y and press Enter to start the process.
The installer has two separate sections for downloading and installing packages, each with a progress bar. Once the installation finishes, Nala displays the confirmation message.
Uninstall packages with the
sudo nala remove [package-name]
Nala displays the progress bar and confirmation message.
purge command to uninstall an application and remove all the associated configuration options.
sudo nala purge [package-name]
Refresh the package listings for the repositories on your system with the
sudo nala update
apt, Nala updates the package list and displays a message if there are packages to upgrade.
View the list of all available packages by typing:
Use options to filter the list. For example, add
--upgradeable to see the packages you can upgrade.
nala list --upgradeable
Below is the list of other Nala flags useful for listing packages.
-i) shows only the packages installed on the system.
-N) displays the packages installed using Nala.
[package-name]lists all the versions of the given package.
Use the following command to upgrade the installed packages:
sudo nala upgrade
When you execute the
upgrade command, Nala first performs the package list update, then shows a table with the upgradeable packages.
Y and press Enter to start the process.
Nala downloads and upgrades the packages and then prints the confirmation message.
Fetch Fast Mirrors
As mentioned in the section on Nala's advantages over
apt, Nala can generate a list of download mirrors sorted by speed and let the user choose the fastest ones.
1. View the list of mirrors by using the
sudo nala fetch
Nala performs the latency measurements and displays the list.
2. Choose the mirrors to use by typing their index numbers separated by spaces and pressing Enter.
To confirm the selection, type Y and press Enter.
Nala writes the new list of mirrors to the
Show Package Details
nala show command to see details about a package.
nala show [package-name]
The output includes the essential package information like the name, architecture, size, repository section, maintainer info, and package description.
Show Transaction History
See the history of transactions on the system with the
Nala creates a list in which each previously executed transaction has a unique ID.
To undo changes made by a transaction, type:
sudo nala history undo [transaction-id]
Revert the changes using the
sudo nala history redo [transaction-id]
Remove an entry with the
sudo nala history clear [transaction-id]
Clear the entire transaction list by typing:
sudo nala history clear --all
Clear out the Local Repository
Delete the local cache files with the
sudo nala clean
The output confirms the operation was successful.
Optional Nala Arguments
The following is the list of flags you can add to the
nala commands to enable additional options.
-y) provides the
yesanswer to all prompts and allows the command to run non-interactively.
-v) provide additional debugging related information.
-d) tells Nala to download packages but not to unpack or install them.
-h) shows the help section.
--no-autoremovedisables package auto removal.
--no-updateinstructs Nala to skip updating the packages.
--raw-dpkgdisables formatting and shows raw dpkg output.
--remove-essentialallows the removal of all packages, including the essential ones.
--updatetells Nala to perform package update.
--versionshows Nala's version number.
This article presented Nala, an APT frontend that aims to provide a tidier alternative to the standard
apt user interface. Aside from explaining the tool's advantages, the guide showed how to install and use the tool. We also included an overview of the commands Nala uses to interact with packages.