webvm README

The project's README from github.com/leaningtech/webvm. As one markdown file: README.md.

WebVM

Discord server Issues

This repository hosts the source code for https://webvm.io, a Linux virtual machine that runs in your browser.

Try out the new Alpine / Xorg / i3 graphical environment: https://webvm.io/alpine.html

What is WebVM?

WebVM is a server-less virtual environment running fully client-side in HTML5/WebAssembly. It's designed to be Linux ABI-compatible and runs an unmodified Debian distribution including many native development toolchains.

WebVM is powered by the CheerpX virtualization engine, which provides:

Table of Contents

[!NOTE] Visit https://webvm.io to get started immediately in your browser. No setup required.

For local setup, custom image builds, and fork/deploy guidance, see Development & Customization.

Networking

WebVM supports Tailscale integration. So your browser VM can reach your private network and, with an exit node, the public internet too.

[!NOTE] Some low-level networking operations (especially ICMP used by ping) are not currently available in this environment. For connectivity checks, use curl or wget.

Local network

  1. Open the "Networking" panel from the sidebar
  2. Click "Connect to Tailscale"
  3. Log in (create a free account at tailscale.com if needed)
  4. Click "Connect" when prompted

WebVM now has access to all machines in your Tailscale network!

Internet Usage Tips

[!TIP] On slower connections there may be a short delay before initialisation. Connection status is shown as a colored dot on the button: orange = local network, green = global/internet. The button text shows your Tailscale IP address once connected.

To access the public internet from WebVM, set up an Exit Node on another device in your Tailscale network:

  1. Follow the Tailscale Exit Node quickstart (sections: "Advertise a device as an exit node")
  2. WebVM automatically uses the exit node once advertised

Using an Auth Key

As an alternative to interactive login, add your Tailscale auth key to the URL fragment:

https://webvm.io/#authKey=<your-ephemeral-key>

This is equivalent to Tailscale's --login-server option.

[!TIP] If you also need a custom control server, add controlUrl in the same URL fragment and separate values with &, for example: #authKey=...&controlUrl=....

Self-Hosting Tailscale with Headscale

We also support headscale, a selfhosted open source implementation of the Tailscale control server. Because Headscale does not add CORS headers by default, you will need a proxy in front of it. See the Headscale reverse proxy setup docs for an example.

Once ready, add the following line to your location / block in your nginx config file.

if ($http_origin = "https://yourdomain.com") {
    add_header 'Access-Control-Allow-Origin' "$http_origin";
    add_header 'Access-Control-Allow-Credentials' 'true' always;
}

Then access WebVM with:

https://yourdomain.com/#controlUrl=<your-headscale-url>

Development & Customization

[!NOTE] Users have root privileges by default. sudo is not installed though this can easily be added to the Dockerfile if needed.

Deploy to GitHub Pages

This is a simple, beginner-friendly workflow. For local hosting and customization, see below Local Serving & Image Configuration.

Fork the WebVM repository to deploy your own version to GitHub Pages:

deploy_instructions_gif
  1. Fork the repository
  2. Enable GitHub Pages via forked repository in Settings → Pages using "GitHub Actions" as source
  3. Run the Deploy workflow from Actions
  4. After completion, open the URL shown under the deploy_to_github_pages job

The same Deploy workflow also builds custom .ext2 disk images from a Dockerfile. You can point it at dockerfiles/debian_mini or another Dockerfile, then either publish the result as a GitHub Release asset or deploy the Pages build from your fork.

[!NOTE] dockerfiles/debian_large is too large of an image for GitHub pages.

Local Serving & Image Configuration

1. Clone the repository

git clone https://github.com/leaningtech/webvm.git
cd webvm

2. Put your image in custom-disk-images/

This repository includes a persistent custom-disk-images/ directory for local .ext2 files.

To use the official Debian mini image, download it from Releases:

debian_mini_20230519_5022088024.ext2

You can also copy in an image you built yourself.

3. Point WebVM to your local image

Edit config_public_terminal.js:

export const diskImageUrl =
  "/custom-disk-images/debian_mini_20230519_5022088024.ext2";
export const diskImageType = "bytes";

4. Install dependencies and build

npm install
npm run build

5. Start Nginx and open WebVM

nginx -p . -c nginx.conf

Then open http://127.0.0.1:8081 and enjoy your local WebVM!

