An Easy Way to Install Solr 6.x on a Linux Server
In this tutorial we will install Solr 6.6.4 on a CentOS server. This is quite simple as now Solr comes with a cool automated installation script, it detects the OS and eventually creates the solr user for the daemon.
Note: Before getting started make sure that you have root/sudo access to your server.
What is Solr?
Solr is highly reliable, scalable and fault tolerant, providing distributed indexing, replication and load-balanced querying, automated failover and recovery, centralized configuration and more. Solr powers the search and navigation features of many of the world's largest internet sites. For more information you can take a look at the Solr official website at:
Choosing your Solr version
You can get the exact Solr version that you need from the Apache.org archive at:
In my case I would go with 6.6.4:
1. First let's start with installing Java:
yum install java-1.8.0-openjdk
Check your Java version like this:
java -version openjdk version "1.8.0_171" OpenJDK Runtime Environment (build 1.8.0_171-b10) OpenJDK 64-Bit Server VM (build 25.171-b10, mixed mode)
2. You would also need to install lsof as this script needs it to determine if Solr is listening on a specific port.
yum install lsof
3. After that we need the Solr installation files from:
4. Extracted the files:
tar -xzvf solr-6.6.4.tgz
5. Then run the cool Solr installation script, it detect the OS and eventually creates the solr user for the daemon:
cd solr-6.6.4/bin # Note specify the path to your Solr source files that you've just downloaded ./install_solr_service.sh ../../solr-6.6.4.tgz
You would get the following output:
Also here's how to install the MySQL connector incase you need it.
First download the required version:
wget http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.31.tar.gz # Extract it: tar -xzvf mysql-connector-java-5.1.31.tar.gz # symlink the connector to the solr directory ln -s /opt/mysql-connector-java/mysql-connector-java-5.1.31-bin.jar /opt/solr/dist/mysql-connector-java.jar
This is pretty much it, now Solr should be installed at /opt/solr. You should also now have a startup script that you could use to start/stop/restart the solr service:
As a good practice I would suggest locking the Solr port via your firewall so that only you could access it directly.
If you want to learn more about Solr I would strongly recommend this book here:
As always feel free to reach out to me at any time :)