Base Configuration

These commands will set up some basic configuration defaults and install some packages useful to both desktop and server builds. This document assumes that your Debian 10 installation was built utilizing the Debian 10 Build Notes.

Start by logging into your new install and use sudo su - to become root.

Generate Scripts

The following commands will generate some useful scripts to have in /opt and assign the correct permissions.

echo -e 'apt-get update'\\n\
'apt-get upgrade'\\n\
'apt-get clean'\\n\
'apt-get --purge dist-upgrade'\\n\
'apt-get clean'\\n\
'apt-get --purge autoremove'\\n\
'apt-get autoclean'\\n\
'aptitude forget-new'\\n\
'aptitude keep-all'\\n\
'aptitude purge ~c'\
> /opt/update_debian.sh

chmod 700 /opt/update_debian.sh

Install Additional Packages

If the computer is a desktop or server, or should otherwise never be allowed to sleep then run the following command. If sleep needs to be enabled later run the same command but change mask to unmask.

sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

Update apt and install package sets.

apt-get update

apt-get install -y amd64-microcode aptitude autofs bridge-utils bsd-mailx \
build-essential curl debootstrap dkms dmidecode dnsutils dosfstools eject \
fakeroot firmware-amd-graphics firmware-bnx2 firmware-iwlwifi firmware-linux \
firmware-linux-free firmware-linux-nonfree firmware-misc-nonfree \
firmware-qlogic gcc git htop ifenslave intel-microcode inxi iotop iperf \
iperf3 ksh laptop-detect linux-headers-amd64 linux-image-amd64 locales \
lsb-release lsscsi lxc make neofetch nload ntp parted pixz pv rsync screen \
smartmontools sudo tcsh usbutils vlan wget zfs-dkms zfs-initramfs zsh

echo -e '/net'\\t'/etc/auto.net --timeout 60' >> /etc/auto.master && mkdir /net
ls /boot/dos && apt-get install -y grub-pc grub-pc-bin
ls /boot/efi && apt-get install -y efibootmgr grub-efi-amd64-bin
ls /dev/ipmi* && apt-get install -y ipmitool

update-pciids
curl 'http://www.linux-usb.org/usb.ids' > /var/lib/usbutils/usb.ids
bash <(curl -s http://docs.irix7.com/osdist/grub_splash.sh)

Check for any missing firmware by running dmesg | grep -i firmware and install it now.

Run dpkg-reconfigure tzdata and select "America/Los_Angeles" as the new time zone when prompted.

Install Optional Packages

If the computer has any Nvidia GPU hardware also install the Nvidia drivers and tools.

apt-get install -y nvidia-cuda-toolkit nvidia-detect nvidia-driver \
nvidia-kernel-dkms nvidia-settings nvidia-smi

If the computer will be utilized as a desktop then install Thunderbird and optionally remove games. Also set a blank GDM3 screensaver.

apt-get install -y thunderbird

apt autoremove gnome-games

echo -e \\n\
"[org/gnome/desktop/screensaver]"\\n\
"#picture-uri='file:///path/to/image.png'"\\n\
"picture-options='none'"\\n\
"primary-color='#3a3a3a'"\
>> /etc/gdm3/greeter.dconf-defaults
sed -i 's/# sleep-inactive-ac-timeout=1200/sleep-inactive-ac-timeout=0/g' \
/etc/gdm3/greeter.dconf-defaults
sed -i 's/# sleep-inactive-battery-timeout=1200/sleep-inactive-battery-timeout=0/g' \
/etc/gdm3/greeter.dconf-defaults
dpkg-reconfigure gdm3

If the computer needs to send e-mail notifications then install and configure postfix.

apt-get install -y postfix

When prompted select "Satellite System" and enter the computer's FQDN for "System Mail Name". The "SMTP Relay Host" is the local mail server. Use the defaults for the rest of the postfix configuration prompts. Mail settings can be tested using mailx -s subject email_address after the installation. You can also reconfigure postfix by running dpkg-reconfigure postfix if needed, such as to set a "root and postmaster recipient" address.

Configure User Account

Run some or all of these commands as necessary to set up the user account defaults.

export INNEWNAME="user"

touch /home/$INNEWNAME/.hushlogin

# Generate .cshrc file for tcsh.
echo -e 'if ($?prompt) then'\\n\
' set path=( $path /sbin .)'\\n\
' alias mv '"'"'mv -i'"'"''\\n\
' alias ls '"'"'ls -Clas'"'"''\\n\
' alias cd '"'"'chdir \\!* ; set prompt="[%m] $cwd% "'"'"''\\n\
' setenv TERM xterm'\\n\
' cd .'\\n\
'endif'\
> /home/$INNEWNAME/.cshrc

# Change user's shell to tcsh.
usermod --shell /bin/tcsh $INNEWNAME

# Allow user to use sudo without a password.
echo -e $INNEWNAME' ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers.d/local
chmod 0440 /etc/sudoers.d/local

# Move user's home directory to root instead of home.
cp -pr /home/$INNEWNAME /.
sed -i 's/:\/home\/'"$INNEWNAME"'/:\/'"$INNEWNAME"'/g' /etc/passwd
ls /$INNEWNAME && rm -rf /home/$INNEWNAME

Update Fstab and Grub

cp /etc/fstab /tmp/fstab.old
grep "^[UP]" /tmp/fstab.old > /etc/fstab
sed -i 's/  */ /g' /etc/fstab
ls /dev/zvol/rpool/swap && \
echo -e '/dev/zvol/rpool/swap none swap defaults 0 0' >> /etc/fstab
ls /dev/sr0 && \
echo -e '/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0' >> /etc/fstab
ls /dev/sr1 && \
echo -e '/dev/sr1 /media/cdrom1 udf,iso9660 user,noauto 0 0' >> /etc/fstab
ls /dev/zvol/rpool/swap \
&& sed -i 's/UX_DEFAULT="quiet"/UX_DEFAULT="quiet noresume"/g' /etc/default/grub
ls /dev/sr0 && mkdir /media/cdrom0
ls /dev/sr0 && ln -s /media/cdrom0 /media/cdrom
ls /dev/sr1 && mkdir /media/cdrom1

update-initramfs -u -k all
grub-mkconfig
update-grub

Final Configuration

It is recommended to set a reservation and quota on the root pool to allow for a small amount of free space should the pool be filled to 100% capacity. Run df -BG and take the current "1G-blocks" size divided by 64 then round down to the nearest decimal and multiply that number by 64 to get the new size. Use the following commands to set the reservation and quota for the root pool.

zfs set reservation=512G rpool/ROOT/debian
zfs set quota=512G rpool/ROOT/debian

 


Last Update 28.08.2019