How to Install Ubuntu Desktop GUI on Server

Ubuntu Desktop includes a graphical user interface. In this article, you’ll learn all about the Ubuntu Desktop installation and connect using a remote desktop client. Ubuntu has several desktop environments available in its repositories.

Install Ubuntu Desktop

Install Ubuntu Desktop

The following commands used to install Ubuntu Desktop on Server.

Unity (The Default Desktop)
sudo apt-get install ubuntu-desktop

KDE
sudo apt-get install kubuntu-desktop

LXDE (Lubuntu)
sudo apt-get install lubuntu-desktop

MATE
sudo apt-get install mate-desktop

Gnome
sudo apt-get install ubuntu-gnome-desktop

XFCE (Xubuntu)
sudo apt-get install xubuntu-desktop

Please make sure you have the desktop repositories installed. For example, you need to add gnome repositories.

[email protected]:~$ sudo add-apt-repository ppa:gnome3-team/gnome3-staging
[email protected]:~$ sudo add-apt-repository ppa:gnome3-team/gnome3

And then install it:

[email protected]:~$ sudo apt-get update && sudo apt install gnome gnome-shell
[email protected]:~$ sudo apt install ubuntu-gnome-desktop

Checking availability from default sources

[email protected]:~$ sudo apt-cache policy ubuntu-gnome-desktop
ubuntu-gnome-desktop:
Installed: 0.58.3
Candidate: 0.58.3
Version table:
*** 0.58.3 500
500 http://phx-ad-3.clouds.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages
100 /var/lib/dpkg/status
0.58 500
500 http://phx-ad-3.clouds.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages

Install XRDP Package from Ubuntu Repository

xrdp Server is an open-source remote desktop protocol server which uses RDP to present a GUI to the client. It provides a fully functional Linux terminal server, capable of accepting connections from rdesktop, freerdp, and Microsoft’s own terminal server / remote desktop clients.

Install and Enable Xrdp

Login your ubuntu server.

[email protected]:~$ sudo apt install xrdp
xrdp Installation

XRDP Install

You will be then informed about the package size. To proceed with the installation, press Y

Once the installation is done, enable it.

[email protected]:~$ sudo systemctl enable xrdp

When done, you need to install an alternate desktop environment. In our scenario, we are using xfce4

Install xfce4 Desktop environment

[email protected]:~$ sudo apt-get install xfce4

You will be then informed about the package size. To proceed with the installation, press Y

 

Configure xrdp to use xfce desktop environment

you have to configure your Ubuntu server for xrdp to know that the xfce desktop will be used instead of the Unity or Gnome.
To configure this, from the terminal console, you will issue the following command

[email protected]:~$ echo xfce4-session >~/.xsession

Restart the xrdp service by issuing the following command

[email protected]:~$ sudo service xrdp restart

Firewall

You should check the xrdp port 3389 is enabled in firewall. To see current firewall settings use sudo ufw status verbose, or iptables -L.

sudo ufw disable # To disable the firewall
sudo ufw enable # To enable the firewall

Test your Ubuntu Desktop connections using windows remote desktop.

 

 

VMware VM created and deleted users list using PowerCLI

How to check quickly in VMware vCenter about users who have created or deleted the VMs? The below PowerCLI script can be fetched using the TaskEvent which has the description VmBeingDeployedEvent or VmBeingClonedEvent and VmRemovedEvent in VMware vCenter 6.

VMware PowerCLI

VMware PowerCLI Connect

You can list the virtual machine details which user has removed or deleted and Created, check the vCenter Server Events Logs using PowerCLI command to list all the details.

Get-VIEvent -MaxSamples ([int]::MaxValue) -Start (Get-Date).AddDays(-30) | where {$_.Gettype().Name -eq “VmCreatedEvent” -or $_.Gettype().Name -eq “VmBeingClonedEvent” -or $_.Gettype().Name -eq “VmBeingDeployedEvent”} | %{“{0} created by {1}” -f $_.VM.Name,$_.UserName}

