首页 > 代码库 > centos5.8 安装tomcat7、solr4.9

centos5.8 安装tomcat7、solr4.9

先下载相应的软件
Tomcat7.0 点击下载
Solr4.9 点击下载

solr4.9需要jdk1.7所以要先升级java:
查看当前版本:
yum search java | grep -i --color JDK
升级:
yum install java-1.7.0-openjdk java-1.7.0-openjdk-devel

安装tomcat7:

unzip apache-tomcat-7.0.54.zip
mv apache-tomcat-7.0.54 /data/tomcat7
修改端口:/data/tomcat7/conf/server.xml
8080就是:
<Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
启动tomcat7:
cd /data/tomcat7/bin
chmod +x ./shutdown.sh ./startup.sh ./catalina.sh
./startup.sh
提示如下表示成功:
Using CATALINA_BASE:   /data/tomcat7
Using CATALINA_HOME:   /data/tomcat7
Using CATALINA_TMPDIR: /data/tomcat7/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /data/tomcat7/bin/bootstrap.jar:/data/tomcat7/bin/tomcat-juli.jar
Tomcat started.
访问:http://localhost:8080 查看
设置tomcat gui权限:
vi /data/tomcat7/conf/tomcat-users.xml
将:
<!--
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>
-->
改为:
<role rolename="manager-gui"/>
  <user username="你的账号" password="密码" roles="manager-gui"/>

安装solr4.9

unzip solr-4.9.0.zip
cd solr-4.9.0
cp solr-4.9.0/dist/solr-4.9.0.war /data/tomcat7/webapps/solr.war
修改solr索引文件主目录:/data/tomcat7/webapps/solr/WEB-INF/web.xml
<!--
    <env-entry>
       <env-entry-name>solr/home</env-entry-name>
       <env-entry-value>/put/your/solr/home/here</env-entry-value>
       <env-entry-type>java.lang.String</env-entry-type>
    </env-entry>
   -->
改为:
<env-entry-name>solr/home</env-entry-name>
       <env-entry-value>/data/solr</env-entry-value>
       <env-entry-type>java.lang.String</env-entry-type>
    </env-entry>
创建solr索引目录:
mkdir -p /data/solr
cp -rf solr-4.9.0/example/solr/* /data/solr/
修改/data/solr/collection1/conf/solrconfig.xml:
${solr.data.dir:}
改为:
${solr.data.dir:/data/solr/collection1/data}
最后复制相应的jar文件(重要)
cp -rf solr-4.9.0/example/lib/ext/* /data/tomcat7/lib/
cp -rf solr-4.9.0/example/resources/log4j.properties /data/tomcat7/lib
最后重启tomcat7:
/data/tomcat7/bin/shutdown.sh
/data/tomcat7/bin/startup.sh

centos5.8 安装tomcat7、solr4.9