How to check if Ubuntu Desktop or Server is installed?

I have a shared hosting. I have access to shell. The OS is Ubuntu, and I want to check whether it is the server version or desktop version.

When I log in through shell, it shows following information:

Linux [server-name] 2.6.32-24-generic #39-Ubuntu SMP Wed Jul 28 06:07:29 UTC 2010 i686 GNU/Linux
Ubuntu 10.04.1 LTS

Solution 1:

dpkg -l ubuntu-desktop 

will tell you if the suggested desktop components are installed.

uname -a

will tell you whether the server or generic kernel is being used.

"Desktop or server" is not a binary thing - it's possible to have some desktop components installed on a machine originally installed as a server, etc.

You have to decide what package you want to use as the key distinction between "server" or "desktop". Maybe xserver-xorg is a good choice, though even some servers will have that for package dependencies or to support remote desktops.

Solution 2:

This answer isn't as cut and dry as some people are making out. You can do a ubuntu-standard package install and use that as a server. You can use ubuntu-minimal as a server. You can take ubuntu-desktop and break it so it doesn't use X... Or even leave X there for administration (eww). You can change the kernel packages from -server to -generic to -rt etc. You can change the motd or even just upgrade from a version where the motd isn't as long as the new one (none of my servers have ever come out with all that guff -- probably because they're upgraded from older LTSes).

I guess the questions that all of us should be asking are: Why does it matter? What are you trying to learn? What difference does it make to you?

If you're trying to run something graphical, check for what you actually need (X, x11vnc, etc). If you're trying to check that there isn't a graphical interface, do the same!

Solution 3:

it can be checked by typing cat /etc/motd. The output will be defferent on server and different on desktop edition.

Desktop:

Ubuntu 10.10

Welcome to Ubuntu!
 * Documentation:  https://help.ubuntu.com/

Server:

Ubuntu 10.10

Welcome to Ubuntu!
 * Documentation:  https://help.ubuntu.com/

  System information as of Wed Nov 10 20:54:11 UTC 2010

  System load:  0.07               Processes:           78
  Usage of /:   30.4% of 14.76GB   Users logged in:     1
  Memory usage: 38%                IP address for eth0: XXXXXXXX
  Swap usage:   0%

  Graph this data and manage this system at https://landscape.canonical.com/
---------------------------------------------------------------------
At the moment, only the core of the system is installed. To tune the 
system to your needs, you can choose to install one or more          
predefined collections of software by running the following          
command:                                                             

   sudo tasksel --section server  

It is also worth mentioning that this file is easily editable by sudo, which is done very often, because it's the message that user sees when he logs via ssh.

Solution 4:

This may not be the fastest or purest way to tell, but run:

dpkg --get-selections | grep linux-image | grep -v deinstall

If the currently installed linux-image package contains the word "server" in it, then you're running Ubuntu server.

For example, the current latest kernel package for Ubuntu 10.10 desktop:

linux-image-2.6.35-22-generic

And server:

linux-image-2.6.35-22-server

For a more generic package that should be the same across different versions of Ubuntu, linux-image-generic is the default package for Ubuntu desktop and linux-image-server is the default for the server edition.