Hi,
Just thought I would update this with some additional information.
PWM version: 1.91
OS: UBUNTU 20.04 LTS, but probably applies to any Debian-based distribution...
Installation of tomcat9 from distribution (apt install ...) then follow the instructions in the guide: "Installation on Ubuntu Server 16.04 LTS" from the pwm github wiki.
There are a number of issues with following this:
When you install Tomcat on Ubuntu 20.04 using apt install ..., the resulting tomcat9 instance is sandboxed by systemd. From the README.debian:
* Tomcat is sandboxed by systemd and only has write access to the following
directories:
- /var/lib/tomcat9/conf/Catalina (actually /etc/tomcat9/Catalina)
- /var/lib/tomcat9/logs (actually /var/log/tomcat9)
- /var/lib/tomcat9/webapps
- /var/lib/tomcat9/work (actually /var/cache/tomcat9)
If write access to other directories is required the service settings
have to be overridden.
This is done by creating an override.conf file
in /etc/systemd/system/tomcat9.service.d/ containing:
[Service]
ReadWritePaths=/path/to/the/directory/
The service has to be restarted afterward with:
systemctl daemon-reload
systemctl restart tomcat9
For Ubuntu, this isn't actually correct. Ubuntu puts the systemd *.service files in /lib/systemd/system.
To sort out this mess and get pwm working on a fresh install of Ubuntu 20.04 LTS, I did the following:
Update the tomcat9.service file:
sudo nano /lib/systemd/system/tomcat9.service
under
[Service]
# Configuration
add:
ENVIRONMENT="PWM_APPLICATIONPATH=/media/pwm"
under
[Service]
# Security
add:
ReadWritePaths=/media/pwm
Write Out the file, then Exit
Note: the pwm application path could be any existing directory with the required permissions (chmod 755 on the directory /media/pwm works here...), just substitute your choice for "/media/pwm" in the above instructions. I think the previous solution (placing the application path in the /home/tomcat/pwm directory may work because users always have r-w access to their /home/<user> tree...?
Reload the systemd daemon:
sudo systemctl daemon-reload
Re-enable the tomcat9 service:
sudo systemctl enable --now tomcat9
Note: a restart might have been as effective...
Probably best to re-boot the VM after these changes, one of the systemctl commands seems to hang...
After the re-boot, you should be good to go.
Note: I'm not particularly skilled with Linux system administration, so there may be better ways to do this. My approach is the result of a significant amount of research (Google is your friend).
Using the override approach suggested in the Debian readme might work, but there were enough differences between the instructions and the actual set-up on Ubuntu 20.04, that I wasn't keen to try them and possibly go down another rabbit hole....
A real Linux sysadmin could probably do better. Feel free to update / respond. I'm not precious about the approach, it just worked for me...