Installation (Ubuntu)
Initial Setup
Much of this section is borrowed from the following pages - they are well worth a read!
- http://www.howtoforge.com/perfect-server-ubuntu8.04-lts
- http://www.howtoforge.com/how-to-install-ubuntu8.04-with-software-raid1
This section will create a Ubuntu VM installed on one partition, software RAID'ed across two VMDK's. To explain why I do this, my ESX's storage originally wasn't resilient, hence the software RAID across VMDK's on separate physical disks, if you've got resilient storage you should probably wouldn't use software RAID.
However, once I'd bought a nice (SOHO) NAS, I moved one disk and VM config across to NAS, thinking I'd eventually ditch the software RAID. Luckily I didn't get round to it, so when I managed to destroy my NAS (partly my fault), I could easily recover my VM's from where they left off by creating new ones and re-using the surviving VMDK file. Therefore, unless you're running a truly enterprise class NAS, that's cost you £1k's to buy, and £1k's in yearly support I'd still recommend you software RAID your critical VM's (eg mail server) across two separate devices. The whole reason you have a home set-up is to play, which inevitably means break!
Prepare Virtual Machine
- Create a virtual machine with the following options (use Custom)
- Guest OS: Linux > Ubuntu 32bit
- CPU: 1
- Memory: 756 MB
- Disk: 36GB
- Then add a second 36GB disk on a separate physical datastore (if you intend to use software RAID)
- Attach Ubuntu install ISO to the CD-ROM
Note that the specs above should be altered to suit your purposes. For example, its now more common to use a 64bit OS even if you don't expect to need that much memory addressing, in fact 512 MB RAM is often more than enough
OS Installation
Follow the default or sensible choices for your locale, however, use the following notes as well...
- Configure the network
- Enter the server's hostname (not a FQDN, just the hostname)
- Partition Disks
- If setting up software RAID follow the steps below, otherwise just select Guided - use entire disk and set up LVM
- Select "Manual
- Then create a partition...
- Select the first disk (
sda
) and on the next screen, Yes, to Create new empty partition table on this device? - Select the FREE SPACE, then Create a new Partition, and use all but the last 2GB of space,
- And then select type of Primary, and create at Beginning
- Change Use as to physical volume for RAID, and change the Bootable flag to Yes, the select Done setting up this partition
- Select the first disk (
- Repeat the above on the remaining FREE SPACE on
sda
, to create another primary physical volume for RAID, but 'not bootable - Select the second disk,
sdb
, and repeat the steps taken forsda
to create two identical partitions - On the same screen, select the Configure Software RAID option (at the top), and then confirm through the next screen
- Create a RAID pack/multidisk...
- Select Create MD device, then select RAID1 (ie a mirror), then confirm 2 Active devices, and 0 Spare devices
- Select both
/dev/sda1
and/dev/sdb1
partitions, and then select Finish
- Repeat the above to create a RAID volume using
/dev/sda2
and/dev/sdb2
partitions - Now select the RAID device #0 partition (select the #1 just under RAID1 device line), and change the Use as and select Ext3...
- Change the Mount point to /, then select Done configuring this partition
- Now select the RAID device #1 partition (select the #1 just under RAID1 device line), and change the Use as and select Swap area
- Then select Done configuring this partition then finally Finish partitioning and write changes to disk, and confirm to Write the changes to disks
- Accept the "The kernel was unable to re-read...system will need to restart" complaints for each RAID multidisk, after which the install will continue (note there's a little more to do post install to ensure you can boot using the second disk should the first fail).
- If setting up software RAID follow the steps below, otherwise just select Guided - use entire disk and set up LVM
- Software Selection
- DNS Server - Only required in order to configure split DNS, which is required for an exchange server install
- OpenSSH Server - Required (allows you to Putty/SSH to the server)
Post OS Install Config
- Enable Root
- Use the command
sudo passwd root
- Enter user password, and then a strong password for the root account
- Use the command
- Finish Software RAID config - only if configured during install
- Start-up grub (by entering
grub
and enter the following commands (seems to work better via SSH than direct console)...device (hd1) /dev/sdb
root (hd1,0)
setup (hd1)
quit
- Then edit the
/boot/grub/menu.lst
config file. Go to the end of the file where the boot options are, and create a copy of the first option and edit the following linestitle
Add "Primary disk fail" or something similar to endroot
Changehd0
tohd1
- To check the RAID setup of your drives use
mdadm --misc -D /dev/md0
mdadm --misc -D /dev/md1
- Start-up grub (by entering
Change IP Address
- Edit the
/etc/network/interfaces
file in the following fashion
# The primary network interface auto eth0 iface eth0 inet static address 192.168.1.150 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1
- Then check the local hosts file
/etc/hosts
, so that the IP v4 part looks like...
127.0.0.1 localhost 192.168.1.150 hostname.domain.com hostname
- Check that DNS resolution is setup correctly (add DNS nameservers as required, as found in
/etc/resolv.conf
in order of pref...
nameserver 127.0.0.1
- Then restart networking
sudo /etc/init.d/networking restart
Update the OS
- Run the following command to update the apt package database
apt-get update
- To install any updates
apt-get upgrade
Install VM Tools
The pre-built modules that come with the VMTools installer aren't compatible, therefore the script needs to be able to compile them, however the required library files aren't available by default, so the procedure is a little laboured.
Ubuntu 8.04.4 LTS
- Install the build library files...
apt-get install build-essential
apt-get install linux-headers-2.6.24-26-server
- Use
uname -r
to get the right headers version number
- Use
- Select "Install VM Tools" from the VI Client
- Mount the VM Tools CD-ROM
mount /media/cdrom0/
- Copy to home directory
cp /media/cdrom/VMwareTools-4.0.0-219382.tar.gz /home/user/
- Uncompress and then move into the
vmware-tools-distrib
directorytar xf VMwareTools-4.0.0-219382.tar.gz
cd vmware-tools-distrib
- Run the install script
./vmware-install.pl
- Restart
shutdown -r now
Ubuntu 10.04.1 LTS
VM Tools can be installed via two methods, neither of which is ideal...
- Using the normal VM Tools CD - requires additional library install and sometimes mounting the CDROM doesn't work too well.
- Using APT package manager - doesn't work quite as well as it could (upgrading VM Tools isn't supported), and support for this method is rumoured to be dropped in future releases
VM Tools CD
- Install the build library files (not required for ESX v4.0 update 2 and later)...
apt-get install build-essential
- Select "Install VM Tools" from the VI Client
- Mount the VM Tools CD-ROM
mount /dev/cdrom /media/cdrom/
- If
/media/cdrom/
doesn't exist, create withmkdir /media/cdrom
- If
- Copy to tmp directory (version number below will vary)
cp /media/cdrom/VMwareTools-4.0.0-236512.tar.gz /tmp/
- Unmount the CD-ROM, and move into tmp directory
umount /media/cdrom/
cd /tmp/
- Uncompress and then move into the
vmware-tools-distrib
directorytar xzvf VMware*.gz
cd vmware-tools-distrib
/
- Run the install script, and accept defaults
./vmware-install.pl
- Restart
shutdown -r now
APT Package Manager
- Install VM Tools using apt package manager
- Open VMware Packaging Public GPG Key at http://packages.vmware.com/tools/VMWARE-PACKAGING-GPG-KEY.pub
- On the server open a new file called
VMWARE-PACKAGING-GPG-KEY.pub
with the/tmp
directory - Copy and paste the contents of the webpage into the file and save
- Import the key using the following command
apt-key add /tmp/VMWARE-PACKAGING-GPG-KEY.pub
- You should get
OK
returned
- If you need to add a proxy see http://communities.vmware.com/servlet/JiveServlet/download/1554533-39836/Vmware%20Tools%20Guide%20Linux%20osp_install_guide.pdf
- Open a new vi in VI called
/etc/apt/sources.list.d/vmware-tools.list
- Add the following line
deb http://packages.vmware.com/tools/esx/<esx-version>/ubuntu lucid main restricted
where <esx-version> is the appropriate esx version found at http://packages.vmware.com/tools/esx/index.html
- Update the repository cacahe
apt-get update
- Install VM Tools
apt-get install vmware-tools
NTP
Not required if your server doesn't really need bang on accurate time
Out of the box your server will sync every time its restarted and drift a bit in-between. There is an additional resource demand in running the NTP daemon so unless you need to, there's no need to install the full blown NTP daemon.
I tend to have one or two servers updating from remote (public) servers, and then all others updating from those.
- Install the service
apt-get install ntp
- Update the NTP config file,
/etc/ntp.conf
(Example below is for a server updating from public European servers - see http://www.pool.ntp.org/)server 0.europe.pool.ntp.org
server 1.europe.pool.ntp.org
server 2.europe.pool.ntp.org
server 3.europe.pool.ntp.org
- Restart the NTP service
service ntp restart
- Verify using the following commands
ntpq -np
date