How to install Selfoss on a CentOS 7 Linux VPS

In the following article we are going to guide you through the steps of installing Selfoss on a CentOS 7 Linux VPS.

What is Selfoss?

It is a new multipurpose RSS reader, live stream, mashup and aggregation web application with the following features:

  1. web based rss reader
  2. universal aggregator
  3. open source and free
  4. easy extendable with an open plugin system (write your own data connectors)
  5. mobile support (Android, iOS, iPad)
  6. use selfoss to live stream and collect all your posts, tweets, feeds in one place
  7. lightweight PHP application with less than 2 MB
  8. supports MySQL, PostgreSQL and Sqlite Databases
  9. OPML Import
  10. restful json api
  11. third party apps for iOS and Android available

System Requirements?

  • A Linux VPS Hosting
  • PHP 5.3 or higher
  • MySQL, PostgreSQL or Sqlite
  • Apache, Nginx or Lighttpd Webserver
  • Mod_Rewrite and Mod_Headers

UPDATE SYSTEM

Before proceeding any further, ssh to your CentOS VPS, initiate a screen session and upgrade your system using yum:

## screen -U -S selfoss-centos
## yum update
## yum install unzip vim

INSTALL LEMP (Linux Nginx MariaDB and PHP)

Selfoss requires a webserver, a database server and a PHP server so go ahead and install LEMP on the CentOS 7 VPS. Once you complete the LEMP installation proceed with creating a database for Selfoss.

CREATE A NEW DATABASE

Selfoss requires a database to store its data, so use your favorite MySQL tools to create a new database or use command line as in:

# mysql -u root -p

MariaDB [(none)]> create database selfoss;
MariaDB [(none)]> grant all on selfoss.* to selfoss@localhost identified by 'SECURE_PASSWORD';
MariaDB [(none)]> \q

SELFOSS INSTALLATION AND CONFIGURATION

ban3

DOWNLOAD AND EXTRACT SELFOSS

We’ll be using /srv/www as webserver document root, so let’s create this directory and download Selfoss using:

## mkdir -p /srv/www
## wget https://github.com/SSilence/selfoss/archive/master.zip -O /tmp/selfoss.zip
## unzip /tmp/selfoss.zip -d /srv/www/

now you should have selfoss extracted in /srv/www/selfoss-master. proceed with selfoss configuration

SELFOSS CONFIGURATION

Any settings in config.ini will override the settings in defaults.ini. To customize settings follow these instructions:

  1. Copy defaults.ini to config.ini
  2. Edit config.ini and delete any lines you do not wish to override.
  3. Do not delete the [globals] line.
## cd /srv/www/selfoss-master
## cp defaults.ini config.ini
## vim config.ini

A sample config.ini may look like the following:

[globals]
db_type=mysql
db_host=localhost
db_database=selfoss
db_username=selfoss
db_password=SECURE_PASSWORD
db_port=3306

WEBSERVER CONFIGURATION

Next, we have to setup a virtual server block so we can serve the Selfoss RSS app using http://rss.mydomain.com. To achieve this, create the following file in /etc/nginx/conf.d/selfoss.conf. Of course, make sure you change the relevant information to match yours.

server {
    listen 80;
    server_name rss.mydomain.com;
    root /srv/www/selfoss-master/;
    access_log /var/log/nginx/rss.access.log;
    error_log /var/log/nginx/rss.error.log;

    location ~* \ (gif|jpg|png) {
        expires 30d;
    }
    location ~ ^/favicons/.*$ {
        try_files $uri /data/$uri;
    }
    location ~ ^/thumbnails/.*$ {
        try_files $uri /data/$uri;
    }
    location ~* ^/(data\/logs|data\/sqlite|config\.ini|\.ht) {
        deny all;
    }
    location / {
        index index.php index.html index.htm;
        try_files $uri /public/$uri /index.php$is_args$args;
    }
    location ~ \.php$ {
    	try_files $uri = 404;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include /etc/nginx/fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}

With the Nginx configuration file in place, proceed with reloading the webserver for the change to take effect using:

## nginx -t
## systemctl restart nginx

Set-up proper ownership:

## chown nginx: -R /srv/www/selfoss-master/
ban1

With the Nginx configuration file in place, proceed with reloading the webserver for the change to take effect using:

## nginx -t
## systemctl restart nginx

Set-up proper ownership:

## chown nginx: -R /srv/www/selfoss-master/

ACCESS SELFOSS

Finally, access your Selfoss RSS reader at http://rss.mydomain.com using your favorite web browser.

You may also want to setup a cron job which will update your feeds using:

## echo "*/10 * * * * root wget -o /dev/null http://yourwebsite.com/update" >> /etc/cron.d/selfoss

Leave a Reply

Your email address will not be published. Required fields are marked *