Linux server configuration and installation of Java, Tomcat server, javatomcat

Source: Internet
Author: User

Linux server configuration and installation of Java, Tomcat server, javatomcat

System: Ubuntu 16.04 dev_desktop

1. install and configure environment variables in Java

Download the latest JDK: http://www.oracle.com/technetwork/java/javase/downloads/index.html from Java Official Website

Download jdk package jdk-8u144-linux-x64.tar.gz

(2) decompress the compressed package and copy it to the/usr/lib directory.

    

tar -zxvf jdk-8u144-linux-x64.tar.gz sudo cp -r ./jdk1.8.0_144/ /usr/lib

(3) edit the profile configuration environment variable

Use vim to open/etc/profile

   

sudo vim /etc/profile

   
Add the following code at the end of the file, configure the environment variable, save and 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 take effect

 

source /etc/profile

 

(5) restart the computer and enter java-version in the terminal. When the version information is displayed, 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. Install Tomact

  Download the latest tomcat http://tomcat.apache.org/download-80.cgi from tomcat Official Website

Compressed package tar.gz

(2) decompress the package and copy it to the/opt folder.

 

tar -zxvf apache-tomcat-8.5.16.tar.gzsudo cp -r ./apache-tomcat-8.5.16 /opt/

 

(3) Configure tomcat, go to the apache-tomcat-8.5.16 folder, and use vim to edit the./bin/startup. sh file.

    

cd /opt/apache-tomcat-8.5.16/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.16

JAVA_HOME is the path when java is just installed.

Note that the Code must be inserted before exec "$ PRGDIR"/"$ EXECUTABLE" start "$.

(4) Start and close tomcat.

    

sudo ./bin/startup.shsudo ./bin/shutdown.sh

 

(5) After the startup is successful, enter localhost: 8080 in the browser. If the tomcat homepage is displayed, the installation is successful. when deploying a project, you only need to copy the file package to/opt/apache-tomcat-8.5.16/webapps.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.