How to install LEMP and run TT-RSS on a Fedora 20 VPS

how-to-install-lemp-and-run-tt-rss-on-fedora-20-vpsThe following blog post will guide you through the steps of installing LEMP (Linux Nginx MariaDB and PHP) and setting up TT-RSS (Tiny-Tiny RSS) on a Fedora 20 VPS.

What is Tiny Tiny RSS?

It is an open source, web-based news feed (RSS/Atom) reader and aggregator, designed to allow you to read news from any location, while feeling as close to a real desktop application as possible.

 

Some of the TT-RSS features are:

  • Server-side AJAX-powered application, user only needs a web browser
  • Free software, licensed under GNU GPL
  • Supports feed aggregation / syndication,
  • Supports keyboard shortcuts
  • Supports OPML import/export
  • Supports sharing arbitrary content through tt-rss
  • Supports mobile device

and much more….

TT-RSS requires a webserver, a database server, PHP and some PHP extensions such as:

  • JSON
  • mbstring
  • iconv
  • CURL (not required, but highly recommended) OR support for remote fopen()
  • posix functions (for the multiprocess update daemon, otherwise not needed)
  • GD (for OTP QR code generation, otherwise not needed)
  • PostgreSQL or MySQL depending on the database server used

UPDATE THE SYSTEM

We are going to run TT-RSS on a LEMP stack, so before going any further, ssh to your linux vps, initiate a screen session and make sure the fedora vps is fully up-to-date by using:

## screen -U -S tt-rss-screen
## yum update

next, stop apache if it’s running on the system using the following command:

## [[ $(pgrep httpd) ]] && ( systemctl stop httpd; systemctl disable httpd )

INSTALL NGINX

Install the Nginx webserver using yum:

## yum install nginx

create Nginx server-block in /etc/nginx/conf.d/ which will serve the TT-RSS installation we are going to set-up later on.

## vim /etc/nginx/conf.d/tt-rss.conf

and paste the following: (make sure you set your own server_name)

server {
  server_name yourwebsite.com;
  listen 80;
  root /var/www/html/yourwebsite.com;
  access_log /var/log/nginx/yourwebsite.com-access.log;
  error_log /var/log/nginx/yourwebsite.com-error.log;
  index index.php;

  location / {
    try_files  $uri $uri/ /index.php?$args;
  }

  location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
    access_log off;
    expires max;
  }
  location ~ /\.ht {
    deny  all;
  }
  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;
  }
}

test, start and add Nginx to system’s start-up using:

## nginx -t
## systemctl restart nginx
## systemctl enable nginx

INSTALL PHP

Install PHP and all the required PHP extensions for TT-RSS on the system using the following:

## yum install php-fpm php-curl php-mbstring php-gd php-xml php-process php-mysql

Next, edit /etc/php-fpm.d/www.conf and change the user and group the fpm pool is running under to:

## vim +/^user /etc/php-fpm.d/www.conf

user = nginx
group = nginx

set-up log directory ownership:

## chown nginx:root -R /var/log/php-fpm/

start and add the PHP server to the system’s start-up using systemctl

## systemctl restart php-fpm
## systemctl enable php-fpm

INSTALL MARIADB

The database server MariaDB can be installed using yum

## yum install mariadb-server

and configured by its post installation script known as mysql_secure_installation. Before you can run this script the database server needs to be running on the vps, so start and add it to the system’s start-up using systemctl

## systemctl start mariadb
## systemctl enable mariadb

then run

## mysql_secure_installation

Enter current password for root (enter for none): [HIT ENTER]
Set root password? [Y/n] y
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y

INSTALL AND SET-UP TT-RSS

At the time of writing, TT-RSS is at version 1.11, but you should always set-up the latest version available from GitHub.

download and install tt-rss in /var/www/html/yourwebsite.com using the following commands:

## mkdir -p /var/www/html/yourwebsite.com
## cd !$
## wget https://github.com/gothfox/Tiny-Tiny-RSS/archive/1.11.tar.gz -O ttrss.tar.gz
## tar -zxf ttrss.tar.gz
## rm -f ttrss.tar.gz
## mv Tiny-Tiny-RSS-*/* .
## rm -rf Tiny-Tiny-RSS-*/
## chown nginx: -R ../yourwebsite.com/

create a database for tt-rss using the following commands:

## mysql -u root -p

MariaDB> create database ttrssDB;
MariaDB> grant all on ttrssDB.* to ttrssUser@localhost identified by 'SomeSecretPassword';
MariaDB> flush privileges;
MariaDB> \q

once the database is set-up, navigate to http://yourwebsite.com/install and set-up your tiny-tiny rss installation like this:
tt-rss-mysql-set-up

once the connection to the database is set-up, initialize the database by clicking the ‘Initialize database’ button and save the generated configuration file.

finally, login to your TT-RSS at http://yourwebsite.com/ using admin as username and password as password. Make sure you change your admin password as soon as possible.

To automatically update the feeds in TT-RSS you need to set-up an update daemon. Since Fedora 20 is using systemd as init system, we can achieve this by simply creating the following unit file in /etc/systemd/system/tt-rss.service

## vim /etc/systemd/system/tt-rss.service

[Unit]
Description=Reader update daemon
After=network.target mysqld.service

[Service]
ExecStart=/usr/bin/php /var/www/html/yourwebsite.com/update_daemon2.php --quiet
User=nginx
StandardOutput=syslog

[Install]
WantedBy=multi-user.target

finally, start and add the tt-rss service to the system start-up using:

## systemctl restart tt-rss
## systemctl enable tt-rss

Of course, if you are one of our Linux VPS Hosting customers, you don’t have to do any of this, simply ask our admins, sit back and relax. Our admins will set this up for you immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>