# Postgres Datenbank

Alle Informationen zu Postgres auf Fedora

# Deinstallieren von Postgres auf Fedora

Quelle: [https://kb.objectrocket.com/postgresql/how-to-completely-uninstall-postgresql-757](https://kb.objectrocket.com/postgresql/how-to-completely-uninstall-postgresql-757)

<p class="callout info">Be sure to elevate the privileges for any of the commands in this article with `<span class="text">sudo</span>` if the terminal returns a `<span class="text">Permission denied</span>` error.</p>

## Uninstall and remove PostgreSQL packages on Fedora Linux

You can use the DNF repository’s `<span class="text">dnf</span>` command to uninstall PostgreSQL on Fedora-based distributions of Linux:

`<span class="kw2">sudo dnf remove </span>postgresql`

To use a wildcard operator (`<span class="text">*</span>`) to remove *all* packages with names beginning with `<span class="text">postgres</span>`, use the following command:

`sudo dnf <span class="kw2">remove </span>postgres\<span class="sy0">*</span>`

Be sure to remove the `<span class="text">pgsql</span>` directory as well:

`<span class="kw2">sudo rm </span><span class="sy0">/</span>var<span class="sy0">/</span>lib<span class="sy0">/</span>pgsql -d -r`

# Installieren von Postgres auf Fedora

Quelle: [https://docs.fedoraproject.org/en-US/quick-docs/postgresql/](https://docs.fedoraproject.org/en-US/quick-docs/postgresql/)

### Installation

The installation and initialization of the postgresql server is a little bit different in comparison to other packages and other Linux distros. This document aims to summarize basic installation steps relevant to recent Fedora Linux releases.

`sudo dnf install postgresql-server postgresql-contrib libpq`

The postgresql server is not running and disabled by default. To set it to start at boot, run:

`sudo systemctl enable postgresql`

The database needs to be populated with initial data after installation. The database initialization could be done using following command. It creates the configuration files postgresql.conf and pg\_hba.conf

`sudo postgresql-setup --initdb --unit postgresql`

To start the postgresql server manually, run

`sudo systemctl start postgresql`

### Benutzer und Datenbank anpassen

Der Standard-Benutzer "postgres" sollte ein eigenes Passwort bekommen, dies sollte je nach Unternehmen gesetzt werden, da sonst Probleme mit einigen Apps/Software auftreten können.

`sudo -u postgres psql`

Sie befinden sich nun in der Postgres-Konsole unter "postgres=#" zu erkennen.

`\password postgres`

Jetzt tippen Sie das neue Passwort zwei mal ein.

### Konfiguration für Postgres anpassen

In der HBA Konfiguration von Postgres alle angaben rechts auf "trust" setzen.

`sudo nano /var/lib/pgsql/data/pg_hba.conf`

[![Bildschirmfoto vom 2023-05-15 14-12-03.png](https://docs.liquidmagic.de/uploads/images/gallery/2023-05/scaled-1680-/HJ6dt5Y49pl2sHHx-bildschirmfoto-vom-2023-05-15-14-12-03.png)](https://docs.liquidmagic.de/uploads/images/gallery/2023-05/HJ6dt5Y49pl2sHHx-bildschirmfoto-vom-2023-05-15-14-12-03.png)