Skip to content

Instantly share code, notes, and snippets.

@lelegard
Last active December 3, 2022 13:08
Show Gist options
  • Save lelegard/80800d708f241519c3312543d43334bc to your computer and use it in GitHub Desktop.
Save lelegard/80800d708f241519c3312543d43334bc to your computer and use it in GitHub Desktop.
My Arch Linux Installation

My Arch Linux Installation

As the title implies, this is "my" experience of Arch Linux Installation on a virtual machine. There are many (too many) ways to install Arch Linux. This Gist is only designed as a reminder if I need to do this again...

Target configuration: use English language, French keyboard, located in France.

Installation guides

Get base installation media

Virtual machine configuration

  • CPU: 2
  • Memory: 4 GB
  • Disk: 40 GB
  • USB: 3.1
  • CD: installation image
  • No nested virtualization
  • No UEFI, use legacy BIOS

Installation, phase 1

  • Boot on install CD => prompt root@archiso ~ #
  • Define keyboard layout:
# loadkeys fr
  • Network: list adapters, start DHCP client daemon, verify address:
# ip link
# systemctl start dhcpcd
# ip addr
  • List disks (assuming /dev/sda):
# fdisk -l
  • Partition disk: 4 GB swap, root file system for the rest of the disk (see fdisk commands at end of document)
# fdisk /dev/sda
o  <-- create a new empty DOS partition table
p  <-- print the partition table
F  <-- list free unpartitioned space
n  <-- add a new partition
   p    <-- primary
   1    <-- partition number
        <-- first sector, use default
   +4G  <-- last sector (4GB after first sector)
t  <-- change a partition type
   82   <-- type: Linux swap
n  <-- add a new partition
   p    <-- primary
   2    <-- partition number
        <-- first sector, use default
        <-- last sector, use default (end of disk)
a  <-- toggle a bootable flag
   2    <-- partition number
p  <-- print the partition table
v  <-- verify the partition table
w  <-- write table to disk and exit
  • Format swap and root, mount them:
# mkswap /dev/sda1
# mkfs.ext4 /dev/sda2
# swapon /dev/sda1
# mount /dev/sda2 /mnt
  • Update the maintainers keyring, in case new keys are not on the boot DVD:
pacman -Sy archlinux-keyring
  • Install some base packages:
# pacstrap /mnt base linux linux-firmware grub vi vim sudo dhcpcd networkmanager man-db man-pages texinfo
  • Generate an fstab file:
# genfstab -U /mnt >>/mnt/etc/fstab
  • Change root into the new system:
# arch-chroot /mnt
  • Set the time zone, generate /etc/adjtime (hardware clock is set to UTC):
# ln -sf /usr/share/zoneinfo/Europe/Paris /etc/localtime
# hwclock --systohc
  • Generate locale, keyboard and host name:
# vi /etc/locale.gen   # uncomment en_US.UTF-8 UTF-8
# locale-gen
# echo "LANG=en_US.UTF-8" >/etc/locale.conf
# echo "KEYMAP=fr" >/etc/vconsole.conf
# echo "vmarch" >/etc/hostname
  • Set the root password:
# passwd
  • Install GRUB bootloader:
# grub-install /dev/sda
# vi /etc/default/grub  # only if non-default configuration is needed
# grub-mkconfig -o /boot/grub/grub.cfg
  • Reboot:
# exit  # from arch-chroot
# umount /mnt
# reboot

Installation, phase 2

  • Enable network:
# systemctl start NetworkManager
# systemctl enable NetworkManager
# ip addr  # to check addresses
  • Create user:
# groupadd _NAME_
# useradd _NAME_ -m -d /home/_NAME_ -g _NAME_
# passwd _NAME_
# echo "_NAME_ ALL=(ALL) NOPASSWD:ALL" >/etc/sudoers.d/_NAME_
  • Install additional software:
# pacman -Syu --noconfirm base-devel bash-completion gnome gnome-terminal gnome-tweaks openssh linux-headers dkms git
# localectl --no-convert set-x11-keymap fr
# systemctl enable gdm
# systemctl enable sshd

Appendix 1: fdisk commands summary

  • Main commands:
DOS (MBR)
 a   toggle a bootable flag
 b   edit nested BSD disklabel
 c   toggle the dos compatibility flag

Generic
 d   delete a partition
 F   list free unpartitioned space
 l   list known partition types
 n   add a new partition
 p   print the partition table
 t   change a partition type
 v   verify the partition table
 i   print information about a partition

Misc
 m   print this menu
 u   change display/entry units
 x   extra functionality (experts only)

Script
 I   load disk layout from sfdisk script file
 O   dump disk layout to sfdisk script file

Save & Exit
 w   write table to disk and exit
 q   quit without saving changes

Create a new label
 g   create a new empty GPT partition table
 G   create a new empty SGI (IRIX) partition table
 o   create a new empty DOS partition table
 s   create a new empty Sun partition table
  • Extra commands (after x):
DOS (MBR)
 b   move beginning of data in a partition
 i   change the disk identifier

Geometry (for the current label)
 c   change number of cylinders
 h   change number of heads
 s   change number of sectors/track

Generic
 p   print the partition table
 v   verify the partition table
 d   print the raw data of the first sector from the device
 D   print the raw data of the disklabel from the device
 f   fix partitions order
 m   print this menu

Save & Exit
 q   quit without saving changes
 r   return to main menu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment