Skip to content

Instantly share code, notes, and snippets.

@lorello
Last active August 29, 2015 14:01
Show Gist options
  • Select an option

  • Save lorello/e8ca93e27ac7e831261b to your computer and use it in GitHub Desktop.

Select an option

Save lorello/e8ca93e27ac7e831261b to your computer and use it in GitHub Desktop.
Customizing for my need: localized setup for Italian site (locales, timezone, ubuntu mirror...)
# Ubuntu Kickstart file for Ubuntu 12.04 on XenServer
#
# Source: http://invalidlogic.com/2012/05/01/deploying-ubuntu-12-04-on-xenserver-made-easy/
#
# Usage:
# simply add
# ks=http://url/to/your/kickstart
# to the beginning part of “advanced OS boot parameters” option when selecting the installation media.
#
lang it_IT
langsupport it_IT
keyboard it
timezone Europe/Rome
text
install
skipx
halt
url --url http://it.archive.ubuntu.com/ubuntu
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
# Default is DHCP, uncomment and customized next lines to use static config
#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
%packages
ubuntu-minimal
openssh-server
screen
curl
wget
puppet-common
python-software-properties
%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://it.archive.ubuntu.com/ubuntu/ precise main restricted universe
deb http://it.archive.ubuntu.com/ubuntu/ precise-security main restricted universe
deb http://it.archive.ubuntu.com/ubuntu/ precise-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 it_IT.UTF-8
update-locale LANG="it_IT.UTF-8"
echo 'LANG=it_IT.UTF-8' >> /etc/environment
echo 'LC_ALL=it_IT.UTF-8' >> /etc/environment
# install xe tools from PPA
add-apt-repository -y ppa:retrosnub/xenserver-support
apt-get update
apt-get install -y xe-guest-utilities
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment