Install Apache Solr on CentOS 7

16

To install Apache Solr first you need to install Java.

Next, go to Solr Downloads page and download Solr 8.x binary release.

Unpack the downloaded archive (assume you do into /home/sam/solr).

Open the file /home/sam/solr/bin/solr.in.sh for editing.

Find SOLR_JAVA_HOME parameter and set it to JRE directory location. To find its location execute the following:

update-alternatives --config java

You will see the path to Java binary. Copy this path without trailing `/bin/java'. For example, you could see:

/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.222.b10-0.el7_6.x86_64/jre/bin/java

So your SOLR_JAVA_HOME value is:

/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.222.b10-0.el7_6.x86_64/jre

If you're using firewalld and want to reach Solr from the Internet (which you should do only if you have a good reason for that) then update firewalld rules:

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

As you see, by default Solr accepts connections on 8983 port. You can change that by setting different value into SOLR_PORT parameter in solr.in.sh. If you do that then don't forget to update firewalld command as well.

Disable JMX RMI connector if you don't really need it. Open solr/bin/solr.in.sh and change:

ENABLE_REMOTE_JMX_OPTS="false"

If you're going to use Solr with PHP then also install PHP Solr library:

yum install php-solr
Share this page:

See also how to:

How to install Java runtime environment on CentOS 7
How to install PHP FastCGI Process Manager (FPM) on CentOS 7
How to install PostgreSQL database server on Linux
A very simple steps to install PHP 7 on CentOS 7
How to install MySQL database server on CentOS 7