Tomcat installation steps

View the environment variables
whereis java
Which java (java execution path)
echo $ JAVA_HOME
echo $ the PATH
Second, the installation
choose to install java location, such as up / down usr / directory, create a new folder java (mkdir java)

#mkdir -p / usr / java
copy downloaded jdk-8u31-linux-x64.tar.gz to the / usr / java

#cd /usr/java

tar -zxvf jdk-8u31-linux-x64.tar.gz

Third, set the variable

vim /etc/profile

Add the following to the final surface:

JAVA

JAVA_HOME=/usr/local/java
CLASSPATH=.:$JAVA_HOME/lib.tools.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASSPATH PATH

The variables to take effect

source /etc/profile

Verify successful

java -version

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)

View Variable

which java // java execution path

/usr/java/jdk1.8.0_31/bin/java

echo $JAVA_HOME

/usr/java/jdk1.8.0_31

echo $PATH

/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

IV. Uninstall jdk
· find jdk installation directory _uninst subdirectory
-execute the command in a shell terminal ./uninstall.sh you can uninstall jdk.

V. Installation tomcat
download tomcat
wget http://mirrors.cnnic.cn/apache/tomcat/tomcat-8/v8.0.36/bin/apache-tomcat-8.0.36.tar.gz

(1) extracting apache-tomcat-8.0.20.tar.gz

tar -zxvf apache-tomcat-8.0.20.tar.gz

(2) Contents apache-tomcat-8.0.20 extracted to the copied / usr / local and rename tomcat8

cp -R apache-tomcat-8.0.20 /usr/local/tomcat8

Note: You need to fill in when we want to modify environment variables / usr / local / tomcat8 is that the directory path
(3)
Add the environment variable tomcat

vi /etc/profile

Was added under Code
#set Environment variable
the JAVA_HOME = / usr / local / Java
the CLASSPATH =:. $ The JAVA_HOME / lib.tools.jar
the PATH the JAVA_HOME = $ / bin: $ the PATH
Export the JAVA_HOME the CLASSPATH the PATH
Export the TOMCAT_HOME = / usr / local / Tomcat
Export CATALINA_HOME = / usr / local / tomcat
modify the application environment variable is configured to take effect

source /etc/profile

(4) into the bin directory, start tomcat

cd /usr/local/tomcat/

cd bin /

#./startup.sh

(5) after modify environment variables restart tomcat successfully started
[root @ oracledb bin] # ./startup.sh
the Using CATALINA_BASE: / usr / local / tomcat8
the Using CATALINA_HOME: / usr / local / tomcat8
the Using CATALINA_TMPDIR: / usr / local / tomcat8 / the TEMP
the Using JRE_HOME: /usr/java/jdk1.8.0_31
the Using the 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) add administrative privileges
by default, Tomcat did not provide an account with administrative privileges, so you need to add an account with such privileges. The role of manager-gui have such authority, but tomcat-users.xml and not set these two roles and the corresponding user in the system user control file, so you need to add this role and user opening the tomcat-users.xml file, add the following:
<rolerolename = "GUI-Manager" />
<UserUsername A = "Manager" password = "Manager" Roles = "GUI-Manager" />
and then restart the Tomcat server, file modification effect.

Guess you like

Origin blog.51cto.com/13870640/2485275