pgAdmin 4 : Installation steps on centOS 7
pgAdmin 4 : Installation steps on centOS 7
pgAdmin, a free and open source management tool for PostgreSQL and derivative relation databases like EDB Advanced Server. This can be installed on multiple OS platforms like Linux, Unix, Mac OS X, and Windows to manage PostgreSQL 9.2 and above.
pgAdmin can be run as both web and desktop application.
As web based application, it is deployed behind a web server running as a reverse proxy or using the WSGI interface.
In desktop deployment, it is deployed to run in desktop mode by utilizing the desktop run time to host the application. When the run time is launched, it runs the pgAdmin server and launches a web browser to render the user interface.
Now, we are going to see the pgAdmin 4 installation steps in CentOS 7 (Web Deployment).
- Server with root login
Installing PostgreSQL Server
First, we need to enable the EPEL repository to download dependent packages for pgAdmin.
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Set up PostgreSQL Repository (PostgreSQL 11)
pgAdmin 4 is available in PostgreSQL repository and your system should have the PostgreSQL repository by now, if you have already completed the installation of PostgreSQL. If not, add the PostgreSQL repository using the below command.
yum install https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7-x86_64/pgdg-centos11-11-2.noarch.rpm
yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm
Install pgAdmin 4
Once the PostgreSQL repository configured on your system, run the following command to install pgAdmin 4.
yum -y install pgadmin4
Now, Check you have started and enabled httpd service
systemctl start httpd systemctl enable httpd
Configure pgAdmin 4
Now, we need to do some configuration changed to access pgAdmin 4. Copy the pgAdmin 4 sample configuration.
cp /etc/httpd/conf.d/pgadmin4.conf.sample /etc/httpd/conf.d/pgadmin4.conf
Create a pgAdmin log and data directories.
mkdir /var/log/pgadmin4/ mkdir /var/lib/pgadmin4/
Now, edit config_local.py file
Add the below settings for log and session save path
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'
Change permissions of directories, so that Apache can write data into it.
chown -R apache:apache /var/lib/pgadmin4/ chown -R apache:apache /var/log/pgadmin4/
To create a user account for the pgAdmin 4 web interface, run the below command.
NOTE: Configuring authentication for SERVER mode. Enter the email address and password to use for the initial pgAdmin user account: Email address: firstname.lastname@example.org Password:******** Retype password:******** pgAdmin 4 - Application Initialisation ======================================
Now, restart the apache service.
systemctl restart httpd
Setup firewall, to access pgAdmin 4 from external/remote machines.
firewall-cmd --permanent --add-service=http firewall-cmd --reload
Note: Consider disabling SELinux permanently for pgAdmin 4 to work properly.
Access pgAdmin 4, from browser using the below URL
Log in to pgAdmin 4 web interface using the email address and password you have created earlier.
Click on Add New Server, to manage a PostgreSQL server.
In General Tab,
Name : Enter your server ip address or hostname.
Hostname/address:- Hostname or IP Address of PostgreSQL server
Port:- 5432 (Leave default) – Change it if required
Username:- Username by which you are connecting.
Password:- Password for the user
Make sure you have enabled the port 5432 in your server
if not enable the port using the below commands.
firewall-cmd --zone=public --permanent --add-port=5432/tcp firewall-cmd --reload
Click Save to save the changes. Now you can see the server you have added.
If you are getting Fatal: Ident authentication failed for user error, edit the below file and modify the authentication.
modify the file as below
# TYPE DATABASE USER ADDRESS METHOD host all all all md5
Restart the PostgreSQL service.
systemctl restart postgresql-11
systemctl restart postgresql-10
Now, pgAdmin4 is installed on our sever, hope this post is helpful.
Please share your valuable comments to improve us.