I did a Ansible workshop for beginner last week and I wanted to deploy to a virtual server on my laptop. As a huge fan of Gnome, I wanted to deploy using Gnome Boxes, the very easy virtualization solution integrated in the desktop environment.
If you don’t have it already installed, just go in your software center, or just type
sudo dnf install gnome-boxes . You will need to download a distribution of you choice, for Fedora go to getfedora.org/en/server/download/.
When you’re done with the installation and and the download, open Gnome Boxes and add you ISO by clicking the plus (+) button. Go through the installation process to the end then reboot your virtual machine.
In your fresh installation, you will need SSH if it’s not install by default:
sudo dnf install openssh-server
sudo systemctl enable sshd
systemctl start sshd
Then you need to know to which IP address you will be able to connect. It should be an local IP, beginning with
ip addr | grep 192.168
inet 192.168.124.252/24 brd 192.168.124.255 scope global ens3
You can now connect through SSH in a local terminal:
$ ssh email@example.com
The authenticity of host '192.168.124.252 (192.168.124.252)' can't be established.
ECDSA key fingerprint is SHA256:2nqY95stS6j2QJf9N4pIgN3hLk05f1M2EXGU4eCFpuM.
ECDSA key fingerprint is MD5:32:f1:8f:f7:70:cf:89:71:18:a0:28:53:83:a4:cf:74.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.124.252' (ECDSA) to the list of known hosts.
Last login: Sun Apr 16 19:47:04 2017
[my-username@fedora25-ser ~]$ uname -a
But then, you would need to keep Gnome Boxes open to connect through SSH even if you don’t need to interact with any user interface. As soon as you close Gnome Boxes, your virtual machine is shut down. Let’s fix that.
Gnome Boxes utilizes QEMU under the hood. We will use the
virsh utility to interact with our machine. First, we need the name of our virtual machine:
$ virsh list --all
ID Name State
1 fedora25-ser closed
Now that we have the name, we can start it:
$ virsh start fedora25-ser
Domain fedora25-ser started
Other useful subcommands:
Now you can try again to log to your virtual machine without having the Gnome Boxes window open!