+0.12 Thu Aug 4 20:09:38 UTC 2016
+ - Add support for Solr 6.X, create masterkey-lui-solr6 package
+ (SOLR-26)
+
0.11 Fri Jul 29 17:28:07 UTC 2016
- Remove legacy scripts.conf file from configuration
- Reorganize configuration file layout to accomodate future HA configuration files
NAME=masterkey-lui-solr
-VERSION=0.11
+VERSION=0.12
DEBIAN_DIST="jessie wheezy"
UBUNTU_DIST=""
And to install LUI Solr:
$ cd ..
$ sudo dpkg -i masterkey-lui-solr5_*.indexdata_all.deb
+ OR
+$ sudo dpkg -i masterkey-lui-solr6_*.indexdata_all.deb
#SOLR_AUTHENTICATION_CLIENT_CONFIGURER=
#SOLR_AUTHENTICATION_OPTS=
+# Settings for ZK ACL
+#SOLR_ZK_CREDS_AND_ACLS="-DzkACLProvider=org.apache.solr.common.cloud.VMParamsAllAndReadonlyDigestZkACLProvider \
+# -DzkCredentialsProvider=org.apache.solr.common.cloud.VMParamsSingleSetCredentialsDigestZkCredentialsProvider \
+# -DzkDigestUsername=admin-user -DzkDigestPassword=CHANGEME-ADMIN-PASSWORD \
+# -DzkDigestReadonlyUsername=readonly-user -DzkDigestReadonlyPassword=CHANGEME-READONLY-PASSWORD"
+#SOLR_OPTS="$SOLR_OPTS $SOLR_ZK_CREDS_AND_ACLS"
+
Package: masterkey-lui-solr5
Architecture: all
-Depends: openjdk-7-jdk, ${misc:Depends}
+Depends: openjdk-7-jdk | openjdk-8-jdk, ${misc:Depends}
Conflicts: masterkey-lui-solr4-common, masterkey-lui-solr4-master, masterkey-lui-solr4-slave, masterkey-lui-solr4-zookeeper, masterkey-lui-solr4-common-tomcat6, masterkey-lui-solr4-master-tomcat6, masterkey-lui-solr4-slave-tomcat6, masterkey-lui-solr4-common-tomcat8, masterkey-lui-solr4-master-tomcat8, masterkey-lui-solr4-slave-tomcat8
Replaces: masterkey-lui-solr4-common, masterkey-lui-solr4-master, masterkey-lui-solr4-slave, masterkey-lui-solr4-zookeeper, masterkey-lui-solr4-common-tomcat6, masterkey-lui-solr4-master-tomcat6, masterkey-lui-solr4-slave-tomcat6, masterkey-lui-solr4-common-tomcat8, masterkey-lui-solr4-master-tomcat8, masterkey-lui-solr4-slave-tomcat8
Description: Local Unified Index (Solr)
(subdatabases). The underlying index is a Solr/Lucene 5 index configured
to use a specific LUI schema.
+Package: masterkey-lui-solr6
+Architecture: all
+Depends: openjdk-8-jdk, ${misc:Depends}
+Conflicts: masterkey-lui-solr4-common, masterkey-lui-solr4-master, masterkey-lui-solr4-slave, masterkey-lui-solr4-zookeeper, masterkey-lui-solr4-common-tomcat6, masterkey-lui-solr4-master-tomcat6, masterkey-lui-solr4-slave-tomcat6, masterkey-lui-solr4-common-tomcat8, masterkey-lui-solr4-master-tomcat8, masterkey-lui-solr4-slave-tomcat8, masterkey-lui-solr5
+Replaces: masterkey-lui-solr4-common, masterkey-lui-solr4-master, masterkey-lui-solr4-slave, masterkey-lui-solr4-zookeeper, masterkey-lui-solr4-common-tomcat6, masterkey-lui-solr4-master-tomcat6, masterkey-lui-solr4-slave-tomcat6, masterkey-lui-solr4-common-tomcat8, masterkey-lui-solr4-master-tomcat8, masterkey-lui-solr4-slave-tomcat8, masterkey-lui-solr5
+Description: Local Unified Index (Solr)
+ The Local Unified Index is a index that contains multiple logical indexes
+ (subdatabases). The underlying index is a Solr/Lucene 6 index configured
+ to use a specific LUI schema.
+
Package: masterkey-lui-zookeeper
Architecture: all
Depends: openjdk-7-jdk, ${misc:Depends}
dist/solr-5*.tgz usr/share/masterkey/lui/dist
-dist/install_solr_service.sh usr/share/masterkey/lui/dist
+dist/install_solr5_service.sh usr/share/masterkey/lui/dist
conf/solr/* etc/masterkey/lui/solr
-doc/* usr/share/doc/masterkey-lui-solr5
+doc/apache-solr-ref-guide-5*.pdf usr/share/doc/masterkey-lui-solr5
+doc/debian-install.md usr/share/doc/masterkey-lui-solr5
+doc/upgrade.md usr/share/doc/masterkey-lui-solr5
-etc/masterkey/lui/solr/lui-solr.in.sh etc/default/lui-solr.in.sh
\ No newline at end of file
+etc/masterkey/lui/solr/lui-solr.in.sh etc/default/lui-solr.in.sh
+
chown -R lui-solr /var/log/masterkey/lui
chown -R lui-solr /etc/masterkey/lui/solr/solr-home
# Run Solr installation script
- /usr/share/masterkey/lui/dist/install_solr_service.sh /usr/share/masterkey/lui/dist/solr-5.5.1.tgz -d /var/lib/masterkey/lui -i /usr/share/masterkey/lui -s lui-solr -u lui-solr -f
+ /usr/share/masterkey/lui/dist/install_solr5_service.sh /usr/share/masterkey/lui/dist/solr-5.5.1.tgz -d /var/lib/masterkey/lui -i /usr/share/masterkey/lui -s lui-solr -u lui-solr -f
# Remove extra files created by Solr installation
rm -f /var/lib/masterkey/lui/log4j.properties
rm -rf /var/lib/masterkey/lui/logs
# Remove Solr installation
rm -f /usr/share/masterkey/lui/lui-solr
rm -rf /usr/share/masterkey/lui/solr-*
-
- # Automatically added by dh_installinit
- if [ "$1" = "purge" ] ; then
- update-rc.d lui-solr remove >/dev/null
- fi
-
-
- # In case this system is running systemd, we make systemd reload the unit files
- # to pick up changes.
- if [ -d /run/systemd/system ] ; then
- systemctl --system daemon-reload >/dev/null || true
- fi
- # End automatically added section
-
- ;;
-
+ ;;
upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;
--- /dev/null
+#!/bin/sh -e
+
+case "$1" in
+ remove|upgrade|remove|deconfigure)
+ # Stop lui-solr service
+ if [ -x "/etc/init.d/lui-solr" ]; then
+ invoke-rc.d lui-solr stop || exit $?
+ fi
+
+ ;;
+ failed-upgrade)
+ ;;
+
+ *)
+ echo "prerm called with unknown argument \`$1'" >&2
+ exit 1
+esac
+
+exit 0
--- /dev/null
+etc/default
+usr/share/masterkey/lui/dist
+usr/share/doc/masterkey-lui-solr6
+etc/masterkey/lui/solr
+var/log/masterkey/lui
+var/lib/masterkey/lui/solr/lui
--- /dev/null
+dist/solr-6*.tgz usr/share/masterkey/lui/dist
+dist/install_solr6_service.sh usr/share/masterkey/lui/dist
+conf/solr/* etc/masterkey/lui/solr
+doc/apache-solr-ref-guide-6*.pdf usr/share/doc/masterkey-lui-solr6
+doc/debian-install.md usr/share/doc/masterkey-lui-solr6
+doc/upgrade.md usr/share/doc/masterkey-lui-solr6
--- /dev/null
+etc/masterkey/lui/solr/lui-solr.in.sh etc/default/lui-solr.in.sh
+
--- /dev/null
+#!/bin/sh -e
+
+case "$1" in
+ configure|upgrade)
+ # Create the solr user
+ adduser --system --shell /bin/bash --group --disabled-password --home /var/lib/masterkey/lui lui-solr
+ # Set directory permissions
+ chown -R lui-solr /var/lib/masterkey/lui
+ chown -R lui-solr /var/log/masterkey/lui
+ chown -R lui-solr /etc/masterkey/lui/solr/solr-home
+ # Run Solr installation script
+ /usr/share/masterkey/lui/dist/install_solr6_service.sh /usr/share/masterkey/lui/dist/solr-6.1.0.tgz -d /var/lib/masterkey/lui -i /usr/share/masterkey/lui -s lui-solr -u lui-solr -f
+ # Remove extra files created by Solr installation
+ rm -f /var/lib/masterkey/lui/log4j.properties
+ rm -rf /var/lib/masterkey/lui/logs
+ rm -rf /var/lib/masterkey/lui/data
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument '$1'" >&2
+ exit 1
+ ;;
+esac
+
+exit 0
--- /dev/null
+#!/bin/sh -e
+
+case "$1" in
+ purge|remove)
+ # Remove Solr installation
+ rm -f /usr/share/masterkey/lui/lui-solr
+ rm -rf /usr/share/masterkey/lui/solr-*
+ ;;
+ upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+ ;;
+
+ *)
+ echo "postrm called with unknown argument \`$1'" >&2
+ exit 1
+esac
+
+exit 0
--- /dev/null
+#!/bin/sh -e
+
+case "$1" in
+ remove|upgrade|remove|deconfigure)
+ # Stop lui-solr service
+ if [ -x "/etc/init.d/lui-solr" ]; then
+ invoke-rc.d lui-solr stop || exit $?
+ fi
+
+ ;;
+ failed-upgrade)
+ ;;
+
+ *)
+ echo "prerm called with unknown argument \`$1'" >&2
+ exit 1
+esac
+
+exit 0
- name: Update apt-cache
become: yes
apt: update-cache=yes
+
+ - name: Install python-apt
+ become: yes
+ apt: name=python-apt state=present
- - name: Install dependencies from apt
+ - name: Add backports apt repo
become: yes
- apt: name={{ item }} state=present
- with_items:
- - openjdk-7-jdk
+ apt_repository: repo="deb http://ftp.debian.org/debian jessie-backports main" state=present update_cache=yes
+
+ - name: Install openjdk
+ become: yes
+ apt: name=openjdk-8-jdk state=present
- name: Create deployment environment
become: yes
- name: Install Solr binary
become: yes
- command: /vagrant/dist/install_solr_service.sh /vagrant/dist/solr-5.5.1.tgz -d /var/lib/masterkey/lui -i /usr/share/masterkey/lui -s lui-solr -u lui-solr -f creates=/usr/share/masterkey/lui/solr-5.5.1
+ command: /vagrant/dist/install_solr6_service.sh /vagrant/dist/solr-6.1.0.tgz -d /var/lib/masterkey/lui -i /usr/share/masterkey/lui -s lui-solr -u lui-solr -f creates=/usr/share/masterkey/lui/solr-6.1.0
- name: Remove extra files created by Solr install
become: yes
# Set up solr.in.sh with reasonable defaults
# Link in the lui-solr configuration
-SOLR_VERSION=5.5.1
+SOLR_VERSION=6.1.0
SOLR_DIR=solr-$SOLR_VERSION
echo "Unpacking Solr $SOLR_VERSION archive..."
--- /dev/null
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+if [[ $EUID -ne 0 ]]; then
+ echo -e "\nERROR: This script must be run as root\n" 1>&2
+ exit 1
+fi
+
+print_usage() {
+ ERROR_MSG="$1"
+
+ if [ "$ERROR_MSG" != "" ]; then
+ echo -e "\nERROR: $ERROR_MSG\n" 1>&2
+ fi
+
+ echo ""
+ echo "Usage: install_solr_service.sh path_to_solr_distribution_archive OPTIONS"
+ echo ""
+ echo " The first argument to the script must be a path to a Solr distribution archive, such as solr-5.0.0.tgz"
+ echo " (only .tgz or .zip are supported formats for the archive)"
+ echo ""
+ echo " Supported OPTIONS include:"
+ echo ""
+ echo " -d Directory for live / writable Solr files, such as logs, pid files, and index data; defaults to /var/solr"
+ echo ""
+ echo " -i Directory to extract the Solr installation archive; defaults to /opt/"
+ echo " The specified path must exist prior to using this script."
+ echo ""
+ echo " -p Port Solr should bind to; default is 8983"
+ echo ""
+ echo " -s Service name; defaults to solr"
+ echo ""
+ echo " -u User to own the Solr files and run the Solr process as; defaults to solr"
+ echo " This script will create the specified user account if it does not exist."
+ echo ""
+ echo " -f Upgrade Solr. Overwrite symlink and init script of previous installation."
+ echo ""
+ echo " NOTE: Must be run as the root user"
+ echo ""
+} # end print_usage
+
+if [ -f "/proc/version" ]; then
+ proc_version=`cat /proc/version`
+else
+ proc_version=`uname -a`
+fi
+
+if [[ $proc_version == *"Debian"* ]]; then
+ distro=Debian
+elif [[ $proc_version == *"Red Hat"* ]]; then
+ distro=RedHat
+elif [[ $proc_version == *"Ubuntu"* ]]; then
+ distro=Ubuntu
+elif [[ $proc_version == *"SUSE"* ]]; then
+ distro=SUSE
+else
+ echo -e "\nERROR: Your Linux distribution ($proc_version) not supported by this script!\nYou'll need to setup Solr as a service manually using the documentation provided in the Solr Reference Guide.\n" 1>&2
+ exit 1
+fi
+
+if [ -z "$1" ]; then
+ print_usage "Must specify the path to the Solr installation archive, such as solr-5.0.0.tgz"
+ exit 1
+fi
+
+SOLR_ARCHIVE=$1
+if [ ! -f "$SOLR_ARCHIVE" ]; then
+ print_usage "Specified Solr installation archive $SOLR_ARCHIVE not found!"
+ exit 1
+fi
+
+# strip off path info
+SOLR_INSTALL_FILE=${SOLR_ARCHIVE##*/}
+is_tar=true
+if [ ${SOLR_INSTALL_FILE: -4} == ".tgz" ]; then
+ SOLR_DIR=${SOLR_INSTALL_FILE%.tgz}
+elif [ ${SOLR_INSTALL_FILE: -4} == ".zip" ]; then
+ SOLR_DIR=${SOLR_INSTALL_FILE%.zip}
+ is_tar=false
+else
+ print_usage "Solr installation archive $SOLR_ARCHIVE is invalid, expected a .tgz or .zip file!"
+ exit 1
+fi
+
+if [ $# -gt 1 ]; then
+ shift
+ while true; do
+ case $1 in
+ -i)
+ if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
+ print_usage "Directory path is required when using the $1 option!"
+ exit 1
+ fi
+ SOLR_EXTRACT_DIR=$2
+ shift 2
+ ;;
+ -d)
+ if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
+ print_usage "Directory path is required when using the $1 option!"
+ exit 1
+ fi
+ SOLR_VAR_DIR="$2"
+ shift 2
+ ;;
+ -u)
+ if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
+ print_usage "Username is required when using the $1 option!"
+ exit 1
+ fi
+ SOLR_USER="$2"
+ shift 2
+ ;;
+ -s)
+ if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
+ print_usage "Service name is required when using the $1 option!"
+ exit 1
+ fi
+ SOLR_SERVICE="$2"
+ shift 2
+ ;;
+ -p)
+ if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
+ print_usage "Port is required when using the $1 option!"
+ exit 1
+ fi
+ SOLR_PORT="$2"
+ shift 2
+ ;;
+ -f)
+ SOLR_UPGRADE="YES"
+ shift 1
+ ;;
+ -help|-usage)
+ print_usage ""
+ exit 0
+ ;;
+ --)
+ shift
+ break
+ ;;
+ *)
+ if [ "$1" != "" ]; then
+ print_usage "Unrecognized or misplaced argument: $1!"
+ exit 1
+ else
+ break # out-of-args, stop looping
+ fi
+ ;;
+ esac
+ done
+fi
+
+if [ -z "$SOLR_EXTRACT_DIR" ]; then
+ SOLR_EXTRACT_DIR=/opt
+fi
+
+if [ ! -d "$SOLR_EXTRACT_DIR" ]; then
+ print_usage "Installation directory $SOLR_EXTRACT_DIR not found! Please create it before running this script."
+ exit 1
+fi
+
+if [ -z "$SOLR_SERVICE" ]; then
+ SOLR_SERVICE=solr
+fi
+
+if [ -z "$SOLR_VAR_DIR" ]; then
+ SOLR_VAR_DIR="/var/$SOLR_SERVICE"
+fi
+
+if [ -z "$SOLR_USER" ]; then
+ SOLR_USER=solr
+fi
+
+if [ -z "$SOLR_PORT" ]; then
+ SOLR_PORT=8983
+fi
+
+if [ -z "$SOLR_UPGRADE" ]; then
+ SOLR_UPGRADE=NO
+fi
+
+if [ ! "$SOLR_UPGRADE" = "YES" ]; then
+ if [ -f "/etc/init.d/$SOLR_SERVICE" ]; then
+ print_usage "/etc/init.d/$SOLR_SERVICE already exists! Perhaps Solr is already setup as a service on this host? To upgrade Solr use the -f option."
+ exit 1
+ fi
+
+ if [ -e "$SOLR_EXTRACT_DIR/$SOLR_SERVICE" ]; then
+ print_usage "$SOLR_EXTRACT_DIR/$SOLR_SERVICE already exists! Please move this directory / link or choose a different service name using the -s option."
+ exit 1
+ fi
+fi
+
+# stop running instance
+if [ -f "/etc/init.d/$SOLR_SERVICE" ]; then
+ echo -e "\nStopping Solr instance if exists ...\n"
+ service "$SOLR_SERVICE" stop
+fi
+
+# create user if not exists
+solr_uid="`id -u "$SOLR_USER"`"
+if [ $? -ne 0 ]; then
+ echo "Creating new user: $SOLR_USER"
+ if [ "$distro" == "RedHat" ]; then
+ adduser "$SOLR_USER"
+ elif [ "$distro" == "SUSE" ]; then
+ useradd -m "$SOLR_USER"
+ else
+ adduser --system --shell /bin/bash --group --disabled-password --home "$SOLR_VAR_DIR" "$SOLR_USER"
+ fi
+fi
+
+# extract
+SOLR_INSTALL_DIR="$SOLR_EXTRACT_DIR/$SOLR_DIR"
+if [ ! -d "$SOLR_INSTALL_DIR" ]; then
+
+ echo -e "\nExtracting $SOLR_ARCHIVE to $SOLR_EXTRACT_DIR\n"
+
+ if $is_tar ; then
+ tar zxf "$SOLR_ARCHIVE" -C "$SOLR_EXTRACT_DIR"
+ else
+ unzip -q "$SOLR_ARCHIVE" -d "$SOLR_EXTRACT_DIR"
+ fi
+
+ if [ ! -d "$SOLR_INSTALL_DIR" ]; then
+ echo -e "\nERROR: Expected directory $SOLR_INSTALL_DIR not found after extracting $SOLR_ARCHIVE ... script fails.\n" 1>&2
+ exit 1
+ fi
+
+ chown -R root: "$SOLR_INSTALL_DIR"
+ find "$SOLR_INSTALL_DIR" -type d -print0 | xargs -0 chmod 0755
+ find "$SOLR_INSTALL_DIR" -type f -print0 | xargs -0 chmod 0644
+ chmod -R 0755 "$SOLR_INSTALL_DIR/bin"
+else
+ echo -e "\nWARNING: $SOLR_INSTALL_DIR already exists! Skipping extract ...\n"
+fi
+
+# create a symlink for easier scripting
+if [ -h "$SOLR_EXTRACT_DIR/$SOLR_SERVICE" ]; then
+ echo -e "\nRemoving old symlink $SOLR_EXTRACT_DIR/$SOLR_SERVICE ...\n"
+ rm "$SOLR_EXTRACT_DIR/$SOLR_SERVICE"
+fi
+if [ -e "$SOLR_EXTRACT_DIR/$SOLR_SERVICE" ]; then
+ echo -e "\nWARNING: $SOLR_EXTRACT_DIR/$SOLR_SERVICE is not symlink! Skipping symlink update ...\n"
+else
+ echo -e "\nInstalling symlink $SOLR_EXTRACT_DIR/$SOLR_SERVICE -> $SOLR_INSTALL_DIR ...\n"
+ ln -s "$SOLR_INSTALL_DIR" "$SOLR_EXTRACT_DIR/$SOLR_SERVICE"
+fi
+
+# install init.d script
+echo -e "\nInstalling /etc/init.d/$SOLR_SERVICE script ...\n"
+cp "$SOLR_INSTALL_DIR/bin/init.d/solr" "/etc/init.d/$SOLR_SERVICE"
+chmod 0744 "/etc/init.d/$SOLR_SERVICE"
+chown root: "/etc/init.d/$SOLR_SERVICE"
+# do some basic variable substitution on the init.d script
+sed_expr1="s#SOLR_INSTALL_DIR=.*#SOLR_INSTALL_DIR=\"$SOLR_EXTRACT_DIR/$SOLR_SERVICE\"#"
+sed_expr2="s#SOLR_ENV=.*#SOLR_ENV=\"/etc/default/$SOLR_SERVICE.in.sh\"#"
+sed_expr3="s#RUNAS=.*#RUNAS=\"$SOLR_USER\"#"
+sed_expr4="s#Provides:.*#Provides: $SOLR_SERVICE#"
+sed -i -e "$sed_expr1" -e "$sed_expr2" -e "$sed_expr3" -e "$sed_expr4" "/etc/init.d/$SOLR_SERVICE"
+
+# install/move configuration
+if [ ! -d /etc/default ]; then
+ mkdir /etc/default
+ chown root: /etc/default
+ chmod 0755 /etc/default
+fi
+if [ -f "$SOLR_VAR_DIR/solr.in.sh" ]; then
+ echo -e "\nMoving existing $SOLR_VAR_DIR/solr.in.sh to /etc/default/$SOLR_SERVICE.in.sh ...\n"
+ mv "$SOLR_VAR_DIR/solr.in.sh" "/etc/default/$SOLR_SERVICE.in.sh"
+elif [ -f "/etc/default/$SOLR_SERVICE.in.sh" ]; then
+ echo -e "\n/etc/default/$SOLR_SERVICE.in.sh already exist. Skipping install ...\n"
+else
+ echo -e "\nInstalling /etc/default/$SOLR_SERVICE.in.sh ...\n"
+ cp "$SOLR_INSTALL_DIR/bin/solr.in.sh" "/etc/default/$SOLR_SERVICE.in.sh"
+ echo "SOLR_PID_DIR=\"$SOLR_VAR_DIR\"
+SOLR_HOME=\"$SOLR_VAR_DIR/data\"
+LOG4J_PROPS=\"$SOLR_VAR_DIR/log4j.properties\"
+SOLR_LOGS_DIR=\"$SOLR_VAR_DIR/logs\"
+SOLR_PORT=\"$SOLR_PORT\"
+" >> "/etc/default/$SOLR_SERVICE.in.sh"
+fi
+chown root: "/etc/default/$SOLR_SERVICE.in.sh"
+chmod 0644 "/etc/default/$SOLR_SERVICE.in.sh"
+
+# install data directories and files
+mkdir -p "$SOLR_VAR_DIR/data"
+mkdir -p "$SOLR_VAR_DIR/logs"
+if [ -f "$SOLR_VAR_DIR/data/solr.xml" ]; then
+ echo -e "\n$SOLR_VAR_DIR/data/solr.xml already exists. Skipping install ...\n"
+else
+ cp "$SOLR_INSTALL_DIR/server/solr/solr.xml" "$SOLR_VAR_DIR/data/solr.xml"
+fi
+if [ -f "$SOLR_VAR_DIR/log4j.properties" ]; then
+ echo -e "\n$SOLR_VAR_DIR/log4j.properties already exists. Skipping install ...\n"
+else
+ cp "$SOLR_INSTALL_DIR/server/resources/log4j.properties" "$SOLR_VAR_DIR/log4j.properties"
+ sed_expr="s#solr.log=.*#solr.log=\${solr.solr.home}/../logs#"
+ sed -i -e "$sed_expr" "$SOLR_VAR_DIR/log4j.properties"
+fi
+chown -R "$SOLR_USER:" "$SOLR_VAR_DIR"
+find "$SOLR_VAR_DIR" -type d -print0 | xargs -0 chmod 0750
+find "$SOLR_VAR_DIR" -type f -print0 | xargs -0 chmod 0640
+
+# configure autostart of service
+if [[ "$distro" == "RedHat" || "$distro" == "SUSE" ]]; then
+ chkconfig "$SOLR_SERVICE" on
+else
+ update-rc.d "$SOLR_SERVICE" defaults
+fi
+
+# start service
+service "$SOLR_SERVICE" start
+sleep 5
+service "$SOLR_SERVICE" status
+
+echo "Service $SOLR_SERVICE installed."
--- /dev/null
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+if [[ $EUID -ne 0 ]]; then
+ echo -e "\nERROR: This script must be run as root\n" 1>&2
+ exit 1
+fi
+
+print_usage() {
+ ERROR_MSG="$1"
+
+ if [ "$ERROR_MSG" != "" ]; then
+ echo -e "\nERROR: $ERROR_MSG\n" 1>&2
+ fi
+
+ echo ""
+ echo "Usage: install_solr_service.sh path_to_solr_distribution_archive OPTIONS"
+ echo ""
+ echo " The first argument to the script must be a path to a Solr distribution archive, such as solr-5.0.0.tgz"
+ echo " (only .tgz or .zip are supported formats for the archive)"
+ echo ""
+ echo " Supported OPTIONS include:"
+ echo ""
+ echo " -d Directory for live / writable Solr files, such as logs, pid files, and index data; defaults to /var/solr"
+ echo ""
+ echo " -i Directory to extract the Solr installation archive; defaults to /opt/"
+ echo " The specified path must exist prior to using this script."
+ echo ""
+ echo " -p Port Solr should bind to; default is 8983"
+ echo ""
+ echo " -s Service name; defaults to solr"
+ echo ""
+ echo " -u User to own the Solr files and run the Solr process as; defaults to solr"
+ echo " This script will create the specified user account if it does not exist."
+ echo ""
+ echo " -f Upgrade Solr. Overwrite symlink and init script of previous installation."
+ echo ""
+ echo " NOTE: Must be run as the root user"
+ echo ""
+} # end print_usage
+
+if [ -f "/proc/version" ]; then
+ proc_version=`cat /proc/version`
+else
+ proc_version=`uname -a`
+fi
+
+if [[ $proc_version == *"Debian"* ]]; then
+ distro=Debian
+elif [[ $proc_version == *"Red Hat"* ]]; then
+ distro=RedHat
+elif [[ $proc_version == *"Ubuntu"* ]]; then
+ distro=Ubuntu
+elif [[ $proc_version == *"SUSE"* ]]; then
+ distro=SUSE
+else
+ echo -e "\nERROR: Your Linux distribution ($proc_version) not supported by this script!\nYou'll need to setup Solr as a service manually using the documentation provided in the Solr Reference Guide.\n" 1>&2
+ exit 1
+fi
+
+if [ -z "$1" ]; then
+ print_usage "Must specify the path to the Solr installation archive, such as solr-5.0.0.tgz"
+ exit 1
+fi
+
+SOLR_ARCHIVE=$1
+if [ ! -f "$SOLR_ARCHIVE" ]; then
+ print_usage "Specified Solr installation archive $SOLR_ARCHIVE not found!"
+ exit 1
+fi
+
+# strip off path info
+SOLR_INSTALL_FILE=${SOLR_ARCHIVE##*/}
+is_tar=true
+if [ ${SOLR_INSTALL_FILE: -4} == ".tgz" ]; then
+ SOLR_DIR=${SOLR_INSTALL_FILE%.tgz}
+elif [ ${SOLR_INSTALL_FILE: -4} == ".zip" ]; then
+ SOLR_DIR=${SOLR_INSTALL_FILE%.zip}
+ is_tar=false
+else
+ print_usage "Solr installation archive $SOLR_ARCHIVE is invalid, expected a .tgz or .zip file!"
+ exit 1
+fi
+
+if [ $# -gt 1 ]; then
+ shift
+ while true; do
+ case $1 in
+ -i)
+ if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
+ print_usage "Directory path is required when using the $1 option!"
+ exit 1
+ fi
+ SOLR_EXTRACT_DIR=$2
+ shift 2
+ ;;
+ -d)
+ if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
+ print_usage "Directory path is required when using the $1 option!"
+ exit 1
+ fi
+ SOLR_VAR_DIR="$2"
+ shift 2
+ ;;
+ -u)
+ if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
+ print_usage "Username is required when using the $1 option!"
+ exit 1
+ fi
+ SOLR_USER="$2"
+ shift 2
+ ;;
+ -s)
+ if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
+ print_usage "Service name is required when using the $1 option!"
+ exit 1
+ fi
+ SOLR_SERVICE="$2"
+ shift 2
+ ;;
+ -p)
+ if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
+ print_usage "Port is required when using the $1 option!"
+ exit 1
+ fi
+ SOLR_PORT="$2"
+ shift 2
+ ;;
+ -f)
+ SOLR_UPGRADE="YES"
+ shift 1
+ ;;
+ -help|-usage)
+ print_usage ""
+ exit 0
+ ;;
+ --)
+ shift
+ break
+ ;;
+ *)
+ if [ "$1" != "" ]; then
+ print_usage "Unrecognized or misplaced argument: $1!"
+ exit 1
+ else
+ break # out-of-args, stop looping
+ fi
+ ;;
+ esac
+ done
+fi
+
+if [ -z "$SOLR_EXTRACT_DIR" ]; then
+ SOLR_EXTRACT_DIR=/opt
+fi
+
+if [ ! -d "$SOLR_EXTRACT_DIR" ]; then
+ print_usage "Installation directory $SOLR_EXTRACT_DIR not found! Please create it before running this script."
+ exit 1
+fi
+
+if [ -z "$SOLR_SERVICE" ]; then
+ SOLR_SERVICE=solr
+fi
+
+if [ -z "$SOLR_VAR_DIR" ]; then
+ SOLR_VAR_DIR="/var/$SOLR_SERVICE"
+fi
+
+if [ -z "$SOLR_USER" ]; then
+ SOLR_USER=solr
+fi
+
+if [ -z "$SOLR_PORT" ]; then
+ SOLR_PORT=8983
+fi
+
+if [ -z "$SOLR_UPGRADE" ]; then
+ SOLR_UPGRADE=NO
+fi
+
+if [ ! "$SOLR_UPGRADE" = "YES" ]; then
+ if [ -f "/etc/init.d/$SOLR_SERVICE" ]; then
+ print_usage "/etc/init.d/$SOLR_SERVICE already exists! Perhaps Solr is already setup as a service on this host? To upgrade Solr use the -f option."
+ exit 1
+ fi
+
+ if [ -e "$SOLR_EXTRACT_DIR/$SOLR_SERVICE" ]; then
+ print_usage "$SOLR_EXTRACT_DIR/$SOLR_SERVICE already exists! Please move this directory / link or choose a different service name using the -s option."
+ exit 1
+ fi
+fi
+
+# stop running instance
+if [ -f "/etc/init.d/$SOLR_SERVICE" ]; then
+ echo -e "\nStopping Solr instance if exists ...\n"
+ service "$SOLR_SERVICE" stop
+fi
+
+# create user if not exists
+solr_uid="`id -u "$SOLR_USER"`"
+if [ $? -ne 0 ]; then
+ echo "Creating new user: $SOLR_USER"
+ if [ "$distro" == "RedHat" ]; then
+ adduser "$SOLR_USER"
+ elif [ "$distro" == "SUSE" ]; then
+ useradd -m "$SOLR_USER"
+ else
+ adduser --system --shell /bin/bash --group --disabled-password --home "$SOLR_VAR_DIR" "$SOLR_USER"
+ fi
+fi
+
+# extract
+SOLR_INSTALL_DIR="$SOLR_EXTRACT_DIR/$SOLR_DIR"
+if [ ! -d "$SOLR_INSTALL_DIR" ]; then
+
+ echo -e "\nExtracting $SOLR_ARCHIVE to $SOLR_EXTRACT_DIR\n"
+
+ if $is_tar ; then
+ tar zxf "$SOLR_ARCHIVE" -C "$SOLR_EXTRACT_DIR"
+ else
+ unzip -q "$SOLR_ARCHIVE" -d "$SOLR_EXTRACT_DIR"
+ fi
+
+ if [ ! -d "$SOLR_INSTALL_DIR" ]; then
+ echo -e "\nERROR: Expected directory $SOLR_INSTALL_DIR not found after extracting $SOLR_ARCHIVE ... script fails.\n" 1>&2
+ exit 1
+ fi
+
+ chown -R root: "$SOLR_INSTALL_DIR"
+ find "$SOLR_INSTALL_DIR" -type d -print0 | xargs -0 chmod 0755
+ find "$SOLR_INSTALL_DIR" -type f -print0 | xargs -0 chmod 0644
+ chmod -R 0755 "$SOLR_INSTALL_DIR/bin"
+else
+ echo -e "\nWARNING: $SOLR_INSTALL_DIR already exists! Skipping extract ...\n"
+fi
+
+# create a symlink for easier scripting
+if [ -h "$SOLR_EXTRACT_DIR/$SOLR_SERVICE" ]; then
+ echo -e "\nRemoving old symlink $SOLR_EXTRACT_DIR/$SOLR_SERVICE ...\n"
+ rm "$SOLR_EXTRACT_DIR/$SOLR_SERVICE"
+fi
+if [ -e "$SOLR_EXTRACT_DIR/$SOLR_SERVICE" ]; then
+ echo -e "\nWARNING: $SOLR_EXTRACT_DIR/$SOLR_SERVICE is not symlink! Skipping symlink update ...\n"
+else
+ echo -e "\nInstalling symlink $SOLR_EXTRACT_DIR/$SOLR_SERVICE -> $SOLR_INSTALL_DIR ...\n"
+ ln -s "$SOLR_INSTALL_DIR" "$SOLR_EXTRACT_DIR/$SOLR_SERVICE"
+fi
+
+# install init.d script
+echo -e "\nInstalling /etc/init.d/$SOLR_SERVICE script ...\n"
+cp "$SOLR_INSTALL_DIR/bin/init.d/solr" "/etc/init.d/$SOLR_SERVICE"
+chmod 0744 "/etc/init.d/$SOLR_SERVICE"
+chown root: "/etc/init.d/$SOLR_SERVICE"
+# do some basic variable substitution on the init.d script
+sed_expr1="s#SOLR_INSTALL_DIR=.*#SOLR_INSTALL_DIR=\"$SOLR_EXTRACT_DIR/$SOLR_SERVICE\"#"
+sed_expr2="s#SOLR_ENV=.*#SOLR_ENV=\"/etc/default/$SOLR_SERVICE.in.sh\"#"
+sed_expr3="s#RUNAS=.*#RUNAS=\"$SOLR_USER\"#"
+sed_expr4="s#Provides:.*#Provides: $SOLR_SERVICE#"
+sed -i -e "$sed_expr1" -e "$sed_expr2" -e "$sed_expr3" -e "$sed_expr4" "/etc/init.d/$SOLR_SERVICE"
+
+# install/move configuration
+if [ ! -d /etc/default ]; then
+ mkdir /etc/default
+ chown root: /etc/default
+ chmod 0755 /etc/default
+fi
+if [ -f "$SOLR_VAR_DIR/solr.in.sh" ]; then
+ echo -e "\nMoving existing $SOLR_VAR_DIR/solr.in.sh to /etc/default/$SOLR_SERVICE.in.sh ...\n"
+ mv "$SOLR_VAR_DIR/solr.in.sh" "/etc/default/$SOLR_SERVICE.in.sh"
+elif [ -f "/etc/default/$SOLR_SERVICE.in.sh" ]; then
+ echo -e "\n/etc/default/$SOLR_SERVICE.in.sh already exist. Skipping install ...\n"
+else
+ echo -e "\nInstalling /etc/default/$SOLR_SERVICE.in.sh ...\n"
+ cp "$SOLR_INSTALL_DIR/bin/solr.in.sh" "/etc/default/$SOLR_SERVICE.in.sh"
+ echo "SOLR_PID_DIR=\"$SOLR_VAR_DIR\"
+SOLR_HOME=\"$SOLR_VAR_DIR/data\"
+LOG4J_PROPS=\"$SOLR_VAR_DIR/log4j.properties\"
+SOLR_LOGS_DIR=\"$SOLR_VAR_DIR/logs\"
+SOLR_PORT=\"$SOLR_PORT\"
+" >> "/etc/default/$SOLR_SERVICE.in.sh"
+fi
+chown root: "/etc/default/$SOLR_SERVICE.in.sh"
+chmod 0644 "/etc/default/$SOLR_SERVICE.in.sh"
+
+# install data directories and files
+mkdir -p "$SOLR_VAR_DIR/data"
+mkdir -p "$SOLR_VAR_DIR/logs"
+if [ -f "$SOLR_VAR_DIR/data/solr.xml" ]; then
+ echo -e "\n$SOLR_VAR_DIR/data/solr.xml already exists. Skipping install ...\n"
+else
+ cp "$SOLR_INSTALL_DIR/server/solr/solr.xml" "$SOLR_VAR_DIR/data/solr.xml"
+fi
+if [ -f "$SOLR_VAR_DIR/log4j.properties" ]; then
+ echo -e "\n$SOLR_VAR_DIR/log4j.properties already exists. Skipping install ...\n"
+else
+ cp "$SOLR_INSTALL_DIR/server/resources/log4j.properties" "$SOLR_VAR_DIR/log4j.properties"
+ sed_expr="s#solr.log=.*#solr.log=\${solr.solr.home}/../logs#"
+ sed -i -e "$sed_expr" "$SOLR_VAR_DIR/log4j.properties"
+fi
+chown -R "$SOLR_USER:" "$SOLR_VAR_DIR"
+find "$SOLR_VAR_DIR" -type d -print0 | xargs -0 chmod 0750
+find "$SOLR_VAR_DIR" -type f -print0 | xargs -0 chmod 0640
+
+# configure autostart of service
+if [[ "$distro" == "RedHat" || "$distro" == "SUSE" ]]; then
+ chkconfig "$SOLR_SERVICE" on
+else
+ update-rc.d "$SOLR_SERVICE" defaults
+fi
+
+# start service
+service "$SOLR_SERVICE" start
+sleep 5
+service "$SOLR_SERVICE" status
+
+echo "Service $SOLR_SERVICE installed."
+++ /dev/null
-#!/usr/bin/env bash
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-if [[ $EUID -ne 0 ]]; then
- echo -e "\nERROR: This script must be run as root\n" 1>&2
- exit 1
-fi
-
-print_usage() {
- ERROR_MSG="$1"
-
- if [ "$ERROR_MSG" != "" ]; then
- echo -e "\nERROR: $ERROR_MSG\n" 1>&2
- fi
-
- echo ""
- echo "Usage: install_solr_service.sh path_to_solr_distribution_archive OPTIONS"
- echo ""
- echo " The first argument to the script must be a path to a Solr distribution archive, such as solr-5.0.0.tgz"
- echo " (only .tgz or .zip are supported formats for the archive)"
- echo ""
- echo " Supported OPTIONS include:"
- echo ""
- echo " -d Directory for live / writable Solr files, such as logs, pid files, and index data; defaults to /var/solr"
- echo ""
- echo " -i Directory to extract the Solr installation archive; defaults to /opt/"
- echo " The specified path must exist prior to using this script."
- echo ""
- echo " -p Port Solr should bind to; default is 8983"
- echo ""
- echo " -s Service name; defaults to solr"
- echo ""
- echo " -u User to own the Solr files and run the Solr process as; defaults to solr"
- echo " This script will create the specified user account if it does not exist."
- echo ""
- echo " -f Upgrade Solr. Overwrite symlink and init script of previous installation."
- echo ""
- echo " NOTE: Must be run as the root user"
- echo ""
-} # end print_usage
-
-if [ -f "/proc/version" ]; then
- proc_version=`cat /proc/version`
-else
- proc_version=`uname -a`
-fi
-
-if [[ $proc_version == *"Debian"* ]]; then
- distro=Debian
-elif [[ $proc_version == *"Red Hat"* ]]; then
- distro=RedHat
-elif [[ $proc_version == *"Ubuntu"* ]]; then
- distro=Ubuntu
-elif [[ $proc_version == *"SUSE"* ]]; then
- distro=SUSE
-else
- echo -e "\nERROR: Your Linux distribution ($proc_version) not supported by this script!\nYou'll need to setup Solr as a service manually using the documentation provided in the Solr Reference Guide.\n" 1>&2
- exit 1
-fi
-
-if [ -z "$1" ]; then
- print_usage "Must specify the path to the Solr installation archive, such as solr-5.0.0.tgz"
- exit 1
-fi
-
-SOLR_ARCHIVE=$1
-if [ ! -f "$SOLR_ARCHIVE" ]; then
- print_usage "Specified Solr installation archive $SOLR_ARCHIVE not found!"
- exit 1
-fi
-
-# strip off path info
-SOLR_INSTALL_FILE=${SOLR_ARCHIVE##*/}
-is_tar=true
-if [ ${SOLR_INSTALL_FILE: -4} == ".tgz" ]; then
- SOLR_DIR=${SOLR_INSTALL_FILE%.tgz}
-elif [ ${SOLR_INSTALL_FILE: -4} == ".zip" ]; then
- SOLR_DIR=${SOLR_INSTALL_FILE%.zip}
- is_tar=false
-else
- print_usage "Solr installation archive $SOLR_ARCHIVE is invalid, expected a .tgz or .zip file!"
- exit 1
-fi
-
-if [ $# -gt 1 ]; then
- shift
- while true; do
- case $1 in
- -i)
- if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
- print_usage "Directory path is required when using the $1 option!"
- exit 1
- fi
- SOLR_EXTRACT_DIR=$2
- shift 2
- ;;
- -d)
- if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
- print_usage "Directory path is required when using the $1 option!"
- exit 1
- fi
- SOLR_VAR_DIR="$2"
- shift 2
- ;;
- -u)
- if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
- print_usage "Username is required when using the $1 option!"
- exit 1
- fi
- SOLR_USER="$2"
- shift 2
- ;;
- -s)
- if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
- print_usage "Service name is required when using the $1 option!"
- exit 1
- fi
- SOLR_SERVICE="$2"
- shift 2
- ;;
- -p)
- if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
- print_usage "Port is required when using the $1 option!"
- exit 1
- fi
- SOLR_PORT="$2"
- shift 2
- ;;
- -f)
- SOLR_UPGRADE="YES"
- shift 1
- ;;
- -help|-usage)
- print_usage ""
- exit 0
- ;;
- --)
- shift
- break
- ;;
- *)
- if [ "$1" != "" ]; then
- print_usage "Unrecognized or misplaced argument: $1!"
- exit 1
- else
- break # out-of-args, stop looping
- fi
- ;;
- esac
- done
-fi
-
-if [ -z "$SOLR_EXTRACT_DIR" ]; then
- SOLR_EXTRACT_DIR=/opt
-fi
-
-if [ ! -d "$SOLR_EXTRACT_DIR" ]; then
- print_usage "Installation directory $SOLR_EXTRACT_DIR not found! Please create it before running this script."
- exit 1
-fi
-
-if [ -z "$SOLR_SERVICE" ]; then
- SOLR_SERVICE=solr
-fi
-
-if [ -z "$SOLR_VAR_DIR" ]; then
- SOLR_VAR_DIR="/var/$SOLR_SERVICE"
-fi
-
-if [ -z "$SOLR_USER" ]; then
- SOLR_USER=solr
-fi
-
-if [ -z "$SOLR_PORT" ]; then
- SOLR_PORT=8983
-fi
-
-if [ -z "$SOLR_UPGRADE" ]; then
- SOLR_UPGRADE=NO
-fi
-
-if [ ! "$SOLR_UPGRADE" = "YES" ]; then
- if [ -f "/etc/init.d/$SOLR_SERVICE" ]; then
- print_usage "/etc/init.d/$SOLR_SERVICE already exists! Perhaps Solr is already setup as a service on this host? To upgrade Solr use the -f option."
- exit 1
- fi
-
- if [ -e "$SOLR_EXTRACT_DIR/$SOLR_SERVICE" ]; then
- print_usage "$SOLR_EXTRACT_DIR/$SOLR_SERVICE already exists! Please move this directory / link or choose a different service name using the -s option."
- exit 1
- fi
-fi
-
-# stop running instance
-if [ -f "/etc/init.d/$SOLR_SERVICE" ]; then
- echo -e "\nStopping Solr instance if exists ...\n"
- service "$SOLR_SERVICE" stop
-fi
-
-# create user if not exists
-solr_uid="`id -u "$SOLR_USER"`"
-if [ $? -ne 0 ]; then
- echo "Creating new user: $SOLR_USER"
- if [ "$distro" == "RedHat" ]; then
- adduser "$SOLR_USER"
- elif [ "$distro" == "SUSE" ]; then
- useradd -m "$SOLR_USER"
- else
- adduser --system --shell /bin/bash --group --disabled-password --home "$SOLR_VAR_DIR" "$SOLR_USER"
- fi
-fi
-
-# extract
-SOLR_INSTALL_DIR="$SOLR_EXTRACT_DIR/$SOLR_DIR"
-if [ ! -d "$SOLR_INSTALL_DIR" ]; then
-
- echo -e "\nExtracting $SOLR_ARCHIVE to $SOLR_EXTRACT_DIR\n"
-
- if $is_tar ; then
- tar zxf "$SOLR_ARCHIVE" -C "$SOLR_EXTRACT_DIR"
- else
- unzip -q "$SOLR_ARCHIVE" -d "$SOLR_EXTRACT_DIR"
- fi
-
- if [ ! -d "$SOLR_INSTALL_DIR" ]; then
- echo -e "\nERROR: Expected directory $SOLR_INSTALL_DIR not found after extracting $SOLR_ARCHIVE ... script fails.\n" 1>&2
- exit 1
- fi
-
- chown -R root: "$SOLR_INSTALL_DIR"
- find "$SOLR_INSTALL_DIR" -type d -print0 | xargs -0 chmod 0755
- find "$SOLR_INSTALL_DIR" -type f -print0 | xargs -0 chmod 0644
- chmod -R 0755 "$SOLR_INSTALL_DIR/bin"
-else
- echo -e "\nWARNING: $SOLR_INSTALL_DIR already exists! Skipping extract ...\n"
-fi
-
-# create a symlink for easier scripting
-if [ -h "$SOLR_EXTRACT_DIR/$SOLR_SERVICE" ]; then
- echo -e "\nRemoving old symlink $SOLR_EXTRACT_DIR/$SOLR_SERVICE ...\n"
- rm "$SOLR_EXTRACT_DIR/$SOLR_SERVICE"
-fi
-if [ -e "$SOLR_EXTRACT_DIR/$SOLR_SERVICE" ]; then
- echo -e "\nWARNING: $SOLR_EXTRACT_DIR/$SOLR_SERVICE is not symlink! Skipping symlink update ...\n"
-else
- echo -e "\nInstalling symlink $SOLR_EXTRACT_DIR/$SOLR_SERVICE -> $SOLR_INSTALL_DIR ...\n"
- ln -s "$SOLR_INSTALL_DIR" "$SOLR_EXTRACT_DIR/$SOLR_SERVICE"
-fi
-
-# install init.d script
-echo -e "\nInstalling /etc/init.d/$SOLR_SERVICE script ...\n"
-cp "$SOLR_INSTALL_DIR/bin/init.d/solr" "/etc/init.d/$SOLR_SERVICE"
-chmod 0744 "/etc/init.d/$SOLR_SERVICE"
-chown root: "/etc/init.d/$SOLR_SERVICE"
-# do some basic variable substitution on the init.d script
-sed_expr1="s#SOLR_INSTALL_DIR=.*#SOLR_INSTALL_DIR=\"$SOLR_EXTRACT_DIR/$SOLR_SERVICE\"#"
-sed_expr2="s#SOLR_ENV=.*#SOLR_ENV=\"/etc/default/$SOLR_SERVICE.in.sh\"#"
-sed_expr3="s#RUNAS=.*#RUNAS=\"$SOLR_USER\"#"
-sed_expr4="s#Provides:.*#Provides: $SOLR_SERVICE#"
-sed -i -e "$sed_expr1" -e "$sed_expr2" -e "$sed_expr3" -e "$sed_expr4" "/etc/init.d/$SOLR_SERVICE"
-
-# install/move configuration
-if [ ! -d /etc/default ]; then
- mkdir /etc/default
- chown root: /etc/default
- chmod 0755 /etc/default
-fi
-if [ -f "$SOLR_VAR_DIR/solr.in.sh" ]; then
- echo -e "\nMoving existing $SOLR_VAR_DIR/solr.in.sh to /etc/default/$SOLR_SERVICE.in.sh ...\n"
- mv "$SOLR_VAR_DIR/solr.in.sh" "/etc/default/$SOLR_SERVICE.in.sh"
-elif [ -f "/etc/default/$SOLR_SERVICE.in.sh" ]; then
- echo -e "\n/etc/default/$SOLR_SERVICE.in.sh already exist. Skipping install ...\n"
-else
- echo -e "\nInstalling /etc/default/$SOLR_SERVICE.in.sh ...\n"
- cp "$SOLR_INSTALL_DIR/bin/solr.in.sh" "/etc/default/$SOLR_SERVICE.in.sh"
- echo "SOLR_PID_DIR=\"$SOLR_VAR_DIR\"
-SOLR_HOME=\"$SOLR_VAR_DIR/data\"
-LOG4J_PROPS=\"$SOLR_VAR_DIR/log4j.properties\"
-SOLR_LOGS_DIR=\"$SOLR_VAR_DIR/logs\"
-SOLR_PORT=\"$SOLR_PORT\"
-" >> "/etc/default/$SOLR_SERVICE.in.sh"
-fi
-chown root: "/etc/default/$SOLR_SERVICE.in.sh"
-chmod 0644 "/etc/default/$SOLR_SERVICE.in.sh"
-
-# install data directories and files
-mkdir -p "$SOLR_VAR_DIR/data"
-mkdir -p "$SOLR_VAR_DIR/logs"
-if [ -f "$SOLR_VAR_DIR/data/solr.xml" ]; then
- echo -e "\n$SOLR_VAR_DIR/data/solr.xml already exists. Skipping install ...\n"
-else
- cp "$SOLR_INSTALL_DIR/server/solr/solr.xml" "$SOLR_VAR_DIR/data/solr.xml"
-fi
-if [ -f "$SOLR_VAR_DIR/log4j.properties" ]; then
- echo -e "\n$SOLR_VAR_DIR/log4j.properties already exists. Skipping install ...\n"
-else
- cp "$SOLR_INSTALL_DIR/server/resources/log4j.properties" "$SOLR_VAR_DIR/log4j.properties"
- sed_expr="s#solr.log=.*#solr.log=\${solr.solr.home}/../logs#"
- sed -i -e "$sed_expr" "$SOLR_VAR_DIR/log4j.properties"
-fi
-chown -R "$SOLR_USER:" "$SOLR_VAR_DIR"
-find "$SOLR_VAR_DIR" -type d -print0 | xargs -0 chmod 0750
-find "$SOLR_VAR_DIR" -type f -print0 | xargs -0 chmod 0640
-
-# configure autostart of service
-if [[ "$distro" == "RedHat" || "$distro" == "SUSE" ]]; then
- chkconfig "$SOLR_SERVICE" on
-else
- update-rc.d "$SOLR_SERVICE" defaults
-fi
-
-# start service
-service "$SOLR_SERVICE" start
-sleep 5
-service "$SOLR_SERVICE" status
-
-echo "Service $SOLR_SERVICE installed."
Prerequisites
=============
-* lui-solr is based on Solr 5.x, which requires Java 7. The package
+* masterkey-lui-solr5 is based on Solr 5.x, which requires Java 7. The package
depends on openjdk-7-jdk.
+* masterkey-lui-solr6 is based on Solr 6.x, which requires Java 8. The package
+depends on openjdk-8-jdk, available on backports for
+jessie. openjdk-8-jdk is _not_ available for wheezy. To install
+masterkey-lui-solr6 on wheezy is possible, bu it is outside the scope
+of this document.
+
Pre-installation
================
```
+* For masterkey-lui-solr6 on jessie: Add the backports apt
+repository. Add the following content to /etc/apt/sources.list:
+
+```
+ deb http://ftp.debian.org/debian jessie-backports main
+
+```
+
+And update your package list:
+
+```
+ sudo apt-get update
+
+```
+
* Masterkey LUI stores its Solr indexes by default in
/var/lib/masterkey/lui/solr. Ensure this partition is large enough to
accomodate your Solr indexes.
default on port 8983, and processes and files are owned by the
"lui-solr" user.
-* Install the masterkey-lui-solr5 package:
+* Install the masterkey-lui-solr5 or masterkey-lui-solr6 package:
```
- sudo apt-get install masterkey-lui-solr5
+ sudo apt-get install <masterkey-lui-solr5|masterkey-lui-solr6>
```
### Prerequisites
-* lui-solr is a repackaging of Solr 5.x, which requires Java 7
+* lui-solr is a repackaging of Solr 6.x, which requires Java 8
### Installation
controlled from the 'solr-<version>/bin/solr' script. Examples:
```
- $ solr-5.5.1/bin/solr start
- $ solr-5.5.1/bin/solr stop
+ $ solr-6.1.0/bin/solr start
+ $ solr-6.1.0/bin/solr stop
```
-The masterkey-lui-solr5 package contains a number of changes from the
-masterkey-lui-solr4 family of packages. The good news is that
-**indexes created with masterkey-lui-solr4 are compatible with
-masterkey-lui-solr5**.
+The masterkey-lui-solr5/masterkey-lui-solr6 packages contain a number
+of changes from the masterkey-lui-solr4 family of packages. The good
+news is that **indexes created with masterkey-lui-solr4 are compatible
+with masterkey-lui-solr5**.
-That said, the move to Solr 5 requires significant changes to
+That said, the move to Solr 5/6 requires significant changes to
schema.xml and to solrconfig.xml, so older versions of those files are
not compatible. Any customizations will need to be backported into
those files. Also, because of the schema and solrconfig
-incompatibilities, Solr 4- and Solr 5-based installations cannot be in
-a replication relationship together (master-slave pairs must be all
-Solr 4 or all Solr 5).
+incompatibilities, Solr 4- and Solr 5/6-based installations cannot be
+in a replication relationship together (master-slave pairs must be all
+Solr 4 or all Solr 5/6).
Major Changes
=============
-* masterkey-lui-solr5 is based on Solr 5, which does not require a
- separate Java servlet container. That simplifies packaging and
- installation significantly, as there is no longer any need for
- Tomcat integration. There is only one package to install,
- masterkey-lui-solr5.
-
-* masterkey-lui-solr5 is installed as a separate service, since it no
- longer runs under Tomcat. The service name is "lui-solr", and files
- and processes are owned by the "lui-solr" user (created as part of
- the package installation).
-
-* The default port for masterkey-lui-solr5 is the same as the Solr 5
- default port, 8983, to prevent conflicts when upgrading a lui-solr
- installation that is on the same system as a MasterKey Harvester
- installation (which runs by default under Tomcat on port 8080). This
- may require changes to Harvester datasource settings and/or search
- target settings for existing installations. The Solr port can be set
- by the user in the configuration file
- /etc/masterkey/lui/solr/lui-solr.in.sh (look for the SOLR_PORT variable).
-
-* Solr 5 no longer has the feature of serving up a default core
- ("collection1") on the root of the web
- application. The masterkey-lui-solr5 installs a default core named
- "lui", addressable at http://localhost:8983/solr/lui. This may also
- require changes to Harvester and search target settings.
+* masterkey-lui-solr5/masterkey-lui-solr6 are based on Solr 5/6, which
+ do not require a separate Java servlet container. That simplifies
+ packaging and installation significantly, as there is no longer any
+ need for Tomcat integration. There is only one package to install,
+ masterkey-lui-solr5 or masterkey-lui-solr6.
+
+* masterkey-lui-solr5/masterkey-lui-solr6 are installed as a separate
+ service, since they no longer runs under Tomcat. The service name is
+ "lui-solr", and files and processes are owned by the "lui-solr" user
+ (created as part of the package installation).
+
+* The default port for masterkey-lui-solr5/masterkey-lui-solr6 is the
+ same as the Solr default port, 8983, to prevent conflicts when
+ upgrading a lui-solr installation that is on the same system as a
+ MasterKey Harvester installation (which runs by default under Tomcat
+ on port 8080). This may require changes to Harvester datasource
+ settings and/or search target settings for existing
+ installations. The Solr port can be set by the user in the
+ configuration file /etc/masterkey/lui/solr/lui-solr.in.sh (look for
+ the SOLR_PORT variable).
+
+* Solr 5/6 no longer have the feature of serving up a default core
+ ("collection1") on the root of the web application. The
+ masterkey-lui-solr packages install a default core named "lui",
+ addressable at http://localhost:8983/solr/lui. This may also require
+ changes to Harvester and search target settings.
* Cores are defined in the /etc/masterkey/lui/solr/solr-home
directory. Indexes are stored by default in
masterkey-lui-solr4-master-tomcat8, and
masterkey-lui-solr4-slave-tomcat8
-5. Install the masterkey-lui-solr5 package using the instructions in
- debian-install.md.
+5. Install the masterkey-lui-solr5 or the masterkey-lui-solr6 package
+ using the instructions in debian-install.md.
6. Make any updates necessary to the configuration files in
/etc/masterkey/lui/solr and restart the lui-solr service. You should be
able to point to your existing index by editing
/etc/masterkey/lui/solr/solr-home/lui/solrconfig.xml and altering the
entry for `<dataDir>`.
+