manjaro usage

包管理工具

  • pacman / pamac (GUI)
  • AUR
  • snap
  • flatpak

搜索包

初始化

1
2
3
4
# 安装并启用 sshd.service
$ sudo pacman install openssl openssh
$ sudo systemctl enable sshd.service
$ sudo systemctl start sshd.service

pacman

查看帮助

1
2
$ pacman -h
$ pacman -S -h

切换源

1
2
3
4
5
6
# manjaro
# 1. 刷新
$ sudo pacman-mirrors -i -c China -m rank
# 选择合适的源
# 2. 更新
$ sudo pacman -Syy

或选择最近源。

1
$ sudo pacman-mirrors --geoip && sudo pacman -Syyu

参数

1
2
3
4
5
6
7
# -S
-S 安装
-S --needed --noconfirm
--needed: 跳过已经安装到最新版本的包
--noconfirm: 跳过确认

-R 卸载

查看安装的包

1
2
3
4
# 所有安装的包
$ pacman -Q
# 查询指定包
$ pacman -Q vim

搜索包

1
$ pacman -Ss vim

AUR

AUR(Arch User Repository)。

AUR Helpers

AUR helpers 可以帮助我们搜索、下载、编译 AUR 包,常见的 AUR helpers 有 yay、paru等。

Paru

安装

1
2
3
4
$ sudo pacman -S --needed base-devel
$ git clone https://aur.archlinux.org/paru.git
$ cd paru
$ makepkg -si

使用示例

1
2
# 搜索
$ paru -Ss gcc7
1
2
3
4
5
6
7
8
9
10
paru <target> -- Interactively search and install <target>.
paru -- Alias for paru -Syu.
paru -S <target> -- Install a specific package.
paru -Sua -- Upgrade AUR packages.
paru -Qua -- Print available AUR updates.
paru -G <target> -- Download the PKGBUILD and related files of <target>.
paru -Gp <target> -- Print the PKGBUILD of <target>.
paru -Gc <target> -- Print the AUR comments of <target>.
paru --gendb -- Generate the devel database for tracking *-git packages. This is only needed when you initially start using paru.
paru -Bi . -- Build and install a PKGBUILD in the current directory.

其他

可以手动搜索包,然后使用 git clone,并使用命令 makepkg -s 编译,使用命令 makepkg -i 安装,或直接使用 makepkg -is 命令编译安装。也可以通过 pamac 命令使用 aur。

1
2
3
4
5
6
# 安装 pamac
$ pacman -S pamac-cli
# 搜索 aur 包
$ pamac search ttf-ms-fonts --aur
# 安装
$ pamac build ttf-ms-fonts

安装 AUR 包

pamac build pkgp

安装官方包

pamac install pkg