This is just an example/playground for packaging a Rust app as a .deb package (using cargo-deb) which also contains a (systemd) service that automatically starts the app once the .deb package is installed.
Requires Rust 1.31+, and optionally dpkg
, ldd
and liblzma-dev
. Compatible with Ubuntu.
Once you clone the repo do:
cargo build && cargo deb
sudo dpkg -i target/debian/hello-world_0.1.0_amd64.deb
It will install a hello
binary under /usr/bin/
and also a hello.service
under
/lib/systemd/system/
. Once installed the service will be enabled and started.
You can see the status using:
sudo systemctl status hello
systemctl is a wrapper around systemd services so it offers many goodies (stop/restart etc).
To see the logs you can use the journalctl:
sudo journalctl -u hello.service
In order to completely remove the binary and the systemd all you need to do is:
sudo dpkg --purge hello-world