标签:aliyun ubuntu 14.04 64bit openjdk tomcat7 install
my work environment:
aliyun Ubuntu 14.04 64位
first phase:apt-get update (it is very important,otherwise will cause 404 error)
second phase:installation referenced by other website information;
install Openjdk
linuxidc@ubsolr:~$ sudo apt-get -y install openjdk-7-jdk
check JDK installation path :
linuxidc@ubsolr:~$ ls /usr/lib/jvm
java-1.7.0-openjdk-i386 java-7-openjdk-commonjava-7-openjdk-i386 (some machine is amd64bit:java-1.7.0-openjdk-amd64 java-7-openjdk-commonjava-7-openjdk-amd64)
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
if machine cpu is amd 64bit:
linuxidc@ubsolr:~$ sudo nano /etc/profile
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin:$PATH
reboot linux system,check 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 Tomcat7 installation,the location and configuration as bellow:
/usr/share/tomcat7
/var/lib/tomcat7/webapps
/etc/tomcat7/Catalina/localhost
from http://tomcat.apache.org/tomcat-6.0-doc/appdev/sample/ download sample.war,pubt sample.war to /var/lib/tomcat7/webapps and reboot Tomcat7:
linuxidc@ubsolr:~$ sudo /etc/init.d/tomcat7 restart
input the website as bellow in explorer (my host IP address 192.168.56.10)
http://192.168.56.10:8080/sample
now you can see sample page,then we can make sure JDK and Tomcat7 work normal。
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
把解压后的 solr-4.3.0.war 复制到 tomcat7/webapps 并改名为 solr.war
linuxidc@ubsolr:~$ sudo cp solr-4.3.0/dist/solr-4.3.0.war /var/lib/tomcat7/webapps/solr.war
新建一个目录 /var/solr 作为 Solr 的 home 目录 (solr.solr.home)
linuxidc@ubsolr:~$ sudo mkdir -p /var/solr
把解压的 example/solr 复制到 solr.solr.home 目录,这个就会是 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
在 /etc/tomcat7/Catalina/localhost 建议一个 solr.xml,指明solr的路径
linuxidc@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>
以上设置中,我的 solr.war (包括其后产生的 solr 目录) 是存放于 /var/lib/tomcat7/webapps
而 实例 collection1 则存放于 /var/solr
把实例 collection1 (和 core0, core1) 的路径 放到系统变量 (于文件 /etc/profile):
linuxidc@ubsolr:~$ sudo nano /etc/profile
export JAVA_OPTIONS="-Dsolr.solr.home=/var/solr $JAVA_OPTIONS"
将解压的 solr 相关 lib 复制到 tomcat7 的 /lib 目录下:
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 的详细介绍:请点这里
Tomcat 的下载地址:请点这里
相关阅读:
Ubuntu 13.04下升级到Maven3.10 以支持 OpenJDK7 http://www.linuxidc.com/Linux/2013-08/88844.htm
Ubuntu 12.10中编译安装OpenJDK 7 http://www.linuxidc.com/Linux/2013-03/81948.htm
Linux下Apache与多个Tomcat 集群负载均衡 http://www.linuxidc.com/Linux/2012-01/51731.htm
Nginx Tomcat 集群负载均衡解决笔记 http://www.linuxidc.com/Linux/2013-07/86827.htm
实例详解Tomcat组件安装+Nginx反向代理Tomcat+Apache使用mod_jk和mod_proxy反向代理和负载均衡 http://www.linuxidc.com/Linux/2013-06/85290.htm
Apache+Tomcat 环境搭建(JK部署过程) http://www.linuxidc.com/Linux/2012-11/74474.htm
深入剖析Tomcat PDF http://www.linuxidc.com/Linux/2013-11/92595.htm
本篇文章来源于 Linux公社网站(www.linuxidc.com) 原文链接:http://www.linuxidc.com/Linux/2014-02/96398.htm
aliyun Ubuntu 14.04 64bit OpenJDK Tomcat7 install
标签:aliyun ubuntu 14.04 64bit openjdk tomcat7 install
原文地址:http://blog.csdn.net/wilsonke/article/details/39671321