So if I want to do red teaming or learn on maldev academy is there a way to self host phishing pages for their offensive phishing course or malware C2 servers locally in a vm while being stealthy?
Yes. You may find useful Set up Your Onion Service, even though it doesn’t explain how to set up a webserver.
The Tor Project’s own guide on setting up an onion service is the piece worth reading first. Running it in a VM is straightforward, and once tor is configured you can point the hidden service at whatever local web server you spin up. The second post is right that the guide stops at the onion service itself, so you’ll need to sort out the web server side separately. Do keep in mind that the Tor network’s rules and your own comfort level should guide what you actually expose.
Running it in a VM works fine, and the Tor Project’s guide is the right place to start since it covers the onion service config itself. The gap the second post points out is real, though, so plan on setting up the web server separately and pointing the hidden service at its local port. One thing worth thinking through before you expose anything: decide what you actually want reachable and keep that scope tight. From Chicago I’ve mostly seen people underestimate the web server side rather than the Tor side.