Install Postgresql On OpenBSD 6.1

Before executing below step login as root to your OpenBSD

1. make sure PKG_PATH is correctly pointing to mirror containing openbsd package.
check it with set command on shell and search for PKG_PATH

   PKG_PATH=http://ftp.jaist.ac.jp/pub/OpenBSD/6.1/packages/amd64

if not set or not exist execute command below

   export PKG_PATH=http://ftp.jaist.ac.jp/pub/OpenBSD/6.1/packages/amd64

2. add postgresql server package

   pkg_add postgresql-server

3. connect to postgresql user

   su – _postgresql

4. create directory to hold data

   mkdir /var/postgresql/data/

5. init database and set password with md5 auth

   initdb -D /var/postgresql/data -U postgres -A md5 -W

6. to start postgresql server

   /etc/rc.d/postgresql start

7. configure for auto start at system boot by adding postgresql to pkg_scripts on /etc/rc.conf.local
if /etc/rc.conf.local is not exist then create it and add as follow

   pkg_scripts=postgresql

8. install pgadmin3  and postgresql-client if needed

   pkg_add pgadmin3 postgresql-client

9. execute pgadmin3 under xwindows and connect to postgresql using user postgres and password set before

 

Good luck …

 

Leave a Reply

Your email address will not be published. Required fields are marked *