Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

This tutorial is designed for users who are not so familiar with Linux, but need to have a platform to practice installing OpenMRS on such a system, and a general introduction to building a Ubuntu server.

Introduction

Ubuntu is a distribution of the Linux operating system which is relatively easy to use and well supported, and thus is a common choice for sites that require a dedicated OpenMRS server. Conveniently the Ubuntu Server Edition installation CD includes MySQL and Apache Tomcat.

For users who are unfamiliar with Linux it can be very useful to practice setting up both the operating system and OpenMRS on a virtual machine. Sun's VirtualBox software is flexible virtualization software package which can be installed on Windows, Linux, OS/X or Solaris. With regard to virtual machines, the term host refers to the system (usually physical) which is running the virtual machine, and guest refers to the system being run within the virtual machine. VirtualBox allows users to run Linux guests on Windows hosts, or vice versa.

Requirements

Creating the virtual machine

  1. In VirtualBox, click on New to start the New Virtual Machine Wizard, and then press Next.
  2. Give the new machine a name, and specify the type of operating system (Linux), and the version (Ubuntu).
  3. Use the default base memory size value value of 512MB.
  4. Select Create new disk and press Next to start the Create New Virtual Disk Wizard.
  5. Select Dynamically expanding storage.
  6. Specify a suitable path for Location, and use the default size of 8.00GB.
  7. Press Finish to complete that wizard, and Finish again to complete the previous wizard.
  8. Right-click on the machine and goto Settings... > System > Processor and select "Enable PAE/NX". This is required for the Ubuntu server kernel.

Installing Ubuntu Server Edition

  1. Start the virtual machine, and assuming this is the first time it has been started, you will see the First Run Wizard:
    1. Under Media Source select Image File.
    2. Click the folder icon beside the image list to open the Virtual Media Manager.
    3. Select Add from the top menu, and browse to the Ubuntu Server ISO (e.g. ubuntu-11.04-server-i386.iso).

...

    1. Double-click

...

    1. the

...

    1. ISO

...

    1. file

...

    1. in

...

    1. the

...

    1. list

...

    1. to

...

    1. select

...

    1. it

...

    1. and

...

    1. close

...

    1. the

...

    1. wizard.

...

  1. Press

...

  1. Finish

...

  1. and

...

  1. the

...

  1. virtual

...

  1. machine

...

  1. will

...

  1. boot

...

  1. from

...

  1. the

...

  1. installation

...

  1. CD.

...

  1. Select

...

  1. your

...

  1. language

...

  1. by

...

  1. using

...

  1. the

...

  1. arrow

...

  1. keys

...

  1. and

...

  1. then

...

  1. the

...

  1. enter

...

  1. key

...

  1. (this

...

  1. is

...

  1. only

...

  1. used

...

  1. for

...

  1. the

...

  1. initial

...

  1. menu).

...

  1. Select

...

  1. Install

...

  1. Ubuntu

...

  1. Server.

...

  1. Select

...

  1. the

...

  1. language

...

  1. for

...

  1. the

...

  1. installation.

...

  1. Select

...

  1. your

...

  1. location.

...

  1. If

...

  1. you

...

  1. know

...

  1. your

...

  1. keyboard

...

  1. layout

...

  1. (most

...

  1. likely

...

  1. USA)

...

  1. skip

...

  1. auto-detection

...

  1. and

...

  1. select

...

  1. it

...

  1. from

...

  1. the

...

  1. list.

...

  1. The

...

  1. installer

...

  1. will

...

  1. try

...

  1. to

...

  1. automatically

...

  1. configure

...

  1. the

...

  1. networking

...

  1. settings,

...

  1. if

...

  1. you

...

  1. have

...

  1. disabled

...

  1. network

...

  1. access

...

  1. then

...

  1. this

...

  1. will

...

  1. fail.

...

  1. If

...

  1. so,

...

  1. select

...

  1. Do

...

  1. not

...

  1. configure

...

  1. networking

...

  1. at

...

  1. this

...

  1. time.

...

  1. Enter

...

  1. a

...

  1. suitable

...

  1. hostname.

...

  1. Next

...

  1. the

...

  1. partitioner

...

  1. dialog

...

  1. will

...

  1. be

...

  1. displayed.

...

  1. Linux

...

  1. operating

...

  1. systems

...

  1. require

...

  1. separate

...

  1. partition

...

  1. for

...

  1. swap

...

  1. space,

...

  1. but

...

  1. the

...

  1. installer

...

  1. can

...

  1. configure

...

  1. this

...

  1. for

...

  1. you:

...

    1. Select

...

    1. "Guided

...

    1. -

...

    1. use

...

    1. entire

...

    1. disk"

...

    1. to

...

    1. use

...

    1. the

...

    1. entire

...

    1. virtual

...

    1. hard

...

    1. disk

...

    1. for

...

    1. Ubuntu.

...

    1. Select

...

    1. SCSI1

...

    1. (0,0,0)

...

    1. (sda)

...

    1. -

...

    1. 8.6GB

...

    1. ATA

...

    1. VBOX

...

    1. HARDDISK.

...

    1. Select

...

    1. Yes

...

    1. for

...

    1. Write

...

    1. changes

...

    1. to

...

    1. disk

...

    1. to

...

    1. finish

...

    1. the

...

    1. partitioning

...

    1. task.

...

  1. Provide

...

  1. a

...

  1. user

...

  1. name,

...

  1. and

...

  1. password

...

  1. for

...

  1. the

...

  1. administrator

...

  1. account.

...

  1. Allow

...

  1. installer

...

  1. to

...

  1. update

...

  1. list

...

  1. of

...

  1. packages,

...

  1. or

...

  1. cancel

...

  1. to

...

  1. update

...

  1. later

...

  1. Choose

...

  1. an

...

  1. update

...

  1. management

...

  1. strategy

...

  1. Using

...

  1. the

...

  1. arrow

...

  1. keys

...

  1. and

...

  1. spacebar,

...

  1. select

...

  1. LAMP

...

  1. Server,

...

  1. OpenSSH

...

  1. Server

...

  1. and

...

  1. Tomcat

...

  1. Java

...

  1. Server.

...

  1. Provide

...

  1. a

...

  1. root

...

  1. password

...

  1. for

...

  1. MySQL

...

  1. which

...

  1. you

...

  1. will

...

  1. need

...

  1. later.

...

  1. The

...

  1. installer

...

  1. will

...

  1. finish

...

  1. by

...

  1. rebooting

...

  1. into

...

  1. Ubuntu.

...

  1. If

...

  1. you

...

  1. mounted

...

  1. the

...

  1. installation

...

  1. ISO

...

  1. yourself,

...

  1. then

...

  1. you

...

  1. should

...

  1. unmount

...

  1. it

...

  1. (see

...

  1. the

...

  1. Devices

...

  1. menu)

...

  1. to

...

  1. avoid

...

  1. re-running

...

  1. the

...

  1. installer.

...

Configuring

...

Apache

...

Tomcat

For this step and some subsequent steps we need to edit files on the guest. If you are familiar with editors such as vi or vim you can use one of them, but if not then

is recommended as it easy to use and already installed. The sudo command causes the command following it to be run as root.

  1. Login and type:
    Code Block
    sudo nano /etc/tomcat6/tomcat-users.xml
    

...

  1. Create a user with the manager and admin roles. Don't

...

  1. forget

...

  1. to

...

  1. remove

...

  1. the

...

  1. XML

...

  1. comments

...

  1. (<

...

  1. !-

...

  1. -

...

  1. >),

...

  1. so

...

  1. the

...

  1. result

...

  1. should

...

  1. look

...

  1. like:

...

  1. Code Block

...

  1. 
    <tomcat-users>
      <user username="admin" password="XXXXXX" roles="admin,manager"/>
    </tomcat-users>
    

...

  1. Save (Ctrl+O)

...

  1. and

...

  1. exit

...

  1. (Ctrl+X).

...

  1. Restart

...

  1. Tomcat

...

  1. using

...

  1. the

...

  1. initialization

...

  1. script:

...

  1. Code Block

...

  1. 
    sudo /etc/init.d/tomcat6 restart
    

...

Configuring Port Forwarding to the Guest

VirtualBox's

...

NAT

...

option

...

allows

...

network

...

requests

...

to

...

the

...

host

...

to

...

be

...

forwarded

...

to

...

the

...

guest,

...

which

...

means

...

other

...

computers

...

can

...

access

...

services

...

such

...

as

...

Tomcat

...

which

...

are

...

running

...

on

...

the

...

guest,

...

as

...

if

...

they

...

were

...

running

...

on

...

the

...

host.

...

This

...

step

...

forwards

...

requests

...

on

...

port

...

8090

...

on

...

the

...

host,

...

to

...

port

...

8080

...

on

...

the

...

guest,

...

which

...

is

...

Tomcat's

...

default

...

port.

...

  1. Shutdown

...

  1. the

...

  1. virtual

...

  1. machine

...

  1. if

...

  1. it

...

  1. is

...

  1. still

...

  1. running

...

  1. Code Block

...

  1. 
    sudo shutdown -h 0
    

...

  1. Right-click

...

  1. on

...

  1. the

...

  1. machine

...

  1. and

...

  1. goto

...

  1. Settings...

...

  1. >

...

  1. Network

...

  1. >

...

  1. Port

...

  1. Forwarding

...

    1. Add

...

    1. a

...

    1. new

...

    1. rule

...

      1. Name:

...

      1. Tomcat

...

      1. Protocol:

...

      1. TCP

...

      1. Host

...

      1. port:

...

      1. 8090

...

      1. Guest

...

      1. port:

...

      1. 8080

...

  1. Restart

...

  1. the

...

  1. virtual

...

  1. machine.

...

  1. On

...

  1. the

...

  1. host,

...

  1. browse

...

  1. to

...

  1. http://localhost:8090

...

  1. to

...

  1. verify

...

  1. that

...

  1. the

...

  1. port

...

  1. is

...

  1. being

...

  1. forwarded

...

  1. correctly

...

Install

...

OpenMRS

...

  1. On

...

  1. the

...

  1. guest

...

  1. machine,

...

  1. type

...

  1. the

...

  1. following

...

  1. to

...

  1. create

...

  1. the

...

  1. OpenMRS

...

  1. runtime

...

  1. directory:

...

  1. Code Block

...

  1. 
    sudo mkdir /usr/share/tomcat6/.OpenMRS
    sudo chown -R tomcat6:root /usr/share/tomcat6/.OpenMRS
    

...

  1. On the host,

...

  1. browse

...

  1. to

...

  1. http://localhost:8090/manager/html

...

  1. to

...

  1. access

...

  1. the

...

  1. Tomcat

...

  1. Managment

...

  1. webapp.

...

  1. Under

...

  1. the

...

  1. heading

...

  1. Deploy

...

  1. >

...

  1. WAR

...

  1. file

...

  1. to

...

  1. deploy,

...

  1. browse

...

  1. to

...

  1. the

...

  1. OpenMRS

...

  1. WAR

...

  1. file,

...

  1. and

...

  1. then

...

  1. press

...

  1. "Deploy".

...

  1. Tomcat

...

  1. should

...

  1. report

...

  1. that

...

  1. the

...

  1. deployment

...

  1. succeeded.

...

  1. Browse

...

  1. to

...

  1. http://localhost:8090/openmrs/

...

  1. to

...

  1. begin

...

  1. the

...

  1. step-by-step

...

  1. installation

...

  1. of

...

  1. OpenMRS.

...

    1. Step

...

    1. 1:

...

    1. Select

...

    1. No

...

    1. under

...

    1. Do

...

    1. you

...

    1. currently

...

    1. have

...

    1. an

...

    1. OpenMRS

...

    1. database...

...

    1. and

...

    1. then

...

    1. enter

...

    1. the

...

    1. MySQL

...

    1. root

...

    1. password.

...

    1. Press

...

    1. Continue.

...

    1. Step

...

    1. 2:

...

      1. Select

...

      1. Yes

...

      1. under

...

      1. Do

...

      1. you

...

      1. want

...

      1. to

...

      1. add

...

      1. demo

...

      1. data...

...

      1. (assuming

...

      1. you

...

      1. want

...

      1. common

...

      1. concepts

...

      1. and

...

      1. some

...

      1. sample

...

      1. patients)

...

      1. Select

...

      1. No

...

      1. under

...

      1. Do

...

      1. you

...

      1. currently

...

      1. have

...

      1. a

...

      1. database

...

      1. user...

...

      1. and

...

      1. again

...

      1. enter

...

      1. the

...

      1. MySQL

...

      1. root

...

      1. password.

...

      1. Press

...

      1. Continue.

...

    1. Step

...

    1. 3:

...

    1. Leave

...

    1. default

...

    1. values,

...

    1. and

...

    1. press

...

    1. Continue.

...

    1. Step

...

    1. 4:

...

    1. Specify

...

    1. a

...

    1. suitable

...

    1. admin

...

    1. password,

...

    1. and

...

    1. press

...

    1. Continue.

...

    1. Step

...

    1. 5:

...

    1. Leave

...

    1. values

...

    1. blank,

...

    1. and

...

    1. press

...

    1. Continue.

...

    1. Step

...

    1. 6:

...

    1. Press

...

    1. Finish

...

    1. to

...

    1. start

...

    1. the

...

    1. OpenMRS

...

    1. installation

...

    1. process,

...

    1. which

...

    1. will

...

    1. take

...

    1. a

...

    1. few

...

    1. minutes.

...

Conclusion

You should now have a working OpenMRS server, which being a virtual machine, can be paused and resumed whenever it is needed. Additional tasks that you might want to try are:

  • Configure port forwarding to the guest on port 22 to allow SSH connections to the guest system:
    1. Shutdown the machine
    2. Goto Settings... > Network > Port Forwarding
    3. Add a new rule to map the host port 2222 to the guest port 22
    4. Try connecting from host
      Code Block
      
      ssh localhost -p 2222
      

...