Hello to everyone,
I’d like to share with you the procedure I use to install Apache Solr search server on my Ubuntu machine.
Apache Solr is, as indicated on the official website “Solr is the popular, blazing fast open source enterprise search platform from the Apache Lucene project. ” It is written in Java so that you will need an application server like Tomcat or JBoss for example ( by the way Solr is shipped with Jetty) so:
First step open your terminal and type:
sudo apt-get install tomcat
This will install Tomcat as a service. After installing it type
sudo service tomcat7 stop
You don’t need Tomcat running while installing solr; so next step download Apache Solr from here, uncompress the package in a folder.
Now go to /var/www and create a folder (e.g. solr_test), opent the folder where you previously extracted Solr and copy these folders/files to your new folder in /var/www/
- Bin
- Dist
- solr.xml
- zoo.cfg
- from /dist/ copy solr-4.4.xx.war,
- from /example/solr copy collection1 folder
- from /dist copy to /usr/share/tomcat7/lib the following files (since Apache Solr doesn’t use log4j for logging)
- log4j.properties
- slf4j-log4j12-1.6.6.jar
- slf4j-api-1.6.6.jar
- log4j-1.2.16.jar
- jul-to-slf4j-1.6.6.jar
- jcl-over-slf4j-1.6.6.jar
now, we must say to Tomcat where is the Solr application; to accomplish this, open the terminal and go to /etc/tomcat7/Catalina/localhost. This is the folder were some of the files needed fot the Tomcat configuration are stored, so now type
sudo touch solr_test.xml
Open the file with your favourite text editor and add the following lines:
<?xml version="1.0" encoding="utf-8"?> <Context docBase="/var/www/solr/solr-4.4.0.war" crossContext="true"> <Environment name="solr/home" type="java.lang.String" value="/var/www/solr" override="true"/> </Context>
Change the paths according to your system, change the permissions of your /var/www/solr_test folder and restart Tomcat in this way
sudo chown tomcat7.root /var/www/your_folder -R sudo service tomcat7 start
Now, open your favourite browser and go to:
http://localhost:8080/solr_instance1/#/
If everything is correct, your Solr search server should be ready .
Enjoy!