XPS 如何安装 Archlinux + Gnome 桌面环境

Posted by 韩同学的笔记本 on March 20, 2020

XPS 安装相对来说比较简单,注意一定要安装 linux-firmware 包。

安装流程

首先执行以下代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
timedatectl set-ntp true
fdisk -l
cfdisk /dev/nvme0n1               # 请更改为你自己的分区
# mkfs.ext4 /dev/nvme0n1p3          # 请更改为你自己的分区

# --- use btrfs ---
mkfs.btrfs /dev/nvme0n1p3
mount /dev/nvme0n1p3 /mnt         # 请更改为你自己的分区
btrfs subvolume create /mnt/@root
btrfs subvolume create /mnt/@var
btrfs subvolume create /mnt/@home
btrfs subvolume create /mnt/@snapshots
umount /mnt
mount -o compress=zstd,subvol=@root /dev/nvme0n1p3 /mnt
mkdir /mnt/{boot,var,home,.snapshots}
mount -o compress=zstd,subvol=@var /dev/nvme0n1p3 /mnt/var
mount -o compress=zstd,subvol=@home /dev/nvme0n1p3 /mnt/home
mount -o compress=zstd,subvol=@snapshots /dev/nvme0n1p3 /mnt/.snapshots
# --- end btrfs ---

mkdir /mnt/boot
mount /dev/nvme0n1p1 /mnt/boot    # 请更改为你自己的分区
swapon /dev/nvme0n1p4             # 请更改为你自己的分区

nano /etc/pacman.d/mirrorlist
pacstrap /mnt base base-devel linux-zen linux-zen-headers # or linux
genfstab -U /mnt >> /mnt/etc/fstab
cat /mnt/etc/fstab
arch-chroot /mnt

ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
hwclock --systohc
nano /etc/locale.gen
locale-gen
nano /etc/hostname
nano /etc/hosts
nano /etc/locale.conf

/etc/locale.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

/etc/hosts

1
2
3
127.0.0.1	localhost
::1 localhost
127.0.1.1	myhostname.localdomain	myhostname
1
2
3
4
5
6
7
8
9
10
11
12
13
14
pacman -S linux-firmware intel-ucode grub efibootmgr os-prober
# pacman -S dialog
# pacman -S linux-lts
mkinitcpio -p linux-zen # or linux
passwd
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=ARCHLINUX
grub-mkconfig -o /boot/grub/grub.cfg
pacman -S gdm gnome gnome-extra
# pacman -S kde-applications plasma plasma-wayland-session sddm kdebase
# systemctl enable sddm
# systemctl enable NetworkManager
systemctl enable NetworkManager gdm
pacman -S nano # or vim
nano /etc/modprobe.d/blacklist.conf

/etc/modprobe.d/blacklist.conf

1
2
3
4
5
blacklist nouveau
blacklist rivafb
blacklist nvidiafb
blacklist rivatv
blacklist nv

将用户加入组

1
2
3
4
5
useradd -U maghsk -m
sudo gpasswd -a maghsk input
sudo gpasswd -a maghsk wheel
# sudo gpasswd -a maghsk bumblebee
visudo

结束安装并重启

1
2
3
4
5
exit
sync
umount /mnt/boot
umount /mnt
reboot

与 Windows 系统时间同步

将以下代码保存为 XXX.bat 然后双击打开。

1
Reg add HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation /v RealTimeIsUniversal /t REG_DWORD /d 1

Windows 映射 Caps LockCtrl

将以下代码保存为 XXX.reg 然后双击打开。

1
2
3
4
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00

有关字体配置

Snapper: change the subvolume of .snapshots

1
2
3
4
5
umount /.snapshots
rm -r /.snapshots
btrfs subvolume delete /.snapshots
mkdir /.snapshots
mount -o compress=zstd,subvol=@snapshots /dev/nvme0n1p3 /.snapshots