243

Trying to run a Ubuntu server for the first time... But everything is in a terminal. Is there a way to switch to a GUI?

muru
  • 197,895
  • 55
  • 485
  • 740
  • 23
    NOTE - THE TOP ANSWER SAYS THERE IS NO SERVER DISTRIBUTION OF UBUNTU, BUT NOW THERE IS. The first answer that talks about Ubuntu Server is currently the 3rd answer, by Ubuntu Ingrained. – kim holder Jan 07 '17 at 22:09
  • 1
  • 1
    This typical of the nature of answers on this site - when a top voted answer is actually useless because it is out-dated, there is no flag/warning ability so we dont waste our time reading/questioning it. Down-voting leads to discomfort. They really need to address this. – killjoy Feb 17 '18 at 15:14
  • @killjoy - this stack seems to be at a certain level of expertise, and a bit tough for newbies, as we both are. At my home, Money.SE, we learned long ago, there are people just starting, totally clueless, and we need to help them along, too. Here, it would be a great start if questions and answers had a rev level, as things tend to change. I just installed "Ubuntu Server 16.04 and was floored to see a command line, and need for me to load more packages. – JTP - Apologise to Monica Feb 20 '18 at 13:18
  • 1
    There's been an "Ubuntu Server" since 6.06 in 2006, and everything @Gilles said is correct: it's not its own distribution; it's a package selection. – Tohuw May 05 '18 at 09:53
  • Additional question posed after first question by original poster: "Also, the server doesn't have direct access to the internet... So, is there a way to share it from a laptop?" Never answered. – K7AAY May 23 '18 at 23:38
  • @kimholder I'm puzzled by your comment: there is no server distribution, just a server installer, which is exactly what I state in my answer. – Gilles 'SO- stop being evil' May 25 '18 at 08:53
  • @Gilles you're making a semantic distinction that distracts from answering a simple question. The OP never even mentioned the word "distribution". Certainly Ubuntu Server is a thing that exists and is different from Ubuntu Desktop -- so the question is 100% valid and doesn't need any further qualification. – Paul Sep 08 '18 at 19:13

14 Answers14

203

There's no specific distribution called “Ubuntu server”, it's all Ubuntu. There are different installation media for Ubuntu desktop and server, but the difference is only in the initial installation program and the set of packages included. The server installation media doesn't install a GUI by default, but it's just a package installation away. The desktop installation media does install a GUI by default.

To add a desktop UI environment to an Ubuntu installed as the "server" variety, you'll need to install some packages from the internet.

Run these commands to install a desktop environment:

sudo apt-get update
sudo apt-get install ubuntu-desktop

You should get a graphical login prompt at that point (I'm not completely sure; if you don't get one, reboot).

Once you have a GUI, you should go and enable a few more software sources, at the very least security updates and the universe repository. Click on the Ubuntu button, and search for "Software Sources”, and check the “restricted”, “universe” and “multiverse” boxes (in addition to “main”) in the first tab, and check at least “-security” and “-updates” (and you might as well check the others) in the “Updates” tab.

  • 55
    I suggest since it's a server the following: sudo apt-get install --no-install-recommends ubuntu-desktop Keep it minimal. – Karl Morrison Feb 03 '15 at 14:13
  • 14
    From another answer below: "--no-install-recommends will exclude major softwares and tools like libreoffice, firefox , thunderbird etc" – Miscreant Sep 11 '16 at 22:42
  • 2
    @Jistanidiot think of the different downloads from ubuntu.com as Ubuntu with these library sets. Desktop users don't need server libraries so don't include them and vice versa. You can install these libraries after installing Ubuntu at any time as they are not directly apart of Ubuntu itself. – Michael Warner Aug 08 '17 at 17:40
  • I did this but now I can't log in with the user I had...I successfully login as guest though. – Sampgun Mar 28 '18 at 13:09
  • 1
    Sadly, I don't think this is quite accurate anymore. If you install from the "desktop" distro images, it will also (optionally) add in things like the appropriate video card drivers, which you don't get from installing the desktop... – rogerdpack Dec 02 '19 at 17:26
  • So how to remote login the desktop???? – huang Jan 15 '21 at 23:51
136

If you want to administer locally

You can install the default Ubuntu desktop by executing the following:

sudo apt-get install ubuntu-desktop

