Since version 5 SOLR has been distributed as a stand-alone server running within Jetty. Some (like me) would prefer to run it within Tomcat which requires the creation of a WAR file.
Below are the steps to take do achieve this. I have successfully done this with SOLR 5 through SOLR 8.
Please note that this is not officially supported so may stop working at any time.
Unpack the SOLR tar file:
tar zxf solr-8.6.1.tgz
Create a META-INF directory in your home directory:
mkdir -v META-INF
Move the LICENSE.txt and NOTICE.txt files from solr-8.6.1 to the META-INF directory:
mv -v solr-8.6.1/LICENSE.txt META-INF/
mv -v solr-8.6.1/NOTICE.txt META-INF/
Create a MANIFEST.MF file in the META-INF directory which contains the following text:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.10.8
Created-By: 14.0.2+12-46 (Oracle Corporation)
Build-Date: June 25 2020
Extension-Name: org.apache.solr
Specification-Title: Apache Solr Search Server
Specification-Version: 8.6.1
Specification-Vendor: The Apache Software Foundation
Implementation-Title: org.apache.solr
Implementation-Version: 8.6.1
Implementation-Vendor: The Apache Software Foundation
X-Compile-Source-JDK: 14.0.2
X-Compile-Target-JDK: 14.0.2
Listing the META-INF directory should look like:
linux: ~ > ls -1 META-INF
LICENSE.txt
MANIFEST.MF
NOTICE.txt
The web.xml file needs to be edited to remove/comment out the section which is located at the end of the file:
vi solr-8.6.1/server/solr-webapp/webapp/WEB-INF/web.xml
Remove/comment out this section:
<security-constraint>
.
.
.
</security-constraint>
Do the following to move files/directories in place:
cd solr-8.6.1/server/solr-webapp
mv -v webapp solr
mv -v ../lib/metrics-*.jar solr/WEB-INF/lib
cd solr
mv -v ~/META-INF .
Create the WAR file:
jar cvf solr-8.6.1.war .
Move the WAR file to your home directory:
mv -v solr-8.6.1.war ~
Move the solr-solrj-8.6.1.jar to your home directory if you need it:
mv -v WEB-INF/lib/solr-solrj-8.6.1.jar ~
And you are done.