Starting PostgreSQL as a service in Solaris Express

PostgreSQL is already installed in Solaris Express, and it's set up as a service, but it is disabled by default. Once you have this set up, then PostgreSQL will always be up and running, even after reboots.

Log in as the postgres user, which is pre-created as part of the install of SXDE. I didn't know what the password was, so I had to log in as root first, then change the password using passwd postgres.

Fix the PATH environment variable so that /usr/postgres/8.2/bin is at the front. The default Postgres commands in /usr/bin are for version 8.1 of PostgreSQL

Make sure the directory /var/postgres/8.2/data exists; if not, create it

Make sure your default user has rights to manage services. Go to Administration->Users and Groups, select your user, and choose Properties, then select the User Privileges tab, and make sure either System Administrator or Service Management is enabled.

Enable the service using svcadm enable postgresql:version_82

Run svcs -x. If it shows postgresql, there was a problem, and it will tell you where the log file is to see what went wrong. Run svcs | grep postgres and it should show it as enabled.

Create a user in Postgres that matches your current user, so you can log in to the database as that user by running createuser userid. Alternately you can run createuser postgres and log in to the database as postgres.

Verify you can log in to the Postgres server by running the psql command.