tomcat部署

tomcat部署,第1张

tomcat部署 tomcat部署

安装jdk开发环境

[root@server2 ~]# yum -y install java-11-openjdk*

下载tomcat

[root@server2 ~]# wget https://archive.apache.org/dist/tomcat/tomcat-10/v10.0.12/bin/apache-tomcat-10.0.12.tar.gz

解压

[root@server2 ~]# tar xf apache-tomcat-10.0.12.tar.gz  -C /usr/local/
[root@server2 ~]# 
[root@server2 ~]# cd  /usr/local/
[root@server2 local]# ls
apache-tomcat-10.0.12  games    lib64    share
bin                    include  libexec  src
etc                    lib      sbin
[root@server2 local]# mv  apache-tomcat-10.0.12/ tomcat
[root@server2 local]# ls
bin  games    lib    libexec  share  tomcat
etc  include  lib64  sbin     src
[root@server2 local]# 

编写一个简单的网页

[root@server2 ~]# cat index.jsp


        test page


        <%
            out.println("Hellow World");
        %>



开启服务

[root@server2 tomcat]# /usr/local/tomcat/bin/catalina.sh start
Using CATALINA_base:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:   
Tomcat started.
[root@server2 tomcat]# ss -antl
State   Recv-Q  Send-Q          Local Address:Port                    Peer Address:Port                 
LISTEN  0       128                   0.0.0.0:22                           0.0.0.0:*                    
LISTEN  0       100                         *:8080                               *:*                    
LISTEN  0       128                         *:80                                 *:*                    
LISTEN  0       128                      [::]:22                              [::]:*                    
LISTEN  0       1          [::ffff:127.0.0.1]:8005                               *:*                    
[root@server2 tomcat]# 

访问网页

移动网页

[root@server2 tomcat]# cd  webapps/
[root@server2 webapps]# ls
ROOT  docs  examples  host-manager  manager
[root@server2 webapps]# mv  ROOT/ /opt/
[root@server2 webapps]# mkdir ROOT
[root@server2 webapps]# cd
[root@server2 ~]# ls
YYDS                          etc
anaconda-ks.cfg               index.jsp
apache-tomcat-10.0.12.tar.gz  yyds
[root@server2 ~]# mv  index.jsp /usr/local/tomcat/webapps/ROOT/
[root@server2 ~]# 

访问网页

配置文件

[root@server2 ~]# cd  /usr/local/tomcat/
[root@server2 tomcat]# ls
BUILDING.txt     README.md      conf  webapps
CONTRIBUTING.md  RELEASE-NOTES  lib   work
LICENSE          RUNNING.txt    logs
NOTICE           bin            temp
[root@server2 tomcat]# pwd
/usr/local/tomcat

[root@server2 webapps]# mkdir test
[root@server2 webapps]# ls
ROOT  docs  examples  host-manager  manager  test
[root@server2 webapps]# mv ROOT/insdex.jps  test/

设置用户和密码

[root@server2 conf]# vim tomcat-users.xml
[root@server2 conf]# pwd
/usr/local/tomcat/conf

.....


.....

设置IP

[root@server2 manager]# pwd
/usr/local/tomcat/webapps/manager
[root@server2 manager]# vim  meta-INF/context.xml 
........

  
     #添加IP地址
  

.........

关闭服务

[root@server2 ~]# /usr/local/tomcat/bin/shutdown.sh 
Using CATALINA_base:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:   
NOTE: Picked up JDK_JAVA_OPTIONS:  --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
[root@server2 ~]# ss -antl
State    Recv-Q   Send-Q       Local Address:Port                     Peer Address:Port                 
LISTEN   0        128                0.0.0.0:22                            0.0.0.0:*                    
LISTEN   0        128                      *:80                                  *:*                    
LISTEN   0        128                   [::]:22                               [::]:*                    
[root@server2 ~]# ps -ef | grep  tomcat
root      154340   26434  0 22:00 pts/2    00:00:00 grep --color=auto tomcat

启动服务

[root@server2 ~]# /usr/local/tomcat/bin/catalina.sh start
Using CATALINA_base:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:   
Tomcat started.
[root@server2 ~]# 
[root@server2 ~]# 
[root@server2 ~]# ss -antl
State   Recv-Q  Send-Q          Local Address:Port                    Peer Address:Port                 
LISTEN  0       128                   0.0.0.0:22                           0.0.0.0:*                    
LISTEN  0       100                         *:8080                               *:*                    
LISTEN  0       128                         *:80                                 *:*                    
LISTEN  0       128                      [::]:22                              [::]:*                    
LISTEN  0       1          [::ffff:127.0.0.1]:8005                               *:*                    
[root@server2 ~]# 

访问网页



控制服务


访问test

开启


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/3990508.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-10-21
下一篇 2022-10-21

发表评论

登录后才能评论

评论列表(0条)

保存