On Linux servers I always uninstall the compiler and dev tools. I actually wrote a little script to dry-run uninstall every single package on the server one by one, and if uninstalling it doesn't remove anything important I'll go ahead an uninstall it.
I'm left with only a bare minimum of stuff, even things like man pages or simple utils I'll uninstall.
if you're uploading a compiler you could just upload a binary. unless it's a very specific system you can probably just put it together "at home" and slap it in there.
summary pgh 3 [One of the actor’s primary tactics, techniques, and procedures (TTPs) is living off the
land, which uses built-in network administration tools to perform their objectives. This
TTP allows the actor to evade detection by blending in with normal Windows system
and network activities, avoid endpoint detection and response (EDR) products that
would alert on the introduction of third-party applications to the host, and limit the
amount of activity that is captured in default logging configurations. Some of the built-in
tools this actor uses are: wmic , ntdsutil , netsh , and PowerShell .]