13.5 C
Texas
angeloma
Senior Writer and partner

How to install pgAdmin4 on CentOS 8?

Hello friends in this post, you will learn how to install pgAdmin4 on CentOS 8. This process is quite simple but requires some steps.

pgAdmin is the most popular and features rich Open Source administration and development platform for PostgreSQL, the most advanced Open Source database in the world.

Thanks to this application, you can have a graphical interface to manage everything related to PostgreSQL. The main advantage of this program is the ability to view all the records we have stored. On the other hand, we can create connections and customize them to achieve even more security. It is also possible to create, modify, and delete databases.

So, pgAdmin4 becomes a printable application if you use a lot of PostgreSQL or if you want to use it for educational purposes.

- Advertisement -

So, let us install pgAdmin4 on CentOS 8.

Install PostgreSQL on CentOS 8

The first step we have to do is to have an instance of PostgreSQL up and running on our server. For this we have a post that can help you with this:

How to install PostgreSQL 12 on CentOS 8 / RHEL 8 / Oracle Linux 8?

Once PostgreSQL is correctly installed and configured then we can proceed to install PgAdmin4 without any problems.

Install pgAdmin4 on CentOS 8

The first thing we have to do is update the operating system.

dnf update

Then, enable the EPEL repository that we will need to enhance the installation:

dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

Within this repository, there is one called powertool that we also have to enable.

dnf config-manager --set-enabled powertools

And finally, install pgAdmin4 by running the following command:

dnf --enablerepo=powertools install pgadmin4

After accepting the changes, the download and installation process will begin.

Preparing pgAdmin4 for the firt use

Before using pgAdmin4 it is advisable to make a few settings so as not to have problems of any kind.

First, start and enable the Apache webserver that was installed during the process.

systemctl enable httpd
systemctl start httpd

pgAdmin comes with a default Apache configuration, which we can use or modify. In this case, we will copy it to take advantage of it.

cp /etc/httpd/conf.d/pgadmin4.conf.sample /etc/httpd/conf.d/pgadmin4.conf

Apply the changes by restarting Apache:

systemctl restart httpd

The next step is to create dedicated folders for pgAdmin log and lib. You can choose another location but the most pertinent is /var/

mkdir -p /var/lib/pgadmin4/
mkdir -p /var/log/pgadmin4/

You can then configure pgAdmin4 to tell it to use the paths of the folders you have created.

nano /usr/lib/python3.6/site-packages/pgadmin4-web/config_distro.py

And add the following lines:

LOG_FILE = '/var/log/pgadmin4/pgadmin4.log
SQLITE_PATH = '/var/lib/pgadmin4/pgadmin4.db
SESSION_DB_PATH = '/var/lib/pgadmin4/sessions
STORAGE_DIR = '/var/lib/pgadmin4/storage 

Save the changes, and then close the file.

Now define the username and password that we will use to access pgAdmin4.

python3 /usr/lib/python3.6/site-packages/pgadmin4-web/setup.py 

And there you will have to set the password.

1.- Configure a new admin for pgAdmin4
1.- Configure a new admin for pgAdmin4

Assign Apache to be the owner of the created directories.

chown -R apache:apache /var/lib/pgadmin4
chown -R apache:apache /var/log/pgadmin4

Apply all changes by restarting Apache and PostgreSQL.

systemctl restart httpd
systemctl restart postgresql-12 

Now we can use it.

Testing the installation

Now we can access http://your-server/pgadmin4 and you should see the following screen

2.- pgAdmin login screen
2.- pgAdmin login screen

Now login with your credentials and you will see the pgAdmin main screen. This proves that everything works.

3.- pgAdmin4 running on CentOS 8
3.- pgAdmin4 running on CentOS 8

All you have to do now is add your PostgreSQL instance.

Conclusion

pgAdmin4 is a vital tool to manipulate PostgreSQL visually and very easily. Its potentials are vast and it is recommended that you visit the project website to learn more about it.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article