These instructions cover the installation of the Ubuntu Linux 8.04 operating system and WeBWorK 2.4 from scratch.

These instructions cover the installation of the Ubuntu Linux 8.04 operating system and WeBWorK 2.4 from scratch.

Line 61:

Line 70:

# On the <code>Partition disks</code> page use <code>&lt;Tab&gt;</code> to select <code>Go Back</code> and then select <code>Partition disks</code>

# On the <code>Partition disks</code> page use <code>&lt;Tab&gt;</code> to select <code>Go Back</code> and then select <code>Partition disks</code>

# Use the down arrow to select your disk (<code>sda</code>)

# Use the down arrow to select your disk (<code>sda</code>)

−

# On the <code>You have selected an entire device to partition...</code> page select <code>Yes</code> to the question <code>Create new empty partition tale on this device</code>

+

# On the <code>You have selected an entire device to partition...</code> page select <code>Yes</code> to the question <code>Create new empty partition table on this device</code>

# On the <code>This is an overview...</code> page select <code>FREE SPACE</code>

# On the <code>This is an overview...</code> page select <code>FREE SPACE</code>

# On the <code>How to use this free space</code> page select <code>Create a new partition</code>

# On the <code>How to use this free space</code> page select <code>Create a new partition</code>

Line 211:

Line 220:

# Select <code>System</code>, <code>Administration</code> and then <code>Synaptic Package Manager</code>. You will have to enter the <code>&lt;your password&gt;</code>. The <code>Synaptic Package Manager</code> window will open

# Select <code>System</code>, <code>Administration</code> and then <code>Synaptic Package Manager</code>. You will have to enter the <code>&lt;your password&gt;</code>. The <code>Synaptic Package Manager</code> window will open

+

# Click on <code>Reload</code> to bring the package information up to date

Now we will actually select and install a large number of packages. The process is the same for all packages. I'll give an example of installing <code>libnet-ldap-perl</code> and then just give the list of required packages.

Now we will actually select and install a large number of packages. The process is the same for all packages. I'll give an example of installing <code>libnet-ldap-perl</code> and then just give the list of required packages.

Line 226:

Line 236:

# <code>cvs</code>

# <code>cvs</code>

# <code>dvipng</code>

# <code>dvipng</code>

+

# <code>gcc</code>

# <code>libapache2-request-perl</code>

# <code>libapache2-request-perl</code>

# <code>libdatetime-perl</code>

# <code>libdatetime-perl</code>

Line 235:

Line 246:

# <code>libnet-ldap-perl</code>

# <code>libnet-ldap-perl</code>

# <code>libossp-uuid-perl</code>

# <code>libossp-uuid-perl</code>

+

# <code>libsql-abstract-perl</code>

# <code>libstring-shellquote-perl</code>

# <code>libstring-shellquote-perl</code>

# <code>libtimedate-perl</code>

# <code>libtimedate-perl</code>

# <code>libxml-parser-perl</code>

# <code>libxml-parser-perl</code>

# <code>libxml-writer-perl</code>

# <code>libxml-writer-perl</code>

+

# <code>make</code>

# <code>mysql-server-5.0</code>

# <code>mysql-server-5.0</code>

# <code>netpbm</code>

# <code>netpbm</code>

Line 245:

Line 258:

# <code>tetex-bin</code>

# <code>tetex-bin</code>

# <code>tetex-extra</code>

# <code>tetex-extra</code>

+

# <code>unzip</code>

When I do this I see on the bottom of <code>Synaptic Package Manager</code> window <code>82 to install/upgrade</code>, <code>1 to remove</code>. Your numbers may differ slightly.

When I do this I see on the bottom of <code>Synaptic Package Manager</code> window <code>82 to install/upgrade</code>, <code>1 to remove</code>. Your numbers may differ slightly.

Line 251:

Line 265:

That completes the set up of your base Ubuntu system. You can quit the <code>Synaptic Package Manager</code>.

That completes the set up of your base Ubuntu system. You can quit the <code>Synaptic Package Manager</code>.

+

+

+

If you would prefer to install all of these packages in one fell swoop, run this command as root:

