Sunday, April 2, 2017

Arch Linux Cheat Sheet

This walkthrough is largely based on this video walkthrough.
https://wiki.archlinux.org/index.php/Installation_guide

I. Download and Run Arch Linux iso

  1. https://www.archlinux.org/download/
  2. burn to 
    • disk: Use normal utility (In Windows, right-click .iso file to burn to disk)
    • usb: Use unetbootin
  3. Insert disk or usb and restart computer to boot into Arch Linux
    • An Arch Linux graphic and an options menu should appear
  4. Select option     Boot Arch Linux (x86_64)                       
  5. You should go through a text boot process and then eventually see a command prompt.





II. Partition, Format, Mount

A. Create Disk Partitions with fdisk

  1. type: fdisk -l and note the location of the disk (/dev/sda here)
  2. type: fdisk <disk location>
  3. enter: o to reset the drive
  4. create new partitions
    1. enter: n to create a new partition
    2. enter p or l for primary or logical
    3. enter start point (usually stick with default by pressing enter)
    4. enter end point (enter as +30G for a 30 gigabyte partition)
  5. enter partition types
    1. enter 'type'
    2. select partition number to alter 
    3. select type number
      • (83 for Linux partitions)
      • (82 for swap partitions)
      • (this is not formatting. formatting will be done next)
  6. Finally enter w to save partitions and exit fdisk



B. Format ext4 Partitions with mkfs

  •  example
    • mkfs.ext4 /dev/sda1
  • example
    • mkfs.ext4 /dev/sda3 



C. Mount Filesystem to Partitions for Installation

  1. mount the root partition to /mnt
    • example: mount /dev/sda3 /mnt
  2. make directories (such as /boot and /home) in the /mnt directory
    • example: mkdir /mnt/boot
    • example: mkdir /mnt/home
  3. mount those directories to their respective partitions
    • example: mount /dev/sda1 /mnt/boot
    • example: mount /dev/sda4 /mnt/home





III. Set Up WPA Wireless Networking

  1. Find your computer's interface names by entering: 'ip link' or 'ip a'
    • a wireless interface will start with 'w' if it starts with 'e' (or 'enp'), then it is most definitely not a wireless interface.)
  2. Make sure you know your wireless SSID and passcode from your home router
  3. Copy a wpa wireless config template: cp /etc/netctl/exmaples/wireless-wpa /etc/netctl/<name>
    • name the file whatever you want to.
    • keep the filename simple and memorable
  4. Edit the wpa config template: vim /etc/netctl/<name>
    • edit Interface= to be the name of the wireless interface from the 'ip link' command
    • edit ESSID='<router>' to be the SSID of your wireless router you'd normally see
    • edit Key='<key>' to be whatever your router's passkey is
  5. Start the wireless interface with: netctl start <name>




IV. Install and Configure the System

A. Install the system

  1. pacstrap -i /mnt base 
  2. genfstab -U /mnt >> /mnt/etc/fstab 
  3. arch-chroot /mnt
  4. pacman -S vim openssh grub-bios linux-headers linux-lts linux-lts-headers wpa_supplicant wireless_tools

B. Configure language

  1. vim /etc/locale.gen
    1. un-comment your language (en_US.UTF-8 UTF-8)
    2. save file
  2. enter: locale-gen

 C. Configure time

  1.  ln -sf /usr/share/zoneinfo/<Region>/<City> /etc/localtime
    • example: ln -sf /usr/share/zoneinfo/American/New_York /etc/localtime
  2. hwclock --systohc --utc
    • Runs hwclock(8) to generate /etc/adjtime:

D. Enable SSH at startup

  • systemctl enable sshd.service

E. Set Password

  • passwd

F. Install Grub bootloader

  1. grub-install --target=i386-pc --recheck /dev/sda
  2. cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo
  3. grub-mkconfig -o /boot/grub/grub.cfg