This is for Tomcat5.5 (on Debian Lenny), WordPress 3.1 and Solr 3.4. The intention is to use the solr-for-wordpress plugin (see github ).
Lenny does include a Solr package (v1.2) which is somewhat outdated (and not supported by the upstream solr-for-wordpress wordpress plugin, hence we can’t use it).
Install Tomcat (and Java)
apt-get install sun-java6-jre
Edit /etc/profile and set a JAVA_HOME – so add in something like :
# Setup Jave environment 6
And then do :
So those settings are set / present within your environment (or logout and back in).
Next, install Tomcat :
apt-get install tomcat5.5
apt-get install tomcat5.5-admin
Edit /etc/tomcat5.5/tomcat-users.xml and define your own user; for the -admin apps you’ll need to give the user a role of admin and manager.
<?xml version='1.0' encoding='utf-8'?>
<user username="palepurple" password="letmein" roles="admin,manager,tomcat"/>
And then restart Tomcat. You should now be able to visit http://yourserver:8180/admin and see a login screen.
In my case, I also edited /etc/tomcat5.5/server.xml to disable the AJP connector on port 8009 and also to tell the remaining connector (port 8180) to listen only on 127.0.0.1. To connect to the admin interface, I just use SSH port forwarding from my desktop – this is just to improve security.
Finally, it seems necessary to grant permission for Java to log to /var/log/tomcat5.5… .a dirty way of achieving this is to edit :
and add in (near the top)
(Yes, I know this is a bit like doing chmod -R 777 on a filesystem or something; but in my case Solr is running only on localhost, so I think it’s an acceptable fix; I’m sure Google can provide more eloquent fixes.).
Download; unpack and install .war file :
tar -zxf apache-solr-3.4.0.tgz
cp apache-solr-3.4.0/dist/apache-solr-3.4.0.war /var/lib/tomcat5.5/webapps
If you now restart Solr, you’ll find some log files and stuff of use in /var/log/tomcat5.5 – looking in the catalina log file there you’ll see it moaning about not finding solrconfig.xml and so on. To fix this –
cp -a apache-solr-3.4.0/example/solr /var/lib/tomcat5.5/
And edit /etc/default/tomcat55 to contain :
export JAVA_OPTS="$JAVA_OPTS -Dsolr.solr.home=/var/lib/tomcat5.5/solr"
This tells Solr where to find it’s configuration and so on.
Then edit :
/var/lib/tomcat5.5/solr/conf/solrconfig.xml and fix the file paths to the various .jar files included – so in my case (you might want to copy them out of the apache-solr-3.4.0 dir and into /var/lib/tomcat5.5/solr/lib perhaps) – part of the solrconfig.xml is below :
<lib dir="/var/lib/tomcat5.5/apache-solr-3.4.0/contrib/extraction/lib" />
<!-- When a regex is specified in addition to a directory, only the
files in that directory which completely match the regex
(anchored on both ends) will be included.
<lib dir="/var/lib/tomcat5.5/apache-solr-3.4.0/dist/" regex="apache-solr-cell-\d.*\.jar" />
<lib dir="/var/lib/tomcat5.5/apache-solr-3.4.0/dist/" regex="apache-solr-clustering-\d.*\.jar" />
<lib dir="/var/lib/tomcat5.5/apache-solr-3.4.0/dist/" regex="apache-solr-dataimporthandler-\d.*\.jar" />
<!-- If a dir option (with or without a regex) is used and nothing
is found that matches, it will be ignored
<lib dir="/var/lib/tomcat5.5/apache-solr-3.4.0/contrib/clustering/lib/" />
Next create the data directory for solr to use :
chown tomcat55 /var/lib/tomcat5.5/solr/data
And restart tomcat.
At this point you should be able to visit :
If it fails, check out /var/log/tomcat5.5/*catalina.log* or /var/log/daemon.log
git clone https://github.com/mattweber/solr-for-wordpress.git
cp solr-for-wordpress/schema.xml /var/lib/tomcat5.5/solr/conf/
<<restart tomcat again; /etc/init.d/tomcat5.5. restart >>
Now you just need to enable the plugin from within wordpress and tell wordpress to index your posts and you’re off.
- Enable plugin
- Goto settings -> solr options -> select single server; tell it to use localhost, port 8180 and under the path ‘/apache-solr-3.4.0’
- Perform the ‘server ping’ check; and then tell WordPress you want to index your pages/posts etc as you see fit.