源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

Spring boot部署发布到linux的操作方法

  • 时间:2021-02-04 04:00 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:Spring boot部署发布到linux的操作方法
[b]限制条件:[/b] The default script supports most Linux distributions and is tested on CentOS and Ubuntu. Other platforms, such as OS X and FreeBSD, will require the use of a custom embeddedLaunchScript. 当前文档适用于 CentOS and Ubuntu,其他平台需要定制脚本 [b]1、部署发布[/b] [b]1.1 打包[/b] maven打包成执行文件
<plugin>
 <groupId>org.springframework.boot</groupId>
 <artifactId>spring-boot-maven-plugin</artifactId>
 <configuration>
  <executable>true</executable>
 </configuration>
</plugin> 
Gradle设置
springBoot {
 executable = true
} 
You can then run your application by typing ./my-application.jar (where my-application is the name of your artifact). 打包完成后,可以使用./my-application.jar 运行  [b]1.2 原理[/b] linux下查看文件格式为一个bshell可执行文件
[root@i-2cjt6k6n ~]# file audit-console-1.0.0.jar
audit-console-1.0.0.jar: Bourne-Again shell script text executable 
查看文件内容
vi audit-console-1.0.0.jar
文件开头: [img]http://files.jb51.net/file_images/article/201711/2017112410550018.jpg[/img] shell与执行jar内容的分割: [img]http://files.jb51.net/file_images/article/201711/2017112410550019.png[/img] 可以看到,非常高的技巧,jar包包装为shell可执行文件,另外可以加载自己运行  [b]1.3 发布为一个服务[/b]
 ln -s /var/myapp/myapp.jar /etc/init.d/myapp
service myapp start
[b]总结[/b] 以上所述是小编给大家介绍的Spring boot部署发布到linux的操作方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对编程素材网网站的支持!
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部