阅读297 返回首页    go 阿里云 go 技术社区[云栖]


Centos下快速部署JDK+RESIN

Resin是CAUCHO公司([url]https://www.caucho.com/[/url])的产品,是一个非常流行的支持servlets 和jsp的引擎,速度非常快,据说是tomcat的3倍。

操作系统:Centos5.2 64位系统

第一步安装配置JDK

1、安装一个叫jpackage-utils的包

wget -P /etc/yum.repos.d [url]https://jpackage.org/jpackage17.repo[/url]

yum install jpackage-utils

————————————————-

2、安装JDK

cd /usr/src

wget https://people.mobiledirect.ru/people/umask/public/jdk6u10/jdk-6u10-linux-x64-rpm.bin

chmod + jdk-6u10-linux-x64-rpm.bin
sh jdk-6u10-linux-x64-rpm.bin

——————————————————

3、配置JDK环境变量

我看了网上大多数配置环境变量都是在/etc/profile配置,个人感觉比较麻烦,在这里我介绍一个叫alternatives 命令,它的意思是“可选择的内容”。假如你的系统中有几个命令功能十分类似,却又不能随意删除,那么可以用 alternatives 来指定一个全局的设置。废话少说,go on!

alternatives –install /usr/bin/java java /usr/java/default/ 1

alternatives –config java
选择1

编辑/etc/java/java.conf

JVM_ROOT=/usr/java/default

—————————————————-

测试下JDK是否成功。

java -version

如果出现以下信息说明JDK配置成功。

java version “1.6.0_10″
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) 64-Bit Server VM (build 11.0-b15, mixed mode)

——————————————————————————————————————–

第二步安装配置Resin

cd /home
wget [url]https://www.caucho.com/download/resin-3.1.8.tar.gz[/url]

tar zxvf resin-3.1.8.tar.gz
ln -s resin-3.1.8 resin
cp /home/resin/contrib/init.resin.in /etc/init.d/resin //设置Resin启动服务

chmod +x /etc/init.d/resin

chkconfig –add resin //设置Resin开机自动启动

chkconfig resin on

修改/etc/init.d/resin

JAVA_HOME=/usr/java/default
RESIN_HOME=/home/resin

以下是我的/etc/init.d/resin文件

——————————————-

#!/bin/sh
#
# Linux startup script for Resin
# chkconfig: 345 85 15
# description: Resin is a Java Web server.
# processname: wrapper.pl
#
# To install, configure this file as needed and copy init.resin
# to /etc/rc.d/init.d as resin. Then use “# /sbin/chkconfig resin reset”
#
JAVA_HOME=/usr/java/default
RESIN_HOME=/home/resin

export JAVA_HOME RESIN_HOME

JAVA=$JAVA_HOME/bin/java
#
# If you want to start the entire Resin process as a different user,
# set this to the user name. If you need to bind to a protected port,
# e.g. port 80, you can’t use USER, but will need to use bin/resin.
#
USER=
#
# Set to the server id to start
#
#SERVER=”-server app-a”
#
ARGS=”-resin-home $RESIN_HOME $SERVER”

if test -r /lib/lsb/init-functions; then
. /lib/lsb/init-functions
else

log_daemon_msg () {
if [ -z "$1" ]; then
return 1
fi

if [ -z "$2" ]; then
echo -n “$1:”
return
fi
echo -n “$1: $2″
}
log_end_msg () {
[ -z "$1" ] && return 1

if [ $1 -eq 0 ]; then
echo ” .”
else
echo ” failed!”
fi
return $1
}

fi

case “$1″ in
start)
log_daemon_msg “Starting resin”
if test -n “$USER”; then
su $USER -c “$JAVA -jar $RESIN_HOME/lib/resin.jar $ARGS start” 1>/dev/null 2>/dev/null
else
$JAVA -jar $RESIN_HOME/lib/resin.jar $ARGS start 1>/dev/null 2>/dev/null
fi
log_end_msg $?
;;
stop)
log_daemon_msg “Stopping resin”
if test -n “$USER”; then
su $USER -c “$JAVA -jar $RESIN_HOME/lib/resin.jar $ARGS stop” 1>/dev/null 2>/dev/null
else
$JAVA -jar $RESIN_HOME/lib/resin.jar $ARGS stop 1>/dev/null 2>/dev/null
fi
log_end_msg $?
;;
restart)
$0 stop
$0 start
;;
*)
echo “Usage: $0 {start|stop|restart}”
exit 1
esac

exit 0

———————————

注:红色部分为已删除部分。

到此,全部配置完成,测试下吧。

/etc/init.d/resin start

lynx [url]https://localhost:8080[/url]

出现”Resin? Default Home Page”,说明平台配置成功了。

» 本文来自:彭攀 » 《Centos下快速部署JDK+RESIN》

最后更新:2017-01-04 22:34:51

  上一篇:go Linux下搭建简单ftp服务器
  下一篇:go php 平滑重启和快速重启