Linux Solr服務器搭建

1.建立solr目錄css

mkdir solr

2.進入到solr目錄 下載tomcat,解壓縮html

cd solr/
wget http://zsj-linux.oss-cn-hangzhou.aliyuncs.com/apache-tomcat-8.0.30.tar.gz
tar -zxvf apache-tomcat-8.0.30.tar.gz 
rm -rf apache-tomcat-8.0.30.tar.gz

3.進入到tomcat目錄下 進入到webAPPs目錄下java

[root@iZm5e0c5bxd15k4yfdiirsZ solr]# cd apache-tomcat-8.0.30/
[root@iZm5e0c5bxd15k4yfdiirsZ apache-tomcat-8.0.30]# ls
bin  conf  lib  LICENSE  logs  NOTICE  RELEASE-NOTES  RUNNING.txt  temp  webapps  work
[root@iZm5e0c5bxd15k4yfdiirsZ apache-tomcat-8.0.30]# cd webapps/
[root@iZm5e0c5bxd15k4yfdiirsZ webapps]# ls
docs  examples  host-manager  manager  ROOT
[root@iZm5e0c5bxd15k4yfdiirsZ webapps]# rm -rf docs/ examples/ host-manager/ manager/ ROOT/

4.下載solr.war 並啓動tomcat linux

[root@iZm5e0c5bxd15k4yfdiirsZ webapps]# wget http://zsj-linux.oss-cn-hangzhou.aliyuncs.com/solr.war
--2017-08-31 17:45:37--  http://zsj-linux.oss-cn-hangzhou.aliyuncs.com/solr.war
Resolving zsj-linux.oss-cn-hangzhou.aliyuncs.com (zsj-linux.oss-cn-hangzhou.aliyuncs.com)... 116.62.99.177, 120.27.176.84
Connecting to zsj-linux.oss-cn-hangzhou.aliyuncs.com (zsj-linux.oss-cn-hangzhou.aliyuncs.com)|116.62.99.177|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 29741796 (28M) [application/octet-stream]
Saving to: ‘solr.war’

100%[====================================================================================================================================================================================================================================>] 29,741,796  4.13MB/s   in 7.0s   

2017-08-31 17:45:44 (4.08 MB/s) - ‘solr.war’ saved [29741796/29741796]

[root@iZm5e0c5bxd15k4yfdiirsZ webapps]# ls
solr.war
[root@iZm5e0c5bxd15k4yfdiirsZ webapps]# cd ..
[root@iZm5e0c5bxd15k4yfdiirsZ apache-tomcat-8.0.30]# cd bin/
[root@iZm5e0c5bxd15k4yfdiirsZ bin]# ls
bootstrap.jar  catalina.sh         commons-daemon.jar            configtest.bat  daemon.sh   digest.sh         setclasspath.sh  shutdown.sh  startup.sh       tomcat-native.tar.gz  tool-wrapper.sh  version.sh
catalina.bat   catalina-tasks.xml  commons-daemon-native.tar.gz  configtest.sh   digest.bat  setclasspath.bat  shutdown.bat     startup.bat  tomcat-juli.jar  tool-wrapper.bat      version.bat
[root@iZm5e0c5bxd15k4yfdiirsZ bin]# ./startup.sh run
Using CATALINA_BASE:   /opt/solr/apache-tomcat-8.0.30
Using CATALINA_HOME:   /opt/solr/apache-tomcat-8.0.30
Using CATALINA_TMPDIR: /opt/solr/apache-tomcat-8.0.30/temp
Using JRE_HOME:        /opt/jdk1.8.0_11
Using CLASSPATH:       /opt/solr/apache-tomcat-8.0.30/bin/bootstrap.jar:/opt/solr/apache-tomcat-8.0.30/bin/tomcat-juli.jar
Tomcat started.
[root@iZm5e0c5bxd15k4yfdiirsZ bin]# ls
bootstrap.jar  catalina.sh         commons-daemon.jar            configtest.bat  daemon.sh   digest.sh         setclasspath.sh  shutdown.sh  startup.sh       tomcat-native.tar.gz  tool-wrapper.sh  version.sh
catalina.bat   catalina-tasks.xml  commons-daemon-native.tar.gz  configtest.sh   digest.bat  setclasspath.bat  shutdown.bat     startup.bat  tomcat-juli.jar  tool-wrapper.bat      version.bat
[root@iZm5e0c5bxd15k4yfdiirsZ bin]# cd ..
[root@iZm5e0c5bxd15k4yfdiirsZ apache-tomcat-8.0.30]# cd bin/
[root@iZm5e0c5bxd15k4yfdiirsZ bin]# ls
bootstrap.jar  catalina.sh         commons-daemon.jar            configtest.bat  daemon.sh   digest.sh         setclasspath.sh  shutdown.sh  startup.sh       tomcat-native.tar.gz  tool-wrapper.sh  version.sh
catalina.bat   catalina-tasks.xml  commons-daemon-native.tar.gz  configtest.sh   digest.bat  setclasspath.bat  shutdown.bat     startup.bat  tomcat-juli.jar  tool-wrapper.bat      version.bat
[root@iZm5e0c5bxd15k4yfdiirsZ bin]# ./shutdown.sh 
Using CATALINA_BASE:   /opt/solr/apache-tomcat-8.0.30
Using CATALINA_HOME:   /opt/solr/apache-tomcat-8.0.30
Using CATALINA_TMPDIR: /opt/solr/apache-tomcat-8.0.30/temp
Using JRE_HOME:        /opt/jdk1.8.0_11
Using CLASSPATH:       /opt/solr/apache-tomcat-8.0.30/bin/bootstrap.jar:/opt/solr/apache-tomcat-8.0.30/bin/tomcat-juli.jar
[root@iZm5e0c5bxd15k4yfdiirsZ bin]# ls
bootstrap.jar  catalina.sh         commons-daemon.jar            configtest.bat  daemon.sh   digest.sh         setclasspath.sh  shutdown.sh  startup.sh       tomcat-native.tar.gz  tool-wrapper.sh  version.sh
catalina.bat   catalina-tasks.xml  commons-daemon-native.tar.gz  configtest.sh   digest.bat  setclasspath.bat  shutdown.bat     startup.bat  tomcat-juli.jar  tool-wrapper.bat      version.bat
[root@iZm5e0c5bxd15k4yfdiirsZ bin]# cd ..
[root@iZm5e0c5bxd15k4yfdiirsZ apache-tomcat-8.0.30]# cd webapps/
[root@iZm5e0c5bxd15k4yfdiirsZ webapps]# ls
solr  solr.war
[root@iZm5e0c5bxd15k4yfdiirsZ webapps]# rm -rf solr.war 
[root@iZm5e0c5bxd15k4yfdiirsZ webapps]# ls
solr
[root@iZm5e0c5bxd15k4yfdiirsZ webapps]#

5.  添加solr服務的擴展依賴包(日誌包)git

[root@iZm5e0c5bxd15k4yfdiirsZ webapps]# cd solr/
[root@iZm5e0c5bxd15k4yfdiirsZ solr]# ls
admin.html  css  favicon.ico  img  js  META-INF  tpl  WEB-INF
[root@iZm5e0c5bxd15k4yfdiirsZ solr]# cd WEB-INF/
[root@iZm5e0c5bxd15k4yfdiirsZ WEB-INF]# ls
lib  weblogic.xml  web.xml
[root@iZm5e0c5bxd15k4yfdiirsZ WEB-INF]# cd lib/
[root@iZm5e0c5bxd15k4yfdiirsZ lib]# ls
antlr-runtime-3.5.jar  commons-configuration-1.6.jar        dom4j-1.6.1.jar               hadoop-hdfs-2.2.0.jar  joda-time-2.2.jar                     lucene-core-4.10.3.jar         lucene-memory-4.10.3.jar       lucene-suggest-4.10.3.jar          solr-core-4.10.3.jar
asm-4.1.jar            commons-fileupload-1.2.1.jar         guava-14.0.1.jar              hppc-0.5.2.jar         lucene-analyzers-common-4.10.3.jar    lucene-expressions-4.10.3.jar  lucene-misc-4.10.3.jar         noggit-0.5.jar                     solr-solrj-4.10.3.jar
asm-commons-4.1.jar    commons-io-2.3.jar                   hadoop-annotations-2.2.0.jar  httpclient-4.3.1.jar   lucene-analyzers-kuromoji-4.10.3.jar  lucene-grouping-4.10.3.jar     lucene-queries-4.10.3.jar      org.restlet-2.1.1.jar              spatial4j-0.4.1.jar
commons-cli-1.2.jar    commons-lang-2.6.jar                 hadoop-auth-2.2.0.jar         httpcore-4.3.jar       lucene-analyzers-phonetic-4.10.3.jar  lucene-highlighter-4.10.3.jar  lucene-queryparser-4.10.3.jar  org.restlet.ext.servlet-2.1.1.jar  wstx-asl-3.2.7.jar
commons-codec-1.9.jar  concurrentlinkedhashmap-lru-1.2.jar  hadoop-common-2.2.0.jar       httpmime-4.3.1.jar     lucene-codecs-4.10.3.jar              lucene-join-4.10.3.jar         lucene-spatial-4.10.3.jar      protobuf-java-2.5.0.jar            zookeeper-3.4.6.jar
[root@iZm5e0c5bxd15k4yfdiirsZ lib]# wget http://zsj-linux.oss-cn-hangzhou.aliyuncs.com/solrjar/jcl-over-slf4j-1.7.6.jar
[root@iZm5e0c5bxd15k4yfdiirsZ lib]# wget http://zsj-linux.oss-cn-hangzhou.aliyuncs.com/solrjar/jul-to-slf4j-1.7.6.jar
[root@iZm5e0c5bxd15k4yfdiirsZ lib]# wget http://zsj-linux.oss-cn-hangzhou.aliyuncs.com/solrjar/log4j-1.2.17.jar
[root@iZm5e0c5bxd15k4yfdiirsZ lib]# wget http://zsj-linux.oss-cn-hangzhou.aliyuncs.com/solrjar/slf4j-api-1.7.6.jar
[root@iZm5e0c5bxd15k4yfdiirsZ lib]# wget http://zsj-linux.oss-cn-hangzhou.aliyuncs.com/solrjar/slf4j-log4j12-1.7.6.jar

6. 添加log4j.propertiesweb

[root@iZm5e0c5bxd15k4yfdiirsZ lib]# cd ..
[root@iZm5e0c5bxd15k4yfdiirsZ WEB-INF]# ls
lib  weblogic.xml  web.xml
[root@iZm5e0c5bxd15k4yfdiirsZ WEB-INF]# mkdir classes
[root@iZm5e0c5bxd15k4yfdiirsZ WEB-INF]# ls
classes  lib  weblogic.xml  web.xml
[root@iZm5e0c5bxd15k4yfdiirsZ WEB-INF]# cd classes/
[root@iZm5e0c5bxd15k4yfdiirsZ classes]# ls
[root@iZm5e0c5bxd15k4yfdiirsZ classes]# wget http://zsj-linux.oss-cn-hangzhou.aliyuncs.com/solrlog/log4j.properties

7. 在solr應用的web.xml文件中,加載SolrHomeexpress

訪問http://localhost:8080/solr/apache

出現如下界面則說明solr安裝成功!!!bootstrap

相關文章
相關標籤/搜索