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.21.2.10 -r1.21.2.11 --- openacs-4/packages/acs-core-docs/www/postgres.html 21 Jan 2004 18:36:16 -0000 1.21.2.10 +++ openacs-4/packages/acs-core-docs/www/postgres.html 2 Feb 2004 18:10:54 -0000 1.21.2.11 @@ -1,7 +1,7 @@ -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.0.0 will run with PostgreSQL 7.2.x, 7.3.2, 7.3.3, and 7.3.4. 7.3.4 is the recommended version of PostgreSQL. PostgreSQL 7.4 has been verified.

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

  • Debian.�

    Debian users can install the package and add some backwards-compatibility links:

    apt-get install postgresql postgresql-dev postgresql-doc
    +        

Skip this section if you will run only Oracle.

OpenACS will run with PostgreSQL 7.2.x, 7.3.2, 7.3.3, and 7.3.4. 7.3.4 is the recommended version of PostgreSQL. PostgreSQL 7.4 has been verified.

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

  • Debian.�

    Debian users, especially Debian stable users, should install PostGreSQL from source as detailed below. Debian unstable users: the following process has been known to work:

    apt-get install postgresql postgresql-dev postgresql-doc
     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
    @@ -23,21 +23,21 @@
     [root root]# groupadd web
     [root root]# su - postgres
     -bash-2.05b$
    -
    
    +
     ln -s /usr/lib/pgsql/ /var/lib/pgsql/lib
     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
     groupadd web
    -su - postgres

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

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

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

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

    [root root]# cd /usr/local/src
     [root src]# tar xzf /tmp/postgresql-7.3.4.tar.gz
     [root src]# 
    -
    cd /usr/local/src
    -tar xzf /tmp/postgresql-7.3.4.tar.gz
  2. Create the Postgres user.� +cd /usr/local/src +tar xzf /tmp/postgresql-7.3.4.tar.gz

  3. 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 @@ -48,11 +48,11 @@ [root src]# chown -R postgres.web /usr/local/pgsql /usr/local/src/postgresql-7.3.4 [root src]# chmod 750 /usr/local/pgsql [root src]# -

    groupadd web
    +groupadd web
     useradd -g web -d /usr/local/pgsql postgres
     mkdir -p /usr/local/pgsql
     chown -R postgres.web /usr/local/pgsql /usr/local/src/postgresql-7.3.4
    -chmod 750 /usr/local/pgsql
    • Mac OS X: Do instead:

      sudo niutil -create / /groups/web
      +chmod 750 /usr/local/pgsql
      • Mac OS X: Do instead:

        sudo niutil -create / /groups/web
         sudo niutil - list / /groups

        The second command returns a list of groups. The last entry should include the gid of the group web, which you will need in the next sequence:

        sudo niutil -create / /users/postgres
         sudo niutil -createprop / /users/postgres gid web's gid_number
         sudo niutil -createprop / /users/postgres home /usr/local/pgsql
        @@ -73,7 +73,7 @@
         	  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 want to
         	  enable
        -	  Unicode support, add the flags --enable-locale and --enable-multibyte. If you want to see what the other possibilities are, run ./configure --help.
        +	  Unicode support, add the flags --enable-locale and --enable-multibyte. If you want to see what the other possibilities are, run ./configure --help.
         	

        [root src]# su - postgres
         [postgres pgsql]$ cd /usr/local/src/postgresql-7.3.4
         [postgres postgresql-7.3.4]$ ./configure
        @@ -94,11 +94,11 @@
         (many lines omitted)
         Thank you for choosing PostgreSQL, the most advanced open source database
         engine.
        -
        su - postgres
        +su - postgres
         cd /usr/local/src/postgresql-7.3.4
         ./configure
         make all
        -make install
      • Start PostgreSQL.� +make install

      • Start PostgreSQL.� The initdb command initializes the database. pg_ctl is used to start up PostgreSQL. @@ -111,8 +111,8 @@ [postgres tsearch]$ /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l /usr/local/pgsql/data/server.log start postmaster successfully started [postgres tsearch]$ -

        /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
        -/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l /usr/local/pgsql/data/server.log start

        +/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data +/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l /usr/local/pgsql/data/server.log start

        PostgreSQL errors will be logged in /usr/local/pgsql/data/server.log

      • Install Pl/pgSQL.�Set up plpgsq and allow your user to have @@ -128,8 +128,8 @@ (1 row) [postgres pgsql]$ -

        createlang plpgsql template1
        -createlang -l template1
      • Test PostgreSQL (OPTIONAL).�Create a database and try some simple commands. The output should be as shown. +createlang plpgsql template1 +createlang -l template1

      • Test PostgreSQL (OPTIONAL).�Create a database and try some simple commands. The output should be as shown.

        [postgres pgsql]$ createdb mytestdb
         CREATE DATABASE
         [postgres pgsql]$ psql mytestdb
        @@ -170,13 +170,13 @@
                 state. Red Hat and Debian and SuSE each work a little
                 differently.
         	

        • 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 /tmp/openacs-5.0.0/packages/acs-core-docs/www/files/postgresql.txt /etc/init.d/postgresql
          +[root root]# 
        • Red Hat from source:

          [root src]# cp /tmp//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 /tmp/openacs-5.0.0/packages/acs-core-docs/www/files/postgresql.txt /etc/init.d/postgresql
          +cp /tmp//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
          +chmod 755 /etc/rc.d/init.d/postgresql

          Test the script.

          [root root]# service postgresql stop
           Stopping PostgreSQL: ok
           [root root]# 

          If PostgreSQL successfully stopped, then use the following command to make sure that the script is run appropriately at boot @@ -190,16 +190,16 @@ [root root]# service postgresql start Starting PostgreSQL: ok [root root]# -

          chkconfig --add postgresql
          +chkconfig --add postgresql
           chkconfig --level 345 postgresql on
           chkconfig --list postgresql
          -service postgresql start
      • Debian:

        [root ~]# cp /tmp/openacs-5.0.0/packages/acs-core-docs/www/files/postgresql.txt /etc/init.d/postgresql
        +service postgresql start
      • Debian:

        [root ~]# cp /tmp//packages/acs-core-docs/www/files/postgresql.txt /etc/init.d/postgresql
         [root ~]# chown root.root /etc/init.d/postgresql
         [root ~]# chmod 755 /etc/init.d/postgresql
        -[root ~]# 
        
        -cp /tmp/openacs-5.0.0/packages/acs-core-docs/www/files/postgresql.txt /etc/init.d/postgresql
        +[root ~]# 
        +cp /tmp//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
        +chmod 755 /etc/init.d/postgresql

        Test the script

        [root ~]# /etc/init.d/postgresql stop
         Stopping PostgreSQL: ok
         [root ~]# 

        If PostgreSQL successfully stopped, then use the following command to make sure that the script is run @@ -225,7 +225,7 @@ rc.d/ part in each of the following commands. -

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

    [root ~]# cp /tmp//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