设为首页 收藏本站
查看: 1204|回复: 0

[经验分享] CentOS 5 配置Resin3.1.8 服务

[复制链接]

尚未签到

发表于 2016-5-10 12:20:46 | 显示全部楼层 |阅读模式
  主要步骤即:
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>
=================

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-215189-1-1.html 上篇帖子: CentOS 5 安装 Resin 4 下篇帖子: centos下nginx和resin安装配置
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表