Skip to content

Instantly share code, notes, and snippets.

@tobchen
Last active April 3, 2024 17:43
Show Gist options
  • Save tobchen/71acfdfbf6f2f95e860b339dce50dcd4 to your computer and use it in GitHub Desktop.
Save tobchen/71acfdfbf6f2f95e860b339dce50dcd4 to your computer and use it in GitHub Desktop.

How to Install Mirth Connect on Ubuntu Server

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.

Steps

  1. Install JRE: sudo apt install openjdk-21-jre-headless
  2. Create user mirth: sudo adduser mirth
  3. Download Mirth Connect: wget https://s3.amazonaws.com/downloads.mirthcorp.com/connect/4.5.0.b3012/mirthconnect-4.5.0.b3012-unix.tar.gz
  4. Unpack: tar xvfz mirthconnect-4.5.0.b3012-unix.tar.gz
  5. Add Java 9+ options (see Mirth Connect/docs/README.md): cat Mirth\ Connect/docs/mcservice-java9+.vmoptions >> Mirth\ Connect/mcserver.vmoptions
  6. Copy (or move (mv)) to /opt/: sudo cp -r Mirth\ Connect /opt/mirthconnect
  7. Change ownership to mirth user and group: sudo chown -R mirth:mirth /opt/mirthconnect
  8. Create service (file contents, see below): sudo nano /etc/systemd/system/mirth.service
  9. 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

Additional Steps for PostgreSQL Use

  1. Make sure the service stopped: sudo systemctl stop mirth.service
  2. Install PostgreSQL: sudo apt install postgresql
  3. Run psql: sudo -u postgres psql
    1. Create database (check the documentation for different tablespace locations): create database mirth;
    2. Create user (password mirth is for example purposes only): create user mirth with password 'mirth';
    3. Grant privilege to user: grant all privileges on database mirth to mirth;
  4. Edit the Mirth Connect config (additions, see below): sudo nano /opt/mirthconnect/conf/mirth.properties
  5. Change the service (see comment below): sudo nano /etc/systemd/system/mirth.service
  6. Start anew: sudo systemctl start mirth.service

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

Mirth Config

In /opt/mirthconnect/conf/mirth.properties change:

database = postgres

database.url = jdbc:postgresql://localhost:5432/mirth

database.username = mirth
database.password = mirth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment