[Debian][Package][自分用メモ] Debパッケージを自作する方法。

AIX、UNIX、Linux

意外に簡単!Debパッケージを自作する方法

全然関係ないのですが、PowerDNS recursorの4.0.0rc1が出たので、ARM板でコンパイルしようとしたらメモリが足りない状況に泣かされています。

そこで解決する方法として、メモリが潤沢な別のARM板でdebパッケージを作成し配布すれば良いということに気がついたので、実際にやってみました。

手順

関連パッケージの導入

$ sudo apt-get install build-essential checkinstall

PowerDNSの関連パッケージの導入

$ sudo apt-get install libboost-dev protobuf-compiler libprotoc-dev libprotobuf-dev libsystemd-dev liblua5.2-dev libssl-dev

PowerDNSパッケージのダウンロード

$ sudo wget https://downloads.powerdns.com/releases/pdns-recursor-4.0.0-rc1.tar.bz2

PowerDNSパッケージの展開

$ sudo tar jxf pdns-recursor-4.0.0-rc1.tar.bz2
$ cd pdns-recursor-4.0.0-rc1/

環境設定

$ sudo ./configure --sysconfdir=/etc/powerdns --enable-systemd
configure:
configure: Configuration summary
configure: =====================
configure:
configure: PowerDNS Recursor configured with:  '--sysconfdir=/etc/powerdns' '--enable-systemd'
configure:
configure: CC: gcc
configure: CXX: g++
configure: LD: /usr/bin/ld
configure: CFLAGS: -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 --param ssp-buffer-size=4 -fstack-protector -Wall -g -O2
configure: CPPFLAGS:
configure: CXXFLAGS:  -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 --param ssp-buffer-size=4 -fstack-protector -Wall -g -O2 -std=gnu++11
configure: LDFLAGS: -Wl,-z -Wl,relro -Wl,-z -Wl,now
configure: LIBS:
configure:
configure: BOOST_CPPFLAGS:
configure:
configure: Lua support: lua5.2
configure: Protobuf support: yes
configure: systemd support: yes
configure:

ビルド

$ sudo make

Debパッケージの作成

$ sudo checkinstall --install=no

とりあえずエンターを押します。

checkinstall 1.6.2, Copyright 2009 Felipe Eduardo Sanchez Diaz Duran
This software is released under the GNU GPL.

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

とりあえずエンターを押します。

Preparing package documentation...OK

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

以下のように編集します。

This package will be built according to these values:

0 -  Maintainer: [ [email protected] ]
1 -  Summary: [ Package created with checkinstall 1.6.2 ]
2 -  Name:    [ pdns-recursor ]
3 -  Version: [ 4.0.0rc1 ]
4 -  Release: [ 1 ]
5 -  License: [ GPL ]
6 -  Group:   [ checkinstall ]
7 -  Architecture: [ armhf ]
8 -  Source location: [ pdns-recursor-4.0.0-rc1 ]
9 -  Alternate source location: [  ]
10 - Requires: [ libboost-dev,protobuf-compiler,libprotoc-dev,libprotobuf-dev,libsystemd-dev,liblua5.2-dev ]
11 - Provides: [ pdns-recursor-4.0.0 ]
12 - Conflicts: [  ]
13 - Replaces: [  ]

Enter a number to change any of them or press ENTER to continue:

確認

以下のように表示されれば、所定の場所にパッケージが作成されています。

**********************************************************************

Done. The new package has been saved to

/usr/local/src/pdns-recursor-4.0.0-rc1/pdns-recursor_4.0.0rc1-1_armhf.deb
You can install it in your system anytime using:

dpkg -i pdns-recursor_4.0.0rc1-1_armhf.deb

**********************************************************************

ただし、これではユーザーやグループは作成されません。
この件については調査中です。もしご存じの方がいればご教示ください。

この記事を書いた人

kometchtech

うつ病を患いながら、IT業界の末席にいるおっさんエンジニア。科学計算をしたことがないのに、HPC分野にお邪魔している。興味のある分野で学習したことをblogにまとめつつ、うつ病の経過症状のメモも置いておく日々。じつはRouterboard User Group JPの中の人でもある。 Amazon欲しいものリスト / Arm板を恵んでくれる人募集中

kometchtechをフォローする
タイトルとURLをコピーしました