Centos – 404 Error on Apache Solr install – CentOS 6 and Tomcat6

centoscentos6.2solrtomcat6

I've tried various tutorials and I get a 404 error when I finally navigate to host:port/solr on my CentOS machine.

Can anyone tell me why I would get a 404?

Once I find a solution I'll make this the official tutorial on how to install Apache Solr on a CentOS 6 / Tomcat6 configuration. In the meantime, there is very little documentation out there…


Tomcat6 Configuration (Source)

yum install tomcat6 tomcat6-webapps tomcat6-admin-webapps

vi /usr/share/tomcat6/conf/tomcat6.conf
JAVA_HOME="/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/"

Additionally, I've added an admin and manager role user in /etc/tomcat6/tomcat-users.xml


/usr/share/tomcat6/conf/Catalina/localhost/solr.xml

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

Best Answer

You must configure Tomcat to actually point to the Solr instance.

See Solr's example in their documentation:

<?xml version="1.0" encoding="utf-8"?>
<Context docBase="/opt/solr/example/solr/solr.war" debug="0" crossContext="true">
  <Environment name="solr/home" type="java.lang.String" value="/opt/solr/example/solr" override="true"/>
</Context>

This should be placed in $CATALINA_HOME/conf/Catalina/localhost/solr.xml, and adjust the paths for your install locations.