Benutzer-Werkzeuge

Webseiten-Werkzeuge


hswiki:archiv:jensites:debian_installation_the_hard_way

Installing Debian the hard way

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.

Step 1: Preparations

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:

  1. sudo su
  2. 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.

Step 2: Partitioning

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:

  1. pvcreate /dev/sda1
  2. vgcreate DEBIAN /dev/sda1
  3. lvcreate -L10G -n ROOT DEBIAN
  4. lvcreate -L8G -n SWAP DEBIAN
  5. 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.

  1. mkfs.ext4 /dev/mapper/DEBIAN-ROOT
  2. mkfs.ext4 /dev/mapper/DEBIAN-HOME
  3. mkswap /dev/mapper/DEBIAN-SWAP

Following commands mount the partitions under /mnt, where the system will get installed.

  1. mount /dev/mapper/DEBIAN-ROOT /mnt
  2. mkdir /mnt/home
  3. mount /dev/mapper/DEBIAN-HOME /mnt/home
  4. swapon /dev/mapper/DEBIAN-SWAP
Step 3: Debootstrapping

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/
Step 4: Configuration

The following commands will changeroot into your new system:

  1. cp /etc/mtab /mnt/etc/mtab
  2. mount -o bind /dev /mnt/dev
  3. mount -o bind /sys /mnt/sys
  4. mount -o bind /proc /mnt/proc
  5. chroot /mnt /bin/bash

Now you can configure your new system from within:

  1. 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.

  1. 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):

  1. 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
  1. apt update

Now we configure the network settings. First we add a hostname to identify the system in the local network:

  1. echo debian > /etc/hostname

Now we configure interfaces and hosts:

  1. nano /etc/hosts

Append the following in a new line: 127.0.1.1 debian

  1. nano /etc/network/interfaces

Comment out everything but the loopback device ( by prepending # ) since we want to use network manager.

  1. nano /etc/NetworkManager/NetworkManager.conf
   Change managed=false to managed=true

We install and configure the grub bootloader:

  1. grub-install /dev/sda
  2. nano /etc/default/grub
  GRUB_CMDLINE_LINUX="dolvm"
  1. grub-mkconfig -o /boot/grub/grub.cfg

Add an user and lock the root account since we want to use sudo:

  1. adduser user –gid 27 –shell /bin/bash –home /home/user
  2. 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.

  1. apt install console-setup
  2. apt install console-data
  3. apt install keyboard-configuration
  4. 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:

  1. apt-get build-dep dwm
  2. mkdir /usr/src -p
  3. cd /usr/src
  4. apt-get source dwm
  5. cd dwm*
  6. cp config.def.h config.h
  7. 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 };
  1. make install
  2. make clean

Create config directories in the user's home directory:

  1. mkdir -p /home/user/.config/{nvim,terminator}

Configure neovim:

  1. 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 : -

  1. 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.

  1. apt-get clean
  2. update-initramfs -u -k all
  3. exit
  4. reboot
  5. remove install medium

Enjoy!

hswiki/archiv/jensites/debian_installation_the_hard_way.txt · Zuletzt geändert: 2020/08/01 21:11 von 127.0.0.1