Setting up Postgresql on SUSE
To install postgresql you just need to use the SUSE package manager, either from yast or from zypper:
zypper in postgresql-server
or
yast -i postgresql-server
By default Postgresql on SUSE is setup in ‘ident’ mode, which matches your SQL user with your unix user, so only the unix user ’sontek’ can login to the database with the username ’sontek’. This is great security but is confusing the first time you are setting up the server because you wont be able to login with your user or root.
What you have to do is switch your user to postgres :
su - postgres
and then you will be able to setup your own user account:
createuser ’sontek’
and now your user will be able to login to the postgresql server with your account.
The other issue with ident is now only unix users will be able to connect to your database server, so if you are a programmer and need to write an application that connects to the database you will need to setup a non-ident user. To do this you first need to create a user with a password:
createuser ‘appuser’ –pwprompt -E
This will create a user named ‘appuser’ and will prompt you for a password that will be encrypted.
and then add this line to your /var/lib/pgsql/data/pg_hba.conf file:
host all appuser 127.0.0.1/32 md5
This will setup your server to allow ‘appuser’ to be authenticated via an md5 password. After you modify the pg_hba.conf file you will need to restart postgresql and then you are all set to start working with postgresql on SUSE!
/etc/init.d/postgresql restart








This is exactly what I was looking for. I am still on 10.2, but trying to get a php/postgres system to run on opensuse. Thanks so much!
Comment by Matthias Ritzkowski — October 12, 2007 @ 6:22 pm
I’m kind of confused by your instructions here — are you assuming you are logged in as root and that you don’t all ready have a personal user account? Are you required to create a local unix account for every username you want to grant access to Postgres? I got this working before by disabling the ident authentication, but I’d like to try to get it working the default SUSE way — is there any documentation out there on this?
Comment by stm — October 21, 2007 @ 8:27 pm
Good comments on sun vs novell. There will always be disaffected people; some with good reason. All companies screw-up from time-to-time - it’s a human trait. I’d be happy to work for either (if only). Siting lots of bad comments and then inviting a poll on the issue is about as immature as it gets.
Comment by RogerP — October 26, 2007 @ 4:00 am