
Installing FreshRSS on Linux
fossI've been using feedly as my news aggregator, also known as rss reader. In recent months I became interested in open source applications and as an extension to that, hosting them yourself so are in control of your data, in this blog post I will run through the steps required to setup your own self hosted freshRSS
Hosting
You can follow this guide using any type of hosting, all you need is a Linux distribution (I'm using Ubuntu) and a server, this can be a rusty RaspberryPi or a hosted VPS solution such as DigitalOcean or Amazon Lightsails, which are both extremely cheap to use (\$5 per month). I'm going to use a fresh Ubuntu server on Amazon Lightsails.
Installing Nginx
sudo apt update
sudo apt install -y nginx
When nginx installed succesfully and you browse to the ip of your server, you should see the "Welcome to nginx!" page.
Install and configure MySQL
Install mysql-server and run the secure installation, which will remove test databases and secure our installation.
sudo apt install -y mysql-server
sudo mysql_secure_installation
Select the following options during the secure installation
- Validate password plugin: Yes
- Remove anonymous users: Yes
- Disable root login remotely: Yes
- Remove test database: Yes
- Reload privileges: Yes
Next let's create an independant user for our freshrss database, and the database itself.
Connect to our mysql database using sudo mysql
, make sure to replace the password with your own.
CREATE USER 'freshrssuser'@'localhost' IDENTIFIED BY 'freshrsspassword';
CREATE DATABASE `freshrss`;
GRANT ALL privileges ON `freshrss`.* TO 'freshrssuser'@localhost;
FLUSH PRIVILEGES;
QUIT;
Installing PHP
sudo apt -y install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
Install php and required modules, we're using nginx so we will use php-fpm, after installation start php-fpm.
sudo apt install -y php7.4 php7.4-fpm php7.4-curl php7.4-mbstring php7.4-mysql php7.4-dom
sudo systemctl start php7.4-fpm
Install FreshRSS
cd /var/www
sudo git clone https://github.com/FreshRSS/FreshRSS.git freshrss
Move into our newly created freshrss folder and set permissions for reading and writing our data
cd /var/www/freshrss
sudo chown -R :www-data .
sudo chmod -R g+rw .
Create the NGINX Server Block
Remove the default server block and it's symlink in the enabled sites, so we can start fresh and create our own.
sudo rm /etc/nginx/sites-available/default
sudo rm /etc/nginx/sites-enabled/default
Let's create our own nginx server block
sudo nano /etc/nginx/sites-available/freshrss
Add the following configuration data, for the purpose of this demo we won't be using ssl, you could uncomment the ssl lines if you like. I commented the code inline so you can understand what's going on.
server {
listen 80 default_server;
listen 443 ssl;
# We're not using SSL for the purpose of this demo
# Feel free to get a certificate and uncomment the following lines.
#
# ssl on;
# ssl_certificate /etc/nginx/server.crt;
# ssl_certificate_key /etc/nginx/server.key;
# your server’s IP or URL(s)
server_name mysite.com;
# the folder of your FreshRSS installation
root /var/www/freshrss/p;
index index.php index.html index.htm;
# nginx log files
access_log /var/log/nginx/freshrss.access.log;
error_log /var/log/nginx/freshrss.error.log;
# php files handling
# this regex is mandatory because of the API
location ~ ^.+?\.php(/.*)?$ {
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
# FreshRSS API greader.php needs the variable PATH_INFO
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location / {
try_files $uri $uri/ index.php;
}
}
Save and exit nano and verify that the server block is valid by running
sudo nginx -t
When the above command succeeded and we don't have errors, symlink our new server block to the sites-enabled folder so it will be used by nginx, and restart the server.
sudo ln -s /etc/nginx/sites-available/freshrss /etc/nginx/sites-enabled/
sudo service nginx restart
FreshRSS Configuration
When you browse to your server or domain name, you should see the freshRSS installation page, if all php modules installed correctly, we should see all checklist items light up in green.
Finish the database configuration with the data we used in previous steps, freshrssuser for the database user, freshrsspassword as password and freshrss as the database name.
Choose a username and password to login to your web interface, you can optionally choose to not use authentication, but that's doesn't seem like a great idea.
That should bring you to the web interface login screen, into your freshRSS dashboard and to the end of this guide. If you have any questions or comments you can reach me at miguel@notflip.be