简体   繁体   中英

How to create mongodb package to install with apt-get on Ubuntu?

I'm building MongoDb from the sources ( https://github.com/mongodb/mongo.git ) and now want to package it as a .deb package such that I can install it on other Ubuntu machines using apt-get. Building it on Ubuntu 12.04.4 x64 is not the problem, but I cannot figure out how to create a .deb package from it.

The 'debian' directory in the checkout from git contain .rules and .control files but what command(s) must I invoke to create a package for the mongodb-enterprise version? Since all control files seem to be present I'd assume it's a matter of just running a command, but I cannot find it in the documentation or on the mongodb website. Also read the documenatation that TeTeT mentioned in the comments, but then I'd need to start form scratch to create the package and all that is needed already seems to be part of the 'debian' directory... just can figure out how to use it to build the package.

I did try using the dh_builddeb command, but that reported that the .control files is not a debian format archive.

The 'debian' directory contains the following files:

root@buildmongo:/mongobuild/mongo# ls -l debian/
total 424
-rw-r--r-- 1 root root  4001 Jul 25 16:12 bsondump.1
-rw-r--r-- 1 root root  5077 Jul 25 16:12 changelog
-rw-r--r-- 1 root root     2 Jul 25 16:12 compat
-rw-r--r-- 1 root root   483 Jul 25 16:12 copyright
-rw-r--r-- 1 root root    33 Jul 25 16:12 dirs
-rw-r--r-- 1 root root    39 Jul 25 16:12 files
-rw-r--r-- 1 root root  8216 Jul 25 16:12 init.d
-rw-r--r-- 1 root root   891 Jul 25 16:12 lintian-overrides
-rw-r--r-- 1 root root 16595 Jul 25 16:12 mongo.1
-rw-r--r-- 1 root root 39099 Jul 25 16:12 mongod.1
-rw-r--r-- 1 root root  1693 Jul 25 16:12 mongod.conf
-rw-r--r-- 1 root root  1676 Jul 25 16:12 mongod.upstart
-rw-r--r-- 1 root root   154 Jul 25 16:12 mongodb-enterprise-server.docs
-rw-r--r-- 1 root root  1441 Jul 25 16:12 mongodb-enterprise-server.postinst
-rw-r--r-- 1 root root   154 Jul 25 16:12 mongodb-enterprise-unstable-server.docs
-rw-r--r-- 1 root root  1441 Jul 25 16:12 mongodb-enterprise-unstable-server.postinst
-rw-r--r-- 1 root root 14760 Jul 25 16:12 mongodb-enterprise-unstable.control
-rw-r--r-- 1 root root  4524 Jul 25 16:12 mongodb-enterprise-unstable.rules
-rw-r--r-- 1 root root 14845 Jul 25 16:12 mongodb-enterprise.control
-rw-r--r-- 1 root root  4226 Jul 25 16:12 mongodb-enterprise.rules
-rw-r--r-- 1 root root  1441 Jul 25 16:12 mongodb-org-server.postinst
-rw-r--r-- 1 root root  1441 Jul 25 16:12 mongodb-org-unstable-server.postinst
-rw-r--r-- 1 root root 14704 Jul 25 16:12 mongodb-org-unstable.control
-rw-r--r-- 1 root root  4345 Jul 25 16:12 mongodb-org-unstable.rules
-rw-r--r-- 1 root root 14839 Jul 25 16:12 mongodb-org.control
-rw-r--r-- 1 root root  4049 Jul 25 16:12 mongodb-org.rules
-rw-r--r-- 1 root root 16840 Jul 25 16:12 mongodump.1
-rw-r--r-- 1 root root 19099 Jul 25 16:12 mongoexport.1
-rw-r--r-- 1 root root 14153 Jul 25 16:12 mongofiles.1
-rw-r--r-- 1 root root 16065 Jul 25 16:12 mongoimport.1
-rw-r--r-- 1 root root 13347 Jul 25 16:12 mongooplog.1
-rw-r--r-- 1 root root  5825 Jul 25 16:12 mongoperf.1
-rw-r--r-- 1 root root 16644 Jul 25 16:12 mongorestore.1
-rw-r--r-- 1 root root 23535 Jul 25 16:12 mongos.1
-rw-r--r-- 1 root root  5388 Jul 25 16:12 mongosniff.1
-rw-r--r-- 1 root root 15941 Jul 25 16:12 mongostat.1
-rw-r--r-- 1 root root 12415 Jul 25 16:12 mongotop.1
-rw-r--r-- 1 root root   932 Jul 25 16:12 postrm
-rw-r--r-- 1 root root   692 Jul 25 16:12 preinst
-rw-r--r-- 1 root root   894 Jul 25 16:12 prerm
-rw-r--r-- 1 root root   329 Jul 25 16:12 watch

(I'm building MongoDb because I need SSL support and do not need a support contract with Mongo. If I understand it correct you can only use the enterprise version (supports SSL) downloaded from the mongodb site if you signup for a support contract. )

Regards, Gero

Upstream packaging is rarely better than maintainer's one so I would get source package from Debian :

apt-get install devscripts
dget -ux http://http.debian.net/debian/pool/main/m/mongodb/mongodb_2.4.10-2.dsc
cd mongodb-2.4.10/
## install Build-Depends (extracted from "debian/control"):
sudo apt-get install debhelper dh-systemd libboost-date-time-dev libboost-dev libboost-filesystem-dev libboost-program-options-dev libboost-thread-dev libgoogle-perftools-dev libpcap-dev libpcre3-dev libreadline-dev libsnappy-dev libstemmer-dev libssl-dev libv8-dev python-pymongo scons
debuild -uc -b

I'm with Debian so I did not test the above procedure on Ubuntu (which I don't recommend).
If package did not build (due to lack of build dependencies etc.) then you may choose a different suite from the following page

and try to fetch an older DSC file.
Good luck.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM