Friday, 2 October 2020

KVM Post Install

Below is kickstart file, I have been working on for some time, to help me with some redhat study. It's pretty standard, but it does do some things I am pleased about, such as

  • update the server
  • enable console access, so I can console to the server (as well as ssh to it)
  • install a nice basic set of packages that are useful (base, "Directory Client", and some others)
  • remove some stuff I don't like
  • put my /etc into version control
  • TODO: ssh keys, and a repo 

 [dpl@host02 run6]$ cat advanced_gui-ks.cfg
#sudo virt-install --name test --memory 3072 --disk /var/lib/libvirt/images/test.labs.io.qcow2,size=20 --disk /var/lib/libvirt/images/testd2.labs.io.qcow2,size=3 --disk /var/lib/libvirt/images/testd3.labs.io.qcow2,size=3 --location ftp://192.168.122.1/pub/inst/centos7 --extra-args "ks=ftp://192.168.122.1/pub/inst/centos7/advanced-ks.cfg"

#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
# Use graphical install
graphical
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=sda
# Keyboard layouts
keyboard --vckeymap=gb --xlayouts='gb'
# System language
lang en_GB.UTF-8

# Network information
network  --bootproto=static --device=eth0 --gateway=GATEWAY --ip=ADDRESS --nameserver=8.8.8.8 --netmask=255.255.255.0 --ipv6=auto --activate
network  --hostname=HOSTNAME

# Use network installation
url --url="ftp://192.168.122.1/pub/inst/centos7"
# Root password
rootpw --iscrypted $6$7VMoGhXZlGlXEkGL$HMdSD4p0BGkC7E7VdGsOoM.by2MURrbwfhLulAFhHY8kSr/GLOIbBvOp9zTp.bv4eYlvdTceNXkCZOdpNObYt0
# System services
services --enabled="chronyd"
# System timezone
timezone Europe/London --isUtc
user --groups=wheel --name=dpl --password=$6$kdpWmfTi.fxYOg9m$dzHXgv8l3qxVx4oybWcHYsI4QbYNIcO4NzgR4Fk1THY5FDM.3p/GTx6N9cbjIDJc/bKiFfs7LjDi3D.FPmOG9/ --iscrypted --gecos="dpl"
# X Window System configuration information
xconfig  --startxonboot
# System bootloader configuration
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda
autopart --type=lvm
# Partition clearing information
clearpart --none --initlabel

%post
#TODO - ssh keys, and a repo file
#TODO - make a repo server

yum -y update
systemctl enable serial-getty@ttyS0.service
systemctl start serial-getty@ttyS0.service
yum -y install epel-release
yum -y install vim tmux terminator htop mutt elinks lftp telnet git levien-inconsolata-fonts
cd /etc
git init
git add .
git commit -m "fresh build"
yum -y remove evince gnome-boxes gnome-dictionary gnome-text-editor gnome-weather gnome-terminal gedit orca cheese gnome-clocks gnome-contacts empathy
yum -y group install "Base"
yum -y group install "Directory Client"
cd /etc
git init
git add .
git commit -m "base and directory client installed"
wget ftp://192.168.122.1:/pub/inst/centos7/.tmux.conf -P /root/
wget ftp://192.168.122.1:/pub/inst/centos7/.tmux.conf -P /home/dpl/
wget ftp://192.168.122.1:/pub/inst/centos7/.vimrc -P /root/
wget ftp://192.168.122.1:/pub/inst/centos7/.vimrc -P /home/dpl/
wget ftp://192.168.122.1:/pub/inst/centos7/.bashrc -P /root
wget ftp://192.168.122.1:/pub/inst/centos7/.bashrc -P /home/dpl
wget ftp://192.168.122.1:/pub/inst/centos7/.gitconfig -P /root
wget ftp://192.168.122.1:/pub/inst/centos7/.gitconfig /home/dpl
%end
%packages
@^graphical-server-environment
@base
@core
@desktop-debugging
@dial-up
@fonts
@gnome-desktop
@guest-agents
@guest-desktop-agents
@hardware-monitoring
@input-methods
@internet-browser
@multimedia
@print-client
@x11
chrony
kexec-tools

%end

%addon com_redhat_kdump --enable --reserve-mb='auto'

%end

%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end