I have an Ubuntu server with the default package list installed. I'd like to uninstall everything that isn’t nginx, its dependencies, and any other packages required to boot to a tty and run nginx.
Is there a way to do this without manually discerning which packages to remove?
Aside: my reason to do this is so the system has as few tools installed as possible in case of exploits in nginx etc.
Edit: I will also need sshd, and sudo… maybe a good answer will point out other things I will likely need.