安装resin-4.0.62
※ 知悉
1. 源码编译安装resin时,./configure中带上 --enable-64bit,否则gcc报错,make不通过
2. 请指定java_home为/usr/java/default目录,这样以后升降级jdk时无需再配置java_home
3. resin编译make必须在源码目录,而不能是源码目录的下层子目录,否则make会出现寻址错误
JDK下载,最新版本Java SE Development Kit 12.0.1
https://www.oracle.com/technetwork/java/javase/downloads/jdk12-downloads-5295953.html
Resin下载,最新版本resin-4.0.62
https://caucho.com/products/resin/download#download
准备工作1:下载安装包及相关依赖
[root@localhost ~]# wget http://caucho.com/download/resin-pro-4.0.62.tar.gz
[root@localhost ~]# wget https://download.oracle.com/otn-pub/java/jdk/12.0.1+12/69cfe15208a647278a19ef0990eea691/jdk-12.0.1_linux-x64_bin.rpm
准备工作2:安装目录及相关说明
安装目录
/usr/local/resin
/usr/java
/usr/local/openssl
源文件目录
/root/resin-pro-4.0.62
/root/jdk-12.0.1_linux-x64_bin.rpm
/root/openssl-1.0.2s
配置文件目录
/usr/local/resin/conf/resin.xml
resin的web目录
/www/java
jdk-12.0.1安装及多版本jdk管理和灵活切换
1. 安装 jdk-12.0.1_linux-x64_bin.rpm,默认安装目录是/usr/java
使用ll命令查看,发现rpm安装的jdk默认会将最新版本的jdk软链接到/usr/java/default目录,安装resin时with-java-home只要指向这个目录即可,以后升级jdk无需重复配置
[root@localhost ~]# rpm -ivh jdk-12.0.1_linux-x64_bin.rpm
警告:jdk-12.0.1_linux-x64_bin.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID ec551f03: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:jdk-12.0.1-2000:12.0.1-ga ################################# [100%]
[root@localhost ~]# java -version
java version "12.0.1" 2019-04-16
Java(TM) SE Runtime Environment (build 12.0.1+12)
Java HotSpot(TM) 64-Bit Server VM (build 12.0.1+12, mixed mode, sharing)
[root@localhost ~]# ll /usr/java/
总用量 0
lrwxrwxrwx. 1 root root 16 6月 18 10:26 default -> /usr/java/latest
drwxr-xr-x. 10 root root 120 6月 18 10:26 jdk-12.0.1
lrwxrwxrwx. 1 root root 20 6月 18 10:26 latest -> /usr/java/jdk-12.0.1
2. 查看java的相关执行命令,发现rpm方式安装的java是由alternatives来实现版本管理的
输出信息显示,对执行命令 java javac javadoc javap,alternatives都已经有软链接指向/bin,无需配置环境变量
[root@localhost ~]# ll /bin/|grep java
lrwxrwxrwx. 1 root root 22 6月 18 10:26 java -> /etc/alternatives/java
lrwxrwxrwx. 1 root root 23 6月 18 10:26 javac -> /etc/alternatives/javac
lrwxrwxrwx. 1 root root 25 6月 18 10:26 javadoc -> /etc/alternatives/javadoc
lrwxrwxrwx. 1 root root 23 6月 18 10:26 javap -> /etc/alternatives/javap
[root@localhost ~]# ll /etc/alternatives/|grep java
lrwxrwxrwx. 1 root root 48 6月 18 10:26 jaccessinspector.1 -> /usr/java/jdk-12.0.1/man/man1/jaccessinspector.1
lrwxrwxrwx. 1 root root 45 6月 18 10:26 jaccesswalker.1 -> /usr/java/jdk-12.0.1/man/man1/jaccesswalker.1
lrwxrwxrwx. 1 root root 30 6月 18 10:26 jaotc -> /usr/java/jdk-12.0.1/bin/jaotc
lrwxrwxrwx. 1 root root 28 6月 18 10:26 jar -> /usr/java/jdk-12.0.1/bin/jar
lrwxrwxrwx. 1 root root 35 6月 18 10:26 jar.1 -> /usr/java/jdk-12.0.1/man/man1/jar.1
lrwxrwxrwx. 1 root root 34 6月 18 10:26 jarsigner -> /usr/java/jdk-12.0.1/bin/jarsigner
lrwxrwxrwx. 1 root root 41 6月 18 10:26 jarsigner.1 -> /usr/java/jdk-12.0.1/man/man1/jarsigner.1
lrwxrwxrwx. 1 root root 29 6月 18 10:26 java -> /usr/java/jdk-12.0.1/bin/java
lrwxrwxrwx. 1 root root 36 6月 18 10:26 java.1 -> /usr/java/jdk-12.0.1/man/man1/java.1
lrwxrwxrwx. 1 root root 30 6月 18 10:26 javac -> /usr/java/jdk-12.0.1/bin/javac
lrwxrwxrwx. 1 root root 37 6月 18 10:26 javac.1 -> /usr/java/jdk-12.0.1/man/man1/javac.1
lrwxrwxrwx. 1 root root 32 6月 18 10:26 javadoc -> /usr/java/jdk-12.0.1/bin/javadoc
lrwxrwxrwx. 1 root root 39 6月 18 10:26 javadoc.1 -> /usr/java/jdk-12.0.1/man/man1/javadoc.1
lrwxrwxrwx. 1 root root 30 6月 18 10:26 javap -> /usr/java/jdk-12.0.1/bin/javap
lrwxrwxrwx. 1 root root 37 6月 18 10:26 javap.1 -> /usr/java/jdk-12.0.1/man/man1/javap.1
lrwxrwxrwx. 1 root root 29 6月 18 10:26 jcmd -> /usr/java/jdk-12.0.1/bin/jcmd
lrwxrwxrwx. 1 root root 36 6月 18 10:26 jcmd.1 -> /usr/java/jdk-12.0.1/man/man1/jcmd.1
lrwxrwxrwx. 1 root root 33 6月 18 10:26 jconsole -> /usr/java/jdk-12.0.1/bin/jconsole
lrwxrwxrwx. 1 root root 40 6月 18 10:26 jconsole.1 -> /usr/java/jdk-12.0.1/man/man1/jconsole.1
lrwxrwxrwx. 1 root root 28 6月 18 10:26 jdb -> /usr/java/jdk-12.0.1/bin/jdb
lrwxrwxrwx. 1 root root 35 6月 18 10:26 jdb.1 -> /usr/java/jdk-12.0.1/man/man1/jdb.1
lrwxrwxrwx. 1 root root 34 6月 18 10:26 jdeprscan -> /usr/java/jdk-12.0.1/bin/jdeprscan
lrwxrwxrwx. 1 root root 41 6月 18 10:26 jdeprscan.1 -> /usr/java/jdk-12.0.1/man/man1/jdeprscan.1
lrwxrwxrwx. 1 root root 30 6月 18 10:26 jdeps -> /usr/java/jdk-12.0.1/bin/jdeps
lrwxrwxrwx. 1 root root 37 6月 18 10:26 jdeps.1 -> /usr/java/jdk-12.0.1/man/man1/jdeps.1
lrwxrwxrwx. 1 root root 28 6月 18 10:26 jfr -> /usr/java/jdk-12.0.1/bin/jfr
lrwxrwxrwx. 1 root root 30 6月 18 10:26 jhsdb -> /usr/java/jdk-12.0.1/bin/jhsdb
lrwxrwxrwx. 1 root root 37 6月 18 10:26 jhsdb.1 -> /usr/java/jdk-12.0.1/man/man1/jhsdb.1
lrwxrwxrwx. 1 root root 31 6月 18 10:26 jimage -> /usr/java/jdk-12.0.1/bin/jimage
lrwxrwxrwx. 1 root root 30 6月 18 10:26 jinfo -> /usr/java/jdk-12.0.1/bin/jinfo
lrwxrwxrwx. 1 root root 37 6月 18 10:26 jinfo.1 -> /usr/java/jdk-12.0.1/man/man1/jinfo.1
lrwxrwxrwx. 1 root root 28 6月 18 10:26 jjs -> /usr/java/jdk-12.0.1/bin/jjs
lrwxrwxrwx. 1 root root 35 6月 18 10:26 jjs.1 -> /usr/java/jdk-12.0.1/man/man1/jjs.1
lrwxrwxrwx. 1 root root 30 6月 18 10:26 jlink -> /usr/java/jdk-12.0.1/bin/jlink
lrwxrwxrwx. 1 root root 37 6月 18 10:26 jlink.1 -> /usr/java/jdk-12.0.1/man/man1/jlink.1
lrwxrwxrwx. 1 root root 29 6月 18 10:26 jmap -> /usr/java/jdk-12.0.1/bin/jmap
lrwxrwxrwx. 1 root root 36 6月 18 10:26 jmap.1 -> /usr/java/jdk-12.0.1/man/man1/jmap.1
lrwxrwxrwx. 1 root root 29 6月 18 10:26 jmod -> /usr/java/jdk-12.0.1/bin/jmod
lrwxrwxrwx. 1 root root 36 6月 18 10:26 jmod.1 -> /usr/java/jdk-12.0.1/man/man1/jmod.1
lrwxrwxrwx. 1 root root 28 6月 18 10:26 jps -> /usr/java/jdk-12.0.1/bin/jps
lrwxrwxrwx. 1 root root 35 6月 18 10:26 jps.1 -> /usr/java/jdk-12.0.1/man/man1/jps.1
lrwxrwxrwx. 1 root root 35 6月 18 10:26 jrunscript -> /usr/java/jdk-12.0.1/bin/jrunscript
lrwxrwxrwx. 1 root root 42 6月 18 10:26 jrunscript.1 -> /usr/java/jdk-12.0.1/man/man1/jrunscript.1
lrwxrwxrwx. 1 root root 31 6月 18 10:26 jshell -> /usr/java/jdk-12.0.1/bin/jshell
lrwxrwxrwx. 1 root root 38 6月 18 10:26 jshell.1 -> /usr/java/jdk-12.0.1/man/man1/jshell.1
lrwxrwxrwx. 1 root root 31 6月 18 10:26 jstack -> /usr/java/jdk-12.0.1/bin/jstack
lrwxrwxrwx. 1 root root 38 6月 18 10:26 jstack.1 -> /usr/java/jdk-12.0.1/man/man1/jstack.1
lrwxrwxrwx. 1 root root 30 6月 18 10:26 jstat -> /usr/java/jdk-12.0.1/bin/jstat
lrwxrwxrwx. 1 root root 37 6月 18 10:26 jstat.1 -> /usr/java/jdk-12.0.1/man/man1/jstat.1
lrwxrwxrwx. 1 root root 31 6月 18 10:26 jstatd -> /usr/java/jdk-12.0.1/bin/jstatd
lrwxrwxrwx. 1 root root 38 6月 18 10:26 jstatd.1 -> /usr/java/jdk-12.0.1/man/man1/jstatd.1
lrwxrwxrwx. 1 root root 32 6月 18 10:26 keytool -> /usr/java/jdk-12.0.1/bin/keytool
lrwxrwxrwx. 1 root root 39 6月 18 10:26 keytool.1 -> /usr/java/jdk-12.0.1/man/man1/keytool.1
lrwxrwxrwx. 1 root root 37 6月 18 10:26 kinit.1 -> /usr/java/jdk-12.0.1/man/man1/kinit.1
lrwxrwxrwx. 1 root root 37 6月 18 10:26 klist.1 -> /usr/java/jdk-12.0.1/man/man1/klist.1
lrwxrwxrwx. 1 root root 36 6月 18 10:26 ktab.1 -> /usr/java/jdk-12.0.1/man/man1/ktab.1
lrwxrwxrwx. 1 root root 32 6月 18 10:26 pack200 -> /usr/java/jdk-12.0.1/bin/pack200
lrwxrwxrwx. 1 root root 39 6月 18 10:26 pack200.1 -> /usr/java/jdk-12.0.1/man/man1/pack200.1
lrwxrwxrwx. 1 root root 29 6月 18 10:26 rmic -> /usr/java/jdk-12.0.1/bin/rmic
lrwxrwxrwx. 1 root root 36 6月 18 10:26 rmic.1 -> /usr/java/jdk-12.0.1/man/man1/rmic.1
lrwxrwxrwx. 1 root root 29 6月 18 10:26 rmid -> /usr/java/jdk-12.0.1/bin/rmid
lrwxrwxrwx. 1 root root 36 6月 18 10:26 rmid.1 -> /usr/java/jdk-12.0.1/man/man1/rmid.1
lrwxrwxrwx. 1 root root 36 6月 18 10:26 rmiregistry -> /usr/java/jdk-12.0.1/bin/rmiregistry
lrwxrwxrwx. 1 root root 43 6月 18 10:26 rmiregistry.1 -> /usr/java/jdk-12.0.1/man/man1/rmiregistry.1
lrwxrwxrwx. 1 root root 34 6月 18 10:26 serialver -> /usr/java/jdk-12.0.1/bin/serialver
lrwxrwxrwx. 1 root root 41 6月 18 10:26 serialver.1 -> /usr/java/jdk-12.0.1/man/man1/serialver.1
lrwxrwxrwx. 1 root root 34 6月 18 10:26 unpack200 -> /usr/java/jdk-12.0.1/bin/unpack200
lrwxrwxrwx. 1 root root 41 6月 18 10:26 unpack200.1 -> /usr/java/jdk-12.0.1/man/man1/unpack200.1
3. 用alternatives管理jdk版本并实现灵活切换
google一下发现alternatives是一个方便的多版本管理软件,如果已经安装了多个版本jdk,使用命令alternatives --config java会列出当前所有的jdk版本,输入jdk对应的选项数字按enter就切换到相应的jdk(本机只安装了一个jdk,即:jdk12,且rpm安装已自动注册了alternatives),非常实用。更多使用请使用命令alternatives --help
[root@localhost ~]# alternatives --config java
共有 1 个提供“java”的程序。
选项 命令
-----------------------------------------------
*+ 1 /usr/java/jdk-12.0.1/bin/java
按 Enter 保留当前选项[+],或者键入选项编号:
resin-pro-4.0.62安装
[root@localhost ~]# tar zxvf resin-pro-4.0.62.tar.gzip
[root@localhost ~]# cd resin-pro-4.0.62
[root@localhost resin-pro-4.0.62]# ./configure --prefix=/usr/local/resin \
--with-java-home=/usr/java/default \
--with-openssl=/root/openssl-1.0.2s \
--enable-64bit
# 部分输出信息如下
Resin Configuration Summary:
RESIN : 4.0.62
home : /usr/local/resin
root : /usr/local/resin
conf : /usr/local/resin/conf
log : /usr/local/resin/log
plugins : common resin_os resin resinssl
init : /etc/init.d/resin
JAVA_HOME : /usr/java/default
JNI : 64-bit
include : -I/usr/java/default/include -I/usr/java/default/include/linux
CFLAGS :
cflags_shlib : -fpic
ld_shlib : gcc
ldflags_shlib : -shared -fPIC -m64
libs_shlib :
epoll() for keepalives
OPENSSL : OpenSSL 1.0.2s 28 May 2019
include : /root/openssl-1.0.2s/include
lib : /root/openssl-1.0.2s/lib
libraries : -lssl -lcrypto
[root@localhost resin-pro-4.0.62]# make && make install
./configure --enable-64bit(务必带上参数--enable-64bit,否则报错如下)
/usr/bin/ld: 当搜索用于 /usr/lib/gcc/x86_64-redhat-linux/4.8.5/libgcc_s.so 时跳过不兼容的 -lgcc_s
/usr/bin/ld: 找不到 -lgcc_s
collect2: 错误:ld 返回 1
make[2]: *** [libresin.so] 错误 1
make[2]: 离开目录“/root/resin-pro-4.0.62/modules/c/src/resin”
make[2]: 进入目录“/root/resin-pro-4.0.62/modules/c/src/resinssl”
gcc -g -O2 -DEPOLL -D_POSIX_PTHREAD_SEMANTICS -pthread -fPIC -fno-omit-frame-pointer -O2 -DHAS_SOCK_TIMEOUT -DHAS_SENDFILE -DHAS_SPLICE -DPOLL -DHAS_JVMTI -DRESIN_HOME=\"/usr/local/resin\" -I/root/openssl-1.0.2s/include -I/usr/java/default/include -I/usr/java/default/include/linux -I../common -I../resin_os -DCPU=\"x86_64\" -DOS= -fPIC -m32 -fpic -DSSL_ENGINE -c -o ssl.o ssl.c
gcc -shared -fPIC -m32 -o libresinssl.so ssl.o ../resin_os/memory.o ../resin_os/std.o ../resin_os/java.o -lpthread -lrt -lc -lssl -lcrypto
/usr/bin/ld: 找不到 -lssl
/usr/bin/ld: 找不到 -lcrypto
/usr/bin/ld: 当搜索用于 /usr/lib/gcc/x86_64-redhat-linux/4.8.5/libgcc_s.so 时跳过不兼容的 -lgcc_s
/usr/bin/ld: 找不到 -lgcc_s
collect2: 错误:ld 返回 1
make[2]: *** [libresinssl.so] 错误 1
make[2]: 离开目录“/root/resin-pro-4.0.62/modules/c/src/resinssl”
make[1]: *** [plugins] 错误 2
make[1]: 离开目录“/root/resin-pro-4.0.62/modules/c/src”
make: *** [all] 错误 2
启动resin,检查是否可用
[root@localhost resin-pro-4.0.62]# cd /usr/local/resin/bin/
[root@localhost bin]# ./resin.sh start
Resin/4.0.62 launching watchdog at 127.0.0.1:6600
Resin/4.0.62 started -server 'app-0' with watchdog at 127.0.0.1:6600
[root@localhost bin]# ps aux |grep resin
root 20565 84.5 2.6 5116036 103684 pts/0 Sl 16:48 0:09 /usr/java/jdk-12.0.1/bin/java -Dresin.watchdog=app-0 -Djava.util.logging.manager=com.caucho.log.LogManagerImpl -Djavax.management.builder.initial=com.caucho.jmx.MBeanServerBuilderImpl -Djava.awt.headless=true -Djava.awt.headlesslib=true -Dresin.home=/usr/local/resin/ -Dresin.root=/usr/local/resin/ -Xrs -Xss1m -Xmx32m -server com.caucho.boot.WatchdogManager start --log-directory /usr/local/resin/log
root 20624 242 4.6 6777076 178472 pts/0 Sl 16:48 0:16 /usr/java/jdk-12.0.1/bin/java -Dresin.server=app-0 -Djava.util.logging.manager=com.caucho.log.LogManagerImpl -Djava.system.class.loader=com.caucho.loader.SystemClassLoader -Djavax.management.builder.initial=com.caucho.jmx.MBeanServerBuilderImpl -Djava.awt.headless=true -Djava.awt.headlesslib=true -Dresin.home=/usr/local/resin/ -server com.caucho.server.resin.Resin --root-directory /usr/local/resin/ -conf /usr/local/resin/conf/resin.xml -server app-0 -socketwait 35013 start --log-directory /usr/local/resin/log
root 20700 0.0 0.0 112728 992 pts/0 S+ 16:48 0:00 grep --color=auto resin
[root@localhost bin]# netstat -antl
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.1:6600 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:6800 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:8081 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 96 192.168.154.132:22 192.168.154.1:53749 ESTABLISHED
tcp6 0 0 :::3306 :::* LISTEN
tcp6 0 0 :::8080 :::* LISTEN
tcp6 0 0 :::22 :::* LISTEN
tcp6 0 0 :::33060 :::* LISTEN
tcp6 0 0 127.0.0.1:35013 127.0.0.1:50436 ESTABLISHED
tcp6 0 0 127.0.0.1:50436 127.0.0.1:35013 ESTABLISHED
tcp6 0 0 127.0.0.1:38704 127.0.0.1:6600 TIME_WAIT
[root@localhost bin]# ./resin.sh stop
Resin/4.0.62 stopped for watchdog at 127.0.0.1:6600
配置resin开机启动
[root@localhost bin]# chkconfig resin on
[root@localhost bin]# service resin start
破解resin
[root@localhost resin-pro-4.0.62]# mv /usr/local/resin/lib/pro.jar /usr/local/resin/lib/pro.jar.bak
[root@localhost resin-pro-4.0.62]# cp /root/pro-4.0.62.jar /usr/local/resin/lib/pro.jar
在防火墙中开启8080端口的远程访问
[root@localhost resin-pro-4.0.62]# firewall-cmd --zone=public --add-port=8080/tcp --permanent
success
[root@localhost resin-pro-4.0.62]# firewall-cmd --reload
success
[root@localhost resin-pro-4.0.62]# firewall-cmd --zone=public --list-ports
3306/tcp 80/tcp 8080/tcp
至此,resin安装讲解全部结束!
resin配置及resin与nginx动静分离、负载均衡将在以后章节讲解。