Forum OpenACS Development: New Version: OpenHosting Installation steps for OpenACS 5.1.5 and Postgresql 7.4.10 (FC4)

#  OpenHosting Installation of OpenACS 5.1.5
#  for use on OpenHosting VPS server running Fedora Core 4
#  (www.openhosting.com)
#
#    ver. 0.0.3
#    Last Modified: March 5, 2006
#    Author: Ryan Gallimore (mailto:rgallimore@viscousmedia.com)
#
#  This is UNSTABLE.
#

# Rebuild your server from the control panel.

emacs /etc/profile
# add:

export OPENACS_SERVICE_NAME=[your service name]

# OpenACS
groupadd web
useradd -g web $OPENACS_SERVICE_NAME
mkdir /var/lib/aolserver
chown -R $OPENACS_SERVICE_NAME /var/lib/aolserver
chgrp -R web /var/lib/aolserver
chmod -R 770 /var/lib/aolserver

su - $OPENACS_SERVICE_NAME
cd /tmp
wget https://openacs.org/projects/openacs/download/download/openacs-5.1.5.tar.gz?revision_id=271916
cd /var/lib/aolserver
tar xzf /tmp/openacs-5.1.5.tar.gz?revision_id=271916
mv openacs-5.1.5/ $OPENACS_SERVICE_NAME
chmod -R 755 $OPENACS_SERVICE_NAME
chown -R $OPENACS_SERVICE_NAME.web $OPENACS_SERVICE_NAME
exit
cd /
ln -s /var/lib/aolserver/$OPENACS_SERVICE_NAME

# PostgreSQL 7.4.10

su
service postgresql stop
yum remove postgresql
exit
cd /tmp
wget http://easynews.dl.sourceforge.net/sourceforge/pgsql/postgresql-7.4.10.tar.bz2
cd /usr/local/src
tar xjvf /tmp/postgresql-7.4.10.tar.bz2

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.10
chmod 750 /usr/local/pgsql

su - postgres
cd /usr/local/src/postgresql-7.4.10
./configure --without-readline --without-zlib
make all
make install

/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 start

createlang plpgsql template1
createlang -l template1

createuser -a -d $OPENACS_SERVICE_NAME
exit

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
echo "export LD_LIBRARY_PATH=/usr/local/pgsql/lib" >> ~postgres/.bash_profile
echo "export PATH=$PATH:/usr/local/pgsql/bin" >> ~postgres/.bash_profile

su - $OPENACS_SERVICE_NAME
/usr/local/pgsql/bin/createdb -E UNICODE $OPENACS_SERVICE_NAME
exit

# Set postgres to start on boot
cp /var/lib/aolserver/$OPENACS_SERVICE_NAME/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

service postgresql stop
chkconfig --add postgresql
chkconfig --level 345 postgresql on
chkconfig --list postgresql
service postgresql start

# Tcl
yum remove tcl
cd /usr/local/src
wget http://heanet.dl.sourceforge.net/sourceforge/tcl/tcl8.4.7-src.tar.gz
tar xfz tcl8.4.7-src.tar.gz
cd tcl8.4.7/unix
./configure --enable-threads
make install
mv /usr/local/bin/tclsh8.4 /usr/local/bin/tclsh

# AOLServer
cd /usr/local/src
mkdir aolserver40r8
cd aolserver40r8
cvs -z3 -d:pserver:mailto:anonymous@cvs.sourceforge.net:/cvsroot/aolserver co -r aolserver_v40_r8 aolserver
cvs -z3 -d:pserver:mailto:anonymous@cvs.sourceforge.net:/cvsroot/aolserver co nscache
cvs -z3 -d:pserver:mailto:anonymous@cvs.sourceforge.net:/cvsroot/aolserver co nspostgres
cvs -z3 -d:pserver:mailto:anonymous@cvs.sourceforge.net:/cvsroot/aolserver co nssha1
cvs -z3 -d:pserver:mailto:anonymous@cvs.sourceforge.net:/cvsroot/aolserver co -r v2_7 nsoracle
cvs -z3 -d:pserver:mailto:anonymous@cvs.sourceforge.net:/cvsroot/aolserver co nsxml
wget http://www.tdom.org/tDOM-0.7.8.tar.gz
tar xvfz tDOM-0.7.8.tar.gz

