Brooks Computing Systems - Jacksonville
Visit Brooks Computing Systems
Mainframes, Desktops & Web Sites
To install PostgreSQL on Gentoo Linux, follow these steps:
To install PostgreSQL on Gentoo Linux, follow these steps:
sudo emerge --sync
sudo emerge -av sys-cluster/postgresql16Replace `postgresql16` with your desired version (e.g., `postgresql15`).
sudo useradd -c "PostgreSQL Server" -d /var/lib/postgresql -m -s /bin/false postgres
sudo passwd -d postgres # Disable the postgres user's password sudo -u postgres initdb -D /var/lib/postgresql/dataThis creates the default database directory and initializes the cluster.
Edit the configuration files:
- **`postgresql.conf`**: Located at `/var/lib/postgresql/data/postgresql.conf`
- **`pg_hba.conf`**: Located at `/var/lib/postgresql/data/pg_hba.conf`
Example `pg_hba.conf` to allow local connections:
# TYPE SOURCE DEST USER CIDR-ADDRESS METHOD
local all all postgres trust
host all all 127.0.0.1/32 md5 sudo rc-update add postgresql default
sudo /etc/init.d/postgresql startConnect to the database as the `postgres` user:
sudo -u postgres psql -U postgresYou should see a PostgreSQL prompt (`psql (16.x) ...`).
sudo rc-update add postgresql defaultQuality, Reliability & Service Consultancy for Mainframes, Desktops & Web Sites