version 1.2, 2012/02/05 07:14:36
|
version 1.4, 2016/07/04 05:35:17
|
Line 9 Installing a PostgreSQL Server under Net
|
Line 9 Installing a PostgreSQL Server under Net
|
|
|
Setting PKG_PATH enables us to easily download and install packages and it's dependencies. |
Setting PKG_PATH enables us to easily download and install packages and it's dependencies. |
|
|
# export PKG_PATH=ftp://ftp4.de.netbsd.org/pub/NetBSD/packages/3.0/i386/All |
# export PKG_PATH=https://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/$(uname -m)/$(uname -r)/All/ |
|
|
|
|
or if you are using csh: |
or if you are using csh: |
|
|
# setenv PKG_PATH ftp://ftp4.de.netbsd.org/pub/NetBSD/packages/3.0/i386/All |
# setenv PKG_PATH https://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/$(uname -m)/$(uname -r)/All/ |
|
|
|
|
You should keep this in your .profile, .bash_profile, if you mainly using binaries. |
You should keep this in your .profile, .bash_profile, if you mainly using binaries. |
|
|
# Installing the PostgreSQL Server |
# Installing the PostgreSQL Server |
|
|
# pkg_add -v postgresql80-server-8.0.4.tgz |
# pkg_add -v postgresql92-server |
|
|
|
|
This will install the postgresql client and the server and any missing dependency (readline, perl) and will add the user **pgsql** to your user database. |
This will install the postgresql client and the server and any missing dependency (readline, perl) and will add the user **pgsql** to your user database. |
Line 35 Please copy the pgsql example script to
|
Line 35 Please copy the pgsql example script to
|
# cp /usr/pkg/share/examples/rc.d/pgsql /etc/rc.d |
# cp /usr/pkg/share/examples/rc.d/pgsql /etc/rc.d |
|
|
|
|
If you want to keep the databse cluster other place than the default location, just change the user **pgsql'**s home directory, before proceeding to the initialisation: |
If you want to keep the database cluster other place than the default location, just change the user **pgsql'**s home directory, before proceeding to the initialisation: |
|
|
# usermode -d /var/db/pgsql pgsql |
# usermod -d /var/db/pgsql pgsql |
|
|
|
|
This directory must be owned by pgsql:pgsql. |
This directory must be owned by pgsql:pgsql. |
Line 71 to your /etc/rc.conf
|
Line 71 to your /etc/rc.conf
|
|
|
To create a database switch to the user pgsql |
To create a database switch to the user pgsql |
|
|
# su pgsql |
# createdb -e -h 127.0.0.1 -U pgsql newdbname |
|
|
|
|
and create the database |
and create the database |
Line 99 Postgres provides a Tool to manage the D
|
Line 99 Postgres provides a Tool to manage the D
|
|
|
# PHP and PostgreSQL |
# PHP and PostgreSQL |
|
|
You may wish to install the postgres Module for PHP |
You may wish to install the postgres Module for PHP, e.g. for PHP 7.0 use: |
|
|
# pkg_add -v php-pgsql-4.4.1.tgz |
# pkg_add -v php70-pgsql |
|
|
|
|
Have fun. |
Have fun. |