From Fedora Project Wiki
(Replaced content with "moved to []")
(14 intermediate revisions by the same user not shown)
Line 1: Line 1:
The installation and initialization of the postgresql server is little bit different in compare to other packages. This document aims to summarize basic installation steps relevant to recent fedora release. In first place, you may consider to install newer version than is packaged for fedora see []. However, this is not recommended.
moved to []
== Installation ==
$ sudo yum install postgresql postgresql-server
The postgresql server is turned off and disabled by default. You can enable its start during the boot using following command:
$ sudo systemctl enable postgresql
You can start the postgresql server only when necessary as follows.
$ sudo systemctl start postgresql
Job for postgresql.service failed. See 'systemctl status postgresql.service' and 'journalctl -xn' for details.
The database needs to be populated by initial data after installation. The error log describes problem and its solution.
$ journalctl -xn
-- Logs begin at Mon 2013-11-04 14:38:33 CET, end at Thu 2013-11-14 11:45:56 CET. --
Nov 14 11:45:34 sudo[2054]: jmlich : TTY=pts/2 ; PWD=/home/jmlich ; USER=root ; COMMAND=/bin/systemctl status postgresql
Nov 14 11:45:37 sudo[2073]: jmlich : TTY=pts/2 ; PWD=/home/jmlich ; USER=root ; COMMAND=/bin/systemctl status postgresql
Nov 14 11:45:56 sudo[2105]: jmlich : TTY=pts/2 ; PWD=/home/jmlich ; USER=root ; COMMAND=/bin/systemctl start postgresql
Nov 14 11:45:56 systemd[1]: Starting PostgreSQL database server...
-- Subject: Unit postgresql.service has begun with start-up
-- Defined-By: systemd
-- Support:
-- Unit postgresql.service has begun starting up.
Nov 14 11:45:56 postgresql-check-db-dir[2108]: An old version of the database format was found.
Nov 14 11:45:56 postgresql-check-db-dir[2108]: Use "postgresql-setup upgrade" to upgrade to version 9.3.
Nov 14 11:45:56 postgresql-check-db-dir[2108]: See /usr/share/doc/postgresql/README.rpm-dist for more information.
Nov 14 11:45:56 systemd[1]: postgresql.service: control process exited, code=exited status=1
Nov 14 11:45:56 systemd[1]: Failed to start PostgreSQL database server.
-- Subject: Unit postgresql.service has failed
-- Defined-By: systemd
-- Support:
-- Documentation:
-- Unit postgresql.service has failed.
-- The result is failed.
The database initialization could be done using following command. It creates the configuration files postgresql.conf and pg_hba.conf
$ sudo postgresql-setup initdb
== Upgrade ==
As you can see from error message, it is not fresh installation, but ugprade.
$ sudo postgresql-setup upgrade
== User and password ==
$ sudo su - postgres
$ createuser -P
== configuration  ==
The postgresql server is using two main configuration files
* /var/lib/pgsql/data/postgresql.conf
* /var/lib/pgsql/data/pg_hba.conf
The default settings is usually restricted to localhost. 
== tips and tricks ==
For database management is comfortable to use graphical tools such as phpPgAdmin or pgadmin3
$ sudo yum install phpPgAdmin
$ sudo yum install pgadmin3

Latest revision as of 09:13, 3 February 2014

moved to [1]