in aolserver/nsd/conn.c
Line 843:
    result  = Tcl_GetObjResult(interp);
-    connPtr = (Conn *) conn = itPtr->conn;
+    connPtr = conn = (Conn *) itPtr->conn;

in aolserver/nsd/unix.c
    comment out line 74
    //pthread_kill_other_threads_np();

cd /usr/local/src/aolserver40r8/aolserver
./configure --prefix=/usr/local/aolserver40r8 --with-tcl=/usr/local/lib/
make install
ln -s /usr/local/aolserver40r8 /usr/local/aolserver

cd /usr/local/src/aolserver40r8/nscache
make install
cd ../nspostgres/
make install POSTGRES=/usr/local/pgsql ACS=1 INST=/usr/local/aolserver40r8
cd ../nssha1/
make
make install
cd ../tDOM-0.7.8/unix
../configure --enable-threads --disable-tdomalloc --prefix=/usr/local/aolserver40r8 --with-tcl=/usr/local/lib
make install
cd /usr/local/aolserver40r8/bin
cp /var/lib/aolserver/$OPENACS_SERVICE_NAME/packages/acs-core-docs/www/files/nsd-postgres.txt ./nsd-postgres
chmod 755 nsd-postgres

# Copy config files:

# emacs /$OPENACS_SERVICE_NAME/etc/config.tcl
# 1. edit hostname and address
# 2. change homedir to /usr/local/aolserver40r8
# 3. change bindir to /usr/local/aolserver40r8/bin

# We have to do this or libpq.so and nspostgres throws an error
# and the db load fails.
# Search for libpq.so and copy it to /usr/lib/libpq.so.3
# e.g mv /usr/lib/libpq.so.4 /usr/lib/libpq.so.3

# Copy the init.d script to /etc/init.d/:

#!/bin/sh
#
# chkconfig: 2345 99 03
# description: Start the VM Demo OpenACS Server.
#

OPENACS_SERVICE_NAME=vmdemo
NAME="OpenACS on $OPENACS_SERVICE_NAME"
SERVICEPATH=/var/lib/aolserver/$OPENACS_SERVICE_NAME
IP=192.168.2.50

PATH=/bin:/usr/bin:/sbin:/usr/sbin

trap "" 1

start()
{
    echo -n "Starting web server: $NAME"
    echo -e -n "\r"

    # give time for Postgres to come up
    sleep 2

    exec /usr/local/aolserver/bin/nsd -it $SERVICEPATH/etc/config.tcl -u $OPENACS_SERVICE_NAME -g web -b $IP:80 &

    # For AOLserver 4 using privileged ports (usually < 1024), add the flag
    # -b youraddress:yourport

    echo ""
}

stop()
{
    echo -n "Stopping web server: $NAME"
    killall nsd
    echo ""
}

case "$1" in
  start)
    sleep 3
    start
    ;;
  stop)
    stop
    ;;
  restart)
    stop
    sleep 3
    start
    ;;
  *)

    echo "Usage: /etc/init.d/$NAME {start|stop|restart}"
    exit 1
    ;;
esac

echo -n -e "\c\r\n"

exit 0

# End of openacs init.d script

chmod u+x /etc/init.d/$OPENACS_SERVICE_NAME

# avoid pid not found errors in the log
chown root:web /usr/local/aolserver/log
chmod 775 /usr/local/aolserver/log

# avoid psql not found error
emacs /$OPENACS_SERVICE_NAME/packages/acs-tcl/tcl/00-database-procs.tcl
# Find db_pg_bin proc
# Insert first line: return /usr/local/pgsql/bin

# Set openacs to start on boot
chkconfig --add $OPENACS_SERVICE_NAME
chkconfig $OPENACS_SERVICE_NAME on

# Stop apache permanently
/etc/init.d/httpd stop
chkconfig --del httpd

# Start the server!
/etc/init.d/openacs-base start

# Done!