Apache Solr is an open-source search platform written on Java. Solr provides full-text search, spell suggestions, custom document ordering and ranking, Snippet generation, and highlighting. This tutorial will help you to install Apache Solr 8.9 on Ubuntu 18.04, 16.04, and 14.04 systems.
Step 1 – Install Java
Apache Solr 7 required Java 8 or greater to run. Make sure your system fulfills the Java requirements of Apache Solr. If you don’t have java installed on your system visit the below articles.
sudo apt install openjdk-11-jdk
Verify active Java version:
java -version openjdk version "11.0.4" 2019-07-16 OpenJDK Runtime Environment (build 11.0.4+11-post-Ubuntu-1ubuntu218.04.3) OpenJDK 64-Bit Server VM (build 11.0.4+11-post-Ubuntu-1ubuntu218.04.3, mixed mode, sharing)
You can also follow this tutorial to install Java on Ubuntu Linux.
Step 2 – Install Apache Solr on Ubuntu
Now download the required Solr version from its official site or mirrors. Or simply use the following command to download Apache Solr 9.0.
wget https://dlcdn.apache.org/solr/solr/9.0.0/solr-9.0.0.tgz
Now extract the Apache Solr service installer shell script from the downloaded Solr archive file and run the installer using the following commands.
tar xzf solr-9.0.0.tgz solr-9.0.0/bin/install_solr_service.sh --strip-components=2 sudo bash ./install_solr_service.sh solr-9.0.0.tgz
Step 3 – Start / Stop Solr Service
Solr is configured as a service on your system. You can simply use the following commands to Start, Stop and check the status of the Solr service.
sudo service solr stop sudo service solr start sudo service solr status
Step 4 – Create First Solr Collection
After the successful installation of Solr on your system. Create the first collection in Apache Solr using the following command.
sudo su - solr -c "/opt/solr/bin/solr create -c mycol1 -n data_driven_schema_configs"
Sample output:
Created new core 'mycol1'
Step 5 – Access Solr Admin Panel
Default Solr runs on port 8983. You can access the Solr port in your web browser using the server IP or domain name pointed to that server and you will get the Solr dashboard.
http://demo.tecadmin.net:8983/
Now, select “MyCol1” under core selector drop down in left sidebar
Here you can view statics of created collection in previous steps named “mycol1”. Click on “Core Selector” on the left sidebar and select created collection.
16 Comments
Could u please tell how to run it in Cloud mode?
I run this code to create core:
sudo su – solr -c “/opt/solr-8.6.2/bin/solr create -c businesses -n data_driven_schema_configs”
It’s working fine but it stopped automatically after sometime, status for solr service is below please advice.
solr.service – LSB: Controls Apache Solr as a Service
Loaded: loaded (/etc/init.d/solr; bad; vendor preset: enabled)
Active: active (exited) since Tue 2020-01-21 16:38:58 UTC; 11h ago
Docs: man:systemd-sysv-generator(8)
Process: 22872 ExecStop=/etc/init.d/solr stop (code=exited, status=1/FAILURE)
Process: 22930 ExecStart=/etc/init.d/solr start (code=exited, status=0/SUCCESS)
Tasks: 0
Memory: 0B
CPU: 0
Jan 21 16:38:49 colab systemd[1]: solr.service: Unit entered failed state.
Jan 21 16:38:49 colab su[22935]: Successful su for solr by root
Jan 21 16:38:49 colab systemd[1]: solr.service: Failed with result ‘exit-code’.
Jan 21 16:38:49 colab su[22935]: + ??? root:solr
Jan 21 16:38:49 colab systemd[1]: Starting LSB: Controls Apache Solr as a Service…
Jan 21 16:38:49 colab su[22935]: pam_unix(su:session): session opened for user solr by (uid=0)
Jan 21 16:38:58 colab solr[22930]: [230B blob data]
Jan 21 16:38:58 colab solr[22930]: Started Solr server on port 8983 (pid=23000). Happy searching!
Jan 21 16:38:58 colab solr[22930]: [14B blob data]
Jan 21 16:38:58 colab systemd[1]: Started LSB: Controls Apache Solr as a Service.
In step 2 you have invalid url, I think you can use this url.
wget https://archive.apache.org/dist/lucene/solr/8.3.1/solr-8.3.1.tgz
Thanks Mykola, Tutorial has been updated
Thanks. I follow your steps and its Working fine
well, I could install it, until that point when I want to use SSL or login for admin as usually for a remote warehouse.. Could you explain that, too on newer Ubuntu and SolR.. 🙂
Great article, used to install solr 8.1.1 on ubuntu 16.04. But I cant open the examples provided.What should I follow?
Nice and clear. Thanks. Works fine with Solr 8.0.0 too.
Thank you for your article 🙂
Simple article but sweeTech at its best.
Thanks and Be blessed by the Divine.
Ganesh
Excellent guide! Thank you
Nice Article .. I have followed it working fine for me. now one doubt is after the creation of core will I have to create a schema.xml file .?? if yes then which location it will place.?? and how schema.xml will configure with solr .
I am very new in Solr if possible please let me know.
great 🙂
Nice article, Thank for the one.
I followed this guide and it worked. However, it didn’t say so directly in the text, but this will install Solr as a service that auto-starts when you (re)boot Ubuntu. I’m just saying, because I had a doubt and actually went and rebooted my Ubuntu server just to test if it would.