Apache solr for drupal on debian
Installing apache solr with tomcat6 on debian in /usr/local (based on http://xdeb.org/node/1213)
Change /etc/apt/sources.list so that non-free packages can be used:
1 | deb http://ftp.nl.debian.org/debian/ lenny main contrib non-free |
Install Java:
1 | apt-get install sun-java6-jdk |
Install Tomcat6 to /usr/local:
1 2 3 4 | cd /usr/src wget http://apache.osuosl.org/tomcat/tomcat-6/v6.0.24/bin/apache-tomcat-6.0.24.tar.gz tar xzf apache-tomcat-6.0.24.tar.gz mv apache-tomcat-6.0.24 /usr/local/tomcat6 |
Install Solr:
1 2 3 4 5 6 | cd /usr/src wget http://apache.osuosl.org/lucene/solr/1.4.0/apache-solr-1.4.0.tgz cp ./apache-solr-1.4.0/dist/apache-solr-1.4.0.war /usr/local/tomcat6/webapps/solr.war cp -r ./apache-solr-1.4.0/example/solr /usr/local/solr mkdir -p /usr/local/tomcat6/conf/Catalina/localhost/ pico /usr/local/tomcat6/conf/Catalina/localhost/solr.xml |
Now add the configuration here:
1 2 3 | <Context docBase="/usr/local/tomcat6/webapps/solr.war" debug="0" crossContext="true" > <Environment name="solr/home" type="java.lang.String" value="/usr/local/solr" override="true" /> </Context> |
Edit pico /usr/local/tomcat6/conf/server.xml and change the Connector tag to:
1 2 3 4 5 | <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" address="127.0.0.1" URIEncoding="UTF-8" /> |
Add the tomcat service to the system:
1 | echo "ENABLED=1" > /etc/default/tomcat |
Add the init.d startup script to /etc/init.d/tomcat:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # Tomcat auto-start ## description: Auto-starts tomcat # processname: tomcat # pidfile: /var/run/tomcat.pid ENABLED=0 if [ -f /etc/default/tomcat ]; then . /etc/default/tomcat fi if [ "$ENABLED" = "0" ]; then exit 0 fi export JAVA_HOME=/usr/lib/jvm/java-6-sun/jre export JAVA_OPTS="$JAVA_OPTS -Dsolr.solr.home=/usr/local/solr" export CATALINA_OPTS="-Xms64m -Xmx64m" case $1 in start) sh /usr/local/tomcat6/bin/startup.sh ;; stop) sh /usr/local/tomcat6/bin/shutdown.sh ;; restart) sh /usr/local/tomcat6/bin/shutdown.sh sh /usr/local/tomcat6/bin/startup.sh ;; esac exit 0 |
Add tomcat user and give ownership:
1 2 3 | adduser --shell /bin/false tomcat tomcat chown -R tomcat:tomcat /usr/local/tomcat6 chown -R tomcat:tomcat /usr/local/sol |