Tomcat and Solr on EC2

First of all, install tomcat. You can choose your own version.

yum install tomcat7

Now we need to install Solr manually. Let's first download it:


Unpack it, and make the new folder solr. Then, we just need to properly place all the files in this folder:

cp -R apache-solr-3.6.0/example/solr/* /solr
cp apache-solr-3.6.0/dist/apache-solr-3.6.0.war /solr/solr.war

Now let's configure Tomcat to point at this. Create a file with vi.

vi /etc/tomcat7/Catalina/localhost/solr.xml

Then place this text inside:

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

Let tomcat user access the folder.

chown -R tomcat:tomcat /solr

Now copy you schema.xml and place it in /solr/conf/schema.xml. (Or make a symbolic link ln -s <your schema.xml> /solr/conf/schema.xml)

And also edit /solr/conf/solrconfig.xml. Fix the data path:


and also fix all the lib tags in it.

Now restart Tomcat with /etc/init.d/tomcat7 restart.

That's it.