mrc0mmand / centos / kickstarts

Forked from centos/kickstarts 2 years ago
Clone

Blame CentOS-7-GenericCloud.ks

92fd60
# System authorization information
92fd60
auth --enableshadow --passalgo=sha512
92fd60
# Reboot after installation
92fd60
reboot
92fd60
# Use network installation
92fd60
url --url="http://mirrorsnap.centos.org/DATESTAMP/centos/7/os/ARCH/"
92fd60
# Firewall configuration
92fd60
firewall --enabled --service=ssh
92fd60
firstboot --disable
92fd60
ignoredisk --only-use=vda
92fd60
# Keyboard layouts
92fd60
# old format: keyboard us
92fd60
# new format:
92fd60
keyboard --vckeymap=us --xlayouts='us'
92fd60
# System language
92fd60
lang en_US.UTF-8
92fd60
repo --name "os" --baseurl="http://mirrorsnap.centos.org/DATESTAMP/centos/7/os/ARCH/" --cost=100
92fd60
repo --name "updates" --baseurl="http://mirrorsnap.centos.org/DATESTAMP/centos/7/updates/ARCH/" --cost=100
92fd60
repo --name "extras" --baseurl="http://mirrorsnap.centos.org/DATESTAMP/centos/7/extras/ARCH/" --cost=100
92fd60
# Network information
92fd60
network  --bootproto=dhcp
92fd60
network  --hostname=localhost.localdomain
92fd60
# Root password
92fd60
rootpw --iscrypted nothing
92fd60
selinux --enforcing
92fd60
services --disabled="kdump" --enabled="network,sshd,rsyslog,chronyd"
92fd60
timezone UTC --isUtc
92fd60
# Disk
92fd60
bootloader --append="console=tty0" --location=mbr --timeout=1 --boot-drive=vda
92fd60
zerombr
92fd60
reqpart
92fd60
clearpart --all --initlabel 
92fd60
#part /boot/efi --fstype="vfat" --ondisk=vda --size=200
92fd60
part / --fstype="xfs" --ondisk=vda --size=4096 --grow
92fd60
92fd60
%post --erroronfail
92fd60
92fd60
# workaround anaconda requirements
92fd60
passwd -d root
92fd60
passwd -l root
92fd60
92fd60
# Create grub.conf for EC2. This used to be done by appliance creator but
92fd60
# anaconda doesn't do it. And, in case appliance-creator is used, we're
92fd60
# overriding it here so that both cases get the exact same file.
92fd60
# Note that the console line is different -- that's because EC2 provides
92fd60
# different virtual hardware, and this is a convenient way to act differently
92fd60
echo -n "Creating grub.conf for pvgrub"
92fd60
rootuuid=$( awk '$2=="/" { print $1 };'  /etc/fstab )
92fd60
mkdir /boot/grub
92fd60
echo -e 'default=0\ntimeout=0\n\n' > /boot/grub/grub.conf
92fd60
for kv in $( ls -1v /boot/vmlinuz* |grep -v rescue |sed s/.*vmlinuz-//  ); do
92fd60
  echo "title CentOS Linux 7 ($kv)" >> /boot/grub/grub.conf
92fd60
  echo -e "\troot (hd0)" >> /boot/grub/grub.conf
92fd60
  echo -e "\tkernel /boot/vmlinuz-$kv ro root=$rootuuid console=hvc0 LANG=en_US.UTF-8" >> /boot/grub/grub.conf
92fd60
  echo -e "\tinitrd /boot/initramfs-$kv.img" >> /boot/grub/grub.conf
92fd60
  echo
92fd60
done
92fd60
92fd60
#link grub.conf to menu.lst for ec2 to work
92fd60
echo -n "Linking menu.lst to old-style grub.conf for pv-grub"
92fd60
ln -sf grub.conf /boot/grub/menu.lst
92fd60
ln -sf /boot/grub/grub.conf /etc/grub.conf
92fd60
92fd60
# setup systemd to boot to the right runlevel
92fd60
echo -n "Setting default runlevel to multiuser text mode"
92fd60
rm -f /etc/systemd/system/default.target
92fd60
ln -s /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
92fd60
echo .
92fd60
92fd60
# this is installed by default but we don't need it in virt
92fd60
echo "Removing linux-firmware package."
92fd60
yum -C -y remove linux-firmware
92fd60
92fd60
# Remove firewalld; it is required to be present for install/image building.
92fd60
echo "Removing firewalld."
92fd60
yum -C -y remove firewalld --setopt="clean_requirements_on_remove=1"
92fd60
92fd60
# remove avahi and networkmanager
92fd60
echo "Removing avahi/zeroconf and NetworkManager"
92fd60
yum -C -y remove avahi\* Network\*
92fd60
92fd60
echo -n "Getty fixes"
92fd60
# although we want console output going to the serial console, we don't
92fd60
# actually have the opportunity to login there. FIX.
92fd60
# we don't really need to auto-spawn _any_ gettys.
92fd60
sed -i '/^#NAutoVTs=.*/ a\
92fd60
NAutoVTs=0' /etc/systemd/logind.conf
92fd60
92fd60
echo -n "Network fixes"
92fd60
# initscripts don't like this file to be missing.
92fd60
cat > /etc/sysconfig/network << EOF
92fd60
NETWORKING=yes
92fd60
NOZEROCONF=yes
92fd60
EOF
92fd60
92fd60
# For cloud images, 'eth0' _is_ the predictable device name, since
92fd60
# we don't want to be tied to specific virtual (!) hardware
92fd60
rm -f /etc/udev/rules.d/70*
92fd60
ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules
92fd60
92fd60
# simple eth0 config, again not hard-coded to the build hardware
92fd60
cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF
92fd60
DEVICE="eth0"
92fd60
BOOTPROTO="dhcp"
92fd60
ONBOOT="yes"
92fd60
TYPE="Ethernet"
92fd60
USERCTL="yes"
92fd60
PEERDNS="yes"
92fd60
IPV6INIT="no"
92fd60
PERSISTENT_DHCLIENT="1"
92fd60
EOF
92fd60
92fd60
# set virtual-guest as default profile for tuned
92fd60
echo "virtual-guest" > /etc/tuned/active_profile
92fd60
92fd60
# generic localhost names
92fd60
cat > /etc/hosts << EOF
92fd60
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
92fd60
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
92fd60
92fd60
EOF
92fd60
echo .
92fd60
92fd60
# Because memory is scarce resource in most cloud/virt environments,
92fd60
# and because this impedes forensics, we are differing from the Fedora
92fd60
# default of having /tmp on tmpfs.
92fd60
echo "Disabling tmpfs for /tmp."
92fd60
systemctl mask tmp.mount
92fd60
92fd60
cat <<EOL > /etc/sysconfig/kernel
92fd60
# UPDATEDEFAULT specifies if new-kernel-pkg should make
92fd60
# new kernels the default
92fd60
UPDATEDEFAULT=yes
92fd60
92fd60
# DEFAULTKERNEL specifies the default kernel package type
92fd60
DEFAULTKERNEL=kernel
92fd60
EOL
92fd60
92fd60
# make sure firstboot doesn't start
92fd60
echo "RUN_FIRSTBOOT=NO" > /etc/sysconfig/firstboot
92fd60
92fd60
# workaround https://bugzilla.redhat.com/show_bug.cgi?id=966888
92fd60
#if ! grep -q growpart /etc/cloud/cloud.cfg; then
92fd60
#  sed -i 's/ - resizefs/ - growpart\n - resizefs/' /etc/cloud/cloud.cfg
92fd60
#fi
92fd60
92fd60
92fd60
#echo -e 'cloud-user\tALL=(ALL)\tNOPASSWD: ALL' >> /etc/sudoers
92fd60
92fd60
echo "Cleaning old yum repodata."
92fd60
yum clean all
92fd60
92fd60
echo "set instance type markers"
92fd60
echo 'genclo' > /etc/yum/vars/infra
92fd60
92fd60
# chance dhcp client retry/timeouts to resolve #6866
92fd60
cat  >> /etc/dhcp/dhclient.conf << EOF
92fd60
92fd60
timeout 300;
92fd60
retry 60;
92fd60
EOF
92fd60
92fd60
# clean up installation logs"
92fd60
rm -rf /var/log/yum.log
92fd60
rm -rf /var/lib/yum/*
92fd60
rm -rf /root/install.log
92fd60
rm -rf /root/install.log.syslog
92fd60
rm -rf /root/anaconda-ks.cfg
92fd60
rm -rf /var/log/anaconda*
92fd60
rm -rf /root/anac*
92fd60
92fd60
echo "Fixing SELinux contexts."
92fd60
touch /var/log/cron
92fd60
touch /var/log/boot.log
92fd60
mkdir -p /var/cache/yum
92fd60
/usr/sbin/fixfiles -R -a restore
92fd60
92fd60
# reorder console entries
92fd60
sed -i 's/console=tty0/console=tty0 console=ttyS0,115200n8/' /boot/grub2/grub.cfg
92fd60
92fd60
#echo "Zeroing out empty space."
92fd60
# This forces the filesystem to reclaim space from deleted files
92fd60
dd bs=1M if=/dev/zero of=/var/tmp/zeros || :
92fd60
rm -f /var/tmp/zeros
92fd60
echo "(Don't worry -- that out-of-space error was expected.)"
92fd60
92fd60
%end
92fd60
92fd60
%packages
92fd60
@core
92fd60
chrony
92fd60
cloud-init
92fd60
cloud-utils-growpart
92fd60
dracut-config-generic
92fd60
dracut-norescue
92fd60
firewalld
92fd60
grub2
fab7e0
gdisk
92fd60
kernel
92fd60
nfs-utils
92fd60
rsync
92fd60
tar
92fd60
yum-utils
92fd60
-NetworkManager
92fd60
-aic94xx-firmware
92fd60
-alsa-firmware
92fd60
-alsa-lib
92fd60
-alsa-tools-firmware
92fd60
-biosdevname
92fd60
-iprutils
92fd60
-ivtv-firmware
92fd60
-iwl100-firmware
92fd60
-iwl1000-firmware
92fd60
-iwl105-firmware
92fd60
-iwl135-firmware
92fd60
-iwl2000-firmware
92fd60
-iwl2030-firmware
92fd60
-iwl3160-firmware
92fd60
-iwl3945-firmware
92fd60
-iwl4965-firmware
92fd60
-iwl5000-firmware
92fd60
-iwl5150-firmware
92fd60
-iwl6000-firmware
92fd60
-iwl6000g2a-firmware
92fd60
-iwl6000g2b-firmware
92fd60
-iwl6050-firmware
92fd60
-iwl7260-firmware
92fd60
-libertas-sd8686-firmware
92fd60
-libertas-sd8787-firmware
92fd60
-libertas-usb8388-firmware
92fd60
-plymouth
92fd60
92fd60
%end
92fd60