我可以将 Ubuntu Desktop 14.04 转换为服务器吗?

Jos*_*lle 30 server 14.04

我找到了几种将 Ubuntu 12.04 桌面转换为服务器的解决方案,使用以下命令:

sudo apt-get install tasksel
sudo tasksel remove ubuntu-desktop
sudo tasksel install server
apt-get install linux-server linux-image-server
apt-get –purge remove lightdm
Run Code Online (Sandbox Code Playgroud)

我只想知道它是否与 Ubuntu 14.04 的过程相同。我需要这样做的原因是因为我需要安装moodle(有些人可能有其他原因这样做,所以我希望这对他们也有帮助)并且它需要在 Ubuntu Server 而不是桌面上运行。谢谢

小智 31

注意:以下命令仅适用于 Ubuntu 版本低于/低于 12.04,请参阅服务器常见问题解答,注意:您最终可能会得到一个无用的系统。

感谢您的回答,但我发现您需要添加更新行

sudo apt-get update
Run Code Online (Sandbox Code Playgroud)

还更正了以下行

sudo apt-get -purge remove lightdm
Run Code Online (Sandbox Code Playgroud)

sudo apt-get purge lightdm
Run Code Online (Sandbox Code Playgroud)

更正后脚本的完整版本如下

# update
sudo apt-get update

# install the 'tasksel' package so we can remove the desktop image       
sudo apt-get install tasksel

# remove the desktop image
sudo tasksel remove ubuntu-desktop

# tell tasksel to start the server image setup
sudo tasksel install server

# install the server images
sudo apt-get install linux-server linux-image-server

# remove lightdm
sudo apt-get purge lightdm

# remove all packages no longer required (~400 MB)
sudo apt-get autoremove
Run Code Online (Sandbox Code Playgroud)

  • 在 Ubuntu 15.10 上,我必须在删除桌面映像后重新安装 `tasksel`。此外,不需要(也不能)安装服务器映像,因为“自 12.04 以来,Ubuntu 桌面和 Ubuntu 服务器之间的内核没有区别”(http://bit.ly/1S54S2d)。 (2认同)

小智 4

简单的答案是肯定的,但是运行命令您就可以安装 Ubuntu 服务器。确保对位于 的 grub 配置文件进行以下更改/etc/default/grub

\n\n
GRUB_TIMEOUT=10\n( Comment out \xe2\x80\x98GRUB_HIDDEN_TIMEOUT\xe2\x80\x99 )\nGRUB_CMDLINE_LINUX_DEFAULT=\xe2\x80\x9d"\nGRUB_TERMINAL=console ( only for PC )\n
Run Code Online (Sandbox Code Playgroud)\n\n

然后你就可以运行

\n\n
sudo update-grub\n
Run Code Online (Sandbox Code Playgroud)\n