Home / Server  / Install Apache Solr 5.2.1 on RHEL / CentOs 6 with multicore

Install Apache Solr 5.2.1 on RHEL / CentOs 6 with multicore

solr apache tomcat apache solr

is an Open Source project by Apache Lucene  and a popular enterprise search engine which made in java , It has lots of features like full text searching , hit highlighting, faceted search, real-time indexing, dynamic clustering, database integration etc.

This  Tutorial Document Included three parts as


  1. Install
  2. Set Admin Password
  3. Create cores
  1. Install Solr
  1. For Solr install we should have java compatibility for that install java
[[email protected] ~]# yum install java-1.8.0-openjdk.x86_64

2. Download apache solr 5.2.1

[[email protected] ~]# cd /opt
[[email protected] opt]# wget http://apache.go-parts.com/lucene/solr/5.2.1/solr-5.2.1.tgz &&  tar xvf solr-5.2.1.tgz

Follow the steps to start and stop script for apache solr

#cp /opt/solr-5.2.1/bin/init.d/solr  /etc/init.d/solr

Edit /etc/init.d/solr

#vi /etc/init.d/solr

Change the lines ,Line Number 36

SOLR_INSTALL_DIR=/opt/solr    To    SOLR_INSTALL_DIR=/ opt/solr-5.2.1

search and replace

SOLR_ENV=/var/solr/solr.in.sh    to    SOLR_ENV= /opt/solr-5.2.1/bin/ solr.in.sh

search and replace

RUNAS=solr    to    RUNAS=root

Save and exit

#   chmod 755 /etc/init.d/solr    #   chown root:root /etc/init.d/solr

Add solr for start at boot time

#cd /etc/init.d
#chkconfig --add solr

Allow Solr port in firewall

#iptables -A INPUT -p tcp -m tcp --dport 8983 -j ACCEPT
#service iptables save
  1. Set Admin Password 

1. Go to the apache solr configure directory

#cd /opt/solr-5.2.1/server/etc

Create a file “realm.properties” and add

admin: password, admin-role

  1. Open jetty.xml and add
<Call name="addBean">  <Arg>  <New class="org.eclipse.jetty.security.HashLoginService">  <Set name="name">Solr Realm</Set>  <Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/realm.properties</Set>  <Set name="refreshInterval">0</Set>  </New>  </Arg>  </Call>  

Save and exit

  1. Open webdefault.xml and add
<security-constraint>  <web-resource-collection>  <web-resource-name>Disable TRACE</web-resource-name>  <url-pattern>/</url-pattern>  <http-method>TRACE</http-method>  </web-resource-collection>  <web-resource-collection>  <web-resource-name>Solr authenticated application</web-resource-name>  <url-pattern>/*</url-pattern>  </web-resource-collection>  <auth-constraint>  <role-name>admin-role</role-name>  </auth-constraint>  <auth-constraint/>  <login-config>  <auth-method>BASIC</auth-method>  <realm-name>Solr Realm</realm-name>  </login-config>  </security-constraint>  

Save and exit

Now Star Solr Service

#/etc/init.d/solr start  

Open the browser and access solr with http://your_ip:8983

Now login with your user name and password which you have added in realm.properties , in my case the the user name is “admin” and password is “password”

  1. Create Multiple Cores

You can add multiple cores by the following commands

# cd /opt/solr-5.2.1/  # bin/solr create -c core1  # bin/solr create -c core2  

Thanks for reading this tutorial, if you have any query you can ask in comments

Reference Links:


Review overview
  • Deepak July 11, 2017

    Hello, I m new to redhat. I have redhat RHEL linux box and I m trying to install solr for it should I use custom directory for the same. like “/var/www/html/solr” .


Time limit is exhausted. Please reload CAPTCHA.