Chapter 2. Quick Install

by Joel Aufrecht
OpenACS docs are written by the named authors, and may be edited by OpenACS documentation staff.

Purpose of this document

This page describes a minimal installation of OpenACS with PostGreSQL (not Oracle). It will produce a working OpenACS installation in under an hour. It excludes source control, full text search, ssl, managed services (daemontools), DocBook, and qmail.

For Red Hat 9

  1. Install PostGreSQL 7.3.2 from RPM. Select Menu > System Settings > Add/Remove Applications and select Database Server.

  2. 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):

  3. 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
      Name   | Trusted?
    ---------+----------
     plpgsql | t
    (1 row)
    
    [postgres@yourserver pgsql]$
    
    createlang plpgsql template1
    createlang -l template1
  4. Unpack the Aolserver tarball. Download the aolserver tarball to /tmp/aolserver3.3oacs1.tar.gz. As root, untar aolserver3.3oacs1.tar.gz into /usr/local/src.

    [root@yourserver root]# cd /usr/local/src
    [root@yourserver src]# tar xzf /tmp/aolserver3.3oacs1.tar.gz
    [root@yourserver src]#
    
    cd /usr/local/src
    tar xzf /tmp/aolserver3.3oacs1.tar.gz
  5. Compile AOLserver. Compile and install AOLserver. First, prepare the installation directory and the source code. The message about BUILD-MODULES can be ignored.

    root@yourserver root]# mkdir -p /usr/local/aolserver
    [root@yourserver root]# cd /usr/local/src/aolserver
    [root@yourserver aolserver]# ./conf-clean
    cat: BUILD-MODULES: No such file or directory
    Done.
    [root@yourserver aolserver]#
    mkdir -p /usr/local/aolserver
    cd /usr/local/src/aolserver
    ./conf-clean

    If you are using Oracle, edit conf-db and change postgresql to oracle, or to the word both if you want both drivers installed. In order to get nsoracle to compile, you may need to su - oracle, and then su (without the -) root to set the environment variables properly.

    conf-inst should contain the location where AOLserver is to be installed. Overwrite the tarball's default value with our default value, /usr/local/aolserver:

    [root@yourserver aolserver]# echo "/usr/local/aolserver" > conf-inst
    [root@yourserver aolserver]#

    conf-make should contain the name of the GNU Make command on your system. It defaults to gmake.

    Set an environment variable that the nspostgres driver Makefile needs to compile correctly and run conf, which compiles AOLserver, the default modules, and the database driver, and installs them.

    (Debian Users working with AOLserver 3.3+ad13 and postgresql from apt-get may need to make these symlinks: ln -s /usr/include/postgresql/ /usr/include/pgsql and ln -s /usr/lib/postgresql /usr/local/pgsql)

    [root@yourserver aolserver]# export POSTGRES=/usr/local/pgsql; ./conf
    Building in /usr/local/aolserver
    with the following modules:
    aolserver
    nscache
    nsrewrite
    nssha1
    nsxml
    pgdriver
    ==================================================================
    Starting Build Sat Mar  8 10:28:26 PST 2003
    Running gmake in aolserver/; output in log/aolserver.log
    (several minute delay here)
    Running gmake in nscache/; output in log/nscache.log
    Running gmake in nsrewrite/; output in log/nsrewrite.log
    Running gmake in nssha1/; output in log/nssha1.log
    Running gmake in nsxml/; output in log/nsxml.log
    Running gmake in nspostgres/; output in log/nspostgres.log
    Creating  ...
    ==================================================================
    Done Building Sat Mar  8 10:31:35 PST 2003
    [root@yourserver aolserver]# 

    This takes about 5 minutes. It builds aolserver, several modules, and the database driver. (Upgraders, note that the postgres database driver has changed from postgres.so to nspostgres.so). All of the results are logged to files in /usr/local/src/aolserver/log. If you run into problems running AOLserver, check these files for build errors.

  6. Add a database-specific wrapper script. This script sets database environment variables before starting AOLserver; this allows the AOLserver instance can communicate with the database. There is one script each for Oracle and PostGreSQL. They don't conflict, so if you plan to use both databases, install both.

    • Oracle

      [root@yourserver aolserver]# cd /usr/local/aolserver/bin
      [root@yourserver bin]# cp /tmp/openacs-5.0.0d/packages/acs-core-docs/www/files/nsd-oracle.txt ./nsd-oracle
      [root@yourserver bin]# chmod 750 nsd-oracle
      [root@yourserver bin]#
      
      cd /usr/local/aolserver/bin
      cp /tmp/openacs-5.0.0d/packages/acs-core-docs/www/files/nsd-oracle.txt ./nsd-oracle
      chmod 750 nsd-oracle
    • PostGreSQL

      [root@yourserver aolserver]# cd /usr/local/aolserver/bin
      [root@yourserver bin]# cp /tmp/openacs-5.0.0d/packages/acs-core-docs/www/files/nsd-postgres.txt ./nsd-postgres
      [root@yourserver bin]# chmod 755 nsd-postgres
      [root@yourserver bin]#
      
      cd /usr/local/aolserver/bin
      cp /tmp/openacs-5.0.0d/packages/acs-core-docs/www/files/nsd-postgres.txt ./nsd-postgres
      chmod 755 nsd-postgres
  7. The reference install stores all OpenACS services in /web, with one subdirectory per service. The first time you install a service, you must create that directory and set its permissions:

    [root@yourserver root]# mkdir /web
    [root@yourserver root]# chgrp web /web
    [root@yourserver root]# chmod 770 /web
    [root@yourserver root]#
    
    mkdir /web
    chgrp web /web
    chmod 770 /web
  8. You should already have downloaded the OpenACS tarball to the /tmp directory. If not, download the OpenACS tarball and save it in /tmp and proceed:

  9. Set up your user account.

    AOLserver needs to be started as the root user if you want to use port 80. Once it starts, though, it will drop the root privileges and run as another user, which you must specify on the command line. It's important that this user has as few privileges as possible. Why? Because if an intruder somehow breaks in through AOLserver, you don't want her to have any ability to do damage to the rest of your server.

    At the same time, AOLserver needs to have write access to some files on your system in order for OpenACS to function properly. So, we'll run AOLserver with a different user account for each different service. A service name should be a single word, letters and numbers only. If the name of your site is one word, that would be a good choice. For example "service0" might be the service name for the service0.net community.

    For the 5.0.0d-P and 5.0.0d-O Reference Platform, we'll use a server named service0 and a user named service0. We'll leave the password blank for increased security. The only way to log in will be with ssh certificates. The only people who should log in are developers for that specific instance. Add this user, and put it in the web group so that it can use database commands associated with that group.

    [root@yourserver root]# useradd -g web service0 -d /home/service0
    [root@yourserver root]#

    Set up database environment variables. They are necessary for working with the database.

    [root@yourserver root]# su - service0
    [service0@yourserver service0]$ emacs .bashrc

    Put in the appropriate lines for the database you are running. If you will use both databases, put in both sets of lines.

    • PostGreSQL:

      export LD_LIBRARY_PATH=LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/pgsql/lib
      export PATH=$PATH:/usr/local/pgsql/bin
    • Oracle. These environment variables are specific for a local Oracle installation communicating via IPC. If you are connecting to a remote Oracle installation, you'll need to adjust these appropriately. Also, make sure that the '8.1.7' matches your Oracle version.

      export ORACLE_BASE=/ora8/m01/app/oracle
      export ORACLE_HOME=$ORACLE_BASE/product/8.1.7
      export PATH=$PATH:$ORACLE_HOME/bin
      export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
      export ORACLE_SID=ora8
      export ORACLE_TERM=vt100
      export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data

    Test this by logging out and back in as service0 and checking the paths.

    [service0@yourserver service0]$ exit
    logout
    [root@yourserver src]# su - service0
    [postgres@yourserver pgsql]$ env | grep PATH
    

    For PostGreSQL, you should see:

    LD_LIBRARY_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

    For Oracle:

    ORACLE_BASE=/ora8/m01/app/oracle
    ORACLE_HOME=/ora8/m01/app/oracle/product/8.1.7
    PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin/X11:/usr/X11R6/bin:/root/bin:/ora8/m01/app/oracle/product/8.1.7/bin
    LD_LIBRARY_PATH=/ora8/m01/app/oracle/product/8.1.7/lib:/lib:/usr/lib
    ORACLE_SID=ora8
    ORACLE_TERM=vt100
    ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
    [service0@yourserver service0]$ exit
    logout
    
    [root@yourserver root]#
  10. Unpack the OpenACS tarball and rename it to service0. Secure the directory so that only the owner can access it. Check the permissions by listing the directory.

    [root@yourserver root]# su - service0
    [service0@yourserver service0]$ cd /web
    [service0@yourserver web]$ tar xzf /tmp/openacs-5.0.0d.tgz
    [service0@yourserver web]$ mv openacs-5.0.0d service0
    [service0@yourserver web]$ chmod -R 700 service0
    [service0@yourserver web]$ ls -al
    total 3
    drwxrwx---    3 root     web          1024 Mar 29 16:41 .
    drwxr-xr-x   25 root     root         1024 Mar 29 16:24 ..
    drwx------    7 service0 web          1024 Jan  6 14:36 service0
    [service0@yourserver web]$ exit
    logout
    
    [root@yourserver root]#
    
    su - service0
    cd /web
    tar xzf /tmp/openacs-5.0.0d.tgz
    mv openacs-5.0.0d service0
    chmod -R 700 service0/
    exit
  11. Create a user in the database matching the service name.

    [root@yourserver root]# su - postgres
    [postgres@yourserver pgsql]$ createuser service0
    Shall the new user be allowed to create databases? (y/n) y
    Shall the new user be allowed to create more new users? (y/n) y
    CREATE USER
    [postgres@yourserver pgsql]$ exit
    logout
    
    [root@yourserver root]#
  12. Create a database with the same name as our service name, service0.

    [root@yourserver root]# su - service0
    [service0@yourserver service0]$ createdb -E UNICODE service0
    CREATE DATABASE
    [service0@yourserver service0]$
    
    su - service0
    createdb -E UNICODE service0
  13. [service0@yourserver service0]$ exit
    logout
    
    [root@yourserver root]# 
  14. Kill any current running AOLserver processes and start a new one. If you are using Oracle, rather than PostgreSQL, replace nsd-postgres with nsd-oracle).

    If you want to use port 80, there are complications. First, Aolserver must be root to use system ports such as 80, but refuses to run as root for security reasons. Thus you must start as root and specify a non-root user ID and Group ID which Aolserver will switch to after claiming the port. To do so, find the UID and GID of the service0 user via grep service0 /etc/passwd and then put those numbers into the command line via -u 501 -g 502. Second, if you are root then killall will affect all OpenACS services on the machine, so if there's more than one you'll have to do ps -auxw | grep nsd and selectively kill by job number.

    [service0@yourserver etc]$ killall nsd
    nsd: no process killed
    [service0@yourserver service0]$ /usr/local/aolserver/bin/nsd-postgres -t /web/service0/etc/config.tcl
    [service0@yourserver service0]$ [08/Mar/2003:18:13:29][32131.8192][-main-] Notice: nsd.tcl: starting to read config file...
    [08/Mar/2003:18:13:29][32131.8192][-main-] Notice: nsd.tcl: finished reading config file.

After completing installation and restarting the server, go to http://localhost:8000 for configuration and customization instructions. You can upgrade a Quick Install with source control, full text search, backup/recovery, and other production features by walking through the Installation documentation and doing the steps marked OPTIONAL.

($Id: quick.html,v 1.2 2003/08/20 16:20:16 joela Exp $)
View comments on this page at openacs.org