javaweb项目部署测试
测试环境:centos7
下载安装jdk
rpm -ivh jdk-8u131-linux-x64.rpm
下载安装MySQL
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-community-server-5.7.33-1.el7.x86_64.rpm https://downloads.mysql.com/archives/get/p/23/file/mysql-community-client-5.7.33-1.el7.x86_64.rpm https://downloads.mysql.com/archives/get/p/23/file/mysql-community-common-5.7.33-1.el7.x86_64.rpm https://downloads.mysql.com/archives/get/p/23/file/mysql-community-libs-5.7.33-1.el7.x86_64.rpm --no-check-certificate
rpm -e mariadb-libs --nodeps
rpm -ivh mysql-community*
systemctl start mysqld
#查看mysql初始密码
grep 'temporary password' /var/log/mysqld.log
mysql -u root -p
#输入密码后修改密码
alter user 'root'@'localhost' identified by 'Root@123';
修改密码为‘ok’
修改MySQL配置文件
vim /etc/my.cnf
添加
skip-grant-tables
重启MySQL
systemctl restart mysqld
mysql -uroot -p
直接进入设置密码
update mysql.user
set authentication_string=password('ok')
where user='root' and host='localhost';
重启MySQL
下载安装tomcat
wget https://dlcdn.apache.org/tomcat/tomcat-8/v8.5.99/bin/apache-tomcat-8.5.99.tar.gz --no-check-certificate
tar xvf /opt/javaweb/apache-tomcat-8.5.99.tar.gz -C /usr/local/tomcat
mv /usr/local/tomcat/apache-tomcat-8.5.99 /usr/local/tomcat/tomcat8
sh /usr/local/tomcat/tomcat8/bin/startup.sh
下载好项目exam.war examdb.sql到/usr/local/tomcat/tomcat8/webapps
导入数据库
mysql -uroot -p <examdb.sql
关闭防火墙
systemctl stop firewalld
访问网页
192.168.101.127:8080/exam
创建定时任务,每两分钟备份一次examdb数据库
crontab -e
*/2 * * * * mysqldump -uroot -p examdb > /opt/examdb.sql
systemctl restart crond