centos 7安装jdk、tomcat

时间:2021-01-15 16:37:20

jdk安装

创建上传目录:

[root@ckl1 home]# pwd
/home
[root@ckl1 home]# mkdir upload

 

安装上传工具:

yum install lrzsz    

 

上传tar包:

centos 7安装jdk、tomcat

 

解压缩到/usr/local(或者本地解压也可以)

[root@ckl1 upload]# tar -zxvf jdk-8u161-linux-x64.tar.gz -C /usr/local/

 

查看解压的jdk:

centos 7安装jdk、tomcat

 

配置path:

[root@ckl1 ~]#  vim /etc/profile

如果提示vim没安装,yum install vim

 

按GG,跳转到尾部,按i,进入编辑模式,粘贴以下代码后,按esc退出编辑,按:wq退出(具体参考vim的操作):

#java environment
export JAVA_HOME=/usr/local/jdk1.8.0_161
export CLASSPATH=.:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jar
export PATH=$PATH:${JAVA_HOME}/bin

 

刷新环境变量:

[root@ckl1 local]# source /etc/profile

测试:

centos 7安装jdk、tomcat

 

Tomcat安装:

上传安装包:

centos 7安装jdk、tomcat

 

解压缩:

tar -zxvf apache-tomcat-8.5.28.tar.gz 

 

查看目录:

centos 7安装jdk、tomcat

 

启动:

centos 7安装jdk、tomcat

 

关闭防火墙:

首先查看防火墙状态:

[root@ckl1 apache-tomcat-8.5.28]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2018-04-19 09:26:32 CST; 7h ago
     Docs: man:firewalld(1)
 Main PID: 634 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─634 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopi

可以看到,防火墙是开的。

我们关闭它,不然外部不能访问。

[root@ckl1 apache-tomcat-8.5.28]# systemctl stop firewalld.service
[root@ckl1 apache-tomcat-8.5.28]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Thu 2018-04-19 17:06:26 CST; 1s ago
     Docs: man:firewalld(1)
 Main PID: 634 (code=exited, status=0/SUCCESS)

 

测试:

http://192.168.44.128:8080/

centos 7安装jdk、tomcat

 

 

 

ok了。