1. Install Tomcat
(1) Download and extract to/opt/tomcat
# cd/opt/jediael #
TAR-ZXVF apache-tomcat-7.0.54.tar.gz #
MV apache-tomcat-7.0.54 Tomcat renames the directory to Tomcat
# ls
apache-tomcat-7.0.54.tar.gz RH Tomcat
(2) Configure Conf/tomcat-users.xml to facilitate management and configuration through the page
<role rolename= "Manager-gui"/> <user username= "Tomcat" password= "Tomcat" roles= "Manager-gui"/>
(3) Start Tomcat and verify
# bin/startup.sh
using catalina_base:/opt/jediael/tomcat
using catalina_home:/opt/jediael/tomcat
Using Catalina_tmpdir:/opt/jediael/tomcat/temp
using jre_home:/usr/java/jdk1.7.0_51
using CLASSPATH:/opt /jediael/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
Tomcat started.
Open http://ip:8080/, normal login open http://ip:8080/manager/html, login with username password tomcat/tomcat
2. Deploy SOLR (1) to replicate the SOLR uncompressed EXAMPLE/SOLR directory to/OPT/JEDIAEL/SOLR/EXAMPLE/SOLR
# mkdir-p/opt/jediael/solr/example
# cp-rf/opt/jediael/solr-4.9.0/example/solr/opt/jediael/solr/example
(2) Copy Dist/solr-4.9.0.war to/OPT/JEDIAEL/SOLR/EXAMPLE/SOLR and rename to Solr.war
# pwd
/opt/jediael/solr/example/solr
# cp/opt/jediael/solr-4.9.0/dist/solr-4.9.0.war solr.war
# ls
bin Collection1 README.txt Solr.war solr.xml zoo.cfg
(3) Configure Solrconfig.xml, specifying the data directory
# pwd
/opt/jediael/solr/example/solr/collection1
Modify the following:
<dataDir>${solr.data.dir:}</dataDir>
For
<dataDir>${solr.data.dir:/opt/jediael/solr/example/solr/collection1/data}</dataDir>
Explained as follows: which is true to running the Jetty server provided with the example, but to Tomcat incorrect as a service. The above configuration takes effect immediately:
Export java_opts= "$JAVA _opts-dsolr.data.dir=/opt/jediael/solr/example/solr/collection1/data"
(4) pointing to the above package in Tomcat
Start Tomcat at least once before this directory is generated
Create a new file in/opt/jediael/tomcat/conf/catalina/localhost/:
# cd/opt/jediael/tomcat/conf/catalina/localhost/
# ls
# VI Solr.xml
The contents are as follows:
<?xml version= "1.0" encoding= "Utf-8"?> <context docbase=
"/opt/jediael/solr/example/solr/solr.war" debug= "0" crosscontext= "true" >
<environment name= "Solr/home" type= "java.lang.String" value= /SOLR/EXAMPLE/SOLR "override=" true "/>
</Context>
(5) Copy jar file and log4j configuration file
# cp/opt/jediael/solr-4.9.0/example/lib/ext/*/opt/jediael/tomcat/lib/
# mkdir logs
# pwd
/opt/jediael/ SOLR/EXAMPLE/SOLR
# cp/opt/jediael/solr-4.9.0/example/resources/log4j.properties/opt/jediael/tomcat/lib/
# VI
Modify:
solr.log=/opt/jediael/solr/example/solr/logs/
(6) Copy jar package
[# pwd
/opt/jediael/solr/example/solr
# mkdir Lib #
Cp/opt/jediael/solr-4.9.0/dist/*.jar lib/
3. Start and verify
(1) Start Tomcat
bin/startup.sh
(2) Verify the following pages
http://ip:8080/manager/html View Run status
http://ip:8080/solr/
Http://ip:8080/solr/collection1/browse
4, analysis
(1) The above war package is extracted to/OPT/JEDIAEL/TOMCAT/WEBAPPS/SOLR, and the contents are as follows:
# ls
admin.html css favicon.ico img js meta-inf TPL Web-inf
Content other than war packages:
# Lsbin Collection1 lib logs README.txt Solr.war solr.xml zoo.cfg
Remain in the original position, and did not change.
Repeat the above steps with different installation directories to run multiple instances of SOLR side-by-side.