PostgreSQL, often simply Postgres, is an object-relational database management system (ORDBMS) available for many platforms including Linux, FreeBSD, Solaris, Microsoft Windows and Mac OS X. The following versions have been made available. They are all 64 bit and compiled with the Oracle Solaris Studio tools.
|Name||Package Name||Version||Version String|
|PostgreSQL Database 8.2||postgresql-82||8.2.23||82|
|PostgreSQL Database 8.4||postgresql-84||8.4.17||84|
|PostgreSQL Database 9.0||postgresql-90||9.0.13||90|
|PostgreSQL Database 9.1||postgresql-91||9.1.9||91|
|PostgreSQL Database 9.2||postgresql-92||9.2.4||92|
The process below uses $$ in place of the version number. Remember to use the correct Version String shown above in place of $$ for all commands.
The installation of PostgreSQL also delivers the required files and configuration to run it as a Solaris SMF service. Continue reading to get PostgreSQL running as a service on your Solaris 11 environment.
If you've already added my repository to your Solaris 11 installation the following command will install PostgreSQL.
sudo pkg install postgresql-$$
The table below shows some of the key service properties that can/should be changed to suit your environment. Default values are also listed. The default values will work but I'd recommend, at the very least, method_context/group and method_context/user be reviewed to ensure you're happy using the defaults. The user and group needs to be the owner of the postgresql-$$/data folder.
|postgresql-$$/binary||/opt/SMM/postgresql-$$/bin||The location for the PostgreSQL binary files.|
|postgresql-$$/log||server.log||The name of the log file created/used by the PostgreSQL service.|
|postgresql-$$/data||/var/opt/SMM/postgresql-$$||Data directory used by PostgreSQL. This folder must be owned by 'method_context/group' and 'method_context/user'.|
|method_context/group||postgres||Group that PostgreSQL runs under.|
|method_context/user||postgres||User that PostgreSQL runs under.|
Firstly, decide on a user, group and data directory to use for PostgreSQL. For this example, I will be using the default user and group but I'll detail the process to change them anyway. They already exist in the standard Solaris 11 install so they don't need to be created.
Now, let's set up the environment and configure the properties for the service. The commands below need to be executed by a user with elevated privileges.
# create the data directory mkdir /postgresql # change the ownership on the data directory chown -R postgres:postgres /postgresql # set the relevant properties for the service svccfg -s postgresql-$$:default setprop postgresql-$$/data = astring: "/postgresql" svccfg -s postgresql-$$:default setprop postgresql-$$/log = astring: "postgresql.log" svccfg -s postgresql-$$:default setprop method_context/group = astring: "postgres" svccfg -s postgresql-$$:default setprop method_context/user = astring: "postgres" svcadm refresh postgresql-$$:default
Create the Initial Database
su - postgres /opt/SMM/postgresql-$$/bin/initdb -D /postgresql
Start the Service
# start the service svcadm enable postgresql-$$ # check status svcs -l postgresql-$$ # view the log less /postgresql/postgresql.log
You should now have a running instance of PostgreSQL.
I'm running 9.2 and have only done limited testing with the other version. Let me know if you have any questions or issues.