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.25 -r1.26 --- openacs-4/packages/acs-core-docs/www/postgres.html 12 Feb 2004 13:51:40 -0000 1.25 +++ openacs-4/packages/acs-core-docs/www/postgres.html 18 Feb 2004 14:43:03 -0000 1.26 @@ -31,13 +31,25 @@ 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.

  • Safe approach: install from source

    1. Unpack PostgreSQL.�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.3.4.�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.� +tar xzf /tmp/postgresql-7.3.4.tar.gz

      3. ALTERNATIVE: Unpack PostgreSQL 7.4.1.�If you have not downloaded the postgresql tarball to + /tmp/postgresql-7.4.1.tar.bz2, + get it.

        [root root]# cd /usr/local/src
        +[root src]# tar xfj /tmp/postgresql-7.4.1.tar.bz2
        +[root src]# 
        +cd /usr/local/src
        +tar xfj /tmp/postgresql-7.4.1.tar.bz2
      4. Install Bison.�Only do this if bison --version is smaller than 1.875 and you install PostgreSQL 7.4.

        [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
        +      
      5. 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 @@ -52,16 +64,23 @@ 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
          -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
          +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]"
            +          

            Now you can install the users

            sudo niutil -create / /groups/web
            +sudo niutil -createprop / /groups/web gid 201
            +sudo niutil -create / /users/postgres
            +sudo niutil -createprop / /users/postgres gid 201
            +sudo niutil -createprop / /users/postgres uid 502
             sudo niutil -createprop / /users/postgres home /usr/local/pgsql
            -sudo niutil -createprop / /users/postgres shell /bin/bash
            +sudo niutil -create / /users/service0
            +sudo niutil -createprop / /users/service0 gid  201
            +sudo niutil -createprop / /users/service0 uid 201
             mkdir -p /usr/local/pgsql
            -chown -R postgres:web /usr/local/pgsql /usr/local/src/postgresql-7.4
            +chown -R postgres:web /usr/local/pgsql /usr/local/src/postgresql-7.4.1
             chmod 750 /usr/local/pgsql
        • Set up postgres's environment variables.�They are necessary for the executable to find its supporting libraries. Put the following lines into the postgres user's environment.

          [root src]# su - postgres
          -[postgres ~] emacs ~postgres/.bashrc

          Paste these lines into .bashrc:

          export PATH=$PATH:/usr/local/pgsql/bin
          +[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
          @@ -73,10 +92,11 @@
           	  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.
           	

          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
          +[postgres postgresql-7.3.4]$ ./configure --with-includes=/sw/include/ --with-libraries=/sw/lib --enable-locale --enable-multibyte \
          +  --enable-syslog --enable-unicode-conversion --enable-recode 
           creating cache ./config.cache
           checking host system type... i686-pc-linux-gnu
           (many lines omitted>
          @@ -168,13 +188,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.  If you haven't  untarred the OpenACS tarball, you will need to do so now to access the postgresql.txt file.
          +        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 root]# 
          • Red Hat from source:

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

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

        [root ~]# cp /tmp/openacs-5.1.0d1/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 +306,7 @@ # Write-ahead log (WAL) # checkpoint_segments = 3 # in logfile segments (16MB each), min 1 -

        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

    more information about PostgreSQL