1、解压solr
[[email protected] tmp]tar -zxvf solr-4.7.0.tgz
2、将solr包移动到opt目录下:
[[email protected] tmp]mv /tmp/solr-4.7.0 /opt/solr
3、把exmaple/webapps中的solr.war复制到tomcat
[[email protected] tmp]makdir -p /opt/tomcat/webapps
[[email protected] tmp]cp /opt/solr/example/webapps/solr.war /opt/tomcat/webapps/
[[email protected] tmp]vim /usr/local/tomcat/conf/server.xml
<Host name="localhost" appBase="/opt/tomcat/webapps"
unpackWARs="true" autoDeploy="true">
如图将webapps改为/opt/tomcat/webapps 即可;
4、启动tomcat,solr.war 自动解压,修改solr项目下的web.xml
[[email protected] tmp]cd /usr/local/tomcat/bin/
[[email protected] bin]./startup.sh
[[email protected] bin]vi/opt/tomcat/webapps/solr/WEB-INF/web.xml
5、修改solr home配置(注意:要把这段内容的注释去掉,否则不生效):
<env-entry>
<env-entry-name>solr/home</env-entry-name>
<env-entry-value>/opt/solr/example/solr</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
6、复制solr/example/lib/ext下的jar包到/tomcat/../solr/WEB-INF/lib/下:
[[email protected] tmp]cp /opt/solr/example/lib/ext/*.jar /opt/tomcat/webapps/solr/WEB-INF/lib/
7、在tomcat solr下创建classpath,并把example/resources/log4j.properties复制到classpath中:
[[email protected] tmp]mkdir -p /opt/tomcat/webapps/solr/classpath
[[email protected] tmp]cp/opt/solr/example/resources/log4j.properties /opt/tomcat/webapps/solr/classpath/
8、配置完成重启tomcat
/usr/local/tomcat/bin/shutdown.sh
/usr/local/tomcat/bin/startup.sh
9、浏览器输入http://192.168.1.196:8080/solr/进入solr admin画面