Page Contents

OMERO

Downloads
Feature List
Licensing

Previous topic

OMERO.server installation

Next topic

OMERO.server installation on CentOS 7

This Page

Note

This documentation is for the new OMERO 5.2 version. See the latest OMERO 5.1.x version or the previous versions page to find documentation for the OMERO version you are using if you have not upgraded yet.

OMERO.server installation on CentOS 6 with Python 2.7 and Ice 3.5

This installation walkthrough should be read in conjunction with OMERO.server installation and OMERO.web deployment.

Running OMERO on CentOS 6 has a number of special requirements which deviate from the standard installation instructions. The instructions below will set up Python 2.7 and Ice 3.5 on CentOS 6. We tested the installation with Python 2.7 from IUS and used a virtual environment to install the various dependencies required to install an OMERO.server. It is also possible to use SCL Python (for example install_centos6_py27_nginx.sh) but such solution could have potential side effects.

Setting up

Python 2.7

CentOS 6 provides Python 2.6. However, OMERO.web requires Python 2.7 in order to use Django 1.8. While Django 1.6 may be used with Python 2.6, this version of Django no longer has security support. In consequence, it is necessary to upgrade to Python 2.7 in order to obtain Django security updates, which are required for a production deployment.

The following steps are run as root.

Install:

yum install https://centos6.iuscommunity.org/ius-release.rpm
yum install python27

Note that epel-release will be pulled as a dependency.

To use the newly installed version of Python, it is preferrable to install the various dependencies required to run the OMERO.server in a virtual environment.

If virtualenv is not already installed, install it using pip:

yum install python27-pip
pip2.7 install virtualenv

Development packages

The following sections require a number of libraries and a compiler. Run the following commands to install them:

yum groupinstall "Development Tools"
# Python module dependencies
yum install python27-devel hdf5-devel freetype-devel libjpeg-devel libpng-devel

Ice 3.5

The RPM packages provided by ZeroC for CentOS 6 use the Python 2.6 provided by the system. OMERO will need an Ice build which uses Python 2.7. A version of Ice 3.5 built against Python 2.7 installed above is available at http://downloads.openmicroscopy.org/ice/experimental.

The following steps will install Ice into /opt:

# Download and install needed Ice build dependencies (db and mcpp)
curl -o /etc/yum.repos.d/zeroc-ice-el6.repo http://download.zeroc.com/Ice/3.5/el6/zeroc-ice-el6.repo
mkdir /tmp/ice-download
cd /tmp/ice-download
wget http://downloads.openmicroscopy.org/ice/experimental/Ice-3.5.1-b1-centos6-iuspy27-x86_64.tar.gz
yum install db53 db53-devel db53-utils mcpp-devel
tar -zxvf /tmp/ice-download/Ice-3.5.1-b1-centos6-iuspy27-x86_64.tar.gz
mv Ice-3.5.1-b1-centos6-iuspy27-x86_64 /opt/Ice-3.5.1
# make path to Ice globally accessible
# if globally set, there is no need to export LD_LIBRARY_PATH
echo /opt/Ice-3.5.1/lib64 > /etc/ld.so.conf.d/ice-x86_64.conf
ldconfig

Prerequisites

This is an example walkthrough for installing OMERO on CentOS 6 with Python 2.7 using a dedicated system user. You can use this as a guide for setting up your own test server. For production use you should also read the pages listed under Optimizing Server Configuration.

For convenience in this walkthrough the main OMERO configuration options have been defined as environment variables. When following this walkthrough you can either use your own values, or alternatively source the following file settings.env:

OMERO_DB_USER=db_user
OMERO_DB_PASS=db_password
OMERO_DB_NAME=omero_database
OMERO_ROOT_PASS=omero_root_password
OMERO_DATA_DIR=/OMERO

OMERO_WEB_PORT=80

export OMERO_DB_USER OMERO_DB_PASS OMERO_DB_NAME OMERO_ROOT_PASS OMERO_DATA_DIR OMERO_WEB_PORT

export PGPASSWORD="$OMERO_DB_PASS"

Once Python 2.7 and Ice 3.5 are installed,

Install Java:

yum install java-1.8.0-openjdk

Install PostgreSQL, reconfigure to allow TCP connections and start it:

yum install http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-redhat94-9.4-1.noarch.rpm
yum install postgresql94-server postgresql94-contrib
service postgresql-9.4 initdb
sed -i.bak -re 's/^(host.*)ident/\1md5/' /var/lib/pgsql/9.4/data/pg_hba.conf
chkconfig postgresql-9.4 on
service postgresql-9.4 start

