diff --git a/CentOS-8-Docker.ks b/CentOS-8-Docker.ks new file mode 100644 index 0000000..75671a4 --- /dev/null +++ b/CentOS-8-Docker.ks @@ -0,0 +1,92 @@ +# This is a minimal CentOS kickstart designed for docker. +# It will not produce a bootable system +# To use this kickstart, run the following command +# livemedia-creator --make-tar \ +# --iso=/path/to/boot.iso \ +# --ks=centos-8.ks \ +# --image-name=centos-root.tar.xz +# + +# Basic setup information +install +keyboard us +rootpw --lock --iscrypted locked +timezone --isUtc --nontp UTC +selinux --enforcing +firewall --disabled +network --bootproto=dhcp --device=link --activate --onboot=on +shutdown +bootloader --disable +lang en_US + + +# Disk setup +zerombr +clearpart --all --initlabel +autopart --noboot --nohome --noswap --nolvm --fstype=ext4 + +# Package setup +%packages --excludedocs --instLangs=en --nocore +centos-release +binutils +-brotli +bash +hostname +rootfiles +coreutils-single +glibc-minimal-langpack +vim-minimal +less +-gettext* +-firewalld +-os-prober* +tar +-iptables +iputils +-kernel +-dosfstools +-e2fsprogs +-fuse-libs +-gnupg2-smime +-libss +-pinentry +-shared-mime-info +-trousers +-xkeyboard-config +-xfsprogs +-qemu-guest-agent +yum +-grub\* + +%end + +%post --erroronfail --log=/root/anaconda-post.log +# container customizations inside the chroot + +echo 'container' > /etc/dnf/vars/infra + +#Generate installtime file record +/bin/date +%Y%m%d_%H%M > /etc/BUILDTIME + +# Limit languages to help reduce size. +LANG="en_US" +echo "%_install_langs $LANG" > /etc/rpm/macros.image-language-conf + + +# systemd fixes +:> /etc/machine-id +umount /run +systemd-tmpfiles --create --boot +# mask mounts and login bits +systemctl mask systemd-logind.service getty.target console-getty.service sys-fs-fuse-connections.mount systemd-remount-fs.service dev-hugepages.mount + +# Remove things we don't need +rm -f /etc/udev/hwdb.bin +rm -rf /usr/lib/udev/hwdb.d/ +rm -rf /boot +rm -rf /var/lib/dnf/history.* + + +%end + + diff --git a/CentOS-8-GenericCloud.ks b/CentOS-8-GenericCloud.ks new file mode 100644 index 0000000..6c98aea --- /dev/null +++ b/CentOS-8-GenericCloud.ks @@ -0,0 +1,197 @@ +auth --enableshadow --passalgo=sha512 +reboot +url --url="mirror.centos.org/centos/7/os/x86_64" +firewall --enabled --service=ssh +firstboot --disable +ignoredisk --only-use=vda +keyboard us +# System language +lang en_US.UTF-8 +# Network information +network --bootproto=dhcp --device=link --activate --onboot=on +network --hostname=localhost.localdomain +# Root password +rootpw --iscrypted thereisnopasswordanditslocked +selinux --enforcing +services --disabled="kdump" --enabled="NetworkManager,sshd,rsyslog,chronyd,cloud-init,cloud-config,cloud-final,rngd" +timezone UTC --isUtc +# Disk +bootloader --append="console=tty0,115200n8 no_timer_check crashkernel=auto net.ifnames=0" --location=mbr --timeout=1 --boot-drive=vda +zerombr +clearpart --all --initlabel +reqpart +part / --fstype="xfs" --ondisk=vda --size=8000 + +%post --erroronfail +passwd -d root +passwd -l root + +# pvgrub support +echo -n "Creating grub.conf for pvgrub" +rootuuid=$( awk '$2=="/" { print $1 };' /etc/fstab ) +mkdir /boot/grub +echo -e 'default=0\ntimeout=0\n\n' > /boot/grub/grub.conf +for kv in $( ls -1v /boot/vmlinuz* |grep -v rescue |sed s/.*vmlinuz-// ); do + echo "title CentOS Linux 7 ($kv)" >> /boot/grub/grub.conf + echo -e "\troot (hd0)" >> /boot/grub/grub.conf + echo -e "\tkernel /boot/vmlinuz-$kv ro root=$rootuuid console=hvc0 LANG=en_US.UTF-8" >> /boot/grub/grub.conf + echo -e "\tinitrd /boot/initramfs-$kv.img" >> /boot/grub/grub.conf + echo +done +ln -sf grub.conf /boot/grub/menu.lst +ln -sf /boot/grub/grub.conf /etc/grub.conf + +# setup systemd to boot to the right runlevel +rm -f /etc/systemd/system/default.target +ln -s /lib/systemd/system/multi-user.target /etc/systemd/system/default.target +echo . + +yum -C -y remove linux-firmware + +# Remove firewalld; it is required to be present for install/image building. +# but we dont ship it in cloud +yum -C -y remove firewalld --setopt="clean_requirements_on_remove=1" +yum -C -y remove avahi\* Network\* +sed -i '/^#NAutoVTs=.*/ a\ +NAutoVTs=0' /etc/systemd/logind.conf + +cat > /etc/sysconfig/network << EOF +NETWORKING=yes +NOZEROCONF=yes +EOF + +# For cloud images, 'eth0' _is_ the predictable device name, since +# we don't want to be tied to specific virtual (!) hardware +rm -f /etc/udev/rules.d/70* +ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules + +# simple eth0 config, again not hard-coded to the build hardware +cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF +DEVICE="eth0" +BOOTPROTO="dhcp" +ONBOOT="yes" +TYPE="Ethernet" +USERCTL="yes" +PEERDNS="yes" +IPV6INIT="no" +PERSISTENT_DHCLIENT="1" +EOF + +echo "virtual-guest" > /etc/tuned/active_profile + +# generic localhost names +cat > /etc/hosts << EOF +127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 +::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 + +EOF +echo . + +systemctl mask tmp.mount + +cat < /etc/sysconfig/kernel +# UPDATEDEFAULT specifies if new-kernel-pkg should make +# new kernels the default +UPDATEDEFAULT=yes + +# DEFAULTKERNEL specifies the default kernel package type +DEFAULTKERNEL=kernel +EOL + +# make sure firstboot doesn't start +echo "RUN_FIRSTBOOT=NO" > /etc/sysconfig/firstboot + +echo -e 'cloud-user\tALL=(ALL)\tNOPASSWD: ALL' >> /etc/sudoers + +dnf clean all + +# XXX instance type markers - MUST match CentOS Infra expectation +echo 'genclo' > /etc/yum/vars/infra + +# chance dhcp client retry/timeouts to resolve #6866 +cat >> /etc/dhcp/dhclient.conf << EOF + +timeout 300; +retry 60; +EOF + + +rm -rf /var/log/yum.log +rm -rf /var/lib/yum/* +rm -rf /root/install.log +rm -rf /root/install.log.syslog +rm -rf /root/anaconda-ks.cfg +rm -rf /var/log/anaconda* + +rm -f /var/lib/systemd/random-seed + +cat /dev/null > /etc/machine-id + +echo "Fixing SELinux contexts." +touch /var/log/cron +touch /var/log/boot.log +mkdir -p /var/cache/yum +/usr/sbin/fixfiles -R -a restore + +# reorder console entries +sed -i 's/console=tty0/console=tty0 console=ttyS0,115200n8/' /boot/grub2/grub.cfg + +%end + +%packages +@core +chrony +dnf +yum +cloud-init +cloud-utils-growpart +dracut-config-generic +dracut-norescue +firewalld +grub2 +kernel +nfs-utils +rsync +tar +dnf-utils +-aic94xx-firmware +-alsa-firmware +-alsa-lib +-alsa-tools-firmware +-ivtv-firmware +-iwl100-firmware +-iwl1000-firmware +-iwl105-firmware +-iwl135-firmware +-iwl2000-firmware +-iwl2030-firmware +-iwl3160-firmware +-iwl3945-firmware +-iwl4965-firmware +-iwl5000-firmware +-iwl5150-firmware +-iwl6000-firmware +-iwl6000g2a-firmware +-iwl6000g2b-firmware +-iwl6050-firmware +-iwl7260-firmware +-libertas-sd8686-firmware +-libertas-sd8787-firmware +-libertas-usb8388-firmware +-biosdevname +-iprutils +-plymouth + +python3-jsonschema +qemu-guest-agent +firewalld +dhcp-client +cockpit-ws +cockpit-system +-langpacks-* +-langpacks-en + +centos-release +rng-tools +%end +