After all of my unusual troubles, I have finally done it. I have succeeded in building and installing OpenMRS on my Ubuntu machine. This blog post will serve as a guide, tracing the steps that led to my successful installation.
Before we begin, however, it's important to note that my machine has a 64-bit Intel processor and my operating system is Ubuntu 14.04.
Software
First, here are a few URLs for the resources that I used:
GitHub repository for the OpenMRS core
- https://github.com/openmrs/openmrs-core
Apache Maven version 3.3.9 tar
- http://apache.arvixe.com/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
- http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Note: the Java link features many different packages. We will need this one: jdk-8u73-linux-x64.tar.gz
You will also need to have a working version of MySQL installed on your machine, and you need to know the password for your user.
Installations
Note: You may have to run some or all of these commands as sudo. I did.
OpenMRS-Core
To check out the OpenMRS core, you will need to fork the repository. Once that is done, you can enter the following commands in your terminal to get the repo on your local machine:
Building OpenMRS
You should now have all of the necessary tools to build and install openmrs-core. To do this,
$ cd *file path to your openmrs-core clone*
$ mvn clean install
Make sure that when you run the clean install command that you are in the outermost layer of the openmrs-core directory. This may take a while, but that's ok. If you experience failure, try running the command as su. If you continue to experience failure, you may need to clear your .m2 folder, like so:
$ cd ~/.m2
$ rm -r repository
$ mkdir repository
After this process, try the "clean install" command again in the openmrs-core directory.
At this point, you should be able to run the installation.
$ cd *file path to openmrs-core directory*/webapp
$ mvn jetty:run
Then, direct to your browser to "localhost:8080" You should be provided with a link. Follow the link, and click the button to install OpenMRS. Make sure that you have MySQL installed and that you know the password, as this installation is going to build the OpenMRS database.
If everything was successful, you should now have a working OpenMRS installation. Congratulations! Now you just have to install an API. If not, it's probably your fault. Just kidding. If you have any issues or comments, or something is just plain wrong, please leave a comment or email me.
-Craig
Installations
Note: You may have to run some or all of these commands as sudo. I did.
OpenMRS-Core
To check out the OpenMRS core, you will need to fork the repository. Once that is done, you can enter the following commands in your terminal to get the repo on your local machine:
$ mkdir openmrs-core
$ cd openmrs-core
$ git init
$ git pull *enter the URL of your forked repo here*
You should now have the checked out code on your machine.
Maven
Once you have downloaded the tar package, you can run these commands to get it running:
$ mv apache-maven-3.3.9-bin.tar.gz /opt/apache-maven-3.3.9-bin.tar.gz
$ cd /opt
$ tar -xfvz apache-maven-3.3.9-bin.tar.gz
$ rm apache-maven-3.3.9-bin.tar.gz
Now you will have the most recent version of Maven, as I write this, in your /opt directory. To make Maven easy to use, we will have to symbolically link to it, more or less making a "shortcut." To do this, enter:
$ cd ~
$ ln -s /usr/bin/mvn /opt/apache-maven-3.3.9-bin.tar.gz
Java
Download the tarball specified above, then follow these steps:
$ mv jdk-8u73-linux-x64.tar.gz /usr/lib/jvm/jdk-8u73-linux-x64.tar.gz
$ cd /usr/lib/jvm
$ tar -xfvz jdk-8u73-linux-x64.tar.gz
$ rm jdk-8u73-linux-x64.tar.gz
$ update-alternatives --config java
After the last command, you will most likely get a list of options. You want to make sure that you select the option that reads "/usr/lib/jvm/java-8-oracle/jre/bin/java"
BASHRC
Now we will have to add these programs to our path. To do this, you will have to
$ cd ~
and, using the text editor of your choice, add the following lines to your .bashrc file:
#java home path
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export PATH=$PATH:$JAVA_HOME/bin
#Maven path
export MAVEN_HOME=/opt/apache-maven-3.3.9/bin
export PATH=$PATH:$MAVEN_HOME/bin
After the last command, you will most likely get a list of options. You want to make sure that you select the option that reads "/usr/lib/jvm/java-8-oracle/jre/bin/java"
BASHRC
Now we will have to add these programs to our path. To do this, you will have to
$ cd ~
and, using the text editor of your choice, add the following lines to your .bashrc file:
#java home path
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export PATH=$PATH:$JAVA_HOME/bin
#Maven path
export MAVEN_HOME=/opt/apache-maven-3.3.9/bin
export PATH=$PATH:$MAVEN_HOME/bin
Once the above lines have been added the the .bashrc file in your home directory, enter the command
$ source .bashrc
to update.
$ source .bashrc
to update.
Building OpenMRS
You should now have all of the necessary tools to build and install openmrs-core. To do this,
$ cd *file path to your openmrs-core clone*
$ mvn clean install
Make sure that when you run the clean install command that you are in the outermost layer of the openmrs-core directory. This may take a while, but that's ok. If you experience failure, try running the command as su. If you continue to experience failure, you may need to clear your .m2 folder, like so:
$ cd ~/.m2
$ rm -r repository
$ mkdir repository
After this process, try the "clean install" command again in the openmrs-core directory.
At this point, you should be able to run the installation.
$ cd *file path to openmrs-core directory*/webapp
$ mvn jetty:run
Then, direct to your browser to "localhost:8080" You should be provided with a link. Follow the link, and click the button to install OpenMRS. Make sure that you have MySQL installed and that you know the password, as this installation is going to build the OpenMRS database.
If everything was successful, you should now have a working OpenMRS installation. Congratulations! Now you just have to install an API. If not, it's probably your fault. Just kidding. If you have any issues or comments, or something is just plain wrong, please leave a comment or email me.
-Craig
No comments:
Post a Comment