1.5 KiB
title | weight |
---|---|
PostgreSQL | 1 |
PostgreSQL
On this page, $
means the command must be run as a user with adequate rights such as the postgres
user.
Installation
Archlinux
On archlinux, PostgreSQL can be installed using the postgresql
package from [extra]
.
Major PostgreSQL upgrades are breaking. Instructions from the official documentation should be followed.
Upgrades can be prevented by adding postgresql
and postgresql-libs
to IgnorePkg
in /etc/pacman.conf
.
Filesystem preparation
In case a Btrfs filesystem is used, Copy-on-Write should be disabled first.
Initial setup
The database can be initialized using the following command. Locale defaults to current environment locale.
$ initdb --locale C.UTF-8 --encoding=UTF8 -D /var/lib/postgres/data --data-checksums
PostgreSQL can then be started using the postgresql
systemd service.
Usage
Creating users
The following command can be used:
$ createuser [--interactive]
Additionnal options can be used to give permissions to the user (usually not needed).
Users can be deleted using the following command:
$ dropuser [-i/--interactive] [user]
Creating databases
The following command can be used:
$ createdb [-O owner] [dbname [description]]