Linux 安装jsvc

目录

一、下载commons-daemon

二、解压安装


一、下载commons-daemon

commons-daemon-1.3.3-src.tar.gzhttps://dlcdn.apache.org//commons/daemon/source/commons-daemon-1.3.3-src.tar.gz

Daemon – Download Apache Commons Daemon

二、解压安装

1.上传至服务器 ,执行解压命令

tar -xzvf commons-daemon-1.3.3-src.tar.gz

2.进入目录unix

cd commons-daemon-1.3.3-src/src/native/unix/
[root@centos-tianmen unix]# ll
总用量 172
-rwxrwxr-x. 1 root root 147655 9月  18 21:49 configure
-rw-r--r--. 1 root root   5038 9月  18 21:49 configure.in
-rw-r--r--. 1 root root   2598 9月  18 21:49 INSTALL.txt
-rw-r--r--. 1 root root   1081 9月  18 21:49 Makedefs.in
-rw-r--r--. 1 root root   1110 9月  18 21:49 Makefile.in
drwxr-xr-x. 2 root root     58 3月  19 23:11 man
drwxr-xr-x. 2 root root   4096 3月  19 23:11 native
drwxr-xr-x. 2 root root    141 3月  19 23:11 support

3.配置

./configure --with-java=/你的jdk安装目录

4.make 

make

5.验证 

./jsvc --help

示例: 

[root@centos-tianmen unix]# ./configure --with-java=/apphome/jdk1.8.0_361
*** Current host ***
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking cached host system type... ok
*** C-Language compilation tools ***
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... -std=gnu11
checking for ranlib... ranlib
checking for strip... strip
*** Host support ***
checking C flags dependant on host system type... ok
*** Java compilation tools ***
checking JAVA_HOME... /apphome/jdk1.8.0_361
checking for JDK os include directory...  linux
gcc flags added
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for sys/capability.h... no
configure: WARNING: cannot find headers for libcap
*** Writing output files ***
configure: creating ./config.status
config.status: creating Makefile
config.status: creating Makedefs
config.status: creating native/Makefile
*** All done ***
Now you can issue "make"
[root@centos-tianmen unix]# make
(cd native; make  all)
make[1]: 进入目录“/apphome/commons-daemon-1.3.3-src/src/native/unix/native”
gcc -std=gnu11 -g -O2 -DOS_LINUX -DDSO_DLFCN -DCPU=\"amd64\" -Wall -Wstrict-prototypes   -I/apphome/jdk1.8.0_361/include -I/apphome/jdk1.8.0_361/include/linux -c jsvc-unix.c -o jsvc-unix.o
jsvc-unix.c: 在函数‘run_controller’中:
jsvc-unix.c:1311:20: 警告:从不兼容的指针类型赋值 [默认启用]
     act.sa_handler = controller;
                    ^
gcc -std=gnu11 -g -O2 -DOS_LINUX -DDSO_DLFCN -DCPU=\"amd64\" -Wall -Wstrict-prototypes   -I/apphome/jdk1.8.0_361/include -I/apphome/jdk1.8.0_361/include/linux -c arguments.c -o arguments.o
gcc -std=gnu11 -g -O2 -DOS_LINUX -DDSO_DLFCN -DCPU=\"amd64\" -Wall -Wstrict-prototypes   -I/apphome/jdk1.8.0_361/include -I/apphome/jdk1.8.0_361/include/linux -c debug.c -o debug.o
gcc -std=gnu11 -g -O2 -DOS_LINUX -DDSO_DLFCN -DCPU=\"amd64\" -Wall -Wstrict-prototypes   -I/apphome/jdk1.8.0_361/include -I/apphome/jdk1.8.0_361/include/linux -c dso-dlfcn.c -o dso-dlfcn.o
gcc -std=gnu11 -g -O2 -DOS_LINUX -DDSO_DLFCN -DCPU=\"amd64\" -Wall -Wstrict-prototypes   -I/apphome/jdk1.8.0_361/include -I/apphome/jdk1.8.0_361/include/linux -c dso-dyld.c -o dso-dyld.o
gcc -std=gnu11 -g -O2 -DOS_LINUX -DDSO_DLFCN -DCPU=\"amd64\" -Wall -Wstrict-prototypes   -I/apphome/jdk1.8.0_361/include -I/apphome/jdk1.8.0_361/include/linux -c help.c -o help.o
gcc -std=gnu11 -g -O2 -DOS_LINUX -DDSO_DLFCN -DCPU=\"amd64\" -Wall -Wstrict-prototypes   -I/apphome/jdk1.8.0_361/include -I/apphome/jdk1.8.0_361/include/linux -c home.c -o home.o
gcc -std=gnu11 -g -O2 -DOS_LINUX -DDSO_DLFCN -DCPU=\"amd64\" -Wall -Wstrict-prototypes   -I/apphome/jdk1.8.0_361/include -I/apphome/jdk1.8.0_361/include/linux -c java.c -o java.o
gcc -std=gnu11 -g -O2 -DOS_LINUX -DDSO_DLFCN -DCPU=\"amd64\" -Wall -Wstrict-prototypes   -I/apphome/jdk1.8.0_361/include -I/apphome/jdk1.8.0_361/include/linux -c location.c -o location.o
gcc -std=gnu11 -g -O2 -DOS_LINUX -DDSO_DLFCN -DCPU=\"amd64\" -Wall -Wstrict-prototypes   -I/apphome/jdk1.8.0_361/include -I/apphome/jdk1.8.0_361/include/linux -c replace.c -o replace.o
gcc -std=gnu11 -g -O2 -DOS_LINUX -DDSO_DLFCN -DCPU=\"amd64\" -Wall -Wstrict-prototypes   -I/apphome/jdk1.8.0_361/include -I/apphome/jdk1.8.0_361/include/linux -c locks.c -o locks.o
gcc -std=gnu11 -g -O2 -DOS_LINUX -DDSO_DLFCN -DCPU=\"amd64\" -Wall -Wstrict-prototypes   -I/apphome/jdk1.8.0_361/include -I/apphome/jdk1.8.0_361/include/linux -c signals.c -o signals.o
ar cr libservice.a arguments.o debug.o dso-dlfcn.o dso-dyld.o help.o home.o java.o location.o replace.o locks.o signals.o
ranlib libservice.a
gcc -std=gnu11   jsvc-unix.o libservice.a -ldl -lpthread -o ../jsvc
make[1]: 离开目录“/apphome/commons-daemon-1.3.3-src/src/native/unix/native”
[root@centos-tianmen unix]# ./jsvc --help
Usage: jsvc [-options] class [args...]

Where options include:

    -help | --help | -?
        show this help page (implies -nodetach)
    -jvm <JVM name>
        use a specific Java Virtual Machine. Available JVMs:
            'server'
    ...

6.复制jsvc到指定目录

cp jsvc /apphome/

7.建立软连接

ln /apphome/jsvc /usr/bin/jsvc

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值