Update on 2012.09.20: updated for Solr 4.0-BETA (from ALPHA, thanks for the comment Dorthe).
Update on 2013.07.09: updated for Solr 4.3.1
Update on 2013.07.28: the guide works with Solr 4.4, Ubuntu server 13.04 and tomcat7, just replace tomcat6 with tomcat7 and /var/lib/tomcat6/shared with /var/lib/tomcat7/lib
This short guide will describe how to install solr 4 on Ubuntu server. The versions I’m using are: Ubuntu Server 12.04 and Apache Solr 4.3.1. I will also show how to test the installation & perform a sample indexing and query.
Installation on tomcat Ubuntu 12.04 LTS
1. Install packages
2. Download solr 4 from http://lucene.apache.org/solr (at the time of writing it was solr-4.3.1.tgz)
3. Choose directory for solr – know as SOLR_HOME. I’ve chosen to put it into /opt/solr so my SOLR_HOME=/opt/solr. Replace /opt/solr with your own location if you want a different one.
4. Extract downloaded files anywhere and copy following to your $SOLR_HOME and to your tomcat installation:
- copy example/solr/* to /opt/solr
- copy example/webapps/solr.war to /opt/solr
- copy example/lib/ext/* to /var/lib/tomcat6/shared
5. Edit dataDir in solr configuration file /opt/solr/collection1/conf/solrconfig.xml:
6. Create directory for solr data and make it write-able for tomcat server
Here is how my /opt/solr directory looks like (showing only directories):
7. Setup new context in tomcat server pointing to our solr files. Create file /etc/tomcat6/Catalina/localhost/solr.xml with the following content:
8. Restart tomcat
9. Enjoy your newly set up solr4 by pointing your browser to http://localhost:8080/solr.
Sample indexing and UTF-8 test
solr installation files come with sample schema.xml (we’ve already copied it into our $SOLR_HOME) and some .xml files with sample data we can import. We will use one of them to test if UTF-8 encoding is working as expected.
1. Go to the directory with extracted solr installation files and import utf8-example.xml using curl
The response from the server should be similar to
2. Commit the documents
3. Test it by searching for êâîôû string. Use solr administrative UI or this GET request should do: http://localhost:8080/solr/collection1/select?q=êâîôû. You should see exactly one result.