Skip to content

Building Apache Solr

aborkar-ibm edited this page Feb 16, 2021 · 60 revisions

Building Apache Solr

General Notes:

  • When following the steps below, please use a standard permission user unless otherwise specified.

  • A directory /<source_root>/ will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it.

Apache Solr binaries are available and can be downloaded from here. To use these binaries, different Java flavors can be installed on mentioned distributions.

Step 1: Install Dependencies

export SOURCE_ROOT=/<source_root>/
  • RHEL (7.8, 7.9, 8.1, 8.2, 8.3)

    • With OpenJDK 11

      sudo yum install -y git java-11-openjdk tar wget lsof
    • With AdoptOpenJDK 11

      sudo yum install -y git tar wget lsof
      • Download and install AdoptOpenJDK 11 (with HotSpot or OpenJ9) from here.
  • SLES (12 SP5, 15 SP2)

    • With OpenJDK 11

      sudo zypper install -y --auto-agree-with-licenses git java-11-openjdk tar wget gzip gawk lsof
    • With AdoptOpenJDK 11

      sudo zypper install -y git tar wget gzip gawk lsof
      • Download and install AdoptOpenJDK 11 (with HotSpot or OpenJ9) from here.
  • Ubuntu (18.04, 20.04, 20.10)

    • With OpenJDK 11

      sudo apt-get update	
      sudo apt-get install -y ant git tar wget lsof openjdk-11-jdk
    • With AdoptOpenJDK 11

      sudo apt-get update
      sudo apt-get install -y ant git tar wget lsof
      • Download and install AdoptOpenJDK 11 (with HotSpot or OpenJ9) from here.

Note: At the time of creation of these build instructions, Apache Solr 8.8.0 was verified with OpenJDK 11 (build 11.0.10+9-LTS) on RHEL, OpenJDK 11 (build 11.0.10+9-Ubuntu-0ubuntu1) on Ubuntu, OpenJDK 11 (build 11.0.10+9-suse-3.53.1) on SLES 15 SP2, OpenJDK 11 (build 11.0.10+9-suse-3.18.2) on SLES 12 SP5, AdoptOpenJDK 11 with HotSpot (build 11.0.10+9) and AdoptOpenJDK 11 with OpenJ9 (build 11.0.10+9, openj9-0.24.0).

Step 2 : Set Environment Variables

  • Set JAVA_HOME and PATH

    export JAVA_HOME=<Path to Java>
    export PATH=$JAVA_HOME/bin:$PATH

Step 3: Verification

3.1) Start Solr and create a core

Extract Apache Solr binary tar to $SOURCE_ROOT and follow steps given below.

cd $SOURCE_ROOT/<Apache_Solr_binary_folder>/bin
sudo chmod a+x solr
./solr start
./solr create -c sample

3.2) Expected Output

The./solr start command will start the Solr server on port 8983. The ./solr create -c sample command should create a core and output:

Created new core 'sample'

Access the Solr Admin Console at: http://HOST_IP:8983/solr/

References:

Apache Solr Homepage - Details of Apache Solr can be found here.

Clone this wiki locally