Linux & Other OS

This guide will take you through the steps needed to install Firefox, Java, Tomcat, and Jetty, preparing your system for running OpenMRS.

Step 1: Install Firefox

Begin by installing Firefox, which will be necessary to access and manage OpenMRS.

Step 2: Install Java

Java is essential for running OpenMRS, and the installation process varies depending on your operating system.

For Ubuntu:

  • Option 1: Install OpenJDK Directly

    sudo apt-get install openjdk-8-jdk
  • Option 2: Install OpenJDK as a Dependency of Tomcat

    sudo apt-get install tomcat7

For Other Operating Systems:

  • Download Java:

    • Obtain the Java 8 release version of the Java Runtime Environment (JRE) from the official site.

  • Install Java:

    • Run the installer or unzip the contents, depending on the provided package.

    • Accept the license agreement to complete the installation.

Step 3: Install Tomcat

Tomcat is the application server that will run OpenMRS. You can either install it as a package or manually from a zip archive.

Option 1: Manual Installation on Other Operating Systems

  1. Download Tomcat:

    • Get the zip archive of Tomcat 7.0.99 from the official website.

  2. Unpack Tomcat:

    sudo useradd tomcat7 cd /opt sudo tar zxvf apache-tomcat-7.0.99.tar.gz sudo ln -s apache-tomcat-7.0.99 tomcat7 sudo chown tomcat7.tomcat7 apache-tomcat-7.0.99
  3. Configure Tomcat Users:

    • Open the Tomcat users file (e.g., /opt/tomcat/conf/tomcat-users.xml) as root:

      sudo nano /opt/tomcat/conf/tomcat-users.xml
    • Add a user with admin and manager roles:

      <user name="admin" password="XXXXXX" roles="tomcat,admin,manager,manager-gui"/>

Option 2: Installation as a Debian Package (Not Recommended)

  1. Install Tomcat:

    sudo apt-get install tomcat7
  2. Configure Tomcat Users:

    • Open the Tomcat users file (e.g., /etc/tomcat/tomcat-users.xml) as root:

      sudo nano /etc/tomcat/tomcat-users.xml
    • Add a user with admin and manager roles:

      <user name="admin" password="XXXXXX" roles="tomcat,admin,manager,manager-gui"/>
  3. Adjust Security Settings:

    • Turn off the Tomcat security flag:

      sudo nano /etc/init.d/tomcat7
    • Find TOMCAT7_SECURITY=yes and change it to TOMCAT7_SECURITY=no.

  4. Create OpenMRS Application Data Directory:

    sudo mkdir /usr/share/tomcat6/.OpenMRS sudo chown -R tomcat7:root /usr/share/tomcat7/.OpenMRS

Step 4: Install Jetty (Alternative to Tomcat)

Jetty is another application server option for running OpenMRS, particularly in a Linux environment.

Jetty Installation Steps

  1. Download Jetty:

    • Obtain Jetty 7.4.5 from the official site (avoid version 7.5.4, which may have compatibility issues with your JDK).

  2. Unpack Jetty:

    sudo mkdir /usr/share/jetty cd /usr/share/jetty sudo mv /path/to/jetty/jetty-distribution-(version).tar.gz . sudo tar xfz jetty-distribution-(version).tar.gz sudo mv jetty-distribution-(version)/* . sudo rm -rf jetty-distribution(version)
  3. Set Up Jetty as a Service:

    • Copy the Jetty startup script:

      sudo cp bin/jetty.sh /etc/init.d/jetty
    • Edit /etc/init.d/jetty to define the paths for Java and Jetty:

      JAVA_HOME=/path/to/java JETTY_HOME=/usr/share/jetty // or your Jetty installation directory
  4. Start Jetty:

    • Place the openmrs.war file in /usr/share/jetty/webapps/.

    • Start Jetty using the command:

      sudo /etc/init.d/jetty start

Step 5: Install MySQL

Finally, you need to set up a MySQL database to store the OpenMRS application data.

For Ubuntu:

  • Install MySQL:

    sudo apt-get install mysql-server
  • Set a Root Password:

    • During installation, you will be prompted to enter a root password. Remember this for configuring OpenMRS.

Related content