Install Apache Solr on CentOS 7


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/ 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:


So your SOLR_JAVA_HOME value is:


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 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/ and change:


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

yum install php-solr
Rate this post:
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