Create a .deb for private use
This page provides a minimal set of steps to create a .deb file you can install on your local computer. To create packages robust enough to install on other computers, see Packaging.
First, create a directory for your package to go in:
mkdir -p mypackage
Then add some files for your package:
mkdir -p mypackage/usr/bin
cat > mypackage/usr/bin/myprogram.sh <<EOF
#!/bin/sh
echo "Hello, World!"
EOF
chmod 755 mypackage/usr/bin/myprogram.sh
sudo chown root:root mypackage/usr/bin/myprogram.sh
Then add some Debian metadata:
mkdir -p mypackage/DEBIAN
cat > mypackage/DEBIAN/control <<EOF
Package: mypackage
Architecture: all
Version: 1.0
Section: misc
Maintainer: Local user <root@localhost>
Priority: optional
Standards-Version: 4.7.0
Description: My package
EOF
Finally, build and test your package:
dpkg-deb -b mypackage
sudo dpkg -i mypackage.deb
myprogram.sh
sudo dpkg --remove mypackage
You can now use mypackage.deb like any other package! But it might break in surprising ways, because it lacks features you take for granted in packages reviewed by Debian. To learn how to create proper packages, see Packaging.
Better solutions in the real world
Creating a Debian package with dpkg-deb is like creating a Word document with zip - the underlying format works that way, but people use higher-level interfaces for a reason.
equivs is more advanced than dpkg-deb but not as complicated as git. For example, it uses a normal lowercase debian/ directory instead of dpkg-deb's DEBIAN/, lets you put scripts in your control file that run during package installation and removal, and requires you to specify the location each file should be installed in.
