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