主要步骤即:
1,创建运行该服务的resin用户;
2,下载resin-3.1.8并安装,配置编码为UTF-8,测试服务端口;
3,修改启动脚本,拷贝到启动服务目录,并设置服务为可自动启动脚本。
完全运行如下:
[simonsun@magic ~]$ sudo /usr/sbin/groupadd resin
[simonsun@magic ~]$ sudo /usr/sbin/useradd resin -G resin -g resin -d /home/resin
[simonsun@magic ~]$ sudo passwd resin
Changing password for user resin.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[simonsun@magic ~]$ su resin
口令:
[resin@magic simonsun]$ cd ~
[resin@magic ~]$ wget http://www.caucho.com/download/resin-3.1.8.zip
--21:44:34-- http://www.caucho.com/download/resin-3.1.8.zip
正在解析主机 www.caucho.com... 207.44.178.4
Connecting to www.caucho.com|207.44.178.4|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:10345361 (9.9M) [application/zip]
Saving to: `resin-3.1.8.zip'
100%[======================================>] 10,345,361 51.7K/s in 3m 21s
21:47:56 (50.3 KB/s) - `resin-3.1.8.zip' saved [10345361/10345361]
[resin@magic ~]$ ls
resin-3.1.8.zip
[resin@magic ~]$ unzip resin-3.1.8.zip
[resin@magic ~]$ cd resin-3.1.8/
[resin@magic resin-3.1.8]$ ./configure;make;make install
[resin@magic resin-3.1.8]$ echo $LANG
zh_CN.UTF-8
[resin@magic resin-3.1.8]$ export LANG=en_US.UTF-8
[resin@magic resin-3.1.8]$ echo $LANG
en_US.UTF-8
[resin@magic resin-3.1.8]$ vim conf/resin.conf
<web-app-default>
<character-encoding>UTF-8</character-encoding>
[resin@magic resin-3.1.8]$ java -jar lib/resin.jar
Mar 12, 2009 10:49:50 PM com.caucho.boot.WatchdogProcess run
INFO: WatchdogProcess[Watchdog[],1] starting Resin
[22:49:51.000] {watchdog-} WatchdogProcess[Watchdog[],1] starting Resin
Resin-3.1.8 (built Mon, 17 Nov 2008 12:15:21 PST)
Copyright(c) 1998-2008 Caucho Technology. All rights reserved.
Using Resin(R) Open Source under the GNU Public License (GPL).
See http://www.caucho.com for information on Resin Professional,
including caching, clustering, JNI acceleration, and OpenSSL integration.
Starting Resin on Thu, 12 Mar 2009 22:49:54 +0800 (CST)
[22:49:58.779] {main} 'select-manager' requires Resin Professional. See http://www.caucho.com for information and licensing.
[22:49:58.779] {main}
[22:49:58.780] {main} Linux 2.6.18-92.1.22.el5 i386
[22:49:58.780] {main} Java(TM) 2 Runtime Environment, Standard Edition 1.5.0_15-b04, UTF-8, en
[22:49:58.780] {main} Java HotSpot(TM) Client VM 1.5.0_15-b04, 32, mixed mode, Sun Microsystems Inc.
[22:49:58.781] {main} user.name: resin
[22:49:58.781] {main} resin.home = /home/resin/resin-3.1.8/
[22:49:58.782] {main} resin.root = /home/resin/resin-3.1.8/
[22:49:58.784] {main} resin.conf = /home/resin/resin-3.1.8/conf/resin.conf
[22:49:58.785] {main}
[22:49:59.752] {main} WebApp[http://localhost:8080] active
[22:50:00.241] {main} WebApp[http://localhost:8080/resin-admin] active
[22:50:00.243] {main} expanding /home/resin/resin-3.1.8/webapps/resin-doc.war to /home/resin/resin-3.1.8/webapps/resin-doc
[22:50:05.925] {main} WebApp[http://localhost:8080/resin-doc] active
[22:50:05.926] {main} Host[] active
[22:50:05.937] {main} hmux listening to magic.linux:6800
[22:50:05.963] {main} http listening to *:8080
[22:50:05.976] {main} Server[id=,cluster=app-tier] active
[22:50:05.986] {main} Resin started in 12405ms
[resin@magic resin-3.1.8]$ w3m http://127.0.0.1:8080
Resin® Default Home Page
This is the default page for the Resin web server.
Documentation is available here.
Administration is available here.
[resin@magic resin-3.1.8]$ vim contrib/init.resin
[resin@magic resin-3.1.8]$ exit
exit
[simonsun@magic ~]$ sudo cp /home/resin/resin-3.1.8/contrib/init.resin /etc/rc.d/init.d/resin
[simonsun@magic ~]$ sudo chmod +x /etc/rc.d/init.d/resin
[simonsun@magic ~]$ cd /etc/rc.d/init.d/
[simonsun@magic init.d]$ sudo /sbin/chkconfig --level 35 resin on
[simonsun@magic init.d]$ cat ./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/jdk1.5.0_15
RESIN_HOME=/home/resin/resin-3.1.8
export JAVA_HOME RESIN_HOME
export export LANG=en_US.UTF-8
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)
echo -n "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)
echo -n "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
echo " done."
#log_end_msg $?
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit 0
[simonsun@magic init.d]
经测试,为避免中文乱码,需要注意export LANG=en_US.UTF-8,以及<web-app-default>
<character-encoding>UTF-8</character-encoding>
=================
CentOS 5 配置Resin3.1.8 服务
最新推荐文章于 2017-11-09 13:11:04 发布