Skip to content

Instantly share code, notes, and snippets.

@kathgironpe
Created April 14, 2011 23:29
Show Gist options
  • Save kathgironpe/920829 to your computer and use it in GitHub Desktop.
Save kathgironpe/920829 to your computer and use it in GitHub Desktop.
Install Tomcat 6 and Solr on Mac OS X.

SolR and Tomcat

1. Install Tomcat on Mac

Sources: 
http://www.malisphoto.com/tips/tomcatonosx.html

http://wiki.apache.org/solr/SolrTomcat

http://yoodey.com/content/howto-install-solr-14-mac-os-x-1064-snow-leopard-tomcat-6-and-multi-core-multi-instance-5

Start here: 

cd ~/src
wget http://apache.is.co.za/lucene/solr/1.4.1/apache-solr-1.4.1.tgz
tar xvzf apache-solr-1.4.1.tgz

wget http://www.bizdirusa.com/mirrors/apache/tomcat/tomcat-6/v6.0.32/bin/apache-tomcat-6.0.32.tar.gz


mate ~/.bash_profile
Add these lines: 
export JAVA_HOME=/Library/Java/Home
export CATALINA_HOME=/Library/Tomcat/Home 

source ~/.bash_profile

sudo mkdir -p /Library/Tomcat
cd /Library
chown root Tomcat
chgrp admin Tomcat

cd /Library/Tomcat
sudo tar xvzf ~/src/apache-tomcat-6.0.32.tar.gz

sudo ln -sfhv apache-tomcat-6.0.32 Home

# Change directories to the Tomcat configuration directory
cd Home/conf

sudo chmod 755 *

# Edit the tomcat-users.xml file
sudo mate tomcat-users.xml

# Replace content with: 
<?xml version='1.0' encoding='utf-8'?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<tomcat-users>
<!--
  NOTE:  By default, no user is included in the "manager-gui" role required
  to operate the "/manager/html" web application.  If you wish to use this app,
  you must define such a user - the username and password are arbitrary.
-->
<!--
  NOTE:  The sample user and role entries below are wrapped in a comment
  and thus are ignored when reading this file. Do not forget to remove
  <!.. ..> that surrounds them.
-->
<!--
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>
-->
<roll rollname="manager"/>
<user username="admin" password="password" roles="standard,manager,admin"/>

</tomcat-users>

# Change directories to where the Tomcat startup scripts are located
cd ../bin

# Remove the .bat scripts
sudo rm *.bat

# Execute the Tomcat startup script
sudo ./startup.sh


#kill the process
ps aux | grep tomcat
sudo kill nnnn (PID/  digits on the left side)


2. Install Apache SOLR 1.4.1 in Mac OS X

sudo mkdir -p /Library/Tomcat/webapps
sudo cp ~/src/apache-solr-1.4.1/dist/apache-solr-1.4.1.war /Library/Tomcat/webapps/solr.war
sudo cp -R ~/src/apache-solr-1.4.1/example/solr /Library/Tomcat/

sudo mate /Library/Tomcat/Home/conf/Catalina/localhost/solr.xml

COPY AND PASTE THIS ON THE FILE: 

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

cd /Library/Tomcat/Home/conf/Catalina/localhost

sudo mkdir -p /Library/Tomcat/solr/data


sudo mate /Library/Tomcat/solr/conf/solrconfig.xml 

Update this: 
<dataDir>/Library/Tomcat/solr/data</dataDir>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment