1、版本选择
solr-5.3.1.tgz apache-tomcat-8.0.29.tar.gz
2、解压tomcat和solr
[[email protected] solr]# tar -zxvf apache-tomcat-8.0.29.tar.gz [[email protected] solr]# tar -zxvf solr-5.3.1.tgz
3、复制solr项目到tomcat
1)将/solr-5.3.1/server/solr-webapp目录下的webapp复制到tomcat的webapps目录中
[[email protected] solr-webapp]# pwd /luxh/solr/solr-5.3.1/server/solr-webapp [[email protected] solr-webapp]# ls webapp [[email protected] solr-webapp]# cp -r webapp/ /luxh/solr/apache-tomcat-8.0.29/webapps/
2)将复制到tomcat中的webapp改名为solr
[[email protected] solr-webapp]# cd /luxh/solr/apache-tomcat-8.0.29/webapps [[email protected] webapps]# ls docs examples host-manager manager ROOT webapp [[email protected] webapps]# mv webapp/ solr [[email protected] webapps]# ls docs examples host-manager manager ROOT solr [[email protected] webapps]#
4、建立solr根目录
[[email protected] solr]# mkdir solr_home [[email protected] solr]# cd solr_home/ [[email protected] solr_home]# pwd /luxh/solr/solr_home
将solr-5.3.1/server/solr目录下的所有文件拷贝到solr根目录
[[email protected] solr]# pwd /luxh/solr/solr-5.3.1/server/solr [[email protected] solr]# ls configsets README.txt solr.xml zoo.cfg [[email protected] solr]# cp -r /luxh/solr/solr-5.3.1/server/solr/* /luxh/solr/solr_home/ [[email protected] solr]#
5、配置tomcat中的solr项目
1)修改solr项目的web.xml文件
[[email protected] WEB-INF]# pwd /luxh/solr/apache-tomcat-8.0.29/webapps/solr/WEB-INF [[email protected] WEB-INF]# vi web.xml
去掉<env-entry>的注释,并将<env-entry-value>的值设置为之前建立solr的根目录
<env-entry> <env-entry-name>solr/home</env-entry-name> <env-entry-value>/luxh/solr/solr_home</env-entry-value> <env-entry-type>java.lang.String</env-entry-type> </env-entry>
2)将solr-5.3.1/server/lib/ext目录下的所有jar包拷贝的solr项目中
[[email protected] ext]# cp -r /luxh/solr/solr-5.3.1/server/lib/ext/* /luxh/solr/apache-tomcat-8.0.29/webapps/solr/WEB-INF/lib/ [[email protected] ext]#
3)将solr-5.3.1/server/resources目录中的log4j.properties拷贝的solr项目中
先创建classes文件夹
[[email protected] WEB-INF]# pwd /luxh/solr/apache-tomcat-8.0.29/webapps/solr/WEB-INF [[email protected] WEB-INF]# ls lib weblogic.xml web.xml [[email protected] WEB-INF]# mkdir classes [[email protected] WEB-INF]# ls classes lib weblogic.xml web.xml [[email protected] WEB-INF]#
拷贝log4j.properties
[[email protected] resources]# pwd /luxh/solr/solr-5.3.1/server/resources [[email protected] resources]# ls jetty-logging.properties log4j.properties [[email protected] resources]# cp log4j.properties /luxh/solr/apache-tomcat-8.0.29/webapps/solr/WEB-INF/classes [[email protected] resources]#
6、启动tomcat
[[email protected] apache-tomcat-8.0.29]# pwd /luxh/solr/apache-tomcat-8.0.29 [[email protected] apache-tomcat-8.0.29]# bin/startup.sh
7、访问 http://你的ip:8080/solr/admin.html ,出现如下界面,说明部署成功。
时间: 2024-12-28 08:14:31