Benutzer-Werkzeuge

Webseiten-Werkzeuge


lilypond:lsr_setup

Howto set up a local LSR mirror

Downloading/Installing all requirements

  1. Install tomcat, mod_jk, velocity, libtagsoup-java, libmysql-java and mysql from your distribution's packages
  2. Download MG4J's dependencies package and the binary package, ERW and the LSR source code and the mysql dump. In particular, you should download the following files:
    • mg4j-deps.tar.gz
    • mg4j-3.0.1-bin.tar.gz
    • ERW-1.0.10.tar.gz
    • lsr-0.5-src.tar.gz
    • lsr-2011-06-30.mysqldump.gz
  3. Extract the LSR source code (into the lsr-0.5/ directory):
    tar xfz lsr-0.5-src.tar.gz

Building the LSR jar archive

  1. Install MG4J: extract mg4j and all dependencies to the the lsr folder:
    mkdir -p lsr-0.5/lib
    tar -C lsr-0.5/lib/ -xvzf mg4j-deps.tar.gz
    rm lsr-0.5/lib/tomcat5-servlet-*.jar
    tar xfz mg4j-3.0.1-bin.tar.gz
    cp mg4j-3.0.1/mg4j-*.jar lsr-0.5/lib/
  2. Copy all required global jar files to the lsr code directory:
    cp /usr/share/java/tagsoup.jar lsr-0.5/lib/
    cp /usr/share/java/mysql.jar lsr-0.5/lib/
    cp /usr/share/java/mysql-connector-java.jar lsr-0.5/lib/
    cp /usr/share/tomcat6/lib/servlet-api.jar lsr-0.5/lib/
  3. Create a sh/ subdirectory that will contain several helper shell scripts:
    mkdir -p lsr-0.5/sh/

    and download the setcp.sh and indexlsr.sh scripts to that directory: setcp.sh, indexlsr.sh

  4. We also need to tell the javac compiler to use those .jar files in the lib subdirectory (plus, the build.xml file contains the wrong version), therefore we have to patch build.xml. Download the following patch and store it in the lsr-0.4/ subdirectory: Patch file for build.xml
    cd lsr-0.5/
    patch -p0 < build.xml.patch
  5. Build the LSR:
    ant
    cd ..

    You will now have a lsr-0.5.jar file in lsr-0.5

  6. Finally, remove all hardcoded references to lsr.dsi.unimi.it and to the https host (we are using http for both the front- and the backend). Download this patch: remove-dsi-url-https.patch
    patch -p0 < remove-dsi-url-https.patch

Setting up the MySQL database

  1. Create a MySQL user lsr with password lsr and also create a database lsr, to which the user has all rights.
  2. Insert the mysql database dump into mysql (replace the date with the proper name of your downloaded file):
    gunzip lsr-2011-06-30.mysqldump.gz
    mysql --user=lsr --password=lsr lsr < lsr-2011-06-30.mysqldump
  3. Create a group superadmin and give it all rights to all types. Also add a user 'admin' and add it to the superadmin group. It's easiest to use the following SQL file (Please change the password!): sql-add-superadmin.sql
    mysql --user=lsr --password=lsr lsr < sql-add-superadmin.sql

