{{tag>[hardware apu centos]}}
=====PC Engines APU - install CentOS 7=====
This pages describes the installation of CentOS 7 on PC Engines APU hardware.
====Preparation====
===Console===
* Connect a serial console, or USB<->Serial adapter. Make sure your locale is set to UTF-8. $ locale
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
* If locale is not set right, add the following lines to your ~/.profile and login again.export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
* Connect to serial console:screen /dev/tty.usbserial-A7022O5B 115200
===PXE===
* Edit /tftpboot/pxelinux.cfg/default: serial 0 115200
default centos7
prompt 0
timeout 0
label centos7
kernel http://yourrepo.host/centos/7/CentOS7-base/images/pxeboot/vmlinuz
append initrd=http://yourrepo.host/centos/7/CentOS7-base/images/pxeboot/initrd.img ks.device=bootif ip=dhcp ks=http://yourpxe.host/apu-centos7.ks console=ttyS0,115200
===Kickstart===
* Edit kickstart file apu-centos7.ks:####
#### PC Engines APU KickStart installation
####
install
# Base repo
url --url=http://repo/centos/7/CentOS7-base
# Configure updates repo
repo --name="CentOS7-updates" --baseurl=http://repo/centos/7/CentOS7-updates
network --onboot yes --bootproto dhcp
lang en_US.UTF-8
keyboard --vckeymap=us --xlayouts='us','us'
rootpw --iscrypted
firewall --service=ssh
authconfig --enableshadow --passalgo=sha512
selinux --enforcing
timezone --utc Europe/Amsterdam
# Set serial console and change disk elevator to noop for SSD.
bootloader --location=mbr --driveorder=sda --append="console=tty0 console=ttyS0,115200 elevator=noop rd_NO_PLYMOUTH"
# Any disks whose formatting is unrecognized are initialized.
zerombr
# Erases all partitions from the system.
clearpart --all --drives=sda --initlabel
# Initialize boot partition.
part /boot --fstype=xfs --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=xfs
logvol /var --vgname=vg --size=4096 --name=lv_var --fstype=xfs
logvol /home --vgname=vg --size=512 --name=lv_home --fstype=xfs
# Create non administrative user
user --name=username --homedir=/home/username --password=
# Reboot after installation.
reboot
# 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)
%end
%post
# Disable SSH root login
/bin/sed -i.bak 's/#PermitRootLogin yes/PermitRootLogin no/g' /etc/ssh/sshd_config
# Mount /tmp as tmpfs.
systemctl enable tmp.mount
#Add weekly fstrim job
cat << EOF > /etc/cron.weekly/fstrim
#!/bin/sh
#this script will run weekly, will overwrite log.
trimlog=/var/log/fstrim.log
echo > \$trimlog
for fs in \$(lsblk -o MOUNTPOINT,DISC-MAX,FSTYPE | grep -E '^/.* [1-9]+.* ' | awk '{print \$1}'); do
printf "\`date\` - \`fstrim -v \$fs\`\n" >>\$trimlog
done
EOF
chmod +x /etc/cron.weekly/fstrim
# Enable LVM to issue discards.
/bin/sed -i.bak 's/issue_discards = 0/issue_discards = 1/g' /etc/lvm/lvm.conf
# Reduce swappiness.
echo "vm.swappiness=1" >> /etc/sysctl.d/swappiness.conf
echo "vm.vfs_cache_pressure=50" >> /etc/sysctl.d/swappiness.conf
# Set chassis name and icon
/bin/hostnamectl set-chassis "server"
exit 0
%end
====Installation====
* Boot the APU and press F12, select "iPXE" to boot from network.