In this tutorial we’ll learn how to install Apache Solr on CentOS 7. 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 CentOS server setup as a basis for the tutorial, that can be a virtual or a root server image with an CentOS 7 minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.
Install Apache Solr on CentOS 7
Step 1. First, ensure your system is fully up-to-date by running the following:
yum -y update
Step 2. Installing Java.
Install the latest available version of Java on your server:
yum install java-1.8.0-openjdk.x86_64
Once Java is installed, you can verify it by running the following command:
Step 3. Installing Apache Solr.
First you will need to download the latest version of Apache Solr from the Apache website:
Extract the service installation file with the following command:
tar xzf solr-7.2.0.tgz solr-7.2.0/bin/install_solr_service.sh --strip-components=2
Install Solr as a service by running the following command:
bash ./install_solr_service.sh solr-7.2.0.tgz
Use the following commands to Start, Stop and check the status of Solr service:
systemctl stop solr systemctl start solr systemctl status solr
After successful installation of Apache Solr service on your system. Create your first collection using the following command:
sudo su - solr -c "/usrlocal/solr/bin/solr create -c rezkia -n data_driven_schema_configs"
Created new core 'rezkia'
Step 4. Configure Apache Solr through Firewall.
By default Apache Solr listens on port 8983, so you will need to allow this port through firewall:
firewall-cmd --zone=public --add-port=8983/tcp --permanent firewall-cmd --reload
Step 5. 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 CentOS 7 server. Thanks for using this tutorial for installing Apache Solr on CentOS 7 system.