PostgreSQL – TecAdmin https://tecadmin.net How to guide for System Administrator's and Developers Wed, 16 Nov 2022 05:48:44 +0000 en-US hourly 1 https://wordpress.org/?v=6.1.1 How To Install PostgreSQL on MacOS https://tecadmin.net/install-postgresql-on-macos/ https://tecadmin.net/install-postgresql-on-macos/#respond Mon, 24 Oct 2022 11:58:18 +0000 https://tecadmin.net/?p=19314 PostgreSQL is an open-source database management system (DBMS) that is widely used for its reliability, performance, and scalability. It is also known as a third-generation DBMS because it retains data in secondary storage rather than memory, making it less prone to performance degradation and other issues associated with dynamic memory allocation. In this article, we’ll [...]

The post How To Install PostgreSQL on MacOS appeared first on TecAdmin.

]]>
PostgreSQL is an open-source database management system (DBMS) that is widely used for its reliability, performance, and scalability. It is also known as a third-generation DBMS because it retains data in secondary storage rather than memory, making it less prone to performance degradation and other issues associated with dynamic memory allocation. In this article, we’ll show you how to install PostgreSQL on macOS.

In this blog post, you will learn how to install PostgreSQL on macOS with Homebrew by following the steps below. Once you complete the installation process, you’ll be able to create databases, tables, and other objects inside those tables. You can even write queries against those tables so that they return the data that you are looking for.

Installing Homebrew

The first step is to install Homebrew, which is a package manager for macOS. Package managers are useful when installing open source software (OSS) because you don’t have to manually download the source code, build the software from scratch, and then install it. You can instead, just use the package manager to pull in the OSS that you want and then install it with a simple command. You can follow the steps below to install Homebrew on macOS.

First, open a new Terminal window by clicking on Finder and then clicking on Applications. From there, click on Utilities. This will open a new Terminal window. In the Terminal window, type:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 

You’ll see a bunch of text fly by. Once the text stops, you are then prompted to add the path for Terminal to your PATH environment variable. You can do that by typing “export PATH=/usr/local/bin:/usr/local/sbin:$PATH” and then press the enter key.

Installing PostgreSQL

Once you’ve installed Homebrew on your macOS, first of all search available versions of PostgreSQL server for installation:

brew search postgresql

All the available versions or formulae will be listed.

PostgreSQL Installation on MacOS

Choose one of the listed PostgreSQL versions to install on your macOS. For example, to install PostgreSQL 14, execute the following command:

brew install postgresql@14 

If you need to upgrade an existing PostgreSQL installation, use the following command:

brew upgrade postgresql@14 

Remember that the above command will upgrade the minor version only.

Then, start the PostgreSQL service with the following command:

brew services start postgresql@14 

If you want to stop or restart the service, use the following commands:

brew services stop postgresql@14 
brew services restart postgresql@14 

That’s it. You have successfully installed the PostgreSQL server on your macOS.

Login to PostgreSQL

After installing a fresh database server, you need to configure it before using it. The “psql” is the command line utility for managing the Postgres database server. The default PostgreSQL comes with a database named “postgres”, that we can use to log in to the server. Execute the following command to get login into the Postgres terminal:

psql postgres 

PostgreSQL Installation on MacOS

Once you get the Postgres terminal, you can check the available databases with the following command:

\l 

How to Install PostgreSQL on macOS

The default installation creates a user named “admin” with superuser privileges. That is the owner of the default “postgres” database. You can list all the available users with the following command.

\du 

PostgreSQL Installation on MacOS

Creating User

As you see above that the default PostgreSQL creates a super admin named “admin” and database “postgres”. You can either use the “CREATE ROLE” to add a new ROLE (User) in your system or use “createuse” command line utility to create it. Personally, I love to use “createuser” utility with an interactive mode that helped for adding new roles quickly

Let’s create the first ROLE from your macOS terminal, type:

createuser --interactive --pwprompt 

