Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/brettaufheber/ubuntu-headless-installer

install Ubuntu from command line via debootstrap and chroot
https://github.com/brettaufheber/ubuntu-headless-installer

bash chroot debootstrap linux post-installation shell ubuntu ubuntu-installation

Last synced: 4 days ago
JSON representation

install Ubuntu from command line via debootstrap and chroot

Awesome Lists containing this project

README

        

= Ubuntu Headless Installer

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

== Dependencies

The debootstrap tool which is required by the installer, might not be installed.

[source]
----
sudo apt-get install debootstrap
----

== Usage

This tool can be installed by calling the following command:

[source]
----
sudo ./install.sh
----

=== Preparation: partitioning and formatting

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

=== Install Ubuntu

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.

==== UEFI boot mode

[source]
----
sudo ubuntu-installer.sh install-system \
‑‑efi \
‑‑separate‑home \
-u \
-n \
-c \
-x \
-y \
-z
----

==== Legacy BIOS boot mode

[source]
----
sudo ubuntu-installer.sh install-system \
‑‑separate‑home \
-u \
-n \
-c \
-x \
-y \
-z
----

=== Parameters for the installation task

[cols="7,7,15,1",options="header"]
|===

|command line parameter
|environment variable
|description
|required

|`‑‑help` +
`‑h`
|
|If enabled the help text is shown and other arguments are ignored.
|no

|`‑‑login` +
`‑l`
|
|This option allows logging into the shell for diagnostic purposes directly at the end of the installation.
|no

|`‑‑efi` +
`‑e`
|
|Switch between UEFI boot mode and legacy BIOS boot mode. Default is legacy mode.
|no

|`‑‑separate‑home` +
`‑s`
|
|Use a separate home partition.
|no

|`‑‑copy‑network‑settings` +
`‑k`
|
|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

|`‑‑username < >` +
`‑u < >`
|`USERNAME_NEW`
|The username for the first user of the system to be created. If unspecified the username of the current shell session is used.
|no

|`‑‑hostname < >` +
`‑n < >`
|`HOSTNAME_NEW`
|The hostname of the system to be created. If unspecified the hostname of the running system is used.
|no

|`‑‑codename < >` +
`‑c < >`
|`CODENAME`
|The first word of an Ubuntu codename in lowercase must be defined to refer to a specific Ubuntu version. See https://wiki.ubuntu.com/Releases[here] to choose from available releases.
|yes

|`‑‑dev‑root < >` +
`‑x < >`
|`DEV_ROOT`
|The path to the block device file of the system partition must be specified. This block device file must be unmounted during installation.
|yes

|`‑‑dev‑home < >` +
`‑y < >`
|`DEV_HOME`
|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

|`‑‑dev‑boot < >` +
`‑z < >`
|`DEV_BOOT`
|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 https://wiki.archlinux.org/title/Device_file#Block_device_names[here] for more information about device file names. It does not matter whether the partition is mounted during installation.
|yes

|`‑‑bundles < >` +
`‑b < >`
|`BUNDLES`
|An optional comma separated list that allows installing additional software. See the topic "Software bundles" below.
|no

|`‑‑bundles‑file < >`
|`BUNDLES_FILE`
|The path to an optional file that contains information about bundles and packages.
|no

|`‑‑debconf‑file < >`
|`DEBCONF_FILE`
|The path to an optional file that allows to pre-seed the debconf database.
|no

|`‑‑dconf‑file < >`
|`DCONF_FILE`
|The path to an optional file that overwrites the GNOME dconf defaults.
|no

|`‑‑mirror < >`
|`MIRROR`
|The mirror used to resolve software packages. Default is "mirror://mirrors.ubuntu.com/mirrors.txt"
|no, but recommended

|`‑‑locales < >`
|`LOCALES`
|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

|`‑‑time‑zone < >`
|`TZ`
|The time zone (e.g. _UTC_, _Europe/Berlin_) of the system to be created. If unspecified the installer will ask interactively.
|no

|`‑‑user‑gecos < >`
|`USER_GECOS`
|Additional GECOS information for the first user of the system to be created.
|no

|`‑‑password < >`
|`PASSWORD`
|The password for the first user of the system to be created. If unspecified the installer will ask interactively.
|no

|`‑‑keyboard‑model < >`
|`XKBMODEL`
|The keyboard model. If unspecified the installer will ask interactively. See file "/etc/default/keyboard" of another system to find matching values.
|no

|`‑‑keyboard‑layout < >`
|`XKBLAYOUT`
|The keyboard layout. If unspecified the installer will ask interactively. See file "/etc/default/keyboard" of another system to find matching values.
|no

|`‑‑keyboard‑variant < >`
|`XKBVARIANT`
|The keyboard variant. If unspecified the installer will ask interactively. See file "/etc/default/keyboard" of another system to find matching values.
|no

|`‑‑keyboard‑options < >`
|`XKBOPTIONS`
|The keyboard options. If unspecified the installer will ask interactively. See file "/etc/default/keyboard" of another system to find matching values.
|no

|===

=== Software bundles

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)

== Other features

The installer is able to create Docker container images and Linux containers.
See the code to learn more about these features.

== License

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/_.