install-ns.sh
Please refer to https://raw.githubusercontent.com/gustafn/install-ns/master/install-ns.sh for the latest version of the script below.
Below is a simple install script for installing NaviServer and its components for a PostgresSQL installation from scratch by obtaining the relevant sources and compiling it. The script works under a typical Linux installation as well as on Mac OS X.
A sample config-file for OpenACS is provided here: openacs-config.tcl
#!/bin/bash clean=0 build=0 while [ x"$1" != x ]; do case $1 in clean) clean=1 shift continue;; build) build=1 shift continue;; *) echo "argument '$1' ignored" shift continue;; esac done echo "------------------------ Settings ---------------------------------------" # Installation directory and software versions to be installed build_dir=/usr/local/src inst_dir=/usr/local/ns v_ns=4.99.5 v_tcl=8.5.14 v_tcllib=1.15 v_thread=2.7.0 v_xotcl=2.0b5 v_tdom=0.8.3 # # the pg_* variables should be the path leading to the include and # library file of postgres to be used in this build. In particular, # "libpg-fe.h" and "libpq.so" are typically needed. pg_incl=/usr/include/postgresql pg_lib=/usr/lib echo " Installation Script for Naviserver (c) 2008 Malte Sussdorff, Nima Mazloumi, Gustaf Neumann Tested under Mac OS X and Ubuntu 12.04 LICENSE This program comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under certain conditions; For details see http://www.gnu.org/licenses. SETTINGS Build-Dir ${build_dir} Install-Dir ${inst_dir} NaviServer ${v_ns} Tcllib ${v_tcllib} Thread ${v_thread} XOTcl ${v_xotcl} Tcl ${v_tcl} tDOM ${v_tdom} " if [ $build = "0" ]; then echo " WARNING Check Settings AND Cleanup section before running this script! If you know what you're doing then call the call the script as $0 build " exit fi echo "------------------------ Cleanup -----------------------------------------" # First we clean up # The cleanup on the installation dir is optional, since it might # delete something else not from our installation. #rm -rf ${inst_dir} cd ${build_dir} #rm tcl${v_tcl}-src.tar.gz rm -r tcl${v_tcl} #rm tcllib-${v_tcllib}.tar.bz2 rm -r tcllib-${v_tcllib} #rm naviserver-${v_ns}.tar.gz rm -r naviserver-${v_ns} #rm naviserver-${v_ns}-modules.tar.gz rm -r modules #rm thread${v_thread}.tar.gz rm -r thread${v_thread} #rm nsf${v_xotcl}.tar.gz rm -r nsf${v_xotcl} #rm tDOM-${v_tdom}.tgz rm -r tDOM-${v_tdom} # just clean? if [ $clean = "1" ]; then exit fi echo "------------------------ System dependencies ---------------------------------" if [ ! -f "/etc/debian-version" ]; then # On Debian/Ubuntu, make sure we have zlib installed, otherwise # naviserver can provide compression support apt-get install zlib1g-dev libpq-dev wget gcc fi echo "------------------------ Downloading sources ----------------------------" if [ ! -f tcl${v_tcl}-src.tar.gz ]; then wget http://heanet.dl.sourceforge.net/sourceforge/tcl/tcl${v_tcl}-src.tar.gz fi if [ ! -f tcllib-${v_tcllib}.tar.bz2 ]; then wget http://heanet.dl.sourceforge.net/sourceforge/tcllib/tcllib-${v_tcllib}.tar.bz2 fi if [ ! -f naviserver-${v_ns}.tar.gz ]; then wget http://heanet.dl.sourceforge.net/sourceforge/naviserver/naviserver-${v_ns}.tar.gz fi if [ ! -f naviserver-${v_ns}-modules.tar.gz ]; then wget http://heanet.dl.sourceforge.net/sourceforge/naviserver/naviserver-${v_ns}-modules.tar.gz fi if [ ! -f thread${v_thread}.tar.gz ]; then wget http://heanet.dl.sourceforge.net/sourceforge/tcl/thread${v_thread}.tar.gz fi if [ ! -f nsf${v_xotcl}.tar.gz ]; then wget http://heanet.dl.sourceforge.net/sourceforge/next-scripting/nsf${v_xotcl}.tar.gz fi if [ ! -f tDOM-${v_tdom}.tgz ]; then wget --no-check-certificate https://github.com/downloads/tDOM/tdom/tDOM-${v_tdom}.tgz fi echo "------------------------ Installing TCL ---------------------------------" set -o errexit tar xfz tcl${v_tcl}-src.tar.gz cd tcl${v_tcl}/unix ./configure --enable-threads --prefix=${inst_dir} make -j 6 make install # make sure, we have a tclsh in ns/bin if [ -f $inst_dir/bin/tclsh ]; then rm $inst_dir/bin/tclsh fi source $inst_dir/lib/tclConfig.sh ln -sf $inst_dir/bin/tclsh${TCL_VERSION} $inst_dir/bin/tclsh cd ../.. echo "------------------------ Installing Naviserver ---------------------------" tar zxvf naviserver-${v_ns}.tar.gz cd naviserver-${v_ns} ./configure --with-tcl=${inst_dir}/lib --prefix=${inst_dir} make -j 6 make install cd .. echo "------------------------ Installing Modules/nsdbpg ----------------------" tar zxvf naviserver-${v_ns}-modules.tar.gz cd modules/nsdbpg make PGLIB=${pg_lib} PGINCLUDE=${pg_incl} make install cd ../.. echo "------------------------ Installing TCLLib ------------------------------" tar xvfj tcllib-${v_tcllib}.tar.bz2 cd tcllib-${v_tcllib} ./configure --prefix=${inst_dir} make install cd .. echo "------------------------ Installing Thread ------------------------------" tar xfz thread${v_thread}.tar.gz cd thread${v_thread}/unix/ ../configure --enable-threads --prefix=${inst_dir} --exec-prefix=${inst_dir} --with-naviserver=${inst_dir} --with-tcl=${inst_dir}/lib make make install cd ../.. echo "------------------------ Installing XOTcl 2.0 ----------------------------" tar xvfz nsf${v_xotcl}.tar.gz cd nsf${v_xotcl} export CC=gcc ./configure --enable-threads --enable-symbols --prefix=${inst_dir} --exec-prefix=${inst_dir} --with-tcl=${inst_dir}/lib make make install cd .. echo "------------------------ Installing tdom --------------------------------" tar xfz tDOM-${v_tdom}.tgz cd tDOM-${v_tdom}/unix ../configure --enable-threads --disable-tdomalloc --prefix=${inst_dir} --exec-prefix=${inst_dir} --with-tcl=${inst_dir}/lib make install cd ../.. echo " Congratulations, you have installed NaviServer. In order to run the server, it has should be executed with non-root privileges. Therefore, the server needs an unprivileged user to be specified (e.g. nsadmin). The permissions for log directory have to be set up: chown -R nsadmin ${inst_dir}/logs You can now run plain NaviServer by typing the following command: ${inst_dir}/bin/nsd -f -u nsadmin -t ${inst_dir}/conf/nsd-config.tcl As a next step, you need to configure the server according to your needs, or you might want to use the server with OpenACS. Consult as a reference the alternate configuration files in ${inst_dir}/conf/ "