Configure PostgreSQL database on Solaris 10

Configure PostgreSQL database on Solaris 10

Occassionally you may need to setup database remotely on non-Windows O.S., then the following steps could be of great reference for your SCADA application.

  1. Open a terminal (right click on desktop, select Hosts and click Terminal Console)
  2. Create postgres user in /export/home/postgres

  3. # groupadd postgres
    # useradd -c 'PostgreSQL user' -d /export/home/postgres -g postgres -m -s /bin/bash postgres

  4. Create /export/home/postgres/data folder and user postgres as its owner

  5. # mkdir /export/home/postgres/data
    # chown postgres /export/home/postgres/data

  6. Initialize database cluster and run postmaster (database services)

  7. # su - postgres
    $ initdb -D /export/home/postgres/data
    $ postmaster -D /export/home/postgres/data >/export/home/postgres/data/logfile 2>& 1&

  8. Configure database for remote connection from where IGX is hosted, e.g.
  9. Open /export/home/postgres/data/pg_hba.conf file & under '#IPv4 local connections:' line, add:

  10. host all all trust

  11. Open /export/home/postgres/data/postgresql.conf file & modify line

  12. #listen_addresses = 'localhost' to listen_addresses = '*'

  13. Configure user account dbadmin & password dbadmin

  14. $ createuser -P
    Username: dbadmin
    Password: dbadmin
    $ exit

  15. Create /etc/init.d/postgresql file

  16. # touch /etc/init.d/postgresql

  17. Then open /etc/init.d/postgresql and insert a command line to run postmaster

  18. su - postgres -c "/usr/bin/pg_ctl start -l logfile -D /export/home/postgres/data"

  19. Create the postgresql symbolic link onto /etc/rc3.d as S99postgresql to launch postmaster(PostgreSQL server) during server startup automatically:

  20. # ln -s /etc/init.d/postgresql /etc/rc3.d/S99postgresql

  21. Stop postmaster and reboot unit.

  22. # su - postgres
    $ /usr/bin/pg_ctl stop -D /export/home/postgres/data -m smart
    $ exit
    # init 6

This guide is shared by our project engineer Zainal who has the avatar as shown. Yes, you can tell that he’s a Japanese cartoon lover & cheerful too. Feel free to contact him via our support channel if you have any issue using this guide for your SCADA configuration.