Ubuntu Server Installation

From OpenEMR Project Wiki
Revision as of 17:21, 4 November 2011 by Bradymiller (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

March 3, 2009

Choose Ubuntu Server Edition version 8.04 (LTS) if you want long term support updates and more recent versions such as 8.10 if you are not as much interested in long term stability and long term support.

Ubuntu Server Edition allows a very simple procedure for installing the environment suitable for installing OpenEMR. Most, if not all, of the necessary functionality is automatically installed during installation of the operating system. One can download the installation CD from http://www.ubuntu.com and follow the installation instructions after booting from CD. Installation is straightforward, but you will want to choose to install the following options when prompted to do so:

openssh

LAMP server

Once you install the server edition, you will be able to log in as a non-privileged user on the command prompt. By default, root cannot log in until assigned a non-blank password. A password can be assigned for root by typing

sudo passwd

Alternatively, you can keep the root user locked up (i.e. without a password) and preface each of the privileged commands below by "sudo" as the non-privileged user. While that approach is a nuisance, it is probably a bit more secure.

At this point I updated the system by typing, as root (or by using sudo):

apt-get update

apt-get upgrade

Then I added a simple text editor and cvs by doing this:

apt-get install jed

apt-get install cvs

Next, cd into the /var/www directory and use jed, nano or other text editor to create a file named test.php with this content:

{?php

phpinfo();

?}

HOWEVER, the braces {} should be replaced with the less than and greater than sign in your file. For some reason, they do not display properly on the wiki.

Figure out the IP address of your server, perhaps by typing ifconfig, and use a browser on another computer to direct to that IP address as below:


http://XXX.XXX.XXX.XXX

where the Xs represent the IP address of your server.

If the web server is working right, you should see a display

It works!

Next, direct the browser to the test.php file thus:

http://XXX.XXX.XXX.XXX/test.php

If PHP is working, you will see a long display of system configuration information. You can configure a static IP address rather than the default dhcp by making appropriate entries into the /etc/networks/interface file.

At this point you can refer to the instructions for installing OpenEMR elsewhere on this wiki. However, to download the current cvs version, you may proceed as below:

Now, back at the server command prompt, as root (or with sudo command) cd to /var/www again. Then

cvs -d:pserver:anonymous@openemr.cvs.sourceforge.net:/cvsroot/openemr co -P openemr

This will download the latest development version of the OpenEMR system.

It is important to remember the following defaults for Ubuntu:

web server directory: /var/www/

apache user name: www-data

apache group name: www-data

Therefore, the directory and files in /var/www/openemr directory should have ownership www-data.www-data.

For example you can type:

cd /var/www

chown www-data.www-data openemr -Rf

At this point, you can proceed to the instructions for tweaking the apache2 configuration file and configuring OpenEMR.

Here are the instructions for enabling a secure (i.e. ssl) Apache server if you need that:

Installation of SSL:

Create a home-made certificate.

openssl req $@ -new -x509 -days 365 -nodes -out /etc/apache2/apache.pem -keyout /etc/apache2/apache.pem

This should be on one line. None of the hyphens on this expression should be followed by a space. Refer to outside instructions on how to create and install a fully authenticated certificate.

Type this:

cd /etc/apache2/sites-available/

cp 000-default ssl -a

ln -s /etc/apache2/sites-available/ssl /etc/apache2/sites-enabled/

Now here are instructions contributed by Rod Roark and okhra on how to configure virtual hosts for ports 80 and 443:

( I replaced any of the less than or greater than signs with { and } so they would show up on this WIKI -- please be aware of that.)

File /etc/apache2/ports.conf should contain only this the following lines.

Listen 443

Listen 80

Remove anything else.

edit file /etc/apache2/sites-enabled/ssl as follows:

a) select (i.e. copy) the whole file and paste it to the end of the file. This will allow two sections for configuring two virtual hosts.

b) add this line to the beginning:

NameVirtualHost *:80

c) The next line should be : {VirtualHost *:80}

d) Do the same in the second section but use *:443 instead of *:80 in the two corresponding places.

i.e.

NameVirtualHost *:443

VirtualHost *:443

e) add the lines:

SSLEngine on

SSLCertificateFile /etc/apache2/apache.pem

within the body of {VirtualHost *:443} {/VirtualHost}

Then

chmod 600 /etc/apache2/apache.pem

I activated two necessary modules by creating two symbolic links thus:

ln -s /etc/apache2/mods-available/ssl.conf /etc/apache2/mods-enabled/

ln -s /etc/apache2/mods-available/ssl.load /etc/apache2/mods-enabled/

Then restart apache by typing

/etc/init.d/apache2 restart

Now to test openemr, you can direct your browser to

https://localhost/openemr:443

You will want to firewall connections to port 80 one way or another to outside connections.


Author:
Dorothy Leemhuis