Skip to content

Ubuntu Install guide

DariusIII edited this page Dec 31, 2025 · 109 revisions

Ubuntu Install Guide

This guide is designed for Ubuntu 22.04/24.04 LTS and derivatives (Linux Mint, Elementary OS, Pop!_OS, etc.). Using this guide on Debian or other Linux distributions might require adjustments.

Minimum Requirements:

  • PHP 8.3+ (recommended)
  • MariaDB 10.6+ or MySQL 8+
  • 4GB RAM minimum (16GB+ recommended)
  • 50GB+ disk space (SSD recommended)

Note: Commands shown in grey boxes should be typed in your terminal.


Table of Contents

  1. Update Operating System
  2. Install Prerequisites
  3. Add PHP Repository
  4. Install PHP
  5. Install MariaDB
  6. Configure MariaDB
  7. Install Web Server
  8. Configure PHP
  9. Install Extra Software
  10. Clone NNTmux
  11. Configure NNTmux
  12. Install Search Engine
  13. Start Indexing
  14. Additional Configuration

Step 1: Update Operating System

Update all packages and reboot:

sudo apt update
sudo apt upgrade -y
sudo apt dist-upgrade -y
sudo reboot

Step 2: Install Prerequisites

Install required tools:

sudo apt install -y software-properties-common git make curl wget unzip

Step 3: Add PHP Repository

NNTmux requires PHP 8.3+. If your distribution doesn't include it, add the Ondřej PPA:

sudo add-apt-repository ppa:ondrej/php
sudo apt update

Step 4: Install PHP

Install PHP 8.3 and all required extensions:

sudo apt install -y php8.3-cli php8.3-dev php8.3-common php8.3-curl \
    php8.3-gd php8.3-mysql php8.3-mbstring php8.3-xml php8.3-intl \
    php8.3-fpm php8.3-bcmath php8.3-zip php8.3-imagick php8.3-redis \
    php-pear redis-server

Verify installation:

php -v

Step 5: Install MariaDB

Add MariaDB Repository

Visit https://mariadb.org/download/?t=repo-config to get the correct repository for your Ubuntu version.

For Ubuntu 24.04 (Noble):

sudo apt install -y apt-transport-https curl
sudo mkdir -p /etc/apt/keyrings
sudo curl -o /etc/apt/keyrings/mariadb-keyring.pgp 'https://mariadb.org/mariadb_release_signing_key.pgp'

Create repository configuration:

sudo tee /etc/apt/sources.list.d/mariadb.sources <<EOF
# MariaDB 11.4 repository
X-Repolib-Name: MariaDB
Types: deb
URIs: https://deb.mariadb.org/11.4/ubuntu
Suites: noble
Components: main main/debug
Signed-By: /etc/apt/keyrings/mariadb-keyring.pgp
EOF

Note: Change noble to jammy for Ubuntu 22.04.

Install MariaDB:

sudo apt update
sudo apt install -y mariadb-server mariadb-client

Secure the installation:

sudo mysql_secure_installation

Step 6: Configure MariaDB

Edit Configuration

Find your configuration file location:

mysqld -v --help | grep -A 1 'Default options'

Edit the configuration:

sudo nano /etc/mysql/mariadb.conf.d/99-nntmux.cnf

Add the following configuration (adjust innodb_buffer_pool_size based on your RAM):

[mysqld]
# Connection settings
max_allowed_packet = 16M
max_connections = 200
wait_timeout = 600
interactive_timeout = 600

# InnoDB settings
innodb_buffer_pool_size = 2G          # 50-70% of available RAM
innodb_buffer_pool_instances = 4
innodb_log_file_size = 512M
innodb_log_buffer_size = 64M
innodb_flush_log_at_trx_commit = 2
innodb_flush_method = O_DIRECT
innodb_file_per_table = 1

# Query settings
group_concat_max_len = 8192
tmp_table_size = 256M
max_heap_table_size = 256M

# Disable query cache (deprecated)
query_cache_type = 0
query_cache_size = 0

Restart MariaDB:

sudo systemctl restart mariadb

Create Database and User

Connect to MariaDB:

sudo mysql -u root -p

Create the database and user (replace the placeholders):

-- Create database
CREATE DATABASE nntmux CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- Create user (replace 'YourPassword' with a strong password)
CREATE USER 'nntmux'@'localhost' IDENTIFIED BY 'YourPassword';

-- Grant privileges
GRANT ALL PRIVILEGES ON nntmux.* TO 'nntmux'@'localhost';
FLUSH PRIVILEGES;

-- Exit
EXIT;

Step 7: Install Web Server

Choose either Nginx (recommended) or Apache. Do not install both.

Option A: Nginx (Recommended)

Install Nginx:

sudo apt install -y nginx

Create NNTmux site configuration:

sudo nano /etc/nginx/sites-available/nntmux

Paste the following (adjust server_name as needed):