Setting up ERW and generating the lsr-specific ERW files

  1. Extract ERW:
    tar xfz ERW-1.0.10.tar.gz
  2. Create the proper forms, definition files and the SQL for an initial database for ERW (ertool –forms/defs/sql does the same, but has a hardcoded path to the erw.jar and needs it globally installed. Here we simply use the same direct java call as ertool does):
    erwdir=$PWD/ERW-1.0.10
    alias myerwtool="java -cp $erwdir/ERtool/erw.jar:$CLASSPATH -Dit.unimi.dsi.erw.dtddir="$erwdir/dtd/" it.unimi.dsi.erw.ERtool "
    cd lsr-0.5/ERW/
    myerwtool --forms forms/*.erf < lsr.xml
    mkdir -p defs
    cd defs
    myerwtool --defs < ../lsr.xml
    cd ..
    myerwtool --sql < lsr.xml > lsr-ERW-db-structure.sql
    cd ../../
  3. Patch ERW to remove the outdated check for old browsers altogether. Download the following file to ERW-1.0.10/php: Path for ERW.php
    patch -p0 < erw.php.patch

Preparing the web host's directory structure

  1. Create an output directory, where we collect all files for the web application:
    mkdir -p web/LSR/WEB-INF/{classes,data,templates,lib} web/{custom,defs,forms}
  2. Copy the lsr-0.5.jar and all other required java packages to the output directory:
    cp lsr-0.5/lsr-0.5.jar web/LSR/WEB-INF/lib/
    cp lsr-0.5/lib/*.jar web/LSR/WEB-INF/lib/
  3. Copy the ERW .php files to the correct directory:
    cp -r ERW-1.0.10/php/*.php ERW-1.0.10/php/ERW web/
  4. Copy all LSR files (also the generated ERW files) over, which will be served by apache:
    cp -r lsr-0.5/{css,html,img} web/LSR/
    cp lsr-0.5/ERW/custom/*.php web/custom/
    cp lsr-0.5/ERW/defs/*.php web/defs/
    cp lsr-0.5/ERW/forms/*.php web/forms/
    mv web/custom/login.php web/
    cp lsr-0.5/vm/*.vm web/LSR/WEB-INF/templates
  5. Download the web.xml and velocity.properties files to the web/LSR/WEB-INF/ directory:
  6. Open web/ERW-conf.orig.php in a text editor and change $_ERW_erlId, the database user, password and database to „lsr“. Then rename it to ERW-config.php:
    mv web/ERW-conf.orig.php web/ERW-conf.php

    My ERW-config.php can also be downloaded here: My ERW-conf.php config file

  7. Create the initial MG4J search index:
      lsrshdir=$PWD/lsr-0.5/sh/
      cd web/LSR/WEB-INF/data
      . $lsrshdir/setcp.sh
      $lsrshdir/indexlsr.sh
      cd -

Setting up Tomcat

  1. Add a new user with roles manager and admin in /etc/tomcat6/tomcat-users.xml and restart tomcat
  2. Deploy the webabb in web/LSR with tomcat (we already created the correct file structure above). In the manager (e.g. http://localhost:8080/manager/html) deploy the webapp with the following settings:
      Context Path (required): /LSR
      XML Configuration file: file://home/reinhold/Software/LSR/web/LSR/WEB-INF/web.xml
      URL: file://home/reinhold/Software/LSR/web/LSR/
  3. Enable the AJP13 connector (in /etc/tomcat6/server.xml):
        <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

Setting up Apache

  1. Make sure that the HTTP php module is installed:
    pear install HTTP
  2. Setup a proper virtual host in Apache's configuration /etc/apache2/sites-enabled/vhosts.conf. NOTE: Adjust the pathes, IP and hostname to your needs:
    <VirtualHost *:80>
      ServerName lsr.local
      ServerName lsr.kainhofer.at
      DocumentRoot /home/reinhold/Software/LSR/web
      ReadmeName README
      JkMount  /LSR/* LSR
      JkUnMount /LSR/html/* LSR
      JkUnMount /LSR/img/* LSR
      JkUnMount /LSR/css/* LSR
      JkUnMount /*.php LSR
      DirectoryIndex LSR/Browse
      php_value "arg_separator.input" ";"
      php_value "register_long_arrays" "On"
    </VirtualHost>

    Notice the two php_value arguments, which are required by the code of ERW:

    1. For its RPC calls ERW uses the semicolon as query string parameter separator rather than the ampersand (that's hardcoded in many .php files of ERW)
    2. ERW uses the deprecated $HTTP_GET_VARS global variables (and similar $HTTP_* variables) rather than the new $_GET. These old globals are no longer available in php >=5.0.0. However, regist_long_arrays enables a compatibility mode for that deprecated syntax.
  3. Configure mod_jk:
    1. Create a file /etc/apache2/mods-available/jk.conf with the following contents (or Download my version):
      JkWorkersFile	/etc/libapache2-mod-jk/workers.properties
      JkLogFile 	/var/log/apache2/mod_jk.log
      # info/warn/error/debug
      JkLogLevel 	info
    2. Edit /etc/libapache2-mod-jk/workers.properties to contain the following lines:
      worker.list=LSR
      # Defining a worker named LSR and of type ajp13
      # Note that the name and the type do not have to match.
      worker.LSR.port=8009
      worker.LSR.host=localhost
      worker.LSR.type=ajp13
    3. Install the mod_jk module and configure it to use the tomcat webapplication:
        a2enmod jk
  4. Restart apache:
    /etc/init.d/tomcat6 restart
    /etc/init.d/apache2 restart

Setting up the cronjob to build the MG4J index

Setting up the LilyPond jail needed for creating snippet output

  1. Install a Lilypond version from the binary builds:
    1. Download the .sh file
    2. As root, do
        sudo mkdir /opt/lily2.14
        sudo ./lilypond-2.14.2-1.linux-x86.sh --prefix=/opt/lily2.14/
  2. Use this script to setup a lilypond jail directory (each installed lilypond version needs roughly 100MB). You can use multiple installations with multiple -p arguments (in this example, I have versions 2.10, 2.12 and 2.14 installed in the same jail):
      sudo ./create_lily_jail.sh -p /opt/lily2.10/ -p /opt/lily2.12/ -p /opt/lily2.14/ -s 400000 lilyjail
  3. This script will print out some instructions how to enable sudo for a user and how to automount the jail on boot. Follow the instructions, i.e.
    1. Add the following line to /etc/fstab to ensure the loop device will be mounted on boot:
      /home/lilyjail/lilyloop /home/lilyjail/lilymnt    ext3 auto,loop 0       0
    2. Call visudo as root and add the following lines to the sudoers file (typically /etc/sudoers):
      ALL   ALL=NOPASSWD: /opt/lily2.10/lilypond/usr/bin/lilypond -jlilyjail\,lilyjail\,/home/lilyjail/lilymnt\,/lilyhome *
      ALL   ALL=NOPASSWD: /opt/lily2.12/lilypond/usr/bin/lilypond -jlilyjail\,lilyjail\,/home/lilyjail/lilymnt\,/lilyhome *
      ALL   ALL=NOPASSWD: /opt/lily2.14/lilypond/usr/bin/lilypond -jlilyjail\,lilyjail\,/home/lilyjail/lilymnt\,/lilyhome *

      This allows all users to run the jailed lilypond installation.

For details see the LilyPond documentation: http://lilypond.org/doc/v2.14/Documentation/usage/command_002dline-usage.html#lilypond-in-chroot-jail

Open issues

.

lilypond/lsr_setup.txt · Zuletzt geändert: 2013/03/13 10:42 von 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki