OMERO.server installation on CentOS 6 with Python 2.7 and Ice 3.5 ================================================================= This installation walkthrough should be read in conjunction with :doc:`server-installation` and :doc:`install-web`. 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 :download:`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 :file:`/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 :ref:`index-optimizing-server`. 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 :download:`settings.env `: .. literalinclude:: walkthrough/settings.env :start-after: Substitute 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: | :download:`step01_centos6_py27_ius_deps.sh ` Create an omero system user, and a directory for the OMERO repository: .. literalinclude:: walkthrough/step02_centos6_py27_ius_setup.sh | :download:`step02_centos6_py27_ius_setup.sh ` Create a database user and initialize a new database for OMERO: .. literalinclude:: walkthrough/step03_all_postgres.sh | :download:`step03_all_postgres.sh ` 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 :file:`bin` directory of the virtual environment :file:`/home/omero/omeroenv` to the ``PATH`` variable: .. literalinclude:: walkthrough/omero-centos6py27ius.env These settings will enable Python 2.7, and set the necessary environment variables for Ice 3.5 to work. For example, download :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" | :download:`step03_centos6_py27_ius_virtualenv_deps.sh ` 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. .. literalinclude:: walkthrough/step04_centos6_py27_ius_omero.sh 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 :doc:`install-web/install-nginx`. **The following steps are run as root.** Install Nginx, install the requirements to run OMERO.web in the virtual environment, deactivate it and copy the Nginx OMERO configuration file into the Nginx configuration directory, and disable the default configuration: .. literalinclude:: walkthrough/step05_centos6_py27_ius_nginx.sh | :download:`step05_centos6_py27_ius_nginx.sh ` Apache ^^^^^^ See also :doc:`install-web/install-apache`. As the **omero** system user, configure OMERO.web by running the following commands: .. literalinclude:: walkthrough/setup_omero_apache22.sh **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. Install Apache 2.2, install the requirements to run OMERO.web in the virtual environment, deactivate it and add the path to the virtual environment python to the ``python-path`` parameter of the ``WSGIDaemonProcess`` directive: .. literalinclude:: walkthrough/step05_centos6_py27_ius_apache22.sh | :download:`step05_centos6_py27_ius_apache22.sh ` .. note:: If you wish to use Apache 2.4 with mod_wsgi, see `omero-install `_ for a possible solution. | :download:`step05_centos6_py27_ius_apache24.sh ` 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: .. literalinclude:: walkthrough/step06_ubuntu1404_daemon.sh | :download:`step06_centos6_daemon.sh ` | :download:`omero-init.d ` | :download:`omero-web-init.d ` 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: .. literalinclude:: walkthrough/step07_all_perms.sh | :download:`step07_all_perms.sh ` 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: .. literalinclude:: walkthrough/omero-web-cron Copy this script into the appropriate location: .. literalinclude:: walkthrough/step08_all_cron.sh | :download:`omero-web-cron ` | :download:`step08_all_cron.sh ` .. _SElinux_centos6: 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: .. literalinclude:: walkthrough/setup_centos_selinux.sh | :download:`setup_centos6_selinux.sh ` 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