Install Miniflux

miniflux, rss, selfhosted

I consume all my news, blogs and podcasts through RSS for a safe and distraction free way to consume the content. I’ve been doing that for many years with different apps and self hosted solutions. The one I’ve been using the last few years is Miniflux. It features a nice web interface which works great on both phone and PC. Miniflux also works as a progressive web app, which is a big plus since I’m usually reading on the phone.

What is Miniflux?

The RSS aggregator pulls the actual content and strips away everything else such as ads, trackers, cookies, Javascripts and other nasty stuff. In times like these it’s nice to be able to read news and other stuff without the need to actually visiting the site. Many social media platforms allow you to follow users content via RSS.

Of course it’s possible to filter out articles before it hits your feed, if there is stuff you know you dont want in the feed.

I remember the first time I was going to install it and had some problems because their own documentation is a bit messy. This is how I installed Miniflux on a Debian 10 server.

Before installing - update the system

It’s always a good practice to update the repositories

sudo apt update && sudo apt upgrade

Install dependencies

The first thing is to install a few packages needed for Miniflux.

sudo apt install postgresql nginx python3-certbot-nginx

Install Miniflux

Download and install Miniflux. Since I run Debian on my server and I am too lazy to compile it myself, I will go for the .deb-package. Find the latest release on their Github

wget https://github.com/miniflux/v2/releases/download/x.x.xx/miniflux_x.x.xx_amd64.deb
sudo dpkg -i miniflux_x.x.xx_amd64.deb

Configuration

The config file is located in /etc/miniflux.conf. To find out what options there are for the configuration file, take a look at the official documentation. If the file doesn’t exist - just create it.

This is my config below

DATABASE_URL="user=miniflux password=pw dbname=miniflux sslmode=disable"
BASE_URL=https://your.domain
LISTEN_ADDR=/run/miniflux/miniflux.sock
POLLING_FREQUENCY=15
BATCH_SIZE=30
CLEANUP_FREQUENCY_HOURS=24
CLEANUP_ARCHIVE_READ_DAYS=30
CLEANUP_ARCHIVE_UNREAD_DAYS=-1
CLEANUP_REMOVE_SESSIONS_DAYS=30
RUN_MIGRATION=1

Just a heads up. A few versions back they added the option CLEANUP_ARCHIVE_UNREAD_DAYS which removes unread entries after..I think it was 6 months. If you add that option and set it to -1, they will never be removed from the database.

Export DATABASE_URL variable

export DATABASE_URL="user=miniflux password=pw dbname=miniflux sslmode=disable"

Create the database and run database migration

sudo -u postgres createuser -P miniflux
sudo -u postgres createdb -O miniflux miniflux
sudo -u postgres psql

postgres=# ALTER USER miniflux WITH SUPERUSER;
postgres=# \q
miniflux -migrate
sudo -u postgres psql
postgres=# ALTER USER miniflux WITH NOSUPERUSER;
postgres=# \q

nginx

We need to create and populate the nginx configuration file

sudo vim /etc/nginx/sites-available/miniflux

This is the config Miniflux provides

server {
    server_name     your.domain;

    location / {
        proxy_pass http://unix:/run/miniflux/miniflux.sock;
        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Enable the nginx config

sudo ln -s /etc/nginx/site-available/miniflux /etc/nginx/sites-enabled/

If the service dont start

For some reason Miniflux doesn’t create a socket file and won’t be able to start by itself.

I always try to start Miniflux myself before I do manually create the socket file.

sudo systemctl start miniflux && sudo systemctl status miniflux

If it refuse to start up we create it manually and then restart both Miniflux and nginx

sudo mkdir /run/miniflux/ && sudo chown -R miniflux: /run/miniflux
sudo systemctl restart miniflux
sudo systemctl restart nginx

Certbot

The last thing we need to do before Miniflux is up and running is to create a certificate for the domain name. You’ll be guided though the creation of the certificate. After that we will restart the services

sudo certbot

Final step, create your admin user

miniflux -create-admin

Now the Miniflux is up and running with your user and a valid certificate.

Newsboat

I know a lot of people like to have their RSS feed in the terminal. While this is greate when you’re at home, I usually read my feed when I’m not at the computer. However, it is possible to integrate your feed into Newsboat, see this part in the newsboat documentation.

I still haven’t looked in to a password file or any other safe way to store my password yet.