linux/ubuntu中制作deb安装包

linux/ubuntu中制作deb安装包

由于要制作一个在arm平台上运行的xorg-server-1.12.4版本的安装包,所以需要学习如何制作deb安装包。这里以一个非常小的工程为例,记录制作的过程。

首先需要一个deb包管理系统,如debian、ubuntu等,这里我使用的是ubuntu14.04LTS,这些系统默认安装了deb包制作所需的工具,没有的话后期也可以通过sudo apt-get install来安装。

1 创建一个简单的源码包

ls -l
total 24
-rw-rw-r– 1 mountzf mountzf 73 Jul 8 14:05 helloworld.c
-rw-rw-r– 1 mountzf mountzf 323 Jul 8 14:32 Makefile

#include <stdio.h>

int main()
{
        printf("Hello World!\n");
        return 0;
}

C code的内容与deb包的制作关系不大,这里还是先主要看一下makefile的内容,在制作deb包的时候,makfile是需要修改的。

# Sample makefile.

PROG=helloworld
CC=gcc
BINDIR=/usr/bin
INSTALL=cp

# Compile commands.
$(PROG):helloworld.c
        $(CC) -o $(PROG) helloworld.c

# make clean command.
clean:
        rm -rf $(PROG)

# make install command.
install:
        $(INSTALL) $(PROG) $(BINDIR)

# make uninstall command.
uninstall:
        rm -rf $(BINDIR)/$(PROG)

2 创建GPG key

GPG key在build包的时候需要用到,ubuntu系统中默认已经安装gpg工具,可以gpg --help查看使用方法。这里gpg --gen-key,然后按照提示依次进行即可。由于我是在虚拟机中运行ubuntu,生成密钥时遇到如下问题:

Not enough random bytes available. Please do some other work to give
the OS a chance to collect more entropy! (Need 288 more bytes)

不要慌,翻阅论坛后发现很多

  • 2
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值