Skip to content

NanoLIMS v2.0 Full Manual Installation

cheinle edited this page Jan 16, 2017 · 6 revisions

#Table of Contents Note: Installation requires sudo user privileges

Install Apache MySQL and PHP

NanoLIMS tested using XAMPP on Windows 7 & 8 and LAMPP stack on CentOS release 6.6 (Final)

Development: XAMPP v3.2.1 - Apache 2.4.10, MySQL 5.6.20 (no STRICT_TRANS_TABLES mode), PHP 5.5.15 (with mysqli module), phpmyadmin 4.2.7.1
Production: LAMPP - Apache 2.2.15 , MySQL 5.5.43 (no STRICT_TRANS_TABLES mode), PHP 5.5.25 (with mysqli module), phpmyadmin 4.4.9

Instructions Assume the Following:

  • LAMPP stack is already installed and set-up **

  • Mail feature is set up in php configurations (used for password reset, project name approval requests, and user registration)

  • Php includes mysqli module and MYSQL does not use STRICT_TRANS_TABLES mode

  • User is responsible for appropriate mysql back-ups and db security

**for tutorial on installing LAMPP stacks for your specific OS, search for ‘install LAMP stack on [my os]’ in your web browser. Digital Ocean often has good step by step instructions

*[Ubuntu 16.04 LAMP Installation](https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-16-04)    

*[Ubuntu 14.04 LAMP Installation](https://www.digitalocean.com/community/tutorials/how-to-install-lamp-on-ubuntu-14-04-quickstart)

*[Centos 6 LAMP Installation](https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-centos-6)

Download Files From Github

Grab zip file of the NanoLIMS repository from Github
Open your web browser and go to https://github.com/cheinle/NanoLIMS

Click on the green ‘Clone or download’ button on the right hand side of the page and choose to ‘Download Zip’. You should now have a file called - ‘NanoLIMS-master.zip’. Move this file to an easily accessible place. For our example we will place on our desktop

Move zip file to remote server (if needed) and unzip file Open your terminal and go to the directory in which you stored your ‘NanoLIMS-master.zip’ (xterminal on mac or can download and use putty’s psftp @ http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html on windows

cd /Username/desktop/

*can use lcd if on psftp (lcd for local change directory)

Login using sftp to your remote server

sftp username@remote_hostname_or_IP

Change directories on your remote server to your document root directory

cd /path/to/my/document_root

This is the directory where your website files are stored. This can be different for different servers. If you are using CENTOS and are uncertain of your document root you can use the following command to find it:

grep -i 'DocumentRoot' /etc/httpd/conf/httpd.conf

If you are using a hosted service, please check their documentation for which folder is your hosted folder. For our example our document root will be the folder ‘/var/www/html’

Use the put command to move the ‘NanoLIMS-master.zip’ file from your local computer to the document root directory of your remote server

put NanoLIMS-master.zip

Unzip ‘NanoLIMS-master.zip’ and rename file to ‘NanoLIMS’

unzip NanoLIMS-master.zip
mv NanoLIMS-master NanoLIMS

Set paths for NanoLIMS by telling it where you put your nanolims folder (Optional)

If stored in a subdirectory of document root directory, set path to these files at the top of the page in variable $path_to_webroot in login.php near ‘Set Variable For Document Root Path’ and variable $logout_path in path.php. This will be the path from your document root directory to any subdirectory within it

cd nanolims vi login.php

If using vi editor, type 'i' to begin editing document. Change variable $path_in_webroot , save and exit using [esc] : wq [enter]

vi path.php

If using vi editor, type 'i' to begin editing document. Change variable $logout_path, save and exit using [esc] : wq [enter]

Separate ‘Important Accessories.zip’ from files and remove from webroot

Open nanolims directory (if not already inside)

Move ‘Important Accessories.zip’ out of webroot

Zip file contains four files:

  • database_schema.pdf
  • nanolims_empty.sql
  • nanolims_demo.sql
  • example_connection.php

sudo mv Important Accessories.zip ../../ Or Ex: > mv Important Accessories.zip /var/www/

Unzip

sudo unzip ../../Important Accessories.zip

Security - Where To Store Database Connection & Permissions *

Store connection to database in file above the document root folder so that it is not exposed to the web (Example of connection is in example_connection.php)

If you are in your document root folder, change directories to one directory level outside of the document root directory

cd ../
Ex: cd /var/www/

Then make a directory called nanolims_config

sudo mkdir nanolims_config

Make a file called connection.php and copy the contents of ‘example_connection.php’ (stored in the Important Accessories.zip file just unzipped) to it (we will edit this later). Do this by copying the 'example_connection.php' file from the Important Accessories directory into your nanolims_config folder

cd /var/www/Important Accessories/ sudo cp example_connection.php /var/www/nanolims_config/connection.php

Change back to nanolims_config folder

cd /var/www/nanolims_config/

Ensure read permissions for ‘other’ user on connection.php

sudo chmod o+r connection.php

Find the path to to connection.php and note it

pwd
Ex: < /var/www/nanolims_config/
So full path is /var/www/nanolims_config/connection.php

Change back to nanolims folder and edit ‘database_connection.php’

Ex: > cd /var/www/html/nanolims/

Replace ‘include('/my/connection/path/example_connection.php');’ to the path where your new connection.php is stored and save
Ex: include('/var/www/nanolims_config/connection.php');

Change owner of files for NanoLIMS writable files to apache's php user ('www-data' for Ubuntu and 'apache' for Centos)

sudo chown -R www-data:www-data [path to webroot]/NanoLIMS/sequencing/sequencing_form.xlsx
sudo chown -R www-data:www-data [path to webroot]/query_samples/nanolims_export.txt
sudo chown -R www-data:www-data [path to webroot]/query_samples/nanolims_user_created_export.txt
sudo chown -R www-data:www-data [path to webroot]/labels/nanolims_labels.txt

Upload Database Structure

DEMO:Import nanolims_demo.sql to MYSQL

Sign into your sql database from your ‘Important Accessories’ directory using either your mysql root user or an admin user with full privileges (now located one directory outside of document root Ex: /var/www/Important Accessories)

mysql -u [username] -p

Import nanolims_demo.sql file found in the ‘Important Accessories.zip’ file. A database named 'nanolims_demo'and a user named 'nanolims_test' (with SELECT, INSERT, UPDATE and DELETE privileges) will be created. Password for 'nanolims_test' user is set to 'nanolims_password123'. Please open nanolims_demo.sql and change password before importing (shown below). Note this password and username is what will be stored in the connection.php file

Change password

Run source command to import NanoLIMS

source nanolims_demo.sql;

Exit MySQL

exit

Update connection.php previously mentioned in ‘Security - Where To Store Database Connection & Permissions’ portion of the manual with your newly created user, password, and database name

$dbc=@mysqli_connect('localhost','nanolims_test','[password]','nanolims_demo') or die ('Could not connect to the database because:'.mysqli_connect_error());mysqli_query($dbc, "SET SESSION sql_mode = ''");

Go to http://[myipaddress]/[path from document root to nanolims folder]/NanoLIMS/login.php

Ex: http://localhost/NanoLIMS/login.php

Login page should now display

Continue onto Create Admin User portion of manual to login and view pre populated projects and samples

Live: Import nanolims_empty.sql to MYSQL

Sign into your sql database from your ‘Important Accessories’ directory using either your mysql root user or an admin user with full privileges (now located one directory outside of document root Ex: /var/www/Important Accessories)

mysql -u [username] -p

Import nanolims_empty.sql file found in the ‘Important Accessories.zip’ file. A database named 'nanolims_empty'and a user named 'nanolims' (with SELECT, INSERT, UPDATE and DELETE privileges) will be created. Password for 'nanolims' user is set to 'nanolims_password123'. Please open nanolims_empty.sql and change password before importing (shown below). Note this password and username is what will be stored in the connection.php file

Change password

Run source command to import NanoLIMS

source nanolims_empty.sql;

Exit MySQL

exit

Update connection.php previously mentioned in ‘Security - Where To Store Database Connection & Permissions’ portion of the manual with your newly created user, password, and database name

$dbc=@mysqli_connect('localhost','nanolims','[password]','nanolims_empty') or die ('Could not connect to the database because:'.mysqli_connect_error()); mysqli_query($dbc, "SET SESSION sql_mode = ''");

Go to http://[myipaddress]/[path from document root to nanolims folder]/NanoLIMS/login.php

Ex: http://localhost/NanoLIMS/login.php

Login page should now display

Disclaimer

All NanoLIMS users are responsible for their own data security. Please take any necessary extra precautions to reduce the inherent risk involved with database exposure to the internet such as SQLi and xxs attacks. NanoLIMS utilizes prepared statements and htmlspecialchars to help protect against these attacks. However, NanoLIMS has been created for a closed internet connection and has not been rigorously tested against these types of attacks Please backup all database information as needed