How to install OpenMRS on a CentOS 6 VPS

openmrs vpsOpenMRS or Open Medical Record System is a Java based collaborative open source project used to create customized medical records system with no programming knowledge.
To install OpenMRS on a CentOS VPS follow the very easy steps described below. OpenMRS requires Java 6, Java servlet container such as Apache Tomcat, and an existing database such as MySQL.

Install JAVA

Install Java 6 using the following command:

yum install java-1.6.0-openjdk java-1.6.0-openjdk-devel ant

Verify the Java version installed on the server:

java -version

java version "1.6.0_33"
OpenJDK Runtime Environment (IcedTea6 1.13.5) (rhel-
OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)

Install Tomcat

Download and install the latest version of Apache Tomcat 7 (do not install Tomcat 8 if you intend to use it with Java 6):

cd /opt


tar -zxf apache-tomcat-7.0.57.tar.gz -C /usr/local

mv /usr/local/apache-tomcat-7.0.57 /usr/local/tomcat

useradd -r tomcat --shell /bin/false

chown -R tomcat: /usr/local/tomcat

Edit the ‘/usr/local/tomcat/bin/’ file and add the following line before ‘# OS specific support. $var _must_ be set to either true or false.’ line:

export JAVA_HOME=/usr

Install OpenMRS

For advanced users using OpenMRS in production it is recommended to download OpenMRS Platform 1.10.1 WAR file. It can be downloaded at

cd /usr/local/tomcat/webapps
wget -O openmrs.war
mkdir -P /usr/local/tomcat/.OpenMRS 
chown tomcat: /usr/local/tomcat/webapps/openmrs.war 
chown tomcat: /usr/local/tomcat/.OpenMRS/

Since ‘openmrs.war’ file is located to the ‘/usr/local/tomcat/webapps’ directory, it will automatically be deployed by Tomcat on start-up, so start Tomcat service:

cd /usr/local/tomcat/bin

OpenMRS requires a database to work as this is where data is saved, so create a new ‘openmrsdb’ MySQL database on your server:

mysql -u root -p
mysql> CREATE DATABASE openmrsdb;
mysql> CREATE USER openmrs@localhost;
mysql> SET PASSWORD FOR 'openmrs'@'localhost' = PASSWORD("openmrs-password");
mysql> GRANT ALL PRIVILEGES ON openmrsdb.* TO 'openmrs'@'localhost' IDENTIFIED BY 'openmrs-password' WITH GRANT OPTION;
mysql> quit

Open http://server-ip-address:8080/openmrs and follow the easy instructions: select install language, choose ‘Advanced’ type of installation, enter ‘openmrsdb’ as database name, ‘openmrs’ as MySQL username and the MySQL password for the ‘openmrs’ user defined earlier and finally specify a new password for your administrator user.

openmrs back-end


If you like to eliminate the 8080 from the URL and open OpenMRS through a regular URL (i.e. reverse proxy OpenMRS web application behind Apache), edit Apache configuration file and add the following lines:

<VirtualHost *:80>
   ErrorLog logs/
   CustomLog logs/ common

ProxyRequests Off

   <Proxy *>
   Order deny,allow
   Allow from all

      ProxyPass / http://server-ip-address:8080/openmrs/
      ProxyPassReverse / http://server-ip-address:8080/openmrs/

   <Location />
      Order allow,deny
      Allow from all

In order to open OpenMRS using , change ‘server-ip-address’ with ‘’ in the ProxyPass and ProxyPassReverse directives. Do not forget to restart Apache web server for the changes to take effect:

service httpd restart

That is it. The OpenMRS installation is now complete. Of course you don’t have to do any of this if you use one of our Super-Fast CentOS Hosting services, in which case you can simply ask our expert Linux admins to install OpenMRS for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.


Leave a Comment

To prove you are human please solve the following *