Linux Installation
Software Requirements for UgandaEMR
- Java JDK 8
- Tomcat 7 or higher
- Mysql 5.6 or 5.7Installation of Java
Login as root in the linux environment
Download the JDK 8(jdk-8u361-linux-x64.tar.gz) from this official site:
Open the terminal and enter the following command to create the parent directory to deploy the JDK.
sudo mkdir /usr/lib/jvmEnter the following command to change the directory
cd /usr/lib/jvmExtract the jdk-8u361-linux-x64.tar.gz file in the jvm directory using this command
sudo tar -xvzf /YourHomeDirectory/jdk-8u361-linux-x64.tar.gzEnter the following command to open the environment variables file. According to your personal preference, you can choose any text editor instead of nano.
sudo nano /etc/environmentIn the opened file, add the following bin folders to the existing PATH variable. Note that the PATH variables must be separated by a colon.
/usr/lib/jvm/jdk1.8.0_361/bin/usr/lib/jvm/jdk1.8.0_361/db/bin/usr/lib/jvm/jdk1.8.0_361/jre/binAppend the following environment variable to the end of the file.
J2SDKDIR="/usr/lib/jvm/jdk1.8.0_361" J2REDIR="/usr/lib/jvm/jdk1.8.0_361/jre" JAVA_HOME="/usr/lib/jvm/jdk1.8.0_361"A sample environment file before making these changes would look like the following:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"The same file after making the changes should look like this:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games: /usr/lib/jvm/jdk1.8.0_361/bin:/usr/lib/jvm/jdk1.8.0_361/db/bin:/usr/lib/jvm/jdk1.8.0_361/jre/bin" J2SDKDIR="/usr/lib/jvm/jdk1.8.0_361" J2REDIR="/usr/lib/jvm/jdk1.8.0_361/jre" JAVA_HOME="/usr/lib/jvm/jdk1.8.0_361"Save the changes and close the editor
Sometimes an existing JDK installation might have a shortcut added to the /usr/bin directory. Therefore setting the PATH environment variable alone may not change the default Java compiler and runtime. To update these alternative shortcuts, run the following commands:
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_351/bin/java" 0sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.8.0_351/bin/javac" 0sudo update-alternatives --set java /usr/lib/jvm/jdk1.8.0_351/bin/javasudo update-alternatives --set javac /usr/lib/jvm/jdk1.8.0_351/bin/javacTo verify the setup enter the following commands and make sure that they print the location of java and javac as you have provided in the previous step.
update-alternatives --list javaupdate-alternatives --list javacTest version on terminal with command
java -versionIf you are not able to see the version install missing linux libraries
sudo apt-get install libc6-i386
Installation of Tomcat
Tomcat installation will require java which were previously installed as shown above
sudo apt updateSet up a Tomcat user
sudo useradd -r -m -U -d /opt/tomcat -s /bin/false tomcatDownload tomcat
wget -c https://archive.apache.org/dist/tomcat/tomcat-7/v7.0.109/bin/apache-tomcat-7.0.109.tar.gz 4. Install on linux sudo tar xf apache-tomcat-7.0.109.tar.gz -C /opt 5. Rename apache-tomcat-7.0.109 to tomcat
cd /opt
mv apache-tomcat-7.0.109 tomcat
Now we need to provide the user Tomcat with access for the Tomcat installation directory
sudo chown -R tomcat: /opt/tomcat/*Finally, we will use the chmod command to provide all executable flags to all scripts within the bin directory.
sudo sh -c 'chmod +x /opt/tomcat/bin/*.sh'Configure Tomcat serice
sudo nano /etc/systemd/system/tomcat.serviceNow enter the following in your file and save it. Note that you need to update the value of JAVA_HOME if your Java installation directory is not the same as given below.
[Unit]
Description=Apache Tomcat Web Application Container
After=network.target
[Service]
Type=forking
Environment="JAVA_HOME=/usr/lib/jvm/jdk1.8.0_361"
Environment="CATALINA_PID=/opt/tomcat/temp/tomcat.pid"
Environment="CATALINA_HOME=/opt/tomcat/"
Environment="CATALINA_BASE=/opt/tomcat/"
Environment="CATALINA_OPTS=-Xms1024M -Xmx2048M -server -XX:+UseParallelGC"
Environment="JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom"
ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh
User=tomcat
Group=tomcat
UMask=0007
RestartSec=10
Restart=always
[Install]
WantedBy=multi-user.targetNow we reload the daemon to update the system about the new file.
sudo systemctl daemon-reloadStart tomcat service
sudo systemctl start tomcatNow we can enable the Tomcat service to run on startup using this command.
sudo systemctl enable tomcatAfter you install Tomcat, you need to allow it to use the 8080 port through the firewall to be able to communicate outside your local network.
sudo ufw allow 8080/tcpOnce we install Tomcat on Linux, we need to verify our installation. To do so, simply enter the following in your browser.
http://YourIPAddress:8080
If your installation and configuration were successful, you should see this page. 
To enable tomcat to write in /var/lib , create the OpenMRS folder and make tomcat to own it using the commands below
cd /var/libmkdir OpenMRSsudo chown tomcat:tomcat OpenMRS/*Done.
Mysql 5.6 Installation
Guide for mysql installation is provided in link here Mysql Installation
Remember to create mysql user 'openmrs'
Deploying UgandaEMR on Linux
Stop tomcat service
sudo service tomcat stopcopy war file to /opt/tomcat/webapps folder
Start tomcat service
sudo service tomcat startAccess the system on browser via
http://YourIPAddress:8080/openmrsYou should see OpenMRS Installation Wizard page as below
Intial page Select your preferred language and click the “=>” button.
On the Installation Type screen, choose the Advanced installation type you want and click the “=>” button.

Intial page Fill in your MySQL root password as shown below, and click the “=>” button.

page2 Fill the Next form as shown below and click the “=>” button.

page2 Fill in options as shown below and click the “=>” button.

page3 Fill in admin password as shown below and click the “=>” button.

page3 Skip next form click the “=>” button.
And continue to finish the installation
Drop openmrs database dump to openmrs database and restart tomcat service.
Done Click the “=>” button to create a database for OpenMRS and complete the installation. Log in to OpenMRS using the default username “admin” and password “Admin123”.
Last updated
Was this helpful?