This manual attempts to show how to install a minimal debian system with dwm as a window manager and some simple command line tools on a lvm2 setup without using an installer.
Please beware: you will have to modify many of these instructions according to your machine and wishes, make sure to understand exactly what the commands do before using them and modify them accordingly, since those package selections are tuned for my notebook.
Also make sure to first read it as a whole before beginning.
Download a debian live iso, for example this one including non-free drivers :http://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/8.6.0-live+nonfree/amd64/iso-hybrid/debian-live-8.6.0-amd64-standard+nonfree.iso, and generate a bootable usb thumbdrive or CD from it.
Boot it up, log in as the user „user“ with the password „live“ and make sure to have internet access. Find out which drivers you will need later, especially graphics and network drivers.
Start with the following commands:
sudo su
apt install lvm2 console-data debootstrap
This will log you in as root and install some utilities that are needed for the installation, as well as configure your keyboard.
If the hard drive you wish to install on, has no partitions, create a partition now, e. g. with fdisk.
Assuming you want to install your full system on a lvm2 container on /dev/sda1, run the following:
pvcreate /dev/sda1
vgcreate DEBIAN /dev/sda1
lvcreate -L10G -n ROOT DEBIAN
lvcreate -L8G -n SWAP DEBIAN
lvcreate -L20G -n HOME DEBIAN
This will create a physical lvm2 volume on partition /dev/sda1
, creates the volume group DEBIAN and adds three logical volumes: named ROOT, SWAP and HOME. Depending on your available amount of disk space you may choose bigger sizes, ROOT should be 8-20 GB, SWAP 2 times the amount of your RAM size and HOME should hold enough space for your personal data. It is a good idea to keep some spare space, as you can resize partitions accordingly later on, if needed.
Following commands create the file systems for these partitions.
mkfs.ext4 /dev/mapper/DEBIAN-ROOT
mkfs.ext4 /dev/mapper/DEBIAN-HOME
mkswap /dev/mapper/DEBIAN-SWAP
Following commands mount the partitions under /mnt
, where the system will get installed.
mount /dev/mapper/DEBIAN-ROOT /mnt
mkdir /mnt/home
mount /dev/mapper/DEBIAN-HOME /mnt/home
swapon /dev/mapper/DEBIAN-SWAP
This command will install the system packages, some of them might not be applicable to you, so be sure to know every package before continuing and choose the right server for yourself:
debootstrap --arch amd64 --components=main,contrib,non-free \ --include=linux-image-3.16.0-4-amd64,linux-headers-3.16.0-4-amd64, \ grub-pc,lvm2,zsh-static,bash-completion,terminator,xserver-xorg-core,\ xserver-xorg-input-kbd,xserver-xorg-input-mouse,xserver-xorg-input-synaptics, \ xserver-xorg-video-radeon,xserver-xorg-video-fbdev,xinit,neovim,emacs-nox, \ dwm,suckless-tools,links2,w3m,git,rfkill,tree,htop,apvlv,fakeroot,wget,less, \ build-essential,feh,cmus,aptitude,sudo,pwgen,openssh-server,openssh-client, network-manager stable /mnt http://ftp.de.debian.org/debian/
The following commands will changeroot into your new system:
cp /etc/mtab /mnt/etc/mtab
mount -o bind /dev /mnt/dev
mount -o bind /sys /mnt/sys
mount -o bind /proc /mnt/proc
chroot /mnt /bin/bash
Now you can configure your new system from within:
nano /etc/fstab
/dev/mapper/DEBIAN-ROOT / ext4 errors=remount-ro 0 1 /dev/mapper/DEBIAN-HOME /home ext4 defaults 0 2 /dev/mapper/DEBIAN-SWAP none swap sw 0 0 tmpfs /tmp tmpfs noatime 0 0 tmpfs /var/tmp tmpfs noatime 0 0
This mounts the 3 partitions you've just created on every boot and additionally mounts /tmp
and /var/tmp
into the ram to speed many things up for the cost of just a little bit of your RAM. If you do not want this behaviour, just remove the last 2 lines.
Now we configure apt
, the package manager, in two steps: First of all we tell apt
not to install recommended nor suggested packages, if you do want this, just skip the second edit.
nano /etc/apt.conf
APT::Install-Recommends "0"; APT::Install-Suggests "0";
Second we configure the source servers for apt
to pull packages from (make sure to take the right server again):
nano /etc/apt/sources.list
deb http://ftp.de.debian.org/debian/ stable main contrib non-free deb-src http://ftp.de.debian.org/debian/ stable main contrib non-free deb http://security.debian.org/ stable/updates main contrib non-free deb-src http://security.debian.org/ stable/updates main contrib non-free deb http://ftp.de.debian.org/debian/ stable-updates main contrib non-free deb-src http://ftp.de.debian.org/debian/ stable-updates main contrib non-free
apt update
Now we configure the network settings. First we add a hostname to identify the system in the local network:
echo debian > /etc/hostname
Now we configure interfaces and hosts:
nano /etc/hosts
Append the following in a new line: 127.0.1.1 debian
nano /etc/network/interfaces
Comment out everything but the loopback device ( by prepending # ) since we want to use network manager.
nano /etc/NetworkManager/NetworkManager.conf
Change managed=false to managed=true
We install and configure the grub bootloader:
grub-install /dev/sda
nano /etc/default/grub
GRUB_CMDLINE_LINUX="dolvm"
grub-mkconfig -o /boot/grub/grub.cfg
Add an user and lock the root
account since we want to use sudo
:
adduser user –gid 27 –shell /bin/bash –home /home/user
passwd -l root
The group ID (gid) 27 marks the group named sudo, so our user is allowed to run commands using the program sudo.
Finally, we configure the software for our user to some reasonable defaults.
apt install console-setup
apt install console-data
apt install keyboard-configuration
apt install broadcom-sta-dkms
This sets up usable keyboard and console configs and installs the broadcom wlan driver that needs to be done from inside the chroot.
Now we configure dwm:
apt-get build-dep dwm
mkdir /usr/src -p
cd /usr/src
apt-get source dwm
cd dwm*
cp config.def.h config.h
nano config.h
change according lines to the following:
static const char selfbordercolor[] = "#C80003"; static const char selfbgcolor[] = "#C80003"; static const char *termcmd[] = {"terminator", NULL };
make install
make clean
Create config directories in the user's home directory:
mkdir -p /home/user/.config/{nvim,terminator}
Configure neovim:
nano /home/user/.config/nvim/init.vim
set enc=utf-8
set fenc=utf-8 set termencoding=utf-8 set nocompatible set autoindent set smartindent set tabstop=4 set shiftwidth=4 set textwidth=120 set t_Co=256 syntax on set number set showmatch set comments=s1:/*,mb:\ *,elx:\ */
Configure terminator : -
nano /home/user/.config/terminator/config
append :
[profiles] [[default]] background_image=None custom_command = /bin/zsh-static font = Noto Mono 12 scrollback_lines = 100000 scrollback_position = hidden use_custom_command = True
Make dwm
xinit's standard choice for startx :
echo "exec dwm" >> /home/user/.xinitrc
Clean up and reboot (be sure to remove the install medium before rebooting in your new system!), to start the GUI of your new system just type „startx“ after logging in as your user.
apt-get clean
update-initramfs -u -k all
exit
reboot
Enjoy!