- jdk&tomcat安装
- MySQL安装
- 后端接口部署
- linux单体项目前端部署
1.jdk&tomcat安装
上传jdk、tomcat安装包
解压两个工具包
#解压tomcat
tar -zxvf apache-tomcat-8.5.20.tar.gz
#解压jdk
tar -zxvf jdk-8u151-linux-x64.tar.gz
配置并且测试jdk安装
#配置环境变量
vim /etc/profile
#java environment
export JAVA_HOME=/javaxl/software/jdk1.8.0_151/
** /javaxl/software/jdk1.8.0_151/ 是你在MobaXterm软件里的路径**
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
#设置环境变量生效
source /etc/profile
启动tomcat
./start.sh
5.防火墙设置
#开放端口
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --zone=public --add-port=8080/tcp --permanent
#跟新防火墙规则
firewall-cmd --reload
#防火墙列表
firewall-cmd --zone=public --list-ports
#防火墙状态
systemctl status firewalld
#启动防火墙
systemctl start firewalld
#关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
#打开防火墙
systemctl enable firewalld.service
2. MySQL安装
#卸载mariadb,否则安装MySql会出现冲突(先查看后删除再查看)
[root@192 ~]# rpm -qa|grep mariadb
mariadb-libs-5.5.56-2.el7.x86_64
[root@192 ~]# rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64
[root@192 ~]# rpm -qa|grep mariadb
#在线下载MySQL安装包(也可提前下载好上传)
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.35-1.el7.x86_64.rpm-bundle.tar
#3.将MySQL安装包解压到指定目录
mkdir mysql-5.7
tar -xvf mysql-5.7.35-1.el7.x86_64.rpm-bundle.tar -C mysql-5.7
#开始安装,-ivh 其中i表示安装,v表示显示安装过程,h表示显示进度
cd mysql-5.7
rpm -ivh mysql-community-common-5.7.35-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.35-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.35-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.35-1.el7.x86_64.rpm
//复制 rpm -ivh 再用tab键补全
#启动MySQL服务
systemctl start mysqld
#登录mysql修改密码
[root@192 mysql-5.7]# grep "password" /var/log/mysqld.log
2022-10-12T13:19:16.313408Z 1 [Note] A temporary password is generated for root@localhost: o8N#/CfWD+sh
[root@192 mysql-5.7]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
#设置密码校验策略(0 or LOW),要不密码太LOW不让你过
set global validate_password_policy=0;
#设置密码校验长度,要不密码太短不让你过(多次测试发现密码最小长度为4位)
set global validate_password_length=4;
#更新密码
set password = password("123456");
#输入后使修改生效还需要下面的语句
FLUSH PRIVILEGES;
#可以退出,试试用新密码重新登录
exit 或:use mysql;进入数据库
#Centos7下无法远程连接mysql数据库
#数据库没有授权,允许以root身份远程登录mysql
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
#输入后使修改生效还需要下面的语句
FLUSH PRIVILEGES;
#Navicat链接MySQL测试
#查看MySQL版本
rpm -qa | grep mysql
3.后台项目部署
#启动后台项目测试
http://localhost:8080/ssm/wx/user.index
#maven install将项目打包
#将打包好的项目放入tomcat/webapps/
#启动tomcat
./start.sh
#浏览器测试
http://192.168.195.139:8080/ssm/wx/user.index
3.linux单体项目前端部署