• 欢迎大家分享资料!前往留言板评论即可!

Linux服务器下安装Tomcat8服务器详细教程

合宙 模组资料网 8个月前 (05-15) 144次浏览 已收录 0个评论 扫描二维码

Tomcat 服务器是一个免费的开放源代码的Web 应用服务器,属于轻量级应用服务器,在中小型系统和并发访问用户不是很多的场合下被普遍使用。

$ d/ w+ z6 I0 E8 R+ G0 R” W


<

p style=”word-wrap: break-word; margin-bottom: 0px; padding: 0px; color: rgb(68, 68, 68); font-family: Tahoma, “Microsoft Yahei”, Simsun; line-height: 30px; text-indent: 2em;”>对于创客进行物联网方面的发明创造时,可以将用java语言编写的web应用程序部署到Tomcat服务器中,这绝对是一个不错的选择。那么在这篇文章中,我将去在自己的Linux服务器上安装Tomcat8,当你想要按照我的步骤去在自己服务器上安装Tomcat服务器时,请先确保一下条件:

. D( z6 b8 U# K) Y
1、你有自己的Linux系统服务器,我的服务器是Centos 6.8 64位系统。0 ]) v9 I( C% I% d
2、你已经在服务器上安装了JDK,我的服务器已经安装了JDK,版本为jdk1.8.0_65。! l1 c5 m* c# y+ g  K6 V. j& k


2 n  b+ G) q3 }0 ^* A( Z’ d, }2 h
具备上面两个前提条件后,接下来,看我如何安装Tomcat8:
1、首先要到tomcat官网,找到tomcat8的下载连接。
tomcat官网地址为:http://tomcat.apache.org/; C5 x5 r! r+ f  f. r: L
‘ a0 e* G4 c* ?  q# \  # s- C</font><br style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><font size="5" style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;">进入tomcat官网后,找到下载界面,如下所示:</font><font class="jammer" style="word-wrap: break-word; font-size: 10px; color: rgb(255, 255, 255); font-family: Tahoma, "Microsoft Yahei", Simsun;">6 T; r! Y! c6 ^+ [3 c! ]. {* V&nbsp;&nbsp;N+ w0 [</font><br style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><ignore_js_op style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><img id="aimg_1417" aid="1417" src="http://bbs.qdclab.com/data/attachment/forum/201511/20/184339r21ud2m3023dq7kk.jpg" title="Linux服务器下安装Tomcat8服务器详细教程" zoomfile="data/attachment/forum/201511/20/184339r21ud2m3023dq7kk.jpg" file="data/attachment/forum/201511/20/184339r21ud2m3023dq7kk.jpg" class="zoom" width="274" inpost="1" style="word-wrap: break-word; cursor: pointer;">&nbsp;</ignore_js_op><span style="color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"></span><br style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><br style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><font size="5" style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;">找到tar.gz这个文件,并获取下载地址,例如我这用的是傲游云浏览器,tar.gz后就弹出下载页面,就有下载地址,复制一下。</font><font class="jammer" style="word-wrap: break-word; font-size: 10px; color: rgb(255, 255, 255); font-family: Tahoma, "Microsoft Yahei", Simsun;">& t" t9 m1 U" K1 ?</font><br style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><br style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><font size="5" style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;">2、使用putty软件连接服务器,进入输入 cd /web/eoair/download 进入download目录。</font><font class="jammer" style="word-wrap: break-word; font-size: 10px; color: rgb(255, 255, 255); font-family: Tahoma, "Microsoft Yahei", Simsun;">: n& B& z+ H& F5 k; \</font><br style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><font size="5" style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><font class="jammer" style="word-wrap: break-word; font-size: 10px; color: rgb(255, 255, 255);">; \0 s) R+ N2 R6 G8 Ao</font><br style="word-wrap: break-word;"></font><br style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><font size="5" style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;">3、输入 wget&nbsp;<font color="#336699" style="word-wrap: break-word;">http://mirrors.cnnic.cn/apache/tomcat/tomcat-8/v8.0.28/bin/apache-tomcat-8.0.28.tar.gz</font>&nbsp;下载tomcat8的压缩文件包。</font><br style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><font size="5" style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><br style="word-wrap: break-word;"></font><font class="jammer" style="word-wrap: break-word; font-size: 10px; color: rgb(255, 255, 255); font-family: Tahoma, "Microsoft Yahei", Simsun;">( a# y4 u0 u, t* y4 T/ h J</font><br style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><font size="5" style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;">wget是Linux的下载命令,wget后面是tomcat8压缩包的url地址。tomcat官网有时候更新版本,也许这个url会失效,那么大家应该自己去官网找正确的url。</font><font class="jammer" style="word-wrap: break-word; font-size: 10px; color: rgb(255, 255, 255); font-family: Tahoma, "Microsoft Yahei", Simsun;">7 ]2 \& C) B! c9 ]# v1 d</font><br style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><font size="5" style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><font class="jammer" style="word-wrap: break-word; font-size: 10px; color: rgb(255, 255, 255);">7 W: E! Z) p. X: O% ~2 Z) L6 ~</font><br style="word-wrap: break-word;"></font><font class="jammer" style="word-wrap: break-word; font-size: 10px; color: rgb(255, 255, 255); font-family: Tahoma, "Microsoft Yahei", Simsun;">8 S% D, ^9 _9 f. vV, K0 G3 v</font><br style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><font size="5" style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;">等待下载完毕,输入 ll 查看文件,如下所示:</font><br style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><ignore_js_op style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><img id="aimg_1418" aid="1418" src="http://bbs.qdclab.com/data/attachment/forum/201511/20/185237xvqnnqmvc7ew7cc8.jpg" zoomfile="data/attachment/forum/201511/20/185237xvqnnqmvc7ew7cc8.jpg" file="data/attachment/forum/201511/20/185237xvqnnqmvc7ew7cc8.jpg" class="zoom" width="600" inpost="1" initialized="true" style="word-wrap: break-word; cursor: pointer;">&nbsp;</ignore_js_op><span style="color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"></span><font class="jammer" style="word-wrap: break-word; font-size: 10px; color: rgb(255, 255, 255); font-family: Tahoma, "Microsoft Yahei", Simsun;"> K+ g8 c3 E0 s* C7 d- o6 M</font><br style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><font class="jammer" style="word-wrap: break-word; font-size: 10px; color: rgb(255, 255, 255); font-family: Tahoma, "Microsoft Yahei", Simsun;">5 d6 T4 x" z/ k&nbsp;&nbsp;j# A</font><br style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><font size="5" style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;">看到上图中有 apache-tomcat-8.0.28.tar.gz ,这个就是我们刚才下载的tomcat8压缩包文件。</font><br style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><font size="5" style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><br style="word-wrap: break-word;"></font><font class="jammer" style="word-wrap: break-word; font-size: 10px; color: rgb(255, 255, 255); font-family: Tahoma, "Microsoft Yahei", Simsun;">1 Z1 m% ~, n' Q" t* m+ k</font><br style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><font size="5" style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;">4、接下来,输入 tar -zxvf apache-tomcat-8.0.28.tar.gz&nbsp;&nbsp;将tomcat8的压缩文件进行解压,解压后,输入 ll 查看 文件情况如下:</font><font class="jammer" style="word-wrap: break-word; font-size: 10px; color: rgb(255, 255, 255); font-family: Tahoma, "Microsoft Yahei", Simsun;">&nbsp;&nbsp;u3 c8 [- x, m% N</font><br style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><ignore_js_op style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><img id="aimg_1420" aid="1420" src="http://bbs.qdclab.com/data/attachment/forum/201511/20/190920nu9urk44um014k4b.jpg" zoomfile="data/attachment/forum/201511/20/190920nu9urk44um014k4b.jpg" file="data/attachment/forum/201511/20/190920nu9urk44um014k4b.jpg" class="zoom" width="600" inpost="1" initialized="true" style="word-wrap: break-word; cursor: pointer;">&nbsp;</ignore_js_op><span style="color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"></span><br style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><font size="5" style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;">看上图,蓝色的那个路径就是解压出来的。</font><br style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><font size="5" style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><font class="jammer" style="word-wrap: break-word; font-size: 10px; color: rgb(255, 255, 255);">2 G3 S0 c) X$ R( B/ S' ^</font><br style="word-wrap: break-word;"></font><br style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><font size="5" style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;">5、解压出来的tomcat8名字太长了,给他给一下,输入 mv apache-tomcat-8.0.28 tomcat8 ,将其改为tomcat8,然后输入ll 查看一下如下图所示:</font><br style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><ignore_js_op style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><img id="aimg_1421" aid="1421" src="http://bbs.qdclab.com/data/attachment/forum/201511/20/191107bii5xififxcusxzn.jpg" zoomfile="data/attachment/forum/201511/20/191107bii5xififxcusxzn.jpg" file="data/attachment/forum/201511/20/191107bii5xififxcusxzn.jpg" class="zoom" width="600" inpost="1" style="word-wrap: break-word; cursor: pointer;">&nbsp;</ignore_js_op><span style="color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"></span><font class="jammer" style="word-wrap: break-word; font-size: 10px; color: rgb(255, 255, 255); font-family: Tahoma, "Microsoft Yahei", Simsun;">! M# p0 @) {1 ~</font><br style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><font size="5" style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;">看上图,蓝色的那个已经修改成功。</font><font class="jammer" style="word-wrap: break-word; font-size: 10px; color: rgb(255, 255, 255); font-family: Tahoma, "Microsoft Yahei", Simsun;">&nbsp;&nbsp;d3 }" f: P! _1 H" E! a3 M( W5 E</font><br style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><font size="5" style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><font class="jammer" style="word-wrap: break-word; font-size: 10px; color: rgb(255, 255, 255);">- H/ \79 b’ _6 A4 N! h
$ c& k1 p% R( e
6、输入 cd / 回到服务器根目录,输入 mv /web/eoair/download/tomcat8  /web/eoair 将tomcat8转移到eoair目录下。
输入 cd /web/eoair 进入eoair目录,然后输入 ll 查看文件如下图所示:: f8 d0 _8 R” t$ O+ {” M: H
Linux服务器下安装Tomcat8服务器详细教程 
从上图中可以看出,在eoair目录下已经有了tomcat8,这说明转移成功。# W( N* D  K4 ^

7 E4 R; N/ B: F
7、download目录已经没有用了,那么将其删除,输入 rm -rf /web/eoair/download 接可以删除download目录及其内部的文件了。
6 l$ n! A% O7 U
* G: {1 C6 P1 d
截至到这,tomcat8已经算是安装好了,可是还没结束,接下来需要为tomcat8配置环境变量:
1、输入vim /etc/profile 打开profile文件,按下键盘上的i键进入编辑模式,在profile文件内容的最下边,添加 export CATALINA_HOME=/web/eoair/tomcat8 如下图所示:
Linux服务器下安装Tomcat8服务器详细教程 
CATALINA_HOME的值是tomcat8的目录,别写错了。# W  [8 V% S& ]# _’ W
输入完毕后,按一下键盘上的Esc键,然后按住shift键同时按:键,然后输入wq并回车,就可以保存并退出profile文件。1 m% i; X2 [8 ( B. y0 y
2、输入 source /etc/profile  可以让修改过的profile文件立即生效。( C’ t, V” n& n$ K3 N
3、接下来就可以启动tomcat服务器了。
输入 cd /web/eoair/tomcat8/bin 进入tomcat服务器的bin目录下,然后输入ll 查看文件,我们可以找到一个startup.sh的文件,这个文件就是tomcat的启动文件,如下图所示:
Linux服务器下安装Tomcat8服务器详细教程 / m/ w8 B% e& _
( M- u’ _( ' W) U</font><br style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><font size="5" style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;">输入 ./startup.sh 并回车,可以看到如下界面:</font><br style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><ignore_js_op style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><img id="aimg_1425" aid="1425" src="http://bbs.qdclab.com/data/attachment/forum/201511/20/194040gbotlv5bnhnjr1nd.jpg" zoomfile="data/attachment/forum/201511/20/194040gbotlv5bnhnjr1nd.jpg" file="data/attachment/forum/201511/20/194040gbotlv5bnhnjr1nd.jpg" class="zoom" width="600" inpost="1" initialized="true" style="word-wrap: break-word; cursor: pointer;">&nbsp;</ignore_js_op><span style="color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"></span><font class="jammer" style="word-wrap: break-word; font-size: 10px; color: rgb(255, 255, 255); font-family: Tahoma, "Microsoft Yahei", Simsun;">+ v- u}&nbsp;&nbsp;N7 H. b& i. Q</font><br style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><font size="5" style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;">看到上面界面,说明Tomcat启动成功。</font><br style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><font size="5" style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><br style="word-wrap: break-word;"></font><font class="jammer" style="word-wrap: break-word; font-size: 10px; color: rgb(255, 255, 255); font-family: Tahoma, "Microsoft Yahei", Simsun;">. @7 ~- b O/ l</font><br style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;"><font size="5" style="word-wrap: break-word; color: rgb(68, 68, 68); font-family: Tahoma, "Microsoft Yahei", Simsun;">4、虽然Tomcat启动成功,但是不能确定配置没问题,接下来,验证一下。</font><font class="jammer" style="word-wrap: break-word; font-size: 10px; color: rgb(255, 255, 255); font-family: Tahoma, "Microsoft Yahei", Simsun;">/ ]9  \7 S6 C2 R& N
打开你的浏览器,输入你的服务器IP地址或域名,由于Tomcat服务器默认占用8080端口,因此浏览器地址栏的输入格式是:IP:8080 或 你的域名:8080 ,由于我已经为服务器绑定域名为http://www.58check.com,因此我在浏览器地址栏输入 http://www.58check.com:8080 然后就看到了Tomcat的默认主页如下图所示,这就说明一切Ok,Tomcat服务器已经可以使用了:  r( X” [: W, G; G” K& B
Linux服务器下安装Tomcat8服务器详细教程 0 U6 q) W2 Y6 P7 L4 W. ?/ l

Linux服务器下安装Tomcat8服务器详细教程


喜欢 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址