Huawei Cloud Yaoyun Server L instance evaluation | Java common development environment practical deployment

Table of contents

 1. Basic introduction

1.1 Introduction to Yunyao Cloud Server L Instance

1.2 Practical introduction

 2. Purchase and basic use of Yunyao Cloud Server

2.1 Server purchase process

2.2 Initialization connection process

2.3 System environment check

3. Install JAVA (Tomcat+JDK)

3.1 Basic introduction to Tomcat+JDK

3.2 Installation steps

3.3 View and use

4. Install Nginx

4.1 Basic introduction to Nginx

4.2 Installation steps

4.3 View and use

5. Install the database MYSQL

5.1 Basic introduction to MYSQL

5.2 Installation steps

5.3 View and use

6. Summary of practical operations


 1. Basic introduction

1.1 Introduction to Yunyao Cloud Server L Instance

 Yunyao Cloud Server L instance is a new generation of out-of-the-box lightweight application cloud server built for small and medium-sized enterprises and developers . Yunyao Cloud Server L instance provides a rich and carefully selected application image, enabling one-click deployment of applications, helping customers to build e-commerce websites, web applications, applets, learning environments, various development tests, etc. in the cloud conveniently and efficiently. It has a low threshold for use and is more suitable for the following groups of people:

  • Beginner users of cloud computing services
  • Individual developers and small and medium-sized enterprises deploying simple applications on the server

Purchase address: Yunyao Cloud Server L instance purchase address

Yunyao Cloud Server L instance has computing, storage, image installation, backup and other capabilities:

  • Yunyao Cloud Server L instances are deployed in different regions. A failure in one region will not affect cloud servers in other regions.
  • You can establish a dedicated network environment through a virtual private cloud (VPC), set up subnets and security groups, and achieve external network links through elastic public IP.
  • Data storage is realized through the cloud disk (EVS) service, and the backup and recovery of Yunyao Cloud Server L instance data is realized through the cloud disk backup service.
  • Cloud Server Backup (CBR) provides backup protection services for Yunyao Cloud Server L instances. Supports backing up all cloud disks (system disks and data disks) in Yunyao Cloud Server L instance, and uses the backup data to restore Yunyao Cloud Server L instance data.
  • Host Security (HSS) improves the overall security of Yunyao Cloud Server L instances. Through intrusion detection, vulnerability management, and baseline checking functions, it can identify and manage information assets in the cloud server, monitor risks in the cloud server in real time, and reduce server intrusion. risks of.
  • Yunyao Load Balancing (HCES ELB) is a traffic distribution control service that distributes access traffic to multiple back-end Yunyao cloud server L instances according to distribution policies. Load balancing can expand the external service capabilities of the application system through traffic distribution and improve the availability of the application system by eliminating single points of failure.

1.2 Practical introduction

When we get a server, the first thing we need to do is to equip our own development environment, so this practical operation is mainly to complete a common environment that Java developers need on Huawei Cloud.

Mainly includes the following environment configuration:

  • Install JAVA (Tomcat+JDK)
  • Install nginx
  • Install database MYSQL

 This installation uses the one-click installation tool OneinStack. OneinStack (one-click PHP/JAVA installation tool) is a software that can help users complete the installation of development tools. Users can quickly complete language installation and some local configuration work through the software. The software contains multiple optional installation combinations. Users can choose which one to install according to their own circumstances. It supports multiple versions of systems such as CentOS and Ubuntu.

 2. Purchase and basic use of Yunyao Cloud Server

2.1 Server purchase process

Log in to Huawei Cloud, jump to the purchase address mentioned above, and select the server configuration required for this practical operation. Here I used the Liunx visual pagoda panel, and the instance specification is the most basic 2 cores | 2G.

Click to buy to jump to the next step

Click to pay to make the payment. Recently, Yunyao Cloud Server L instance has experience evaluation coupons. I used the coupons here. Just click to pay online.

After the payment is completed, click to return to the Huawei Cloud Yunyao service console to view the purchased server.

 As you can see in the picture below, we have successfully purchased it. Click on remote login to initialize the configuration.

2.2 Initialization connection process

Huawei Cloud Console Connection Method

 Since I didn’t set a password before, I’ll reset it here.

 After restarting, just log in. Our server is now ready.

Xshell connection method

If you are used to using Xshell for operations, it is also supported. The xshell connection process is as follows:

Create a new connection and enter the corresponding public network IP

 Enter username: Log in as root user

​ Enter the password you set the password for

Then we can connect to our cloud server

2.3 System environment check

  •  cat /etc/os-releaseCommand: used to display system version and release information.

root@hcss-ecs-a5d1:~# 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
root@hcss-ecs-a5d1:~# 
  • df -h command: used to display the disk space usage of the file system. 
root@hcss-ecs-a5d1:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           179M  1.1M  178M   1% /run
/dev/vda1        40G  4.5G   33G  13% /
tmpfs           892M   16K  892M   1% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           179M  4.0K  179M   1% /run/user/0

3. Install JAVA (Tomcat+JDK)

3.1 Basic introduction to Tomcat+JDK

 Basic introduction to JDK

JDK is a software development kit in the Java language, mainly used for Java applications on mobile devices and embedded devices. JDK is the core of the entire Java development. It includes the JAVA running environment (JVM+Java system class library) and JAVA tools. 

 Basic introduction to Tomacat

Tomacat is a free and open source Servlet container launched by Apache, which can load JavaWeb programs. Tomcat server is a free open source web application server. It is a lightweight application server. It is commonly used in small and medium-sized systems and situations where there are not many concurrent access users. It is the first choice for developing and debugging JSP programs.

3.2 Installation steps

Enter the command: wget -c http://mirrors.oneinstack.com/oneinstack-full.tar.gz && tar xzf oneinstack-full.tar.gz && ./oneinstack/install.sh --tomcat_option 2 --jdk_option 1 - -reboot

The purpose of this command is to download, decompress and install OneInstack, configure Tomcat 8 and OpenJDK 8, and finally restart the system:

  • - `wget -c http://mirrors.oneinstack.com/oneinstack-full.tar.gz`: Use the `wget` command to download the complete installation package of OneInstack.  
  • - `tar xzf oneinstack-full.tar.gz`: Use the `tar` command to decompress the downloaded installation package.  
  • - `./oneinstack/install.sh --tomcat_option 2 --jdk_option 1 --reboot`: Run the `install.sh` script and pass three parameters: `--tomcat_option 2` means using Tomcat 8 as the Web server, ` --jdk_option 1` means using OpenJDK 8 as the Java Development Kit, and `--reboot` means restarting the system after the installation is complete.

Wait for the download and installation to restart. This process may take a long time, please wait patiently. After it is completed, the following interface will appear:

 After the installation is completed, the server will automatically restart and you need to reconnect to the server.

3.3 View and use

Configure security group rules on your Yunyao cloud server, that is, open ports 8080 and 443:

Access the public network IP+:8080 in the browser and the following interface appears, which means success. The OneInstack image has modified tomcat's default homepage, so this interface appears, which is normal.

Change the directory to the /usr/local/tomcat/bin directory to view tomcat version information. Use the ./catalina.sh version command to view it .

root@hcss-ecs-a5d1:/# cd /usr/local/tomcat/bin
root@hcss-ecs-a5d1:/usr/local/tomcat/bin# ./catalina.sh version
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr/lib/jvm/java-8-openjdk-amd64
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:   -Djava.library.path=/usr/local/apr/lib
Server version: Apache Tomcat/9.0.75
Server built:   May 4 2023 13:04:05 UTC
Server number:  9.0.75.0
OS Name:        Linux
OS Version:     5.15.0-60-generic
Architecture:   amd64
JVM Version:    1.8.0_382-8u382-ga-1~22.04.1-b05
JVM Vendor:     Private Build
root@hcss-ecs-a5d1:/usr/local/tomcat/bin# 

4. Install Nginx

4.1 Basic introduction to Nginx

Nginx is a high-performance HTTP and reverse proxy web server that also provides IMAP/POP3/SMTP services. Nginx is a lightweight web server/reverse proxy server and email (IMAP/POP3/SMTP) proxy server. The characteristics of Nginx are: it occupies less memory and has strong concurrency capabilities.

Nginx is specially developed for performance optimization. Performance is the most important consideration and it attaches great importance to efficiency. In fact, Nginx's concurrency capability performs better among web servers of the same type and can support up to 50,000 concurrent connection responses.

4.2 Installation steps

Enter the command: wget -c http://mirrors.oneinstack.com/oneinstack-full.tar.gz && tar xzf oneinstack-full.tar.gz && ./oneinstack/install.sh --nginx_option 1 --reboot

The purpose of this command is to download, decompress and install OneInstack, and configure Nginx

  • Use the `wget` command to download the complete installation package of OneInstack (`oneinstack-full.tar.gz`)  
  • Use the `tar` command to decompress the downloaded installation package  
  • Enter the unzipped directory (`oneinstack`) and execute the `install.sh` script  
  • Pass two parameters when executing the script: `--nginx_option 1` means to select the default configuration when installing Nginx, `--reboot` means to restart the system after the installation is completed.

 After the installation is completed, the server will automatically restart and you need to reconnect to the server.

4.3 View and use

Configure security group rules on your own Yunyao Cloud server, that is, open port 80:

 Access the public network IP+:80 in the browser and the following interface appears, which means success. The OneInstack image has modified the Nginx default homepage, so this interface appears, which is normal.

Modify Nginx as the default page, and modify the root configuration item in the nginx.conf file in the /usr/local/nginx/conf directory to html

 Enter your Yunyao cloud server IP in the browser to view

5. Install the database MYSQL

5.1 Basic introduction to MYSQL

MySQL is a relational database management system developed by the Swedish MySQL AB company and is a product of Oracle. MySQL is one of the most popular relational database management systems. In terms of WEB applications, MySQL is one of the best RDBMS (Relational Database Management System) application software.
MySQL is a relational database management system. A relational database stores data in different tables instead of placing all data in one large warehouse, which increases speed and flexibility.

5.2 Installation steps

Enter the command: wget -c http://mirrors.oneinstack.com/oneinstack-full.tar.gz && tar xzf oneinstack-full.tar.gz && ./oneinstack/install.sh --db_option 2 --dbinstallmethod 1 - -dbrootpwd zhang123123 --reboot

The general meaning of this instruction is:

1. Use the `wget` command to download the `oneinstack-full.tar.gz` file. If the download is interrupted, it will be downloaded again automatically.  
2. Use the `tar` command to decompress the `oneinstack-full.tar.gz` file.  
3. Enter the decompressed `oneinstack` directory and execute the `install.sh` script.  
4. When executing the script, the following parameters are passed:  

  •    - `--db_option 2`: Select the database option, here is MySQL.  
  •    - `--dbinstallmethod 1`: Select the database installation method. Here, the system's built-in MySQL installation program is used.  
  •    - `--dbrootpwd zhang123123`: Set the password of the database root user to `zhang123123`.  
  •    - `--reboot`: Automatically restart the system after executing the script.

The purpose of this command is to download, decompress and install OneInstack, set the database root password to ` zhang123123 `, and restart the system after the installation is completed.

After the installation is completed, the server will automatically restart and you need to reconnect to the server.

5.3 View and use

Use mysql -V to view the installed database version

root@hcss-ecs-a5d1:/usr/local/tomcat/bin# cd /
root@hcss-ecs-a5d1:/# mysql -V
mysql  Ver 14.14 Distrib 5.7.42, for linux-glibc2.12 (x86_64) using  EditLine wrapper

Use mysql -uroot -p to enter the password and log in to the database terminal

To view all databases, use the MySQL terminal and enter the show databases; command 

MySQL [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| ultrax             |
+--------------------+
6 rows in set (0.02 sec)

MySQL [(none)]> 

6. Summary of practical operations

In this practical operation, we deployed a common Java development environment, and the whole process was smooth and smooth. The deployment idea is to use the installation command to install directly. External access ports are required, and the ports can be opened in the server. Huawei Cloud Yaoyun Server L instance has excellent performance and is stable and reliable. For novices or small companies who are new to cloud servers for project deployment, using Huawei Cloud Yaoyun Server L instance is generally a good choice.

Guess you like

Origin blog.csdn.net/m0_62436868/article/details/132891484