Learn how to *install PostgreSQL and PGAdmin on Ubuntu 24.04 LTS* step by step. PostgreSQL is a powerful open-source relational database system, and PGAdmin is a feature-rich GUI tool for managing PostgreSQL databases. In this guide, we’ll cover how to set up both tools, configure them, and start using them efficiently. <br /><br />---<br /><br />What You’ll Learn: <br />1. Installing PostgreSQL on Ubuntu 24.04 LTS. <br />2. Installing and setting up PGAdmin. <br />3. Configuring PostgreSQL to work with PGAdmin. <br /><br />---<br /><br />Steps to Install PostgreSQL <br /><br />#### 1. *Update System Packages* <br />Keep your system up to date: <br />```bash<br />sudo apt update && sudo apt upgrade -y<br />``` <br /><br />#### 2. *Install PostgreSQL* <br />Install the PostgreSQL database server: <br />```bash<br />sudo apt install postgresql postgresql-contrib -y<br />``` <br /><br />#### 3. *Start and Enable PostgreSQL* <br />Ensure the PostgreSQL service is running and enabled at boot: <br />```bash<br />sudo systemctl start postgresql<br />sudo systemctl enable postgresql<br />``` <br /><br />#### 4. *Switch to PostgreSQL User* <br />Switch to the default PostgreSQL user to configure the database: <br />```bash<br />sudo -i -u postgres<br />``` <br /><br />#### 5. *Access PostgreSQL Prompt* <br />Enter the PostgreSQL shell: <br />```bash<br />psql<br />``` <br />Create a new database user or modify configurations as needed. <br />Exit the shell using: <br /> ```sql<br /> \q<br /> ``` <br /><br />---<br /><br />Steps to Install PGAdmin <br /><br />#### 1. *Install Dependencies* <br />Install required dependencies: <br />```bash<br />sudo apt install curl ca-certificates -y<br />``` <br /><br />#### 2. *Add the PGAdmin Repository* <br />Import the repository key and add the PGAdmin repository: <br />```bash<br />#### 3. *Install PGAdmin* <br />Update the package list and install PGAdmin: <br />```bash<br />sudo apt update<br />sudo apt install pgadmin4-web -y<br />``` <br /><br />#### 4. *Configure PGAdmin* <br />Run the setup script to configure PGAdmin: <br />```bash<br />sudo /usr/pgadmin4/bin/setup-web.sh<br />``` <br />Set up an admin email and password for accessing the PGAdmin web interface. <br /><br />#### 5. *Access PGAdmin* <br />Open a browser and go to `http://server-ip/pgadmin4` or `http://127.0.0.1/pgadmin4`. <br />Log in using the admin credentials you set earlier. <br /><br />---<br /><br />Connect PostgreSQL to PGAdmin <br />1. Open PGAdmin and add a new server. <br />2. Provide the *name* for the server. <br />3. Under the *Connection* tab, add: <br />Host: `localhost` <br />Port: `5432` <br />Username: `postgres` <br />Password: The password set for the `postgres` user. <br />4. Save the configuration and start managing your PostgreSQL databases. <br /><br />---<br /><br />Why Use PostgreSQL and PGAdmin? <br />**PostgreSQL**: Reliable, feature-rich, and highly extensible database. <br />**PGAdmin**: Simplifies database management with a user-friendly GUI. <br /><br />By following these steps, you’ll have PostgreSQL and PGAdmin installed and ready for use on Ubuntu 24.04 LTS. Like, share, and subscribe for more Linux tutorials!