When setting up PostgreSQL 9.1.2 on Fedora 16, you might encounter this peculiar error when attempting to initialize the database cluster:
Redirecting to /bin/systemctl initdb postgresql.service
Unknown operation initdb
This occurs because modern Fedora systems use systemd, which handles service management differently than traditional init scripts.
Instead of using the service command, you should either:
# As postgres user
sudo -u postgres initdb -D /var/lib/pgsql/data
# Or using postgresql-setup
sudo postgresql-setup initdb
After successful initialization, check the status:
sudo systemctl status postgresql.service
sudo systemctl start postgresql.service
sudo systemctl enable postgresql.service
If pgAdmin3 still won't connect, verify these configuration files:
# /var/lib/pgsql/data/pg_hba.conf
local all all peer
host all all 127.0.0.1/32 md5
# /var/lib/pgsql/data/postgresql.conf
listen_addresses = 'localhost'
port = 5432
Remember to restart PostgreSQL after making changes:
sudo systemctl restart postgresql.service
For PostgreSQL 10+ on modern Fedora, the recommended method is:
sudo postgresql-10-setup initdb
sudo systemctl start postgresql-10
The error message you're seeing (Redirecting to /bin/systemctl initdb postgresql.service
) indicates your Fedora 16 system is using systemd, which handles service management differently from traditional init systems. The key misunderstanding is that initdb
isn't a systemd service operation.
For PostgreSQL 9.1.2, you have two correct approaches to initialize the database cluster:
# Method 1: Using postgresql-setup
sudo postgresql-setup initdb
# Method 2: Manual initialization (as postgres user)
sudo -u postgres initdb -D /var/lib/pgsql/data
After initialization, check if the data directory contains the expected files:
ls -l /var/lib/pgsql/data
You should see critical files like postgresql.conf
, pg_hba.conf
, and the base database directories.
Once initialized, start the service using:
sudo systemctl start postgresql.service
To enable automatic startup on boot:
sudo systemctl enable postgresql.service
If pgAdmin3 still won't connect, verify these configuration aspects:
- Check
pg_hba.conf
for proper authentication methods - Ensure PostgreSQL is listening on the correct interface in
postgresql.conf
- Verify the service status with
systemctl status postgresql
While this solution works for PostgreSQL 9.1.2, note that newer Fedora versions and PostgreSQL releases have different initialization procedures. Current versions typically handle initialization during package installation.