如何执行Ubuntu桌面的无人值守安装?

我知道关于Ubuntu服务器无头和无人值守安装的信息很多。但是我需要在许多机器上安装Trusty的桌面版本,并且我希望能够自动化这个过程。使用Kickstart和Preseed手册,我无法实现Ubuntu 14.04桌面版64位的无人值守安装。
是否有一个我没有找到的手册?如果能得到一些帮助就太好了。我已经花了几个小时在这个问题上。
我的txt.cfg在/isolinux/目录下:
default autoinstall
label autoinstall
     menu label ^Autoinstall Ubuntu POS-Server
     kernel /install/vmlinuz
     append preseed/file=/cdrom/preseed/pos.seed debian-installer/locale=de_DE console-setup/layoutcode=de initrd=/install/initrd.gz ramdisk_size=16384 ks=cdrom:/ks.cfg  root=/dev/ram rw --

我的pos.seed在/preseed/中。
d-i partman/confirm_write_new_label boolean true
d-i partman/choose_partition \
select Finish partitioning and write changes to disk
d-i partman/confirm boolean true

d-i debian-installer/locale string en_US.UTF-8
d-i debian-installer/splash boolean false
d-i console-setup/ask_detect boolean false
d-i console-setup/layoutcode string de
d-i console-setup/variantcode string

### Network
d-i netcfg/choose_interface select auto

## Keyboard configuration
d-i keyboard-configuration  keyboard-configuration/layoutcode       string  de
d-i keyboard-configuration  keyboard-configuration/layout   select  German
d-i keyboard-configuration  keyboard-configuration/variant  select  German
d-i keyboard-configuration  keyboard-configuration/xkb-keymap       select  de

#### Advanced options
### Running custom commands during the installation
# This first command is run as early as possible, just after
# preseeding is read.
# if old filesystem present installer asks for unmount
d-i preseed/early_command string umount /media

### Package selection
# Individual additional packages to install
# Install the Ubuntu desktop.
tasksel tasksel/first multiselect ubuntu-desktop
d-i pkgsel/include string openssh-server build-essential
# Policy for applying updates. May be "none" (no automatic updates),
# "unattended-upgrades" (install security updates automatically), or
# "landscape" (manage system with Landscape).
d-i pkgsel/update-policy select none
# Enable extras.ubuntu.com.
d-i apt-setup/extras    boolean true

我的 ks.cfg 在 /:

#Generated by Kickstart Configurator
#platform=AMD64 or Intel EM64T

#System language
lang en_US
#Language modules to install
langsupport en_US
#System keyboard
keyboard de
#System mouse
mouse
#System timezone
timezone Europe/Berlin
#Root password
rootpw --disabled
#Initial user
user ****** --fullname "******" --iscrypted --password ******************
#Reboot after installation
reboot
#Use text mode install
text
#Install OS instead of upgrade
install
#Use CDROM installation media
cdrom
#System bootloader configuration
bootloader --location=mbr locale=de_DE console-setup/ask_detect=false keyboard-configuration/layoutcode=de
#Clear the Master Boot Record
zerombr yes
#Partition clearing information
clearpart --all --initlabel 
#Partitioning
part / --fstype ext4 --size 1 --grow --asprimary
part swap --recommended
part /boot --fstype ext4 --size 256 --asprimary
#System authorization infomation
auth  --useshadow  --enablemd5 
#Network configuration
network --bootproto=dhcp --device=eth0
#Firewall configuration
#firewall --disabled 
#Do not configure the X Window System
skipx
#custom packages for installation
%packages
openssh-server
ubuntu-desktop

通过这个设置,我能够搭建一个服务器,但无法搭建一个桌面。 - Timo
2个回答

尽管安装了不同的软件包集,但服务器版和桌面版之间实际上没有真正的区别。

有一个名为"ubuntu-desktop"的元软件包,它包含了Ubuntu桌面版所安装的所有软件包。默认仓库中还提供了Kubuntu、Edubuntu、Lubuntu和Xubuntu的元软件包。

只需使用Ubuntu服务器的教程,并将此软件包添加到您的kickstart文件中,而不是与服务器相关的软件包(根据安装过程中选择的服务,可能还会安装其他元软件包,如"openssh-server")。如果没有选择任何服务(或在kickstart文件中列出),则会得到一个最小化的Ubuntu系统,没有任何额外的内容。

以下是Preseed文件中相关部分的示例:

### Package selection
tasksel tasksel/first multiselect ubuntu-desktop
#tasksel tasksel/first multiselect lamp-server, print-server
#tasksel tasksel/first multiselect kubuntu-desktop

在这里找到示例文件

对于Kickstart文件也是一样:

%packages
ubuntu-desktop

不要使用@ubuntu-desktop,这意味着安装一个软件包组,但在deb世界中,软件包组是一个元软件包,它会作为依赖项拉取其他软件包。

嗨,谢谢。 基本上我使用了这个教程:如何创建完全无人值守安装的Ubuntu? 但是我失败了。可能是因为txt.cfg与server-txt-cfg有很大不同。 - Timo
好的...我明白了,我会尝试让我的服务器安装自动安装ubuntu-desktop软件包。 - Timo
抱歉,无法将ubuntu-desktop添加到kickstart或preseed文件中。它根本不起作用。 - Timo
我刚刚在答案中添加了更多信息。我觉得你对packagegroup和metapackage有些困惑。我在你的preseed文件中也没有看到"ubuntu-desktop"的列表。 知道你所说的"just does not work"具体指什么会很好。安装这种方式后,你遇到了什么样的系统问题? - Christian
我又更新了我的文件示例。在预设文件中有ubuntu-desktop。我从kickstart文件中删除了@符号。我尝试了几个不同的选项。最后它总是自动安装,但始终只安装服务器版本,没有安装ubuntu-desktop,并且没有设置我的键盘布局为德语。我需要桌面环境能够自动启动。 - Timo
它是没有被安装还是只是没有自动启动?你在Kickstart文件中使用了"skipx"参数进行安装吗? - Christian
我使用了上面的文件,但在ubuntu-desktop之前加上了@符号,并且没有网络。现在它可以工作了!显然,我需要互联网连接来下载桌面数据,而且你说的@符号是错误的。 - Timo

问题是你只指定了光盘作为安装源。服务器镜像中不包含ubuntu-desktop。
我的解决方法是同时添加一个网络源:
# Installation media. Use both CD-ROM and Net
cdrom
url --url http://archive.ubuntu.com/ubuntu

理想情况下,我们应该将这些软件包添加到主ISO镜像中,但是我还没有找到如何实现这一点的方法。