How to install a full desktop on a Multipass virtual machine for easier Linux development

in virtualmachine •  3 years ago 

If Multipass is your virtual machine environment of choice, and you wish you could add a GUI to your VMs, wish no more. Jack Wallen shows you how to do just that.

Multipass is still one of my favorite virtual machine systems. With this command-line tool, I can very quickly spin up a virtual instance of Ubuntu in seconds. These VMs can be used for testing, development and other use cases.

What you'll need
To make this work, you'll need a running instance of Multipass. If you don't already have that working, give How to use Multipass, a new tool for launching virtual machines a quick read and you'll be up to speed in no time.

How to launch a new VM and access its shell
The first thing we'll do is launch a new instance of Ubuntu and access the shell. Find out what iterations of Ubuntu are available with the command:
multipass find

The results should list out each version of Ubuntu that's available for use with Multipass. Let's deploy a virtual machine with Ubuntu 21.10, with the command:
multipass launch daily:21.10

Once the VM launches, you should see it's randomly generated name listed. If you miss it, you can locate it with the command:
multipass list

To access the shell for the new VM, issue the command:
multipass shell NAME

Where NAME is the randomly assigned name.

You should now find yourself at the bash prompt of the virtual machine.

How to install the desktop
Now, we're going to install both a desktop and an RDP server. First, update apt with the command:

sudo apt-get update
When that completes, install the desktop and RDP client with:
sudo apt-get install ubuntu-desktop xrdp -y

The installation should take a few minutes. Once it completes, create a new user with the command:

sudo adduser USERNAME
Where USERNAME is a username you'll log in with.

Finally, give the new user sudo access with:
sudo usermod -aG sudo USERNAME

Where USERNAME is a username you'll log in with.

How to access the desktop
To access the newly-installed desktop, you will first have to discover the IP address of the VM. For that, remain within the VM shell and issue the command:
ip a

You should see an IP address such as 10.171.55.156, which will be the address for the VM.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  
Loading...