logo-1

How To Install And Configure Apache Solr On Ubuntu 22.04.3?

Searching for information quickly and accurately is necessary in today’s digital age. Apache Solr, an open-source search platform, can help you achieve that. Whether a tech enthusiast or a business owner, learning to install and configure Apache Solr on your Ubuntu 22.04.3 system is valuable.

In this guide, we’ll break down the process into simple steps. No prior expertise is required! By the end of this tutorial, you’ll have Apache Solr up and running on your Ubuntu 22.04.3 system, ready to power your search capabilities.

Let’s begin this journey together, making complex installations a breeze.

Step 1 – Installing Java

Before we dive into setting up Apache Solr on your Ubuntu 22.04.3 system, ensuring that you have Java installed is crucial. Apache Solr 9 requires Java 11 or a more recent version, with Java 17 being the latest tested version. Here’s how to install Java if it’s not already on your system:

sudo apt update && sudo apt install default-jdk

This command updates your package list and installs the default JDK (Java Development Kit). Once the installation is complete, you should check the currently active Java version to verify that everything is set up correctly:

java -version

When you run this command, you should see an output similar to the following:

openjdk version "11.0.15" 2022-04-19

  • OpenJDK Runtime Environment (build 11.0.15+10-Ubuntu-0ubuntu0.22.04.1)
  • OpenJDK 64-Bit Server VM (build 11.0.15+10-Ubuntu-0ubuntu0.22.04.1, mixed mode, sharing)
  • This output confirms that Java has been successfully installed on your Ubuntu 22.04.3 system and is ready to support Apache Solr.

Now that we have Java up and running, let’s proceed to the next steps to install and configure Apache Solr.

Step 2 – Installing Apache Solr on Ubuntu

Now that we’ve ensured Java is installed and ready, it’s time to install Apache Solr on your Ubuntu 22.04.3 system. As of the writing of this tutorial, Apache Solr 9.0 is the latest version available. Follow these steps to install it:

Download Apache Solr 9.0:

To begin, use the following command to download Apache Solr 9.0 to your system:

wget https://dlcdn.apache.org/solr/solr/9.0.0/solr-9.0.0.tgz

This command fetches the Solr archive file from the official Apache Solr download location. If, for any reason, the download fails, you can always visit the Solr download page to obtain the latest version.

Extract Installation Script:

After successfully downloading the archive, extract the Apache Solr service installer shell script with the following command:

tar xzf solr-9.0.0.tgz solr-9.0.0/bin/install_solr_service.sh --strip-components=2

This command extracts the necessary installation script from the Solr archive.

Initiate Solr Installation:

Now, initiate the Apache Solr installation on your Ubuntu system by executing the following command. Ensure that you run this command from the directory where you downloaded the Solr archive:

sudo bash ./install_solr_service.sh solr-9.0.0.tgz

This command installs Apache Solr as a service on your system.

After running the sudo bash ./install_solr_service.sh solr-9.0.0.tgz command to install Apache Solr as a service, you will need to use the following command to start the Solr service:

sudo service solr start

This command will initiate the Solr service, allowing you to access and configure it. You can then proceed with configuring and using Apache Solr on your Ubuntu system.

Step 3 – Managing the Solr Service

Now that Apache Solr is installed and configured as a service on your system, you can easily manage it using a few straightforward commands. These commands allow you to start, stop, and check the status of the Solr service as needed:

Start Solr Service:

To start the Solr service, execute the following command:

sudo systemctl start solr

This command initiates the Solr service, making it accessible for indexing and searching your data.

Stop Solr Service:

If you need to stop the Solr service for any reason, use the following command:

sudo systemctl stop solr

This command gracefully halts the Solr service, temporarily disabling its functions until restarted.

Check the Status of Solr Service:

To verify the status of the Solr service, use the following command:

sudo systemctl status solr

This command provides essential information about the current state of the Solr service, including whether it is active and running without issues.

Step 4 – Creating a New Solr Collection

With Apache Solr successfully installed and the service up and running, you can start working with collections. Collections in Solr are logical containers for your data. Here’s how to create a new Solr collection:

Execute the following command:

sudo su - solr -c "/opt/solr/bin/solr create -c mycol1 -n data_driven_schema_configs"

