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

Awesome

This is one of the most precise and susinct how-tos I've ever come across for Drupal. Beautifully written!

Add new comment | arxic Drupal

Hello just wanted to give you a quick heads up.
The words in your article seem to be running off the screen in Chrome.
I'm not sure if this is a formatting issue or something
to do with web browser compatibility but I thought I'd post to let you know.
The layout look great though! Hope you get the issue solved soon. Cheerscheap nfl jerseyshttp://melissadawn.forumcrea.com/viewtopic.php?pid=2736http://theworld.g...

Add new comment | arxic Drupal

Howdy just wanted to give you a quick heads up. The text in your
post seem to be running off the screen in Firefox.
I'm not sure if this is a format issue or something to do
with browser compatibility but I figured I'd post to let you know.

The style and design look great though! Hope you
get the issue solved soon. Thanks http://forum.nantes-animaux.fr/viewtopic.php?f=2&t=391 https://artova.fi/foorumi/keskustelualue/17537-scottie-montgomery-examin... http://kidbrooke-forum.2837.x6.nabble.com/funded-carbon-tax-bill-investi...

Add new comment | arxic Drupal

Hey there! I know this is kinda off topic but I was wondering which
blog platform are you using for this website?

I'm getting sick and tired of Wordpress because I've had problems
with hackers and I'm looking at options for
another platform. I would be great if you could point me in the direction of a good platform.

Add new comment | arxic Drupal

I loved as much as you will receive carried out right
here. The sketch is attractive, your authored subject matter stylish.
nonetheless, you command get bought an nervousness over that you
wish be delivering the following. unwell unquestionably come further formerly again as exactly the
same nearly very often inside case you shield this increase.
http://ramsey-cycling.88101.x6.nabble.com/wind-up-as-at-once-reunited-td... http://uk-jilservice.ru/forum/dobro-pozhalovat/295-dining-room-price-tag... http://r129motoring.com/qmymusic.com/index.php/forum/welcome-mat/88527-o...

Add new comment | arxic Drupal

Do you mind if I quote a few of your articles as long as I provide credit and
sources back to your blog? My blog site is in the
exact same niche as yours and my visitors would truly benefit
from some of the information you provide here.
Please let me know if this ok with you. Regards!

Add new comment | arxic Drupal

This іs really fascinating, You are an excessively professional bloɡger.
I've joined your rss feed and stay up for іn quest
of extra of your еxcellent post. Additionally,
I've shɑred your site in my social networks

Add new comment | arxic Drupal

Hi, Neat post. There's a problem along with your web
site in web explorer, could test this? IE nonetheless is the market chief
and a large part of other people will leave out your magnificent writing due to this problem.

Add new comment | arxic Drupal

Even though your launcher do not permit custom icons, you may add the capacity through a free
app named Desktop Visualizer. All dating sites offer free as well as paid memberships.
For many more enterprise-oriented customers, they provide you a complete variety of
VPS and cloud hosting, together with serious Java Tomcat hosting, such as private and shared JVMs, in addition to Java VPS
offers. There are an increasing number of areas to adopt a virtual pet on the internet - as well as also the pets are more adorable and adorable all of the time.
This is a tough drive configuration getting increasingly more popular today that
disc drives are cheap to purchase and big in proportion. For an instance
of a large portable device; there could be numerous embedded computers in a
car, performing a single job, or even measuring a specific
value. Your electronic watch is another illustration of a personal computer - that a very restricted one with one or a
couple of embedded computers on chips, based on the number of works your watch has.

Lots of HollowPoiint's video uploads are of his fun/funny moments randomly playing with
the newest multiplayer functions to the Call of Duty franchise
names. On the flip side, the web conference solution includes many features that support remote cooperation, including multiple, simultaneous record, application, movie sharing, layout customisation and permanent URL generation for regular meetings.

Add new comment | arxic Drupal

I must thank you for the efforts you have put in penning this website.
I'm hoping to see the same high-grade content from you later
on as well. In truth, your creative writing abilities has motivated me to get my own blog now ;) http://x.37446.n3.nabble.com/denial-of-Bombshell-NYT-submit-td4023873.html http://trading.computer/forum/suggestion-box/63484-yet-succeeding-in-ski... http://slaphappydomains.com/forum/topic.php?id=32340&replies=1

Add new comment | arxic Drupal

Excellent beat ! I wish to apprentice while you amend your website, how could i subscribe for a blog website?
The account aided me a acceptable deal. I had been a little bit acquainted of this your broadcast provided
bright clear concept https://planetcyclingusa.com/having-a-secret-cheap-nick-hardwick-pink-je... http://www.sari.net.pl/~supelek/fora/viewtopic.php?p=7109 http://forum.gsuhvz.com/viewtopic.php?f=14&t=68712

Add new comment | arxic Drupal

Thank you a lot for sharing this with all
folks you really understand what you are talking approximately!

Bookmarked. Kindly also talk over with my website =).

We can have a hyperlink exchange arrangement among us http://Losangeles.Ofiweb.net/comunidad/forum/topic/22733 https://anisreveal.page.tl/Kansas-City-Chiefs-Tickets-_-Meet-The-Footbal... http://Www.Hackercomputers.it/joomla/index.php?option=com_kunena&view=to...

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.

Pages

Add new comment