Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure and install Java and Tomcat servers with server in Linux

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how to configure and install Java and Tomcat servers in server in Linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

System: Ubuntu 16.04dev_desktop

1.Java installs and configures environment variables

(1) download the latest version of JDK: http://www.oracle.com/technetwork/java/javase/downloads/index.html from the official website of Java

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

(2) unpack the 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 profile configuration environment variables

Open / etc/profile using vim

Sudo vim / etc/profile

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

two。 Install Tomact

(1) download the latest version of tomcat http://tomcat.apache.org/download-80.cgi from the official tomcat website

Compressed package tar.gz

(2) extract 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, enter the apache-tomcat-8.5.16 folder, and edit the. / bin/startup.sh file with vim.

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

Where JAVA_HOME is the path where java was just installed.

Note the revision code needs to be inserted before the line exec "$PRGDIR" / "$EXECUTABLE" start "$@".

(4) start and shut down tomcat.

Sudo. / bin/startup.shsudo. / bin/shutdown.sh

(5) after starting successfully, enter localhost:8080 in the browser to display the tomcat home page and the installation is successful. When deploying the project, simply copy the package to / opt/apache-tomcat-8.5.16/webapps

Thank you for reading! This is the end of the article on "how to configure server in Linux to install Java and Tomcat server". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report