Ubuntu openjdk + Tomcat 7 Installation

Source: Internet
Author: User
Tags solr nginx reverse proxy
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. Solr4.3.0 was installed in Ubuntu12.04 + OpenJDK1.7, which is somewhat different from the existing articles on the Internet. Ubuntu12.04 installation-after basic installation, only install Openjdklinuxidc @ ubsolr :~ $ Sud

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
Linuxidc @ ubsolr :~ $ Sudo apt-get-y install openjdk-7-jdk

Check the JDK installation path:
Linuxidc @ ubsolr :~ $ Ls/usr/lib/jvm
Java-1.7.0-openjdk-i386 java-7-openjdk-commonjava-7-openjdk-i386

Linuxidc @ ubsolr :~ $ Ls/usr/lib/jvm/java-7-openjdk-i386
Linuxidc @ ubsolr :~ $ Ls/usr/lib/jvm/java-7-openjdk-i386/bin

Add JDK environment variables:
Linuxidc @ 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:

Linuxidc @ ubsolr :~ $ Env
Linuxidc @ ubsolr :~ $ Java-version
Linuxidc @ ubsolr :~ $ Echo $ JAVA_HOME

 

 

Install Apache2 and Tomcat7

Linuxidc @ ubsolr :~ $ Sudo apt-get-y install apache2 apache2-prefork-dev libapr1-dev libaprutil1-dev
Linuxidc @ ubsolr :~ $ Sudo apt-get update
Linuxidc @ 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:

Linuxidc @ 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


Linuxidc @ ubsolr :~ $ Sudo/etc/init. d/tomcat7 stop

Linuxidc @ ubsolr :~ $ Sudo tar xzvf solr-4.3.0.tgz

Linuxidc @ 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.

Linuxidc @ 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)

Linuxidc @ ubsolr :~ $ Sudo mkdir-p/var/solr

 

Copy the decompressed example/solr to the solr. solr. home directory. This will be an instance of collection1.
Linuxidc @ ubsolr :~ $ Sudo cp-R solr-4.3.0/example/solr/*/var/solr

Linuxidc @ ubsolr :~ $ Ls/var/solr

Linuxidc @ ubsolr :~ $ Sudo chown-R tomcat7/var/solr

We recommend a solr. xml file in/etc/tomcat7/Catalina/localhost to specify the solr path.

Linuxidc @ ubsolr :~ $ Sudo nano/etc/tomcat7/Catalina/localhost/solr. xml




 

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 ):


Linuxidc @ 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:
Linuxidc @ 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

Linuxidc @ ubsolr :~ $ Ls/usr/share/tomcat7/lib

Linuxidc @ ubsolr :~ $ Sudo cp-R solr-4.3.0/example/lib/ext/*/usr/share/tomcat7/lib

Linuxidc @ ubsolr :~ $ Sudo cp solr-4.3.0/example/resources/log4j. properties/usr/share/tomcat7/lib

Tomcat details: Click here
Tomcat: Click here

Reading:

Upgrade Ubuntu 13.04 to Maven3.10 to support OpenJDK7 http://www.linuxidc.com/Linux/2013-08/88844.htm

Compile and install OpenJDK 7 http://www.linuxidc.com/Linux/2013-03/81948.htm in Ubuntu 12.10

Load Balancing between Apache and multiple Tomcat clusters in LinuxHttp://www.linuxidc.com/Linux/2012-01/51731.htm

Nginx Tomcat Cluster load balancing solution notes http://www.linuxidc.com/Linux/2013-07/86827.htm

Example details Tomcat component installation + Nginx reverse proxy Tomcat + Apache use mod_jk and mod_proxy Reverse Proxy and load balancing http://www.linuxidc.com/Linux/2013-06/85290.htm

Apache + Tomcat environment setup (JK deployment process) http://www.linuxidc.com/Linux/2012-11/74474.htm

In-depth analysis of Tomcat PDF http://www.linuxidc.com/Linux/2013-11/92595.htm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.