码迷,mamicode.com
首页 > 其他好文 > 详细

Deepin 安装 tomcat

时间:2020-07-16 00:25:35      阅读:133      评论:0      收藏:0      [点我收藏+]

标签:profile   code   依赖   can   jsp   follow   for   min   servlet   

Deepin 安装 tomcat9

一、安装

sudo apt install tomcat8 tomcat8-user tomcat8-admin tomcat8-docs tomcat8-examples

二、操作

sudo systemctl start tomcat8
# 开启
sudo systemctl stop tomcat8
# 关闭
sudo systemctl restart tomcat8
# 重启

或者

	$CATALINA_HOME/bin/startup.sh
	# 开启
	 $CATALINA_HOME/bin/shutdown.sh
	 # 关闭

三、查看

** 打开浏览器输入localhost:8080 **

It works !
If you‘re seeing this page via a web browser, it means you‘ve setup Tomcat successfully. Congratulations!

This is the default Tomcat home page. It can be found on the local filesystem at: /var/lib/tomcat8/webapps/ROOT/index.html

Tomcat8 veterans might be pleased to learn that this system instance of Tomcat is installed with CATALINA_HOME in /usr/share/tomcat8 and CATALINA_BASE in /var/lib/tomcat8, following the rules from /usr/share/doc/tomcat8-common/RUNNING.txt.gz.

You might consider installing the following packages, if you haven‘t already done so:

tomcat8-docs: This package installs a web application that allows to browse the Tomcat 8 documentation locally. Once installed, you can access it by clicking here.

tomcat8-examples: This package installs a web application that allows to access the Tomcat 8 Servlet and JSP examples. Once installed, you can access it by clicking here.

tomcat8-admin: This package installs two web applications that can help managing this Tomcat instance. Once installed, you can access the manager webapp and the host-manager webapp.

NOTE: For security reasons, using the manager webapp is restricted to users with role "manager-gui". The host-manager webapp is restricted to users with role "admin-gui". Users are defined in /etc/tomcat8/tomcat-users.xml.

成功

四、配置环境变量

  1. 在/etc/environment文件中写入JAVA_HOME="JDK主目录的绝对路径"

设置 java环境变量

  1. 编辑 profile (全局) 配置文件
    sudo vim /etc/profile
    
  2. 添加 CATALINA_HOME 和 CATALINA_BASE 到文件末尾
    # tomcat 全局变量
    CATALINA_HOME=/usr/share/tomcat8
    CATALINA_BASE=/var/lib/tomcat8	
    
  3. 运行 profile 文件
     source /etc/profile
    
  4. 输出 CATALINA_HOME 和 CATALINA_BASE 测试
    yang@yang:~$ echo $CATALINA_HOME
    

/usr/share/tomcat8
yang@yang:~$ echo $CATALINA_BASE
/var/lib/tomcat8
```

四、文件

  • /var/lib/tomcat8/webapps/ROOT/index.html 项目位置
  • /etc/tomcat8/tomcat-users.xml 用户权限设置
  • /usr/share/doc/tomcat8-common/RUNNING.txt 说明文件

五、项目结构

  1. /var/lib/tomcat8 -> CATALINA_BASE
	yang@yang:/var/lib/tomcat8$ pwd
/var/lib/tomcat8
yang@yang:/var/lib/tomcat8$ ls -al
总用量 20
drwxr-xr-x  5 root    root    4096 7月  15 20:22 .
drwxrwxrwx 70 root    root    4096 7月  15 18:53 ..
lrwxrwxrwx  1 root    root      12 8月  25  2018 conf -> /etc/tomcat8 # 配置文件
drwxr-xr-x  2 tomcat8 tomcat8 4096 8月  25  2018 lib # 依赖 jar 包
lrwxrwxrwx  1 root    root      17 8月  25  2018 logs -> ../../log/tomcat8 # 日志
drwxr-xr-x  2 root    root    4096 7月  15 20:22 policy # 政策 
drwxrwxr-x  3 tomcat8 tomcat8 4096 7月  15 18:53 webapps # 存放发布的项目
lrwxrwxrwx  1 root    root      19 8月  25  2018 work -> ../../cache/tomcat8 # 运行时 产生的文件
yang@yang:/var/lib/tomcat8$
  1. /usr/share/tomcat8 -> CATALINA_HOME
	yang@yang:/usr/share/tomcat8$ pwd
/usr/share/tomcat8
yang@yang:/usr/share/tomcat8$ ls -al
总用量 48
drwxrwxrwx   6 root root  4096 7月  15 20:04 .
drwxrwxrwx 281 root root 12288 7月  15 19:03 ..
drwxrwxrwx   2 root root  4096 7月  15 18:51 bin #启动和关闭的sh脚本
-rw-r--r--   1 root root    39 8月  25  2018 defaults.md5sum
-rw-r--r--   1 root root  1911 8月  25  2018 defaults.template
drwxr-xr-x   2 root root  4096 7月  15 18:51 lib # 库
-rw-r--r--   1 root root    53 8月  25  2018 logrotate.md5sum
-rw-r--r--   1 root root   134 8月  25  2018 logrotate.template
drwxr-xr-x   2 yang yang  4096 7月  15 20:04 logs # 自己创建的没用
drwxr-xr-x   4 root root  4096 7月  15 18:53 skel
  1. /etc/tomcat8
	yang@yang:/etc/tomcat8$ pwd
/etc/tomcat8
yang@yang:/etc/tomcat8$ ls -al
总用量 224
drwxr-xr-x   4 root root      4096 7月  15 18:53 .
drwxr-xr-x 140 root root     12288 7月  15 20:24 ..
drwxrwxr-x   3 root tomcat8   4096 7月  15 18:51 Catalina
-rw-r-----   1 root tomcat8   7770 8月  25  2018 catalina.properties
-rw-r-----   1 root tomcat8   1338 7月   5  2016 context.xml # 所有 web 项目的配置信息
-rw-r-----   1 root tomcat8   1149 7月   5  2016 jaspic-providers.xml
-rw-r-----   1 root tomcat8   2686 8月  25  2018 logging.properties
drwxr-xr-x   2 root tomcat8   4096 7月  15 19:03 policy.d
-rw-r-----   1 root tomcat8   7528 8月  25  2018 server.xml # 服务器配置文件
-rw-r-----   1 root tomcat8   2164 7月   5  2016 tomcat-users.xml # 用户配置文件
-rw-r-----   1 root tomcat8 168133 8月  31  2016 web.xml
yang@yang:/etc/tomcat8$

Deepin 安装 tomcat

标签:profile   code   依赖   can   jsp   follow   for   min   servlet   

原文地址:https://www.cnblogs.com/javayanglei/p/13308389.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!