V2 Server Setup
Introduction
- A Linux server capable of hosting multiple virtual machines (VMs)
- Basic setup performed by hand:
- OS installation
- Install development tools
- Setup RAID disk mirroring
Further provisioning automated by use of Puppet:
VirtualBox and Vagrant installation
- Rinetd setup on host system
- Reverse proxy gateway in VM
- Internal DNS server in VM
Basic Platform
- Hardware:
- Multi-core Intel architecture with 64-bit processor(s)
- 1 x SSD drive for the root, swap and main applications
- 2 x identical hard disks for backups
- Software:
VirtualBox - Virtualization software
Bagrant - Ruby-based command line front for VirtualBox
Other standard Linux packages (Bind, Apache, MySQL, Rails, etc.) as needed
Operating System Installation
Download Ubuntu 12.04.3 LTS Server
Available from: http://www.ubuntu.com/download/server
Select: 64-bit (recommended) - This is called amd64, with is appropriate for Interl and AMD 64-bit processors
- Prepare a bootable memory stick
- See instructions at:
On an Ubuntu system: http://www.ubuntu.com/download/desktop/create-a-usb-stick-on-ubuntu
- See instructions at:
Ubuntu Installation
Boot system from memory stick containing Ubuntu 12.04.3 LTS server
Select language: English
Selection option: Install Ubuntu Server
Select system language: English
Select location: other --> Europe --> Switzerland
Select locale: en_US.UTF-8
- Configure network:
DHCP configuration will start, enter cancel
Select primary network interface - This question does not appear for systems with a single ethernet port
Select: Configure manually
IP address: enter systems's IP address'
Gate IP address: enter system's gateway address
Nameserver address(es): enter system's primary DNS IP address(es)'
Hostname: enter system's hostname
- Create initial user
- Full name:
- User name:
Enter & re-enter password
Encrypt home directory: no
Time zone: Accept Europe/Zurich
- Partition disks:
- Select entry for SSD drive
Select Automatically partition and use LVM
- Select entire disk
- Accept proposed partition and accept writing partition table to disk
Installs base operating system
Enter proxy information: Enter return (e.g. no proxy required)
Software selection: Select SSHD server, and nothing else
Installs and configures more software
Install GRUB boot loader: Yes
- Installation complete. Remove memory stick a reboot
Initial Configuration
- Login as the user defined during the installation
- Set the root password:
sudo bash passwd
- Update system:
apt-get update apt-get -y dist-upgrade
Install development tools, required for VirtualBox installation
apt-get -y install build-essential autoconf libtool pkg-config
Setup Mirrored Disks
Setup RAID-1 based mirrored disks
Device Names
In a typical installation, the SSD and two hard disks have device names assigned as follows:
SSD: /dev/sda
Hard disk 1: /dev/sdb
Hard disk 2: /dev/sdc
Procedure
Partition and format hard disks with ext4 filesystems
Partition: Perform this procedure once for heach hard dick, typically for /dev/sdb and /dev/sdc. Enter the following commands:
fdisk /dev/sdb p # Print partition table d # Delete all existing partitions. May need to use this command multiple times n # Create a new partition, accept defaults, which are for a primary partition using all availa disk space w # Write partition table to disk and exit
- Example:
Command (m for help): p ..prints partition table (which will be empty for a new disk).. Command (m for help): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): Partition number (1-4, default 1): Using default value 1 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table.
- Setup RAID-1 set:
- Create mount point:
mkdir /v01
- Create multi-disk array for RAID set:
mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1
- Create mount point:
- Show information about the RAID set:
mdadm --detail /dev/md0 /dev/md0: Version : 1.2 Creation Time : Tue Nov 19 16:12:03 2013 Raid Level : raid1 Array Size : 1953381248 (1862.89 GiB 2000.26 GB) Used Dev Size : 1953381248 (1862.89 GiB 2000.26 GB) Raid Devices : 2 Total Devices : 2 Persistence : Superblock is persistent Update Time : Thu Nov 21 16:48:44 2013 State : active Active Devices : 2 Working Devices : 2 Failed Devices : 0 Spare Devices : 0 Name : odin:0 (local to host odin) UUID : 7289ef81:334df27d:389e9383:c225b4f5 Events : 160 Number Major Minor RaidDevice State 0 8 17 0 active sync /dev/sdb1 1 8 33 1 active sync /dev/sdc1 mdadm --detail --scan ARRAY /dev/md/0 metadata=1.2 name=odin:0 UUID=7289ef81:334df27d:389e9383:c225b4f5 blkid /dev/md0 /dev/md0: UUID="21f4f1a5-7f60-4f89-986d-84cfd6de49b4" TYPE="ext4"
- Format the RAID set:
mkfs -t ext4 /dev/md0
Update /etc/mdadm/mdadm.conf and add the following: (Note use of the UUID, obtained from the mdadm --detail --scan command):
# 2 x 2TB mirrored hard drives: ARRAY /dev/md0 level=raid1 num-devices=2 metadata=1.2 UUID=7289ef81:334df27d:389e9383:c225b4f5
Update /etc/fstab and add the following: (Note use of the UUID, obtained from the blkid /dev/md0 command):
# 2 x 2TB mirrod disks UUID=21f4f1a5-7f60-4f89-986d-84cfd6de49b4 /v01 ext4 defaults 0 2
Update /etc/initramfs-tools/conf.d/mdadm to contain: (This allow the server to reboot when the RAID set is degraded. If this is not set, when the RAID set is degraded, which is the apparently case while the RAID is initially being built, the system will not boot, except through the rescue menu entry of the systems boot menu).
BOOT_DEGRADED=true
- Test mount and umount the RAID set:
mount /v01 df -h ...should list /dev/md0 with the expected disk capacity umount /v01
Reboot system to make sure it boots and that the /v01 file system is present:
reboot now
Additional System Configuration
NTP Configuration
- Install NTP daemon
apt-get install ntp
Edit /etc/ntp.conf to contain the following:
server ntp1.softxs.ch server ntp2.softxs.ch server ntp3.softxs.ch server ntp4.softxs.ch
- Start NTP daemon:
service ntp restart
- Check damon running and able to connect with time servers: (You should see output like the following):
ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== caledonia.dataw 129.69.1.153 2 u 7 64 1 19.662 54.345 0.000 ntp0.as34288.ne .MRS. 1 u 6 64 1 27.857 14.460 0.000 arthur.testserv 162.23.41.56 2 u 5 64 1 23.029 12.674 0.000 ms21.snowflakeh 81.94.123.17 2 u 4 64 1 35.802 19.073 0.000 europium.canoni 193.79.237.14 2 u 3 64 1 40.978 9.453 0.000