cronyakatsuki.xyz/public/blog/miniflux-setup/index.html

194 lines
16 KiB
HTML
Raw Normal View History

2023-10-05 21:05:32 +02:00
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="/css/style.css" rel="stylesheet" />
<title>miniflux setup on debian</title>
<meta property="og:title" content="miniflux setup on debian" />
<meta property="og:description" content="Looking for a minimal self-hosted feed reader I found miniflux. But trying to set it up I found my self trying to set it up for 3 freaking hours since I only recently started to self-host things. So here I will try to explaing it in the most easy way how to set it up on a debian server with https using certbot and nginx.
For this tutorial I expect that you already have a server seted up with nginx and certbot." />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://cronyakatsuki.xyz/blog/miniflux-setup/" /><meta property="article:section" content="blog" />
<meta property="article:published_time" content="2022-11-30T00:00:00+00:00" />
<meta property="article:modified_time" content="2022-11-30T00:00:00+00:00" /><meta property="og:site_name" content="Crony Akatsuki&#39;s Website" />
2023-12-09 19:59:23 +01:00
2023-10-05 21:05:32 +02:00
</head>
<body>
<header>
<h1>Crony Akatsuki</h1>
<nav>
<span><a href="/">Home</a></span>
<span>|</span>
<span><a href="/about">About</a></span>
<span>|</span>
<span><a href="/blog">Blog</a></span>
<span>|</span>
<span><a href="/services">Services</a></span>
</nav>
</header>
<main>
<div id="content">
<h1>miniflux setup on debian</h1>
2023-10-06 19:04:36 +02:00
2023-10-06 20:10:52 +02:00
<div id="blog-meta">
<p id="date">30-11-2022</p>
<p>
<span>|</span>
<a href="https://cronyakatsuki.xyz/tags/self-host/">self-host</a> <span>|</span>
<a href="https://cronyakatsuki.xyz/tags/rss/">rss</a></p>
<hr>
2023-10-06 19:04:36 +02:00
</div>
<p>Looking for a minimal self-hosted feed reader I found <a href="https://miniflux.app/">miniflux</a>. But trying to set it up I found my self trying to set it up for 3 freaking hours since I only recently started to self-host things. So here I will try to explaing it in the most easy way how to set it up on a debian server with https using certbot and nginx.</p>
2023-10-05 21:05:32 +02:00
<!-- raw HTML omitted -->
<p>For this tutorial I expect that you already have a server seted up with nginx and certbot. To set up this things check out <a href="https://landchad.net">landchad</a></p>
<h2 id="installing-needed-packages">Installing needed packages</h2>
<p>You will first need to setup miniflux apt repository to install it on your system.</p>
2023-10-24 19:16:22 +02:00
<div class="highlight"><pre tabindex="0" style="color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#99d1db">echo</span> <span style="color:#a6d189">&#34;deb [trusted=yes] https://repo.miniflux.app/apt/ /&#34;</span> | sudo tee /etc/apt/sources.list.d/miniflux.list &gt; /dev/null
2023-10-05 21:05:32 +02:00
</span></span><span style="display:flex;"><span>apt update
</span></span></code></pre></div><p>Then just install the needed packages.</p>
2023-10-24 19:16:22 +02:00
<div class="highlight"><pre tabindex="0" style="color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>apt install miniflux postgresql
2023-10-05 21:05:32 +02:00
</span></span></code></pre></div><h2 id="setting-up-postgres-database-and-miniflux">Setting up postgres database and miniflux</h2>
<p>Here I will detail steps to create the postgres database.</p>
<h3 id="initial-postgres-setup">Initial postgres setup</h3>
2023-10-24 19:16:22 +02:00
<div class="highlight"><pre tabindex="0" style="color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#737994;font-style:italic"># Switch to the postgres user</span>
2023-10-05 21:05:32 +02:00
</span></span><span style="display:flex;"><span>$ su - postgres
</span></span><span style="display:flex;"><span>
2023-10-24 19:16:22 +02:00
</span></span><span style="display:flex;"><span><span style="color:#737994;font-style:italic"># Creating a miniflux user, enter a safe and secure password</span>
2023-10-05 21:05:32 +02:00
</span></span><span style="display:flex;"><span>$ createuser -P miniflux
</span></span><span style="display:flex;"><span>
2023-10-24 19:16:22 +02:00
</span></span><span style="display:flex;"><span><span style="color:#737994;font-style:italic"># Create a database for miniflux that belongs to our user</span>
2023-10-05 21:05:32 +02:00
</span></span><span style="display:flex;"><span>$ createdb -O miniflux miniflux
</span></span><span style="display:flex;"><span>
2023-10-24 19:16:22 +02:00
</span></span><span style="display:flex;"><span><span style="color:#737994;font-style:italic"># Create a database for miniflux that belongs to our user</span>
2023-10-05 21:05:32 +02:00
</span></span><span style="display:flex;"><span>$ createdb -O miniflux miniflux
</span></span><span style="display:flex;"><span>
2023-10-24 19:16:22 +02:00
</span></span><span style="display:flex;"><span><span style="color:#737994;font-style:italic"># Creating extension hstore as superuser</span>
2023-10-05 21:05:32 +02:00
</span></span><span style="display:flex;"><span>$ psql miniflux -c <span style="color:#a6d189">&#39;create extension hstore&#39;</span>
</span></span><span style="display:flex;"><span>
2023-10-24 19:16:22 +02:00
</span></span><span style="display:flex;"><span><span style="color:#737994;font-style:italic"># Managing the miniflux database</span>
</span></span><span style="display:flex;"><span>$ psql <span style="color:#f2d5cf">$MINIFLUX_DATABASE</span>
2023-10-05 21:05:32 +02:00
</span></span><span style="display:flex;"><span>
2023-10-24 19:16:22 +02:00
</span></span><span style="display:flex;"><span><span style="color:#737994;font-style:italic"># Giving miniflux user all privileges</span>
</span></span><span style="display:flex;"><span>&gt; alter user miniflux with superuser;
2023-10-05 21:05:32 +02:00
</span></span><span style="display:flex;"><span>
2023-10-24 19:16:22 +02:00
</span></span><span style="display:flex;"><span><span style="color:#737994;font-style:italic"># Exit the postgres database</span>
2023-10-05 21:05:32 +02:00
</span></span><span style="display:flex;"><span>&gt; <span style="color:#8caaee">\q</span>
</span></span><span style="display:flex;"><span>
2023-10-24 19:16:22 +02:00
</span></span><span style="display:flex;"><span><span style="color:#737994;font-style:italic"># Exit postgres user</span>
</span></span><span style="display:flex;"><span>$ <span style="color:#99d1db">exit</span>
2023-10-05 21:05:32 +02:00
</span></span></code></pre></div><h3 id="miniflux-configuration-file">Miniflux configuration file</h3>
<p>Open the miniflux configuration file in path <code>/etc/miniflux.conf</code> and edit it like this.</p>
2023-10-24 19:16:22 +02:00
<div class="highlight"><pre tabindex="0" style="color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#737994;font-style:italic"># See https://miniflux.app/docs/configuration.html</span>
</span></span><span style="display:flex;"><span><span style="color:#f2d5cf">LISTEN_ADDR</span><span style="color:#99d1db;font-weight:bold">=</span>127.0.0.1:8080
</span></span><span style="display:flex;"><span><span style="color:#f2d5cf">DATABASE_URL</span><span style="color:#99d1db;font-weight:bold">=</span><span style="color:#f2d5cf">user</span><span style="color:#99d1db;font-weight:bold">=</span>miniflux <span style="color:#f2d5cf">password</span><span style="color:#99d1db;font-weight:bold">=</span>PASSWORD_HERE <span style="color:#f2d5cf">dbname</span><span style="color:#99d1db;font-weight:bold">=</span>miniflux <span style="color:#f2d5cf">sslmode</span><span style="color:#99d1db;font-weight:bold">=</span>disable
</span></span><span style="display:flex;"><span><span style="color:#f2d5cf">RUN_MIGRATIONS</span><span style="color:#99d1db;font-weight:bold">=</span><span style="color:#ef9f76">1</span>
2023-10-05 21:05:32 +02:00
</span></span></code></pre></div><h3 id="migrating-the-database-and-removing-superuser-privileges-in-postgres">Migrating the database and removing superuser privileges in postgres</h3>
<p>Now we will migrate the database and remove unneded superuser privileges, since it is reccomended in the miniflux documentation.</p>
2023-10-24 19:16:22 +02:00
<div class="highlight"><pre tabindex="0" style="color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#737994;font-style:italic"># Migrating the database</span>
2023-10-05 21:05:32 +02:00
</span></span><span style="display:flex;"><span>$ miniflux -c /etc/miniflux.conf -migrate
</span></span><span style="display:flex;"><span>
2023-10-24 19:16:22 +02:00
</span></span><span style="display:flex;"><span><span style="color:#737994;font-style:italic"># Creating miniflux admin user</span>
2023-10-05 21:05:32 +02:00
</span></span><span style="display:flex;"><span>$ miniflux -c /etc/miniflux.conf -create-admin
</span></span><span style="display:flex;"><span>
2023-10-24 19:16:22 +02:00
</span></span><span style="display:flex;"><span><span style="color:#737994;font-style:italic"># Restarting the systemctl service</span>
2023-10-05 21:05:32 +02:00
</span></span><span style="display:flex;"><span>$ systemctl restart miniflux
</span></span><span style="display:flex;"><span>
2023-10-24 19:16:22 +02:00
</span></span><span style="display:flex;"><span><span style="color:#737994;font-style:italic"># Entering postgres database user</span>
2023-10-05 21:05:32 +02:00
</span></span><span style="display:flex;"><span>$ su - postgres
</span></span><span style="display:flex;"><span>
2023-10-24 19:16:22 +02:00
</span></span><span style="display:flex;"><span><span style="color:#737994;font-style:italic"># Entering miniflux database</span>
</span></span><span style="display:flex;"><span>$ psql <span style="color:#f2d5cf">$MINIFLUX_DATABASE</span>
2023-10-05 21:05:32 +02:00
</span></span><span style="display:flex;"><span>
2023-10-24 19:16:22 +02:00
</span></span><span style="display:flex;"><span><span style="color:#737994;font-style:italic"># Removing unneded superuser privileges from miniflux user</span>
</span></span><span style="display:flex;"><span>&gt; alter user miniflux with nosuperuser;
2023-10-05 21:05:32 +02:00
</span></span><span style="display:flex;"><span>
2023-10-24 19:16:22 +02:00
</span></span><span style="display:flex;"><span><span style="color:#737994;font-style:italic"># Exit the postgres database</span>
2023-10-05 21:05:32 +02:00
</span></span><span style="display:flex;"><span>&gt; <span style="color:#8caaee">\q</span>
</span></span><span style="display:flex;"><span>
2023-10-24 19:16:22 +02:00
</span></span><span style="display:flex;"><span><span style="color:#737994;font-style:italic"># Exit postgres user</span>
</span></span><span style="display:flex;"><span>$ <span style="color:#99d1db">exit</span>
2023-10-05 21:05:32 +02:00
</span></span></code></pre></div><h2 id="nginx-and-certbot-setup">Nginx and certbot setup</h2>
<p>Make sure to have a domain to use for your miniflux setup.</p>
<p>Create and open a nginx config with path <code>/etc/nginx/sites-available/miniflux.conf</code> and add this</p>
2023-10-24 19:16:22 +02:00
<div class="highlight"><pre tabindex="0" style="color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-nginx" data-lang="nginx"><span style="display:flex;"><span><span style="color:#ca9ee6">server</span> {
</span></span><span style="display:flex;"><span> <span style="color:#81c8be">server_name</span> <span style="color:#a6d189">your.domain.ext</span>;
</span></span><span style="display:flex;"><span> <span style="color:#81c8be">listen</span> <span style="color:#ef9f76">80</span>;
</span></span><span style="display:flex;"><span> <span style="color:#81c8be">listen</span> <span style="color:#a6d189">[::]:80</span>;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span> <span style="color:#81c8be">location</span> <span style="color:#a6d189">/</span> {
</span></span><span style="display:flex;"><span> <span style="color:#81c8be">proxy_pass</span> <span style="color:#a6d189">http://127.0.0.1:8080</span>;
</span></span><span style="display:flex;"><span> <span style="color:#81c8be">proxy_redirect</span> <span style="color:#e5c890">off</span>;
</span></span><span style="display:flex;"><span> <span style="color:#81c8be">proxy_set_header</span> <span style="color:#a6d189">Host</span> <span style="color:#f2d5cf">$host</span>;
</span></span><span style="display:flex;"><span> <span style="color:#81c8be">proxy_set_header</span> <span style="color:#a6d189">X-Real-IP</span> <span style="color:#f2d5cf">$remote_addr</span>;
</span></span><span style="display:flex;"><span> <span style="color:#81c8be">proxy_set_header</span> <span style="color:#a6d189">X-Forwarded-For</span> <span style="color:#f2d5cf">$proxy_add_x_forwarded_for</span>;
</span></span><span style="display:flex;"><span> <span style="color:#81c8be">proxy_set_header</span> <span style="color:#a6d189">X-Forwarded-Proto</span> <span style="color:#f2d5cf">$scheme</span>;
</span></span><span style="display:flex;"><span> }
</span></span><span style="display:flex;"><span>}
2023-10-05 21:05:32 +02:00
</span></span></code></pre></div><p>Now just link the config to enabled sites and restart nginx service.</p>
2023-10-24 19:16:22 +02:00
<div class="highlight"><pre tabindex="0" style="color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>$ ln -s /etc/nginx/sites-available/miniflux.conf /etc/nginx/sites-enabled/miniflux.conf
2023-10-05 21:05:32 +02:00
</span></span><span style="display:flex;"><span>$ systemctl restart nginx
</span></span></code></pre></div><p>To get https on your domain you just need to run <code>certbot --nginx</code> same as in this <a href="https://landchad.net/basic/certbot/">tutorial</a></p>
<h2 id="finishing-words">Finishing words</h2>
<p>I hope that this wasn&rsquo;t hard to follow and shouldn&rsquo;t take hours like it took me first time I tried to set this all up.</p>
2023-10-06 19:04:36 +02:00
</div>
2023-10-05 21:05:32 +02:00
</main>
<footer>
<div id="links">
<span><a href="https://code.cronyakatsuki.xyz">Code</a></span>
<span>|</span>
<span><a href="https://steamcommunity.com/id/CronyAkatsuki/">Steam</a></span>
<span>|</span>
<span><a href="https://osu.ppy.sh/users/18953565">Osu!</a></span>
<span>|</span>
<span><a href="https://anilist.co/user/CronyAkatsuki/">Anilist</a></span>
<span>|</span>
<span><a href="https://youtube.com/channel/UClFdlNlUipHG5Kit8GbFz5Q">Gaming Channel</a></span>
2023-11-07 19:47:47 +01:00
<span>|</span>
<span><a href="https://uptime.cronyakatsuki.xyz/status/public">Services Status</a></span>
2023-12-17 11:17:57 +01:00
<span>|</span>
<span><a href="https://lemmy.cronyakatsuki.xyz/u/crony">Lemmy</a></span>
2023-10-05 21:05:32 +02:00
</div>
<div id="banners">
<a rel="noreferrer" href="/" target="_blank"><img src="/88x31.png"
alt="Me" title="Me" /></a>
<a rel="noreferrer" href="https://kernel.org" target="_blank"><img src="https://cyber.dabamos.de/88x31/linux_powered.gif"
alt="linux kernel" title="Best kernel in the world" /></a>
<a rel="noreferrer" href="https://debian.org" target="_blank"><img src="https://cyber.dabamos.de/88x31/debian.gif"
alt="debian" title="This website run's on debian" /></a>
<a rel="noreferrer" href="https://bitwarden.com" target="_blank"><img src="https://cyber.dabamos.de/88x31/bitwarden.gif"
alt="Bitwarden" title="Bitwarden/Vaultwarden for the win" /></a>
<a rel="noreferrer" target="_blank"><img src="https://cyber.dabamos.de/88x31/free.gif"
alt="foss" title="Foss is the way" /></a>
<a rel="noreferrer" href="https://neovim.io" target="_blank"><img src="/assets/badges/neovim.gif"
alt="Neovim" title="Written in neovim" /></a>
<a rel="noreferrer" href="https://landchad.net" target="_blank"><img src="https://landchad.net/pix/landchad.gif"
alt="LandChad" title="Get A Website!" /></a>
<a rel="noreferrer" href="https://poggerer.xyz" target="_blank"><img src="https://poggerer.xyz/88x31.png"
alt="Tulg" title="Tulg" /></a>
<a rel="noreferrer" href="https://arthurmelton.com" target="_blank"><img src="https://arthurmelton.com/88x31.png"
alt="AMTitan" title="AMTitan" /></a>
<a rel="noreferrer" href="https://aadi.net.in" target="_blank"><img src="https://aadi.net.in/88x31.png"
alt="Aadi" title="Aadi" /></a>
<a rel="noreferrer" href="https://bear.oops.wtf/" target="_blank"><img src="https://bear.oops.wtf/download/88x31.png"
alt="Bear" title="Bear" /></a>
</div>
</footer>
</body>
</html>