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 2019-04-04 14:41  荣锋亮  阅读(295)  评论(0编辑  收藏  举报

导航