This is an installation record. I have browsed many articles on solr installation and configuration before and when I encountered problems. Thanks to all the authors for sharing them. It was found that Solr 4.3.0 was installed on Ubuntu 12.04 + OpenJDK 1.7, which is somewhat different from the existing articles on the Internet.
Install Ubuntu 12.04-after basic installation, only install openssh
Install Openjdk
Bkjia @ ubsolr :~ $ Sudo apt-get-y install openjdk-7-jdk
Check the JDK installation path:
Bkjia @ ubsolr :~ $ Ls/usr/lib/jvm
Java-1.7.0-openjdk-i386 java-7-openjdk-commonjava-7-openjdk-i386
Bkjia @ ubsolr :~ $ Ls/usr/lib/jvm/java-7-openjdk-i386
Bkjia @ ubsolr :~ $ Ls/usr/lib/jvm/java-7-openjdk-i386/bin
Add JDK environment variables:
Bkjia @ ubsolr :~ $ Sudo nano/etc/profile
Export JAVA_HOME =/usr/lib/jvm/java-7-openjdk-i386
Export JRE_HOME =$ {JAVA_HOME}/jre
Export CLASSPATH =. :$ {JAVA_HOME}/lib :$ {JRE_HOME}/lib
Export PATH =$ {JAVA_HOME}/bin :$ {JRE_HOME}/bin: $ PATH
Restart the system and check the JAVA Configuration:
Bkjia @ ubsolr :~ $ Env
Bkjia @ ubsolr :~ $ Java-version
Bkjia @ ubsolr :~ $ Echo $ JAVA_HOME
Install Apache2 and Tomcat7
Bkjia @ ubsolr :~ $ Sudo apt-get-y install apache2 apache2-prefork-dev libapr1-dev libaprutil1-dev
Bkjia @ ubsolr :~ $ Sudo apt-get update
Bkjia @ ubsolr :~ $ Sudo apt-get-y install tomcat7 tomcat7-admin
After Tomcat 7 is installed, the related directories and configurations are in the following directories:
/Usr/share/tomcat7
/Var/lib/tomcat7/webapps
/Etc/tomcat7/Catalina/localhost
Download sample. war from the http://tomcat.apache.org/tomcat-6.0-doc/appdev/sample/, put sample. war in/var/lib/tomcat7/webapps, and restart Tomcat7:
Bkjia @ ubsolr :~ $ Sudo/etc/init. d/tomcat7 restart
Enter the Host IP address in the browser (My Host IP address is 192.168.56.10)
Http: // 192.168.56.10: 8080/sample
You can see the sample page, so that JDK and tomcat 7 are fully operating normally.
Install Solr 4.3.0
Bkjia @ ubsolr :~ $ Sudo/etc/init. d/tomcat7 stop
Bkjia @ ubsolr :~ $ Sudo tar xzvf solr-4.3.0.tgz
Bkjia @ ubsolr :~ $ Ls solr-4.3.0/dist.
Solr-4.3.0.war
Copy the extracted solr-4.3.0.war to tomcat7/webapps and change it to solr. war.
Bkjia @ ubsolr :~ $ Sudo cp solr-4.3.0/dist/solr-4.3.0.war/var/lib/tomcat7/webapps/solr. war
Create a directory/var/solr as the Solr home directory (solr. solr. home)
Bkjia @ ubsolr :~ $ Sudo mkdir-p/var/solr
Copy the decompressed example/solr to the solr. solr. home directory. This will be an instance of collection1.
Bkjia @ ubsolr :~ $ Sudo cp-R solr-4.3.0/example/solr/*/var/solr
Bkjia @ ubsolr :~ $ Ls/var/solr
Bkjia @ ubsolr :~ $ Sudo chown-R tomcat7/var/solr
We recommend a solr. xml file in/etc/tomcat7/Catalina/localhost to specify the solr path.
Bkjia @ ubsolr :~ $ Sudo nano/etc/tomcat7/Catalina/localhost/solr. xml
<Context docBase = "/var/lib/tomcat7/webapps/solr. war" debug = "0" privileged = "true" allowLinking = "true" crossContext = "true">
<Environment name = "solr/home" type = "java. lang. String" value = "/var/solr" override = "true">
</Environment>
</Context>
In the preceding settings, my solr. war (including the solr directory generated later) is stored in/var/lib/tomcat7/webapps.
While instance collection1 is stored in/var/solr
Put the instance collection1 (and core0, core1) path to the system variable (in the file/etc/profile ):
Bkjia @ ubsolr :~ $ Sudo nano/etc/profile
Export JAVA_OPTIONS = "-Dsolr. solr. home =/var/solr $ JAVA_OPTIONS"
Copy the decompressed solr-related lib to the/lib directory of Tomcat 7:
Bkjia @ ubsolr :~ $ Ls solr-4.3.0/example/lib/ext
Jcl-over-slf4j-1.6.6.jar log4j-1.2.16.jar slf4j-log4j12-1.6.6.jar
Jul-to-slf4j-1.6.6.jar slf4j-api-1.6.6.jar
Bkjia @ ubsolr :~ $ Ls/usr/share/tomcat7/lib
Bkjia @ ubsolr :~ $ Sudo cp-R solr-4.3.0/example/lib/ext/*/usr/share/tomcat7/lib
Bkjia @ ubsolr :~ $ Sudo cp solr-4.3.0/example/resources/log4j. properties/usr/share/tomcat7/lib
Tomcat details: click here
Tomcat: click here
Upgrade Ubuntu 13.04 to Maven3.10 to support OpenJDK7
Compile and install OpenJDK 7 in Ubuntu 12.10
Load Balancing between Apache and multiple Tomcat clusters in Linux
Nginx Tomcat Cluster load balancing solution notes
Instance details Tomcat component installation + Nginx reverse proxy Tomcat + Apache use mod_jk and mod_proxy Reverse Proxy and load balancing
Build an Apache + Tomcat environment (JK deployment process)
In-depth analysis of Tomcat PDF