PostgreSQL – TecAdmin https://tecadmin.net How to guide for System Administrator's and Developers Mon, 24 Oct 2022 05:47:54 +0000 en-US hourly 1 https://wordpress.org/?v=6.1.1 How to Install PostgreSQL and pgAdmin4 in Ubuntu 20.04 https://tecadmin.net/how-to-install-postgresql-in-ubuntu-20-04/ https://tecadmin.net/how-to-install-postgresql-in-ubuntu-20-04/#comments Wed, 07 Apr 2021 06:25:42 +0000 https://tecadmin.net/?p=25098 PostgreSQL is a powerful, reliable, robust and open source object-relational database system. The latest version of this database system is PostgreSQL 13.2, while versions 12.6, 11.11, 10.16, 9.6.21, & 9.5.25 still getting regular updates. This tutorial describes how to install the latest PostgreSQL on Ubuntu 20.04 LTS Linux system. Also, include the steps to install [...]

The post How to Install PostgreSQL and pgAdmin4 in Ubuntu 20.04 appeared first on TecAdmin.

]]>
PostgreSQL is a powerful, reliable, robust and open source object-relational database system.

The latest version of this database system is PostgreSQL 13.2, while versions 12.6, 11.11, 10.16, 9.6.21, & 9.5.25 still getting regular updates.

This tutorial describes how to install the latest PostgreSQL on Ubuntu 20.04 LTS Linux system. Also, include the steps to install pgAdmin4.

Prerequisites

A running Ubuntu 20.04 LTS system with shell access.

Log in as a sudo user and press “CTRL+ALT+T” to open a terminal. Then install a few required packages.

sudo apt update 
sudo apt install wget curl ca-certificates 

Step 1 – Install PostgreSQL in Ubuntu 20.04

First of all, Import the repository signing GPG key to your system. Open a terminal and use the below command to import key:

wget -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - 

Next, create a PPA file for PostgreSQL on your Ubuntu 20.04 system.

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ focal-pgdg main" >> /etc/apt/sources.list.d/pgdg.list' 

After adding the PPA to your system. Execute the following command to install the PostgreSQL server on your system.

sudo apt update 
sudo apt-get install postgresql postgresql-contrib 

Installing PostgreSQL in Ubuntu 20.04

Press ‘y’ for any confirmation prompted by the installer. The above command will install the latest version of the PostgreSQL server on your Ubuntu system.

After successful installation verify the PostgreSQL service:

sudo systemctl status postgresql 

Installing postgresql Ubuntu 20.04 LTS

Step 2 – Connection To PostgreSQL

Now, establish a connection with the newly installed Postgres database server. First switch to the system’s Postgres user account:

sudo su - postgres 

then type “psql” to get the postgress prompt:

psql 

psql (13.2 (Ubuntu 13.2-1.pgdg20.04+1))
Type "help" for help.

postgres=#

Connect PostgreSQL in Ubuntu 20.04

Instead of switching users to connect to PostgreSQL, You can also combine both of the above commands as a single command.

sudo -u postgres psql

psql (13.2 (Ubuntu 13.2-1.pgdg20.04+1))
Type "help" for help.

postgres=#

Once you are connected to PostgreSQL and you can see the connection information’s details, use the following command:

postgres=# \conninfo

The output displays information on the database name, the account you are logged in to, the socket path, and the port number.

PostgreSQL connection information in Ubuntu 20.04

Step 3 – Secure PostgreSQL

PostgreSQL installer creates a user “postgres” on your system. Default this user is not protected.

First, create a password for the “postgres” user account by running the following command.

sudo passwd postgres 

Next, switch to the “postgres” account Then switch to the Postgres system account and create a secure and strong password for PostgreSQL administrative database user/role as follows.

su - postgres 
psql -c "ALTER USER postgres WITH PASSWORD 'secure_password_here';" 
exit 

Restart the service to apply security changes.

sudo systemctl restart postgresql 

Step 4 – Install pgAdmin

We can use the official pgAdmin4 PPA to install the latest version of pgAdmin on your system.

