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.
---
What You’ll Learn: 1. Installing PostgreSQL on Ubuntu 24.04 LTS. 2. Installing and setting up PGAdmin. 3. Configuring PostgreSQL to work with PGAdmin.
---
Steps to Install PostgreSQL
#### 1. *Update System Packages* Keep your system up to date: ```bash sudo apt update && sudo apt upgrade -y ```
#### 3. *Start and Enable PostgreSQL* Ensure the PostgreSQL service is running and enabled at boot: ```bash sudo systemctl start postgresql sudo systemctl enable postgresql ```
#### 4. *Switch to PostgreSQL User* Switch to the default PostgreSQL user to configure the database: ```bash sudo -i -u postgres ```
#### 5. *Access PostgreSQL Prompt* Enter the PostgreSQL shell: ```bash psql ``` Create a new database user or modify configurations as needed. Exit the shell using: ```sql \q ```
#### 2. *Add the PGAdmin Repository* Import the repository key and add the PGAdmin repository: ```bash #### 3. *Install PGAdmin* Update the package list and install PGAdmin: ```bash sudo apt update sudo apt install pgadmin4-web -y ```
#### 4. *Configure PGAdmin* Run the setup script to configure PGAdmin: ```bash sudo /usr/pgadmin4/bin/setup-web.sh ``` Set up an admin email and password for accessing the PGAdmin web interface.
#### 5. *Access PGAdmin* Open a browser and go to `http://server-ip/pgadmin4` or `http://127.0.0.1/pgadmin4`. Log in using the admin credentials you set earlier.
---
Connect PostgreSQL to PGAdmin 1. Open PGAdmin and add a new server. 2. Provide the *name* for the server. 3. Under the *Connection* tab, add: Host: `localhost` Port: `5432` Username: `postgres` Password: The password set for the `postgres` user. 4. Save the configuration and start managing your PostgreSQL databases.
---
Why Use PostgreSQL and PGAdmin? **PostgreSQL**: Reliable, feature-rich, and highly extensible database. **PGAdmin**: Simplifies database management with a user-friendly GUI.
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!
Sé la primera persona en añadir un comentario