Apache Solr Linux install

Apache Solr is open source search software. It’s capable of being implemented as an enterprise-level search engine thanks to its high scalability, advanced indexing, fast queries, and ability to integrate with a large variety of applications. It’s capable of tackling big data and also has high availability with its load balancing and failover configurations.

The platform is written in Java and can be installed on Linux systems. In this guide, we’ll show the step by step instructions for installing Apache Solr on some of the most popular Linux distros, including Ubuntu, Debian, CentOS, and Red Hat.

In this tutorial you will learn:

  • How to install Apache Solr on Debian based systems
  • How to install Apache Solr on Red Hat based systems
  • Initial configuration of Apache Solr
Apache Solr installed on Linux

Apache Solr installed on Linux

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Debian or Red Hat based distros
Software Apache Solr, Java
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Install Apache Solr on Debian based systems

If you’re running Ubuntu, Debian, or a different Debian based system like Linux Mint, the step by step instructions below should work for you. Instructions for Red Hat based systems are in the next section.

  1. Start by opening a terminal and installing Java.
    $ sudo apt install default-jdk
    
  2. Next, use wget to download the latest version of Apache Solr from the official download page. At the time of this writing, it’s 8.6.3.
    $ wget http://www.gtlib.gatech.edu/pub/apache/lucene/solr/8.6.3/solr-8.6.3.tgz
    


  3. Once the file has been downloaded, use the following tar command to extract its contents.
    $ tar zxvf solr-8.6.3.tgz
    
  4. Next, execute the included install script to install Apache Solr. Be sure to do this as the root user.
    $ sudo solr-8.6.3/bin/install_solr_service.sh solr-8.6.3.tgz
    
  5. Apache Solr should now be installed and started as a service automatically. It can be controlled by systemd through a systemctl command.
    $ sudo systemctl start solr # start Solr
    $ sudo systemctl stop solr # stop Solr
    $ systemctl status solr # check the status of Solr
    $ sudo systemctl enable solr # make Solr start automatically upon reboot
    

Install Apache Solr on Red Hat based systems

If you’re running CentOS, Red Hat, or a different Red Hat based system like Fedora, the step by step instructions below should work for you.

  1. Start by opening a terminal and installing Java.
    $ sudo dnf install java-11-openjdk
    
  2. Next, use wget to download the latest version of Apache Solr from the official download page. At the time of this writing, it’s 8.6.3.
    $ wget http://www.gtlib.gatech.edu/pub/apache/lucene/solr/8.6.3/solr-8.6.3.tgz
    


  3. Before continuing, you should increase the file and max processes limits to maximize performance and prevent Solr from issuing warnings when it starts up. Use nano or your preferred text editor open this file and add these four lines:
    $ sudo nano /etc/security/limits.conf
    
    Add to bottom of file:
    solr hard nofile 65535
    solr soft nofile 65535
    solr hard nproc 65535
    solr soft nproc 65535
    
  4. Now you can use the following tar command to extract the Apache Solr files.
    $ tar zxvf solr-8.6.3.tgz
    
  5. Next, execute the included install script to install Apache Solr. Be sure to do this as the root user.
    $ sudo solr-8.6.3/bin/install_solr_service.sh solr-8.6.3.tgz
    
  6. Once Apache Solr is done installing, use the following commands to control it.
    $ sudo service solr start # start Solr
    $ sudo service solr stop # stop Solr
    $ sudo service solr status # check the status of Solr
    $ sudo chkconfig solr on # make Solr start automatically upon reboot
    


Apache Solr initial configuration

  • Many aspects of Apache Solr can be configured via the command line, but Solr also has a web interface, which you’ll probably find more convenient. Access it through http://localhost:8983/solr – if not on the same machine, replace localhost with the IP address or fully qualified domain name of your Apache Solr server.
    Accessing Apache Solr through the web interface

    Accessing Apache Solr through the web interface

  • Get started using Apache Solr by first creating a new collection on the left side of the screen.
    Click this link to create a new collection in Apache Solr

    Click this link to create a new collection in Apache Solr

  • Conclusion

    In this guide, we saw how to install Apache Solr on popular Debian based and Red Hat based Linux distributions. This should be enough to get you started with Solr and begin using its search functionality after you’ve configured your first collection.



    Comments and Discussions
    Linux Forum