Pgadmin 4 установить linux fedora

How To Install PostgreSQL and pgAdmin4 in Fedora 35/34

PostgreSQL is an open-source object-relational, highly scalable, SQL-compliant database management system. It is developed at the University of California at Berkeley’s Computer Science Department. At the time of the last update of this article, PostgreSQL 13 is the latest stable version available for production servers. PostgreSQL 14 is under the development mode and not suggested for production users.

pgAdmin4 is a client application used for managing PostgreSQL servers graphically. It is available as a desktop application for Linux desktop systems as well as a web application. Which provides a beautiful and easy-to-use web interface and helps us to increase productivity.

This article will help you to install the PostgreSQL server on Fedora 34/33 Linux system. Also, provide you the instructions to install pgAdmin4 on the Fedora system. This article has been tested with the Fedora version 34.

Step 1 – Installing PostgreSQL on Fedora

Follow the below instructions to install the PostgreSQL server on a Fedora system.

1. First of all, search for the available DNF modules contains the PostgreSQL server packages. Open a terminal and type the below command:

sudo dnf module list postgresql 

DNF search for PostgrSQL repositories

2. In the above command, you will see the available PostgreSQL versions. Now enable the repository of the required version. The below command will enable the repository for the PostgreSQL 13 on your system.

sudo dnf module enable postgresql:13 

Enable PostgreSQL Repository with DNF

3. Once you have successfully enabled the required DNF module. Use the following command to install the PostgreSQL server packages using DNF package manager. This will also install additional required packages on your system.

sudo dnf install postgresql-server 

Press ‘y’ to confirm and finish the packages installation.

4. After that, you need to initialize the PostgreSQL data directory. In other words, this will create a data directory and other configuration files on your system.

To initialize the database server, type:

sudo postgresql-setup --initdb 

Initialize PostgreSQL environment on Fedora

After finishing the above command, the PostgreSQL server installation is completed on your Fedora system. PostgreSQL server uses PGDATA environment variable to contain the data directory location.

Читайте также:  Тонкая настройка postgresql linux

Setp 2 – Manage PostgreSQL Service

To start the PostgreSQL service use the following command as per your operating systems. Also, enable the PostgreSQL service to autostart on system boot.

sudo systemctl enable postgresql sudo systemctl start postgresql 

You can see the current status of the service using the following command.

sudo systemctl status postgresql 

Managing PostgreSQL service on Fedora

Step 3 – Secure Postgres User

After completing the above steps. Your PostgreSQL 11 server is ready to use. Log in to the postfix instance to verify the connection.

You may create a strong password for the “postgres” account to enhance server security.

postgres=# \password postgres

Create password for

Step 4 – Installing pgAdmin4 on Fedora

The pgAdmin4 is a great tool for managing PostgreSQL server databases with a graphical interface. It is available as an application for desktop systems. Also, a web version is available to access in a web browser. The below steps will help you to set pgAdmin4 on your Fedora system.

1. First, configure the pgAdmin4 repository to your Fedora system. In a terminal execute the following command.

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

2. After that, install the pgadmin4-web package on your system. This will also add other dependencies to your system.

sudo dnf install pgadmin4-web 

Installing pgAdmin web interface on Fedora

3. The policycoreutils-python-utils package contains the management tools use to manage an SELinux environment for the Python applications. Install it on your system with the following command.

sudo dnf install policycoreutils-python-utils 

4. Finally, run a shell script to configure the pgAdmin4 on your system. This will prompt for an email address and password to enable web application authentication.

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

Configure pgAdmin Environment on Fedora

Remember that, this authentication is just for login to the pgAdmin4 dashboard. It can’t be used to log in to the PostgreSQL server.

Step 5 – Allow Public Access to pgAdmin4

The Fedora systems use a firewall to protect the server from external users. You need to allow access on port 80 to access pgAdmin4 from outside of the server.

To open web port in firewall, type:

sudo firewall-cmd --add-port=80/tcp --permanent sudo firewall-cmd --reload 

As the Fedora system has default SELinux in enforcing mode, you need to apply SELinux setting to allow network access to the webserver.

sudo setsebool -P httpd_can_network_connect 1 

In the end, restart the Apache service to reload all the settings and changes.

sudo systemctl restart httpd 

Step 6 – Access pgAdmin4

Now, you can access the pgAdmin4 web application in a web browser. Access your server with the IP address following with /pgadmin4

Читайте также:  Linux software distribution system

Login to pgAdmin on Fedora

Enter login credentials created in the above step. After a successful login, you will get access to the pgAdmin4 dashboard. Here you can connect multiple PostgreSQL servers and manage them.

pgAdmin Dashboard on Fedora

Conclusion

In conclusion, You have successfully installed the PostgreSQL server on the Fedora Linux system. Additionally, provides you instructions to install the pgAdmin4 dashboard to manage the PostgreSQL server graphically.

Источник

How To Install pgAdmin 4 on CentOS 7 / RHEL 7 & Fedora 29 / Fedora 28

ITzGeek

pgAdmin is a free and open source management tool for PostgreSQL and derivative relation databases such as EDB Advanced Server. It can be installed on multiple OS platforms such as Linux, Unix, Mac OS X, and Windows to manager PostgreSQL 9.2 and above.

Deployment Mode

