CentOS安装配置Solr环境
软件需求:
1、JDK 1.5或更高版本
2、Ant
3、Tomcat
第一步:安装JDK环境
版本: jdk1.6.0_25 ( jdk-6u25-linux-i586-rpm.bin )
# mkdir /usr/Java
# cd /usr/java
# wget jdk-6u25-linux-i586-rpm.bin
# sh jdk-6u25-linux-i586-rpm.bin
第二步:安装ant
版本:Apache Ant(TM) version 1.8.2 ( apache-ant-1.8.2-bin.tar.gz )
# mkdir /usr/local/ant
# cd /usr/local/ant
# wget apache-ant-1.8.2-bin.tar.gz
# tar xzvf apache-ant-1.8.2-bin.tar.gz
第三步:安装Tomcat
版本: Tomcat 7.0 ( apache-tomcat-7.0.12.tar.gz )
# mkdir /usr/local/tomcat7
# cd /usr/local/tomcat7
# wget apache-tomcat-7.0.12.tar.gz
# tar xzvf apache-tomcat-7.0.12.tar.gz
第四步:安装solr
版本:solr 3.0 ( apache-solr-3.1.0.tar.gz )
# mkdir /usr/local/solr3
# cd /usr/local/solr3
# wget apache-solr-3.1.0.tar.gz
# tar xzvf apache-solr-3.1.0.tar.gz
第五步:配置环境变量
JAVA_HOME=/usr/java/jdk1.6.0_25
TOMCAT_HOME=/usr/local/tomcat7
ANT_HOME=/usr/local/ant
CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
PATH=$PATH:$JAVA_HOME/bin:$ANT_HOME/bin:TOMCAT_HOME/bin
export JAVA_HOME TOMCAT_HOME ANT_HOME CLASSPATH PATH
export JAVA_OPTS="$JAVA_OPTS -Dsolr.solr.home=/usr/local/solr3/example/solr"
第六步:配置solr
# cp /usr/local/solr3/dist/apache-solr-3.1.0.war /usr/local/tomcat7/webapps/solr.war
# mkdir -p /usr/local/tomcat/conf/Catalina/localhost
# vim /usr/local/tomcat/conf/Catalina/localhost/solr.xml
<Context docBase="/usr/local/tomcat/webapps/solr.war" debug="0" crossContext="true">
<Environment name="solr/home" type="java.lang.String" value="/usr/local/solr3/example/solr" override="true" />
</Context>
# vim /usr/local/solr/example/solr/conf/solrconfig.xml
#初始
<dataDir>${solr.data.dir:}</dataDir>
#修改为
<dataDir>${solr.data.dir:/usr/local/solr3/example/solr/data}</dataDir>
# vim /usr/local/tomcat7/conf/tomcat-users.xml
#去掉注释块,加入以下内容
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<user username="tomcat" password="s3cret" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-script,admin-gui"/>
配置完成。
访问:http://localhost:8080/solr