CentOSRHEL Based

How To Install pgAdmin on CentOS Stream 10

Install pgAdmin on CentOS Stream 10

In this tutorial, we will show you how to install pgAdmin on CentOS Stream 10. PostgreSQL is a powerful, open-source object-relational database system known for its robustness and scalability. pgAdmin, a popular web-based administration tool for PostgreSQL, offers a user-friendly interface for managing databases. This article will guide you through the process of installing pgAdmin on CentOS Stream 10, ensuring you have all the necessary steps and troubleshooting tips to get started effectively.

Prerequisites

Before diving into the installation process, ensure that your system meets the following prerequisites:

  • System Requirements: A machine running CentOS Stream 10 with sufficient resources (at least 1 GB RAM and 2 CPU cores recommended).
  • Software Requirements: Ensure PostgreSQL is installed on your system. You can install it alongside pgAdmin if not already present.
  • User Permissions: You will need sudo privileges to install packages and make system changes.

Step 1: Update Your System

Keeping your system updated is crucial for security and performance. Open your terminal and run the following command:

sudo dnf update -y

This command updates all installed packages to their latest versions. It’s a good practice to restart your system after updates to ensure all changes take effect.

Step 2: Enable EPEL Repository

The Extra Packages for Enterprise Linux (EPEL) repository contains additional packages not included in the standard CentOS repositories, which are essential for installing pgAdmin. To enable EPEL, execute:

sudo dnf install epel-release -y

After enabling EPEL, verify that it is correctly set up by listing the enabled repositories:

dnf repolist

Step 3: Install pgAdmin4

The next step is to add the official pgAdmin repository and install pgAdmin4. Start by adding the repository with the following command:

sudo rpm -i https://ftp.postgresql.org/pub/pgadmin/pgadmin4/yum/pgadmin4-redhat-repo-2-1.noarch.rpm

Now, install pgAdmin4 using DNF:

sudo dnf install pgadmin4 -y

This command will download and install pgAdmin along with its dependencies. Make sure to check for any errors during installation.

Step 4: Configure Apache Web Server

pgAdmin runs on a web server, so you need to configure Apache. First, start and enable the Apache service:

sudo systemctl start httpd
sudo systemctl enable httpd

Next, open the firewall to allow HTTP traffic:

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload

This ensures that your server can accept incoming connections on port 80.

Step 5: Set Up pgAdmin4

You need to run a setup script that configures pgAdmin for web access. Execute the following command:

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

You will be prompted to enter an email address and password for the initial admin user account. Make sure to remember these credentials as they will be used for logging in later.

SELinux Configuration

If SELinux is enabled on your system (which it usually is), you may need to adjust its settings to allow Apache to connect to PostgreSQL. Set SELinux to permissive mode temporarily with:

sudo setenforce permissive

This can help avoid potential access issues while setting up pgAdmin.

Step 6: Accessing pgAdmin4

Once the setup is complete, you can access pgAdmin through your web browser. Open a browser and navigate to:

http://localhost/pgadmin4

You should see the login page. Enter the email address and password you set during the setup process.

Install pgAdmin on CentOS Stream 10

Step 7: Adding a PostgreSQL Server in pgAdmin4

After logging in successfully, you’ll want to connect pgAdmin to your PostgreSQL server. Follow these steps:

  • Select “Servers” from the left pane.
  • Right-click and choose “Create” → “Server”.
  • In the “General” tab, provide a name for your server (e.g., MyLocalPostgres).
  • In the “Connection” tab:
    • Name: Give it a friendly name.
    • Host name/address: Use localhost if PostgreSQL is on the same machine.
    • Password: Enter the password for your PostgreSQL user (default is postgres).
  • Click “Save” to create the connection.

Troubleshooting Common Issues

If you encounter issues during installation or while accessing pgAdmin, consider these troubleshooting tips:

  • Error: “Could not connect to server”: Ensure that PostgreSQL is running by executing sudo systemctl status postgresql. If it’s not running, start it with sudo systemctl start postgresql.
  • Error: “pgAdmin application server could not be contacted”: This may indicate issues with Apache configuration or SELinux settings. Check Apache logs located at /var/log/httpd/error_log.
  • Error: Login issues: Double-check that you are using the correct email and password set during setup. If necessary, rerun the setup script.
  • If SELinux causes issues: You can set SELinux back to enforcing mode after confirming everything works by using sudo setenforce enforcing.
  • If you still face issues: Consider checking firewall settings or reinstalling components as a last resort.

Congratulations! You have successfully installed pgAdmin. Thanks for using this tutorial for installing pgAdmin4 on your CentOS Stream 10 system. For additional help or useful information, we recommend you check the official pgAdmin website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button