CentOS下yum安装jdk以及tomcat

安装JDK,path之类的已经自动设置好了

[java]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. 2. 安装JDK  
  2. yum list java*  
  3. yum install java-1.7.0-openjdk* -y  
 

安装 tomcat

[java]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. 4. 安装 tomcat  
  2. cd /usr/local  
  3. wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-7/v7.0.63/bin/apache-tomcat-7.0.63.tar.gz  
  4. tar -zxf apache-tomcat-7.0.63.tar.gz  
  5. mv apache-tomcat-7.0.63 tomcat  

4.1 修改配置文件

[java]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. cd /usr/local/tomcat/conf  
  2. # 修改配置文件 server.xml,不能有中文.  
  3. # 配置端口号,绑定域名,别名,以及设置线程池,映射context文件夹  
  4. vi server.xml  

启动mysqld 服务,以及tomcat

[java]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. -- 5. 启动mysqld 服务,以及tomcat  
  2. cd /usr/local/renfufei  
  3. mkdir mysql_data  
  4. # 必须修改所属用户哦,如果修改了mysql的数据文件保存目录的话  
  5. chown mysql:mysql mysql_data  
  6.   
  7. service mysqld start  
  8. /usr/local/tomcat/bin/startup.sh  


5.1 设置Tomcat自动启动

有很多种方式,比如设置服务,或者使用 rc.local 进行加载。

修改 /etc/rc.d/rc.local 文件:

  1. vim /etc/rc.d/rc.local  
在里面增加启动Tomcat的脚本,然后保存. 最终结果如下所示:

[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. [root@xxx bin]# cat /etc/rc.d/rc.local   
  2. #!/bin/sh  
  3. #  
  4. # This script will be executed *after* all the other init scripts.  
  5. # You can put your own initialization stuff in here if you don't  
  6. # want to do the full Sys V style init stuff.  
  7.   
  8. touch /var/lock/subsys/local  
  9.   
  10. # start tomcat  
  11. /usr/local/tomcat/bin/startup.sh  
可以看到, 我们只增加了最后一行。意思是在Linux启动完成后,加载其他初始脚本完毕之后, 执行启动Tomcat的命令.
当然,启动其他程序也可以使用这种方式,但是就是土了一点,而且不可以使用 chkconfig 进行配置和调用(也就是说没有采用安装服务的方式.)

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值