Posted also on ac.csci.a348:

Here are a few things to remember when you try to finish assignment 1 in time for Friday's deadline:

1. Log into the burrow machine that has been assigned to you.

If you have been assigned tucotuco please telnet into it, not into burrow. The burrows machines share file space but they each have a different CPU so here's what can happen when you telnet 'carelessly' into burrow instead of the host that has been assigned to you. This is a true story. :-)

DingHong Chen (dchen, bandicoot:19800) logs into burrow and receives a whistlepig prompt. He installs its server, starts it, and logs out. He checks to see if his server on bandicoot:19800 is running and he doesn't get a response. He logs into burrow a few more times and gets a bandicoot prompt eventually. He starts the server again. Now the httpd.pid file has the pid of his server on the last machine he used to start his server, that is, bandicoot but his server on whistlepig is running, using port 19800.

Enter Jason Miller (jastmill, whistlepig:19800) who had already managed to start his server on whistlepig, but for some reason had his server stopped when DingHong started his server on whistlepig. Jason can't start his server now because the port is taken. So we mail DingHong and ask him to stop his server on whistlepig so that Jason can use it. But the httpd.pid in the logs directory in DingHong's account had the pid for the server that was running on bandicoot so he can't use the start/stop method described in the notes.

Now we need to have DingHong login into whistlepig, and use the following command: ps -ef | grep httpd | grep dchen to find out the pid's of those processes that his server started and kill them.

But you have to be careful what processes you kill. If you don't kill the right one, the ones you're trying to get rid of will come back, alive, as in a re-run of 'The Night of the Living Dead'. So what do we do?

To make sure that you're killing the parent httpd process you should look for the httpd with the lowest process id and a parent process id of 1. So we use ps and grep for the process id of the httpd server owned by dchen and our woes are history.

The moral is: telnet into the machine that you have been assigned, for any kind of work you need to do on your server. I think the instructions had this note with them, but they may have not seem very persuasive. But, all's well when it ends well. Caveat emptor.

If you're having trouble starting your server make sure you're logged into your assigned host. Ports in use by A348/A548 are 19800, 19801, 19802, and a few 19803, distributed over the entire set of machines. If you don't log into your host you may be trying to use someone else's host/port assignments. Also, to make sure that you get proper credit for this assignment please change your welcome page (htdocs/index.html) into something which displays your name as well.

2. Be careful when you modify the configuration files.

There are only two changes you need to make to each one of the three configuration files, for a total of six changes, but you can't make any typos or mistakes. Here's a diff on the configuration files as they should look for a properly installed server, with the distribution templates, to help you troubleshoot the finer points of your installation. Please note that this note assumes username=dgerman, hostname=tucotuco, port=19800.

httpd.conf, that controls how the server starts up:

tucotuco.cs.indiana.edu% diff httpd.conf httpd.conf-dist
32c32
< Port 19800
---
> Port 80
66c66
< ServerRoot /u/dgerman/httpd  
---
> ServerRoot @@ServerRoot@@
127c127
< LockFile /tmp/apache.lockfile.dgerman
---
> #LockFile logs/accept.lock
tucotuco.cs.indiana.edu% 
srm.conf, that controls how the server runs:
tucotuco.cs.indiana.edu% diff srm.conf srm.conf-dist
15c15
< DocumentRoot /u/dgerman/httpd/htdocs
---
> DocumentRoot @@ServerRoot@@/htdocs
148c148
< ScriptAlias /cgi-bin/ /u/dgerman/httpd/cgi-bin/
---
> #ScriptAlias /cgi-bin/ @@ServerRoot@@/cgi-bin/
tucotuco.cs.indiana.edu%
access.conf that coordinates access to your web site files to users:
tucotuco.cs.indiana.edu% diff srm.conf srm.conf-dist
15c15
< DocumentRoot /u/dgerman/httpd/htdocs
---
> DocumentRoot @@ServerRoot@@/htdocs
148c148
< ScriptAlias /cgi-bin/ /u/dgerman/httpd/cgi-bin/
---
> #ScriptAlias /cgi-bin/ @@ServerRoot@@/cgi-bin/
tucotuco.cs.indiana.edu%
So you basically can see what you need to change, and into what.

Configuration files have been covered in class but description was pretty general. The textbook has more details (chapter 3, the Apache section that starts on page 68) and we will cover them later, again.

3. The hello script was tricky in some points.

The reason is that each document served by a web server needs to have a type. We have discussed this in Thursday's lecture and we mentioned that the safest way to write the hello script would be like this:

#!/usr/local/bin/perl
print qq{Content-type: text/html\n\n<html><head>
<title>Hello</title></head><body>
<h1>Hello Web-Wide World!</h1></body></html> 
}; 
Put the script in your cgi-bin directory and make it executable and if your configuration files are OK you should be done with it.

For trouble shooting hints don't forget to check your error_log.

4. A few students have asked about running java on the burrow cluster. It's really quite easy and you don't need to install any compiler. Here's what you need to do to run the simplest Java application:

tucotuco.cs.indiana.edu% vi Hello.java
tucotuco.cs.indiana.edu% cat Hello.java
class Hello { 
  public static void main (String[] args) {
    System.out.println("I can compile and run a Java program"); 
  }
}
tucotuco.cs.indiana.edu% javac Hello.java
tucotuco.cs.indiana.edu% ls Hello*
Hello.class  Hello.java
tucotuco.cs.indiana.edu% java Hello
I can compile and run a Java program
tucotuco.cs.indiana.edu% 
Let me know if you have more questions.

... Adrian