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 install JDK and Tomcat on Linux CVM

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

Share

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

This article is about how to install JDK and Tomcat on Linux CVM. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Download and install JDK

Step 1: download jdk's official address http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html from the official website.

You need to confirm the number of system bits of your computer's Linux (usually 64-bit), 32-bit download Linux x86 version, 64-bit download Linux x64 version

Query using the linux command: uname-a

Step 2: upload the jdk file to the cloud service by using the Xftp tool to copy the downloaded jdk package to the CVM (the folder is created by myself. I created the software to store the software installation package in the usr directory)

Step 3: extract the jdk package (using the linux command)

First use the cd command to reach the folder address you created in the previous step: cd / usr/software

Then use the command to extract the jdk package: tar-xvf jdk-8u65-linux-x64.tar.gz (you can press tab to complete automatically after entering jdk)

Use the mv jdk1.8.0_65 jdk1.8 command to rename jdk1.8.0_65 to jdk1.8 (for later management and use)

Step 4: change the environment variable after the decompression is complete

Enter the linux command: vim / etc/profile

Then press I to enter the writing mode

In the profile file, move the cursor to the end and add the following command (if the above is based on my steps, the following command can be copied. If different, remember to change the folder name and jdk name):

Export JAVA_HOME=/usr/software/jdk1.8 export JRE_HOME=/usr/software/jdk1.8/jre export PATH=$PATH:/usr/software/jdk1.8/bin export CLASSPATH=./:/usr/software/jdk1.8/lib:/usr/software/jdk1.8/jre/lib

Press Esc when you are finished, then press: enter the last line mode, enter the linux command wq to save and exit

Step 5: restart the Linux server

After the restart, enter the following command:

Java-version

Javac-version

If the following appears in English, it proves that jdk is installed successfully.

The first step of downloading and installing Tomcat: first download tomcat from the official website, such as the above jdk has been successfully installed, and then install tomcat (similar to the steps of jdk). First go to the official website to download tomcat: http://tomcat.apache.org/.

Step 2: upload the tomcat file to the cloud service and copy the downloaded tomcat package to the CVM by using the Xftp tool

Step 3: extract the tomcat package (using the linux command) first use the cd command to reach the folder address created in the previous step: cd / usr/software and then use the extract jdk package command: tar-xvf apache-tomcat-8.0.30.tar (press tab to complete automatically after entering apache)

Step 4: change the environment variable after the decompression is complete

Enter the linux command: vim / etc/profile

Then press I to enter the writing mode

In the profile file, move the cursor to the end and add the following command (if the above is based on my steps, the following command can be copied. If different, remember to change the folder name and jdk folder name):

Export CATALINA_HOME=/usr/software/apache-tomcat-8.0

Press Esc when you are finished, then press: enter the last line mode, enter the linux command wq to save and exit

Step 5: change the port number

Use the linux command to enter the configuration folder: cd / usr/software/apache-tomcat-8.0.30/conf

The linux command, enter vi server.xml, and find the following code:

Change 8080 to the default port 80 of HTTP protocol, and the changed code is as follows:

Go to the cd / usr/local/tomcat/apache-tomcat-8.0.30/bin directory

Enter the console of the CVM, go to the security group rules, add security group rules, and configure port 80 (if you have not changed port 80 above, the port range is 8080).

Step 6: start the tomcat server

Use the linux command to first go to the bin directory of the tomcat folder: cd / usr/software/apache-tomcat-8.0.30/bin

Enter your own ip address in the browser (if you do not change the port number, add: 8080 after the ip address), and the home page of tomcat appears, which proves that the tomcat configuration started successfully

If the page is blocked, you can try to turn off linux Firewall using the following command. Command: service iptables stop

Thank you for reading! This is the end of the article on "how to install JDK and Tomcat on Linux CVM". 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 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