MyLabStocks: A web-application to manage molecular biology materials.
Table of Contents
Installation Instructions
This installation has been fully tested on:
- Ubuntu 18.04
Prerequisites
To install MyLabStocks, the following packages must be installed on your system :
- (openssh-server)
- apache2
- mysql-server 5.7
- php 7.2
- php-curl
- tomcat9
- ant
- tomcat9-admin
- csh
- ncbi-blast+
- git
On the targeted server, you can install these packages by typing the following command in a terminal :
sudo apt-get install apache2 mysql-server php7.2 php7.2-mysql curl php-curl tomcat9 ant csh git ncbi-blast+
You also need to give yourself the permissions to write in the application directory without using sudo all the time. You can do this by adding yourself to the 'www-data' group, so if your login name is 'fandefromage' type in a terminal:
sudo usermod -a -G www-data fandefromage
(Optional) Create Swap File
Some installation steps of MyLabStocks require large-size downloads. We sometimes experienced memory issues during installation, especially on virtual machines having less than 1Gb of allocated RAM memory. If your server has plenty of RAM, you can probably skip this step. If your server has little memory, you must follow this step in order to create a swap file that will be used to compensate for memory oversizing. If you are not sure, we recommend that you create this swap file just in case.
To create a 1Gb swap file on the hard drive of your server, type the following commands:
sudo fallocate -l 1G /var/swapfile
sudo chmod 600 /var/swapfile
sudo mkswap /var/swapfile
sudo swapon /var/swapfile
Database setup
MyLabStocks uses MySQL to store your data. For this, two things must be created in your MySQL server: a database and a user with administrative priviledges on this database. You therefor eneed to choose a username and password for this MySQL user.
To create the database and user, type the following commands in a terminal, after changing 'admin' and 'password' by the username and password you chose.
sudo mysql
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'password';
CREATE DATABASE labstocks_db CHARACTER SET utf8 COLLATE utf8_bin;
GRANT ALL PRIVILEGES ON labstocks_db.* TO 'admin'@'localhost' WITH GRANT OPTION;
exit
Optional Step (for developers or geeks): install and configure phpmyadmin
If you want to keep an eye on your database and verify if tables are correctly handled by MyLabStocks, you may want to use PhpMyAdmin.
To install PhpMyAdmin and configure it, type the following commands:
sudo apt-get install phpmyadmin
sudo vi /etc/apache2/sites-available/phpmyadmin.conf
Alias /phpmyadmin "/usr/share/phpmyadmin/"
<Directory "/usr/share/phpmyadmin/">
Order allow,deny
Allow from all
Require all granted
</Directory>
sudo a2ensite phpmyadmin.conf
sudo systemctl reload apache2
Verify phpMyAdmin installation by going to http://localhost/phpmyadmin
(username and password are those you used in the Database setup step above)
Install Composer.
MyLabStocks is built on Laravel, which is a powerful open-source PHP framework that facilitates the development and maintenance of applications. MyLabStocks also uses Voyager, which offers an administration backend for BREAD(CRUD) operations, media management, menu builder, and much more.
MyLabStocks therefore uses several PHP packages that have a number of dependencies. Composer will install these packages and all dependencies for you. It will also allow you to update these depencencies safely.
We first need to install general PHP libraries. On the targeted server type the following commands in a terminal :
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install libapache2-mod-php7.2 php7.2-xml php7.2-gd php7.2-opcache php7.2-mbstring
We now need to install Composer. To install Composer, type the following commands.
cd /tmp
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
Create your MyLabStocks instance
You need to retrieve the source code of MyLabStocks and place its directory in the web server. To do so, type the following command in a terminal.
cd /var/www/
sudo mkdir mylabstocks
sudo chgrp www-data mylabstocks/
sudo chmod 775 mylabstocks/
git clone https://gitbio.ens-lyon.fr/sjanczar/mylabstocks2.git mylabstocks
sudo chgrp -R www-data mylabstocks/
sudo chmod -R 775 mylabstocks/
cd mylabstocks
cp .env.example .env
sudo chgrp www-data .env
sudo chmod 770 .env
Now edit the .env file to enable appropriate connections. Look for the following lines, and replace the 'admin' and 'password' by the values that you entered when setting up the MySQL database. Also replace 'your.server.url' by what it really is, for example its IP address.
APP_URL=http://your.server.url/mylabstocks
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=labstocks_db
DB_USERNAME=admin
DB_PASSWORD=password
You can now run composer to install all dependencies of MyLabStocks, and install the application itself.
cd /var/www/mylabstocks
composer install
php artisan voyager:install
sudo chmod -R 775 storage/logs/
./restorebreadmenus.sh
We have now to create a new admin user for MyLabStocks. To do this, type the following commands in the terminal :
php artisan voyager:admin --create
And you will be prompted to enter for the user name and password that you want to use for this admin account, as well as its contact email.
Configure your Apache server
MyLabStocks is now installed but you must tell your web server Apache to access it. For this, type the following commands:
echo "Alias /mylabstocks /var/www/mylabstocks/public/" > /tmp/lab.conf
echo "<Directory /var/www/mylabstocks>" >> /tmp/lab.conf
echo "AllowOverride All" >> /tmp/lab.conf
echo "</Directory>" >> /tmp/lab.conf
sudo cp /tmp/lab.conf /etc/apache2/sites-available/mylabstocks.conf
sudo a2ensite mylabstocks.conf
sudo a2enmod rewrite
sudo service apache2 restart
Install PlasMapper
PlasMapper provides advanced plasmid visualisation features. We use it to dynamically produce annotated plasmid maps directly from the plasmid's sequence.
To install plasMapper, please follow the dedicated documentation.