Let me try to help. I welcome clarifications from others or clarifying questions from you.
1. The sudo command (in Linux, Unix, macOS) is used by a non-root user to temporarily elevate to having root privileges, to get something done.
That's safer than logging in and running literally as the root user, as you could do things by mistake which could have wide-ranging impact, or you could fall victim to a vuln that now also would have that impact.
Of course, for an account to be able to DO that sudo command (or the related su), their account must be given that privilege by someone running as root (or already defined in sudoers).
2. If it helps, the corollary in Windows is the "administrator" account, and how another account can be put in the Administrators group. One COULD just login as administrator, or by being in the admin group you may have noticed windows offer the option to temporarily elevate your privileges to perform some operation.
(Also, FWIW, recent Windows versions even now allow one to enable sudo as a command, so you can intentionally run a given command with admin privileges--again assuming you're in the admin group.)
3. So to your original question, that's why the installer could be installed as root or via sudo, to the same effect. There's one important additional point.
Note that the Linux cf installer specifically ASKS what user to use to RUN cf, which can be different than the user INSTALLING it. That relates to the above, in terms of what permissions "cf" would then have. And one can create a user to run cf, giving it ONLY what permissions it needs to done what cf needs to do (discussed in the lockdown guide).
(In Windows, the cf installer sadly doesn't ask but just sets up a service that runs as the special "local system" account, available for such services. We have to change it to another account manually.)
BTW, all this is also why one would NOT want to put the user running the cf service into sudoers (on Linux, or the
Administrators group in Windows), as that would make it just as capable of causing trouble as if it WAS the root (or "administrator") account.
Does all that make sense, and help with your question?
... View more