1. Install VMWare virtual machine
VMWare Download: https://www.cr173.com/soft/68480.html
Fool installation: Continue to click Next
To installing permanent use requires a key, there is a lot on Baidu
2. mounted on VM centos7 (installation image)
2.1 Select Typical, click Next
2.2 installation path selection centos
2.3 to your virtual machine a name and set the storage location
2.4 Click Finish
Enter directly
Select Chinese as well as the installation location
Set the root password
Then restart
JDK, Tomcat, MySQL installation
1 Use SecureFX upload JDK, Tomcat archive of linux
2 using SecureCRT installation configuration JDK, Tomcat
An installation configuration JDK
1 . Decompressing compressed JDK
2 . JDK Configuration Environment variables
1 ) VI / etc / Profile
2 ) disposed in the rearmost JDK environment variables:
#java Environment
Export the JAVA_HOME . = / Zking / jdk1 . 8 .0_151 (JDK decompression path)
Export the JRE_HOME = $ {the JAVA_HOME} / JRE
Export the CLASSPATH =:. $ {the JAVA_HOME} / lib: $ {the JRE_HOME} / lib
Export the pATH = $ {the JAVA_HOME} / bin: $ the pATH
. 3 ) set environmental variables
Source / etc / Profile
. 4 ) check the environment variable JDK
Java - Version
3.2 . 2 installation configuration the Tomcat
. 1The decompressor Tomcat
2 configure the environment variables.
. 1 ) VI / etc / Profile
2 ) disposed in the rearmost Tomcat environment variables:
#tomcat
Export the TOMCAT_HOME = / zking / tomcat--Apache 8.5 . 20 is (Tomcat decompression path)
. 3 ) Source / etc / Profile
. 4 ) start Tomcat: ./ the startup.sh
command:
. 1 ) .gz unpack the archive: the tar - zxvf compressed name
2 ) .tar compression decompression: tar -vxf compressed package name
2, install mysql
uninstall mariadb, otherwise there will be conflicts installation MySql
1 RPM -qa | grep MariaDB
2 -e - nodeps RPM file name
rpm -Uvh mysql57-community-release-el7-11.noarch.rpm(mysql源) 或者 yum localinstall mysql57-community-release-el7-8.noarch.rpm cd /etc/yum.repos.d(目录下多了mysql的文件) yum install mysql-community-server(安装mysql) 中途Y/D/N Y service mysqld start(启动服务) systemctl|grep mysql(检测mysql是否正在启动) 开机自启动 systemctl enable mysqld systemctl daemon-reload 默认密码是保存在/var/log/mysqld.log文件中 mysql -u root -p set password=password(‘新密码’); 这是因为密码的规则,设置简单规则 set global validate_password_policy=0 set password=password(‘新密码’); 接下来又是防火墙问题了 以及外网访问权限问题 grant all privileges on *.* to 用户名@'%' identified by '密码'; grant all privileges on *.* to root@'%' identified by 'Xiaoli@2019'; flush privileges; WuTeng@3088 注意:mysql-community.repo这个文件中可以换数据库版本使用。Enabled=1
3、部署web项目
将war包丢到tomcat的webapp下
启动后报错,将db.properties改掉
多处需要注意、防火墙开放端口
开放端口
firewall-cmd --zone=public --add-port=3306/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
1 通过WinSCP将window中下载的JDK的安装包,传输到centos中
首先在centos中创建一个文件夹,用来保存JDK,Tomcat,MySQL等软件安装包
解压,使用命令 tar -axvf 安装包
配置环境变量,需要修改/etc/profile文件,使用命令
Vi /etc/profile,点击insert进入编辑模式:在文件末尾处添加如下内容: export JAVA_HOME=/soft/jdk1.8.0_151 export JRE_HOME=JAVAHOME/jreexportCLASSPATH=.: {JAVA_HOME}/jre export CLASSPATH=.:JAVA H OME/jreexportCLASSPATH=.:{JAVA_HOME}/lib:JREHOME/libexportPATH= {JRE_HOME}/lib export PATH=JRE H OME/libexportPATH={JAVA_HOME}/bin:$PATH
点击esc,然后输入:wq保存退出
使配置文件生效,使用命令 source profile
与安装jdk的步骤与方法大同小异
tomcat安装
使用命令解压
tar -zxvf 安装包名
配置Tomcat,修改catalina.sh文件,文件内容如下
export JAVA_HOME=/soft/jdk1.8.0_151
export JRE_HOME= /soft/jdk1.8.0_151/jre
export TOMCAT_HOME=/soft/apache-tomcat-8.5.20
export CATALINA_HOME=/soft/apache-tomcat-8.5.20
8.可能访问不到,有可能是防火墙的问题,需要设置
(1)将端口8080加入到防火墙中
firewall-cmd --zone=public --add-port=8080/tcp --permanent
(2)更新防火墙规则
firewall-cmd --reload
(3)查看防火墙中已打开的端口
firewall-cmd --zone=public --list-ports
重新访问即可
MySQL安装
将rpm包安装上,使用命令 rpm -Uvh 安装包
如果安装成功,则会在/etc/yum.repos.d会多了两个mysql的repo文件,如下图
打开文件mysql-community.repo,内容如下:
安装MYSQL,使用命令 yum install mysql-community-server
中间会有一个步骤,选择填写Y,回车即可
该过程需要到网络上下去,时间比较久。
出现如下图,则安装完毕
下载完成后,启动服务
命令:service mysqld start
检测mysql是否正在启动
命令:systemctl|grep mysql
默认密码
默认密码是保存在/var/log/mysqld.log文件中,如下图
修改密码
用原密码登录mysql,使用命令:mysql -u root -p,如下图
输入密码,回车
修改命令:set password=password(‘新密码’)
使用Navicat连接Mysql不成功
11.可能是防火墙的原因,需要将3306端口添加到防火墙规则中
(1)将端口3306加入到防火墙中
firewall-cmd --zone=public --add-port=3306/tcp --permanent
(2)更新防火墙规则
firewall-cmd --reload
(3)查看防火墙中已打开的端口
firewall-cmd --zone=public --list-ports
安装成功就可以使用本地的MySQL连接了