This file contains instructions for installing a new instance.
Ubuntu 14.04 LTS is officially supported.
Everything as root(sudo):
tasksel
Individual packages Use the Advanced Package Tool to install the required packages.
apt-get install \ git \ libapache2-mod-wsgi \ libapache2-mod-jk \ python-cjson \ python-django \ python-django-piston \ python-django-extra-views \ python-mysqldb \ python-libxml2 \ python-lxml \ python-django-extensions \ python-imaging \ sqlite3 \ javascript-common \ libjs-jquery-ui \ libjs-jquery-timepicker
****
Open a MySQL prompt.
mysql -u root -p CREATE DATABASE mds; CREATE USER ‘mds’@’localhost’ IDENTIFIED BY ‘**’; GRANT ALL ON mds.* TO ‘mds’@’localhost’; exit;
MDS source code
mkdir ~/git cd ~/git git clone https://github.com/SanaMobile/sana.mds.git
Link or copy the mds source into the sana directories
ln -s /home/<user>/git/sana.mds/src/mds /opt/sana/sana.mds/mds cp -r /home/<user>/git/sana.mds/src/mds /opt/sana/sana.mds cp /home/<user>/git/sana.mds/src/manage.py /opt/sana/sana.mds
Note: Linking is preferable to keep any files cached at runtime out of the source directories.
Install and set up the mds code
cp /opt/sana/sana.mds/mds/settings.py.tmpl /opt/sana/sana.mds/mds/settings.py cp /opt/sana/sana.mds/mds/local_settings.py.tmpl /opt/sana/sana.mds/mds/local_settings.py
Adjust any values in settings.py to match the local system. Should just be the database config.
cd /opt/sana/sana.mds python manage.py syncdb python manage.py collectstatic
Link the contents of /opt/sana/sana.mds/mds/ to your apache document root. The default for Ubuntu is /var/www/html, e.g.
/var/www/html
ln -sf /opt/sana/sana.mds/mds /var/www/html/mds
Directory Permissions. Update directory permissions for the mds files
chown -R www-data:www-data /opt/sana/sana.mds
Set mds environment variables
echo ‘export MDS_DIR=/opt/sana/sana.mds’ » /etc/apache2/envvars
Copy the mds.conf file from the source into the apache conf-available directory and enable.
conf-available
cp /home//git/sana.mds/include/mds/apache2/conf-available/* \ /etc/apache2/conf-available
Add option to follow symlinks for the server root directive in your apache config, example:
<Directory /var/www/html> Options FollowSymLinks Require all granted </Directory>
Enable mds conf
a2enconf mds
Enable wsgi module
a2enmod wsgi
Set up encryption. (https://help.ubuntu.com/14.04/serverguide/certificates-and-security.html) This is not absolutely required for development servers. The following is a quick start for generating your own certificate.
Create your own certificate and key
openssl genrsa -des3 -out server.key 1024 openssl rsa -in server.key -out server.key.insecure openssl req -new -key server.key -out server.csr openssl x509 -req -days 365 -in server.csr -signkey server.key.insecure -out server.crt
You will be prompted for some information. Type in country, state, city, org, common name. You can skip challenge password and company name)
Copy the cert and key
cp server.crt /etc/ssl/certs cp server.key /etc/ssl/private
Restart Apache and check connection:
service apache2 restart
You should now be able to access:
http://<hostname>/mds/ https://<hostname>/mds/
Ignore the following steps if running MDS in standalone mode.
Verify that the following line is in your /etc/tomcat7/server.xml file, uncomment if necessary.
<Connector port="8009" URIEncoding="UTF-8" enableLookups="false" protocol="AJP/1.3" />
A sample server.xml is available in the mds includes directory. Create OpenMRS installation directory
mkdir /usr/share/tomcat7/.OpenMRS chown tomcat7:tomcat7 /usr/share/tomcat7/.OpenMRS
e. Restart tomcat. service tomcat7 restart
Enable apache modules and and openmrs conf
a2enmod jk a2enmod proxy a2enmod proxy_http a2enmod proxy_ajp a2enconf openmrs
Note: Step (b) will provide access to OpenMRS through http:///openmrs
c.
Download
http://openmrs.org/download/
Follow installation instructions:
https://wiki.openmrs.org/display/docs/Installing+OpenMRS