Skip to content

Instantly share code, notes, and snippets.

@rposborne
Forked from ludo/kickstart
Last active August 29, 2015 14:00
Show Gist options
  • Save rposborne/11165272 to your computer and use it in GitHub Desktop.
Save rposborne/11165272 to your computer and use it in GitHub Desktop.
Kickstart
Don't use pull from the raw gist... It can't be https.
#url --url http://us.archive.ubuntu.com/ubuntu
CD-ROM
text
lang en_US
langsupport en_US
keyboard us
timezone Etc/UTC
install
#rootpw pa$$word # you should replace, and use --iscrypted
auth --useshadow --enablemd5
user --disabled
bootloader --location=mbr
zerombr yes
clearpart --all --initlabel
part /boot --fstype=ext2 --size=64
part swap --size=1024
part / --fstype=ext4 --size=1 --grow
network --onboot yes --device eth0 --bootproto dhcp --noipv6
#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 --disabled
# Skip Xserver setup
skipx
# Authentication
authconfig --enableshadow --passalgo=sha512
# SELinux
selinux --disabled
%packages
ubuntu-minimal
openssh-server
curl
wget
xe-guest-utilities
%post
# update fstab for the root partition
perl -pi -e 's/(errors=remount-ro)/noatime,nodiratime,$1,barrier=0/' /etc/fstab
# point sh to bash instead of dash
rm /bin/sh
ln -s /bin/bash /bin/sh
# add normal apt source list
(
cat <<'EOP'
deb http://us.archive.ubuntu.com/ubuntu/ trusty main restricted universe
deb http://us.archive.ubuntu.com/ubuntu/ trusty-security main restricted universe
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe
EOP
) > /etc/apt/sources.list
apt-get update
apt-get upgrade -y
# install some additional packages
apt-get install -y xenstore-utils
# set up xenserver automation scripts
AUTOMATER_REPO=https://raw.github.com/krobertson/xenserver-automater
curl $AUTOMATER_REPO/master/usr/sbin/xe-set-hostname > /usr/sbin/xe-set-hostname
curl $AUTOMATER_REPO/master/usr/sbin/xe-set-network > /usr/sbin/xe-set-network
curl $AUTOMATER_REPO/master/usr/sbin/generate-sshd-keys > /usr/sbin/generate-sshd-keys
curl $AUTOMATER_REPO/master/etc/init/xe-automator.conf > /etc/init/xe-automator.conf
chmod a+x /usr/sbin/xe-set-hostname
chmod a+x /usr/sbin/xe-set-network
chmod a+x /usr/sbin/generate-sshd-keys
# setup locales
locale-gen en_US.UTF-8
update-locale LANG="en_US.UTF-8"
echo 'LANG=en_US.UTF-8' >> /etc/environment
echo 'LC_ALL=en_US.UTF-8' >> /etc/environment
# install xe tools
# cd /tmp
# wget http://some/url/to/xe-guest-utilities_6.0.0-743_amd64.deb
# dpkg -i xe-guest-utilities_6.0.0-743_amd64.deb
# install paravirt kernel image
#apt-get install -f -y linux-virtual
#dpkg -l | grep generic | grep linux | awk '{print $2}' | xargs apt-get remove -y
# clean up some stuff
rm -f /etc/ssh/ssh_host_*
rm -f /var/cache/apt/archives/*.deb
rm -f /var/cache/apt/*cache.bin
rm -f /var/lib/apt/lists/*_Packages
%end
firstboot --disabled
shutdown
%post
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment