OMERO.server installation on CentOS 6 with Python 2.7 and Ice 3.6 ================================================================= 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.6 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:`walkthrough_centos6_py27.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. Ice 3.6 ^^^^^^^ With Ice 3.6, the Python bindings are provided separately. This allows to install the RPM packages provided by ZeroC for CentOS 6. Then run ``pip install zeroc-ice`` to install the Ice Python bindings if your package manager does not provide the Ice python packages. See `Using the Python Distribution `__ for further details. Installing prerequisites ------------------------ **The following steps are run as root.** Install Java 1.8, Ice 3.6 and PostgreSQL 9.4: To install Java 1.8 and other dependencies: .. literalinclude:: walkthrough/walkthrough_centos6_py27_ius.sh :start-after: #start-step01 :end-before: # install Ice To install Ice 3.6: .. literalinclude:: walkthrough/walkthrough_centos6_py27_ius.sh :start-after: #start-supported-ice :end-before: #end-supported-ice To install PostgreSQL 9.4: .. literalinclude:: walkthrough/walkthrough_centos6_py27_ius.sh :start-after: #end-supported-ice :end-before: #end-step01 The remaining dependencies will be installed in a virtual environment: .. literalinclude:: walkthrough/walkthrough_centos6_py27_ius.sh :start-after: #start-step01.1 :end-before: #end-step01.1 See :download:`requirements_centos6_py27_ius.txt ` Create an omero system user, and a directory for the OMERO repository: .. literalinclude:: walkthrough/walkthrough_centos6_py27_ius.sh :start-after: #start-step02 :end-before: #start-configuration-env Create a database user and initialize a new database for OMERO. As postgres who is the admin for a PostgreSQL installation, run: .. literalinclude:: walkthrough/walkthrough_centos6_py27_ius.sh :start-after: #start-step03 :end-before: #end-step03 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/walkthrough_centos6_py27_ius.sh :start-after: #start-configuration-env-ice36 :end-before: #end-configuration-env-ice36 These settings will enable Python 2.7, and set the necessary environment variables for Ice 3.6 to work. Install OMERO.server -------------------- **The following steps are run as the omero system user.** Download, unzip and configure OMERO. 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. You will need to install the server corresponding to your Ice version. Install ``server-ice36.zip``: .. literalinclude:: walkthrough/walkthrough_centos6_py27_ius.sh :start-after: #start-release-ice36 :end-before: #end-release-ice36 Configure: .. literalinclude:: walkthrough/walkthrough_centos6_py27_ius.sh :start-after: #end-release-ice36 :end-before: #end-step04 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 1.8, 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/walkthrough_centos6_py27_ius.sh :start-after: #start-nginx :end-before: #end-nginx Apache (deprecated) ^^^^^^^^^^^^^^^^^^^ See also :doc:`install-web/install-apache`. As the **omero** system user, configure OMERO.web by running the following commands: .. literalinclude:: walkthrough/walkthrough_centos6_py27_ius.sh :start-after: #start-configure-apache :end-before: #end-configure-apache **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/walkthrough_centos6_py27_ius.sh :start-after: #start-apache-install :end-before: #end-apache-install .. 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 If you deploy with Nginx, to start the OMERO.web client run:: OMERO.server/bin/omero web start The last command is **not** necessary if you deploy with Apache. 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/walkthrough_centos6_py27_ius.sh :start-after: #start-step06 :end-before: #end-step06 | :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/walkthrough_centos6_py27_ius.sh :start-after: #start-step07 :end-before: #end-step07 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/walkthrough_centos6_py27_ius.sh :start-after: #start-omeroweb-cron :end-before: #end-omeroweb-cron Copy the following commands into the appropriate location: .. literalinclude:: walkthrough/walkthrough_centos6_py27_ius.sh :start-after: #start-copy-omeroweb-cron :end-before: #end-copy-omeroweb-cron | :download:`omero-web-cron ` 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/walkthrough_centos6_py27_ius.sh :start-after: #start-selinux :end-before: #end-selinux 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