CentOS下Tomcat 7+Solr 3的安装配置

下载

wget http://mirror.bjtu.edu.cn/apache/lucene/solr/3.1.0/apache-solr-3.1.0.tgz
wget http://labs.renren.com/apache-mirror/tomcat/tomcat-7/v7.0.12/bin/apache-tomcat-7.0.12.tar.gz
tar zxvf apache-solr-3.1.0.tgz
tar zxvf apache-tomcat-7.0.12.tar.gz
mv apache-solr-3.1.0 /usr/local/solr
mv apache-tomcat-7.0.12 /usr/local/tomcat

配置

vi /etc/profile
#加在最底下
export Java_HOME=/usr/lib/jvm/jre-1.6.0-openjdk
export CLASSPATH=.:$JAVA_HOME/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
export TOMCAT_HOME=/usr/local/tomcat
export JAVA_OPT="$JAVA_OPTS -Dsolr.solr.home=/usr/local/solr/example/solr"
cp /usr/local/solr/dist/apache-solr-3.1.0.war /usr/local/tomcat/webapps/solr.war
 
vi /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/solr/example/solr" override="true" />
</Context>
vi /usr/local/solr/example/solr/conf/solrconfig.xml
#初始
<dataDir>${solr.data.dir:}</dataDir>
#修改为
<dataDir>${solr.data.dir:/usr/local/solr/example/solr/data}</dataDir>
vi /usr/local/tomcat/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"/>

启动
/usr/local/tomcat/bin/startup.sh

浏览
http://localhost:8080/manager/status

CentOS下Tomcat 7+Solr 3的安装配置

http://localhost:8080/solr/

CentOS下Tomcat 7+Solr 3的安装配置

相关推荐