First, import the repository signing GPG key and add the pgAdmin4 PPA to your system using the following commands.

curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add -
sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/focal pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list' 

After adding the PPA, update the Apt cache and install the pgAdmin4 package on your system.

sudo apt update
sudo apt install pgadmin4 

The pgadmin4 package contains both pgadmin4-web and pgadmin4-desktop versions, Here:

  • pgadmin4-web – Provides the web interface accessible in a web browser
  • pgadmin4-desktop – Provides desktop application for Ubuntu system, which required Ubuntu Desktop system.

You can install both or one of them of your choice. If you have installed both or pgadmin4-web, run the below command to configure it. This will add a login screen to the pgAdmin4 web dashboard.

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

The above script will prompt you to create a user to access the web interface. Input an email address and password when prompted. Say “y” for other confirmation asked by the script.

Once the script finished, you are good to access the pgAdmin web dashboard. It will be available at the below address:

Access this in a web browser: http://localhost/pgadmin4

Login to pgAdmin3 web

In any case, the above page is not loading, restart the Apache server using “sudo systemctl restart apache2“. Again try to load the above URL

Now login with the email address and password configured with /usr/pgadmin4/bin/setup-web.sh script. After successful login to pgAdmin4, you will see the below screen.

Add server to pgAdmin4

Here you need to add your Postgres server to pgAdmin4. Click on the “Add New Server” button. This will open a popup, Enter a friendly name, database host, and Postgres login credentials.

Click “Save” to complete the connection.

On successful authentication, you will see the databases in the sidebar as shown below screenshot.

pgAdmin4 connected to database server

All done. You have successfully added the Postgres database server to pgAdmin4. You can also add more database instances to a single pgAdmin4 server.

Conclusion

In this tutorial, you have learned to install a PostgreSQL server on a Ubuntu 20.04 system. Additionally, you have learned to install and configure pgAdmin4 on your system.

Next, you can learn about backup and restore Postgres databases via command line.

The post How to Install PostgreSQL and pgAdmin4 in Ubuntu 20.04 appeared first on TecAdmin.

]]>
https://tecadmin.net/how-to-install-postgresql-in-ubuntu-20-04/feed/ 6
How To Install PostgreSQL Server on CentOS 8 https://tecadmin.net/how-to-install-postgresql-and-pgadmin4-on-centos-8/ https://tecadmin.net/how-to-install-postgresql-and-pgadmin4-on-centos-8/#respond Sun, 10 Nov 2019 17:14:01 +0000 https://tecadmin.net/?p=19513 PostgreSQL is an object-relational database management system that stores data in the form of tables. It is highly secure and reliable and allows for easy storage, access, and retrieval of data. The pgAdmin is a feature-rich web-based interface for the administration, development, and management of PostgreSQL. It is also an open-source, free software just like [...]

The post How To Install PostgreSQL Server on CentOS 8 appeared first on TecAdmin.

]]>
PostgreSQL is an object-relational database management system that stores data in the form of tables. It is highly secure and reliable and allows for easy storage, access, and retrieval of data.

The pgAdmin is a feature-rich web-based interface for the administration, development, and management of PostgreSQL. It is also an open-source, free software just like PostgreSQL.

In this how-to guide we will learn to install PostgreSQL and pgAdmin4 on CentOS 8:

How to Install PostgreSQL on CentOS 8

01. Multiple versions of PostgreSQL are available in a default repository of CentOS 8. They can be listed on the terminal by using the below-given command:

dnf module list postgresql 
CentOS 8 Check Postgres Repository
List available Postgres DNF modules

There are four different versions available in the AppStream repository on my system. The [d] after the PostgreSQL version 10 indicates that version 10 is the default version of PostgreSQL.

02. By default it will install PostgreSQL 10 on your system. We can install any other version on our CentOS 8 system as well. To install any other version we will first need to reset the already installed module stream:

sudo dnf module reset postgresql -y 

03. Now we will enable the module stream of the latest PostgreSQL version:

sudo dnf module enable postgresql:13 -y 

04. Now run the installation command again. The terminal will now install the latest version i.e. version 13:

sudo dnf install postgresql-server -y 

Installing PostgreSQL on CentOS 8

05. You can verify the installed version by using the below-given command:

 postgres --version 
Output:
postgres (PostgreSQL) 13.3

06. Now that the latest version of PostgreSQL has been installed, initialize it by using the below-given command:

sudo postgresql-setup initdb 

PostgreSQL Initdb on CentOS 8

07. You can start the database by running the command:

sudo systemctl start postgresql 

08. The PostgreSQL can also be enabled to automatically start at the boot:

sudo systemctl enable postgresql 

09. You can check the status of the service by using this command:

sudo systemctl status postgresql 

how to install PostgreSQL on CentOS 8

10. You can also check whether the service has been successfully enabled to start at the boot:

sudo systemctl is-enabled postgresql 

How to Install PostgreSQL on CentOS 8

How to Install pgAdmin4 in CentOS 8

01. Now we will install pgAdmin4, the web-based PostgreSQL database management tool. To install pgAdmin4 we first need to install the EPEL repository:

sudo dnf install epel-release 

02. Next, we will install a pgAdmin repository to resolve the dependencies:

sudo dnf install -y https://ftp.postgresql.org/pub/pgadmin/pgadmin4/yum/pgadmin4-redhat-repo-1-1.noarch.rpm 

03. In order to install the pgAdmin4 on our system we will also need to remove some PostgreSQL repositories:

sudo dnf remove -y pgdg-redhat-repo 

This repository has already been uninstalled from my system.

04. Now we will make a cache for pgAdmin4 by executing the below-given command:

sudo dnf makecache 

05. We can finally install pgAdmin4 on our system as all the dependencies have been resolved:

sudo dnf install pgadmin4 

How to Install pgAdmin4 on CentOS 8

Press y and hit Enter whenever prompted to do so:

The pgAdmin4 has been successfully installed on the system.

06. The next step is to set up pgAdmin4. This can be done by opening the configuration file that comes with the pgAdmin4 package:

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

How to Install pgAdmin4 on CentOS 8

07. The configuration script will ask you for an email and a password to create a new user account for the web interface.

You can now access pgAdmin4 by navigating to the following address on your browser:

http://localhost/pgadmin4

For the remote systems, change “localhost” with the remote server IP address or domain name.

Installing pgAdmin4 on CentOS 8

Conclusion

The latest versions of PostgreSQL and pgAdmin4 have been successfully installed on your system. Now you can configure them according to your requirements.

PostgreSQL is a powerful RDBMS; It is open-source and runs across platforms and is known for its reliability and robust features. RDBMS helps store, organize, and access data in a structured manner. pgAdmin4 is a GUI-based web application that is used for the management of the PostgreSQL databases.

In this installation guide, we have learned to install PostgreSQL and pgAdmin4 on our CentOS 8 system.

The post How To Install PostgreSQL Server on CentOS 8 appeared first on TecAdmin.

]]>
https://tecadmin.net/how-to-install-postgresql-and-pgadmin4-on-centos-8/feed/ 0
How to Install PostgreSQL 11 on Debian 10 (Buster) https://tecadmin.net/install-postgresql-on-debian-10-buster/ https://tecadmin.net/install-postgresql-on-debian-10-buster/#respond Sun, 21 Jul 2019 16:53:37 +0000 https://tecadmin.net/?p=18905 PostgreSQL is an open-source object-relational database system. PostgreSQL 11 is the latest version available for the installation on Debian systems. It is one of the leading database server used for production servers. This tutorial will help you to install the PostgreSQL database server on Debian 10 Buster Linux systems. Installing pgAdmin4 on Debian 10 Step [...]

The post How to Install PostgreSQL 11 on Debian 10 (Buster) appeared first on TecAdmin.

]]>
PostgreSQL is an open-source object-relational database system. PostgreSQL 11 is the latest version available for the installation on Debian systems. It is one of the leading database server used for production servers. This tutorial will help you to install the PostgreSQL database server on Debian 10 Buster Linux systems.

Step 1 – Setup PostgreSQL PPA

First, you need to import PostgreSQL packages signing key on your system. Use the below command to import the key.

wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -

Now add PostgreSQL apt repository in your system as per your operating system. These are suggested on official PostgreSQL website using following command.

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'

Step 2 – Install PostgreSQL on Debian 10

At this stage, you have successfully added PostgreSQL official repository in your system. Now update the repository list. After that install Latest PostgreSQL Server in our Ubuntu system using following commands.

sudo apt-get update
sudo apt-get install postgresql postgresql-contrib

Step 3 – Connect to PostgreSQL

After installing the PostgreSQL database server by default, it creates a user ‘postgres’ with role ‘postgres’. It also creates a system account with the same name ‘postgres’. So to connect to postgres server, login to your system as user postgres and connect the database.

sudo -u postgres psql

psql (11.4 (Debian 11.4-1.pgdg100+1))
Type "help" for help.

postgres=#

Now you are logged in to PostgreSQL database server. To check login info use following command from the database command prompt.

postgres-# \conninfo

You are connected to database "postgres" as user "postgres" via socket in "/var/run/postgresql" at port "5432".

To disconnect from PostgreSQL database command prompt just type below command and press enter. It will return you back to Debian command prompt.

postgres-# \q

Step 4 – Conclusion

Your PostgreSQL installation has been completed successfully on your Debian 9 system.

Let’s move to pgAdmin4 installation on Debian 10 systems.

The post How to Install PostgreSQL 11 on Debian 10 (Buster) appeared first on TecAdmin.

]]>
https://tecadmin.net/install-postgresql-on-debian-10-buster/feed/ 0
How to Install PostgreSQL 11 on Debian 9 (Stretch) https://tecadmin.net/install-postgresql-on-debian-9-stretch/ https://tecadmin.net/install-postgresql-on-debian-9-stretch/#respond Mon, 12 Nov 2018 17:15:04 +0000 https://tecadmin.net/?p=17386 PostgreSQL is an open source object-relational database system. It is one of leading database server used for production servers. This tutorial will help you to install the PostgreSQL database server on Debian 9 Stretch systems. How to Install pgAdmin4 on Debian 9 Step 1 – Enable Apt Repository First, you need to import PostgreSQL packages [...]

The post How to Install PostgreSQL 11 on Debian 9 (Stretch) appeared first on TecAdmin.

]]>
PostgreSQL is an open source object-relational database system. It is one of leading database server used for production servers. This tutorial will help you to install the PostgreSQL database server on Debian 9 Stretch systems.

Step 1 – Enable Apt Repository

First, you need to import PostgreSQL packages signing key on your system. Use the below command to import the key.

wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -

Now add PostgreSQL apt repository in your system as per your operating system. These are suggested on official PostgreSQL website using following command.

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'

Step 2 – Install PostgreSQL on Debian 9

At this stage, you have successfully added PostgreSQL official repository in your system. Now update the repository list. After that install Latest PostgreSQL Server in our Ubuntu system using following commands.

sudo apt-get update
sudo apt-get install postgresql postgresql-contrib

Step 3 – Connect to PostgreSQL

After installing the PostgreSQL database server by default, it creates a user ‘postgres’ with role ‘postgres’. It also creates a system account with the same name ‘postgres’. So to connect to postgres server, login to your system as user postgres and connect database.

sudo su - postgres
psql

Now you are logged in to PostgreSQL database server. To check login info use following command from database command prompt.

postgres-# \conninfo

To disconnect from PostgreSQL database command prompt just type below command and press enter. It will return you back to Debian command prompt.

postgres-# \q

Step 4 – Conclusion

Your PostgreSQL installation has been completed successfully on your Debian 9 system.

Let’s move to pgAdmin4 installation on Debian 9 systems.

