Installation

Configuration of WeBWorK 2.19 on Ubuntu 22.04

Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Jalene Mirgissa -
Number of replies: 38

Hello,

I am trying to set up WeBWorK on an AWS EC2 instance running Ubuntu 22.04, but I am encountering an issue after completing the installation steps. After following the setup process and configuring Apache, when I try to access WeBWorK using the server's public IP, I get a "Not Found" error in my browser.


I followed the following steps:

1) Installed prerequisites

2) Downloaded WeBWorK: I cloned the WeBWorK repository and placed it under /opt/webwork2 and /opt/pg

3) Apache configuration: Created the required virtual host file for WeBWorK

4) DB Config: I configured MySQL/MariaDB as required

5) Test: I verified that Apache is running properly using systemctl status apache2, and it shows "Active (running)".

6) Attempted to Access WeBWorK:

I tried to access WeBWorK by entering the public IP of my EC2 instance in the browser, but I get the "Not Found" error.

Any assistance or guidance on what I may have missed or how I can resolve this issue would be greatly appreciated. Please let me know if additional information is needed.

Thank you in advance for your help!

Attachment Error - Not Found.PNG
In reply to Jalene Mirgissa

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Glenn Rice -

I assume that you are following the installation manual.  It sounds like you are trying the approach of proxying via apache2.  Have you completed the step to enable and start the webwork2 app?

In reply to Glenn Rice

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Jalene Mirgissa -

Yes, I did follow the installation manual, and yes, I am using option 2, apache2, according to the manual. However, it seems that the issue still persists. I have attached screenshots of the problem(Error) together with the original "site.conf" file and the changes I made to the webwork and server root URLs.

Thanks for the support.

Attachment Error.PNG
In reply to Jalene Mirgissa

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Glenn Rice -

Your screen shot shows the issue.  "Can't load application from file "/opt/webwork/webwork2/bin/webwork2": Can't locate YAML/XS.pm in @INC".  That means that the Perl module YAML::XS is not found.  You need to install the package libyaml-libyaml-perl.  So run "sudo apt install libyaml-libyaml-perl".  Perhaps that was missed when installing the dependencies.  It is also possible that there is an issue with the Perl installation on your system and it isn't finding what it needs.  That will be harder to diagnose if that is the case.

You should also run the webwork2 check_modules.pl script to ensure that all other Perl dependencies are found.

In reply to Glenn Rice

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Jalene Mirgissa -

Hi, 

I installed the module YAML::XS and checked the other modules as well. Some are found, and some are not. Is it mandatory for all to be found? [I have listed below what is found and what is not.] Finally, I got a "Service Unavailable" error, as you can see from the attached picture.

  Archive::Tar found and loaded

** Archive::Zip not found in @INC

** Archive::Zip::SimpleZip not found in @INC

** Array::Utils not found in @INC

   Benchmark found and loaded

   Carp found and loaded

** Class::Accessor not found in @INC

** Crypt::JWT not found in @INC

** Crypt::PK::RSA not found in @INC

   Data::Dump found and loaded

   Data::Dumper found and loaded

** Data::Structure::Util not found in @INC

** Data::UUID not found in @INC

   Date::Format found and loaded

   Date::Parse found and loaded

   DateTime found and loaded

   DBD::mysql found and loaded

   DBI found and loaded

   Digest::MD5 found and loaded

   Digest::SHA found and loaded

   Email::Address::XS found and loaded

   Email::Sender::Simple found and loaded

   Email::Sender::Transport::SMTP found and loaded

** Email::Stuffer not found in @INC

   Errno found and loaded

   Exception::Class found and loaded

   File::Copy found and loaded

** File::Copy::Recursive not found in @INC

   File::Fetch found and loaded

   File::Find found and loaded

** File::Find::Rule not found in @INC

   File::Path found and loaded

   File::Spec found and loaded

   File::stat found and loaded

   File::Temp found and loaded

** Future::AsyncAwait not found in @INC

   GD found and loaded

** GD::Barcode::QRcode not found in @INC

   Getopt::Long found and loaded

   Getopt::Std found and loaded

   HTML::Entities found and loaded

   HTML::Tagset found and loaded

   HTML::Template found and loaded

** HTTP::Async not found in @INC

   IO::File found and loaded

   IO::Socket::SSL found and loaded

