38 lines
965 B
Markdown
38 lines
965 B
Markdown
# PostgreSQL Installation on AlmaLinux
|
|
|
|
```javascript
|
|
# Install Repository
|
|
dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm
|
|
|
|
# Disable default PostgreSQL module
|
|
dnf -qy module disable postgresql
|
|
|
|
# Install PostgreSQL (you can change version ofc)
|
|
dnf -y install postgresql16-server postgresql16-contrib
|
|
|
|
# Initialize DB
|
|
/usr/pgsql-16/bin/postgresql-16-setup initdb
|
|
|
|
# Set autostart and start PostgreSQL now
|
|
systemctl enable --now postgresql-16
|
|
```
|
|
|
|
# PostgreSQL Installation on AlpineLinux
|
|
|
|
```javascript
|
|
# Install PostgreSQL
|
|
apk add postgresql postgresql-client
|
|
|
|
# Setup/Initialize Database
|
|
rc-service postgresql setup
|
|
rc-service postgresql start
|
|
|
|
# Create a User that can create a Database
|
|
psql -U postgres
|
|
CREATE USER pgUSER WITH PASSWORD 'strongpassword';
|
|
ALTER ROLE pgUSER CREATEDB;
|
|
\q
|
|
|
|
# Set autostart and start PostgreSQL now
|
|
rc-update add postgresql
|
|
``` |