First of all, X Window Core must be installed, or you won’t be able to use GUI. X Window Core is called “x-window-system-core”. To install any GUI, you should install this first.
In linux, one of the display managers (login managers) gdm/kdm/xdm should be chosen. To get a different desktop manager for ubuntu, just add packages following:
e.g.
(root)# apt install ubuntu-desktop
After the installation, of course, we should set default-display-manager on ubuntu. There are two ways to do so,
Refer to: HOWTO: correctly install/remove k/x/ed/ubuntu-desktop packages