Install Apache Solr on CentOS 8/7 & Fedora 29-26

Cpanel/Whm License $3/mo Plesk License $10/mo Cloudlinux License $5/mo

(: April 26, 2019)

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. In this tutorial, we will look at how to  Install Apache Solr on CentOS 8/7 / Fedora 29-26

Step 1: Install Java

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

Install Java on CentOS 7:

.td_uid_2_5d907afde35bf_rand.td-a-rec-img{text-align:left}.td_uid_2_5d907afde35bf_rand.td-a-rec-img img{margin:0 auto 0 0}
sudo yum install lsof java-1.8.0-openjdk  java-1.8.0-openjdk-devel
java -version

Install Java on Fedora:

$ sudo dnf install java-11-openjdk
OR
$ sudo dnf install java-1.8.0-openjdk  java-1.8.0-openjdk-devel

After the installation of Java, you can quickly confirm the version using the following command:

$ java -version
java version "11.0.1" 2018-10-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)

Step 2: Install Latest Apache Solr on CentOS 7 / Fedora 29 / Fedora 28

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.0.0"
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.0.0.tgz to /opt

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

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 testcollection -n data_driven_schema_configs"

Where testcollection 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 'testcollection'

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

Beginning with Solr 4.4, a detailed reference guide is available online or as a PDF download.

For Ubuntu / Debian refer to Install Latest Apache Solr on Ubuntu/Debian

.td_uid_4_5d907afde380f_rand.td-a-rec-img{text-align:left}.td_uid_4_5d907afde380f_rand.td-a-rec-img img{margin:0 auto 0 0}

Related posts

Linux: AMD Phenom II and AMD Athlon II CPU Change Frequency On All Logical Cores

SXI ADMIN

Brexit Rumors Fail to Boost Market as Bitcoin Price Steady at $420

SXI ADMIN

Blockchain Water Purifier? New China Mobile Appliance Earns You Tokens

SXI ADMIN

After Friday’s SEC Actions, Experts Say ICO Party ‘Is Truly Over’

SXI ADMIN

Hackers Demand $1 Million in XRP After Bank Data Theft

SXI ADMIN

Powerful Windows Apps for Students

SXI ADMIN

Coinbase App Update Enables Mobile Sign Up

SXI ADMIN

Marketplace Lender Blackmoon to Launch Ethereum Token Management Platform

SXI ADMIN

One of Bitcoin’s Biggest Investments Might Finally Be Paying Off

SXI ADMIN

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More