文章目录

  • 前言
  • 本文介绍如何在阿里云服务器上部署springboot项目,记录一下自己的部署过程,希望可以对各位小伙伴有帮助。
  • 一、阿里云前期准备工作
  • 二、安装Xsheel
  • 二、阿里云服务器端安装JDK
  • 三、阿里云服务器端安装MySQL
  • 四.IDEA端将spring boot项目打成jar包
  • 五.在Xsheel端上传IDEA打成的项目jar包



前言

本文介绍如何在阿里云服务器上部署springboot项目,记录一下自己的部署过程,希望可以对各位小伙伴有帮助。

一、阿里云前期准备工作

springboot 微服务服务器 热部署 服务器部署springboot项目_服务器


springboot 微服务服务器 热部署 服务器部署springboot项目_服务器_02


springboot 微服务服务器 热部署 服务器部署springboot项目_mysql_03


springboot 微服务服务器 热部署 服务器部署springboot项目_spring boot_04


springboot 微服务服务器 热部署 服务器部署springboot项目_阿里云服务器_05


springboot 微服务服务器 热部署 服务器部署springboot项目_阿里云_06


springboot 微服务服务器 热部署 服务器部署springboot项目_阿里云_07


springboot 微服务服务器 热部署 服务器部署springboot项目_服务器_08


springboot 微服务服务器 热部署 服务器部署springboot项目_mysql_09


springboot 微服务服务器 热部署 服务器部署springboot项目_mysql_10


springboot 微服务服务器 热部署 服务器部署springboot项目_spring boot_11


springboot 微服务服务器 热部署 服务器部署springboot项目_spring boot_12


springboot 微服务服务器 热部署 服务器部署springboot项目_阿里云_13

二、安装Xsheel

springboot 微服务服务器 热部署 服务器部署springboot项目_阿里云服务器_14


springboot 微服务服务器 热部署 服务器部署springboot项目_spring boot_15


springboot 微服务服务器 热部署 服务器部署springboot项目_服务器_16


springboot 微服务服务器 热部署 服务器部署springboot项目_服务器_17


springboot 微服务服务器 热部署 服务器部署springboot项目_阿里云服务器_18

二、阿里云服务器端安装JDK

springboot 微服务服务器 热部署 服务器部署springboot项目_mysql_19


打开Xsheel工具,连接上阿里云服务器,执行:

yum install lrzsz

出现this is ok的时候输入:y就行

cd /usr

springboot 微服务服务器 热部署 服务器部署springboot项目_阿里云服务器_20

rz -be

springboot 微服务服务器 热部署 服务器部署springboot项目_spring boot_21


springboot 微服务服务器 热部署 服务器部署springboot项目_spring boot_22


解压压缩包:

tar -zxvf jdk-8u361-linux-x64.tar.gz

springboot 微服务服务器 热部署 服务器部署springboot项目_阿里云服务器_23


配置jdk系统环境变量:

cd /etc

springboot 微服务服务器 热部署 服务器部署springboot项目_spring boot_24

vim profile

springboot 微服务服务器 热部署 服务器部署springboot项目_服务器_25


按i进入vi编辑器编辑,末尾添加:

springboot 微服务服务器 热部署 服务器部署springboot项目_阿里云服务器_26


配置完成:先按ESC,输入:wq,在回车就行。

立即执行profile文件,使之生效:

source profile

springboot 微服务服务器 热部署 服务器部署springboot项目_阿里云服务器_27

输入java -version;进行检验。

java -version;

springboot 微服务服务器 热部署 服务器部署springboot项目_阿里云_28

三、阿里云服务器端安装MySQL

##0.创建一个mysql目录:

mkdir /mysql
//进入创建的目录:
cd /mysql

1.查看Centos版本

cat /etc/redhat-release

2.卸载之前的mysql和mariadb

rpm -qa|grep mysql;
yum -y remove mariadb-libs-5.5.60-1.el7_5.x86_64

3.下载mysql源到mysql下

wget https://repo.mysql.com//mysql80-community-release-el7-5.noarch.rpm

yum localinstall mysql80-community-release-el7-5.noarch.rpm
4.检查下源是否包含mysql
yum clean all && yum makecache

yum repolist enabled | grep "mysql.*-community.*"

yum repolist all | grep mysql

5.安装mysql

yum install mysql-community-server -y

6.启动并设置开机自启

systemctl start mysqld

systemctl enable mysqld

systemctl status mysqld

7.查看MySQL的版本

mysql --version

8.查看初始密码并重置

//查看初始密码
grep 'temporary password' /var/log/mysqld.log
//登录mysql
mysql -u root -p
//输入的密码为初始密码
//重置密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root_password123456';

9.远程登录

show databases;

use mysql;

select user,host from user;

update user set host="%" where user="root";

flush privileges;

quit;

四.IDEA端将spring boot项目打成jar包

1.在application.properties添加:

server.servlet.encoding.charset=utf-8

2.在pom.xml添加:

<packaging>jar</packaging>

springboot 微服务服务器 热部署 服务器部署springboot项目_mysql_29


3.点击package

springboot 微服务服务器 热部署 服务器部署springboot项目_spring boot_30


4.打成的jar包在项目的target下面:

springboot 微服务服务器 热部署 服务器部署springboot项目_服务器_31

五.在Xsheel端上传IDEA打成的项目jar包

1.在Xsheel里面上传我们的jar包

rz

springboot 微服务服务器 热部署 服务器部署springboot项目_mysql_32


2.运行我们部署的项目:

java -jar springbootWeb-0.0.1-SNAPSHOT.jar

springboot 微服务服务器 热部署 服务器部署springboot项目_服务器_33

3.访问项目:

http://官网ip:端口号

springboot 微服务服务器 热部署 服务器部署springboot项目_阿里云_34


springboot 微服务服务器 热部署 服务器部署springboot项目_mysql_35


springboot 微服务服务器 热部署 服务器部署springboot项目_阿里云服务器_36