In this chapter, we will understand the prerequisites and learn how to install Apache Solr and the necessary components on our system. For the purpose of demonstration, we will be using Windows-based components. We will cover the following topics:
Prerequisites for Solr
Installing web servers
Installing Apache Solr
Let's get started.
XAMPP for Windows (for example, V3.1.0 Beta 4): This can be downloaded from http://www.apachefriends.org/en/xampp-windows.html
XAMPP comes with a package of components, which includes Apache (a web server), MySQL (a database server), PHP, PhpMyAdmin, FileZilla (an FTP server), Tomcat (a web server to run Solr), Strawberry Perl, and a XAMPP control panel
Tomcat add-on: This can be downloaded from http://tomcat.apache.org/download-60.cgi
Java JDK: This can be downloaded from http://java.sun.com/javase/downloads/index.jsp
Apache Solr: This can be downloaded from http://apache.tradebit.com/pub/lucene/solr/4.6.1/
Solr PHP client: This can be downloaded from http://code.google.com/p/solr-php-client/
It is recommended that you choose the latest version of the preceding components due to the fact that the latest version has security patches implemented, which are lacking in the older ones. Additionally, you may use any version of these components, but keep in mind that they are compatible with each other and are secure enough to handle intruders.
Install XAMPP and follow the instructions.
Install the latest Java JDK.
Install Tomcat and follow the instructions.
By now, there must be a folder called
C:(by default). Navigate to the
xamppfolder, find the
xampp-controlapplication, and start it, as shown in the following screenshot:
Extract Apache Solr and navigate to the
/distfolder. You will find a file called
solr-4.3.1.war, as shown in the following screenshot (we need to copy this file):
C:/xampp/tomcat/webapps/and paste the
solr-4.3.1.warfile (which you copied in the previous step) into the
solr.war, as shown in the following screenshot:
Create a directory in
/solr/and paste the
ApacheSolrFolder>/example/solr/files into this directory, that is,
C:/xampp/solr, as shown in the following screenshot:
Now, navigate to
C:/xampp/tomcat/bin/tomcat6, click on the Java tab, and copy the command
-Dsolr.solr.home=C:\xampp\solrinto the Java Options section, as shown in the following screenshot:
Now, you are done with installing Apache Solr in your local environment. To confirm, type
http://localhost:8080/solr/admin/and hit the Enter key on the keyboard. You should be able to see Apache Solr's dashboard.
In this chapter, we have learned about the prerequisites necessary to run Apache Solr successfully and how to install and configure XAMPP, Tomcat, the Solr server, and the Solr client. In the next chapter, we will learn the different ways to boost our search using query parsers and various robust function queries such as field references, function references, and function query boosting based on different criteria.