Ubuntu - Expert Style

Minimal and Custom Dapper Drake installation


If you like the Debian style minimal, highly configurable install ( e.g. like this howto ), Ubuntu Dapper Drake desktop install may seem a bit to much of the idiot-proof " next next next ". Although the live-CD approach to a Desktop setup has its advantages, (it's wonderful for home users or to quickly setup a few desktops or laptops), it does tie your hands if you're looking to setup unattended installations of lots of PC's, or want a minimal setup that you can build your own custom setup upon. Here's how to get your sysadmin power back.

installing Ubuntu Dapper Drake - 6.06 LTS

For installation, do NOT choose the Ubuntu 6.06 LTS (Dapper Drake) Desktop CD. That's the one that starts a live system from CD and dumps it to disk. Not much too configure there, and even less to automate. Choose the 'alternative' image (which gives "text mode" and "OEM" installation options). Better yet, choose the mini.iso, a net install CD image. (archive/.../dists/main/installer/.../netboot/)).

The following procedure is based on a net install, but the "alternate" install is similar, except that with the "alternate" CD, you need to choose 'Expert Mode' (F6 before booting the installer) to be able to skip installation of some packages. For more recent versions of Ubuntu, the procedure is similar but some details may be different. Read the messages displayed on the screen to make informed decisions during install.

As usual, boot from the installation CD. Don't press enter right-away, but press the function keys to view the boot options. You might be interested in the following options

server-expert
a boot image label for a minimal install with lots of input. Other 'labels' can be found at the package archives, in the main/installer directory.
hardware options
change debconf priority
this controls how much input you can give during configuration of packages. Setting it 'low' means more input but more control. 'medium'
put string here
a preseed-URL for automatic installation

so you'll build a boot string like

	boot: server-expert debian-installer/framebuffer=false screen=800x600 xkeyb=be keyb=be lang=be
		debian-installer/preseed-URL=
	

The function keys show more and other examples, you can also try Knoppix 'Cheat Codes' and general debian-installer boot parameters.

Why do we do this ? We choose a server install because it's a text mode setup that doesn't install xwindows. 'Expert' puts the debconf priority warning level so that the installer asks a lot of questions (so you can customize and avoid 'default' server packages), and you can add a preseed-url and some hardware specific parameters to get things organized, baselined, and unattended. These are options! At the least, you 'll have to install a server in expert mode for a minimal, customizable setup. The other options can be used to pre-configure and automate things, or for troubleshooting specific problems.

Bugs and Caveats

When its time to select a mirror to install from, you can only choose a country, which will result in installing from [country code].archive.ubuntu.com. The only alternative is "enter information manually", in which case you need to build a path to a server, in a way that this path will resolve to a valid download-URL, such as a path to an apt-proxy.

During the installation procedure, you'll reach the item "select and install software", but it doesn't let you choose anything, the selection is preconfigured by Ubuntu. Skip this step, you can easily add any software later.

special case : starting from a debian base install

If the Ubuntu 'server-expert' gives you any difficulties, you can also start from a Debian system. Starting from a Debian Etch (stable / Sarge may work to, but i didn't try it), apt-get update to have the system up to date, then remove all entries from /etc/apt/sources.list and replace them with references to the Ubuntu repositories. Run apt-get update to activate the new sources, then apt-get upgrade && apt-get dist-upgrade to introduce ubuntu replacement packages if they are available.

An advantage of migration from Debian to Ubuntu is that in the process, you're re-configuring packages, and you can configure more/better than the ubuntu 'server-expert' allows (by default).

You'll be replacing a couple of hundred packages, and chances are that sooner or later you'll break dependencies. Usually they can be fixed by repeating apt-get update && apt-get upgrade && apt-get dist-upgrade. apt-get -f install can help to fix dependencies, dpkg --configure -a will pick up the install and configuration routine if it got interrupted for some reason. It may be necessary to repeat those 5 commands a couple of times to get a successful debian to ubuntu migration

Setting up Ubuntu (standard)

To turn this very minimal ubuntu system into a Ubuntu Dapper Drake Desktop, you could install one or more of the following packages - all at once or one by one. One by one is probably better, as this makes it easier to fix broken dependencies and other upgrade trouble should it occur.

ubuntu-minimal
mainly libraries. Will also get installed automatically to resolve dependencies from the other ubuntu packages
ubuntu-base
transitional package, temporary, to resolve discrepancies between Ubuntu and Debian packages. Mainly alternative versions of libraries. Causes ubuntu-minimal and ubuntu-standard to be installed as well.
ubuntu-standard
creates sort of an ubuntu system without GUI but with more software and utilities than the core 'Linux from ubuntu archives' system, e.g. tools for wireless networking, etc. Also triggers the installation of ubuntu-minimal. Install ubuntu-standard to finish the conversion from Debian to Ubuntu and to lay the ground work for a ubuntu-desktop install or your own customized x-windows-system.
ubuntu-desktop
installs xwindows and Gnome in an Ubuntu configuration, but also adds desktop applications such as
you can remove any of them if you don't want them. This will seem to 'uninstall' ubuntu-desktop, but that is just a virtual package, a trick with dependencies to get a collection of packages installed and configured. You don't really need it anymore.

alternatives for ubuntu-desktop are kubuntu-desktop (KDE Ubuntu desktop) and xubuntu-desktop (ubuntu desktop with xfce window manager in stead of Gnome desktop). For a lightweight desktop, xubuntu is probably a better choice.

The following packages gave dependency trouble:

lvm2
lvm-common
mdadm

These are RAID tools, and if you don't really need them (it's a desktop, right), you can uninstall (remove --purge) them, and repair the installation with apt-get -f install and dpkg --configure -a. You can also 'remove' ubuntu-minimal, ubuntu-base and ubuntu-standard, as these are only meta-packages to trigger the installation of other packages.

Setting up Ubuntu - customized

If you want to create a highly customized desktop environment, you'll probably want to skip the ubuntu-* packages and install your own selection by hand. You can just pick and chose. You could also have a look at what a 'real' ubuntu desktop installs, and base your selection on it.

With "dpkg --get-selections" you can list what's installed on an existing system (auto-inventory. See also automatic installations). You can also reveal the contents of ubuntu-minimal, ubuntu-standard, ubuntu-desktop with
apt-cache depends ubuntu-desktop [> list_of_packages ], and use the output to create a list of what you want to install. It's quite safe to leave out things like python, libraries (lib*) etc. If they're absolutely required for other packages, apt will install them (dependencies !). Your list will need some clean-up, eg sed -i s/"Depends:"//g list_of_packages.

Next, you can run the following commands on a minimal ubuntu system to transform it into a customized desktop :

	# edit /etc/apt/sources.list first, 
	#     then, make sure we're up to date
	apt-get update
	apt-get -y upgrade

	# check kernel and replace it if necessary
	uname -r
	apt-get install kernel-image 
	apt-get install linux-image

	# install windowing system
	apt-get -y install x-window-system-core xserver-xorg gdm

	# we'll use wget to download files from an intranet web server
	apt-get -y install wget

	# grab list of packages
	wget http://intranet/list_of_packages

	# install packages from list
	for item in $(cat list_of_packages);
		do apt-get -y install $item;
	done
	

Automation

Here's a script that performs some basic system administration tasks. Because they're scripted, they're easy to repeat (wget this script from a server and run it), allowing for the creation of a baseline on which you'll build your customized systems. The script is compatible with Debian and Ubuntu minimal (server-expert) installs, and can be combined with a script to install your custom software selection :

	#!/bin/bash
	## Ubuntu/Debian baseline configuration
	#
	# list of packages we want on *every* PC
	APPS="less vim openssh-server wget rsync whois iptables ntp-simple"

	# user account we want on *every* PC
	THEUSER=operator
	
	# create a timestamp so we can track config changes made after initial install by comparing modification dates of files. 
	date > /etc/timestamp

	#backup files that will be modified in this script before modify
	echo "backup files that will be replaced or modified"
	cp /boot/grub/menu.lst /boot/grub/menu.lst.orig
	mv /etc/apt/sources.list /etc/apt/sources.list.orig

	# set a modified sources.list
	cat > /etc/apt/sources.list << EOF
	deb http://192.168.0.1:9999/ubuntu/ dapper main universe
	deb http://192.168.0.1:9999/ubuntu/ dapper-updates main universe
	deb http://192.168.0.1:9999/ubuntu-security/ dapper-security main universe
	deb http://192.168.0.2/mypackages ./
	EOF

	# install baseline packages
	apt-get update
	for pkg in $APPS ; do
		echo; echo "install $pkg"
		apt-get -y --force-yes install $pkg
	done

	#ntp config
	echo "server 192.168.0.2" > /etc/ntp.conf

	# set admin user account and password.
	echo ; echo "creating a system administrator account $THEUSER"
	if grep $THEUSER /etc/passwd ; then
		echo "$THEUSER exists. reset the password :"
		passwd $THEUSER
	else
		echo "$THEUSER doesn't exists. create an account :"
		adduser --ingroup admin $THEUSER
		passwd $THEUSER
	fi

	# this is to get dhcp to take note of the hostname.
	echo ; echo "send hostname when requising dhcp lease"
	grep "$HOSTNAME" /etc/dhcp3/dhclient.conf  && echo "- OK " || ( echo "send host-name \"$HOSTNAME\" ;" ) >> /etc/dhcp3/dhclient.conf


	# basic security : GRUB
	echo ; echo "basic security : locking the boot menu and protecting maintenance mode"
	# gnome menu lock-down : insert locks, set timeout, set passwd
	sed -i -e  's/^timeout[ \t]*[0-9]/timeout 1/' /boot/grub/menu.lst
	sed -i -e '/title[ \t]*Ubuntu, memtest86+/a\lock\ ' /boot/grub/menu.lst
	sed -i -e '/(recovery mode)/a\lock\ ' /boot/grub/menu.lst


	## the end
	apt-get update
	apt-get upgrade
	apt-get clean
	apt-get update
	

For a graphical environment you will need to install

Next Steps

You now have your base ubuntu desktop system, that you can configure further to your leisure - e.g. add only the applications you (or the users on the network you're in charge of) need in stead of accepting the default set of applications in an ubuntu-desktop. This could also be the start of e.g. a Linux multimedia kiosk system.

Take it one step further, and you could create a custom debian package (eg 'ubuntu-desktop_mychoice'), which adds the packages you selected, including any customized configuration file. An other option is to create a customized installation CD.

You can also just install a package manager and use that to further build your custom desktop.

Tom Fichtner made a Light and Complete Ubuntu Install Script, a.k.a. Ubuntu Light Deluxe, that lets you set up a custom Ubuntu desktop from a base command line system. (see also Ubuntu Forums).


Koen Noens
July 2006