From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id oMpZJ+IKCV9SHAAA0tVLHw (envelope-from ) for ; Sat, 11 Jul 2020 00:42:10 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id kIQOI+IKCV/nDQAAbx9fmQ (envelope-from ) for ; Sat, 11 Jul 2020 00:42:10 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id BA5DA940A1D for ; Sat, 11 Jul 2020 00:42:09 +0000 (UTC) Received: from localhost ([::1]:33882 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ju3ai-00031P-9E for larch@yhetil.org; Fri, 10 Jul 2020 20:42:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60206) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ju3ad-00031I-0Z for guix-patches@gnu.org; Fri, 10 Jul 2020 20:42:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:60338) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ju3ac-0000nS-Nt for guix-patches@gnu.org; Fri, 10 Jul 2020 20:42:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ju3ac-0004I2-Kv for guix-patches@gnu.org; Fri, 10 Jul 2020 20:42:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#42317] Adding a "Running Guix on a Linode" to the cookbook Resent-From: Joshua Branson Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 11 Jul 2020 00:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 42317 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 42317@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.159442811116471 (code B ref -1); Sat, 11 Jul 2020 00:42:02 +0000 Received: (at submit) by debbugs.gnu.org; 11 Jul 2020 00:41:51 +0000 Received: from localhost ([127.0.0.1]:43651 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ju3aM-0004HW-HB for submit@debbugs.gnu.org; Fri, 10 Jul 2020 20:41:50 -0400 Received: from lists.gnu.org ([209.51.188.17]:49560) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ju3aJ-0004HN-6V for submit@debbugs.gnu.org; Fri, 10 Jul 2020 20:41:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60156) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ju3aI-0002zi-Ms for guix-patches@gnu.org; Fri, 10 Jul 2020 20:41:42 -0400 Received: from mx1.dismail.de ([78.46.223.134]:28183) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ju3aG-0000ll-1G for guix-patches@gnu.org; Fri, 10 Jul 2020 20:41:42 -0400 Received: from mx1.dismail.de (localhost [127.0.0.1]) by mx1.dismail.de (OpenSMTPD) with ESMTP id 40200222 for ; Sat, 11 Jul 2020 02:41:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=dismail.de; h=date :message-id:from:to:subject; s=20190914; bh=QjaXeuN+z9J2/XnPOSdQ XROWc55nkNwfaxDQOeR75Zw=; b=tPwPLrSXUHHz9YXngLHu/rydLbjvbW/5i33i uMgZOp5BTneBQPeaBjHQ32IA9pBOaYA2IVbSoSYpaDBXQjoWt5m1Rz0q2ip2fgsP xMW9X04i8QffxQXIfdrRSqpRSeOsAQ5nJvR1o8aYkZixo7aWfdLn1xIxJoi18RNi ILGQ7PFjQ9Z9wWyM6ZSG9dlyTYJe5eYQF12LROiKkOTZnkbCzP0Sbn81AeVI7gMm 7xaC8pmAFE79xj4iiACUfjFbkVniA1XXGBQ17rLMgrZShIt6grPC9Vu5BDgd0RWC foGC3oYNaIJC8xG4ituaPo7PyHqpDVH4SP7IN7uE2PjCD3PT4Q== Received: from smtp2.dismail.de ( [10.240.26.12]) by mx1.dismail.de (OpenSMTPD) with ESMTP id be9a26d5 for ; Sat, 11 Jul 2020 02:41:36 +0200 (CEST) Received: from smtp2.dismail.de (localhost [127.0.0.1]) by smtp2.dismail.de (OpenSMTPD) with ESMTP id d665f7af for ; Sat, 11 Jul 2020 02:41:36 +0200 (CEST) Received: by dismail.de (OpenSMTPD) with ESMTPSA id a1f7edb9 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for ; Sat, 11 Jul 2020 02:41:32 +0200 (CEST) Date: Fri, 10 Jul 2020 20:41:22 -0400 Message-Id: <87v9iukhn1.fsf@dismail.de> Received-SPF: pass client-ip=78.46.223.134; envelope-from=jbranso@dismail.de; helo=mx1.dismail.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/10 20:41:37 X-ACL-Warn: Detected OS = ??? X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -2.4 (--) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" Reply-to: Joshua Branson , Joshua Branson via Guix-patches From: Joshua Branson via Guix-patches via X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=dismail.de header.s=20190914 header.b=tPwPLrSX; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: -0.01 X-TUID: P5OFpVlaOxDV From: Joshua Branson Date: Fri, 10 Jul 2020 20:32:30 -0400 Subject: [PATCH] doc: cookbook: Adding a section "Running Guix on a Linode"" MIME-Version: 1.0 Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-doc-cookbook-Adding-a-section-Running-Guix-on-a-Lino.patch * doc/guix-cookbook.texi (Running Guix on a Linode): I added a section that explains how to run guix on a linode. Thanks Chris Webber! --- doc/guix-cookbook.texi | 180 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 180 insertions(+) diff --git a/doc/guix-cookbook.texi b/doc/guix-cookbook.texi index f541592d13..3ade82af14 100644 --- a/doc/guix-cookbook.texi +++ b/doc/guix-cookbook.texi @@ -1347,6 +1347,7 @@ reference. * Customizing the Kernel:: Creating and using a custom Linux kernel on Guix System. * Connecting to Wireguard VPN:: Connecting to a Wireguard VPN. * Customizing a Window Manager:: Handle customization of a Window manager on Guix System. +* Running Guix on a Linode:: Running Guix on a Linode * Setting up a bind mount:: Setting up a bind mount in the file-systems definition. * Getting substitutes from Tor:: Configuring Guix daemon to get substitutes through Tor. @end menu @@ -1759,6 +1760,185 @@ your screen but not suspend it, it's a good idea to notify xss-lock about this s confusion occurs. This can be done by executing @code{xset s activate} immediately before you execute slock. +@node Running Guix on a Linode +@section Running Guix on a Linode +@cindex linode + +Start with a recommended Debian server. Be sure to add your ssh key for +easy login. We recommend using the default distro as a way to bootstrap +Guix. This is usually done via @code{ssh-copy-id}. + +Power the linode down. In the Linode's Disks/Configurations tab, resize +the Debian disk to be smaller. 30 GB is recommended. + +In the Linode settings, "Add a disk", with the following: +@itemize @bullet +@item +Label: "Guix" + +@item +Filesystem: ext4 + +@item +Set it to the remaining size +@end itemize + +On the "configuration" field that comes with the default image, press +"..." and select "Edit", then on that menu add to /dev/sdc the "Guix" +label. + +Now "Add a Configuration", with the following: +@itemize @bullet +@item +Label: Guix + +@item +VM Mode: Paravirtualization @c{The default?? Does this matter?} + +@item +Kernel: Grub 2 (it's at the bottom! This step is @b{IMPORTANT!}) + +@item +Block device assignment: + +@item +/dev/sda: Guix + +@item +/dev/sdb: swap + +@item +Root device: /dev/sda + +@item +Turn off all the filesystem/boot helpers +@end itemize + +Now power it back up, picking the Debian configuration. Once it's +booted up, ssh in your server via @code{ssh root@@}. +Now you can run the "install guix form binary installer" steps: + +@example +sudo apt-get install gpg +wget https://sv.gnu.org/people/viewgpg.php?user_id=15145 -qO - | gpg --import - +wget https://git.savannah.gnu.org/cgit/guix.git/plain/etc/guix-install.sh +chmod +x guix-install.sh +./guix-install.sh +guix pull +@end example + +Now it's time to write out a config for the server. The key information +is below. Save the resulting file as guix-config.scm: + +@lisp +(use-modules (gnu) + (guix modules)) +(use-service-modules networking + ssh) +(use-package-modules admin + certs + package-management + ssh + tls) + +(operating-system + (host-name "my-server") + (timezone "America/New_York") + (locale "en_US.UTF-8") + ;; This goofy code will generate the grub.cfg + ;; without installing the grub bootloader on disk. + (bootloader (bootloader-configuration + (bootloader + (bootloader + (inherit grub-bootloader) + (installer #~(const #t)))))) + (file-systems (cons (file-system + (device "/dev/sda") + (mount-point "/") + (type "ext4")) + %base-file-systems)) + + (initrd-modules (cons "virtio_scsi" ; Needed to find the disk + %base-initrd-modules)) + + (users (cons (user-account + (name "janedoe") + (group "users") + ;; Adding the account to the "wheel" group + ;; makes it a sudoer. + (supplementary-groups '("wheel")) + (home-directory "/home/janedoe")) + %base-user-accounts)) + + (packages (cons* nss-certs ;for HTTPS access + openssh-sans-x + %base-packages)) + + (services (cons* + (service dhcp-client-service-type) + (service openssh-service-type + (openssh-configuration + (openssh openssh-sans-x) + (password-authentication? #f) + (authorized-keys + `(("janedoe" ,(local-file "janedoe_rsa.pub")) + ;; Is this a good idea? Well if you don't add it + ;; you have to manually set your user's password + ;; via the glish console... + ("root" ,(local-file "janedoe_rsa.pub")))))) + %base-services))) +@end lisp + +Replace the following fields in the above configuration: +@lisp +(host-name "my-server") ; replace with your server name +(name "janedoe") ; replace with your username +("janedoe" ,(local-file "janedoe_rsa.pub")) ; here too +@end lisp + +Note the same above for root, which I don't feel great about, but +otherwise you'll need to log in via the linode "glish" console to log in +as root and set the user's initial password before you can start using +sudo. @comment {(is there another way around this?)} + +Save your ssh public key (@code{~/.ssh/id_rsa.pub}) as +_rsa.pub in the same directory. + +Mount the guix drive: +@example +mkdir /mnt/guix +mount /dev/sdc /mnt/guix +@end example + +Due to the way we set things up above, we do not install Grub +completely. Instead we install only our grub configuration file. So we +need to copy over some of the other Grub stuff that is already there: + +@example +mkdir -p /mnt/guix/boot/grub +cp -r /boot/grub/* /mnt/guix/boot/grub/ +@end example + +Now initialize the Guix installation: +@example +guix system init guix-config.scm /mnt/guix +@end example + +Ok, power it down! +Now from the linode console, select boot and select "Guix". + +Once it boots, you should be able to log in via ssh! (The server +config will have changed though.) + +Be sure to set your password and root's password. + +Horray! At this point you can shut down the server, delete the +Debian disk, and resize the Guix to the rest of the size. +Congratulations! + +BTW, if you save it as a disk image right at this point, you'll have an +easy time spinning up new Guix images! + @node Setting up a bind mount @section Setting up a bind mount -- 2.26.0