Skip to content

Instantly share code, notes, and snippets.

@Pupwiz
Forked from espinz/README.md
Created November 7, 2021 14:04
Show Gist options
  • Save Pupwiz/3924625dcb07170e4a8aa03f5302a61d to your computer and use it in GitHub Desktop.
Save Pupwiz/3924625dcb07170e4a8aa03f5302a61d to your computer and use it in GitHub Desktop.
Debian Headless install - simple-cdd

Description

The following will create an automated custom debian iso image using simple-cdd.
Copy the iso to the USB. Plug in the USB and press power; it will automatically restart with a fresh debian install. No prompts, or typing required. Barebone and vm tested.

Jump to Code
Anchor links do not work on github gists. please scroll down.

Install the required package

simple-cdd is in the debian repositories so there is no need to add or configure anything. Install it like any other package.

# install

apt install simple-cdd

Create the working directories

This will create some directories to save your custom profiles.

# custom profiles

mkdir -p  ~/simple-cdd/{profiles,config}
touch profiles/mjc.{description,packages,downloads,preseed,postinst}
touch config/mjc.conf
cd ~/simple-cdd

Edit the default profile

See a custom default.preseed below

You can use the global preseed or a defined local one by copying the global one into ~/simple-cdd/profiles/

# Global to local

#sudo vim /usr/share/simple-cdd/profiles/default.preseed

cp /usr/share/simple-cdd/profiles/default.preseed ~/simple-cdd/profiles/
vim profiles/default.preseed

Edit your custom profile

See mjc.preseed below

Here is the magic of simple-cdd. The custom profile (mjc.preseed) is only 15 lines long.
The rest will be added into default.preseed; which will be the base for all custom isos.

# custom preseed

vim profiles/mjc.preseed

Edit the packages file

See mjc.packages below

Add all of the packages you would like in this file;
Do not add dependencies.

# packages

vim profiles/mjc.packages

Edit the conf file

See mjc.conf below

These are variables passed to simple-cdd.

# conf

vim config/mjc.conf

Create the ISO image

# This will create the iso in images/

build-simple-cdd --conf config/mjc.conf -p mjc

Copy the ISO image to USB

Make sure your usb is partitioned before using a high capacity USB.

# Your usb "/dev/sdc" might be different
# Do a df or disk -l

sudo dd if=images/debian-9.8-amd64-CD-1.iso of=/dev/sdc conv=notrunc,sync

Shortcut

# Overview

sudo apt install simple-cdd;

mkdir -p  ~/simple-cdd/{profiles,config};

cd ~/simple-cdd;

# copy the files below into the profiles directory so it looks like this.
profiles/default.preseed;

profiles/mjc.preseed;

profiles/mjc.packages;

config/mjc.conf;

build-simple-cdd --conf config/mjc.conf -p mjc;

sudo dd if=images/debian-9.8-amd64-CD-1.iso of=/dev/sdc conv=notrunc,sync;

Resources

12.3. Automated Installation
B.4. Contents of the preconfiguration file (for stretch)
Simple-CDD/Howto - Debian Wiki
/usr/share/simple-cdd/README

BOOT_TIMEOUT=50
locale="en_US"
keyboard=us
use_qemu="true"
profiles="mjc fixed"
force_preseed="true"
auto_profiles="fixed"
simple_cdd_dir="$(pwd)"
KERNEL_PARAMS="$KERNEL_PARAMS DEBIAN_FRONTEND=text fb=false vga=normal"
vga_normal="true"
qemu_opts="-curses -no-reboot"
#use_serial_console=true
simple-cdd simple-cdd/profiles multiselect ltsp, x-basic, test, mjc
d-i clock-setup/utc boolean true
d-i time/zone select US/Pacific
console-common console-data/keymap/policy select Don't touch keymap
console-data console-data/keymap/policy select Don't touch keymap
console-data console-data/keymap/qwerty/layout select US american
d-i netcfg/choose_interface select auto
d-i netcfg/wireless_wep string
d-i partman-auto/method string regular
d-i partman-auto/init_automatically_partition select Use the largest continuous free space
d-i partman-auto/init_automatically_partition select Guided - use entire disk
d-i partman-auto/choose_recipe select All files in one partition (recommended for new users)
d-i partman/confirm_write_new_label boolean true
d-i partman/choose_partition select finsh
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
choose-mirror-bin mirror/country string US
choose-mirror-bin mirror/http/countries select US
choose-mirror-bin mirror/http/directory string /debian/
choose-mirror-bin mirrror/http/hostname string debian.osuosl.org
choose-mirror-bin mirror/http/mirror select debian.osuosl.org
choose-mirror-bin mirror/http/proxy string
choose-mirror-bin mirror/no-default boolean true
choose-mirror-bin mirror/protocol select http
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i grub-installer/bootdev string default
d-i grub-installer/bootdev string /dev/sda
base-config apt-setup/cd/another boolean false
exim4-config exim4/dc_eximconfig_configtype select no configuration at this time
exim4-config exim4/dc_postmaster string
d-i finish-install/reboot_in_progress note
base-config base-config/intro note
base-config base-config/login note
d-i popularity-contest/participate boolean false
apt-cdrom-setup apt-setup/cdrom/set-first boolean false
d-i preseed/early_command string anna-install simple-cdd-profiles
# window manager
#icewm
openbox
# x-teminal-emulator
rxvt-unicode
terminator
# menus up to date
menu
# login manager
lightdm
# includes startx
xbase-clients
# X
xorg
# workaround http://bugs.debian.org/405639
xserver-xorg-input-all
xserver-xorg-video-all
slim
thunar
vim-nox
virt-manager
vnc4server
xvnc4viewer
autossh
ssvnc
ufw
sudo
# This profile is added to the iso image when applied with the -p flag.
# Example: build-simple-cdd --config final.conf -p mjc
tasksel tasksel/first multiselect standard, openssh-server, lxde-desktop
passwd passwd/root-password password profdale
passwd passwd/root-password-again password profdale
passwd passwd/make-user boolean true
passwd passwd/user-fullname string jeremy tux
passwd passwd/username string jeremy
passwd passwd/user-password password Yosemite1
passwd passwd/user-password-again password Yosemite1
d-i netcfg/get_hostname string mjc-final
d-i netcfg/get_domain string mjc-final
d-i apt-setup/services-select multiselect security, updates, backports
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment