安装tomcat

root@kickseed:~# cd /root/work/soft_dir/root@kickseed:~/work/soft_dir# wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-8/v8.5.20/bin/apache-tomcat-8.5.20.tar.gzroot@kickseed:~/work/soft_dir# lsapache-maven-3.5.0-bin.tar.gz  apache-tomcat-8.5.20.tar.gz  jdk-8u77-linux-x64.tar.gzroot@kickseed:~/work/soft_dir# mkdir -p /root/work/app_dir/tomcatroot@kickseed:~/work/soft_dir# tar xf apache-tomcat-8.5.20.tar.gz -C /root/work/app_dir/tomcatroot@kickseed:~/work/soft_dir# ln -sv /root/work/app_dir/tomcat/apache-tomcat-8.5.20/ /root/work/app_dir/tomcat/current‘/root/work/app_dir/tomcat/current’ -> ‘/root/work/app_dir/tomcat/apache-tomcat-8.5.20/’root@kickseed:~/work/soft_dir# ll /root/work/app_dir/tomcat/total 12drwxr-xr-x 3 root root 4096 Sep  5 20:31 ./drwxr-xr-x 5 root root 4096 Sep  5 20:29 ../drwxr-xr-x 9 root root 4096 Sep  5 20:28 apache-tomcat-8.5.20/lrwxrwxrwx 1 root root   47 Sep  5 20:31 current -> /root/work/app_dir/tomcat/apache-tomcat-8.5.20//root@kickseed:~/work/soft_dir# cd /root/work/app_dir/tomcat/currentroot@kickseed:~/work/app_dir/tomcat/current# pwd/root/work/app_dir/tomcat/currentroot@kickseed:~/work/app_dir/tomcat/current# vim /etc/profile.d/tomcat.shroot@kickseed:~/work/app_dir/tomcat/current# cat /etc/profile.d/tomcat.shexport CATALINA_HOME=/root/work/app_dir/tomcat/currentexport PATH=$CATALINA_HOME/bin:$PATHroot@kickseed:~/work/app_dir/tomcat/current# . /etc/profile.d/tomcat.shroot@kickseed:~/work/app_dir/tomcat/current# catalina.sh versionUsing CATALINA_BASE:   /root/work/app_dir/tomcat/currentUsing CATALINA_HOME:   /root/work/app_dir/tomcat/currentUsing CATALINA_TMPDIR: /root/work/app_dir/tomcat/current/tempUsing JRE_HOME:        /root/work/app_dir/jdk/currentUsing CLASSPATH:       /root/work/app_dir/tomcat/current/bin/bootstrap.jar:/root/work/app_dir/tomcat/current/bin/tomcat-juli.jarServer version: Apache Tomcat/8.5.20Server built:   Aug 2 2017 21:35:49 UTCServer number:  8.5.20.0OS Name:        LinuxOS Version:     4.4.0-31-genericArchitecture:   amd64JVM Version:    1.8.0_77-b03JVM Vendor:     Oracle Corporationroot@kickseed:~/work/app_dir/tomcat/current#

建立应用目录

root@kickseed:~/work/app_dir/tomcat/current# cd /root/work/root@kickseed:~/work# cd app_dir/root@kickseed:~/work/app_dir# lsjdk  maven  tomcatroot@kickseed:~/work/app_dir# mkdir deploy_tomcatroot@kickseed:~/work/app_dir# mkdir learn_approot@kickseed:~/work/app_dir# lsdeploy_tomcat  jdk  learn_app  maven  tomcatroot@kickseed:~/work/app_dir# cd learn_app/

dubbo-interfac目录结构

root@kickseed:~/work/app_dir/learn_app/dubbo-interface# tree.├── pom.xml└── src    └── main        ├── java        │   └── com        │       └── kingdz        │           └── dubbo        │               └── HelloWorld.java        └── resources7 directories, 2 files

root@kickseed:~/work/app_dir/learn_app/dubbo-interface# mvn clean installroot@kickseed:~/work/app_dir/learn_app/dubbo-interface# cd ../root@kickseed:~/work/app_dir/learn_app# lsdubbo-consumer  dubbo-interface  dubbo-providerroot@kickseed:~/work/app_dir/learn_app# cd dubbo-provider/root@kickseed:~/work/app_dir/learn_app/dubbo-provider# tree.├── pom.xml└── src    └── main        ├── java        │   ├── com        │   │   └── kingdz        │   │       └── dubbo        │   │           └── impl        │   │               └── HelloWorldImpl.java        │   └── com.kingdz.dubbo.impl        ├── resources        │   ├── applicationContext.xml        │   └── log4j.properties        └── webapp            ├── index.jsp            └── WEB-INF                └── web.xml11 directories, 6 filesroot@kickseed:~/work/app_dir/learn_app/dubbo-consumer# mvn clean installroot@kickseed:~/work/app_dir/learn_app/dubbo-provider# cd ../dubbo-consumer/root@kickseed:~/work/app_dir/learn_app/dubbo-consumer# tree.├── pom.xml└── src    └── main        ├── java        │   └── com        │       └── kingdz        │           └── dubbo        │               └── controller        │                   └── HelloWorldController.java        ├── resources        │   ├── applicationContext.xml        │   ├── log4j.properties        │   └── spring-mvc.xml        └── webapp            ├── index.jsp            └── WEB-INF                └── web.xml10 directories, 7 filesroot@kickseed:~/work/app_dir/learn_app/dubbo-consumer# mvn clean install

