linux ded编译,重新编译deb包

debian/ubuntu 是高度自动化的Linux系统,编译源码包也不例外。

首选需要确保你的sources.list 包含src 源

例如:

deb-src http://http.us.debian.org/debian stable main contrib non-free

如果你刚刚在source.list里添加了上面那行,请运行下面的命令清除缓存

apt-get clean all

安装编译环境

apt-get install dpkg-dev devscripts build-essential

以软件包nginx为例

1、建立一个临时目录

mkdir -p /usr/src/nginx

cd /usr/src/nginx

2、下载源码,并编译软件包

apt-get source nginx

apt-get build-dep nginx

3、修改编译参数,并重新编译

cd nginx-*/debian

nano rules

cd ../../nginx-*/

dpkg-buildpackage -us -uc

4、生成的deb包位于当前目录

dpkg-deb: building package `nginx' in `../nginx_1.6.2-1~precise_amd64.deb'.

dpkg-deb: building package `nginx-debug' in `../nginx-debug_1.6.2-1~precise_amd64.deb'.

dpkg-genchanges  >../nginx_1.6.2-1~precise_amd64.changes

dpkg-genchanges: including full source code in upload

dpkg-source --after-build nginx-1.6.2

dpkg-buildpackage: full upload (original source is included)

5、保留文件,以ubuntu precise 为例

nginx_1.6.2-1~precise.debian.tar.gz

nginx_1.6.2.orig.tar.gz

6、将上述两个文件移动到另外一台机器

mkdir build

cp nginx_1.6.2-1~precise.debian.tar.gz build/

cp nginx_1.6.2.orig.tar.gz

tar zxvf nginx_1.6.2.orig.tar.gz

tar zxvf nginx_1.6.2-1~precise.debian.tar.gz -C nginx-1.6.2

cd nginx-1.6.2

dpkg-buildpackage -us -uc

这样就完成了移植性。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值