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. 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.
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 -O '$OMERO_DB_USER' '$OMERO_DB_NAME'"
# If you are using PostgreSQL 8.4 you must run:
#su - postgres -c "createlang plpgsql '$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/omero/5.0.5/artifacts/OMERO.server-5.0.5-ice35-b47.zip
wget $SERVER
unzip -q `basename $SERVER`
ln -s `basename "${SERVER%.zip}"` 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 "" "" "$OMERO_ROOT_PASS"
psql -h localhost -U "$OMERO_DB_USER" "$OMERO_DB_NAME" < OMERO.server/db.sql
OMERO.server/bin/omero web config nginx --system --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