Difference between revisions of "Installation Manual for 2.18 on Ubuntu"
(45 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | {{UnderConstruction}} |
||
+ | |||
+ | <!-- {{UnderConstruction}} --> |
||
These instructions cover the installation of WeBWorK 2.18 for Ubuntu Server 22.04 LTS. |
These instructions cover the installation of WeBWorK 2.18 for Ubuntu Server 22.04 LTS. |
||
− | Other installation methods (which are faster and easier) include using the WeBWorK Virtual Machine Image (see [[Installing WeBWorK from a Virtual Machine Image]]) which has been tested on VMware, VirtualBox and QEMU/KVM and using the WeBWorK AMI if you want to run your server on AWS (see [[WeBWorK Amazon Machine Images (AMI's)]]). |
+ | Other installation methods (which are faster and easier) include using the WeBWorK Virtual Machine Image (see [[Installing WeBWorK from a Virtual Machine Image]]) which has been tested on VMware, VirtualBox and QEMU/KVM and using the WeBWorK AMI if you want to run your server on AWS (see [[WeBWorK Amazon Machine Images (AMI's)]]). |
+ | |||
+ | <!-- Note that the Virtual Machine Image for the latest version of WeBWorK may not be available at the time of release. --> |
||
If you are just upgrading WeBWorK, especially if you already have existing WeBWorK courses, see [[Release notes for WeBWorK 2.18#Upgrade Instructions]]. |
If you are just upgrading WeBWorK, especially if you already have existing WeBWorK courses, see [[Release notes for WeBWorK 2.18#Upgrade Instructions]]. |
||
Line 89: | Line 90: | ||
Here is the list of Ubuntu packages that need to be installed. |
Here is the list of Ubuntu packages that need to be installed. |
||
+ | # <code>cm-super</code> |
||
# <code>cpanminus</code> |
# <code>cpanminus</code> |
||
# <code>curl</code> |
# <code>curl</code> |
||
Line 156: | Line 158: | ||
'''To install all of these packages in one fell swoop''' run the command ('''obviously you want to use cut and paste''') |
'''To install all of these packages in one fell swoop''' run the command ('''obviously you want to use cut and paste''') |
||
− | $ sudo apt install cpanminus curl dvipng dvisvgm gcc git imagemagick \ |
+ | $ sudo apt install cm-super cpanminus curl dvipng dvisvgm gcc git imagemagick \ |
libarchive-zip-perl libarray-utils-perl libclass-tiny-antlers-perl \ |
libarchive-zip-perl libarray-utils-perl libclass-tiny-antlers-perl \ |
||
libcrypt-jwt-perl libcryptx-perl libdata-dump-perl libdata-structure-util-perl \ |
libcrypt-jwt-perl libcryptx-perl libdata-dump-perl libdata-structure-util-perl \ |
||
Line 243: | Line 245: | ||
To obtain more information about the <code>MariaDB</code> or <code>MySQL</code> server run |
To obtain more information about the <code>MariaDB</code> or <code>MySQL</code> server run |
||
$ systemctl status mysql |
$ systemctl status mysql |
||
+ | |||
+ | === Connection Limits === |
||
+ | |||
+ | Those coming from earlier versions of WeBWorK, especially 2.13 and 2.14, may have never run into connection limits on the SQL database write, depending on the total class enrollments. In 2.18, especially using hypnotoad (see below), the connection limit default of 151 connections can be reached fairly easily. So long as your system resources allow it, increasing this limit to approximately twice the number of workers used in the web serving can help prevent very scary errors from confusing your users. Edit the MariaDB conf file at: |
||
+ | |||
+ | $ sudo nano /etc/my.cnf |
||
+ | |||
+ | Beneath the first line, which should state something like: |
||
+ | |||
+ | [mysqld] |
||
+ | |||
+ | add a line to increase this number. For example, if the number of workers for your hypnotoad setup (below) was set to 250, then 500 might be an appropriate choice for the maximum number of connections. |
||
+ | |||
+ | Max_connections = [preferred new max digits] |
||
+ | |||
+ | (Aside) If you are using MySQL instead of MariaDB, this file is located at /etc/mysql/mysql.conf.d/mysql.cnf. Same setting, same information, just a different configuration location. |
||
==Install WeBWorK== |
==Install WeBWorK== |
||
Line 267: | Line 285: | ||
$ git clone https://github.com/openwebwork/webwork-open-problem-library.git |
$ git clone https://github.com/openwebwork/webwork-open-problem-library.git |
||
− | '''Important Note'''. The above commands retrieve the main branch which gives the latest stable release of the software package (webwork2, pg, etc.) with bug fixes. If a stable release newer than 2.18 exists, that will be downloaded and these instructions may be a little out of date. So it is a good idea to check before downloading. |
||
+ | The first and second <code>git clone</code> commands above download the latest released versions of WeBWorK 2 and PG. |
||
− | The best way to do that is to look at https://github.com/openwebwork/webwork2/blob/main/VERSION and https://github.com/openwebwork/pg/blob/main/VERSION. |
||
+ | The third command downloadss the WeBWorK Open Problem Library (OPL) which contains thousands of WeBWorK problems (over 37,000 currently). |
||
+ | |||
+ | '''Important Note'''. The above commands retrieve the main branch which gives the latest stable release of the software package (webwork2, pg, etc.) with bug fixes. Since a later version has now been released you will need to execute the following commands to obtain the 2.18 release of WeBWorK (with bug fixes). |
||
− | The first and second download gives you the latest released versions of WeBWorK 2 and PG. |
||
+ | $ cd /opt/webwork/webwork2 |
||
− | The third download contains the WeBWorK Open Problem Library (OPL) which contains thousands of WeBWorK problems (over 37,000 currently). |
||
+ | $ git checkout -b WeBWorK-2.18+ WeBWorK-2.18+ |
||
+ | $ cd /opt/webwork/pg |
||
+ | $ git checkout -b PG-2.18+ PG-2.18+ |
||
The main information page about WebWorK downloads is available at http://webwork.maa.org/wiki/Category:Release_Notes |
The main information page about WebWorK downloads is available at http://webwork.maa.org/wiki/Category:Release_Notes |
||
Line 348: | Line 370: | ||
Note that if you have a previous version of node installed, then you will need to first uninstall it. To determine if this is the case run |
Note that if you have a previous version of node installed, then you will need to first uninstall it. To determine if this is the case run |
||
$ node --version |
$ node --version |
||
− | If that shows <code> |
+ | If that shows <code>vNN.??.?</code> where <code>NN</code> is 16 or more, then you already have a new enough version of node installed. If that says <code>Command 'node' not found, ...</code>, then skip to installing node below. If a version is shown that does not start with 16 or more, then uninstall node with the commands: |
$ sudo apt autoremove nodejs nodejs-doc |
$ sudo apt autoremove nodejs nodejs-doc |
||
$ sudo rm /etc/apt/sources.list.d/nodesource.list |
$ sudo rm /etc/apt/sources.list.d/nodesource.list |
||
Line 417: | Line 439: | ||
$ nano /opt/webwork/webwork2/conf/site.conf |
$ nano /opt/webwork/webwork2/conf/site.conf |
||
− | First we have to add information about |
+ | First we have to add information about your site's URL. |
Search for <code>server_root_url</code> and edit the line so that it reads: |
Search for <code>server_root_url</code> and edit the line so that it reads: |
||
Line 438: | Line 460: | ||
where of course you should replace "database_password" with your own password but do use the single quotes. '''Remember this password as we will need it below'''. |
where of course you should replace "database_password" with your own password but do use the single quotes. '''Remember this password as we will need it below'''. |
||
− | WeBWorK sends mail in |
+ | WeBWorK sends mail in two instances. 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 <code>localhost</code>. IMPORTANT: Our instructions above did not install an SMTP server so you will have to install and configure 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 <code>From</code> address on the mail message). Edit the lines |
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 <code>localhost</code>. IMPORTANT: Our instructions above did not install an SMTP server so you will have to install and configure 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 <code>From</code> address on the mail message). Edit the lines |
||
Line 453: | Line 475: | ||
Then save the file and Quit. |
Then save the file and Quit. |
||
+ | |||
+ | ==== The defaults.config file ==== |
||
+ | |||
+ | The <code>defaults.config</code> contains basic defaults for your system. You should not need to change these but if you decide to, you should not change them here since this file will be overwritten when you update WeBWorK. Instead make the change in the <code>localOverrides.conf</code> file using the same syntax as in the <code>defaults.config</code> file. |
||
==== Custom Themes ==== |
==== Custom Themes ==== |
||
Line 475: | Line 501: | ||
Now we check that all necessary LaTeX packages have been installed. Run the command |
Now we check that all necessary LaTeX packages have been installed. Run the command |
||
$ check_latex |
$ check_latex |
||
− | and look for missing packages |
+ | and look for missing packages. |
If the script displays "Compilation Success!", then all is good! |
If the script displays "Compilation Success!", then all is good! |
||
Line 494: | Line 520: | ||
== Serving the Webwork2 Mojolicious App == |
== Serving the Webwork2 Mojolicious App == |
||
− | You now have a choice to make. That is how to serve webwork2. There are two primary choices. Either the app may be served directly via hypnotoad (option 1 below), or it may be proxied via another web server. If your server is dedicated to serving only webwork2, then serving directly via hypnotoad is the simplest choice. (Note that this option does allow for a customizable root url or a redirect of the root url to another site.) However, if your server will be serving other sites as well then you will need to proxy the app via another web server. For that we provide instructions for serving via apache2 or nginx (options 2 and 3 below). However, another server could be used as well. |
+ | You now have a choice to make. That is how to serve webwork2. There are two primary choices. Either the app may be served directly via hypnotoad (option 1 below), or it may be proxied via another web server. If your server is dedicated to serving only webwork2, then serving directly via hypnotoad is the simplest choice. (Note that this option '''does''' allow for either a customizable root url or a redirect of the root url to another site.) However, if your server will be serving other sites as well then you will need to proxy the app via another web server. For that we provide instructions for serving via apache2 or nginx (options 2 and 3 below). However, another server could be used as well. |
All approaches use the webwork2.mojolicious.yml and webwork2.service files. Start by copying the dist files. |
All approaches use the webwork2.mojolicious.yml and webwork2.service files. Start by copying the dist files. |
||
Line 510: | Line 536: | ||
Determine if you are going to be serving securely with SSL certificates or not. If so use port 443 below, otherwise use port 80. |
Determine if you are going to be serving securely with SSL certificates or not. If so use port 443 below, otherwise use port 80. |
||
− | If you are serving securely with SSL certificates, then change <code>listen:</code> at the beginning of the <code>hypnotoad:</code> section to include your ssl certificates. See the examples in the file for the format that is needed. You will also need to make sure that the www-data user has read permissions for the certificate files. |
+ | If you are serving securely with SSL certificates, then change <code>listen:</code> at the beginning of the <code>hypnotoad:</code> section to include your ssl certificates. See the examples in the file for the format that is needed. You will also need to make sure that the www-data user has read permissions for the certificate files. This is possibly trickier than you might think: you need the directory path that the certificate and key are in (e.g., .pem files from letsencrypt) to be readable by www-data or whatever your .yml file specifies as the user and group. There is a log by default at /opt/webwork/webwork2/logs/webwork2.log which can often help debugging this step. |
If you are not serving securely with SSL certificates, then change <code>listen:</code> at the beginning of the <code>hypnotoad:</code> section to <code>- <nowiki>http://*:80</nowiki></code>. |
If you are not serving securely with SSL certificates, then change <code>listen:</code> at the beginning of the <code>hypnotoad:</code> section to <code>- <nowiki>http://*:80</nowiki></code>. |
||
+ | |||
+ | Search for the lines |
||
+ | clients: 1 |
||
+ | workers: 25 |
||
+ | spare: 8 |
||
+ | and edit the numbers depending on the amount of RAM available on your server. Look at the recommendations for these settings in the section immediately above these lines in the webwork2.mojolicious.yml file - roughly 10 workers per GB of RAM, with buffer for the OS and the spare; and spare set to approximately 10% of total workers. |
||
Then save the file and Quit. |
Then save the file and Quit. |
||
Line 691: | Line 723: | ||
$ sudo systemctl stop webwork2-job-queue |
$ sudo systemctl stop webwork2-job-queue |
||
$ sudo systemctl restart webwork2-job-queue |
$ sudo systemctl restart webwork2-job-queue |
||
+ | |||
+ | It is worth checking to make sure the webwork2-job-queue has started properly. If anything is wrong, it'll quietly just hang, and then most of the courses will run fine, except certain things like mass grade updates, which will just never run. |
||
+ | |||
+ | $ sudo systemctl status webwork2-job-queue |
||
+ | |||
+ | Even though the <code>webwork2-job-queue.service</code> file specifies user <code>www-data</code> and group <code>www-data</code>, and even if permissions are set appropriately as above (re: logs directory), if you're doing an upgrade-in-place, you might end up in a situation where the <code>www-data</code> user can't write to <code>webwork2.log</code>, and then the job queue will fail. The above status check will indicate this, and you can then double-check permissions on the log directory, and make sure that the files are writeable by <code>www-data</code>. |
||
== Test your configuration == |
== Test your configuration == |
||
Line 742: | Line 780: | ||
== Check for and Install Hotfixes == |
== Check for and Install Hotfixes == |
||
− | The following commands show you how to check for and install bug fixes. '''Important Note:''' These commands check and retrieve the main branch which gives the latest stable release of the software package (webwork2, pg, etc.) with bug fixes. If a stable release newer than 2. |
+ | The following commands show you how to check for and install bug fixes. '''Important Note:''' These commands check and retrieve the main branch which gives the latest stable release of the software package (webwork2, pg, etc.) with bug fixes. If a stable release newer than 2.18 exists for webwork2 and/or pg, that will be checked and retrieved which is probably not what you want. Please check before updating. The best way to do that is to look at https://github.com/openwebwork/webwork2/blob/main/VERSION and https://github.com/openwebwork/pg/blob/main/VERSION. |
To check if there are bug fixes, do the following. |
To check if there are bug fixes, do the following. |
||
Line 777: | Line 815: | ||
$ git pull origin |
$ git pull origin |
||
$ OPL-update |
$ OPL-update |
||
− | '''Important Note:''' The OPL contains over 37,000 problems and if one new problem is added, the above will report the OPL is out of date. I would suggest you update the OPL maybe once or twice a semester. Also the version of the OPL contained in the WW 2. |
+ | '''Important Note:''' The OPL contains over 37,000 problems and if one new problem is added, the above will report the OPL is out of date. I would suggest you update the OPL maybe once or twice a semester. Also the version of the OPL contained in the WW 2.19 Virtual Machine Image and in the WW 2.19 Amazon Machine Image is current as of August 1, 2024. |
Updating the OPL is pretty much risk free since changes usually involve only a relatively small number of individual problems and the vast majority of problems remain unchanged. Updating the OPL does not require restarting webwork2. |
Updating the OPL is pretty much risk free since changes usually involve only a relatively small number of individual problems and the vast majority of problems remain unchanged. Updating the OPL does not require restarting webwork2. |
||
Line 800: | Line 838: | ||
There should be a link named <code>Contrib</code> in the directory |
There should be a link named <code>Contrib</code> in the directory |
||
/opt/webwork/courses/modelCourse/templates/ |
/opt/webwork/courses/modelCourse/templates/ |
||
− | so that when courses are created copying templates from the <code>modelCourse</code>, the Contrib directory will be available. A button in the Library Browser which gives access to problems in the <code>Contrib</code> directory will be available for all courses with this link. |
+ | so that when courses are created copying templates from the <code>modelCourse</code>, the Contrib directory will be available. A button in the Library Browser which gives access to problems in the <code>Contrib</code> directory will be available for all courses with this link. We recommend you keep this setting. |
− | + | However, if you only want this for individual courses, not all courses then remove the link in the <code>modelCourse</code> above. Then after creating a course, for example after creating <code>myTestCourse</code> below, do the following |
|
$ cd /opt/webwork/courses/myTestCourse/templates/ |
$ cd /opt/webwork/courses/myTestCourse/templates/ |
||
$ sudo ln -s /opt/webwork/libraries/webwork-open-problem-library/Contrib Contrib |
$ sudo ln -s /opt/webwork/libraries/webwork-open-problem-library/Contrib Contrib |
||
Line 879: | Line 917: | ||
== Test that Things are Working Properly == |
== 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 <code>/var/log/apache2/error.log</code>. |
+ | We will test out a few important parts of WeBWorK. If you run into problems, you should look at the WeBWorK app error log which is located at <code>/opt/webwork/webwork2/logs/webwork2.log</code> and/or the Apache error log which is located at <code>/var/log/apache2/error.log</code> and/or the nginx error log located at <code>/var/log/nginx/error.log</code>. |
− | Click on <code>Hmwk Sets Editor</code> on the <code>Main Menu</code>. Then select <code>Import</code>, select <code>setDemo.def</code> from the <code>Import from where</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> |
+ | Click on <code>Hmwk Sets Editor</code> on the <code>Main Menu</code>. Then select <code>Import</code>, select <code>setDemo.def</code> from the <code>Import from where</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>Import</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 displayed nicely by MathJax (right click on the equation for info). You can also display equations as images but this is not recommended. |
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 displayed nicely by MathJax (right click on the equation for info). You can also display equations as images but this is not recommended. |
||
− | Note that since you probably used "admin" to login you have Permission Level "admin" so things look more complicated than if you were just a regular professor with Permission Level "professor". In particular any time you view a problem, you have the option to "Edit tags" which you probably do not want to do. If |
+ | Note that since you probably used "admin" to login you have Permission Level "admin" so things look a bit more complicated than if you were just a regular professor with Permission Level "professor". In particular any time you view a problem, you have the option to "Edit tags" which you probably do not want to do. If this bothers you, login as a professor (see below). |
Continue looking at problems to see if everything is working properly. |
Continue looking at problems to see if everything is working properly. |
||
− | Next click on <code>Problem List</code> to bring back the Problem List Page and click on <code>Download PDF ...</code>. The page is |
+ | Next click on <code>Problem List</code> to bring back the Problem List Page and click on <code>Download PDF ...</code>. The page is complicated because you are an admin so you see the professor view (students see a very simple page) but you can just scroll to the bottom and click on <code>Generate hardcopy for selected users and selected sets</code>. If you get an error, then look at the various log files that are linked to on the output page (normally these files are removed if there are no errors). If you want to preserve these temporary files, then set <code>perserve_temp_files</code> to 1 in the file <code>/opt/webwork/webwork2/conf/webwork2.mojolicious.conf</code> and restart the webwork2 service. Remember to change <code>preserve_temp_files</code> back to 0 and restart the webwork2 service again or you will be saving a lot of unnecessary files. You can find these temporary files in <code>/opt/webwork/webwork2/tmp/</code>, then look under your course, <code>hardcopy</code>, and user. You will have to switch to being the root user to access the final subdirectory containing the tmp files. |
Another thing to do is to use <code>Email</code> on the <code>Main Menu</code>. 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 <code>Send Email</code> 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. |
Another thing to do is to use <code>Email</code> on the <code>Main Menu</code>. 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 <code>Send Email</code> 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. |
||
Line 899: | Line 937: | ||
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 <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. Also you can Import <code>set0.def</code> and <code>setMAAtutorial.def</code> and look through those problems. |
+ | Go back to <code>Hmwk Sets Editor</code> on the <code>Main Menu</code>. Then select <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. Also you can Import <code>set0.def</code> and <code>setMAAtutorial.def</code> and look through those problems. Note that most of these sets date from the early days of WeBWorK in the 1990's and the problems they contain, while they still work, are not examples of current good programing practices. For current programing methods, look at e.g. https://webwork.maa.org/wiki/Category:PGM. Further, Problem 12 in setMAAtutorial (file htmllinksexample.pg) contains a simple error which is typical of errors you might make in authoring your own problems. WeBWorK tries to tell you what the error is and you can use the <code>Edit</code> button to edit and save the problem. Problem 2 in set0 (file prob1a.pg) may contain more subtle errors. The Open Problem Library (OPL) contains over 37,000 problems the vast majority of which are error free. |
− | If you are new to WeBWorK or even if you are a pro, 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 or admin interfaces. Also for the same reason you should probably add professor to myTestCourse and log in as that professor to see what the professor interface looks like. |
+ | If you are new to WeBWorK or even if you are a pro, 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 or admin interfaces. Also for the same reason you should probably add a professor to myTestCourse and log in as that professor to see what the professor interface looks like. |
Click on <code>Classlist Editor</code> on the <code>Main Menu</code>. |
Click on <code>Classlist Editor</code> on the <code>Main Menu</code>. |
||
Line 974: | Line 1,012: | ||
=== Implement Option A (SSL) === |
=== Implement Option A (SSL) === |
||
'''Option A''' configures the server so that access to WeBWorK will be through an encrypted connection (SSL) with an https: URL. Note that TLS is the successor protocol to SSL and is used everywhere. So that when we and others use the more common acronym SSL, we really are talking about TLS. |
'''Option A''' configures the server so that access to WeBWorK will be through an encrypted connection (SSL) with an https: URL. Note that TLS is the successor protocol to SSL and is used everywhere. So that when we and others use the more common acronym SSL, we really are talking about TLS. |
||
+ | |||
+ | Note that there are very explicit instructions for setting up an SLL connection using the WeBWorK AMI image, Certbot, and Hypnotoad at [[WeBWorK_2.18_Ubuntu_Server_22.04_LTS_Amazon_Machine_Image#Set_up_WeBWorK_to_use_SSL]] which may be useful. |
||
First we have to obtain an official SSL certificate or generate a self-signed one which can be used for testing purposes. If students will be using your server, it is better to obtain an official SSL certificate since using a self-signed certificate with cause warning messages to be displayed when students connect to the server. |
First we have to obtain an official SSL certificate or generate a self-signed one which can be used for testing purposes. If students will be using your server, it is better to obtain an official SSL certificate since using a self-signed certificate with cause warning messages to be displayed when students connect to the server. |
||
Line 984: | Line 1,024: | ||
==== Use a self-signed Certificate ==== |
==== Use a self-signed Certificate ==== |
||
− | + | First we need to install a package which is needed for openssh-server to generate a self-signed certificate. |
|
− | /etc/ssl/certs/ssl-cert-snakeoil.pem |
||
− | and the private key at |
||
− | /etc/ssl/private/ssl-cert-snakeoil.key |
||
− | This certificate and key may be regenerated manually with the following command (needs root privileges ie sudo): |
||
+ | $ sudo apt-get install ssl-cert |
||
+ | Then run |
||
$ sudo make-ssl-cert generate-default-snakeoil --force-overwrite |
$ sudo make-ssl-cert generate-default-snakeoil --force-overwrite |
||
− | which you might want to do since I believe the original certificate is only valid for 365 days. |
||
+ | This creates a certificate stored at |
||
+ | /etc/ssl/certs/ssl-cert-snakeoil.pem |
||
+ | and a private key at |
||
+ | /etc/ssl/private/ssl-cert-snakeoil.key |
||
+ | |||
+ | I believe this certificate is only valid for 365 days. You can generate a new certificate with the same command. |
||
In the instructions below we will use the provided self-signed certificate (ssl-cert-snakeoil.pem and ssl-cert-snakeoil.key) but you can also generate your own using openssh following instructions on the web. As we said above, for a production server, you should really use an official certificate. |
In the instructions below we will use the provided self-signed certificate (ssl-cert-snakeoil.pem and ssl-cert-snakeoil.key) but you can also generate your own using openssh following instructions on the web. As we said above, for a production server, you should really use an official certificate. |
||
Line 1,008: | Line 1,054: | ||
to |
to |
||
listen: |
listen: |
||
− | - <nowiki>https://*:443?cert=/etc/ssl/certs/ssl-cert-snakeoil.pem&key=/etc/ssl/private/ssl-cert-snakeoil. |
+ | - <nowiki>https://*:443?cert=/etc/ssl/certs/ssl-cert-snakeoil.pem&key=/etc/ssl/private/ssl-cert-snakeoil.key</nowiki> |
Make sure that the files are readable by the webwork2 app. |
Make sure that the files are readable by the webwork2 app. |
||
− | $ sudo chown www-data /etc/ssl/certs/ssl-cert-snakeoil.pem /etc/ssl/private/ssl-cert-snakeoil.key |
+ | $ sudo chown www-data /etc/ssl/certs/ssl-cert-snakeoil.pem /etc/ssl/private/ssl-cert-snakeoil.key |
The webwork2 app needs to be restarted for this to take effect, but we will delay that until a bit later. Go to the check site.conf section below. |
The webwork2 app needs to be restarted for this to take effect, but we will delay that until a bit later. Go to the check site.conf section below. |
||
Line 1,291: | Line 1,337: | ||
copytruncate |
copytruncate |
||
} |
} |
||
− | and then save the file and quit. The backup will be done weekly and we are keeping 15 weeks (approximately one semester) worth of logs. |
||
+ | and then save the file and quit. |
||
+ | |||
+ | There is one additional step that is needed if you are [[Installation_Manual_for_2.18_on_Ubuntu#Option 1: Serving Directly via Hypnotoad|serving directly via hypnotoad]]. In that case the webwork2 application initially starts as the root user, and then switches to the www-data user, and the <code>webwork2.log</code> file is created by the root user before the switch is made. So the file's owner and group need to be fixed. You can do this by executing |
||
+ | $ sudo chown www-data:www-data /opt/webwork/webwork2/logs/webwork2.log |
||
+ | |||
+ | The backup will be done weekly and we are keeping 15 weeks (approximately one semester) worth of logs. |
||
The most recent backup will not be compressed but all older ones will be. We are not explicitly creating a new <code>timing.log</code> file |
The most recent backup will not be compressed but all older ones will be. We are not explicitly creating a new <code>timing.log</code> file |
||
because WeBWorK will automatically create one if it's missing. If you want to check that it works you can run <code>logrotate</code> |
because WeBWorK will automatically create one if it's missing. If you want to check that it works you can run <code>logrotate</code> |
Latest revision as of 16:40, 13 August 2024
These instructions cover the installation of WeBWorK 2.18 for Ubuntu Server 22.04 LTS.
Other installation methods (which are faster and easier) include using the WeBWorK Virtual Machine Image (see Installing WeBWorK from a Virtual Machine Image) which has been tested on VMware, VirtualBox and QEMU/KVM and using the WeBWorK AMI if you want to run your server on AWS (see WeBWorK Amazon Machine Images (AMI's)).
If you are just upgrading WeBWorK, especially if you already have existing WeBWorK courses, see Release notes for WeBWorK 2.18#Upgrade Instructions.
Contents
- 1 Notation
- 2 Install the Ubuntu 22.04 Server Operating System
- 3 Install Software Packages
- 4 Install a Database
- 5 Install WeBWorK
- 6 Configure the Shell
- 7 Obtain Javascript Libraries
- 8 Miscellaneous System Patches
- 9 Configure WeBWorK
- 10 Check Dependencies
- 11 Set up the webwork database
- 12 Serving the Webwork2 Mojolicious App
- 13 Set Up the Webwork2 Job Queue
- 14 Test your configuration
- 15 If Something is Wrong
- 16 Create the admin Course
- 17 Check for and Install Hotfixes
- 18 Install the WeBWorK Problem Libraries
- 19 Create Your First Actual Course
- 20 Test that Things are Working Properly
- 21 More House Keeping
- 22 Optional Configurations
- 23 Known Issues
- 24 Housekeeping
- 25 Where to go From Here
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.).
Note that we will use wwadmin
to refer to your administrative user on the system. In practice you should NOT actually use wwadmin for your administrative user name. Using a fixed user name that is publicly known is a security vulnerability.
^
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.
Code blocks for command to enter in the shell begin with $
. You are not intended to type the $
character as part of the provided commands.
Note that many commands begin with sudo
. These commands are executed with super user privileges. You will need to enter your password for the first invocation of one of these commands which will begin a super user session. That session will timeout typically 15 minutes after the last entered sudo command, and you will need to enter your password again. You can also enter a super user shell with sudo -s
. However, it is not advisable to do so. This is an unsafe practice. Forgetting to exit the super user shell is a common mistake that can lead to disastrous consequences if the wrong command is executed with the elevated privileges.
Install the Ubuntu 22.04 Server Operating System
Installation
Connect to http://www.ubuntu.com/ for information. We recommend you use the "Long Term Support" (LTS) version of Ubuntu which is currently version 22.04. The next LTS release will be version 24.04 to be released in April, 2024.
The installation process consists of a series of steps or panels. In the panels, generally you will use <Tab>
or the up and down arrows to navigate, the <Space>
bar to check a box and the <Enter>
key to confirm an action. On the "Chose type of install" panel, select the default "Ubuntu Server", not the "Ubuntu Server (minimized)"
Enter the information for the steps until you get to the "Profile setup".
- Profile Setup
What you fill in for the "Profile setup" is a privileged user so you might want to enter a special administrative account rather than your normal account. You can use whatever you want. Do NOT use wwadmin
, but this is what will be referred to in these instructions by wwadmin
.
- Enter the information for "Your name"
- Enter the information for "Your Computer's name"
- Enter the information for "Pick a username" In these instructions, we will call this name
wwadmin
. - Enter the information twice for the password. In these instructions, you will need to enter this password for
sudo
commands. DO NOT FORGET WHAT YOU ENTER HERE.
- Then select
Done
and press<Enter>
.
- SSH Setup
- Select "Install OpenSSH server". Then select
Done
and press<Enter>
.
- Featured Server Snaps
- Do not select any server snaps. Then select
Done
and press<Enter>
.
Now sit back and relax while the installation takes place. This should be pretty quick. When you finally see "Reboot Now", press <Enter>
and log into your server.
Accessing Your Server Remotely
At this point 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).
You can do all of the remaining installation from a remote location if you wish. The advantage of doing this is that you can copy commands from these instructions (with copy
from the Edit menu or ^C
) and paste them into a terminal window
(with paste
from the Edit menu list or <Shift> <Ctrl> <V>
or <Shift> <Insert>
depending on your application). This is an excellent way to use these instructions since it is fast and insures commands are entered correctly (just be careful to read before you run the command and replace things like database_password
with the correct code in the few places such things occur).
Assuming your network has been set up, type
$ ip addr show
and you will see something like
... link/ether 00:0c:29:4f:2c:1d brd ff:ff:ff:ff:ff:ff inet 192.168.76.128/24 brd 192.168.76.255 scope global dynamic ens33 ...
Here 192.168.76.128 is the ip address of your server. Note that you should ignore the loopback address 127.0.0.1.
Fully Qualified Domain Name
Now we have to set your server's fully qualified domain name. Note that if your network was set up automatically via DHCP, your server's fully qualified domain name should already be set up. You can check by running the hostname
commands below.
Run the command
sudo hostnamectl set-hostname webwork
where of course you should replace webwork by whatever your server's name is.
You can check these settings by running the commands
$ hostname --fqdn
and
$ hostname
The first gives the server's fully qualified domain name (e.g. webwork.mydepartment.myschool.edu) and the second the server's name (e.g. webwork).
Install Software Packages
Ubuntu Software Packages
The following instructions will install necessary software packages. You may first have to run the commands
$ sudo apt update $ sudo apt upgrade
to update package locations and upgrade. Restart all services if requested.
Here is the list of Ubuntu packages that need to be installed.
cm-super
cpanminus
curl
dvipng
dvisvgm
gcc
git
imagemagick
libarchive-zip-perl
libarray-utils-perl
libclass-tiny-antlers-perl
libcrypt-jwt-perl
libcryptx-perl
libdata-dump-perl
libdata-structure-util-perl
libdatetime-perl
libemail-stuffer-perl
libexception-class-perl
libfile-find-rule-perl
libfile-sharedir-install-perl
libfuture-asyncawait-perl
libgd-perl
libhttp-async-perl
libiterator-perl
libiterator-util-perl
libjson-maybexs-perl
libjson-perl
liblocale-maketext-lexicon-perl
libmath-random-secure-perl
libminion-perl
libminion-backend-sqlite-perl
libmojolicious-perl
libmojolicious-plugin-renderfile-perl
libnet-ip-perl
libnet-ldap-perl
libnet-oauth-perl
libossp-uuid-perl
libpadwalker-perl
libpandoc-wrapper-perl
libpath-class-perl
libphp-serialization-perl
libpod-wsdl-perl
libsoap-lite-perl
libsql-abstract-classic-perl
libstring-shellquote-perl
libsvg-perl
libtemplate-perl
libtext-csv-perl
libtimedate-perl
libuniversal-can-perl
libuniversal-isa-perl
libuuid-tiny-perl
libxml-parser-easytree-perl
libxml-parser-perl
libxml-writer-perl
libyaml-libyaml-perl
make
netpbm
openssh-server
pdf2svg
preview-latex-style
texlive
texlive-latex-extra
texlive-science
unzip
To install all of these packages in one fell swoop run the command (obviously you want to use cut and paste)
$ sudo apt install cm-super cpanminus curl dvipng dvisvgm gcc git imagemagick \ libarchive-zip-perl libarray-utils-perl libclass-tiny-antlers-perl \ libcrypt-jwt-perl libcryptx-perl libdata-dump-perl libdata-structure-util-perl \ libdatetime-perl libemail-stuffer-perl libexception-class-perl \ libfile-find-rule-perl libfile-sharedir-install-perl libfuture-asyncawait-perl \ libgd-perl libhttp-async-perl libiterator-perl libiterator-util-perl \ libjson-maybexs-perl libjson-perl liblocale-maketext-lexicon-perl \ libmath-random-secure-perl libminion-perl libminion-backend-sqlite-perl \ libmojolicious-perl libmojolicious-plugin-renderfile-perl libnet-ip-perl \ libnet-ldap-perl libnet-oauth-perl libossp-uuid-perl libpadwalker-perl \ libpandoc-wrapper-perl libpath-class-perl libphp-serialization-perl \ libpod-wsdl-perl libsoap-lite-perl libsql-abstract-classic-perl \ libstring-shellquote-perl libsvg-perl libtemplate-perl libtext-csv-perl \ libtimedate-perl libuniversal-can-perl libuniversal-isa-perl libuuid-tiny-perl \ libxml-parser-easytree-perl libxml-parser-perl libxml-writer-perl \ libyaml-libyaml-perl make netpbm openssh-server pdf2svg preview-latex-style \ texlive texlive-latex-extra texlive-science unzip
Accept any prompts with the default answer by hitting <Enter>
. Restart all services if requested.
Installation of Other Perl Modules with cpanm
We will use cpanm
to install other Perl modules that are not available as Ubuntu packages or a different version than the Ubuntu packaged version is needed. To install these modules execute
$ sudo cpanm --notest Statistics::R::IO Perl::Tidy@20220613 XML::LibXML
Note that --notest
is added to avoid the unit tests that make the installation take considerably longer, and require the installation of additional dependencies used only for the tests.
Later we will check that all Perl modules have been properly installed.
Install a Database
This section installs MariaDB as the database manger for webwork. MariaDB is the recommended database but you can install and use MySQL if you wish.
Install and Testing MariaDB
Install MariaDB using the distribution and cpan packages.
$ sudo apt install mariadb-server libmariadb3 libmariadb-dev libdevel-checklib-perl $ sudo cpanm DBD::MariaDB
Restart all services if requested.
Secure the Database
Then we should secure the database. Note that if you install MariaDB as suggested, all mysql commands automatically use MariaDB.
$ sudo mysql_secure_installation
To get started just hit <Enter>
since there is no password set for root. You should answer n
to the first two questions as is suggested and answer Y
to all the remaining questions.
Now test that all is well:
$ sudo mysql
You should see
Welcome to the MariaDB monitor ... MariaDB>
Now lets check the MariaDB users. To see the users, do the following
MariaDB> SELECT user,authentication_string,plugin,host FROM mysql.user;
You will see a table with only three users: mariadb.sys
, root
and mysql
.
Now exit MariaDB
MariaDB> exit Bye $
Starting and Stopping MariaDB (or MySQL)
On rare occasions you may need to start, stop, or restart the database server.
To start the MariaDB
or MySQL
server run the command
$ sudo systemctl start mysql
To stop the MariaDB
or MySQL
server run the command
$ sudo systemctl stop mysql
To restart the MariaDB
or MySQL
server run the command
$ sudo systemctl restart mysql
To obtain more information about the MariaDB
or MySQL
server run
$ systemctl status mysql
Connection Limits
Those coming from earlier versions of WeBWorK, especially 2.13 and 2.14, may have never run into connection limits on the SQL database write, depending on the total class enrollments. In 2.18, especially using hypnotoad (see below), the connection limit default of 151 connections can be reached fairly easily. So long as your system resources allow it, increasing this limit to approximately twice the number of workers used in the web serving can help prevent very scary errors from confusing your users. Edit the MariaDB conf file at:
$ sudo nano /etc/my.cnf
Beneath the first line, which should state something like:
[mysqld]
add a line to increase this number. For example, if the number of workers for your hypnotoad setup (below) was set to 250, then 500 might be an appropriate choice for the maximum number of connections.
Max_connections = [preferred new max digits]
(Aside) If you are using MySQL instead of MariaDB, this file is located at /etc/mysql/mysql.conf.d/mysql.cnf. Same setting, same information, just a different configuration location.
Install WeBWorK
We are at the point where we can start downloading and installing WeBWorK.
Note the instructions below assume you are installing WeBWorK from scratch. If you are just upgrading WeBWorK, especially if you already have existing WeBWorK courses, see Release notes for WeBWorK 2.18#Upgrade Instructions.
Create the Required Directories
$ sudo mkdir /opt/webwork $ sudo chown wwadmin:wwadmin /opt/webwork $ cd /opt/webwork $ mkdir libraries courses
Reminder: You should use the account you selected to administer webwork instead of wwadmin
above.
Download the WeBWorK System Software and Problem Libraries
We will use Git to download WeBWorK from Github. This is easy and it will also make it easy to update the system in the future. Note that for long commands it is much easier to copy (^C) them from this document and paste (<Shift><Ctrl><V> or <Shift><Insert>) them in a terminal window.
$ cd /opt/webwork $ git clone https://github.com/openwebwork/webwork2.git $ git clone https://github.com/openwebwork/pg.git $ cd libraries $ git clone https://github.com/openwebwork/webwork-open-problem-library.git
The first and second git clone
commands above download the latest released versions of WeBWorK 2 and PG.
The third command downloadss the WeBWorK Open Problem Library (OPL) which contains thousands of WeBWorK problems (over 37,000 currently).
Important Note. The above commands retrieve the main branch which gives the latest stable release of the software package (webwork2, pg, etc.) with bug fixes. Since a later version has now been released you will need to execute the following commands to obtain the 2.18 release of WeBWorK (with bug fixes).
$ cd /opt/webwork/webwork2 $ git checkout -b WeBWorK-2.18+ WeBWorK-2.18+ $ cd /opt/webwork/pg $ git checkout -b PG-2.18+ PG-2.18+
The main information page about WebWorK downloads is available at http://webwork.maa.org/wiki/Category:Release_Notes
The main information page about the OPL is available at http://webwork.maa.org/wiki/Open_Problem_Library
Setup the Directory for Courses
Now copy content into courses
directory.
$ cd /opt/webwork/webwork2/courses.dist $ cp *.lst /opt/webwork/courses/ $ rsync -a modelCourse /opt/webwork/courses/
Set File and Directory Permissions
The PG installation directory and files should be owned by the primary wwadmin
user and not writable by other users, but readable by all:
$ sudo chmod -R u+rwX,go+rX /opt/webwork/pg
Most WeBWorK directories and files should also be owned by the primary wwadmin
user and not writable by other users, and again readable by all:
$ sudo chmod -R u+rwX,go+rX /opt/webwork/webwork2
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 use the default group for web services www-data
.
It is helpful for the user administering webwork to be in this group. As above we are calling this user wwadmin
. To add wwadmin
to the www-data
group,
$ sudo adduser wwadmin www-data
where of course you should replace wwadmin
by the actual user name. You can check that this succeeded by running
$ id wwadmin
and then you should see www-data
listed under groups.
Now we make the WeBWorK directories that need to be writable by the web server have www-data
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.
$ cd /opt/webwork/webwork2/ $ sudo chgrp -R www-data DATA ../courses htdocs/tmp logs tmp $ sudo chmod -R g+w DATA ../courses htdocs/tmp logs tmp
Configure the Shell
To make working with WeBWorK easier, there are a couple of changes you can make to your shell environment.
Add the WeBWorK bin
directory to your path. This will allow you to run WeBWorK command-line utilities without typing the full path to the utility. Go to your home directory and backup your .bashrc
file
$ cd $ cp .bashrc .bashrc.bak
Now edit .bashrc
$ nano .bashrc
After the last line add the three lines:
export PATH=$PATH:/opt/webwork/webwork2/bin export WEBWORK_ROOT=/opt/webwork/webwork2 export PG_ROOT=/opt/webwork/pg
Then save the file and Quit.
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 $ echo $PG_ROOT
Obtain Javascript Libraries
Install node and npm
WW 2.18 requires newer versions of node and npm than are in the Ubuntu repositories.
Note that if you have a previous version of node installed, then you will need to first uninstall it. To determine if this is the case run
$ node --version
If that shows vNN.??.?
where NN
is 16 or more, then you already have a new enough version of node installed. If that says Command 'node' not found, ...
, then skip to installing node below. If a version is shown that does not start with 16 or more, then uninstall node with the commands:
$ sudo apt autoremove nodejs nodejs-doc $ sudo rm /etc/apt/sources.list.d/nodesource.list $ sudo apt update
Run the following commands to install node version 16 and npm version 8 from nodesource:
$ curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - $ sudo apt install -y nodejs
Installing Javascript Libraries
Javascript libraries are obtained using npm
. This includes the following javascript packages:
codemirror
bootstrap
flatpickr
fontawesome
iframe-resizer
jquery
jquery-ui
mathjax
sortablejs
jsxgraph
mathquill
Furthermore, all local javascript and css files are minimized, and the generated file names include a hash of the content. This ensures that browser's always are served up to date files when these files change, and prevent the need for users to need to refresh their browser cache.
To install all javascript dependencies and minimize local javascript and css:
$ cd /opt/webwork/webwork2/htdocs/ $ npm ci $ cd /opt/webwork/pg/htdocs/ $ npm ci
Note that a message may be displayed stating that "Browserlist: caniuse-lite is outdated." You can safely ignore that message.
Miscellaneous System Patches
If the users of your system will be using problems that utilize the new PGtikz.pl
macro then you will need to apply the following patch:
$ sudo patch -p1 -d / < /opt/webwork/webwork2/docker-config/imagemagick-allow-pdf-read.patch
Configure WeBWorK
Make Copies of the Distribution Configuration Files
Before configuring the system, you must make local copies of the site.conf
and localOverrides.conf
configuration files, located in /opt/webwork/webwork2/conf/
.
$ cd /opt/webwork/webwork2/conf $ cp site.conf.dist site.conf $ cp localOverrides.conf.dist localOverrides.conf
WeBWorK System Configuration
Most WeBWorK configuration is done in the files /opt/webwork/webwork2/conf/site.conf
and /opt/webwork/webwork2/conf/localOverrides.conf
. These files provide system-wide configuration settings, and defaults for course settings. Any setting in these files 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 localOverrides.conf
) in the course.conf
file. An instructor can only edit the course.conf
file herself (for her own course) if she has "admin" privilege which by default instructors do not have. But most things instructors may want to customize and many others (language, timezone, permissions, display modes, email, ...) can be set using the Course Configuration page from within the course and such setting override those in the configuration files.
Actually there are three main configuration files, site.conf
, defaults.config
and localOverrides.conf
. The reason there are three configuration files is to make upgrading WeBWorK easier.
site.conf
: This file contains global variables which are required for basic configuration. It will not be overridden when you update WeBWorK but its distribution version,site.conf.dist
will be.defaults.config
: This file contains initial settings for many customizable options in WeBWorK. Do not edit defaults.config. It will be overridden next time you upgrade.localOverrides.conf
This is where you should add all local customizations. It will not be overridden when you update WeBWorK but its distribution version,localOverrides.conf.dist
will be.
There are several options that must be set for WeBWorK to work with your system. The rest of the file consists of customization options.
Edit the site.conf file
Now edit site.conf
$ nano /opt/webwork/webwork2/conf/site.conf
First we have to add information about your site's URL.
Search for server_root_url
and edit the line so that it reads:
$server_root_url = 'http://yourserver.yourschool.edu';
where of course you should edit yourserver.yourschool.edu
appropriately. The "http://" is important. If you are running a secure server (i.e., using SSL - really TLS), the url should start with https:
but you should wait to make that change until after WeBWorK is up and running and you set up SSL. In that case the "https://" is important.
If you would like to serve third party javascript and css files from a CDN instead of from your server, then change $options{thirdPartyAssetsUseCDN} = 0;
to $options{thirdPartyAssetsUseCDN} = 1;
.
Database Settings
Search for the code $database_driver
. By default the $database_driver
is set to MariaDB which is correct unless you installed MySQL. If you installed MySQL, uncomment the MySQL line and comment out the MarisDB line.
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 unused password we set when securing MySQL.
Search for database_password
and replace the line
$database_password = "passwordRW";
by
$database_password = 'database_password';
where of course you should replace "database_password" with your own password but do use the single quotes. Remember this password as we will need it below.
WeBWorK sends mail in two instances. 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 configure 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
$mail{smtpServer} = ; # e.g. 'mail.yourschool.edu' or 'localhost' $mail{smtpSender} = ; # e.g. 'webwork@yourserver.yourschool.edu'
entering the appropriate information. Be sure to use single quotes and NOT double quotes around email addresses otherwise Perl will treat @ as an array variable.
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 a list of timezones recognized by DateTime run the command
timedatectl list-timezones
These timezones are more refined than standard time zone 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 America/New_York
and you should enter $siteDefaults{timezone} = "America/New_York";
which is the default. Read the documentation in this section of the the site.conf
file for more information on selecting time zones and formatting dates.
Search for $siteDefaults{timezone}
and enter your local timezone if it is not correct.
Then save the file and Quit.
The defaults.config file
The defaults.config
contains basic defaults for your system. You should not need to change these but if you decide to, you should not change them here since this file will be overwritten when you update WeBWorK. Instead make the change in the localOverrides.conf
file using the same syntax as in the defaults.config
file.
Custom Themes
If you would like to customize the appearance of WeBWorK, then see Customizing WeBWorK.
Default Header Files
After you have used WeBWorK for awhile, you may want to change the default header files in defaults.config
. Search for $webworkFiles{screenSnippets}{setHeader}
and $webworkFiles{hardcopySnippets}{setHeader}
in localOverrides.config
. Settings in the conf and config files affect all WeBWorK courses. You can override any setting in these conf and config files for an individual course by putting the local setting in course.conf
.
Check Dependencies
Check Perl Modules
WeBWorK includes a script called check_modules.pl
(in the directory /opt/webwork/webwork2/bin
) 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
Scroll up and look through the listing. It should find everything. If something is missing (flagged by **
), look back through these instructions to find where it should have been installed and install it.
Check LaTeX packages
Now we check that all necessary LaTeX packages have been installed. Run the command
$ check_latex
and look for missing packages. If the script displays "Compilation Success!", then all is good!
Set up the webwork database
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>
make sure that you replace database_password
with the password you set when editing site.conf
above):
$ sudo mysql MariaDB > CREATE DATABASE webwork; MariaDB > CREATE USER 'webworkWrite'@'localhost' IDENTIFIED BY 'database_password'; MariaDB > GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, LOCK TABLES ON webwork.* TO 'webworkWrite'@'localhost'; MariaDB > exit Bye $
Serving the Webwork2 Mojolicious App
You now have a choice to make. That is how to serve webwork2. There are two primary choices. Either the app may be served directly via hypnotoad (option 1 below), or it may be proxied via another web server. If your server is dedicated to serving only webwork2, then serving directly via hypnotoad is the simplest choice. (Note that this option does allow for either a customizable root url or a redirect of the root url to another site.) However, if your server will be serving other sites as well then you will need to proxy the app via another web server. For that we provide instructions for serving via apache2 or nginx (options 2 and 3 below). However, another server could be used as well.
All approaches use the webwork2.mojolicious.yml and webwork2.service files. Start by copying the dist files.
$ cd /opt/webwork/webwork2/conf $ cp webwork2.mojolicious.dist.yml webwork2.mojolicious.yml $ cp webwork2.dist.service webwork2.service
Edit /opt/webwork/webwork2/conf/webwork2.mojolicious.yml with your preferred text editor. Near the beginning of the file change the secrets:
to whatever you want to change it to, but don't leave it at the default setting. You can choose random characters or a long phrase.
Option 1: Serving Directly via Hypnotoad
Edit /opt/webwork/webwork2/conf/webwork2.mojolicious.yml with your preferred text editor. At the very end of the hypnotoad:
section comment out the line that reads proxy: 1
by inserting a #
character at the beginning of the line.
Determine if you are going to be serving securely with SSL certificates or not. If so use port 443 below, otherwise use port 80.
If you are serving securely with SSL certificates, then change listen:
at the beginning of the hypnotoad:
section to include your ssl certificates. See the examples in the file for the format that is needed. You will also need to make sure that the www-data user has read permissions for the certificate files. This is possibly trickier than you might think: you need the directory path that the certificate and key are in (e.g., .pem files from letsencrypt) to be readable by www-data or whatever your .yml file specifies as the user and group. There is a log by default at /opt/webwork/webwork2/logs/webwork2.log which can often help debugging this step.
If you are not serving securely with SSL certificates, then change listen:
at the beginning of the hypnotoad:
section to - http://*:80
.
Search for the lines
clients: 1 workers: 25 spare: 8
and edit the numbers depending on the amount of RAM available on your server. Look at the recommendations for these settings in the section immediately above these lines in the webwork2.mojolicious.yml file - roughly 10 workers per GB of RAM, with buffer for the OS and the spare; and spare set to approximately 10% of total workers.
Then save the file and Quit.
Install Mojolicious::Plugin::SetUserGroup
By default on Ubuntu ports 80 and 443 can not be bound to by non-root users, and so the hypnotoad server will be started as root so that the needed ports can be bound. However, the server should not be run as root as that is a security vulnerability. So the server will be switched to the www-data user after the ports have been bound. The Mojolicious::Plugin::SetUserGroup
module takes care of this. Install it with
$ sudo cpanm --notest Mojolicious::Plugin::SetUserGroup
The --notest
flag is needed to skip the module unit tests on Ubuntu 22.04 as those tests fail.
Configure the Webwork2 Systemd Service
There are a few changes to the systemd service configuration needed for this option. Edit /opt/webwork/webwork2/conf/webwork2.service with your preferred text editor. Comment out the lines that read
User=www-data Group=www-data Environment="MOJO_REVERSE_PROXY=1"
by inserting a #
character at the beginning of each line.
Then save the file and Quit.
Optional Configuration Details
Next determine where you want the root url to go, i.e., the location http[s]://yoursite.edu/.
If you want to display fixed html content, then execute
$ cp /opt/webwork/webwork2/htdocs/index.dist.html /opt/webwork/webwork2/htdocs/index.html
and edit the copied file by adding your custom content.
If you want to redirect to another site, then edit /opt/webwork/webwork2/conf/webwork2.mojolicious.yml, uncomment the server_root_url_redirect:
setting, and change that setting to point to the desired site.
If you are serving securely with SSL certificates, then you will most likely want to redirect unsecure connections to port 80 to secure connections on port 443. To make this happen add the line - http://*:80
below the line - https://*:443?...
in the listen:
part of the the hypnotoad:
section, and change redirect_http_to_https: 0
to redirect_http_to_https: 1
in the file /opt/webwork/webwork2/conf/webwork2.mojolicious.yml.
Option 2: Serving via Proxy by Apache2
First install the apache2 server with
$ sudo apt install apache2
Note that this guide does not cover basic site configuration of the apache2 server.
Webwork2 ships with an apache2 configuration file that needs to linked into your apache2 configuration process. Create a copy of the dist file with
$ cp /opt/webwork/webwork2/conf/webwork2.apache2.4.dist.conf /opt/webwork/webwork2/conf/webwork2.apache2.4.conf
and link it into your apache2 configuration process with
$ sudo ln -s /opt/webwork/webwork2/conf/webwork2.apache2.4.conf /etc/apache2/conf-enabled/webwork2.conf
If you do not have ssl certificates to serve with https, then edit /opt/webwork/webwork2/webwork2.apache2.4.conf, and change RequestHeader set X-Forwarded-Proto "https"
to RequestHeader set X-Forwarded-Proto "http"
.
Additional apache2 modules are needed to proxy webwork2. Enable these with
$ sudo a2enmod proxy proxy_http headers
Next we will make a few changes to Apache's default configuration. We need to edit two files. First we will save copies of the original files.
$ cd /etc/apache2/ $ sudo cp apache2.conf apache2.conf.bak $ cd /etc/apache2/mods-available/ $ sudo cp mpm_event.conf mpm_event.conf.bak
Edit apache2.conf
$ sudo nano /etc/apache2/apache2.conf
Search for the line
Timeout 300
and replace it by
Timeout 1200
Then save the file and quit.
Edit mpm_event.conf
$ sudo nano /etc/apache2/mods-available/mpm_event.conf
Search for the lines
MaxRequestWorkers 150 MaxConnectionsPerChild 0
Which occur under <IfModule mpm_event_module>
and replace them by
MaxRequestWorkers 10 MaxConnectionsPerChild 50
where you should set MaxRequestWorkers depending on what is needed for your server. A good rule of thumb is 5 MaxRequestWorkers per 1 GB of memory available on the server. Note that for busy servers, you should observe your memory usage and adjust the above settings as necessary. Also make sure MaxSpareThreads is not set too high.
Then save the file and quit.
Now restart apache2 so that changes to the configuration take effect.
$ sudo systemctl restart apache2
The apache2 process is controlled with systemctl
. If the apache2 configuration is changed, then you will need to restart apache2 in order for those changes to take effect as was done above. In addition you can stop and start the apache2 process with
$ sudo systemctl stop apache2 $ sudo systemctl start apache2
You can also obtain more information about the running service with
$ systemctl status apache2
Sometimes to determine problems with the apache2 process it is helpful to view the apache2 error log. The log is saved in the file /var/log/apache2/error.log.
Option 3: Serving via Proxy by Nginx
First install the Nginx server with
$ sudo apt install nginx
At this point this guide does not cover basic site configuration. Ubuntu has a default configuration file located at /etc/nginx/sites-available/default
that you can start with for this. (Nginx documentation recommends using a file in /etc/nginx/conf.d
instead.) In any case make note of which file you are using for the following. This will be referred to as "your site's Nginx configuration file."
Webwork2 ships with an Nginx configuration file that needs to be included in your Nginx configuration. Create a copy of the dist file with
$ cp /opt/webwork/webwork2/conf/webwork2.nginx.dist.conf /opt/webwork/webwork2/conf/webwork2.nginx.conf
Edit your site's Nginx configuration file to include this file. In your configuration file find the primary server
section, and add the line include /opt/webwork/webwork2/conf/webwork2.nginx.conf;
to the end of the section. You will need to determine which server
section is the correct one to use if you have multiple such sections in the file.
Restart the nginx process for that change to take effect.
$ sudo systemctl restart nginx
The nginx process is controlled with systemctl
. If the nginx configuration is changed, then you will need to restart nginx as done above. In addition you can stop and start the nginx process with
$ sudo systemctl stop nginx $ sudo systemctl start nginx
You can also obtain more information about the running service with
$ systemctl status nginx
Sometimes to determine problems with the nginx process it is helpful to view the nginx error log. The log is saved in the file /var/log/nginx/error.log.
Install Favicon for Options 2 and 3
Copy WeBWorK's icon file favicon.ico
to Ubuntu's html
directory.
$ sudo cp /opt/webwork/webwork2/htdocs/favicon.ico /var/www/html
Enable and start the Webwork2 Systemd Service
Next set up the systemd service that will control the webwork2 app. Execute the following to enable and start the service.
$ sudo systemctl enable /opt/webwork/webwork2/conf/webwork2.service $ sudo systemctl start webwork2
At this point webwork2 is now running, and you should be able to open your browser to http://yoursite.edu/webwork2 or https://yoursite.edu/webwork2.
Note that anytime you make changes to the webwork2 configuration files you will need to restart the app in order for those changes to take effect. This can be done by executing
$ sudo systemctl restart webwork2
In addition you can stop and start the webwork2 app with
$ sudo systemctl stop webwork2 $ sudo systemctl start webwork2
Set Up the Webwork2 Job Queue
Some long running processes are not directly run by the webwork2 app. Particularly mass grade updates via LTI and sending of instructor emails. Instead these tasks are executed via the webwork2 Minion job queue. If the users of your system will be utilizing either of those features, then you will need to set up the webwork2 job queue. If those features will not be utilized by the users of your system, then you can skip this section.
Install Dependencies
The libminion-backend-sqlite-perl
package installed above depends on libmojo-sqlite-perl
which contains version 3.008 of the Perl module Mojo::SQLite
. Unfortunately, there is an issue with that version on Ubuntu 22.04 that prevents the Minion SQLite backend from functioning correctly. So version 3.002 needs to be installed from CPAN instead.
First install additional Ubuntu packages that are needed for this with
$ sudo apt install libextutils-config-perl libextutils-installpaths-perl libextutils-helpers-perl
Then downgrade Mojo::SQLite
with the command
$ sudo cpanm --notest Mojo::SQLite@3.002
Note that the --notest
flag is needed as the unit tests that are executed by default also fail.
Enable and start the Webwork2 Job Queue Systemd Service
Copy webwork2-job-queue.dist.service
to webwork2-job-queue.service
with
$ cd /opt/webwork/webwork2/conf $ cp webwork2-job-queue.dist.service webwork2-job-queue.service
Then execute the following to start the job queue
$ sudo systemctl enable /opt/webwork/webwork2/conf/webwork2-job-queue.service $ sudo systemctl start webwork2-job-queue
Note that you can start, stop, and restart the job queue with the following commands:
$ sudo systemctl start webwork2-job-queue $ sudo systemctl stop webwork2-job-queue $ sudo systemctl restart webwork2-job-queue
It is worth checking to make sure the webwork2-job-queue has started properly. If anything is wrong, it'll quietly just hang, and then most of the courses will run fine, except certain things like mass grade updates, which will just never run.
$ sudo systemctl status webwork2-job-queue
Even though the webwork2-job-queue.service
file specifies user www-data
and group www-data
, and even if permissions are set appropriately as above (re: logs directory), if you're doing an upgrade-in-place, you might end up in a situation where the www-data
user can't write to webwork2.log
, and then the job queue will fail. The above status check will indicate this, and you can then double-check permissions on the log directory, and make sure that the files are writeable by www-data
.
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.
If Something is Wrong
If something is wrong one of the first things to check is that the config files have been edited correctly. 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. You may also want to check the webwork2 app log. Errors and other information from the running app will appear here. The webwork2 app log is saved in the file /opt/webwork/webwork2/logs/webwork2.log.
$ cd /opt/webwork/webwork2/conf/ $ diff site.conf site.conf.dist $ diff localOverrides.conf localOverrides.conf.dist $ tail /opt/webwork/webwork2/logs/webwork2.log
If something is wrong and you fix it, you will have to restart webwork2 for the changes to take effect
$ sudo systemctl restart webwork2
If webwork2 is proxied via another web server, then you may also need to examine the configuration files and log files for the web server as well. If changes are made to the web servers configuration file, then the web server will need to be restarted.
Create the admin Course
Course Administration gives information about creating courses. Here we will give explicit instructions for doing this. (You may need to become root or use sudo to execute some of these commands.)
$ cd /opt/webwork/courses $ /opt/webwork/webwork2/bin/addcourse admin --users=adminClasslist.lst $ sudo chown -R www-data:www-data admin
where the last line makes the course admin
and its subdirectories owned by the Apache server and readable/writeable by the wwadmin user.
Now go to http://yourserver.yourschool.edu/webwork2
and should see the WeBWorK home page with Course Administration
listed at the top. Click on it and login with Username admin
and Password admin
. This first thing you should do is register your new WeBWorK installation. It's quick and easy, just click on Register
. IMPORTANT The next thing you should do is click on User Settings
and change admin
's password to something more secure than admin
.
Unless you choose otherwise, users with admin
privileges in the admin
course (i.e. WeBWorK administrators) will automatically be added to new courses with admin
privileges 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 - Click the
Add
tag and clickTake Action!
- Enter the appropriate information (you can use your
Login Name
as theStudent ID
if you want and also you can leave the last three items blank) and clickAdd 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 click the
Password
tag and clickTake Action!
. (Note as a safely mechanism you can not change the password for the user you are logged in as, currentlyadmin
, this way) - Enter the password and then click
Take Action!
- Finally give yourself
admin
privileges by selecting yourself with a check mark, clicking theEdit
tag and then clickingTake 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
fromstudent
toadmin
- 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 (or unhide) a course select Hide Courses
in the admin course and follow the directions. When hidden a course 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
.
Now go to http://yourserver.yourschool.edu/webwork2
and no course will be listed.
Check for and Install Hotfixes
The following commands show you how to check for and install bug fixes. Important Note: These commands check and retrieve the main branch which gives the latest stable release of the software package (webwork2, pg, etc.) with bug fixes. If a stable release newer than 2.18 exists for webwork2 and/or pg, that will be checked and retrieved which is probably not what you want. Please check before updating. The best way to do that is to look at https://github.com/openwebwork/webwork2/blob/main/VERSION and https://github.com/openwebwork/pg/blob/main/VERSION.
To check if there are bug fixes, do the following.
Update the webwork2 code
First we check for updates to the webwork2 code:
cd /opt/webwork/webwork2/ git remote show origin
This will print several lines of data, but the last line will tell you if your copy is up to date or out of date. If it is out of date, run
git pull origin
and restart webwork2.
Update the pg code
Now check for updates to the pg code:
cd /opt/webwork/pg/ git remote show origin
This will print several lines of data, but the last line will tell you if your copy is up to date or out of date. If it is out of date, run
git pull origin
and restart webwork2.
Restart webwork2
Important: After updating either webwork2 or pg, you have to restart the webwork2 app with
$ sudo systemctl restart webwork2
Update the OPL
The following assumes you have already installed the OPL. For that see #Install the Open Problem Library below. Now check for updates to the Open Problem Library (OPL):
$ cd /opt/webwork/libraries/webwork-open-problem-library $ git remote show origin
This will print several lines of data, but the last line will tell you if your copy is up to date or out of date. If it is out of date and you want to update, run:
$ git pull origin $ OPL-update
Important Note: The OPL contains over 37,000 problems and if one new problem is added, the above will report the OPL is out of date. I would suggest you update the OPL maybe once or twice a semester. Also the version of the OPL contained in the WW 2.19 Virtual Machine Image and in the WW 2.19 Amazon Machine Image is current as of August 1, 2024.
Updating the OPL is pretty much risk free since changes usually involve only a relatively small number of individual problems and the vast majority of problems remain unchanged. Updating the OPL does not require restarting webwork2.
Install the WeBWorK Problem Libraries
Before we create a real course we will install the WeBWorK Problem Libraries.
Install the Open Problem Library
The Open 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 load a database for searching it.
Run the OPL-update
script which will download the OPL metadata release and checkout the corresponding tag in the library as needed for the Library Browser in WeBWorK. Since this is a new installation, we do not have any OPL statistics to upload (see OPL_Problem_Statistics), so we run the command:
$ SKIP_UPLOAD_OPL_STATISTICS=1 OPL-update
If at some time in the future you want to upgrade the Problem Library, the process is easy, see Updating the OPL. Note that this is something you should do fairly often so that your library is up to date with new problems and bug fixes for old ones.
Set up access to the Contrib directory
The Contrib
directory contains contributions to the OPL that may not have been formally accepted into the main collection of OPL problems. This may be because the contribution is recent and has not yet been reviewed or because the problems are not properly tagged as is the case with the CAPA problem collection. It also contains the original versions of problems that have been accepted into the OPL (the idea being that the original authors maintain control of problems in the Contrib
directory but problems in the OPL are controlled by the editors).
There should be a link named Contrib
in the directory
/opt/webwork/courses/modelCourse/templates/
so that when courses are created copying templates from the modelCourse
, the Contrib directory will be available. A button in the Library Browser which gives access to problems in the Contrib
directory will be available for all courses with this link. We recommend you keep this setting.
However, if you only want this for individual courses, not all courses then remove the link in the modelCourse
above. Then after creating a course, for example after creating myTestCourse
below, do the following
$ cd /opt/webwork/courses/myTestCourse/templates/ $ sudo ln -s /opt/webwork/libraries/webwork-open-problem-library/Contrib Contrib
to enable access to Contrib for the course. For other courses change myTestCourse to the course id.
Set up the Rochester and Union Libraries
This step is optional. It creates buttons in the Library Browser which give direct links to the Rochester and Union libraries. If you don't do this, you can find these libraries and others under the OPL Directory
button. But you can follow this example if you want to create button(s) for direct access to other sub libraries.
First we need to edit localOverrides.conf
one last time
$ cd /opt/webwork/webwork2/conf $ nano localOverrides.conf
Search for courseFiles{problibs}
and scroll down several lines to the lines
# rochesterLibrary => "Rochester", # unionLibrary => "Union",
Uncomment these lines (i.e. remove the #
) so they become
rochesterLibrary => "Rochester", unionLibrary => "Union",
Then save the file and quit.
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 Open Problem Library. Note that the Rochester, Union and other libraries are contained in the OPen Problem Library and are accessible from there under the OPL Directory
button in the Library Browser. This step simply creates buttons in the Library Browser so that you can access the Rochester and Union libraries directly.
$ cd /opt/webwork/courses/modelCourse/templates/ $ sudo ln -s /opt/webwork/libraries/webwork-open-problem-library/OpenProblemLibrary/Union unionLibrary $ sudo ln -s /opt/webwork/libraries/webwork-open-problem-library/OpenProblemLibrary/Rochester rochesterLibrary
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/webwork-open-problem-library/OpenProblemLibrary/
you might find other libraries that are not yet listed in global.conf
and these can be added in the same way as the Rochester and
Union
libraries. 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.
Install and Set Up the CAPA Library
This step is optional. It installs and sets up the CAPA Library, which is a library of physics problems.
We have to put a link in the templates directory of every course that needs access to the CAPA Library. If you want to have every course you create have access to the CAPA Library put the link in the modelCourse
. Actually this link, called capaLibrary
, has already been added to
/opt/webwork/courses/modelCourse/templates/
so no action on your part is required.
If you just want to do this for individual courses, not all courses then remove the link capaLibrary
in the modelCourse
above, and then do the following. We don't have any yet. But for example after creating myTestCourse
below, to set up access to the CAPA Library from myTestCourse
, do the following
$ cd /opt/webwork/courses/myTestCourse/templates/ $ sudo ln -s /opt/webwork/libraries/webwork-open-problem-library/Contrib/CAPA/ capaLibrary
and do the analogous thing for every course that needs access to the CAPA Library.
Then to gain access to the CAPA Library from the course, simply go to the Library Browser
and click on the CAPA
button.
Create Your First Actual Course
Since we have edited site.conf
and localOverrides.conf
and these are critical files, it would be a good idea to run
$ cd /opt/webwork/webwork2/conf $ diff site.conf site.conf.dist $ diff localOverrides.conf localOverrides.conf.dist
and check that you haven't made any mistakes (e.g. by introducing an inadvertent line break, etc.). If there are any mistakes, correct them. Remember that any time you change these files you must restart the webwork2 app in order for these changes to take effect. Do this with
$ sudo systemctl restart webwork2
Now log into the admin
course ( http://yourserver.yourschool.edu/webwork2/admin
or, if you have not hidden the admin course, click on Course Administration
on WeBWorK's home page http://yourserver.yourschool.edu/webwork2/
) as yourself or admin
and
- click on
Add Courses
- For
Course ID
entermyTestCourse
- For
Course Title
enterMy Test Course
- Enter your institution
- Leave
Add WeBWorK administrators to new course
checked - Add an additional instructor if you wish
- Copy templates from:
modelCourse
(the default action) - Leave
Also copy simple configuration file
checked - Click on
Add Course
- Click
Log into myTestCourse
and log in either as admin
or yourself (if you added yourself as an additional instructor above).
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 WeBWorK app error log which is located at /opt/webwork/webwork2/logs/webwork2.log
and/or the Apache error log which is located at /var/log/apache2/error.log
and/or the nginx error log located at /var/log/nginx/error.log
.
Click on Hmwk Sets Editor
on the Main Menu
. Then select Import
, select setDemo.def
from the Import from where
drop down list and select all current users
from the assigning this set to
drop down list. Then hit Import
Now click on Homework Sets
on the Main Menu
and click on Demo
. Then look at the problems. Mathematical equations should be displayed nicely by MathJax (right click on the equation for info). You can also display equations as images but this is not recommended.
Note that since you probably used "admin" to login you have Permission Level "admin" so things look a bit more complicated than if you were just a regular professor with Permission Level "professor". In particular any time you view a problem, you have the option to "Edit tags" which you probably do not want to do. If this bothers you, login as a professor (see below).
Continue looking at problems to see if everything is working properly.
Next click on Problem List
to bring back the Problem List Page and click on Download PDF ...
. The page is complicated because you are an admin so you see the professor view (students see a very simple page) but you can just scroll to the bottom and click on Generate hardcopy for selected users and selected sets
. If you get an error, then look at the various log files that are linked to on the output page (normally these files are removed if there are no errors). If you want to preserve these temporary files, then set perserve_temp_files
to 1 in the file /opt/webwork/webwork2/conf/webwork2.mojolicious.conf
and restart the webwork2 service. Remember to change preserve_temp_files
back to 0 and restart the webwork2 service again or you will be saving a lot of unnecessary files. You can find these temporary files in /opt/webwork/webwork2/tmp/
, then look under your course, hardcopy
, and user. You will have to switch to being the root user to access the final subdirectory containing the tmp files.
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 Open Problem Library
(actually it should already be selected so it will be greyed out) 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. Note that if you just happen to view some statistics problems that require the R server, you will get errors (since we have not installed R --- at least not yet).
Note: if when using the Library Browser
you find that after selecting a Subject
, you can not select a Chapter
(and usually an error toast will be shown), the most common reason is that $server_root_url has not been set "correctly" in the /opt/webwork/webwork2/conf/site.conf
file. A common error is to use forget http:// or to use http:// when you should use https:// or to just have the wrong domain name or ip address. But sometimes "localhost" will work when the correct ip address or url will not, for example in situations when you are using a virtual machine as your host.
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 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. Also you can Import set0.def
and setMAAtutorial.def
and look through those problems. Note that most of these sets date from the early days of WeBWorK in the 1990's and the problems they contain, while they still work, are not examples of current good programing practices. For current programing methods, look at e.g. https://webwork.maa.org/wiki/Category:PGM. Further, Problem 12 in setMAAtutorial (file htmllinksexample.pg) contains a simple error which is typical of errors you might make in authoring your own problems. WeBWorK tries to tell you what the error is and you can use the Edit
button to edit and save the problem. Problem 2 in set0 (file prob1a.pg) may contain more subtle errors. The Open Problem Library (OPL) contains over 37,000 problems the vast majority of which are error free.
If you are new to WeBWorK or even if you are a pro, 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 or admin interfaces. Also for the same reason you should probably add a professor to myTestCourse and log in as that professor to see what the professor interface looks like.
Click on Classlist Editor
on the Main Menu
.
Then select Add
, for "Add how many students?" pick 2 and hit Take Action!
. Then add two students, say
Last Name
"Smith",First Name
"Jane" ,Student ID
"jsmith" andLogin Name
"jsmith"
Last Name
"A",First Name
"Prof" ,Student ID
"profa" andLogin Name
"profa"
and make sure to select all sets to assign them to both of them. Then hit Add Students
.
Now we make "profa" a professor. Again click on Classlist Editor
on the Main Menu
. The fast way is to click on the "pencil" by "profa", set the "Permission Level" to "professor" and hit Take Action!
.
Jane Smith's initial password will be her Student ID
jsmith
. Now login as Jane Smith and play around a little.
Prof A's initial password will be her Student ID
profa
. You should also login as Prof A and play around a little.
You can also add "practice users" and login as one of those to see how you can grant partial access to your course for practice or other reasons (e.g. auditors who don't want to be graded). To do this Click on Classlist Editor
, select Import
, select the "demoCourse.lst" (the only classlist available at this point) and hit Take Action!
.
More House Keeping
Hide the admin and myTestCourse courses
Log out of myTestCourse if you are logged in and go to the WeBWorK Welcome page. Click on Course Administration and login as admin with the new admin password you set for the admin course. Select "Hide Inactive Courses" and select the courses you want to hide and hit "Hide Courses". If you go back to the WeBWorK Welcome page, you will see no courses listed. You can still access these courses directly by
http://yoursite.edu/webwork2/admin http://yoursite.edu/webwork2/myTestCourse
where of course you should use your actual url.
Replace the default landing page
If serving webwork2 via a proxy by another web server, then you probably should replace /var/www/html/index.html
with a page which redirects to the webwork course list at your site. If serving webwork2 directly, then the same can be accomplished by editing /opt/webwork/webwork2/htdocs/index.html
(unless you are using the server_root_url_redirect:
setting instead). Something like the following should work:
<html> <head> <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Refresh" content="0;url=https://mysite.mydomain.edu/webwork2/"> <title>WeBWorK site - redirects to main page</title> </head> <body style="text-align: center;"> You probably want to use the <a href="https://mysite.mydomain.edu/webwork2/">the WeBWorK list of courses page</a> </body> </html>
Institution Logo
The institution logo (which is the MAA logo by default) appears on every WeBWorK page. You can replace with you own logo by doing the following. We took these directions verbatim from Alex Jordan's Forum post https://webwork.maa.org/moodle/mod/forum/discuss.php?d=5642.
All you need to do is add lines like these to a config file like localOverrides.conf:
$institutionLogo = 'myimage'; $institutionURL = 'URL for target if a user clicks on the image'; $institutionName = 'Name of the target, to be used in alt text';
myimage is an image file that you place in webwork2/htdocs/themes/math4/images/. It could be for example 'myimage.svg' containing some text.
The easiest way to do this is to search for the lines
# The institution logo should be an image file in the theme's images folder #$institutionLogo = 'my_school_logo.png'; #$institutionURL = 'http://www.myschool.edu'; #$institutionName = 'My University';
in /opt/webwork/webwork2/conf/localOverrides.conf
, remove the #'s
from the last three lines and enter your information.
If you want to just make the change for an individual course, copy the code and put it in
/opt/webwork/courses/Course_Name/course.conf
.
Optional Configurations
You should definitely consider implementing the following optional configurations.
Option A configures the server so that access to WeBWorK will be through an encrypted connection (SSL) with an https: URL.
Option B installs and configures the R server for statistical computing. Many statistics and probability problems (mostly contributed by faculty at the University of British Columbia) require this.
Option C sets up log rotation for WeBWorK's timing log.
Implement Option A (SSL)
Option A configures the server so that access to WeBWorK will be through an encrypted connection (SSL) with an https: URL. Note that TLS is the successor protocol to SSL and is used everywhere. So that when we and others use the more common acronym SSL, we really are talking about TLS.
Note that there are very explicit instructions for setting up an SLL connection using the WeBWorK AMI image, Certbot, and Hypnotoad at WeBWorK_2.18_Ubuntu_Server_22.04_LTS_Amazon_Machine_Image#Set_up_WeBWorK_to_use_SSL which may be useful.
First we have to obtain an official SSL certificate or generate a self-signed one which can be used for testing purposes. If students will be using your server, it is better to obtain an official SSL certificate since using a self-signed certificate with cause warning messages to be displayed when students connect to the server.
Obtain an Official SSL Certificate
Talk to the networking group on your campus about obtaining an official certificate. You can find information on the net about certificate providers, e.g. http://www.sslshopper.com/certificate-authority-reviews.html . Certbot (https://certbot.eff.org/) which uses Let's Encrypt certificates (https://letsencrypt.org/) is a good option if you are not using your organization's official certificates.
The certificate goes in /etc/ssl/certs/
and the key file goes in /etc/ssl/private/
.
Use a self-signed Certificate
First we need to install a package which is needed for openssh-server to generate a self-signed certificate.
$ sudo apt-get install ssl-cert
Then run
$ sudo make-ssl-cert generate-default-snakeoil --force-overwrite
This creates a certificate stored at
/etc/ssl/certs/ssl-cert-snakeoil.pem
and a private key at
/etc/ssl/private/ssl-cert-snakeoil.key
I believe this certificate is only valid for 365 days. You can generate a new certificate with the same command.
In the instructions below we will use the provided self-signed certificate (ssl-cert-snakeoil.pem and ssl-cert-snakeoil.key) but you can also generate your own using openssh following instructions on the web. As we said above, for a production server, you should really use an official certificate.
Set up the Server to use SSL
Now we need to set up the server to use the SSL certificates. Choose your deployment option below and follow the directions for that option.
Our self-signed certificate and key files are named /etc/ssl/certs/ssl-cert-snakeoil.pem
and /etc/ssl/private/ssl-cert-snakeoil.key
. If you are using official files, use their file names instead. Additional configuration may also be needed in some cases. Instructions for doing so are beyond the scope of this document. You might look at https://docs.mojolicious.org/Mojo/Server/Daemon#listen for direct deployment via hypnotoad (you could also try using https://metacpan.org/pod/Mojo::ACME for letsencrypt), https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-22-04 for apache2, or https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-22-04 for nginx.
Set up Hypnotoad to use SSL (Option 1)
The only thing that needs to be done is to tell hypnotoad where the certificates are. For this edit/opt/webwork/webwork2/conf/webwork2.mojolicious.yml
and in thehypnotoad:
section change
listen: - http://*:8080
to
listen: - https://*:443?cert=/etc/ssl/certs/ssl-cert-snakeoil.pem&key=/etc/ssl/private/ssl-cert-snakeoil.key
Make sure that the files are readable by the webwork2 app.
$ sudo chown www-data /etc/ssl/certs/ssl-cert-snakeoil.pem /etc/ssl/private/ssl-cert-snakeoil.key
The webwork2 app needs to be restarted for this to take effect, but we will delay that until a bit later. Go to the check site.conf section below.
Set up Apache to use SSL (Option 2)
First we enable the mod_ssl
module
$ sudo a2enmod ssl
Now we have to configure Apache to use SSL.
$ cd /etc/apache2/sites-available/ $ sudo cp default-ssl.conf default-ssl.conf.bak $ sudo nano default-ssl.conf
Search for the lines
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
and replace ssl-cert-snakeoil.pem
and ssl-cert-snakeoil.key
by the names of your certificate. Since in these instructions we are using
ssl-cert-snakeoil.pem
and ssl-cert-snakeoil.key
, we can just leave the lines as is.
Then save the file and quit. And enable default-ssl.conf
$ sudo a2ensite default-ssl.conf
Finally we restart Apache
$ sudo systemctl restart apache2
and test things. Connect to https://yourserver.yourschool.edu/webwork2/myTestCourse . If you are using the snakeoil certificates you will see warning messages (e.g. NET::ERR_CERT_AUTHORITY_INVALID) and you will be asked to accept the risk. After you do so things should work just as before except that the connection will be via https.
Redirect http requests to https
Assuming that everything is working, the next thing we do is set things up so that requests to http://yourserver.yourschool.edu/webwork2/ are automatically redirected to https://yourserver.yourschool.edu/webwork2/.
$ cd /etc/apache2/sites-available $ sudo cp 000-default.conf 000-default.conf.bak $ sudo nano 000-default.conf
In the
<VirtualHost *:80>
section just under the line
DocumentRoot /var/www/html
add the line
Redirect permanent /webwork2 https://yourserver.yourschool.edu/webwork2
where of course you should edit yourserver.yourschool.edu
appropriately.
Then save the file and quit.
Restart Apache
$ sudo systemctl restart apache2
and try connecting to http://yourserver.yourschool.edu/webwork2/. The real connection should be through https://yourserver.yourschool.edu/webwork2/.
Set up Nginx to use SSL (Option 3)
You should identify the correct file to use for your system if you have already created an Nginx site configuration file. If you have not then a good starting point is to copy /etc/nginx/sites-available/default
to /etc/nginx/conf.d/default-ssl.conf
and modify that. Add the lines
ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem; ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;
to the file after the listen
lines near the beginning of the server
section. The contents of the file should now look something like the following.
server { listen 443 ssl default_server; listen [::]:443 ssl default_server; ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem; ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key; root /var/www/html; index index.html index.htm; server_name yourserver.yourdomain.edu; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; } include /opt/webwork/webwork2/conf/webwork2.nginx.conf; }
Restart Nginx for this to take effect.
$ sudo systemctl restart nginx
You should now be able to open the url https://yourserver.yourdomain.edu/webwork2 in a browser.
Redirect http requests to https
Add the following to the beginning of your nginx site configuration file.
server { listen 80 default_server; listen [::]:80 default_server; server_name yourserver.yourdomain.edu; return 301 https://yourserver.yourdomain.edu$request_uri; }
Restart Nginx for this to take effect.
$ sudo systemctl restart nginx
You should now be able to open the url http://yourserver.yourdomain.edu/webwork2 in a browser and it will automatically be redirected to https://yourserver.yourdomain.edu/webwork2.
Check site.conf
This is important. We have to check the value of $server_root_url in webwork2/conf/site.conf to make sure it uses https (so it should read e.g. https://yourserver.yourschool.edu). If you don't do this, your may run into strange problems in the Library Browser. To check, open the Library Browser, select a subject and then click on the chapter area. If you see a drop down list of chapters, things are working properly.
Now we check and edit if necessary site.conf
cd /opt/webwork/webwork2/conf nano site.conf
In the line
$server_root_url = ...
replace http by https if necessary. Then save the file, quit and restart webwork2
sudo systemctl restart webwork2
Implement Option B (Rserve)
Here we will install and configure the R server for statistical computing. Many statistics and probability problems (mostly contributed by faculty at the University of British Columbia) require this.
See the documentation (from which we have borrowed heavily) R_in_WeBWorK for more detailed information.
Install the R server
$ sudo apt install r-cran-rserve
and check that R is running
$ R
You should see something very similar to
R version 4.1.2 (2021-11-01) -- "Bird Hippie" Copyright (C) 2021 The R Foundation for Statistical Computing ... Type 'q()' to quit R. >
and then quit
> q() Save workspace image? [y/n/c]: n
Configure Webwork with the location of the R server
We have to edit the localOverrides.conf file.
$ cd /opt/webwork/webwork2/conf $ nano localOverrides.conf
Search for the line
#$pg{specialPGEnvironmentVars}{entryAssist} = 'MathView';
and under that line add the following
################################################################################ #location of the R server ################################################################################ $pg{specialPGEnvironmentVars}{Rserve} = {host => 'localhost'};
Then save the file and Quit.
Set up Rserve to run as a daemon at system boot
This is somewhat complicated. I'm basically following instructions from https://github.com/geordielad/rserve-systemd-unit
First we create a user with limited privileges to run rserve.
$ sudo adduser rserveuser --system --shell=/bin/false --no-create-home --disabled-password --disabled-login
Next we create a file to automatically start Rserve
$ cd $ nano rserve.service
Now copy and paste the following code into nano
[Unit] Description=Rserve [Service] Type=forking PIDFile=/var/run/rserve/rserve.pid # Define runtime directory RuntimeDirectory=rserve RuntimeDirectoryMode=750 User=rserveuser Group=nogroup ExecStart=/usr/bin/R CMD Rserve --quiet --vanilla --RS-pidfile /var/run/rserve/rserve.pid [Install] WantedBy=multi-user.target
and then save the file and quit. Change the owner to root, move the file to the proper location and register it.
$ sudo chown root:root rserve.service $ sudo mv rserve.service /etc/systemd/system $ sudo systemctl daemon-reload
Next we enable the service to start when the system starts
$ sudo systemctl enable rserve.service
and finally set up some needed links
$ cd /usr/lib/R/bin/ $ sudo ln -s ../site-library/Rserve/libs/Rserve $ sudo ln -s ../site-library/Rserve/libs/Rserve.dbg
Test that things are working properly
First start Rserve manually
$ sudo systemctl start rserve
and run
$ sudo lsof -i -P -n | grep LISTEN
and you should see that Rserve is listening on port 6311
Next test that WeBWorK problems using R run properly. In WeBWorK, click on Library Browser
on the Main Menu
. Then click Open Problem Library
(actually it should already be selected so it will be greyed out).
Now select "Statistics" as Subject
, "Bayesian inference" as Chapter
and "Posterior distribution" as Section
and then hit View Problems
. Also test a problem with graphics, e.g. select "Statistics" as Subject
, "Hypotheses tests" as Chapter
and "One-way ANOVA" as Section
and then hit View Problems
.
If the problems display with no error messages, all should be well (for the graphics problem, look at Library/UBC/STAT/STAT300/hw06/stat300_hw06_q01.pg). To be totally sure, click on the "eye" (Try it) in the upper right corner and test the problem. If there are no error messages, congratulate yourself. Everything works.
Finally reboot your server (to test that the Rserve starts automatically on boot up) and run
$ sudo systemctl status rserve.service
to check that all is well and just to be redundant
$ sudo lsof -i -P -n | grep LISTEN
again. Now we are sure that Rserve automatically starts when the system is booted.
Loading additional modules
This step should not be necessary unless you are writing or using WeBWorK problems that need additional resources beyond what is loaded by default. An example is using R to compute complex eigenvalues which requires the Math::Complex
module (see https://webwork.maa.org/moodle/mod/forum/discuss.php?d=5577). The error message in such a case would be similar to
Can't locate object method "make" via package "Math::Complex" (perhaps you forgot to load "Math::Complex"?) at /usr/share/perl/5.30/Math/Complex.pm line 329 Died within Math::Complex::cplx called at line 351 of /usr/local/share/perl/5.30.0/Statistics/R/IO/QapEncoding.pm from within Statistics::R::IO::QapEncoding::decode called at line 236 of /usr/local/share/perl/5.30.0/Statistics/R/IO/Rserve.pm from within Statistics::R::IO::Rserve::eval called at line 26 of [PG]/lib/Rserve.pm from within Rserve::try_eval called at line 146 of [PG]/macros/RserveClient.pl from within main::rserve_eval called at line 40 of (eval 4456)
First note that the required module must be installed on your server. The Math::Complex
module already is which we can see by running the command
perl -MMath::Complex -e 'print "installed!\n"'
which returns installed!
. If it were not installed you would see at lot of gibberish.
In general to test if a Perl module is installed and working on your system, issue the above command, replacing Math::Complex
with the name of the module. To install additional Perl modlues , see Installation of Other Perl Modules with cpanm above.
We need to load Math::Complex
into WeBWorK's safe compartment. For this we have to edit the localOverrides.conf file.
$ cd /opt/webwork/webwork2/conf $ nano localOverrides.conf
Now search for the line
# Additional PG modules
and under the line
#push (@{${pg}{modules}}, [qw(TikZ_Image2)]);
add the line
push @{$pg{modules}}, [qw(Math::Complex)];
You can add as many modules as you need this way.
Then save the file and Quit.
Implement Option C (Logrotate)
Here we will set up log rotation for WeBWorK's timing log and webwork2 app log which can grow huge especially if you have a large number of users. The timing.log
gives timing information on every action in WeBWorK (see WeBWorK_performance) and can be used to assess the performance of your server. The webwork2.log
file contains webwork2 app log output including errors that can be useful for debugging issues.
Create a WeBWorK configuration file for Logrotate
Logrotate’s configuration files are located in /etc/logrotate.d
. Now we create one for WeBWorK.
$ sudo nano /etc/logrotate.d/webwork
Now copy and paste the following code into nano
/opt/webwork/webwork2/logs/timing.log { su www-data www-data weekly missingok rotate 15 compress delaycompress notifempty } /opt/webwork/webwork2/logs/webwork2.log { su www-data www-data weekly missingok rotate 15 compress delaycompress notifempty copytruncate }
and then save the file and quit.
There is one additional step that is needed if you are serving directly via hypnotoad. In that case the webwork2 application initially starts as the root user, and then switches to the www-data user, and the webwork2.log
file is created by the root user before the switch is made. So the file's owner and group need to be fixed. You can do this by executing
$ sudo chown www-data:www-data /opt/webwork/webwork2/logs/webwork2.log
The backup will be done weekly and we are keeping 15 weeks (approximately one semester) worth of logs.
The most recent backup will not be compressed but all older ones will be. We are not explicitly creating a new timing.log
file
because WeBWorK will automatically create one if it's missing. If you want to check that it works you can run logrotate
with the configuration file (make sure you have done something with WeBWorK so that the timing.log
is not empty):
sudo logrotate -f /etc/logrotate.d/webwork
Then if you look in /opt/webwork/webwork2/logs
, you should see the following files
webwork2.log webwork2.log.1 timing.log.1
You will not see a timing.log
file unless someone has been doing something with WeBWorK. If there is no timing.log
file
do something yourself (e.g. login to a course) and then you should see
webwork2.log webwork2.log.1 timing.log timing.log.1
Now run logrotate
again
sudo logrotate -f /etc/logrotate.d/webwork
and do something in WeBWorK and you should see
webwork2.log webwork2.log.1 webwork2.log.2.gz timing.log timing.log.1 timing.log.2.gz
Here is what is going on. timing.log.1
was renamed to timing.log.2
and compressed giving timing.log.2.gz
. timing.log
was renamed to timing.log.1
. A slightly different procedure occured for the webwork2.log
file due to the copytruncate
option. webwork2.log.1
was renamed to webwork2.log.2
and compressed giving webwork2.log.2.gz
. That part is the same. However, webwork2.log
was copied to webwork2.log.1
, and webwork2.log
was truncated. That means that the original webwork2.log
file is still in place, but is now empty. This is important or the Mojolicious webwork2 app would lose its handle on the file and stop writing to it. A similar procedure will happen weekly until there are a total of 15 backups of each file after which the oldest one will be deleted.
Known Issues
Here are the known issues with this release.
PGbasicmacros.pl
Displaying certain symbols (e.g. {, },<,>,≤, ≥) in the text (not in Math Mode) of a WeBWorK problem fails. An example is Problem 1 in Set 0 in "myTestCourse" (see Test that Things are Working Properly below). For information on this see https://github.com/openwebwork/pg/issues/473. This can be fixed. However the fix causes trouble with WeBWorK problems that use the associated macros incorrectly in Math Mode (see https://webwork.maa.org/moodle/mod/forum/discuss.php?d=5727) and there are quite a few more problems that use them incorrectly than correctly. If you use any of these problems, the easiest solution would be to not perform the fix.
If you do want to proceed with the fix we need to edit the PGbasicmacros.pl file.
$ cd /opt/webwork/pg/macros $ cp PGbasicmacros.pl PGbasicmacros.pl.bak
$ nano PGbasicmacros.pl
Look for the line
HTML_MathJax => [ "HTML_dpng", "HTML_tth", "HTML", ],
and replace it by
#HTML_MathJax => [ "HTML_dpng", "HTML_tth", "HTML", ], HTML_MathJax => [ "HTML_dpng", "HTML", "HTML_tth", ],
Then save the file and Quit.
Housekeeping
Remove temporary files
WebWorK no longer generates a lot of temporary files but it is still a good idea to clean them out once in awhile. Temporary files are stored under the directories /opt/webwork/webwork2/tmp
and /opt/webwork/webwork2/htdocs/tmp
. It is safe to delete everything in these tmp directories. If you want, you can follow the directions below to set up Cron jobs to do this automatically.
Using Cron Jobs to remove temporary files
It is a good idea to clean out temporary files on a regular automatic schedule. The following two cron jobs will accomplish this. They are run every six months (in January and July), on the first and second days of the month at 0330 hours. These cron jobs should be run as root. We use crontab
to edit the crontab
file:
$ sudo crontab -e
Now add the following lines at the end of the file
30 03 1 1,7 * find /opt/webwork/webwork2/tmp/* -name "*" ! -name "README" -delete 30 03 2 1,7 * find /opt/webwork/webwork2/htdocs/tmp/* -name "*" ! -name "README" -delete
and save the file and quit.
Where to go From Here
You should play around with myTestCourse
e.g. click on Library Browser
and browse the Problem Library
.
Look at A day in the life of a WeBWorK instructor.
Read Course Administration for more information about creating courses.
Under Categories below click on Administrators to see a listing of other WeBWorK documentation for system administrators.