For the steps described above, download:

Create an omero system user, and a directory for the OMERO repository:

#!/bin/bash

useradd -m omero
chmod a+X ~omero

mkdir -p "$OMERO_DATA_DIR"
chown omero "$OMERO_DATA_DIR"

Create a database user and initialize a new database for OMERO:

#!/bin/bash

source settings.env

echo "CREATE USER $OMERO_DB_USER PASSWORD '$OMERO_DB_PASS'" | \
    su - postgres -c psql
su - postgres -c "createdb -E UTF8 -O '$OMERO_DB_USER' '$OMERO_DB_NAME'"

psql -P pager=off -h localhost -U "$OMERO_DB_USER" -l

To install the remaining dependencies, create a virtual environment:

virtualenv -p /usr/bin/python2.7 /home/omero/omeroenv
source /home/omero/omeroenv/bin/activate
#upgrade pip
/home/omero/omeroenv/bin/pip install --upgrade pip

The following settings will need adding to your OMERO startup script or to the omero user’s environment (for example in a shell startup script). Add the absolute path to the bin directory of the virtual environment /home/omero/omeroenv to the PATH variable:

# Environment file for OMERO

ICE_HOME=/opt/Ice-3.5.1
export PATH="${ICE_HOME}/bin:/home/omero/omeroenv/bin:$PATH"
#Remove commented out export below if Ice is not set globally accessible
#export LD_LIBRARY_PATH="${ICE_HOME}/lib64:${ICE_HOME}/lib:$LD_LIBRARY_PATH"
export PYTHONPATH="${ICE_HOME}/python:$PYTHONPATH"
export SLICEPATH="${ICE_HOME}/slice"

These settings will enable Python 2.7, and set the necessary environment variables for Ice 3.5 to work. For example, download walkthrough/omero-centos6py27ius.env into /home/omero and run:

echo source /home/omero/omero-centos6py27ius.env >> /home/omero/.bashrc

Install additional Python modules in the virtual environment:

# Cap Pillow version due to a limitation in OMERO.figure
/home/omero/omeroenv/bin/pip2.7 install "Pillow<3.0"
/home/omero/omeroenv/bin/pip2.7 install numpy matplotlib

# Install Django
/home/omero/omeroenv/bin/pip2.7 install "Django>=1.8,<1.9"

Install OMERO.server

The following steps are run as the omero system user.

Download, unzip and configure OMERO, and create a configuration file for Nginx. The rest of this walkthrough assumes the OMERO.server is installed into the home directory of the omero system user.

Note that this script requires the same environment variables that were set earlier in settings.env, so you may need to copy and/or source this file as the omero user.

#!/bin/bash

set -e -u -x

source settings.env

SERVER=http://downloads.openmicroscopy.org/latest/omero5/server-ice35.zip

wget $SERVER
unzip -q server-ice35.zip
ln -s OMERO.server-*/ OMERO.server

OMERO.server/bin/omero config set omero.data.dir "$OMERO_DATA_DIR"
OMERO.server/bin/omero config set omero.db.name "$OMERO_DB_NAME"
OMERO.server/bin/omero config set omero.db.user "$OMERO_DB_USER"
OMERO.server/bin/omero config set omero.db.pass "$OMERO_DB_PASS"
OMERO.server/bin/omero db script -f OMERO.server/db.sql --password "$OMERO_ROOT_PASS"

psql -h localhost -U "$OMERO_DB_USER" "$OMERO_DB_NAME" < OMERO.server/db.sql

# This is the default in 5.2 so could be left unset
OMERO.server/bin/omero config set omero.web.application_server wsgi-tcp
OMERO.server/bin/omero web config nginx --http "$OMERO_WEB_PORT" > OMERO.server/nginx.conf.tmp

Installing a web server

To Deploy OMERO.web, you can use either Nginx or Apache. Follow the steps to install your chosen web server.

Nginx

See also OMERO.web Nginx and Gunicorn deployment (Unix/Linux).

The following steps are run as root.

To install Nginx run:

yum install nginx

In the virtual environment, install the requirements to run OMERO.web using the requirements file:

/home/omero/omeroenv/bin/pip2.7 install -r ~omero/OMERO.server/share/web/requirements-py27-nginx.txt

Deactivate the virtual environment:

deactivate

