Wiki Spaces

Documentation
Projects
Resources

Get Help from Others

Q&A: Ask OpenMRS
Discussion: OpenMRS Talk
Real-Time: IRC Chat | Slack

Documentation

Page tree
Skip to end of metadata
Go to start of metadata

Step by step setup walk through for Linux Developer Installation

(This guide was designed for Linux Ubuntu 10.10, x86-- results may vary based on distribution and architecture)

Notice that the step named Build Maven Project below also works on Windows 7 / 64.

Prerequisites:

  1. Install: Eclipse IDE for Java EE Developers
  • Open terminal and  navigate to your download folder
    su – or prefix all commands with sudo
  • Extract files
  • tar -xvzf eclipse-jee-juno-linux-gtk.tar.gz -C /opt (varies by downloaded file name)
  • Add read permissions to all files
  • chmod -R +r /opt/eclipse
    Create Eclipse executable on /usr/bin path
    touch /usr/bin/eclipse
    chmod 755 /usr/bin/eclipse
     
  • Open eclipse file with your favorite editor
    nano -w /usr/bin/eclipse
       (or graphically)
          gksu -u root gedit /usr/bin/eclipse
     
  • Paste following content to file
    #!/bin/sh
    export ECLIPSE_HOME="/opt/eclipse"

          $ECLIPSE_HOME/eclipse $*

  • Create Gnome desktop launcher
    ## Create following file, with your favorite editor ##
    /usr/share/applications/eclipse.desktop
       ( graphically)
          gksu -u root gedit /usr/share/applications/eclipse.desktop
     
    ## Add following content to file and save ##
    [Desktop Entry]
    Encoding=UTF-8
    Name=Eclipse
    Comment=Eclipse SDK 3.6.1
    Exec=eclipse
    Icon=/opt/eclipse/icon.xpm
    Terminal=false
    Type=Application
    Categories=GNOME;Application;Development;
    StartupNotify=true

      2.        Make sure JDK is installed*

  • sudo apt-get install openjdk-6-jdk

      3.        Make sure mysql-server is installed (Required for OpenMRS Database)*

  • sudo apt-get install mysql-server

 *** NOTE: You will be prompted to create a database password, do not forget this as you need it later on!!!

Configure Eclipse and Plugins

  1. Launch Eclipse EE and create a new workspace (Applications -> Programming -> Eclipse)
  2. See How to install Eclipse plugins sections here

Check out Source Code from repository

** NOTE ** You might need to click on the workspace icon in the top right of Eclipse main panel to get into the Java perspective.

  1. See how to check out a maven project from a Git repository here

Install OpenMRS 

  • In the project explorer panel, right click on the project which has been created and navigate to “Run as → Maven Install” (this may take some time to complete)

  

Build Maven Project

**Review console notifications to makes sure Maven installation was successful.

  • Expand the project and navigate to the “webapp” folder. Right click and select “ Run As -Maven Build

 

  • In the “Goals” text field enter: “jetty:run” which will start the java application server locally. 
  • In the JRE tab, put in the following VM arguments: -Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m
  • Press the Run button

 

Configure OpenMRS Installation for the first time

  1. Once the jetty application server is running (via Maven Build, last step), point your browser to http://127.0.0.1:8080/openmrs/initialsetup
  2. http://127.0.0.1:8080/openmrs/initialsetupClick on the “Advanced” installation option and press continue.
  3. Follow these configuration instructions## ** NOTE this is where you will need the mysql database password from before
  4. You should now be able to login to OpenMRS via http://127.0.0.1:8080/

Default Login Details for your Locally hosted OpenMRS

  • Username : admin
  • Password : either "Admin123" or "test"
End Notes

When making most code modifications, you need to complete a Maven Install. You may cut down on compile time by skipping OpenMRS tests if desired. This can be done by creating a new run configuration for the project and typing into the “Goals” textfield the word “install”, and checking the checkbox which says “skip tests”.

Developer Setup guide created by Jon Polaski and Todd Binger of Western New England University.

