Skip to content

Instantly share code, notes, and snippets.

@abythell
Last active June 2, 2016 13:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abythell/5249453 to your computer and use it in GitHub Desktop.
Save abythell/5249453 to your computer and use it in GitHub Desktop.
Bash script to automatically install and configure Xen 4.1 on Ubuntu Server 12.04 LTS
#!/bin/bash
# Setup and configure Xen DomU
# Run as root/sudo on a fresh Ubuntu Server 12.04 LTS install. Reboot when complete.
# Update
apt-get update
apt-get upgrade
# Install Xen hypervisor
apt-get install xen-hypervisor-amd64
sed -i 's/GRUB_DEFAULT=.*\+/GRUB_DEFAULT="Xen 4.1-amd64"/' /etc/default/grub
sed -i 's/TOOLSTACK=.*\+/TOOLSTACK="xm"/' /etc/default/xen
# Setup bridge network interface
cat >> /etc/network/interfaces << EOL
#Xen Bridge
auto xenbr0
iface xenbr0 inet dhcp
bridge_ports eth0
EOL
# Limit Dom0 memory to 512M
echo 'GRUB_CMDLINE_XEN_DEFAULT="dom0_mem=512M"' >> /etc/default/grub
update-grub
#Allow VNC connections from anywhere
sed -i "s/#(vnc-listen.*/(vnc-listen \'0.0.0.0\')/" /etc/xen/xend-config.sxp
#Fix keymap issue
ln -s /usr/share/qemu-linaro/ /usr/share/qemu/
@abythell
Copy link
Author

Edit line 24 to set the amount of memory assigned to dom0.

@pythoninthegrass
Copy link

Thanks for the script! Was following another guide and stumbled across yours -- gonna save me a lot of time! ;_;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment