在 Arch Linux 上安裝 Yaourt 的兩種方法

YAOURT 是 Yet Another User Repository Tool 的縮寫。 它是一個自動化 AUR 包安裝的工具。 需要這樣的工具才能在 Arch Linux 和基於它的系統(如 Manjaro Linux 或 Antergos)中輕鬆安裝用戶存儲庫包。 在本文中,我將向您展示如何在 Arch Linux 2018 上安裝 Yaourt。

兩種安裝方式

由於 Yaourt 本身是一個 AUR 包,這意味著它在默認情況下不受 pacman 支持,我們有兩種安裝方式。

其中之一是從 AUR 構建包,另一個是添加自定義存儲庫並使用 pacman 下載它。 我們將探討這兩種方法。 儘管它們不同,但它們有一個共同的步驟。 首先,我們需要更新您的存儲庫和軟件包

$ sudo pacman -Syu
:: Synchronizing package databases...
 core is up to date
 extra is up to date
 community is up to date
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...

現在安裝我們將為 yaourt 提供幫助的軟件包。

$ sudo pacman -S --needed base-devel git wget yajl
:: There are 26 members in group base-devel:
:: Repository core
   1) autoconf  2) automake  3) binutils  4) bison  5) fakeroot  6) file
   7) findutils  8) flex  9) gawk  10) gcc  11) gettext  12) grep  13) groff
   14) gzip  15) libtool  16) m4  17) make  18) pacman  19) patch
   20) pkg-config  21) sed  22) sudo  23) systemd  24) texinfo  25) util-linux
   26) which

Enter a selection (default=all): 

按 Enter 當提示詢問時進行默認選擇。

1) 從 AUR 構建

與所有 AUR 包一樣,您需要做的第一件事是獲取構建文件。 需要一個僅 AUR 的依賴項 – 包查詢。

$ cd /opt

現在克隆包查詢

$ git clone https://aur.archlinux.org/package-query.git
Cloning into 'package-query'...
remote: Counting objects: 45, done.

Enter 包目錄

$ cd package-query

安裝軟件包。

$ makepkg -si

現在克隆yaourt repo

$ git clone https://aur.archlinux.org/yaourt.git
Cloning into 'yaourt'...
remote: Counting objects: 26, done.

對 yaourt 包本身執行相同的操作:

# cd /opt/yaourt && makepkg -si
==> Making package: yaourt 1.9-1 (Sat Feb 3 03:36:28 WAT 2018)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...

就這些!

2) 使用自定義存儲庫安裝 Yaourt

您必須將自定義存儲庫添加到您的 pacman 存儲庫列表中。 所以用你最喜歡的文本編輯器編輯 pacman 配置文件。 我們將使用vim。

$ sudo vim nano /etc/pacman.conf

在底部添加這段文字:

[archlinuxfr]
SigLevel = Never
Server = https://repo.archlinux.fr/$arch

Save 文件。 然後,您可以安裝該軟件包:

$ sudo pacman -Sy yaourt
$ sudo pacman -Sy yaourt
:: Synchronizing package databases...
 archlinuxfr               12.1 KiB  80.6K/s 00:00 [######################] 100%
 core is up to date
 extra is up to date
 community is up to date
warning: yaourt-1.9-1 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (1) yaourt-1.9-1

因為我已經安裝了 yaourt,所以您可以在我的輸出中看到我有一條警告消息,告訴我 yaourt 已安裝並且是最新的,但它會嘗試重新安裝。

如何使用yaourt(幾個例子)

除了使用 Yaourt 下載和安裝 AUR 包之外,您還可以將其用作 pacman 的替代品,並使用它安裝任何非 AUR 包。 只需輸入:

$ yaourt -S htop
resolving dependencies...
looking for conflicting packages...

Packages (1) htop-2.0.2-2

Total Download Size:   0.07 MiB
Total Installed Size:  0.19 MiB

:: Proceed with installation? [Y/n] 

就像你對吃豆子一樣。 這 -Sy, -Syu 選項正常同步數據庫,升級包:

$ yaourt -Syu
:: Synchronizing package databases...
 archlinuxfr is up to date
 core is up to date
 extra is up to date
 community is up to date

此外與 --devel --aur 選項,它可以搜索 aur 和 devel(所有基於 dev 版本的包)升級:

$ yaourt -Syu --aur --devel
:: Synchronizing package databases...
 archlinuxfr is up to date
 core is up to date
 extra is up to date
 community is up to date
==> upgrading SVN/CVS/HG/GIT package

您可以列出所有可用的軟件包並選擇要安裝的軟件包

$ yaourt list
1 core/acl 2.2.52-4 [installed]
 Access control list utilities, libraries and headers
2 core/libmnl 1.0.4-1 [installed]
 Minimalistic user-space library oriented to Netlink developers.
3 core/libpsl 0.19.1-1 [installed]
.......
.......
643 aur/zmeventserver-git 20171227.b6a8eca-2 (0) (0.00)
 A WSS (Secure Web Sockets) based event notification server that broadcasts new events to any 
 authenticated listeners.
==> Enter n° of packages to be installed (e.g., 1 2 3 or 1-3)
==> ---------------------------------------------------------
==>

讓我們知道您對本文的評論。 祝你有美好的一天。