Deploy the ssm project (xshell and xftp) on Alibaba Cloud

table of Contents

1. Purchase a server (with mysql)

2. Download xshell and xftp (free version for home/school):

3. Configure ECS:

4. Connect to ECS via xshell:

5. Download tomcat and jdk (1.8) through yum in xshell:

6. Start and test tomcat:

7. Configure cloud database RDS and add whitelist:

8. Use local navicat to connect to cloud database

9. Change the configuration file of the database in the project, package the project into a war file through eclipse or idea (jdk1.8, the subject is the SSM project)

10. Start xftp via xshell and upload the war file to the webapps directory of tomcat:

11. Start the project by command and test access:


1. Purchase a server (with mysql)

Website: https://promotion.aliyun.com/ntms/act/campus2018.html

 

2. Download xshell and xftp (free version for home/school):

https://www.netsarang.com/zh/free-for-home-school/

Install it yourself after downloading.

 

3. Configure ECS:

(1) Reset password:

Enter your own console, enter the ECS server instance, and reset the password on the right.

reset Password:

 

 (2) Add a security group: port 8080

Click Manage--Security Group for this instance--Configure Rules

 

 

Select the upper right corner: add security group rules, and then fill in.

The configuration is complete.

4. Connect to ECS via xshell:

Open xshell, click New, and fill in the following: The server ip is your own Alibaba Cloud public network ip

Then click user authentication, fill in, and confirm.

 

After the creation is complete, directly double-click the session connection you just created:

connection succeeded:

 

5. Download tomcat and jdk (1.8) through yum in xshell:

By command: After executing the command, the jdk will be installed for you, and the environment variables will be automatically configured

yum -y install tomcat  

(1) After installation, check the Java version:

java -version

 As shown below:

 

(2) View the status of tomcat:

systemctl status tomcat.service

 As shown in the figure below: it is already running , and it should be dead if it is not started

 After detection, the installation is successful.

Reference article: https://blog.csdn.net/zhaoyanjun6/article/details/79131856

6. Start and test tomcat:

The main thing is to install the tomcat default browser management interface, and then access it through the ip port.

(1) The installation directory of tomcat is in /usr/share/tomcat,我们用cd到这个目录下面的webapps,即/usr/share/tomcat/webapps

(2) After switching the directory, use the command yum install tomcat-webapps tomcat-admin-webapps to install the management interface:

yum install tomcat-webapps tomcat-admin-webapps

(3) After the installation is complete, run your tomcat through the command

systemctl start tomcat.service

Then use the above view tomcat command to view the status, if it is running, it is turned on.

systemctl status tomcat.service

(4) After opening, visit through your ip address and port 8080 in the browser: your server ip: 8080

     The following interface appears, which means the configuration is successful.

 

7. Configure cloud database RDS and add whitelist:

Let me create an account by myself:

Enter the RDS instance of the cloud database in the Alibaba Cloud console, click Manage , and enter account management:

 

Next add the whitelist:

Click on data security , as shown in the figure:

 

Add the IP of your own host (used by navicat database connection) and Alibaba Cloud's IP in the default group (after deploying the project, the project needs to access the database).

Your host ip can be displayed by entering ip directly in the browser. Alibaba Cloud's own examples.

As shown:

8. Use local navicat to connect to cloud database

Copy your own cloud database external network address first, and obtain the external network address yourself

As shown:

Open Navicat, click connect:

Confirm that the connection is successful.

After that, I migrated my local project database to the cloud database in Navicat. (Right-click the project to be transferred locally and select data transfer)

 

9. Change the configuration file of the database in the project, and package the project into a war file through eclipse or idea

(Jdk1.8, the subject is SSM project)

 

It is mentioned here that the jar package for database connection also needs to be changed to version 8.

After the modification, directly export the project to the war file, you can also test whether the database can be used locally.

 

10. Start xftp via xshell and upload the war file to the webapps directory of tomcat:

Open xshell, click on the file transfer in the red box below, and xftp will automatically pop up.

 Select the location of tomcat's webapps in xftp, as shown in the figure: /usr/share/tomcat/webapps

 

After entering the webapps directory , upload your own war project directly on the left.

 

11. Start the project by command and test access:

After upload

Restart tomcat:

sudo systemctl restart tomcat

In the browser enter 8080 / name of your project / Home: The server IP access

Such as format: 123.12.31.222:8080/project/index.jsp

The access is successful and the deployment is complete.

Guess you like

Origin blog.csdn.net/weixin_41905320/article/details/105050502
Recommended