Search the OSCAR Documentation
< All Topics
Print

Installation of OSCAR 19 on Ubuntu 24.04

Preface

This tested basic install is adequate for a local install of OSCAR 19 with scripted encrypted backups and Secure Socket Layer technology.  NOTE THESE INSTRUCTIONS REMAIN *EXPERIMENTAL* UNTIL THIS NOTICE IS REMOVED.  For production work consider the well proven instructions for Ubuntu 22.04 instead.

Document Version History

  • v0.1 – Initial instructions for LTS Ubuntu 24.04 daily build – Feb 22, 2024
  • v0.2 – Updated with the earliest DEB (19-90~4002) that expands and installs correctly  – Mar 12, 2024
  • v0.3 – Tomcat9 replaced by Tomcat10 in the 24.04 repository. Install tomcat9 manually or update repository to find it. – Aug 21, 2024

Documentation Copyright © 2012-2024 by Peter Hutten-Czapski MD under the Creative Commons Attribution-Share Alike 3.0 Unported License

Prerequisites

Check that:

  • You have at least two hours to spare.  Downloading the Ubuntu ISO will take half an hour at 2 MB/s. Allow a minimum of 30 minutes to install Ubuntu, 15 minutes to install the infrastructure packages, 5 to download the OSCAR DEB and a final 18 minutes to install OSCAR itself. YMMV
  • We recommend virtualization for enterprise level equipment. A virtualization environment (hypervisor) allows you to install one or more servers as virtual machines (VM) to improve security and ease maintenance. When provisioning the VM consider that the base install of Ubuntu and OSCAR will need about 15 GB and should have 3GB RAM allocated at a minimum for testing.
  • You are using suitable hardware.  While the OSCAR server may run on recent CPUs with 2GB RAM I consider 3GB a minimum.  I suggest aiming to consumer grade machines with 8GB RAM for 1-3 MD’s increasing to server grade machines with 32GB for 7+ MD’s.  Server grade machines offer component redundancy and improved reliability that is an advantage in any setting, but all systems need contingency plans for hardware failure. The author runs Intel Xeon server with 72GB RAM and hardware RAID as well as a i7 backup server with 16GB RAM for a database that is 8GB (compressed) in size and has 24 users
  • You have installed the 24.04 64 bit LTS version of Ubuntu Noble Numbat either natively or as a VM.  The desktop version is slightly easier to debug for testing and the server version is “lighter” and more suitable for production. The desktop version has been tested with OSCAR and both are publicly supported by Ubuntu to April 2029 and with inexpensive subscription to 2034.
  •  For Production Use, if you are able to manually provide the password after a power outage or reboot, we strongly recommend configuring Ubuntu for *full disk encryption* which will mitigate the privacy breech that occurs with physical theft of the server.
  • You have a basic level of Linux knowledge and you can open a Linux terminal
  • You can cut and paste EXACTLY the following instructions (These instructions are sensitive to spelling packages and order. )
  • These instructions have been tested. There are significant disadvantages of trying ANY other version of the software versions specified herein unless you have extensive OSCAR configuration experience.  Better to get it running on spec and only then try something a bit different.

NOTE: Firefox will copy with Control+C while a Linux terminal requires Shift+Control+V for paste

TL; DR

Well then lets give the skinny
sudo apt-get update

sudo apt install openjdk-11-jdk unzip curl pgpgpg ufw wkhtmltopdf

tomcat9 is no longer in the Ubuntu 24.04 LTS ‘Noble Numbat’ repository. It has been replaced by tomcat10. To install tomcat9, you can either manually download and install it or update the repository, install it and restore the repository (my choice).
The following will: Add 2 ‘jammy’ lines to the repo, list the repo, install tomcat9, check the version, nano to remove the 2 ‘jammy’ lines, update the repo

sudo add-apt-repository -y -s "deb http://archive.ubuntu.com/ubuntu/ jammy main universe"
cat /etc/apt/sources.list</br/> sudo apt install tomcat9</br/> /usr/share/tomcat9/bin/catalina.sh version
sudo nano /etc/apt/sources.list
sudo apt-get update

sudo apt install mariadb-server mariadb-client libmariadb-java

Now skip to the configuration of MariaDB section for the tricky bits

Installing The Infrastructure Packages

WE REITERATE It’s a newbie error to deviate from these instructions in favour of something newer or “easier.” For production use we recommend these exact instructions as the community can support you if you are having problems. If you are both familiar with OSCAR and are testing or are willing to take chances when you colour outside the lines feel free to deviate from the instructions as you wish (review the version notes), and if its substantive deviation (and it works), please submit back your version.

Java 8 11

In Ubuntu 24.04 you have the option of Java’s including 8, 11, 17, and 21.  OSCAR 19 has been tested and runs on all of them, only 8 and 11 support full OSCAR functionality.

sudo apt install openjdk-11-jdk

Some of the libraries that OSCAR uses will not work on newer Java. Testing has shown you will loose the ability to print labels with Java 17+ without any performance advantage.  If you want to use newer Java remember  its easy to downgrade to the well tested Java 8 (end of life in 2026) .  Just change the JAVA_HOME in /etc/default/tomcat9 file to point to the one you want to use and restart tomcat9.  See the JAVA version notes for more detail.

Tomcat 9.0

Java uses Apache Tomcat to present OSCAR’s webpages to your internet browser from the Universe repository. Tomcat 10 is not currently supported. Install Tomcat 9.0.70 with

sudo apt install tomcat9

Test by pointing your browser at http://localhost:8080

For a headless server you can test by installing a non graphical browser such as lynx.  Otherwise test from another machine by replacing localhost with the IP of the server.

If you don’t get a welcome screen then it is likely that Tomcat is not picking up your java, see troubleshooting in the Java section above.

Unzip Curl

Unzip is used to decompress zip files.  Curl is an internet file transfer utility.  Pgpgpg is optionally used by OSCAR to encrypt charts for export. Uncomplicated Fire Wall (ufw) will secure the server. Unzip and UFW are probably already installed.  Apt-get them to be sure

sudo apt install unzip curl pgpgpg ufw

Certbot (optional)

Certbot will register your server with Lets Encrypt so that external browser access to the OSCAR will be with a green padlock for a trusted connection.  You DO need to own a fully qualified domain name (FQDN eg www.example.org) to proceed.  To install certbot execute the following

sudo apt install certbot

Certbot sets up a temporary standalone webserver that needs to communicate on port 80 to the lets encrypt server to authenticate that you are the owner of the website.  If your server is behind a router/firewalls you will need to open port 80 on your router and forward that port as port 80 on your server.  Those instructions vary by router.  In the following replace FQDN with your the fully qualified domain name that you own.

sudo certbot certonly --standalone -d FQDN

Test by checking if there are files as below

sudo ls /etc/letsencrypt/live/FQDN cert.pem  chain.pem  fullchain.pem  privkey.pem  README

The OSCAR Deb installer will install the certificate for you when it runs, alternately if no certificate is found it will generate a self-signed certificate and install that instead.

wkhtmltopdf 0.12.6

OSCAR uses wkhtmltopdf to print some pdf content for eforms and faxing.

sudo apt install wkhtmltopdf

If after you finish installing OSCAR your eForms PDF fine then there is no need for further testing. Otherwise it is advised that you test with the parameters that you have in oscar,properties for the keyword WKHTMLTOPDF_ARGS

Currently the DEB will configure something that could be tested with the following

wkhtmltopdf -s Letter -T 10mm -L 8mm -R 8mm --print-media-type --enable-local-file-access http://google.com test.pdf

If you get an error with the wkhtmltopdf, you can install the patched version. See the Software Version Notes for more information Version notes – Notes on wkhtmltopdf

MariaDB

OSCAR uses this database to store your data. You can use the latest version of MariaDB (10.11.09) obtained with:

sudo apt install mariadb-server mariadb-client libmariadb-java

Configuration MariaDB

This installation has no initial password and will need to be secured with the following Configuration section (follow the scripts suggested defaults EXCEPT for switching to unix socket authentication where you should answer n)

The plugin prevents non system root users from logging in to MariaDB, but allows for root users to log in to MariaDB directly without a password. By removing the plugin everyone (including OSCAR via the unprivileged tomcat user) can, and has to, sign into MariaDB by providing the MariaDB password.

Run the mysql_secure_installation script. Do NOT switch to unix_socket authentication. Set the password now.  Feel free to use numbers and letters in your password.  If you proceed with the complication of using symbols “#,!, &,*, (, ), / , \, = and $” in this password (e.g. pass&word), be sure to escape them when providing them to scripts below where the instructions supply ******  that require it (e.g. pass\&word).

$ sudo mysql_secure_installation
Switch to unix_socket authentication [Y/n] n
Change the root password? [Y/n] Y
New password: 
Re-enter new password: 
Remove anonymous users? [Y/n] Y 
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

Now there will only be the one root user set for MariaDB with the password you provided.

To test merely login to the MariaDB shell

$ mysql -uroot -p**********
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 39
Server version: 10.11.6-MariaDB-2 Ubuntu 24.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> quit
Bye

Installing OSCAR 19

Download the OSCAR deb package from Sourceforge.  There are several to choose from. You want the latest DEBs in the feed

RSS Feeds

The naming format is oscar_emr{OSCAR_VERSION}-{DEB_VERSION}~{BUILD}.deb

  • Install the latest as package support for Ubuntu 24.04 is just being finalized.
  • Do NOT try to install a package older than exampled below.
  • Note OSCAR is now running a rolling release and thus stability is not necessarily improved by a higher build number.
  • Once installed if you are experiencing bugs wait for a new release and try either upgrading to a higher number build (the last 4 digits of the deb’s name) that incorporates the fix, or downgrading to an earlier deb that does not have the problem.

All are at http://sourceforge.net/projects/oscarmcmaster/files

You can get the version tested for this article with the following

wget http://sourceforge.net/projects/oscarmcmaster/files/Oscar\ Debian\+Ubuntu\ deb\ Package/oscar_emr19-90~4002.deb

Now simply run the package and follow the instructions

sudo dpkg -i oscar_emr19-90~4002.deb

The deb will provide feedback as to what it is doing however if you want more verbose details open another terminal window and invoke

sudo tail -f /usr/share/oscar-emr/Oscar19install.log

New installs get the following install screens. (for upgrades see Appendix 1 below) Start by providing the location.  Choose BC (not tested) only if you need to bill the BC MSP. 

Then provide the MySQL/MariaDB password you assigned earlier.

This window will give you the option to populate the database with a demo patient with which to develop familiarity with OSCAR.

You can remove the demo data later with the following (replace ****** with your MariaDB/Mysql password, escaping any symbols (if any) that you used in the password).

mysql -uroot -p******* oscar_15 <  /usr/share/oscar-emr/undemo.sql

While customary production settings will be applied, they can be changed manually through editing /usr/share/tomcat9/oscar.properties in your favorite text editor. Note that OSCAR/Tomcat need to restart whenever the properties file is modified, to have the settings take effect.

BE PATIENT The terminal will provide feedback as OSCAR is assembled and configured.  Your output should mirror the following if you did things right

sudo dpkg -i oscar_emr19-90~4002.deb
Selecting previously unselected package oscar-emr.
(Reading database ... 150718 files and directories currently installed.)
Preparing to unpack oscar_emr19-90~4002.deb ...
Unpacking oscar-emr (19-90~4002) ...
Setting up oscar-emr (19-90~4002) ...
NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
Edited tomcat9.service to allow Tomcat read write on /usr/share/oscar-emr and /tmp
Setting initial defaults for areacode in ON
[x] Checking the MySQL password success
[x] Creating an apparmor profile for wkhtmltopdf success
[x] Determining locale success
[x] Creating the new oscar_15 database success
[x] Populating database with ON data success
[x] Populating database with OLIS data success
[x] Patching database to very latest schema success
[x] Populating database with Demo data success
[x] Configuring Tomcat success
[x] Creating Drugref2 Property Files success
[x] Updating drugref database success
[x] Installing Ontario Specific eForms success
[x] Installing HRM xml files success
[x] Installing Ontario Rourke eForm under licence success
[x] Restarting Tomcat success
Successful installation of oscar deb revision 90~4002 Login at https://localhost:8443/oscar Your username is oscardoc Initial password mac2002 second level password (pin) 1117

Allow for a good quarter hour for the deb to run.  Once Tomcat restarts you will be given back the prompt.

You can read the readme!

less /usr/share/oscar-emr/README.txt

Trying It Out

At this point you have a fairly plain install. To test the connection, click on the link displayed on the output above or open your web browser and type in the address manually.  While most new proprietary browsers (Chrome, Safari, Edge etc) will work, for production use we strongly recommend FireFox ESR version, for stability, for tested OSCAR features and a large number of grease monkey addons that you can get on these pages.  Did I mention Firefox is open source and doesn’t sell your data?

Troubleshooting

A few times while testing these instructions OSCAR would not start.  If you

tail -f /var/lib/tomcat9/logs/catalina.out

you would see a critical error with a “missing child” message such as

java.lang.IllegalStateException: Error starting child

OSCAR is a BIG Tomcat program.  There are times when all the libraries it needs to run are not expanded.  The solution is to delete the expanded /var/lib/tomcat9/webapps/oscar directory and let Tomcat re-expand OSCAR fully.

Tomcat will load OSCAR correctly with the above deb when /var/lib/tomcat9/webapps/oscar /WEB-INF/lib has 383 items, totaling 482.5 MB

See production instructions for older Ubuntu for troubleshooting other issues

 

Table of Contents