Ubuntu
Installing OpenMRS on Ubuntu involves setting up a few key dependencies, configuring necessary ports, and compiling the platform itself. This guide will walk you through each step, ensuring you have everything in place for a successful installation.
Before you start, make sure your system meets the prerequisites outlined below. You'll need to check and install several dependencies, configure your environment, and finally, compile and run OpenMRS.
Ports used
OpenMRS requires two specific ports to be available during installation:
Port 3306: The default port for MySQL.
Port 8080: The default port for the Jetty server.
To ensure these ports are open and free from any existing connections, execute the following commands in your terminal:
fuser -k 3306/tcp
fuser -k 8080/tcp
Dependencies
Before diving into the installation, you’ll need to verify and install several dependencies to ensure OpenMRS runs smoothly on your Ubuntu system.
Java Runtime Environment (JRE)
First, check if you have the JRE installed by running:
javac -version
OpenMRS requires Java 1.6 or higher, and for Platform 2.x, Java 1.8 is required. If Java is not installed, you’ll see a message prompting you to install it:
sudo apt-get install default-jre
Java Development Kit (JDK)
Next, confirm that the JDK is installed with:
As with the JRE, OpenMRS requires at least Java 1.6, and Platform 2.x requires Java 1.8. If the JDK is not installed, use the following command:
If you have another version of Java installed, ensure that Java 1.8 is the active version by executing:
MySQL
For OpenMRS Platform 2.3, MySQL 5.7 is recommended. For versions 2.2 and below, MySQL 5.6 is preferred. Check your current MySQL version by running:
For older versions of Ubuntu, you may install MySQL using:
After installation, you’ll be prompted to set a root password for MySQL. Ensure your firewall allows TCP connections on port 3306, and your hosts.deny
file permits access to your localhost.
Maven
Maven is essential for compiling and generating source files in OpenMRS. Verify its presence with:
If Maven is not installed, follow the prompt to install it:
Getting the OpenMRS Core from GitHub
To access the source code, follow the instructions provided on the Using Git page. Make sure to place the openmrs-core
directory into your home directory.
Downloading a User Interface Module
Starting with version 2.0, OpenMRS does not include a built-in user interface. You’ll need to download one manually. To get the Legacy UI Module, follow the instructions on the User Interface Modules page.
Once downloaded, move the legacyui-(version#)-SNAPSHOT.omod
file into the ~/.OpenMRS/modules
directory. To do this manually:
Go to the Home directory.
Press
Ctrl+H
to reveal hidden folders.Navigate to the
.OpenMRS
folder and place the UI.omod
file in themodules
folder.
Compiling the OpenMRS Platform
In your terminal, navigate to the outermost project directory (inside the openmrs-core
directory) and run:
This process may take some time, depending on your machine. It will compile, run tests, build all artifacts, and install them into your local repository.
Running OpenMRS
To start OpenMRS, move into the webapp
directory inside openmrs-core
and run:
Wait for the message [INFO] Started Jetty Server
. Once it appears, open your web browser and go to:
After selecting your preferred language, you should see the installation screen.
Simple Installation Method: If chosen, the default username is
admin
and the default password isAdmin123
. You can also decide whether to include demo data.
Advanced Installation Method: Recommended if you’ve previously created the OpenMRS database.
By following these steps, you should have a fully functional OpenMRS installation on your Ubuntu system. If you encounter any issues or need further assistance, refer to the related articles or reach out to the OpenMRS community for support.