Skip to content

Automated provisioning of a Arch Linux development environment.

Notifications You must be signed in to change notification settings

thled/ansible-arch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Ansible Arch

Install

Prerequisite

Ansible Process

  1. Install Git and Ansible: $ pacman -S git ansible
  2. Install Ansible "aur" module : $ git clone https://github.com/kewlfft/ansible-aur.git ~/.ansible/plugins/modules/aur
  3. Clone this repository: $ git clone https://github.com/thled/ansible-arch.git
  4. Change to project directory: $ cd ansible-arch
  5. Run the Ansible Playbook: $ ansible-playbook playbook.yml
  6. Reboot system.
  7. Login with your chosen username and start the window manager: $ startx

Optional

  • Add SSH keys to ~/.ssh/.
  • Sync Firefox config and addons by logging in.
  • Configure bluetooth headset:
    1. $ pulseaudio -k
    2. $ systemctl start bluetooth
    3. $ bluetoothctl
    4. $ default-agent
    5. $ scan on
    6. $ pair CC:98:8B:1B:7B:B1
    7. $ connect CC:98:8B:1B:7B:B1
    8. $ trust CC:98:8B:1B:7B:B1
    9. $ exit

Usage

  • Start Neovim by typing $ nvim and wait while it initializes.
  • Use the shortcut Win+p to start any application.
  • Install any application by using $ paru APP.
  • Use Arandr to configure screenlayout. Or use presets like $ .screenlayout/xps49.sh.

Arch Installation

Script (EFI)

  1. Download Arch Linux ISO.
  2. Verify UEFI: $ ls /sys/firmware/efi/efivars
  3. Verify internet: $ ping -c3 google.com
    • If no internet: $ iwctl
      1. $ device list
      2. $ station DEVICE scan
      3. $ station DEVICE get-networks
      4. $ station DEVICE connect SSID
    • Still no internet: $ dhcpcd
  4. Verify block device is /dev/nvme0n1: $ fdisk -l
  5. Download script: $ curl -LO https://raw.githubusercontent.com/thled/ansible-arch/master/arch-install.sh
  6. Execute script: $ bash arch-install.sh
  7. Reboot, login as root and connect to wifi
    1. List wifi networks: $ nmcli device wifi list
    2. Connect to wifi: $ nmcli device wifi connect SSID password PASSWORD

EFI

  1. Download Arch Linux ISO.
  2. Verify UEFI: $ ls /sys/firmware/efi/efivars
  3. Verify internet: $ ping -c3 google.com
    • If no internet: $ iwctl
      1. $ device list
      2. $ station DEVICE scan
      3. $ station DEVICE get-networks
      4. $ station DEVICE connect SSID
    • Still no internet: $ dhcpcd
  4. Verify block device is /dev/sda: $ fdisk -l
  5. Partition disks: $ fdisk /dev/sda
    1. New partition layout: $ g
    2. New efi partition: $ n, Return, Return, $ +500M
    3. Set type of efi: $ t, $ 1 ("EFI")
    4. New boot partition: $ n, Return, Return, $ +500M
    5. New root partition: $ n, Return, Return, Return
    6. Set type of root: $ t, Return, $ 24 ("root x86_64")
    7. Write partitions: $ w
  6. Format partitions
    1. $ mkfs.fat -F32 /dev/sda1
    2. $ mkfs.ext4 /dev/sda2
    3. $ cryptsetup luksFormat /dev/sda3
    4. $ cryptsetup open /dev/sda3 cryptroot
    5. $ mkfs.ext4 /dev/mapper/cryptroot
  7. Mount file systems
    1. $ mount /dev/mapper/cryptroot /mnt
    2. $ mkdir /mnt/boot
    3. $ mount /dev/sda2 /mnt/boot
    4. $ mkdir /mnt/boot/efi
    5. $ mount /dev/sda1 /mnt/boot/efi
  8. Install system: $ pacstrap /mnt base linux linux-lts linux-firmware vim networkmanager grub efibootmgr
  9. Generate UUID for FS: $ genfstab -U /mnt >> /mnt/etc/fstab
  10. Switch to new system: $ arch-chroot /mnt
  11. Set root PW: $ passwd
  12. Setup mkinitcpio
    1. Add encrypt in HOOKS before filesystem: $ vim /etc/mkinitcpio.conf
    2. Create images
      • $ mkinitcpio -p linux
      • $ mkinitcpio -p linux-lts
  13. Make swap file
    1. $ fallocate -l 2G /swapfile
    2. $ chmod 600 /swapfile
    3. $ mkswap /swapfile
    4. $ echo /swapfile none swap sw 0 0 >> /etc/fstab
  14. Select mirrors: $ vim /etc/pacman.d/mirrorlist
  15. Update clock: $ timedatectl set-ntp true
  16. Set timezone
    • $ ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
    • $ hwclock --systohc
  17. Add localization
    • Uncomment en_US.UTF-8 UTF-8: $ vim /etc/locale.gen
    • $ locale-gen
    • $ echo LANG=en_US.UTF-8 >> /etc/locale.conf
  18. Enable NetworkManager: $ systemctl enable NetworkManager
  19. Configure network
    • $ echo HOSTNAME > /etc/hostname
    • Add hosts
      • $ echo 127.0.0.1 localhost >> /etc/hosts
      • $ echo ::1 localhost >> /etc/hosts
      • $ echo 127.0.1.1 HOSTNAME.localdomain HOSTNAME >> /etc/hosts
  20. Configure bootloader
    1. Edit $ vim /etc/default/grub
      • Add to GRUB_CMDLINE_LINUX_DEFAULT before quiet: cryptdevice=/dev/sda3:cryptroot:allow-discards
      • Uncomment GRUB_ENABLE_CRYPTODISK
    2. $ grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch --recheck
    3. $ grub-mkconfig -o /boot/grub/grub.cfg
  21. Reboot system
    1. $ exit
    2. $ umount -R /mnt
    3. $ shutdown
  22. Login as root and connect to wifi
    1. List wifi networks: $ nmcli device wifi list
    2. Connect to wifi: $ nmcli device wifi connect SSID password PASSWORD

BIOS

  1. Verify internet: $ ping -c3 google.com
    • If no internet: $ iwctl
      1. $ device list
      2. $ station DEVICE scan
      3. $ station DEVICE get-networks
      4. $ station DEVICE connect SSID
    • Still no internet: $ dhcpcd
  2. Verify block device is /dev/sda: $ fdisk -l
  3. Partition disks: $ fdisk /dev/sda
    1. New partition layout: $ o
    2. New boot partition: $ n, Return, Return, $ +500M
    3. New root partition: $ n, Return, Return, Return
    4. Write partitions: $ w
  4. Format partitions
    1. $ mkfs.ext4 /dev/sda1
    2. $ cryptsetup luksFormat /dev/sda2
    3. $ cryptsetup open /dev/sda2 cryptroot
    4. $ mkfs.ext4 /dev/mapper/cryptroot
  5. Mount file systems
    1. $ mount /dev/mapper/cryptroot /mnt
    2. $ mkdir /mnt/boot
    3. $ mount /dev/sda1 /mnt/boot
  6. Install system: $ pacstrap /mnt base linux linux-lts linux-firmware vim networkmanager grub efibootmgr
  7. Generate UUID for FS: $ genfstab -U /mnt >> /mnt/etc/fstab
  8. Switch to new system: $ arch-chroot /mnt
  9. Set root PW: $ passwd
  10. Setup mkinitcpio
    1. Add encrypt in HOOKS before filesystem: $ vim /etc/mkinitcpio.conf
    2. Create images
      • $ mkinitcpio -p linux
      • $ mkinitcpio -p linux-lts
  11. Make swap file
    1. $ fallocate -l 2G /swapfile
    2. $ chmod 600 /swapfile
    3. $ mkswap /swapfile
    4. $ echo /swapfile none swap sw 0 0 >> /etc/fstab
  12. Select mirrors: $ vim /etc/pacman.d/mirrorlist
  13. Update clock: $ timedatectl set-ntp true
  14. Set timezone
    • $ ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
    • $ hwclock --systohc
  15. Add localization
    • Uncomment en_US.UTF-8 UTF-8: $ vim /etc/locale.gen
    • $ locale-gen
    • $ echo LANG=en_US.UTF-8 >> /etc/locale.conf
  16. Enable NetworkManager: $ systemctl enable NetworkManager
  17. Configure network
    • $ echo HOSTNAME > /etc/hostname
    • Add hosts
      • $ echo 127.0.0.1 localhost >> /etc/hosts
      • $ echo ::1 localhost >> /etc/hosts
      • $ echo 127.0.1.1 HOSTNAME.localdomain HOSTNAME >> /etc/hosts
  18. Configure bootloader
    1. Edit $ vim /etc/default/grub
      • Add to GRUB_CMDLINE_LINUX_DEFAULT before quiet: cryptdevice=/dev/sda2:cryptroot:allow-discards
      • Uncomment GRUB_ENABLE_CRYPTODISK
    2. $ grub-install /dev/sda
    3. $ grub-mkconfig -o /boot/grub/grub.cfg
  19. Reboot system
    1. $ exit
    2. $ umount -R /mnt
    3. $ shutdown
  20. Login as root and connect to wifi
    1. List wifi networks: $ nmcli device wifi list
    2. Connect to wifi: $ nmcli device wifi connect SSID password PASSWORD

About

Automated provisioning of a Arch Linux development environment.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published