1.安装tomcat6

 

<span class="n">sudo</span> <span class="n">apt</span><span class="o">-</span><span class="n">get</span> <span class="n">install</span> <span class="n">tomcat6</span>
<br />
2.下载solr
<pre><span class="n">mkdir</span> <span class="o">-</span><span class="n">p</span> <span class="o">~/</span><span class="n">tmp</span><span class="o">/</span><span class="n">solr</span><span class="o">/</span>
<span class="n">cd</span> <span class="o">~/</span><span class="n">tmp</span><span class="o">/</span><span class="n">solr</span><span class="o">/</span>
wget http://www.ecoficial.com/apachemirror/lucene/solr/1.4.1/apache-solr-1.4.1.tgz
下载的速度在国内比较慢你需要有一些耐心
tar -zxvf apache-solr-1.4.1.tgz
<br />
<pre><span class="n">sudo</span> <span class="n">mkdir</span> <span class="o">-</span><span class="n">p</span> <span class="o">/</span><span class="n">var</span><span class="o">/</span><span class="n">solr</span>
<span class="n">sudo cp apache-solr-1.4.1/dist/apache-solr-1.4.1.war /var/solr/solr.war<br /></span>
<span class="n">sudo cp -R apache-solr-1.4.1/example/multicore/* /var/solr/</span>
<span class="n">sudo chown -R tomcat6 /var/solr/</span>
<span class="n"><br /></span>
<br />
<span class="o"><br /></span>
<br />
<pre><span class="n">echo</span> <span class="o">-</span><span class="n">e</span> <span class="s">\'<Context docBase="/var/solr/solr.war" debug="0" privileged="true" allowLinking="true" \'</span>\
<span class="s">\'crossContext="true"></span><span class="se">\n</span><span class="s"><Environment name="solr/home" type="java.lang.String" value="/var/solr" \'</span>\
<span class="s">\'override="true" /></span><span class="se">\n</span><span class="s"></Context>\'</span> <span class="o">|</span> <span class="n">sudo</span> <span class="n">tee</span> <span class="o">-</span><span class="n">a</span> <span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">tomcat6</span><span class="o">/</span><span class="n">Catalina</span><span class="o">/</span><span class="n">localhost</span><span class="o">/</span><span class="n">solr</span><span class="o">.</span><span class="n">xml</span>
<span class="n">cat </span><span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">tomcat6</span><span class="o">/</span><span class="n">Catalina</span><span class="o">/</span><span class="n">localhost</span><span class="o">/</span><span class="n">solr</span><span class="o">.</span><span class="n">xml</span>
<pre><span class="n">echo</span> <span class="s">\'TOMCAT6_SECURITY=no\'</span> <span class="o">|</span> <span class="n">sudo</span> <span class="n">tee</span> <span class="o">-</span><span class="n">a</span> <span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">default</span><span class="o">/</span><span class="n">tomcat6</span>
cat /etc/default/tomcat6
sudo vi /etc/init.d/tomcat6 near line 84 add this bellow line
<pre><span class="n">JAVA_OPTS</span><span class="o">=</span><span class="s">"$JAVA_OPTS -Dsolr.home=/var/solr"</span>
<span class="s">3.重启tomcat,</span>
<span class="s"><pre><span class="n">sudo</span> <span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">init</span><span class="o">.</span><span class="n">d</span><span class="o">/</span><span class="n">tomcat6</span> <span class="n">restart</span>
<span class="n">访问http://localhost:8080/solr/<br /></span>
<br />
以上在ubuntu 8.04上有问题,主要是tomcat restart 上会报/etc/init.d/tomcat6: 156: Syntax error: "(" unexpected
在ubuntu10.04.1上测试通过

版权声明:本文为lexus原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/lexus/archive/2010/08/22/1805763.html