Ubuntu16.04 Installing the JDK, download version 64 of Linux
You need to download the tar.gz version of the JDK,TOMCAT installation package
Http://pan.baidu.com/s/1mi4WVhA
To install the JDK:
[Email protected]:~$ sudo mkdir/Java[sudo] Hongdada password: [email protected]:~$ CD/DOWNLOADSBASH:CD:/Downloads: No file or directory [email protected]:~$ CD downloads/[email protected]:~/downloads$ sudo mv jdk-8u121-linux-x64.tar.gz/Java[email protected]:~/downloads$ sudo tar-zxvf jdk-8u121-linux-X64.tar.gztar (Child): JDK-8u121-linux-x64.tar.gz: Cannot open: There is no file or directory tar (child): Error was not recoverable:exiting Nowtar:child returned status2Tar:error is not recoverable:exiting now[email protected]:~/downloads$ CD java/Bash:cd:java/: No file or directory [email protected]:~/downloads$ CD ~[email protected]:~$ CD java/Bash:cd:java/: No file or directory [email protected]:~$ CD/Java[email protected]:/java$ sudo tar-zxvf jdk-8u121-linux-X64.tar.gzjdk1.8.0_121/Jdk1.8.0_121/thirdpartylicensereadme-Javafx.txtjdk1.8.0_121/Thirdpartylicensereadme.txt...............jdk1.8.0_121/man/ja_jp. Utf-8/man1/jstat.1[email protected]:/java$ sudo gedit/etc/Environment//Modify the content in the/etc/environment[email protected]:~$ sudo gedit/etc/Environment[sudo] Hongdada Password: (gedit:3856): ibus-warning * *: The owner Of/home/hongdada/.config/ibus/bus is not root!(gedit:3856): gtk-warning * *: Calling Inhibit failed:GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown:The name Org.gnome.SessionManager was wasn't provided by any. Service Files* * (gedit:3856): WARNING *: Set document metadata failed: Setting properties not supported metadata::gedit-spell-enabled* * (gedit:3856): WARNING *: Set document metadata failed: Setting properties not supported metadata::gedit-encoding* * (gedit:3856): WARNING *: Set document metadata failed: Setting properties not supported metadata::gedit-spell-enabled* * (gedit:3856): WARNING *: Set document metadata failed: Setting properties not supported metadata::gedit-encoding* * (gedit:3856): WARNING *: Set document metadata failed: Setting properties not supported metadata::gedit-spell-enabled* * (gedit:3856): WARNING *: Set document metadata failed: Setting properties not supported metadata::gedit-encoding* * (gedit:3856): WARNING *: Set document metadata failed: Setting properties not supported metadata::gedit-Position[email protected]:~$ source/etc/Environment[email protected]:~$ Java-Versionjava version"1.8.0_121"Java (TM) SE Runtime Environment (build1.8.0_121-B13) Java HotSpot (TM)64-bit Server VM (build 25.121-b13, Mixed mode)
/etc/environment in the document was amended to read
Path= "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games: $JAVA _home/bin" export CLASSPATH=.: $JAVA _home/lib: $JAVA _home/jre/libexport java_home=/java/jdk1.8.0_121
Modify environment is to modify the environment variables of the system, but also to modify the login user's environment variables, that is, modify the/etc/profile file
[Email protected]:~$ sudo gedit/etc/profile
/etc/profile modified to:
#/etc/profile:system-wide. profile file forThe Bourne Shell (SH (1) # and Bourne compatible shells (Bash (1), Ksh (1), Ash (1), ...).if["$PS 1" ]; Thenif["$BASH"] && ["$BASH"! = "/bin/sh" ]; Then # The file BASH.BASHRC already sets thedefaultPS1. # PS1= ' \h:\w\$ 'if[-f/etc/BASH.BASHRC]; Then. /etc/bash.bashrc fiElse if["' Id-u '"-eq 0 ]; Then PS1= ' # 'ElsePS1= ' $ 'fi Fifiif[-d/etc/PROFILE.D]; Then forI IN/ETC/PROFILE.D/*. Sh; do if [-R $i]; $i fi done unset ifi#set java environmentexport java_home=/java/jdk1.8.0_121 Export jre_home= $JAVA _home/jreexport classpath=.: $JAVA _home/lib: $JRE _home/lib: $CLASSPATHexport path= $JAVA _home/ Bin: $JRE _home/bin: $PATH
Use commands to make environment variables effective immediately
Source/etc/profile
Restart the computer, can enter the system normally, and the java-version command is valid
Install Tomcat9:
Create a folder under the Java folder Tomcat, migrate the apache-tomcat-9.0.0.m17.tar.gz file in downloads to the Tomcat folder, unzip
Modify the/java/tomcat/apache-tomcat-9.0.0.m17/bin/startup.sh file
Add at the bottom of the file
#set java environmentexport java_home=/java/jdk1.8. 0_121export jre_home= $JAVA _home/jreexport CLASSPATH=.: $JAVA _home/lib: $JRE _home/lib: $CLASSPATHexport PATH= $JAVA _home/bin: $JRE _home/bin:$ Path#tomcatexport tomcat_home=/java/tomcat/apache-tomcat-9.0.0.m17
Add the startup.sh file after
#!/bin/sh# Licensed to the Apache software Foundation (ASF) under one or more# contributor license agreements. See the NOTICE file distributed with# ThisWork foradditional information regarding copyright ownership.# the ASF licenses ThisFile to under the Apache License, Version 2.0# ( the"License"); If you don't use Thisfile except in compliance with# the License. Obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0# # unless required by applicable law or agreed to writing, software# distributed under the License is distributed O N an"As is"basis,# without warranties or CONDITIONS of any KIND, either express or implied.# see the License forThe specific language governing permissions and# limitations under the license.#-----------------------------------------------------------------------------# Start Script forThe CATALINA server#-----------------------------------------------------------------------------# Better OS/400 Detection:see Bugzilla 31132os400=false Case"' Uname '"inOS400*) os400=true;; Esac# Resolve Links-$May be a SOFTLINKPRG= "$" while[-H "$PRG"]; Dols= ' Ls-ld ' $PRG "' link= ' expr ' $ls ': ' .*-> \ (. *\) $ '` ifExpr "$link": '/.* ' >/dev/NULL; then PRG= "$link"ElsePRG= ' dirname ' $PRG '/' $link 'Fidoneprgdir= ' dirname ' $PRG "' Executable=catalina.sh# Check that target executable existsif$os, then #-X would only work on the os400ifThe files are: #1. Owned by the user #2. Owned by the PRIMARY group of the user # ThisWon't workifThe user belongs in secondary groups evalElse if[!-X "$PRGDIR"/"$EXECUTABLE" ]; Then Echo"Cannot find $PRGDIR/$EXECUTABLE"Echo"The file is absent or does not has execute permission"Echo"This file was needed to run"Exit1fifiexec"$PRGDIR"/"$EXECUTABLE" start "[email protected]"#set java environmentexport java_home=/java/jdk1.8. 0_121export Jre_home= $JAVA _home/Jreexport CLASSPATH=.: $JAVA _home/lib: $JRE _home/Lib: $CLASSPATHexport PATH= $JAVA _home/bin: $JRE _home/bin: $PATH #tomcatexport tomcat_home=/java/tomcat/apache-tomcat-9.0.0.m17
View Code
Start Tomcat
[Email protected]:~$ CD/Java[email protected]:/java$ CD Tomcat[email protected]:/java/tomcat$ CD apache-tomcat-9.0.0. M17[email protected]:/java/tomcat/apache-tomcat-9.0.0. m17$ CD Binbash:cd:bin: Insufficient permissions [email protected]:/java/tomcat/apache-tomcat-9.0.0. m17$ sudo cd binsudo:cd: Command not found [email protected]:/java/tomcat/apache-tomcat-9.0.0. m17$ sudo binsudo:bin: command not found [email protected]:/java/tomcat/apache-tomcat-9.0.0.m17$ sudo./bin/startup.shusing catalina_base:/java/tomcat/apache-tomcat-9.0.0. M17using Catalina_home:/java/tomcat/apache-tomcat-9.0.0. M17using Catalina_tmpdir:/java/tomcat/apache-tomcat-9.0.0.m17/tempusing jre_home:/java/jdk1.8. 0_121using CLASSPATH:/java/tomcat/apache-tomcat-9.0.0.m17/bin/bootstrap.jar:/java/tomcat/apache-tomcat-9.0.0.m17/bin/tomcat-Juli.jartomcat started.
The IP address of the virtual machine is 192.168.1.202
View Tomcat
To automatically start Tomcat at boot time
Modify the/etc/rc.local file
#!/bin/sh-e## rc.local## This script was executed at the end of all multiuser runlevel.# make sure that the script would"Exit 0"On success or any other# value on error.## in order to enable or disable Thisscript just change the execution# bits.## bydefault Thisscript does nothing. #set java environmentexport java_home=/java/jdk1.8. 0_121export Jre_home= $JAVA _home/Jreexport CLASSPATH=.: $JAVA _home/lib: $JRE _home/Lib: $CLASSPATHexport PATH= $JAVA _home/bin: $JRE _home/bin: $PATH #tomcatexport tomcat_home=/java/tomcat/apache-tomcat-9.0.0. M17#configuration/java/tomcat/apache-tomcat-9.0.0.m17/bin/startup.sh
Especially underneath the configuration, for self-priming.
Http://www.linuxidc.com/Linux/2017-02/140908.htm
Http://www.linuxdiyf.com/linux/27852.html
Ubuntu16.04 Installing JDK Tomcat