2 Copyright (C) The Arvados Authors. All rights reserved.
4 SPDX-License-Identifier: CC-BY-SA-3.0
7 # Start a shell for the postgres user:
8 <notextile><pre>~$ <span class="userinput">sudo -u postgres bash</span></pre></notextile>
9 # Generate a new database password:
10 <notextile><pre>$ <span class="userinput">ruby -e 'puts rand(2**128).to_s(36)'</span>
12 </pre></notextile> Record this. You'll need it when you set up the Rails server later.
13 # Create a database user with the password you generated:
14 <notextile><pre><code>$ <span class="userinput">createuser --encrypted -R -S --pwprompt {{service_role}}</span>
15 Enter password for new role: <span class="userinput">yourgeneratedpassword</span>
16 Enter it again: <span class="userinput">yourgeneratedpassword</span>
17 </code></pre></notextile>
18 # Create a database owned by the new user:
19 <notextile><pre><code>$ <span class="userinput">createdb {{service_database}} -T template0 -E UTF8 -O {{service_role}}</span></code></pre></notextile>
20 # Exit the postgres user shell:
21 <notextile><pre>$ <span class="userinput">exit</span></pre></notextile>