How to create meta-package

Create simplest possible meta-package to install multiple software packages at once and quickly setup familiar environment.

Install equivs utility.

$ sudo apt-get install equivs

Create configuration file for meta-package.

$ equivs-control my-terminal-utilities

Inspect created configuration template.

$ cat my-terminal-utilities
### Commented entries have reasonable defaults.
### Uncomment to edit them.
# Source: <source package name; defaults to package name>
Section: misc
Priority: optional
# Homepage: <enter URL here; no default>
Standards-Version: 3.9.2

Package: <package name; defaults to equivs-dummy>
# Version: <enter version here; defaults to 1.0>
# Maintainer: Your Name <[email protected]>
# Pre-Depends: <comma-separated list of packages>
# Depends: <comma-separated list of packages>
# Recommends: <comma-separated list of packages>
# Suggests: <comma-separated list of packages>
# Provides: <comma-separated list of packages>
# Replaces: <comma-separated list of packages>
# Architecture: all
# Multi-Arch: <one of: foreign|same|allowed>
# Copyright: <copyright file; defaults to GPL2>
# Changelog: <changelog file; defaults to a generic changelog>
# Readme: <README.Debian file; defaults to a generic one>
# Extra-Files: <comma-separated list of additional files for the doc directory>
# Files: <pair of space-separated paths; First is file to include, second is destination>
#  <more pairs, if there's more than one file to include. Notice the starting space>
Description: <short description; defaults to some wise words>
 long description and info
 .
 second paragraph

Modify configuration file to reflect meta-package dependencies.

$ cat my-terminal-utilities
Section: misc
Priority: optional
Standards-Version: 3.9.2
Version: 1.0+artificial
Package: my-terminal-utilities
Depends: git, tmux, vim, ncdu, htop, curl, jq, httpie
Description: essential terminal utilities
 several useful utilities

Build meta-package.

$ equivs-build my-terminal-utilities
dh_testdir
dh_testroot
dh_prep
dh_testdir
dh_testroot
dh_install
dh_install: Compatibility levels before 9 are deprecated (level 7 in use)
dh_installdocs
dh_installdocs: Compatibility levels before 9 are deprecated (level 7 in use)
dh_installchangelogs
dh_compress
dh_fixperms
dh_installdeb
dh_installdeb: Compatibility levels before 9 are deprecated (level 7 in use)
dh_gencontrol
dh_md5sums
dh_builddeb
dpkg-deb: building package 'my-terminal-utilities' in '../my-terminal-utilities_1.0+artificial_all.deb'.

The package has been created.
Attention, the package has been created in the current directory,
not in ".." as indicated by the message above!

Install created package.

$ sudo dpkg -i my-terminal-utilities_1.0+artificial_all.deb
(Reading database ... 27051 files and directories currently installed.)
Preparing to unpack my-terminal-utilities_1.0+artificial_all.deb ...
Unpacking my-terminal-utilities (1.0+artificial) over (1.0+artificial) ...
dpkg: dependency problems prevent configuration of my-terminal-utilities:
 my-terminal-utilities depends on git; however:
  Package git is not installed.
 my-terminal-utilities depends on tmux; however:
  Package tmux is not installed.
 my-terminal-utilities depends on ncdu; however:
  Package ncdu is not installed.
 my-terminal-utilities depends on htop; however:
  Package htop is not installed.
 my-terminal-utilities depends on jq; however:
  Package jq is not installed.
 my-terminal-utilities depends on httpie; however:
  Package httpie is not installed.

dpkg: error processing package my-terminal-utilities (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 my-terminal-utilities

Resolve dependencies.

$ sudo apt-get --fix-broken install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  git git-man htop httpie jq libcurl3-gnutls liberror-perl libevent-2.0-5 libjq1 libonig4 libpopt0
  libpython-stdlib libutempter0 ncdu python python-cffi-backend python-chardet python-cryptography
  python-enum34 python-idna python-ipaddress python-minimal python-openssl python-pkg-resources
  python-pyasn1 python-pygments python-requests python-setuptools python-six python-urllib3 python2.7
  python2.7-minimal rsync tmux
Suggested packages:
  git-daemon-run | git-daemon-sysvinit git-doc git-el git-email git-gui gitk gitweb git-arch git-cvs
  git-mediawiki git-svn lsof strace python-doc python-tk python-cryptography-doc
  python-cryptography-vectors python-enum34-doc python-openssl-doc python-openssl-dbg doc-base
  ttf-bitstream-vera python-socks python-setuptools-doc python-ntlm python2.7-doc binfmt-support
The following NEW packages will be installed:
  git git-man htop httpie jq libcurl3-gnutls liberror-perl libevent-2.0-5 libjq1 libonig4 libpopt0
  libpython-stdlib libutempter0 ncdu python python-cffi-backend python-chardet python-cryptography
  python-enum34 python-idna python-ipaddress python-minimal python-openssl python-pkg-resources
  python-pyasn1 python-pygments python-requests python-setuptools python-six python-urllib3 python2.7
  python2.7-minimal rsync tmux
0 upgraded, 34 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 11.0 MB of archives.
After this operation, 49.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
[...]
Setting up python-chardet (2.3.0-2) ...
Setting up python-cryptography (1.7.1-3) ...
Setting up python-requests (2.12.4-1) ...
Setting up httpie (0.9.8-1) ...
Setting up python-openssl (16.2.0-1) ...
Setting up my-terminal-utilities (1.0+artificial) ...
Processing triggers for libc-bin (2.24-11+deb9u1) ...

Verify that meta-package is marked as installed.

$ apt-cache policy my-terminal-utilities
my-terminal-utilities:
  Installed: 1.0+artificial
  Candidate: 1.0+artificial
  Version table:
 *** 1.0+artificial 100
        100 /var/lib/dpkg/status

Verify that dependencies are installed (requires apt-rdepends package as described earlier).

$ apt-rdepends --print-state --state-follow=none my-terminal-utilities
Reading package lists... Done
Building dependency tree       
Reading state information... Done
my-terminal-utilities
  Depends: curl [Installed]
  Depends: git [Installed]
  Depends: htop [Installed]
  Depends: httpie [Installed]
  Depends: jq [Installed]
  Depends: ncdu [Installed]
  Depends: tmux [Installed]
  Depends: vim [Installed]

About Milosz Galazka

Milosz is a Linux Foundation Certified Engineer working for a successful Polish company as a system administrator and a long time supporter of Free Software Foundation and Debian operating system.