Archive for Linux

Building a KVM host on Debian

As a continuing project I always love playing with virtulisation. This is some notes for installing and configuring KVM on Debian. Its mainly for my own reference, but if you find it useful please leave a comment!

1. Create a Debian ‘base system’ and fully update it. I use Debian stable, and a minimal install.

Hardware Requirements for KVM

KVM works best if your processor supports virtulisation extensions. It WILL still work if you dont, but dont expect any decent performance! Installations of virtual hosts are sometimes painfully slow without this!

I like my virtualmachines to get their own proper IP address from my LAN or be configured with a static. For this to work and get past the default NAT setup, you will need to setup a network bridge. Follow the link here: http://wiki.debian.org/BridgeNetworkConnections#Setting_up_your_Bridge on how to set that up.

2. Now you should have a fully patched and updated Debian system, we’re now going to install KVM:
apt-get install qemu-kvm libvirt-bin

Revisiting Virtulization

xen_logo_small

Its time to revisit virtulization. My home server homer is in dire need of some more diskspace, RAM and general cleaning up. It would probably help if the roles were split across a couple of VM’s. A bit of my development work requires a windows server or 2 and the rest, which is mainly web development is fine with running on Debian.

However, these days homer is showing his age. He is an old Dell, running only a P4 2.8 GHz chip. Hardware vitulization is not supported and previous attempts at running Vmware hasnt worked that well. I think its time to build a new server:

Requirements
1. Its got to be as quiet as possible (currently its in the bedroom, between our desks)
2. Low power consumption
3. Loads of diskspace (main house fileserver for movies) preferably in an LVM or maybe even some kind of RAID.
4. Enough RAM to run a few VM’s for various roles.
5. Low cost – its almost Xmas man!

 

 

Back to Fluxbox

Today I switched back to using Fluxbox on my main linux system at work. I was having major performance issues and boy has it worked! I had forgotten just how fast it was! Dual monitors were a breeze to setup using xrandr and grandr. A few apps added to the start up file and I was in business. Loving Fluxbox yet again!

Easy Backup Script

While waiting for a laptop to install today I thought it would be a nice idea to backup its drive if anything bad happened in the future. Instead of messing about with boot cd’s or PXE booting, I opted for the simple approach. Extract the drive, plug it in another machine and run DD and add a bit of gzip for some compression. I wrote the following script; if you find it useful let me know!
Read more

Funky Graphs with RRDtool

Today I have been playing around with RRDtool to create some graphs with some more functionality that my current MRTG ones. Read more

Conky

On a lot of my screenshots you can see I like to monitor various systems, local and remote. An excellent local monitoring tool I have found is Conky. You can find my .conkyrc file here

Conky

Resizing Xen Disk Images

My Xen host was only created with a 4GB partition:

bart:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 4.0G 2.8G 1.1G 73% /
tmpfs 129M 0 129M 0% /lib/init/rw
udev 10M 24K 10M 1% /dev

With hindsight, this was far too small.
If you a using basic ‘file’ based images you can safely resize them:

First of all make sure you create a backup of your current image:
(Make sure that the image is not mounted or running.)

bart:~# cp hd.img backup.img

bart:~# dd if=/dev/zero of=hd.img bs=1M conv=notrunc count=1 seek=8000

This will resize the image to approx 8GB.

Now boot your host and expand the filesystem:

bart:~# resize2fs /dev/sda1
resize2fs 1.40-WIP (14-Nov-2006)
Filesystem at /dev/sda1 is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/sda1 to 2048256 (4k) blocks.
The filesystem on /dev/sda1 is now 2048256 blocks long.

bart:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 7.7G 2.8G 4.6G 38% /
tmpfs 129M 0 129M 0% /lib/init/rw
udev 10M 24K 10M 1% /dev

:D

Xen Server Setup on Debian Etch

I have spent the morning reading up on Xen details. Im very impressed so far. It seems a great way of doing things. The only thing I am a bit worried about is that the processor in my test rig does not support hyperthreading, so I might not get any performance increase to begin with. However, the plan for the moment is to complete the Debian server and to install 3 guest OS’s: Windows 2000, Windows XP and a Debian server install. At the moment im following this giude : http://shearer.org/MinimalEtchXen It is geared to a nice minimal Etch install so should be perfect for my needs!

Wish me luck!

Dammit. Windows images will NOT run without a VT enabled processor. Anybody got a spare Dual-Core Intel Chip and board lying around spare? ;-)

Xen Thinking

Xen clustering is the way to go. Im thinking of creating a Xen install (Debian) on one of my faster boxes to perform the following roles:

Windows 2000 Server (Game Server)
Debian Linux Server (www, mail, ftp)
Debian Linux Server (internal file & print server)
Windows XP Pro (client test install)

I’ll let you know how I get on! :-)

Enabling mod_rewrite under Debian for Apache2

Nice and simple!

# a2enmod rewrite
Module rewrite installed; run /etc/init.d/apache2 force-reload to enable.
# /etc/init.d/apache2 force-reload
Reloading web server config: apache2.
#