System: Ubuntu 16.04 Dev_desktop
1.Java Installing and configuring environment variables
(1) Download the latest version of jdk:http://www.oracle.com/technetwork/java/javase/downloads/index.html from the official Java website
Download JDK Compression Pack jdk-8u144-linux-x64.tar.gz
(2) Unzip the package and copy it to the/usr/lib directory
TAR-ZXVF jdk-8u144-linux-x64. tarcp-r./jdk1. 8.0_144//usr/lib
(3) Edit profile configuration environment variables
Using Vim to open/etc/profile
sudo vim/etc/profile
Add the following code at the end of the file, configure environment variables, save exit
Export JAVA_HOME=/USR/LIB/JDK1. 8. 0_144
Export jre_home=${java_home}/JRE
Export Classpath=.:${java_home}/lib:${jre_home}/lib
Export Path=${java_home}/bin: $PATH
(4) Make the configuration file effective
Source/etc/profile
(5) Restart the computer, enter java-version in the terminal, when the version information appears, the installation is successful.
Java Version "1.8.0_144"
Java (TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot (TM) 64-bit Server VM (build 25.144-b01, Mixed mode)
2. Installing Tomact
(1) Download the latest version of Tomcat http://tomcat.apache.org/download-80.cgi from the official Tomcat website
Compress Package tar.gz
(2) Unzip the tarball and copy it to the/opt folder
tar -zxvf apache-tomcat-8.5. . Tar . GZ sudo CP -R./apache-tomcat-8.5. /opt/
(3) Configure Tomcat to enter apache-tomcat-8.5. folders, edit./bin/startup.sh files with vim
cd/opt/apache-tomcat-8.5. /sudo vim./bin/startup. SH
Insert the following code before the last line of the file:
Java_home=/usr/lib/jdk1. 8 . 0_144jre_home= $JAVA _home/jrepath= $PATH: $JAVA _home/Bin: $JRE _homeclasspath=.: $JRE _ Home/lib/rt.jar: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jartomcat_home=/opt/apache-tomcat- 8.5. -
Where Java_home is the path when Java was just installed.
Note that the change code needs to be inserted before the Exec "$PRGDIR"/"$EXECUTABLE" start "[email protected]" line.
(4) Start and close Tomcat.
sudo ./bin/startup. SH sudo ./bin/shutdown. SH
(5) After successful startup, enter localhost:8080 in the browser and the Tomcat homepage will be installed successfully. When you deploy a project, simply copy the package to/opt/apache-tomcat-8.5.16/webapps
Linux Server Configuration Install Java,tomcat server