Reprint: https://blog.csdn.net/alibaba_f / article / details / 89407754
First, create an empty folder to facilitate the management of tomcat, solr and solr data source management;
2. Install tomcat and solr, and wear an empty folder solrHome
3. Copy the files under server → solr webApp → webApp in the solr installation package to the solr folder created under tomcat → webApp.
#Enter webapp of tomcat cd /home/apache-tomcat-8.5.39/webapps #Create solr folder mkdir solr #Enter solr cd /home/apache-tomcat-8.5.39/webapps/solr #Copy all files and folders in / home/solr-8.0.0/server/solr-webapp/webapp to the current folder cp -r /home/solr-8.0.0/server/solr-webapp/webapp .
4. Copy the corresponding jar under the server to the tomcat → webApp → solr → WEB_INF → lib folder (there are many jars, so I will not use the figure above)
cd /home/apache-tomcat-8.5.39/webapps/solr/WEB-INF/lib # Copy all jar packages in / home/solr-8.0.0/server/solr-webapp/webapp/WEB-INF/lib / * cp -r /home/solr-8.0.0/server/solr-webapp/webapp/WEB-INF/lib/*.jar .
V. configure web.xml under tomcat → webApp → solr → WEB_INF
1. Add configuration (specify the location of Solr data source < the directory where Solr starts solr.xml):
<env-entry> <env-entry-name>solr/home</env-entry-name> <env-entry-value>/home/solrHome/solr</env-entry-value> <env-entry-type>java.lang.String</env-entry-type> </env-entry>
2. Comment the configuration (to prevent tomcat 403 problem)
<!-- <security-constraint> <web-resource-collection> <web-resource-name>Disable TRACE</web-resource-name> <url-pattern>/</url-pattern> <http-method>TRACE</http-method> </web-resource-collection> <auth-constraint/> </security-constraint> <security-constraint> <web-resource-collection> <web-resource-name>Enable everything but TRACE</web-resource-name> <url-pattern>/</url-pattern> <http-method-omission>TRACE</http-method-omission> </web-resource-collection> </security-constraint> -->
6. Copy the configuration file under server resources file in solr installation package to tomcat webApp solr web inf classes folder (if there is no classes folder, please create
cd /home/apache-tomcat-8.5.39/webapps/solr/WEB-INF #Class creation does not exist mkdir classes cd classes #Copy everything in the / home/solr-8.0.0/server/resources / folder to the current directory cp -r /home/solr-8.0.0/server/resources/* . #You need to modify the two configuration files starting with log4j2 respectively. You need to change all ${sys:solr.log.dir} to your own specified real path #Path. #It is to specify a folder to store log s
7. Copy all files under solr → server to solrHome folder
cd /home/solrHome cp -r /home/solr-8.0.0/server/* .
8. Start tomcat and visit http://hostname:8080/solr/index.html to verify whether the configuration is successful.