How to set up postgres in Fedora 35

The Fedora PostgreSQL guide, while technically correct, is written in a very strange manner with numerous dead ends and wrong commands in my opinion. I’ve just signed up and failed to gain edit access to the wiki for the second time, so I’m documenting here in the hopes that the lonely Googler/Searcher will find this ranking on the first page too. The correct commands to set up postgres on Fedora are:

sudo dnf install postgresql-server postgresql-contrib

sudo systemctl enable postgresql

sudo postgresql-setup --initdb --unit postgresql

sudo systemctl start postgresql

su - postgres (You then need to non-optionally create your databases under the postgres user)


CREATE USER lenny WITH PASSWORD 'leonard'; (you can also create a password for your PSQL user with \password your_password )


\q to get out of postgres and back to shell. Now you can switch back to your main account and start using your database.

su giannidunk (in my case)

psql carl and go for it!

Please feel free to post your improvements below! I hope someone with Wiki permissions sees this and re-orders that horrible document. See the original document for explanation of what these commands do!

Yours truly – A developer who’s just trying to get some work done.


sudo gedit /var/lib/pgsql/data/pg_hba.conf - If you’re getting ident errors from your app you’ll probably need to perform the accepted solution described here (tldr: edit host all all ident to host all all md5 )


Hello @nikodunk, welcome, and thank you.
This is not the purpose of this category, but it doesn’t matter.

The Fedora wiki contains a lot of outdated documents. Nowadays it’s more a scratch-board than a documentation source.
It would be nice if you propose what you wrote here as a quick doc. And subsequently fix the wiki page by redirecting it to the new document. If you would like to participate, here you can find how to contribute to quick-docs: Contribute to Quick Docs :: Fedora Docs

And if you would like to speak to someone, for clarifications and any question, I suggest to get in touch with the Fedora Join SIG[1]. Here you can find how to communicate with them Fedora Join Special Interest Group :: Fedora Docs

  1. SIG: Special Interesting Group ↩︎


Awesome, @alciregi ! Thank you for the pointers! Looking into it now.

Great! Thanks again for the pointer. Opened a Pull Request at PR#414: Update Postgres guide - fedora-docs/quick-docs - as recommended by the guide with my changes above, though I’d still need Wiki access to redirect the old Wiki page to the updated new Postgres wiki page!

Thanks! I’ll let you know how it goes waiting for approval to merge.



Looks great — thanks for doing this! I would add you to the wikiedit group, but turns out I myself am not a sponsor for that. I filed a request to become one so I can add people in the future. :classic_smiley:

1 Like

I implemented your changes - they were excellent. Thank you, @mattdm

1 Like

By the way, thanks to @alciregi s efforts, I’ve re-routed the old Wiki to the new Quick Docs. So once/if the changes are merged into the Quick Docs, we’ll have a fully updated guide at the correct address :slight_smile:

Thanks for all your help!


Hi @mattdm @alciregi . Thank you for merging the pull request. Quick question - does it take a while for the quick docs to rebuild? I’m not seeing the updated page at PostgreSQL :: Fedora Docs?


There is a delay, but it shouldn’t be this long. I’ll check with the infra team tomorrow to see what’s going on.

1 Like

Thank you!

How peculiar… @mattdm it appears to have updated all translations except en-US. PostgreSQL :: Fedora Docs for example shows the updated guide?

Weird! Maybe some caching is getting in the way. Let’s bring this over to Quickdocs site not updating?

Update! It’s up at PostgreSQL :: Fedora Docs and as the top query for fedora psql! Great job everyone :slight_smile:

1 Like