Huawei Cloud Yaoyun Server L instance evaluation|Installation of Tomcat on Linux system

1. Introduction to Yunyao Cloud Server L Instance

1.1 Introduction to Yunyao Cloud Server L instance

Yunyao Cloud Server L instance is a new generation of lightweight application cloud server, specially designed for small and medium-sized enterprises and developers, providing a convenient out-of-box experience. This product provides rich and strictly screened application images and can deploy applications with one click, greatly simplifying the process of customers building e-commerce websites, web applications, applets, learning environments, and various development and testing tasks in the cloud.

Insert image description here

1.2 Features of Yunyao Cloud Server L instance

  • Intelligent and non-stuck: Huawei Cloud Qingtian architecture supports software and hardware collaboration combined with AI algorithm intelligent scheduling to provide you with high-quality performance. Huawei Cloud has a global storage and computing network with data transmission latency shorter than the blink of an eye, meeting the high requirements of low network latency scenarios such as games and audio and video.

  • Excellent price, easy to use: super cost-effective, ultra-low threshold, open to use as you like. Multiple instance specifications to balance performance and cost. Technology upgrades optimize cloud costs and benefit more start-ups and developers.

  • It’s easier to get started: order multiple images and resource combinations with one click. A variety of high-quality images have been carefully selected and rigorously tested by Huawei Cloud officials. They cover seven major scenarios and have preset templates, which are quick to build, safe and trustworthy. Automated orchestration, one-click activation of resources, and business online in minutes. Smooth learning curve, wizard-based application construction, and easy application activation.

  • Management is more worry-free: topology, resources, and mirroring are managed visually, and business architecture is transparently managed. Intimate service status reminders, one-click resource renewal and withdrawal, and simplified management. Real-time monitoring of resource load, security, and usage ensures that services are always online. A wide range of optional security services are available, including extensive backup, host security and other services, providing the highest level of security protection.

2. Introduction to Tomcat

2.1 Introduction to Tomcat

Tomcat is an open source, free web server. It is a lightweight web server. It is suitable for deploying small and medium-sized web projects with not many concurrent access users. It is the first choice for deploying small and medium-sized JSPs.

2.2 Tomcat features

  • Lightweight: Tomcat is a lightweight web container that takes up fewer resources than other web servers and can run in environments with limited resources.

  • Easy installation: The installation and configuration of Tomcat are relatively simple, and even in a Windows environment, all operations can be completed through a one-click installation program.

  • Easy to expand: Tomcat supports a variety of plug-ins and extension functions to meet different needs.

  • Easy to develop: Tomcat can be integrated with development tools such as Eclipse to facilitate developers to debug and test.

  • Easy deployment: Tomcat can be deployed through WAR files, which makes application release easier and faster.

  • Easy maintenance: Tomcat provides powerful management tools that can help administrators manage and monitor the running status of Tomcat instances.

3. Introduction to this practice

3.1 Introduction to this practice

1. This practice is a personal test learning environment, aiming to quickly deploy applications. Please be cautious in the production environment;
2. This practice environment is a Yunyao Cloud Server L instance, and the application image used is Portainer 2.18.4;
3. In the cloud Install Tomcat on Yaoyun Server L instance.

3.2 This environmental plan

Server category Application image Intranet IP address Docker version Portainer version tomcaat version Operating system version
Yunyao cloud server L instance Docker visualization Portainer 192.168.0.168 24.0.4 8.15.0 10.1.7.0 Ubuntu 22.04.1 LTS

4. Purchase an L instance of Yunyao Cloud Server

4.1 Purchase Yunyao Cloud Server L instance

  • Purchase steps:

1. Official website link: https://www.huaweicloud.com/product/hecs-light.html
2. Purchase specifications:
Region: North China-Beijing IV;
Application image: Docker visualization-Portainer;
Instance specifications: 2 cores 2G/system Disk 40G/peak bandwidth 3Mbps/traffic package 400G;
instance name: Customize it, edit it here as HECS-L-Portainer;
purchase duration: 1 month.
3. Click to buy.

Insert image description here

4.2 Check the status of Yunyao Cloud Server L instance

Check the status of the previously purchased Yunyao Cloud Server L instance and it is running normally.

Insert image description here

4.3 Reset server password

Click to remotely log in to Yunyao Cloud Server L instance

Insert image description here

Insert image description here

To reset the password, click the reset password option on the right. Identity verification is required. After selecting mobile phone verification, the password can be reset successfully.

Insert image description here

Insert image description here

5. Check the server environment

5.1 Xshell remote connection server

  • Copy the elastic public IP address and use it when connecting to the server remotely.

Insert image description here

  • In the Xshell tool, fill in the server's elastic public IP address, account and password information, and connect to the remote server via ssh.

Insert image description here

Insert image description here

Insert image description here

5.2 Check operating system version

Check the operating system version of the Yunyao Cloud Server L instance. The operating system version used this time is Ubuntu 22.04.1 LTS.

root@hcss-ecs-f91c:~# cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.1 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

5.3 Check the system kernel version

Check system kernel version

root@hcss-ecs-f91c:~# uname -r
5.15.0-60-generic

6. Deploy java environment

6.1 Download jdk package

Download address: https://www.oracle.com/java/technologies/downloads/#java11

Insert image description here

  • Use the xftp tool to upload the downloaded jdk package to the Yunyao Cloud Server L instance
root@hcss-ecs-f91c:~# ls jdk-11.0.20_linux-x64_bin.tar.gz
jdk-11.0.20_linux-x64_bin.tar.gz

6.2 Install jdk

  • Unzip the jdk package
 tar -xzvf jdk-11.0.20_linux-x64_bin.tar.gz

Insert image description here

  • Copy binary files
cp -r ~/jdk-11.0.20 /usr/local/jdk/
  • Configure environment variables and add the following two lines to /etc/profile.
vim /etc/profile
export JAVA_HOME=/usr/local/jdk
export PATH=$PATH:$JAVA_HOME/bin
  • Make environment variables effective
root@hcss-ecs-f91c:~# source !$
source /etc/profile

6.3 Check jdk version

Check jdk version

 java -version

Insert image description here

7. Install Tomcat

7.1 Download tomcat software package

Download address: https://dlcdn.apache.org/tomcat/

Insert image description here

Use the xftp tool to upload the downloaded tomcat package to the Yunyao Cloud Server L instance

root@hcss-ecs-f91c:~# ls apache-tomcat-10.1.13.tar.gz
apache-tomcat-10.1.13.tar.gz

7.2 Unzip the Tomcat software package

Unzip the tomcat package

tar -xzvf apache-tomcat-10.1.13.tar.gz  -C /usr/local/
mv /usr/local/apache-tomcat-10.1.13/ /usr/local/tomcat

7.3 Set environment variables

Add the following two lines to /etc/profile

vim /etc/profile
export TOM_HOME=/usr/local/tomcat
export PATH=$PATH:$TOM_HOME/bin
  • Make environment variables effective
root@hcss-ecs-f91c:~# source !$
source /etc/profile

7.4 Check Tomcat version

Check Tomcat version

root@hcss-ecs-f91c:~# vim /etc/profile
root@hcss-ecs-f91c:~# source !$
source /etc/profile
root@hcss-ecs-f91c:~# version.sh
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr/local/jdk
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:
Server version: Apache Tomcat/10.1.13
Server built:   Aug 23 2023 21:34:59 UTC
Server number:  10.1.13.0
OS Name:        Linux
OS Version:     5.15.0-60-generic
Architecture:   amd64
JVM Version:    11.0.20+9-LTS-256
JVM Vendor:     Oracle Corporation

7.5 Start Tomcat service

Start the Tomcat service

root@hcss-ecs-f91c:/usr/local/tomcat/conf#  startup.sh
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr/local/jdk
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:
Tomcat started.

7.6 Check Tomcat service status

  • Check the listening address. Tomcat listens to port 8080 by default.
root@hcss-ecs-f91c:~# ss -tunlp |grep 8080
.tcp   LISTEN 0      100                     *:8080            *:*    users:(("java",pid=383091,fd=42))
  • Check tomcat process
root@hcss-ecs-f91c:~# ps -aux |grep tomcat
root      383091  2.9  5.3 2963324 97020 pts/0   Sl   14:51   0:03 /usr/local/jdk/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED -classpath /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/tomcat -Dcatalina.home=/usr/local/tomcat -Djava.io.tmpdir=/usr/local/tomcat/temp org.apache.catalina.startup.Bootstrap start
root      383215  0.0  0.1   6476  2312 pts/0    S+   14:53   0:00 grep --color=auto tomcat

7.7 View tomcat configuration file

The tomcat configuration file is in the installation directory /usr/local/tomcat, conf/server.xml file.

  • Modify the listening port part
<<Connector port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000"
           redirectPort="8443" address="0.0.0.0" />

Insert image description here

  • Modify website path
<Host name="localhost"  appBase="/path/to/webapps">

Insert image description here

8. Access the Tomcat website service

8.1 Release security group ports

On the security group management page of Huawei Cloud Yaoyun Server L instance, allow port 8080 in the inbound direction.

Insert image description here
Insert image description here

8.2 Access Tomcat service

Access address: http://Elastic public IP address: 8080.
Replace the IP address with the elastic public IP address of your server.

Insert image description here

Guess you like

Origin blog.csdn.net/jks212454/article/details/132829582