How to Install and Uninstall nftables on Ubuntu 22.04

Updated: September 20, 2022

This software provides an in-kernel packet classification framework that is based on a network-specific Virtual Machine (VM) and the nft userspace command line tool. The nftables framework reuses the existing Netfilter subsystems such as the existing hook infrastructure, the connection tracking system, NAT, userspace queueing and logging subsystem. In this tutorial, I will show you ways to install nftables Ubuntu 22.04.

Prerequisites to install

  • OS: Ubuntu 22.04 or older Ubuntu versions
  • Privileges: Check that you can run sudo commands.

Prerequisites to install nftables on Ubuntu 22.04

Install nftables Ubuntu 22.04

nftables is one of the popular ways on Ubuntu now so that this tutorial will show you some ways to install it. Choose the one that you think is easy and you can follow.

Install nftables using APT

This is one of the popular ways to install any Ubuntu packages because it’s easy to follow, even if you are a newbie in Linux. Following these instructions to install nftables on your Ubuntu.

Step 1: You must update the APT package repository cache before attempting to install, update, or remove any packages. Update the APT database to download new packages from Ubuntu. Opening the terminal and executing this Linux command:

sudo apt-get -y update

Step 2: Start the package installation on Ubuntu 22.04. After updating the system, you can install nftables Ubuntu by executing this command in the terminal.

sudo apt install nftables

Install nftables using Aptitude

Aptitude allows users to view a list of available packages and manage package installation, upgrade, and removal. If you haven’t already done so, run this command to install it.

sudo apt-get -y install aptitude

After installing, you can now install nftables, just following these steps:

Step 1: You must update the APT package repository cache before attempting to install, update, or remove any packages. Update the APT database to download new packages from Ubuntu. Opening the terminal and executing this Linux command:

sudo apt update

Step 2: Install the package on Ubuntu 22.04. After updating, you can install nftables Ubuntu by executing this command in the terminal.

sudo aptitude -y install nftables

Uninstall nftables on Ubuntu 22.04

Have you ever considered how difficult it is to uninstall an application from Ubuntu? You are mistaken; anyone, not just package administrators, can easily uninstall any program.

If you installed nftables using APT or Aptitude, you could uninstall nftables on Ubuntu by following this step:

sudo apt remove --auto-remove nftables

You can also execute this command if you want to uninstall nftables and remove its data and dependencies:

sudo apt autoremove --purge nftables

Conclusion

In this guide, I showed you ways to install nftables on Ubuntu 22.04 and ways to uninstall nftables too. Please contact me if you require any assistance. I’d be delighted to respond.