首页 > 其他分享 >deb打包

deb打包

时间:2023-01-11 16:36:55浏览次数:31  
标签:opt 0.1 helloworld 打包 deb hello dpkg

方法一: dpkg命令打包

创建一个打包的目录,类似rpmbuild,这里创建了目录deb_build

mkdir  deb_build

目标

我有一个hello的二进制文件hello和源码hello.c, 准备安装到/opt/helloworld目录中

步骤

  1. 在deb_build目录创建一个文件夹用于存放我的安装文件
mkdir helloworld
  1. 在helloworld文件里创建DEBIAN文件夹和opt文件夹
  2. 在DEBIAN文件夹创建一个文件control
  3. 在opt文件夹新建一个helloworld文件夹,存放上hello和hello.c,如下
$ tree helloworld/
helloworld/
├── DEBIAN
│   └── control
└── opt
    └── helloworld
        ├── hello
        └── hello.c

3 directories, 3 files

control文件类似rpm的spec文件,包含deb的包信息

只要把想安装的文件写到对应目录就可以安装到对应的系统目录

这里描述一个最简易的control文件

Package: helloworld
Description: my deb test
Maintainer: username <[email protected]>
Version: 0.1
Architecture: all
  1. 回到deb_build目录,执行dpkg -b helloworld即可在当前目录生成deb包
$ dpkg -b helloworld
dpkg-deb: building package 'hello' in 'helloworld.deb'.

也可以指定dpkg -b hellorld hellorld-0.1-all.deb

$ dpkg -b helloworld helloworld-0.1-all.deb
dpkg-deb: building package 'helloworld' in 'helloworld-0.1-all.deb'.
  1. 安装打好的deb包
$ sudo dpkg -i helloworld-0.1-all.deb 
Selecting previously unselected package helloworld.
(Reading database ... 208913 files and directories currently installed.)
Preparing to unpack helloworld-0.1-all.deb ...
Unpacking helloworld (0.1) ...
Setting up helloworld (0.1) ...

此时/opt/helloworld/hello和hello.c 就安装在/opt/helloworld目录下了

检测安装效果

  • 查看包安装
$ dpkg -l helloworld
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                    Version          Architecture     Description
+++-=======================-================-================-===================================================
ii  helloworld              0.1              all              my deb test
  • 检测/opt/helloworld目录
$ ls /opt/helloworld/
hello  hello.c

$ sudo /opt/helloworld/hello
hello world

标签:opt,0.1,helloworld,打包,deb,hello,dpkg
From: https://www.cnblogs.com/ishmaelwanglin/p/17044160.html

相关文章

  • py文件打包成exe
    将py文件打包成EXE可执行文件一:为什么要打包?众所周知,Python脚本不能在没有安装Python的机器上运行,需打包成可脱离python环境直接运行的.exe文件方便其他同学使用,目前比较......
  • debian11设置开机启动程序
    1.新建内容vim/etc/rc.local写入以下内容#!/bin/bash# #rc.local # #Thisscriptisexecutedattheendofeachmultiuserrunlevel. #Makesurethat......
  • 编译打包rabbitmq然后一键部署的简单方法
    摘要之前总结过一版,但是感觉不太全面想着本次能够将使用中遇到的问题总结一下.所以本次是第二版介质下载rabbitmq不区分介质的打包文件rabbitmq-server-generic-......
  • react-native启动时报错Execution failed for task ':app:checkDebugAarMetadata'
    报错内容如下:FAILURE:Buildfailedwithanexception.*Whatwentwrong:Executionfailedfortask':app:checkDebugAarMetadata'.>Multipletaskactionfailur......
  • 批量将python打包成.so文件(python将py编译成so)
    1首先为什么要将python打包成so文件Python是一种面向对象的解释型计算机程序设计语言,具有丰富和强大的库,使用其开发产品快速高效。python的解释特性是将py编译为独有的二......
  • 使用mui+vue框架做原生app的坑(二) 打包
    怎么打包,这里不赘述,网上有很多教程。  打包成功后,app会出现未加入push功能。    后面查询需要这样配置权限,权限要在manifest......
  • Docker 打包MySQL (带数据源打包) 并加载打包后镜像运行
    前言mysql镜像的数据默认都在/var/lib/mysql目录下,我们修改默认的数据库的数据位置就行,不要放在/var/lib/mysql下面。操作1.创建mysql源数据备份目录mkdir/mysqldata......
  • struct --- 将字节串解读为打包的二进制数据
    面对网络协议,在组包拆包时,python提供了struct模块,可以在python值和C语言的结构体之间相互转换。格式字符串格式字符串的第一个字符可用于指示打包数据的字节顺序,大小和对......
  • debian11 配置samba服务 linux
    一、安装软件包sudoapt-yinstallsambasamba-common二、linux系统添加samba需要用的账户,创建需要共享的文件夹,并配置好权限。(注意共享文件夹最好不要是当前用户主......
  • Debian 11 安装 fcitx5 和中文输入法
    系统:Debian11桌面:Gnome输入法框架:fcitx5输入法:拼音安装:sudoaptinstallfcitx5fcitx5-chinese-addonsgnome-shell-extension-kimpanelim-config-nfcitx5Gnome......