http://www.apache.org/dyn/closer.cgi/zookeeper/  下载地址zookeeperhttp://mirror.bit.edu.cn/apache/zookeeper/http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz

root@kickseed:~# cd /root/work/soft_dir/root@kickseed:~/work/soft_dir# wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gzroot@kickseed:~/work/soft_dir# lsapache-maven-3.5.0-bin.tar.gz  apache-tomcat-8.5.20.tar.gz  jdk-8u77-linux-x64.tar.gz  zookeeper-3.4.6.tar.gzroot@kickseed:~/work/soft_dir# mkdir -p /root/work/app_dir/zookeeperroot@kickseed:~/work/soft_dir# tar xf zookeeper-3.4.6.tar.gz -C /root/work/app_dir/zookeeper/root@kickseed:~/work/soft_dir# ls /root/work/app_dir/zookeeper/zookeeper-3.4.6root@kickseed:~/work/soft_dir# cd /root/work/app_dir/zookeeper/root@kickseed:~/work/app_dir/zookeeper# ln -sv /root/work/app_dir/zookeeper/zookeeper-3.4.6/ /root/work/app_dir/zookeeper/current‘/root/work/app_dir/zookeeper/current’ -> ‘/root/work/app_dir/zookeeper/zookeeper-3.4.6/’root@kickseed:~/work/app_dir/zookeeper# lscurrent  zookeeper-3.4.6root@kickseed:~/work/app_dir/zookeeper# cd currentroot@kickseed:~/work/app_dir/zookeeper/current# cp conf/zoo_sample.cfg conf/zoo.cfgroot@kickseed:~/work/app_dir/zookeeper/current# vim conf/zoo.cfg修改添加下面两行dataDir=/root/work/app_dir/zookeeper/datadataLogDir=/root/work/app_dir/zookeeper/datalogroot@kickseed:~/work/app_dir/zookeeper/current# mkdir -pv /root/work/app_dir/zookeeper/{data,datalog}mkdir: created directory ‘/root/work/app_dir/zookeeper/data’mkdir: created directory ‘/root/work/app_dir/zookeeper/datalog’root@kickseed:~/work/app_dir/zookeeper/current# ss -tnlState       Recv-Q Send-Q                            Local Address:Port                              Peer Address:PortLISTEN      0      128                                           *:22                                           *:*LISTEN      0      50                                            *:3306                                         *:*LISTEN      0      128                                          :::22                                          :::*root@kickseed:~/work/app_dir/zookeeper/current# bin/zkServer.sh startJMX enabled by defaultUsing config: /root/work/app_dir/zookeeper/current/bin/../conf/zoo.cfgStarting zookeeper ... STARTEDroot@kickseed:~/work/app_dir/zookeeper/current# ss -tnlState       Recv-Q Send-Q                            Local Address:Port                              Peer Address:PortLISTEN      0      128                                           *:22                                           *:*LISTEN      0      50                                            *:3306                                         *:*LISTEN      0      128                                          :::22                                          :::*LISTEN      0      50                                           :::44378                                       :::*LISTEN      0      50                                           :::2181

root@kickseed:~/work/app_dir/learn_app# lsdubbo-consumer  dubbo-interface  dubbo-providerroot@kickseed:~/work/app_dir/learn_app# git clone https://github.com/alibaba/dubbo.gitroot@kickseed:~/work/app_dir/learn_app# lsdubbo  dubbo-consumer  dubbo-interface  dubbo-providerroot@kickseed:~/work/app_dir/learn_app# cd dubboroot@kickseed:~/work/app_dir/learn_app/dubbo# lscodestyle    dubbo-cluster  dubbo-container  dubbo-maven     dubbo-remoting  dubbo-test    NOTICEdubbo        dubbo-common   dubbo-demo       dubbo-monitor   dubbo-rpc       hessian-lite  pom.xmldubbo-admin  dubbo-config   dubbo-filter     dubbo-registry  dubbo-simple    LICENSE       README.mdroot@kickseed:~/work/app_dir/learn_app/dubbo# mvn clean install -Dmaven.test.skip=trueroot@kickseed:~/work/app_dir/learn_app/dubbo# cd dubbo-admin/root@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# ls target/classes  dubbo-admin-2.5.4-SNAPSHOT  dubbo-admin-2.5.4-SNAPSHOT.war  generated-sources  maven-archiver  maven-statusroot@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# ls /root/work/app_dir/deploy_tomcat/ jdk/           learn_app/     maven/         tomcat/root@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# ls /root/work/app_dir/deploy_tomcat/root@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# cp -rf /root/work/app_dir/tomcat/apache-tomcat-8.5.20/ /root/work/app_dir/deploy_tomcat/app_nameroot@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# ls /root/work/app_dir/deploy_tomcat/app_name/bin  conf  lib  LICENSE  logs  NOTICE  RELEASE-NOTES  RUNNING.txt  temp  webapps  workroot@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# rm -rf /root/work/app_dir/deploy_tomcat/app_name/bin/*root@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# rm -rf /root/work/app_dir/deploy_tomcat/app_name/libroot@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# ls /root/work/app_dir/deploy_tomcat/app_name/conf  LICENSE  logs  NOTICE  RELEASE-NOTES  RUNNING.txt  temp  webapps  workroot@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# rm -f /root/work/app_dir/deploy_tomcat/app_name/LICENSEroot@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# rm -f /root/work/app_dir/deploy_tomcat/app_name/NOTICEroot@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# rm -f /root/work/app_dir/deploy_tomcat/app_name/RELEASE-NOTESroot@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# rm -f /root/work/app_dir/deploy_tomcat/app_name/RUNNING.txtroot@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# ls /root/work/app_dir/deploy_tomcat/app_name/bin  conf  logs  temp  webapps  workroot@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# cat /root/work/app_dir/deploy_tomcat/app_name/bin/appctl.sh#!/bin/bashexport CATALINA_BASE=$(cd $(dirname $0);cd ../;pwd)echo $CATALINA_BASEcase $1 in    start)        catalina.sh start        ;;    stop)        catalina.sh stop        ;;    restart)        catalina.sh stop        catalina.sh start        ;;    *)        exit 1        ;;esacroot@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# cat target/dubbo-admin-2.5.4-SNAPSHOT/WEB-INF/dubbo.propertiesdubbo.registry.address=zookeeper://127.0.0.1:2181dubbo.admin.root.password=rootdubbo.admin.guest.password=guestroot@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# cp -rf /root/work/app_dir/deploy_tomcat/app_name/ /root/work/app_dir/deploy_tomcat/dubbo-adminroot@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# cp target/dubbo-admin-2.5.4-SNAPSHOT.war /root/work/app_dir/deploy_tomcat/dubbo-admin/webapps/root@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# cd /root/work/app_dir/deploy_tomcat/dubbo-adminroot@kickseed:~/work/app_dir/deploy_tomcat/dubbo-admin# bin/appctl.sh start/root/work/app_dir/deploy_tomcat/dubbo-adminUsing CATALINA_BASE:   /root/work/app_dir/deploy_tomcat/dubbo-adminUsing CATALINA_HOME:   /root/work/app_dir/tomcat/currentUsing CATALINA_TMPDIR: /root/work/app_dir/deploy_tomcat/dubbo-admin/tempUsing JRE_HOME:        /root/work/app_dir/jdk/currentUsing CLASSPATH:       /root/work/app_dir/tomcat/current/bin/bootstrap.jar:/root/work/app_dir/tomcat/current/bin/tomcat-juli.jarTomcat started.root@kickseed:~/work/app_dir/deploy_tomcat/dubbo-admin# ss -tnlState       Recv-Q Send-Q                            Local Address:Port                              Peer Address:PortLISTEN      0      128                                           *:22                                           *:*LISTEN      0      50                                            *:3306                                         *:*LISTEN      0      128                                          :::22                                          :::*LISTEN      0      50                                           :::44378                                       :::*LISTEN      0      50                                           :::2181                                        :::*LISTEN      0      100                                          :::8009                                        :::*LISTEN      0      100                                          :::8080                                        :::*root@kickseed:~/work/app_dir/deploy_tomcat/dubbo-provider# sed -n 's#\(
root@kickseed:~/work/app_dir/deploy_tomcat/dubbo-provider# sed -n 's#\(
root@kickseed:~/work/app_dir/deploy_tomcat/dubbo-provider# sed -n 's#\(
    

http://www.cnblogs.com/yxl10/p/4143884.html