openSUSE Tumbleweed Vagrant libvirt image

By | February 6, 2022

Assumme you want to quickly test out some thing on openSUSE OS, there are many ways to do it, you can spin up a VM on public clould, openstack cloud or you can request a VM to be provisoned by IT team, while all this methods have a wait time ranging from minutes to days, approval process etc.

If you have a laptop with decent CPU( 8 cores) and RAM( 16 GB) you can install vagrant and sping up vm with in few minutes, this may have few shortcomings, created VM would be running in a isolated network.

1. Downloading openSUSE Tumbleweed from vagrant site.

cipher@server:~/cipher-gitlab/vagrant$ vagrant box add opensuse/Tumbleweed.x86_64
==> box: Loading metadata for box 'opensuse/Tumbleweed.x86_64'
box: URL: https://vagrantcloud.com/opensuse/Tumbleweed.x86_64
This box can work with multiple providers! The providers that it
can work with are listed below. Please review the list and choose
the provider you will be working with.

1) libvirt
2) virtualbox

Enter your choice: 1
==> box: Adding box ‘opensuse/Tumbleweed.x86_64’ (v1.0.20220204) for provider: libvirt
box: Downloading: https://vagrantcloud.com/opensuse/boxes/Tumbleweed.x86_64/versions/1.0.20220204/providers/libvirt.box
==> box: Successfully added box ‘opensuse/Tumbleweed.x86_64’ (v1.0.20220204) for ‘libvirt’!

2. List the download vagrant box.
cipher@server:~/cipher-gitlab/vagrant$ vagrant box list
centos/7 (libvirt, 2004.01)
opensuse/Tumbleweed.x86_64 (libvirt, 1.0.20220204)

3.start the vagrant image.
cipher@server:~$ mkdir vagrant-lab
cipher@server:~$ cd vagrant-lab/
cipher@server:~/vagrant-lab$ ls
cipher@server:~/vagrant-lab$ mkdir suse
cipher@server:~/vagrant-lab$ cd suse/
cipher@server:~/vagrant-lab/suse$ ls
cipher@server:~/vagrant-lab/suse$ vagrant init opensuse/Tumbleweed.x86_64
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
cipher@server:~/vagrant-lab/suse$

cipher@server:~/vagrant-lab/suse$ vagrant up
Bringing machine ‘default’ up with ‘libvirt’ provider…
==> default: Checking if box ‘opensuse/Tumbleweed.x86_64’ version ‘1.0.20220204’ is up to date…
==> default: Uploading base box image as volume into Libvirt storage…
==> default: Creating image (snapshot of base box volume).
==> default: Creating domain with the following settings…
==> default: — Name: suse_default
==> default: — Description: Source: /home/cipher/vagrant-lab/suse/Vagrantfile
==> default: — Domain type: kvm
==> default: — Cpus: 1
==> default: — Feature: acpi
==> default: — Feature: apic
==> default: — Feature: pae
==> default: — Clock offset: utc
==> default: — Memory: 512M
==> default: — Management MAC:
==> default: — Loader:
==> default: — Nvram:
==> default: — Base box: opensuse/Tumbleweed.x86_64
==> default: — Storage pool: default
==> default: — Image(): /var/lib/libvirt/images/suse_default.img, 42G
==> default: — Disk driver opts: cache=’default’
==> default: — Kernel:
==> default: — Initrd:
==> default: — Graphics Type: vnc
==> default: — Graphics Port: -1
==> default: — Graphics IP: 127.0.0.1
==> default: — Graphics Password: Not defined
==> default: — Video Type: cirrus
==> default: — Video VRAM: 9216
==> default: — Video 3D accel: false
==> default: — Sound Type:
==> default: — Keymap: en-us
==> default: — TPM Backend: passthrough
==> default: — TPM Path:
==> default: — INPUT: type=mouse, bus=ps2
==> default: Creating shared folders metadata…
==> default: Starting domain.
==> default: Waiting for domain to get an IP address…
==> default: Waiting for machine to boot. This may take a few minutes…
default: SSH address: 192.168.121.22:22
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection refused. Retrying…
default: Warning: Connection refused. Retrying…
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest…
default: Removing insecure key from the guest if it’s present…
default: Key inserted! Disconnecting and reconnecting using new SSH key…
==> default: Machine booted and ready!
==> default: Rsyncing folder: /home/cipher/vagrant-lab/suse/ => /vagrant
cipher@server:~/vagrant-lab/suse$

4. Access VM, we have a sandbox to test.
cipher@server:~/vagrant-lab/suse$ vagrant ssh
Last login: Sun Feb 6 16:04:00 CET 2022 from 192.168.121.1 on ssh
Have a lot of fun…
vagrant@localhost:~> cat /etc/os-release
NAME=”openSUSE Tumbleweed”
# VERSION=”20220204″
ID=”opensuse-tumbleweed”
ID_LIKE=”opensuse suse”
VERSION_ID=”20220204″
PRETTY_NAME=”openSUSE Tumbleweed”
ANSI_COLOR=”0;32″
CPE_NAME=”cpe:/o:opensuse:tumbleweed:20220204″
BUG_REPORT_URL=”https://bugs.opensuse.org”
HOME_URL=”https://www.opensuse.org/”
DOCUMENTATION_URL=”https://en.opensuse.org/Portal:Tumbleweed”
LOGO=”distributor-logo-Tumbleweed”
vagrant@localhost:~>