You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
104 lines
4.1 KiB
HTML
104 lines
4.1 KiB
HTML
4 years ago
|
<!DOCTYPE html>
|
||
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
|
||
|
<head>
|
||
|
<meta charset="utf-8" />
|
||
|
<meta name="generator" content="pandoc" />
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
|
||
|
<title>Installation notes</title>
|
||
|
<style type="text/css">
|
||
|
code{white-space: pre-wrap;}
|
||
|
span.smallcaps{font-variant: small-caps;}
|
||
|
span.underline{text-decoration: underline;}
|
||
|
div.column{display: inline-block; vertical-align: top; width: 50%;}
|
||
|
</style>
|
||
|
<link rel="stylesheet" href="styles.css" />
|
||
|
</head>
|
||
|
<body>
|
||
|
<header>
|
||
|
<h1 class="title">Installation notes</h1>
|
||
|
</header>
|
||
|
<h2 id="tinc">Tinc</h2>
|
||
|
<p>Installed tinc following pzwiki guide!</p>
|
||
|
<h2 id="nginx-config">NGINX config</h2>
|
||
|
<p>sudo apt install nginx</p>
|
||
|
<p>Added user directories to nginx setup</p>
|
||
|
<pre><code> # enable home directories ... eg ~USER/ => /home/USER/public_html/index.html
|
||
|
location ~ ^/~(.+?)(/.*)?$ {
|
||
|
alias /home/$1/public_html$2;
|
||
|
index index.html index.htm;
|
||
|
autoindex on;
|
||
|
}</code></pre>
|
||
|
<p>Made the /var/www/html folder belong to group users</p>
|
||
|
<pre><code>sudo chgrp users /var/www/html
|
||
|
sudo chmod -R 2775 /var/www/html</code></pre>
|
||
|
<p>NB: The 2 turns on the setGID bit meaning:</p>
|
||
|
<blockquote>
|
||
|
<p>newly created subfiles inherit the same group as the directory, and newly created subdirectories inherit the set GID bit of the parent directory.</p>
|
||
|
</blockquote>
|
||
|
<h3 id="reverse-proxies-for-jupyter">Reverse proxies for jupyter</h3>
|
||
|
<pre><code> location /lab/mmurtaugh/ {
|
||
|
proxy_pass http://localhost:9050/;
|
||
|
# ADDs sandbot
|
||
|
rewrite /(.*) /sandbot/$1 break;
|
||
|
include /etc/nginx/includes/lab.conf;
|
||
|
}</code></pre>
|
||
|
<p>And made a file for common settings:</p>
|
||
|
<pre><code>sudo nano /etc/nginx/includes/lab.conf</code></pre>
|
||
|
<pre><code>error_page 502 /lab/502.html;
|
||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
|
proxy_set_header X-Real-IP $remote_addr;
|
||
|
proxy_set_header Host $http_host;
|
||
|
proxy_http_version 1.1;
|
||
|
proxy_redirect off;
|
||
|
proxy_buffering off;
|
||
|
proxy_set_header Upgrade $http_upgrade;
|
||
|
proxy_set_header Connection "upgrade";
|
||
|
proxy_read_timeout 86400;</code></pre>
|
||
|
<h2 id="jupyter-config">Jupyter config</h2>
|
||
|
<p>First installed pip3 & updated it…</p>
|
||
|
<pre><code>sudo apt install python3-pip
|
||
|
sudo pip3 install --upgrade pip</code></pre>
|
||
|
<p>Then used pip3 to install jupyterlab…</p>
|
||
|
<pre><code>sudo pip3 install jupyterlab</code></pre>
|
||
|
<p>Following <a href="http://sonny-qa.github.io/2017/11/16/jupyter-notebook-ec2-reverse-proxy/">this guide</a>, configured my local jupyter to use port 9050, and setup config</p>
|
||
|
<p>To <a href="http://ipython.org/ipython-doc/stable/notebook/public_server.html">set the password</a>:</p>
|
||
|
<pre><code>python3
|
||
|
|
||
|
from IPython.lib import passwd
|
||
|
passwd()</code></pre>
|
||
|
<p>Copied by “password hash”</p>
|
||
|
<pre><code>jupyter notebook --generate-config
|
||
|
nano ~/.jupyter/jupyter_notebook_config.py</code></pre>
|
||
|
<pre><code>c.NotebookApp.base_url = '/sandbot/lab/mmurtaugh/'
|
||
|
c.NotebookApp.port = 9050
|
||
|
c.NotebookApp.trust_xheaders = True
|
||
|
c.NotebookApp.port_retries = 50
|
||
|
c.NotebookApp.password = 'sha1:PASSWORD_HASH_FROM_ABOVE'
|
||
|
c.NotebookApp.allow_remote_access = True</code></pre>
|
||
|
<p>Followed <a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-a-jupyterlab-environment-on-ubuntu-18-04#step-6-%E2%80%94-setting-up-a-systemd-service">this tutorial</a> on creating a systemd service. Used my username (and group).</p>
|
||
|
<pre><code>sudo nano /etc/systemd/system/jupyterlab@.service</code></pre>
|
||
|
<pre><code>[Unit]
|
||
|
Description=Jupyter Lab Server (%i)
|
||
|
After=nginx.service
|
||
|
|
||
|
[Service]
|
||
|
User=%i
|
||
|
Group=%i
|
||
|
Type=simple
|
||
|
WorkingDirectory=/home/%i/
|
||
|
ExecStart=/usr/local/bin/jupyter-lab --config=/home/%i/.jupyter/jupyter_notebook_config.py
|
||
|
StandardOutput=null
|
||
|
Restart=always
|
||
|
RestartSec=10
|
||
|
|
||
|
[Install]
|
||
|
WantedBy=multi-user.target</code></pre>
|
||
|
<p>Then you can</p>
|
||
|
<p>sudo systemctl enable jupyterlab@mmurtaugh</p>
|
||
|
<p>or</p>
|
||
|
<p>sudo systemctl start jupyterlab@mmurtaugh</p>
|
||
|
<p>and</p>
|
||
|
<p>sudo systemctl status jupyterlab@mmurtaugh</p>
|
||
|
</body>
|
||
|
</html>
|