1,首先,暂停iptables服务
[iyunv@localhost ~]# service iptables stop
[iyunv@localhost ~]# chkconfig iptables off
2,jdk的安装和配置:
(1),安装jdk命令: rpm -ivh jdk-8u51-linux-x64.rpm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[iyunv@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
[iyunv@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)配置环境变量:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
[iyunv@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
1
2
3
4
[iyunv@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
1
2
[iyunv@localhost install]# javac -version
javac 1.8.0_51
3,tomcat安装配置
(1),创建组和用户tomcat
1
2
3
4
5
6
7
8
9
10
[iyunv@localhost install]# groupadd tomcat
[iyunv@localhost install]# useradd -g tomcat tomcat
[iyunv@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.
[iyunv@localhost install]#
(2)切换用户并创建tomcat用户的目录:
1
2
3
[iyunv@localhost install]# su tomcat
[tomcat@localhost install]$ mkdir /home/tomcat/server
[tomcat@localhost install]$
(3)解压tomcat压缩包并放到指定的目录里
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
[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)切换目录并配置文件:
1
2
3
[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)启动关闭测试
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[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
运维网声明
1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网 享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com