Skip to content

Instantly share code, notes, and snippets.

@atejeda
Created November 30, 2020 03:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atejeda/e3e30fe39885c9c8b00d827cc74cbca8 to your computer and use it in GitHub Desktop.
Save atejeda/e3e30fe39885c9c8b00d827cc74cbca8 to your computer and use it in GitHub Desktop.
# with the image
# install an openssh server to perform all these commands from a terminal
# networking is required
pacman -S openssh
systemctl start sshd
passwd
# <password>
# <password>
/sbin/ifconfig
ip a
timedatectl set-ntp true
reflector -c Chile -a 6 --sort rate --save /etc/pacman.d/mirrorlist
pacman -Syy
# disk layout
lsblk
export ARCH_DEVICE=/dev/sda
export ARCH_PVNAME=lvm_pv0
export ARCH_VGNAME=lvm_vg0
export ARCH_LVNAME=lvm_arch
export ARCH_HOSTNAME=hostname
export ARCH_USER=user
sgdisk --zap-all $ARCH_DEVICE
sgdisk -n 1:0:+256M -t 1:ef00 $ARCH_DEVICE
sgdisk -i 1 $ARCH_DEVICE
sgdisk -n 2:0:0 -t 2:8e00 $ARCH_DEVICE
sgdisk -i 2 $ARCH_DEVICE
lsblk
# crypt setup
cryptsetup luksFormat ${ARCH_DEVICE}2
# YES
# <passphrase>
# <passphrase>
cryptsetup open ${ARCH_DEVICE}2 $ARCH_PVNAME
pvcreate /dev/mapper/$ARCH_PVNAME
vgcreate $ARCH_VGNAME /dev/mapper/$ARCH_PVNAME
lvcreate -l 100%FREE $ARCH_VGNAME -n $ARCH_LVNAME
lsblk
# format partitions
mkfs.fat -F32 ${ARCH_DEVICE}1
mkfs.ext4 /dev/$ARCH_VGNAME/$ARCH_LVNAME
lsblk
# mount and setup
mount /dev/$ARCH_VGNAME/$ARCH_LVNAME /mnt
mkdir -p /mnt/boot
mount ${ARCH_DEVICE}1 /mnt/boot
pacstrap /mnt base base-devel linux linux-firmware lvm2
genfstab -U /mnt >> /mnt/etc/fstab
# chroot
arch-chroot /mnt
timedatectl list-timezones | grep Santiago
ln -sf /usr/share/zoneinfo/America/Santiago /etc/localtime
hwclock --systohc
pacman -S linux linux-lts linux-headers linux-lts-headers
pacman -S vim emacs base-devel openssh
pacman -S networkmanager wpa_supplicant wireless_tools netctl
pacman -S dialog lvm grub
pacman -S efibootmgr dosfstools os-prober mtools
pacman -S emacs git
pacman -S reflector cups xdg-utils xdg-user-dirs
# mkinitcpio
vim /etc/mkinitcpio.conf
HOOKS=(base udev autodetect modconf block encrypt lvm2 filesystems keyboard fsck)
mkinitcpio -p linux
mkinitcpio -p linux-lts
# locale
# uncomment en_US.UTF-8 UTF-8
vim /etc/locale.gen
echo LANG=en_US.UTF-8 >> /etc/locale.conf
# host
echo "$ARCH_HOSTNAME" > /etc/hostname
cat <<EOF > /etc/hosts
127.0.0.1 localhost
::1 localhost
127.0.0.1 $ARCH_HOSTNAME.localdomain $ARCH_HOSTNAME
EOF
# users
passwd
# <password>
# <password>
useradd -m -g users -G wheel $ARCH_USER
passwd $ARCH_USER
# <password>
# <password>
# sudo
EDITOR=vim visudo
# uncomment %wheel ALL=(ALL) ALL
# enable services
systemctl enable sshd
systemctl enable NetworkManager
# boot loader
# uncomment GRUB_ENABLE_CRYPTODISK=y
# edit GRUB_CMDLINE_LINUX_DEFAULT with the output of
# echo "loglevel=3 cryptdevice=${ARCH_DEVICE}2:$ARCH_VGNAME:allow-discards quiet"
vim /etc/default/grub
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=grub_uefi --recheck
#mkdir /boot/grub/locale
cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo
grub-mkconfig -o /boot/grub/grub.cfg
# swap file (in case to resize the swap, resize the swap file instead of partition)
fallocate -l 4G /swapfile
chmod 600 /swapfile
mkswap /swapfile
cp /etc/fstab /etc/fstab.bak
echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab
# cpu microcode, amd or intel
pacman -S intel-ucode
# desktop enviroment
pacman -S xorg-server
# video (intel chipset)
pacman -S mesa
# experimental
pacman -S xf86-video-vmware
# reboot
exit
umount -a
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment