commit a757fed54ba254912d8c8695612e5ed47d43ddf3 Author: TuDatTr Date: Thu Nov 9 22:32:41 2023 +0100 first commit diff --git a/README.org b/README.org new file mode 100644 index 0000000..e7387d0 --- /dev/null +++ b/README.org @@ -0,0 +1,80 @@ +* Debian Preseed Configuration + +This Git repository contains a preseed configuration file (preseed.txt) that can be used to automate the installation of Debian on default machines. The preseed file is based on the official DebianInstaller/Preseed documentation, which can be found [[https://wiki.debian.org/DebianInstaller/Preseed][here]]. + +* Usage + +To use this preseed configuration during installation, follow these steps: + +1. When the graphical installer boot menu appears, select the "Help" entry. +2. You will get a generic help screen with a boot: prompt at the bottom. +3. Type the following command, replacing the URL with the address to your preseed configuration file: +#+begin_src shell +auto url=http://webserver/path/preseed.cfg +#+end_src + +* Preseed Configuration Details + +The preseed configuration includes the following sections: +Localization + + Language: English (US) + Country: Germany + +Network Configuration + + Automatically choose a network interface with a link. + +Mirror Settings + + Use manual mirror selection with `http.de.debian.org` as the mirror. + +Account Setup + +- Set root password to `asdf`. +- Create a user account with username `user` and password `asdf`. This user will belong to the groups: `audio`, `cdrom`, `video`, `sudo`. + +Clock and Time Zone Setup + +- Hardware clock is set to UTC. +- Time zone is set to `Europe/Berlin`. +- NTP is enabled to sync the clock. + +Partitioning + +- Automatically partition the disk with GPT label. +- Use the `atomic` partitioning recipe (all files in one partition). + +Base System Installation + +- Additional packages to install: `openssh-server`, `build-essential`, `sudo`, `git`, `iperf3`, `smartmontools`, `vim`, `curl`, `tree`, `rsync`, `systemd-timesyncd`, `neofetch`, `btrfs-progs`, `powertop`. + +Boot Loader Installation + +- Grub is the boot loader. +- Grub will be installed to the UEFI partition/boot record if no other operating system is detected. + +Finishing Up the Installation + +- Avoid displaying the last message about the install being complete. +- After installation, the system will halt (not reboot). + +Advanced Options + +- Custom commands will be run after installation to set up SSH keys for the `user` account. + +* Custom Commands + +The following custom commands will be executed during the installation: + +#+begin_src shell +mkdir -p /home/user/.ssh/ +echo "sh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqc9fnzfCz8fQDFzla+D8PBhvaMmFu2aF+TYkkZRxl9 tuan@genesis-2022-01-20" > /target/home/user/.ssh/authorized_keys +chown -R user:user /target/home/user/.ssh/ +chmod 700 /target/home/user/.ssh/ +chmod 600 /target/home/user/.ssh/authorized_keys +#+end_src + +These commands will create an .ssh directory in the user's home directory, add an authorized SSH key, and set the appropriate permissions. + +Feel free to customize this preseed configuration to suit your specific requirements. diff --git a/preseed.txt b/preseed.txt new file mode 100644 index 0000000..85cf6a5 --- /dev/null +++ b/preseed.txt @@ -0,0 +1,172 @@ +#_preseed_V1 +### Localization +# Preseeding only locale sets language, country and locale. +d-i debian-installer/locale string en_US +d-i debian-installer/language string en +d-i debian-installer/country string DE + +# Keyboard selection. +d-i keyboard-configuration/xkb-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 + +# To pick a particular interface instead: +#d-i netcfg/choose_interface select eth1 + +# Any hostname and domain names assigned from dhcp take precedence over +# values set here. However, setting the values still prevents the questions +# from being shown, even if values come from dhcp. +d-i netcfg/get_hostname string test +d-i netcfg/get_domain string seyshiro.de + +### Mirror settings +# Mirror protocol: +# If you select ftp, the mirror/country string does not need to be set. +# Default value for the mirror protocol: http. +d-i mirror/country string manual +d-i mirror/http/hostname string http.de.debian.org +d-i mirror/http/directory string /debian +#d-i mirror/http/proxy string + +### Account setup +# Root password, either in clear text +d-i passwd/root-password password asdf +d-i passwd/root-password-again password asdf + +# To create a normal user account. +d-i passwd/user-fullname string user +d-i passwd/username string user +# Normal user's password, either in clear text +d-i passwd/user-password password asdf +d-i passwd/user-password-again password asdf + +# The user account will be added to some standard initial groups. To +# override that, use this. +d-i passwd/user-default-groups string audio cdrom video sudo + +### 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 Europe/Berlin + +# Controls whether to use NTP to set the clock during the install +d-i clock-setup/ntp boolean true +# NTP server to use. The default is almost always fine here. +#d-i clock-setup/ntp-server string ntp.example.com + +### Partitioning +## Partitioning example +d-i partman-auto/disk string /dev/sda +d-i partman-auto/method string regular +d-i partman-lvm/device_remove_lvm boolean true +d-i partman-md/device_remove_md boolean true +d-i partman-lvm/confirm boolean true +d-i partman-lvm/confirm_nooverwrite boolean true + +# You can choose one of the three predefined partitioning recipes: +# - atomic: all files in one partition +# - home: separate /home partition +# - multi: separate /home, /var, and /tmp partitions +d-i partman-auto/choose_recipe select atomic + +# This makes partman automatically partition without confirmation +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 + +# Force UEFI booting ('BIOS compatibility' will be lost). Default: false. +# Ensure the partition table is GPT - this is required for EFI +d-i partman-efi/non_efi_system boolean true +d-i partman-partitioning/choose_label select gpt +d-i partman-partitioning/default_label string gpt + +# This makes partman automatically partition without confirmation. +d-i partman-md/confirm boolean true +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 + +### Base system installation +### Apt setup +# Choose, if you want to scan additional installation media +# (default: false). +d-i apt-setup/cdrom/set-first boolean false +# Select which update services to use; define the mirrors to be used. +# Values shown below are the normal defaults. +d-i apt-setup/services-select multiselect security, updates +d-i apt-setup/security_host string security.debian.org + +# Uncomment this to add multiarch configuration for i386 +#d-i apt-setup/multiarch string i386 + + +### Package selection +tasksel tasksel/first multiselect standard + +# Individual additional packages to install +d-i pkgsel/include string openssh-server build-essential sudo git iperf3 smartmontools vim curl tree rsync systemd-timesyncd neofetch btrfs-progs powertop + +# Whether to upgrade packages after debootstrap. +# Allowed values: none, safe-upgrade, full-upgrade +d-i pkgsel/upgrade select full-upgrade + +### Boot loader installation +# Grub is the boot loader (for x86). + +# This is fairly safe to set, it makes grub install automatically to the UEFI +# partition/boot record if no other operating system is detected on the machine. +d-i grub-installer/only_debian boolean true + +# This one makes grub-installer install to the UEFI partition/boot record, if +# it also finds some other OS, which is less safe as it might not be able to +# boot that other OS. +d-i grub-installer/with_other_os boolean true + +# Due notably to potential USB sticks, the location of the primary drive can +# not be determined safely in general, so this needs to be specified: +#d-i grub-installer/bootdev string /dev/sda +# To install to the primary device (assuming it is not a USB stick): +#d-i grub-installer/bootdev string default + +# Alternatively, if you want to install to a location other than the UEFI +# parition/boot record, uncomment and edit these lines: +#d-i grub-installer/only_debian boolean false +#d-i grub-installer/with_other_os boolean false +#d-i grub-installer/bootdev string (hd0,1) +# To install grub to multiple disks: +#d-i grub-installer/bootdev string (hd0,1) (hd1,1) (hd2,1) + +# Use the following option to add additional boot parameters for the +# installed system (if supported by the bootloader installer). +#d-i debian-installer/add-kernel-opts string nousb + +### Finishing up the installation + +# Avoid that last message about the install being complete. +d-i finish-install/reboot_in_progress note + +# This is how to make the installer shutdown when finished, but not +# reboot into the installed system. +d-i debian-installer/exit/halt boolean true +# This will power off the machine instead of just halting it. +d-i debian-installer/exit/poweroff boolean true + + +#### Advanced options +### Running custom commands during the installation + +d-i preseed/late_command string \ + in-target mkdir -p /home/user/.ssh/; \ + in-target echo "sh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqc9fnzfCz8fQDFzla+D8PBhvaMmFu2aF+TYkkZRxl9 tuan@genesis-2022-01-20" > /target/home/user/.ssh/authorized_keys; \ + in-target chown -R user:user /target/home/user/.ssh/; \ + in-target chmod 700 /target/home/user/.ssh/; \ + in-target chmod 600 /target/home/user/.ssh/authorized_keys