How to install LDAS on a stand-alone Linux system

There are times when it is desirable to run LDAS on a stand-alone machine instead of over a distributed network. One such example is the convenience of running LDAS jobs on a laptop. The following instructions describe how to build, install and run LDAS on a stand-alone Linux machine.

Table of Contents

Requirements

Assumptions

Due to the development nature of the software, at any given time the released versions of LDAS, LAL, and LAL Wrapper may not be compatible with each other or with the required tools in LDCG. This may require retrieving the software from the CVS repository instead of from a release distribution. This document does not attempt to describe the steps necessary to retreive and build any software from a CVS repository. The instructions mentioned in this document regarding software building only describe building from a release distribution. Consult the corresponding web site for information on retreiving and building software from a CVS repository.

This document is written from the viewpoint of installing and building all the software from scratch, starting with the operating system. If you already have a computer with the correct version of the OS installed, or you already have a current installation of the LDCG tools, take caution when skipping the instructions that don't apply.

RedHat Linux Installation

Start the RedHat installation, choose Custom Install and install ALL the packages (Everything). After the install is complete, follow RedHat's instructions on upgrading the kernel to the version indicated in the Requirements section. Install any dependencies required by the rpm utility when upgrading the kernel.

To prevent conflicts with the version of LAM installed with the LDCG tools, uninstall the LAM rpm package installed by RedHat:

rpm -e lam-6.5.8-4

Hostname

Note: Some of the above instructions may have already been performed by the RedHat installation.

User Accounts

Login as root and execute the following commands to set up the necessary user accounts.

mkdir -p /usr1
groupadd -g 4099 ldas
useradd -c "LDAS General Account" -d /usr1/ldas -g ldas -m -n -s /bin/tcsh -u 4098 ldas
useradd -c "Software Installation Account" -d /usr1/install -g ldas -m -n -s /bin/tcsh -u 4099 install
useradd -c "DB2 Server Account" -d /usr1/ldasdb -g ldas -m -n -s /bin/tcsh -u 4100 ldasdb
chmod 755 /usr1/install /usr1/ldas /usr1/ldasdb
touch /usr1/ldasdb/.login /usr1/ldasdb/.profile
chown ldasdb:ldas /usr1/ldasdb/.login /usr1/ldasdb/.profile
mkdir -p /ldcg/stow_pkgs /ldas/stow_pkgs /lal/stow_pkgs /ldas_outgoing /usr1/databases
chmod 755 /ldcg /ldcg/stow_pkgs /ldas /ldas/stow_pkgs /lal /lal/stow_pkgs /usr1/databases
chmod 775 /ldas_outgoing
chown install:ldas /ldcg /ldcg/stow_pkgs /ldas /ldas/stow_pkgs /lal /lal/stow_pkgs
chown ldas:ldas /ldas_outgoing
chown ldasdb:ldas /usr1/databases

Assign a password to each new user.

passwd ldas
passwd install
passwd ldasdb

In the root user home account, create a file named cshrc. A working sample is available here. Copy it into the home directory of each user, renaming it to .cshrc.

chmod 644 ~/cshrc
cp ~/cshrc /usr1/ldas/.cshrc
cp ~/cshrc /usr1/install/.cshrc
cp ~/cshrc /usr1/ldasdb/.cshrc
chown ldas:ldas /usr1/ldas/.cshrc
chown install:ldas /usr1/install/.cshrc
chown ldasdb:ldas /usr1/ldasdb/.cshrc

The following adds search users for mpi/wrapper jobs. The example below creates 16 search user accounts (search01 - search16). Adjust the value of the max variable to your specific needs.

N=1
max=16
while test $N -le $max; do
   test $N -lt 10 && N="0$N"
   useradd -d /usr1/search$N -g ldas -m -n -s /bin/tcsh -u 41$N search$N
   chmod 755 /usr1/search$N
   cp ./cshrc /usr1/search$N/.cshrc
   chown search$N:ldas /usr1/search$N/.cshrc
   N=`expr $N + 1`
done

Web Server

In order to remotely view the HTML log files generated by the LDAS APIs, a web server must be configured. By default, the RedHat installation does NOT start a web server. To configure a web server, login as root and perform the following commands. From now on, a web server will be started at boot time.

service httpd start
chkconfig --add httpd
chkconfig httpd on
ln -s /ldas_outgoing/ /var/www/html/ldas_outgoing
ln -s /ldas_outgoing/logs/ /var/www/html/ldaslogs
ln -s /ldas/doc/ /var/www/html/ldasdoc

To monitor the API log files, enter a URI like http://machine.domain.suffix/ldaslogs/ into your favorite web browser. To view the LDAS documentation, use a URI like http://machine.domain.suffix/ldasdoc/.

DB2 8.1 Installation

The following steps are simplified from a more general document on installing DB2. That document is written in the context of a distributed/networked LDAS installation. It includes instructions for Solaris systems and for migrating from a DB2 7.2 installation. Be aware that some of the information there may not apply to a stand-alone environment.

Unless otherwise specified, all the following steps must be performed as root.

  1. Prepare the installation media

    Depending on how you obtained the DB2 software will determine where the installation files are located. If you received the software on CD-ROM, you will need to mount it on the stand-alone system. (Placing it in the CD-ROM tray and running a command like mount /mnt/cdrom will usually do the trick). Make sure the CD-ROM includes "DB2 Universal Database Enterprise Server Edition" and is for the Linux operating system. If you downloaded the software from IBM's web-site, you will need to extract the archive somewhere on the local filesystem (the root user home directory is as good a place as any).

  2. Install DB2 Enterprise Edition software

    Change to the top-level directory of the DB2 installation files, which were prepared in the previous step. Type ./db2_install to start the installer script. When the installer prompts for a product code, enter DB2.ESE. When the installation completes, run the following command to install the license file.

    /opt/IBM/db2/V8.1/adm/db2licm -a ./db2/license/db2ese.lic

    You can now safely unmount or remove the installation files.

  3. Install DB2 FixPak 5

    Download FixPak 5 from IBM's FTP server. Run the following commands from the root user home directory to extract the archive and install the FixPak. After the update completes, you can safely remove the extracted files.

    mkdir IBMdb2-8.1.5 tar xf FP10_U488497.tar
    cd IBMdb2-8.1.5
    ./installFixPak
  4. Adjust system kernel parameters

    Modify the kernel parameters by adding the following lines to /etc/sysctl.conf:

    kernel.msgmni = 1024
    kernel.sem = 250 256000 32 1024

    Run the following command to apply the new settings:

    sysctl -p
  5. Create a DB2 user instance

    An instance is a single DB2 database manager running under a specific Unix username. Each instance may contain one or more databases. Perform the following command to create an instance for user ldasdb:

    /opt/IBM/db2/V8.1/instance/db2icrt -s ese -u ldasdb ldasdb
  6. Configure the database manager parameters

    It is no longer necessary to be logged in as root. Perform the following commands as user ldasdb:

    db2set DB2COMM=TCPIP
    db2set DB2AUTOSTART=YES
    db2 'update database manager configuration using svcename 50002'
    db2 'update database manager configuration using diaglevel 4'
    db2 'update database manager configuration using query_heap_sz 40000'
    db2 terminate
    db2start
  7. Validate the installation (optional)

    Log in as ldasdb and run the following command to create a sample database. This can take a few minutes to process. There is no completion message; when the shell prompt returns, the process is complete.

    db2sampl

    Enter the following commands to connect to the sample database, retrieve a list of all the employees that work in department 20, and reset the database connection.

    db2 connect to sample
    db2 "select * from staff where dept = 20"
    db2 connect reset

    The query above should return the following information:

    ID NAME DEPT JOB YEARS SALARY COMM ------ --------- ------ ----- ------ --------- --------- 10 Sanders 20 Mgr 7 18357.50 - 20 Pernal 20 Sales 8 18171.25 612.45 80 James 20 Clerk - 13504.60 128.20 190 Sneider 20 Clerk 8 14252.75 126.50 4 record(s) selected.

    After you have verified the installation, remove the sample database.

    db2 drop database sample
  8. Additional DB2 Information

LDCG Tools

In order to build and run successfully, LDAS relies on various third-party software packages. To build these packages, login as user install. Follow the instructions on building the software packages used by LDAS.

Two additional packages must be built in order to run wrapperAPI jobs in LDAS. The DB2 include files and libraries must also be copied to the LDCG directory.

  1. LAL 3.0

    tar xzf lal-3.0.tar.gz
    cd lal-3.0
    mkdir `uname`-`uname -m`
    cd `uname`-`uname -m`
    ../configure --prefix=/lal --disable-frame --enable-mpi --enable-shared --disable-static --disable-debug '--with-extra-cflags=-O4 -ansi -fexceptions' --with-extra-cppflags=-I/ldcg/include --with-extra-ldflags=-L/ldcg/lib
    make
    make check
    make dvi
    make install prefix=/lal/stow_pkgs/lal-3.0
    cd /lal/stow_pkgs
    stow lal-3.0
  2. LAL Wrapper 3.0

    tar xzf lalwrapper-3.0.tar.gz
    cd lalwrapper-3.0
    ./configure --prefix=/lal --enable-shared --disable-static --disable-debug '--with-extra-cppflags=-I/lal/include -I/ldcg/include' '--with-extra-ldflags=-L/lal/lib -L/ldcg/lib' --with-extra-cflags=-O4
    make
    make check
    make dvi
    make install prefix=/lal/stow_pkgs/lalwrapper-3.0
    cd /lal/stow_pkgs
    stow lalwrapper-3.0
  3. IBM DB2 8.1

    cd /ldcg/stow_pkgs
    mkdir -p IBMdb2-8.1.5/IBMdb2
    cp -rp /opt/IBM/db2/V8.1/include IBMdb2-8.1.5/IBMdb2
    cp -rp /opt/IBM/db2/V8.1/lib IBMdb2-8.1.5/IBMdb2
    stow IBMdb2-8.1.5

LDAS 1.16.3

To build LDAS, login as user install. Follow the instructions on retrieving the LDAS source code and view the build options for building LDAS. Before you begin the build process, it is a good idea to shutdown any currently running LDAS system. Also, unstow any previously installed LDAS software and rename the installation directory if you are rebuilding the same version. If this is the first time you are building LDAS on this machine, you can skip the following example.

cd /ldas/stow_pkgs
stow -D ldas-1.16.3
mv&nbps;ldas-1.16.3 ldas-1.16.3.old

To build and install the LDAS source code, perform the following commands.

Note: The LDAS installation no longer supports changing the prefix at install time by specifying the prefix= option on the make install command line. LDAS will always be installed in the subdirectory stow_pkgs/ldas-1.16.3 relative to the value given to the --prefix= option specified on the build_ldas command line.

tar xzf ldas-1.16.3.tar.gz
cd ldas-1.16.3
./build-ldas --prefix=/ldas --with-odbc-dm=DB2
cd `uname`-`uname -m`
make install
cd /ldas/stow_pkgs
stow ldas-1.16.3

LDAS Databases

The following commands are condensed from a more detailed document on creating LDAS databases. That document is written in the context of a distributed/networked LDAS installation. Some of the information may not apply to a stand-alone environment. To create an LDAS database, perform the following commands as user ldasdb. Replace any occurrence of ldas_tst with your choice of a database name.

cd /ldas/doc/db2/doc/text
db2 'create database ldas_tst on /usr1/databases alias ldas_tst'
./createall ldas_tst

LDAS Configuration

To configure LDAS for stand-alone operation, perform the following commands as user ldas.

mkdir -p /ldas_outgoing/frames
mkdir -p /ldas_outgoing/mpiAPI
mkdir -p /ldas_outgoing/cntlmonAPI
mkdir -p /ldas_outgoing/metadataAPI
mkdir -p /ldas_outgoing/diskcacheAPI
cp /ldas/bin/LDASapi.rsc /ldas_outgoing
cp /ldas/bin/LDASdb2utils.rsc /ldas_outgoing/cntlmonAPI
cp /ldas/lib/mpiAPI/LDASmpi.rsc /ldas_outgoing/mpiAPI
cp /ldas/lib/cntlmonAPI/LDAScntlmon.rsc /ldas_outgoing/cntlmonAPI
cp /ldas/lib/diskcacheAPI/LDASdiskcache.rsc /ldas_outgoing/diskcacheAPI

To link the database to LDAS, perform the following commands. The dbDsnames utility will display a dialog box where you provide the passwords for the database users. This will create the file LDASdsnames.ini which contains the encoded passwords.

cd /ldas_outgoing/metadataAPI
/ldas/bin/dbDsnames

Examine the LDASdsnames.ini file and verify that it contains the proper list of available databases. Remove any references to a database you do not wish to expose to the LDAS system.

Modify each of the following resource files accordingly.

/ldas_outgoing/LDASapi.rsc

/ldas_outgoing/diskcacheAPI/LDASdiskcache.rsc

/ldas_outgoing/mpiAPI/LDASmpi.rsc

/ldas_outgoing/cntlmonAPI/LDAScntlmon.rsc

/ldas_outgoing/cntlmonAPI/LDASdb2utils.rsc

SSH Configuration

LDAS uses an ssh-agent to authenticate the communication between APIs, and when running wrapper jobs in the search user accounts. To configure SSH for the ldas account, run the following commands as user ldas. Accept the default name and path for the file in which to save the key when prompted by ssh-keygen (/usr1/ldas/.ssh/id_rsa). For security reasons, it is important to provide a non-blank passphrase when prompted by ssh-keygen. Remember the passphrase as you will need it when starting LDAS.

ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

To complete the SSH configuration, perform a 'loopback' ssh connection to the stand-alone machine.

ssh ldas@hostname

If a message like the following is displayed, answer 'yes' at the prompt. This will add the hostname to the ~/.ssh/known_hosts file. This message, which can interfere with LDAS communications, will not be displayed in the future.

The authenticity of host 'xxxx (123.456.789.00)' can't be establihed.
DSA key fingerprint is 0a:1b:2c:3d:4e:5f:6a:7b:8c:9d:ae:bf:ca:db:ec:fd.
Are you sure you want to continue connecting (yes/no)?

Continue to hit the <Enter> key until the shell prompt comes back. (Disregard all the password prompts.)

To configure SSH for the search users, the public key of the ldas account must be added to the authorized_keys file of each search user. Login as the root user and perform the following commands. Adjust the value of the max variable to match what was used when creating the search user accounts above (in the User Accounts section).

N=1
max=16
while test $N -le $max; do
   test $N -lt 10 && N="0$N"
   mkdir /usr1/search$N/.ssh
   cat /usr1/ldas/.ssh/id_rsa.pub >>/usr1/search$N/.ssh/authorized_keys
   chown search$N:ldas /usr1/search$N/.ssh
   chown search$N:ldas /usr1/search$N/.ssh/authorized_keys
   chmod 700 /usr1/search$N/.ssh
   chmod 600 /usr1/search$N/.ssh/authorized_keys
   N=`expr $N + 1`
done

Starting the LDAS System

To start the LDAS system, perform the following command as user ldas. The MGRKEY is a password key which the managerAPI will use to authenticate commands (like shutting down LDAS, or restarting APIs). Provide any alpha-numeric string for this key.

cd /ldas_outgoing
/ldas/bin/runLDAS MGRKEY

The runLDAS command will try to connect to an already running ssh-agent. Otherwise, it will start a new ssh-agent and will prompt you for the passphrase you provided during ssh configuration.

While LDAS is starting, it writes log information to two sets of files, which can be monitored. The first set is the api.log files found in /ldas_outgoing/apiAPI directories. These files are the stdout and stderr of the APIs. Make sure there are no error messages in any of the files.

The second set is the LDASapi.log.html and APIstatus.html files found in /ldas_outgoing/logs. These files can be viewed with any Web browser. (If the http server was configured correctly above, these log files can also be viewed remotely.) They contain continuing information about the APIs and the jobs that are running. They should be monitored on a regular basis.

General information about configuring/starting LDAS is available in another document. Be aware that the information in that document is for running LDAS in a distributed/networked environment. Some of the information may not apply in a stand-alone environment.

Stopping the LDAS System

Telnet to the managerAPI's emergency port on the stand-alone machine. The emergency port is two ports higher than the value of BASEPORT in the LDASapi.rsc file. For example, if BASEPORT is set to 12000, telnet to port 12002. Then type the following command at the telnet prompt. MGRKEY is the key you provided on the command line when starting LDAS; username and password are the name and password of a control user included in the control_group list specified in the /ldas_outgoing/LDASapi.rsc file.

MGRKEY username password mgr::sHuTdOwN

Isaac Salzman