- I OpenACS For Everyone
- I.1 High level information: What is OpenACS?
- I.1.1 Overview
- I.1.2 OpenACS Release Notes
- I.2 OpenACS: robust web development framework
- I.2.1 Introduction
- I.2.2 Basic infrastructure
- I.2.3 Advanced infrastructure
- I.2.4 Domain level tools
- I.1 High level information: What is OpenACS?
- II Administrator's Guide
- II.2 Installation Overview
- II.2.1 Basic Steps
- II.2.2 Prerequisite Software
- II.3 Complete Installation
- II.3.1 Install a Unix-like system and supporting software
- II.3.2 Install Oracle 10g XE on debian
- II.3.2.1 Install Oracle 8.1.7
- II.3.3 Install PostgreSQL
- II.3.4 Install AOLserver 4
- II.3.5 Quick Install of OpenACS
- II.3.5.1 Complex Install OpenACS 5.3
- II.3.6 OpenACS Installation Guide for Windows2000
- II.3.7 OpenACS Installation Guide for Mac OS X
- II.4 Configuring a new OpenACS Site
- II.4.1 Installing OpenACS packages
- II.4.2 Mounting OpenACS packages
- II.4.3 Configuring an OpenACS package
- II.4.4 Setting Permissions on an OpenACS package
- II.4.5 How Do I?
- II.4.6 Configure OpenACS look and feel with templates
- II.5 Upgrading
- II.5.1 Overview
- II.5.2 Upgrading 4.5 or higher to 4.6.3
- II.5.3 Upgrading OpenACS 4.6.3 to 5.0
- II.5.4 Upgrading an OpenACS 5.0.0 or greater installation
- II.5.5 Upgrading the OpenACS files
- II.5.6 Upgrading Platform components
- II.6 Production Environments
- II.6.1 Starting and Stopping an OpenACS instance.
- II.6.2 AOLserver keepalive with inittab
- II.6.3 Running multiple services on one machine
- II.6.4 High Availability/High Performance Configurations
- II.6.5 Staged Deployment for Production Networks
- II.6.6 Installing SSL Support for an OpenACS service
- II.6.7 Set up Log Analysis Reports
- II.6.8 External uptime validation
- II.6.9 Diagnosing Performance Problems
- II.7 Database Management
- II.7.1 Running a PostgreSQL database on another server
- II.7.2 Deleting a tablespace
- II.7.3 Vacuum Postgres nightly
- II.8 Backup and Recovery
- II.8.1 Backup Strategy
- II.8.2 Manual backup and recovery
- II.8.3 Automated Backup
- II.8.4 Using CVS for backup-recovery
- II.A Install Red Hat 8/9
- II.B Install additional supporting software
- II.B.1 Unpack the OpenACS tarball
- II.B.2 Initialize CVS (OPTIONAL)
- II.B.3 Add PSGML commands to emacs init file (OPTIONAL)
- II.B.4 Install Daemontools (OPTIONAL)
- II.B.5 Install qmail (OPTIONAL)
- II.B.6 Install Analog web file analyzer
- II.B.7 Install nspam
- II.B.8 Install Full Text Search
- II.B.9 Install Full Text Search using Tsearch2
- II.B.10 Install Full Text Search using OpenFTS (deprecated see tsearch2)
- II.B.11 Install nsopenssl
- II.B.12 Install tclwebtest.
- II.B.13 Install PHP for use in AOLserver
- II.B.14 Install Squirrelmail for use as a webmail system for OpenACS
- II.B.15 Install PAM Radius for use as external authentication
- II.B.16 Install LDAP for use as external authentication
- II.B.17 Install AOLserver 3.3oacs1
- II.C Credits
- II.C.1 Where did this document come from?
- II.C.2 Linux Install Guides
- II.C.3 Security Information
- II.C.4 Resources
- II.2 Installation Overview
- III For OpenACS Package Developers
- III.9 Development Tutorial
- III.9.1 Creating an Application Package
- III.9.2 Setting Up Database Objects
- III.9.3 Creating Web Pages
- III.9.4 Debugging and Automated Testing
- III.10 Advanced Topics
- III.10.1 Write the Requirements and Design Specs
- III.10.2 Add the new package to CVS
- III.10.3 OpenACS Edit This Page Templates
- III.10.4 Adding Comments
- III.10.5 Admin Pages
- III.10.6 Categories
- III.10.7 Profile your code
- III.10.8 Prepare the package for distribution.
- III.10.9 Distributing upgrades of your package
- III.10.10 Notifications
- III.10.11 Hierarchical data
- III.10.12 Using .vuh files for pretty urls
- III.10.13 Laying out a page with CSS instead of tables
- III.10.14 Sending HTML email from your application
- III.10.15 Basic Caching
- III.10.16 Scheduled Procedures
- III.10.17 Enabling WYSIWYG
- III.10.18 Adding in parameters for your package
- III.10.19 Writing upgrade scripts
- III.10.20 Connect to a second database
- III.10.21 Future Topics
- III.11 Development Reference
- III.11.1 OpenACS Packages
- III.11.2 OpenACS Data Models and the Object System
- III.11.3 The Request Processor
- III.11.4 The OpenACS Database Access API
- III.11.5 Using Templates in OpenACS
- III.11.6 Groups, Context, Permissions
- III.11.7 Writing OpenACS Application Pages
- III.11.8 Parties in OpenACS
- III.11.9 OpenACS Permissions Tediously Explained
- III.11.10 Object Identity
- III.11.11 Programming with AOLserver
- III.11.12 Using Form Builder: building html forms dynamically
- III.12 Engineering Standards
- III.12.1 OpenACS Style Guide
- III.12.2 Release Version Numbering
- III.12.3 Constraint naming standard
- III.12.4 ACS File Naming and Formatting Standards
- III.12.5 PL/SQL Standards
- III.12.6 Variables
- III.12.7 Automated Testing
- III.13 CVS Guidelines
- III.13.1 Using CVS with OpenACS
- III.13.2 OpenACS CVS Concepts
- III.13.3 Contributing code back to OpenACS
- III.13.4 Additional Resources for CVS
- III.14 Documentation Standards
- III.14.1 OpenACS Documentation Guide
- III.14.2 Using PSGML mode in Emacs
- III.14.3 Using nXML mode in Emacs
- III.14.4 Detailed Design Documentation Template
- III.14.5 System/Application Requirements Template
- III.15 TCLWebtest
- III.16 Internationalization
- III.16.1 Internationalization and Localization Overview
- III.16.2 How Internationalization/Localization works in OpenACS
- III.16.4 Design Notes
- III.16.5 Translator's Guide
- III.D Using CVS with an OpenACS Site
- III.9 Development Tutorial
- IV For OpenACS Platform Developers
- IV.17 Kernel Documentation
- IV.17.1 Overview
- IV.17.2 Object Model Requirements
- IV.17.3 Object Model Design
- IV.17.4 Permissions Requirements
- IV.17.5 Permissions Design
- IV.17.6 Groups Requirements
- IV.17.7 Groups Design
- IV.17.8 Subsites Requirements
- IV.17.9 Subsites Design Document
- IV.17.10 Package Manager Requirements
- IV.17.11 Package Manager Design
- IV.17.12 Database Access API
- IV.17.13 OpenACS Internationalization Requirements
- IV.17.14 Security Requirements
- IV.17.15 Security Design
- IV.17.16 Security Notes
- IV.17.17 Request Processor Requirements
- IV.17.18 Request Processor Design
- IV.17.19 Documenting Tcl Files: Page Contracts and Libraries
- IV.17.20 Bootstrapping OpenACS
- IV.17.21 External Authentication Requirements
- IV.18 Releasing OpenACS
- IV.18.1 OpenACS Core and .LRN
- IV.18.2 How to Update the OpenACS.org repository
- IV.18.3 How to package and release an OpenACS Package
- IV.18.4 How to Update the translations
- IV.17 Kernel Documentation
- V Tcl for Web Nerds
- V.1 Tcl for Web Nerds Introduction
- V.2 Basic String Operations
- V.3 List Operations
- V.4 Pattern matching
- V.5 Array Operations
- V.6 Numbers
- V.7 Control Structure
- V.8 Scope, Upvar and Uplevel
- V.9 File Operations
- V.10 Eval
- V.11 Exec
- V.12 Tcl for Web Use
- V.13 OpenACS conventions for TCL
- V.14 Solutions
- VI SQL for Web Nerds
- VI.1 SQL Tutorial
- VI.1.1 SQL Tutorial
- VI.1.2 Answers
- VI.2 SQL for Web Nerds Introduction
- VI.3 Data modeling
- VI.3.1 The Discussion Forum -- philg's personal odyssey
- VI.3.2 Data Types (Oracle)
- VI.3.4 Tables
- VI.3.5 Constraints
- VI.4 Simple queries
- VI.5 More complex queries
- VI.6 Transactions
- VI.7 Triggers
- VI.8 Views
- VI.9 Style
- VI.10 Escaping to the procedural world
- VI.11 Trees
- VI.1 SQL Tutorial
II.3.3 Install PostgreSQL
Skip this section if you will run only Oracle.
OpenACS 5.3.2 will run with PostgreSQL 8.2.x or 8.1.x. 8.2.4 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 ???. Mac OS X 10.3 requires PostGreSQL ???.
-
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 (but you should double-check that the version of PostGreSQL is 8.1.0 or above):
For Debian stable users, you can use backports, by adding this line to the /etc/apt/sources.list
deb http://www.backports.org/debian stable bison postgresql openssl openssh tcl8.4 courier debconf spamassassin tla diff patch neon chkrootkit
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.
-
Special Notes for Red Hat.Red Hat users: If you install PostgreSQL ??? 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 information):
[root root]#
ln -s /usr/lib/pgsql/ /var/lib/pgsql/lib
[root root]#ln -s /var/lib/pgsql /usr/local/pgsql
[root root]#ln -s /etc/init.d/postgresql /etc/init.d/postgres
[root root]#ln -s /usr/bin /usr/local/pgsql/bin
[root root]#service postgresql start
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]#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 8. Something similar may work for other binary packages as well.
-
Safe approach: install from source
-
Unpack PostgreSQL 8.2.4.If you have not downloaded the postgresql tarball to
/var/tmp/postgresql-8.2.4.tar.gz
, get it.[root root]#
cd /usr/local/src
[root src]#tar xzf /var/tmp/postgresql-8.2.4.tar.gz
[root src]# cd /usr/local/src
tar xzf /var/tmp/postgresql-8.2.4.tar.gz -
ALTERNATIVE: Unpack PostgreSQL 8.2.4.If you have not downloaded the postgresql tarball to
/var/tmp/postgresql-8.2.4.tar.bz2
, get it.[root root]#
cd /usr/local/src
[root src]#tar xfj /var/tmp/postgresql-8.2.4.tar.bz2
[root src]# cd /usr/local/src
tar xfj /var/tmp/postgresql-8.2.4.tar.bz2 -
Install Bison.Only do this if
bison --version
is smaller than 1.875 and you install PostgreSQL 8.2 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
-
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 directly as that user, we'll leave the password blank.
Debian users should probably use adduser instead of useradd. Type
man adduser
[root src]#
groupadd web
[root src]#useradd -g web -d /usr/local/pgsql postgres
[root src]#mkdir -p /usr/local/pgsql
[root src]#chown -R postgres.web /usr/local/pgsql /usr/local/src/postgresql-7.4.7
[root src]#chmod 750 /usr/local/pgsql
[root src]# 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.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]"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 -create / /users/$OPENACS_SERVICE_NAME sudo niutil -createprop / /users/$OPENACS_SERVICE_NAME gid 201 sudo niutil -createprop / /users/$OPENACS_SERVICE_NAME uid 201 mkdir -p /usr/local/pgsql chown -R postgres:web /usr/local/pgsql /usr/local/src/postgresql-7.4.7 chmod 750 /usr/local/pgsql -
FreeBSD users: need to add more parameters.
[root src]#
mkdir -p /usr/local/pgsql
[root src]#pw groupadd -n web
[root src]#pw useradd -n postgres -g web -d /usr/local/pgsql -s /bin/bash
[root src]#chown -R postgres:web /usr/local/pgsql /usr/local/src/postgresql-7.4.7
[root src]#chmod -R 750 /usr/local/pgsql
[root src]# mkdir -p /usr/local/pgsql
pw groupadd -n web
pw useradd -n postgres -g web -d /usr/local/pgsql -s /bin/bash
chown -R postgres:web /usr/local/pgsql /usr/local/src/postgresql-7.4.7
chmod -R 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 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/libTest this by logging in as
postgres
and checking the 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
.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-8.2.4]$./configure
creating cache ./config.cache checking host system type... i686-pc-linux-gnu (many lines omitted> linking ./src/makefiles/Makefile.linux to src/Makefile.port linking ./src/backend/port/tas/dummy.s to src/backend/port/tas.s [postgres postgresql-8.2.4$make all
make -C doc all make[1]: Entering directory `/usr/local/src/postgresql-8.2.4/doc' (many lines omitted) make[1]: Leaving directory `/usr/local/src/postgresql-8.2.4/src' All of PostgreSQL successfully made. Ready to install. [postgres postgresql-8.2.4]$make install
make -C doc install make[1]: Entering directory `/usr/local/src/postgresql-8.2.4/doc' (many lines omitted) Thank you for choosing PostgreSQL, the most advanced open source database engine. su - postgres
cd /usr/local/src/postgresql-8.2.4
./configure
make all
make install -
Edit /etc/postgresql.conf (Debian /etc/postgresql/8.2/postgresql.conf) to make sure the three following settings are correct:
add_missing_from = true
regex_flavor = enhanced
default_with_oids = true -
Start PostgreSQL. The
initdb
command initializes the database.pg_ctl
is used to start up PostgreSQL. If PostgreSQL is unable to allocate enough memory, see section 11 Tuning PostgreSQL (below).[postgres postgresql-8.2.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 postgresql-7.4.7]$/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l /usr/local/pgsql/data/server.log start
postmaster successfully started [postgres postgresql-7.4.7]$ /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 startPostgreSQL errors will be logged in
/usr/local/pgsql/data/server.log
-
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.
Additionals to install in Postgres 8.1.x
[postgres postgresql-7.4.7]$
createlang plpgsql template1
[postgres pgsql]$createlang -l template1
Procedural languages Name | Trusted? ---------+---------- plpgsql | t (1 row) [postgres pgsql-7.4.7]$ 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
Welcome to psql, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help on internal slash commands \g or terminate with semicolon to execute query \q to quit mytestdb=#select current_timestamp;
timestamptz ------------------------------- 2003-03-07 22:18:29.185413-08 (1 row) mytestdb=#create function test1() returns integer as 'begin return 1; end;' language 'plpgsql';
CREATE mytestdb=#select test1();
test1 ------- 1 (1 row) mytestdb=#\q
[postgres pgsql]$dropdb mytestdb
DROP DATABASE [postgres pgsql]$exit
logout [root src]# -
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. 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.3rc1/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.3rc1/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/postgresqlTest 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 and shutdown. And turn it back on because we'll use it later.
[root root]#
chkconfig --add postgresql
[root root]#chkconfig --level 345 postgresql on
[root root]#chkconfig --list postgresql
postgresql 0:off 1:off 2:on 3:on 4:on 5:on 6:off [root root]#service postgresql start
Starting PostgreSQL: ok [root root]# chkconfig --add postgresql
chkconfig --level 345 postgresql on
chkconfig --list postgresql
service postgresql start -
Debian:
[root ~]#
cp /var/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 /var/tmp/openacs-5.2.3rc1/packages/acs-core-docs/www/files/postgresql.txt /etc/init.d/postgresql chown root.root /etc/init.d/postgresql chmod 755 /etc/init.d/postgresqlTest 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 appropriately at boot and shutdown.
[root ~]#
update-rc.d postgresql defaults
Adding system startup for /etc/init.d/postgresql ... /etc/rc0.d/K20postgresql -> ../init.d/postgresql /etc/rc1.d/K20postgresql -> ../init.d/postgresql /etc/rc6.d/K20postgresql -> ../init.d/postgresql /etc/rc2.d/S20postgresql -> ../init.d/postgresql /etc/rc3.d/S20postgresql -> ../init.d/postgresql /etc/rc4.d/S20postgresql -> ../init.d/postgresql /etc/rc5.d/S20postgresql -> ../init.d/postgresql [root ~]#/etc/init.d/postgresql start
Starting PostgreSQL: ok [root ~]# -
FreeBSD:
[root ~]#
cp /tmp/openacs-5.2.3rc1/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.3rc1/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.shTest the script
[root ~]#
/usr/local/etc/rc.d/postgresql.sh stop
Stopping PostgreSQL: ok [root ~]#If PostgreSQL successfully stopped, then turn it back on because we'll use it later.
[root root]#
/usr/local/etc/rc.d/postgresql.sh start
Starting PostgreSQL: ok [root root]# /usr/local/etc/rc.d/postgresql.sh start -
SuSE:
Note
I have received reports that SuSE 8.0 is different from previous versions. Instead of installing the boot scripts in
/etc/rc.d/init.d/
, they should be placed in/etc/init.d/
. If you're using SuSE 8.0, delete therc.d/
part in each of the following commands.[root ~]#
cp /var/tmp/openacs-5.2.3rc1/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
Test the script.
[root ~]#
/etc/rc.d/init.d/postgresql stop
Stopping PostgreSQL: okIf PostgreSQL successfully stopped, then use the following command to make sure that the script is run appropriately at boot and shutdown.
[root ~]#
cd /etc/rc.d/init.d
root:/etc/rc.d/init.d#ln -s /etc/rc.d/init.d/postgresql K20postgresql
root:/etc/rc.d/init.d#ln -s /etc/rc.d/init.d/postgresql S20postgresql
root:/etc/rc.d/init.d#cp K20postgresql rc2.d
root:/etc/rc.d/init.d#cp S20postgresql rc2.d
root:/etc/rc.d/init.d#cp K20postgresql rc3.d
root:/etc/rc.d/init.d#cp S20postgresql rc3.d
root:/etc/rc.d/init.d#cp K20postgresql rc4.d
root:/etc/rc.d/init.d#cp S20postgresql rc4.d
root:/etc/rc.d/init.d#cp K20postgresql rc5.d
root:/etc/rc.d/init.d#cp S20postgresql rc5.d
root:/etc/rc.d/init.d#rm K20postgresql
root:/etc/rc.d/init.d#rm S20postgresql
root:/etc/rc.d/init.d#Test configuration.
root:/etc/rc.d/init.d #
cd
root:~ #/etc/rc.d/init.d/rc2.d/S20postgresql start
Starting PostgreSQL: ok root:~ # -
Mac OS X 10.3:
-
Install the startup script:
cd /System/Library/StartupItems/
tar xfz /var/lib/aolserver/$OPENACS_SERVICE_NAME/packages/acs-core-docs/www/files/osx-postgres-startup-item.tgz
-
-
Mac OS X 10.4 can use Launchd:
-
Install the startup script:
cd /Library/LaunchDaemons
cp
/var/lib/aolserver/$OPENACS_SERVICE_NAME/packages/acs-core-docs/www/files/osx-postgres-launchd-item.txt
org.postgresql.PostgreSQL.plistIf postgres does not start automatically on reboot, see what error you get when manually starting it with:
$
sudo launchctl load /Library/LaunchDaemons/org.postgresql.PostgreSQL.plist
$sudo launchctl start org.postgresql.PostgreSQL
-
From now on, PostgreSQL should start automatically each time you boot up and it should shutdown gracefully each time you shut down. (Note: Debian defaults to starting all services on runlevels 2-5. Red Hat defaults to starting services on 3-5. So, on Red Hat, PostgreSQL won't start on runlevel 2 unless you alter the above commands a little. This usually isn't a problem as Red Hat defaults to runlevel 3)
-
-
Tune postgres. (OPTIONAL).The default values for PostgreSQL are very conservative; we can safely change some of them and improve performance.
-
Change the kernel parameter for maximum shared memory segment size to 128Mb:
[root root]#
echo 134217728 >/proc/sys/kernel/shmmax
[root root]#Make that change permanent by editing
/etc/sysctl.conf
to add these lines at the end:# increase shared memory limit for postgres
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)# Shared Memory Size
#
shared_buffers = 15200 # 2*max_connections, min 16
# Non-shared Memory Sizes
#
sort_mem = 32168 # min 32
# Write-ahead log (WAL)
#
checkpoint_segments = 3 # in logfile segments (16MB each), min 1Restart postgres (
service postgresql restart
) or (/etc/init.d/postgres restart
) so that the changes take effect.
FreeBSD users: See
man syctl
,man 5 sysctl
andman 5 loader.conf
.Performance tuning resources:
Managing Kernel Resources about PostgreSQL shared memory and semaphores with specific operating system notes.
Managing Kernel Resources (development version) This information may be experimental.
-
-