-
-
Save ypchen/3187714 to your computer and use it in GitHub Desktop.
References: | |
[1] http://www.virtualzone.de/2012-05-01/ubuntu-12-04-on-citrix-xenserver-5-6/ | |
[2] http://thetechshop.org/showthread.php?847-Citrix-Xenserver-Template-for-Ubuntu-12.04-and-the-weird-Rebooting-to-Read-Only-Mode | |
Steps: | |
1. New VM | |
* Two choices: | |
- Install from ISO Library: ubuntu-12.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-get install linux-virtual linux-image-virtual linux-headers-virtual | |
13. Remove Generic Linux kernel. Command: | |
apt-get remove linux-generic linux-headers-generic linux-image-generic | |
apt-get autoremove | |
cd /boot | |
rm *-generic | |
cd / | |
14. Update the grub boot loader. Command: | |
update-grub | |
15. Reboot to check if everything is ok. Command: | |
sync ; sync ; reboot | |
16. Boot, login, and become root. Command: | |
sudo -s | |
17. Select xs-tools.iso from "DVD Drive 1" | |
18. Mount XenServer Tools. Command: | |
mount /dev/xvdd /mnt | |
mount: block device /dev/xvdd is write-protected, mounting read-only | |
19. Install XenServer Tools. Command: | |
cd /mnt/Linux | |
dpkg -i *amd64.deb | |
cd / | |
umount /mnt | |
(It's ok to fail.) | |
sync ; sync; reboot | |
20. Eject xs-tools.iso from "DVD Drive 1" |
You can use a kickstart file:
ks=http://SERVER_ADDRESS/kickstart -- quiet console=hvc0
lang en_US
langsupport en_US
keyboard pt
mouse
timezone Europe/Lisbon
Use text mode install
text
Install OS instead of update
install
Do not configure the X Window System
skipx
halt after instalation
halt
Install using URL
url --url http://eu.archive.ubuntu.com/ubuntu
If install using CDRoom
CD-ROM
nfs --server=server.com --dir=/path/to/ubuntu/
root password is disabled, user will be sudoer
rootpw --disabled
Initial user
user stack --fullname "stack" --iscrypted --password $1$QqG5Xd2R$gtj9VIrWtjgitrfCZl33z1 # replace (use auth --iscrypted if password already MD5-hashed)
System authorization infomation
auth --useshadow --enablemd5
System bootloader configuration
bootloader --location=mbr
zerombr yes
Clear the Master Boot Record
clearpart --all --initlabel
partitions
part /boot --fstype=ext2 --size=64
part swap --size=1024
part / --fstype=ext4 --size=1 --grow
Network with DHCP
network --bootproto=dhcp --device=eth0
If network static:
network --device=eth0 --bootproto=static --ip=10.0.0.50 --netmask=255.255.255.0 \ --nameserver=10.0.0.1 --gateway=10.0.0.1
Firewall configuration
firewall --disabled --trust=eth0 --ssh
%packages
ubuntu-minimal
openssh-server
screen
curl
wget
xe-guest-utilities
%post
Set hostname (Change also on hosts (next area))
echo openstack > /etc/hostname
cat > /etc/hosts <<'endmsg'
127.0.0.1 localhost
127.0.1.1 openstack
The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
endmsg
update fstab for the root partition: sometimes the filesystem is read-only
perl -pi -e 's/(errors=remount-ro)/noatime,nodiratime,$1,barrier=0/' /etc/fstab
I tried several methods before to do this and none worked.
This one works flawlessly!
Thanks for a great work!