This is an example walkthrough for installing OMERO on Linux with Nginx, using a dedicated system user, and should be read in conjunction with OMERO.server installation and OMERO.web deployment. 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.
Example shell scripts for installing OMERO on Ubuntu 14.04 are included in-line, and can be downloaded. Separate instructions for installing on CentOS 6 are also available where this differs from the Ubuntu instructions. These instructions assume your Linux distribution is configured with a UTF-8 locale (this is normally the default).
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:
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"
As root install Ice, Java, Postgres:
#!/bin/bash
apt-get update
apt-get -y install \
unzip \
wget \
python-{imaging,matplotlib,numpy,pip,scipy,tables,virtualenv} \
openjdk-7-jre-headless \
ice-services python-zeroc-ice \
postgresql
service postgresql start
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
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
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 this 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.1/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
OMERO.server/bin/omero web config nginx --http "$OMERO_WEB_PORT" > OMERO.server/nginx.conf.tmp
As root install Nginx, copy the Nginx OMERO configuration file into the Nginx configuration directory, and disable the default configuration:
#!/bin/bash
apt-get -y install nginx
# See setup_omero*.sh for the nginx config file creation
cp ~omero/OMERO.server/nginx.conf.tmp /etc/nginx/sites-available/omero-web
rm /etc/nginx/sites-enabled/default
ln -s /etc/nginx/sites-available/omero-web /etc/nginx/sites-enabled/
service nginx start
OMERO should now be set up. To start the server log in as the omero system user, and run:
OMERO.server/bin/omero admin start
To start the OMERO.web client run:
OMERO.server/bin/omero web start
Nginx 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.
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
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"
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
If you are running a system with SELinux enabled (for example, it is enabled by default on CentOS6) 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