千家信息网

rhel6.4部署tomcat

发表于:2025-01-25 作者:千家信息网编辑
千家信息网最后更新 2025年01月25日,先把tomcat和jdk包下好http://tomcat.apache.org/download-70.cgihttp://www.Oracle.com/technetwork/java/javase
千家信息网最后更新 2025年01月25日rhel6.4部署tomcat

先把tomcat和jdk包下好

http://tomcat.apache.org/download-70.cgi

http://www.Oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html


安装jdk

[root@kurolz ~]# ls jdk*jdk-8u131-linux-x64.rpm[root@kurolz ~]# rpm -ivh jdk-8u131-linux-x64.rpm


配置环境变量

[root@kurolz ~]# vim /etc/profileexport JAVA_HOME=/usr/java/defaultexport JAVA_BIN=$JAVA_HOME/binexport PATH=$PATH:$JAVA_HOME/binexport CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarexport PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH[root@kurolz ~]# source /etc/profile[root@kurolz ~]# java -versionjava version "1.8.0_131"Java(TM) SE Runtime Environment (build 1.8.0_131-b11)Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)


解压安装tomcat

[root@kurolz ~]# tar -zxvf apache-tomcat-7.0.77.tar.gz[root@kurolz ~]# cd apache-tomcat-7.0.77[root@kurolz ~]# cd apache-tomcat-7.0.77/bin/[root@kurolz bin]# ./startup.shUsing CATALINA_BASE:   /root/apache-tomcat-7.0.77Using CATALINA_HOME:   /root/apache-tomcat-7.0.77Using CATALINA_TMPDIR: /root/apache-tomcat-7.0.77/tempUsing JRE_HOME:        /usr/java/defaultUsing CLASSPATH:       /root/apache-tomcat-7.0.77/bin/bootstrap.jar:/root/apache-tomcat-7.0.77/bin/tomcat-juli.jarTomcat started.


关闭防火墙或者加一条允许8080端口通过

/sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT

[root@kurolz bin]# service iptables stopiptables:清除防火墙规则:                             [确定]iptables:将链设置为政策 ACCEPT:filter                    [确定]iptables:正在卸载模块:                              [确定]


浏览器测试:http://ip:8080



增加web管理账号和角色,再标签里写入下面2条,指定

[root@kurolz ~]# vim apache-tomcat-7.0.77/conf/tomcat-users.xml    


0