~ubuntu-branches/debian/experimental/upspin/experimental

« back to all changes in this revision

Viewing changes to doc/server_setup_ubuntu.md

  • Committer: Package Import Robot
  • Author(s): Michael Stapelberg
  • Date: 2017-03-09 14:06:46 UTC
  • Revision ID: package-import@ubuntu.com-20170309140646-3q7qp80jy7aivjsg
Tags: upstream-0.0~git20170316.0.d0c0831
ImportĀ upstreamĀ versionĀ 0.0~git20170316.0.d0c0831

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Running `upspinserver` on Ubuntu 16.04
 
2
 
 
3
These instructions are part of the instructions for
 
4
[Setting up `upspinserver`](/doc/server_setup.md).
 
5
Please make sure you have read that document first.
 
6
 
 
7
## Introduction
 
8
 
 
9
These instructions assume you have access to an Debian or Ubuntu linux
 
10
server, and that the server is reachable at your chosen host name.
 
11
(`upspin.example.com`)
 
12
 
 
13
> Note that these instructions have been verified to work against Ubuntu 16.04.
 
14
> The exact commands may differ on your system.
 
15
 
 
16
Once the server is running you should log in to it as root and configure it to
 
17
run `upspinserver` by following these instructions.
 
18
 
 
19
## Create a user for `upspinserver`
 
20
 
 
21
The following commands must be executed on the server as the super user, `root`,
 
22
perhaps via `sudo su`.
 
23
 
 
24
Create a Unix account named `upspin`:
 
25
 
 
26
```
 
27
$ useradd upspin
 
28
```
 
29
 
 
30
Give yourself SSH access to the `upspin` account on the server (a convenience):
 
31
 
 
32
```
 
33
$ su upspin
 
34
$ cd $HOME
 
35
$ mkdir .ssh
 
36
$ chmod 0700 .ssh
 
37
$ cat > .ssh/authorized_keys
 
38
(Paste your SSH public key here and type Control-D and Enter)
 
39
```
 
40
 
 
41
## Build `upspinserver` and copy it to the server
 
42
 
 
43
From your workstation, run these commands:
 
44
 
 
45
```
 
46
$ GOOS=linux GOARCH=amd64 go build upspin.io/cmd/upspinserver
 
47
$ scp upspinserver upspin@upspin.example.com:.
 
48
```
 
49
 
 
50
## Run `upspinserver` on server startup
 
51
 
 
52
The following commands must be executed on the server as the super user, `root`.
 
53
 
 
54
These instructions assume that your Linux server is running `systemd`.
 
55
 
 
56
Create the file `/etc/systemd/system/upspinserver.service` that contains
 
57
the following service definition.
 
58
 
 
59
```
 
60
[Unit]
 
61
Description=Upspin server
 
62
 
 
63
[Service]
 
64
ExecStart=/home/upspin/upspinserver
 
65
User=upspin
 
66
Group=upspin
 
67
Restart=on-failure
 
68
 
 
69
[Install]
 
70
WantedBy=multi-user.target
 
71
```
 
72
 
 
73
### Allow `upspinserver` to listen on port `443`
 
74
 
 
75
The `upspinserver` binary needs to listen on port `443` in order to obtain
 
76
its TLS certificates through [LetsEncrypt](https://letsencrypt.org/).
 
77
 
 
78
Normally only user `root` can bind ports below `1024`.
 
79
Instead of running `upspinserver` as `root` (which is generally discouraged),
 
80
we will grant the `upspinserver` binary this capability by using `setcap` (as
 
81
`root`):
 
82
 
 
83
```
 
84
$ setcap cap_net_bind_service=+ep /home/upspin/upspinserver
 
85
```
 
86
 
 
87
Note that you need to run this `setcap` command whenever the `upspinserver`
 
88
binary is updated.
 
89
 
 
90
### Start the service
 
91
 
 
92
Use `systemctl` to enable and start the service:
 
93
 
 
94
```
 
95
$ systemctl enable --now /etc/systemd/system/upspinserver.service
 
96
```
 
97
 
 
98
You may also use `systemctl stop upspinserver` and `systemctl restart
 
99
upspinserver` to stop and restart the server, respectively.
 
100
 
 
101
You can use `journalctl` to see the log output of the server:
 
102
 
 
103
```
 
104
$ journalctl -f -u upspinserver
 
105
 
 
106
```
 
107
 
 
108
## Continue
 
109
 
 
110
You can now continue following the instructions in
 
111
[Setting up `upspinserver`](/doc/server_setup.md).