Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.

preface

Cloud services can be seen everywhere in the Internet era, such as you build systems, build games, build personal websites and so on are deployed on the cloud server, so cloud server deployment is crucial, this paper makes a detailed introduction to cloud server deployment.

Buy a cloud server

First of all, the server has to buy, you can choose Ali cloud or Tencent cloud, here I take Tencent cloud as the main, enter the official website to buy curl.qcloud.com/vAFDbEef, according to their actual situation to choose to buy (new users have preferential, if it is a student, the price will be much cheaper), the system recommended to choose Centos system.

The default user name is root, and the password you bought will give you a password, but the password is not easy to remember, you can click more in the instance to reset the password.

Two, operate the server

In the console instance, you can click login to enter a terminal interface for operation, but generally through SSH connection to operate the server, I usually use Xshell to connect to the server, the operation steps are as follows:

  • First, we generate the public key in Xshell;
  • Find the SSH key next to Tencent Cloud console to create a key pair (select the existing public key).
  • Enter the public key information just generated in Xshell; Restart Tencent cloud server in the example;
  • Then you can log in to Tencent cloud server (user name root) on Xshell.

Xshell generates a public key:

Get the public key information:

Create a key pair in Tencent Cloud Console:

Restart the cloud server:

Xshell connects to the server:

Xshell login:

Login successful:

At this point, the server terminal is complete, and then proceed to Linux command operation JDK and Tomcat.

Download the JDK and install it

1. Install JDK with yum or wegt

In the official website to download the JDK, address for www.oracle.com/technetwork…

2. Install JDK

Tar -zxvf jdK-8u271-linux-x64.tar.gz.tar. gz vim /etc/profile // Edit the configuration file // Add the following content to the configuration file: Export JAVA_HOME="/root/jdk1.8.0_151" export CLASSPATH="$:CLASSPATH:$JAVA_HOME/lib/" export PATH="$PATH:$JAVA_HOME/bin" // Refresh configuration file source /etc/profileCopy the code

After the configuration, enter the Java -version command to check the result:

Download, install, and start Tomcat

1. Download Tomcat

Tomcat’s official website to download: tomcat.apache.org/download-80…

2. Install and start Tomcat

File transfer is done on Xftp as in the JDK above.

// Decompress tar -zxvf apache-tomcat-8.5.47.tar.gz // Go to the bin directory CD apache-tomcat-8.5.47/bin/ /start tomcat. /startup.sh // Disable Tomcat./shutdown.shCopy the code

3. Enable the security group port in Tencent cloud

If you want to access the Tomcat server from the outside, you need to click modify rules in the Security group of Tencent Cloud Console, and then open the corresponding port number, otherwise it is not accessible.

Inbound rules have ports, so do outbound rules.

Next, restart the server and enter the IP or domain name on Windows to access Tomcat on Linux.

conclusion

At this point, the cloud server deployment and server installation of JDK and Tomcat are complete.