#!/bin/bash set -e echo "=== Tiny Tiny RSS Setup Script ===" echo "This script will install and configure tt-rss from scratch" echo "" # Check if running as root if [ "$EUID" -ne 0 ]; then echo "Please run as root" exit 1 fi # Install dependencies echo "[1/8] Installing dependencies..." apt-get update apt-get install -y software-properties-common curl git postgresql nginx kmod sudo # Add PHP repository and install PHP 8.2 echo "[2/8] Installing PHP 8.2..." add-apt-repository -y ppa:ondrej/php apt-get update apt-get install -y php8.2 php8.2-fpm php8.2-pgsql php8.2-curl php8.2-gd php8.2-intl php8.2-mbstring php8.2-xml php8.2-zip # Clone tt-rss if not already present echo "[3/8] Cloning tt-rss repository..." if [ ! -f "/tmp/ttrss/index.php" ]; then git clone https://git.tt-rss.org/fox/tt-rss.git /tmp/ttrss fi # Setup PostgreSQL echo "[4/8] Configuring PostgreSQL..." service postgresql start sleep 2 # Create database user and database su - postgres -c "psql -tc \"SELECT 1 FROM pg_user WHERE usename = 'ttrss'\" | grep -q 1 || psql -c \"CREATE USER ttrss WITH PASSWORD 'ttrss123';\"" su - postgres -c "psql -tc \"SELECT 1 FROM pg_database WHERE datname = 'ttrss'\" | grep -q 1 || psql -c \"CREATE DATABASE ttrss OWNER ttrss;\"" # Create tt-rss config echo "[5/8] Creating configuration..." cat > /tmp/ttrss/config.php <<'PHPCONFIG' /etc/nginx/sites-available/ttrss <<'NGINXCONFIG' server { listen 8281; server_name localhost; root /tmp/ttrss; index index.php; access_log /var/log/nginx/ttrss_access.log; error_log /var/log/nginx/ttrss_error.log; location / { try_files $uri $uri/ =404; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~ /\.ht { deny all; } } NGINXCONFIG ln -sf /etc/nginx/sites-available/ttrss /etc/nginx/sites-enabled/ rm -f /etc/nginx/sites-enabled/default cd /tmp/ttrss/plugins.local/ git clone https://github.com/vector090/tt-rss-plugin-card-view card_view