server {
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name localhost;

    root /var/www/nntmux/public;
    index index.php index.html;

    access_log /var/log/nginx/nntmux-access.log;
    error_log /var/log/nginx/nntmux-error.log;

    # Security headers
    add_header X-Frame-Options "SAMEORIGIN" always;
    add_header X-Content-Type-Options "nosniff" always;

    # Static files caching
    location ~* \.(?:css|js|gif|ico|jpe?g|png|svg|woff2?|ttf|eot)$ {
        expires 1y;
        add_header Cache-Control "public, immutable";
    }

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

    # Covers directory
    location ^~ /covers/ {
        alias /var/www/nntmux/storage/covers/;
    }

    # PHP handling
    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_read_timeout 300;
        fastcgi_buffers 16 16k;
        fastcgi_buffer_size 32k;
    }

    # Deny access to sensitive files
    location ~ /\.(?!well-known) {
        deny all;
    }
}

Enable the site:

sudo rm /etc/nginx/sites-enabled/default
sudo ln -s /etc/nginx/sites-available/nntmux /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx
sudo systemctl restart php8.3-fpm

Option B: Apache

Install Apache:

sudo apt install -y apache2 libapache2-mod-php8.3

Create NNTmux site configuration:

sudo nano /etc/apache2/sites-available/nntmux.conf

Paste the following:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName localhost
    DocumentRoot /var/www/nntmux/public

    <Directory /var/www/nntmux/public>
        Options FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    Alias /covers /var/www/nntmux/storage/covers

    <Directory /var/www/nntmux/storage/covers>
        Options FollowSymLinks
        AllowOverride None
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/nntmux-error.log
    CustomLog ${APACHE_LOG_DIR}/nntmux-access.log combined
</VirtualHost>

Enable the site:

sudo a2dissite 000-default
sudo a2ensite nntmux.conf
sudo a2enmod rewrite
sudo systemctl restart apache2

Add User to www-data Group

sudo usermod -a -G www-data $USER

Log out and back in for group changes to take effect:

exit
# Log back in

Step 8: Configure PHP

CLI Configuration

sudo nano /etc/php/8.3/cli/php.ini

Update these settings:

max_execution_time = 120
memory_limit = 2048M
date.timezone = Europe/Belgrade    ; Change to your timezone
error_reporting = E_ALL
log_errors = On

Find your timezone at: https://www.php.net/manual/en/timezones.php

FPM Configuration (for Nginx)

sudo nano /etc/php/8.3/fpm/php.ini

Apply the same settings as CLI, plus:

upload_max_filesize = 100M
post_max_size = 100M

Restart PHP-FPM:

sudo systemctl restart php8.3-fpm

Apache Configuration

If using Apache:

sudo nano /etc/php/8.3/apache2/php.ini

Apply the same settings, then restart:

sudo systemctl restart apache2

Step 9: Install Extra Software

Required Tools

sudo apt install -y p7zip-full mediainfo lame ffmpeg tmux

Unrar (Latest Version)

The repository version is outdated. Install the latest:

mkdir -p ~/unrar_install && cd ~/unrar_install
wget https://www.rarlab.com/rar/rarlinux-x64-701.tar.gz
tar -xzf rarlinux-x64-701.tar.gz
sudo cp rar/unrar /usr/local/bin/
sudo chmod 755 /usr/local/bin/unrar
cd ~ && rm -rf ~/unrar_install

Verify:

unrar --version

Install Composer

cd ~
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
composer --version

Install Node.js (for frontend assets)

curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
node --version
npm --version

Step 10: Clone NNTmux

Create the web directory:

sudo mkdir -p /var/www
sudo chown $USER:www-data /var/www
cd /var/www

Clone the repository:

git clone https://github.com/NNTmux/newznab-tmux.git nntmux
cd nntmux

Step 11: Configure NNTmux

Create Environment File

cp .env.example .env
nano .env

Essential Settings

Update these settings in your .env file:

# Application
APP_NAME=NNTmux
APP_ENV=production
APP_DEBUG=false
APP_URL=http://your-server-ip
APP_TIMEZONE=Europe/Belgrade

# Database
DB_CONNECTION=mariadb
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=nntmux
DB_USERNAME=nntmux
DB_PASSWORD=YourDatabasePassword

# NNTP Server (your Usenet provider)
NNTP_SERVER=news.your-provider.com
NNTP_PORT=563
NNTP_SSLENABLED=true
NNTP_USERNAME=your_usenet_username
NNTP_PASSWORD=your_usenet_password
NNTP_SOCKET_TIMEOUT=120

# Admin User
ADMIN_USER=admin
ADMIN_PASS=YourAdminPassword
ADMIN_EMAIL=admin@example.com

# API Keys (get these from respective services)
TMDB_API_KEY=your_tmdb_key
TVDB_API_KEY=your_tvdb_key
OMDB_API_KEY=your_omdb_key

