Ports Used
OpenMRS Installation requires the use of two ports, 3306 and 8080. Port 3306 is the default port for MySQL and 8080 is the 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.
Both ports must be open and have no existing connections. Before going any further, make sure to kill all processes running on those ports with the following commands.
fuser -k 3306/tcp
fuser -k To ensure these ports are open and free from any existing connections, execute the following commands in your terminal:
Code Block | ||
---|---|---|
| ||
fuser -k 3306/tcp fuser -k 8080/tcp |
Dependencies
Before building and compiling OpenMRS make sure you have or install the following dependencies:
Java JRE
Check for the JRE by going into the Terminal and typing
javac –version
If Java is installed, the result should be 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:
Code Block | ||
---|---|---|
| ||
javac -version |
OpenMRS requires Java 1.6 or higher, and platform for Platform 2.x requires , Java 1.8 is required.
If you don’t have Java is not 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
Java JDK
Check for the JDK by going into the Terminal and typing
java –version
The result should look something like this:
Againyou’ll see a message prompting you to install it:
Code Block | ||
---|---|---|
| ||
sudo apt-get install default-jre |
Java Development Kit (JDK)
Next, confirm that the JDK is installed with:
Code Block | ||
---|---|---|
| ||
java -version |
As with the JRE, OpenMRS requires at least java Java 1.6, and platform Platform 2.x requires Java 1.8. If you didn’t have Java installed and you just installed the JDK is not installed, execute use the following command: sudo
Code Block | ||
---|---|---|
| ||
sudo apt-get install default-jdk |
If you have another version of java Java installed, please make sure ensure that java Java 1.8 is set to be the version you are using. Execute sudo active version by executing:
Code Block | ||
---|---|---|
| ||
sudo update-alternatives --config |
...
The result should look something like this:
...
Choose java 8 by entering the corresponding selection number.
MySQL
...
java |
...
MySQL
For OpenMRS Platform 2.3, or MySQL 5.6 for OpenMRS 7 is recommended. For versions 2.2 and below. To check if your version of MySQL, type into a terminal, MySQL 5.6 is preferred. Check your current MySQL version by running:
Code Block | ||
---|---|---|
| ||
mysql --version |
In order to install old versions of MySQL on newer versions of Ubuntu (like 20.04), follow the instructions outlined here.
On For older versions of Ubuntu, you may be able to install MySQL using:
Code Block | ||
---|---|---|
| ||
sudo apt-get install mysql-server-5.7 |
Once installed, you will then After installation, you’ll be prompted to set a root password for MySQL.
You must know your MySQL root password, or have a database ready with a username and password for OpenMRS.
Note: Make sure that your firewall accepts TCP connection on port 3306 for MySQL. Also make sure that Ensure your firewall allows TCP connections on port 3306, and your hosts.deny
file allows permits access to your localhost.
Maven
OpenMRS uses Maven to compile and generate source files. To see if you have maven, use the following command in the Terminal:
mvn
Maven is essential for compiling and generating source files in OpenMRS. Verify its presence with:
Code Block | ||
---|---|---|
| ||
mvn |
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.follow the prompt to install it:
Code Block | ||
---|---|---|
| ||
sudo apt install maven |
Getting the OpenMRS
...
Core from GitHub
To get access the source code, follow the instructions provided on this page:
https://openmrs.atlassian.net/wiki/display/docs/Using+Git
Make sure you put the Using Git page. Make sure to place the openmrs-core
directory into the your home directory of your machine.
Downloading a User Interface Module
Any Starting with version after 2.0, OpenMRS does not include a built-in user interface. This means you will You’ll need to download one yourselfmanually. To download get the Legacy UI Module, follow the instructions on this page:
https://openmrs.atlassian.net/wiki/display/docs/User+Interface+Modules
Then you’ll want to the User Interface Modules page.
Once downloaded, move the legacyui-(version#)-SNAPSHOT.omod
file into the ~/.OpenMRS/modules
directory. If you want to To do this manually in the Files window, go :
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 the Terminal, go In your terminal, navigate to the most outer outermost project directory (in this case, inside the openmrs-core
directory) and type the commandrun: mvn clean
Code Block | ||
---|---|---|
| ||
mvn clean install |
This process may take a while some time, depending on your machine. Your Terminal should be looking something like this:
This It will compile, run tests, build all artifacts, and install them into your local repository.
Running OpenMRS
Move To start OpenMRS, move into the “webapp” webapp
directory inside the “openmrsopenmrs-
core” core
and run the command: mvn
Code Block | ||
---|---|---|
| ||
mvn jetty:run |
Wait for “the message [INFO] Started Jetty
Server” which look like this:
Now open a Server
. Once it appears, open your web browser and go to:
Code Block | ||
---|---|---|
| ||
http://localhost:8080/openmrs |
After it asks you to select a After selecting your preferred language, you should see thisthe installation screen.
Click here if choosing Advanced
Simple Installation Method
...
Click here if choosing Test Installation Method
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.
...
: 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.