- Download the latest Debian netinstall release, specifically
amd64. - Flash image to USB drive.
sudo dd if=debian-XX.X.X-amd64.netinst.iso of=/dev/TARGET_DEVICE bs=1M
Boot into the non-graphical installer. Choose default (sane) options, noting these specific details:
- Enter a sensible lowercase hostname. Prefer 2-3 syllables, and non-ambiguous spelling.
- Leave domain name blank.
- Leave root password blank, to disable the root account. Prefer to use a normal-privileged user with sudoer rights instead.
- Use the "single partition" guided method. No need for a separate
/homeparition when all storage will be handled by the storage driver.
- Uncheck
Debian desktop environmentandprint server. - Check only
SSH serverandstandard systems utilities.
- Verify your login works.
- For console-aesthetics reasons, force color prompt:
sed -i 's/#force_color/force_color/g' ~/.bashrc source ~/.bashrc
- Configure a static IP address (optional, but useful)
sudo nano /etc/network/interfaces # CHANGE TO: # auto INTERFACE_NAME # iface INTERFACE_NAME inet static # address 192.168.1.XXX # gateway 192.168.1.1 sudo service networking restart
- Define the additional users you want to create. This will be used in later steps.
echo "user1 user2 user3" > users.txt
- Create users with password login disabled (for now).
for user in `cat users.txt`; do sudo adduser --disabled-password --gecos "" $user done
- Configure passwords later with
sudo passwd USER
- Configure passwords later with
- Add users to publisher group.
sudo groupadd publisher for user in $USER `cat users.txt`; do sudo usermod -a -G publisher $user done
- Add desired administrators users to
sudogroup.echo "user1 user2" > admins.txt for admin in `cat admins.txt`; do sudo adduser ${admin} sudo done
- Install these handy tools
sudo apt-get install htop screen smartmontools parted rsync curl
Enable automatic security (and regular) updates. Source: debian.org
- Install requisite packages.
sudo apt-get install unattended-upgrades apt-listchanges
- Enable mailing information about the upgrades.
sudo sed -i 's#//Unattended-Upgrade::Mail "";#Unattended-Upgrade::Mail "root";#g' /etc/apt/apt.conf.d/50unattended-upgrades - Enable auto-upgrades
echo unattended-upgrades unattended-upgrades/enable_auto_updates boolean true | sudo debconf-set-selections sudo dpkg-reconfigure -f noninteractive unattended-upgrades
Route root emails to a gmail account. Source: easyengine.io
- Install packages
sudo apt-get install postfix mailutils libsasl2-2 ca-certificates libsasl2-modules
- Choose
Internet Site, and keep the default entry for your hostname during the installation.
- Choose
- Edit postfix config
sudo nano /etc/postfix/main.cfto add the following:relayhost = [smtp.gmail.com]:587 smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = noanonymous smtp_tls_CAfile = /etc/postfix/cacert.pem smtp_use_tls = yes - Create smtp credentials file.
sudo nano /etc/postfix/sasl_passwd
- Use the following template:
[smtp.gmail.com]:587 USERNAME@gmail.com:PASSWORD - Restrict permissions, add to postmap.
sudo chmod 400 /etc/postfix/sasl_passwd sudo postmap /etc/postfix/sasl_passwd
- Use the following template:
- Fix errors with certificate validation.
cat /etc/ssl/certs/thawte_Primary_Root_CA.pem | sudo tee -a /etc/postfix/cacert.pem sudo service postfix reload - Set alias for routing root mail to a specific user.
echo " root: user1 user1: you@example.com " | sudo tee -a /etc/aliases sudo newaliases
- Sources: brismuth.com, stackexchange.com
- Finally, test the configuration
echo "Test mail from postfix, sent `date`" | mail -s "Test Postfix" you@example.com
See headings below for how to address common issues.
Create a modprobe conf file to blacklist the offending kvm modules:
bash echo "blacklist kvm blacklist kvm_intel blacklist kvm_amd" | sudo tee /etc/modprobe.d/blacklist-kvm.conf
Source: askubuntu answer
- Boot into live OS similar to the one being rescued.
- Mount the drive to be rescued, including separate
/boot,/var, and/usrpartitions if applicable. - Bind mount some necessary stuff:
for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt$i"; done - If EFI mode is used (see this if unsure), use
sudo fdisk -l | grep -i efito find the EFI partition. Then:sudo mount /dev/sdXY /mnt/boot/efi sudo chroot /mntupdate-grub. Can generally stop at this step.grub-install /dev/sdXupdate-grub- Update EFI partition UUID if it changed.
blkid | grep -i efi grep -i efi /etc/fstab - If no errors, proceed with reboot.
exit; sudo reboot
Source: askubuntu answer
- Setup SSH access