** Iterator not found in @INC

** Iterator::Util not found in @INC

   JSON found and loaded

** JSON::MaybeXS not found in @INC

** Locale::Maketext::Lexicon not found in @INC

   Locale::Maketext::Simple found and loaded

   LWP::Protocol::https found and loaded

** MIME::Base32 not found in @INC

   MIME::Base64 found and loaded

** Math::Random::Secure not found in @INC

** Minion not found in @INC

** Minion::Backend::SQLite not found in @INC

   Mojolicious found and loaded

   Mojolicious::Plugin::NotYAMLConfig found and loaded

** Mojolicious::Plugin::RenderFile not found in @INC

** Net::IP not found in @INC

** Net::LDAPS not found in @INC

** Net::OAuth not found in @INC

   Net::SMTP found and loaded

   Net::SSLeay found and loaded

   Opcode found and loaded

   PadWalker found and loaded

** Pandoc not found in @INC

** Path::Class not found in @INC

** Perl::Tidy not found in @INC

** PHP::Serialization not found in @INC

   Pod::Simple::Search found and loaded

   Pod::Simple::XHTML found and loaded

   Pod::Usage found and loaded

** Pod::WSDL not found in @INC

   Safe found and loaded

   Scalar::Util found and loaded

** SOAP::Lite not found in @INC

   Socket found and loaded

   SQL::Abstract found and loaded

** Statistics::R::IO not found in @INC

   String::ShellQuote found and loaded

** SVG not found in @INC

** Template not found in @INC

** Text::CSV not found in @INC

   Text::Wrap found and loaded

   Tie::IxHash found and loaded

   Time::HiRes found and loaded

   Time::Zone found and loaded

** Types::Serialiser not found in @INC

   URI::Escape found and loaded

** UUID::Tiny not found in @INC

** XML::LibXML not found in @INC

   XML::Parser found and loaded

** XML::Parser::EasyTree not found in @INC

** XML::Writer not found in @INC

   YAML::XS found and loaded

Attachment Service-Unavailable Error.PNG
In reply to Jalene Mirgissa

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Glenn Rice -

There are a few of them that will not prevent the application from running, but really all of those are needed.  I recommend that you copy and paste the given "apt install" line from https://webwork.maa.org/wiki/Installation_Manual_for_2.19_on_Ubuntu#Ubuntu_Software_Packages.  That will install all of the packages that you need except a few more you need.  For that run the "sudo cpanm" command right below the "apt install" line on the same page.

In reply to Glenn Rice

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Jalene Mirgissa -

I managed to install half of them on the list (the one with an asterisk), but halfway through the installation, I started getting an error - not enough space on the device; example [ Error downloading with HTTP::Tiny: Error: Caught error closing temporary file /root/.cpan/sources/modules/03modlist.data.gz.tmp663081653153726: No space left on device]

Below is the detail I got about the disk space. So how can I get more space?

ubuntu@ip-172-31-47-114:~$ df -h

Filesystem       Size  Used Avail Use% Mounted on

/dev/root        6.8G  6.7G     0 100% /

tmpfs            458M     0  458M   0% /dev/shm

tmpfs            183M   17M  166M  10% /run

tmpfs            5.0M     0  5.0M   0% /run/lock

efivarfs         128K  3.6K  120K   3% /sys/firmware/efi/efivars

/dev/nvme0n1p16  881M   76M  744M  10% /boot

/dev/nvme0n1p15  105M  6.1M   99M   6% /boot/efi

tmpfs             92M   12K   92M   1% /run/user/1000


In reply to Jalene Mirgissa

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Glenn Rice -

That may be challenging.  You are pressing the lower limits of disk space with only 6.8G available. I cannot guarantee that 6.8G is enough for a basic webwork2 installation.

You could try running "sudo apt clean".  That will delete all previously download package files.  Those files are not needed and will be downloaded again if they are when you sun "sudo apt install ...", so that is always safe to do.

Then try to find any unnecessary files on the system and delete them.  You  could try uninstalling some (or all) of the texlive packages.  Those are not needed for the webwork2 application to run.  However, if you do that hardcopy generation and problems that use the latex image macros will not work.  Those packages are some of the largest in the required package list.

In reply to Glenn Rice

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Jalene Mirgissa -

