版本:solr-4.10.3、tomcat-8.0
1、将下载的solr解压至:/home/test/software
$:tar -xzvf solr-4.10.3.tgz -C /home/test/software
2、将下载的tomcat解压至:/home/test/software
$:tar -xzvf apache-tomcat-8.0.36.tar.gz -C /home/test/software
3、拷贝/home/test/software/solr-4.10.3/example/webapps/solr.war到Tomcat的webapps/目录中。直接解压 solr.war 或者启动Tomcat 解压 solr.war
启动tomcat解压:$:${tomcat安装目录}/apache-tomcat-8.0.36/bin/catalina.sh start
jar解压war:$:jar -xvf solr.war
4、新建/home/test/software/solrData目录,拷贝 /home/test/software/solr-4.10.3/example/solr文件夹到/home/test/software/solrData
$:cp -r /home/test/software/solr-4.10.3/example/solr /home/test/software/solrData
5、修改 /home/test/software/solrData/solr/collection1/conf/solrconfig.xml
将
<dataDir>${solr.data.dir:}</dataDir>
改为:
<dataDir>${solr.data.dir:/home/test/software/solrData/solr/collection1/data}</dataDir>
6、修改${tomcat安装目录}/apache-tomcat-8.0.36/webapps/solr/WEB-INF/web.xml
将
<!--
<env-entry>
<env-entry-name>solr/home</env-entry-name>
<env-entry-value>/put/your/solr/home/here</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
-->
改为:
<env-entry>
<env-entry-name>solr/home</env-entry-name>
<env-entry-value>/home/test/software/solrData/solr</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
7、复制/home/test/software/solr-4.10.3/example/lib/ext下所有的jar包到${tomcat安装目录}/apache-tomcat-8.0.36/webapps/solr/WEB-INF/lib中
8、在${tomcat安装目录}/apache-tomcat-8.0.36/webapps/solr/WEB-INF下创建文件classes文件夹,复制/home/test/software/solr-4.10.3/example/resources/log4j.properties到${tomcat安装目录}/apache-tomcat-8.0.36/webapps/solr/WEB-INF/classes文件夹中,并将solr.log改为/home/test/software/solrData/logs,solr.log=/home/test/software/solrData/logs。记得在/home/test/software/solrData下创建文件夹
9、将nutch安装目录conf目录下的schema.xml复制到/home/test/software/solrData/solr/collection1/conf/,替换原有的schema.xml文件,这样nutch启动抓取指定solrUrl参数后,即可在solr上建立索引,通过solr搜索;
10、重新启动Tomcat即可访问solr管理界面了http://localhost:8080/solr