Skip to content

Instantly share code, notes, and snippets.

@HariSekhon
Created March 22, 2024 01:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HariSekhon/c8f0ecb4f8097428e64a7b673a3020d9 to your computer and use it in GitHub Desktop.
Save HariSekhon/c8f0ecb4f8097428e64a7b673a3020d9 to your computer and use it in GitHub Desktop.
ubuntu.md from HariSekhon/Knowledge-Base repo: https://github.com/HariSekhon/Knowlege-Base

Ubuntu

https://ubuntu.com/

The most widely used Linux distribution for cloud installations, derived from the battle tested stable long term Debian distribution which is now the standard for Linux and the eventual winner of the long Linux distro wars, as the result of Redhat abandoning the open source mission in favour of profits and relegating themselves to becoming legacy.

For servers always use LTS releases for stability (LTS = Long Term Support).

For the Desktop release you can just do with the newer version.

The Releases page lists the release dates and end of life date for each of version.

Debian Core

Read the Debian.md page for Deb / Apt package management and other core commands derived from Debian.

Upgrade LTS to newer non-LTS release

Don't do this on servers unless you have no other choice.

Servers should remain on LTS release, normal releases are better for desktops.

sudo apt-get install -y update-manager-core
sed -i 's/^Prompt=lts/Prompt=normal/' /etc/update-manager/release-upgrades

This step must be done locally, otherwise it tries to spawn another sshd which crashes out as a bug in 12.04 LTS:

do-release-upgrade

Change keyboard layout (requires reboot):

sudo dpkg-reconfigure keyboard-configuration

AutoInstall - Automated Installations

Ubuntu can be automatically installed via a config text file bundled into an installation medium such as a DVD iso or served by a web server on the local network.

Newer versions of Ubuntu use Autoinstall (autoinstall-user-data config).

This is called by adding the following kernel arguments in the installation grub bootloader:

linux /casper/vmlinuz autoinstall 'ds=nocloud-net;s=http://192.168.1.2:8080/'

The above command will search the web server base address for user-data and meta-data files. The user-data contents should be the config above with all the installation settings but the latter meta-data can be empty.

Older versions of Ubuntu used Redhat's Kickstart format (anaconda-ks.cfg config).

If you just want to start a quick webserver from your local directory, you can do this which starts a local webserver on port 8080:

warning this will share out your entire $PWD local directory contents without authentication so copy to an empty /tmp directory and share that so nothing else is exposed:

mkdir -p -v /tmp/serve-autoinstall &&
cp -v autoinstall-user-data /tmp/serve-autoinstall/user-data &&
touch /tmp/serve-autoinstall/meta-data &&
cd /tmp/serve-autoinstall &&

python -m SimpleHTTPServer

Autoinstall Template

HariSekhon/Templates - autoinstall-user-data

HashiCorp Packer + Autoinstall Config

Packer builds fully automated Virtual Machine golden templates from which to clone virtual machines by booting the Ubuntu installer medium with an Autoinstall config.

Real-world Autoinstall config used by Packer build:

HariSekhon/Packer-templates - installers/autoinstall-user-data

For building Ubuntu VMs with this config, here are relevant real configs:

HariSekhon/Packer-templates - installers/autoinstall-user-data

HariSekhon/Packer-templates - ubuntu-x86_64.vbox.pkr.hcl

Ported from private Knowledge Base page 2010+ - should have been from mid 2000s but young guys don't document enough
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment