Is it possible to install and run dnsmasq on a shared host webserver (standard lamp stack)? And how would one do this?
I use Siteground and Dreamhost. I think I can run a lamp stack on my NAS too which I may have more permissions for.
Being linux based, I'm assuming it's possible but I know shared services can have limited permissions.
No, something branded as a managed VPS or web host cannot install custom software. Or change the system DNS resolver, in this example. You may get a shell and only see your own processes, with container or VM technology.
With instances you control, you get root access and can install software. And necessary features to manage VMs, like managing (boot) disks, console access, and a reboot button.
Linux based doesn't mean anything about what you can do in a given system. Almost everything could be Linux powered, from platform as a service offerings you have zero control over, to owning your own servers and having full control of the software.