IMPORTANT NOTE: The following works for me under Ubuntu. It should work as is under Debian. RPM based distros prevent the auto-start by default, but it may still get you closer to your goal.
In most cases, you want to install it in the
multi-user.target using the install section as follow:
This means the
your-package.postinst script will automatically start the daemon for you.
Note that if you have your own
your-package.postinst script, you have to make sure to include the Debian helper as in:
...your own script here...
#DEBHELPER# pattern, the packager will not add the default code and as a result your daemon won't get enabled and started automatically. The code added there will enable and start the service:
systemctl enable <service-name>
systemctl start <service-name>
unless the service is
static (does not have an
[Install] section as shown above.) A static service requires a special command line to be enabled and that's not available by default:
systemctl add-wants multi-user.target <service-name>
As we can see, the command includes
multi-user.target which the default
#DEBHELPER# (systemd, really) has no clue about unless you have an
The package must also be built with the
systemd extension. This means having the following in your
dh $@ --with systemd --parallel
That should get you set.
Just in case, if you wanted to not start the newly installed service, you can actually prevent such by adding the following:
dh_installsystemd --no-start --no-disable
Mix and match as required by your system.