- |
- Discussion |
- Edit |
- History
Step-by-Step Installation for Developers
This guide is focused on Windows users. A guide for OS X users can be found at Step-by-Step_Installation_for_Developers_on_OS_X (this should also work for Linux users as well, but a Linux guide is in the works).
Contents |
[edit]
STEP 1 - Prerequisites for Installing OpenMRS
- Download and install the latest stable release of the following software
- Java >= v1.5 aka v5.0 (implementers can use the JRE, developers need the JDK)
- MySQL 5.x
- Ant
- Tomcat
- Eclipse IDE for Java EE Developers
- Install the OpenMRS customizations at here
- One (or more) Subversion client:
- Subversion OR
- TortoiseSVN (if you're working within Windows) OR Subclipse (if you're working within Eclipse only)
- NOTE- You may use both TortoiseSVN and Subclipse, but only one is necessary.
- Growl + growlnotify (in the Growl Extras folder) - for Macs
[edit]
STEP 2 - Retrieve a Copy of the Source Code
- With Subversion installed:
- Create a new directory for the code. Our example will call it OPENMRS.
- At a command line prompt in the OPENMRS directory, run %SVN_HOME%/bin/svn checkout http://svn.openmrs.org/openmrs/trunk
- With TortoiseSVN installed:
- Right-click within explorer and select SVN Checkout...
- Enter URL as http://svn.openmrs.org/openmrs/trunk, specify a new directory for your working copy, then click OK
- With Subclipse installed (in eclipse):
- File-->New-->Project...-->SVN-->Checkout project from SVN
- Use Repository - http://svn.openmrs.org/
- Browse in new tree to /openmrs/trunk
- Go through various prompts with Next>
- At the command line prompt in the OPENMRS directory, run %ANT_HOME%/bin/ant install
- Future compilations can run %ANT_HOME%/bin/ant -k clean remove install or %ANT_HOME%/bin/ant update
[edit]
STEP 3 - Create the Database
- Within your working copy, find the SQL scripts within the /metadata/model/ folder
- Launch mysql and run the script openmrs_createdb-mysql.sql to drop/generate the OpenMRS database. Be sure to use the fully qualified path such as: source C:\Documents and Settings\Jim\workspace\OpenMRS\metadata\model\openmrs_1.2.0-mysql.sql
-
- "c:\Program Files\MySQL\MySQL Server 5.0\bin\mysql.exe" -u root -pmyrootpassword
- mysql> source openmrs_createdb-mysql.sql
-
- Run these scripts in order in the same way as the first script at the mysql prompt: Note: you may have to select the database you're using before any of these calls by typing 'use openmrs;'
- openmrs_1.2.0-mysql.sql -- This generates the data model.
- openmrs_1.2.0-data-mysql.sql -- This populates tables.
- openmrs_1.2.0-patient-data-mysql.sql -- This is scrambled data and names. The data is real, however, all personal information is completely fabricated.
- openmrs_1.2.0-to-latest-mysqldiff.sql -- This should be done last
[edit]
STEP 4 - Set up your Local Configuration (optional)
It is possible to use usernames/passwords that are not the default (insecure) ones. See Overriding OpenMRS Default Properties.
[edit]
Create OpenMRS database user
- Log into mysql command line client as root (needs more explicit instructions)
- Create new 'openmrs' user with password 'openmrs'
mysql> create user openmrs@localhost identified by 'openmrs';
mysql> set password for openmrs@localhost=PASSWORD('openmrs');
- Grant all privileges (select insert drop create...) to 'openmrs' user to openmrs schema
mysql> grant ALL on openmrs.* to openmrs;
NOTE: Using 'openmrs' for the username and password is insecure, so please change these for your configuration.
NOTE: Write down the the username and password!
[edit]
OpenMRS-build.properties
- Open a text editor (i.e. Notepad - click Start > Programs > Accessories > Notepad)
- Copy-and-paste Build Properties section from Overriding OpenMRS Default Properties into Notepad
- Save file to
- %USER_HOME%\Application Data\OpenMRS\OpenMRS-build.properties (for windows) or ~/.OpenMRS/OpenMRS-build.properties (for unix)
- Modify the Build Properties to match the location for your installation of Tomcat.
- for windows
-
tomcat.home=C:/Program Files/Apache Software Foundation/Tomcat 6.0/
- for unix
-
tomcat.home=/usr/local/apache-tomcat-6.0.16
- If you are using unix, change your properties.xml file so that:
-
- <property name="tomcat.home" value="/usr/local/apache-tomcat-6.0.16"/>
- <property name="catalina.home" value="/usr/local/apache-tomcat-6.0.16"/>
-
[edit]
Create OpenMRS-runtime.properties
- Open a text editor (i.e. Notepad)
- Copy-and-paste Runtime Properties section from Overriding OpenMRS Default Properties into Notepad
- Save file to %USER_HOME%\Application Data\OpenMRS\OpenMRS-runtime.properties (for windows) or ~/.OpenMRS/OpenMRS-runtime.properties (for unix)
- Modify the runtime properties for the OpenMRS database to match the database user you created above.
-
- connection.username=openmrs
- connection.password=openmrs
-
- If you are using Unix, change your build.xml file so that:
-
- <!-- Environment properties -->
- <property environment="env"/>
- <property name="env.COMPUTERNAME" value="${env.HOSTNAME}"/>
- <property name="env.OPENMRS_RUNTIME_PROPERTIES_FILE" value="${user.home}/.OpenMRS/OPENMRS-runtime.properties" />
-
NOTE: Ignore the customization properties unless you plan to customize the look-and-feel for your OpenMRS implementation
NOTE: Make sure the files do not save as .txt files. This is bad.
[edit]
STEP 5 - Deploy OpenMRS
Assumptions and Dependencies (needs work):
- Eclipse is installed in your machine AND
- OpenMRS source code has been downloaded using TortoiseSVN and imported into Eclipe (include link to instructions) OR
- OpenMRS source code has been downloaded using subclipse (include link to instructions)
- Ensure that Tomcat is running
- Once you are up and running, the default OpenMRS user/password is admin/test
[edit]
Eclipse (in Windows, Linux, Unix, Mac)
- Run Eclipse.exe
- In the project explorer, right click on your OpenMRS project folder root and select "properties", left click on "Java Compiler" and ensure that the Java Compiler is set to Compiler compliance level 5.0
- Click Window > Show View > Ant
- Drag and Drop build.xml from the 'openmrs' project into the Ant view
- In the Ant view (left pane), expand the 'openmrs' build file
- Double click on the install ant task (this may take a few minutes)
- Make sure your tomcat user has the roles manager,admin,tomcat
- NOTE: Subsequent re-installs can be done using the update Ant task.
- View your installation at http://localhost:${tomcat.port}/${webapp.name}/ (Default is http://localhost:8080/openmrs)
- For support on Windows XP/Vista/Eclipse integration, contact jim@manico.net
[edit]
Command Line (Windows XP)
- Open a Windows command line prompt
- Click Start Menu > Run
- Type 'cmd' at the Open prompt
- Press Ok
- Change directories to the openmrs project directory.
- Type 'ant install'
- Assumes that Ant has been added to your PATH (provide link to instructions)
[edit]
Command Line (Unix / Linux)
- Log into server
- Open a bash shell
