Steve Borba

My notes, I hope they help you, feel free to comment/add to them

Arch Install

So I decided I was going to finally try Arch. I was told many times it was too hard and I shouldn’t attempt it unless I was willing to invest a lot of time… It’s not that hard, especially for me because I had done a more difficult version when I setup an Ubuntu server to boot from ZFS root (this time I didn’t also setup 7 10 disk vdevs (p.s. default grub doesn’t like that many disks)

Now, in Steve fashion, I didn’t just decide to install Arch, I also wanted to make sure it only has the what I use/want on my generic install and running as thin and new of stuff as I can, so I decided to use systemd for as much as I could; this included systemd-boot instead of grub (I also started out trying to do secure-boot, but I haven’t got that working yet).

First we need to boot to an existing Arch system (found a live CD), setup the partitions and load the basic system:

cfdisk /dev/sda
- gpt
- new, 512M, type EFI System
- freespace, new
- write, yes, quit

mkfs.ext4 -L "root" /dev/sda2
mkfs.fat -F 32 -n EFI /dev/sda1

mount /dev/sda2 /mnt
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot
pacstrap /mnt base linux linux-firmware

genfstab -U /mnt > /mnt/etc/fstab

arch-chroot /mnt

bootctl --path=/boot install

echo "title Arch Linux
linux /vmlinuz-linux
initrd /initramfs-linux.img
options root=LABEL=root rw" > /boot/loader/entries/arch.conf

You could just reboot and have a functioning Arch Linux, but lets customize it a bit first, edit the variables to your needs

PCNAME="arch-1"
DOMAIN="lab.steveborba.com"
LANG="en_US.UTF-8"
TZ="US/Pacific"
USER='steve'

if [ "$DOMAIN" = "" ]; then
  echo "127.0.0.1       $PCNAME  localhost" >> /etc/hosts
  echo "::1             $PCNAME  localhost" >> /etc/hosts
  echo "$PCNAME" > /etc/hostname
 else
  echo "127.0.0.1       $PCNAME  $PCNAME.$DOMAIN  localhost" >> /etc/hosts
  echo "::1             $PCNAME  $PCNAME.$DOMAIN  localhost" >> /etc/hosts
  echo "$PCNAME.$DOMAIN" > /etc/hostname
fi

ln -sf /usr/share/zoneinfo/$TZ /etc/localtime
echo "LANG=$LANG" > /etc/locale.conf
sed "s/#$LANG/$LANG/" -i /etc/locale.gen
locale-gen

pacman -S openssh sudo haveged open-vm-tools screen vim

systemctl enable systemd-networkd
systemctl enable systemd-resolved
systemctl enable iptables
systemctl enable sshd
systemctl enable haveged
systemctl enable vmtoolsd

systemctl disable lvm2-lvmetad
systemctl mask lvm2-lvmetad

echo "[Match]
Name=e*

[Network]
DHCP=ipv4
LLMNR=false
LinkLocalAddressing=no" > /etc/systemd/network/990-default-ethernet.network

echo "#Disable IPv6
net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.d/40-ipv6.conf

echo "*filter
:INPUT ACCEPT [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
-A INPUT ! -i lo -j DROP
COMMIT" > /etc/iptables/iptables.rules

echo "set mouse-=a" | tee /root/.vimrc >> /etc/skel/.vimrc
echo "
PROMPT_COMMAND='history -a'

alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'

alias ll='ls -al'
alias vi=vim alias ifconfig='ip address show' alias netstat='ss'" | tee /root/.bashrc >> /etc/skel/.bashrc sed "s/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/" -i /etc/sudoers if [ "$USER" == "" ]; then echo "Set Password for root" passwd else echo "Set Password for $USER" useradd -G wheel -s /bin/bash -m -c "$USER" $USER passwd $USER passwd -l root fi

It is the same install, just without a wizard. Not too hard.

Notes:
haveged is installed because ssh took a long time to start without it
I like vim, but I vim basic/tiny has weird issues with direction arrows and numpad with putty, but it vim has problems with mouse… I included my workarounds to get it working
I also included a few aliases that I need because I try to use old ways

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>