Skip to content

Instantly share code, notes, and snippets.

@lucalianas
Last active December 23, 2015 17:59
Show Gist options
  • Save lucalianas/b74f563feedec2a80774 to your computer and use it in GitHub Desktop.
Save lucalianas/b74f563feedec2a80774 to your computer and use it in GitHub Desktop.
OMERO server and OMERO.biobank installation examples
#!/bin/bash
# This script can be used to install OMERO and OMERO.biobank on your
# local machine, make sure that the following software is installed
# before running the script:
#
# - Oracle Java JDK 6 or 7
# - PostgreSQL (server and client)
# - Ice 3.4 (Java and Python libraries at least and Ice services)
# - Python PIL, matplotlib, pytables and genshi
# - RabbitMQ
# - Neo4j
# - protobuf-compiler and make (for biobank's dependency biodoop-core)
# - pika version 0.9.12 (pip install pika==0.9.12)
# - bulbs (pip install bulbs)
# - voluptuous (pip install voluptuous)
OME_HOST="localhost"
OME_USER="root"
OME_PASS="omero"
# This presumes that both Neo4j and RabbitMQ are running on your
# localhost with default settings
NEO4J_URI="http://localhost:7474/db/data/"
RABBITMQ_HOST="localhost"
RABBITMQ_QUEUE="omero-biobank"
# DB config, these are the default values for OMERO server, if you are
# going to change these make sure to patch the
# $OMERO_SERVER_DIR/etc/omero.properties file as well
OME_DB_USER="omero"
OME_DB_PASS="omero"
OME_DB_NAME="omero"
OME_VERSION="v.4.4.8p1"
OME_DB_VERSION="OMERO4.4"
OME_DB_PATCH="0"
OME_DATA_DIR="${PWD}/omero/omero_data"
# Prepare the database, these instructions work if your database run
# on localhost
sudo -u postgres psql -c "CREATE USER $OME_DB_USER WITH PASSWORD '${OME_DB_PASS}';"
sudo -u postgres createdb -O $OME_DB_USER $OME_DB_NAME
# Checkout GIT repositores
git clone https://github.com/crs4/omero.biobank.git biobank
git clone --recursive git://github.com/openmicroscopy/openmicroscopy.git omero
cd ./omero
git checkout master
git reset --hard $OME_VERSION
git submodule update
# Deploy OMERO.biobank models
cp ../biobank/models/*.ome.xml ./components/model/resources/mappings/
# Setup OMERO server
mkdir $OME_DATA_DIR
## patch OMERO version
cd ../biobank
./utils/patch_ome_config --ome-home ../omero --models-repository ./models
## setup Neo4j and RabbitMQ
cd ../omero
echo "" >> etc/omero.properties
echo "omero.biobank.graph.engine=neo4j" >> etc/omero.properties
echo "omero.biobank.graph.uri=$NEO4J_URI" >> etc/omero.properties
echo "omero.biobank.messages_queue.enabled=True" >> etc/omero.properties
echo "omero.biobank.messages_queue.host=$RABBITMQ_HOST" >> etc/omero.properties
echo "omero.biobank.messages_queue.queue=$RABBITMQ_QUEUE" >> etc/omero.properties
## patch the build.py script in order to avoid JavaOutOfMemory
## expection when compiling models
patch ./build.py < ../biobank/.travis-data/build.py.patch
# Build OMERO
./build.py -quiet
./build.py -quiet build-schema -Domero.db.dialect=org.hibernate.dialect.PostgreSQLDialect
# Add python libraries to PYTHONPATH in order to use OMERO.cli
export PYTHONPATH="${PWD}/dist/lib/python:$PYTHONPATH"
./dist/bin/omero db script $OME_DB_VERSION $OME_DB_PATCH $OME_PASS
psql -h localhost -U $OME_DB_USER $OME_DB_NAME < ${OME_DB_VERSION}__${OME_DB_PATCH}.sql
./dist/bin/omero config set omero.data.dir $OME_DATA_DIR
# Start OMERO server (this is required in order to build
# OMERO.biobank's configuration)
./dist/bin/omero admin start
# Install OMERO.biobank dependency, biodoop-core
cd ..
git clone https://github.com/crs4/biodoop-core.git biodoop-core
cd ./biodoop-core
make
python setup.py install --user
# Install OMERO.biobank
cd ../biobank
# Sleep for ten seconds, just to be sure that OMERO server is fully
# initialized
sleep 10
python build_configuration.py -H $OME_HOST -U $OME_USER -P $OME_PASS --python
python setup.py install --user
# Stop the server, this is just an install script
cd ../omero
./dist/bin/omero admin stop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment