Arch Linux Installation

# WHY

# Why do I want to switch from Windows to Linux?

First and foremost, Linux is OPEN-SOURCE. Actually, I am an OPEN-SOURCIST. It is my hope to fully stand for open-source community.

  • I am able to fully customize my system. Windows have limited a large amount of options to make system fit for us. Take system fonts for example. In Linux, we could just open the config file and fill in the font we want. But in Windows, we have to deal with lots of random and unknown services to change only a system font, and then we will get a number of bugs that we cannot solve for the unknown source code.
  • I am able to fully maximize my efficiency. If I want to install tools, I could just simply type $ sudo pacman -S ${pachage} or $ sudo apt install ${pachage}, and those packages’ licenses like MIT, GNU are easy to follow. But in Windows, it is time-consuming to download, depackage, install, agree to license, pay for the software, etc.
  • I am able to debug by my self. If we encounter a bug, we could just look at the source code and fix the bug. We could also PR to the repos and improve the software together. But for some software in Windows, it is hard to figure out how the software runs.
  • We have a large community to solve problems. In Linux, I have solved all bugs and run system smoothly without asking for any help - almost all problems and questions I encountered have been solved in Linux communities or forums.
  • I am able to uninstall the services I do not want. In Linux, we are able to install whatever we want and uninstall (remove) whatever we do not want. But in Windows, there are so many services like SMB file transfer that I might not want to use for entire life! The total storage of Pure Arch Linux with Xfce and daily working and gaming software is below 8 G!

# Why do I want to switch from Ubuntu to Arch?

  • After using Ubuntu for several months, I have the ability to work smoothly with terminals and have basis understanding of Linux. I want to step in further, and installing Arch Linux is a good approach to that.
  • Arch have the most complete wiki that we might be able to solve all problems there!
  • Arch Linux has more universal package manager and various packages from different system (it might be AUR).
  • Ubuntu still have lots of services I do not know. And gnome is an anti-lightweight desktop environment which could be very annoying.
  • Ubuntu with gnome is stepping in commercial and be less community-friendly. And there are some ads of Ubuntu Pro appear in the system.

# Why do I want to install Arch Linux without the script?

Learn more about Linux and fully customize for myself.

# WHAT

Here is an introduction of Arch Linux from its wiki: https://wiki.archlinux.org/title/Arch_Linux

# HOW

Note. This guide is just a simplification, clarification and modification based Arch Linux-Installation Guide. If you have any questions or if I not mention or skip about some necessary steps, you could just read the wiki and find out the answer. By the way, this guide is more focusing on understanding Linux system and how a system could be installed in a machine.

Every command begin with # meaning it is a shell command. # is always input automatically that you do not need to type it again. E.g. # mount /dev/?{nvme0n1p4} /mnt you might only need to type in mount /dev/?{nvme0n1p4} /mnt. $, [iwd]#, etc. is also similar to $.

Everything with ?{ } meaning that you could modify it based on your situation, for example # mount /dev/?{nvme0n1p4} /mnt might be # mount /dev/sd1 /mnt for you. Everything with !{ } meaning that you could not to type this based on your situation. E.g. # arch-chroot /mnt !{/bin/bash} you might only need to run # arch-chroot /mnt.

# 1. Preparation

A target machine that you want to install system to. A computer with 16 GB or above disk and AMD or Intel CPU is recommended. (P.S. High RAM is highly recommended. In this guide, I would not introduce how to create SWAP partition because my 16 GB RAM is enough for daily use.)

A USB flash drive (storage device) that could be modified. A USB with 8 GB or larger is recommended.

An available network that is able to access to Arch Linux packages. (If you are a Chinese User, this post is recommended to use.) An unhidden network is recommended.

# 2. Making an Installation Medium

# 3. Network Configuration

Note. The installation medium have installed iwd tool. Although networkmanager is more popular in Arch Linux network settings, iwd is the default network settings tool for installation.

  1. # iwctl to enter iwd tool.
  2. [iwd]# device list to check your network device. You need to remember your device name and type into ?{wlan0} in the following commands.
  3. [iwd]# station ?{wlan0} get-networks to check your networks and remember your SSID to type into following ${SSID}
  4. [iwd]# station ?{wlan0} connect ${SSID} to connect to SSID, you might need to type password after connect to it.
  5. [iwd]# exit to exit the network tool.

