Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pluvial/vm
Linux VMs on ARM64
https://github.com/pluvial/vm
Last synced: about 2 months ago
JSON representation
Linux VMs on ARM64
- Host: GitHub
- URL: https://github.com/pluvial/vm
- Owner: pluvial
- License: mit
- Created: 2024-07-09T09:13:47.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-11-08T11:10:01.000Z (2 months ago)
- Last Synced: 2024-11-08T11:32:24.592Z (2 months ago)
- Language: Shell
- Homepage:
- Size: 90.8 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vm
Linux VMs on ARM64
## Getting `vm`
```sh
mkdir vm && curl -L https://github.com/pluvial/vm/archive/main.tar.gz | tar xzf - --strip-components=1
mkdir vm && wget https://github.com/pluvial/vm/archive/main.tar.gz -O - | tar xzf - --strip-components=1
git clone --depth=1 https://github.com/pluvial/vm
```## Building `vm` binary
```sh
./build.sh
# or
xcodebuild -arch arm64
``````sh
$ tree build/Release
build/Release/
├── vm
├── vm.dSYM
│ └── Contents
│ ├── Info.plist
│ └── Resources
│ ├── DWARF
│ │ └── vm
│ └── Relocations
│ └── aarch64
│ └── vm.yml
└── vm.swiftmodule
├── Project
│ └── arm64-apple-macos.swiftsourceinfo
├── arm64-apple-macos.abi.json
├── arm64-apple-macos.swiftdoc
└── arm64-apple-macos.swiftmodule9 directories, 8 files
```## Setup Ubuntu VM
```sh
ubuntu/setup.sh
``````sh
tree ubuntu
ubuntu
├── cidata
│ ├── meta-data
│ └── user-data
├── initrd
├── noble-server-cloudimg-arm64.tar.gz
├── run.sh
├── setup.sh
├── vda.img
├── vdb.img
├── vdc.iso
├── vmlinuz
└── vmlinuz.gz2 directories, 11 files
```## Run Ubuntu VM
```sh
ubuntu/run.sh
```Mount host shared directories:
```sh
sudo mkdir /mnt/host
sudo mount -t virtiofs host /mnt/host
# or add to /etc/fstab :
# host /mnt/host virtiofs defaults 0 0
```## Setup Alpine VM
In Ubuntu VM:
```sh
cd /mnt/host/cwd/alpine
sudo ./build.sh
```Creates `/mnt/host/cwd/vm-build`
In host:
```sh
mv vm-build/* alpine
alpine/setup.sh
``````sh
tree alpine
alpine
├── alpine-minirootfs.tar.gz
├── etc
│ ├── fstab
│ ├── group
│ ├── hosts
│ ├── init.d
│ │ ├── rcK
│ │ └── rcS
│ ├── inittab
│ └── passwd
├── image.sh
├── linux.config
├── linux.sh
├── linux.tar.xz
├── linux.version
├── mnt
├── root
│ ├── build.sh
│ ├── setup-podman.sh
│ └── setup-vdb.sh
├── run.sh
├── setup.sh
├── usr
│ └── share
│ └── udhcpc
│ └── default.script
├── vda.img
├── vdb.img
└── vmlinuz8 directories, 22 files
```## Run Alpine VM
```sh
alpine/run.sh
```### SSH into VM
In VM:
```sh
apk add dropbear && reboot
```In host:
```sh
alpine/ssh.sh
```### Setup Podman
In VM:
```sh
./setup-vdb.sh
./setup-podman.sh
```Test with:
```sh
podman run --rm -it alpine
```### Build Linux in Podman
```sh
./build.sh
```Creates `~/build/vmlinuz`, can be copied to host with:
```sh
cp build/vmlinuz /mnt/host/cwd/
```## Cleaning
Clean disk images:
```sh
./clean.sh
```Clean disk images, downloads, and build artifacts
```sh
./clean.sh --all
```## Inspiration
[apinske/virt](https://github.com/apinske/virt)
Apple sample code:
- [Running Linux in a Virtual Machine](https://developer.apple.com/documentation/virtualization/running_linux_in_a_virtual_machine)
- [Running GUI Linux in a virtual machine on a Mac](https://developer.apple.com/documentation/virtualization/running_gui_linux_in_a_virtual_machine_on_a_mac)