1.下载apache-tomcat7.0.53
2.解压文件到/usr/local/apache-tomcat目录,没有apache-tomcat目录则先新建该目录
3.由于tomcat安装依赖JAVA JDK,查看Linux系统是否配置有java环境
(1)用 java -version 命令查看当前jdk版本信息
java -version
(2)用rpm -qa | grep java 命令查询操作系统自身安装的java
rpm -qa | grep java
由此可见,我的Linux系统中没有安装过JAVA JDK,所以要先下载安装。
4.安装JAVA JDK
推荐一个安装配置博客:https://www.cnblogs.com/liugh/p/6623530.html
5.启动Tomcat
(1)进入tomcat执行目录
cd /usr/local/tomcat/tomcat7/bin
(2)添加JAVA JDK环境变量,编辑setclasspath.sh
sume@ubuntu:/usr/local/apache-tomcat/apache-tomcat-7.0.53/bin$ sudo vim setclasspath.sh
在setclasspath.sh中,一定要在以下两段间添加环境变量,不然tomcat启动失败。
# -----------------------------------------------------------------------------
# Set JAVA_HOME or JRE_HOME if not already set, ensure any provided settings
# are valid and consistent with the selected start-up options and set up the
# endorsed directory.
# -----------------------------------------------------------------------------
#my append
export JAVA_HOME=/usr/local/jdk8/jdk1.8.0_201 export JRE_HOME=/usr/local/jdk8/jdk1.8.0_201/jre
# Make sure prerequisite environment variables are set
(3)查看tomcat的运行状态
ps -ef |grep tomcat
(4)启动tomcat
sudo ./startup.sh
Tomcat的端口号是8080,在保证网络畅通的情况下,在WINDOWS浏览器输入地址,能看到Tomcat网页就是配置成功了
转载于:https://blog.51cto.com/13502993/2346370