UserVM Handbook: Difference between revisions

No edit summary
(3 intermediate revisions by the same user not shown)
*A machine with decent specs (8GB of RAM and a modern CPU, probably)
*A Linux distribution; You can pick any mainstream distro, for the purposes of this guide I recommend either Debian or Arch, or their OpenRC counterparts if you prefer OpenRC. Yes, Ubuntu will work, it's terrible though
*A decently fast network that allows you to forward a port. We will not accept UserVMs behind services like ngrok. Cloudflare tunnels are fine. You must also have a URL that stays persistent. If your IP is dynamic, you can use services like NOIP or setup a script to auto-update your domain using cloudflare.
*Basic knowledge of how computers and Linux systems work. We aren't going to hold your hand, you need to be comfortable with a command line
*A few hours
On Debian, the packaged node version is too old to run CollabVM, so we'll add the nodesource repository.
{{code|<nowiki>
sudo apt-get install -y ca-certificates curl gnupg
curl -fsSL https://deb.nodesource.com/setup_21.x | sudo bash -
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
NODE_MAJOR=20
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
sudo apt-get update
sudo apt-get install nodejs -y
</nowiki>}}
npm run build
}}
 
== Set up your VM ==
Now is a good time to get your VM set up. Currently, the only supported hypervisor is QEMU. We have many guides on this wiki for setting up different OSes in QEMU, [[QEMU/Guests|check them out here.]]
'''This is REQUIRED for UserVM as, for technical reasons, only SSL-equipped WebSockets can be accepted'''
 
We strongly recommend you proxy your UserVM behind Nginx, to provide additional security and allow things like SSL. It also makes your VM look a lot cleaner, allowing people to access it on your main HTTP(s) port and on a subdirectory, like <code>https://yoursiteexample.xyzcom/collab-vm/</code> rather than <code>http://yoursiteexample.xyzcom:6004</code>. Here's a brief description of how to set that up on the Nginx side. This assumes you already have your site set up with Nginx, and if not there are numerous guides for that around the internet.
 
First, you'll want to save [https://computernewb.com/~elijah/wsproxy_params wsproxy_params] to your Nginx directory, which enables WebSocket proxying. Here's a one-liner to do that:
First, we highly recommend you create a separate user for CollabVM, to maximize security
{{code|
sudo useradd -rM -d /srv/collabvm collabvm
sudo chown -R collabvm:collabvm /srv/collabvm/ # Set the collabvm user as the owner of the server files
sudo usermod -aG kvm collabvm # Give the CollabVM user permission to use KVM hypervision