Install and Configure Apache Solr on CentOS 7

Table of Contents


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.

In this tutorial, we will learn how to install and do some basic configuration of Apache Solr on CentOS 7.


  • A server running CentOS 7.
  • A non-root user with sudo privilege setup on your server.

Installing Java

Before starting, update your system with the latest versions of installed packages.

sudo yum update

You will need to install the latest version of Java on your server as Java is a prerequisite for installing Solr.

To install Java, run the following command:

sudo yum install java-1.8.0-openjdk.x86_64

Once Java is installed, you can verify it by running the following command:

sudo java -version


openjdk version "1.8.0_111"
OpenJDK Runtime Environment (build 1.8.0_111-b15)
OpenJDK 64-Bit Server VM (build 25.111-b15, mixed mode)

Downloading and Installing Apache Solr

First you will need to download the latest version of Apache Solr from the Apache website.

You can easily download it using the wget command:

wget http://apache.org/dist/lucene/solr/6.3.0/solr-6.3.0.tgz

Once the download is completed, extract the service installation file with the following command:

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

Install Solr as a service by running the following command:

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

You should see the following output:

We recommend installing the 'lsof' command for more stable start/stop of Solr

Extracting solr-6.3.0.tgz to /opt

Installing symlink /opt/solr -> /opt/solr-6.3.0 ...

Installing /etc/init.d/solr script ...

Installing /etc/default/solr.in.sh ...

Service solr installed.
Customize Solr startup configuration in /etc/default/solr.in.sh
NOTE: Please install lsof as this script needs it to determine if Solr is listening on port 8983.

Started Solr server on port 8983 (pid=6426). Happy searching!

Found 1 Solr nodes:

Solr process 6426 running on port 8983
 "version":"6.3.0 a66a44513ee8191e25b477372094bfa846450316 - shalin - 2016-11-02 19:52:42",
 "uptime":"0 days, 0 hours, 0 minutes, 18 seconds",
 "memory":"85.4 MB (%17.4) of 490.7 MB"}

You can start|stop|restart the Solr service with the following commands:

sudo service solr start
sudo service solr stop
sudo service solr restart

Allow Solr through Firewall

By default Solr listens on port 8983, so you will need to allow this port through firewall.

You can do this by running the following command:

sudo firewall-cmd --zone=public --add-port=8983/tcp --permanent
sudo firewall-cmd --reload

Accessing Solr Web Interface

Now that we have enabled access through the firewall, it is time to access Solr web interface.

Open your web browser and type the URL http://your-server-ip:8983/solr. You should see the Solr dashboard as below:

Apache Solr Dashboard

Securing Solr Admin Page

By default the Apache Solr server admin pages are left unprotected. It is recommended that you secure it with a password.

To do so, you will need to modify webdefault.xml file:

sudo nano /opt/solr/server/etc/webdefault.xml

Add the following lines before <web-app>:


        <web-resource-name>Secure resources</web-resource-name>

Create a samplerealm.txt file:

sudo nano /opt/solr/server/etc/samplerealm.txt

Add the following lines:

admin: admin@123,user

This sets admin as your username, admin@123 as the password and user as the role which you have defined in webdefault.xml file.

Next you will also need to modify jetty.xml file:

sudo nano /opt/solr/server/etc/jetty.xml

Find the section <Configure id="Server" class="org.eclipse.jetty.server.Server"> and add the following lines of code below it:

<Call name="addBean">
    <New class="org.eclipse.jetty.security.HashLoginService">
     <Set name="name">samplerealm</Set>
     <Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/samplerealm.txt</Set>
     <Set name="refreshInterval">0</Set>

Save the file and restart the Solr service.

sudo service solr restart

Open your web browser and type the URL http://your-server-ip:8983/solr, it will ask you for credentials. Provide admin as your username and admin@123 as a password. You can also change the username and password as you wish by editing the samplerealm.txt file.


In this tutorial we have demonstrated how to install Solr on a CentOS 7 server. Feel free to comment below if you have any questions or ran into issues following the tutorial.

  • Hi Hitesh

    After follow step for "Securing Solr Admin Page" ..solr admin page is not accessible it give error like "HTTP ERROR: 503 Problem accessing /solr/. Reason: Service Unavailable.

  • The currently defined JAVA_HOME (/usr/local/jdk) refers to a location where Java could not be found. Aborting. Either fix the JAVA_HOME variable or remove it from the environment so that the system PATH will be searched.

  • i have probloem same as pdpatel.er issue. after change all file and restart the service solr still stop.

    i use update yum, then check java version that are 1.8... but when i want to service solr start after 180sec show this error:


    [root@server1 ~]# service solr stop

    No process found for Solr node running on port 8983

    [root@server1 ~]# service solr start

    Warning: Available entropy is low. As a result, use of the UUIDField, SSL, or any other features that require RNG might not work properly. To check for the amount of available entropy, use 'cat /proc/sys/kernel/random/entropy_avail'.

    Waiting up to 180 seconds to see Solr running on port 8983 [|] Still not seeing Solr listening on 8983 after 180 seconds!

    2017-12-04 14:42:45.175 WARN (main) [ ] o.e.j.x.XmlConfiguration Config error at < Arg name="threadpool">

    <New id="threadpool" class="com.codahale.metrics.jetty9.InstrumentedQueuedThreadPool"><Arg name="registry">
        <Call id="solrJettyMetricRegistry" name="getOrCreate" class="com.codahale.metrics.SharedMetricRegistries"><Arg>solr.jetty</Arg></Call>



  • A tutorial is installed for the happiness and entertainment of the people. The motive of the tutorial and british assignments help is assigned for the motivating elements for the help of the individuals.

Log In, Add a Comment