Skip to content

Instantly share code, notes, and snippets.

@okanon
Last active July 11, 2020 11:28
Show Gist options
  • Save okanon/8105ea897cbf6017e049a8653c532654 to your computer and use it in GitHub Desktop.
Save okanon/8105ea897cbf6017e049a8653c532654 to your computer and use it in GitHub Desktop.
Install x86_64 ArchLinux (late 2020)

How to Install x86_64 Arch Linux 2020 (Single Boot)

Pre-Installation

  • Set the keyboard layout and Font

    The default console keymap is US. To list available layouts, run ls /usr/share/kbd/keymaps/**/*.map.gz. To modify the layout, append a corresponding file name to loadkeys, omitting path and file extension.

    For example, run loadkeys jp106 to set a Japanese keyboard layout.

    Console fonts are located in /usr/share/kbd/consolefonts/ and can likewise be set with setfont.

    For example, run setfont Lat2-Terminus16. Japanese is not garbled.

    loadkeys jp106
    setfont Lat2-Terminus16
    
  • Connect to the Internet

    The installation image enables the dhcpcd daemon on boot for wired network devices. The connection may be checked with:

    ping archlinux.org
    

    If no connection is available, stop the dhcpcd service with systemctl stop dhcpcd, Tab and see Network configuration.

    For wireless connections, iw, wpa_supplicant and netctl are available. See Wireless network configuration.

  • Update the system clock

    Use timedatectl to ensure the system clock is accurate:

    timedatectl set-ntp true
    

    To check the service status, use timedatectl status.

  • Partition the disks and Mount the file systems (SSD)

    Partition type Format Uses Mount Point capacity required
    /dev/sda1 gpt mkfs.fat -F32 efi /mnt/boot +512M
    /dev/sda2 gpt mkswap swapon swap +3GB optional
    /dev/sda3 gpt mkfs.xfs root /mnt +100G
    /dev/sda4 gpt mkfs.xfs home /mnt/home option optional

    XFS for installation on SSD, but EXT4 is recommended for installation on HDD.

    preview this site.

Installation

  • Select the mirrors

    Packages to be installed must be downloaded from mirror servers, which are defined in /etc/pacman.d/mirrorlist. On the live system, all mirrors are enabled, and sorted by their synchronization status and speed at the time the installation image was created.

    The higher a mirror is placed in the list, the more priority it is given when downloading a package. You may want to edit the file accordingly, and move the geographically closest mirrors to the top of the list, although other criteria should be taken into account.

    This file will later be copied to the new system by pacstrap, so it is worth getting right.

    Bring jaist or tsukuba's server to the top with /etc/pacman.d/mirrorlist.

    # vi /etc/pacman.d/mirrorlist
    
    ##
    ## Arch Linux repository mirrorlist
    ## Sorted by mirror score from mirror status page
    ## Generated on 2015-01-01
    ##
    
    ## Japan
    Server = http://ftp.jaist.ac.jp/pub/Linux/ArchLinux/$repo/os/$arch
    ## Germany
    ...
    
  • Install the base packages

    Use the pacstrap script to install the base package group:

    pacstrap /mnt base base-devel linux linux-firmware
    

    This group does not include all tools from the live installation, such as btrfs-progs or specific wireless firmware; see packages.both for comparison.

    To install packages and other groups such as base-devel, append the names to pacstrap (space separated) or to individual pacman commands after the Chroot step.

  • Fstab

    Generate an fstab file (use -U or -L to define by UUID or labels, respectively):

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

      The genfstab will only generate what is currently mounted, so it must be Mount all partitions before working with them.

      mount /dev/sda2 /mnt
      mkdir /mnt/boot /mnt/home
      mount /dev/sda1 /mnt/boot
      mount /dev/sda3 /mnt/home
      

      As for mount /dev/sda3 /mnt/home, you can use the If you want to make the same partition as / without cutting the partitions, you don't need to do it.

  • Chroot

    Change root into the new system:

    arch-chroot /mnt
    

    Pacman install vim

    pacman -S vim
    
  • Locale

    Uncomment en_US.UTF-8 UTF-8 , ja_JP.UTF-8 UTF-8 and other needed localizations in /etc/locale.gen:

    # vim /etc/locale.gen
    
    #en_SG ISO-8859-1
    en_US.UTF-8 UTF-8
    #ja_JP.EUC-JP EUC-JP
    ja_JP.UTF-8 UTF-8
    

    and generate them with:

    locale-gen
    

    Set the LANG variable in locale.conf accordingly, for example:

    echo LANG=en_US.UTF-8 > /etc/locale.conf
    export LANG=en_US.UTF-8
    

    If you set the keyboard layout, make the changes persistent in vconsole.conf:

    # /etc/vconsole.conf
    
    KEYMAP=jp106
    FONT=Lat2-Terminus16
    
  • Time zone

    Set the time zone:

    ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
    

    Run hwclock to generate /etc/adjtime:

    hwclock --systohc --utc
    

    This command assumes the hardware clock is set to UTC. See Time#Time standard for details.

  • Hostname

    Create the hostname file:

    echo myhostname > /etc/hostname
    

    Consider adding a matching entry to hosts:

    # vim /etc/hosts
    
    127.0.0.1	localhost
    ::1		localhost
    127.0.1.1	localhost.localdomain	myhostname
    

    See also Network configuration Set the hostname.

    Network configuration The newly installed environment has no network connection activated by default. See Network configuration#Network managers.

    For Wireless configuration, install the iw and wpa_supplicant packages, as well as needed firmware packages. Optionally install dialog for usage of wifi-menu.

  • Pacman Multilib

    Uncomment

    # vim /etc/pacman.conf
    
    [multilib]
    Include=/etc/pacman.d/mirrorlist
    

    When commenting out is complete, update with pacman -Sy.

  • Initramfs

    Creating a new initramfs is usually not required, because mkinitcpio was run on installation of the linux package with pacstrap.

    For special configurations, modify the mkinitcpio.conf file and recreate the initramfs image:

    mkinitcpio -p linux
    
  • Root password

    Set the root password:

    passwd
    
  • UserAdd

    Set the user and user password:

    useradd USERNAME
    passwd USERNAME
    
  • Mount efivarfs

    mount -t efivarfs efivarfs /sys/firmware/efi/efivars
    
  • Bootloader

    See Category:Boot loaders for available choices and configurations.

    If you have an Intel CPU, install the intel-ucode package in addition, and enable microcode updates.

    • install grub

      Install grub and grub configuration with necessary packages.

      pacman -S grub efibootmgr
      

      Install grub like this:

      grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=archlinux --recheck
      

      Since --bootloader-id is the name of the hard disk from the BIOS, for example, if you set it to GRUB, the BIOS will display the name of the hard disk as GRUB, so you won't know which OS is booted.
      So, we need to set --bootloader-id to a name that identifies which OS is booted and set the Let's. However, this is not the case for dual-booting.

      In this case, you might want to use --bootloader-id="Arch Linux". No, but I haven't tried 😉

      One last step:

      grub-mkconfig -o /boot/grub/grub.cfg
      

      Arch Linux grubs are not updated with update-grub. Use grub-mkconfig to update grub. If you want to set the time until timeout, set the value of /etc/default/grub to and then update it.
      For example, if you want to skip the grub screen and start Arch Linux, the timeout value to 0.0.

    • Old installtion

      bootctl install
      ...
      
      # sudo vim /boot/loader/entries/arch.conf
      
      title Arch Linux
      linux /vmlinuz-linux
      initrd /initramfs-linux.img
      
      echo "options root=PARTUUID=$(blkid -s PARTUUID -o value /dev/sda3) rw" >> /boot/loader/entries/arch.conf
      
      # /boot/loader/entries/arch.conf
      
      title Arch Linux
      linux /vmlinuz-linux
      initrd /initramfs-linux.img
      options root=PARTUUID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx rw
      
  • DHCP and NetworkManager

    Configure dhcp and networkmanager:

    pacman -S dhcpcd
    
    systemctl enable dhcpcd.service
    pacman -S networkmanager
    systemctl enable NetworkManager.service
    
  • Unmount

    Go through the chroot environment and return to the archiso environment:

    exit
    

    If you don't see root@archiso in this state please exit again.

    I'll unmount it when I return to the archiso:

    umount -R /mnt
    
  • Reboot System

    reboot
    

    Please remove USB and boot from Linux Boot Manager.


Congratulations!

This completes the installation of Arch Linux. Please also refer to the following when installing the GUI.

x86_64 Arch Linuxのインストール方法 2020

eta son.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment