How To Deploy Apache Solr Enterprise Search Platform on Ubuntu Server 22.04
If you have huge amounts of data to search for, Apache Solr might be just what you need. Jack Wallen shows you how to deploy this useful tool.
Apache Solr is an open-source search platform that can perform full-text search, result highlighting, faceted search, real-time indexing, dynamic clustering and includes database integration, rich document management and a friendly web user interface. If you have massive amounts of data to search for, this tool might be just what you need. Apache Solor is optimized for high traffic, highly scalable, and fault tolerant.
TO SEE: Recruitment Kit: Database Engineer (TechRepublic Premium)
I want to walk you through the simple steps of installing and running Apache Solr on an Ubuntu Server 22.04 (Jammy Jellyfish) instance.
What you will need
To successfully install Apache Solr, you will need a running instance of Ubuntu Server 22.04 and a user with sudo privileges. Of course, you can install Apache Solr on different Linux distributions, but we’ll focus on my server of choice.
That said, let’s get to the installation.
How to Install Apache Solr
Connect to your Ubuntu Server instance and install Java with the command:
sudo apt-get install default-jdk -y
Once Java is installed, download Apache Solr with:
Be sure to visit the Apache Solr download page to make sure you are downloading the latest version of the app.
Once the package is downloaded, extract it with:
tar -xvzf solr-8.11.1.tgz
The newly created directory includes a handy installer script that will take care of almost everything for you. To run this script, run the command:
sudo ./solr-8.11.1/bin/install_solr_service.sh solr-8.11.1.tgz
Once the script is complete, start and enable Apache Solr with:
sudo systemctl enable --now solr
How to create a collection
Now we need to create a collection that can be used to house your data. Before doing this, however, we need to create a password for the solr user that was added when running the install script. To do this, run the command:
sudo passwd solr
You will be prompted to enter and verify a new password for the user.
Now we can create the collection with the command:
su - solr -c "/opt/solr/bin/solr create -c datacollection -n data_driven_schema_configs"
You will be prompted to enter the new password you just created for the solr user.
Once this creation is complete, let’s add some sample data to our collection with the command:
./bin/post -c datacollection example/exampledocs/*
You are now ready to access the web interface.
How to Access Apache Solr Web Interface
Open a web browser and point it to http://SERVER:8983. In the Core Selector drop-down list (Figure A), select datacollection (which we just created).
After selecting data collection, you should end up on the overview, where you can see that we have already included data. You can then search for this data by clicking Query, changing any of the options, and clicking Run Query (Figure B).
Congratulations, you have successfully installed Apache Solr, created a new data collection, added sample data, and run a query against the data.
Subscribe to TechRepublic How to make technology work on YouTube for all the latest tech tips for professionals from Jack Wallen.