Installing eZ Find's Solr on CentOS 7

To set up Apache Solr -- the search platform that powers eZ Publish (through the eZ Find extension) and eZ Platform -- as a service on CentOS 7, you have at least two options. We’ll cover both: a manually created service for the new systemd as well as the older SystemV -- via the service script included with eZ Find.

What is systemd?

CentOS 7 features a new way of loading service scripts via systemd, which takes some getting used to for those coming from earlier versions of CentOS.

A very TLDR summary about systemd:“systemd is an init system used in Linux distributions to bootstrap the user space and manage all subsequent processes, instead of the UNIX System V or Berkeley Software Distribution (BSD) init systems. ... One of systemd's main goals is to unify basic Linux configurations and service behaviors across all distributions.” [1]

Since systemctl doesn't give you feedback by default, run a status check to see if the service is working as expected.

$ sudo systemctl status solr.service

If the service is working as expected, the service can be enabled to start at boot.

$ sudo systemctl enable solr.service

Breaking it down

The [Unit] section

The Description setting is used to describe the service as well as its functionality. Being specific here will help to identify the service and its function down the track.A number of systemd tools display this information.

The After setting defines the units that will be started before this unit. Units listed here are not dependencies. If dependencies are required, use the Requires or Wants settings.

The [Section] section

This section contains the service configuration. A service section should contain a Type setting, which controls how systemd handles this service.

If no Type or BusName setting are supplied, the service type defaults to ‘simple’, which means systemd considers the service to be started immediately. The main process of the service needs to be defined via ExecStart in that case.[4]

WorkingDirectory where the service's executable is located

PIDFile the service’s process id file location

User the user to run the service

ExecStart the command to run to start the service

ExecReload the command to run to reload the service

ExecStop the command to run to stop the service

PrivateTmp specifies the use of a private /tmp directory

The [Install] section

WantedBy specifies how the service unit should be enabled. The setting is not used by systemd at runtime, but when the service is enabled or disabled via systemctl.

A symlink is created in /etc/systemd/system/<wanted_by_value>.wants/<symlink_to_unit> creating a dependency so that the current units starts when the listed unit does.[5]

The systemd target multiuser.target is equivalent to the SystemV runlevels 2,3,4 (Set up a non-graphical multi-user system)[6]

SystemV service setup

While loading service scripts via systemd is new to CentOS 7, it still has legacy support for SystemV.

eZ Find includes service scripts for Debian, Gentoo, and RHEL out of the box.We will use the RHEL script, following the instructions found at the top of the file located in <ezp_root>/extensions/ezfind/bin/scripts/rhel/solr.sh