There are many desktop alternatives which you may install and use, like:

  • Gnome 3 installation: sudo apt-get install gnome-shell
  • KDE see Kubuntu installation: sudo apt-get install kubuntu-desktop
  • XFCE installation: sudo apt-get install xfce4
  • LXDE installation: sudo apt-get install lxde
  • Openbox installation: sudo apt-get install openbox
  • Gnome Classic (old) a Gnome 3 desktop that looks like Gnome 2 installation: sudo apt-get install gnome-session-fallback
  • Ubuntu Gnome (Official flavor) installation: sudo apt install ubuntu-gnome-desktop

Local and or remote administration

Except from the above you can administer your server by using a web based solution using less resources:

  • Webmin installation: see here
  • Zentyal (offers community edition there seems to be no free edition enymore. A lot of complaints, it's stripped down more and more... ) installation: see here
  • ISPConfig (supports up to 16.10) installation: see here
Stef K
  • 4,836
  • 1
    A traditional graphical interface, such as gnome or kde or fluxbox, adds very little to a server as almost everything you do is from the command line anyways (editing files, starting stopping services, installing services). If yoy "need" a graphical interface, use a web based solution such as Webmin. – Panther Apr 23 '13 at 16:09
  • 20
    Nowhere in the question is asked a GUI for administrative purposes. The OP clearly asks how to enable a GUI to his server. The answer provides various possibilities from a full desktop environment for general usage to more administration oriented solutions. – Stef K Apr 23 '13 at 16:15
  • Great list - is there an 'official' overview of alternatives somewhere? – Reinier Post Jun 16 '14 at 09:18
  • I am not aware of a report - post mentioning all solutions, Google is your friend... – Stef K Jun 16 '14 at 10:07
  • Can you tell, what are additional steps? i.e. installed from terminal (I use VPS), then how to setup/connect to it from i.e. my Windows 10? – T.Todua Jan 13 '19 at 11:40
  • I did "sudo apt-get install ubuntu-desktop". Then RD on Google how can I open Desktop. I see https://www.cyberciti.biz/faq/ubuntu-linux-install-gnome-desktop-on-server/ . Then I run this command sudo tasksel. Enable Ubuntu desktop. run - sudo apt install ubuntu-desktop. But still I did not open GUI or desktop version. Please guide me step by step. I am using ubuntu 18.04 server version – Md Maidul Islam May 13 '19 at 11:45
  • What is the difference between the "default Ubuntu desktop" and the "official flavor"? Would be better answer if this was clear imo. – aquirdturtle Aug 01 '22 at 22:02
87

Hi guys after a little research I wanted to share an answer too!
Some more info can be found here https://help.ubuntu.com/community/ServerGUI. I assume you start with a clean install of Ubuntu Server 16.04 (some modifications may be needed for older versions of Ubuntu). Depending on your needs you can do these:

  1. Minimal GUI:

    sudo apt install xorg
    sudo apt install --no-install-recommends openbox
    

    Run the command startx and openbox will start (you can open a terminal there and run any application you want)

  2. Minimal GUI with display manager:

    sudo apt install xorg
    sudo apt install --no-install-recommends lightdm-gtk-greeter
    sudo apt install --no-install-recommends lightdm
    sudo apt install --no-install-recommends openbox
    

    After reboot you will see the lightdm login menu.

  3. A more functional minimal desktop environment (the one I use):

    sudo apt install xorg
    sudo apt install --no-install-recommends lightdm-gtk-greeter
    sudo apt install --no-install-recommends lightdm
    sudo apt install --no-install-recommends lxde-icon-theme
    sudo apt install --no-install-recommends lxde-core
    sudo apt install --no-install-recommends lxde-common
    sudo apt install --no-install-recommends policykit-1 lxpolkit
    sudo apt install --no-install-recommends lxsession-logout
    sudo apt install --no-install-recommends gvfs-backends
    

    EXPLANATION: lxde-icon-theme is needed for basic icons(there are alternatives), lxde-core and lxde-common will install the basic lxde components, policykit-1 andlxpolkit are needed to run pkexec, lxsession-logout is needed so that the logout menu works, gvfs-backends is needed if you want trash,network,devices etc support at pcmanfm

  4. A full lightweight desktop environment:

    sudo apt install xorg
    

    Then choose one of these:

    sudo apt install --no-install-recommends lubuntu-core
    

    OR

    sudo apt install --no-install-recommends xubuntu-core
    

    OR

    sudo apt install --no-install-recommends ubuntu-mate-core
    

    EXPLANATION: Each of these metapackages is based on lxde,xfce and mate desktop respectively including dependencies such as alsa, lightdm etc. and with many more packages such as themes, configurations etc.

  5. A full lightweight desktop environment without minding the recommendations:

    Choose one of these:

    sudo apt install lubuntu-core
    

    OR

    sudo apt install xubuntu-core
    

    OR

    sudo apt install ubuntu-mate-core
    

    EXPLANATION: Almost the same as 4 (including full xorg installation) but with many more packages such as bluetooth, printers, scanner support, different themes and fonts, basic gnome tools etc.

  6. A full desktop with all the extras (better choose another option):

    Choose one of these:

    sudo apt install lubuntu-desktop
    

    OR

    sudo apt install xubuntu-desktop
    

    OR

    sudo apt install ubuntu-mate-desktop
    

    OR

    sudo apt install ubuntu-gnome-desktop
    

    OR

    sudo apt install ubuntu-desktop
    

    OR

    sudo apt install kubuntu-desktop
    

    EXPLANATION: This will install everything that the live cd of each ubuntu flavor installs (that means even the media players or whatever they find useful for their flavor. So, it's not recommended option

TIP1: The --no-install-recommends options applies to all dependencies packages recursively so I first install xorg package to make sure all graphic drivers and other packages are installed and so that my system is portable even if I change motherboard or GPU. Some people install only components of xorg but I've never been able to create a usable system this way.

TIP2: If an option you choose installs network-manager and network-manager-gnome then better use it to configure your network and delete everything at /etc/network/interfaces file (except the lo interface) in order to avoid conflicts.

TIP3: If you need remote desktop via x11vnc then choose option 2 to 6 (I think you also need to add option -auth guess and -loopso that vnc works before you login and after you logout)

TIP4: At options 2 to 6 if you wanna stop lightdm autostarting then run the command sudo systemctl disable lightdm and you can start it whenever you want with sudo systemctl start lightdm. To re-enable it run sudo systemctl enable lightdm and check it with systemctl is-enabled lightdm (sometimes you can't re-enable it and the is-enabled commands has output static so run sudo apt install --reinstall lightdm to fix it)

TIP5: There is also another option (which I left out on purpose). You can install the specific desktop environment metapackage like lxde, xfce4, mate-desktop-environment, plasma-desktop, unity, gnome. However, you will need more packages than just xorg in most cases and these packages or metapackages might install packages that are not longer preferred by any Ubuntu flavor. For example lxde installs wicd as recommendation when all flavors (including lubuntu) use network-manager and network-manager-gnome nowadays. To see differences between packages you can search here: http://packages.ubuntu.com/

TIP6: If upon boot you see the greeter and it throws you back to tty again, then simply restart the lightdm by firing sudo service lightdm restart

DigiGoon
  • 23
  • 3
  • 1
    Wow! Thanks for all those details! I really like how you broke them down by starting with minimalistic and then to fully loaded. – Lance Kind Oct 03 '19 at 00:08
64

Ubuntu Server never comes with a GUI. All activities that you need to do on a server can to be done through terminal. Even if you download the GUI, you will probably be able to access internet and get online support via forums or through chat. But there are no server / activities management tools for linux as yet which need a GUI for management.

If you are looking for some GUI similar to Windows Server, then such GUI does not exist for Ubuntu Server. But you can download a Ubuntu desktop on a server to get the UI...All server related activities will still be required to be done through the terminal. You can download the desktop GUI on the server through the following command...

Following are the options

  1. To install the default Unity desktop environment: sudo apt-get install ubuntu-desktop

  2. To install the Unity desktop environment without addons like (Email, OpenOffice): sudo aptitude install --without-recommends ubuntu-desktop

  3. To install a very lightweight desktop environment, just the basic GUI (XFCE): sudo apt-get install xubuntu-desktop (or LXDE: sudo apt-get install lubuntu-desktop for an even lighter GUI)

edwinksl
  • 23,789
  • 11
    I suggest since it's a server the following: sudo apt-get install --no-install-recommends ubuntu-desktop Keep it minimal. – Karl Morrison Feb 03 '15 at 14:11
  • 2
    @ScottBeeson Hi, Scott. Launching the command from the first answer doesn't lock you into that command. You can apt-get remove packages (i.e. desktop environments) just as easy as you tan apt-get install them. If you apt-get installed the first solution, you can look at it and decided if that is for you. If it's not, just sudo apt-get remove ubuntu-desktop then install a different one to try out. – L. D. James Aug 30 '15 at 13:36
  • 2
    "All activities that you need to do on a server can to be done through terminal." I have to disagree. I'm installing a gui on my dedicated right now as I need to run a java service that has no command line options. I will say it is rare, but sometimes you need to connect to an xserver. This includes some of the cool stuff you can do via xserver remotely. – David Cahill Sep 13 '15 at 22:29
  • @edwinksl I suppose I'll remove the "-get" again once 14.04 goes EOL in 3 years, as apt is recommended in 16.04+. – Aaron Franke Sep 18 '16 at 23:59
  • @AaronFranke Yeah, that may work, but for now, I would keep apt-get for answers that target 14.04 and older. Also, I don't think all functionality in apt-get exists in apt yet, so I wouldn't consider apt a complete replacement of apt-get in 16.04. Your edits are great by the way, but I would suggest not changing apt-get to apt. :) – edwinksl Sep 19 '16 at 00:02
  • @ScottBeeson Could you please explain what confused you in my answer? Especially since you liked this answer, which mentions the exact same command. – Gilles 'SO- stop being evil' May 25 '18 at 08:54
  • @WinEunuuchs2Unix It's just been pointed out to me that several comments on this page state that my answer is wrong. It would have helped if at least one of those comments were on my answer instead of being on other posts where they didn't notify me! However, none of the comments explain in what way my answer is wrong. It is still true today that Ubuntu Server and Ubuntu Desktop are not separate distributions, they're only separate installers. So why do you consider my answer to be wrong? – Gilles 'SO- stop being evil' May 25 '18 at 08:56
  • @Gilles My comment is over a year old and I honestly can't recall what I was thinking at that time. It appears to be based on Scott Beeson's comment from 2015 that the first answer was wrong. It's hard to know what the first answer was back then. Consequently I've deleted that comment. As an aside I've benefited greatly by your many answers in Unix&Linux. – WinEunuuchs2Unix May 25 '18 at 10:30
  • I should have read all answers before jumping on this one - he sounded so confident. I used his last LXDE recommendation and lo & behold it installed all fonts and printer drives and all sorts of crap and took over an hour. How is this even considered MINIMAL, jeez ?? – killjoy Jun 19 '18 at 15:11
  • @L.D.James I made the same mistake as others following answers top-down which I hate, on this site; the first apt-get remove lubuntu-desktop worked, but the second apt-get remove lubuntu-core did squat and left a butt-load of packages behind, including x-org and gnome stuff - any idea why ? – killjoy Jun 19 '18 at 16:37
  • @killjoy did you try apt purge? – Paul Sep 08 '18 at 18:49
  • I did "sudo apt-get install ubuntu-desktop". Then RD on Google how can I open Desktop. I see cyberciti.biz/faq/ubuntu-linux-install-gnome-desktop-on-server . Then I run this command sudo tasksel. Enable Ubuntu desktop. run - sudo apt install ubuntu-desktop. But still I did not open GUI or desktop version. Please guide me step by step. I am using ubuntu 18.04 server version – Md Maidul Islam 4 secs ago – Md Maidul Islam May 13 '19 at 11:45
21

The reason why it's called "Server" is because it's lightweight (no GUI or extra packages) to run the machine as lean as you possibly can. Adding a GUI to it defeats the purpose of a Server installation.

However, installing as Server then using apt-get install/aptitude install your choice of a desktop can help to weed out unnecessary applications than from doing a direct installation of a Ubuntu Desktop release. If you're going this route, I personally like

sudo aptitude install --without-recommends ubuntu-desktop

EDIT: However, if you're using it as a real "Server" (ftp, web hosting, DNS, etc.), it is highly recommended to learn how to navigate Ubuntu via its shell instead of the GUI.

And what UbuntuIngrained said about the necessity of knowing the shell isn't necessarily true. There are packages that install GUIs for different server functions.

  • About your EDIT note, do you have any tutorial link to navigate Ubuntu server via its shell instead of the GUI?! – Dr.jacky Sep 30 '15 at 05:22
  • 2
    The reason we need a minimal GUI without all the trash is we run a development app server on a VM, so we need a browser and decent File Manager and dont forget, IDE. Hope everyone who preaches against min GUI in server installs gets this :) - Obviously installing on a blade - no one would want GUI. – killjoy Jun 19 '18 at 16:51
18

Ubuntu server is designed to use minimal resources. A GUI will lead to high resource usage, however if you still want a GUI, you can install only what's required for the default Unity desktop.

Install ubuntu-desktop with the argument --no-install-recommends. This will exclude unnecessary software and tools like LibreOffice, Firefox, Thunderbird, etc.

sudo apt-get install --no-install-recommends ubuntu-desktop

Read these guides.

  • This is the answer everyone should be using, the accepted answer above installs the entire desktop. This answer (also in some comments above) is the stripped down version. – Guy Starbuck Apr 13 '16 at 15:36
  • @ubuntuhelp - so which 'core' does this install ? nm - I just saw you linked gnome. – killjoy Jun 18 '18 at 22:34
12

Ubuntu Server has no GUI, but you can install it additionally. Simply login with the user you created during installation and install the Desktop with.

sudo apt-get install ubuntu-desktop

Afterwards type

reboot

and you are done.

ddeimeke
  • 3,089
6

If you look very closely at the official Ubuntu Server Guide. Chapter 6 Remote Administration you will find that the last article would be of extreme interest. Trust me you do not want to install a DeskTop environment on a server, it uses up too many resources up to 50 to 60% if you go bananas and you don't get any benefit to control your server from a GUI standpoint.

Read and digest chapter 6.3 Zentyal. That is what you would need. I can't believe I overlooked that myself. So don't be afraid to install it, this is a full blown web interface that my first impression of installing the zentyal-core and zentyal-common was "AWESOME" look no further for anything other than the sanctioned web interface by Ubuntu creators.

However looks like this software might cost you money, but if you are serious about using a GUI, I'm sure the fees might be affordable for light use. Not everything in life is free if you want it bad enough. However I am sure home use might be fee free, depends on what services you need. This software comes with lots of modules, I dare say you should only install the ones you need.

MagicCamera
  • 121
  • 2
  • 4
5

Some of the desktop managers have core-packages, so you can only install the desktop without any applications.

  • LXDE: sudo apt-get install lxde-core (for full sudo apt-get install lxde )
  • XFCE: sudo apt-get install xfce4 (for full sudo apt-get install xubuntu-desktop)
  • GNOME: sudo apt-get install gnome-core (for full sudo apt-get install gnome)

Source

muru
  • 197,895
  • 55
  • 485
  • 740
3

Instead of adding A full Desktop Environment, consider adding a lightweight web-based frontend.

Cockpit has been in the Ubuntu Repositories since 16.04.

  • Does not use any non-Ubuntu sources
  • Does not change any server configuration files
  • Easy to use, easy to understand

Installation is trivial:

    sudo apt install cockpit
    // After install, point your web browser at http://<server_ip_address>:9090

Removal is just as easy:

    sudo apt remove cockpit.
    // No weird scripts, no additional cleanup.
user535733
  • 62,253
3

Install gnome package via sudo apt-get install ubuntu-desktop. You might additionally need to install: x-window-system-core, xserver-xorg, gnome-desktop-environment, gdm but apt-get will probably do that.

As to the internet thingy: You can set up a bridge or emulate a router. How to do that depends a bit on your hardware. There is a myriad of forum posts and howtos available on that subject. Use Google.

Packages of interest: bridge-utils OR dnsmasq. The hostapd package is for WLAN access point if you want your laptop to be one. But frankly I don't see, why you don't connect your sever to the internet. A WLAN card is cheap and easy and I suppose your internet laptop is connected through a router already.

con-f-use
  • 18,813
3
  1. Configuring an interface:

    sudo ip link set dev eth0 down
    sudo dhclient eth0
    

    This will bring eth0 up using DHCP.

  2. Install your choice of a desktop:

    sudo apt-get update
    sudo apt-get install ubuntu-desktop
    reboot
    
Eric Carvalho
  • 54,385
2

The thing is, there is no GUI included with the server edition. You can install and use Webmin - a web based graphical interface, or, if you want desktop-like GUI, you'll need to pick and install the packages manually. The bare minimum would be Xorg, a window manager and probably a file manager.

con-f-use
  • 18,813
mikewhatever
  • 32,638
  • 5
    Webmin has been removed form the package list. It can lead to a severely damaged system. It edits configuration files in a non debian/ubuntu conform manner. – con-f-use Jul 20 '11 at 09:29
1

Gathering from what you are saying I assume you would like one of two things:

  1. Re-install MacOS
  2. Install a GUI on the (already cleanly wiped) system.

Am I correct in this?

If it's the first, you should mark this and ask a Moderator to move it the "Ask Different" section, if it's the second you once again have two choices:

  1. Download the Ubuntu 11.04 Desktop installation DVD and install all the required packages on the server, or
  2. Simply install the Desktop Edition on the system from scratch (my suggestion, since you have already wiped everything of interest anyways) and then install any needed server components on top of that using Ubuntu's package manager, Synaptic, or the CLI.
Eugéne
  • 217