Wednesday, December 30, 2009

Installing Ubuntu 9.10 as home server

In this article I'm going to be installing Ubuntu Server 9.10 on my home server with some specific requirements. I'm doing the installation on a similar built VM as well to get screencap's.

The server contains 2 SATA drives of 1 TB in it. It also has one internal gigabit nic, and a wifi USB stick.

For this system some requirements spring to mind:
-Full install from USB stick, just for the added speed & to test if and how that works.
-Full raid mirror array set for vital data, partially using logical volume management
-Minimal networking setup during installation, as I'll do that later, bridging my wireless internet to wired.

After initial setup is done, I'll write follow-up articles on for example:
-I want an Apache2 server running
-I want a scheduled Dirvish backup
-Monitoring & alerting, undecided with what nagios or cacti or something else
-Networking setup 
  -DHCP/DNS for internal network/domain
  -Wifi internet sharing to my internal wired network (my landlord has wireless internet)

As I can only cover so much in 1 article, we'll mostly handle the installation today.

Getting Ubuntu Server
This should be the least of your worries, in my case I downloaded the ISO, and used UNetbootin to create the USB stick. The later to install from USB for added install speed.
Just make sure your UNetbootin screen looks similar to this:
That's all nice for desktop live cd's, but doesn't work when you just want to install the server version.
Open syslinux.cfg on the root of your usb stick and add the following section (under timeout):

label ubuntuserver
menu label ^Server installer
kernel /install/vmlinuz
append initrd=/install/initrd.gz ramdisk_size=10000 cdrom-detect/try-usb=true root=/dev/rd/0 devfs=mount,dall rw

Note: the 'append' line is 1 line till 'rw' !
I tried about 10 different USB creators and loads of manuals, but in the end I doctored this approach together.

