Step-by-Step Installation Guide for Ubuntu 8.10 for Developers


Contents

Note: Some of the command line commands have EDIT in them. Substitute your favorite editor (e.g. vim, gedit, emacs).

Note: This installation procedure also works for Ubuntu 9.10.

Downloading Required Software

Make sure your system is up-to-date:

sudo aptitude update

Enable the multiverse package so we can install the Sun Java 6 packages. Open up /etc/apt/sources.list and make sure the multiverse repositories are there:

deb http://us.ec2.archive.ubuntu.com/ubuntu/ intrepid main multiverse
deb-src http://us.ec2.archive.ubuntu.com/ubuntu/ intrepid main multiverse
deb http://us.ec2.archive.ubuntu.com/ubuntu/ intrepid-updates main multiverse
deb-src http://us.ec2.archive.ubuntu.com/ubuntu/ intrepid-updates main multiverse

Update aptitude so it knows about the repositories we just added:

sudo aptitude update

Install the following packages: tomcat6 tomcat6-admin mysql-client mysql-server sun-java6-bin sun-java6-jdk sun-java6-jre

sudo aptitude install tomcat6 tomcat6-admin mysql-client mysql-server sun-java6-bin sun-java6-jdk sun-java6-jre

If you are using InfoPath for form entry, install the additional packages: lcab cabextract

sudo aptitude install lcab cabextract

If you get the following error:

Setting up tomcat6-common (6.0.18-0ubuntu3.2) ...
Setting up tomcat6 (6.0.18-0ubuntu3.2) ...
Adding system user `tomcat6' (UID 110) ...
Adding new group `tomcat6' (GID 117) ...
Adding new user `tomcat6' (UID 110) with group `tomcat6' ...
Not creating home directory `/usr/share/tomcat6'.
* Starting Tomcat servlet engine tomcat6
...fail!
invoke-rc.d: initscript tomcat6, action "start" failed.
Setting up tomcat6-admin (6.0.18-0ubuntu3.2) ...
invoke-rc.d: initscript tomcat6, action "status" failed.

Purge and reinstall tomcat (bug 372233):

sudo aptitude purge tomcat6 tomcat6-admin
sudo aptitude install tomcat6 tomcat6-admin

Make sure you have the proper development tools.

Set Up Tomcat

  1. Set environment variables needed by Tomcat.
    EDIT ~/.bashrc
    • Add the following lines:
           export JAVA_HOME=/usr/lib/jvm/java-6-sun
      
      export JRE_HOME=/usr/lib/jvm/java-6-sun
    • In your open terminal window:
      source ~/.bashrc
  2. Modify the Tomcat security settings.
    sudo EDIT /etc/init.d/tomcat6
    • Update/add the following lines:
            Use the Java security manager? (yes/no)
      
      TOMCAT6_SECURITY=no
      CATALINA_OPTS='-Xmx512m -Xms512m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:NewSize=128m'
  3. Add a Tomcat user.
    sudo EDIT /etc/tomcat6/tomcat-users.xml
    • Update the following lines:
      <?xml version='1.0' encoding='utf-8'?>
      
      ...
      <tomcat-users>
      <role rolename="admin"/>
      <role rolename="manager"/>
      <role rolename="tomcat"/>
      <user username="test" password="test" roles="admin,manager,tomcat"/>
      </tomcat-users>
    • Ensure the code inside <tomcat-users> is no longer surrounded by a comment.
  4. Restart Tomcat
    sudo sh /etc/init.d/tomcat6 restart
  5. Verify that Tomcat is running correctly.

Download OpenMRS Source

  • With just Subversion (svn) installed:
    1. Create a new directory for the code. Our example will call it OPENMRS.
    2. At a command line prompt in the OPENMRS directory, run (SVN_HOME)/bin/svn checkout http://svn.openmrs.org/openmrs/trunk

or

  • With Subclipse installed as plugin in Eclipse:
    1. File-->New-->Project...-->SVN-->Checkout project from SVN
    2. Use Repository - http://svn.openmrs.org/
    3. Browse in new tree to /openmrs/trunk
    4. Go through various prompts with Next>

Set Up Project

  1. Update the project properties.
    • Edit properties.xml (at the root of the source tree)
    • Update the following lines:
            <property name="tomcat.home" value="/var/lib/tomcat6"/>
      
      <property name="catalina.home" value="/var/lib/tomcat6"/>
  2. Set up the OpenMRS runtime directory.
    •       sudo mkdir /usr/share/tomcat6/.OpenMRS
      
      sudo chown -R tomcat6:root /usr/share/tomcat6/.OpenMRS

Build the Source and Install the Webapp

  • From within Eclipse
    1. Click Window > Show View > Ant
    2. Drag and Drop build.xml from the 'openmrs' project into the Ant view
    3. In the Ant view (left pane), expand the 'openmrs-trunk' build file
    4. Double click on the install ant task (this may take a few minutes)
      • NOTE: Subsequent re-installs can be done using the update Ant task.

or

  • Command Line
    1. Open a terminal / bash shell
    2. Change directories to the openmrs project directory where you checked out the OpenMRS trunk code using svn.
    3. Type 'ant install'
      • Future compilations can run (ANT_HOME)/bin/ant update or, if really needed, (ANT_HOME)/bin/ant -k clean remove install
  • If openmrs is not starting, check your tomcat logs: (tomcathome)/logs/catalina.out

Set Up OpenMRS Database

When you start OpenMRS for the first time, you will see the Installation Wizard.

  1. Step 1 of 5
    • Select No, you do not currently have a database installed.
    • database name: openmrs
    • username: root
    • password: your database root password
  2. Step 2 of 5
    • Select Yes, you need to automatically create the tables.
    • Select Yes, you want to add demo data.
    • Select No, you do not currently have a database user.
    • username: root
    • password: your database root password
  3. Step 3 of 5
    • Select Yes, you want to be able to upload modules.
    • Select Yes, you want updates to be applied on startup.
  4. Step 4 of 5
    • username: admin
    • password: choose a password
  5. Step 5 of 5
    • Click finish.