The post How to Install PostgreSQL 11 on Debian 9 (Stretch) appeared first on TecAdmin.

]]>
https://tecadmin.net/install-postgresql-on-debian-9-stretch/feed/ 0
How To Install pgAdmin4 on Debian 10/9 https://tecadmin.net/install-pgadmin4-on-debian/ https://tecadmin.net/install-pgadmin4-on-debian/#comments Mon, 12 Nov 2018 16:13:59 +0000 https://tecadmin.net/?p=17380 pgAdmin is a web-based interface for managing PostgreSQL database instances. With the help of pgAdmin4, We can create, access databases, run queries over databases easily. pgAdmin4 is available in both web and desktop versions. We can install it on a nix based systems, macOS, and Windows from official packages. The latest pgAdmin4 is helpful for [...]

The post How To Install pgAdmin4 on Debian 10/9 appeared first on TecAdmin.

]]>
pgAdmin is a web-based interface for managing PostgreSQL database instances. With the help of pgAdmin4, We can create, access databases, run queries over databases easily. pgAdmin4 is available in both web and desktop versions. We can install it on a nix based systems, macOS, and Windows from official packages. The latest pgAdmin4 is helpful for managing PostgreSQL 9.2 and above versions.

This tutorial will guide you through installation of pgAdmin4 on Debian Linux system.

Prerequisites

You must have PostgreSQL server installed on your system via an official apt repository. If you don’t have installed PostgreSQL, use below link to install.

Install PostgreSQL on Debian 9

Install pgAdmin4 on Debian

pgAdmin4 packages are available under PostgreSQL official apt repository. We assume you already have configured apt repository during the installation of the database server.

Execute below command on the terminal to begin pgAdmin4 installation on Debian.

sudo apt-get install pgadmin4 pgadmin4-apache2

The package pgadmin4-apache2 will integrate pgAdmin4 with Apache2 web server.

install pgadmin4 Debian

During the installation, you are required to setup pgAdmin4 admin login.

Enter an email address to use as admin login id for your pgAdmin4 web interface. You can use any address of your choice.

Then click OK.

pgAdmin4 on Debian 9

Now this will prompt to input password for the administrator account.

pgAdmin4 on Debian 9 Stretch

This will complete the installation of pgAdmin4 on your system. This will also make required changes on your local PostgreSQL system for connection.

Now, pgAdmin4 is ready to use. Let’s connect pgAdmin4 with PostgreSQL database.

Configure pgAdmin4 with PostgreSQL

You have successfully installed pgAdmin4 on your Debian system. Now you can access pgAdmin4 in your favorite web browser.

Use servers IP address or domain name followed by /pgAdmin4 as subdirectory URL.

http://example.com/pgAdmin4

After successful login, you will be redirected to pgAdmin4 dashboard. As this is a new installation, there will be no servers connected.

Now, connect your first PostgreSQL instance by clicking on “Add New Server“.

This will open a popup window. This tutorial is using the basic settings to connect the database instance. Enter the user-friendly name for the new instance connection under the General tab.

Then switch to Connection tab. Enter hostname or IP address of your PostgreSQL instance. In my case, it’s running on localhost system, so I just the put localhost as the hostname. Then enter the username and password for PostgreSQL authentication.

After that click Save button.

After successful adding new instance, you will see an instance in the left sidebar. Here you can manage the database instance.

Conclusion

You have installed pgAdmin4, a web-based interface for the PostgreSQL server management. Now connect as many as PostgreSQL instances with the pgAdmin4.

The post How To Install pgAdmin4 on Debian 10/9 appeared first on TecAdmin.

]]>
https://tecadmin.net/install-pgadmin4-on-debian/feed/ 7
How to Install and Configure pgAdmin4 on Ubuntu 18.04 & 16.04 https://tecadmin.net/install-pgadmin4-on-ubuntu/ https://tecadmin.net/install-pgadmin4-on-ubuntu/#comments Sun, 11 Nov 2018 14:11:08 +0000 https://tecadmin.net/?p=17343 Introduction pgAdmin is a web-based interface for management of PostgreSQL database instances. It can be installed on Linux, Unix, Mac OS X, and Windows to manage PostgreSQL 9.2 and above. Prerequisites You must have PostgreSQL server installed on your system via an official apt repository. If you don’t have installed PostgreSQL, use below link to [...]

