My personal Arch Linux configuration on my notebook. Feel free to try it.
Item | Detail |
---|---|
Model | ASUS ZenBook UX501J |
Kernel | 5.12.8-arch1-1 |
Disk Partition | LVM |
Bootloader | GRUB |
Wireless | plasma-nm |
Graphics | xf86-video-nouveau |
Audio | PulseAudio |
The guide is provided "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of correctness and relevance to a particular subject. The entire risk as to the quality and accuracy of the content is with you. Should the content prove substandard, you assume the cost of all necessary servicing, repair, or correction.
Should this guide miss anything important or stated something wrong, please tell me at once. I'll corrected it ASAP.
This guide is based on UEFI
system.
Download the latest boot image and make a Live USB. To BIOS setting, disable the Secure Boot Control, the function will be automatically maintained by Arch Linux Kernel after completing the installation. Then boot with the Live USB.
Make sure you have booted in UEFI mode by checking efi directory
ls /sys/firmware/efi/efivars
Ensure your network interface is listed and enabled
ip link
ping archlinux.org
Ensure the system clock is accurate
timedatectl set-ntp true
To check the service status, use timedatectl status
.
Use cfdisk
, cgdisk
, fdisk
or whatever tools you like to partition according to the office guide. However, I suggest part the root for 40G at least if one tries to install KDE Plasma. Note that we are refering to UEFI with GPT
.
After completing all steps, my lsblk
output is as follow:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 119.2G 0 disk
├─sda1 8:1 0 512M 0 part /boot/EFI
├─sda2 8:2 0 2G 0 part [SWAP]
└─sda3 8:3 0 116.7G 0 part
├─vg1-root 254:0 0 50G 0 lvm /
└─vg1-home 254:1 0 66.7G 0 lvm /home
sdb 8:16 0 931.5G 0 disk
└─sdb1 8:17 0 931.5G 0 part /data
Create the LVM on root and home partitions as following steps:
pvcreate /dev/sda3
pvdisplay
vgcreate vg1 /dev/sda3
vgdisplay
lvcreate -L 50G -n root vg1
lvcreate -l 100%FREE -n home vg1
Once the partitions have been created, each newly created partition must be formatted with an appropriate file system.
mkfs.fat -F32 /dev/sda1 --> EFI formation
mkswap /dev/sda2 --> swap initalization
mkfs.ext4 /dev/vg1/root
mkfs.ext4 /dev/vg1/home
mkfs.ext4 /dev/sdb1
Mount the root volume to /mnt. Then create any remaining mount points (such as /mnt/home) and mount their corresponding volumes.
mount /dev/vg1/root /mnt
mkdir -p /mnt/home
mount /dev/vg1/home /mnt/home
mkdir -p /mnt/boot/EFI
mount /dev/sda1 /mnt/boot/EFI
swapon /dev/sda2 --> enable swap session
Check lsblk
to ensure everything is properly set.
Install essential packages. Use the pacstrap script
to install the base package, Linux kernel and firmware for common hardware:
pacstrap /mnt base linux linux-firmware base-devel linux-headers intel-ucode lvm2 vim
Also, we install the additional packages such like:
- userspace utilities for the management of file systems that will be used on the system
- specific firmware for other devices not included in linux-firmware.
- packages for microcode updates,
intel-ucode
oramd-ucode
. - utilities for accessing RAID or LVM partitions.
- a text editor.
Generate an fstab file (use -U or -L to define by UUID or labels, respectively):
genfstab -U /mnt >> /mnt/etc/fstab
cat /mnt/etc/fstab
to check if it works, mine is like:
# <file system> <dir> <type> <options> <dump> <pass>
# /dev/mapper/vg1-root
UUID=66ddf5be-051c-4e31-9774-34c14b2c8d9f / ext4 rw,relatime 0 1
# /dev/mapper/vg1-home
UUID=31af8d33-2f65-4b6e-80f8-3345a2699af1 /home ext4 rw,relatime 0 2
# /dev/sda1
UUID=A289-1408 /boot/EFI vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 2
# /dev/sdb1
UUID=fcb0c78c-6d9d-4f36-825f-2da2ab50064f /data ext4 rw,relatime 0 2
Change root into the new system:
arch-chroot /mnt
Set the time zone:
ln -sf /usr/share/zoneinfo/Asia/Taiwan /etc/localtime
Run hwclock to generate /etc/adjtime:
hwclock --systohc
run date
to check status.
Uncomment the locales you are going to use in /etc/locale.gen
. Then run:
locale-gen
echo LANG=en_US.UTF-8 >> /etc/locale.conf
Create the hostname file:
echo "myhostname" >> /etc/hostname
Add matching entries to hosts:
vim /etc/hosts
127.0.0.1 localhost
::1 localhost
127.0.1.1 myhostname.localdomain myhostname
If the system has a permanent IP address, it should be used instead of 127.0.1.1.
Complete the network configuration for the newly installed environment, that may include installing suitable network management
software.
pacman -S networkmanager openssh wireless_tools wpa_supplicant netctl dialog dhcpcd
systemctl enable NetworkManager
For LVM, system encryption or RAID, modify mkinitcpio.conf
:
vim /etc/mkinitcpio.conf
Edit the file and insert lvm2
between block and filesystems like so:
HOOKS=(base udev ... block lvm2 filesystems)
Then recreate the initramfs image:
mkinitcpio -P linux
passwd
Choose GRUB as a Linux-capable boot loader.
pacman -S grub efibootmgr
grub-install --target=x86_64-efi --efi-directory=/boot/EFI --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg
Exit the chroot environment by typing exit
or pressing Ctrl+d
.
Optionally manually unmount all the partitions with umount -R /mnt
: this allows noticing any "busy" partitions, and finding the cause with fuser.
Finally, restart the machine by typing reboot
: any partitions still mounted will be automatically unmounted by systemd. Remember to login into the new system with the root account.
useradd -m -G wheel -s /bin/bash <username>
passwd <username>
EDITOR=vim visudo
Then uncomment %wheel ALL=(ALL) ALL
.
Reboot and check if everything works.
reboot
Xorg is the public, open-source implementation of the X Window System (commonly X11, or X). It is required for running applications with graphical user interfaces (GUIs), and the majority of users will want to install it.
Wayland is a newer, alternative display server protocol and the Weston reference implementation is available.
Here I would install Xorg since the vast majority of native applications that exist were written for Xorg now.
pacman -S xorg-server xorg-apps xort-xinit
One can find the diffrence between Xorg and Wayland by refering to the Xorg, X11, Wayland? Linux Display Servers And Protocols Explained
Install the appropriate driver for AMD or NVIDIA products.
pacman -S xf86-video-nouveau --> Nvidia Card Driver
In Arch Linux, you can install Plasma 5 in three ways:
- plasma-desktop --> minimun weight
- plasma
- plasma-meta
I would install a medium weight plasma
since it contains the most essential packages and is friendly for new beginners of Linux.
pacman -S plasma
Still, we will need to install some essential utilities. Here are the ones I have chosen:
- Web Browser: I would using firefox here.
- Network Manager: Kde has a package named plasma-nm which is included in
plasma
, that can be used to connect to a network (Wifi/Ethernet). - Audio:
plasma
also include a package named plasma-pa, which is PulseAudio integrating for Plasma desktop. - File Manager: Dolphin is the file manager that I prefer to install.
- Terminal: As for terminal, I would install Konsole. It is the default terminal app for KDE.
pacman -S firefox dolphin konsole
Then, configure the networkmanager
for plasma-nm. Disable the original connection. For example, I used dhcpcd
for the Ethernet connection.
systemctl stop dhcpcd
systemctl disable dhcpcd
Enable or restart the NetworkManager
systemctl enable NetworkManager
systemctl start NetworkManager
Most desktop environments include a display manager for automatically starting the graphical environment and managing user logins.
SDDM is recommended for KDE Plasma.
pacman -S sddm
systemctl enable sddm
Reboot and login to the system. You should now have a GUI on Arch Linux, similar to the following picture.
Apart from the essential packages that I have mentioned, you might want to install some other programs that you will need. Here are the ones I have chosen:
- Screenshot Capturer: Spectacle is a utillity for KDE.
- Snipping tool: ksnip is also a utillity for KDE.
- Video Player : I find VLC the best open source video player on both Linux and Windows.
- Photo Viewer : digiKam is mainly developed for KDE, but is a little heavy since it supports many features like editor, organizer, etc.
- Text Editor : Kate works good on KDE and has multi-tab support.
- AUR Helper : I used yay and refered to How to Install Yay AUR Helper in Arch Linux and Manjaro for installation.
pacman -S spectacle vlc digikam kate ksnip
Kudos !! After installing the above packages and yay, you can now start to customized your Arch Linux.
Fcitx5 is the successor of Fcitx, a lightweight input method framework aimed at providing environment-independent language support for Linux.
pacman -S fictx5
Then install a GUI configuration tool for convenient.
pacman -S fictx5-configtool
Set environment variables for IM modules Define the environment variables to register the input method modules. Without these variables, applications may fallback to XIM protocol.
As a general recommendation, define the following environment variables in ~/.pam_environment
. This file will be read by the pam_env module for all logins, including both X11 and Wayland sessions.
GTK_IM_MODULE DEFAULT=fcitx
QT_IM_MODULE DEFAULT=fcitx
XMODIFIERS DEFAULT=\@im=fcitx
or edit /etc/environment
and add the above lines.
pacman -S fcitx5-chewing
pacman -S ttf-android adobe-source-han-sans-tw-fonts opendesktop-fonts
Uncomment the following languages.
zh_TW.BIG-5
zh_TW.UTF-8
Then run:
locale-gen
check locale
or locale -a
for the language setup. Finally, reboot the system.
reboot
For keyring error while upgradeing the system, we need to update the package archlinux-keyring
.
pacman -Sy archlinux-keyring
If that dosen't work, reset the keys by removing the /etc/pacman.d/gnupg
directory and by rerunning pacman-key --init
followed by pacman-key --populate
to re-add the default keys, and pacman-key --refersh-keys
for developer keys.
rm -r /etc/pacman.d/gnupg
pacman-key --init
pacman-key --populate
pacman-key --refresh-keys
Then rerun pacman -Sy archlinux-kerying
to upgrade the system.
If it still dosen't work, please refer to pacman/Package signing - ArchWiki
This is a "one-liner" exemple, you will have to add a lot of exceptions to the one command. Here is what I do.
sudo su
cd /
tar -cvpzf backup.tgz --exclude=/backup.tgz --exclude=/proc
--exclude=/tmp --exclude=/mnt --exclude=/dev --exclude=/sys /
will backup your root and exclude ALL mounted partitions, like /media (you do not want to backup external devices) and you absolutely do NOT want to backup something like /dev , /tmp, or /proc etc.
In above method the backup are stored in /. It will be bettter to store it on an external media later; you can then put a directory in front of the backup.tgz.
- backup.tgz is the backup.
- The
--exclude
will prevent the actual backup to be backupped. - cvpzf: create, verbose, preserve permissions, compress(gzip), use a file.
Restoring would be
sudo su
cd /
tar -xvzf backup.tgz
The -x
stands for decompressoing or extracting file.