How to Uninstall and Install g++-9 Ubuntu 22.04

Updated: October 20, 2022

This is the GNU C++ compiler, a fairly portable optimizing compiler for C++. In this tutorial, I will show you ways to install g++-9 Ubuntu 22.04.

Requirements to install

  • Operating system: Ubuntu 22.04 is needed for g++-9 to work
  • Privileges: Make sure you are able to execute sudo commands.

Prerequisites to install g++-9 on Ubuntu 22.04

Install g++-9 Ubuntu 22.04

g++-9 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 g++-9 using APT

This is a popular method for installing Ubuntu packages since it’s simple to understand, even if you’re new to Linux. Following these steps to get g++-9 on your Ubuntu 22.04.

Step 1: Update the APT database to download new packages from Ubuntu. Opening the terminal and executing the following Linux command:

sudo apt-get update

Step 2: Install the package on Ubuntu 22.04. After updating, you can install g++-9 Ubuntu by pasting this command into the terminal and executing it.

sudo apt-get install g++-9

Install g++-9 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 install aptitude

Then, you can now install g++-9, just following these steps:

Step 1: The APT package repository cache needs to be updated before you try to install, update, or remove any packages. Obtain new packages from Ubuntu by updating the APT database. Opening the terminal and executing the following Linux command:

sudo apt-get update

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

sudo aptitude install g++-9

Uninstall g++-9 on Ubuntu 22.04

Have you ever thought that uninstalling an application from Ubuntu might be challenging? You’re wrong; any program, not just a g++-9, can be easily uninstalled by anyone.

You can uninstall g++-9 Ubuntu by running this command if you installed it using APT or Aptitude.

sudo apt remove --auto-remove g++-9

If you want to uninstall g++-9 and delete its data and dependencies, you can also run the following command:

sudo apt autoremove --purge g++-9

Ending

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