Minimal Ubuntu 8.04 Server Install

I find myself removing packages that I don't need, especially if the packages belong to processes that are using processor resources. There is a way to start from the ground up, you can have a minimal system and just add what you need. This has the added benefit of extra security, your system doesn't have services running that you don't use. You won't use a Ubuntu Server CD, but the Desktop Live CD.

 

1 Partition and Format drives

The tutorial is targeted for Sysadmins and more experienced users, so you probably know how you want to configure your storage. You could create a software RAID, my RAID 10 tutorial can guide you how to set up a RAID array in a Live CD environment.

Create your partitions, this example has a 50MB boot partition, a xfs formated root partition, and a 2GB swap partition.

sudo su
cfdisk /dev/sda
mkfs.ext3 /dev/sda1
mkfs.xfs /dev/sda2
mkswap /dev/sda3

 

2 Use debootstrap to create a minimal system

Mount file system and install debootstrap:

mkdir /min
mount /dev/sda2 /min
mkdir /min/boot
mount /dev/sda1 /min/boot
apt-get install debootstrap

By default debootstrap will download about 100 MB from ubuntu.com. Change the url on the third line to the best mirror you have access to.

nano /usr/share/debootstrap/scripts/hardy
case $ARCH in
amd64|i386|sparc)
default_mirror http://mirror.xmission.com/ubuntu

Use debootstrap to create the minimal install:

debootstrap hardy /min

 

3 Configure your install

A few settings not configured in the install can just be copied from the Live CD environment:

cp /etc/hosts /min/etc/
cp /etc/network/interfaces /min/etc/network/
cp /etc/bash_completion /min/etc/
cp /etc/bash.bashrc /min/etc/

Set up mount folders for your optical drive:

mkdir -p /min/media/cdrom0
ln -s cdrom0 /min/media/cdrom

Configure your file system table:

nano /min/etc/fstab
proc            /proc           proc    defaults                   0       0
/dev/sda2	/               xfs    relatime                   0       1
/dev/sda1	/boot           ext3    relatime                   0       1
/dev/sda3	none            swap    sw                         0       0
/dev/cdrom      /media/cdrom0   udf,iso9660 user,noauto,exec,utf8  0       0

 

4 Chroot into your minimum install to prepare it for booting.

Set up and enter your chroot enviroment:

mount --bind /dev /min/dev
mount -t proc proc /min/proc
mount -t sysfs sysfs /min/sys
chroot /min

Install tools for your file system, unless you're only using ext2 or ext3.
Say yes at the verification prompts:

apt-get install xfsprogs

Set your timezone, match the zoneinfo directory to your location:

cp /usr/share/zoneinfo/America/Denver /etc/localtime

Install your favorite config editor.

apt-get install nano

Update your sources.list to have all the packages and updates from your favorite mirror.

nano /etc/apt/sources.list
deb http://mirror.xmission.com/ubuntu hardy main restricted universe multiverse
deb http://mirror.xmission.com/ubuntu hardy-updates main restricted universe multiverse
deb http://mirror.xmission.com/ubuntu hardy-security main restricted universe multiverse

Update your system.
You can ignore the locale warning.

apt-get update
apt-get dist-upgrade

Set root password and set up a user:

passwd
adduser maxbash

Set up sudo for your user:

addgroup admin
adduser maxbash admin
echo "%admin ALL=(ALL) ALL" >> /etc/sudoers

 

4 Make the minimal system bootable

Install the kernel and boot loader:

apt-get install linux-image-server grub
mkdir /boot/grub
update-grub

Make sure all of the needed kernel modules are installed in the inital ramdisk.

update-initramfs -u

Exit your chroot:

exit

Install grub to the MBR:

grub-install --root-directory=/min --no-floppy --recheck /dev/sda

Reboot into your new system.

Share this page:

10 Comment(s)