Install tomcat in Ubuntu

      I'm sorry I have to blog in English,for I haven't install Chinese input method in Ubuntu.

      Using Linux is a little different from Windows. For one thing, you cannot copy or move files and directories at will.So it does bothered me a lot at the beginning.

    Here I want to show you how to install apache-tomcat in Ubuntu and run a hello world web application.


    Before starting, you don't have to worry about JDK, for Ubuntu has already installed it (Open JDK1.6.0_24 Ubuntu-12.0.4)


    Step1: Download apache-tomcat from official website: http://mirror.bjtu.edu.cn/apache/tomcat/tomcat-7/v7.0.34/bin/apache-tomcat-7.0.34.tar.gz


    Step2: Extract it to your favorite path.


    Step3: Start tomcat server in Shell.

                1: Open Terminal ( Ctrl+Alt+T)

                2: Locate to apache tomcat bin directory

                3: start server by inputting ./startup.sh        (startup.bat for windows)


    if you see this prints out in your terminal,then you have successfully start tomcat server.

root@ubuntu:/home/tsb/Desktop/apache-tomcat-7.0.34/bin# ./startup.sh
Using CATALINA_BASE:   /home/tsb/Desktop/apache-tomcat-7.0.34
Using CATALINA_HOME:   /home/tsb/Desktop/apache-tomcat-7.0.34
Using CATALINA_TMPDIR: /home/tsb/Desktop/apache-tomcat-7.0.34/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /home/tsb/Desktop/apache-tomcat-7.0.34/bin/bootstrap.jar:/home/tsb/Desktop/apache-tomcat-7.0.34/bin/tomcat-juli.jar

    Step4: Test http://localhost:8080 in FireFox browser:



    If you see this familiar icon cat, then congratulation to you.

    Last let's write a sample web application which we call it Hello World.


    First locate to webapps directory, and copy ROOT directory and paste it in the same directory , rename it to hello. In hello directory, we just edit the index.jsp file as follow:

   


<html>
	<body>
		Hello World! <%=new java.util.Date().toGMTString() %>
	</body>
</html>

    To test it in your web browser, simply write http://localhost:8080/hello/index.jsp.


   

    Finally,  if you want to stop the server.Just write ./shutdown.sh in you terminal.

root@ubuntu:/home/tsb/Desktop/apache-tomcat-7.0.34/bin# ./shutdown.sh
Using CATALINA_BASE:   /home/tsb/Desktop/apache-tomcat-7.0.34
Using CATALINA_HOME:   /home/tsb/Desktop/apache-tomcat-7.0.34
Using CATALINA_TMPDIR: /home/tsb/Desktop/apache-tomcat-7.0.34/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /home/tsb/Desktop/apache-tomcat-7.0.34/bin/bootstrap.jar:/home/tsb/Desktop/apache-tomcat-7.0.34/bin/tomcat-juli.jar

     And I'm just a elementary programmer who loves java and web programming. Thanks for  your click.

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值