summaryrefslogtreecommitdiff
path: root/tutorial.md
blob: 5ba8ce4ac845d6ced0b5a3874232a2d2120ff578 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# Install Debian on a bare metal system with v-i

You need:

- a USB drive, at least 4 GB
- a PC that supports UEFI
- backups: _all drives_ in the PC will be wiped from data

The steps:

1. Download the installer image (`v-i.img.xz`) and related scripts
   (`configure-installer` and `write-and-config.sh`) from a
   subdirectory or <https://files.liw.fi/v-i/>.
   
   * <https://files.liw.fi/v-i/VERSION/v-i.img.xz>
   * <https://files.liw.fi/v-i/VERSION/configure-installer>
   * <https://files.liw.fi/v-i/VERSION/write-and-config.sh>

2. Unpack the downloaded image.

   ~~~sh
   unxz v-i.img.xz
   ~~~
   
   This will use a few gigabytes of disk apace.

3. Write a configuration file for the installer, to allow logging in
   via SSH to the running installer. If you don't intend to do that,
   you can just create an empty file. Otherwise, create a YAML file
   like the one below, but with values customized for you. You need
   one of `authorized_keys_file` or `user_ca_pub_file`.

   ~~~yaml
   user_ca_pub_file: ~liw/.ssh/ca/userca.pub
   authorized_keys_file: ~liw/.ssh/id_personal.pub
   ~~~
   
   Either of these two lines configures the installer SSH to allow you
   to log in as `root` using SSH. Password logins are not allowed for
   SSH. You can also log in via the console, as `root`, without a
   password.

4. Insert USB drive and find out the device allocated it. I prefer GNOME
   Disks for this, but you can also look up the device of the USB
   stick: run `sudo dmsg -T`. The device name is usually `/dev/sdx`
   for some value of x.

5. Write the installer image to the USB drive, and configure it.

   ~~~sh
   sudo bash write-and-config.sh config.yaml /dev/sdx v-i.img
   ~~~

   This will take a few minutes.

6. Make sure everything has been written to the USB drive. Again, I
   prefer GNOME Disks for this, but from the command line:

    ~~~sh
    sync
    eject /dev/sdx
    ~~~

7. Move the USB drive to the target machine and boot off the drive.
   How this happens varies from machine to machine. On my Thinkpad
   X220, I press F12 at the POST screen and then choose the right
   drive from the boot menu.

8. Wait for the system to boot. Log in as root, either from the
   virtual console (no password), or via SSH.

   If you need to connect to wifi, you need to log in as root and run
   the following commands:

    ~~~sh
    iwctl station wlan0 get-networks
    iwctl stations wlan0 connect DadItIsThisOne
    ~~~

   Substitute the name of the network as needed. Enter wifi password
   when requested.

9. Create a target specification file `foo-target.yaml`. The name can
   be anything, but it must be valid YAML. In the example below, there
   is one NVMe drive that will get the system installed. All drives
   will be encrypted using LUKS, with the password "hunter2".

    ~~~yaml
    drive: /dev/nvme0n1
    luks: hunter2
    ~~~
    
    See [spec.md][] for a full description of the specification file.

10. Install. Add the `--verbose` option to `./v-i` if you want to know
    what's happening. The first time you run this on a given v-i USB
    drive, it takes a while: it runs `vmdebootstrap` and that is just
    slow. However, the output is cached, so further runs are faster.

    ~~~sh
    rm -f install.log
    v-i --verbose foo-target.yaml
    ~~~
     
    This will take few minutes the first time, assuming a fast
    Internet connection. Further runs go faster.

11. Reboot into the installed system.

12. Finish configuring the system in whatever way you like to do that.
    I use Ansible.

    Remember to change the LUKS password for each drive.

13. Optional: Let me know how it went.

[spec.md]: spec.md