Use the following PowerCLI command to list last 7 days VM deleted Event logs with a username.

Get-VIEvent -MaxSamples ([int]::MaxValue) -Start (Get-Date).AddDays(-7) | where {$_.Gettype().Name -eq “VmRemovedEvent”} | %{“{0} created by {1}” -f $_.VM.Name,$_.UserName}

How to get a list Virtual Machine Snapshots in VMware

This is additional information to get a list of all VM Snapshots for VMs managed by vCenter you can type the following command using PowerCLI.

get-vm | get-snapshot | format-list

The command above will give you the following properties:

Description
Created
Quiesced
PowerState
VM
VMId
Parent
ParentSnapshotId
ParentSnapshot
Children
SizeMB
IsCurrent
IsReplaySupported
ExtensionData
Id
Name
Uid

If you want the VM list with the name of the snapshot, you could simply add these properties after “format-list” as shown below.

get-vm | get-snapshot | format-list vm,name

 

 

How to enable nested virtualization on Google Cloud

Google Cloud supports nested virtualization using the KVM hypervisor on Linux instances. This nested virtualization feature allows you to run one or more virtual machines inside a Linux virtual machine by leveraging Intel VT-x processor, It means VMs inside of VMs. The only requirement is that the VM has to run on an Intel Haswell or newer CPU. Here are the steps, how to enable nested virtualization on google cloud.

  • ESX and Xen hypervisors are not supported.
  • Nested virtualization does not currently support Windows instances.

Google has verified nested virtualization tests which work perfectly using the following Linux distros. The list of available regions and zones for the CPU platforms available in each zone.

– CentOS 7 with kernel version 3.10
– Debian 9 with kernel version 4.9
– Debian 8 with kernel version 3.16
– RHEL 7 with kernel version 3.10
– SLES 12.2 with kernel version 4.4
– SLES 12.1 with kernel version 3.12
– Ubuntu 16.04 LTS with kernel version 4.4
– Ubuntu 14.04 LTS with kernel version 3.13

How to Enable nested virtualization on Google Cloud

You can enable nested virtualization using ‘gcloud’ command-line tool or the API. It would be required to create a custom image with the special license key required for virtualization. We have created a new nested virtualization image using an existing image as a source image.

Log in your Google Cloud Console

Click top right corner - > Activate Google Cloud Shell
google cloud shell

GCP shell

List all compute images including deprecated.

$ gcloud compute images list --show-deprecated
gcloud list images

gcloud list images

You can use any one of the image as the source image to enable nested virtualization.

Syntax,

$ gcloud compute images create <nested_image_name> \
--source-image=<os_image_name> --source-image-project=<source_image_project> \
--licenses="https://www.googleapis.com/compute/v1/projects/vm-options/global/licenses/enable-vmx"

For example, the following command creates an image named ‘gcp-nested-vm-image‘ from an existing centos image named ‘centos-7-v20170719‘.

$ gcloud compute images create gcp-nested-vm-image \
--source-image=centos-7-v20170719 --source-image-project=centos-cloud \
--licenses="https://www.googleapis.com/compute/v1/projects/vm-options/global/licenses/enable-vmx"

Once done. Create a VM instance with the custom image in a zone that supports Haswell or higher.

Using the Console.

Login Compute Engine -> VM instances -> CREATE INSTANCE

Using gcloud command.

$ gcloud compute instances create example-nested-vm --zone us-central1-b \
--image gcp-nested-vm-image

Once VM created, connect the VM SSH and check that nested virtualization is enabled by running the following command.

# grep -cw vmx /proc/cpuinfo

or

# cat /proc/cpuinfo | grep vmx

A non-zero response confirms that nested virtualization is enabled.

You have enabeld the nested virtualization on your google cloud. Now you can start a nested VM in many different ways like qemu-kvm installation.