Index: openacs-4/packages/acs-core-docs/www/xml/install-guide/postgres.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/xml/install-guide/postgres.xml,v diff -u -r1.9 -r1.10 --- openacs-4/packages/acs-core-docs/www/xml/install-guide/postgres.xml 24 Jun 2003 03:37:05 -0000 1.9 +++ openacs-4/packages/acs-core-docs/www/xml/install-guide/postgres.xml 28 Jun 2003 05:07:07 -0000 1.10 @@ -1,5 +1,5 @@ - - Install PostGreSQL 7.2.4 + + Install PostGreSQL by Vinod Kurup @@ -11,15 +11,47 @@ has not been fully tested with 7.3.2; 7.2.4 is the recommended version of PostgreSQL to use. - This page assumes you have downloaded postgresql to -/tmp/postgresql-7.2.4.tar.gz. If not, -get it. - - + + + + Using the Red Hat RPM + 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 a link so that the + data directory appears to be in the same place as in a source + install; start the service; create a new group for web service + users, and modify the postgres user's + environment (more + information): + + [root@yourserver root]# ln -s /var/lib/pgsql/data /usr/local/pgsql/data +[root@yourserver root]# service postgresql start +Initializing database: + [ OK ] +Starting postgresql service: [ OK ] +[root@yourserver root]# echo "export LD_LIBRARY_PATH=/usr/local/pgsql/lib" >> ~postgres/.bash_profile +[root@yourserver root]# echo "export PATH=$PATH:/usr/local/pgsql/bin" >> ~postgres/.bash_profile +[root@yourserver root]# groupadd web +[root@yourserver root]# su - postgres +-bash-2.05b$ + +ln -s /var/lib/pgsql/data /usr/local/pgsql/data +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 . Something similar may work for other binary packages as well. + + - Unpack PostGreSQL. -[root@yourserver root]# cd /usr/local/src + + Unpack PostGreSQL. + If you have not downloaded the postgresql tarball to + /tmp/postgresql-7.2.4.tar.gz, + get it. + + [root@yourserver root]# cd /usr/local/src [root@yourserver src]# tar xzf /tmp/postgresql-7.2.4.tar.gz [root@yourserver src]# cd /usr/local/src @@ -48,26 +80,28 @@ chmod 750 /usr/local/pgsql - Set up postgres's environment variables. They are - necessary for the executable to find its supporting + + Set up postgres's environment variables + They are necessary for the executable to find its supporting libraries. For convenience, we'll simply append the necessary lines to the postgres shell config file. + [root@yourserver src]# echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/pgsql/lib" >> ~postgres/.bashrc [root@yourserver src]# echo "export PATH=$PATH:/usr/local/pgsql/bin" >> ~postgres/.bashrc -echo "export LD_LIBRARY_PATH=LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/pgsql/lib" >> ~postgres/.bashrc +echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/pgsql/lib" >> ~postgres/.bashrc echo "export PATH=$PATH:/usr/local/pgsql/bin" >> ~postgres/.bashrc Test this by logging in as postgres and checking the paths; you should see /usr/local/pgsql/bin [root@yourserver src]# su - postgres [postgres@yourserver pgsql]$ env | grep PATH -LD_LIBRARY_PATH=LD_LIBRARY_PATH=:/usr/local/pgsql/lib +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@yourserver pgsql]$ exit - - + + 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 @@ -102,8 +136,8 @@ make all make install - - + + Start PostgreSQL The initdb command initializes the @@ -127,12 +161,15 @@ /usr/local/pgsql/data/server.log - - Set up plpgsql and allow your user to have + + + Install Pl/pgSQL + Set up plpgsq and allow your user to have 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@yourserver pgsql]$ createlang plpgsql template1 [postgres@yourserver pgsql]$ createlang -l template1 Procedural languages @@ -146,8 +183,11 @@ createlang -l template1 - Test PostgreSQL. Create a database and try some simple commands. The output should be as shown. + + Test PostgreSQL (OPTIONAL). + Create a database and try some simple commands. The output should be as shown. + [postgres@yourserver pgsql]$ createdb mytestdb CREATE DATABASE [postgres@yourserver pgsql]$ psql mytestdb @@ -180,19 +220,24 @@ logout [root@yourserver src]# - - - Set PostgreSQL to start on boot. First, we copy the + + + Set PostgreSQL to start on boot. First, we copy the postgresql.txt init script, which automates startup and shutdown, to the distribution-specific init.d directory. Then we verify that it works. Then we automate it by setting up a 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 so three sets of instructions are provided. + differently. - Red Hat: + Red Hat RPM: + The init script is already installed; just turn it on for the appropriate run levels. + [root@yourserver root]# chkconfig --level 345 postgresql on +[root@yourserver root]# + + Red Hat from source: [root@yourserver src]# cp /tmp/&tarballpath;/packages/acs-core-docs/www/files/postgresql.txt /etc/init.d/postgresql [root@yourserver src]# chown root.root /etc/rc.d/init.d/postgresql @@ -216,12 +261,14 @@ [root@yourserver root]# chkconfig --add postgresql +[root@yourserver root]# chkconfig --level 345 postgresql on [root@yourserver root]# chkconfig --list postgresql postgresql 0:off 1:off 2:on 3:on 4:on 5:on 6:off [root@yourserver root]# service postgresql start Starting PostgreSQL: ok [root@yourserver root]# chkconfig --add postgresql +chkconfig --level 345 postgresql on chkconfig --list postgresql service postgresql start @@ -351,7 +398,7 @@ kernel.shmmax = 134217728 - Edit the PostGreSQL config file, /usr/local/pgsql/data/postgresql.conf, to use more memory. These values should improve performance in most cases. (More information) + Edit the PostGreSQL config file, /usr/local/pgsql/data/postgresql.conf, to use more memory. These values should improve performance in most cases. (more information) # Shared Memory Size # shared_buffers = 15200 # 2*max_connections, min 16 @@ -374,7 +421,7 @@ - Learn more about PostgreSQL + more information about PostgreSQL