Basically a combination of Installing Mirth on Ubuntu - A How To and Run Mirth service manually works, running from systemd errs with "No suitable JVM...".
This will create a Mirth Connect 4.5.0 service for a user and group mirth running on OpenJDK 21.
- Install JRE:
sudo apt install openjdk-21-jre-headless
- Create user mirth:
sudo adduser mirth
- Download Mirth Connect:
wget https://s3.amazonaws.com/downloads.mirthcorp.com/connect/4.5.0.b3012/mirthconnect-4.5.0.b3012-unix.tar.gz
- Unpack:
tar xvfz mirthconnect-4.5.0.b3012-unix.tar.gz
- Add Java 9+ options (see
Mirth Connect/docs/README.md
):cat Mirth\ Connect/docs/mcservice-java9+.vmoptions >> Mirth\ Connect/mcserver.vmoptions
- Copy (or move (
mv
)) to /opt/:sudo cp -r Mirth\ Connect /opt/mirthconnect
- Change ownership to mirth user and group:
sudo chown -R mirth:mirth /opt/mirthconnect
- Create service (file contents, see below):
sudo nano /etc/systemd/system/mirth.service
- Start:
sudo systemctl start mirth.service
Mirth Connect will now run with a Derby database. To have it start on boot, type: sudo systemctl enable mirth.service
- Make sure the service stopped:
sudo systemctl stop mirth.service
- Install PostgreSQL:
sudo apt install postgresql
- Run psql:
sudo -u postgres psql
- Create database (check the documentation for different tablespace locations):
create database mirth;
- Create user (password
mirth
is for example purposes only):create user mirth with password 'mirth';
- Grant privilege to user:
grant all privileges on database mirth to mirth;
- Create database (check the documentation for different tablespace locations):
- Edit the Mirth Connect config (additions, see below):
sudo nano /opt/mirthconnect/conf/mirth.properties
- Change the service (see comment below):
sudo nano /etc/systemd/system/mirth.service
- Start anew:
sudo systemctl start mirth.service
In /etc/systemd/system/mirth.service put:
[Unit]
Description=Mirth Connect
# For PostgreSQL use: After=network.target postgresql.service
After=network.target
[Service]
Type=exec
User=mirth
Group=mirth
ExecStart=/opt/mirthconnect/mcserver
TimeoutSec=60
Restart=on-failure
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
In /opt/mirthconnect/conf/mirth.properties change:
database = postgres
database.url = jdbc:postgresql://localhost:5432/mirth
database.username = mirth
database.password = mirth