虽然ArchLinux官方已经提供了大量的程序包,不过还是有些包找不到,比如说cockpit,这时候就需要使用AUR(Archlinux User Repository)里面的包了,首先是得安装yaourt工具,这样就可以跟pacman一样直接装AUR里面的包
需要注意:安装yaourt过程不能用root用户,必须用普通用户!!另外需要提前先装好base-devel
$ curl -o yaourt.tar.gz https://aur.archlinux.org/cgit/aur.git/snapshot/yaourt.tar.gz
$ tar -zxvf yaourt.tar.gz
$ cd yaourt
$ makepkg -rsi
这个时侯会报错,当前用户没在sudoers里面,原因是我装ArchLinux的时候只安装了base和base-devel,里面没有带sudo的工具都,囧~
[lpwm@MyArch yaourt]$ makepkg -rsi
==> Making package: yaourt 1.9-1 (Tue May 8 15:14:36 CST 2018)
==> Checking runtime dependencies...
==> Installing missing dependencies...
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
[sudo] password for lpwm:
lpwm is not in the sudoers file. This incident will be reported.
==> ERROR: 'pacman' failed to install missing dependencies.
[lpwm@MyArch yaourt]$ su
Password:
[root@MyArch yaourt]# pacman -S sudo
[root@MyArch yaourt]# visudo //编辑sudo的配置
找到## User privilege specification注释,在root ALL=(ALL) ALL下面增加一行
lpwm ALL=(ALL) ALL
$ vi ~/.bashrc
末尾增加
export VISUAL="vim"
重新执行编译安装
[lpwm@MyArch yaourt]$ makepkg -rsi
==> Making package: yaourt 1.9-1 (Tue May 8 15:27:38 CST 2018)
==> Checking runtime dependencies...
==> Installing missing dependencies...
resolving dependencies...
looking for conflicting packages...
Packages (2) yajl-2.1.0-1 package-query-1.9-2
Total Download Size: 0.06 MiB
Total Installed Size: 0.22 MiB
:: Proceed with installation? [Y/n]
# vim /etc/pacman.conf
在[options]下面增加内容找到
SigLevel = Required DatabaseOptional修改为
SigLevel = Never
修改 /etc/yaourtrc
,去掉 # AURURL
的注释,修改为
AURURL="https://aur.tuna.tsinghua.edu.cn"
$ yaourt -Sy //更新缓存
3.使用测试
yaourt用起来的语法与pacman是一样的,现在就试试装cockpit
先搜索一下,可以看到有aur库里面的结果了
[lpwm@MyArch yaourt]$ yaourt -Ss cockpit
archlinuxcn/cockpit 161-1
A systemd web based user interface for Linux servers
aur/cockpit 167-1 (43) (0.51)
A systemd web based user interface for Linux servers
aur/cockpit-git 0.91.r3.gf5f3eda-1 (8) (0.00)
A systemd web based user interface for Linux servers
aur/cockpit-minimal 163-1 (0) (0.00)
A systemd web based user interface for Linux servers (minimal setup with system graphs, journalctl, storage, network, user accounts, systemd services and terminal)
aur/devolo-dlan-cockpit 4.3.3-3 (6) (0.04)
Display and configure settings of your devolo device
aur/od-cockpit-git v3.0.1-1 (0) (0.00)
Open Source Development Architecture for Virtual, Networked, and Cyber-Physical System Infrastructures.
aur/ttf-b612-git 1.003r3.bd14fde-1 (0) (0.00)
An highly legible open source font family designed and tested to be used on aircraft cockpit screens
使用普通用户执行yaourt -s cockpit,选择aur下面的cockpit,序号2
结果发现有个依赖systemtap装不上,只好手工单独装一下这个包
$ yaourt -s systemtap
算逑吧~网速太慢,先不折腾了
不用yaourt的话,直接从网站上下载snapshot压缩包手工安装也挺方便的,举个栗子安装Visual Studio Code:
如果在一开始安装ArchLinux系统就装了base-devel就可以跳过了,不过好像我之前装的几次都是懒省事只装了base,后面得再补一刀
# pacman -S base-devel
打开https://aur.archlinux.org/ 搜索visual studio code,然后下载snapshot
下载到本地是一个tar.gz的压缩包,就地解压
# tar -zxvf visual-studio-code-bin.tar.gz
进入到解压后的文件夹中,执行安装,需要注意,这里执行makepkg的时候不允许用root用户了,必须用普通用户
$ makepkg -s //-s参数可以自动解决依赖
编译完成后会生成一个.pkg.tar.xz的文件,再用pacman -U执行本地安装
# pacman -U visual-studio-code-bin-1.23.1-1-x86_64.pkg.tar.xz
安装完成后启动code,提示不能直接用root用户启动,加上参数--user-data-dir设置到root用户的~目录