CentOS7.0下完美部署Solr 搜索引擎

来源:互联网 发布:常熟淘宝开店 编辑:程序博客网 时间:2024/06/07 06:01


一、环境准备:

系统环境:CentOS-7.0.1406
        tomcat-7.0.29

        jdk-7u9

        solr-4.7.0

首先将软件包上传到/tmp目录下
1、  jdk安装

[root@svn-server /]# cd /tmp/              [root@svn-server /]#tar zxvf  jdk-7u9-linux-x64.tar.gz[root@svn-server /]#mv  jdk1.7.0_09 /usr/[root@svn-server /]#vi  /etc/profile


在最后一行复制以下代码添加如下内容:
JAVA_HOME=/usr/jdk1.7.0_09/CLASSPATH=.:$JAVA_HOME/lib/tools.jarPATH=$JAVA_HOME/bin:$PATHexport JAVA_HOME CLASSPATH PATH


保存退出(:wq!)后,执行下面命令生效:

source /etc/profile


2、  tomcat安装
将tomcat包减压到tmp目录下:

[root@svn-server tmp]tar zxvf apache-tomcat-7.0.47.tar.gz 将tomcat包移动到/usr/local/tomcat 下:

[root@svn-server tmp]mv apache-tomcat-7.0.47  /usr/local/tomcat


二、安装solr
1、解压solr

[root@svn-server tmp]tar -zxvf solr-4.7.0.tgz  

2、将solr包移动到opt目录下:
[root@svn-server tmp]mv /tmp/solr-4.7.0  /opt/solr  

3、把exmaple/webapps中的solr.war复制到tomcat

[root@svn-server tmp]makdir  -p /opt/tomcat/webapps[root@svn-server tmp]cp /opt/solr/example/webapps/solr.war  /opt/tomcat/webapps/  [root@svn-server 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

[root@svn-server tmp]cd /usr/local/tomcat/bin/[root@svn-server bin]./startup.sh[root@svn-server 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/下:

[root@svn-server tmp]cp /opt/solr/example/lib/ext/*.jar  /opt/tomcat/webapps/solr/WEB-INF/lib/  



7、在tomcat solr下创建classpath,并把example/resources/log4j.properties复制到classpath中:

[root@svn-server tmp]mkdir -p /opt/tomcat/webapps/solr/classpath  [root@svnserver 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


最终运行效果展示如下:

本文借鉴 Linux公社网站相关资料(www.linuxidc.com)

转载请注明出处:http://blog.csdn.net/fwj380891124/ 


0 0
原创粉丝点击