Skip to content

Instantly share code, notes, and snippets.

@steelcowboy
Last active January 31, 2021 01:05
Show Gist options
  • Save steelcowboy/3620482d5d50bab06ef293b9275d0dc6 to your computer and use it in GitHub Desktop.
Save steelcowboy/3620482d5d50bab06ef293b9275d0dc6 to your computer and use it in GitHub Desktop.
A simple kickstart to configure btrfs on CentOS utilizing the Oracle Unbreakable Kernel
# System setup
cmdline
keyboard --vckeymap=us --xlayouts='us'
lang en_US.UTF-8
timezone America/Los_Angeles --utc --ntpservers 0.pool.ntp.org,1.pool.ntp.org,2.pool.ntp.org,3.pool.ntp.org
network --activate
# Disk setup
bootloader --location=mbr
zerombr
clearpart --all --initlabel --disklabel="gpt"
part biosboot --fstype=biosboot --size=1
part /boot --fstype=ext4 --size=512 --asprimary --label="boot"
part btrfs.main --fstype=btrfs --grow --fsoptions="compress=zstd:1,space_cache=v2"
btrfs none --label=centos btrfs.main
btrfs / --subvol --name=root centos
btrfs /home --subvol --name=home centos
btrfs /var/log --subvol --name=var_log centos
btrfs /var/lib/libvirt/images --subvol --name=libvirt_images centos
# User setup
rootpw --iscrypted YOUR_ENCRYPTED_PASSWORD
user --name YOUR_USER --groups wheel --iscrypted --password YOUR_ENCRYPTED_USER_PASSWORD
# Packages
url --mirrorlist=http://mirrorlist.centos.org/?release=8-stream&arch=x86_64&repo=baseos
repo --name=ol8_UEKR8 --baseurl=https://yum.oracle.com/repo/OracleLinux/OL8/UEKR6/x86_64
%packages
@^server-product-environment
kernel-uek
grub2-pc
-kernel
-kernel-core
-kernel-modules
-kernel-modules-extra
-kmod-kvdo
-vdo
%end
%post
# https://unix.stackexchange.com/a/351755 for handling TTY in anaconda
printf "Press Alt-F3 to view post-install logs\r\n" > /dev/tty1
{
echo "Turning off copy-on-write for libvirt images directory"
chattr +C /var/lib/libvirt/images
echo "Configuring UEK Repo"
rpm --import https://yum.oracle.com/RPM-GPG-KEY-oracle-ol8
cat << 'EOF' > /etc/yum.repos.d/uek-ol8.repo
[ol8_UEKR8]
name=Latest Unbreakable Enterprise Kernel Release 6 for Oracle Linux
baseurl=https://yum.oracle.com/repo/OracleLinux/OL8/UEKR6/$basearch
gpgcheck=1
enabled=1
EOF
echo "Fixing branding"
sed -i 's|Oracle Linux Server 8|CentOS Stream release 8|g' /boot/loader/entries/*.conf
} 2>&1 | tee -a /root/postinstall.log > /dev/tty3
%end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment