centos 查看是否安装java_centos 安装java和tomcat

一、yum环境

1、查看yum是否安装

rpm -qa | grep yum

二、Java环境

1、查看java是否安装,若没有,进行安装

rpm -qa | grep java

2、查找java-1.8.0的可以使用的安装包

yum list | grep java-1.8.0-openjdk

3、安装java-1.8.0-openjdk所有的文件

yum -y install java-1.8.0-openjdk*

4、查看版本号

java -version

5、输入javac,如果能看到内容输出就说明已经安装好了

[root@VM-0-15-centos ~]#javac

Usage: javac where possible options include:-g Generate all debugging info-g:none Generate no debugging info-g:{lines,vars,source} Generate only some debugging info-nowarn Generate no warnings-verbose Output messages about what the compiler isdoing-deprecation Output source locations where deprecated APIs are used-classpath Specify where to find user class files and annotation processors

三、tomcat

1、安装:yum在线安装tomcat(-y 代表遇到询问都选 y,这样安装过程中就不需要手动输入y了)

yum -y install tomcat

2、查看tomcat服务状态:Active: inactive (dead)  服务处于挂了的状态

[root@VM-0-15-centos tomcat]#systemctl status tomcat

● tomcat.service -Apache Tomcat Web Application Container

Loaded: loaded (/usr/lib/systemd/system/tomcat.service; disabled; vendor preset: disabled)

Active: inactive (dead)

[root@VM-0-15-centos tomcat]#

3、启动tomcat服务,查看状态:Active: active (running) 服务运行中

[root@VM-0-15-centos tomcat]# systemctl start tomcat

[root@VM-0-15-centos tomcat]# systemctl status tomcat

● tomcat.service - Apache Tomcat Web Application Container

Loaded: loaded (/usr/lib/systemd/system/tomcat.service; disabled; vendor preset: disabled)

Active: active (running) since Mon 2020-08-10 10:27:53 CST; 9s ago

Main PID: 27930 (java)

CGroup: /system.slice/tomcat.service

└─27930 /usr/lib/jvm/jre/bin/java -classpath /usr/share/tomcat/bin/bootstrap.jar:/usr/share/t...

Aug 10 10:27:54 VM-0-15-centos server[27930]: Aug 10, 2020 10:27:54 AM org.apache.catalina.startup.C...load

Aug 10 10:27:54 VM-0-15-centos server[27930]: INFO: Initialization processed in 515 ms

Aug 10 10:27:54 VM-0-15-centos server[27930]: Aug 10, 2020 10:27:54 AM org.apache.catalina.core.Stan...rnal

Aug 10 10:27:54 VM-0-15-centos server[27930]: INFO: Starting service Catalina

Aug 10 10:27:54 VM-0-15-centos server[27930]: Aug 10, 2020 10:27:54 AM org.apache.catalina.core.Stan...rnal

Aug 10 10:27:54 VM-0-15-centos server[27930]: INFO: Starting Servlet Engine: Apache Tomcat/7.0.76

Aug 10 10:27:54 VM-0-15-centos server[27930]: Aug 10, 2020 10:27:54 AM org.apache.coyote.AbstractPro...tart

Aug 10 10:27:54 VM-0-15-centos server[27930]: INFO: Starting ProtocolHandler ["ajp-bio-8009"]

Aug 10 10:27:54 VM-0-15-centos server[27930]: Aug 10, 2020 10:27:54 AM org.apache.catalina.startup.C...tart

Aug 10 10:27:54 VM-0-15-centos server[27930]: INFO: Server startup in 34 ms

Hint: Some lines were ellipsized, use -l to show in full.

[root@VM-0-15-centos tomcat]#

4、访问:浏览器访问http://服务器公网ip:8080, 就可以打开tomcat的地址了

5、配置用户:进入 tomcat 安装目录(cd /usr/share/tomcat),进入 conf 目录,打开 tomcat-users.xml 文件,在 标签下,添加如下配置:

fc44539d539efa415f5e4826dea8143d.png

6、tomcat相关命令

停止tomcat服务

systemctl stop tomcat

重启tomcat

systemctl restart tomcat

开机启动

systemctl enable tomcat

查看tomcat状态

systemctl status tomcat

启动tomcat

systemctl start tomcat

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值