This will prompt for the following details:

  • Name for the new ROLE (User).
  • Inter a password for new role
  • Re-enter the password for new role (Same as above)
  • Press ‘n’, do not provide super administrator privileges.
  • Press ‘y’ to provide create database privileges
  • Press ‘n’ to not allow to make new roles

How to Install PostgreSQL on macOS

You can successfully added a new user to the Postgres database server. Use the following command to log in as a new user.

psql postgres -U tecadmin -W 

Change “tecadmin” with your user name. Currently the user user doesn’t have any database with name, So the above command will connect to the “postgres” database. Press Enter button and provide the password of the user:

How to Install PostgreSQL on macOS

Creating Database

Now, create a new database with the following command.

CREATE DATABASE tecadmin; 

After creating a database, list all the databases in the postgres server.

\du 

PostgreSQL Installation on MacOS

Conclusion

In this article, we’ve shown you how to install PostgreSQL on macOS. Once you complete the installation process, you’ll be able to create databases, tables, and other objects inside those tables. You can even write queries against those tables so that they return the data that you are looking for. When you’re finished, be sure to log out of the “postgres” user or stop the PostgreSQL service by using the “brew services stop postgresql” command before continuing to use your Mac.

The post How To Install PostgreSQL on MacOS appeared first on TecAdmin.

]]>
https://tecadmin.net/install-postgresql-on-macos/feed/ 0
How To Configure PostgreSQL to Allow Remote Connections https://tecadmin.net/postgresql-allow-remote-connections/ https://tecadmin.net/postgresql-allow-remote-connections/#comments Thu, 23 Sep 2021 11:12:33 +0000 https://tecadmin.net/?p=27027 An open-source, object-based relational database PostgreSQL, provides the user with the implementation of SQL and is commonly hosted on Linux. With PostgreSQL users can expand the system by defining self-data types, functions, and operators. PostgreSQL is used by many large companies to save and store their data for various applications and it supports various programming [...]

The post How To Configure PostgreSQL to Allow Remote Connections appeared first on TecAdmin.

]]>
An open-source, object-based relational database PostgreSQL, provides the user with the implementation of SQL and is commonly hosted on Linux. With PostgreSQL users can expand the system by defining self-data types, functions, and operators.

PostgreSQL is used by many large companies to save and store their data for various applications and it supports various programming interfaces as well as videos, texts, and images. In this article we’ll first go through the installation of PostgreSQL on ubuntu 20.04 then we’ll configure it to allow remote connection

Prerequsities

This article assumes that you already have running a PostgreSQL server on your system. If not, use one of the below links to install the PostgreSQL database server on your system.

  1. Installing PostgreSQL on Ubuntu 20.04
  2. Installing PostgreSQL on CentOS 8

Find Configuration File

In order to install PostgreSQL on our system we need to update our repository and for that execute the below command:

sudo -u postgres psql -c "SHOW config_file;" 
Output:
config_file ----------------------------------------- /etc/postgresql/13/main/postgresql.conf (1 row)

You need to change the listening address in the postgresql.conf configuration file showing in the command output. Also, you need to edit “pg_hba.conf” in the same directory to allow remote access.

Configure PostgreSQL to Allow Remote Connections

In order to allow all the IP addresses to connect to the PostgreSQL server, we need to configure the file and make some changes, for that you have located the configuration file in the previous step.

  1. Configuring postgresql.conf:
  2. Now we need to open the file and make some changes in order to allow a remote connection. To open the file you’ve to use the keyword “nano” or you can run the command in the terminal that is provided below:

    sudo nano /etc/postgresql/13/main/postgresql.conf 
    

    This command will open this file and in it, you need to search “listen_addresses” and add the following line.

    #listen_addresses = 'localhost'
    listen_addresses = '*'
    
    Change Postgres Listen Address
    Change Listen Address in PostgreSQL

    All you’ve to do is change the listening address from localhost to “*” or add a new line as shown above. This will allow every IP address to be connected to the database server, or if you want to specify some particular ips you can type them with spaces between each IP address.

  3. Configuring pg_hba.conf:
  4. In order to allow the users that we want to be connected to the database then we need to make changes in the “pg_hba.conf” file. This file will be available under the same directory as above.

    Now open the file using the command provided below:

    sudo nano /etc/postgresql/13/main/pg_hba.conf 
    

    In the file you’ve to add the following lines in file:

    # TYPE  DATABASE	USER	ADDRESS   	METHOD
    host    all     	all     0.0.0.0/0       md5
    host    all             all     :/0             md5
    
    PostgreSQL Allow Remote Hosts
    Allow Remote Hosts in PostgreSQL

    Save the configuration file and close it.

  5. Restart Service :
  6. Now, restart the database service to apply changes by executing the below-mentioned command:

    sudo systemctl restart postgresql 
    

    Now simply open the port “5432” in the firewall and you’re all set to see all the databases and you can bond from whichever ip address to the server of PostgreSQL:

    sudo ufw allow 5432 
    

That’s it. Your PostgreSQL database server is accessible from remote hosts.

Conclusion

PostgreSQL database is default set to bond with localhost which restricts the other IP address and host to connect or have the access to the PostgreSQL server. In this article, we guided you through the configuration of PostgreSQL to allow remote connection so that other IPs can bond to the server. In this way, other hosts can easily see the list of databases and connect to the PostgreSQL server remotely.

The post How To Configure PostgreSQL to Allow Remote Connections appeared first on TecAdmin.

]]>
https://tecadmin.net/postgresql-allow-remote-connections/feed/ 2
How to Check the PostgreSQL Version https://tecadmin.net/check-postgres-version/ https://tecadmin.net/check-postgres-version/#respond Thu, 05 Aug 2021 12:42:49 +0000 https://tecadmin.net/?p=27021 PostgreSQL is an advanced, open-source relational database management system. It is written in C programming language and was developed at the University of California, Berkeley in 1996. Initially, version 1.0 of Postgres95 was announced on September 5, 1995. The first non-university version of PostgreSQL was provided on July 8, 1996, by Marc Fournier at Hub.org [...]

The post How to Check the PostgreSQL Version appeared first on TecAdmin.

]]>
PostgreSQL is an advanced, open-source relational database management system. It is written in C programming language and was developed at the University of California, Berkeley in 1996. Initially, version 1.0 of Postgres95 was announced on September 5, 1995. The first non-university version of PostgreSQL was provided on July 8, 1996, by Marc Fournier at Hub.org Networking Services. Which is the first version of PostgreSQL for public use.

As of today, PostgreSQL 13.3 is the latest stable version available for installation. PostgreSQL version 9.5 and lower versions are no more supported by the team.

In this tutorial, you will learn, how to check the PostgreSQL version on your system.

How to Find PostgreSQL Version using Command line

Use one of the following methods to check the PostgreSQL version via the command line.

  1. Check Version with Login

    Once you login to the PostgreSQL server via terminal, The post login screen displays the PostgreSQL version you have connected to.

    psql 
    
    Output:
    psql (13.3 (Ubuntu 13.3-1.pgdg20.04+1)) Type "help" for help.
  2. The above output displays, that you are running version 13.3 of PostgreSQL server.

  3. Check Version with version() Function

    You can also execute version() function to find out the PostgreSQL version. This method can also help you to check PostgreSQL version in automation scripts.

    SELECT version();
    
    Output:
    version ------------------------------------------------------------------------------------ PostgreSQL 13.3 (Ubuntu 13.3-1.pgdg20.04+1) on x86_64-pc-linux-gnu, compiled by gcc (1 row)
  4. Check Version with Parameters

    Alternatively, you can also find the PostgreSQL version by the preset parameters, and you can also use this method for automatic version checks.

    SHOW server_version;
    
    Output:
    server_version ---------------------------------- 13.3 (Ubuntu 13.3-1.pgdg20.04+1) (1 row)

Check the below screenshot for all commands in action to check the Postgres version on command line.

Find PostgreSQL Version

