OpenACS at the pd.o

The first in our sysadmin series. How to install OpenACS 4.6.3 on an OpenBSD box, pintday.org-style.

This Guide assumes your server name is pdo. Replace it accordingly.

  1. Download the aolserver 3.4.2 port and install it. It should install to /usr/local/aolserver
  2. Copy the aolserver config file, pdo.tcl, to /usr/local/aolserver/.
  3. Copy the run script and the log run script (for daemontools) to /usr/local/aolserver/servers/pdo/ and /usr/local/aolserver/servers/pdo/log respectively.

Installing and Configuring PostgreSQL

  1. Obtain and install the postgresql-7.3.2 port
  2. If this is the first installation of PostgreSQL, you will need to create the PostgreSQL user and group:

      # useradd -c "PostgreSQL Admin User" -g =uid -m -d /var/postgresql \
    	 -s /bin/sh postgresql
    
  3. su to the postgresql account and initialize the database:

      # sudo su - postgresql
      $ mkdir /var/postgresql/data
      $ initdb -D /var/postgresql/data>
    
  4. To enable automatic startup of the database, add the following to /etc/rc.local:

    if [ -x /usr/local/bin/pg_ctl ]; then
    	su -l postgresql -c "/usr/local/bin/pg_ctl start \
    		-D /var/postgresql/data -l /var/log/postgresql/psql.log \
    		-o '-D /var/postgresql/data'"
    	echo -n ' postgresql'
    fi
    

    And for the automatic shutdown, add this to /etc/rc.shutdown:

    if [ -f /var/postgresql/data/postmaster.pid ]; then
    	su -l postgresql -c "/usr/local/bin/pg_ctl stop -m fast \
    		-D /var/postgresql/data"
    	rm -f /var/postgresql/data/postmaster.pid
    fi
    
  5. You should adjust the ulimit settings for the postgresql user by adding the following to /etc/login.conf:
    postgresql:\
            :maxproc-max=256:\
            :maxproc-cur=256:\
            :openfiles-cur=768:\
            :datasize-max=256M:\
            :datasize-cur=64M:\
            :stacksize-cur=4M:
    
  6. Finally, you should probably compile a custom kernel, bumping up some of the SysV semaphore and shared memory limits:

    option          SEMMNI=256
    option          SEMMNS=2048
    option		SHMMAXPGS=4096		# default on i386 is 2048 = 8Mb
    					# other archs may vary
    
  7. Now we will want to create the postgres variant of the PL/SQL language and add it to the default template (where it will be used by all newly created tablespaces):

      $ createlang plpgsql template1
      $ createlang -l template1
      Procedural languages
        Name   | Trusted? 
      ---------+----------
       plpgsql | t
      (1 row)
    

    To test whether this configuration worked, do the following:

      $ createdb test
      CREATE DATABASE
      $ psql test
      Welcome to psql 7.3.2, 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
    
      test=# select current_timestamp;
                timestamptz          
      -------------------------------
       2003-06-19 01:18:05.856626-06
      (1 row)
    
      test=# create function test1() returns integer as 'begin return 1; end;'
         language 'plpgsql';
      CREATE FUNCTION
      test=# select test1();
       test1 
      -------
           1
      (1 row)
      
      test=# \q
      $ dropdb test
      DROP DATABASE
    

pintday.org » Fresh every Tuesday.