14 Comments

  1. user-11e35

    Hi! I'm having trouble while installing from the m2e-extras repository, it asks for:

    Cannot complete the install because one or more required items could not be found.
      Software being installed: Hudson Integration for M2Eclipse 0.13.0.201105100720 (org.sonatype.m2e.hudson.feature.feature.group 0.13.0.201105100720)
      Missing requirement: UI Commons 1.1.7.201105091728 (org.maven.ide.eclipse.commons.feature.feature.group 1.1.7.201105091728) requires 'org.eclipse.m2e.core 0.13.0' but it could not be found
      Cannot satisfy dependency:
        From: Hudson Integration for M2Eclipse 0.13.0.201105100720 (org.sonatype.m2e.hudson.feature.feature.group 0.13.0.201105100720)
        To: org.maven.ide.eclipse.commons.feature.feature.group [1.1.7.201105091728]

    Any ideas of how could I get them working? Maybe the repositories changed? Thanks in advance

    1. The easiest thing to do is just to not choose the "hudson integration" when installing.  You only need the "subclipse integration".

  2. user-501c3

    Hi,

    While Building Maven Project ,I expanded the project and navigated to the “webapp” folder and then Right clicked and selected “ Run As -Maven Build” as per the instructions given here . After performing this step, the console is stuck with this line:
    [INFO] Starting scanner at interval of 10 seconds.
    Any idea on how to proceed from here would be welcome.Thanks in advance.

     

     

    1. Thats what you want to see. Thats the last thing jetty prints out when it is done starting up. Now go to localhost:8080/openmrs in your browser and you should see openmrs running in a jetty servlet container.

      1. user-501c3

        Thanks for replying. I did just that, but then after completing all the installation procedures, I get this error:

        • ?Error executing sql: create database if not exists `?` default character set utf8 - Could not create connection to database server. Attempted reconnect 3 times. Giving up.?
        • Failed to create the test database, see logs for details

        And then it goes back to Step1 of installation procedure and asks default language I prefer.

        1. This means that openmrs couldn't connect to your mysql server. Make sure you have mysql installed and running. Also make sure that you put in the correct username/password in the wizard for openmrs to connect and create the db.

          1. user-501c3

            You were absolutely correct. After reinstalling mysql from synaptic manager, and repeating the installation procedure with the correct password, the problem is solved .Thanks a lot. :-)

            1. This guide was very helpful to me in correctly setting up OpenMRS. Thank you very much!

  3. user-52e2d

    hi everyone, I installed and the initial setup ran successfully but today when i opened openmrs (localhost:8080/openmrs) it is giving the following errors :

    Error occurred while trying to get the updates needed for the database. Could not acquire change log lock. Currently locked by fe80:0:0:0:21b:38ff:feca:a3a1%2 (fe80:0:0:0:21b:38ff:feca:a3a1%2) since 3/24/12 7:26 PM
    java.lang.RuntimeException: Error occurred while trying to get the updates needed for the database. Could not acquire change log lock. Currently locked by fe80:0:0:0:21b:38ff:feca:a3a1%2 (fe80:0:0:0:21b:38ff:feca:a3a1%2) since 3/24/12 7:26 PM
    at org.openmrs.util.DatabaseUpdater.getUnrunDatabaseChanges(DatabaseUpdater.java:578)
    at org.openmrs.util.DatabaseUpdater.updatesRequired(DatabaseUpdater.java:257)
    at org.openmrs.web.Listener.setupNeeded(Listener.java:170)
    at org.openmrs.web.Listener.contextInitialized(Listener.java:142)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4323)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4780)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:785)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:763)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:557)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:987)
    at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:778)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:540)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1390)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:355)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)
    at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:313)
    at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:293)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:996)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:771)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:988)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:275)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:427)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:649)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:585)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:415)
    Caused by: liquibase.exception.LockException: Could not acquire change log lock. Currently locked by fe80:0:0:0:21b:38ff:feca:a3a1%2 (fe80:0:0:0:21b:38ff:feca:a3a1%2) since 3/24/12 7:26 PM
    at liquibase.lock.LockHandler.waitForLock(LockHandler.java:170)
    at liquibase.Liquibase.listUnrunChangeSets(Liquibase.java:518)
    at org.openmrs.util.DatabaseUpdater.getUnrunDatabaseChanges(DatabaseUpdater.java:566)
    ... 35 more
    any idea how to fix this ?

    1. See Troubleshooting OpenMRS. OpenMRS after 1.9 should catch this and fix it for you though. What were you installing?

      1. user-52e2d

        Hi thanks for the reply, yaa i saw that page after some searching here and there and finally found the solution. 

      2. user-4ba3b

        i have cloned the openmrs 1.9.x but i get a compilation error as follows.. can you help me? thanks

         

        INFO] OpenMRS ........................................... SUCCESS [3.276s]
        [INFO] openmrs-tools ..................................... SUCCESS [2.888s]
        [INFO] openmrs-test ...................................... SUCCESS [0.048s]
        [INFO] openmrs-api ....................................... FAILURE [8.676s]
        [INFO] openmrs-web ....................................... SKIPPED
        [INFO] openmrs-webapp .................................... SKIPPED
        [INFO] ------------------------------------------------------------------------
        [INFO] BUILD FAILURE
        [INFO] ------------------------------------------------------------------------
        [INFO] Total time: 15.702s
        [INFO] Finished at: Sat May 25 17:04:54 GMT 2013
        [INFO] Final Memory: 17M/90M
        [INFO] ------------------------------------------------------------------------
        [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.1:compile (default-compile) on project openmrs-api: Compilation failure
        [ERROR] Failure executing javac, but could not parse the error:
        [ERROR] An exception has occurred in the compiler (1.6.0_24). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport)  after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report.  Thank you.
        [ERROR] java.lang.NullPointerException

  4. user-4ba3b

    Hi,

    im facing this error while trying to compile the openmrs-core, in ubuntu. i have tried cloning fresh from the git folder but the same error prevails. Can some one help me?

    [INFO] OpenMRS ........................................... SUCCESS [3.276s]
    [INFO] openmrs-tools ..................................... SUCCESS [2.888s]
    [INFO] openmrs-test ...................................... SUCCESS [0.048s]
    [INFO] openmrs-api ....................................... FAILURE [8.676s]
    [INFO] openmrs-web ....................................... SKIPPED
    [INFO] openmrs-webapp .................................... SKIPPED
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 15.702s
    [INFO] Finished at: Sat May 25 17:04:54 GMT 2013
    [INFO] Final Memory: 17M/90M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.1:compile (default-compile) on project openmrs-api: Compilation failure
    [ERROR] Failure executing javac, but could not parse the error:
    [ERROR] An exception has occurred in the compiler (1.6.0_24). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport)  after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report.  Thank you.
    [ERROR] java.lang.NullPointerException
    [ERROR] at com.sun.tools.javac.parser.Parser.block(Parser.java:1497)
    [ERROR] at com.sun.tools.javac.parser.Parser.block(Parser.java:1511)
    [ERROR] at com.sun.tools.javac.parser.Parser.methodDeclaratorRest(Parser.java:2566)
    [ERROR] at com.sun.tools.javac.parser.Parser.classOrInterfaceBodyDeclaration(Parser.java:2515)
    [ERROR] at com.sun.tools.javac.parser.Parser.classOrInterfaceBody(Parser.java:2442)
    [ERROR] at com.sun.tools.javac.parser.Parser.classDeclaration(Parser.java:2287)
    [ERROR] at com.sun.tools.javac.parser.Parser.classOrInterfaceOrEnumDeclaration(Parser.java:2225)
    [ERROR] at com.sun.tools.javac.parser.Parser.typeDeclaration(Parser.java:2214)
    [ERROR] at com.sun.tools.javac.parser.Parser.compilationUnit(Parser.java:2160)
    [ERROR] at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:581)
    [ERROR] at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:622)
    [ERROR] at com.sun.tools.javac.main.JavaCompiler.parseFiles(JavaCompiler.java:878)
    [ERROR] at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:796)
    [ERROR] at com.sun.tools.javac.main.Main.compile(Main.java:388)
    [ERROR] at com.sun.tools.javac.main.Main.compile(Main.java:308)
    [ERROR] at com.sun.tools.javac.main.Main.compile(Main.java:299)
    [ERROR] at com.sun.tools.javac.Main.compile(Main.java:100)
    [ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    [ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    [ERROR] at java.lang.reflect.Method.invoke(Method.java:616)
    [ERROR] at org.codehaus.plexus.compiler.javac.JavacCompiler.compileInProcess(JavacCompiler.java:484)
    [ERROR] at org.codehaus.plexus.compiler.javac.JavacCompiler.compile(JavacCompiler.java:155)
    [ERROR] at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:575)
    [ERROR] at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:116)
    [ERROR] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    [ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    [ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    [ERROR] at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    [ERROR] at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    [ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    [ERROR] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    [ERROR] at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    [ERROR] at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    [ERROR] at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    [ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    [ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    [ERROR] at java.lang.reflect.Method.invoke(Method.java:616)
    [ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    [ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    [ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    [ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
    [ERROR] -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]

  5. Hi,

    To setup OpenMrs in ubuntu ,I followed this  link http://en.flossmanuals.net/openmrs-developers-guide/get-set-up/.Now I got a screen with 3 options. i.e. Sample,Advanced,Test.I have selected Advanced and  followed  the process which is explained inStep 6 - Configure OpenMRS.In final step I got the below exception.Please any one help me to fix this below problem.

    Exception:

    [INFO] Started Jetty Server
    [INFO] Starting scanner at interval of 10 seconds.
    ERROR - Context.getServiceContext(255) |2014-01-22 17:27:36,346| serviceContext is null. Creating new ServiceContext()
    WARN - InitializationFilter.executeStatement(1134) |2014-01-22 17:27:49,886| error executing sql: create database if not exists `?` default character set utf8
    com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
    at com.mysql.jdbc.Util.getInstance(Util.java:381)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:984)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2364)
    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:773)
    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
    at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:352)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:282)
    at java.sql.DriverManager.getConnection(DriverManager.java:571)
    at java.sql.DriverManager.getConnection(DriverManager.java:215)
    at org.openmrs.web.filter.initialization.InitializationFilter.executeStatement(InitializationFilter.java:1119)
    at org.openmrs.web.filter.initialization.InitializationFilter.access$200(InitializationFilter.java:59)
    at org.openmrs.web.filter.initialization.InitializationFilter$InitializationCompletion$1.run(InitializationFilter.java:1342)
    at java.lang.Thread.run(Thread.java:744)
    Caused by: java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3536)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3468)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:917)
    at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3974)
    at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1282)
    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2292)
    ... 15 more

    WARN - OpenmrsUtil.getRuntimePropertiesFilePathName(2530) |2014-01-22 17:27:56,371| Unable to find a runtime properties file at /home/ait/openmrs-core/webapp/openmrs-runtime.properties
    WARN - OpenmrsUtil.getRuntimePropertiesFilePathName(2556) |2014-01-22 17:27:56,373| Unable to find properties file: /home/ait/.OpenMRS/openmrs-runtime.properties

    Thanks in Advance,