How to Find Postgres Version in pgAdmin4

pgAdmin4 is an excellent web interface for managing the PostgreSQL servers. So the pgAdmin4 users can also find the Postgres version on the web interface.

To get the version, follow:

  1. Login to pgAdmin4
  2. In the left sidebar, expand the Servers and select your Postgres server
  3. Go to Properties tab
  4. Under the General section, check for PostgreSQL version.

Check Postgres Version in PgAdmin4

Conclusion

In this tutorial, you have learned 3 methods to check the PostgreSQL version via the command line. Also provided the steps to find version in pgAdmin4.

The post How to Check the PostgreSQL Version appeared first on TecAdmin.

]]>
https://tecadmin.net/check-postgres-version/feed/ 0
How to Install pgAdmin4 on Ubuntu 20.04 https://tecadmin.net/how-to-install-pgadmin4-on-ubuntu-20-04/ https://tecadmin.net/how-to-install-pgadmin4-on-ubuntu-20-04/#comments Fri, 09 Apr 2021 08:50:29 +0000 https://tecadmin.net/?p=25160 pgAdmin is a more advanced alternative to phpPgAdmin. It is the most popular and feature-rich Open Source administration platform for the PostgreSQL database server. Which is available for Linux, Unix, macOS, and Windows operating systems. pgAdmin 4 is the enhanced version and is a complete rewrite of pgAdmin. This includes a desktop version written in [...]

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

]]>
pgAdmin is a more advanced alternative to phpPgAdmin. It is the most popular and feature-rich Open Source administration platform for the PostgreSQL database server. Which is available for Linux, Unix, macOS, and Windows operating systems.

pgAdmin 4 is the enhanced version and is a complete rewrite of pgAdmin. This includes a desktop version written in NWjs as well as a web application that can be directly deployed on a web server. The desktop version helps you to access it from the local machine, while the web server enables you to access it from a remote system.

In this tutorial, you will learn to install pgAdmin 4 on Ubuntu systems. Also, include the steps to add the PostgreSQL server to pgAdmin.

Prerequisites

A running Ubuntu 20.04 LTS system.

Assuming you have a pre-installed PostgreSQL server on your system. Otherwise refer to other tutorial which covers both installation of PostgreSQL and pgAdmin on Ubuntu system.

Step 1 – Install pgAdmin4 on Ubuntu

An official PPA is available for pgAdmin4 to install the latest version on Ubuntu systems.

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.
  • To install on a remote server (or no desktop available) use the “pgadmin4-web” package only. For local systems with Desktop installed, can use both versions.

    Step 2 – Configure pgAdmin4-Web

    The user has installed pgadmin4-web or both editions, and needs, to 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 is finished, you are good to access the pgAdmin web dashboard. It will be available below address:

    Step 3 – Access pgAdmin4 Dashboard

    The above commands will also configure pgAdmin4 with the Apache web server. You can access pgAdmin4 in a web browser with the following URL: http://server_ip/pgadmin4

    Make sure to change server_ip with localhost, domain name pointed to the system or system IP address.

    Login to pgAdmin3 web

    In any case, the above page is not loading, restart the Apache server using “sudo systemctl restart apache2“. Again reload the web dashboard.

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

    Step 4 – Add PostgreSQL Server to pgAdmin4

    After successful login to the pgAdmin4 web interface. Let’s start adding the PostgreSQL instances to pgAdmin4. You can add multiple database servers running on the local machines as well as on remote host.

    To add a new server, click on “Add New Server” button.

    Add server to pgAdmin4

    This will open a popup, Enter a friendly name here:

    Switch to the connection tab. Enter the hostname of the PostgreSQL server. Use “localhost” for running the database on the same instance. Then input the authentication details.

    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

    This tutorial helped you to install and configure pgAdmin4 on a Ubuntu 20.04 Linux system. Also added a database server running on the same host.

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

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

    ]]> https://tecadmin.net/how-to-install-pgadmin4-on-ubuntu-20-04/feed/ 7 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