For the full Alpine desktop environment, see leaningtech/alpine-image.

For more details, see CheerpX Custom Images documentation.

[!TIP] For Python3 REPL, the Deploy workflow takes into account the CMD specified in the Dockerfile.

To build a REPL you can simply change CMD [ "/bin/bash" ] to CMD [ "/usr/bin/python3" ] and deploy.

Claude AI Integration

To access Claude AI, you need an API key. Follow these steps to get started:

1. Create an account

2. Get your API key

3. Log in with your API key

4. Start using Claude AI

"Solve the CTF challenge at /home/user/chall1.bin. Note that the binary reads from stdin."

deploy_instructions_gif

Important: Your API key is private and should never be shared. We do not have access to your key, it is only stored locally in your browser.

Community & Support

Report issues: Use GitHub Issues to report bugs or request features.

Chat with us: Join our Discord community to discuss WebVM, share ideas, and get help.

Learn More

Articles & Resources:

Example Deployment:

Technology Behind WebVM:

This project is powered by:

Versioning:

WebVM uses the CheerpX NPM package, which is updated on every release.

Every build is immutable. If a specific version works well for you today, it will keep working forever.

License

WebVM is released under the Apache License, Version 2.0.

You are welcome to use, modify, and redistribute the contents of this repository.

The public CheerpX deployment is provided as-is and is free to use for technological exploration, testing and use by individuals. Any other use by organizations, including non-profit, academia and the public sector, requires a license. Downloading a CheerpX build for the purpose of hosting it elsewhere is not permitted without a commercial license.

Read more here about our licensing practices.

If you want to build a product on top of CheerpX/WebVM, please see our other licensing options: CheerpX licensing or get in touch: [email protected]

webvm (leaningtech/webvm)

Searching Database…

17.4K ·GitHub
这是什么?WebVM 是一个完全在你的浏览器里运行的 Linux 虚拟机——一个未经修改的 Debian 发行版,带有原生开发工具链,完全在客户端运行,无需安装,也不依赖服务器。
所以整个虚拟机真的是在我自己的电脑上运行,而不是在远程服务器上?是的——CheerpX 引擎会进行 x86 到 WebAssembly 的 JIT 编译,模拟 Linux 系统调用,并提供一个基于虚拟块设备的文件系统,全部隔离在浏览器标签页中运行。
我怎么试用它?在浏览器里打开托管的 WebVM 网站即可——无需任何配置。如果你想要自己的一份,可以 fork 仓库并运行 Deploy 工作流发布到 GitHub Pages,或者用 nginx 在本地托管一个镜像。
内置的 Claude AI 集成需要 Anthropic API 密钥吗?需要——把你的 API 密钥粘贴到机器人图标那个标签页里,密钥始终留在你这一边:只保存在你的浏览器本地,WebVM 团队无法访问它。
虚拟机能通过我的浏览器访问互联网吗?只能通过 Tailscale:在网络面板里连接后可以访问你的私有网络,访问公共互联网则需要在另一台设备上设置出口节点(exit node)。ICMP/ping 不可用——请改用 curl 或 wget。
它真的可以免费使用吗?仓库代码采用 Apache-2.0 协议,个人可以免费使用公开的 CheerpX 部署,但任何组织性质的使用——即使是非营利机构或学术机构——都需要获得授权许可,重新托管 CheerpX 则需要商业授权。
它只有命令行界面,还是有图形桌面?默认的 Debian 镜像只有终端界面,但还有一个更新的 Alpine / Xorg / i3 图形环境可以体验,完整的桌面直接在浏览器里运行。
我能把它从 bash shell 改成 Python REPL 吗?可以——把 Dockerfile 里的 CMD 从 /bin/bash 改成 /usr/bin/python3 然后部署即可;Deploy 工作流会遵循这个设置,在浏览器里给你一个 Python REPL。
它底层是怎么实现的?Leaning Technologies 开发的 x86 到 WebAssembly 的 JIT 编译器 CheerpX;用于终端界面的 xterm.js;为 Web 编译的 TCP/IP 协议栈 lwIP;以及负责网络层的 Tailscale。
What are similar projects?quicksand, ProxmoxVE, coop, nvx, qemu, ServerBox, ra2, smolvm
Size
41.3 MB
Stars
17.4K
Age
4y
Commits · 90 Days