linux/doc/Debootstrap.md

158 lines
4.6 KiB
Markdown

# Introduction
The debootstrap tool can be used to install
a basic copy of a Debian derivative into a folder.
This guide explains how to install a full Kubuntu system with debootstrap.
However, any Ubuntu flavour can be installed this way.
This guide uses Bashisms.
# Procedure
## Basic Minimal Installation
debootstrap --variant=minbase wily /target http://ch.archive.ubuntu.com/ubuntu
The subsequent commands are all executed inside a
[chroot](Chroot.md) environment.
## Basic Configuration
### Mark packages
apt-mark showmanual | xargs apt-mark auto
### Set language
apt-get install locales
locale-gen en_US.UTF-8
update-locale LANG=en_US.UTF-8
### Set timezone
dpkg-reconfigure tzdata
### Basic configuration
echo > /etc/fstab
echo "LABEL=System / ext4 errors=remount-ro,noatime 0 1" >> /etc/fstab
echo > /etc/hosts
echo "127.0.0.1 localhost" >> /etc/hosts
echo "127.0.0.1 your-host" >> /etc/hosts
echo "::1 ip6-localhost ip6-loopback" >> /etc/hosts
echo "your-host" > /etc/hostname
echo > /etc/network/interfaces.d/eth0
echo auto eth0 >> /etc/network/interfaces.d/eth0
echo iface eth0 inet dhcp >> /etc/network/interfaces.d/eth0
Note: The option `discard` can be added in `/etc/fstab` for SSD disks.
### Configure keyboard (optional)
dpkg-reconfigure keyboard-configuration
### Configure APT (optional)
echo 'APT::AutoRemove::RecommendsImportant "true";' >> /etc/apt/apt.conf.d/99no-recommends
echo 'APT::Install-Recommends "false";' >> /etc/apt/apt.conf.d/99no-recommends
echo 'APT::Get::Purge "true";' >> /etc/apt/apt.conf.d/99always-purge
### ACPI support (optional)
apt-get install acpi-support-base
systemctl enable acpid
Note: This enables ACPI shutdown as commonly used in VMs.
## Ubuntu Installation
### Install Ubuntu minimal
apt-get install ubuntu-minimal
`ubuntu-minimal` contains useful packages
which would have to be installed manually in Debian.
These include: `cron logrotate nano netbase net-tools isc-dhcp-client sudo rsyslog`
### Add a regular user
adduser user
In Ubuntu, the default secondary user groups are:
adm cdrom sudo dip plugdev lpadmin sambashare
### Install kernel and bootloader
To install a bootable system, the kernel and a bootloader
have to be installed.
apt-get install linux-generic
The following command installs Grub for EFI with Secure Boot enabled:
apt-get install grub-efi-amd64-signed shim-signed
For BIOS:
apt-get install grub-pc
Alternatively, extlinux can be installed:
apt-get install extlinux
mkdir /boot/extlinux
extlinux -i /boot/extlinux
cat /usr/lib/EXTLINUX/mbr.bin > /dev/sda
Copy [extlinux.conf](../conf/extlinux.conf) to `/boot/extlinux`.
### Install desktop system
At this point, it is necessary to enable the
`universe` repository component.
It is a good time to add some repositories.
#### More software repositories
All Ubuntu repositories are enabled using the following configuration:
echo > /etc/apt/sources.list
echo "deb http://ch.archive.ubuntu.com/ubuntu wily main restricted universe multiverse" >> /etc/apt/sources.list
echo "deb http://ch.archive.ubuntu.com/ubuntu wily-security main restricted universe multiverse" >> /etc/apt/sources.list
echo "deb http://ch.archive.ubuntu.com/ubuntu wily-updates main restricted universe multiverse" >> /etc/apt/sources.list
echo "deb http://archive.canonical.com/ubuntu wily partner" >> /etc/apt/sources.list
Also refer to the [Ubuntu Help](https://help.ubuntu.com/community/Repositories/Ubuntu)
to read about the different components.
Some PPAs are needed to ensure the latest software versions are installed.
First, the `add-apt-repository` helper is installed,
and then, those repositories are added:
apt-get install software-properties-common
apt-mark auto software-properties-common
add-apt-repository ppa:libreoffice/ppa
add-apt-repository ppa:rvm/smplayer
add-apt-repository ppa:qtbittorrent-team/qtbittorrent-stable
echo "deb http://debian-mirrors.sdinet.de/debian-multimedia testing main" > /etc/apt/sources.list.d/deb-multimedia.list
#### Install desktop packages
apt-get update
apt-get install --allow-unauthenticated -y deb-multimedia-keyring
apt-get install --install-recommends ubuntu-standard kubuntu-desktop kubuntu-restricted-extras language-pack-kde-en
Personally, I like to use Chrome and SMPlayer:
apt-get purge ktorrent dragonplayer firefox
apt-get install --install-recommends --install-suggests libreoffice-{calc,impress,writer,kde,l10n-de}
apt-get install smplayer mpv ffmpeg
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
Sometimes, some packages have to be pulled
from [packages.debian.org](http://packages.debian.org) manually.