How to Install Apache Solr on Ubuntu 16.04

r00t December 21, 2017

Install Apache Solr on Ubuntu 16.04

In this tutorial we will show you how to install Apache Solr on Ubuntu 16.04. We will also install and configure its prerequisites. Apache Solr is a free, open-source, and popular enterprise search platform built on Apache Lucene. It allows you to create custom search engines that index files, databases, and websites. Solr is specially designed for scalability and fault tolerance. Solr provides lots of features such as distributed indexing, replication, load balancing, automated failover and recovery, and centralized configuration management.

I recommend to use a minimal Ubuntu server setup as a basis for the tutorial, that can be a virtual or a root server image with an Ubuntu 16.04 minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.

Install Apache Solr on Ubuntu 16.04

Step 1. First, ensure your system and apt package lists are fully up-to-date by running the following:

apt-get update -y
apt-get upgrade -y

Step 2. Installing Java.

Apache Solr is written in Java application, so Java runtime environment needs to be installed:

apt install python-software-properties
add-apt-repository ppa:webupd8team/java

We will install the latest version of Oracle Java 8:

apt-get update -y
apt-get install oracle-java8-installer

After installation, you can verify the version by running:

java -version

Step 3. Installing Apache Solr.

First, download the required Solr version from its official site or mirrors:

wget http://www.us.apache.org/dist/lucene/solr/7.1.0/solr-7.1.0.tgz

Extract Apache Solr service installer shell script from the downloaded and run the installer using following command:

tar xzf solr-7.1.0.tgz solr-7.1.0/bin/install_solr_service.sh --strip-components=2
sudo bash ./install_solr_service.sh solr-7.1.0.tgz

Use this command to check the status of the service:

service solr status

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"

In the file: /opt/solr/server/solr/gettingstarted/conf/schema.xml you can find everything you need about the schema’s description.

Step 4. Accesing Apache Solr.

The Apache Solr is now accessible on the default port, which is 8983. The admin UI should be accessible at http://your_server_ip:8983/solr.

Congratulation’s! You have successfully install and configured Apache Solr on your Ubuntu 16.04 server. Thanks for using this tutorial installing Apache Solr on Ubuntu 16.04 LTS (Xenial Xerus) system.

The Tags:

Leave a Comment

Comments are closed.