步驟:
1.掛載磁盤
2.安裝jdk1.8
3.安裝mysql5.7
4.導(dǎo)入數(shù)據(jù)庫
5.防火墻端口放行
5.運(yùn)行jar文件
1.掛載磁盤
http://www.rzrgm.cn/xiang96/p/10240207.html
2.安裝jdk1.8
http://www.rzrgm.cn/lysc/p/12522959.html
3.安裝mysql5.7
http://www.rzrgm.cn/lysc/p/12522940.html
4.導(dǎo)入數(shù)據(jù)庫
1、首先建空數(shù)據(jù)庫
mysql>create database dbname charset=utf8;
2、導(dǎo)入數(shù)據(jù)庫
方法一(終端登陸mysql后):
(1)選擇數(shù)據(jù)庫
mysql>use dbname ;
(2)設(shè)置數(shù)據(jù)庫編碼
mysql>set names utf8;
(3)導(dǎo)入數(shù)據(jù)(注意sql文件的路徑)
mysql>source /home/xxxx/dbname .sql;
方法二(終端直接輸入):
mysql -u用戶名 -p密碼 數(shù)據(jù)庫名 < 數(shù)據(jù)庫名.sql (注意sql文件的路徑)
5.防火墻端口放行
firewall-cmd --permanent --add-port=8080/tcp
firewall-cmd --permanent --add-port=3306/tcp
5.運(yùn)行jar文件
執(zhí)行 cd 文件夾路徑 命令進(jìn)入jar包所在文件夾
后臺(tái)運(yùn)行jar包:執(zhí)行 nohup java -jar ***.jar &(nohub 表示后臺(tái)不掛斷運(yùn)行)
如需將日志輸出到指定文件,在&前面加上>***.log ,如下:nohup java -jar test-admin.jar >out.log &
命令匯總
開啟數(shù)據(jù)庫:systemctl start mysqld.service
關(guān)閉數(shù)據(jù)庫:systemctl stop mysqld.service
重啟數(shù)據(jù)庫:systemctl restart mysqld.service
數(shù)據(jù)庫狀態(tài):systemctl status mysqld.service
啟動(dòng)防火墻:systemctl start firewalld
停止防火墻: systemctl disable firewalld
禁用防火墻:systemctl stop firewalld
重啟防火墻:systemctl restart firewalld或者firewall-cmd --reload
防火墻狀態(tài):systemctl status firewalld
查看端口:netstat -lnp|grep 80
開啟端口:firewall-cmd --permanent --add-port=80/tcp (--permanent代表永久生效不需重啟)
firewall-cmd --zone=public --add-port=80/tcp --permanent
查看端口是否開啟:firewall-cmd --query-port=80/tcp
查看開啟的端口:firewall-cmd --list-port
查看進(jìn)程:ps -ef|grep java
結(jié)束進(jìn)程:kill -9 PID
Linux啟動(dòng)jar(nohub 表示后臺(tái)不掛斷運(yùn)行):nohup java -jar ***.jar &
啟動(dòng)jar包,日志輸出到指定文件:nohup java -jar ***.jar >***.log &
浙公網(wǎng)安備 33010602011771號(hào)