How do I switch from Ubuntu desktop to Ubuntu server?

Actually, if you just have problem with running the GUI there's no need to install another distribution, simply modify the startup sequence to prevent the graphical interface from coming up and work from the command line as you desire.

I don't have access to a system right now, but I believe the script you'll need will be found in the /etc/init.d or /boot/grub directory. Perhaps someone here can give you the name of the script before I get home to check.

I just found this: Starting Ubuntu without the GUI

I see three ways to do it:

  1. Changing the default runlevel

    You can set it at the beginnign of /etc/init/rc-sysinit.conf replace 2 by 3 and reboot. You can enable the graphical interface with telinit 2.(More about runlevels)

  2. Do not launch the graphical interface service on boot

    update-rc.d -f xdm remove
    

    Quick and easy. You can re-enable the graphical interface with service xdm start or revert your changes with update-rc.d -f xdm defaults

  3. Remove packages

    apt-get remove --purge x11-common && apt-get autoremove
    

    I think it suits best for a computer considered as a server. You can re-enable the graphical interface by reinstalling the packages

There's also this: Possible to install ubuntu-desktop and then boot to no GUI

The point being, you can prevent the GUI from coming up if that's your main issue.


I think that an easy way is with tasksel via command line.
Open a terminal and digit:

$ sudo apt-get install tasksel

then

$ sudo tasksel

It will show a simple gui-cli that lets you to choose what you want by a simple check/uncheck (for eg. uncheck "Ubuntu desktop" and also check "Basic Ubuntu server" and "LAMP server".
That's it