1.2 tomcat服务部署
1.2.1 jdk部署
通过工具上传或下载jdk压缩包
[root@localhost ~]# yum install –y lrzsz
[root@localhost ~]# rz
解压并移动到其他目录下
[root@localhost ~]# tar xf jdk-8u181-linux-x64.tar.gz
[root@localhost ~]# mv jdk1.8.0_181/ /usr/local/jdk
编辑环境变量
[root@localhost ~]# vi /etc/profile
添加:
export JAVA_HOME=/usr/local/jdk
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib
export PATH=$JAVA_HOME/bin:$PATH
使环境变量生效
[root@localhost ~]# source /etc/profile
查看jdk版本
[root@localhost ~]# java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
1.2.2 tomcat部署
上传下载好的文件并解压,移动到/usr/local下面
# tar -xf apache-tomcat-8.5.43.tar.gz
# mv apache-tomcat-8.5.43 /usr/local/apache-tomcat-8.5.43
关闭防火墙
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
或者开放防火墙对80、8080端口的限制。
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --reload
关闭selinux
[root@localhost local]# setenforce 0
setenforce: SELinux is disabled
进入tomcat下的bin目录执行:
./startup.sh 启动 tomcat
./shutdown.sh 停止 tomcat
[root@localhost bin]# cd /usr/local/apache-tomcat-8.5.43/bin
[root@localhost bin]# ./startup.sh