The post How to Install and Configure pgAdmin4 on Ubuntu 18.04 & 16.04 appeared first on TecAdmin.

]]>
Introduction

pgAdmin is a web-based interface for management of PostgreSQL database instances. It can be installed on Linux, Unix, Mac OS X, and Windows to manage PostgreSQL 9.2 and above.

Prerequisites

You must have PostgreSQL server installed on your system via an official apt repository. If you don’t have installed PostgreSQL, use below link to install.

Install PostgreSQL on Ubuntu

Install pgAdmin4 on Ubuntu

pgAdmin4 packages are available under PostgreSQL official apt repository. We assume you already have configured apt repository during installation of database server.

Execute below command on the terminal to begin pgAdmin4 installation on Ubuntu.

sudo apt-get install pgadmin4 pgadmin4-apache2

The package pgadmin4-apache2 will integrate pgAdmin4 with Apache2 web server.

install pgadmin4 ubuntu

During the installation, you are required to setup pgAdmin4 admin login.

Enter an email address to use as admin login id for your pgAdmin4 web interface. You can use any address of your choice.

Then click OK.

Now this will prompt to input password for the administrator account.

This will complete the installation of pgAdmin4 on your system. This will also make required changes on your local PostgreSQL system for connection.

Now, pgAdmin4 is ready to use. Let’s connect pgAdmin4 with PostgreSQL database.

Connect PostgreSQL via pgAdmin4

You have successfully installed pgAdmin4 on your Ubuntu system. Now you can access pgAdmin4 in your favorite web browser.

Use servers IP address or domain name followed by /pgAdmin4 as subdirectory URL.

http://example.com/pgAdmin4

After successful login, you will be redirected to pgAdmin4 dashboard. As this is a new installation, there will be no servers connected.

Now, connect your first PostgreSQL instance by clicking on “Add New Server“.

This will open a popup window. This tutorial is using the basic settings to connect database instance. Enter the user-friendly name for the new instance connection under the General tab.

Then switch to Connection tab. Enter hostname or IP address of your PostgreSQL instance. In my case, it’s running on localhost system, so I just the put localhost as the hostname. Then enter the username and password for PostgreSQL authentication.

After that click Save button.

After successful adding new instance, You will see instance in the left sidebar. Here you can manage the database instance.

Conclusion

You have installed pgAdmin4, a web-based interface for the PostgreSQL server management. Now connect as many as PostgreSQL instances with the pgAdmin4.

The post How to Install and Configure pgAdmin4 on Ubuntu 18.04 & 16.04 appeared first on TecAdmin.

]]>
https://tecadmin.net/install-pgadmin4-on-ubuntu/feed/ 19
How To Install PostgreSQL and pgAdmin4 in Fedora 35/34 https://tecadmin.net/how-to-install-postgresql-and-pgadmin-in-fedora/ https://tecadmin.net/how-to-install-postgresql-and-pgadmin-in-fedora/#comments Tue, 30 Oct 2018 16:10:54 +0000 https://tecadmin.net/?p=17323 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 [...]

The post How To Install PostgreSQL and pgAdmin4 in Fedora 35/34 appeared first on TecAdmin.

]]>
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.

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.

su - postgres -c "psql" 

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

postgres=# \password postgres

Create password for "postgres" default account

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

http(s)://server-ip/pgadmin4

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.

