安装 Arch Linux 操作系统里,我们已经安装了一个基础的「Arch Linux」,但它只是一个毛坯房,明显无法作为个人主机使用。

Arch Linux 默认配置禁止了 root 用户的直接远程访问,个人也不建议开放 root 用户的直接远程访问。接下来我们使用新建用户登录进行操作(我的是 JZY),在操作过程中可能需要你频繁输入密码。

配置 Arch Linuxcn 源

Arch Linuxcn
ArchLinuxCN 是一个由 Arch Linux 中文社区维护的非官方软件仓库。它包含了一些在官方仓库中找不到的、特别适合中国用户的软件包,以及一些常用的中文支持软件。
镜像站国内源是镜像 Arch Linux 官方软件仓库的内容,要把 Arch Linuxcn 和镜像站国内源区分开。

编辑 Pacman 配置文件

[JZY@JZY ~]$ sudo vim /etc/pacman.conf

在末尾加入:

# An example of a custom package repository.  See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs

[archlinuxcn]
Server = https://mirrors.ustc.edu.cn/archlinuxcn/$arch

更新软件包数据库

[JZY@JZY ~]$ sudo pacman  -Suyy
:: Synchronizing package databases...
 core                                                                                      118.0 KiB  1072 KiB/s 00:00 [#######################################################################] 100%
 extra                                                                                       7.5 MiB  6.06 MiB/s 00:01 [#######################################################################] 100%
 archlinuxcn                                                                              1374.2 KiB  4.92 MiB/s 00:00 [#######################################################################] 100%
:: Starting full system upgrade...
 there is nothing to do
[JZY@JZY ~]$

安装「archlinuxcn-keyring」

「archlinuxcn-keyring」
「archlinuxcn-keyring」是一个包含 GPG 密钥的软件包,这些密钥用于验证从「Arch Linuxcn」社区仓库下载的软件包的签名。确保使用正确的 GPG 密钥对于维护系统的安全性和完整性至关重要,因为这可以防止安装被篡改或未授权的软件包。
[JZY@JZY ~]$ sudo pacman -S archlinuxcn-keyring
resolving dependencies...
looking for conflicting packages...

Packages (1) archlinuxcn-keyring-20240531-2

Total Download Size:   0.19 MiB
Total Installed Size:  0.26 MiB

:: Proceed with installation? [Y/n] y
:: Retrieving packages...
 archlinuxcn-keyring-20240531-2-any                                                        190.0 KiB   672 KiB/s 00:00 [#######################################################################] 100%
(1/1) checking keys in keyring                                                                                         [#######################################################################] 100%
(1/1) checking package integrity                                                                                       [#######################################################################] 100%
(1/1) loading package files                                                                                            [#############################################################
-------------------------------------------------------------------省略---------------------------------------------------------------------------------------------------------------
gpg: depth: 0  valid:   1  signed:  50  trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: depth: 1  valid:  50  signed:  99  trust: 0-, 0q, 0n, 50m, 0f, 0u
gpg: depth: 2  valid:  77  signed:  22  trust: 77-, 0q, 0n, 0m, 0f, 0u
gpg: next trustdb check due at 2025-01-01
Optional dependencies for archlinuxcn-keyring
    pkgstats: install to submit package usage statistics
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...
[JZY@JZY ~]$

再次更新软件包数据库以验证签名验证正常工作

[JZY@JZY ~]$ sudo pacman -Syu
:: Synchronizing package databases...
 core is up to date
 extra is up to date
 archlinuxcn is up to date
:: Starting full system upgrade...
 there is nothing to do
[JZY@JZY ~]$

安装 paru

「Paru」
「Paru」是一个非官方的「AUR」(Arch User Repository) 辅助工具,它扩展了「pacman」的功能来管理「AUR 包。它能够自动处理依赖关系,并且可以用来搜索、安装和更新「AUR」中的软件包。

确保「Git」和「base-devel」组已安装

[JZY@JZY ~]$ sudo pacman -S --needed git base-devel
warning: base-devel-1-2 is up to date -- skipping
resolving dependencies...
looking for conflicting packages...

Packages (4) perl-error-0.17029-7  perl-mailtools-2.22-1  perl-timedate-2.33-7  git-2.47.1-1

Total Download Size:    6.62 MiB
Total Installed Size:  28.51 MiB

:: Proceed with installation? [Y/n] y
:: Retrieving packages...
 git-2.47.1-1-x86_64                                                                         6.5 MiB  2.65 MiB/s 00:02 [#######################################################################] 100%
 perl-mailtools-2.22-1-any                                                                  58.1 KiB  1096 KiB/s 00:00 [#######################################################################] 100%
 perl-timedate-2.33-7-any                                                                   33.1 KiB   249 KiB/s 00:00 [#######################################################################] 100%
 perl-error-0.17029-7-any                                                                   21.4 KiB   165 KiB/s 00:00 [#######################################################################] 100%
 Total (4/4)                                                                                 6.6 MiB  2.12 MiB/s 00:03 [#######################################################################] 100%
-------------------------------------------------------------------省略---------------------------------------------------------------------------------------------------------------
:: Running post-transaction hooks...
(1/4) Creating system user accounts...
Creating group 'git' with GID 971.
Creating user 'git' (git daemon user) with UID 971 and GID 971.
(2/4) Reloading system manager configuration...
(3/4) Arming ConditionNeedsUpdate...
(4/4) Warn about old perl modules
[JZY@JZY ~]$

下载「Paru」

[JZY@JZY ~]$ sudo git clone https://aur.archlinux.org/paru.git
Cloning into 'paru'...
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint:   git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint:   git branch -m <name>
remote: Enumerating objects: 188, done.
remote: Counting objects: 100% (188/188), done.
remote: Compressing objects: 100% (132/132), done.
remote: Total 188 (delta 57), reused 187 (delta 56), pack-reused 0 (from 0)
Receiving objects: 100% (188/188), 59.81 KiB | 213.00 KiB/s, done.
Resolving deltas: 100% (57/57), done.
[JZY@JZY ~]$

编译「Paru」

[JZY@JZY ~]$ cd paru
[JZY@JZY paru]$ makepkg -si
==> Making package: paru 2.0.4-1 (Fri 27 Dec 2024 02:55:21 PM CST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Installing missing dependencies...

-------------------------------------------------------------------省略---------------------------------------------------------------------------------------------------------------
Enter a number (default=1):         ## 不用管,直接回车
-------------------------------------------------------------------省略---------------------------------------------------------------------------------------------------------------
:: Proceed with installation? [Y/n] y
:: Retrieving packages...
 rust-1:1.83.0-1-x86_64                                                                     66.3 MiB  4.14 MiB/s 00:16 [#######################################################################] 100%
 llvm-libs-18.1.8-5-x86_64                                                                  33.5 MiB  4.45 MiB/s 00:08 [#######################################################################] 100%
-------------------------------------------------------------------省略---------------------------------------------------------------------------------------------------------------
Optional dependencies for paru
    bat: colored pkgbuild printing
    devtools: build in chroot and downloading pkgbuilds
(2/2) installing paru-debug                                                                             [#######################################################################] 100%
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...
[JZY@JZY paru]$ cd ~
[JZY@JZY ~]$

如果「makepkg -si」时,报错「You do not have write permission for the directory $BUILDDIR (/home/JZY/paru).」。「/home/JZY/paru」替换为实际的目录。

[JZY@JZY paru]$ sudo chown -R $USER:$USER /home/JZY/paru

请耐心等候。有时因为与「github.com」网络原因会导致失败,不用担心,一直「makepkg -si」,直到成功。

配置 hyprland

安装「hyprland」

[JZY@JZY paru]$ sudo pacman -Sy hyprland
© 转载需要保留原始链接,未经明确许可,禁止商业使用。CC BY-NC-ND 4.0