1,首先,暂停iptables服务
[root@localhost ~]# service iptables stop
[root@localhost ~]# chkconfig iptables off
2,jdk的安装和配置:
(1),安装jdk命令: rpm -ivh jdk-8u51-linux-x64.rpm
[root@localhost install]# ll total 481168 -rw-r--r--. 1 root root 8850470 Nov 2 22:43 apache-tomcat-7.0.63.tar.gz -rw-r--r--. 1 root root 137808216 Jan 13 15:09 jdk-8u51-linux-x64.rpm -rw-r--r--. 1 root root 33203321 Nov 20 11:31 mysql-5.6.25.tar.gz -rw-r--r--. 1 root root 312845162 Nov 13 15:19 mysql-5.6.27-linux-glibc2.5-x86_64.tar.gz [root@localhost install]# rpm -ivh jdk-8u51-linux-x64.rpm Preparing... ########################################### [100%] 1:jdk1.8.0_51 ########################################### [100%] Unpacking JAR files... rt.jar... jsse.jar... charsets.jar... tools.jar... localedata.jar... jfxrt.jar... plugin.jar... javaws.jar... deploy.jar...
(2)配置环境变量:
[root@localhost install]# vi /etc/profile # /etc/profile # System wide environment and startup programs, for login setup # Functions and aliases go in /etc/bashrc # It‘s NOT a good idea to change this file unless you know what you # are doing. It‘s much better to create a custom.sh shell script in # /etc/profile.d/ to make custom changes to your environment, as this # will prevent the need for merging in future updates. pathmunge () { case ":${PATH}:" in *:"$1":*) ;; *) if [ "$2" = "after" ] ; then PATH=$PATH:$1 else PATH=$1:$PATH fi esac } "/etc/profile" 78L, 1796C # By default, we want umask to get set. This sets it for login shell # Current threshold for system reserved uid/gids is 200 # You could check uidgid reservation validity in # /usr/share/doc/setup-*/uidgid file if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then umask 002 else umask 022 fi for i in /etc/profile.d/*.sh ; do if [ -r "$i" ]; then if [ "${-#*i}" != "$-" ]; then . "$i" else . "$i" >/dev/null 2>&1 fi fi done unset i unset -f pathmunge export JAVA_HOME=/usr/java/jdk1.8.0_51 export PATH=$JAVA_HOME/bin:$PATH export CLASSPATH=$JAVA_HOME/lib:.:$CLASSPATH
(3)测试:
查看java版本号:java -version
[root@localhost install]# java -version java version "1.8.0_51" Java(TM) SE Runtime Environment (build 1.8.0_51-b16) Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)
查看javac版本号命令:javac -version
[root@localhost install]# javac -version javac 1.8.0_51
3,tomcat安装配置
(1),创建组和用户tomcat
[root@localhost install]# groupadd tomcat [root@localhost install]# useradd -g tomcat tomcat [root@localhost install]# passwd tomcat Changing password for user tomcat. New password: BAD PASSWORD: it is too simplistic/systematic BAD PASSWORD: is too simple Retype new password: passwd: all authentication tokens updated successfully. [root@localhost install]#
(2)切换用户并创建tomcat用户的目录:
[root@localhost install]# su tomcat [tomcat@localhost install]$ mkdir /home/tomcat/server [tomcat@localhost install]$
(3)解压tomcat压缩包并放到指定的目录里
[tomcat@localhost install]$ tar zxvf apache-tomcat-7.0.63.tar.gz -C /home/tomcat/server/ apache-tomcat-7.0.63/webapps/examples/jsp/xml/xml.jsp.html apache-tomcat-7.0.63/webapps/examples/servlets/chat/index.jsp apache-tomcat-7.0.63/webapps/examples/servlets/chat/index.jsp.html apache-tomcat-7.0.63/webapps/examples/servlets/chat/login.jsp apache-tomcat-7.0.63/webapps/examples/servlets/chat/login.jsp.html apache-tomcat-7.0.63/webapps/examples/servlets/chat/post.jsp apache-tomcat-7.0.63/webapps/examples/servlets/chat/post.jsp.html apache-tomcat-7.0.63/webapps/examples/servlets/cookies.html apache-tomcat-7.0.63/webapps/examples/servlets/helloworld.html apache-tomcat-7.0.63/webapps/examples/servlets/images/code.gif apache-tomcat-7.0.63/webapps/examples/servlets/images/execute.gif apache-tomcat-7.0.63/webapps/examples/servlets/images/return.gif apache-tomcat-7.0.63/webapps/examples/servlets/index.html apache-tomcat-7.0.63/webapps/examples/servlets/reqheaders.html apache-tomcat-7.0.63/webapps/examples/servlets/reqinfo.html apache-tomcat-7.0.63/webapps/examples/servlets/reqparams.html apache-tomcat-7.0.63/webapps/examples/servlets/sessions.html apache-tomcat-7.0.63/webapps/examples/websocket-deprecated/chat.html apache-tomcat-7.0.63/webapps/examples/websocket-deprecated/echo.html apache-tomcat-7.0.63/webapps/examples/websocket-deprecated/index.html apache-tomcat-7.0.63/webapps/examples/websocket-deprecated/snake.html apache-tomcat-7.0.63/webapps/examples/websocket/chat.xhtml apache-tomcat-7.0.63/webapps/examples/websocket/drawboard.xhtml apache-tomcat-7.0.63/webapps/examples/websocket/echo.xhtml apache-tomcat-7.0.63/webapps/examples/websocket/index.xhtml apache-tomcat-7.0.63/webapps/examples/websocket/snake.xhtml apache-tomcat-7.0.63/webapps/host-manager/META-INF/context.xml apache-tomcat-7.0.63/webapps/host-manager/WEB-INF/jsp/401.jsp apache-tomcat-7.0.63/webapps/host-manager/WEB-INF/jsp/403.jsp apache-tomcat-7.0.63/webapps/host-manager/WEB-INF/jsp/404.jsp apache-tomcat-7.0.63/webapps/host-manager/WEB-INF/web.xml apache-tomcat-7.0.63/webapps/host-manager/images/add.gif apache-tomcat-7.0.63/webapps/host-manager/images/asf-logo.gif apache-tomcat-7.0.63/webapps/host-manager/images/code.gif apache-tomcat-7.0.63/webapps/host-manager/images/design.gif apache-tomcat-7.0.63/webapps/host-manager/images/docs.gif apache-tomcat-7.0.63/webapps/host-manager/images/fix.gif apache-tomcat-7.0.63/webapps/host-manager/images/tomcat.gif apache-tomcat-7.0.63/webapps/host-manager/images/update.gif apache-tomcat-7.0.63/webapps/host-manager/images/void.gif apache-tomcat-7.0.63/webapps/host-manager/index.jsp apache-tomcat-7.0.63/webapps/host-manager/manager.xml apache-tomcat-7.0.63/webapps/manager/META-INF/context.xml apache-tomcat-7.0.63/webapps/manager/WEB-INF/jsp/401.jsp apache-tomcat-7.0.63/webapps/manager/WEB-INF/jsp/403.jsp apache-tomcat-7.0.63/webapps/manager/WEB-INF/jsp/404.jsp apache-tomcat-7.0.63/webapps/manager/WEB-INF/jsp/sessionDetail.jsp apache-tomcat-7.0.63/webapps/manager/WEB-INF/jsp/sessionsList.jsp apache-tomcat-7.0.63/webapps/manager/WEB-INF/web.xml apache-tomcat-7.0.63/webapps/manager/images/add.gif apache-tomcat-7.0.63/webapps/manager/images/asf-logo.gif apache-tomcat-7.0.63/webapps/manager/images/code.gif apache-tomcat-7.0.63/webapps/manager/images/design.gif apache-tomcat-7.0.63/webapps/manager/images/docs.gif apache-tomcat-7.0.63/webapps/manager/images/fix.gif apache-tomcat-7.0.63/webapps/manager/images/tomcat.gif apache-tomcat-7.0.63/webapps/manager/images/update.gif apache-tomcat-7.0.63/webapps/manager/images/void.gif apache-tomcat-7.0.63/webapps/manager/index.jsp apache-tomcat-7.0.63/webapps/manager/status.xsd apache-tomcat-7.0.63/webapps/manager/xform.xsl
(4)切换目录并配置文件:
[tomcat@localhost install]$ cd /home/tomcat/server/apache-tomcat-7.0.63/conf/ [tomcat@localhost conf]$ cp server.xml server.xml.bak [tomcat@localhost conf]$ vi server.xml
(5)启动关闭测试
[tomcat@localhost bin]$ /home/tomcat/server/tomcat/bin/startup.sh Using CATALINA_BASE: /home/tomcat/server/apache-tomcat-7.0.63 Using CATALINA_HOME: /home/tomcat/server/apache-tomcat-7.0.63 Using CATALINA_TMPDIR: /home/tomcat/server/apache-tomcat-7.0.63/temp Using JRE_HOME: /usr Using CLASSPATH: /home/tomcat/server/apache-tomcat-7.0.63/bin/bootstrap.jar:/home/tomcat/server/apache-tomcat-7.0.63/bin/tomcat-juli.jar Tomcat started. [tomcat@localhost bin]$ ps -ef|grep tomca root 1535 1102 0 15:24 pts/0 00:00:00 su tomcat tomcat 1536 1535 0 15:24 pts/0 00:00:00 bash tomcat 1568 1 30 15:31 pts/0 00:00:02 /usr/bin/java -Djava.util.logging.config.file=/home/tomcat/server/apache-tomcat-7.0.63/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/home/tomcat/server/apache-tomcat-7.0.63/endorsed -classpath /home/tomcat/server/apache-tomcat-7.0.63/bin/bootstrap.jar:/home/tomcat/server/apache-tomcat-7.0.63/bin/tomcat-juli.jar -Dcatalina.base=/home/tomcat/server/apache-tomcat-7.0.63 -Dcatalina.home=/home/tomcat/server/apache-tomcat-7.0.63 -Djava.io.tmpdir=/home/tomcat/server/apache-tomcat-7.0.63/temp org.apache.catalina.startup.Bootstrap start tomcat 1586 1536 4 15:31 pts/0 00:00:00 ps -ef tomcat 1587 1536 0 15:31 pts/0 00:00:00 grep tomca [tomcat@localhost bin]$ netstat -lntp |grep 8080 (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) tcp 0 0 :::8080 :::* LISTEN 1568/java
本文出自 “清风明月” 博客,请务必保留此出处http://liqingbiao.blog.51cto.com/3044896/1734612
原文地址:http://liqingbiao.blog.51cto.com/3044896/1734612