自动安装生成器

自动安装生成器

前不久,Ubuntu 放弃了旧的预置格式。我不知道为什么,但是没有可用的替代方法或清晰的文档就放弃这种格式似乎很奇怪。最好的办法是提供一个工具,您可以用它回答设置问题并生成配置。无论如何,我有完全可用的预置格式,但无法使用升级的工具进行转换……我的意思是它根本不起作用。

我怎样才能将其最佳地转换为新的 yml 格式?

看起来完全无聊了:

Traceback (most recent call last):
  File "/snap/autoinstall-generator/64/usr/bin/autoinstall-generator", line 56, in <module>
    sys.exit(main())
  File "/snap/autoinstall-generator/64/usr/bin/autoinstall-generator", line 47, in main
    out = convert_file(infile, args)
  File "/snap/autoinstall-generator/64/lib/python3.6/site-packages/autoinstall_generator/merging.py", line 205, in convert_file
    for idx, line in enumerate(preseed_file.readlines()):
  File "/snap/autoinstall-generator/64/usr/lib/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 1686: ordinal not in range(128)

# --------------------------------------------------- #
# Unattended Installation
# --------------------------------------------------- #
# Simple instruction to tell the debian installer that
# this is intended to be an unattended install and to only
# ask critical questions (wich we will answer in this file)
# End of documentation
d-i auto-install/enable boolean true
d-i debconf/priority select critical
# --------------------------------------------------- #


# --------------------------------------------------- #
# Network configuration
# --------------------------------------------------- #
# Network setup. This can be a static setup or dhcp.
# The RTD default prefferred config is to rely on DHCP,
# and for wireless networks (systems with only wireless cards)
# default to an SSID named "loader" and the guest wpa string
# "letmein1234". This allows supported systems to be
# installed directly over WiFi with no user input.
# End of documentation
d-i netcfg/choose_interface select manual
d-i netcfg/hostname string RTD-Client
d-i netcfg/get_hostname string unassigned-hostname
d-i netcfg/get_domain string unassigned-domain
d-i hw-detect/load_firmware boolean true

# We want the preconfiguration file to work on systems both with and
# without sucessful dhcp configuration
d-i netcfg/dhcp_failed note
d-i netcfg/dhcp_options select Configure network manually
# d-i netcfg/dhcp_timeout string 60

d-i netcfg/wireless_show_essids select manual
d-i netcfg/wireless_essid string loader
d-i netcfg/wireless_essid_again string loader
d-i netcfg/wireless_security_type select wpa
d-i netcfg/wireless_wpa string letmein1234

# --------------------------------------------------- #


# --------------------------------------------------- #
# Do NOT install on the USB stick(!)
# --------------------------------------------------- #
#
# The Debian installer will install on the first disk it finds which can
# sometimes be the USB stick itself. Work around this by rolling our own auto
# detect logic which disallows installing on USB devices.
#
# d-i partman/early_command string [ "$(ls -A /tmp)" ] && umount -l /media || echo "Empty" ;
# End of documentation
d-i partman/early_command string \
USBDEV=$(mount | grep hd-media | cut -d" " -f1 | sed "s/\(.*\)./\1/");\
BOOTDEV=$(list-devices disk | grep -v \$USBDEV | head -1);\
debconf-set partman-auto/disk $BOOTDEV;\
debconf-set grub-installer/bootdev $BOOTDEV;

# --------------------------------------------------- #


# --------------------------------------------------- #
# Account setup (temporary user account)
# --------------------------------------------------- #
# Setup an initial user and disable root login by default.
# root login may be re-enabled later by setting a root password.
# An encrypted password is set here, and should be changed
# ASAP after the system is built. Preferebly connect to LDAP/AD
# in a managed environment.
# End of documentation
d-i passwd/root-login boolean false
d-i passwd/user-fullname string RTD User
d-i passwd/username string tangarora
d-i passwd/user-password seen true
d-i user-setup/allow-password-weak boolean true
d-i passwd/user-password-crypted password $6$Rn5/UTzjIs68MX$9gz8vmshGlPqse3VoX8dzSfhWxRVoYv1MB6aGRD8xdvztOf.gD.SxxVWkxYrwwbShB9Q14flquK/apbdQJ65t1
d-i passwd/auto-login boolean true

# --------------------------------------------------- #


# --------------------------------------------------- #
# Localization
# --------------------------------------------------- #
# Provide localizaton preferences so that the prefferred
# language is used for display and formats. Comparable to
# the MUI in Microsoft environments.
# End of documentation
d-i debian-installer/locale string en_US.UTF-8
d-i localechooser/supported-locales multiselect en_US.UTF-8, se_SE.UTF-8
d-i console-setup/ask_detect boolean false

# --------------------------------------------------- #



# --------------------------------------------------- #
# Set Keyboard layout
# --------------------------------------------------- #
# Set the prefferred keyboard layout. Keyboards will work
# regardless, but the letters and symbols may not actually
# be the ones drawn on the keys. Default is us.
d-i keyboard-configuration/xkb-keymap select se
d-i keyboard-configuration/layoutcode string se
d-i debian-installer/keymap select se
d-i keymap select se
d-i console-setup/layoutcode string se
d-i console-setup/ask_detect boolean false

# --------------------------------------------------- #


# --------------------------------------------------- #
# Clock and time zone setup
# --------------------------------------------------- #
d-i clock-setup/utc boolean true
d-i time/zone string Etc/UTC
d-i clock-setup/ntp boolean true
d-i clock-setup/ntp-server string ntp.ubuntu.com

# --------------------------------------------------- #


# --------------------------------------------------- #
# EFI
# --------------------------------------------------- #
#
# The EFI (Extensible Firmware Interface) system partition is a partition on a data storage device.
# UEFI provides backward compatibility with legacy systems by reserving the first block (sector) of
# the partition for compatibility code, effectively creating a legacy boot sector. On legacy BIOS-based
# systems, the first sector of a partition is loaded into memory and execution is transferred to this code.
# Here we tell setup to install EFI boot setup if possible so that both NEW and old systems may be handled
# and the installed system can be started.
d-i partman-efi/non_efi_system boolean true
# End of documentation
# --------------------------------------------------- #


# --------------------------------------------------- #
# GRUB bootloader installation
# --------------------------------------------------- #
#
# Tell the grub-installer to install to the MBR even if it also finds some other
# OS, which is more likely to allow the newly installed Linux OS to boot without issue.
# End of documentation
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
# --------------------------------------------------- #


# --------------------------------------------------- #
#   Disk layout (default encrypted disk)
# --------------------------------------------------- #
#
# Set option to encrypt the hard disk:
# By default the harddisk will be encrypted to pretect data
# and will need to be unlocked with a password when the
# system is booted. In addition a default is prefferred
# where the swap space is set to 200% of RAM so that
# hibernate can be supported.
# End of documentation

d-i partman-auto/method string crypto
d-i partman-crypto/passphrase password letmein1234
d-i partman-crypto/passphrase-again password letmein1234
d-i partman-auto-crypto/erase_disks boolean false
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-lvm/device_remove_lvm_span boolean true
d-i partman-auto/purge_lvm_from_device boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-auto-lvm/guided_size string max
d-i partman-auto-lvm/new_vg_name string crypt
#d-i partman-auto/choose_recipe select root-encrypted
d-i partman-auto/expert_recipe string                   \
multi-cnx ::                                            \
538 538 1075 free                               \
$primary                                \
$iflabel{ gpt }                         \
$reusemethod{ }                         \
method{ efi } format{ }                 \
.                                               \
3500 3500 3500 ext3                             \
$primary{ } $bootable{ }                \
method{ format } format{ }              \
use_filesystem{ } filesystem{ ext4 }    \
mountpoint{ /boot }                     \
.                                               \
200% 25000 200% linux-swap                      \
    $lvmok{ } lv_name{ swap }               \
    in_vg { crypt }                         \
    $primary{ }                             \
    method{ swap } format{ }                \
.                                               \
500 1000 1000000000 ext4                        \
$lvmok{ } lv_name{ root }               \
in_vg { crypt }                         \
$primary{ }                             \
method{ format } format{ }              \
use_filesystem{ } filesystem{ ext4 }    \
mountpoint{ / }                         \
.

d-i partman-md/device_remove_md boolean true
d-i partman-md/confirm boolean true
d-i partman-basicfilesystems/no_mount_point boolean false
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true

# --------------------------------------------------- #


# --------------------------------------------------- #
# Package selection
# --------------------------------------------------- #
# Packages may be selected as groups (meta packages) like kde-desktop or
# as individual packages. Only one "pkgsel/include" string will be used though!
# remembder to fit all the packages you want on one line.
# tasksel tasksel/first multiselect standard options:
# ubuntu-desktop-minimal kubuntu-desktop, ubuntu-gnome-desktop, lubuntu-desktop, ubuntu-mate-desktop
# desktop,  gnome-desktop, kde-desktop, cinnamon-desktop, mate-desktop,
# lxde-desktop, web-server, ssh-server, print-server.
# The "OEM" line below ist to make it simple to replace the line with a
# relevant chice of debian role using "sed" or similar.
# End of documentation
tasksel tasksel/first multiselect ubuntu-desktop
d-i pkgsel/include string openssh-server virt-what wget spice-vdagent git

# Valid choices for pkgsel/upgrade are: safe-upgrade full-upgrade none
d-i pkgsel/upgrade select safe-upgrade
d-i pkgsel/update-policy select unattended-upgrades

# By default, the system’s locate database will be updated after the
# installer has finished installing most packages. This may take a while, so
# if you don’t want it, you can set this to "false" to turn it off.
# d-i pkgsel/updatedb boolean false
# --------------------------------------------------- #


# --------------------------------------------------- #
# Default preseed Addon Tasks
# --------------------------------------------------- #
d-i preseed/late_command string \
in-target git clone https://github.com/vonschutter/RTD-Setup.git /opt/rtd ; \
in-target /usr/bin/chmod 755 /opt/rtd/core/rtd* ; \
in-target /bin/bash /opt/rtd/core/rtd-oem-enable-config.sh ; \
    cp /*.cfg /target/opt/rtd/ ; \
umount -l /media || echo "Empty" ; \
eject || true; \
echo "------  initial Setup Complete!  ------"

# for ubuntu to work (ignored by Debian)...
ubiquity ubiquity/success_command string \
in-target git clone https://github.com/vonschutter/RTD-Setup.git /opt/rtd  ; \
in-target /bin/bash /opt/rtd/core/rtd-oem-enable-config.sh ; \
in-target /usr/bin/chmod 755 /opt/rtd/core/rtd* ; \
    cp /*.cfg /target/opt/rtd/ ;\
echo "------  initial Setup Complete!  ------"

# Answer the last question
d-i debian-installer/splash boolean true

# Option to try to gracefully eject the installation media:
d-i cdrom-detect/eject boolean true

# Shutdown machine
d-i finish-install/reboot_in_progress note

# --------------------------------------------------- #

答案1

根据您要安装的 Ubuntu,您可以使用以下命令:

https://wiki.ubuntu.com/UbiquityAutomation(类似于 preseed 的格式,但删除了一些 di 命令)

更好的方法可能是切换到新的自动安装方法:

https://ubuntu.com/server/docs/install/autoinstall

有关如何配置此自动安装的信息可以在这里找到:

https://www.golinuxcloud.com/customize-cloud-init-user-data-ubuntu/#2_Install_Ubuntu_with_GUI_GNOME_Desktop

希望这可以帮助 :)

相关内容