Apache Solr 4.6.0 installation and compatibility with Drupal7 I'm having difficulties installing Apache Solr. The latest version that I downloaded was 4.6.0.  But all Drupal documentation and tutorials (see http://www.youtube.com/watch?v=ori-VvvH1Aw) are talking about 3.5.0.  While 3.5.0 is nowhere to be found on internet, 4.6.0 has a totally different directory structure, and there is no documentation on how to install this latest version on a server or on a local WAMP.  There is no mentioning of which Apache Solr versions are most recommended to work with Drupal?  Any help?
You aren't alone I had to scour the internet and read several articles before I truly understand all of this. I tried about three different methods until I finally got it right!

If you are using Debian/Ubuntu (with Tomcat7) it's even easier then most outline. I preferred this over Lullabot since when you install it through Ubuntu it's actually a service and less fiddling :)

Install Java

apt-get install java7-jdk


Install Tomcat

apt-get install tomcat7 tomcat7-admin


Once this is done you can get to http://localhost:8080 and see that's it is all running properly.

Note: It's recommended to push the port to another one since 8080 is pretty common. If you want to do that use this code for that!

sudo sed -i s/8080/8983/g /var/lib/tomcat7/conf/server.xml


Configure Tomcat


You will want to actually create a users account for Tomcat so that other people have to log into the admin (it keeps it safer).

nano /var/lib/tomcat7/conf/tomcat-users.xml
Then add these xml arguments between the &lt;tomcat-users&gt; tags

&lt;role rolename="manager-gui"/&gt;
 &lt;role rolename="admin-gui"/&gt;
 &lt;user username="!!somename!!" password="!!somepassword!!" roles="manager-gui,admin-gui"/&gt;
Now you can restart tomcat again and view the admin page at  http://localhost:8983/manager/html

service tomcat7 restart


Install Solr


Download the latest ApacheSolr here (When I wrote this I got it working with 4.7)
Extract the files into a directory


Copy Solr library files

Next we want to add the library files to Tomcat library directory. Note: You can also use symlinks if you prefer, but for the purpose of understand where everything goes I chose to place it directly in the directories

cp ~/solr-4.x.x/example/lib/ext/* /usr/share/tomcat7/lib/


It may be a good idea to also copy the java libraries from solr/dist/solrrj-lib/*

cp ~/solr-4.x.x/dist/solrj-lib/* /usr/local/tomcat7/lib/


Copy Solr WAR app file

cp ~/solr-4.x.x/dist/solr-4.x.x.war /var/lib/tomcat7/webapps/solr.war


Setup Drupal ApacheSolr core


We first need to copy over the sample configuration files from ApacheSolr.

mkdir -p /var/lib/tomcat7/solr
cp -r ~/solr-4.x.x/example/solr/collection1/conf /var/lib/tomcat7/solr/
Next grab the latest version of the apachesolr module https://drupal.org/project/apachesolr and unzip it

tar xvf apachesolr-*.tar.gz
Syncronize the apachesolr configuration files (for Drupal) with your solr configuration

rsync -av apachesolr/solr-conf/solr-4.x/ /var/lib/tomcat7/solr/conf/


Note: I found an error in which ApacheSolr refused to start due to duplicate errors. I reported that here so you might want to look at the solution here as at the time of writing this I could not get it running without that!


Create a core definition file to tell Apache Solr which cores are available.

nano /var/lib/tomcat7/solr/solr.xml
Paste the following code inside that file

&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
 &lt;solr persistent="false"&gt;
   &lt;cores adminPath="/admin/cores"&gt;
     &lt;core name="!!yourcorename!!" instanceDir="!!yourcoredir!!" /&gt;
    &lt;/cores&gt;
  &lt;/solr&gt;


Create Drupal core directory

This will create a new core in your system with that name. If you wish to add more you simply can repeat this step as well as the one above.

mkdir /var/lib/tomcat7/solr/!!yourcoredir!!
cp -r /var/lib/tomcat7/solr/conf /var/lib/tomcat7/solr/!!yourcoredir!!/


Let's Make It Live


Your at the last stretch!! Let's put tomcat7 to sleep

service tomcat7 stop
Now change the permissions on the tomcat directory

chown -R tomcat7:tomcat7 /var/lib/tomcat7
Start it back up

service tomcat7 start


It's Live

You should be able to go to http://localhost:8983/solr and see a new core instance available! Now you can go ahead and configure drupal to point to that.

Note: Your new core is located at http://localhost:8983/solr/!!yourcorename!! to be used in the Drupal ApacheSolr module.

Credit and props goes out to Pacoup