进入到 /home/soft/
1 下载tomcat
wget http://mirrors.cnnic.cn/apache/tomcat/tomcat-7/v7.0.42/bin/apache-tomcat-7.0.42.tar.gz
2 解压缩
tar zxvf apache-tomcat-7.0.42.tar.gz
3 下载solr
wget http://apache.fayea.com/apache-mirror/lucene/solr/4.5.0/solr-4.5.0.tgz
4 解压缩 solr
tar zxvf solr-4.5.0.tgz
5 建立solrhome
mkdir –p /home/soft/solrhome
6 把solr的war包拷贝出来 并且重命名为solr..war 放到任意文件夹 本例将其放到 solrhome下面
cp /home/soft/solr-4.5.0/dist/ solr-4.5.0.war /home/soft/solrhome/solr.war
7 然后 将/home/soft/solr-4.5.0/example/solr 文件夹拷贝到 solrhome文件夹下面(此例子目录是单core模式 如果是多core模式 则拷贝multicore)
cp /home/soft/solr-4.5.0/example/solr /home/soft/solrhome/
8 配置tomcat
在 tomcat的conf/Catalina/localhost/文件夹下面 建立solr.xml(docBase指向war solr/home 指向sorlhome里面的solr文件夹)
vi conf/Catalina/localhost/solr.xml
<?xml version="1.0" encoding="utf-8"?>
<Context docBase="/home/soft/solrhome/solr1.war" reloadable="true" >
<Environment name="solr/home" type="java.lang.String" value="/home/soft/solrhome/solr/" override="true" />
</Context>
9 solr的日志相关的jar包
把/home/soft/solr-4.5.0/example/lib/ext 下面的全部jar 拷贝到 tomcat 的lib文件夹下面
把 /home/soft/solr-4.5.0/example/resources 下面的log4j配置文件 拷贝到 tomcat的 lib文件夹下面
10 单机版的配置修改
找到 每个collection下面的conf文件夹里面的solrconfig.xml
将<searchComponent name="clustering"
enable="${solr.clustering.enabled:true}"
class="solr.clustering.ClusteringComponent" >
改成<searchComponent name="clustering"
enable="${solr.clustering.enabled:false}"
class="solr.clustering.ClusteringComponent" >
安装 yum install -y unzip zip
11 下载 IK分词
http://ik-analyzer.googlecode.com/files/IK%20Analyzer%202012FF_hf1.zip (IK的这个版本支持4.0以上 下载时要注意)放到tomcat/webapps/solr/WEB-INF/lib下面
并且在 tomcat/webapps/solr/WEB-INF/下面 创建classes目录 然后将IK****.zip 解压缩后将IKAnalyzer.cfg.xml 和stopword.dic 两个文件拷贝到classes目录
修改 solrhome 下面的collection1/conf/schema/xml 加入如下类型
<fieldType name="text_ik" class="solr.TextField">
<analyzer class="org.wltea.analyzer.lucene.IKAnalyzer"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
</fieldType>
Ok 启动你的tomcat 访问http://localhost:8080/solr 看下管理界面 可进入测试了