Skip to content

Instantly share code, notes, and snippets.

@ypchen
Last active August 29, 2015 14:09
Show Gist options
  • Save ypchen/6f60a50070537314ac21 to your computer and use it in GitHub Desktop.
Save ypchen/6f60a50070537314ac21 to your computer and use it in GitHub Desktop.
Create a VM to Install Ubuntu 14.04 LTS 64-bit Server on XenServer/XCP
References:
[1] http://softlit.blogspot.tw/2014/05/xenserver-62-and-ubuntu-1404-lts.html
[2] https://github.com/xenserver/xen-4.3/commit/2196372e76456ce859230950a6e484343e990423
[3] http://ubuntuforums.org/showthread.php?t=2216358&page=2
[4] http://virantha.com/2014/05/21/ubuntu-14-04-trusty-on-xenserver-62/
Steps:
0. [IF NECESSARY] Preparation
* Modify /usr/lib/python2.4/site-packages/grub/GrubConf.py
- Refer to Refs. [1-3]
* Create Ubuntu 14.04 template
- Refer to Ref. [4]
* Make ISO install available (after the three commands given in Ref. [4])
- xe template-param-set other-config:install-methods=cdrom,http,ftp uuid=$NEW_TEMPLATE_UUID
1. New VM
* Two choices (I didn't try the second one):
- Install from ISO Library: ubuntu-14.04.1-server-amd64.iso
- Install from URL: http://ftp.twaren.net/Linux/Ubuntu/ubuntu/
* 2 vCPUs
* 2048 MB RAM
2. Manually or automatically configure the IP
IP: 10.???.???.??? (DHCP: 10.0.0.1 -- 10.0.0.255)
Netmask: 255.0.0.0
Gateway: 10.255.255.254
Name server: 8.8.8.8
3. Make a separate /boot partition
A. Partition method: Manual
B. Virtual disk 1 (xvda) (assume to be 8GB, which is the default value for Ubuntu)
C. Create new empty partition: Yes
D. Create new partition -- /boot
a. 256MB
b. Primary
c. Beginning
d. Use as: Ext3 journaling file system <-- "Ext3" is IMPORTANT
e. Mount point: /boot
f. Reserved blocks: 1%
g: Bootable flag: on
h: Done setting up the partition
E. Create new partition -- /
a. 6GB
b. Primary
c. Beginning
d. Use as: Ext4 journaling file system (default)
e. Mount point: / (default)
f. Reserved blocks: 1%
g: Bootable flag: off (default)
h: Done setting up the partition
F. Create new partition -- swap
a. 2.3GB
b. Primary
c. Use as: swap area
d: Done setting up the partition
G. The result:
Virtual disk 1 (xvda) - 8.6 GB Xen Virtual Block Device
> #1 primary 254.8 MB B f ext3 /boot
> #2 primary 6.0 GB f ext4 /
> #3 primary 2.3 GB f swap swap
fdisk -l /dev/xvda
Device Boot Start End Blocks Id System
/dev/xvda1 * 2048 499711 248832 83 Linux
/dev/xvda2 499712 12218367 5859328 83 Linux
/dev/xvda3 12218368 16775167 2278400 82 Linux swap / Solaris
H. Finish partitioning and write changes to disk
I. Yes
4. No automatic updates
5. Select only "OpenSSH server"
6. Install GRUB boot loader to MBR: Yes.
7. UTC Time: Yes.
8. Boot, login, and become root. Command:
sudo -s
9. [2] Update /etc/fstab. Two ways to do it.
A. Use sed to do the job. Command:
cd /etc
mv fstab fstab.orig
cat fstab.orig | sed -e "s/errors=remount-ro/noatime,nodiratime,errors=remount-ro,nobarrier/" | sed -e "s/defaults/nobarrier/" > fstab
B. Or, manually replace
errors=remount-ro
with:
noatime,nodiratime,errors=remount-ro,nobarrier
and
defaults
with:
nobarrier
to fix the read-only file system issue.
10. Reboot. Command:
sync ; sync ; reboot
11. Boot, login, and become root. Command:
sudo -s
12. Install PV Linux kernel. Command:
apt-update
apt-get install linux-virtual linux-image-virtual linux-headers-virtual
13. Reboot to check if everything is ok. Command:
sync ; sync ; reboot
14. Boot, login, and become root. Command:
sudo -s
15. Select xs-tools.iso from "DVD Drive 1"
16. Mount XenServer Tools. Command:
mount /dev/xvdd /mnt
mount: block device /dev/xvdd is write-protected, mounting read-only
17. Install XenServer Tools. Command:
cd /mnt/Linux
dpkg -i *amd64.deb
cd /
umount /mnt
(It's ok to fail.)
sync ; sync; reboot
18. Eject xs-tools.iso from "DVD Drive 1"
19. Upgrade installed software
apt-get upgrade
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment