Installing multi-core Apache SOLR and Tomcat6 for Drupal 7 with Tika on Ubuntu 12.04 (Precise Pangolin)

First, open up your command line interface, and perform your system updates:

Download updates:

sudo apt-get update

Install updates:

sudo apt-get upgrade

Next, install the suite of Tomcat6 server packages since you can use aptitude to do this. The packages are:

  • tomcat6 - Servlet and JSP engine
  • tomcat6-admin - Admin web applications
  • tomcat6-common - Common files
  • tomcat6-user - Tools to create user instances
  • tomcat6-docs - Documentation
  • tomcat6-examples - Example web applications

At your command line, type:

sudo apt-get install tomcat6 tomcat6-admin tomcat6-common tomcat6-user tomcat6-docs tomcat6-examples

Start Tomcat6:

sudo /etc/init.d/tomcat6 start

Security concerns on public servers:

Tomcat6 runs on port 8080 by default. For the purposes of this tutorial, it is assumed that your Drupal site is on the same server (e.g., localhost), or at least on the same local network, so you don't have to forward this ports from the internet. This will not allow you to make calls to the Apache SOLR server from external sites, but it is considered more secure, especially since Apache SOLR does not have built-in security features (hence the necessity for an access control sub-module for Apache SOLR in Drupal). If you want to access your Apache SOLR server from external sites, then use IP Tables in Ubuntu to restrict access to the server (on port 8080) to certain IP addresses only - the IP addresses of the servers of the external sites.

Download and unpack Apache SOLR to your home directory:

wget http://mirrors.ibiblio.org/apache/lucene/solr/3.6.0/apache-solr-3.6.0.tg...

tar -xvzf apache-solr-3.6.0.tgz

Connect Tomcat6 and Apache SOLR:

To learn where Tomcat6 lives on your system run:

whereis tomcat6

Which should show: /etc/tomcat6 /usr/share/tomcat6

If you switch to the /usr/share/tomcat6 directory, you should see a sub-directory called "webapps"

Copy the apache-solr-3.6.0.war file from the unpacked Apache SOLR folder in your home directory to solr.war in the webapps directory in /usr/share/tomcat6:

sudo cp apache-solr-3.6.0/dist/apache-solr-3.6.0.war /usr/share/tomcat6/webapps/solr.war

Next, copy the example Apache SOLR application directory and all files within (in the unpacked folder) to a new solr folder in /usr/share/tomcat6:

sudo cp -R apache-solr-3.6.0/example/solr/ /usr/share/tomcat6/solr/

Create the Tomcat6-SOLR config file in /etc/tomcat6/Catalina/localhost/solr.xml by:

sudo nano /etc/tomcat6/Catalina/localhost/solr.xml

And fill the file with the following lines (<Context>...</Context>):

<Context docBase="/usr/share/tomcat6/webapps/solr.war" debug="0" privileged="true" allowLinking="true" crossContext="true">
<Environment name="solr/home" type="java.lang.String" value="/usr/share/tomcat6/solr" override="true" />
</Context>

Add one or more users to Tomcat6 to be able to manage Tomcat6 and to check on the SOLR config pages. Edit the Tomcat6 tomcat-users.xml file:

sudo nano /etc/tomcat6/tomcat-users.xml

Within the <tomcat-users> tag, add lines for the admin and manage roles, and then add one line for each user, with your information:

<tomcat-users>
<role rolename="admin"/>
<role rolename="manager"/>
<user username="tc6-admin" password="agoodpassword" roles="admin,manager"/>
</tomcat-users>

Disable Tomcat6 security so that SOLR is able to access /usr/share/tomcat6/solr:

sudo nano /etc/default/tomcat6

Be aware of the security implications, especially on shared and publically accessible servers. Find the section/line and make sure that it is set to no:

TOMCAT6_SECURITY=no

Connect Drupal 7 with Apache SOLR:

Download (Drush or FTP) the latest version of Apache SOLR module for Drupal 7 from http://drupal.org/project/apachesolr into /sites/all/modules of your Drupal installation.

The Drupal 7 version of Apache SOLR does not require you to separately download the SolrPhpClient library, as it is now included in the module!

Switch to the example SOLR application copied to Tomcat6:

cd /usr/share/tomcat6/solr/conf

And move the default configuration files to backups:

schema.xml:

sudo mv schema.xml schema.orig.xml

solrconfig.xml:

sudo mv solrconfig.xml solrconfig.orig.xml

protwords.txt:

sudo mv protwords.txt protwords.orig.txt

Next, copy the Drupal specific configuration files from the module's solr-conf folder into the copied example SOLR application:

schema.xml:

sudo cp /var/www/drupal7/sites/all/modules/apachesolr/solr-conf/schema-solr3x.xml /usr/share/tomcat6/solr/conf/schema.xml

solrconfig.xml:

sudo cp /var/www/drupal7/sites/all/modules/apachesolr/solr-conf/solrconfig-solr3x.xml /usr/share/tomcat6/solr/conf/solrconfig.xml

protwords.txt:

sudo cp /var/www/drupal7/sites/all/modules/apachesolr/solr-conf/protwords.txt /usr/share/tomcat6/solr/conf/protwords.txt

Then, setup Apache SOLR multi-core functionality so you can connect multiple Drupal sites. Start by copying the Apache SOLR multi-core example configuration file:

sudo cp ~/apache-solr-3.6.0/example/multicore/solr.xml /usr/share/tomcat6/solr/solr.xml

You will need to create a directory in /usr/share/tomcat6/solr for each site (core) that you want to index with SOLR. Keep your naming conventions sensible, since you want to be able to easily distinguish between cores when you are connecting the the SOLR core in your Drupal sites. For each site, in /usr/share/tomcat6/solr:

sudo mkdir /usr/share/tomcat6/solr/site1namecore

Then, copy the /usr/share/tomcat6/conf directory into each directory you create:

sudo cp -R /usr/share/tomcat6/solr/conf/ /usr/share/tomcat6/solr/site1namecore/conf/

Make the new directory that you create for each site/core you create belong to the tomcat6 user:

sudo chown -R tomcat6:tomcat6 /usr/share/tomcat6/solr/site1namecore

Leave the /usr/share/tomcat6/solr/conf directory so you can use it to create future cores in the future.

Edit the solr.xml file in /usr/share/tomcat6/solr to add your site (core) names and directories for multi-core setup. There should be one line for each site/core, and the instanceDir for each should correspond to the directory that you created in the above step for each site/core:

sudo nano /usr/share/tomcat6/solr/solr.xml

And replace the default lines with the information for your sites/cores:

<cores adminPath="/admin/cores">
    <core name="site1namecore" instanceDir="site1namecore" />
    <core name="site2namecore" instanceDir="site2namecore" />
  </cores>
</solr>

Get Apache Tika for text data extraction from attached files, via the Apache SOLR attachments module. Switch to your home directory:

cd

Download the latest version of the runnable jar from http://tika.apache.org/download.html (1.1 at the time of writing):

wget http://www.alliedquotes.com/mirrors/apache/tika/tika-app-1.1.jar[/prettify]

Then move it into /usr/share/tomcat6/lib:

sudo mv tika-app-1.1.jar /usr/share/tomcat6/lib

Restart Tomcat6 by:

sudo service tomcat6 restart

In your Drupal site, after enabling the Apache SOLR framework and search modules, go to the SOLR settings page (admin/config/search/apachesolr/settings/solr/edit). For the SOLR server URL, change the port to 8080, and add the core name at the end of the URL:

http://localhost:8080/solr/site1namecore

And save the settings.

After enabling Apache SOLR Attachments, on the settings page (admin/config/search/apachesolr/attachments), enter the Tika directory path and file name:

/usr/share/tomcat6/lib/

tika-app-1.1.jar

Drupal version: 

Comments

Add new comment | arxic Drupal

Oh my goodness! Incredible article dude! Thank you so much, However I
am having troubles with your RSS. I don't understand the reason why I can't subscribe to it.
Is there anyone else getting similar RSS issues? Anybody
who knows the answer will you kindly respond? Thanx!!
http://discussion.81210.x6.nabble.com/are-generally-battery-chargers-new... http://cbmdmusic.com/dsisoundexchange/forum/4-tempest/155-baltimore-dist... http://thongsokythuatxetai.com/the-integration-of-modern-fashion-100-rea...

Add new comment | arxic Drupal

Nice post. I learn something new and challenging on websites I stumbleupon every day.
It will always be interesting to read through articles from other writers and practice a little something from other websites.

Add new comment | arxic Drupal

Hey I know this is off topic but I was wondering if you knew of any widgets I
could add to my blog that automatically tweet my newest twitter
updates. I've been looking for a plug-in like this for quite some time
and was hoping maybe you would have some experience with something like this.
Please let me know if you run into anything. I truly enjoy
reading your blog and I look forward to your new
updates. http://sage.forumcrea.com/viewtopic.php?pid=10753 http://orgtorg.pro/index.php/forum/razdel-predlozhenij/124153-usually-re... http://186.74.196.171/csn_0510/es/forum/suggestion-box/417326-obtain-a-t...

Add new comment | arxic Drupal

