Sure - why not. The question, why do you need to host it locally? You can just create a free account on wordpress.com, or get a private hosted solution for peanuts and with the LAMP stack already configured.
For context my wife uses wordpress to build various sites. I got lumped with the task of moving this online. It was super painful, as WP encodes the URL name (i.e. localhost) flipping everywhere.
I eventually resolved this by editing the tables which stored the URLS (fortunately, as a DS I know SQL) and doing some sed on various files that cached the URL.
I now refuse to do this, and set her up online with a website before she does any work, because moving it is so painful.
I did try the obvious things first, to be fair.
Another way is to perform the find and replace with PhpMyAdmin.
It appeared to work a few times (or at least my wife/her customers didn't complain).
offline editing?
You can accomplish this by using a CDN that caches everything, or use plugins that export static files like WP2Static, or use integrations with static site frameworks like Gatsby that treat WP as a CMS.
But yes, doing it all from scratch yourself is probably not worth it, especially if you're unfamiliar with the tech.