How do you completely remove ubuntu-desktop along with all installed packages with it? I'm using Ubuntu 14.04 server on vps and used sudo apt-get install ubuntu-desktop to install.
6 Answers
Even better than just doing remove, you can use purge and then autoremove.
sudo apt-get purge ubuntu-desktop
sudo apt-get autoremove
Purge option according to the man page for apt-get:
**purge**
purge is identical to remove except that packages are
removed and purged (any configuration files are deleted too).
First do
sudo apt-get remove ubuntu-desktop
sudo apt-get autoremove
Then do the
sudo apt-get remove nautilus nautilus-* gnome-power-manager gnome-screensaver gnome-termina* gnome-pane* gnome-applet* gnome-bluetooth gnome-desktop* gnome-sessio* gnome-user* gnome-shell-common zeitgeist-core libzeitgeist* gnome-control-center gnome-screenshot && sudo apt-get autoremove
to end up with a completely GUI'less environment. This worked for me to remove the ubuntu-desktop I had installed on my Ubuntu Server
Remove the package and the auto-remove the installed dependencies. As root
:
apt-get remove ubuntu-desktop
apt-get autoremove
See also apt-get(8)
manual page for the autoremove
argument.
autoremove (and the auto-remove alias since 1.1)
autoremove is used to remove packages that were automatically installed to satisfy dependencies for other packages and are now no longer needed.
sudo apt-get -y purge x11*
sudo apt-get autoremove -y && sudo apt-get autoclean -y
This will make sure that any gui based application will also be deleted (web browsers etc)
Ubuntu:
sudo apt-get --purge remove libgtk-3-common
Kubuntu:
sudo apt-get --purge remove libqtcore4 libkdecore5 kdelibs-bin
Lubuntu (Version <= 18.04):
sudo apt-get --purge remove libgtk2.0-0
Xubuntu:
sudo apt-get --purge remove libgtk2.0-0 libgtk-3-common
Little script of mine:
#!/bin/bash
sudo apt-get install sed -y
##############UWAGA#################
#potrzebne jest dodatkowe utworzenie dwóch plików:
#usun.txt - gdzie po spacjach wpisujemy paczki do usunięcia - skrypt sam zajmie się usunięciem zależności
#instaluj.txt - gdzie po spacjach wpisujemy paczki do zainstalowania (obligatoryjny jeżeli po reboocie nie chcemy zastać czarnego, zimnego tty ;p)
#aptitude sam rozwiązuje zależności między usuwanymi a instalowanymi paczkami
#nie odpowiadam za ew. szkody ;p
#nie ma za co ;)
usun=`cat usun.txt`
chuj=`apt-cache depends $usun | sed -e 's/.*\ //g' | tr '\r\n' ' '`
instaluj=`cat instaluj.txt`
for i in $instaluj
do
inst=$inst"$i+ "
done
sudo apt-get install aptitude -y
sudo aptitude remove $usun $chuj $inst -y && sudo apt-get autoremove -y && sudo reboot
You have to make 2 additional files:
usun.txt - that should contain metas (like ubuntu-desktop) separated with spaces you want dependencies to get rid of.
instaluj.txt - metas you want to install/keep installed. That would be obligatory if you don't want to see deep, black tty after reboot. Otherwise I'm not responsible for damages.