ubuntu-desktop-to-server
2022年6月28日大约 2 分钟
上一级页面:index-wsl
前言
有些时候我们需要将desktop环境转化为server环境
Ubuntu Desktop只是一个依赖于GNOME Desktop的元包。我们可以说这个元包的创建是为了确保GNOME不会轻易被删除。
注意:
- 不要在生产环境(production)或服务器环境(server)安装
ubuntu-desktop或其他任何*-desktop,这会造成严重的依赖冲突 - 任何时候,不要卸载
ubuntu-desktop,因为卸载它会造成严重的依赖缺失 - 作为替代,你可以选择卸载gnome-shell以及gnome系的几个扩展
转化
安装ubuntu-server-minimal
sudo apt install ubuntu-server-minimal重新启动
sudo systemctl reboot设置多用户
sudo systemctl set-default multi-user.target重新启动
sudo systemctl reboot然后,不要卸载 GNOME 元软件包ubuntu-desktop
# 不要执行下面的操作
# uninstall ubuntu-desktop注意:这里非常危险,请不要--autoremove标签,更不要使用purge
警告:在此步骤中要格外小心
清除Gnome,这是GNOME实际被删除的时候。见ubuntu安装和卸载gnome中卸载gnome的步骤
清理残余的包
查看建议删除的包,
sudo apt update && sudo apt upgrade并且把部分需要的软件包标记为手动安装
sudo apt install <package1> <package2> ...然后删除软件包。
警告:在此步骤中要格外小心
sudo apt autoremove检查剩余的包
在这一点上,你差不多完成了。但是,可能会有一些剩余的 GNOME 软件包。检查Gnome分类中已安装的内容
sudo aptitude并选择其中,自己认为不需要的部分进行删除
sudo apt remove gedit然后删除软件包。
警告:在此步骤中要格外小心
sudo apt autoremove一切正常