Introducing the ultimate lightweight tool for installing Ubuntu Linux from the command line: A single Bash script that is only using debootstrap and chroot to get the job done.
Because the installation does not require any user interaction if fully configured, this solution is ideal for an automatic server setup. Install Ubuntu directly on a free partition of the target hardware or create a USB live system and use it as a recovery solution.
What makes this installer special?
The installer is a headless tool, which means that no graphical user interface is required.
It builds the system from scratch without using any pre-packaged OS image.
Because each installation step can be seen in the script, this solution is very transparent and highly adaptable for personal needs.
Download new versions from the Git repository: https://github.com/brettaufheber/ubuntu-headless-installer
The debootstrap tool which is required by the installer, might not be installed.
sudo apt-get install debootstrap
This tool can be installed by calling the following command:
sudo ./install.sh
-
Partitioning must be done before installation because the installer requires the system partition and home partition as block device files.
-
The block device file for the system partition must be unmounted before starting the installer.
-
The system partition is formatted during installation.
-
The home partition is not formatted during installation to keep the user data. In case of a new home partition, formatting must be done manually.
Before installation, it must be clear which boot mode is used for the target hardware. Most computers nowadays use the UEFI (Unified Extensible Firmware Interface) standard but often support the legacy BIOS (Basic Input/Output System) what can be enabled in the boot settings. Both firmware interfaces are supported by the installer.
sudo ubuntu-installer.sh install-system \
‑‑efi \
‑‑separate‑home \
-u <your username> \
-n <hostname> \
-c <Ubuntu codename: bionic|cosmic|...> \
-x <block device file for system partition "/": /dev/...> \
-y <block device file for home partition "/home": /dev/...> \
-z <block device file for EFI partition "/boot/efi": /dev/...>
sudo ubuntu-installer.sh install-system \
‑‑separate‑home \
-u <your username> \
-n <hostname> \
-c <Ubuntu codename: bionic|cosmic|...> \
-x <block device file for system partition "/": /dev/...> \
-y <block device file for home partition "/home": /dev/...> \
-z <block device file of the whole disk: /dev/...>
command line parameter | environment variable | description | required |
---|---|---|---|
|
If enabled the help text is shown and other arguments are ignored. |
no |
|
|
This option allows logging into the shell for diagnostic purposes directly at the end of the installation. |
no |
|
|
Switch between UEFI boot mode and legacy BIOS boot mode. Default is legacy mode. |
no |
|
|
Use a separate home partition. |
no |
|
|
Allows copying network settings to the target medium. This is particularly useful for installations behind a proxy because it makes the network available out-of-the-box within the chroot environment. |
no |
|
|
|
The username for the first user of the system to be created. If unspecified the username of the current shell session is used. |
no |
|
|
The hostname of the system to be created. If unspecified the hostname of the running system is used. |
no |
|
|
The first word of an Ubuntu codename in lowercase must be defined to refer to a specific Ubuntu version. See here to choose from available releases. |
yes |
|
|
The path to the block device file of the system partition must be specified. This block device file must be unmounted during installation. |
yes |
|
|
The path to the block device file of the home partition must be specified. It does not matter whether the partition is mounted during installation. |
only if a separate home partition is used |
|
|
If the EFI option is enabled, the path to the block device file of the EFI partition must be specified. If the legacy boot is used the path to the block device file for the whole disk must be specified. See here for more information about device file names. It does not matter whether the partition is mounted during installation. |
yes |
|
|
An optional comma separated list that allows installing additional software. See the topic "Software bundles" below. |
no |
|
|
The path to an optional file that contains information about bundles and packages. |
no |
|
|
The path to an optional file that allows to pre-seed the debconf database. |
no |
|
|
The path to an optional file that overwrites the GNOME dconf defaults. |
no |
|
|
The mirror used to resolve software packages. Default is "mirror://mirrors.ubuntu.com/mirrors.txt" |
no, but recommended |
|
|
The locales (e.g. C.UTF-8, en_US.UTF-8, de_DE.UTF-8) of the system to be created. If unspecified the installer will ask interactively. |
no |
|
|
The time zone (e.g. UTC, Europe/Berlin) of the system to be created. If unspecified the installer will ask interactively. |
no |
|
|
Additional GECOS information for the first user of the system to be created. |
no |
|
|
The password for the first user of the system to be created. If unspecified the installer will ask interactively. |
no |
|
|
The keyboard model. If unspecified the installer will ask interactively. See file "/etc/default/keyboard" of another system to find matching values. |
no |
|
|
The keyboard layout. If unspecified the installer will ask interactively. See file "/etc/default/keyboard" of another system to find matching values. |
no |
|
|
The keyboard variant. If unspecified the installer will ask interactively. See file "/etc/default/keyboard" of another system to find matching values. |
no |
|
|
The keyboard options. If unspecified the installer will ask interactively. See file "/etc/default/keyboard" of another system to find matching values. |
no |
Optionally, bundles (collection of software packages) can be installed together with the system. See the code to get an overview of the used packages.
-
net: network tooling
-
virt: QEMU/KVM with tooling
-
dev: basic equipment for software developers
-
desktop: minimal GNOME desktop
-
laptop: power saving tools for mobile devices
-
x86: architecture specific tools and libraries (requires dev)
The installer is able to create Docker container images and Linux containers. See the code to learn more about these features.
Copyright (c) 2018 Eric Löffler
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.