当前位置:网站首页>SSM project deployed in Alibaba cloud

SSM project deployed in Alibaba cloud

2022-04-23 13:45:00 One duck, one duck

One 、 Alibaba cloud purchases servers

Two 、 Reset the instance password for the first login

Get into ESC Console
 Insert picture description here
Click on i… First string in
 Insert picture description here
And then restart

3、 ... and 、 download xshell and Xftp 6

Baidu download crack can

Four 、 Test connection

 Insert picture description here

5、 ... and 、 Install... On the server jdk

Xshell Enter the command

yum -y install java-1.8.0-openjdk.x86_64

 Insert picture description here
see Java edition :
 Insert picture description here

6、 ... and 、 install MySQL(8.0)

cd /usr/local
mkdir mysql
cd mysql
wget  https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm

 Insert picture description here

install yum repo File and update yum cache ;

rpm -ivh mysql80-community-release-el7-1.noarch.rpm

 Insert picture description here
Execution results

Will be in /etc/yum.repos.d/ Two repo file mysql-community.repo mysql-community-source.repo

 Insert picture description here

to update yum command

yum clean all
yum makecache

Use yum install MySQL

When we are using yum install mysql when ,yum The default from the yum Installation in warehouse mysql Abreast of the times GA edition ; How to choose your own version ;
 Insert picture description here
You can see MySQL 5.5 5.6 5.7 Is disabled and MySQL 8.0 Is enabled ;

install

yum install mysql-community-server

 Insert picture description here

Turn on MySQL service

systemctl start mysqld.service

Get the original login password MySQL

mysql After installation, a root@locahost Account , And put the initial password in /var/log/mysqld.log In file ;

cat /var/log/mysqld.log

 Insert picture description here

Log in with the initial password mysql

mysql -u root -p  # Will prompt for password 

 Insert picture description here

Change the initial password

ALTER USER 'root'@'localhost' IDENTIFIED BY ' New password !';# Pay attention to the number and type of password , At least capitalized + A lowercase letter + Symbol + Numbers 

7、 ... and 、 install tomcat

Install here and the first two jdk and mysql It's different . Here is tomcat Download address , Download to local ,
https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/

 Insert picture description here
 Insert picture description here

Xftp6. Establish connection and pull file

xshell6 Establishing a connection is similar ​, Find the... You downloaded tomcat Then enter usr/local Double click !
 Insert picture description here
The above is downloaded locally apache-tomcat-9.0.45.tar To the server /usr/local Under the table of contents

stay xshell Unzip in apache-tomcat

cd /usr/local
 decompression 
apache-tomcat-9.0.45.tar
tar xzf apache-tomcat-9.0.45.tar.gz

start-up tomcat

 cd /usr/local/apache-tomcat-9.0.52/bin
./startup.sh

 Insert picture description here

Open Alibaba cloud management console , Set security group

 Insert picture description here
 Insert picture description here
 Insert picture description here

Browser Test

 Insert picture description here

Database connection

You need to set the... In the server mysql In the database user Users in the table correspond to Host Change the field to % that will do . If you use... In the server Navicat Then you can directly modify the fields above , If not, use sql sentence

use mysql;
update user set Host='%' where User='root';

 Insert picture description here
Successful connection
 Insert picture description here

8、 ... and 、 Import project related information

Navicat Import project database

 Insert picture description here

maven Project generation war file

Note that the database version of the project needs to be changed to that deployed by Alibaba cloud MySQL edition , Also put the database of the configuration file IP Change the address and password to the one deployed by Alibaba cloud MySQL Database consistency
 Insert picture description here

Use Xftp6 take war Incoming server tomcat9 Below wabapps Directory

 Insert picture description here

modify Tomcat Inside servlet.xml file

The above steps , Visit website : The server IP:8080/ Project name /home(home This is the landing page of the blogger project , Modify... According to your actual situation ), The visit was successful , Happily enter the user name and password , land (404??)

This is because the URL you log in and jump to should be without the project name , however tomcat You need to bring the project name to access , How to solve it ? Access to information , We know it needs to be changed tomcat Medium server.xml The path where the configuration file is found

add

<Context path="" docBase="/usr/local/apache-tomcat-9.0.52/webapps/logisticsWeb" reloadable="true" />
cd usr/local/apache-tomcat-9.0.52/conf/
vim servlet.xml

 Insert picture description here

Restart tomcat

cd /usr/local/apache-tomcat-9.0.52/bin
./shutdown.sh
ps -ef|grep java
./startup.sh

Browser access

Visit website : The server IP:8080/ Project name /home, success OK

版权声明
本文为[One duck, one duck]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230558023750.html