TEQ

Tech Docs

Apache Solr installation and configuration

Install Apache Solr

Step 1:

We will start by installing java. So you have to use the following command to start by installing python software properties:

sudo apt-get install python-software-properties

Now we will install the 8th version of java instead of using the default-jdk or default-jre packages. Start by using the following command and later press the enter key to accept the act of adding the new repository to your index:

sudo add-apt-repository ppa:webupd8team/java

And use the following command to update the list source :

sudo apt-get update

And to install Java 8 we will use the apt-get command. It is required to accept the Oracle Binary Code License Agreement for the java SE Platform Products and JavaFX.

sudo apt-get install oracle-java8-installer

Now you have installed the 8th version of java we will move to the next step.

Step 2:

We start this section by downloading the Solr distribution. Select the link where you will install your Solr and use the following commands to make the download:

cd ~ wget http://archive.apache.org/dist/lucene/solr/8.0.0/solr-8.0.0.tgz

Note: If you need to install any other versions, browse all versions from apache archive http://archive.apache.org/dist/lucene/solr/

Then use the following command to extract the service installation file:

tar xzf solr-8.0.0.tgz solr-8.0.0/bin/install_solr_service.sh --strip-components=2

And use the following command to install Solr as a service:

sudo bash ./install_solr_service.sh solr-8.0.0.tgz

you can check if the server is working using the following command:

sudo service solr status

You will receive something like this:

Found 1 Solr nodes:

Solr process 2750 running on port 8983

. . .

Step 3:

Now we will create a solr collection. You can have more than one, in this tutorial we need to have just one. To do, you have to use the following commands:

sudo su - solr -c "/opt/solr/bin/solr create -c gettingstarted -n data_driven_schema_configs"

Now you can add the data after creating the collection. In the file: /opt/solr/server/solr/gettingstarted/conf/schema.xml you can find everything you need about the schema’s description.