时间:2021-07-01 10:21:17 帮助过:4人阅读
2.安装jdk
wget http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.rpm rpm -ivh jdk-7u79-linux-x64.rpm
3.配置环境变量
vim /etc/profile
在/etc/profile文件最下面添加如下:
JAVA_HOME=/usr/java/jdk1.7.0_79 JRE_HOME=/usr/java/jdk1.7.0_79/jre PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin CLASSPATH=.:$JAVA_HOME/lib/jt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib export JAVA_HOME JRE_HOME PATH CLASSPATH
--------------------------------------------------------
source /etc/profile
*****************************************************************
二、安装H2
1.下载H2
cd /opt/ wget http://www.h2database.com/h2-2015-04-10.zip unzip h2-2015-04-10.zip chmod +x build.sh bin/h2.sh
---------------------------------------
2.配置H2
修改h2.sh
cd /opt/h2 vim bin/h2.sh #!/bin/sh dir=$(dirname "$0") java -cp "$dir/h2-1.4.187.jar:$H2DRIVERS:$CLASSPATH" org.h2.tools.Server -tcpAllowOthers -webAllowOthers -webPort 8082 "$@"
注:org.h2.tools.Server 以服务器模式启动
-tcpAllowOthers 允许远程主机通过TCP方式访问
-webAllowOthers 允许远程机器通过浏览器访问
-webPort 8082 默认的访问端口(8082为未被占用的端口,如果此端口已经被其他端口占用,则改为其他端口)
-----------------------------------------------------------------------
修改build.sh
vim build.sh #!/bin/sh if [ -z "$JAVA_HOME" ] ; then if [ -d "/apps/product/jdk1.6.0_19" ] ; then export JAVA_HOME=/apps/product/jdk1.6.0_19 else echo "Error: JAVA_HOME is not defined." fi fi if [ "$1" = "clean" ] ; then rm -rf temp bin ; fi if [ ! -d "temp" ] ; then mkdir temp ; fi if [ ! -d "bin" ] ; then mkdir bin ; fi "$JAVA_HOME/bin/javac" -sourcepath src/tools -d bin src/tools/org/h2/build/*.java "$JAVA_HOME/bin/java" -Xmx256m -cp "bin:$JAVA_HOME/lib/tools.jar:temp" org.h2.build.Build $@
-------------------------------------------------------------------------------------------------------
3.启动H2服务
cd /opt/h2/bin nohup ./h2.sh &
----------------------------------------------------------------------
4.验证
通过浏览器访问http://IP:8082即可
嵌入式数据库H2的安装与配置
标签: