How to Install Apache Solr on Ubuntu Linux
This post helps you install Apache Solr on Ubuntu Linux. Apache Solr is a fast, open-source search tool. It helps you search through large amounts of data quickly.
Why use Solr? It is great for building search features in apps. It handles complex searches like wildcards and grouping at a large scale.
What happens when done? You will have a working search engine running on your server, ready to index your data and provide results via a web interface.
How to download and install Apache Solr on Ubuntu Linux
Solr runs on Java. You need a modern version for the best performance and security. We recommend using OpenJDK 17 or 21.
Run these commands to install OpenJDK:
sudo apt update
sudo apt install openjdk-21-jdk
Check the version to make sure it is ready:
java --version
Next, visit the %%LNK0%% official Apache Solr download mirror to get the latest stable version (e.g., 9.8.x). Download the file using wget and the link you found.
Extract the installation script from the downloaded file:
tar xzf solr-9.8.0.tgz solr-9.8.0/bin/install_solr_service.sh --strip-components=2
Now, run the installation script. This uses the official systemd service integration to keep Solr running smoothly:
sudo bash ./install_solr_service.sh solr-9.8.0.tgz
This creates a user named solr and sets up the service. You can manage the service with these commands:
sudo systemctl stop solr
sudo systemctl start solr
sudo systemctl status solr
To create a new search collection, run this command:
sudo su - solr -c "/opt/solr/bin/solr create -c mycollection"
By default, Solr only talks to the local machine. To allow remote access, edit the configuration file:
sudo nano /etc/default/solr.in.sh
Find the line for SOLR_JETTY_HOST and change it to:
SOLR_JETTY_HOST="0.0.0.0"
Save and close the file. Now, update your firewall to allow traffic on port 8983:
sudo ufw allow 8983/tcp
Restart the service to apply your changes:
sudo systemctl restart solr
Finally, open your web browser and go to http://your-server-ip:8983/ to see the admin console.

That is all you need to do to get started!
Conclusion
Apache Solr is a powerful tool for searching data. By installing it on Ubuntu with a modern Java runtime and proper firewall settings, you have a secure and fast search engine ready for your projects.
[1] [4949] [4949] [1]
Was this guide helpful?
Leave a Reply Cancel reply