在Linux上部署Java项目过程

文章目录

1、ps -ef | grep java

bash 复制代码
[root@iZuf6332h890vozldoxcprZ bailian]# ps -ef | grep java
root      192107       1  1 May22 ?        20:38:41 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el9_0.x86_64/bin/java -Xms512m -Xmx512m -Xmn256m -Dnacos.standalone=true -Dnacos.member.list= -Djava.ext.dirs=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el9_0.x86_64/jre/lib/ext:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el9_0.x86_64/lib/ext -Xloggc:/bailian/nacos/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -Dloader.path=/bailian/nacos/plugins/health,/bailian/nacos/plugins/cmdb -Dnacos.home=/bailian/nacos -jar /bailian/nacos/target/nacos-server.jar --spring.config.additional-location=file:/bailian/nacos/conf/ --logging.config=/bailian/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288 nacos.nacos
root      220703       1  0 May22 ?        05:11:06 java -jar bailian-service-base-1.0.0-SNAPSHOT.jar
root      252545       1  0 May22 ?        03:31:45 java -jar bailian-service-app-1.0.0-SNAPSHOT.jar
root     1401323       1  0 Jul11 ?        00:07:10 java -jar bailian-service-main-1.0.0-SNAPSHOT.jar
root     2692454 2542595  0 16:04 pts/0    00:00:00 grep --color=auto java

2、杀死指定的.jar程序

bash 复制代码
[root@iZuf6332h890vozldoxcprZ bailian]# kill 1401323
[root@iZuf6332h890vozldoxcprZ bailian]# ps -ef | grep java
root      192107       1  1 May22 ?        20:38:44 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el9_0.x86_64/bin/java -Xms512m -Xmx512m -Xmn256m -Dnacos.standalone=true -Dnacos.member.list= -Djava.ext.dirs=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el9_0.x86_64/jre/lib/ext:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el9_0.x86_64/lib/ext -Xloggc:/bailian/nacos/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -Dloader.path=/bailian/nacos/plugins/health,/bailian/nacos/plugins/cmdb -Dnacos.home=/bailian/nacos -jar /bailian/nacos/target/nacos-server.jar --spring.config.additional-location=file:/bailian/nacos/conf/ --logging.config=/bailian/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288 nacos.nacos
root      220703       1  0 May22 ?        05:11:07 java -jar bailian-service-base-1.0.0-SNAPSHOT.jar
root      252545       1  0 May22 ?        03:31:46 java -jar bailian-service-app-1.0.0-SNAPSHOT.jar
root     2698202 2542595  0 16:07 pts/0    00:00:00 grep --color=auto java

3、此时再查看java进程

bash 复制代码
[root@iZuf6332h890vozldoxcprZ bailian]# ps -ef | grep java
root      192107       1  1 May22 ?        20:39:00 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el9_0.x86_64/bin/java -Xms512m -Xmx512m -Xmn256m -Dnacos.standalone=true -Dnacos.member.list= -Djava.ext.dirs=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el9_0.x86_64/jre/lib/ext:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el9_0.x86_64/lib/ext -Xloggc:/bailian/nacos/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -Dloader.path=/bailian/nacos/plugins/health,/bailian/nacos/plugins/cmdb -Dnacos.home=/bailian/nacos -jar /bailian/nacos/target/nacos-server.jar --spring.config.additional-location=file:/bailian/nacos/conf/ --logging.config=/bailian/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288 nacos.nacos
root      220703       1  0 May22 ?        05:11:13 java -jar bailian-service-base-1.0.0-SNAPSHOT.jar
root      252545       1  0 May22 ?        03:31:50 java -jar bailian-service-app-1.0.0-SNAPSHOT.jar
root     2744062 2542595  0 16:31 pts/0    00:00:00 grep --color=auto java

4、找到.jar包在linux上存储的位置

bash 复制代码
[root@iZuf6332h890vozldoxcprZ ~]# find / -name *.jar
/bailian/bailian-service-base-1.0.0-SNAPSHOT.jar
/bailian/bailian-service-app-1.0.0-SNAPSHOT.jar
/bailian/bak/bailian-service-main-1.0.0-SNAPSHOT.jar
/bailian/bailian-service-main-1.0.0-SNAPSHOT.jar

5、切换到存放.jar目录

bash 复制代码
[root@iZuf6332h890vozldoxcprZ ~]# cd /bailian/
[root@iZuf6332h890vozldoxcprZ bailian]# ll
total 1626640
-rw-r--r-- 1 root root      29471 May 20 15:50 333.txt
-rw-r--r-- 1 root root  111911562 Aug 24  2023 bailian-service-app-1.0.0-SNAPSHOT.jar
-rw-r--r-- 1 root root  108757893 Aug 15  2023 bailian-service-base-1.0.0-SNAPSHOT.jar
-rw-r--r-- 1 root root  117371177 Jul 11 15:24 bailian-service-main-1.0.0-SNAPSHOT.jar
drwxr-xr-x 2 root root        104 Jul 11 15:23 bak
drwxr-xr-x 3 root root         18 Aug 14  2023 bat
drwxr-xr-x 7 root root         96 Aug  9  2022 nacos
-rw------- 1 root root 1327590305 Jul 12 16:07 nohup.out
drwxr-xr-x 3 root root        114 May 22  2023 template

5、把相应的.jar包放入这个目录

6、启动指定的java程序

bash 复制代码
[root@iZuf6332h890vozldoxcprZ bailian]# nohup java -jar bailian-service-main-1.0.0-SNAPSHOT.jar &
[1] 2749319
[root@iZuf6332h890vozldoxcprZ bailian]# nohup: ignoring input and appending output to 'nohup.out'
相关推荐
森屿Serien2 分钟前
Spring Boot常用注解
java·spring boot·后端
gywl25 分钟前
openEuler VM虚拟机操作(期末考试)
linux·服务器·网络·windows·http·centos
青木沐25 分钟前
Jenkins介绍
运维·jenkins
WTT00111 小时前
2024楚慧杯WP
大数据·运维·网络·安全·web安全·ctf
苹果醋31 小时前
React源码02 - 基础知识 React API 一览
java·运维·spring boot·mysql·nginx
Hello.Reader1 小时前
深入解析 Apache APISIX
java·apache
日记跟新中2 小时前
Ubuntu20.04 修改root密码
linux·运维·服务器
菠萝蚊鸭2 小时前
Dhatim FastExcel 读写 Excel 文件
java·excel·fastexcel
唐小旭2 小时前
服务器建立-错误:pyenv环境建立后python版本不对
运维·服务器·python