环境:华为云服务器、ubuntu14
一、场景:
我的华为云服务器是从本地VMware迁移出去的服务器,由于是学习用的虚拟机所以还是搭建的带有桌面环境,后续更换至云主机后,因为规格比较小,发现桌面环境占用内存较大,所以考虑卸载桌面环境释放多余的内存。
使用top命令,shift+m查看内存占用情况。三个gnome进程就23% ,无奈服务器只有2g,属实捉襟见肘。
top - 13:46:12 up 5 days, 16:15, 2 users, load average: 0.03, 0.05, 0.01
Tasks: 241 total, 1 running, 196 sleeping, 0 stopped, 1 zombie
%Cpu(s): 0.7 us, 0.2 sy, 0.0 ni, 99.0 id, 0.2 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 2040264 total, 405112 free, 1160168 used, 474984 buff/cache
KiB Swap: 969960 total, 969960 free, 0 used. 706996 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
15249 czx 20 0 3531476 185240 21548 S 0.3 9.1 0:38.12 gnome-shell
15672 czx 20 0 1337572 155796 1712 S 0.0 7.6 0:05.59 gnome-software
1455 gdm 20 0 3478304 145448 24544 S 0.3 7.1 2:47.71 gnome-shell
二、开始卸载
参考该博客就行,按顺序执行。Linux(Ubuntu)卸载桌面环境_ubuntu 卸载 gnome-CSDN博客
防止失联,这里自己也记录一下
1.先杀死gnome各进程程序
kill -9 15249 15672 1455
2.卸载掉gnome-shell主程序
sudo apt-get remove gnome-shell
3.卸载掉gnome
sudo apt-get remove gnome
4.卸载不需要的依赖关系
sudo apt-get autoremove
5.彻底卸载删除gnome的相关配置文件
sudo apt-get purge gnome
6.清理安装gnome时候留下的缓存程序软件包
sudo apt-get autoclean
sudo apt-get clean
重启服务器,再次使用top命令查看内存占用信息。也可不重启,前提是需要杀死掉不需要的进程。