Linux (64) under Tomcat + Java environment setup

Source: Internet
Author: User

View the number of Linux system bits

Getconf Long_bit

Java jdk:http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u181-linux-x64.rpm

Tomcat 9.0:http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-9/v9.0.10/bin/apache-tomcat-9.0.10.tar.gz

Upload the above 2 files to the/home/admin directory

Cd/home/admin

RPM-IVH jdk-8u181-linux-x64.rpm Installing Java JDK

Tar zxvf apache-tomcat-9.0.10.tar.gz Unzip Tomcat

Configuring the JDK System environment variables

cd/etc/

VI Profile

Add the following at the end of this file

# java Path
Export JAVA_HOME=/USR/JAVA/JDK1.8.0_181-AMD64
Export Classpath=.:${java_home}/lib
Export Path=${java_home}/bin: $PATH

Can be set to modify Tomcat port

Cd/home/lifu/apache-tomcat-9.0.10/conf

VI Server.xml

Modify 8080 for the port number you need

Start Tomcat

Cd/home/lifu/apache-tomcat-9.0.10/bin

./startup.sh

See if Tomcat starts properly

Cd/home/lifu/apache-tomcat-9.0.10/logs

Cat Catalina.out

If it does not start properly, the port number may be used, and you can use the following method to query

lsof-i:8080 See which process is taking up

COMMAND PID USER FD TYPE DEVICE size/off NODE NAME
Java 8446 root 49u IPv4 8294048 0t0 TCP *:webcache (LISTEN)

PS Axu|grep 8446 View details of the corresponding PID process

Close Tomcat

Cd/home/lifu/apache-tomcat-9.0.10/bin

./shutdown.sh

Add the specified port to the firewall

Iptables-i input-p Protocol--dport port number-j ACCEPT

For example:

1 iptables-i input-p UDP--dport 161-j ACCEPT2 iptables-i input-p tcp--dport 8080-j ACCEPT

  

    

Linux (64) under Tomcat + Java environment setup

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.