Solr简单部署

因为公司最近涉及这个项目,想了解一下,以便提供更好的支持。。

参考URL:

http://www.centoscn.com/CentosServer/test/2014/1127/4193.html

一、环境准备:

系统环境:CentOS-7.0.1406
        tomcat-7.0.29

        jdk-7u9

        solr-4.7.0

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

[plain] view plaincopyprint? 在CODE上查看代码片 派生到我的代码片
 
  1. [root@svn-server /]# cd /tmp/                
  2. [root@svn-server /]#tar zxvf  jdk-7u9-linux-x64.tar.gz  
  3. [root@svn-server /]#mv  jdk1.7.0_09 /usr/  
  4. [root@svn-server /]#vi  /etc/profile  

在最后一行复制以下代码添加如下内容:

[plain] view plaincopyprint? 在CODE上查看代码片 派生到我的代码片
 
  1. JAVA_HOME=/usr/jdk1.7.0_09/  
  2. CLASSPATH=.:$JAVA_HOME/lib/tools.jar  
  3. PATH=$JAVA_HOME/bin:$PATH  
  4. export JAVA_HOME CLASSPATH PATH  

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

[plain] view plaincopyprint? 在CODE上查看代码片 派生到我的代码片
 
  1. source /etc/profile  

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

[plain] view plaincopyprint? 在CODE上查看代码片 派生到我的代码片
 
  1. [root@svn-server tmp]tar zxvf apache-tomcat-7.0.47.tar.gz   
  2.   
  3. 将tomcat包移动到/usr/local/tomcat 下:  
[plain] view plaincopyprint? 在CODE上查看代码片 派生到我的代码片
 
  1. [root@svn-server tmp]mv apache-tomcat-7.0.47  /usr/local/tomcat  

二、安装solr
1、解压solr 

[plain] view plaincopyprint? 在CODE上查看代码片 派生到我的代码片
 
  1. [root@svn-server tmp]tar -zxvf solr-4.7.0.tgz    

2、将solr包移动到opt目录下:

[plain] view plaincopyprint? 在CODE上查看代码片 派生到我的代码片
 
  1. [root@svn-server tmp]mv /tmp/solr-4.7.0  /opt/solr    


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

[plain] view plaincopyprint? 在CODE上查看代码片 派生到我的代码片
 
  1. [root@svn-server tmp]makdir  -p /opt/tomcat/webapps  
  2. [root@svn-server tmp]cp /opt/solr/example/webapps/solr.war  /opt/tomcat/webapps/    
  3. [root@svn-server tmp]vim  /usr/local/tomcat/conf/server.xml 
[plain] view plaincopyprint? 在CODE上查看代码片 派生到我的代码片
 
  1. <Host name="localhost"  appBase="/opt/tomcat/webapps"  
  2.           unpackWARs="true" autoDeploy="true">  

如图将webapps改为/opt/tomcat/webapps 即可;

4、启动tomcat,solr.war 自动解压,修改solr项目下的web.xml

[plain] view plaincopyprint? 在CODE上查看代码片 派生到我的代码片
 
  1. [root@svn-server tmp]cd /usr/local/tomcat/bin/  
  2. [root@svn-server bin]./startup.sh  
  3. [root@svn-server bin]vi/opt/tomcat/webapps/solr/WEB-INF/web.xml  

5、修改solr home配置(注意:要把这段内容的注释去掉,否则不生效):

[html] view plaincopyprint? 在CODE上查看代码片 派生到我的代码片
 
  1. <env-entry>    
  2.   <env-entry-name>solr/home</env-entry-name>    
  3.   <env-entry-value>/opt/solr/example/solr</env-entry-value>    
  4.   <env-entry-type>java.lang.String</env-entry-type>    
  5. </env-entry>   

6、复制solr/example/lib/ext下的jar包到/tomcat/../solr/WEB-INF/lib/下:

[html] view plaincopyprint? 在CODE上查看代码片 派生到我的代码片
 
  1. [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中:

[html] view plaincopyprint? 在CODE上查看代码片 派生到我的代码片
 
  1. [root@svn-server tmp]mkdir -p /opt/tomcat/webapps/solr/classpath    
  2. [root@svnserver tmp]cp/opt/solr/example/resources/log4j.properties /opt/tomcat/webapps/solr/classpath/    

8、配置完成重启tomcat

[html] view plaincopyprint? 在CODE上查看代码片 派生到我的代码片
 
    1. /usr/local/tomcat/bin/shutdown.sh  
    2. /usr/local/tomcat/bin/startup.sh  

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值