我正在尝试使用 Packer 从备用 ISO(不是实时版本)设置无人值守的 18.04.2 LTS 服务器安装。我已将预置文件设置为从虚拟软盘复制。启动命令输入到 VM 中,预置文件中的所有内容似乎都加载正常,但在安装完成后重新启动 VM 后,我没有看到桌面。我以为我已经通过谷歌搜索把所有东西拼凑起来了,但现在我陷入了困境。
这是我的打包机配置:
{
"_comment": "Build with `packer build ubuntu.json`",
"variables": {
"boot_command_prefix": "<esc><esc><enter><wait>",
"cleanup_pause": "",
"cpus": "2",
"desktop": "true",
"disk_size": "65535",
"headless": "false",
"iso_checksum": "34416ff83179728d54583bf3f18d42d2",
"iso_checksum_type": "md5",
"iso_name": "xubuntu-18.04.2-server-amd64.iso",
"iso_path": "C:\\dev\\Packer",
"iso_url": "C:\\dev\\Packer\\ubuntu-18.04.2-server-amd64.iso",
"locale": "en_US",
"memory": "4096",
"preseed" : "preseed.cfg",
"hostname": "epoch3dev-template",
"ssh_fullname": <full name>,
"ssh_password": <password>,
"ssh_username": <user>,
"update": "false",
"rc_version": "1",
"vm_basename": "EpochIIIDevVM-RC",
"vmware_guest_os_type": "ubuntu-64"
},
"builders": [
{
"boot_wait": "5s",
"boot_command": [
"{{ user `boot_command_prefix` }}",
"/install/vmlinuz ",
"initrd=/install/initrd.gz ",
"auto=true ",
"priority=critical ",
"file=/floppy/{{ user `preseed` }} ",
"hostname={{ user `hostname` }} ",
"-- <enter>"
],
"disk_size": "{{ user `disk_size` }}",
"floppy_files": [
"{{ user `preseed` }}"
],
"guest_os_type": "{{ user `vmware_guest_os_type` }}",
"headless": "{{ user `headless` }}",
"http_directory": "http",
"iso_checksum": "{{ user `iso_checksum` }}",
"iso_checksum_type": "{{ user `iso_checksum_type` }}",
"iso_urls": [
"{{ user `iso_path` }}/{{ user `iso_name` }}",
"{{ user `iso_url` }}"
],
"output_directory": "output-{{ user `vm_basename` }}{{ user `rc_version` }}",
"shutdown_command": "echo '{{ user `ssh_password` }}'|sudo -S shutdown -P now",
"ssh_password": "{{ user `ssh_password` }}",
"ssh_username": "{{ user `ssh_username` }}",
"ssh_wait_timeout": "10m",
"tools_upload_flavor": "linux",
"type": "vmware-iso",
"vm_name": "{{ user `vm_basename` }}{{ user `rc_version` }}",
"vmx_data": {
"ethernet0.pciSlotNumber": "32",
"memsize": "{{ user `memory` }}",
"numvcpus": "{{ user `cpus` }}"
},
"vmx_remove_ethernet_interfaces": true
}
]
}
这是我的预置文件:
d-i auto-install/enable boolean true
### Localization
# Locale sets language and country.
d-i debian-installer/locale string en_US
# Keyboard selection.
d-i console-keymaps-at/keymap select us
### Network configuration
# netcfg will choose an interface that has link if possible. This makes it
# skip displaying a list if there is more than one interface.
d-i netcfg/choose_interface select auto
### Clock and time zone setup
# Controls whether or not the hardware clock is set to UTC.
d-i clock-setup/utc boolean true
# You may set this to any valid setting for $TZ; see the contents of
# /usr/share/zoneinfo/ for valid values.
d-i time/zone string US/Eastern
### Account setup
# Skip creation of a root account (normal user account will be able to
# use sudo).
d-i passwd/root-login boolean false
# To create a normal user account.
d-i passwd/root-login boolean false
d-i passwd/user-fullname string <full name>
d-i passwd/username string <username>
# Normal user's password, either in clear text
d-i passwd/user-password password <password>
d-i passwd/user-password-again password <password>
d-i user-setup/encrypt-home boolean false
# This is fairly safe to set, it makes grub install automatically to the MBR
# if no other operating system is detected on the machine.
d-i grub-installer/only_debian boolean true
### Package selection
ubiquity ubiquity/minimal_install boolean true
tasksel tasksel/first multiselect standard, xubuntu-desktop
d-i pkgsel/install-language-support boolean false
d-i pkgsel/include string openssh-server ntp curl nfs-common linux-headers-$(uname -r) build-essential perl dkms
# do not enable live installer, use normal instead
d-i live-installer/enable boolean false
# activate DASD, dasdfmt if needed
d-i s390-dasd/dasd string 0.0.0200,0.0.0300,0.0.0400
# DASD configuration
d-i s390-dasd/auto-format boolean true
d-i s390-dasd/force-format boolean true
# auto-partition, all files in one partition
d-i partman-auto/method string regular
d-i partman-auto/choose_recipe select atomic
d-i partman/choose_partition select finish
d-i partman/confirm_nooverwrite boolean true
d-i partman/confirm boolean true
### Finishing up the first stage install
# Avoid that last message about the install being complete.
d-i finish-install/reboot_in_progress note
# Monitor autodetection is recommended.
xserver-xorg xserver-xorg/autodetect_monitor boolean true
# Uncomment if you have an LCD display.
#xserver-xorg xserver-xorg/config/monitor/lcd boolean true
# X has three configuration paths for the monitor. Here's how to preseed
# the "medium" path, which is always available. The "simple" path may not
# be available, and the "advanced" path asks too many questions.
xserver-xorg xserver-xorg/config/monitor/selection-method \
select medium
xserver-xorg xserver-xorg/config/monitor/mode-list \
select 1680x1050 @ 60 Hz
有人能告诉我我做错了什么或遗漏了什么吗?我甚至可以使用服务器 ISO 执行此操作吗?
谢谢!
答案1
Ubuntu Server 没有图形界面,但如果您连接到互联网,则可以下载一个。
您需要添加宇宙先用口袋
sudo add-apt-repository universe
然后安装 Ubuntu 桌面
sudo apt install ubuntu-desktop
或 MATE 桌面
sudo apt install ubuntu-mate-desktop^