In this tutorial, we will show you how to install OpenMRS on Ubuntu 22.04 LTS. For those of you who didn’t know, OpenMRS is an enterprise electronic medical record system framework that allows the exchange of patient data with other medical information systems. It is written in Java and provides a web interface to manage electronic medical records.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘
sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the OpenMRS on Ubuntu 22.04 (Jammy Jellyfish). You can follow the same instructions for Ubuntu 22.04 and any other Debian-based distribution like Linux Mint, Elementary OS, Pop!_OS, and more as well.
- A server running one of the following operating systems: Ubuntu 22.04, 20.04, and any other Debian-based distribution like Linux Mint.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
non-root sudo useror access to the
root user. We recommend acting as a
non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.
Install OpenMRS on Ubuntu 22.04 LTS Jammy Jellyfish
Step 1. First, make sure that all your system packages are up-to-date by running the following
apt commands in the terminal.
sudo apt update sudo apt upgrade
Step 2. Installing Java.
The default Java OpenJDK is available on the Ubuntu base repository. Install it via the following
sudo apt install java-11-openjdk
If all installation is completed, verify your Java OpenJDK version using the following command:
For additional resources on installing Java, read the post below:
Step 3. Installing MariaDB.
By default, the MariaDB is available on Ubuntu 22.04 base repository. Now run the following command below to install the latest version of MariaDB to your Ubuntu system:
sudo apt install mariadb-server mariadb-client
After successfully installing, enable MariaDB (to start automatically upon system boot), start, and verify the status using the commands below:
sudo systemctl enable mariadb sudo systemctl start mariadb sudo systemctl status mariadb
Confirm the installation and check the installed build version of MariaDB:
By default, MariaDB is not hardened. You can secure MariaDB using the
mysql_secure_installation script. you should read and below each step carefully which will set a root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:
Configure it like this:
- Set root password? [Y/n] y - 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
Next, we will need to log in to the MariaDB console and create a database for OpenMRS. Run the following command:
mysql -u root -p
This will prompt you for a password, so enter your MariaDB root password and hit Enter. Once you are logged in to your database server you need to create a database for OpenMRS installation:
MariaDB [(none)]> CREATE DATABASE openmrs_db; MariaDB [(none)]> CREATE USER 'openmrs_user'@'localhost' IDENTIFIED BY 'your-strong-password'; MariaDB [(none)]> GRANT ALL ON openmrs_db.* TO 'openmrs_user'@'localhost'; MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> EXIT;
For additional resources on installing MariaDB, read the post below:
Step 4. Installing Apache Tomcat.
Now run the following command below to install the last version of the Apache Tomcat package to your Ubuntu system:
sudo apt install tomcat9 tomcat9-admin
After successfully installing, enable Apache Tomcat (to start automatically upon system boot), start, and verify the status using the commands below:
sudo systemctl enable tomcat sudo systemctl start tomcat sudo systemctl status tomcat
Step 5. Installing OpenMRS on Ubuntu 22.04.
First, we create a directory for OpenMRS and change the ownership of that directory to the tomcat user:
mkdir /var/lib/OpenMRS chown -R tomcat:tomcat /var/lib/OpenMRS
Next, download the latest version of OpenMRS using the following command below:
After that, copy the downloaded file to the Tomcat web apps directory:
cp openmrs.war /opt/tomcat/webapps/
We will need to change some folders permissions:
chown -R tomcat:tomcat /opt/tomcat/webapps/openmrs.war
Step 6. Configure Firewall.
Now we set up an Uncomplicated Firewall (UFW) with OpenMRS to allow public access on default web ports 8080:
sudo ufw allow OpenSSH sudo ufw allow 8081 sudo ufw enable
Step 7. Accessing OpenMRS Web Interface.
Once successfully installed, open your web browser and access the OpenMRS Web interface using the URL
http://Your-IP-address:8080/openmrs. You will be redirected to the following page:
Congratulations! You have successfully installed OpenMRS. Thanks for using this tutorial for installing OpenMRS Medical Record System on Ubuntu 22.04 LTS Jammy Jellyfish system. For additional help or useful information, we recommend you check the OpenMRS website.