Project deployment cloud server, this one is enough

Don't talk nonsense, just start straight

1. Purchase Tencent Cloud Server

Get the server for free https://cloud.tencent.com/act/free/personal?from=17591

 

· reset Password:

 · ssh login

# ssh协议远程登录服务器
$ ssh ubuntu@公网ip

2. Install the tool on the cloud server

# 切换到root用户
$ sudo -i
# 切回ubuntu
$ su - ubuntu

jdk

# jdk:为了在cmd控制台能够编译运行我们写的java文件
# JDK包含的基本组件包括以下文件
# javac.exe,用于编译java文件,将java文件编译成class文件
# java.exe,用于运行class文件,将class文件运行出结果

# 获取到最新的软件包
$ sudo apt-get update
# 安装jdk
$ sudo apt install openjdk-8-jre-headless
# 查看版本
$ java -version

# 安装完成后jdk的家目录是    /usr/lib/jvm/java-8-openjdk-amd64

apache2

# apache前端项目运行的容器

# 获取到最新的软件包
$ sudo apt-get update
# 安装apache
$ sudo apt-get install apache2
# 查看版本
$ apachectl -v

# 手动启动
$ /etc/init.d/apache2 start
# 开放apache端口80

# 查看apache是否已经启动
$ ps -ef | grep apache

# /var/www/html该目录下放置前端项目

mysql

# 获取到最新的软件包
$ sudo apt-get update
# 安装mysql
$ sudo apt-get install mysql-server

# 是否安装成功--连接数据库
$ mysql -u root -p
# 手动启动
$ service mysql start

# 是否启动
$ sudo netstat -tap | grep mysql 
$ ps -ef | grep mysqld

No password is entered for the first installation (cannot log in to mysql directly through the mysql -u root -p command):

#查看/etc/mysql/debian.cn
$ sudo cat /etc/mysql/debian.cnf

$ mysql -u debian-sys-maint -p
# -> 输入随机密码,如上图

# 重置root密码,及验证插件
$ update mysql.user set authentication_string=PASSWORD('root'), plugin='mysql_native_password' where user='root';

# 刷新权限
$ flush privileges;

# 退出
$ exit;

3. Local installation

navicat: database management tool

After clicking the test connection, it is found that the 2003 error is reported, and it needs to be configured in the remote database

$ mysql -u root -p;
# -> 输入密码

$ use mysql;
# 配置root用户的主机,%虽然表示是任何主机,但是它只是针对于通过TCP/IP连接过来的主机
$ update user set Host='%' where User='root';
$ exit;

$ sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
# 修改43行的bind_address=127.0.0.1为bind_address=0.0.0.0(所有ip都可以访问)

# 重启数据库
$ sudo service mysql restart
# -> navicat重新连接

 filezilla: a tool generally used to connect to servers and manage file transfers

 After installation, open filezilla and connect to your own cloud server

4. Server open port

8001

 5. navicat connection

 

 new database

Run the sql file and refresh the table

6.jar package

Open port number 8001

 

# 用filezilla上传jar包到服务器

# 运行jar包,使用nohup命令运行jar包,后面加上&符号,表示不挂断运行命令,当账户退出或终端关闭时,程序仍然可以运行
$ nohup java -jar visual.jar &

# 查看java进程
$ ps -ef | grep java
# 杀死进程
$ kill -9 pid(进程id)

After the startup is successful, enter http://ip address:8001/swagger-ui.html   in the browser

     ```shell
     # 查看进程结果
     # 进程拥有者-进程id-父进程id-CPU使用的资源百分比-进程开始时间-登入者终端机位置-执行时间-进程的命令和参数
     # mysql     21875   1        0                Dec06      ?          00:00:24 /usr/sbin/mysq...

Supongo que te gusta

Origin blog.csdn.net/weixin_61719769/article/details/129700248
Recomendado
Clasificación