This guide will teach you how to configure X11 forwarding to use on Virtual Machine instances managed by Vagrant.This is a series Tutorial on building Virtual Labs with Vagrant and VirtualBox.
We also have the following tutorials on Vagrant:
- xauth: This program is usually used to extract authorization records from one machine and merge them in on another (as is the case when using remote logins or granting access to other users)
- If it doesn’t exist install it on the Vagrant instance.
For Debian based systems: Ubuntu/Debian/Linux Mint, Kali Linux e.t.c, do
sudo apt-get install xauth
yum install xorg-x11-xauth
- Once you’ve installed xauth if it didn’t exist, stop the Vagrant instance
- Open Vagrantfile
- Now edit the Vagrant file and add below lines just after the vagrant.vm name
- Save changes and start the Vagrant instance
- Now ssh to Vagrant instance by running the command vagrant ssh
You will get the message “/home/vagrant/.Xauthority” does not exist. This is okay since we’re running it for the first time.The “xauth” program will create .Xauthority file for you.
- Do a test on the vagrant instance running to check if indeed the X11 forwarding is working.On Vagrant Virtual Machine’s terminal run any of below commands. If you see window popup, then it’s working just fine.
To use xeyes and xclock on CentOS 7 and below install it using
yum install xorg-x11-apps.x86_64
For Fedora 21,20 and below, use
yum install xorg-x11-apps
For Fedora 22 and Fedora 23
dnf install xorg-x11-apps