pgAdmin is a feature-rich tool that helps us manage and control the Postgres Database. It is free to use and offers many useful features, such as an appealing and easy-to-use interface, cross-platform availability, local and remote session management, and many more. When a user installs Postgres on Windows, pgAdmin comes installed by default. However, when it comes to Ubuntu, users have to install it manually.
This write-up illustrates a step-by-step guide on how to install pgAdmin on Ubuntu 22.04.
How to Install pgAdmin on Ubuntu 22.04?
To install pgAdmin on Ubuntu 22.04, users have to go through the following steps:
Step 1: Install Curl
“curl” is a useful command line tool that helps users transfer data between servers. It is a prerequisite for installing pgAdmin on Ubuntu 22.04. If you haven’t installed curl on your Ubuntu machine yet, simply run the below-provided “sudo” command:
sudo apt install curl
Step 2: Add Public Key Using Curl
To install pgAdmin on Ubuntu 22.04, users need to add/include a public key. For this purpose, users must execute the following curl command:
sudo curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add
Step 3: Add pgAdmin Repository
After successfully adding the public key, execute the provided command to add the pgAdmin repository:
sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list'
Step 4: Update Server’s Packages
To ensure optimal performance it is highly recommended to update the system packages before installing any new software or packages. This can be accomplished by running the below-given command:
sudo apt update
Step 5: Install pgAdmin
After successfully updating the server’s packages, you can proceed to install pgAdmin on Ubuntu operating system by executing the following command:
sudo apt install pgadmin4 -y
If everything goes smoothly, pgAdmin 4 will be successfully installed on your Ubuntu machine:
How to Launch/Use pgAdmin on Ubuntu 22.04?
Once the installation process is complete, you can search for “pgAdmin” in the search box and click on the “pgAdmin4” application to open it:
Upon doing so, you will be directed to the following window:
Click on the “Add New Server” tree, which will take you to the following window. Provide the server name in the “General” tab and head into the connection tab:
Provide the connection details under the “Connection” tab and click the “Save” button to register the server:
As soon as you hit the “Save” button, a new server will be added to the “servers” tree:
Step 7: Perform a Postgres Operation
To verify if pgAdmin is functioning correctly, let’s execute a built-in Postgres function. For this purpose, first, open the query tool from the “Tools” tab, then execute the NOW() function to get current date and time:
That’s all about installing and using pgAdmin on Ubuntu 22.04.
To install pgAdmin on Ubuntu 22.04, install curl utility, add a public key using curl, add pgAdmin repository, update server’s packages, and then execute the “sudo apt install pgadmin4 -y” command. Once pgAdmin is successfully installed on Ubuntu 22.04, users can execute any command or function to verify if pgAdmin is functioning properly. This guide has shown you all the necessary steps to install pgAdmin on Ubuntu 22.04.