Installing pgAdmin on Ubuntu 22.04

If you’re a database administrator or developer working with PostgreSQL, then you know how important it is to have an efficient and user-friendly graphical user interface (GUI) for managing your databases. pgAdmin is one of the most popular choices for PostgreSQL management due to its rich feature set and user-friendly design. In this blog post, we’ll guide you step-by-step through the installation of pgAdmin on Ubuntu 22.04, ensuring you’re up and running quickly!

What is pgAdmin?

pgAdmin is an open-source database management tool designed to manage PostgreSQL databases with ease. It offers a web-based interface where you can design, query, and manage your databases. Features include:

  • Graphical Query Builder
  • Advanced data editing capabilities
  • Support for multiple database connections
  • Comprehensive management of database objects
  • Built-in data visualization tools

Step-by-Step Installation of pgAdmin on Ubuntu 22.04

Step 1: Update System Packages

Open your terminal and update your package lists to make sure you have the most recent versions of your packages:

sudo apt update
sudo apt upgrade -y

Step 2: Install Required Dependencies

pgAdmin requires certain packages to run smoothly. Install these dependencies by executing the following command:

sudo apt install curl ca-certificates gnupg

Step 3: Add pgAdmin Repository

First, you need to add the pgAdmin repository to your system. Execute the following commands:

 curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo gpg --dearmor -o /usr/share/keyrings/pgadmin.gpg

 echo "deb [signed-by=/usr/share/keyrings/pgadmin.gpg] https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/ubuntu jammy pgadmin4 main" | sudo tee /etc/apt/sources.list.d/pgadmin4.list > /dev/null

Step 4: Update Packages Again

Now that you’ve added the repository, update your package lists again to include the new pgAdmin packages:

sudo apt update

Step 5: Install pgAdmin

With the repository in place, you can now install pgAdmin. There are two options when it comes to installation: the desktop version and the web version. We’ll cover both.

Installing the Desktop Version

Run the following command to install the desktop version:

sudo apt install pgadmin4-desktop

Installing the Web Version

If you prefer the web version, run the command below instead:

sudo apt install pgadmin4-web

Step 6: Configure pgAdmin Web Mode

If you installed the web version, you’ll need to configure it by running the following command:

sudo /usr/pgadmin4/bin/setup-web.sh

This command will prompt you for several configuration options:

  1. Email address: Enter the email you want to use for pgAdmin login.
  2. Password: Create a strong password to protect your account.
  3. If you want to run it as a web application, confirm the options.

Step 7: Access pgAdmin

  • For the desktop version, you can simply search for pgAdmin in your application menu, and launch it from there.
  • To access the web version, open your web browser and go to http://127.0.0.1/pgadmin4 (or http://localhost/pgadmin4). Log in using the email and password you configured earlier.

Step 8: Connect to Your PostgreSQL Database

After logging in, you can connect to your PostgreSQL instance by clicking on “Add New Server” and entering your PostgreSQL connection details.

Conclusion

Congratulations! You’ve successfully installed pgAdmin on your Ubuntu 22.04 system. Whether you choose the desktop or web version, pgAdmin will provide an intuitive interface and powerful tools to help manage your PostgreSQL databases effectively.

If you encounter any issues during the installation or usage, feel free to consult the pgAdmin documentation for troubleshooting and advanced configurations.

Enjoy your database management experience with pgAdmin!

Leave a Comment