# Cache & Queue
CACHE_DRIVER=redis
QUEUE_CONNECTION=redis
SESSION_DRIVER=redis

API Keys

Get free API keys from these services for better metadata:

Service URL Purpose
TMDB https://www.themoviedb.org/settings/api Movies & TV
TVDB https://thetvdb.com/dashboard/account/apikey TV Shows
OMDB https://www.omdbapi.com/apikey.aspx Movie ratings
Trakt https://trakt.tv/oauth/applications User ratings
Fanart.tv https://fanart.tv/get-an-api-key/ Artwork
GiantBomb https://www.giantbomb.com/api/ Games

Set Permissions

# Set ownership
sudo chown -R $USER:www-data /var/www/nntmux

# Set directory permissions
sudo chmod -R 755 /var/www/nntmux
sudo chmod -R 775 /var/www/nntmux/storage
sudo chmod -R 775 /var/www/nntmux/bootstrap/cache
sudo chmod -R 775 /var/www/nntmux/resources/tmp
sudo chmod -R 775 /var/www/nntmux/public

Run Installation

php artisan nntmux:install

Follow the prompts to complete setup.


Step 12: Install Search Engine

Choose ManticoreSearch (recommended) or Elasticsearch.

Option A: ManticoreSearch (Recommended)

Install ManticoreSearch:

wget https://repo.manticoresearch.com/manticore-repo.noarch.deb
sudo dpkg -i manticore-repo.noarch.deb
sudo apt update
sudo apt install -y manticore manticore-columnar-lib

Copy configuration:

sudo cp /var/www/nntmux/misc/manticoresearch/manticore.conf /etc/manticoresearch/manticore.conf

Create directories:

sudo mkdir -p /var/lib/manticore/data
sudo mkdir -p /var/log/manticore
sudo chown -R manticore:manticore /var/lib/manticore /var/log/manticore

Start service:

sudo systemctl enable manticore
sudo systemctl start manticore

Populate indexes:

cd /var/www/nntmux
php artisan nntmux:populate --manticore --releases
php artisan nntmux:populate --manticore --predb

Option B: Elasticsearch

Follow the official guide: https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html

Then configure NNTmux:

php artisan nntmux:create-es-indexes
php artisan nntmux:populate --elastic --releases
php artisan nntmux:populate --elastic --predb

Add to .env:

ELASTICSEARCH_ENABLED=true
ELASTICSEARCH_HOST=127.0.0.1
ELASTICSEARCH_PORT=9200

Step 13: Start Indexing

Install Tmux

Run the included installation script:

cd /var/www/nntmux
./install_tmux.sh

Configure Tmux Settings

  1. Open your browser and go to: http://your-server-ip/admin/tmux-edit
  2. Review and configure all settings
  3. Click Save Tmux Settings

Start Processing

cd /var/www/nntmux
php artisan tmux:start

Useful Tmux Commands

Command Description
tmux att Reconnect to tmux session
Ctrl+A, D Detach from tmux
php artisan tmux:stop Stop processing

Step 14: Additional Configuration

IRC Pre Scraper

Edit .env to configure IRC settings:

SCRAPE_IRC_ENABLED=true
SCRAPE_IRC_SERVER=irc.synirc.net
SCRAPE_IRC_PORT=6697
SCRAPE_IRC_TLS=true
SCRAPE_IRC_USERNAME=YourUniqueNickname

Enable "Scrape IRC Channels" in Admin → Tmux Settings.

Setup Cron Job

Add the Laravel scheduler to cron:

crontab -e

Add this line:

* * * * * cd /var/www/nntmux && php artisan schedule:run >> /dev/null 2>&1

Redis Configuration

Ensure Redis is running:

sudo systemctl enable redis-server
sudo systemctl start redis-server

SSL/HTTPS (Recommended)

Install Certbot for free SSL:

sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d your-domain.com

Configure Logrotate

Create log rotation for NNTmux:

sudo nano /etc/logrotate.d/nntmux
/var/www/nntmux/storage/logs/*.log {
    daily
    missingok
    rotate 14
    compress
    delaycompress
    notifempty
    create 0664 www-data www-data
}

Troubleshooting

Common Issues

500 Internal Server Error:

tail -f /var/www/nntmux/storage/logs/laravel.log
php artisan config:clear
php artisan cache:clear

Permission Denied:

sudo chown -R $USER:www-data /var/www/nntmux/storage
sudo chmod -R 775 /var/www/nntmux/storage

Database Connection Failed:

mysql -u nntmux -p nntmux
# Test if you can connect

PHP Extensions Missing:

php -m | grep -i extension_name
sudo apt install php8.3-extensionname

Useful Commands

# Clear all caches
php artisan optimize:clear

# Test NNTP connection
php artisan nntmux:test-nntp

# Test API keys
php artisan nntmux:test-apis

# View logs
tail -f storage/logs/laravel.log

Getting Help

Clone this wiki locally