pgAdmin can be run as a web or desktop application.

Server Deployment

In server deployment (web application), it is deployed as a web application behind a web server running as a reverse proxy or using the WSGI interface.

Desktop Deployment

In desktop deployment (desktop application), it is deployed to run in desktop mode by utilizing the desktop runtime to host the application. When the runtime is launched from system-tray, it runs the pgAdmin server and launches a web browser to render the user interface.

In this guide, we will install pgAdmin 4 on CentOS 7 / RHEL 7 & Fedora 29 / Fedora 28 as a web application (server deployment).

Prerequisites

Install PostgreSQL Server

This post assumes that you already have PostgreSQL 9.2 and above installed on your system. Otherwise, follow the post: How To Install PostgreSQL 11 / 10 on CentOS 7 / RHEL 7.

Set up EPEL Repository

We would 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

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.

### PostgreSQL 11 ### # RHEL 7 # yum install https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7-x86_64/pgdg-redhat11-11-2.noarch.rpm # CentoS 7 # yum install https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7-x86_64/pgdg-centos11-11-2.noarch.rpm # Fedora 29 # dnf install https://download.postgresql.org/pub/repos/yum/11/fedora/fedora-29-x86_64/pgdg-fedora11-11-2.noarch.rpm # Fedora 28 # dnf install https://download.postgresql.org/pub/repos/yum/11/fedora/fedora-28-x86_64/pgdg-fedora11-11-2.noarch.rpm ### PostgreSQL 10 ## # RHEL 7 # yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-redhat10-10-2.noarch.rpm # CentoS 7 # yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm # Fedora 29 # dnf install https://download.postgresql.org/pub/repos/yum/10/fedora/fedora-29-x86_64/pgdg-fedora10-10-4.noarch.rpm  # Fedora 28 # dnf install https://download.postgresql.org/pub/repos/yum/10/fedora/fedora-28-x86_64/pgdg-fedora10-10-4.noarch.rpm

Install pgAdmin 4

Once you have PostgreSQL repository configured on your system, run the following command to install pgAdmin 4.

### RHEL / CentOS ### yum -y install pgadmin4 ### Fedora ### dnf -y install pgadmin4

Start and enable httpd service.

systemctl start httpd systemctl enable httpd

Configure pgAdmin 4

We would need to do a few configuration changes prior to accessing the pgAdmin 4.

Читайте также:  Настройка терминального сервера linux

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/

Create/Edit config_local.py file.

vi /usr/lib/python2.7/site-packages/pgadmin4-web/config_local.py

Add the following settings.

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/*

Run the following command to create a user account for the pgAdmin 4 web interface.

python /usr/lib/python2.7/site-packages/pgadmin4-web/setup.py
NOTE: Configuring authentication for SERVER mode. Enter the email address and password to use for the initial pgAdmin user account: Email address: [email protected] Password: xxxxxxxxx Retype password: xxxxxxxxx pgAdmin 4 - Application Initialisation ======================================

Restart the Apache web service.

Firewall

Set up the firewall so that we can access pgAdmin 4 from external machines.

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

SELinux

Consider disabling SELinux permanently for pgAdmin 4 to work properly.

Access pgAdmin 4

Open a web browser and go to the following URL to access the pgAdmin 4 interface.

Log in to pgAdmin 4 web interface using the email address and password you have created earlier.

Install pgAdmin 4 on CentOS 7 - pgAdmin Login Screen

Upon successful login, you should see the pgAdmin 4 interface.

Install pgAdmin 4 on CentOS 7 - pgAdmin Home Page

To manage a PostgreSQL server, you will need to add a new server. Click on Add New Server.

General Tab:

Name:- Name your PostgreSQL Server

Install pgAdmin 4 on CentOS 7 - Add New PostgreSQL Instance

Connection Tab:

Hostname/address:- Hostname or IP Address of PostgreSQL server
Port:- 5432 (Leave default) – Change it if required
Username:- Username by which you are connecting. In my case, it is postgres.
Password:- Password for the user

Install pgAdmin 4 on CentOS 7 - PostgreSQL Instance Details

Click Save to save the changes.

If the connection to PostgreSQL server is successful, you should see the following page.

Install pgAdmin 4 on CentOS 7 - Database Statistics

Troubleshooting

You may get a Fatal: Ident authentication failed for user error.

Install pgAdmin 4 on CentOS 7 - PostgreSQL Error

To fix the issue, edit pg_hba.conf file.

### PostgreSQL 11 ### vi /var/lib/pgsql/11/data/pg_hba.conf ### PostgreSQL 10 ### vi /var/lib/pgsql/11/data/pg_hba.conf

Update the below line shown like below.

# TYPE DATABASE USER ADDRESS METHOD host all all all md5

Restart the PostgreSQL service.

### PostgreSQL 11 ### systemctl restart postgresql-11 ### PostgreSQL 10 ### systemctl restart postgresql-10

Conclusion

You have successfully installed pgAdmin 4 on CentOS 7 / RHEL 7 & Fedora 29 / Fedora 28 and added one of your PostgreSQL instances to it to manage the database. pgAdmin 4 is similar to phpPgAdmin in terms of managing PostgreSQL databases. You can visit pgAdmin 4 documentation for more information.

Источник

Оцените статью
Adblock
detector