ubuntu上利用 checkinstall/dpkg 制作/安装/卸载deb或rpm包

1.安装checkinstall

sudo apt-get install checkinstall

 

2.编译源码

    通常的源码编译需要经过configure或cmake,之后再通过make编译。

configure or cmake

make

 

3.打包

    make后执行

sudo checkinstall

随后跟随系统提示操作:

第一步,是否生成文档,选"yes"

The package documentation directory ./doc-pak does not exist. 
Should I create a default set of package docs? [y]:

第二步,输入包描述

Please write a description for the package.
End your description with an empty line or EOF.
>> i am description
>> 

第三步,修改包信息

This package will be built according to these values:

0 - Maintainer: [ root@tegra-ubutnu ]
1 - Summary: [ i am the summary ]
2 - Name: [ name ]
3 - Version: [  ]
4 - Release: [ 1 ]
5 - License: [ GPL ]
6 - Group: [ checkinstall ]
7 - Architecture: [ amd64 ]
8 - Source location: [ nameofthesrc ]
9 - Alternate source location: [ ]
10 - Requires: [ ]
11 - Provides: [ command ]
12 - Conflicts: [ ]
13 - Replaces: [ ]

需要记住的是,3 - Version 后面的字段不能为空,否则会失败。

以arm上的opencv为例,下面是我的包描述信息:

0 -  Maintainer: [ root@tegra-ubuntu ]
1 -  Summary: [ opencv2.4. ]
2 -  Name:    [ opencv ]
3 -  Version: [ 2.4.13 ]
4 -  Release: [ arm ]
5 -  License: [ GPL ]
6 -  Group:   [ checkinstall ]
7 -  Architecture: [ armhf ]
8 -  Source location: [ build ]
9 -  Alternate source location: [  ]
10 - Requires: [  ]
11 - Provides: [ build ]
12 - Conflicts: [  ]
13 - Replaces: [  ]

随后回车即可得到包:opencv_2.4.13-arm_armhf.deb

4.安装

在新的arm机器上输入dpkg指令安装opencv包

sudo dpkg -i opencv_2.4.13-arm_armhf.deb

dpkg指令说明:

dpkg -i name.deb     #安装软件包
dpkg -I name.deb     #从包里获取deb包的信息
dpkg -i name.deb     #移出所安装的软件包,名字可以通过查看包信息得到
dpkg -c name.deb     #查看包内的内容,看起来就跟压缩包一样
dpkg -s name.deb     #查看已安装的包裹信息
dpkg -r name.deb     #删除一个已安装的包裹
dpkg -P name.deb     #删除一个已安装的包裹,包括配置文件

 

posted @ 2017-04-28 21:06  pry_up  阅读(3633)  评论(0编辑  收藏  举报