Solr入门 Linux中 配置tomcat7 jdk 1.7
一、环境准备:
系统环境:CentOS 6.5
Tomcat 7.0.26
jdk-7u17-linux-x64.rpm
solr-4.10.1.tgz
首先将软件包上传到/tmp目录下
1、 jdk安装
]# rpm -ivh jdk-7u17-linux-x64.rpm
Preparing... ########################################### [100%]
1:jdk ########################################### [100%]
Unpacking JAR files...
rt.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_17/jre/lib/rt.pack
jsse.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_17/jre/lib/jsse.pack
charsets.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_17/jre/lib/charsets.pack
tools.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_17/lib/tools.pack
localedata.jar...
Error: Could not open input file:/usr/java/jdk1.7.0_17/jre/lib/ext/localedata.pack
plugin.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_17/jre/lib/plugin.pack
javaws.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_17/jre/lib/javaws.pack
deploy.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_17/jre/lib/deploy.pack
配置$PATH:vi /etc/profile
#在/etc/profile的最后加上这一段
set JAVA_HOME=/usr/java/jdk1.7.0_17
export JAVA_HOME
set PATH=$PATH:$JAVA_HOME
export PATH
set CLASSPATH=.:JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export CLASSPATH
# java -version
java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b03)
# javac-version
javac 1.7.0_17
2、 tomcat安装
将tomcat包减压到tmp目录下:
#tar zxvf apache-tomcat-7.0.26.tar.gz
将tomcat包移动到/usr/local/tomcat 下:
#mv apache-tomcat-7.0.26 /usr/local/tomcat
二、安装solr
1、解压solr
#tar -zxvf solr-4.10.1.tgz
2、将solr包移动到opt目录下:
#mv /tmp/solr-4.10.1 /opt/solr
3、把exmaple/webapps中的solr.war复制到tomcat
#makdir -p /opt/tomcat/webapps
#]cp /opt/solr/example/webapps/solr.war /opt/tomcat/webapps/
#vim /usr/local/tomcat/conf/server.xml
<Host name="localhost" appBase="/opt/tomcat/webapps"
unpackWARs="true"autoDeploy="true">
如上将webapps改为/opt/tomcat/webapps即可;
4、启动tomcat,solr.war 自动解压,修改solr项目下的web.xml
cd /usr/local/tomcat/bin/
#./startup.sh
#vi/opt/tomcat/webapps/solr/WEB-INF/web.xml
5、修改solr home配置(注意:要把这段内容的注释去掉,否则不生效):
<env-entry>
<env-entry-name>solr/home</env-entry-name>
<env-entry-value>/opt/solr/example/solr</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
6、复制solr/example/lib/ext下的jar包到/tomcat/../solr/WEB-INF/lib/下:
#cp /opt/solr/example/lib/ext/*.jar /opt/tomcat/webapps/solr/WEB-INF/lib/
7、在tomcat solr下创建classpath,并把example/resources/log4j.properties复制到classpath中:
#mkdir -p /opt/tomcat/webapps/solr/classpath
#cp/opt/solr/example/resources/log4j.properties/opt/tomcat/webapps/solr/classpath/
8、配置完成重启tomcat
#sh /usr/local/tomcat/bin/shutdown.sh
#sh /usr/local/tomcat/bin/startup.sh
9、浏览器输入http://192.168.1.119:8080/solr/进入solr admin画面
如果访问不了,注意防火墙设置
(1) 重启后永久性生效:
开启:chkconfig iptables on 关闭:chkconfig iptables off
(2) 即时生效,重启后失效:
开启:service iptables start 关闭:service iptables stop
参考:
http://blog.csdn.net/idesvo/article/details/8609512
http://www.linuxidc.com/Linux/2014-03/98024.htm
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。