How to Install or Uninstall sudo on Ubuntu 22.04

Updated: September 8, 2022

Sudo is a program designed to allow a sysadmin to give limited root privileges to users and log root activity. The basic philosophy is to give as few privileges as possible but still allow people to get their work done. In this tutorial, I will show you how to install sudo on Ubuntu 22.04.

Software Requirement

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

Prerequisites to install sudo on Ubuntu 22.04

Install sudo Ubuntu 22.04

sudo 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 sudo using APT

This is one of the popular ways to install any Ubuntu packages because it is simple to understand, even if you are a Linux novice. Following these steps to get sudo on your Ubuntu 22.04.

Step 1: The APT package repository cache needs to be updated before you try to install, update, or remove any packages. Update the APT database to download new packages from Ubuntu. Launching the terminal and entering the following Linux command:

sudo apt update

Step 2: Install the package on Ubuntu 22.04. You can now install sudo Ubuntu by executing this command in the terminal.

sudo apt install sudo

Install sudo using Aptitude

Users can manage their installation, upgrade, and removal of packages with Aptitude and view a list of the packages that are currently available. You must run this command to install it if you haven’t already done so on Ubuntu.

sudo apt-get install aptitude

Then, you can now install sudo by following these steps:

Step 1: The APT package repository cache needs to be updated before you try to install, update, or remove any packages. Update the APT database to download new packages from Ubuntu. Launching the terminal and entering the following Linux command:

sudo apt-get update

Step 2: Install the package on Ubuntu 22.04. You can now install sudo Ubuntu by executing this command in the terminal.

sudo aptitude install sudo

Uninstall sudo 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.

This command can be used to uninstall sudo from Ubuntu 22.04 if it was installed using APT or Aptitude.

sudo apt remove --auto-remove sudo

To uninstall sudo and remove its data and dependencies, you can also use the following command:

sudo apt autoremove --purge sudo

Conclusion

In this tutorial, I showed you ways to install sudo on Ubuntu 22.04 and some ways to uninstall sudo too. If you need any help, don’t hesitate to contact me. I’m very glad to answer them.