# 4. Disk Mounting and Installation

Note. Mounting disk partitions to installation medium enable we to modify partitions through installation medium. You need to prepare at least two partitions - one at least 150 M as your starting partition and another above 16 G is recommended for your main Arch Linux System.

  1. # fdisk -l to check your partitions of disk.
  2. # mkfs.ext4 /dev/?{nvme0n1p4} to format a partition to ext4 file system for your main Arch Linux System Installation. If you want to install Dual-systems, do not run the following commands: # mkfs.vfat -F32 /dev/?{nvme0n1p1} to format a partition to fat32 file system for the boot partition.
  3. # mount /dev/?{nvme0n1p4} /mnt, # mkdir -p /mnt/boot, # mount /dev/?{nvme0n1p1} /mnt/boot to connect disk partitions to the installation medium.
  4. # lsblk to check your mounting situation. If this not meet your condition, you could modify by # unmount /dev/?{nvme0n1p4} /mnt command.
  5. # pacstrap -K /mnt base !{base-devel} ?{linux} linux-firmware e2fsprogs !{ntfs-3g} ?{vim} !{linux-headers} to install basis Arch Linux. base-devel contains makepkg that is necessary for installing AUR packages. You can install the Linux kernels that you want through https://wiki.archlinux.org/title/kernel. linux-firmware is necessary Linux kernel firmware. e2fsprogs is for configuration of ext4 file system. ntfs-3g is for configuration of NTFS (Windows File System) file system. vim if for latter file editing.

# 5. User Setting

  1. # arch-chroot /mnt /bin/bash to change root to /mnt (root user path) using shell in /bin/bash.
  2. # passwd to reset the root user password.
  3. # echo ?{zayn7lie-acl} > /etc/hostname to reset your machine name.
  4. # useradd -m -G wheel -s /bin/bash ${zayn7lie} set up a new user ${zayn7lie}, set it log in directory and add to wheel group. # passwd ${zayn7lie} to set user’s password. P.S. Wheel group users are used to update system (like a wheel to update continuously)
  5. # EDITOR=nvim visudo to open config file using vim. Type i to enter insert(edit) mode for vim and then find and uncomment (delete #) before %wheel ALL=(ALL:ALL) ALL. Then esc to escape from insert mode and :wq to write in (save) and quit. P.S. :wq! and :q! the ! means force. :wq! will force writing in (If the file is unchangeable, it will create a new file and replace it.), and :q! will force you to quite without any change of the file.
  6. # vim /etc/hosts to config localhost settings. Insert:
127.0.0.1 localhost
::1 localhost
127.0.1.1 ?{zayn7lie-acl}.localdomain ?{zayn7lie-acl}

Replace ?{zayn7lie-acl} with your machine name.

# 6. Language & Time

  1. # vim /etc/locale.gen to enter language config file, then uncomment en-US.UTF-8 UTF-8 and the language you want use, then save the file. # locale-gen to generate and install language files.
  2. # echo LANG=C.UTF-8 > /etc/locale.conf make system default characters to characters in C.
  3. # hwclock --systohc --utc and # timedatectl set-ntp true to update your system time to installation medium time.
  4. # ln -sf /usr/share/zoneinfo/?{EST} /etc/localtime to config your local time. ?{EST} Could be change based on your region. You can use # ls /usr/share/zoneinfo/ to check which option could be used. Some folder like ./Asia might have subfolders that you need to choose in more specific way. E.G. # ln -sf /usr/share/zoneinfo/Asia/Hong_Kong /etc/localtime. P.S. s meaning soft link which will not actually copy all file to the target folder, f meaning force to do it.

# 7. Launch Setting

  1. # pacman -S ?{amd-ucode} grub efibootmgr to install necessary boot package. If you are using Intel CPU, change ?{amd-ucode} to intel-ucode
  2. # grub-install !{--removable} --target=x86_64-efi --efi-directory=/boot --bootloader-id=?{"GRUB"} --recheck to install grub file. !{--removable} determines whether you are able to remove it from UEFI, ?{"Arch Linux"} is your system name in grub.
  3. # grub-mkconfig -o /boot/grub/grub.cfg to generate config file.

# 8. Misc

# pacman -S networkmanager to install NetworkManager tool, then # systemctl enable NetworkManager to let NetworkManager start automatically when you boot your system. As I have mentioned above, networkmanager is more popular than iwd. And iwd is only installed in your installation medium but not your system. You still have to install a network manager tool for your Arch Linux.

# Finish Installation

You have installed Arch Linux in your machine. Now you can # exit to exit your root user account, it is important to # genfstab -U /mnt >> /mnt/etc/fstab to generate a fstab file for Linux file tree viewing. It is safer to # cat /mnt/etc/fstab to check whether file is generated properly. P.S. Difference between » and >: » is appending (add) to the end of the file, > is replacing the file. # reboot and remove installation medium when computer is completely closed. Congratulation! Now, start your journey to Arch Linux!

# Post-installation

If you encounter any problems or bugs, reading Wiki, googling (DDG is a better option with high privacy protection), searching in the forums or communities are both good options. But remember that if you want to ask a question, please ask in a smart way. That’s all, it is my best hope that you could join and enjoy our open-source communities!

# Quick Ref

  • installation medium:
    • $ ls -l /dev/disk/by-id/usb-*
    • $ sudo wipefs --all /dev/disk/by-id/usb-SanDisk_Cruzer_Force_4C531000491008113131-0:0
    • $ sudo cat ?{path/to/archlinux-version-x86_64.iso} > ?{/dev/disk/by-id/usb-My_flash_drive}
  1. Network (Connect directly by mobile threatening)

    1. # iwctl
    2. [iwd]# station wlan0 get-networks, [iwd]# station wlan0 connect ${SSID}
    3. [iwd]# exit
    4. # timedatectl set-ntp true, # hwclock --systohc --utc
  2. Disk Mounting and Installation

    1. # fdisk -l
    2. # mkfs.ext4 /dev/?{nvme0n1p2}, # mount /dev/?{nvme0n1p2} /mnt
    3. # mount --mkdir /dev/?{nvme0n1p1} /mnt/boot
    4. # mkswap -U clear --size 16G --file /mnt/swapfile, # swapon /mnt/swapfile
    5. # lsblk
    6. # pacstrap /mnt base base-devel linux linux-firmware e2fsprogs ntfs-3g neovim
  3. User Setting

    1. # arch-chroot /mnt /bin/bash, # passwd, # echo zayn7lie-acl > /etc/hostname

    2. # useradd -m -G wheel -s /bin/bash zayn7lie, # passwd zayn7lie

    3. # vim /etc/sudoers uncomment %wheel ALL=(ALL:ALL)

    4. vim /etc/hosts:

      127.0.0.1 localhost
      ::1 localhost
      127.0.1.1 zayn7lie-acl.localdomain zayn7lie-acl
      
  4. Language & Time

    1. # vim /etc/locale.gen uncomment en-US.UTF-8 UTF-8, # locale-gen
    2. # echo LANG=C.UTF-8 > /etc/locale.conf
    3. # ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
  5. Launch Setting

    1. # pacman -S amd-ucode grub efibootmgr
    2. # grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB --recheck
    3. # grub-mkconfig -o /boot/grub/grub.cfg
  6. Final

    1. # pacman -S networkmanager, # systemctl enable NetworkManager
    2. # exit,# genfstab -U /mnt >> /mnt/etc/fstab, # cat /mnt/etc/fstab # reboot
    3. NetworkManager
      1. $ nmcli device wifi list
      2. $ nmcli device wifi connect ?{SSID_or_BSSID} password ?{password}
    4. pacman
      1. Remove: $ sudo pacman -Run(c or s) package
      2. Auto-clean: $ sudo pacman -Runc $(pacman -Qdtq)
      3. Clean Cache: $ sudo pacman -Sc
Built with Hugo
Theme Stack designed by Jimmy