Index: openacs-4/packages/acs-core-docs/www/postgres.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/postgres.html,v diff -u -r1.41 -r1.42 --- openacs-4/packages/acs-core-docs/www/postgres.html 16 Feb 2005 00:21:03 -0000 1.41 +++ openacs-4/packages/acs-core-docs/www/postgres.html 4 Jun 2006 00:45:24 -0000 1.42 @@ -1,7 +1,8 @@ -Install PostgreSQL

Install PostgreSQL

by Vinod Kurup

+ +Install PostgreSQL

Install PostgreSQL

by Vinod Kurup

OpenACS docs are written by the named authors, and may be edited by OpenACS documentation staff. -

Skip this section if you will run only Oracle.

OpenACS 5.2.0d1 will run with PostgreSQL 7.3.2, 7.3.3, and 7.3.4 and 7.4.x. 7.4.7 is the recommended version of PostgreSQL.

  • Special notes for Mac OS X.�If you are running Mac OS X prior to 10.3, you should be able to install and use PostGreSQL 7.3.x. Mac OS X 10.3 requires PostGreSQL 7.4.

  • Special Notes for Debian.�

    Debian stable user should install PostGreSQL from source +

Skip this section if you will run only Oracle.

OpenACS 5.2.3b1 will run with PostgreSQL 7.3.2, 7.3.3, and 7.3.4 and 7.4.x. 7.4.7 is the recommended version of PostgreSQL.

  • Special notes for Mac OS X.�If you are running Mac OS X prior to 10.3, you should be able to install and use PostGreSQL 7.3.x. Mac OS X 10.3 requires PostGreSQL 7.4.

  • Special Notes for Debian.�

    Debian stable user should install PostGreSQL from source as detailed below, or they should use the www.backports.org backport for Postgres to get a more current version. Debian unstable users: the following process has been known to work @@ -14,7 +15,7 @@ ln -s /usr/include/postgresql/ /usr/include/pgsql ln -s /var/lib/postgres /usr/local/pgsql ln -s /usr/include/pgsql /usr/local/pgsql/include -su postgres -c "/usr/lib/postgresql/bin/createlang plpgsql template1"

    and proceed to Tune postgres. (OPTIONAL) or to the +su postgres -c "/usr/lib/postgresql/bin/createlang plpgsql template1"

    and proceed to Tune postgres. (OPTIONAL) or to the next section.

  • Special Notes for Red Hat.�Red Hat users: If you install PostgreSQL 7.3.2 from the Red Hat 9 RPM, you can skip a few steps. These shell commands add some links for compatibility with the directories from a source-based install; start the service; create a new group for web service users, and modify the postgres user's @@ -27,8 +28,8 @@ Initializing database: [ OK ] Starting postgresql service: [ OK ] -[root root]# echo "export LD_LIBRARY_PATH=/usr/local/pgsql/lib" >> ~postgres/.bash_profile -[root root]# echo "export PATH=$PATH:/usr/local/pgsql/bin" >> ~postgres/.bash_profile +[root root]# echo "export LD_LIBRARY_PATH=/usr/local/pgsql/lib" >> ~postgres/.bash_profile +[root root]# echo "export PATH=$PATH:/usr/local/pgsql/bin" >> ~postgres/.bash_profile [root root]# groupadd web [root root]# su - postgres -bash-2.05b$ @@ -37,10 +38,10 @@ ln -s /var/lib/pgsql /usr/local/pgsql ln -s /usr/bin /usr/local/pgsql/bin service postgresql start -echo "export LD_LIBRARY_PATH=/usr/local/pgsql/lib" >> ~postgres/.bash_profile -echo "export PATH=$PATH:/usr/local/pgsql/bin" >> ~postgres/.bash_profile +echo "export LD_LIBRARY_PATH=/usr/local/pgsql/lib" >> ~postgres/.bash_profile +echo "export PATH=$PATH:/usr/local/pgsql/bin" >> ~postgres/.bash_profile groupadd web -su - postgres

    ... and then skip to 7. Something similar may work for other binary packages as well.

  • Safe approach: install from source

    1. Unpack PostgreSQL 7.4.7.�If you have not downloaded the postgresql tarball to +su - postgres

      ... and then skip to 8. Something similar may work for other binary packages as well.

    2. Safe approach: install from source

      1. Unpack PostgreSQL 7.4.7.�If you have not downloaded the postgresql tarball to /var/tmp/postgresql-7.4.7.tar.gz, get it.

        [root root]# cd /usr/local/src
         [root src]# tar xzf /var/tmp/postgresql-7.4.7.tar.gz
        @@ -52,7 +53,13 @@
         [root src]# tar xfj /var/tmp/postgresql-7.4.7.tar.bz2
         [root src]# 
         cd /usr/local/src
        -tar xfj /var/tmp/postgresql-7.4.7.tar.bz2
      2. Create the Postgres user.� +tar xfj /var/tmp/postgresql-7.4.7.tar.bz2

      3. Install Bison.�Only do this if bison --version is smaller than 1.875 and you install PostgreSQL 7.4 from cvs instead of tarball.

        [root root]# cd /usr/local/src
        +[root src]# wget http://ftp.gnu.org/gnu/bison/bison-1.875.tar.gz
        +[root src]# tar xfz bison-1.875.tar.gz
        +[root src]# cd bison-1.875
        +[root src]# ./configure
        +[root src]# make install
        +      
      4. Create the Postgres user.� Create a user and group (if you haven't done so before) for PostgreSQL. This is the account that PostgreSQL will run as since it will not run as root. Since nobody will log in @@ -71,8 +78,8 @@ mkdir -p /usr/local/pgsql chown -R postgres.web /usr/local/pgsql /usr/local/src/postgresql-7.4.7 chmod 750 /usr/local/pgsql

        • Mac OS X: Do instead:�First make sure the gids and uids below are available (change them if -they are not).To list taken uids and gids:

          nireport / /groups name gid | grep "[0123456789][0123456789]"
          -nireport / /users name uid | grep "[0123456789][0123456789]"
          +they  are not).To list taken uids and gids:

          nireport / /groups name gid | grep "[0123456789][0123456789]"
          +nireport / /users name uid | grep "[0123456789][0123456789]"
                     

          Now you can install the users

          sudo niutil -create / /groups/web
           sudo niutil -createprop / /groups/web gid 201
           sudo niutil -create / /users/postgres
          @@ -100,15 +107,15 @@
           [postgres ~] emacs ~postgres/.bashrc

          Paste this line into .bash_profile:

          source $HOME/.bashrc

          Paste these lines into .bashrc:

          export PATH=/usr/local/bin/:$PATH:/usr/local/pgsql/bin
           export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/pgsql/lib

          Test this by logging in as postgres and checking the - paths; you should see /usr/local/pgsql/bin

          [root src]# su - postgres
          +	paths; you should see /usr/local/pgsql/bin somewhere in the output (the total output is system-dependent so yours may vary)

          [root src]# su - postgres
           [postgres pgsql]$ env | grep PATH
           LD_LIBRARY_PATH=:/usr/local/pgsql/lib
           PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin/X11:/usr/X11R6/bin:/root/bin:/usr/local/pgsql/bin:/usr/local/pgsql/bin
           [postgres pgsql]$ exit
           

          Don't continue unless you see correct output from env | grep PATH

        • Compile and install PostgreSQL.� Change to the postgres user and run ./configure to set the compilation options automatically. This is the point at which you can - configure PostgreSQL in various ways. For example, if you are installing on "OS X" add the flags --with-includes=/sw/include/ --with-libraries=/sw/lib. If you want to see what the other possibilities are, run ./configure --help. + configure PostgreSQL in various ways. For example, if you are installing on "OS X" add the flags --with-includes=/sw/include/ --with-libraries=/sw/lib. If you want to see what the other possibilities are, run ./configure --help.

          On debian woody (stable, 3.0), do ./configure --without-readline --without-zlib.

          [root src]# su - postgres
           [postgres pgsql]$ cd /usr/local/src/postgresql-7.4.7
           [postgres postgresql-7.4.7]$ ./configure
          @@ -139,7 +146,7 @@
           	  PostgreSQL. If PostgreSQL is unable to allocate enough memory, see section 11
                     Tuning PostgreSQL (below).
           	

          [postgres postgresql-7.4.7]$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
          -The files belonging to this database system will be owned by user "postgres".
          +The files belonging to this database system will be owned by user "postgres".
           This user must also own the server process.
           (17 lines omitted)
           or
          @@ -206,11 +213,11 @@
                   state. Red Hat and Debian and SuSE each work a little
                   differently.  If you haven't  untarred the OpenACS tarball, you will need to do so now to access the postgresql.txt file.
           	

          • Red Hat RPM:

            The init script is already installed; just turn it on for the appropriate run levels.

            [root root]# chkconfig --level 345 postgresql on
            -[root root]# 
          • Red Hat from source:

            [root src]# cp /var/tmp/openacs-5.2.0d1/packages/acs-core-docs/www/files/postgresql.txt /etc/init.d/postgresql
            +[root root]# 
          • Red Hat from source:

            [root src]# cp /var/tmp/openacs-5.2.3b1/packages/acs-core-docs/www/files/postgresql.txt /etc/init.d/postgresql
             [root src]# chown root.root /etc/rc.d/init.d/postgresql
             [root src]# chmod 755 /etc/rc.d/init.d/postgresql
             [root src]# 
            -cp /var/tmp/openacs-5.2.0d1/packages/acs-core-docs/www/files/postgresql.txt /etc/init.d/postgresql
            +cp /var/tmp/openacs-5.2.3b1/packages/acs-core-docs/www/files/postgresql.txt /etc/init.d/postgresql
             chown root.root /etc/rc.d/init.d/postgresql
             chmod 755 /etc/rc.d/init.d/postgresql

            Test the script.

            [root root]# service postgresql stop
             Stopping PostgreSQL: ok
            @@ -233,7 +240,7 @@
             [root ~]# chown root.root /etc/init.d/postgresql
             [root ~]# chmod 755 /etc/init.d/postgresql
             [root ~]# 
            -cp /var/tmp/openacs-5.2.0d1/packages/acs-core-docs/www/files/postgresql.txt /etc/init.d/postgresql
            +cp /var/tmp/openacs-5.2.3b1/packages/acs-core-docs/www/files/postgresql.txt /etc/init.d/postgresql
             chown root.root /etc/init.d/postgresql
             chmod 755 /etc/init.d/postgresql

            Test the script

            [root ~]# /etc/init.d/postgresql stop
             Stopping PostgreSQL: ok
            @@ -251,11 +258,11 @@
                /etc/rc5.d/S20postgresql -> ../init.d/postgresql
             [root ~]# /etc/init.d/postgresql start
             Starting PostgreSQL: ok
            -[root ~]#
          • FreeBSD:

            [root ~]# cp /tmp/openacs-5.2.0d1/packages/acs-core-docs/www/files/postgresql.txt /usr/local/etc/rc.d/postgresql.sh
            +[root ~]#
          • FreeBSD:

            [root ~]# cp /tmp/openacs-5.2.3b1/packages/acs-core-docs/www/files/postgresql.txt /usr/local/etc/rc.d/postgresql.sh
             [root ~]# chown root:wheel /usr/local/etc/rc.d/postgresql.sh
             [root ~]# chmod 755 /usr/local/etc/rc.d/postgresql.sh
             [root ~]# 
            -cp /tmp/openacs-5.2.0d1/packages/acs-core-docs/www/files/postgresql.txt /usr/local/etc/rc.d/postgresql.sh
            +cp /tmp/openacs-5.2.3b1/packages/acs-core-docs/www/files/postgresql.txt /usr/local/etc/rc.d/postgresql.sh
             chown root:wheel /usr/local/etc/rc.d/postgresql.sh
             chmod 755 /usr/local/etc/rc.d/postgresql.sh

            Test the script

            [root ~]# /usr/local/etc/rc.d/postgresql.sh stop
             Stopping PostgreSQL: ok
            @@ -273,7 +280,7 @@
                         rc.d/ part in each of the
                         following commands.
             
            -          

          [root ~]# cp /var/tmp/openacs-5.2.0d1/packages/acs-core-docs/www/files/postgresql.txt /etc/rc.d/init.d/postgresql
          +          

        [root ~]# cp /var/tmp/openacs-5.2.3b1/packages/acs-core-docs/www/files/postgresql.txt /etc/rc.d/init.d/postgresql
         [root ~]# chown root.root /etc/rc.d/init.d/postgresql
         [root ~]# chmod 755 /etc/rc.d/init.d/postgresql