Skip to content
Sara Monzón edited this page Jan 10, 2020 · 25 revisions

Installation of Apache for CentOS

The last installation step for iSkyLIMS is to install Apache server

Use the YUM package manager, to install the Apache web server software

yum install httpd httpd-devel

(NOTE: httpd-devel is needed for python module 'mod_wgsi')

Installation of python mod-wsgi packet

cd /srv/iSkyLIMS
source virtualenv/bin/activate
pip install mod-wsgi 
deactivate

Edit Apache configuration "httpd.conf" file:

vim /etc/httpd/conf/httpd.conf

Add the following lines at the bottom of the LoadModule block:

## Load wsgi module with library associated in virtualenv
LoadModule wsgi_module "/srv/iSkyLIMS/virtualenv/lib/python3.6/site-packages/mod_wsgi/server/mod_wsgi-py36.cpython-36m-x86_64-linux-gnu.so"

Add the following lines at the end of the "httpd.conf" file:

## Django iSkyLIMS site configuration
# Socket prefix for socket file storage (permissions issues in Linux)
WSGISocketPrefix /var/run/wsgi
# Path to serve your app at and wsgi script path
WSGIScriptAlias / /srv/iSkyLIMS/iSkyLIMS/wsgi.py
# Path to virtualenv
WSGIPythonHome /srv/iSkyLIMS/virtualenv
# Ensures your project package is available for import on the Python Path.
WSGIPythonPath /srv/iSkyLIMS

# Directory piece. This ensures that apache can access wsgi.py script.
<Directory /srv/iSkyLIMS/iSkyLIMS>
        <Files wsgi.py>
                ## This lines work for Apache 2.2 version. For 2.4 this sintaxix changes.
                Satisfy Any
                Allow from all
        </Files>
</Directory>
    
# Lines for serving static files (This could be done with nginx instead of Apache)
Alias /static /srv/iSkyLIMS/static
<Directory /srv/iSkyLIMS/static>
## These lines are for Apache 2.2 version.
   Satisfy Any
   Allow from all
</Directory>
Alias /documents /srv/iSkyLIMS/documents
<Directory /srv/iSkyLIMS/documents>
   ## These lines are for Apache 2.2 version. 
   Satisfy Any
   Allow from all
</Directory>

Modify the umask for Apache

For CentOS

 echo "umask 002" >> /etc/init.d/httpd

Start the httpd server:

For CentOS

service httpd start

For Ubuntu:

service apache2 start

SELINUX disabled

selinux has to be disabled in your system. check that SELINUX is disabled on /etc/selinux/conf file.

Installation of Apache for Ubuntu

Install the Apache web server and wsgi software on ubuntu

sudo apt-get install apache2  libapache2-mod-wsgi-py3

Include these lines at /etc/apache2/sites-available/000-default.conf file, before < /VirtualHost >, like in the example below:

    Alias /static /srv/iSkyLIMS/static
    <Directory /srv/iSkyLIMS/static>
        Require all granted
    </Directory>

    <Directory /srv/iSkyLIMS/iSkyLIMS>
       <Files wsgi.py>
            Require all granted
       </Files>
    </Directory>
    WSGIDaemonProcess iSkyLIMS python-home=/srv/iSkyLIMS/virtualenv python-path=/srv/iSkyLIMS
    WSGIProcessGroup iSkyLIMS
    WSGIScriptAlias / /srv/iSkyLIMS/iSkyLIMS/wsgi.py

</VirtualHost>

Restart the apache service

 systemctl restart apache2

In Ubuntu you have to create two files:

First create iskilyms.load in /etc/apache2/mods-available

sudo vim /etc/apache2/mods-available/iskylims.load

Add this lines:

LoadModule wsgi_module "/srv/iSkyLIMS/virtualenv/lib/python3.6/site-packages/mod_wsgi/server/mod_wsgi-py36.cpython-36m-x86_64-linux-gnu.so"

Create file iskylims.conf

sudo vim /etc/apache2/mods-available/iskylims.conf

Add this lines:

# Socket prefix for socket file storage (permissions issues in Linux)
WSGISocketPrefix /var/run/wsgi
# Path to serve your app at and wsgi script path
WSGIScriptAlias / /srv/iSkyLIMS/iSkyLIMS/wsgi.py
# Path to virtualenv
WSGIPythonHome /srv/iSkyLIMS/virtualenv
# Ensures your project package is available for import on the Python Path.
WSGIPythonPath /srv/iSkyLIMS

Create needed symbolic links to enable the configurations:

sudo ln -s /etc/apache2/mods-available/iskylims.load /etc/apache2/mods-enabled/
sudo ln -s /etc/apache2/mods-available/iskylims.conf /etc/apache2/mods-enabled/

Build directory /srv/iSkyLIMS/static with all the required static contents

source virtualenv/bin/activate
./manage.py collectstatic

Apache Verification

After performing all configuration settings it is a nice time to check that your iSkyLIMS run correctly in your system.

To check it write http://localhost in your navigator.

The iSkyLIMS homepage will be displayed.

If you cannot see homepage, check the Apache log files to find out the problem.

Clone this wiki locally