Yeah, actually it looks like the system doesn't have enough space even to process the "apt-get remove" command. So I am thinking of increasing the disk space on the AWS EC2 instance. Will that work? What do you advise?

In reply to Jalene Mirgissa

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Glenn Rice -

I think that more space is going to be needed.  I suspect that you are going to need a minimum of 15G to have enough room for the operating system and webwork.  You will probably need more depending on how large scale this server will be in terms of the number of courses it will serve.  In terms of modern expectations of disk space, it is almost impossible to maintain a server with less than 40G.

In reply to Glenn Rice

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Jalene Mirgissa -
So, I configured everything perfectly and the system shows running and active. However, I am getting a page not found error. And upon checking what the problem is by running, $ sudo tail -f /var/log/apache2/error.log, I get the below error message.

[Mon Feb 10 13:35:01.469200 2025] [proxy:error] [pid 15752:tid 138584086546112] (111)Connection refused: AH00957: http: attempt to connect to 127.0.0.1:8080 (localhost:8080) failed

[Mon Feb 10 13:35:01.469815 2025] [proxy_http:error] [pid 15752:tid 138584086546112] [client 102.22.184.236:23367] AH01114: HTTP: failed to make connection to backend: localhost


In reply to Jalene Mirgissa

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Danny Glin -
It still looks like the WeBWorK service is not running. What do you get when you run "sudo systemctl status webwork2"?
In reply to Danny Glin

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Jalene Mirgissa -

I have attached a screenshot of what happens when I run "sudo systemctl status webwork2".


Attachment Webwork status.PNG
In reply to Jalene Mirgissa

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Glenn Rice -

It does look like the webwork2 app is up and running.  However, clearly the proxy to http://127.0.0.1:8080 is not working.  This is probably some issue with the apache2 configuration.  Have you enabled the apache2 modules that are needed?  In the installation manual the command given to do this is "sudo a2enmod proxy proxy_http headers".

In reply to Glenn Rice

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Jalene Mirgissa -

Yes, I have already enabled the apache2 modules.

I attached a screenshot if it can be of any help to reach the solution.

Attachment Capture.PNG
In reply to Jalene Mirgissa

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Glenn Rice -

Your screen shot shows something that should never happen.  I don't know how it could happen with the instructions in the installation manual.  You are showing a directory listing of the webwork2 directory served via apache2.  That would only happen if the location where the webwork2 files are is being directly served by apache2 which should not be the case.

In reply to Glenn Rice

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Jalene Mirgissa -
So, what do you advise? Should I redo the configuration from scratch one more time? I would really appreciate your feedback.

Thanks

In reply to Jalene Mirgissa

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Glenn Rice -

I don't know that you need to redo the configuration from scratch.  We just need to figure out what is set up incorrectly.

Where are the webwork2 and pg files located?  Are they in /opt/webwork?  In other words, do you have /opt/webwork/webwork2 and /opt/webwork/pg?

What do you have in your apache2 conf file for the site (this is usually located in /etc/apache2/sites-available)?  In particular what is DocumentRoot set to?  There may be multiple site configurations to check for this.  Probably also look in the /etc/apache2/apache2.conf file.