Copy the Nginx OMERO configuration file into the Nginx configuration directory, disable the default configuration and start Nginx:

mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.disabled
cp ~omero/OMERO.server/nginx.conf.tmp /etc/nginx/conf.d/omero-web.conf
service nginx start

Apache

See also OMERO.web Apache and mod_wsgi deployment (Unix/Linux).

As the omero system user, configure OMERO.web by running the following commands:

#!/bin/bash

set -e -u -x

source settings.env

OMERO.server/bin/omero config set omero.web.application_server wsgi
OMERO.server/bin/omero web config apache --http "$OMERO_WEB_PORT" > OMERO.server/apache.conf.tmp
OMERO.server/bin/omero web syncmedia

The following steps are run as root.

The version of Apache installed is 2.2, see the note below if you wish to use version 2.4.

To install Apache 2.2 run:

yum install httpd
# install mod_wsgi compiled against Python 2.7
yum install python27-mod_wsgi

In the virtual environment, install the requirements to run OMERO.web using the requirements file:

/home/omero/omeroenv/bin/pip2.7 install -r ~omero/OMERO.server/share/web/requirements-py27-apache.txt

Deactivate the virtual environment:

deactivate

Open the Apache OMERO configuration file i.e. omero/OMERO.server/apache.conf.tmp, and add the line below to the python-path parameter of the WSGIDaemonProcess directive:

/home/omero/omeroenv/lib64/python2.7/site-packages

Copy the Apache OMERO configuration file into the Apache configuration directory and start Apache:

cp ~omero/OMERO.server/apache.conf.tmp /etc/httpd/conf.d/omero-web.conf

chkconfig httpd on
service httpd start

Note

If you wish to use Apache 2.4 with mod_wsgi, see omero-install for a possible solution.

Running OMERO

The following steps are run as the omero system user.

OMERO should now be set up. To start the server run:

OMERO.server/bin/omero admin start

To start the OMERO.web client run:

OMERO.server/bin/omero web start

Nginx or Apache should already be running so you should be able to log in as the OMERO root user by going to http://localhost/ in your web browser. Please read the SELinux section below.

In addition some example init.d scripts are available should you wish to start OMERO and OMERO.web automatically:

#!/bin/bash

cp omero-init.d /etc/init.d/omero
chmod a+x /etc/init.d/omero

cp omero-web-init.d /etc/init.d/omero-web
chmod a+x /etc/init.d/omero-web

update-rc.d -f omero remove
update-rc.d -f omero defaults 98 02
update-rc.d -f omero-web remove
update-rc.d -f omero-web defaults 98 02

Securing OMERO

The following steps are run as root.

If multiple users have access to the machine running OMERO you should restrict access to OMERO.server’s configuration and runtime directories, and optionally the OMERO data directory:

#!/bin/bash

set -e -u -x

source settings.env

chmod go-rwx ~omero/OMERO.server/etc ~omero/OMERO.server/var

# Optionally restrict accesss to the OMERO data directory
#chmod go-rwx "$OMERO_DATA_DIR"

Regular tasks

The following steps are run as root.

The default OMERO.web session handler uses temporary files to store sessions which should be deleted at regular intervals, for instance by creating a cron job:

#!/bin/sh
OMERO_USER=omero
OMERO_SERVER=/home/omero/OMERO.server
su - ${OMERO_USER} -c "${OMERO_SERVER}/bin/omero web clearsessions"

Copy this script into the appropriate location:

#!/bin/bash

cp omero-web-cron /etc/cron.daily/omero-web
chmod a+x /etc/cron.daily/omero-web

SELinux

The following steps are run as root.

If you are running a system with SELinux enabled (it is enabled by default on CentOS 6) and are unable to access OMERO.web you may need to adjust the security policy:

#!/bin/bash

if [ $(getenforce) != Disabled ]; then
    yum -y install policycoreutils-python
    setsebool -P httpd_read_user_content 1
    setsebool -P httpd_enable_homedirs 1
    semanage port -a -t http_port_t -p tcp 4080
fi

Installing Web apps

The following steps are run as root.

It is possible to add Web applications to OMERO. If your app required some extra Python packages installed using pip, those packages should be also installed in the virtual environment. For example, OMERO.figure requires reportlab and markdown:

virtualenv -p /usr/bin/python2.7 /home/omero/omeroenv
source /home/omero/omeroenv/bin/activate
/home/omero/omeroenv/bin/pip2.7 install reportlab markdown