Apache Solr is an open source, fault-tolerant and highly scalable search tool written in Java. Apache Solr powers the search and navigation features of many of the world’s largest internet sites. 

Step 1: Install Java

Apache Solr requires Java. If somehow you don’t have Java installed on your system, install it as shown below.

Install Java on CentOS 7:

sudo yum install lsof java-1.8.0-openjdk  java-1.8.0-openjdk-devel
java -version

Step 2: Install Latest Apache Solr on CentOS 7

Apache Solr is not available on CentOS & Fedora upstream repositories, you have to download it and do a manual installation. You can check the latest release of Apache Solr then save it to the LATEST_VERvariable.

export LATEST_VER="8.4.1"
curl -O https://www-eu.apache.org/dist/lucene/solr/${LATEST_VER}/solr-${LATEST_VER}.tgz

Extract the archive downloaded:

tar xvf solr-${LATEST_VER}.tgz

Now run the Apache Solr service installer script to setup Solr environment.

cd solr-${LATEST_VER}/bin/
sudo ./install_solr_service.sh ~/solr-${LATEST_VER}.tgz

Sample output:

id: 'solr': no such user
Creating new user: solr
Adding system user `solr' (UID 111) ...
Adding new group `solr' (GID 116) ...
Adding new user `solr' (UID 111) with group `solr' ...
Creating home directory `/var/solr' ...

Extracting /home/vagrant/solr-8.4.1.tgz to /opt

Installing symlink /opt/solr -> /opt/solr-8.4.1 ...

Installing /etc/init.d/solr script ...

Installing /etc/default/solr.in.sh ...

Service solr installed.
Customize Solr startup configuration in /etc/default/solr.in.sh

The script will install and start Solr service. You can check the status by running:

$ sudo systemctl status solr
● solr.service - LSB: Controls Apache Solr as a Service
   Loaded: loaded (/etc/rc.d/init.d/solr; generated)
   Active: active (running) since Mon 2018-11-19 17:23:44 UTC; 2s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 3027 ExecStart=/etc/rc.d/init.d/solr start (code=exited, status=0/SUCCESS)

Nov 19 17:23:33 fed29 su[3029]: pam_unix(su-l:session): session opened for user solr by (uid=0)
Nov 19 17:23:34 fed29 solr[3027]: *** [WARN] *** Your open file limit is currently 1024.
Nov 19 17:23:34 fed29 solr[3027]:  It should be set to 65000 to avoid operational disruption.
Nov 19 17:23:34 fed29 solr[3027]:  If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh
Nov 19 17:23:34 fed29 solr[3027]: *** [WARN] ***  Your Max Processes Limit is currently 3832.
Nov 19 17:23:34 fed29 solr[3027]:  It should be set to 65000 to avoid operational disruption.
Nov 19 17:23:34 fed29 solr[3027]:  If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh
Nov 19 17:23:34 fed29 solr[3027]: NOTE: Please install lsof as this script needs it to determine if Solr is listening on port 8983.
Nov 19 17:23:44 fed29 solr[3027]: Started Solr server on port 8983 (pid=3103). Happy searching!
Nov 19 17:23:44 fed29 systemd[1]: Started LSB: Controls Apache Solr as a Service.

Ensure the service is set to start on boot.

$ sudo systemctl enable solr
solr.service is not a native service, redirecting to systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable solr

Step 3: Access Solr Dashboard

By default Solr runs on port 8983. If you have an active firewall, allow port 8983.

sudo firewall-cmd  --permanent --add-port=8983/tcp
sudo firewall-cmd --reload

The dashboard should be accessible on the Server IP Address / Hostname and port 8983.

http://<IP|Hostname>:8983

You should get a dashboard similar to one below:


Step 4: Create Solr Collection

You can now create your first Solr collection:

sudo su - solr -c "/opt/solr/bin/solr create -c vivocore -n data_driven_schema_configs"

Where vivocore is the name of the collection to be created.

Sample output:

INFO - 2018-11-18 13:48:05.538; org.apache.solr.util.configuration.SSLCredentialProviderFactory; Processing SSL Credential Provider chain: env;sysprop
Created new core 'vivocore'

The created collections are available on the dashboard from the Collections left panel.


  • No labels