The post How To Install PostgreSQL and pgAdmin4 in Fedora 35/34 appeared first on TecAdmin.

]]>
https://tecadmin.net/how-to-install-postgresql-and-pgadmin-in-fedora/feed/ 6
How to Install PostgreSQL 11 on CentOS/RHEL 7/6 https://tecadmin.net/install-postgresql-11-on-centos/ https://tecadmin.net/install-postgresql-11-on-centos/#comments Mon, 29 Oct 2018 16:24:58 +0000 https://tecadmin.net/?p=17315 PostgreSQL 11 Released. It is an open-source object-relational, highly scalable, SQL-compliant database management system. PostgreSQL is developed at the University of California at Berkeley Computer Science Department. This article will help you to install PostgreSQL 11 on CentOS/RHEL 7/6 system. This article has been tested on CentOS Linux release 7.5 Step 1 – Configure Yum [...]

The post How to Install PostgreSQL 11 on CentOS/RHEL 7/6 appeared first on TecAdmin.

]]>
PostgreSQL 11 Released. It is an open-source object-relational, highly scalable, SQL-compliant database management system. PostgreSQL is developed at the University of California at Berkeley Computer Science Department. This article will help you to install PostgreSQL 11 on CentOS/RHEL 7/6 system.

This article has been tested on CentOS Linux release 7.5

Step 1 – Configure Yum Repository

Firstly you need to configure the PostgreSQL repository in your system. Use one of the below commands as per your operating system version.

sudo yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

For more details visit PostgreSQL repositories link page where you can get repository package rpm for various operating systems.

Step 2 – Installing PostgreSQL on CentOS 7

After enabling PostgreSQL yum repository in your system use following command to install PostgreSQL 11 on your system with yum package manager.

yum install postgresql11-server

This will also install some additional required packages on your system. Enter y to confirm and complete the installation process.

Install PostgreSQL 11 on CentOS

Step 3 – Initialize PGDATA

After that, you need to initialize the PostgreSQL instance. In other words, this will create a data directory and other configuration files on your system. To initialize the database use the below command.

/usr/pgsql-11/bin/postgresql-11-setup initdb

Initialize PostgreSQL 11 on CentOS

The above command will take some time to initialize PostgreSQL first time. PGDATA environment variable contains the path of data directory.

PostgreSQL 11 default data directory location is /var/lib/pgsql/11/data

Setp 4 – Start PostgreSQL Server

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

systemctl enable postgresql-11.service
systemctl start postgresql-11.service

Step 5 – Verify PostgreSQL Installation

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

su - postgres -c "psql"

psql (11.0)
Type "help" for help.

postgres=# 

You may create a password for user postgres for security purposes.

postgres=# \password postgres

In conclusion, You have successfully installed the PostgreSQL database server on CentOS/RHEL 7 system.

The post How to Install PostgreSQL 11 on CentOS/RHEL 7/6 appeared first on TecAdmin.

]]>
https://tecadmin.net/install-postgresql-11-on-centos/feed/ 9
How to Install PostgreSQL on CentOS/RHEL 7 https://tecadmin.net/install-postgresql-server-centos/ https://tecadmin.net/install-postgresql-server-centos/#comments Tue, 03 Oct 2017 16:31:33 +0000 https://tecadmin.net/?p=9609 PostgreSQL 10 Released. PostgreSQL is an open-source object-relational, highly scalable, SQL-compliant database management system. PostgreSQL is developed at the University of California at Berkeley Computer Science Department. This article will help you to install PostgreSQL 10 on CentOS, RHEL and Fedora Systems. Step 1 – Add Postgres Yum Repository The first step is to install [...]

The post How to Install PostgreSQL on CentOS/RHEL 7 appeared first on TecAdmin.

]]>
PostgreSQL 10 Released. PostgreSQL is an open-source object-relational, highly scalable, SQL-compliant database management system. PostgreSQL is developed at the University of California at Berkeley Computer Science Department. This article will help you to install PostgreSQL 10 on CentOS, RHEL and Fedora Systems.

Step 1 – Add Postgres Yum Repository

The first step is to install PostgreSQL repository in your system, Use one of below commands as per your system architecture and operating system.

## CentOS/RHEL - 7
rpm -Uvh https://yum.postgresql.org/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm

## CentOS/RHEL - 6
rpm -Uvh https://yum.postgresql.org/10/redhat/rhel-6-x86_64/pgdg-redhat10-10-2.noarch.rpm

