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 Change the url on the third line to the best mirror you have access to.

nano /usr/share/debootstrap/scripts/hardy

case $ARCH in

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 hardy main restricted universe multiverse
deb hardy-updates main restricted universe multiverse
deb 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:

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

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

update-initramfs -u

Exit your chroot:


Install grub to the MBR:

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

Reboot into your new system.

Share this page:

Suggested articles

10 Comment(s)

Add comment


By: Anonymous

I am not a novice, but I have never done a Linux OS install from source either. I would like to get a minimal install like this working, but I do not know what packages to install to get my NIC working.

By: Anonymous

This sounds interesting. I'm looking for a minimal server install and plan to use openvz to run all my services under it. My only question is how does this compare to ubuntu jeos?

Does this method provide fewer services and/or a smaller footprint?


I haven't tried Jeos, but my understanding is that it designed for making virtual machine appliances, or rather for the VM guest.


I know this tutorial isn't exactly targeted at beginners, but for clarities sake you might explicitly make it apparent that the first step is to boot with the LiveCD.

By: Anonymous

I can't get my nic to work. Ifconfig -a shows an eth0 and lsmod shows the e1000 driver. Dmesg shows no errors with the nic. /etc/network/interfaces is setup correctly but ifconfig doesn't show eth0 (only with the '-a' added). Any idea how this can be fixed?


I find Ubuntu 8.04 Live CD a little flaky with static IPs, sometimes I have to check the box to activate and deactivate the interface in the network control panel a couple times to have it come up. Once I really had to tinker with it from the console to get it to work.

By: cosming

Nice job, I tested in vbox and worked "out of the box".

Thank you

By: kaizoku

Does this work with intrepid? Also can this be done over ssh, as I do not have access to server locally.

By: Wonnmeister

You rock!  This tutorial worked perfectly for me.  I even learned a few things by looking up some of the commands that I didn't know before.  Awesome job brother!


By: Anonymous

How can I run this on a machine with 128 MB of RAM?  The minimum requirements to run an Ubuntu Live CD are greater for RAM.  I tried figuring out how to get the Live CD to drop me to a shell instead but couldn't find anything.