Preface#
This article is only applicable to UEFI boot.
This article is intended for migrating from Windows to Archlinux.
The author does not guarantee that the methods in this article will work on your computer.
This article is shared under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) license.
If there are any errors in the content of the article, please point them out, thank you.
Table of Contents#
0x00 Background
0x01 Backup Data
0x02 Create Installation Media
- Download Image
- Write to USB Drive
0x03 Install System
- Boot from USB Drive
- Connect to Wi-Fi (wired users can skip this)
- Sync pacman
- Disk Partitioning
- Formatting
- Mounting Partitions
- Install System
- Configure Boot
- Exit New System and Unmount
0x04 Configure System
0x05 KDE Configuration
- Fcitx5+Rime
0x06 Software Related
- Quick Software Reference
- Using AUR (Arch User Repository)
- Install yay
- Use yay to install packages
- Run Windows applications using wine
- Run Windows applications using winapps
- Create Windows Virtual Machine
0x07 System Beautification
- GRUB Beautification
- SDDM Beautification
- KDE Beautification
- Plugins
0x08 Appendix
- How to use yay
0x09 References
0x00 Background#
The author's computer has a 512GB NVMe SSD and a 2TB Western Digital Black external (mechanical) hard drive, so the author needs to clone the Windows partition to the external hard drive first, then format everything for Archlinux installation.
0x01 Backup Data#
Use WeiPE and DiskGenius tools for data backup and partition cloning.
Since you may not be able to attend online classes or do exercises in the PE environment, we can first use DiskGenius's partition imaging feature to save the partition image to the external hard drive, and then return to the Windows system to restore the partition image to the external hard drive using DiskGenius (this is because partition imaging is a 4K/sequential read and write operation, while partition restoration is a sequential read 4K/sequential write operation, and the small file read and write speed of SSDs is significantly greater than that of mechanical hard drives).
- Create WeiPE Environment
WeiPE Download Link
The author wrote this under Arch and cannot demonstrate it, so it is recommended to find a tutorial yourself. - Enter the WeiPE environment and use DiskGenius for disk imaging operations.
The author wrote this under Arch and cannot demonstrate it, so it is recommended to find a tutorial yourself. - Return to the Windows environment to restore the hard drive.
The author wrote this under Arch and cannot demonstrate it, so it is recommended to find a tutorial yourself.
Note here that after the restoration is complete, the hard drive will be offline. You need to openComputer -> Management -> Disk Management
, right-click the external hard drive and clickOnline
, and Disk Management will reassign the serial number to the partition.
0x02 Create Installation Media#
Download Image#
First, download the ISO image: Official Download Link, it is recommended to scroll down to find mirrors in China for download.
Write to USB Drive#
Then write to the USB drive, it is recommended to use Rufus tool, select GPT for partition type instead of the default MBR, and use DD for the write method instead of ISO.
0x03 Install System#
Connect to Wi-Fi (wired users can skip this)#
- Enter
iwctl
to access the iwd command line. - Enter
device list
to view wireless network card devices. - Assuming the wireless network card is
wlan0
, enterstation wlan0 scan
to scan for networks. - Enter
station wlan0 get-networks
to view the scanned networks. - Assuming the SSID of the network to connect to is
114514
, enterstation wlan0 connect 114514
, and if there is a password, enter it. - Enter
exit
to exit the iwd command line.
Sync pacman#
Enter the following command, which will automatically select the fastest mirror source and replace it:
reflector -c China --sort rate --save /etc/pacman.d/mirrorlist
After completion, enter pacman -Syyy
to sync the pacman source (as shown in the image).
Partition Formatting#
Assuming the partition is nvme0n1p2
, enter the following command:
mkfs.ext4 /dev/nvme0n1p2
Mounting Partitions#
- Mount the partition where the system will be installed to
/mnt
:
mount /dev/nvme0n1p2 /mnt
- Create the
/mnt/boot
folder:
mkdir /mnt/boot
- Mount the EFI partition to
/mnt/boot
, assuming the EFI partition isnvme0n1p1
:
mount /dev/nvme0n1p1 /mnt/boot
Install System#
- Execute the following command to install the basic system:
pacstrap /mnt base linux linux-firmware nano
- Generate the fstab file:
genfstab -U /mnt >> /mnt/etc/fstab
- Switch to the installed system:
arch-chroot /mnt
- Create a swapfile:
dd if=/dev/zero of=/swapfile bs=2048 count=1048576 status=progress # Create swapfile
chmod 600 /swapfile # Change permissions
mkswap /swapfile # Create swap
swapon /swapfile # Activate swap
- Modify fstab to support swapfile.
Enternano /etc/fstab
, add/swapfile none swap defaults 0 0
at the end of the file, then pressCtrl+O Enter Ctrl+X
in order to save and exit. - Set the timezone:
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
- Sync hardware clock:
hwclock --systohc
- Set locale, enter
nano /etc/locale.gen
, pressCtrl+W
and then input#en_US
Enter
, find UTF-8,delete the hash
to uncomment it, thenCtrl+W
search#zh_CN
Enter
, find UTF-8,delete the hash
to uncomment it, and then pressCtrl+O Enter Ctrl+X
in order to save and exit. - Generate locale:
locale-gen
- Create and write to the
/etc/locale.conf
file.
Enternano /etc/locale.conf
, fill inLANG=en_US.UTF-8
, then pressCtrl+O Enter Ctrl+X
in order to save and exit. - Create and write to hostname.
Enternano /etc/hostname
, fill in the hostname you want to use (e.g.,jindan
), then pressCtrl+O Enter Ctrl+X
in order to save and exit. - Write to hosts.
Enternano /etc/hosts
, write the content as shown in the image, then pressCtrl+O Enter Ctrl+X
in order to save and exit (temporarily using an image from a Zhihu expert, see the references section at the end of the article).
- Create a password for the root user:
passwd
Then enter and confirm the password (the password in the Linux terminal does not echo, just press Enter after typing).
Configure Boot#
- Install GRUB package and other necessary packages:
pacman -S grub efibootmgr networkmanager network-manager-applet dialog wireless_tools wpa_supplicant os-prober mtools dosfstools ntfs-3g base-devel linux-headers reflector git sudo
- Install microcode.
If it is an Intel CPU, install Intel's microcode files:
pacman -S intel-ucode
If it is an AMD CPU, install AMD's microcode files:
pacman -S amd-ucode
- If you have other systems to boot (especially Windows), enable OS Prober to automatically detect other systems.
Enternano /etc/default/grub
to access nano, addGRUB_DISABLE_OS_PROBER=false
at the end, then pressCtrl+O Enter Ctrl+X
in order to save and exit. - Install GRUB:
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=Arch
grub-mkconfig -o /boot/grub/grub.cfg
Exit New System and Unmount#
exit
umount -a
reboot
0x04 Configure System#
- Start network service:
systemctl enable --now NetworkManager
- Connect to Wi-Fi (wired users can skip this):
nmtui
- Create a new user and grant permissions.
Assuming the username isjindan
, enter:
useradd -m -G wheel jindan
- Set password for the new user:
passwd jindan
Enter and confirm the password.
5. Grant permissions.
Enter EDITOR=nano visudo
to access nano, Ctrl+W
input # %wheel
Enter
, delete the hash
to uncomment it, then press Ctrl+O Enter Ctrl+X
in order to save and exit.
6. Install graphics card driver.
Install AMD graphics card driver:
pacman -S xf86-video-amdgpu
Install NVIDIA graphics card driver:
pacman -S nvidia nvidia-utils
- Install Display Server (xorg):
pacman -S xorg
- Install Display Manager.
Gnome:
pacman -S gdm
KDE:
pacman -S sddm
Xfce / DDE:
pacman -S lightdm lightdm-gtk-greeter
- Set to start automatically on boot, assuming KDE (
sddm
) is installed:
systemctl enable sddm
- Install Desktop Environment.
Gnome:
pacman -S gnome
KDE:
pacman -S plasma kde-applications packagekit-qt5
Xfce:
pacman -S xfce4 xfce4-goodies
DDE:
pacman -S deepin deepin-extra
- Add archlinuxcn source.
Enternano /etc/pacman.conf
, write the content as shown in the code block below, anduncomment the multilib source
, then pressCtrl+O Enter Ctrl+X
in order to save and exit.
## Aliyun (Global CDN) (ipv4, ipv6, http, https)
## Added: 2020-07-03
[archlinuxcn]
Server = https://mirrors.aliyun.com/archlinuxcn/$arch
- Sync pacman source and install keyring:
pacman -Syu && pacman -S archlinuxcn-keyring
- Install fonts:
pacman -S ttf-sarasa-gothic noto-fonts-cjk
- Restart:
reboot
0x05 KDE Configuration#
Fcitx5+Rime#
Fcitx5 is the new generation input method framework following Fcitx.
Rime (Zhongzhou Yun Input Method Engine) is an input method engine that supports multiple input schemes.
Rime itself does not provide a frontend for handling user input and needs to work with an input method framework, such as Fcitx5 (Simplified Chinese) or IBus (Simplified Chinese).
- Enter the following command to install:
sudo su
pacman -S fcitx5-im
echo "GTK_IM_MODULE=fcitx" >> /etc/environment
echo "QT_IM_MODULE=fcitx" >> /etc/environment
echo "XMODIFIERS=@im=fcitx" >> /etc/environment
echo "INPUT_METHOD=fcitx" >> /etc/environment
echo "SDL_IM_MODULE=fcitx" >> /etc/environment
cp /usr/share/applications/org.fcitx.Fcitx5.desktop ~/.config/autostart/
pacman -S fcitx5-rime
exit
After installation, a restart may be required.
2. Add input method:
4. Set to Simplified Chinese:
0x06 Software Related#
A All functions are available
X Not available
/ Not tested
Note: The deepin-wine package in AUR is also considered as native/AUR
category.
Name | Native/AUR | Wine | WinApps |
---|---|---|---|
X | / | / | |
A | / | / | |
DingTalk | Cannot conduct meetings | / | / |
Microsoft Office | X | / | A |
Using AUR (Arch User Repository)#
The Arch User Repository (AUR) is a user-driven repository for Arch software. Packages in AUR are provided in the form of package build scripts (PKGBUILD), and users generate packages themselves using makepkg, which are then installed by pacman. The purpose of creating AUR is to facilitate users in maintaining and sharing new packages, and official packages are periodically selected from it to enter the community repository.
When you want to install any software, you can first visit the AUR official website to check if the software you need is available. If it is, you can directly use yay to install it. The installation and usage methods of yay are described below.
Install yay#
yay is a tool for quickly installing AUR packages.
- Install git:
sudo pacman -S git
- Clone the yay repository:
git clone https://aur.archlinux.org/yay.git
- Build and install:
cd yay
makepkg -si
Use yay to install packages#
Enter yay -S <package_name>
to install. If asked whether to show differences, enter n
and press Enter to ignore, otherwise enter y
and press Enter to confirm.
For more information, please refer to the How to use yay
section in the Appendix
.
Create Windows Virtual Machine#
- Install KVM and Virtual Machine Manager:
pacman -S virt-manager
- Download Windows 10 ISO and virtio drivers.
Windows 10 ISO: https://www.microsoft.com/en-us/software-download/windows10ISO (Windows 11 is also acceptable)
VirtIO drivers: https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso - Open
Virtual Machine Manager
:
Then clickEdit -> Preferences
, enableEnable XML editing
(as shown).
- Click
File -> Add Connection
, ensure the settings are the same as in the image, and clickConnect
.
- Click to create a new virtual machine:
- Select
QEMU/KVM
connection, clickForward
(as shown).
- Select the image (as shown).
- Set memory and CPU, it is recommended to set to 4096MB, this is actually the maximum memory usage (the author is too lazy and directly used the official document's image).
- Choose the size of your virtual disk, remember this is the maximum size the disk will grow to, but it will not occupy this space until it needs it.
- Next, name your machine, name it RDPWindows so that WinApps can detect it, then select Customize configuration before install.
- Click Finish, ensure that Copy host CPU configuration under CPU is selected, then Apply.
- Next, go to the
XML
tab and edit the<clock>
section to include:
<clock offset='localtime'>
<timer name='hpet' present='yes'/>
<timer name='hypervclock' present='yes'/>
</clock>
Then Apply, this will greatly reduce idle CPU usage (from ~25% to ~3%).
Then you can start the system for a normal Windows installation.
0x07 System Beautification#
GRUB Beautification#
- Choose a favorite theme and download it.
You can find GRUB themes on the Gnome-look website. Click on the theme you like to enter its homepage, clickFiles
, and select the corresponding version to download (as shown).
- Script installation.
The theme I chose isGrub-theme-vimix
. After unzipping, you can find that the theme comes with aninstall.sh
script, which can be used for installation. Enter:
bash install.sh
- Manual installation.
Waiting for supplement.
SDDM Beautification#
yay -S sddm-config-editor-git
yay -S archlinux-themes-sddm
Then search and open SDDM Configuration
, click on the theme to change it. If you are using the plasma default theme, you can use breeze (as shown).
KDE Beautification#
Plugins#
- Awesome Widget can display custom system parameters.
- Weather Widget will display the weather in both icon and table formats.
- Global Menu used in conjunction with Application title achieves a MacOS effect, making the interface more beautiful and operations more convenient.
- Panon sound visualization plugin.
- Event Calendar for quick task addition, displaying weather, dates, and holidays.
0x08 Appendix#
How to use yay#
When using the Arch User Repository, AUR tools can automate certain tasks:
- Search for packages published in AUR.
- Resolve dependencies between AUR packages.
- Download AUR packages.
- Download website content, such as user comments.
- Submit AUR packages.
pacman only handles updates for pre-built packages in its repository. AUR packages are redistributed in the form of PKGBUILD and require an AUR helper to automate the build process. However, please note that even if the package itself has not been updated, you may still need to rebuild certain packages due to updates in some library files.
It will not check for updates for AUR packages, so some tools can also automatically check for updates from AUR and rebuild new versions of packages. Please note that even if the package itself has not been updated, you may still need to rebuild certain packages due to updates in some library files.
Basic Usage#
yay -S <package_name> # Search for package in AUR and install
yay -Ss <package_name> # Search for package in AUR and official sources
yay -Si <package_name> # Get package information in AUR
yay -U <package_path> # Install local package
yay -Pu # Check for updates
yay -Sy # Sync
yay -Syu # Update system
yay -Syua # Update system and already installed AUR packages
yay -Yc # Remove unnecessary dependencies
yay -R <package_name> # Remove package
yay -Rs <package_name> # Remove package and its dependencies
yay -Rnsc <package_name> # Remove package, dependencies, and configuration files
0x09 References#
- ArchWiki: Your online Arch Linux documentation library (official Wiki)
- 2021 Archlinux dual system installation tutorial (super detailed) (Zhihu) Author: ayamir
- Linux Grub boot interface (startup interface) beautification (Zhihu) Author: Kuari
- KDE beautification journey (Zhihu) Author: Zhihu user 9g4W9C
As a beginner in Archlinux, I sincerely thank the authors of the above reference materials.
Thanks to @Hello for reporting errors.