For more details visit PostgreSQL repositories link page where you can get repository package rpm for various operating systems.

Step 2 – Install PostgreSQL 10 Server

After enabling PostgreSQL yum repository in your system use following command to install PostgreSQL 10 on your system with yum package manager.

yum install postgresql10-server postgresql10

Step 3 – Initialize PGDATA

After installing PostgreSQL server, It’s required to initialize it before using the first time. To initialize database use below command.

/usr/pgsql-10/bin/postgresql-10-setup initdb

Above command will take some time to initialize PostgreSQL first time. PGDATA environment variable contains the path of data directory.

PostgreSQL data directory Path: /var/lib/pgsql/10/data/

Setp 4 – Start PostgreSQL Server

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

For CentOS/RHEL 7 and Fedora

systemctl start postgresql-10.service
systemctl enable postgresql-10.service

For CentOS/RHEL 6

service postgresql-10 start
chkconfig postgresql-10 on
Step 5 – Verify PostgreSQL Installation

After completing above steps, you have installed PostgreSQL 10 on your server, Let’s log in to postfix to verify that installation completed successfully.

su - postgres -c "psql"

psql (10.0)
Type "help" for help.
postgres=#

You may create a password for user postgres for security purpose.

postgres=# \password postgres

Congratulation’s! You have successfully installed PostgreSQL Server. Read below article to install phpPgAdmin.

How to Install phpPgAdmin on CentOS using Yum

Thanks for using this tutorial for installing PostgreSQL 10 on CentOS/RHEL 7/6 and Fedora 28/27/26 systems.

The post How to Install PostgreSQL on CentOS/RHEL 7 appeared first on TecAdmin.

]]>
https://tecadmin.net/install-postgresql-server-centos/feed/ 15
How to Install PostgreSQL 11 on Debian 8 (Jessie) https://tecadmin.net/install-postgresql-on-debian/ https://tecadmin.net/install-postgresql-on-debian/#comments Sat, 11 Feb 2017 04:56:31 +0000 https://tecadmin.net/?p=11191 PostgreSQL is an open source object-relational database system. It is one of leading database server used for production servers. This tutorial will help you to install the PostgreSQL database server on Debian 8 Jessie systems. How to Install PostgreSQL on Ubuntu Step 1 – Prerequsities First, you need to import PostgreSQL packages signing key on [...]

The post How to Install PostgreSQL 11 on Debian 8 (Jessie) appeared first on TecAdmin.

]]>
PostgreSQL is an open source object-relational database system. It is one of leading database server used for production servers. This tutorial will help you to install the PostgreSQL database server on Debian 8 Jessie systems.

Step 1 – Prerequsities

First, you need to import PostgreSQL packages signing key on your system. Use the below command to import the key.

wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -

Now add PostgreSQL apt repository in your system as per your operating system. These are suggested on official PostgreSQL website using following command.

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'

Step 2 – Install PostgreSQL on Debian 8

At this stage, you have successfully added PostgreSQL official repository in your system. Now update the repository list. After that install Latest PostgreSQL Server in our Ubuntu system using following commands.

sudo apt-get update
sudo apt-get install postgresql postgresql-contrib

Step 3 – Connect to PostgreSQL

After installing the PostgreSQL database server by default, it creates a user ‘postgres’ with role ‘postgres’. It also creates a system account with the same name ‘postgres’. So to connect to postgres server, login to your system as user postgres and connect database.

sudo su - postgres
psql

Now you are logged in to PostgreSQL database server. To check login info use following command from database command prompt.

postgres-# \conninfo

To disconnect from PostgreSQL database command prompt just type below command and press enter. It will return you back to Debian command prompt.

postgres-# \q

Your PostgreSQL installation has been completed successfully. Let’s move to phpPgAdmin installation of Ubuntu systems.

The post How to Install PostgreSQL 11 on Debian 8 (Jessie) appeared first on TecAdmin.

]]>
https://tecadmin.net/install-postgresql-on-debian/feed/ 8