Before building and compiling OpenMRS make sure you have or install the following dependencies:
Check for the JRE by going into the Terminal and typing
If Java is installed, the result should be 1.6 or higher, and platform 2.x requires Java 1.8.
If you don’t have Java installed, you should get a message returned that says “The program java can be found in the following packages”. Then execute the command:
sudo apt-get install default-jre
Check for the JDK by going into the Terminal and typing
The result should look something like this:
Again, OpenMRS requires at least java 1.6, and platform 2.x requires Java 1.8.
If you didn’t have Java installed and you just installed the JDK, execute the command:
sudo apt-get install default-jdk
You must know your MySQL root password or have a database ready with a username and password. To check if you have MySQL installed, simply type mysql into the Terminal. If you don’t have it installed use the command:
sudo apt-get install mysql-server-5.7
You will need to input the password of your machine. You will then get the message “Do you want to continue? [Y/n]” assuming you want to continue, type y then hit the enter key.
You will then be prompted to set a root password for MySQL. It should look like this:
You will be asked to repeat the password you typed.
Note: Make sure that your firewall accepts tcp connection on port 3306 for mysql. Also make sure that your hosts.deny file allows access to your localhost.
OpenMRS uses Maven to compile and generate source files. To see if you have maven, use the following command in the Terminal:
If Maven is not installed, you should get the message “The program ‘mvn’ is currently not installed. You can install it by typing: sudo apt install maven”. Follow those instructions.
Getting the OpenMRS-core from GitHub
To get the source code, follow the instructions on this page:
Make sure you put the openmrs-core into the home directory of your machine.
Downloading a User Interface Module
Any version after 2.0 does not include a built-in user interface. This means you will need to download one yourself. To download the Legacy UI Module, follow the instructions on this page:
Then you’ll want to move the legacyui-(version#)-SNAPSHOT.omod into the ~/.OpenMRS/modules directory. If you want to do this manually in the Files window, go to the Home directory and Ctrl+H to find show hidden folders. There should be a “.OpenMRS” folder. Inside that folder there should be a “modules” folder – this is where you want to put the UI .omod file.
Compiling the OpenMRS Platform
In the Terminal, go to the most outer project directory (in this case, inside the openmrs-core directory) and type the command:
mvn clean install
This may take a while depending on your machine. Your Terminal should be looking something like this:
This will compile, run tests, build all artifacts, and install them into your local repository.
Move into the “webapp” directory inside the “openmrs-core” and run the command:
Wait for “[INFO] Started Jetty Server” which look like this:
Now open a web browser and go to
After it asks you to select a language, you should see this
If you choose the Simple Installation method, your screen should look like this:
The "Password" field is the password you set when you downloaded MySQL above.
The default username is admin and the default password is Admin123.
You can also set whether you want demo data added or not.
Note: If you have created the openmrs database prior to this step, it might be a good idea to choose 'Advanced' installation.