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.
So, let us install pgAdmin4 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:
Once PostgreSQL is correctly installed and configured then we can proceed to install PgAdmin4 without any problems.
The first thing we have to do is update the operating system.
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.
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
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.
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.
And there you will have to set the password.
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.
Now we can access
http://your-server/pgadmin4 and you should see the following screen
Now login with your credentials and you will see the pgAdmin main screen. This proves that everything works.
All you have to do now is add your PostgreSQL instance.
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.