ubuntu deb pacakge 开发

安装构建工具

apt-get install pbuilder
  • 推荐安装
sudo apt-get install build-essential autoconf automake \
autotools-dev dh-make debhelper devscripts fakeroot \
xutils lintian pbuilder

简单项目

  • 创建包目录
mkdir helloworld && mkdir helloworld/DEBIAN
  • 创建一个简单的包执行文件

    一个简单的shell app

#!/bin/bash

echo "dalongdemo"
  • copy 包依赖的文件
mkdir -p helloworld/usr/local/bin
cp app.sh helloworld/usr/local/bin/
  • 创建control 文件

    helloworld/DEBIAN/control

Package: helloworld
Version: 0.1
Maintainer: dalongrong
Architecture: all
Description: hello world

打包deb package

  • 使用dpkg-deb 命令
dpkg-deb --build helloworld/

效果

dpkg-deb --build helloworld/
dpkg-deb: building package 'helloworld' in 'helloworld.deb'.

安装测试包

  • 安装包
dpkg -i helloworld.deb

效果

dpkg -i helloworld.deb
Selecting previously unselected package helloworld.
(Reading database ... 115327 files and directories currently installed.)
Preparing to unpack helloworld.deb ...
Unpacking helloworld (0.1) ...
Setting up helloworld (0.1) ...
  • 执行安装的命令
app 

效果

app
dalongdemo

说明

这是一个很简单的deb 包的创建,与rpm 包相比,是比较简单,使用上使用checkinstall 生成deb 包更简单,只需要按照提示操作就可以了,后边会有
一个打包pg 扩展的方法介绍

参考资料

http://www.king-foo.com/2011/11/creating-debianubuntu-deb-packages/

posted on   荣锋亮  阅读(299)  评论(0编辑  收藏  举报

编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2017-04-04 lua resty template && openresty 使用
2017-04-04 jekyll 安装使用

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示