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


2.1 二进制文件安装

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

注: We recommend the use of this shell installer script. The script automates the download, installation, and initial configuration steps described below. It should be run as the root user. As root, you can thus run this:

cd /tmp
wget https://git.savannah.gnu.org/cgit/guix.git/plain/etc/guix-install.sh
chmod +x guix-install.sh
./guix-install.sh

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

安装步骤如下:

  1. Download the binary tarball from ‘https://ftp.gnu.org/gnu/guix/guix-binary-1.3.0.x86_64-linux.tar.xz’, 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发行版).

    请确保下载相关的.sig文件,并且用它验证文件包的可靠性,方法如下:

    $ wget https://ftp.gnu.org/gnu/guix/guix-binary-1.3.0.x86_64-linux.tar.xz.sig
    $ gpg --verify guix-binary-1.3.0.x86_64-linux.tar.xz.sig
    

    如果那个命令因为缺少所需的公钥而失败了,那么用这个命令导入它:

    $ wget 'https://sv.gnu.org/people/viewgpg.php?user_id=127547' \
          -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 \
         /path/to/guix-binary-1.3.0.x86_64-linux.tar.xz
    # 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).

    不要在一个正常的Guix系统上解压这个文件包,因为那会把现有的重要的文件覆盖。

    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 调用guix pull):
    # mkdir -p ~root/.config/guix
    # ln -sf /var/guix/profiles/per-user/root/current-guix \
             ~root/.config/guix/current
    

    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 \
         /etc/systemd/system/
    # systemctl enable --now gnu-store.mount guix-daemon
    

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

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

    此外,你可以手动启动后台进程:

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

    最好让这个用户手册的Info版也可以被访问:

    # 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. 为了使用ci.guix.gnu.org或其镜像的substitute(see substitutes),对其授权:
    # guix archive --authorize < \
         ~root/.config/guix/current/share/guix/ci.guix.gnu.org.pub
    
  8. 每个用户可能需要执行一些额外的步骤以使各自的Guix环境可用,see 设置应用程序

瞧,安装完成了!

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

# guix install hello

二进制安装包可以通过在Guix源代码树里运行下面这些命令来重现和验证:

make guix-binary.系统.tar.xz

... 这个命令会执行:

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

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


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