The install
Insert the Ubuntu USB stick or live CD and boot from it. You'll get an UNetbootin menu, where you just select 'Install'. After accepting English as your language for the installer, we come to the main menu.
Select 'Install Ubuntu Server' (you'll skip this step if your working from the USB stick..this is cd only)

We then get to choose the language for the installation process, where I select 'English'

Next up is choosing your country, territory or area.
Here I first select 'Other', then 'Europe' and then 'Netherlands'.

Keyboard setup is next, just select 'No'. On the next 2 screens then say 'USA' and again 'USA'.
You might want to pick whats more appropriate for your system, but most keyboards are USA. USA International is also one that's picked a lot by people in Europe and other native non-english countries.

Now it starts detecting and loading components, this takes a few seconds.
If like me you don't have DHCP server running, you'll get a DHCP autoconfiguration error as thus: 
Most people will never get this message as they'll have DHCP auto-configuration from their modem/router. Just press 'Continue' if this happens.

Note: If you don't get the DHCP fail, then your server's TCP/IP settings will be set by your DHCP provider, which should be OK for most systems, though it might be handy to make sure your server will keep the DHCP lease so as to keep a static IP. You can read the manual of the device which provides your DHCP on how to configure it to keep a device on the same IP. (this is definitely outside my scope)

Network Configuration
Will be mostly empty as I plan to setup most networking after installation. 

In my specific case I want to manually configure my server's networking to be sure it remains on the same internal IP. Select 'Configure network manually'. Servers like a static IP :)

Next up is entering your IP address. The internal wired will be on the 192.168.66 network, so I set my servers IP to Just make sure you keep it in an allowed private range.

Next question is the netmask, this is usually

Gateway is up next; As I'll be configuring internet later for this machine, I'll make this blank for now.
This usually is your router or modem's IP.

Name server, which I also won't be using for now. So same as last time, blank.
Normally this is either your modem/router, or your internet providers DNS.

Enter a hostname, think of this wisely, you'll be stuck with it for a while, and chances are you're going to be typing it a lot (so something easy & small is handy). In my case bender was the last, but I'm going for 'hactar' this time. In case your stuck for a name you might want to browse wikipedia's list of finctional computers. 
(Hactar: the computer that designed the cricket-ball-shaped doomsday bomb (that would destroy the universe) for the people of Krikkit, in Douglas Adams's Life, the Universe and Everything (1982))

Next is your domain name. Unless your running (or building) a domain controller, leave this empty.

Disk Partitioning
The next part is important as your going to be stuck with it for a while. Paritioning in linux can be done very simple, by just letting the partitioner auto configure. But I want a slightly more advanced configuration. As my server contains a lot of files I don't want to lose, I configure my 2 drives as a mirror. And I set most of that up as a volume group for easier dynamic resizing.

I'll give a short list partition wise, then I'll give the screenshots:

  • /dev/sda1 & /dev/sdb1 = raid 1 mirror as /boot, each 500 MB.
  • /dev/sda2 & /dev/sdb2 = raid 1 mirror in a volume group VG01, each 999.5 GB
Volume group VG01 setup:
  • /dev/VG01-swap = mounted as swap, 4 GB
  • /dev/VG01-root = mounted as /, 15 GB
  • /dev/VG01-home = mounted as /home, 15 GB
  • /dev/VG01-share = mounted as /srv, 500GB
Now to continue where we left of. I choose 'Manual' here.

Ignore the sizes a bit from here on, this is my VM's  installation and I didn't have enough terabytes to do all this exactly as on my server ;)
As you can see on the next picture, i do have drives, but no free space, which means we haven't got partition tables yet. Just click the 2 harddiscs and the installer will ask if you want a new partition table there.

  After getting our partitions fixed, we get a lot more options...

Now select the first piece of freespace (the "pri/log 5.2 gb free space" line), and select "Create a new partition".

As the boot partition should be first on the drive we'll start with that. Set partition size to "500 MB"

 Select Primary

 Select beginning of space

Next your given the choise of what type of partition we're creating. Change use as into 'Physical volume for RAID', and turn the bootable flag on.

Now do the same for the second harddisc till they both have a raid partition. Go to "Configure software RAID"

In case the installer asks if you want to keep your current partition layout and configure RAID, say Yes.
You should come to the RAID configuration menu, select "Create MD device".

To skip a few screenshots: Select RAID1. Select 2 active devices. Select 0 spare devices.
When asked which are the active partitions of the device, select our two 500MB raid partitions:

After clicking Continue, and then selecting Finish from the main RAID menu, we come back to the main partitioning screen, which by now should look like the following. Highlight (as shown) the 500 MB raid device, and press enter.

By default it will say the partition is unused, change this to ext4 (or whatever you want your partition in, I'm going for ext4), and change the mount point to /boot.

Now that we're done setting up our first raid partition, it's time for the next one. Setup the two remaining free space as logical partitions of all the leftover space. Configure it as a Physical volume for RAID again,  only this time leave the bootable flag set to off. After checking things are similar to the image, proceed to the RAID configuration again.

If the RAID configurator asks if you first want to write partition changes, say Yes.
Create a second MD device, also RAID 1 of 2 devices and 0 spares of the remaining two partitions.
After finishing the RAID configurator, enter the new raid device that's created and setup it up for LVM:

Select 'done setting up the partition', and enter the logical volume manager configuration menu.

As it has no volume groups setup yet, this will be the first thing we do: Create volume group

Name it VG01, and as devices select /dev/md1 (our big 999.5 GB mirror). You should come back to the same LVM menu. Now it will no longer show 1 free physical volume, but 1 used, and 1 volume group.
Select Create logical volume, select VG01, name it VG01swap, and make it 4 GB.
We do the same for VG01home (15GB), VG01root (15GB), and VG01share (500GB).
Finish the LVM configurator.
Set VG01home as EXT4, mounted as /home
Set VG01root as EXT4, mounted as /root
Set VG01share as EXT4, mounted as /srv
Set VG01swap as swap.
Now your screen should look like: (ignore that the VG01 partitions are all in MB...;)

Go down and select 'Finish partioning and write changes to disk'. The next question depends a bit on your configuration, but I choose that I don't want my system to boot if my raid mirror breaks.

After this your asked to OK all the partition changes.. say YES if you did all the previous steps correctly.

Further questions are username, full name, password, if you have a proxyserver and if you want to encrypt your homedirectory. Proxyserver was left blank and no encryption of home dir.

Next item of interest was the scheduled updates question. As I like to be present during updates, I have cron-apt handle this on download-only mode, but that's for later. For now answer 'no automatic updates'.

Next question will be the Software selection. This is a handy feature to quickly install various software. As I like to do things manually (read: the hard way ;) I only opt for OpenSSH, which I'll be using to remotely access my ubuntu server.

Install should really get on the way now (feel good moment!).

At some point I was asked by grub if I wanted grub2 (which I did), and what my boot partition was, which I set to '/dev/sda /dev/sdb'.

After this my VM crashed (running M$ virtual pc..go figure :), and on my server I ran into an error that was a known bug on launchpad for intel 915 videocards, which my server has builtin. Luckily the Intel error did not affect system performance especially since I don't do anything graphical on my server.

Next time we continue with first configurations of our new server, in part 2.


  1. Hi Jeroen, duplicating your setup. Where's part two?
    Thanks for a good write up.

  2. Hi Dries,

    Thansk :), and sorry for not reacting this long, I've been extremely busy with work and kinda lost track of the blog.
    But I've started blogging a bit again so I might finish it sooner or later :)
    In case your curious on the network setup, I can advise you to:

    And for my monitoring I've gone with zabbix (after a lot of issues with Mon, Cacti & Nagios), as you can read in the last 2 articles :)
    I'll soon have more articles upcoming, so check the blog out every now and then!