[Assist] script for automating install of basic Parabola GNU/Linux

Seth list at sysfu.com
Sun Jun 28 16:19:40 BST 2015


I created this crude script to bootstrap a very basic Parabola system for  
later configuration with Ansible. Maybe someone else will find it useful.

Preparatory steps on target system:
-----------------------------------
Connect LAN port to network (assumes DHCP available)
Boot system to installer
Start SSHD -

   systemctl start sshd

Assign root account password -

   passwd


Do this from yer workstation:
-----------------------------
Copy an SSH key to target -

   cat .ssh/id_rsa.pub  | ssh root@<hostname-or-ip-address> 'mkdir .ssh;  
cat > .ssh/authorized_keys'

Fire off the script -

   ssh root@<hostname-or-ip-address> 'bash -s' < parabola-install.sh


The script: (save as parabola-install.sh)
-----------
# unmount /mnt just in case you're re-running the script
umount /mnt
# fix all the key signing nonsense
pacman -Sy --noconfirm parabola-keyring archlinux-keyring
pacman-key --populate parabola archlinux
dirmngr </dev/null
pacman-key --refresh-keys
# format the entire disk 'sda' with a partitionless btrfs volume
mkfs.btrfs -f /dev/sda
# mount btrfs volume with lzo compression
mount -o compress=lzo /dev/sda /mnt
# disable copy on write for the log file dir
mkdir -p /mnt/var/log && chattr +C /mnt/var/log
# install the base system
pacstrap /mnt base
# generate an fstab with UUIDs
genfstab -U -p /mnt >> /mnt/etc/fstab
# copy resolv.conf file into the chroot system
cp /etc/resolv.conf /mnt/etc/
# chroot into the newly installed system:
arch-chroot /mnt
# set hostname
echo "change-me.tld" >> /etc/hostname
# set time zone
ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
# setup locale. Uncomment en_US.UTF-8 UTF-8 in /etc/locale.gen and run  
locale-gen
sed -i '/#en_US.UTF-8 /s/^#//' /etc/locale.gen
locale-gen
# Set locale preferences in /etc/locale.conf
locale > /etc/locale.conf
# install some packages
pacman -Sy --noconfirm python2 tmux btrfs-progs openssh grub gptfdisk
# enable SSHD so it's available on restart
systemctl enable sshd
# configure networking  - set the LAN interface for DHCP
cd /etc/netctl;cp examples/ethernet-dhcp landhcp
# edit netctl profile and change device name from eth0 to enp3s0 (check  
dmesg for correct device)
sed -i 's/eth0/enp3s0/' /etc/netctl/landhcp
# enable the profile once it's been edited with the correct device name
netctl enable landhcp
# swap out fsck hook for btrfs and rebuild initrd
sed -i 's/fsck"/btrfs"/' /etc/mkinitcpio.conf
mkinitcpio -p linux-libre
# set root password  'change-me'
echo "root:change-me" | chpasswd
# install grub
grub-install --target=i386-pc --recheck --debug /dev/sda
# create grub menu
grub-mkconfig -o /boot/grub/grub.cfg
# exit chroot, umount /mnt and reboot the system
exit
umount /mnt; reboot


More information about the Assist mailing list