Implementing OpenMRS for developers on a local server GUIDE

Hi OpenMRS community,

After a few hours of headaches and frustrations, I have finally been able to install OpenMRS on my laptop for development. Not sure if there’s another guide elsewhere, but most of the guides that I found were a bit outdated or incomplete.

Here’s a step-by-step process of what I did pretty much and the prerequisites you need for OpenMRS to work.

  1. The latest Tomcat version seems to work, but I currently use Tomcat 8 (Not covered in this guide, since this will just be a local install using Jetty).
  2. The latest Java version does not seem to work according to my testing. After some time testing and reading the forums, Java 1.8 seems to work best with OpenMRS.
  3. The latest MYSQL version also does not seem to work. When you try to initialize the database, OpenMRS will bug you saying that it can’t connect to the database. I tried checking my MYSQL password over and over again and even changing it, but it didn’t work. Downgrading to 5.5 did the trick.
  4. The latest Maven version seems to work.
  5. Git works regardless of whichever version you have, so just download the latest one.

Alright, so here’s what worked for me and I hope works for you. I am using Windows 10.

  1. I installed the JDK from here.
  2. I then installed MYSQL from here. (When installing, you can just install the server from going to the custom installation setting. You don’t need most of the applications from there for OpenMRS. When you are installing the program and are configuring the password, make sure you use a password that you will remember - You will need this password when initializing OPENMRS )
  3. Next just install Maven normally from here. There’s an excellent guide for that posted here.
  4. Next install Git from here.
  5. Once you have installed Git, cd to whichever folder or directory works best for you. Once you are satisfied with the folder, type in:

git clone GitHub - openmrs/openmrs-core: OpenMRS API and web application code

It may take a while for this to happen depending on how fast your internet is. Once that’s completed. cd to that directory with the command:

cd openmrs-core

Once that is completed, run this command:

mvn clean install

This may also take some time. It took around 15-20 minutes for my computer to build the entire thing.

  1. Now that you have installed everything. Make sure your MYSQL server is running. then cd over to webapp in your openmrs-core directory with the command:

cd openmrs-core/webapp

Once that’s done, type in:

mvn jetty:run

Wait for Jetty to initialize, and once you see the terminal or command prompt say that it is running head on over to http://localhost:8080/openmrs which will help you set up the database. Make sure you remember your MYSQL password from before as this step requires it. Again, make sure you are using MYSQL 5.5, other versions didn’t work for me. It kept telling me that it couldn’t connect to the database. Once the setup is completed, it’s going to tell you that no module is installed - this means you can’t use the admin interface. You can now go over to whichever directory you’d like to git clone this interface module. Here is the command for git cloning:

git clone https: //github.com/openmrs/openmrs-module-legacyui.git

Once that’s done, cd over to that directory and then type in:

mvn clean install

This may take a while, but once that’s done, cd over to openmrs-module-legacyui/omod/target. There you will see a file with an .OMOD extension. Once you find that, copy that file over to OpenMRS’ AppData. You can do this in Windows 10 by searching for %APPDATA%. Once you are in the AppData folder, cd over to OpenMRS’ folder, then modules. Once inside that modules folder, copy that .omod file there. Once you have copied it over, restart your jetty server if it is still running. To do so, either click the X on the command prompt or hit CTRL+C. Once that’s done, cd over to wherever you installed openmrs-core then cd over to webapp. Once you are there, finally type in:

mvn jetty:run

Once that’s done, your install should now be complete. For your reference, the default login credentials are username: admin and the password: Admin123.

And there you have it. You should now be in the admin menu for OpenMrs. I hope this guide helps you guys out!

3 Likes

I thought this was part of the wiki but thankyou @zenalc for breaking it down to this NICE!!:wink:

2 Likes

You do have a point…something’s need to be changed especially issues of versions…

1 Like

thanks @zenalc for this,its really helpful

i would advocate for mysql 5.7 according to this

1 Like

@zenalc Could you share the link of the wiki page that you were referencing when you first tried to install?

Here you go!