在 Arch Linux 上安装和使用 Yay
AUR Yay
![](/data/attachment/album/202310/14/224808sb66bbdrd4zrqk6q.jpg)



> 
> Yay 是最流行的 AUR 助手之一，用于处理 Arch 用户资源库中的软件包。学习在 Arch Linux 中安装它。
> 
> 
> 


你可以在 <ruby> <a href="https://itsfoss.com/aur-arch-linux/">  Arch 用户仓库 </a> <rt>  Arch User Repository </rt></ruby>（AUR）中找到社区成员打包的大量软件。


由于它来自第三方，纯粹主义者建议从 AUR 手动下载并构建每个所需的包。


但这是一项乏味的任务，这就是为什么会有 AUR 助手来避免麻烦。


Yay 是最受欢迎的 AUR 帮助程序之一，在本教程中，我将分享如何在 Arch Linux 上安装 Yay。我还将分享一些有关使用 Yay 管理 AUR 包的技巧。



> 
> ? Yay 可在 Manjaro 的仓库中找到。因此，Manjaro 用户只需使用 `pacman -S yay` 即可安装
> 
> 
> 


### 在 Arch Linux 上安装 Yay


在继续安装 Yay 之前，你需要一些构建它所需的软件包。


让我把它分成几个步骤。


#### 步骤 1：安装必备包


首先刷新包缓存并更新系统是一个好主意：



```
sudo pacman -Syu

```

安装所需的 `base-devel`（包含 `makepkg` 等工具）和 `git`（克隆 yay 的 Git 仓库所需的）。



```
sudo pacman -S --needed base-devel git

```

使用 `--needed` 标志，它不会重新安装已经安装的软件包。


它看起来是这样的：


![](/data/attachment/album/202310/14/224809dpa4pvt60k09bt4k.png)


现在你已经有了所需的软件包，是时候在你的系统上安装 [Yay](https://github.com/Jguer/yay)。


#### 步骤 2：克隆 Yay Git 仓库并切换到它


[使用 git 命令](https://itsfoss.com/basic-git-commands-cheat-sheet/) “克隆” Yay 仓库。你可以在系统中的任何位置执行此操作，无论是主目录还是其他目录。



```
git clone https://aur.archlinux.org/yay.git

```

完成后，切换到克隆的目录：



```
cd yay

```

![](/data/attachment/album/202310/14/224809owwm5kc2cqicz6g6.png)


终于可以安装 Yay 了。


#### 步骤 3：安装 Yay


事实上，你是在构建它。你将在此处看到 `PKGBUILD` 文件。使用以下命令从此处构建包：



```
makepkg -si

```

按照屏幕上的说明进行操作。当系统要求你确认时，按 `Y`。


![](/data/attachment/album/202310/14/224810yh0yhlklkym5kzkw.png)


该过程完成后，通过检查其版本来验证 Yay 是否已成功安装。



```
yay --version

```

现在你已经成功安装了它，你可以删除克隆的 Yay Git 仓库。不再需要它了。


### 使用 Yay 进行包管理


Yay 遵循与 [pacman](https://itsfoss.com/pacman-command/) 类似（但不相同）的命令结构。所以你用 Yay 管理 AUR 包应该不难。


搜索软件包：



```
yay search_term

```

安装软件包：



```
yay -S package_name

```

删除软件包：



```
yay -R package_name

```

要删除包及其依赖项：



```
yay -Rns package_name

```

仅升级 AUR 包：



```
yay -Sua

```

Yay 还能够升级非 AUR 软件包。上面的 `a` 标志将其限制为 AUR。


### 将 Yay 升级到新版本


现在，你可能想知道如何将 Yay 升级到可用的新版本。


答案是你不需要做任何特别的事情。当你运行以下命令时，Yay 可以自行更新：



```
yay -Sua

```

### 从 Arch 系统中删除 Yay


如果你不喜欢 Yay 或不再需要它，你可以使用 `pacman` 命令像删除任何其他软件包一样删除它：



```
sudo pacman -Rs yay

```

### 总结


这是对 Yay AUR 助手的快速介绍。你可以访问其 GitHub 仓库以了解有关其工作的更多详细信息。


Arch 用户仓库（AUR）是[为什么有些人喜欢使用 Arch Linux](https://itsfoss.com/why-arch-linux/) 的原因之一。


虽然纯粹的 Arch 用户一般都会嘲笑 AUR，特别是 [AUR 助手](https://itsfoss.com/best-aur-helpers/)，但它们仍然因其提供的易用性而受到欢迎。


我希望你发现这个快速教程有助于在 [Arch Linux](https://archlinux.org/) 上获得 Yay。如果你仍有疑问或发现任何技术错误，请告诉我。


*（题图：MJ/f01331ab-ee70-45c4-8fd1-163e63497a6a）*




---


via: <https://itsfoss.com/install-yay-arch-linux/>


作者：[Abhishek Prakash](https://itsfoss.com/author/abhishek/) 选题：[lujun9972](https://github.com/lujun9972) 译者：[geekpi](https://github.com/geekpi) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
![Warp Terminal](/assets/images/warp-terminal.webp)


![Warp Terminal](/assets/images/warp-terminal.webp)

You'll find a huge number of software packaged by the community members in [Arch User Repository](https://itsfoss.com/aur-arch-linux/) (AUR).

Since it is coming from third parties, purists suggest downloading and building each desired package from AUR manually.

But that's a tedious task and that's why AUR helpers were created to save the trouble.

Yay is one of the most popular AUR helpers and in this tutorial, I'll share how you can install Yay on Arch Linux. I'll also share a few tips on managing packages from AUR with Yay.

## Installing Yay on Arch Linux

Before you go on with Yay installation, you need some packages required to build it.

Let me divide it into steps.

### Step 1: Install the prerequisite packages

It is always a good idea to refresh the package cache and update the system first:

`sudo pacman -Syu`


Install the rerquired `base-devel`

(contains tools such as `makepkg`

etc) and git (required for cloning the yay git repository).

```
sudo pacman -S --needed base-devel git
```


With the `--needed`

flag, it will NOT reinstall the already installed packages.

Here's what it looks like:

![](https://itsfoss.com/content/images/2023/10/install-prerequisite-yay.png)

Now that you have the required packages, it's time to get [Yay](https://github.com/Jguer/yay) on your system.

### Step 2: Clone the Yay git repo and switch to it

[Use the git command](https://itsfoss.com/basic-git-commands-cheat-sheet/) to 'clone' the Yay repo. You can do it anywhere in the system, be it your home directory or otherwise.

`git clone https://aur.archlinux.org/yay.git`


Once done, switch to the cloned directory:

`cd yay`


![Clone yay git repo](https://itsfoss.com/content/images/2023/10/git-clone-yay.png)

It's time to install yay (finally).

### Step 3: Install yay

Actually, you are building it. You'll see a PKGBUILD file here. Use the following command to build the package from here:

`makepkg -si`


Follow the on-screen instructions. Press Y when you are asked to confirm.

![Build yay package in arch Linux](https://itsfoss.com/content/images/2023/10/building-yay-package.png)

Once the process finishes, verify that yay has been installed successfully by checking its version.

`yay --version`


Now that you have successfully installed it, you may remove the cloned Yay git repository. It is not needed anymore.

[Proton Mail: Get a private, secure, and encrypted email account | ProtonProton Mail is the world’s largest secure email service with over 100 million users. Available on Web, iOS, Android, and desktop. Protected by Swiss privacy law.](https://go.getproton.me/aff_c?offer_id=26&aff_id=1173&url_id=267)![](https://proton.me/images/social/proton-mail-og.png)


![](https://proton.me/images/social/proton-mail-og.png)

## Using Yay for package management

The yay follows similar (but not identical) command structure as [pacman](https://itsfoss.com/pacman-command/). So it should not be difficult for you to manage AUR packages with Yay.

Search for packages with:

`yay search_term`


Install the packages with:

`yay -S package_name`


Remove packages with:

`yay -R package_name`


To delete a package with its dependencies:

`yay -Rns package_name`


Upgrading (only) the AUR packages:

`yay -Sua`


![Updating Yay on Arch Linux](https://itsfoss.com/content/images/2024/02/updating-yay-arch-linux.png)

Also, it is recommended to not use sudo with yay. You'll be asked to enter the account password when it actually starts to install a package on your system.

## Upgrading Yay to a new version

Now, you may wonder how you can upgrade Yay to a newer version when it's available.

The answer is that you don't have to do anything special. Yay can update itself when you run the command:

`yay -Sua`


## Removing Yay from your Arch system

If you don't like Yay or no longer need it anymore, you can remove it like any other package with the pacman command:

`sudo pacman -Rs yay`


[Learn Linux Quickly - Linux Commands Book for BeginnersLearn Linux Quickly doesn’t assume any prior Linux knowledge, which makes it a perfect fit for beginners. Nevertheless, intermediate and advanced Linux users will still find this book very useful as it goes through a wide range of topics. Learn Linux Quickly will teach you the following topics:Insta…](https://linuxhandbook.gumroad.com/l/mEsrwA)![](https://public-files.gumroad.com/ecjyjb71cmsww7i7srgezk6cq7tg)


## Conclusion

That was a quick introduction to Yay AUR helper. You can visit its GitHub repository for more details on its working.

[GitHub - Jguer/yay: Yet another Yogurt - An AUR Helper written in GoYet another Yogurt - An AUR Helper written in Go. Contribute to Jguer/yay development by creating an account on GitHub.](https://github.com/Jguer/yay)![](https://opengraph.githubassets.com/ba2d9f4158efde8c5b028350bc68b04fe0b2f3b0dd5e0960ad415688bed0412f/Jguer/yay)


Arch User Repository (AUR) is one of the reasons [why some people love using Arch Linux](https://itsfoss.com/why-arch-linux/).

While purists Arch users scoff at AUR in general and [AUR helpers](https://itsfoss.com/best-aur-helpers/) in particular, they remain popular for the ease of use they provide.

I hope you find this quick tutorial helpful in getting Yay on [Arch Linux](https://archlinux.org/). Please let me know if you still have questions or if you notice any technical inaccuracies.