The first download gives you the latest released version with patches (don't be misled by the <code>dev</code> extension --- this is not a development version).

+

The first download gives you the latest released version with patches.

−

The second download contains the WeBWorK National Problem Library. This now includes the Rochester and Union Libraries along with others as sunlibraries. There is quite a bit of overlap between these libraries but now you system is loaded with many thousands of WeBWorK problems (over 13,000 in the National Problem Library main collection alone).

+

The second download contains the WeBWorK National Problem Library. This now includes the Rochester and Union Libraries along with others as sub libraries. Your system will be loaded with many thousands of WeBWorK problems (over 16,000 currently).

== Installing WeBWorK ==

== Installing WeBWorK ==

Line 615:

Line 658:

# mkdir /opt/webwork/courses

# mkdir /opt/webwork/courses

# mkdir /opt/webwork/libraries

# mkdir /opt/webwork/libraries

−

# mv database_problems/ /opt/webwork/libraries/

+

# mv NationalProblemLibrary /opt/webwork/libraries/

# cd /opt/webwork/webwork2/courses.dist

# cd /opt/webwork/webwork2/courses.dist

# cp *.lst /opt/webwork/courses/

# cp *.lst /opt/webwork/courses/

Line 622:

Line 665:

=== Setting Permissions ===

=== Setting Permissions ===

−

The PG installation directory and files should be owned by root and not writeable by other users:

+

The PG installation directory and files should be owned by root and not writable by other users:

# cd /opt/webwork/pg

# cd /opt/webwork/pg

Line 628:

Line 671:

# chmod -R u+rwX,go+rX .

# chmod -R u+rwX,go+rX .

−

Most WeBWorK directories and files should also be owned by root and not writeable by other users:

+

Most WeBWorK directories and files should also be owned by root and not writable by other users:

# cd /opt/webwork/webwork2

# cd /opt/webwork/webwork2

Line 648:

Line 691:

now is a good time to add them. And remember to add them to the <code>wwdata</code> group as above.

now is a good time to add them. And remember to add them to the <code>wwdata</code> group as above.

−

Because system users aer not shown by default, we can not simply use the <code>Group Manager</code> to add the Apache2 webserver (which runs as <code>www-data</code>) to the <code>wwdata</code>

+

Because system users are not shown by default, we can not simply use the <code>Group Manager</code> to add the Apache2 webserver (which runs as <code>www-data</code>) to the <code>wwdata</code>

Scroll up and look through the listing. It should find everything except <code>PHP::Serialization</code>, <code>SOAP::Lite, and </code> <code>XMLRPC::Lite</code> which are only required if you plan to use WeBWorK with Moodle and <code>tth</code> which is a deprecated display mode. If something is missing (flagged by <code>**</code>), look back through these instructions to find where it should have been installed and install it.

+

Scroll up and look through the listing. It should find everything except <code>PHP::Serialization</code>, <code>SOAP::Lite</code>, <code>MIME::Parser</code> and <code>XMLRPC::Lite</code> which are only required if you plan to use WeBWorK with Moodle and <code>tth</code> which is a deprecated display mode. If something is missing (flagged by <code>**</code>), look back through these instructions and/or look at to find where it should have been installed and install it. Note you may have to search in [[Installation Manual for 2.4]] to find out what package it is contained in.

== Configuring WeBWorK ==

== Configuring WeBWorK ==

Line 747:

Line 790:

At this point <code>TtH</code> is a deprecated display mode which we didn't install so we have to remove it from the listof possible display modes.

At this point <code>TtH</code> is a deprecated display mode which we didn't install so we have to remove it from the listof possible display modes.

−

# Search for <code>formattedText</code> and comment out the line = "formattedText", # format math expressions using TtH=

+

# Search for <code>formattedText</code> and comment out the line <code>"formattedText", # format math expressions using TtH</code>

so it becomes

so it becomes

# "formattedText", # format math expressions using TtH

# "formattedText", # format math expressions using TtH

−

We need to set a password that WeBWorK uses when it communicates with the MySQL database.

+

We need to set a password that WeBWorK uses when it communicates with the MySQL database. Note that this is not the same as the <code>&lt;mysql root password&gt;</code> which is the password the MySQL root user uses.

Next we will make a few changes to Apache's default configuration. First we backup the configuration file

+

+

# cd /etc/apache2/

+

# cp apache2.conf apache2.conf.bak1

+

# gedit apache2.conf

+

+

Search for the line

+

Timeout 300

+

and replace it by

+

Timeout 1200

+

Next seach for the lines

+

MaxClients 150

+

MaxRequestsPerChild 0

+

Which occur under <code><IfModule mpm_prefork_module></code> and replace them by

+

# For WeBWorK a rough rule of thumb is 20 MaxClients per 1 GB of memory

+

MaxClients 20

+

MaxRequestsPerChild 100

+

where you should set <code>MaxClients</code> depending on the amount of memory your server has.

+

+

Then save the file and quit.

+

+

+

Now restart Apache

# apache2ctl graceful

# apache2ctl graceful

Line 887:

Line 952:

To hide a course place a file named <code>hide_directory</code> in the course directory and it will not show up in the courses list on the WeBWorK home page. It will still appear in the Course Administration listing. If you do this you will still be able to access the <code>admin</code> course using the URL <code>http://yourserver.yourschool.edu/webwork2/admin</code> but you will not see a link for it on the WeBWorK home page <code>http://yourserver.yourschool.edu/webwork2</code> . Let's hide the <code>admin</code> course.

To hide a course place a file named <code>hide_directory</code> in the course directory and it will not show up in the courses list on the WeBWorK home page. It will still appear in the Course Administration listing. If you do this you will still be able to access the <code>admin</code> course using the URL <code>http://yourserver.yourschool.edu/webwork2/admin</code> but you will not see a link for it on the WeBWorK home page <code>http://yourserver.yourschool.edu/webwork2</code> . Let's hide the <code>admin</code> course.

Now you don't really have to put any verbiage in the file but I suggest you put:

−

−

Place a file named "hide_directory" in a course or other directory

−

and it will not show up in the courses list on the WeBWorK home page.

−

It will still appear in the Course Administration listing.

−

−

Save the file and quit. Now copy the file to the <code>admin</code> course.

−

−

$ sudo cp hide_directory /opt/webwork/courses/admin

−

password:<your password>

Now goto <code>http://yourserver.yourschool.edu/webwork2</code> and no course will be listed.

Now goto <code>http://yourserver.yourschool.edu/webwork2</code> and no course will be listed.

−

== Starting and Stoping Apache, MySQL and the GNOME desktop GUI ==

+

== Starting and Stopping Apache, MySQL and the GNOME desktop GUI ==

−

If you make changes to the system, you will have to restart <code>apache2</code> before the changes take effect. On rare ocassions you may need to restart <code>MySQL</code>.

+

If you make changes to the system, you will have to restart <code>apache2</code> before the changes take effect. On rare occasions you may need to restart <code>MySQL</code>.

−

=== Starting and Stoping Apache ===

+

=== Starting and Stopping Apache ===

You have to run these commands as <code>root</code>.

You have to run these commands as <code>root</code>.

Line 931:

Line 986:

Note that in an earlier version of Ubuntu I found using the GUI interface somewhat unreliable.

Note that in an earlier version of Ubuntu I found using the GUI interface somewhat unreliable.

−

=== Starting and Stoping MySQL ===

+

=== Starting and Stopping MySQL ===

You have to run these commands as <code>root</code>.

You have to run these commands as <code>root</code>.

Line 974:

Line 1,029:

===Install the National Problem Library ===

===Install the National Problem Library ===

−

The <code>National Problem Library</code> consists of both WeBWorK problems and methods for searching and selecting problems. Also it contains as sub libraries many of the other standard libraries. Normally this library is referred to as the <code>ProblemLibrary</code> but the downloaded CVS directory for it is named <code>database_problems</code>. So the first thing we do is to link <code>ProblemLibrary</code> to <code>database_problems</code>.

+

The <code>National Problem Library</code> consists of both WeBWorK problems and methods for searching and selecting problems. Also it contains as sub libraries many of the other standard libraries. We have to tell WeBWork where to find it.

We now create a database, called <code>ProblemLibrary</code>, for for the Problem Library.

+

Run the <code>NPL-update</code> script making sure you are in the <code>/opt/webwork/libraries/NationalProblemLibrary</code> directory. This directory contains the files <code>loadDB2</code> and <code>create_tables2.sql</code>.

−

To do this do the following:

+

−

+

−

$ mysql -u root -p mysql

+

−

Enter password: &lt;mysql root password&gt;

+

−

mysql> CREATE DATABASE ProblemLibrary;

+

−

mysql> GRANT SELECT ON ProblemLibrary.* TO webworkWrite@localhost;

+

−

mysql> exit

+

−

Bye

+

−

$

+

−

+

−

Update mysql

+

+

$ cd /opt/webwork/libraries/NationalProblemLibrary

$ NPL-update

$ NPL-update

−

This has to convert a lot of data so please be patient; it can take a long time.

+

This has to convert a lot of data (around 16900 files) so please be patient; it can take a long time.

If at some time in the future you want to upgrade the Problem Library, the process

If at some time in the future you want to upgrade the Problem Library, the process

If you want to put another library into the <code>modelCourse</code>, just do the analogous thing. If you just want the additional library in a particular course, add the link in the <code>templates</code> directory of that course.

+

If you want to put another library into the <code>modelCourse</code>, just do the analogous thing. If you just want the additional library in a particular course, add the link in the <code>templates</code> directory of that course. If you look in the directory <code>/opt/webwork/libraries/database_problems/</code> you might find other libraries that are not yet listed in <code>global.conf</code> (like <code>Union</code> above) and these can be added in the same way we added <code>Union</code>. Usually they do not require additional macros like <code>Union</code> did. Finally if you add a library with non standard symbols in the name (e.g. <code>uva-statLibrary</code>) you have to use single quotes when adding it to <code>global.conf</code>, e.g. <br>

Click on <code>Hmwk Sets Editor</code> on the <code>Main Menu</code>. Then select (by clicking the circle button) <code>Import</code>, select <code>setDemo.def</code> from the <code>from</code> drop down list and select <code>all current users</code> from the <code>assigning this set to</code> drop down list. Then hit <code>Take Action!</code>

Click on <code>Hmwk Sets Editor</code> on the <code>Main Menu</code>. Then select (by clicking the circle button) <code>Import</code>, select <code>setDemo.def</code> from the <code>from</code> drop down list and select <code>all current users</code> from the <code>assigning this set to</code> drop down list. Then hit <code>Take Action!</code>

−

Now click on <code>Homework Sets</code> on the <code>Main Menu</code> and click on <code>Demo</code>. Then look at the problems. Mathematical equations should be typeset. If not, edit the file <code>Constants.pm</code> in the directory <code>/opt/webwork/webwork2/lib/WeBWorK</code>. Change the line <code>$WeBWorK::PG::ImageGenerator::PreserveTempFiles = 0;</code> to <code>...::PreserveTempFiles = 1;</code>. Then restart Apache and view the first couple problems or some new ones. Then look in the directory <code>/opt/webwork/webwork2/tmp/</code>. <code>cd</code> to one of the <code>ImageGenerator.../tmp/</code> directories and look at the error and log files there. When you fix the problem remember to edit <code>...::PreserveTempFiles = 1;</code> back to 0 and restart Apache or you will be saving a lot of unnecessary files.

+

Now click on <code>Homework Sets</code> on the <code>Main Menu</code> and click on <code>Demo</code>. Then look at the problems. Mathematical equations should be typeset. If not, edit the file <code>Constants.pm</code> in the directory <code>/opt/webwork/webwork2/lib/WeBWorK</code>. Change the line <code>$WeBWorK::PG::ImageGenerator::PreserveTempFiles = 0;</code> to <code>...::PreserveTempFiles = 1;</code>. Then restart Apache and view the first couple problems or some new ones. Then look in the directory <code>/opt/webwork/webwork2/tmp/</code>. <code>cd</code> to one of the <code>ImageGenerator.../tmp/</code> directories and look at the error and log files there. When you fix the problem remember to edit <code>...::PreserveTempFiles = 1;</code> back to 0 and restart Apache or you will be saving a lot of unnecessary files. Another useful trick is to try downloading a hard copy of an assignment and then (assuming there are errors) looking at the various log files that are linked to on the output page.

When you continue looking at problems you will get an error when you try to look at Problem 6 because we have not configured the CAPA macros which are required to display CAPA problems. Unless you are teaching physics you probably don't need them. Also in Problem 9 the Java applet will not load. Problem 9 was written in the 90's and used an applet on a server at The Johns Hopkins University. The server went away a long time ago but have retained this problem for historical reasons and also because it is a example of several things (e.g. WeBWorK problems can include applets running on remote servers but this can lead to other problems).

When you continue looking at problems you will get an error when you try to look at Problem 6 because we have not configured the CAPA macros which are required to display CAPA problems. Unless you are teaching physics you probably don't need them. Also in Problem 9 the Java applet will not load. Problem 9 was written in the 90's and used an applet on a server at The Johns Hopkins University. The server went away a long time ago but have retained this problem for historical reasons and also because it is a example of several things (e.g. WeBWorK problems can include applets running on remote servers but this can lead to other problems).

Line 1,088:

Line 1,131:

If all the above tests work, you can be pretty confident that WeBWorK is working properly.

If all the above tests work, you can be pretty confident that WeBWorK is working properly.

+

+

Go back to <code>Hmwk Sets Editor</code> on the <code>Main Menu</code>. Then select (by clicking the circle button) <code>Import</code>, select <code>setOrientation.def</code> from the <code>from</code> drop down list and select <code>all current users</code> from the <code>assigning this set to</code> drop down list. Then hit <code>Take Action!</code>. Then go through the Orientation problems. This is a good first set to use for introducing students to WeBWorK.

If you are new to WeBWorK, you should probably add a regular student to myTestCourse and log in as that student to see what the student interface looks like. It's much simpler than the professor interface.

If you are new to WeBWorK, you should probably add a regular student to myTestCourse and log in as that student to see what the student interface looks like. It's much simpler than the professor interface.

Line 1,116:

Line 1,161:

# cd /opt/webwork/webwork2/conf

# cd /opt/webwork/webwork2/conf

−

# cp global.conf global.bak1

+

# cp global.conf global.conf.bak1

# gedit global.conf

# gedit global.conf

Line 1,172:

Line 1,217:

"mod_status",

"mod_status",

−

Search for the line

−

server.document-root = "/var/www/"

−

and under this line add the line

−

alias.url = ("/webwork2_files/" => "/opt/webwork/webwork2/htdocs/")

Apache2 is listening on port 80 so we set lighttp to listen on port 81. Find the line

Apache2 is listening on port 80 so we set lighttp to listen on port 81. Find the line

'''Optional C''' configures apache so that access to WeBWorK will be through an encrypted Secure Sockets Layer (SSL) with an https: URL. Note that if you implemented '''Optional B''', the non encrypted lighttp server will be used for images, etc but there is no harm in that.

+

'''Optional C''' configures apache so that access to WeBWorK will be through an encrypted Secure Sockets Layer (SSL) with an https: URL. Note that if you implemented '''Optional B''', the non encrypted lighttp server will be used for images, etc but there is no harm in that. These directions describe how to generate a self signed SSL Certificate but this will generate an initial browser warning message. You can purchase a commercial SSL Certificate from many sources, some for very reasonable rates (try googling "ssl certificate").

I cribbed these directions from several sources, the main one being http://www.akadia.com/services/ssh_test_certificate.html.

I cribbed these directions from several sources, the main one being http://www.akadia.com/services/ssh_test_certificate.html.

Line 1,261:

Line 1,296:

First we create an RSA Private Key.

First we create an RSA Private Key.

−

$openssl genrsa -des3 -out server.key 1024

+

$ openssl genrsa -des3 -out server.key 1024

When you are asked for a <code>pass phrase</code>, enter a phrase which we refer to as <code>&lt;my pass phrase&gt;</code> and then confirm it. Next generate a Certificate Signing Request

When you are asked for a <code>pass phrase</code>, enter a phrase which we refer to as <code>&lt;my pass phrase&gt;</code> and then confirm it. Next generate a Certificate Signing Request

−

openssl req -new -key server.key -out server.csr

+

$ openssl req -new -key server.key -out server.csr

Enter the requested information. '''Important:''' when you are prompted for the <code>Common Name</code> enter your server's fully qualified domain name, something like <code>yourserver.yourschool.edu</code>. You can leave the last two items

Enter the requested information. '''Important:''' when you are prompted for the <code>Common Name</code> enter your server's fully qualified domain name, something like <code>yourserver.yourschool.edu</code>. You can leave the last two items

Line 1,294:

Line 1,329:

Now we have to configure Apache to use SSL.

Now we have to configure Apache to use SSL.

−

# cd /etc/apache2/sites-enabled/

+

# cd /etc/apache2/sites-available/

# cp default default.bak1

# cp default default.bak1

# gedit default

# gedit default

Latest revision as of 14:25, 3 June 2013

This article has been retained as a historical document. It is not up-to-date and the formatting may be lacking. Use the information herein with caution.

This deprecated feature should no longer be used, but is still available for reasons of backwards compatibility.

This feature was deprecated in version 2.6. For up-to-date information view Github.

These instructions cover the installation of the Ubuntu Linux 8.04 operating system and WeBWorK 2.4 from scratch.

They are more detailed (but offer fewer choices and often less background information) than the general Installation Manual for 2.4 and are aimed at non unix experts. Readers may want to quickly scan Installation Manual for 2.4 to get an overview of the installation process and then carefully read and follow these instructions.

Notation

First some short comments on notation we will be using. We will use <key> to indicate that you should press a specific key (e.g. <Enter>, <Tab>, <F12>, etc.). Sometimes we will also use e.g. <root password> to indicate you have to enter the root password.

^ will indicate the <Ctrl> key so e.g. ^X is really shorthand for <Ctrl> <X>, i.e. press the Ctrl key and hit the X key.

We will give references to specific versions of software, e.g. httpd-2.2.4.tar.gz rather than the more general httpd-2.x.x.tar.gz. In most cases you should be able to use the latest stable version but we have only tested the versions listed.

Installing the Ubuntu 8.04 Linux Operating System

Installation CD

Obtain the Desktop Edition, Alternate installation DVD/CD set. Connect to http://www.ubuntu.com/ for information. On the download page http://www.ubuntu.com/getubuntu/download make sure you check the box for Check here if you need the alternate desktop CD. This CD does not include the Live CD, instead it uses a text-based installer. For example you can use wxDownload Fast or BitTorrent to download an ISO image of the installation CD and then burn your own installation CD. If you download the ISO image, make sure that you verify the integrity of the downloaded file by comparing the MD5 checksum of the downloaded file with the MD5 checksum listed at https://help.ubuntu.com/community/UbuntuHashes or at the download site (e.g. http://mirrors.kernel.org/ubuntu-releases/7.04/MD5SUMS). wxDownload Fast automatically calculates the MD5 checksums which is convenient. I have had good luck downloading from mirrors.kernel.org but your experience may differ. These instructions will assume you have the installation CD but installing from a commercial DVD/CD set or from the net should be essentially identical.

Place the installation CD in your DVD/CD drive and reboot your computer from the DVD drive. You may have to press <F12> during the boot process to bring up a boot menu which will allow you to select booting from the DVD. Or you many have to edit the BIOS to select the DVD as the first boot device.

First select English by just hitting <Enter>.

You will see a list of options.

If you want hit <F1> to obtain help and see additional boot methods

You can just hit <Enter> to accept the default install method except in the following situation

If your network has DHCP enabled but you want to setup your server with a static IP address, then hit <F6> and on the Boot OPtions line move the cursor before quiet -- and type netcfg/disable_dhcp=true , leave a space before quiet and then hit <Enter>

A succession of pages follow, for each select the obvious option and hit <Enter>. For example my obvious options are English, United States, <No>, USA and USA

The system will than scan your CD and load various components

If your system has multiple network interfaces, you will be asked to select the one to be used during the installation (which will usually be a hard wired ethernet connection)

Unless you entered the netcfg/disable_dhcp=true boot option above, the system will try to configure your network using DHCP. If you have DHCP, your network interface will be set up automatically. If you don't have DHCP, automatic network configuration will fail quickly (or just hit <Enter> to Cancel if you are impatient). Then hit <Enter> to Continue

Manual network configuration. If your network interface was set up automatically by DHCP, you can skip the rest of this paragraph. Otherwise you will have to enter your machine's static ip address, etc. To do this

Select Configure network manually

Enter your computer's IP address and use <Tab> to select Continue

The netask is probably OK as it but another possibility may be 255.255.0.0

Enter the ip address of your gateway router. Ubuntu makes a good guess at this, but your network may be set up differently.

Next enter the ip address(es) of up to 3 nameservers separated by spaces (at a minimum you have to enter the ip address one nameserver)

Enter the name of your server

Enter the domain name for the domain your server sits on (e.g. math.myschool.edu)

This completes the static ip address setup

Now select your time zone and wait for the clock to be configured

Optional Configurations

If you will have a large number of users (say over a 1,000) and/or a slow server, you may want to consider the first two optimizations. They are independent but related and deal with how WeBWorK handles various temporary and static files. We call these two options Optional A and Optional B. The third option, Optional C, gives greater security.

Optional A creates a separate partition on which are stored all of WeBWorK's "temporary" files. These are mostly small files such as png images of equations, pdf files, etc that may be reused but if they are not present (e.g. if they get deleted) they will be seamlessly regenerated on the fly. There is no reason to back up such files and having them in a separate partition means that it is easier and faster to back up other partitions and skip backing up unnecessary files.

Optional B installs and configures a lightweight webserver. Apache is a very standard and powerful webserver which we use to serve WeBWorK pages. However its child processes use a lot of resources (e.g. memory). When serving static files and images, a much lighter weight webserver can be used. This can substantially reduce the load on a heavily used server.

Optional C configures Apache so that access to WeBWorK will be through an encrypted Secure Sockets Layer (SSL) with an https: URL.

Except for creating a separate partition, we will wait until WeBWorK is installed and tested before implementing these options. We mention them here because the next step is partitioning the disks.

Partition disks

Next comes the Partition disks pages. You should be able to accept the defaults unless you want to follow Optional A and/or create separate partitions for various directories. There is a lot of information on the web if you don't want to accept the default partition set up. If you want to implement Optional A follow the directions below.

Optional A: The default partitioning scheme creates just two partitions, a root (/) partition and a swap partition. Here we will create those and an additional partition for WeBWorK's temporary files.

On the Partition disks page use <Tab> to select Go Back and then select Partition disks

Use the down arrow to select your disk (sda)

On the You have selected an entire device to partition... page select Yes to the question Create new empty partition table on this device

On the This is an overview... page select FREE SPACE

On the How to use this free space page select Create a new partition

Now you have to decide how to allocate your disk space. The rule of thumb is to use twice the amount of RAM you have for swap (e.g. 2 GB if you have 1 GB of RAM). For WeBWorK's temporary files 25 GB for every 1,000 students should be ample. You can allocate the remainder of your disk space to the root (/) partition. Actually if you are going through the trouble of doing this, you probably will want to research other partitioning recommendations.

On the The maximum size you can use... page enter the size for your root (/) partition and Continue

Select Primary for the type of the new partition

Select Beginning for the location of the new partition

Select / for the Mount point of the new partition and then select Done setting up the partition

Now we repeat the process for the partition which will hold WeBWorK's temporary files.

On the This is an overview... page select FREE SPACE

On the How to use this free space page select Create a new partition

On the The maximum size you can use... page enter the size for WeBWorK's temporary files partition. As we said 25 GB for every 1,000 students should be ample. Then Continue

Select Logical for the type of the new partition

Select Beginning for the location of the new partition

Select Mount point and then hit <Enter>

Select Enter manually and then hit <Enter>

For the Mount point for this partition enter /var/www/wwtmp and Continue

Then select Done setting up the partition

Finally we set up the swap partition

On the This is an overview... page select FREE SPACE

On the How to use this free space page select Create a new partition

On the The maximum size you can use... page enter the size for swap partition. As we said the rule of thumb is to use twice the amount of RAM you have. Then Continue

Select Logical for the type of the new partition

Select Beginning for the location of the new partition

Select Use as and then hit <Enter>

Select swap area and then hit <Enter>

Then select Done setting up the partition

Finally

Review your changes and

Select Finish partitioning and write changes to disk and then hit <Enter>

Select Yes to confirm the changes

Base Installation

Now the base installation takes place --- this takes a short time

Enter yourself as a user (with user name and password). Note this account will function partially as the root account so you might want to pick a different username and password than you regularly use.

You can probably leave the HTTP proxy information blank

Now sit back and relax while a lot of software is installed --- this takes awhile

The final step is to install the boot loader. I have a non standard setup and for some reason I had trouble installing the Grub boot loader but Lilo worked fine. Almost certainly, Grub will work fine for you

Continue Installation

After this finishes the system will eject the CD and ask you to reboot.

Log into your account

Accept any available updates. You may see a little notification icon (it has a arrow on it) to the right of your name in the upper right hand corner of the screen --- click on it. Alternately you can select System, Administration, Update Manager. Click install Updates. You may have to enter the <your password> which functions as the <root password> . Follow any instructions, e.g. you may be told to reboot as soon as the installation is completed (to reboot, select System, Quit and then Restart)

If something is wrong and you are not connected to the web, the first thing to do is check that you entered the correct network information.

Select System, Administration, Network

Click on Unlock

Enter <your password> and click Authenticate

Select Wired connection and click Properties

Check that all the entries are correct and edit them if they are not

Then click OK

Next click on DNS and check the name server entries and correct if necessary

Click on Close to close Network settings

Your network connection should start up almost immediately. If you are still having problems it's time to investigate further or seek help.

Here's an aside on keystroke delay and repetition rate. If you are like me and find the keystroke delay too short (so that you often type "geeet" when you want to type "get"), do the following. Click System, Preferences, Keyboard and then increase the delay time interval and hit Close.

Terminal Window Notation and Use

Before installing and configuring additional software, we need to talk about terminal windows.

To open a terminal window click Applications, Accessories and then select Terminal.

In a terminal window some commands will have to be run as root whereas
others should be run as a regular user. We will use # to indicate
that the command is to be run as root e.g.

# perl -MCPAN -e shell

and $ to indicate that the command is to be run as a normal user e.g.

$ cp .bashrc .bashrc.bak1

To execute the above commands you have to hit <Enter>. We'll just assume this.
After executing a command, often the system will respond with text (sometimes a lot of text!) which we will usually not repeat below. We only give the commands that you should execute.

The bash shell which you will be using has a number of very
convenient features.

One is command and file name completion. If you are typing (e.g.
ch) and hit <tab> bash will complete the command or filename if it is
unambiguous (or more precisely it will complete as much as possible).
If there are multiple possibilities (as in the case of ch) nothing will
happen (except you may hear a beep) and you can type more letter(s) and hit <tab> again. Or you can
hit <tab> a second time and you will see a list of all possible
completions. E.g. entering ch<tab><tab> gives a list of possible
completions and ch<tab>g<tab> (or chg<tab>) gives chgrp, the change group command. This
is very fast and convenient and it also leads to fewer typing errors.

Another useful shortcut is the command history. Using the up and down
arrow keys will bring up previous commands which can be edited and then
executed. If you are repeating a command or entering a command which
is similar to a previous one, this is very useful.

You can copy commands from these instructions (with copy from the Edit dropdown list or ^C) and paste them into a terminal window
(with paste from the Edit dropdown list or <Shift> <Ctrl> <V>). However typing yourself using command completion is probably just as fast except if a command is long.

By default Ubuntu has no password set for the root user. To gain root access you have to type in your own user password. This is the password you set for the first user while installing Ubuntu. However we will
manually set a password for the root user since this is a much more standard setup. To do this, type in the following in a terminal window:

$ sudo passwd
Password: <your password>

After that you are asked to type in the new root password twice. Enter the password for the root user and Do not forget what you enter here.

Finally perhaps a safer way to run commands as root is to use the sudo command

$ sudo <command>
Password: <your password>

After you enter the password the command is executed. For a certain period (maybe 5 minutes) you can execute additional sudo commands without reentering <your password>. A log of all sudo commands is kept (I don't know where). In these instructions for the most part we will not use sudo, but keep it in mind for other times that you have to become root in order to execute a few commands (e.g. restarting Apache).

Note that for certain GUI tools such as the Synaptic Package Manager that require root access, the password required is <your password>, the password for the first account you set up, not the new <root password>.

For our next terminal window task create a downloads directory where we will keep copies of downloaded software.

$ cd
$ mkdir downloads

Ubuntu Software Packages

Our next task is to install a number of Ubuntu software packages.

Select System, Administration and then Synaptic Package Manager. You will have to enter the <your password>. The Synaptic Package Manager window will open

Click on Reload to bring the package information up to date

Now we will actually select and install a large number of packages. The process is the same for all packages. I'll give an example of installing libnet-ldap-perl and then just give the list of required packages.

Select Search

Under Look in: select Name. The default Description and Name sometimes returns too many possibilities

We are searching for libnet-ldap-perl so enter ldap-perl (or something similar; you can copy and paste from this document if you want) and click on Search

This should result in 3 possibilities. Select and Mark for Installation (by double clicking or checking and then selecting Mark for Installation) libnet-ldap-perl. You will see a pop up window Mark additional required changes? and you should always click Mark to accept the requirements.

Follow this basic procedure for all the packages listed below

Here is the list of Debian packages that need to be installed. See Installation Manual for 2.4 for a short explanation of what most of these packages do.

apache2

apache2-mpm-prefork

cvs

dvipng

gcc

libapache2-request-perl

libdatetime-perl

libdbd-mysql-perl

libemail-address-perl

libextutils-xsbuilder-perl

libgd-gd2-perl

libmail-sender-perl

libnet-ldap-perl

libossp-uuid-perl

libsql-abstract-perl

libstring-shellquote-perl

libtimedate-perl

libxml-parser-perl

libxml-writer-perl

make

mysql-server-5.0

netpbm

openssh-server

preview-latex-style

tetex-bin

tetex-extra

unzip

When I do this I see on the bottom of Synaptic Package Manager window 82 to install/upgrade, 1 to remove. Your numbers may differ slightly.
Now click Apply and Apply again to confirm the changes. You will be asked several times to enter a
New password for the MySQL "root" user; just hit <Enter> which gives the default blank password. We will fix this and several other MySQL security issues below.

That completes the set up of your base Ubuntu system. You can quit the Synaptic Package Manager.

If you would prefer to install all of these packages in one fell swoop, run this command as root:

Installing Additional Perl Modules from CPAN

since otherwise the installation of some modules (Module::Build is an example) may fail.

First we will set up CPAN. For this you have to be root.

$ su
<root password>
# perl -MCPAN -e shell

Since this is the first time you are using CPAN it will ask you Are you ready for manual configuration?
Respond no and that should be it.

Next we add at least one mirror and reload the index. A list of mirrors can be found at http://mirrors.cpan.org. To add the mirror ftp://mirrors.kernel.org/pub/CPAN and reload the index do the following. For me, a slow and inaccurate typist, copying (^C) and pasting (<Shift> <Ctrl> <V>) is much faster.

Note that one time this failed when I tried to do it in the evening but when I tried again the next morning it worked fine. Now we update CPAN itself

cpan> install Bundle::CPAN

and always hit <Enter> to accept the defaults when prompted. This can be a long process with many long pauses. Please be patient.
When you again see the

cpan>

prompt enter

cpan> reload cpan
cpan> o conf commit

Now install the following modules

cpan> install XML::Parser::EasyTree Iterator Iterator::Util Net::IP

and in case you are prompted accept all defaults by just hitting <Enter>.
Note that with more than one module to install, we just list them after install separated by spaces.

When you again see the

cpan>

prompt enter

cpan> exit
#

Installing Additional Perl Modules from Source

At one point in time (August 2006), the installation of DateTime using CPAN was broken. Currently DateTime can be installed using CPAN. However it is useful to show you how to install perl modules from source in case one of the perl modules we installed above gets updated and its installation from CPAN becomes broken. If that happens you can follow the procedures outlined here to install the module from source.

IMPORTANT: With Debian we have already installed DateTime so you don't have to install it as outlined below. We are just using this as an example of installing a module from source which hopefully you will never have to do. You can skip this section and go directly to the Apache 2 and mod_perl section.

Now we give the example of installing DateTime from source. As we said you can skip this part.

Goto http://search.cpan.org/,
search for DateTime and click on DateTime. Then near the top right download DateTime-0.36.tar.gz and save it to disk. Move it to your downloads directory. Then

If you see anything that looks suspicious during this process, you can always test to see if the perl module in question was in fact installed. If it was not installed
try CPAN first and if CPAN fails then install it from source. The great thing about CPAN (if it works) is that it will trace down and automatically install all required components. Note that if you get a message indicating that package/file.pm was not found, you should serach for and install package::file since perl modules use a double colon (::) as a directory separator.

Assuming all is OK

$su
<root password>
# make install
# exit
$

Finally you should definitely test that the module (e.g. DateTime) was installed sucessfully

$ perl -MDateTime -e 'print "installed!\n"'

If you see

installed!

you can celebrate.

Apache 2 and mod_perl

First we have to enable a couple Apache modules. Acting as root in a terminal window enter

Now we will edit configuration files info.conf and status.conf to allow us to view information about the setup and performance of the web server. Note that this is not absolutely necessary but it can be very useful. You can use your favorite editor but we will give instructions assuming you are using gedit. Note that you have to be root to edit these files. First we edit info.conf

# cd /etc/apache2/mods-available
# gedit info.conf

I suggest you allow access to server information from e.g. your department domain. To do this uncomment (i.e. remove the # from)

# Allow from .example.com

and then replace .example.com by .math.yourschool.edu
where of course you should edit .math.yourschool.edu appropriately.

Then save the file and quit (Save and File, Quit).

Now we edit status.conf

# cd /etc/apache2/mods-available
# gedit status.conf

After the comments at the top and above the <Location /server-status> line enter

ExtendedStatus On

Now edit the

# Allow from .example.com

line just as you did for info.conf.
Then save the file and quit

Now we have to set your server's fully qualified domain name.

Select System, Administration, Network

Click on Unlock

Enter <your password> and click Authenticate

Click on General

Under Host name enter your_server_name (if it's not already there)

Then under Domain name enter your server's domain name, something like department.school.edu

Next

Click on Hosts

There should also be an entry with your server's IP address (if not you should add one)

Select the entry with your server's IP address and click Properties

Under Aliases you should see your server's fully qualified domain name, something like your_server_name.department.school.edu

Add or edit these entries if they are not correct

Then click OK

And click Close to close Network settings

You can check these settings by running the commands

$ hostname --fqdn

and

$ hostname

The first respond with the fully qualified domain name and the second with just your_server_name.

If the command hostname --fqdn returns Unknown host do the following:

Select System, Administration, Network

Click on Unlock

Enter <your password> and click Authenticate

Click on Hosts

Select the entry with your server's IP address and click Properties

Under Aliases you should see your server's fully qualified domain name, something like your_server_name.department.school.edu

Note that if your server can not find its fully qualified domain name, certain tools (such as the Synaptic Package Manager) will not start.

Now restart Apache

$su
<root password>
# apache2ctl graceful
# exit
$

and test your server by connecting to
"http://localhost/" and/or connecting to your
server from a browser on a remote machine. You should see the page It works! indicating that Apache is running.

You can check Apache's status by connecting to
"http://localhost/server-status" using a browser on your machine or from a browser on a remote machine in the math.yourschool.edu domain.

Further test Apache by connecting to
"http://localhost/server-info" using a browser on your machine (or or from a browser on a remote machine in the math.yourschool.edu domain) and you will see a page listing various
information about Apache. In particular under Server Settings you should see

If you have problems now or in the future, a good first thing to do is to look at the Apache error log which is located at /var/log/apache2/error.log. In the directory /var/log/apache2/ you can "less" through the error log (less error.log), look at the last few entires (tail error.log) or run the command tail -f error.log which will display new error messages as they are appended to the file. Use
^C to break out of tail -f .

Reboot and Test

Now connect to
"http://localhost/" using a browser on your machine and/or to your
server from a browser on a remote machine. You should see the page It Works indicating that Apache is running.

This is also a good time to check that you can login your server from a remote location using SSH (non secure telnet and FTP are not allowed but secure SSH and SFTP are). If you are using "SSH Secure Shell" (now called "SSH Tectia"), a popular SSH client for PC's, you will have to add Keyboard Interactive to the list of "Authentication methods" under "Authentication" if it's not already there.

Finally test that MySQL is running.

$ mysql -u root
...
mysql>
mysql> exit
Bye
$

Currently the MySQL password is empty so we didn't need a password.
We will take care of that now.

MySQL Security Issuses

As initially set up, MySQL is a very open system. There are anonymous accounts with full privileges for some databases and the root accounts are not password protected. See e.g. http://dev.mysql.com/doc/refman/5.0/en/default-privileges.html for information on this. We recommend removing the anonymous accounts and giving passwords to the root accounts. There are three root accounts, one is root@localhost, one is root@127.0.0.1 and the third is root@host_name where host_name is the name of your server. To find this name, do the following

$ mysql -u root
mysql> SELECT Host, User, Password FROM mysql.user;

You will see a table with six entries. For localhost you will see three Users, root and debian-sys-maint and one with an empty name (the anonymous user). The other listed Host (with a root user and also one with an empty name) is the name of your server which we will denote by host_name.

and you should get a table with only four users (three root and one debian-sys-maint).

Now we will assign a password to these root accounts.

In the third command below, replace host_name with the name of the server host. In all commands replace newpwd with your choosen MySQL root password. As was said above, Do not forget what you enter here. Also remember that this is the password for the MySQL root user, not the Ubuntu linux system root user. Below we refer to this as <mysql root password>

mysql> UPDATE mysql.user SET password=PASSWORD('newpwd') WHERE host='localhost' and user='root';
mysql> UPDATE mysql.user SET password=PASSWORD('newpwd') WHERE host='127.0.0.1' and user='root';
mysql> UPDATE mysql.user SET password=PASSWORD('newpwd') WHERE host='host_name' and user='root';
mysql> FLUSH PRIVILEGES;

Now use your up arrow key to run the command

mysql> SELECT Host, User, Password FROM mysql.user;

and you should see that all three users now have passwords (which will be displayed in encrypted form).

and you should see encrypted passwords for all three accounts. Note that the way MySQL is set up, you can only gain access to the localhost account, not to the host_name account but setting a password for the host_name account is a safer thing to do in case the set up gets changed. Now exit MySQL

mysql> exit
Bye
$

and congratulate yourself. You are now ready for the next and hopefully easy part, installing WeBWorK.

Downloading the WeBWorK System Software and Problem Libraries

We are finally at the point where we can start downloading and installing WeBWorK. We will use CVS to download WeBWorK. This is easy and it will also make it easy to update the system in the future. Note that the following are rather long commands; it is much easier to copy (^C) them from this document and paste (<Shift> <Ctrl> <V>) them in a terminal window

The first download gives you the latest released version with patches.
The second download contains the WeBWorK National Problem Library. This now includes the Rochester and Union Libraries along with others as sub libraries. Your system will be loaded with many thousands of WeBWorK problems (over 16,000 currently).

Installing WeBWorK

Move the System into the Required Directories

As root create a webwork directory under /opt and move directories there.

Certain data directories need to be writable by the web server. These are DATA, courses, htdocs/tmp, logs, and tmp. It is convenient to give WeBWorK administrators access to these directories as well, so they can perform administrative tasks such as removing temporary files, creating and editing courses from the command line, managing logs, and so on. We will create a new group called wwdata, containing both the WeBWorK administrators and the web server.

Select System, Administration and then Users and Groups

Click on Unlock

Enter <your password> and click Authenticate

Select Manage Groups

Click Add Group

For Group name enter wwdata

Under Group Members select yourself and click OK

Click Close

If there are other users who will also be administering WeBWorK files,
now is a good time to add them. And remember to add them to the wwdata group as above.

Because system users are not shown by default, we can not simply use the Group Manager to add the Apache2 webserver (which runs as www-data) to the wwdata
group so we will do this by hand.

# cd /etc
# cp group group.bak1
# gedit group

In the gedit window scroll to the last line.

It should look like wwdata:x:1001:<your userid>

Append to this line ,www-data

Then Save and Quit

You can check that this succeeded in a terminal window by entering

# exit
$ id <your userid>

and then you should see wwdata listed under groups. Also

$ id www-data

should show wwdata listed under groups. Now we make the WeBWorK directories that need to be writable by the web server have wwdata as their group. The following are rather long commands; you might want to copy them and paste them into your terminal window rather than typing them.

Close your Terminal Window and open a new one so the above changes
take effect. You can check that they have by

$ echo $PATH
$ echo $WEBWORK_ROOT

Checking Module Dependancies

WeBWorK includes a script called check_modules.pl that verifies that the needed programs and Perl modules are installed on your system. Run this script to make sure you have installed the required programs and Perl modules.

$ check_modules.pl apache2

Scroll up and look through the listing. It should find everything except PHP::Serialization, SOAP::Lite, MIME::Parser and XMLRPC::Lite which are only required if you plan to use WeBWorK with Moodle and tth which is a deprecated display mode. If something is missing (flagged by **), look back through these instructions and/or look at to find where it should have been installed and install it. Note you may have to search in Installation Manual for 2.4 to find out what package it is contained in.

Configuring WeBWorK

Making Copies of the Distribution Configuration Files

Before configuring the system, you must make local copies of the global.conf and database.conf configuration files, located in /opt/webwork/webwork2/conf/ . Since these are owned by root

Global Configuration

Most WeBWorK configuration is done in the file /opt/webwork2/conf/global.conf. This file provides system-wide configuration settings, and defaults for course settings. Any setting in this file can be overridden in the course.conf file for a particular course. To override a setting for a course, just put the new setting (using the same syntax as is in global.conf) in the course.conf file.

There are several options that must be set for WeBWorK to work with your system. The rest of the file consists of customization options. Now edit global.conf

# cd /opt/webwork/webwork2/conf
# gedit global.conf

WeBWorK uses the DateTime module. DateTime is supposed to be able to determine the local timezone itself without you having to enter it but this often fails so it is best to just set it here. For is a list of timezones recognized by DateTime go to
http://search.cpan.org/dist/DateTime-TimeZone/ . These timezones are more refined than standard timezone usage in that they include switches to daylight savings time (e.g. some parts of a time zone may make the switch and others may not). For example if your server is in the eastern US, on the list you will see DateTime::TimeZone::America::New_York and you should replace $siteDefaults{timezone} = ""; by $siteDefaults{timezone} = "America/New_York";

Search for $siteDefaults{timezone} = ""; and enter your local timezone.

At this point TtH is a deprecated display mode which we didn't install so we have to remove it from the listof possible display modes.

Search for formattedText and comment out the line "formattedText", # format math expressions using TtH

so it becomes

# "formattedText", # format math expressions using TtH

We need to set a password that WeBWorK uses when it communicates with the MySQL database. Note that this is not the same as the <mysql root password> which is the password the MySQL root user uses.

Search for $database_password = ""; and replace this by $database_password = "database_password";

where of course you should replace 'database_password' with your own password. Remember this password as we will need it below.

WeBWorK sends mail in three instances. The PG system sends mail to report answers to questionnaires and free-response problems. The mail merge module is used to send mail to course participants, i.e. to report scores. The feedback module allows participants to send mail to course instructors.

To send mail, WeBWorK needs the address of an SMTP server. Normally you will use the address of your school's SMTP server. If the local machine is running an SMTP server, use localhost. IMPORTANT: Our instructions above did not install an SMTP server so you will have to install and configue one if you do not use your school's SMTP server. When connecting to the SMTP server, WeBWorK must also send an email address representing the sender of the email (this has nothing to do with the From address on the mail message). Edit the lines

appropriately removing the # and using the professor(s) actual email address(es). In order to have professors from individual courses receive such email, this
should be set in course.conf to the addresses of professors of each course.

Then save the file and Quit.

Now become a regular user again

# exit
$

WeBWorK uses a single database, called webwork, for all courses. We will create the webwork database now.

To do this do the following (before you just copy, paste and hit <Enter> notice that you have to replace database_password with the password you set when editing global.conf above):

where as we said replace database_password with the password you set when editing global.conf above.

Since version 2.3.0 WeBWorK has an automatic database upgrade system. Rather than manually issuing SQL commands to make changes to the database, or using ad-hoc scripts like wwdb_addgw, there is a single script called wwdb_upgrade that applies any necessary updates. It should be run when creating a new database, and any time you upgrade WeBWorK.

$ /opt/webwork/webwork2/bin/wwdb_upgrade -v

jsMath Settings

Version 2.0 of jsMath introduced a new fallback method for when the TeX fonts are not available on the student's computer. This uses images of the individual TeX characters in place of the TeX fonts. These are distributed in webwork2/htdocs/jsMath/jsMath-fonts.tar.gz, and you need to unpack this tarball before jsMath will work properly. Use the command

This will unpack the archive. Since there are 20,000 tiny files, it can take a little while, so the v option is used to show you the names as they are unpacked so that you know the command is actually doing something. Once the images are unpacked, jsMath's image mode fallback (the default fallback method) will work properly.

Configuring Apache

WeBWorK ships with an Apache config file that needs to linked into your Apache configuration process. The file is named webwork.apache2-config.dist and located in the conf directory. First, copy the file to webwork.apache2-config:

# For WeBWorK a rough rule of thumb is 20 MaxClients per 1 GB of memory
MaxClients 20
MaxRequestsPerChild 100

where you should set MaxClients depending on the amount of memory your server has.

Then save the file and quit.

Now restart Apache

# apache2ctl graceful
# exit
$

Test your configuration

Test the /webwork2 location by visiting http://yourserver.yourschool.edu/webwork2. You should see the WeBWorK home page with no courses listed. Actually the directory /opt/webwork/courses/ does contain the modelCourse but the modelCourse is not a real course so you will get an error message if you try to log into it. It will be used a as model for setting up other courses. For this reason /opt/webwork/courses/modelCourse/ contains a file named hide_directory and so the modelCourse is not visible.

You cannot test the /webwork2_course_files location until you have created a course.

If Something is Wrong

If something is wrong one of the first things to check is that the config files have been edited correctly (e.g. one time a wrapped line in global.conf caused me problems, another time it was a missing single quote). A quick way to check this is to do a diff between the edited and distributed versions and check that diff reports the changes you made and only those.

Now goto http://yourserver.yourschool.edu/webwork2 and should see the WeBWorK home page with Course Adninistration listed at the top. Click on it and login with Username admin and Password admin . This first thing you should do is to click on Password/Email and change admin 's password to something more secure than admin .

Unless you choose oherwise, users with professor privilges in the admin course (i.e. WeBWorK administrators) will automatically be added to new courses with professor privilges and the same password as in the admin course. Initially the only such user is admin (hopefully you are not confused by the fact that the course admin has a user named admin). It's usually convenient make yourself a WeBWorK administrator. To do this (assuming you are logged in as admin to the admin course at http://yourserver.yourschool.edu/webwork2/admin )

Click on Classlist Editor in the left panel

Check Add 1 student(s) and click Take Action!

Enter the appropiate information (you can leave the last three items blank) and click Add Students

Click on Classlist Editor in the left panel again

When you enter a new student, by default their Student ID is used as their password. We'll change this now.

Select yourself with a check mark and then check Give new password to Selected users or just check Give new password to All users (as a safely mechanism you can not change the password for the user you are logged in as, currently admin, this way) and then click Take Action!

Enter the password, check Save changes and then click Take Action!

Finally give yourself professor privilges by selecting yourself with a check mark, checking Edit Selected users and then clicking Take Action! (or by just clicking on the "pencil" next to your login name which is a much faster way to edit classlist data for a single user)

Now at the far right change Permission Level from student to professor

Check Save changes and then click Take Action!

At some point you will probably want to hide the admin course so that it is not listed on the WeBWorK home page. As we noted above the modelCourse, which is already hidden, is not a real course so you will get an error message if you try to log into it. This is a good reason to hide it. The modelCourse is very useful as a model (hence its name) for setting up other courses. The admin course is used for administering WeBWorK and even though regular users can not log into it (you did change the admin password, didn't you!!), it a little bit cleaner and safer to hide it from prying eyes.
To hide a course place a file named hide_directory in the course directory and it will not show up in the courses list on the WeBWorK home page. It will still appear in the Course Administration listing. If you do this you will still be able to access the admin course using the URL http://yourserver.yourschool.edu/webwork2/admin but you will not see a link for it on the WeBWorK home page http://yourserver.yourschool.edu/webwork2 . Let's hide the admin course.

Starting and Stopping Apache, MySQL and the GNOME desktop GUI

If you make changes to the system, you will have to restart apache2 before the changes take effect. On rare occasions you may need to restart MySQL.

Starting and Stopping Apache

You have to run these commands as root.

To start or restart (i.e. stop and then start) the apache2 webserver run the command

$ sudo apache2ctl graceful
password:<your password>

To stop the Apache webserver run the command

$ sudo apache2ctl stop
password:<your password>

You can also start or stop apache2, listed as Web server (apache2), by using the GUI interface.

Select System, Administration and then Services

Scroll down to Web server (apache2)

If apache2 is running, uncheck its check box and click Close to stop it

If apache2 is stopped, check its check box and click Close to start it

Another method is to use the init.d script apache2. Run

$ sudo /etc/init.d/apache2
password:<your password>

and you will get a list of allowed commands (start, stop, restart, etc).

Note that in an earlier version of Ubuntu I found using the GUI interface somewhat unreliable.

Starting and Stopping MySQL

You have to run these commands as root.

To start the MySQL server run the command

$ sudo /etc/init.d/mysql start
password:<your password>

To stop the MySQL server run the command

$ sudo /etc/init.d/mysql stop
password: <your password>

To restart the MySQL server run the command

$ sudo /etc/init.d/mysql restart
password: <your password>

You can also start or stop MySQL, listed as Database server (mysql), by using the GUI interface.

Select Desktop, Administration and then Services

Scroll down to Database server (mysql)

If mysql is running, uncheck its check box and click Close to stop it

If mysql is stopped, check its check box and click Close to start it

Starting and stopping the GNOME desktop GUI

The GNOME desktop is automatically started when the system boots.

To stop GNOME so that you only have a standard terminal window run the following in a standard terminal window

$ sudo /etc/init.d/gdm stop
password: <your password>

If you stopped GNOME and want to restart it run the following in a standard terminal window

$ sudo /etc/init.d/gdm start
password: <your password>

Install the WeBWorK Problem Libraries

Before we create a real course we will install the WeBWorK Problem Libraries.

Install the National Problem Library

The National Problem Library consists of both WeBWorK problems and methods for searching and selecting problems. Also it contains as sub libraries many of the other standard libraries. We have to tell WeBWork where to find it.

Run the NPL-update script making sure you are in the /opt/webwork/libraries/NationalProblemLibrary directory. This directory contains the files loadDB2 and create_tables2.sql.

$ cd /opt/webwork/libraries/NationalProblemLibrary
$ NPL-update

This has to convert a lot of data (around 16900 files) so please be patient; it can take a long time.

If at some time in the future you want to upgrade the Problem Library, the process
is simpler. Optionally remove the previous copy of the
library, unpack the new copy in the same place, and run NPL-update.

Set up the Rochester and Union Libraries

Search for courseFiles{problibs} and scroll down several lines to the line # rochesterLibrary => "Rochester",

Uncomment this line (i.e. remove the #) so it becomes

rochesterLibrary => "Rochester",

Directly below this line add the line

unionLibrary => "Union",

Search for macrosPath and scroll down several lines to the line $pg{directories}{macros},

After this line add the line: '/opt/webwork/libraries/NationalProblemLibrary/macros/Union',

Don't forget the coma (,) at the end of these lines. Then save the file and quit.

Since we have edited global.conf a lot and this is a very critical file, it would be a good idea to run

# exit
$ diff global.conf global.conf.dist

and check that you haven't made any mistakes (e.g. by introducing an inadvertant line break, etc).

We next put links to the Rochester and Union Libraries in the modelCourse so that when we create courses copying templates from the modelCourse, these libraries will be available. Skip this step if you usually only want to use National Problem Library.

If you want to put another library into the modelCourse, just do the analogous thing. If you just want the additional library in a particular course, add the link in the templates directory of that course. If you look in the directory /opt/webwork/libraries/database_problems/ you might find other libraries that are not yet listed in global.conf (like Union above) and these can be added in the same way we added Union. Usually they do not require additional macros like Union did. Finally if you add a library with non standard symbols in the name (e.g. uva-statLibrary) you have to use single quotes when adding it to global.conf, e.g. 'uva-statLibrary' => "UVA-Stat",
It's easier to just avoid such names.

At some point you will probably want to "hide" myTestCourse from general view but you already know how to do that.

Test that Things are Working Properly

We will test out a few important parts of WeBWorK. If you run into problems, you should look at the Apache error log which is located at /var/log/apache2/error.log.

Click on Hmwk Sets Editor on the Main Menu. Then select (by clicking the circle button) Import, select setDemo.def from the from drop down list and select all current users from the assigning this set to drop down list. Then hit Take Action!

Now click on Homework Sets on the Main Menu and click on Demo. Then look at the problems. Mathematical equations should be typeset. If not, edit the file Constants.pm in the directory /opt/webwork/webwork2/lib/WeBWorK. Change the line $WeBWorK::PG::ImageGenerator::PreserveTempFiles = 0; to ...::PreserveTempFiles = 1;. Then restart Apache and view the first couple problems or some new ones. Then look in the directory /opt/webwork/webwork2/tmp/. cd to one of the ImageGenerator.../tmp/ directories and look at the error and log files there. When you fix the problem remember to edit ...::PreserveTempFiles = 1; back to 0 and restart Apache or you will be saving a lot of unnecessary files. Another useful trick is to try downloading a hard copy of an assignment and then (assuming there are errors) looking at the various log files that are linked to on the output page.

When you continue looking at problems you will get an error when you try to look at Problem 6 because we have not configured the CAPA macros which are required to display CAPA problems. Unless you are teaching physics you probably don't need them. Also in Problem 9 the Java applet will not load. Problem 9 was written in the 90's and used an applet on a server at The Johns Hopkins University. The server went away a long time ago but have retained this problem for historical reasons and also because it is a example of several things (e.g. WeBWorK problems can include applets running on remote servers but this can lead to other problems).

Next click on Prob. List to bring back the Problem List Page and click on Download a hardcopy of this homework set. The page is a little complicated because you are a professor but you can just scroll to the bottom and click on Generate hardcopy for selected users and selected sets. You will get an error (because of the bad Problem 6) but just click Download Hardcopy to get what was generated. Also you can see links to various
informational files that are available if you run into problems (normally these files are removed if there are no errors).

Another thing to do is to use Email on the Main Menu. Again this page is a little complicated because you can do a lot of things with it (including mail merge) but at this point just select yourself in the list to the right and hit Send Email at the bottom. You should receive two emails. One is the message you just sent and the other is an email with subject "WeBWorK email sent" giving information on your mailing.

As a final test click on Library Browser on the Main Menu. Click Problem Library
and select a Subject, Chapter and Section and then hit View Problems. The first 20 of your selected problems will be displayed. You can also test that you can access any additional Problem Libraries that you installed.

If all the above tests work, you can be pretty confident that WeBWorK is working properly.

Go back to Hmwk Sets Editor on the Main Menu. Then select (by clicking the circle button) Import, select setOrientation.def from the from drop down list and select all current users from the assigning this set to drop down list. Then hit Take Action!. Then go through the Orientation problems. This is a good first set to use for introducing students to WeBWorK.

If you are new to WeBWorK, you should probably add a regular student to myTestCourse and log in as that student to see what the student interface looks like. It's much simpler than the professor interface.
Click on Classlist Editor on the Main Menu.
Then select (by clicking the circle button) Add 1 student(s)and hit Take Action!. Add one student, say Jane Smith, with Student ID1234 and Login Namejsmith.
Jane Smith's initial password will be her Student ID1234. Now login as Jane Smith and play around a little.

Optional Configurations

Optional A stores WeBWorK's "temporary" files in a separate partition.
Optional B installs and configures a lightweight webserver to serve static files.
Optional C configures Apache so that access to WeBWorK will be through SSL.

Implement Optional A (wwtmp)

Now is the time to implement Optional A if you choose to do so. Actually you can do this at any time and your active courses will continue to function seemingly without change. The only change behind the scenes will be that temporary files will be stored in a different location.

Then save the file and quit. If you look at the wwtmp directory you will find it empty but after you restart apache and then access some WeBWorK problems, you will find temporary directories and files in wwtmp. Remember your have to restart apache for these changes to take effect.

Implement Optional B (lighttp)

As is the case for Optional A you can implement Optional B at any time and your active courses will continue to function seemingly without change. The only change behind the scenes will be that static images and pages will be served by a light weight web server.

The Server-Status page doesn't indicate that lighttp is the web server, but it's certainly different than apache's Server-Status page "http://localhost/server-status".

Next we configure WeBWorK to take advantage of lighttp.

First let's make a backup copy of global.conf so that we can easily back out of these changes if necessary.

# cd /opt/webwork/webwork2/conf
# cp global.conf global.conf.bak2

Now edit global.conf. Note that while Optional B is independent of Optional A, we assume most people implementing Optional B will have already implemented Optional A. Therefore we give instructions for editing
global.conf assuming that Optional A has been implemented. If this is not the case, modify the instructions below accordingly. Also replace yourserver.yourschool.edu with the correct address.

Implement Optional C (SSL)

Optional C configures apache so that access to WeBWorK will be through an encrypted Secure Sockets Layer (SSL) with an https: URL. Note that if you implemented Optional B, the non encrypted lighttp server will be used for images, etc but there is no harm in that. These directions describe how to generate a self signed SSL Certificate but this will generate an initial browser warning message. You can purchase a commercial SSL Certificate from many sources, some for very reasonable rates (try googling "ssl certificate").

When you are asked for a pass phrase, enter a phrase which we refer to as <my pass phrase> and then confirm it. Next generate a Certificate Signing Request

$ openssl req -new -key server.key -out server.csr

Enter the requested information. Important: when you are prompted for the Common Name enter your server's fully qualified domain name, something like yourserver.yourschool.edu. You can leave the last two items

A challenge password []:
An optional company name []:

blank.

One unfortunate side-effect of the pass-phrased private key is that Apache will ask for the pass-phrase each time the web server is started. Obviously this is not necessarily convenient as someone will not always be around to type in the pass-phrase, such as after a reboot or crash. We will remove this but you must keep this file secure.