Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Click on below appropriate Ubuntu Server version
Note: If you want to add a new documentation page please do not edit this current page. Instead create a child page. Indicating in the title which Ubuntu version you are referring to. Thanks :)
Comments
Ubuntu 16.04, tomcat 8 with solr 4.x
because of a new account, unable to add a child page so adding this comment :)
I used a combination of resources to get this setup working:
references: https://www.digitalocean.com/community/tutorials/how-to-install-apache-t...
https://www.lullabot.com/articles/installing-solr-for-use-with-drupal
SETUP AND INSTALL TOMCAT
1) sudo apt-get update
2) sudo apt-get install default-jdk
3) sudo groupadd tomcat
4) sudo useradd -s /bin/false -g tomcat -d /usr/local/tomcat tomcat
5) cd /tmp
6)
curl -O http://www.namesdir.com/mirrors/apache/tomcat/tomcat-8/v8.5.13/bin/apache-tomcat-8.5.13.tar.gz
7) sudo mkdir /usr/local/tomcat
8) sudo tar xzvf apache-tomcat-8*tar.gz -C /usr/local/tomcat --strip-components=1
9) cd /usr/local/tomcat
10) sudo chgrp -R tomcat /usr/local/tomcat
11) sudo chmod -R g+r conf
12) sudo chmod g+x conf
13) sudo chown -R tomcat webapps/ work/ temp/ logs/
14) sudo nano /etc/systemd/system/tomcat.service
add the following in the above file:
15) sudo systemctl daemon-reload
16) sudo systemctl start tomcat
17) sudo systemctl status tomcat
18) sudo ufw allow 8080 (if your firewall is enabled)
19) sudo systemctl enable tomcat (enable the service file so Tomcat will start automatically on system boot)
CONFIGURE TOMCAT WEB MANAGEMENT (Optional)
20) sudo nano /usr/local/tomcat/conf/tomcat-users.xml
place the following in the above file:
21) sudo nano /usr/local/tomcat/webapps/manager/META-INF/context.xml
comment out as below:
22) sudo nano /usr/local/tomcat/webapps/host-manager/META-INF/context.xml
comment out as below:
23) sudo systemctl restart tomcat
at this point, you should be able to access the tomcat web interface at http://server_domain_or_IP:8080
INSTALLING SOLR
24) cd /usr/local/src
25)
sudo wget http://archive.apache.org/dist/lucene/solr/4.6.0/solr-4.6.0.tgz
26) sudo tar -zxf solr-4.6.0.tgz
27) sudo cp solr-4.6.0/dist/solrj-lib/* /usr/local/tomcat/lib/
28) sudo cp solr-4.6.0/example/resources/log4j.properties /usr/local/tomcat/conf/
29) sudo cp solr-4.6.0/dist/solr-4.6.0.war /usr/local/tomcat/webapps/solr.war
30) sudo mkdir -p /usr/local/tomcat/conf/Catalina/localhost
31) sudo nano /usr/local/tomcat/conf/Catalina/localhost/solr.xml
add the following to the above file:
32) sudo mkdir -p /usr/local/tomcat/solr
33) sudo cp -r solr-4.6.0/example/solr/collection1/conf /usr/local/tomcat/solr/
34) download and install https://drupal.org/project/apachesolr
35) cd into your drupal installation sites/all/modules directory
36) sudo rsync -av apachesolr/solr-conf/solr-4.x/ /usr/local/tomcat/solr/conf/
37) sudo nano /usr/local/tomcat/solr/solr.xml
add the following to the above file:
38) sudo mkdir /usr/local/tomcat/solr/drupal
39) sudo cp -r /usr/local/tomcat/solr/conf /usr/local/tomcat/solr/drupal/
40) sudo chown -R tomcat:tomcat /usr/local/tomcat
41) sudo systemctl restart tomcat
at this point, the solr core admin interface should be available at http://server_domain_or_IP:8080/solr/#/drupal
URL to use in Drupal's Apache Solr configuration is http://localhost:8080/solr/drupal.
hope this helps.
AWESOME!
This guide is brilliant and got me up and running in no time. Thank you so much for submitting this humPhin
I used Tomcat 8.5.12 and Solr 4.6.1 - you just need to change download locations as applicable.
curl -O http://apache.mirrors.nublue.co.uk/tomcat/tomcat-8/v8.5.12/bin/apache-tomcat-8.5.12.tar.gz
and
sudo wget http://archive.apache.org/dist/lucene/solr/4.6.1/solr-4.6.1.tgz
Also step 33 needs a sudo!
33)
sudo cp -r solr-4.6.0/example/solr/collection1/conf /usr/local/tomcat/solr/
I'm glad it helped! thanks
I'm glad it helped! thanks for pointing out step #33, fixed :)
Index failure
It's also worth noting that when you add the server and an index in Drupal then try to index all items it will probably fail with the following error or something similar:
SearchApiException: Could not index items since important pending server tasks could not be performed. in search_api_index_specific_items() (line 1622 of /var/www/site/docroot/sites/all/modules/contrib/search_api/search_api.module).
This is because the Solr server needs to create the data directory first. Just reindex again and it should work second time around.
Thanks both of you for your
Thanks both of you for your help, it should be into the official doc haha
Also, step 6 is a dead link, you can replace the current path with http://apache.osuosl.org/tomcat/tomcat-8/v8.5.32/bin/apache-tomcat-8.5.3... which is availlable :)