Oscar EMR Installation with Caisi Integrator from Source
Preface: This document is an A-Z installation guide on installing the Oscar EMR with the Caisi Integrator. The OscarSetup.zip file will be available on Google Drive. In most cases in this document, the process will be described, followed by the bolded instructional steps. All paths are absolute.
* See bottom of document for list of commonly used commands *
Prerequisites:
Install Ubuntu 12.04 LTS (host or vm). Run all updates.
Java
See instructions on how to get sun-java below.
MySQL 5.1 or 5.5+
sudo apt-get install mysql-server libmysql-java
Tomcat
sudo apt-get install tomcat6
The tomcat service will run automatically. Enter the following command to stop the service.
sudo /etc/init.d/tomcat6 stop
Git
sudo apt-get install git
Maven2
Download the apache-maven-2.2.1.zip file. It must be 2.2.1.
Create a directory called bin in the home folder.
Extract the zip file to the bin folder.
Configure your environment variables:
Enter these lines at the bottom of the file:source
JAVA_HOME="/usr/lib/jvm/java-6-sun"
CATALINA_HOME="/usr/share/tomcat6"
CATALINA_BASE="/var/lib/tomcat6"M2_HOME=”/home/username/bin/apache-maven-2.2.1”
M2=”$M2_HOME/bin”
PATH=”$M2:$PATH”
export JAVA_HOME CATALINA_HOME CATALINA_BASE M2_HOME M2\Logout and in to see changes
Check your versions to confirm it’s all working
java -version (if this says Ice Tea, you have the wrong Java)
mvn –version
mysql –V (capital)
MySQL Workbench
sudo apt-get install mysql-workbench
Eclipse (install java first, instruction below)
sudo apt-get install eclipse
Your working directory should be named "workspace" and is located at /home/username/
How to get sun-java:
To install the official Sun JDK, enter the following commands:
$ wget https://github.com/flexiondotorg/oab-java6/raw/0.2.7/oab-java.sh -O oab-java.sh
$ chmod +x oab-java.sh
$ sudo ./oab-java.sh
$ sudo apt-get update
$ sudo apt-get install sun-java6-jdk
$ sudo update-java-alternatives -s java-6-sun #If you install this Jdk only and not Iced Tea, you don't need this last command.
Running java -version in command line should now read
java version "1.6.0_38"
Java(TM) SE Runtime Environment (build 1.6.0_38-b05)
Java HotSpot(TM) 64-Bit Server VM (build 20.13-b02, mixed mode)
Lastly the new Java environment needs to be pointed to a different SWT library. Execute:
- ln -s /usr/lib/jni/libswt-* ~/.swt/lib/linux/x86_64/
on a 64-bit installation and
ln -s /usr/lib/jni/libswt-* ~/.swt/lib/linux/x86/
on a 32-bit. I have not confirmed the 32-bit one.
*If using eclipse, you will want to install egit and m2e (Help > Install New Software > All Available Sites > search for ‘egit’ and ‘m2e’ and install each).
MySQL Setup
You will want to create a mysql user named 'oscar' with the password 'oscar' and grant this user all permissions to your databases. The easiest way to perform these mysql operations is to use mysql workbench.
Setup a new Server Instance:
Click New Server Instance (Under Server Administration)
Select localhost
Click Next
Make sure Connection Name is localhost
Host Name is localhost
Username is root
click Next, Select your Install Variant and continue until Finish appears.
When the Server Instance has been created, click Finish.
- Open (Double Click) your new server instance from the list box on the right (mysqld@localhost)
- Select Users and Privileges under Security on the left menu.
- Click the Add Account button and enter the following credentials:
- Login name: oscar
- Limit connectivity: localhost
- Password: oscar
- Confirm password: oscar
- Select Administrative Roles tab and select the DBA Role. This way the oscar user has all permissions.
The user oscar@localhost will be used for all mysql operations from this point on, rather than root@localhost.
Getting the Latest Version of Oscar
To clone Oscar from gerrit, you will have create an account on gerrit - the code review system of choice for Oscar – generate an ssh key, and link it to your account. In terminal, follow the steps below:
cd /home/username/
ssh-keygen
hit the Enter twice (no passphrase)
cd .ssh
cat id_rsa.pub
This will display the ssh-key that you will be copying into gerrit.
Log into gerrit (https://source.oscartools.org:8080)
Click Settings (top-right)
Click SSH Public Keys
Click the Add Key button
Now copy the ssh key from the text editor, and paste it into the ssh-key field in Gerrit and click "Add".
In order to get the latest version of the Oscar project, we will have to clone the oscar project from Gerrit. Enter these commands to setup a new project directory in your workspace folder:
cd /home/username/workspace/
(mkdir workspace first if this directory does not exist)git clone ssh://<your username>@source.oscartools.org:29418/oscar
Setting Up a Custom Tomcat Installation
Download the OscarSetup.zip file from the google docs and unzip it into the user directory.
Next you will have to copy the tomcat-local folder into your local workspace
Setting Up the Oscar Database
Don’t do this unless you have to. Instead ask for the latest MySQL dump from someone who cares. If you can’t find anyone, do it this way.
Run the initialization script to setup your databases. This script accepts 3 parameters:
i. mysql username (oscar)
ii. mysql password (oscar)
iii. the name of the database that you are running creating
cd /home/username/workspace/oscar/database/mysql/
chmod 755 createdatabase_on.sh
./createdatabase_on.sh oscar oscar oscar_spec4
cd /home/username/OscarSetup/
Next you will need to fill the oscar database with sample data:
mysql -uoscar -poscar oscar_spec4 < oscar_spec4_data.sql
If you get a fresh mysql dump, login to mysql as oscar and run
mysql> create database oscar_spec4;
Then run
mysql> use oscar_spec4;
mysql> source thesqlfile.sql;
Now we will want to create the test database.
create database oscar_test # if this database already exists, it’s ok
Now run
mysql> create database drugref;
mysql> use drugref;
mysql> source drugref.sql;
Building and Running Oscar
Copy the files
Oscar.properties
Deploy-oscar.sh
Drugref.properties
into your home folder
Now to build the project, in terminal, you’ll want to run the following:
cd /home/workspace/oscar/
mvn clean package
Go to home folder and run
chmod +x workspace/tomcat-local/bin/catalina.sh
chmod +x deploy-oscar.sh
./deploy-oscar.sh
Now open up a web browser, and navigate to http://localhost:8080/oscar
You’re done! You should now have a "working" copy of the Oscar EMR. Lucky You!!!
-------------------------------------------------------
Command: Description:
Command | Description |
sudo /etc/init.d/tomcat6 start/restart/stop | Restarts tomcat engine |
sudo nano /etc/profile/ | Edit environment variables |
mv /home/mohawk/workspace/oscar_source/oscar/target/oscar-SNAPSHOT.war $CATALINA_BASE/webapps/oscar.war | Move compiled war file to $CATALINA_BASE |
mvn clean package | Compile oscar |