先把tomcat和jdk包下好html
http://tomcat.apache.org/download-70.cgijava
http://www.Oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html linux
安裝jdkweb
[root@kurolz ~]# ls jdk* jdk-8u131-linux-x64.rpm [root@kurolz ~]# rpm -ivh jdk-8u131-linux-x64.rpm
配置環境變量apache
[root@kurolz ~]# vim /etc/profile export JAVA_HOME=/usr/java/default export JAVA_BIN=$JAVA_HOME/bin export PATH=$PATH:$JAVA_HOME/bin export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH [root@kurolz ~]# source /etc/profile [root@kurolz ~]# java -version java 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)
解壓安裝tomcatbootstrap
[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.sh Using CATALINA_BASE: /root/apache-tomcat-7.0.77 Using CATALINA_HOME: /root/apache-tomcat-7.0.77 Using CATALINA_TMPDIR: /root/apache-tomcat-7.0.77/temp Using JRE_HOME: /usr/java/default Using CLASSPATH: /root/apache-tomcat-7.0.77/bin/bootstrap.jar:/root/apache-tomcat-7.0.77/bin/tomcat-juli.jar Tomcat started.
關閉防火牆或者加一條容許8080端口經過vim
/sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT瀏覽器
[root@kurolz bin]# service iptables stop iptables:清除防火牆規則: [肯定] iptables:將鏈設置爲政策 ACCEPT:filter [肯定] iptables:正在卸載模塊: [肯定]
瀏覽器測試:http://ip:8080tomcat
增長web管理帳號和角色,再<tomcat-users>標籤裏寫入下面2條,指定 bash
[root@kurolz ~]# vim apache-tomcat-7.0.77/conf/tomcat-users.xml <tomcat-users> <role rolename="kurolz"/> <user username="kurolz" password="kurolz" role="kurolz"/> </tomcat-users>