16.7 C
Texas
angeloma
Senior Writer and partner

How to install Solr on Ubuntu 18.04

Apache Solr is a standalone enterprise search server with a REST-like API. its an opensource search platform written on Java You put documents in it (called “indexing”) via JSON, XML, CSV or binary over HTTP. You query it via HTTP GET and receive JSON, XML, CSV or binary results.

How to install Solr Apache Server on Ubuntu 18.04 ?

1- Requirements;

Please ensure  that  Java has been installed, openJDK is Ok, but also you use java from Oracle  Install  Java

#apt install  java
- Advertisement -

Check Java version Installed

# java -version
openjdk version “11-ea” 2018-09-25
OpenJDK Runtime Environment (build 11-ea+28)
OpenJDK 64-Bit Server VM (build 11-ea+28, mixed mode, sharing)
[root@osrdarFedora ~]#

2-Download  and   Install  Solr

2.1-Download  the compressed file from Solr Apache site

[root@osrdarFedora ~]# wget http://apache.40b.nl/lucene/solr/7.5.0/solr-7.5.0.tgz
--2018-11-28 02:37:18-- http://apache.40b.nl/lucene/solr/7.5.0/solr-7.5.0.tgz
Resolving apache.40b.nl (apache.40b.nl)... 83.128.155.233
Connecting to apache.40b.nl (apache.40b.nl)|83.128.155.233|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 168429358 (161M) [application/x-gzip]
Saving to: ‘solr-7.5.0.tgz’

solr-7.5.0.tgz 100%[==================================================================================================================>] 160.63M 7.30MB/s in 24s

2018-11-28 02:37:44 (6.74 MB/s) - ‘solr-7.5.0.tgz’ saved [168429358/168429358]

[root@osrdarFedora ~]#

2.2-Extract  and Install The file

[root@osrdarFedora ~]# tar xzf solr-7.5.0.tgz solr-7.5.0/bin/install_solr_service.sh --strip-components=2
[root@osrdarFedora ~]# ls
anaconda-ks.cfg install_solr_service.sh original-ks.cfg solr-7.5.0.tgz

 

[root@osrdarFedora ~]# bash ./install_solr_service.sh solr-7.5.0.tgz
id: ‘solr’: no such user
Creating new user: solr

Extracting solr-7.5.0.tgz to /opt

Installing symlink /opt/solr -> /opt/solr-7.5.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
*** [WARN] *** Your open file limit is currently 1024.
It should be set to 65000 to avoid operational disruption.
If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh
*** [WARN] *** Your Max Processes Limit is currently 8444.
It should be set to 65000 to avoid operational disruption.
If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh
Waiting up to 180 seconds to see Solr running on port 8983 [/]
Started Solr server on port 8983 (pid=28458). Happy searching!

Found 1 Solr nodes:

Solr process 28458 running on port 8983
INFO - 2018-11-28 02:42:25.929; org.apache.solr.util.configuration.SSLCredentialProviderFactory; Processing SSL Credential Provider chain: env;sysprop
{
"solr_home":"/var/solr/data",
"version":"7.5.0 b5bf70b7e32d7ddd9742cc821d471c5fabd4e3df - jimczi - 2018-09-18 13:07:55",
"startTime":"2018-11-28T10:41:40.134Z",
"uptime":"0 days, 0 hours, 0 minutes, 48 seconds",
"memory":"46.9 MB (%9.6) of 490.7 MB"}

[root@osrdarFedora ~]#

 

 3-Manage Solr Service

Please Use the following commands to Start, Stop and check the status of Solr

For Systemd Users – and Systemd users.

sudo systemctl stop solr
sudo systemctl start solr 
sudo systemctl status solr 
sudo systemctl enable solr
sudo systemctl restart solr 
sudo systemctl status solr 

Firewall   Confuration

The Solr port is 8983. please ensure that the port is running and reachable thru the firewall.

Example 1
Open incoming TCP port 8983 to any source IP address:

$ sudo ufw allow from any to any port 8983 proto tcp

Example 2
Open incoming TCP port 8983 to only specific source IP address eg. 192.168.1.111:

$ sudo ufw allow from 192.168.1.111 to any port 8983 proto tcp

4-Create  Collection  :

Create your first collection using the following command.  you may change the name to  something you like.

[root@osrdarFedora ~]# su - solr -c "/opt/solr-7.5.0/bin/solr create -c osradarcol1 -n data_driven_schema_configs"
INFO - 2018-11-28 03:50:27.463; org.apache.solr.util.configuration.SSLCredentialProviderFactory; Processing SSL Credential Provider chain: env;sysprop

Created new core 'osradarcol1'
[root@osrdarFedora ~]#

Step 5 –  Solr Web Admin Panel

The access to the Admin panel have no credentials needed.  only  point your browser to http://ip:8983   or http://host:8983

and Enjoy

 

 

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article