标签:base set 方法 下载 安装tomcat whereis rac run 成功
查看环境变量#mkdir -p /usr/java
拷贝下载的jdk-8u31-linux-x64.tar.gz到/usr/java下
#cd /usr/java
三、设置变量
在最后面添加如下内容:
JAVA_HOME=/usr/local/java
CLASSPATH=.:$JAVA_HOME/lib.tools.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASSPATH PATH
使变量生效
验证是否成功
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)
查看变量
/usr/java/jdk1.8.0_31/bin/java
/usr/java/jdk1.8.0_31
/usr/java/jdk1.8.0_31/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
四. 卸载jdk
·找到jdk安装目录的_uninst子目录
·在shell终端执行命令./uninstall.sh即可卸载jdk。
五,安装tomcat
下载tomcat
wget http://mirrors.cnnic.cn/apache/tomcat/tomcat-8/v8.0.36/bin/apache-tomcat-8.0.36.tar.gz
(1)解压apache-tomcat-8.0.20.tar.gz
(2)复制解压后的目录apache-tomcat-8.0.20到/usr/local下并重命名为tomcat8
注意:/usr/local/tomcat8就是后面我们要修改环境变量时需要填写的目录路径
(3)
添加tomcat环境变量
加入下代码
#set environment variable
JAVA_HOME=/usr/local/java
CLASSPATH=.:$JAVA_HOME/lib.tools.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASSPATH PATH
export TOMCAT_HOME=/usr/local/tomcat
export CATALINA_HOME=/usr/local/tomcat
修改应用环境变量,是配置生效
(4)进入bin目录 ,启动tomcat
#./startup.sh
(5)修改环境变量后重新启动tomcat启动成功
[root@oracledb bin]# ./startup.sh
Using CATALINA_BASE: /usr/local/tomcat8
Using CATALINA_HOME: /usr/local/tomcat8
Using CATALINA_TMPDIR: /usr/local/tomcat8/temp
Using JRE_HOME: /usr/java/jdk1.8.0_31
Using CLASSPATH: /usr/local/tomcat8/bin/bootstrap.jar:/usr/local/tomcat8/bin/tomcat-juli.jar
Tomcat started.
(6)关闭tomcat
[root@oracledb bin]# ./shutdown.sh
Using CATALINA_BASE: /usr/local/tomcat8
Using CATALINA_HOME: /usr/local/tomcat8
Using CATALINA_TMPDIR: /usr/local/tomcat8/temp
Using JRE_HOME: /usr/java/jdk1.8.0_31
Using CLASSPATH: /usr/local/tomcat8/bin/bootstrap.jar:/usr/local/tomcat8/bin/tomcat-juli.jar
(7) 查看进程
[root@oracledb bin]# ps -ef | grep tomcat
root 22552 1 99 09:58 pts/0 00:00:05 /usr/java/jdk1.8.0_31/bin/java -Djava.util.logging.config.file=/usr/local/tomcat8/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/local/tomcat8/endorsed -classpath /usr/local/tomcat8/bin/bootstrap.jar:/usr/local/tomcat8/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/tomcat8 -Dcatalina.home=/usr/local/tomcat8 -Djava.io.tmpdir=/usr/local/tomcat8/temp org.apache.catalina.startup.Bootstrap start
root 22581 22284 0 09:58 pts/0 00:00:00 grep tomcat
(8)添加管理权限
默认情况下,Tomcat并没提供具有管理权限的账号,所以需要添加具有这种权限的账号。角色manager-gui具有这种权限,但在系统用户控制文件 tomcat-users.xml中并没有设置这两种角色和对应的用户,所以需要添加这种角色和用户,方法是打开tomcat-users.xml文件, 添加如下内容:
<rolerolename="manager-gui"/>
<userusername="manager" password="manager"roles="manager-gui"/>
然后重启Tomcat服务器,文件修改生效。
标签:base set 方法 下载 安装tomcat whereis rac run 成功
原文地址:https://blog.51cto.com/13870640/2485275