From: Bill Erickson Date: Thu, 22 Mar 2012 21:47:59 +0000 (-0400) Subject: Evergreen Squeeze installer script X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=1ea562e4606757933c71fa6c7202689d7bbd1dcf;p=working%2Frandom.git Evergreen Squeeze installer script Signed-off-by: Bill Erickson --- diff --git a/installer/squeeze/README b/installer/squeeze/README new file mode 100644 index 000000000..d0e17588a --- /dev/null +++ b/installer/squeeze/README @@ -0,0 +1,28 @@ +Author: Bill Erickson +Copyright: (C) 2009-2012 Equinox Software Inc. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +---------------------------------------------------------- + +Mostly automated "master" install of OpenSRF and Evergreen on Debian Squeeze. + +WARNING: This is for development and evaluation purposes only. Use at own risk. + +Steps: + 1. Install Debian Squeeze + 2. Put these files on the server + 3. Run the script as root and do what it says + + + + + diff --git a/installer/squeeze/eg_squeeze_installer.sh b/installer/squeeze/eg_squeeze_installer.sh new file mode 100755 index 000000000..a68afa957 --- /dev/null +++ b/installer/squeeze/eg_squeeze_installer.sh @@ -0,0 +1,218 @@ +#!/bin/bash +# ----------------------------------------------------------------------- +# Copyright (C) 2009-2012 Equinox Software Inc. +# Bill Erickson +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# ----------------------------------------------------------------------- + +DOJO_VERSION='1.3.3'; + +# ----------------------------------------------------------------------- +# Change to suit... +# ----------------------------------------------------------------------- +# If you change the jabber password, you will need to +# edit opensrf_core.xml and srfsh.xml accordingly +JABBER_PASSWORD='password' +ADMIN_USER='admin'; +ADMIN_PASS='demo123'; +# ----------------------------------------------------------------------- + +if [ ! "$(grep 'squeeze-backports' /etc/apt/sources.list)" ]; then + echo "Please add the following to /etc/apt/sources.list:" + echo "deb http://backports.debian.org/debian-backports squeeze-backports main contrib" + exit; +fi; + + +# CPAN follow pre-reqs? +cpan_policy=$(perl -MCPAN::Config -e 'print $CPAN::Config->{prerequisites_policy}'); +if [ $cpan_policy != 'follow' ]; then + echo ' +The install will go faster if CPAN is configured to automatically install +prerequisites. You can revert the action later with: + +% echo -e "o conf prerequisites_policy ask\\n o conf commit" | cpan + +Automatically install prereqs? [Y/n] '; + read X; + if [ "$X" == 'y' -o "$X" == 'Y' ]; then + echo -e "o conf prerequisites_policy follow\\n o conf commit" | cpan + fi; +fi; + +# And they're off... +BASE_DIR=$PWD + +# Install some essential tools +apt-get update; +apt-get -yq dist-upgrade; +apt-get -yq install build-essential automake git psmisc ntp rsyslog; + + +cp $BASE_DIR/evergreen.ld.conf /etc/ld.so.conf.d/ +ldconfig; + +# Configure rsyslog and restart +cp $BASE_DIR/evergreen-rsyslog.conf /etc/rsyslog.d/evergreen.conf +/etc/init.d/rsyslog restart + +# Create opensrf user and set up environment +if [ ! "$(grep ^opensrf: /etc/passwd)" ]; then + useradd -m -s /bin/bash opensrf + echo 'export PATH=/openils/bin:$PATH' >> /home/opensrf/.bashrc +fi; + +OSRF_COMMAND=' +cd /home/opensrf; +git clone git://git.evergreen-ils.org/OpenSRF.git; +git clone git://git.evergreen-ils.org/Evergreen.git; +' +su - opensrf sh -c "$OSRF_COMMAND"; + + +# Install pre-reqs +mkdir -p /usr/src/evergreen; +cd /usr/src/evergreen; +make -f /home/opensrf/OpenSRF/src/extras/Makefile.install debian-squeeze +make -f /home/opensrf/Evergreen/Open-ILS/src/extras/Makefile.install debian-squeeze install_pgsql_server_backport_debs_91 + + +# Patch Ejabberd and register users +if [ ! "$(grep 'public.localhost' /etc/ejabberd/ejabberd.cfg)" ]; then + cd /etc/ejabberd/ + /etc/init.d/ejabberd stop; + killall beam epmd; # just in case + cp ejabberd.cfg /root/ejabberd.cfg.orig + patch -p0 < $BASE_DIR/ejabberd.squeeze.EG.patch + chown ejabberd:ejabberd ejabberd.cfg + /etc/init.d/ejabberd start + sleep 2; + ejabberdctl register router private.localhost $JABBER_PASSWORD + ejabberdctl register opensrf private.localhost $JABBER_PASSWORD + ejabberdctl register router public.localhost $JABBER_PASSWORD + ejabberdctl register opensrf public.localhost $JABBER_PASSWORD +fi; + + + +# Build and install OpenSRF +OSRF_COMMAND=' +cd /home/opensrf/OpenSRF; +./autogen.sh; +./configure --prefix=/openils --sysconfdir=/openils/conf; +make;' + +su - opensrf sh -c "$OSRF_COMMAND" +cd /home/opensrf/OpenSRF; +make install + +# Build and install the ILS +OSRF_COMMAND=' +cd /home/opensrf/Evergreen; +./autogen.sh; +./configure --prefix=/openils --sysconfdir=/openils/conf; +make;' + +su - opensrf sh -c "$OSRF_COMMAND" +cd /home/opensrf/Evergreen +make install + +cp /openils/conf/opensrf.xml.example /openils/conf/opensrf.xml +cp /openils/conf/opensrf_core.xml.example /openils/conf/opensrf_core.xml + +# fetch and install Dojo +cd /tmp; +wget "http://download.dojotoolkit.org/release-$DOJO_VERSION/dojo-release-$DOJO_VERSION.tar.gz"; +tar -zxf dojo-release-$DOJO_VERSION.tar.gz; +cp -r dojo-release-$DOJO_VERSION/* /openils/var/web/js/dojo/; + +# give it all to opensrf +chown -R opensrf:opensrf /openils + +# copy srfsh config into place +cp /openils/conf/srfsh.xml.example /home/opensrf/.srfsh.xml; +chown opensrf:opensrf /home/opensrf/.srfsh.xml; + +echo -e "\n\nPlease enter a password for the evergreen database user. If you do not want to edit configs, use \"evergreen\"\n" +su - postgres sh -c 'createuser -P -s evergreen;' + +# Apply the DB schema +cd /home/opensrf/Evergreen +perl Open-ILS/src/support-scripts/eg_db_config.pl \ + --create-database \ + --create-schema \ + --create-offline \ + --service all \ + --user evergreen \ + --password evergreen \ + --hostname localhost \ + --database evergreen \ + --admin-user $ADMIN_USER \ + --admin-pass $ADMIN_PASS; + +# Copy apache configs into place and create SSL cert +cp Open-ILS/examples/apache/eg.conf /etc/apache2/sites-available/ +cp Open-ILS/examples/apache/eg_vhost.conf /etc/apache2/ +cp Open-ILS/examples/apache/startup.pl /etc/apache2/ + +mkdir -p /etc/apache2/ssl; +if [ ! -f /etc/apache2/ssl/server.key ] ; then + echo -e "\n\nConfiguring a new temporary SSL certificate....\n"; + openssl req -new -x509 -days 365 -nodes -out /etc/apache2/ssl/server.crt -keyout /etc/apache2/ssl/server.key +else + echo -e "\nkeeping existing ssl/server.key file\n"; +fi + +a2enmod ssl +a2enmod rewrite +a2enmod expires +a2dissite 000-default +a2ensite eg.conf + + +if [ ! "$(grep 'public.localhost' /etc/hosts)" ]; then + cat < +# +# /etc/rsyslog.d/opensrf-rsyslog.conf +# + +$EscapeControlCharactersOnReceive off + +# Message format templates +# TIMESTAMP:::date-pgsql == YYYY-MM-DD HH:MM:SS +$template msgformat,"%TIMESTAMP:::date-pgsql% %HOSTNAME% %syslogtag%%msg:::drop-last-lf%\n" + +# Log file templates ------- +$template osrfsys,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/osrfsys.%$HOUR%.log" +$template osrferror,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/osrferror.log" +$template osrfwarn,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/osrfwarn.log" +$template activity,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/activity.log" +$template gateway,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/gateway.%$HOUR%.log" +$template router,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/router.log" +$template pg,"/var/log/evergreen/%$YEAR%/%$MONTH%/%$DAY%/pg.%$HOUR%.log" + +# Selectors ---------------- +# local0 : OpenSRF +# local1 : OpenSRF "activity" +# local2 : OpenSRF router +# local6 : Apache + +local0.* ?osrfsys;msgformat +local1.* ?activity;msgformat +local2.* ?router:msgformat +local3.* ?pg:msgformat +local6.* ?gateway;msgformat + +# Warn +local0.warn ?osrfwarn;msgformat +local1.warn ?osrfwarn;msgformat +local2.warn ?osrfwarn;msgformat +local3.warn ?osrfwarn;msgformat +local6.warn ?osrfwarn;msgformat + +# Error +local0.error ?osrferror;msgformat +local1.error ?osrferror;msgformat +local2.error ?osrferror;msgformat +local3.error ?osrferror;msgformat +local6.error ?osrferror;msgformat diff --git a/installer/squeeze/evergreen.ld.conf b/installer/squeeze/evergreen.ld.conf new file mode 100644 index 000000000..07233fc95 --- /dev/null +++ b/installer/squeeze/evergreen.ld.conf @@ -0,0 +1,3 @@ +/openils/lib +/usr/local/lib +/usr/local/lib/dbd