We're a group of volunteers and starting a new scheme in our community.
Your site offered us with valuable information to work on. You've done
an impressive job and our whole community will be thankful to you.
http://usanews.mihanblog.com/post/63 http://sean-costello-tenor-blog.38135.n7.nabble.com/culture-cup-of-actua... http://uk-jilservice.ru/forum/dobro-pozhalovat/258-colleges-full-coverag...

Add new comment | arxic Drupal

Hi there terrific website! Does running a blog such as this require
a great deal of work? I've very little knowledge of programming however I had been hoping to start my own blog in the near
future. Anyway, should you have any ideas or tips
for new blog owners please share. I know this is off subject however I simply needed
to ask. Kudos! http://atlantis.co.ao/index.php/forum/suggestion-box/186540-dorothy-dean... http://janadamski.eu/2016/04/benefits-of-getting-a-custom-football-jersey/ http://myanmar-business-network.52086.x6.nabble.com/Independent-persons-...

Add new comment | arxic Drupal

Hi, I do believe this is an excellent site. I stumbledupon it ;) I am going to revisit
once again since i have book-marked it. Money and freedom is
the greatest way to change, may you be rich and
continue to guide others.

Add new comment | arxic Drupal

I feel this is one of the most important info for me.
And i am satisfied studying your article.
But want to statement on some normal issues, The web site taste is wonderful, the articles is really great :
D. Good activity, cheers

It is beyond the scope of

It is beyond the scope of this article, but you can use IPtables or the like to restrict access to Tomcat/SOLR to the IP address where your web server resides.

Add new comment | arxic Drupal

Does your website have a contact page? I'm having a tough time locating it but, I'd
like to shoot you an email. I've got some recommendations
for your blog you might be interested in hearing. Either way, great site and I look
forward to seeing it grow over time.

Add new comment | arxic Drupal

It is appropriate time to make some plans for the longer term and it's
time to be happy. I've read this publish and if I may just I want to
suggest you some fascinating things or tips.
Maybe you could write next articles referring to this
article. I want to read more issues approximately it!
http://www.rotellisticapuana.it/joomla/index.php?option=com_kunena&func=... http://sunnet.vn/a-distinctive-you-cheap-pink-anthony-davis-nike-jerseys... http://cgame.mobi/you-deserve-to-have-one-cheap-youth-cody-latimer-pink-...

Add new comment | arxic Drupal

An intriguing discussion is worth comment. I do believe that
you need to publish more on this issue, it may not be a taboo subject but typically people do not discuss
such issues. To the next! Best wishes!!

Add new comment | arxic Drupal

Great blog! Is your theme custom made or did you
download it from somewhere? A theme like yours with a few
simple tweeks would really make my blog shine. Please let me know where you got your theme.
Cheers http://Paradune.com/phorum/read.php?13,34363 https://enkoo.de/component/kunena/suggestion-box/51090-cornet-to-fekir-s... http://wup-tube-forum.2287207.n4.nabble.com/Hilton-soon-reconnecting-td4...

Add new comment | arxic Drupal

Hi there just wanted to give you a quick
heads up and let you know a few of the pictures aren't loading properly.
I'm not sure why but I think its a linking issue.
I've tried it in two different browsers and both
show the same results. http://egryhazardowe.pl/soccer-west-celebrates-2-decades-of-serving-seat... http://fourthcity.net/1/read.php?1,111527 http://forums.stoppingpower.net/default.aspx?g=posts&m=455965&

Add new comment | arxic Drupal

An outstanding share! I have just forwarded this onto a co-worker who has
been doing a little homework on this. And he actually bought
me lunch because I found it for him... lol. So allow me to reword
this.... Thanks for the meal!! But yeah, thanks for spending some time to
talk about this issue here on your blog.cheap nba jerseys from Chinahttp://geniusengineeringclasses.com/pointers-quicker-sure-that-you-will-...

Add new comment | arxic Drupal

Hi there! I realize this is kind of off-topic but I needed to
ask. Does managing a well-established blog like yours require a large amount of work?
I'm brand new to blogging but I do write in my diary everyday.
I'd like to start a blog so I can share my experience and views
online. Please let me know if you have any kind of ideas or tips for new aspiring blog owners.
Thankyou! http://mccuelinowski-wedding.2364610.n4.nabble.com/AFL-star-category-cou... http://dallascowboyscp.mee.nu/?entry=2831213 http://www.vapewatchforum.com/discussion/39565/pistons-instructor-stan-v...

Add new comment | arxic Drupal

Thanks for one's marvelous posting! I really enjoyed reading it,
you might be a great author. I will be sure to bookmark your blog and will often come
back at some point. I want to encourage you to ultimately continue your great job,
have a nice evening!

Pages

Add new comment