DEV Community

Anderson Gama
Anderson Gama

Posted on

Multipass + Cloud-Init

Multipass

Multipass is a mini-cloud on your workstation using native hypervisors of all the supported plaforms (Windows, macOS and Linux). Multipass can launch and run virtual machines and configure them with cloud-init like a public cloud.

Install Multipass

sudo snap install multipass --classic
Enter fullscreen mode Exit fullscreen mode

Debian in Multipass

echo '#cloud-config
write_files:
  - path: /etc/bash.bashrc
    content: |
      #powerline
      if [ -f /usr/bin/powerline-daemon ]; then
        powerline-daemon --quiet
        POWERLINE_BASH_CONTINUATION=1
        POWERLINE_BASH_SELECT=1
        . /usr/share/powerline/bindings/bash/powerline.sh
      fi
    append: true
runcmd:
 - apt install -y powerline' > cloud-config-debian.yaml
Enter fullscreen mode Exit fullscreen mode
mkdir -p $HOME/Multipass/Debian
wget -c https://cloud.debian.org/images/cloud/bullseye/daily/latest/debian-11-genericcloud-amd64-daily.qcow2 -O $HOME/Multipass/Debian/debian.qcow2
multipass launch --name debian file://$HOME/Multipass/Debian/debian.qcow2 --cloud-init cloud-config-debian.yaml
multipass list
multipass sh debian
Enter fullscreen mode Exit fullscreen mode

Rocky in Multipass

echo '#cloud-config
write_files:
  - path: /etc/dnf/dnf.conf
    content: |
      #fastest
      max_parallel_downloads=10
      fastestmirror=True
    append: true
write_files:
  - path: /etc/bashrc
    content: |
      #ohmyposh
      eval "$(oh-my-posh init bash --config /opt/themes/paradox.omp.json)"
    append: true
runcmd:
 - dnf config-manager --set-enabled crb
 - dnf install -y curl git wget zip
 - curl -s https://ohmyposh.dev/install.sh | bash -s -- -d /bin
 - mkdir -p /opt/themes
 - wget -c https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/paradox.omp.json -O /opt/themes/paradox.omp.json' > cloud-config-rocky.yaml
Enter fullscreen mode Exit fullscreen mode
mkdir -p $HOME/Multipass/Rocky
wget -c http://dl.rockylinux.org/pub/rocky/9/images/x86_64/Rocky-9-GenericCloud.latest.x86_64.qcow2 -O $HOME/Multipass/Rocky/rocky.qcow2
multipass launch --name rocky file://$HOME/Multipass/Rocky/rocky.qcow2 --cloud-init cloud-config-rocky.yaml
multipass list
multipass sh rocky
Enter fullscreen mode Exit fullscreen mode

Top comments (0)