FreshRSS on Raspberry Pi

· 731 words · 4 minute read

I recently installed FreshRSS on an old Raspberry Pi 2 Model B . Since I don’t have much experience with databases and web servers, I had to rely on the many tutorials available on the internet. The whole thing involved a few failed attempts, as some of the instructions no longer reflect the current state. I would like to add another tutorial here that documents the procedure that finally worked for me.

My setup: Operating from a laptop running Ubuntu, the Raspberry Pi is connected via ethernet cable. I mostly worked from shell using SSH, but for checking the results I also used the Pi’s GUI accessed by remote desktop.

My goal: Using FreshRSS as sync service for different devices, only within the local network, so no configuration of DynDNS, SSL or the like.

So here we go!

Install RPI-Imager on your workstation
snap install rpi-imager
Start RPI-Imager
rpi-imager
Select Raspberry Pi OS and Micro SD Card storage, the SD card will be prepared. To activate ssh: put an empty file „ssh“ in the SD card’s boot partition. Put the SD card into the Pi and start it up. Find out its IP address from your router’s menu.

Connect to Pi via SSH, using the IP you found
ssh pi@xxx.xxx.xxx.xxx
Change the standard password
passwd
Update and upgrade the Pi, restart may be required
sudo apt update sudo apt upgrade

If you want to use remote desktop connection install on Pi:
sudo apt install xrdp
and on your workstation:
sudo apt install rdesktop
This allows to access the Pi’s GUI from the workstation by
rdesktop xxx.xxx.xxx.xxx

Install the Apache web server on the Pi
sudo apt install apache2

Start and enable Apache to execute automatically at boot time
sudo systemctl enable apache2 sudo systemctl start apache2

Open the default site configuration file to ensure that the DocumentRoot directive points to the correct directory
sudo nano /etc/apache2/sites-enabled/000-default.conf
As DocumentRoot configuration you should find this:
DocumentRoot „/var/www/html“
Copy the following Directory Apache directives and insert them just before the closing </VirtualHost> tag.
<Directory /var/www/html/><br></br>Options Indexes FollowSymLinks MultiViews<br></br>AllowOverride All<br></br>Order allow,deny<br></br>allow from all<br></br></Directory>
Save (ctrl+o) and exit (ctrl+x) the file.

Enable the mod_rewrite Apache module and then restart Apache
sudo a2enmod rewrite<br></br>sudo systemctl restart apache2

Install all the PHP stuff (in my case I got PHP 7.4)
sudo apt install php php-gd php-mbstring php-common php-mysql php-imagick php-xml libapache2-mod-php php-curl php-tidy php-zip php-gmp php-intl php-sqlite3

Install MariaDB database server (replacing MySQL)
sudo apt install mariadb-server

Start and enable MariaDB server to execute automatically at boot time
sudo systemctl enable mariadb<br></br>sudo systemctl start mariadb

Secure your MariaDB server installation (the root password will be blank, so simply hit enter when prompted )
sudo mysql_secure_installation
When prompted to create a MariaDB root user, select yes and then enter a password. You may answer yes to all of the other yes/no questions.

Log in as the MariaDB root user using the password you just assigned.
sudo mariadb -u root -p
Run the following queries to create a MariaDB database and database user (you might use other strings for database user and password)
CREATE DATABASE db_name CHARACTER SET utf8 COLLATE utf8_general_ci;<br></br>CREATE USER 'db_user'@'localhost' IDENTIFIED BY 'db_password';<br></br>GRANT ALL PRIVILEGES ON db_name.* TO 'db_user'@'localhost';<br></br>FLUSH PRIVILEGES;<br></br>EXIT;

Install Git to obtain FreshRSS
sudo apt install git

Change to the default web directory
cd /var/www/html/

Download the latest FreshRSS source, this will create a folder „freshrss“
sudo git clone https://github.com/FreshRSS/FreshRSS.git freshrss

Change ownership of the web files to the system’s server user (www-data) to avoid any permissions problems
sudo chown -R www-data:www-data * ./

Restart the Apache web server once again
sudo systemctl restart apache2

Now it’s time to open your new installation from your browser

http://xxx.xxx.xxx.xxx/freshrss

You see the configuration page of FreshRSS. The important part is to identify the database. Select MySQL (even you just created a MariaDB database, they’re compatible), enter the identifiers for the database: name, user and password. As „host“ type localhost and leave the „prefix“ field blank.

That’s it. FreshRSS should now be at your service!

PS: I defined a cron job to to regularly initiate feed updates in the background. Open an editor with sudo privileges
sudo nano
By copying the following line, you effect that the server user www-data starts the script every 20 minutes
*/20 * * * * www-data php -f /var/www/html/freshrss/app/actualize_script.php > /tmp/reFreshRSS.log 2>&1
Save (ctrl+o) it to etc/cron.d/refreshrss and exit (ctrl+x) the file.