Next: , Up: 安装   [Contents][Index]

2.1 二进制文件安装

这个小节介绍如何在任意的系统上用独立的Guix二进制文件包安装Guix和它的依赖。这通常比从源代码安装更快,下一小节会介绍如何从源代码安装。唯一的需求是有GNU tar和Xz。

注: 我们推荐使用这个shell安装脚本。这个脚本自动执行下述的下载、安装并且初始化Guix的过程。它需要以root用户身份运行。作为root用户,因此你可以运行这个:

cd /tmp
chmod +x

If you’re running Debian or a derivative such as Ubuntu, you can instead install the package (it might be a version older than 1.4.0 but you can update it afterwards by running ‘guix pull’):

sudo apt install guix

Likewise on openSUSE:

sudo zypper install guix

When you’re done, see 设置应用程序 for extra configuration you might need, and 入门 for your first steps!


  1. Download the binary tarball from ‘’, where x86_64-linux can be replaced with i686-linux for an i686 (32-bits) machine already running the kernel Linux, and so on (see GNU发行版).


    $ wget
    $ gpg --verify guix-binary-1.4.0.x86_64-linux.tar.xz.sig


    $ wget '' \
          -qO - | gpg --import -

    再次运行gpg --verify命令。

    Take note that a warning like “This key is not certified with a trusted signature!” is normal.

  2. 现在你需要成为root用户。基于你的发行版,你可能需要执行su -sudo -i。以root用户身份,执行:
    # cd /tmp
    # tar --warning=no-timestamp -xf \
    # mv var/guix /var/ && mv gnu /

    This creates /gnu/store (see 仓库) and /var/guix. The latter contains a ready-to-use profile for root (see next step).


    The --warning=no-timestamp option makes sure GNU tar does not emit warnings about “implausibly old time stamps” (such warnings were triggered by GNU tar 1.26 and older; recent versions are fine). They stem from the fact that all the files in the archive have their modification time set to 1 (which means January 1st, 1970). This is done on purpose to make sure the archive content is independent of its creation time, thus making it reproducible.

  3. 使profile出现在~root/.config/guix/current,这是guix pull安装更新的位置(see Invoking guix pull):
    # mkdir -p ~root/.config/guix
    # ln -sf /var/guix/profiles/per-user/root/current-guix \

    Source etc/profile to augment PATH and other relevant environment variables:

    # GUIX_PROFILE="`echo ~root`/.config/guix/current" ; \
      source $GUIX_PROFILE/etc/profile
  4. 像下面解释的那样为“构建用户”创建用户组和用户(see 设置构建环境)。
  5. 运行后台进程,并设置为开机自启动。

    如果你的主机的发行版使用systemd init系统,可以用这些命令:

    # cp ~root/.config/guix/current/lib/systemd/system/gnu-store.mount \
         ~root/.config/guix/current/lib/systemd/system/guix-daemon.service \
    # systemctl enable --now gnu-store.mount guix-daemon

    You may also want to arrange for guix gc to run periodically:

    # cp ~root/.config/guix/current/lib/systemd/system/guix-gc.service \
         ~root/.config/guix/current/lib/systemd/system/guix-gc.timer \
    # systemctl enable --now guix-gc.timer

    You may want to edit guix-gc.service to adjust the command line options to fit your needs (see Invoking guix gc).

    如果你的主机的发行版使用Upstart init系统:

    # initctl reload-configuration
    # cp ~root/.config/guix/current/lib/upstart/system/guix-daemon.conf \
    # start guix-daemon


    # ~root/.config/guix/current/bin/guix-daemon \
  6. 使机器上的其他用户也可以使用guix命令:
    # mkdir -p /usr/local/bin
    # cd /usr/local/bin
    # ln -s /var/guix/profiles/per-user/root/current-guix/bin/guix


    # mkdir -p /usr/local/share/info
    # cd /usr/local/share/info
    # for i in /var/guix/profiles/per-user/root/current-guix/share/info/* ;
      do ln -s $i ; done

    That way, assuming /usr/local/share/info is in the search path, running info guix will open this manual (see Other Info Directories in GNU Texinfo, for more details on changing the Info search path).

  7. To use substitutes from, or a mirror (see substitutes), authorize them:
    # guix archive --authorize < \
    # guix archive --authorize < \

    注: If you do not enable substitutes, Guix will end up building everything from source on your machine, making each installation and upgrade very expensive. See 关于信任二进制文件, for a discussion of reasons why one might want do disable substitutes.

  8. 每个用户可能需要执行一些额外的步骤以使各自的Guix环境可用,see 设置应用程序


你可以通过给root profile安装一个软件包来确认Guix可以正常工作。

# guix install hello


make guix-binary.系统.tar.xz

... 这个命令会执行:

guix pack -s 系统 --localstatedir \
  --profile-name=current-guix guix

See Invoking guix pack,了解这个方便的工具。

Next: 需求, Up: 安装   [Contents][Index]