下载tomcat
Tomcat下载地址→:Apache Tomcat® - Apache Tomcat 9 Software Downloads
导入到linux并解压
jdk压缩包上传到linux,用xftp或者用xshell直接传输文件
解压命令:tar -zxvf apache-tomcat-9.0.56.tar.gz(apache-tomcat…这个是刚下载的tomcat名称)
配置环境变量
输入:vim /etc/profile 打开配置文件,按 i 进入编辑模式,在profile文件尾部后面添加如下内容:
export CATALINA_HOME=/root/apps/tomcat/apache-tomcat-9.0.56
(CATALINA_HOME=后面是你tomcat路径)
编辑完之后,按Esc 并输入 :wq(小写) 保存并退出编辑,然后输入以下指令:source /etc/profile 刷新环境配置使profile文件立即生效
启动tomcat
运行 tomcat目录/bin目录下 输入./ startup.sh 就会启动tomcat,在本地真机浏览器中访问http:// 你的IP :8080了,能看到如下界面,说明访问成功。
记得服务器放通8080端口
部分命令
查看全部服务命令:
systemctl list-unit-files --type service
查看服务
systemctl status name.service
增加开机启动
systemctl enable name.service
启动服务
systemctl start name.service
停止服务
systemctl stop name.service
重启服务
systemctl restart name.service
删除开机启动
systemctl disable name.service
linux启动tomcat
作为服务启动作为服务启动 ./startup.sh &
关闭服务 ./shutdown.sh