How To Install and Connect to PostgreSQL on Fedora 23

PostgreSQL is a free, open-source object-relational database management system (object-RDBMS), similar to MySQL, and is standards-compliant and extensible. It often is used as a back-end for web and mobile applications. PostgreSQL, or ‘Postgres’ as it is nicknamed, adopts the ANSI/ISO SQL standards together, with the revisions.

Pre-Flight Check

Step #1: Add the PostgreSQL 9.4 Repository

In this case we want to install PostgreSQL 9.4.4 directly from the Postgres repository. First, we’ll add the repo:

rpm -iUvh http://yum.postgresql.org/9.4/fedora/fedora-23-x86_64/pgdg-fedora94-9.4-4.noarch.rpm

Step #2: Install PostgreSQL

First, we’ll observe best practices by ensuring that the list of available packages is up to date:

dnf -y update

Then it’s a matter of running one command for installation:

dnf -y install postgresql94 postgresql94-server postgresql94-contrib postgresql94-libs --enablerepo=pgdg94

PostgreSQL now should be installed.

Step #3: Start PostgreSQL

Configure Postgres to start when the server boots:
systemctl enable postgresql-9.4

That should produce output similar to the following:

[root@host ~]# systemctl enable postgresql-9.4
Created symlink from /etc/systemd/system/multi-user.target.wants/postgresql-9.4.service to /usr/lib/systemd/system/postgresql-9.4.service.

Initialize Postgres with the following command:

/usr/pgsql-9.4/bin/postgresql94-setup initdb

Which should result in:

/usr/pgsql-9.4/bin/postgresql94-setup initdb
Initializing database ... OK

Then start Postgres:

systemctl start postgresql-9.4

Step #4: Switch to the Default PostgreSQL User

As part of the installation, Postgres adds the system user “postgres” and is setup to use “ident” authentication. Roles internal to Postgres (which are similar to users) match with a system user account.

Let’s switch into that system user:

su - postgres

You’ll receive a command line similar to:

-bash-4.3$

And then connect to the PostgreSQL terminal (in the postgres role):

psql

To quit psql, type:

\q

and to return to the previous user, type:
exit
 

Change a Password for PostgreSQL on Linux via Command Line

PostgreSQL supports many client authentication methods, but in this case we’re only going to concern ourselves with two: password and md5.

Note: The default authentication method for PostgreSQL is ident. If you’d like to change the PostgreSQL authentication method from ident to md5, then visit the linked tutorial!

Continue reading “Change a Password for PostgreSQL on Linux via Command Line”

Change PostgreSQL Authentication Method from Ident to MD5

PostgreSQL supports multiple client authentication methods including: trust, reject, md5, password, gss, sspi, krb5, ident, peer, ldap, radius, cert, and pam. Here we’re only going to concern ourselves with two: ident and md5.

Continue reading “Change PostgreSQL Authentication Method from Ident to MD5”

What is the Default Password for PostgreSQL?

When connecting to PostgreSQL on Linux for the first time many admins have questions, especially if those admins are from the MySQL world.

By default, when PostgreSQL is installed, a postgres user is also added.

If you run the command:

cat /etc/passwd

… you’ll see the postgres user.

Continue reading “What is the Default Password for PostgreSQL?”

How to Install and Connect to PostgreSQL on Fedora 22

PostgreSQL (pronounced ‘post-gres-Q-L’) is a free, open-source object-relational database management system (object-RDBMS), similar to MySQL, and is standards-compliant and extensible. It is often used as a back-end for web and mobile applications. PostgreSQL, or ‘Postgres’ as it is nicknamed, adopts the ANSI/ISO SQL standards together, with the revisions.

Pre-Flight Check

  • These instructions are intended specifically for installing PostgreSQL on Fedora 22.
  • I’ll be working from a Liquid Web Self Managed Fedora 22 server, and I’ll be logged in as root.

Continue reading “How to Install and Connect to PostgreSQL on Fedora 22”

How to Install and Connect to PostgreSQL on Fedora 21

PostgreSQL (pronounced ‘post-gres-Q-L’) is a free, open-source object-relational database management system (object-RDBMS), similar to MySQL, and is standards-compliant and extensible. It is often used as a back-end for web and mobile applications. PostgreSQL, or ‘Postgres’ as it is nicknamed, adopts the ANSI/ISO SQL standards together, with the revisions.

Pre-Flight Check

  • These instructions are intended specifically for installing PostgreSQL on Fedora 21.
  • I’ll be working from a Liquid Web Self Managed Fedora 21 server, and I’ll be logged in as root.

Continue reading “How to Install and Connect to PostgreSQL on Fedora 21”

How to Install and Connect to PostgreSQL on Fedora 20

PostgreSQL (pronounced ‘post-gres-Q-L’) is a free, open-source object-relational database management system (object-RDBMS), similar to MySQL, and is standards-compliant and extensible. It is commonly used as a back-end for web and mobile applications. PostgreSQL, or ‘Postgres’ as it is nicknamed, adopts the ANSI/ISO SQL standards together, with the revisions.

Pre-Flight Check
  • These instructions are intended specifically for installing PostgreSQL on Fedora 20.
  • I’ll be working from a Liquid Web Self Managed Fedora 20 server, and I’ll be logged in as root.

Continue reading “How to Install and Connect to PostgreSQL on Fedora 20”

How to Install and Connect to PostgreSQL on CentOS 7

PostgreSQL (pronounced ‘post-gres-Q-L’) is a free, open-source object-relational database management system (object-RDBMS), similar to MySQL, and is standards-compliant and extensible. It is commonly used as a back-end for web and mobile applications. PostgreSQL, or ‘Postgres’ as it is nicknamed, adopts the ANSI/ISO SQL standards together, with the revisions.

Pre-Flight Check
  • These instructions are intended specifically for installing PostgreSQL on CentOS 7.
  • I’ll be working from a Liquid Web Self Managed CentOS 7 server, and I’ll be logged in as root.

Continue reading “How to Install and Connect to PostgreSQL on CentOS 7”

How to Install and Connect to PostgreSQL on CentOS 6

PostgreSQL (pronounced ‘post-gres-Q-L’) is a free, open-source object-relational database management system (object-RDBMS), similar to MySQL, and is standards-compliant and extensible. It is commonly used as a back-end for web and mobile applications. PostgreSQL, or ‘Postgres’ as it is nicknamed, adopts the ANSI/ISO SQL standards together, with the revisions.

Pre-Flight Check
  • These instructions are intended specifically for installing PostgreSQL on CentOS 6.
  • I’ll be working from a Liquid Web Core Managed CentOS 6.5 server, and I’ll be logged in as root.

Continue reading “How to Install and Connect to PostgreSQL on CentOS 6”

How to Install and Connect to PostgreSQL on Ubuntu 12.04

PostgreSQL (pronounced ‘post-gres-Q-L’) is a free, open-source object-relational database management system (object-RDBMS), similar to MySQL, and is standards-compliant and extensible. It is commonly used as a back-end for web and mobile applications. PostgreSQL, or ‘Postgres’ as it is nicknamed, adopts the ANSI/ISO SQL standards together, with the revisions.

Pre-Flight Check
  • These instructions are intended specifically for installing PostgreSQL on Ubuntu 12.04 LTS.
  • I’ll be working from a Liquid Web Core Managed Ubuntu 12.04 LTS server, and I’ll be logged in as root.

Continue reading “How to Install and Connect to PostgreSQL on Ubuntu 12.04”