Add Desktop Environment to minimal install only cli? [duplicate]

Here is how you install a desktop on a minimum install or headless server.

First, run the following commands to install tasksel:

sudo apt update
sudo apt install tasksel

Run the following command to install a desktop:

sudo tasksel

Then, you can select your desired desktop environment. Choosing the "Ubuntu desktop" will install Gnome Shell which is the standard Ubuntu desktop on 18.04+. Do not select any of the "live cd" options.

Use the space bar to select or deselect a desktop and then use the tab key to select "OK" and then press Enter to install.

You can always run the sudo tasksel command in the future if you want to install another desktop environment.

NOTE: because of a bug in tasksel, DO NOT use tasksel to uninstall packages. ONLY use tasksel to install.