Ben Stienstra

Linux, Unix, network, radio and more...

User Tools

Site Tools


PC Engines APU - CentOS 6.5 KickStart

2014-05-22 - updated SSD config

  • I Used a 16GB mSATA SSD, all data on disk will be cleared!
  • Add your own password hash below at PUTYOURHASHHERE. Generate it with:
    grub-crypt --sha-512

PXE config /tftpboot/pxelinux.cfg/default

serial 0 115200
default centos-serial
prompt 0
timeout 0

label centos-serial
  append initrd= ks= ksdevice=eth0 console=ttyS0,115200n8

KickStart file

#### PC Engines APU KickStart installation

# Base repo
url --url=http://repo/centos/6/base/

# Updates repo
repo --name="updates" --baseurl=http://repo/centos/6/updates/

network --onboot yes --device eth0 --bootproto dhcp
lang en_US.UTF-8
keyboard us
rootpw  --iscrypted PUTYOURHASHHERE
firewall --service=ssh
authconfig --enableshadow --passalgo=sha512
selinux --enforcing
timezone --utc Europe/Amsterdam

# Set serial console.
bootloader --location=mbr --driveorder=sda --append="console=ttyS0,115200n8"

# Any disks whose formatting is unrecognized are initialized.

# Erases all partitions from the system.
clearpart --all --drives=sda --initlabel

# Initialize boot partition.
part /boot --fstype=ext4 --fsoptions="defaults,noatime,commit=60" --size=512 --asprimary

# Create LVM pv and vg.
part pv.01 --size=1000 --grow --asprimary
volgroup vg pv.01

# Create lv's, set discard, noatime and commit time. Leave some space left in the VG for later use.
logvol swap  --vgname=vg --size=512  --name=lv_swap --fstype=swap
logvol /     --vgname=vg --size=4096 --name=lv_root --fstype=ext4 --fsoptions="defaults,noatime,commit=60"
logvol /var  --vgname=vg --size=4096 --name=lv_var  --fstype=ext4 --fsoptions="defaults,noatime,commit=60"
logvol /home --vgname=vg --size=512  --name=lv_home --fstype=ext4 --fsoptions="defaults,noatime,commit=60"

# Create non administrative user
user --name=benst --homedir=/home/benst --password= PUTYOURHASHHERE --iscrypted

# Reboot after installation.

# Install minimal, exclude @Base, exclude documentation
%packages --nobase --excludedocs
@Core           #default
bind-utils      #dig, host, nslookup
openssh-clients #ssh client, key agent, sftp, scp
nc              #nc (netcat)
mailx           #mailer

# No ZeroConf
echo "NOZEROCONF=yes" >> /etc/sysconfig/network

#Add weekly fstrim job
cat << EOF >  /etc/cron.weekly/fstrim
#this script will run weekly, will overwrite log.

echo > \$trimlog
for mount in \`lsblk -ro "rota,rm,fstype,mountpoint" | egrep "0 0 ext[2|3|4]" | cut -d " " -f4\`; do
  printf "\`date\` - \`fstrim -v \$mount\`\n" >>\$trimlog
chmod +x /etc/cron.weekly/fstrim

# Enable LVM to issue discards, regenerate initrd (which includes lvm.conf)
/bin/sed -i.bak 's/issue_discards = 0/issue_discards = 1/g' /etc/lvm/lvm.conf
/sbin/dracut -f

# Change scheduler to noop
cat << EOF >  /etc/udev/rules.d/99-schedulers.rules
# set noop scheduler for non-rotating disks
ACTION=="add|change", KERNEL=="sd[a-z]", TEST!="queue/rotational", ATTR{queue/scheduler}="noop"
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="noop"

# Reduce swappiness.
mkdir -p /etc/sysctl.d
cat << EOF > /etc/sysctl.d/swappiness.conf

# Add /tmp as tmpfs.
echo "tmpfs /tmp tmpfs size=64m 0 0" >> /etc/fstab

exit 0
centos_6.5_on_apu_-_kickstart_file.txt · Last modified: 2014/06/10 12:08 by admin