Selfoss is a powerful, open-source web-based RSS reader, mashup, aggregation, and live stream application written in PHP. It is a lightweight solution with an open plugin system that allows users to create custom data connectors to extend its functionality. The application also enables users to collect tweets, posts, podcast and even feeds in a unified location where they can be accessed with ease via mobile or desktop devices.
This tutorial will show you how to install Selfoss on your CentOS 7 VPS or dedicated server using the LAMP stack (Apache, MariaDB, and PHP).
Ready? Let’s get started!
Before You Begin
For this tutorial to flow seamlessly your require the following:
- A fully configured CentOS server
- LAMP Stack installed in your CentOS server
- Mod_Headers and Mod_Rewrite enabled
Step 1 – Creating Selfoss Database
If you have met all the pre-installation requirements, you can now create a database for the applications:
First, run the command below to access the MariaDB command line:
$ sudo mysql -u root -p
Provide your password and press ENTER to log in. Once you are logged in, run the command below to create a database called ‘selfoss’:
Next, issue the command below to grant the required privileges:
grant all on selfoss.* to selfoss@localhost identifiedby'SECURE_PASSWORD';
Flush the privileges to implement the changes:
Then exit the MariaDB shell:
Step 2 – Installing Selfoss
To install Selfoss, first, create a directory called ‘selfoss’ in /var/www.
$ sudo mkdir /var/www/selfoss
Then run the command below to download Selfoss installation files:
$ cd /var/www/html/ $ sudo wget --content-disposition https://github.com/SSilence/selfoss/releases/download/2.18/selfoss-2.18.zip
Now, execute the command below to check if the files were successfully downloaded:
$ ls -la
This will give you an output similar to the one below:
drwxr-xr-x. 3 root root 43 Oct 31 04:15 . drwxr-xr-x. 4 root root 33 Oct 29 04:15 .. drwxr-xr-x. 8 apache apache 204 Feb 3 2015 lists -rw-r--r--. 1 root root 2881068 Mar 5 2018 selfoss-2.18.zip
Next, run the command below to unzip the file:
$ sudo unzip selfoss-2.18.zip
Then move the installation files to the document root:
$ sudo mv -v selfoss-2.18/* selfoss-2.18/.* /var/www/html 2>/dev/null
Next, change the ownership of these files to prevent permission issues:
$ sudo chown -R apache:apache * ./
$ sudo systemctl restart httpd
Step 3 – Installing Composer
Selfoss requires the Composer to download plugins. Run the command below to install composer:
$ sudo yum -y install composer
Now, change to the web root directory:
Then run composer via apache user:
$ sudo -u apache composer install
You may see a few warning messages but they are nothing to worry about. Everything will be implemented correctly. Once the installer is installed, you can proceed with the last step.
Step 4 – Final Configuration
This is the final step and you need to configure Selfoss to complete the installation. First, ensure you are in the web root directory, then copy the defaults.ini file to the config.ini file:
$ sudo cp -iv defaults.ini config.ini
Next, run the command below to open the config.ini file:
$ sudo nano config.ini
Once the file opens add the database values below to this file:
[globals] db_type=mysql db_host=localhost db_database=selfoss_db db_username=selfoss_user db_password=SECURE_PASSWORD db_port=3306
Web Server Configuration
Next, you need to configure the virtual server block to help access Selfoss directly from mywebmail.tld or RSS.domain.tld. To configure the virtual host, run the command below to open the file /etc/apache2/sites-enabled/selfoss:
$ sudo nano /etc/apache2/sites-enabled/selfoss
Once the file opens, copy and paste the content below:
<VirtualHost *:80> ServerAdmin email@example.com ServerName rss.domain.tld Redirect / https://rss.domain.tld </VirtualHost> <IfModule mod_ssl.c> <VirtualHost *:443> SSLEngineon SSLCertificateFile /etc/ssl/certs/myblog.pem SSLCertificateKeyFile /etc/ssl/private/myblog.key ServerAdmin firstname.lastname@example.org ServerName rss.domain.tld DocumentRoot /var/www/selfoss <Directory /> Options FollowSymLinks AllowOverrideAll </Directory> <Directory /var/www/selfoss> Options Indexes FollowSymLinks MultiViews AllowOverrideAll Order allow,deny allow from all </Directory> </VirtualHost> </IfModule>
Save and exit the nano editor, then restart Apache.
$ sudo systemctl restart httpd
Setting Up Automatic Updates
Here you need to set up automatic feeds updates using the Cron job utility. To refresh the feeds every 10 minutes, run the command below:
$ sudo crontab -e
Add the following directive
echo "*/10 * * * * root wget -o /dev/null http://yourwebsite.com/update">> /etc/cron.d/selfoss
That all, everything should be okay.
You have installed Selfoss in your CentOS 7 server. This is a free and open-source application, feel free to customize it to suit your needs.
Check out these top 3 Linux hosting services