This command uses the Solr command-line tool to create a new collection named “mycol1” with the configuration “data_driven_schema_configs.”

You should see the following output:

Created new core 'mycol1'

This output confirms that the new Solr collection has been successfully created. You can now start adding documents, defining schemas, and using Solr’s powerful search and indexing capabilities within your new collection.

With these steps completed, you are well on your way to harnessing the full potential of Apache Solr on your Ubuntu system.

Step 5 – Allowing Apache Solr Public Access

By default, Apache Solr runs on the localhost, making it accessible only locally. You must modify the Solr configuration to allow public access to the Solr server over networks. Follow these steps:

Open the Solr configuration file for editing using a text editor (e.g., Vim):

sudo vim /etc/default/solr.in.sh

Look for the SOLR_JETTY_HOST variable within the configuration file. You can locate it by searching for “SOLR_JETTY_HOST.” It might be commented out with a ‘#’ symbol at the beginning of the line.

Uncomment the SOLR_JETTY_HOST variable by removing the ‘#’ symbol and setting its value to “0.0.0.0” to allow Solr to listen on all available network interfaces:

SOLR_JETTY_HOST="0.0.0.0"

Save the changes and exit the text editor.

To apply these configuration changes, restart the Solr service:

sudo systemctl restart solr

To confirm that Apache Solr is now listening on all interfaces, you can check its listening address:

sudo ss -tupln | grep 8983

The output should indicate that Solr listens on all interfaces, as denoted by the asterisk (‘*’).

Step 6 – Accessing the Solr Admin Panel

Now that Apache Solr is configured for public access, you can access its Admin Panel from a web browser. By default, Solr runs on port 8983. Here’s how to access it:

Open your web browser and enter the following URL, replacing “your_server_ip” with your server’s IP address or domain name:

http://your_server_ip:8983/

You should now see the Solr Admin Panel, where you can manage and interact with your Solr collections.

To access the collection you created earlier (“mycol1”), use the “Core Selector” in the left sidebar. Click “Core Selector” and select “mycol1” from the list.

Now, you can access the Solr Admin Panel and begin exploring and managing your Solr collection named “mycol1” as needed.

Conclusion

Congratulations, you’ve successfully navigated installing and configuring Apache Solr on your Ubuntu 22.04.3 system. This powerful search platform opens up possibilities for improving data indexing and retrieval in your projects.

From setting up Java to accessing the Solr Admin Panel, you’re now equipped to harness Solr’s capabilities effectively. However, the journey continues. To master Solr and tailor it to your needs, consider exploring advanced configuration options and optimizing your indexing and querying strategies.

For expert guidance and assistance in leveraging Apache Solr to its fullest potential, TRIOTECH SYSTEMS is here to help you enhance your search functionality and drive better results in your applications and websites.

FAQs

How Does The CI/CD Pipeline Assist With Software Development?

Implementing CI/CD has facilitated many businesses’ rapid and reliable software delivery. Continuous Integration/Continuous Delivery allows an efficient procedure for releasing goods to market at record speeds by providing a steady stream of new characteristics and fixing bugs through the most appropriate delivery mechanism.

Why Is Agile Essential For Business?

In the business world, being “agile” involves more than just being able to create flashy new features. Agile teams can boost feedback throughout the development process, eliminate waste and obstacles, and ensure that their code is fully testable.

How Can DevOps Make Use Of AI?

With the help of AI, DevOps teams may improve their software development processes across the board: testing, coding, releasing, and monitoring. Artificial intelligence (AI) can improve automation, problem detection and resolution times, and group dynamics.

Can You Explain How DevOps Helps With Productivity?

DevOps is a set of practices that encourages the adoption of an agile mentality across a wide range of software development and operations processes. The phrases “continuous integration,” “continuous delivery,” “communication,” “automation,” and “management” all spring to mind when talking about DevOps.

Which Testing Method Is Preferable, Manual Or Automated?

Due to its capacity to enhance test coverage, automation testing can yield superior findings. Only a subset of possible hardware configurations and operating systems may be tested manually. However, much more can be covered by automated testing. As a result, we can catch errors more effectively.

author avatar
TRIOTECH SYSTEMS
Share Now
Update cookies preferences