All of which is possible by creating a package for existing package managers. It's how I tend to manage services: I build packages that depend on the other packages I need, and that uses post-install hooks to orchestrate the connections between various services, or replaces config files.
The level of support for cleanly handling things like replacing config files vary between package managers, but I've done this easily enough with both dpkg and rpm.