1. 下载
首先访问Apache Tomcat 9下载页面,然后在提供的下载列表中点击下载自己系统对应的版本,我下载的”tar.gz”文件, 另外你需要将相应的校验文件下载下来,这里我下载md5校验文件.
2. 安装
进入到文件下载的目录,
2.1 对下载的文件完整性
使用命令: “md5sum -c apache-tomcat-9.0.0.M9.tar.gz.md5.txt ”
jiangjian@jiangjian:~/Downloads$ ls
apache-tomcat-9.0.0.M9.tar.gz apache-tomcat-9.0.0.M9.tar.gz.md5.txt
jiangjian@jiangjian:~/Downloads$ md5sum -c apache-tomcat-9.0.0.M9.tar.gz.md5.txt
apache-tomcat-9.0.0.M9.tar.gz: OK
2.2 将下载后的文件解压到安装目录.
使用命令: “tar -xvzf apache-tomcat-9.0.0.M9.tar.gz -C target_dir”
以下是我本地解压的结果
jiangjian@jiangjian:~/Downloads$ ls
apache-tomcat-9.0.0.M9.tar.gz apache-tomcat-9.0.0.M9.tar.gz.md5.txt
jiangjian@jiangjian:~/Downloads$ tar -xvzf apache-tomcat-9.0.0.M9.tar.gz -C ~/software/
apache-tomcat-9.0.0.M9/conf/
apache-tomcat-9.0.0.M9/conf/catalina.policy
apache-tomcat-9.0.0.M9/conf/catalina.properties
apache-tomcat-9.0.0.M9/conf/context.xml
...
3 运行
3.1 环境确认
在运行之前请确保你安装了jdk1.8及以上版本;
jiangjian@jiangjian:~/software/apache-tomcat-9.0.0.M9$ java -version
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
3.2 运行
进入到安装目录,然后执行启动脚本(catalina.sh)
jiangjian@jiangjian:~/software/apache-tomcat-9.0.0.M9$ pwd
/home/jiangjian/software/apache-tomcat-9.0.0.M9
jiangjian@jiangjian:~/software/apache-tomcat-9.0.0.M9$ ls
bin conf lib LICENSE logs NOTICE RELEASE-NOTES RUNNING.txt temp webapps work
jiangjian@jiangjian:~/software/apache-tomcat-9.0.0.M9$ cd bin/
jiangjian@jiangjian:~/software/apache-tomcat-9.0.0.M9/bin$ ls
bootstrap.jar commons-daemon.jar daemon.sh setclasspath.sh startup.sh tool-wrapper.sh
catalina.bat commons-daemon-native.tar.gz digest.bat shutdown.bat tomcat-juli.jar version.bat
catalina.sh configtest.bat digest.sh shutdown.sh tomcat-native.tar.gz version.sh
catalina-tasks.xml configtest.sh setclasspath.bat startup.bat tool-wrapper.bat
jiangjian@jiangjian:~/software/apache-tomcat-9.0.0.M9/bin$ ./catalina.sh run
Using CATALINA_BASE: /home/jiangjian/software/apache-tomcat-9.0.0.M9
Using CATALINA_HOME: /home/jiangjian/software/apache-tomcat-9.0.0.M9
Using CATALINA_TMPDIR: /home/jiangjian/software/apache-tomcat-9.0.0.M9/temp
Using JRE_HOME: /home/jiangjian/software/jdk1.8.0_91
...
在启动之后,登陆浏览器,在地址栏输入: localhost:8080,你将会看到:
至此,你的tomcat 9就安装完成了.