Nala apt Frontend for Linux

December 22, 2022

Introduction

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.

Nala apt frontend for Linux.

Prerequisites

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.

Installing Nala using apt.

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.

downloading the DEB file

2. In the terminal, start the DEB installation with apt:

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.

Installing Pacstall.

2. Use the new pacstall command to install Nala.

pacstall -I nala-deb
Installing Nala using Pacstall.

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.

Cloning the Nala Git repository.

2. Go to the nala Git directory.

cd nala

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
Installing Nala from source.

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.

Install Packages

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.

Installing Neofetch with Nala.

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.

The download and install interface in Nala.

Remove Packages

Uninstall packages with the remove command.

sudo nala remove [package-name]

Nala displays the progress bar and confirmation message.

Package removal in Nala.

Purge Packages

Use the purge command to uninstall an application and remove all the associated configuration options.

sudo nala purge [package-name]

Update Packages

Refresh the package listings for the repositories on your system with the update command.

sudo nala update

Like apt, Nala updates the package list and displays a message if there are packages to upgrade.

Updating packages with Nala.

List Packages

View the list of all available packages by typing:

nala list

Use options to filter the list. For example, add --upgradeable to see the packages you can upgrade.

nala list --upgradeable
Viewing the list of upgradeable packages in Nala.

Below is the list of other Nala flags useful for listing packages.

  • --installed (-i) shows only the packages installed on the system.
  • --nala-installed (-N) displays the packages installed using Nala.
  • --all-versions (-a) [package-name] lists all the versions of the given package.

Upgrade Packages

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.

Type Y and press Enter to start the process.

Upgrading packages in Nala.

Nala downloads and upgrades the packages and then prints the confirmation message.

Package upgrade in Nala.

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 fetch command.

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.

Choosing the fast mirrors in Nala.

To confirm the selection, type Y and press Enter.

Confirming the mirror selection in Nala.

Nala writes the new list of mirrors to the /etc/apt/sources.list.d/nala-sources.list file.

Show Package Details

Use the 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.

Viewing the package details in Nala.

Show Transaction History

See the history of transactions on the system with the history command.

nala history

Nala creates a list in which each previously executed transaction has a unique ID.

Viewing package transaction history in Nala.

To undo changes made by a transaction, type:

sudo nala history undo [transaction-id]

Revert the changes using the redo subcommand.

sudo nala history redo [transaction-id]

Remove an entry with the clear subcommand.

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 clean command.

sudo nala clean

The output confirms the operation was successful.

Clearing out the local repository in Nala.

Optional Nala Arguments

The following is the list of flags you can add to the nala commands to enable additional options.

  • --assume-yes (-y) provides the yes answer to all prompts and allows the command to run non-interactively.
  • --debug and --verbose (-v) provide additional debugging related information.
  • --download-only (-d) tells Nala to download packages but not to unpack or install them.
  • --help (-h) shows the help section.
  • --no-autoremove disables package auto removal.
  • --no-update instructs Nala to skip updating the packages.
  • --raw-dpkg disables formatting and shows raw dpkg output.
  • --remove-essential allows the removal of all packages, including the essential ones.
  • --update tells Nala to perform package update.
  • --version shows Nala's version number.

Conclusion

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.

Was this article helpful?
YesNo
Marko Aleksic
Marko Aleksić is a Technical Writer at phoenixNAP. His innate curiosity regarding all things IT, combined with over a decade long background in writing, teaching and working in IT-related fields, led him to technical writing, where he has an opportunity to employ his skills and make technology less daunting to everyone.
Next you should read
Snap vs APT: What's the Difference?
January 21, 2021

While using repositories is convenient for many reasons, it often presents an obstacle for users who are not tech-savvy. Several alternative packaging systems...
Read more
Comprehensive Guide to Using Snap Packages
March 4, 2021

Snaps are contained applications in the form of packaged software. The package manager for Snap apps is Snap, created by Canonical for Linux.
Read more
YUM vs. APT: What's the Difference?
November 24, 2022

YUM and APT are among the most popular and easiest-to-learn package managing utilities. In this article, you will learn the difference between APT and YUM and their basics.
Read more
How to Fix 'add-apt-repository command not found'
August 7, 2019

The 'add-apt-repository command not found' error indicates that the add-apt-repository package is missing.
Read more