Is there a link named /etc/apache2/conf-enabled/webwork2.conf that points to /opt/webwork/webwork2/conf/webwork2/apache2.4.conf? Also, does that file have a DocumentRoot setting (it shouldn't).

Is there a link in /var/www/html that points to /opt/webwork or /opt/webwork/webwork2.  If so that should be deleted.

The point is that there should be no way to view the webwork2 source code files in the browser as your screenshot shows.  That indicates some oddity in your apache2 configuration that might lead to the real problem.


In reply to Glenn Rice

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Jalene Mirgissa -

Yeah, the webwork2 and pg files are located in /opt/webwork.


Upon running, /etc/apache2/sites-available$ ls

I get: 000-default.conf  default-ssl.conf  webwork.conf  webwork.conf.save


Upon running, /etc/apache2$ ls

I get:

apache2.conf      conf-enabled  mods-available  sites-available

apache2.conf.bak  envvars       mods-enabled    sites-enabled

conf-available    magic         ports.conf


Upon running, /etc/apache2/conf-enabled$ ls

I get:

charset.conf                other-vhosts-access-log.conf  webwork2.conf

javascript-common.conf      security.conf

localized-error-pages.conf  serve-cgi-bin.conf


And upon running, /opt/webwork/webwork2/conf/webwork2.apache2.4.conf


I got the file with contents as attached in the picture. And there is no DocumentRoot directive present.


Upon running /var/www/html$ ls -l

I found:

-rwxr-xr-x  1 www-data www-data   286 Feb  4 17:40 favicon.ico

-rwxr-xr-x  1 www-data www-data 10671 Jan 31 21:09 index.html

-rwxr-xr-x  1 www-data www-data   615 Feb 12 22:41 index.nginx-debian.html

drwxr-xr-x  6 root     root      4096 Feb 12 23:41 simple-app

drwxr-xr-x 22 root     root      4096 Feb 12 23:54 webwork

drwxr-xr-x 17 root     root      4096 Feb 13 00:08 webwork2


And so I removed both webwork and webwork2. Also, the other simple-app that I put while trying to troubleshoot to see if the server can connect to it which it does. So after removing them, I restarted the apache2, and I still am getting "page not found". However, I feel that a simple change can make it work, but I don't know exactly what change to make. Do you think there might be a setting adjustment needed in the AWS instance?

Attachment webwork2_apache2.4.conf.PNG
In reply to Jalene Mirgissa

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Glenn Rice -
Your directory listing of the contents of /var/www/html shows a certain problem. The directory /var/www/html/webwork2 should not exist. That will cause a conflict with the apache2 configuration. You site configuration (probably /etc/apache2/sites-available/default-ssl.conf) probably has "DocumentRoot /var/www/html" (as it should). So if that directory exists then trying to open the URL /webwork2 on the server will open that directory instead of proxying to the webwork2 app as specified in the webwork2.apache2.4.conf file.

I also see that you have webwork.conf and webwork.conf.save files in /etc/apache2/sites-available. Those shouldn't be there. Although that shouldn't cause a problem as long as they aren't linked to in /etc/apache2/sites-enabled.
In reply to Glenn Rice

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Jalene Mirgissa -

I have already removed webwork2 from the listing as I mentioned in the previous chat. I have also removed webwork.conf webwork.conf.save files from /etc/apache2/sites-available.

And now, I am back to the very first issue: I am getting a 503-service unavailable error, as you can see from the attached picture.

Attachment Service-Unavailable.PNG
In reply to Jalene Mirgissa

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Glenn Rice -

I apologize.  I missed your comment about removing the webwork and webwork2 directories from /var/www/html.

I am a little bit at a loss as to what is going on.  So I am going to try another approach to troubleshooting this.

First edit the /opt/webwork/webwork2/conf/webwork2.mojolicious.yml file and change "enabled: 0" to "enabled: 1" in the "debug" section near the end of the file.

Next stop the webwork2 service (with sudo systemctl stop webwork2).

Now from the terminal run the following:

cd /opt/webwork/webwork2
sudo mkdir /run/webwork2
sudo chown www-data /run/webwork2
sudo -u www-data hypnotoad -f bin/webwork2

That should start the hypnotoad server in the foreground and it will say "Web application available at http://127.0.0.1:8080".  If that doesn't work, then let me know what it says.

Then try to access webwork2 in the browser.  Watch the terminal.  If the webwork2 app gets anything you will see extensive debugging output in the terminal.  If you don't see anything, then the issue is the apache2 configuration.  So we need to look deeper into that.

In reply to Glenn Rice

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Jalene Mirgissa -

Hi, 


No worries, I thought so too.


So, as you suggested, I edited the /opt/webwork/webwork2/conf/webwork2.mojolicious.yml file, stopped the Webwork2 service, and ran the commands you wrote. I then got an output that says, "Web application available at http://127.0.0.1:8080." However, upon trying to access Webwork2 from the browser, I got a page not found error, as you can see from the attached picture. So, the error changed from 503: Service unavailable to a page not found error.

Attachment Page not found.PNG
In reply to Jalene Mirgissa

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Glenn Rice -

When you do that, what does the terminal show?  That looks like the request is getting to the webwork2 app, and so the terminal should show debugging information.

In reply to Jalene Mirgissa

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Danny Glin -
I want to confirm that we're in the same state we were earlier:
  • "sudo systemctl status webwork2" should show the service as "active (running)"
  • When you visit the page that gives the 503 error you are once again seeing the same proxy errors you posted earlier in the apache error log.

One thing I notice is that the webwork2 service is showing that it can't open the PID file, but it looks like the service is running despite this.

On your server what do you get if you run "curl http://localhost:8080/webwork2" on the server?  You should see the HTML source of the WeBWorK landing page.


In reply to Danny Glin

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Glenn Rice -

When I run "systemctl status webwork" I also see "webwork2.service: Can't open PID file /run/webwork2/webwork2.pid (yet?) after start: No such file or directory".  The "yet?" in that is what is happening though.  That is just a timing thing.  When the systemctl job first starts the directory doesn't exist, but it does get created and the service still starts.  As long as the last line that reads "Started webwork2.service - webwork2" is there the service is still up and running.

In reply to Glenn Rice

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Jalene Mirgissa -

When running "systemctl status webwork", it is showing me "inactive" as you can see from the below attached picture.

Attachment status - webwork.PNG
In reply to Danny Glin

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Jalene Mirgissa -
So after following the above instruction, the below is what I got upon running "curl http://localhost:8080/webwork2" on the server.

Attachment Curl.PNG
In reply to Jalene Mirgissa

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Glenn Rice -
What do you have set for the "listen:" setting in the "hypnotoad:" section of conf/webwork2.mojolicious.yml?
In reply to Jalene Mirgissa

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Danny Glin -
Try the following:
  • Run the commands that Glenn posted in one terminal window.  Leave it open and running.
  • In another terminal window run the curl command that I suggested.

You should see some information in both terminal windows.

In reply to Danny Glin

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Jalene Mirgissa -
Showing "inactive" when checking the status of the webwork in one terminal (GitBash). Hence, the curl command is also showing me that it can't connect to the server: "Failed to connect to localhost port 8080 after 0 ms: Couldn't connect to server" [from the server terminal, CloudShell].
In reply to Jalene Mirgissa

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Glenn Rice -

If you ran "hypnotoad -f bin/webwork2" from the /opt/webwork/webwork2 directory and "curl http://localhost:8080/webwork2" run from the server in another terminal window cannot connect, then the app isn't running.  Check the terminal where you ran "hypnotoad -f /bin/webwork2".  If the app is running, then there should be no command prompt to work from and it should show "Web application available at http://127.0.0.1:8080" with a cursor blinking below it.

Note that while you are doing the above testing you should make sure that the webwork2 systemd service is NOT running as that will conflict.  So make sure you have run "sudo systemctl stop webwork2".

In reply to Glenn Rice

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Jalene Mirgissa -

The app is running from the terminal: after running "hypnotoad -f /bin/webwork2", it brings "Web application available at http://127.0.0.1:8080" with a cursor blinking below it. However, upon running "curl http://localhost:8080/webwork2" from the server terminal, it brings the error, "curl: (7) Failed to connect to localhost port 8080 after 0 ms: Couldn't connect to server". 



In reply to Jalene Mirgissa

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Glenn Rice -
I am pretty much at a complete loss here. The only thing that I can think of is that the two terminal instances you are using are not actually both on the same server. If the app is running, then you would always be able to connect to it if you are on another terminal on the same computer. Unless you have some other really odd setup that is blocking it. Do you have a firewall set to block connections from the same computer?
In reply to Glenn Rice

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Jalene Mirgissa -
Hi Glenn,

Very sorry for my late reply. I am trying to fix the issue with a server admin expert from this side. 
For the firewall question, no it's not set to block connections. I have checked if it is a firewall setting but that is not the issue. I will definitely let you know the status soon. And we can take it from there.
In reply to Jalene Mirgissa

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Jalene Mirgissa -

I have thoroughly reviewed all configurations, including Apache, network settings, and ports, and everything appears to be functioning correctly. The server responds as expected to basic checks. However, when running "curl http://localhost:8080/webwork2"  from the terminal, I receive an "Invalid request endpoint" message. Despite addressing all potential issues, the final outcome remains the same, and I'm still encountering a "404: Page not found" error.

At this point, should I consider starting a fresh configuration, even if it involves removing the current setup and starting over? 

In reply to Jalene Mirgissa

Re: Configuration of WeBWorK 2.19 on Ubuntu 22.04

by Glenn Rice -

That may be the best way to proceed at this point. I am not sure what is going on.