Before starting, ensure your system is up to date and you have installed all necessary dependencies:
$ sudo apt updateRun the following command to download and add the pgAdmin GPG key:
$ curl -fsS https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo gpg --dearmor -o /usr/share/keyrings/packages-pgadmin-org.gpgAdd the appropriate repository for your Ubuntu version. Replace circe with the correct codename (noble for Ubuntu 24.04):
$ sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/packages-pgadmin-org.gpg] https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/noble pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'
Install both the desktop and web versions of pgAdmin 4:
$ sudo apt install pgadmin4 pgadmin4-desktop pgadmin4-webTo configure pgAdmin 4 for web access, run the following setup script:
$ sudo /usr/pgadmin4/bin/setup-web.shYou will be prompted to enter your email and password for the initial pgAdmin user account. Follow the instructions:
- Email address: Enter a valid email address.
- Password: Enter your password (ensure that both passwords match).
You will also be asked if you want to configure Apache and enable the necessary modules. Answer yes when prompted.
Once the configuration is complete, restart Apache:
$ sudo systemctl restart apache2You can now access pgAdmin 4 in your web browser at the following URL:
http://127.0.0.1/pgadmin4
Log in using the email and password you set during the setup process.