我正在使用 preseed 为 Ubuntu Desktop 18.04.4 创建无人值守安装,并且我想安装openssh-server
(openssh-sftp-server
用于桌面),以便在安装完成后实际上可以 ssh。
我尝试使用诸如:之类的命令pkgsel/include
,ubiquity/success_command
但preseed/late_command
没有任何效果。
预置不会安装软件,也不会更新软件包。
参考如何在 Ubuntu Server 13.10 的 preseed.cfg 中添加其他软件
如果有帮助:
# Installer config
d-i base-installer/kernel/override-image string linux-image-amd64
# GRUB
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
# Setting the locales, country
# Supported locales available in /usr/share/i18n/SUPPORTED
d-i debian-installer/language string en
d-i debian-installer/country string IN
d-i debian-installer/locale string en_US.UTF-8
# Keyboard setting
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/layoutcode string us
d-i keyboard-configuration/xkb-keymap us
d-i keyboard-configuration/modelcode string pc105
# Network configuration
d-i netcfg/choose_interface select auto
d-i netcfg/enable boolean true
d-i netcfg/get_hostname string ubuntu-bionic-desktop
d-i netcfg/get_domain string localdomain
d-i netcfg/wireless_wep string
# d-i hw-detect/load_firmware boolean true
# Mirror settings
choose-mirror-bin mirror/http/proxy string
# Clock and time zone setup
d-i time/zone string UTC
d-i clock-setup/utc-auto boolean true
d-i clock-setup/utc boolean true
d-i clock-setup/ntp boolean true
# Disk and Partitioning setup
d-i partman-auto/disk string /dev/sda
d-i partman-auto-lvm/guided_size string max
d-i partman-auto/choose_recipe select atomic
d-i partman-auto/method string lvm
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-lvm/device_remove_lvm boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman/confirm_write_new_label boolean true
# Vagrant user creation
d-i passwd/user-fullname string vagrant
d-i passwd/username string vagrant
d-i passwd/user-password password vagrant
d-i passwd/user-password-again password vagrant
d-i user-setup/encrypt-home boolean false
d-i user-setup/allow-password-weak boolean true
d-i passwd/user-default-groups vagrant sudo
# Package installations
d-i pkgsel/include string openssh-sftp-server vim cryptsetup build-essential libssl-dev libreadline-dev zlib1g-dev linux-source dkms nfs-common
# Upgrading the system
d-i pkgsel/install-language-support boolean false
d-i pkgsel/update-policy select none
d-i pkgsel/upgrade select full-upgrade
tasksel tasksel/first multiselect standard, ubuntu-desktop
ubiquity ubiquity/use_nonfree boolean true
d-i preseed/late_command string apt-install openssh-sftp-server;
# Success Installation - Tasks
ubiquity ubiquity/success_command string \
in-target apt install openssh-sftp-server;
# Installation - final
d-i finish-install/reboot_in_progress note
ubiquity ubiquity/summary note
ubiquity ubiquity/reboot boolean true`
答案1
删除不必要的行
无处不在忽略preseed/late_command,所以没有必要使用它。因此,您在以下行中包含了 openssh-sftp-server 包:
d-i pkgsel/include string openssh-sftp-server vim cryptsetup build-essential libssl-dev libreadline-dev zlib1g-dev linux-source dkms nfs-common
因此可以删除这些行:
d-i preseed/late_command string apt-install openssh-sftp-server;
# Success Installation - Tasks
ubiquity ubiquity/success_command string \
in-target apt install openssh-sftp-server;
如何使用无处不在
我使用 Ubuntu 最小 iso 测试了你的预置文件,可以在以下位置找到这里。在选择屏幕上,我将光标移动到command-line install
并按下标签键。请注意屏幕底部出现的属性:
然后附加这些属性,随意更改值:
locale=en_US hostname=ubuntu keyboard-configuration/modelcode=SKIP ubiquity url=http://192.168.0.1:8000/preseed-ubuntu.cfg
预置文件可以托管在主机的 localhost 上,例如使用python3 -m http.server
。您的 IP 地址显然会有所不同。按 Enter 键,安装将继续,安装程序只会提示您输入 repo 服务器,因为它未在您的预置文件中定义。
安装完成后,您可以登录并确认openssh-sftp-server
和其他软件包已安装。