Newer
Older
<chapter annotations="slide" version="5.1" xml:id="sdi_hetzner"
xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xila="http://www.w3.org/2001/XInclude/local-attributes"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:trans="http://docbook.org/ns/transclusion"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:m="http://www.w3.org/1998/Math/MathML"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:db="http://docbook.org/ns/docbook">
<title>Using the <orgname xlink:href="https://hetzner.com">Hetzner</orgname>
cloud</title>
<section xml:id="sdi_hetzner_getstarted">
<title>Getting started</title>
<figure xml:id="sdi_hetzner_getstarted_createSshKeyPair">
<title>Create an <command>ssh</command> key pair</title>
<screen>sdiuser@martin-pc-dachboden:~$ <command
xlink:href="https://linux.die.net/man/1/ssh-keygen">ssh-keygen</command> -t ed25519 <co
linkends="sdi_hetzner_getstarted_createSshKeyPair-1"
xml:id="sdi_hetzner_getstarted_createSshKeyPair-1-co"/>
Generating public/private ed25519 key pair.
Enter file in which to save the key (/home/sdiuser/.ssh/id_ed25519):
Created directory '/home/sdiuser/.ssh'.
Enter passphrase (empty for no passphrase): <co
linkends="sdi_hetzner_getstarted_createSshKeyPair-2"
xml:id="sdi_hetzner_getstarted_createSshKeyPair-2-co"/>
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
Your identification has been saved in /home/sdiuser/.ssh/id_ed25519 <co
linkends="sdi_hetzner_getstarted_createSshKeyPair-3"
xml:id="sdi_hetzner_getstarted_createSshKeyPair-3-co"/>
Your public key has been saved in /home/sdiuser/.ssh/id_ed25519.pub <co
linkends="sdi_hetzner_getstarted_createSshKeyPair-4"
xml:id="sdi_hetzner_getstarted_createSshKeyPair-4-co"/></screen>
<calloutlist>
<callout arearefs="sdi_hetzner_getstarted_createSshKeyPair-1-co"
xml:id="sdi_hetzner_getstarted_createSshKeyPair-1">
<para>Create an elliptic rather than default <abbrev>RSA</abbrev>
type key.</para>
</callout>
<callout arearefs="sdi_hetzner_getstarted_createSshKeyPair-2-co"
xml:id="sdi_hetzner_getstarted_createSshKeyPair-2">
<para>Security aware folks will choose a decent passphrase
protecting the private key being generated.</para>
</callout>
<callout arearefs="sdi_hetzner_getstarted_createSshKeyPair-3-co"
xml:id="sdi_hetzner_getstarted_createSshKeyPair-3">
<para>The generated private key.</para>
</callout>
<callout arearefs="sdi_hetzner_getstarted_createSshKeyPair-4-co"
xml:id="sdi_hetzner_getstarted_createSshKeyPair-4">
<para>The generated public key.</para>
<note>
<para>Different implementations like e.g. <command
xlink:href="https://www.putty.org">putty</command> may use
different key storage formats.</para>
</note>
</callout>
</calloutlist>
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
</figure>
<figure xml:id="sdi_hetzner_getstarted_hetznerSignUp">
<title>Create a <orgname>Hetzner</orgname> account</title>
<itemizedlist>
<listitem>
<para>Sign up at <link
xlink:href="https://accounts.hetzner.com/signUp">https://accounts.hetzner.com/signUp</link>
using an account name of your choice.</para>
</listitem>
<listitem>
<para>Optionally: Activate 2-factor authentication.</para>
</listitem>
<listitem>
<para>You may validate your account by ID card or similar. No
payment required!</para>
</listitem>
<listitem>
<para>Publish your <orgname>Hetzner</orgname> account's username to
your SDI course's group at <link
xlink:href="https://learn.mi.hdm-stuttgart.de">https://learn.mi.hdm-stuttgart.de</link>.</para>
</listitem>
</itemizedlist>
</figure>
<figure xml:id="sdi_hetzner_getstarted_accessProject">
<title>Access your project space</title>
<para>Upon confirmation your <orgname>Hetzner</orgname> project space
sdi_gxy (e.g. sdi_g01 corresponding to group 1) should be
accessible.</para>
</figure>
<figure xml:id="sdi_hetzner_getstarted_">
<title>Create a server</title>
<informaltable border="0">
<tr>
<td valign="top"><orderedlist>
<listitem>
<para>Create a default firewall allowing <command
xlink:href="https://linux.die.net/man/8/ping">ping</command>
and <command
xlink:href="https://linux.die.net/man/1/ssh">ssh</command></para>
</listitem>
<listitem>
<para><productname>Ubuntu</productname> latest</para>
</listitem>
<listitem>
<para>Shared vCPU / x86 / CX11 (<link
xlink:href="https://www.hetzner.com/cloud/#pricing">the
cheapest</link>)</para>
<para>Add your personal <command>ssh</command> public key from
<xref
linkend="sdi_hetzner_getstarted_createSshKeyPair"/></para>
</listitem>
</orderedlist></td>
<td valign="top"><orderedlist continuation="continues">
<listitem>
<para>Omit volume, labels and cloud config</para>
</listitem>
<listitem>
<para>Note the <guimenuitem>Networking</guimenuitem> /
<guisubmenu>Public IPv4</guisubmenu> address for later
reference</para>
</listitem>
<listitem>
<para>Click »Create & Buy now«</para>
</listitem>
</orderedlist></td>
</tr>
</informaltable>
</figure>
<figure xml:id="sdi_hetzner_getstarted_accessServer">
<title>Access your server</title>
<itemizedlist>
<listitem>
<para>Ping your server:</para>
<note>
<para>The IP 91.107.232.156 serves just as a sample value
irrespective of your individual actual server IP.</para>
</note>
<screen>sdiuser:~$ ping 91.107.232.156
PING 91.107.232.156 (91.107.232.156) 56(84) bytes of data.
64 bytes from 91.107.232.156: icmp_seq=1 ttl=49 time=18.3 ms
64 bytes from 91.107.232.156 ...</screen>
</listitem>
<listitem>
<screen>ssh root@91.107.232.156</screen>
</listitem>
</itemizedlist>
</figure>
<figure xml:id="sdi_hetzner_getstarted_updateServer">
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
<orderedlist>
<listitem>
<para>apt update</para>
</listitem>
<listitem>
<para>apt upgrade</para>
</listitem>
<listitem>
<para>reboot</para>
</listitem>
</orderedlist>
</figure>
<figure xml:id="sdi_hetzner_getstarted_installNginx">
<title>Install a web server</title>
<screen>root@topsy:~# apt install nginx</screen>
</figure>
<figure xml:id="sdi_hetzner_getstarted_localHttpAccess">
<title>Check local <acronym>http</acronym> web access</title>
<screen>root@topsy:~# wget -O - 91.107.232.156
--2024-04-07 18:59:13-- http://91.107.232.156/
Connecting to 91.107.232.156:80... connected.
<html>
<head>
<title>Welcome to nginx!</title> ...</screen>
</figure>
<figure xml:id="sdi_hetzner_getstarted_externHttp">
<title>External <acronym>http</acronym> web access</title>
<para>Point your browser to http://91.107.232.156.</para>
<screen>sdiuser:~$ telnet 91.107.232.156 80
Trying 91.107.232.156...</screen>
<para>Why is there no answer?</para>
</figure>
<figure xml:id="sdi_hetzner_getstarted_allowHttp">
<title>Add port 80 / <acronym>http</acronym> firewall rule</title>
<screen>sdiuser:~$ telnet 91.107.232.156 80
Trying 91.107.232.156...
Connected to 91.107.232.156.
Escape character is '^]'</screen>
<para>Congrats: External Browser access is working now!</para>
</figure>
<figure xml:id="sdi_hetzner_getstarted_cleanUp">
<title>Cleaning up!</title>
<caution>
<para>This is about <emphasis role="red">$$$ MONEY
$$$</emphasis></para>
</caution>
<itemizedlist>
<listitem>
<para>Delete your server including the IPv4 address.</para>
</listitem>
<listitem>
<para>You may delete your firewall</para>
</listitem>
</itemizedlist>
</figure>
</section>
</chapter>