Merge branch '8784-dir-listings'
[arvados.git] / doc / install / install-shell-server.html.textile.liquid
1 ---
2 layout: default
3 navsection: installguide
4 title: Install a shell server
5 ...
6 {% comment %}
7 Copyright (C) The Arvados Authors. All rights reserved.
8
9 SPDX-License-Identifier: CC-BY-SA-3.0
10 {% endcomment %}
11
12 There is nothing inherently special about an Arvados shell server. It is just a GNU/Linux machine with Arvados utilites and SDKs installed. For optimal performance, the Arvados shell server should be on the same LAN as the Arvados cluster, but that is not required.
13
14 h2. Install API tokens
15
16 Please follow the "API token guide":../user/reference/api-tokens.html to get API tokens for your Arvados account and install them on your shell server. We will use those tokens to test the SDKs as we install them.
17
18 h2. Install the Ruby SDK and utilities
19
20 First, install the curl development libraries necessary to build the Arvados Ruby SDK.  On Debian-based systems:
21
22 <notextile>
23 <pre><code>~$ <span class="userinput">sudo apt-get install libcurl4-openssl-dev</span>
24 </code></pre>
25 </notextile>
26
27 On Red Hat-based systems:
28
29 <notextile>
30 <pre><code>~$ <span class="userinput">sudo yum install libcurl-devel</span>
31 </code></pre>
32 </notextile>
33
34 Next, install the arvados-cli Ruby gem.  If you're using RVM:
35
36 <notextile>
37 <pre><code>~$ <span class="userinput">sudo /usr/local/rvm/bin/rvm-exec default gem install arvados-cli</span>
38 </code></pre>
39 </notextile>
40
41 If you're not using RVM:
42
43 <notextile>
44 <pre><code>~$ <span class="userinput">sudo -i gem install arvados-cli</span>
45 </code></pre>
46 </notextile>
47
48 h2. Install the Python SDK and utilities
49
50 {% assign rh_version = "6" %}
51 {% include 'note_python_sc' %}
52
53 On Red Hat-based systems:
54
55 <notextile>
56 <pre><code>~$ <span class="userinput">echo 'exclude=python2-llfuse' | sudo tee -a /etc/yum.conf</span>
57 ~$ <span class="userinput">sudo yum install python-arvados-python-client python-arvados-fuse crunchrunner</span>
58 </code></pre>
59 </notextile>
60
61 On Debian-based systems:
62
63 <notextile>
64 <pre><code>~$ <span class="userinput">sudo apt-get install python-arvados-python-client python-arvados-fuse crunchrunner</span>
65 </code></pre>
66 </notextile>
67
68 h2. Install Git and curl
69
70 {% include 'install_git_curl' %}
71
72 h2. Update Git Config
73
74 Configure git to use the ARVADOS_API_TOKEN environment variable to authenticate to arv-git-httpd. We use the @--system@ flag so it takes effect for all current and future user accounts. It does not affect git's behavior when connecting to other git servers.
75
76 <notextile>
77 <pre>
78 <code>~$ <span class="userinput">sudo git config --system 'credential.https://git.<b>uuid_prefix.your.domain</b>/.username' none</span></code>
79 <code>~$ <span class="userinput">sudo git config --system 'credential.https://git.<b>uuid_prefix.your.domain</b>/.helper' '!cred(){ cat >/dev/null; if [ "$1" = get ]; then echo password=$ARVADOS_API_TOKEN; fi; };cred'</span></code>
80 </pre>
81 </notextile>
82
83 h2. Install arvados-login-sync
84
85 This program makes it possible for Arvados users to log in to the shell server -- subject to permissions assigned by the Arvados administrator -- using the SSH keys they upload to Workbench. It sets up login accounts, updates group membership, and adds users' public keys to the appropriate @authorized_keys@ files.
86
87 Create an Arvados virtual_machine object representing this shell server. This will assign a UUID.
88
89 <notextile>
90 <pre>
91 <code>apiserver:~$ <span class="userinput">arv --format=uuid virtual_machine create --virtual-machine '{"hostname":"<b>your.shell.server.hostname</b>"}'</span>
92 zzzzz-2x53u-zzzzzzzzzzzzzzz</code>
93 </pre>
94 </notextile>
95
96 Create a token that is allowed to read login information for this VM.
97
98 <notextile>
99 <pre>
100 <code>apiserver:~$ <span class="userinput">arv api_client_authorization create --api-client-authorization '{"scopes":["GET /arvados/v1/virtual_machines/<b>zzzzz-2x53u-zzzzzzzzzzzzzzz</b>/logins"]}'
101 {
102  ...
103  "api_token":"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz",
104  ...
105 }</code>
106 </pre>
107 </notextile>
108
109 Note the UUID and the API token output by the above commands: you will need them in a minute.
110
111 Install the arvados-login-sync program.
112
113 If you're using RVM:
114
115 <notextile>
116 <pre>
117 <code>shellserver:~$ <span class="userinput">sudo -i `which rvm-exec` default gem install arvados-login-sync</span></code>
118 </pre>
119 </notextile>
120
121 If you're not using RVM:
122
123 <notextile>
124 <pre>
125 <code>shellserver:~$ <span class="userinput">sudo -i gem install arvados-login-sync</span></code>
126 </pre>
127 </notextile>
128
129 Install cron.
130
131 On Red Hat-based distributions:
132
133 <notextile>
134 <pre><code>~$ <span class="userinput">sudo yum install cronie</span>
135 ~$ <span class="userinput">sudo systemctl enable crond</span>
136 ~$ <span class="userinput">sudo systemctl start crond</span>
137 </code></pre>
138 </notextile>
139
140 On Debian-based systems:
141
142 <notextile>
143 <pre><code>~$ <span class="userinput">sudo apt-get install cron</span>
144 </code></pre>
145 </notextile>
146
147 Configure cron to run the @arvados-login-sync@ program every 2 minutes.
148
149 If you're using RVM:
150
151 <notextile>
152 <pre>
153 <code>shellserver:~$ <span class="userinput">sudo bash -c 'umask 077; tee /etc/cron.d/arvados-login-sync' &lt;&lt;'EOF'
154 ARVADOS_API_HOST="<strong>uuid_prefix.your.domain</strong>"
155 ARVADOS_API_TOKEN="<strong>the_token_you_created_above</strong>"
156 ARVADOS_VIRTUAL_MACHINE_UUID="<strong>zzzzz-2x53u-zzzzzzzzzzzzzzz</strong>"
157 */2 * * * * root /usr/local/rvm/bin/rvm-exec default arvados-login-sync
158 EOF</span></code>
159 </pre>
160 </notextile>
161
162 If you're not using RVM:
163
164 <notextile>
165 <pre>
166 <code>shellserver:~$ <span class="userinput">sudo bash -c 'umask 077; tee /etc/cron.d/arvados-login-sync' &lt;&lt;'EOF'
167 ARVADOS_API_HOST="<strong>uuid_prefix.your.domain</strong>"
168 ARVADOS_API_TOKEN="<strong>the_token_you_created_above</strong>"
169 ARVADOS_VIRTUAL_MACHINE_UUID="<strong>zzzzz-2x53u-zzzzzzzzzzzzzzz</strong>"
170 */2 * * * * root arvados-login-sync
171 EOF</span></code>
172 </pre>
173 </notextile>
174
175 A user should be able to log in to the shell server when the following conditions are satisfied:
176 * The user has uploaded an SSH public key: Workbench &rarr; Account menu &rarr; "SSH keys" item &rarr; "Add new SSH key" button.
177 * As an admin user, you have given the user permission to log in: Workbench &rarr; Admin menu &rarr; "Users" item &rarr; "Show" button &rarr; "Admin" tab &rarr; "Setup shell account" button.
178 * Two minutes have elapsed since the above conditions were satisfied, and the cron job has had a chance to run.