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.24 -r1.25 --- openacs-4/packages/acs-core-docs/www/postgres.html 4 Feb 2004 16:47:33 -0000 1.24 +++ openacs-4/packages/acs-core-docs/www/postgres.html 12 Feb 2004 13:51:40 -0000 1.25 @@ -1,12 +1,12 @@ -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 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
    +        

Skip this section if you will run only Oracle.

See Table�2.2, “Version Compatibility Matrix” for version compatibility.

  • 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 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
     su postgres -c "/usr/lib/postgresql/bin/createlang plpgsql template1"

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

  • Using the Red Hat RPM.�Red Hat users: If you install PostgreSQL 7.3.2 from the Red Hat 9 RPM, you + 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 environment (more @@ -31,7 +31,7 @@ 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.

  2. Safe approach: install from source

    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
      @@ -52,7 +52,7 @@
       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,8 +73,8 @@
           	  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.
          -	

          [root src]# su - postgres
          +	  Unicode support, add the flags --enable-locale and --enable-multibyte. 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.3.4
           [postgres postgresql-7.3.4]$ ./configure
           creating cache ./config.cache
          @@ -102,15 +102,15 @@
           	  The initdb command initializes the
           	  database. pg_ctl is used to start up
           	  PostgreSQL.
          -	

          [postgres tsearch]$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
          +	

          [postgres postgresql-7.3.4]$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
           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
               /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
          -[postgres tsearch]$ /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l /usr/local/pgsql/data/server.log start
          +[postgres postgresql-7.3.4]$ /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l /usr/local/pgsql/data/server.log start
           postmaster successfully started
          -[postgres tsearch]$
          +[postgres postgresql-7.3.4]$
           /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 @@ -119,15 +119,15 @@ access. Plpgsql is a PL/SQL-like language. We add it to template1, which is the template from which all new databases are created. We can verify that it was created - with the createlang command in list mode.

          [postgres pgsql]$ createlang plpgsql template1
          +	  with the createlang command in list mode.

          [postgres postgresql-7.3.4]$ createlang plpgsql template1
           [postgres pgsql]$ createlang -l template1
           Procedural languages
             Name   | Trusted?
           ---------+----------
            plpgsql | t
           (1 row)
           
          -[postgres pgsql]$
          +[postgres pgsql-7.3.4]$
           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
          @@ -168,13 +168,13 @@
                   bunch of symlinks that ensure that, when the operating system
                   changes runlevels, postgresql goes to the appropriate
                   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//packages/acs-core-docs/www/files/postgresql.txt /etc/init.d/postgresql
            +        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 /tmp/openacs-5.0.1d1/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//packages/acs-core-docs/www/files/postgresql.txt /etc/init.d/postgresql
              +cp /tmp/openacs-5.0.1d1/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
              @@ -193,11 +193,11 @@
               chkconfig --add postgresql
               chkconfig --level 345 postgresql on
               chkconfig --list postgresql
              -service postgresql start
            • Debian:

              [root ~]# cp /tmp//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//packages/acs-core-docs/www/files/postgresql.txt /etc/init.d/postgresql
              +cp /tmp/openacs-5.0.1d1/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
              @@ -225,7 +225,7 @@
                           rc.d/ part in each of the
                           following commands.
               
              -          

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

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

          @@ -286,7 +286,7 @@ # Write-ahead log (WAL) # checkpoint_segments = 3 # in logfile segments (16MB each), min 1 -

          Restart postgres (service postgresql restart) so that the changes take effect.

more information about PostgreSQL

  • +

    Restart postgres (Redhat: service postgresql restart. Many other systems: <computertext>/etc/init.d/postgresql restart</computertext>) so that the changes take effect.

more information about PostgreSQL

($Id$)
View comments on this page at openacs.org
+

  • + Tuning PostgreSQL for performance

  • ($Id$)
    View comments on this page at openacs.org