Linux下配置Tomcat使用普通用户启动Daemon进程
来源:互联网 发布:2016淘宝客教程视频 编辑:程序博客网 时间:2024/05/29 07:45
原文地址:Linux下配置Tomcat使用普通用户启动Daemon进程 作者:edgeman03
系统环境
System Version:略(任意系统版本均可)
Tomcat Version: 6.0.41
JRE/JDK Version: 1.6
安装配置Tomcat
过程略,具体可参考我之前的文章,整个配置过程大致一样,除启动脚本配置不一样外,具体配置如下
《Linux(CentOS)下配置安装Tomcat并配置JDK环境》
《Linux(CentOS)下配置安装Tomcat并配置JRE环境》
配置Daemon方式启动tomcat
原因不多说,按前面文章方式肯定是因为直接用root用户启动tomcat不安全,所以才打算使用普通用户启动
1.创建专用启动用户
# useradd -M -r -d /dev/null -s /sbin/nologin tomcat
2.编译jsvc
# cd /opt/tomcat/bin
# tar -xf commons-daemon-native.tar.gz
# cd commons-daemon-1.0.15-native-src/unix
# ls
CHANGES.txt configure configure.in INSTALL.txt Makedefs.in Makefile.in man native support
# sh support/buildconf.sh
# ./configure --with-java=/opt/jdk #--with-java=/opt/jdk 这个是指定jdk的具体路径,因为编译jsvc需要用到jdk,正式生产环境建议编译完成后删除jdk,java环境使用jre即可
# make
# cp jsvc /opt/tomcat/bin/
# cd /opt/tomcat/bin/
# rm -fr commons-daemon-1.0.15-native-src
3.配置jsvc的daemon启动脚本
# cp daemon.sh /etc/init.d/tomcat
# vim /etc/init.d/tomcat
在文件头增加以下环境变量(注:在启动脚本中增加这几个环境变量,是为了在系统启动时能正常启动这个脚本)
export JAVA_HOME=/opt/jre
export TOMCAT_HOME=/opt/tomcat
export CATALINA_HOME=/opt/tomcat
export CATALINA_BASE=/opt/tomcat
export CATALINA_TMPDIR=/opt/tomcat/temp
export TOMCAT_HOME=/opt/tomcat
export CATALINA_HOME=/opt/tomcat
export CATALINA_BASE=/opt/tomcat
export CATALINA_TMPDIR=/opt/tomcat/temp
如果是其它专用启动用户
# Use the maximum available, or set MAX_FD != -1 to use that
test ".$MAX_FD" = . && MAX_FD="maximum"
# Setup parameters for running the jsvc
#
test ".$TOMCAT_USER" = . && TOMCAT_USER=tomcat #在这个地方把用户名改了
# Set JAVA_HOME to working JDK or JRE
JAVA_HOME=/opt/jre
# If not set we'll try to guess the JAVA_HOME
# from java binary if on the PATH
#
test ".$MAX_FD" = . && MAX_FD="maximum"
# Setup parameters for running the jsvc
#
test ".$TOMCAT_USER" = . && TOMCAT_USER=tomcat #在这个地方把用户名改了
# Set JAVA_HOME to working JDK or JRE
JAVA_HOME=/opt/jre
# If not set we'll try to guess the JAVA_HOME
# from java binary if on the PATH
#
4.启动脚本
# /etc/init.d/tomcat start
检查是否有启动成功
# netstat -ntpul
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 ::ffff:127.0.0.1:8080 :::* LISTEN 3059/jsvc.exec
tcp 0 0 ::ffff:127.0.0.1:8009 :::* LISTEN 3059/jsvc.exec
来自为知笔记(Wiz)
0 0
- Linux下配置Tomcat使用普通用户启动Daemon进程
- Linux下配置Tomcat使用普通用户启动Daemon进程
- Linux普通用户启动tomcat
- Linux下采用普通用户ceshi身份自动启动Tomcat
- linux下的daemon进程
- linux下的daemon进程
- linux下的daemon进程
- linux下普通用户如何使用80端口启动程序
- linux 普通用户通过80端口启动tomcat
- Linux下配置环境变量,启动 tomcat,查看tomcat日志,杀死进程
- linux tomcat 启动用户修改 root用户改为普通用户启动
- linux 下(Daemon)守护进程
- linux下创建守护进程(daemon process)
- linux下创建守护进程(daemon process)
- linux下tomcat作为daemon运行
- linux下tomcat作为daemon运行
- linux下tomcat作为daemon运行
- linux下配置tomcat开机启动
- WCF webhttprequest usage
- iOS进阶路线以及进阶书籍
- ubuntu 下舒畅的使用libreoffice
- leetcode-11Container With Most Water
- 欢迎使用CSDN-markdown编辑器
- Linux下配置Tomcat使用普通用户启动Daemon进程
- Oracle 学习笔记
- ava.util.ResourceBundle使用详解
- Linux学习总结
- 排序算法系列之八大排序算法性能比较-从实验结果分析
- 一个失败CEO的九大特征
- Java之美[从菜鸟到高手演变]之设计模式三
- 户外广告为何青睐LED显示
- JIRA项目执行与管理方案