Annotation of wikisrc/pkgsrc/how_to_install_a_postgresql_server.mdwn, revision 1.2

1.2     ! schmonz     1: Installing a PostgreSQL Server under NetBSD is pretty easy. The recommended way is to install the prebuilt postgresql binaries. The PostgreSQL Server depends on the postgreSQL Client. 
        !             2:    [4]: 
        !             3: 
        !             4: **Contents**
        !             5: 
1.1       mspo        6: [[!toc levels=3]]
1.2     ! schmonz     7: 
        !             8: #   Setting PKG_PATH 
        !             9: 
        !            10: Setting PKG_PATH enables us to easily download and install packages and it's dependencies. 
        !            11:     
        !            12:     # export PKG_PATH=ftp://ftp4.de.netbsd.org/pub/NetBSD/packages/3.0/i386/All
        !            13:     
        !            14: 
        !            15: or if you are using csh: 
        !            16:     
        !            17:     # setenv PKG_PATH ftp://ftp4.de.netbsd.org/pub/NetBSD/packages/3.0/i386/All
        !            18:     
        !            19: 
        !            20: You should keep this in your .profile, .bash_profile, if you mainly using binaries. 
        !            21: 
        !            22: #   Installing the PostgreSQL Server 
        !            23:     
        !            24:     # pkg_add -v postgresql80-server-8.0.4.tgz
        !            25:     
        !            26: 
        !            27: 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. 
        !            28: 
        !            29: That's it. Almost. 
        !            30: 
        !            31: #   Configuring the Server 
        !            32: 
        !            33: Please copy the pgsql example script to /etc/rc.d/ 
        !            34:     
        !            35:     # cp /usr/pkg/share/examples/rc.d/pgsql /etc/rc.d
        !            36:     
        !            37: 
        !            38: 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: 
        !            39:     
        !            40:     # usermode -d /var/db/pgsql pgsql
        !            41:     
        !            42: 
        !            43: This directory must be owned by pgsql:pgsql. 
        !            44: 
        !            45: and then 
        !            46: 
        !            47: #   Starting the Server 
        !            48: 
        !            49: If you want to initialise the database with a local other than "C", for example with unicode, invoke this before starting postgresql for the first time: 
        !            50:     
        !            51:     # /etc/rc.d/pgsql initdb -E unicode
        !            52:     
        !            53: 
        !            54: please start the server entering: 
        !            55:     
        !            56:     # /etc/rc.d/pgsql start
        !            57:     
        !            58: 
        !            59: This will create all necessary initial databases on the first start. 
        !            60: 
        !            61: #   Start on every boot 
        !            62: 
        !            63: To start the server on every boot add 
        !            64:     
        !            65:     pgsql=yes
        !            66:     
        !            67: 
        !            68: to your /etc/rc.conf 
        !            69: 
        !            70: #   Creating an example Database 
        !            71: 
        !            72: To create a database switch to the user pgsql 
        !            73:     
        !            74:     # su pgsql
        !            75:     
        !            76: 
        !            77: and create the database 
        !            78:     
        !            79:     $ createdb testdb
        !            80:     $ exit
        !            81:     
        !            82: 
        !            83: #   Using the Database 
        !            84: 
        !            85: Postgres provides a Tool to manage the Database called **psql**. 
        !            86:     
        !            87:     
        !            88:     # psql -U pgsql testdb
        !            89:     Welcome to psql 8.0.4, the PostgreSQL interactive terminal.
        !            90:     
        !            91:     Type:  \copyright for distribution terms
        !            92:            \h for help with SQL commands
        !            93:            \? for help with psql commands
        !            94:            \g or terminate with semicolon to execute query
        !            95:            \q to quit
        !            96:     
        !            97:     testdb=#
        !            98:     
        !            99: 
        !           100: #   PHP and PostgreSQL 
        !           101: 
        !           102: You may wish to install the postgres Module for PHP 
        !           103:     
        !           104:     # pkg_add -v php-pgsql-4.4.1.tgz
        !           105:     
        !           106: 
        !           107: Have fun. 
        !           108: 
        !           109: #   Additional Information 
        !           110: 
        !           111:   * [pkg_add(1)](http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current) Manpage 
        !           112:   * [su(1)](http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current) Manpage 

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb