You will get the exams back on Wed. 

You need to review the answers posted:

http://silo.cs.indiana.edu:8346/c212/spr2013/eeesols.phps

This one is posted under Feb 1 under What's New?

The Study Guide for this exam was:

http://www.cs.indiana.edu/classes/c212-dgerman/spr2013/earlyeval.html

Also the Midterm Study Guide:

http://www.cs.indiana.edu/classes/c212-dgerman/spr2013/midterm.html

Now let's install Tomcat. 

Connect to silo. 

Check what ports you've been assigned.

I am amgates and I have assigned 18714 and 18715.

I start by copying the software (Tomcat 7):

cp /l/www/classes/a348/spr2013/software/apache-tomcat-7.0.35.tar.gz .

This copies the archive (look how long the path to it is)
            into the current folder (dot, be careful where you are). 

Then run gunzip and then tar xvf on the result to: 

  (a) uncompress and then 
  (b) unarchive the file

Server software is unpacked now, ready to be installed. 

Move into the newly created folder.

Look at the folders you have there: 

(a) conf is a folder where a server.xml needs to be set up.
This file will have the port numbers that are yours and only yours. 

(b) You also need to set up three environment variables. 
This really has nothing to do with these folders here. 
Except that this folder here is the value of one of those variables. 

And you do this by writing something in a special file somewhere.

Let's first set up server.xml in conf:

[amgates@silo conf]$ pwd
/u/amgates/apache-tomcat-7.0.35/conf
[amgates@silo conf]$ cat server.xml
<Server port="18715" shutdown="SHUTDOWN">

  <GlobalNamingResources>
    <!-- Used by Manager webapp -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
       description="User database that can be updated and saved"
           factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
          pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>

  <Service name="Catalina">
    <Connector port="18714" />

    <Engine name="Catalina" defaultHost="localhost">
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase" />
      <Host name="localhost" appBase="webapps" />
    </Engine>

  </Service>
</Server>
[amgates@silo conf]$

Next I need to create three environment variables:

[amgates@silo conf]$ cd
[amgates@silo ~]$ ls -ld ~/.bash_profile
-rw------- 1 amgates students 457 Jan  7 14:36 /u/amgates/.bash_profile
[amgates@silo ~]$ pico -w ~/.bash_profile
[amgates@silo ~]$ cat ~/.bash_profile
#
# .profile - This file is envoked by bourne-shell variants (including
#            bash) on login.

# Get the aliases and functions from your .bashrc
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# Add to your PATH, if needed.  You are encouraged to add to the end of
# the path.  This adds your bin directory to your path.
PATH="${PATH}:$HOME/bin"
export PATH

# Set the default editor you prefer
#EDITOR=emacs
#EDITOR=vim
EDITOR=pico
export EDITOR

JAVA_HOME=/usr/lib/jvm/java-1.6.0-sun.x86_64
export JAVA_HOME

CATALINA_HOME=/u/amgates/apache-tomcat-7.0.35
export CATALINA_HOME

CLASSPATH=.:$CATALINA_HOME/lib/servlet-api.jar
export CLASSPATH
[amgates@silo ~]$

Now I have them in a file but they're not active.

So I simulate the logging in:

[amgates@silo ~]$ echo $JAVA_HOME

[amgates@silo ~]$ source ~/.bash_profile
[amgates@silo ~]$ echo $JAVA_HOME
/usr/lib/jvm/java-1.6.0-sun.x86_64
[amgates@silo ~]$ echo $CATALINA_HOME
/u/amgates/apache-tomcat-7.0.35
[amgates@silo ~]$ echo $CLASSPATH
.:/u/amgates/apache-tomcat-7.0.35/lib/servlet-api.jar
[amgates@silo ~]$

Now I can start the server. 

Before I start it I want to make sure my ports are not taken:

[amgates@silo ~]$ netstat -a | grep 8346
tcp        0      0 *:8346                      *:*                         LISTEN
[amgates@silo ~]$ netstat -a | grep 18714
[amgates@silo ~]$ netstat -a | grep 18715
[amgates@silo ~]$

So I can now start the server:

[amgates@silo ~]$ ps -ef | grep amgates
root     13893 25259  0 09:32 ?        00:00:00 sshd: amgates [priv]
amgates  13915 13893  0 09:33 ?        00:00:00 sshd: amgates@pts/32
amgates  13916 13915  0 09:33 pts/32   00:00:00 -bash
amgates  20216 13916  4 10:41 pts/32   00:00:00 ps -ef
amgates  20217 13916  0 10:41 pts/32   00:00:00 grep amgates
[amgates@silo ~]$


So noticing that it isn't running I start it: 

[amgates@silo ~]$ $CATALINA_HOME/bin/startup.sh
Using CATALINA_BASE:   /u/amgates/apache-tomcat-7.0.35
Using CATALINA_HOME:   /u/amgates/apache-tomcat-7.0.35
Using CATALINA_TMPDIR: /u/amgates/apache-tomcat-7.0.35/temp
Using JRE_HOME:        /usr/lib/jvm/java-1.6.0-sun.x86_64
Using CLASSPATH:       /u/amgates/apache-tomcat-7.0.35/bin/bootstrap.jar:/u/amgates/apache-tomcat-7.0.35/bin/tomcat-juli.jar
[amgates@silo ~]$

So now I check online:

http://silo.cs.indiana.edu:17814

I also can check locally: 

[amgates@silo ~]$ ps -ef | grep amgates
root     13893 25259  0 09:32 ?        00:00:00 sshd: amgates [priv]
amgates  13915 13893  0 09:33 ?        00:00:00 sshd: amgates@pts/32
amgates  13916 13915  0 09:33 pts/32   00:00:00 -bash
amgates  20251     1 10 10:42 pts/32   00:00:06 /usr/lib/jvm/java-1.6.0-sun.x86_64/bin/java -Djava.util.logging.config.file=/u/amgates/apache-tomcat-7.0.35/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/u/amgates/apache-tomcat-7.0.35/endorsed -classpath /u/amgates/apache-tomcat-7.0.35/bin/bootstrap.jar:/u/amgates/apache-tomcat-7.0.35/bin/tomcat-juli.jar -Dcatalina.base=/u/amgates/apache-tomcat-7.0.35 -Dcatalina.home=/u/amgates/apache-tomcat-7.0.35 -Djava.io.tmpdir=/u/amgates/apache-tomcat-7.0.35/temp org.apache.catalina.startup.Bootstrap start
amgates  20318 13916  0 10:43 pts/32   00:00:00 ps -ef
amgates  20319 13916  0 10:43 pts/32   00:00:00 grep amgates
[amgates@silo ~]$


I stop it now:

[amgates@silo ~]$ $CATALINA_HOME/bin/shutdown.sh
Using CATALINA_BASE:   /u/amgates/apache-tomcat-7.0.35
Using CATALINA_HOME:   /u/amgates/apache-tomcat-7.0.35
Using CATALINA_TMPDIR: /u/amgates/apache-tomcat-7.0.35/temp
Using JRE_HOME:        /usr/lib/jvm/java-1.6.0-sun.x86_64
Using CLASSPATH:       /u/amgates/apache-tomcat-7.0.35/bin/bootstrap.jar:/u/amgates/apache-tomcat-7.0.35/bin/tomcat-juli.jar
[amgates@silo ~]$

I check online and it doesn't run/respond anymore.

--