Files
felixfoertsch.de/Content/Archive/220123-ff.de v10 felixfoertsch.github.io/_site/2018/05/21/Syncthing-auf-Uberspace.html
T

378 lines
12 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="en-us">
<head>
<link href="https://gmpg.org/xfn/11" rel="profile" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<!-- Enable responsiveness on mobile devices-->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1" />
<title>
Install Syncthing on Uberspace 6 in a Subdomain &middot; felixfoertsch.de
</title>
<!-- CSS -->
<link rel="stylesheet" href="/assets/css/main.css" />
<!-- Icons -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/favicon.png" />
<link rel="shortcut icon" href="/favicon.png" />
<!-- RSS -->
<link rel="alternate" type="application/rss+xml" title="RSS" href="/feed.xml" />
</head>
<body class="post">
<nav class="navbar navbar-dark bg-dark navbar-expand-md ">
<div class="container-fluid">
<a class="nav-link navbar-brand " href="/"><img src="/favicon.png" width="30" height="30" alt=""> </a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navigation-toggle" aria-controls="navigation-toggle" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navigation-toggle">
<div class="navbar-nav">
<a class="nav-link" href="/about">About</a>
<a class="nav-link" href="/repositories">Repositories</a>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-expanded="false">Categories</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item " href="/category/Design">Design</a></li>
<li><a class="dropdown-item " href="/category/Programming">Programming</a></li>
<li><a class="dropdown-item " href="/category/Tips">Tips</a></li>
<li><a class="dropdown-item " href="/category/summaries">Summaries</a></li>
<li><a class="dropdown-item " href="/category/tutorials">Tutorials</a></li>
</ul>
</li>
<a class="nav-link" title="Tags" aria-label="Tags" href="/tags">Tags</a>
<a class="nav-link" title="Subscribe" aria-label="Subscribe" href="/feed.xml">RSS</a>
<span></span>
</div>
</div>
</div>
</nav>
<main class="container py-3">
<header class="row py-3">
<div class="col">
<h1 class="display-1">Install Syncthing on Uberspace 6 in a Subdomain</h1>
</div>
</header>
<div class="row">
<div class="col">
<div class="card-subtitle mb-2 text-muted">
<span class="">2018-05-21</span> &bull;
<span class=""><svg height="12" class="octicon octicon-sync" viewBox="0 0 16 16" version="1.1" width="12" aria-hidden="true"><path fill-rule="evenodd" d="M8 2.5a5.487 5.487 0 00-4.131 1.869l1.204 1.204A.25.25 0 014.896 6H1.25A.25.25 0 011 5.75V2.104a.25.25 0 01.427-.177l1.38 1.38A7.001 7.001 0 0114.95 7.16a.75.75 0 11-1.49.178A5.501 5.501 0 008 2.5zM1.705 8.005a.75.75 0 01.834.656 5.501 5.501 0 009.592 2.97l-1.204-1.204a.25.25 0 01.177-.427h3.646a.25.25 0 01.25.25v3.646a.25.25 0 01-.427.177l-1.38-1.38A7.001 7.001 0 011.05 8.84a.75.75 0 01.656-.834z"></path></svg> Updated: 2020-07-18</span>
<span class="post-categories">
&bull;
<a href="/category/tutorials">Tutorials</a>
</span>
</div>
<div>
<div class="alert alert-warning">
<h2 class="alert-heading">Uberspace 6 has reached <a href="https://en.wikipedia.org/wiki/End-of-life_(product)">EOL</a></h2>
<p>If you want to use Syncthing, you should create an Uberspace 7 and refer to the the <a href="https://lab.uberspace.de/guide_syncthing.html">Syncthing tutorial from the Uberlab</a>!</p>
</div>
<p>This short tutorial explains how to install <a href="https://syncthing.net">Syncthing</a> on a <a href="https://uberspace.de">Uberspace</a>. It is based on the <a href="https://maxhaesslein.de/dachboden/syncthing-auf-uberspace/"><del>Tutorial</del></a> from <a href="http://maxhaesslein.blog">Max Haesslein</a>. Thanks Max!
<!-- more --></p>
<h2 id="download-newest-syncthing-version">Download newest Syncthing version</h2>
<p>Connect to your uberspace:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ssh &lt;user&gt;@&lt;uberspace&gt;
</code></pre></div></div>
<p>Download the <a href="https://github.com/syncthing/syncthing/releases/latest">newest Syncthing version</a> for Linux:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>cd ~/etc/
wget &lt;NEWEST AMD64 LINUX VERSION&gt;
</code></pre></div></div>
<p>Extract the file (eXtract Ze Files!) and move it to its own folder:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>tar -xzf &lt;FILENAME&gt;
mv &lt;FOLDERNAME&gt; syncthing/
</code></pre></div></div>
<p>Link it to your binaries folder and start it once:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ln -s ~/etc/syncthing/syncthing ~/bin/syncthing
syncthing
</code></pre></div></div>
<p>Close the program with CTRL-C.</p>
<h2 id="prepare-your-uberspace">Prepare your Uberspace</h2>
<p>Get the ports we are going to use for GUI and sync:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>uberspace-add-port -p tcp --firewall
🚀 All good! Opened tcp port &lt;PORT1&gt;.
uberspace-add-port -p both --firewall
🚀 All good! Opened tcp port &lt;PORT2&gt;.
</code></pre></div></div>
<p>Add a subdomain to make your Syncthing easily accessible; also make sure it is possible to connect through HTTPS:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>uberspace-add-domain -w -d sync.&lt;DOMAIN&gt;.de
uberspace-letsencrypt
uberspace-letsencrypt-renew -f
</code></pre></div></div>
<p>If you already use LetsEncrypt, you have to add the domain to your configuration. Just follow the steps displayed after the <code class="language-plaintext highlighter-rouge">uberspace-letsencrypt</code>. Dont forget to add the subdomain to your domain registrar DNS records aswell, so it gets redirected correctly!</p>
<p>Now, create the corresponding folder on the Uberspace:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mkdir /var/www/virtual/&lt;UBERSPACE&gt;/sync.&lt;DOMAIN&gt;.de
</code></pre></div></div>
<p>Edit the <code class="language-plaintext highlighter-rouge">.htaccess</code> so it sends you to the correct port:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>cd /var/www/virtual/&lt;UBERSPACE&gt;/sync.&lt;DOMAIN&gt;.de/
vim .htaccess
</code></pre></div></div>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>RewriteEngine On
RewriteRule (.*) http://localhost:&lt;PORT1&gt;/$1 [P]
</code></pre></div></div>
<h2 id="modify-the-syncthing-config-file">Modify the Syncthing config file</h2>
<p>Open the syncthing config file:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>cd ~/.config/syncthing
vim config.xml
</code></pre></div></div>
<p>Find the GUI entry and replace the port with <code class="language-plaintext highlighter-rouge">&lt;PORT1&gt;</code>:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>...
&lt;gui enabled="true" tls="false" debugging="false"&gt;
&lt;address&gt;127.0.0.1:&lt;PORT1&gt;&lt;/address&gt;
...
</code></pre></div></div>
<p>Find the options entry and replace the port with <code class="language-plaintext highlighter-rouge">&lt;PORT2&gt;</code>:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>...
&lt;options&gt;
...
&lt;localAnnouncePort&gt;&lt;PORT2&gt;&lt;/localAnnouncePort&gt;
&lt;localAnnounceMCAddr&gt;[ff12::8384]&lt;PORT2&gt;&lt;/localAnnounceMCAddr&gt;
...
</code></pre></div></div>
<h2 id="setup-syncthing-as-a-service">Setup Syncthing as a service</h2>
<p>If you dont have any services running, you have to setup the Daemon Tools first: <a href="https://wiki.uberspace.de/system:daemontools">Uberspace Wiki, Daemon Tools</a>.</p>
<p>After setting up the services, you can add Syncthing as a service and restart it once:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>uberspace-setup-service syncthing ~/bin/syncthing
svc -du ~/services/syncthing
</code></pre></div></div>
<h2 id="secure-your-syncthing-instance">Secure your Syncthing instance</h2>
<p>Your Syncthing is now available via <code class="language-plaintext highlighter-rouge">sync.&lt;DOMAIN&gt;.de</code>. However, it is accessible by everyone on the web. Therefore you should secure it. Got to the Syncthing Settings:
<img src="/img/20180602-Syncthing-settings.png" alt="You can access your settings via Actions -&gt; Settings" /></p>
<p><strong>IMPORTANT: Do not check <code class="language-plaintext highlighter-rouge">Use HTTPS for GUI</code> you will lose access to your GUI. To get it back you have to find the TLS option in your Syncthing config and set it to <code class="language-plaintext highlighter-rouge">false</code> again. You connections will have TLS and will be secure without checking this box.</strong></p>
<p>And now enter your admin user and password in the corresponding fields:
<img src="/img/20180602-Syncthing-settings2.png" alt="You can access your settings via Actions -&gt; Settings" /></p>
<h2 id="the-end">The end</h2>
<p>Save and thats it! You now have a Syncthing service running on Uberspace! Ideal for private documents you dont want the NSA to have.</p>
</div>
<div class="py-3">
<a href="/tags#english"><span class="btn btn-sm btn-secondary"><svg height="12" class="octicon octicon-tag" viewBox="0 0 16 16" version="1.1" width="12" aria-hidden="true"><path fill-rule="evenodd" d="M2.5 7.775V2.75a.25.25 0 01.25-.25h5.025a.25.25 0 01.177.073l6.25 6.25a.25.25 0 010 .354l-5.025 5.025a.25.25 0 01-.354 0l-6.25-6.25a.25.25 0 01-.073-.177zm-1.5 0V2.75C1 1.784 1.784 1 2.75 1h5.025c.464 0 .91.184 1.238.513l6.25 6.25a1.75 1.75 0 010 2.474l-5.026 5.026a1.75 1.75 0 01-2.474 0l-6.25-6.25A1.75 1.75 0 011 7.775zM6 5a1 1 0 100 2 1 1 0 000-2z"></path></svg> English</span></a>
<a href="/tags#self-hosted-software"><span class="btn btn-sm btn-secondary"><svg height="12" class="octicon octicon-tag" viewBox="0 0 16 16" version="1.1" width="12" aria-hidden="true"><path fill-rule="evenodd" d="M2.5 7.775V2.75a.25.25 0 01.25-.25h5.025a.25.25 0 01.177.073l6.25 6.25a.25.25 0 010 .354l-5.025 5.025a.25.25 0 01-.354 0l-6.25-6.25a.25.25 0 01-.073-.177zm-1.5 0V2.75C1 1.784 1.784 1 2.75 1h5.025c.464 0 .91.184 1.238.513l6.25 6.25a1.75 1.75 0 010 2.474l-5.026 5.026a1.75 1.75 0 01-2.474 0l-6.25-6.25A1.75 1.75 0 011 7.775zM6 5a1 1 0 100 2 1 1 0 000-2z"></path></svg> Self-Hosted Software</span></a>
</div>
<section>
<h2>Related Posts</h2>
<ul>
<li>
<a href="/2020/08/05/Apple-Colors.html"> Apple Colors in SCSS</a>
<span class="badge bg-secondary">2020-08-05</span>
</li>
<li>
<a href="/2020/08/04/Ideas.html"> Ideas</a>
<span class="badge bg-secondary">2020-08-04</span>
</li>
<li>
<a href="/2020/08/02/Strategies-from-the-Happiness-Lab.html"> Strategies from the Happiness Lab</a>
<span class="badge bg-secondary">2020-08-02</span>
</li>
</ul>
</section>
</div>
</div>
</main>
<footer class="container-fluid py-3">
<script src="/assets/js/bootstrap.min.js" crossorigin="anonymous"></script>
</footer>
</body>
</html>