Encrypted LVM RAID in Ubuntu

This tutorial explains how to setup an encrypted LVM Raid on Ubuntu. Much of this tutorial is outdated, therefore I am including it under the Misc category. All steps have been tested on Ubuntu 12.04 LTS.
_________________________________________________________________________________________________________________

Setting up an encrypted RAID 5 on Ubuntu

Recently I started on configuring an encrypted RAID 5 on Ubuntu 10.10 Server. These were the steps I took:

First, install the required packages:

sudo apt-get install mdadm gddrescue cryptsetup lvm2

I used fdisk to partition each disk as a “Linux raid autodetect” partition.

sudo fdisk /dev/sdb

for each device (in my case /dev/sdb /dev/sdc /dev/sdd and /dev/sde). First use option “n” to add a partition, option “t”to change it to type “fd” and “w” to write the changes to disk.