Guide to Installing OpenMRS on an Amazon EC2 Server (Ubuntu 12.04 LTS)

May 27, 2013 § Leave a Comment

The following is a guide for creating a new instance of OpenMRS 1.9.3 on an Amazon EC2 Server running Ubuntu 12.04 LTS. Although there is a community-based Amazon Machine Image that can be used to implement OpenMRS on an EC2 server, I’ve chosen to start from scratch to ensure security and confidentiality of patient data that will ultimately be stored in this instance of OpenMRS.

1. Ensure that ports 80 and 8080 are enabled under Security Group settings in the Amazon AWS console.
2. Set up an SSH keypair for the server and log in using:
ssh -i username username@ec2-XX-XXX-XX-XX.compute-1.amazonaws.com
3. After logging into the server, log in as a root user using:
su root

- Enter your password.

4. From the terminal, install Apache, MySQL, and PHP using:
sudo apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server

- When prompted, create a password that will be used to log into MySQL.

5. From the terminal, install phpMyAdmin using:
sudo apt-get install phpmyadmin

- Select Apache2 for the server.
- Choose YES when asked to configure for phpMyAdmin with dbconfig-common
- Enter your MySQL password.
- Create a password that will be used to log into phpMyAdmin.

6. Add phpMyAdmin to the Apache configuration by using:
sudo nano /etc/apache2/apache2.conf

- Add the phpmyadmin config at the end of the apache2.conf file.
Include /etc/phpmyadmin/apache.conf
- Restart apache:
sudo service apache2 restart

- Confirm that phpMyAdmin has been configured correctly by pointing to the following address in your browser:
ec2-XX-XXX-XX-XX.compute-1.amazonaws.com/phpmyadmin

7. From the terminal, install Java using:
sudo apt-get install openjdk-6-jdk

8. From the terminal, install Tomcat 6 and related packages using:
sudo apt-get install tomcat6 tomcat6-admin tomcat6-common tomcat6-user tomcat6-docs tomcat6-examples

- Note that Tomcat 6 is compatible with the latest build of OpenMRS 1.9.3 (March 2, 2013). It remains to be seen whether later versions of Tomcat (i.e. Tomcat 7) can be used with the latest version of OpenMRS.

- Test whether Tomcat is up and running by pointing to the following address in your browser:
ec2-XX-XXX-XX-XX.compute-1.amazonaws.com:8080

9. Configure Tomcat by using:
sudo nano /etc/tomcat6/tomcat-users.xml

- After <tomcat-users>, insert the following:
<role rolename=”tomcat”/>
<role rolename=”manager”/>
<role rolename=”admin”/>
<user username=”XXXX” password=”XXXX” roles=”tomcat,admin,manager”/>

- Save the file by pressing Ctrl-X, then Enter.

- Restart Tomcat by using:
sudo /etc/init.d/tomcat6 restart

- Test whether Tomcat has been configured correctly by pointing to the following address in your browser:
ec2-XX-XXX-XX-XX.compute-1.amazonaws.com:8080/manager/html

Log in with the username and password you chose in the tomcat-users.xml file.

10. Create an OpenMRS directory by running the following commands:
sudo mkdir /usr/share/tomcat6/.OpenMRS
sudo chown -R tomcat6 /usr/share/tomcat6/.OpenMRS

11. Go to http://wiki.openmrs.org/display/RES/Downloads, and download the latest version of openmrs.war. Save it to your local system.

12. Go to ec2-XX-XXX-XX-XX.compute-1.amazonaws.com:8080/manager/html, and upload your openmrs.war file under the section titled ‘WAR file to deploy’.

13. In the Tomcat manager, click on /openmrs or point to ec2-XX-XXX-XX-XX.compute-1.amazonaws.com:8080/openmrs to begin installation.

Follow

Get every new post delivered to your Inbox.