How to Install or Uninstall php-gd Ubuntu 22.04

Updated: October 22, 2022

This package provides a GD module for PHP. I will show you how to install php-gd on Ubuntu 22.04 in this guide.

Requirements to install

  • OS: Ubuntu 22.04 or older Ubuntu versions
  • Privileges: Ensure that you are able to execute the sudo commands line.

Prerequisites to install php-gd on Ubuntu 22.04

Install php-gd Ubuntu 22.04

php-gd is one of the popular ways on Ubuntu now so that this tutorial will show you how to install it in various ways. Choose the one you believe is simple and easy to follow.

Install php-gd using APT

This is a popular method for installing Ubuntu packages because it’s easy to follow, even if you are a newbie in Linux. Following these instructions to install php-gd on your Ubuntu 22.04.

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. Launch the terminal and enter the following Linux command:

sudo apt-get -y update

Step 2: Start installing the packages on Ubuntu 22.04. You can now install php-gd Ubuntu by executing this command in the terminal.

sudo apt -y install php-gd

Install php-gd using Aptitude

If you didn’t install Aptitude on Ubuntu, you need to install it by executing this command.

sudo apt-get -y install aptitude

Then, you can now install php-gd by 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. Launching the terminal and entering the following Linux command:

sudo apt -y update

Step 2: Start installing the packages on Ubuntu 22.04. You can now install php-gd Ubuntu by executing this command in the terminal.

sudo aptitude -y install php-gd

Uninstall php-gd on Ubuntu 22.04

Have you ever considered how challenging it might be to uninstall an application from Ubuntu? You’re wrong, anyone can easily uninstall any program, not just a php-gd.

You can uninstall php-gd on Ubuntu by running this command if you installed it using APT or Aptitude.

sudo apt remove --auto-remove php-gd

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

sudo apt autoremove --purge php-gd

Ending

In this guide, I showed you ways to install php-gd on Ubuntu 22.04 and some ways to uninstall php-gd too. Please do not hesitate to contact me if you require any assistance. I’m delighted to respond to them.