Install PostgreSQL on Fedora 26 Workstation

The packages from the standard Fedora repository are almost as recent than the packages in the official PostgreSQL repository. No need to add the PostgreSQL repository.
Install the server and client packages. It’s not necessary to install the postgresql-contrib package. This package includes porting tools, analysis utilities, and plug-in features that are not part of the core PostgreSQL system, mainly because they address a limited audience or are too experimental to be part of the main source tree. This does not preclude their usefulness, but i don’t need them.  Information found here.

$ dnf install postgresql postgresql-server

Initialize the PostgreSQL cluster

$ postgresql-setup --initdb --unit postgresql

Console output:Initializing database in ‘/var/lib/pgsql/data’Initialized, logs are in /var/lib/pgsql/initdb_postgresql.log

Start the service:

$ systemctl start postgresql

Service should be started, but not enabled Check if service is enabled:

$ systemctl is-enabled postgresql

By enabling the service, the PG cluster will be started automatically when starting your workstation.

Enable, disable and stop:

$ systemctl enable postgresql$ systemctl disable postgresql$ systemctl stop postgresql

Login to PG with the default database administrator “postgres”. During the installation the user postgres was created on your workstation.

# su - postgres
Psql is the interactive terminal for working with Postgres.
$ psql
Console output:psql (9.5.3)Type "help" for hel p.
postgres=#

Set a pssword for the user postgres:

postgres=# \password postgres

Quite the postgres console with \q

Other useful console commands are here.

Everything you want to do ranging from listing tables, restoring databases, creating, users, tables, etc. can be done in the psql terminal. But since you are using a workstation, it’s just easier to use a graphical user interface. i want a graphical user interface for that.

Before applications – like the graphical client – can access the PG server, you need modify the default authentication method (ident). The postgresql server is using two main configuration files:/var/lib/pgsql/data/postgresql.conf/var/lib/pgsql/data/pg_hba.conf. The authentication method is defined in pg_hba.conf and needs to be set to e.g. md5. Leave the client authentication method on ident and you will have to create a operation system user for each database user.

ident

Obtain the operating system user name of the client (for TCP/IP connections by contacting the ident server on the client, for local connections by getting it from the operating system) and check if it matches the requested database user name.

md5

Require the client to supply an MD5-encrypted password for authentication.
in pg_hba.conf update the method for type “host” and for the databases you will use (or “all”).

Installing pgadmin3

# dnf install pgadmin3

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s