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

I was suggested this blog via my cousin. I'm no longer certain whether or not this put up is written through him as no one else
recognise such unique approximately my problem.
You are wonderful! Thanks! http://raahemifar.1098262.n5.nabble.com/Johnathan-Thurston-NRL-the-golde... http://psy-science-council.ru/forum/messages/forum10/topic78/message117/... http://sepbackscenas.Forumcrea.com/viewtopic.php?pid=6951

Add new comment | arxic Drupal

My spouse and I absolutely love your blog and find nearly all of your post's
to be just what I'm looking for. Do you offer guest writers to write content available for you?
I wouldn't mind writing a post or elaborating on most of the subjects
you write regarding here. Again, awesome web site! http://nkdrava.mojforum.si/nkdrava-post-1029.html http://carrentals.mee.nu/?entry=2832893 http://mvp-athletics.1122616.n5.nabble.com/Bush-s-medical-doctor-mortall...

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 got an impatience over that
you wish be delivering the following. unwell unquestionably
come further formerly again since exactly the same nearly a lot
often inside case you shield this increase. https://canvasseatcovers.com.au/2016/07/26/the-darkness-is-no-darkness-w... https://www.e-liquidzine.com/your-best-chice-cheap-colts-trent-richardso... http://fifa-15-coins-new.2342592.n4.nabble.com/Astros-warning-six-gurus-...

Add new comment | arxic Drupal

I'm now not certain where you are getting your information, but good topic.

I needs to spend a while studying much more or understanding more.
Thanks for wonderful info I was in search of this
info for my mission.

Add new comment | arxic Drupal

There are many benefits this technology brings. With the change
in the technology the trend of the marketplace and the
users are changing. This amazing handset has been lately jumped in market from
the month of November 2010 and its release has made lots of people its followers.
Samsung can definitely be called among the leaders at the cell phone marketplace
when we talk about technological progress. Samsung Chat 527 S5270 is one of
the most very 3G handsets that Samsung has launched in India.
BatterySamsung Chat 322, as it will function two SIM cards at same time,
so, needed an efficient battery back up. The latest addition to the
family is by your Samsung Chat series. Samsung establishes a series in its Chat variant
like Samsung Chat 322, Samsung Chat 527 S5270 and Samsung Chat 222.
All the sets of this chat collection are too good to hold and operate.

Add new comment | arxic Drupal

Can I simply say what a relief to uncover someone that really understands what they're discussing
on the net. You definitely know how to bring a problem to light and make it important.
More and more people should look at this and understand this side of your story.
I was surprised that you're not more popular because you most certainly possess the gift.
http://paradune.com/phorum/read.php?11,37648 http://Richardbarber.works/index.php?title=User:VerlaRainey1106&oldid=88... http://enerexis.forumcrea.com/viewtopic.php?pid=6353

Add new comment | arxic Drupal

Hi, Neat post. There's a problem with your site in internet explorer, would test this?
IE nonetheless is the market leader and a big component of other folks will leave out your wonderful writing because of this
problem. http://mobafy.com/viewtopic.php?f=20&t=3730 http://Bikebores.com/index.php/forum/site-feedback/164110-cork-firefight... http://vn.vuinhi.com/Direct-your-amazing-anger-at-the-true-abusers-td103...

Add new comment | arxic Drupal

Hi there, I do believe your blog could be having browser
compatibility problems. When I look at your site in Safari,
it looks fine but when opening in I.E., it has some overlapping issues.
I merely wanted to give you a quick heads up! Other than that,
fantastic blog! http://arcflashadvisors.com/forum/index.php?page=topicview&id=general-ch... http://spyrcompratab.Forumcrea.com/viewtopic.php?pid=1225 https://oathauth.wmf.hallowelt.biz/w/index.php?title=Wholesale_Jerseys_F...

Add new comment | arxic Drupal

Thanks for the marvelous posting! I actually enjoyed reading it,
you are a great author. I will always bookmark your blog and will come
back in the future. I want to encourage that you continue your great job, have a nice afternoon!

Add new comment | arxic Drupal

Hello just wanted to give you a brief heads up and let you know a few of the images 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 outcome.

Add new comment | arxic Drupal

I think that is among the most significant information for me.

And i am glad reading your article. However want to remark
on few common things, The web site taste is great, the articles is
really excellent : D. Just right activity, cheers http://www.allseasons-tour.net/forum/dobro-pozhalovat/288-country-wide-c... http://Members-Area.138476.N3.Nabble.com/2008-national-football-league-s... http://www.flavioleonori.it/forum/generale/22981-domain-acquires-around-...

generic viagra coupons b.u.yci.a.l.i.son.l.ine.

viagra coupons goodrx buyc.ialis.o.n.l.i.n.e.

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

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...

Pages

Add new comment