-
-
Notifications
You must be signed in to change notification settings - Fork 54
Ubuntu Install guide
This guide was designed for Ubuntu 20.04+ and derivatives (Linux Mint/Elementary OS/etc.); using this guide on Debian or other Linux Distributions might or might not function.
This guide might have errors or need to be updated by the time you read it; doing some research on your part on how to fix issues if they arise is required.
Notes: In this guide, you will see commands within grey rectangles. When you see them, you must type these into a command line interface (terminal window). Example:
this is an example
PHP 8.2 and MariaDB 10.5 are the minimum supported versions.
Update all your sources, upgrade your applications, reboot the server.
sudo apt update
sudo apt upgrade
sudo apt dist-upgrade
sudo reboot
These programs will be used later on to install additional software. They might already be installed on your operating system.
sudo apt install software-properties-common git make
NNtmux supports PHP version 8.2 or higher; if your distro does not have 8.2+, you must add a repository.
sudo add-apt-repository ppa:ondrej/php
sudo apt install php-pear 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 redis-server
You have multiple choices when it comes to a MySQL server and client, You will need to do some research to figure out which is the best for you. We recommend MariaDB for most people.
To find out what the correct repository is for your version of Ubuntu, visit: https://mariadb.org/download/?t=repo-config And follow instructions on that page
sudo apt install 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'
To install MariaDB 11.4, add the following to /etc/apt/sources.list.d/mariadb.sources
:
sudo tee /etc/apt/sources.list.d/mariadb.sources <<EOF
# MariaDB 11.4 repository list - created 2024-09-06 18:59 UTC
# https://mariadb.org/download/
X-Repolib-Name: MariaDB
Types: deb
# deb.mariadb.org is a dynamic mirror if your preferred mirror goes offline. See https://mariadb.org/mirrorbits/ for details.
# URIs: https://deb.mariadb.org/11.4/ubuntu
URIs: https://mirror.rackspace.com/mariadb/repo/11.4/ubuntu
Suites: noble
Components: main main/debug
Signed-By: /etc/apt/keyrings/mariadb-keyring.pgp
EOF
Install MariaDB 11.4:
sudo apt update
sudo apt install mariadb-server
- Edit my.cnf (the location can vary; type
mysqld -v --help | grep -A 1 'Default options'
to find all the possible locations):
sudo nano /etc/mysql/my.cnf
- Add (or change them if they already exist; they go under the [mysqld] section) the following:
[mysqld]
max_allowed_packet = 16M
group_concat_max_len = 8192
max_connections = 200
- Add (or change them if they already exist; they go under the [innodb] section) the following:
[innodb]
innodb_buffer_pool_size = 256M
Consider raising the key_buffer_size to 256M to start; later, you can raise this more as your database grows.
You can run php show_table_sizes.php 0
from /var/www/NNTmux/misc/testing/DB to see the recommended innodb_buffer_pool_size
.
sudo service mysql restart
Never use the root user for your scripts. Log in to MySQL with the root user
sudo mysql -u root -p
nntmux is the database name, you can change this if you want.
CREATE DATABASE nntmux;
Change YourMySQLServerHostName to the IP address or hostname. If your MySQL server is local, use localhost.
- If remote, try the domain name or IP address.
Change YourMySQLUsername for your username to connect to MySQL in NNTmux.
Do not remove the quotes on the name / hostname / password.
GRANT ALL ON nntmux.* TO 'YourMySQLUsername'@'YourMySQLServerHostName' IDENTIFIED BY 'SomePassword';
GRANT ALL PRIVILEGES ON *.* TO 'YourMySQLUsername'@'YourMySQLServerHostName' WITH GRANT OPTION;
flush privileges;
Exit MySQL
quit;
You have many options. We will, however, show you two options: Apache2 or Nginx.
Only install Apache2 or Nginx, do not install both to avoid issues.
sudo apt install apache2
sudo apt install libapache2-mod-php8.3
apache2 -v
Create a site configuration file:
sudo nano /etc/apache2/sites-available/NNTmux.conf
Paste the following into it (changing your paths as required):
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName localhost
DocumentRoot "/var/www/NNTmux/public"
LogLevel warn
ServerSignature Off
ErrorLog /var/log/apache2/error.log
<Directory "/var/www/NNTmux/public">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Alias /covers /var/www/NNTmux/resources/covers
</VirtualHost>
Edit Apache to allow overrides in the /var/www folder (or the folder you will put NNTmux into):
sudo nano /etc/apache2/apache2.conf
Under <Directory /var/www/>
, change AllowOverride None
to AllowOverride All
Disable the default site, enable NNTmux, enable rewrite, and restart Apache:
sudo a2dissite 000-default
sudo a2ensite NNTmux.conf
sudo a2enmod rewrite
sudo service apache2 restart
(Optional) You might want to remove apache2 first:
sudo apt remove apache2
Install Nginx:
sudo apt install -y nginx
If you wish to install the newest stable version of Nginx
sudo add-apt-repository ppa:nginx/stable
sudo apt install -y nginx
Install php fpm, which sends the PHP files to Nginx:
sudo apt install -y php8.3-fpm
Create a nginx configuration file for your NNTmux website
sudo nano /etc/nginx/sites-available/NNTmux
Paste the following into the file, change the settings as needed:
The server_name must be changed if you want to use a different hostname than localhost.
Example: server_name localhost 192.168.1.29 mydomain.com;
would work on all those 3.
The fastcgi_pass can be changed to TCP by uncommenting it; sockets are faster.
server {
# Change these settings to match your machine.
listen 80 default_server;
server_name localhost;
# These are the log locations; you should not have to change these.
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
# This is the root web folder for NNTmux; you shouldn't have to change this.
root /var/www/NNTmux/public/;
index index.html index.htm index.php;
# Everything below this should not be changed unless noted.
location ~* \.(?:css|eot|gif|gz|ico|inc|jpe?g|js|ogg|oga|ogv|mp4|m4a|mp3|png|svg|ttf|txt|woff|xml)$ {
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ^~ /covers/ {
# This is where the NNTmux covers folder should be in.
root /var/www/NNTmux/storage;
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
# Uncomment the following line and comment the .sock line if you want to use TCP.
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php8.1-fpm.sock;
# The next two lines should go in your fastcgi_params
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
If you have changed the fastcgi_pass to TCP (127.0.0.1:9000), you must edit www.conf
to listen on it instead of sockets:
sudo nano /etc/php/version.number/fpm/pool.d/www.conf
Change listen = /var/run/php8.3-fpm.sock
to listen = 127.0.0.1:9000
Create a log folder if it does not exist:
sudo mkdir -p /var/log/nginx`
sudo chmod 755 /var/log/nginx`
Delete the default Nginx site and Make NNTmux the default Nginx site
sudo unlink /etc/nginx/sites-enabled/default
sudo ln -s /etc/nginx/sites-available/NNTmux /etc/nginx/sites-enabled/NNTmux
Restart Nginx and php8.3-fpm:
sudo service nginx restart
sudo service php8.3-fpm restart
Regardless of which web server you use, you should add your user to the www-data group so that you may create/edit files belonging to the group. If you won't be using the current user for nntmux, please replace $USER with your username.
sudo usermod -a -G www-data $USER
This requires you to log back in before it takes effect, so reboot:
sudo reboot
Open php.ini for the CLI SAPI (/etc/php/8.2/cli/php.ini
):
sudo nano /etc/php/8.2/cli/php.ini
Change the following settings:
max_execution_time = 120
The following can be set to -1
if you have a large amount of system RAM (>=8GB):
memory_limit = 1024M
Change your timezone from a list of timezones here.
Remove the preceding ;
date.timezone = YourLocalTimezone
Enable error logging (Needed when reporting bugs)
error_reporting = E_ALL
log_errors = On
error_log = php-errors.log
Open the Web SAPI php.ini (for PHP8 /etc/php/8.2/).
- If you have installed Apache2:
sudo nano /etc/php/8.2/apache2/php.ini
- If you have installed Nginx:
sudo nano /etc/php/8.2/fpm/php.ini
Change the settings using the same settings as the CLI SAPI.
Restart Apache2 or PHP-FPM (if you use nginx for example):
sudo service apache2 restart
sudo service php8.3-fpm restart
You can install Unrar from the repositories, but it's quite old:
sudo apt install unrar
You can also install it by downloading the newest version (recommended, as some RAR files require version 5+) Go to https://www.rarlab.com/download.htm, look for the newest unrar version (7.01, when this guide was updated), right-click it, and copy the link. Replace the link below with the one you copied:
mkdir -p ~/new_unrar && cd ~/new_unrar
wget https://www.rarlab.com/rar/rarlinux-x64-701.tar.gz
tar -xzf rarlinux*.tar.gz
sudo mv /usr/bin/unrar /usr/bin/unrar4
sudo mv rar/unrar /usr/bin/unrar
sudo chmod 755 /usr/bin/unrar
cd ~/ && rm -rf ~/new_unrar
On Ubuntu you can use the following command to install all additional requirements or follow the individual installations steps below: 7zip, Mediainfo, Lame, FFmpeg or avconv
sudo apt install p7zip-full mediainfo lame ffmpeg`
You can download mediainfo using the deb files of libmediainfo, libzen0 and mediainfo (CLI) on http://mediaarea.net/en/MediaInfo/Download/Ubuntu
Once you have all 3 deb files, install them by typing sudo dpkg -i
followed by the file's name.
You may have to install libzen0 package first
sudo apt install libzen0
You can alternatively install ffmpeg (manual compilation) https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
Switch your active group to 'www-data'.
newgrp www-data
Switch to the system's www location.
cd /var/www/
This folder should have been created when apache2 was installed (by php8.3 dependencies). If, for whatever reason, it did not do:
mkdir -p /var/www
sudo chown www-data:www-data /var/www
sudo chmod 775 /var/www
Install Composer and git clone NNTmux
Now you need to copy the sample .env
config file and change the settings for you NNTmux environment:
cp .env.example .env
nano .env
As a minimum update the following settings:
DB_HOST=yourMySQLServer
DB_PORT=3306
DB_USER=nntmuxMySQLuser
DB_PASSWORD=nntmuxMySQLpassword
DB_NAME=nntmux
NNTP_USERNAME=YourNNTPUsername
NNTP_PASSWORD=YourNNTPPassword
NNTP_SERVER=YourNNTPServerAddress
NNTP_PORT=119
NNTP_SSLENABLED=false
NNTP_SOCKET_TIMEOUT=120
ADMIN_USER=AdminUserNick
ADMIN_PASS=AdminUserPass
ADMIN_EMAIL=AdminUserEmailAddress
APP_ENV=production
APP_DEBUG=false
APP_TZ=YourTimeZone (Same as your PHP TimeZone)
APP_URL=
SESSION_DOMAIN=
If command hostname -f
reports an empty hostname, use the above settings
If they report correct domain, you can use that for APP_URL and SESSION_DOMAIN.
You should only use APP_ENV=local
when setting your server up in a testing environment; otherwise, you need to set APP_ENV=production
.
Fail to set it to production and disabling debug mode will expose sensitive information to the internet.
Install NNTmux additional components by issuing the following command:
composer install
Set the required directory permissions:
Folders must be owned by www-data group (sudo chown -R youruser:www-data + foldername
)
sudo chown -R your_user:www-data /var/www/NNTmux/bootstrap/cache/
sudo chown -R your_user:www-data /var/www/NNTmux/storage/logs/
sudo chown -R your_user:www-data /var/www/NNTmux/resources/tmp/
sudo chown -R your_user:www-data /var/www/NNTmux/public/
sudo chmod -R 755 /var/www/NNTmux/vendor/
sudo chmod -R 777 /var/www/NNTmux/storage/
sudo chmod -R 777 /var/www/NNTmux/resources/
sudo chmod -R 777 /var/www/NNTmux/public/
Configure nntmux by issuing the following commands:
php artisan nntmux:install
You will be prompted with several questions to be sure that everything goes smoothly
You can just open your web browser and point it to your site.
If this only shows you the web server's default page, you probably need to use a domain name.
You can open your local hosts file (on the computer you are trying to browse from) and add an entry for the target server.
sudo nano /etc/hosts
IpAddressOfYourServer <server_name_used_in_configuration>
Next, click on the "Edit Site>Edit Site" menu in the sidebar, scroll down to "Use Compressed Headers" and set it to "Yes" if your server supports it. Then scroll up to find the "3rd Party Application Paths" section and fill out the paths to the optional software like unrar/ffmpeg/etc..
To find the path to the optional software, type which
followed by the program's name.
Example: which unrar
Signing up for all the API services(Amazon/Trakt/OMDB/etc.) is recommended; the keys we offer are used by many. NNTmux sites and are throttled so you will get almost no results from those.
This section explains how to install and configure Manticore Search, a full-text search engine that NNTmux uses to index and search releases and predb data. You need to follow these steps:
- Go to the Manticore Search website and follow the instructions for your operating system to add their repository and install the package: https://manticoresearch.com/install/
- Copy the Manticore configuration file from the NNTmux folder to the Manticore folder. This file contains the settings for connecting to your database and creating the indexes:
sudo cp /var/www/NNTmux/misc/manticoresearch/manticore.conf /etc/manticoresearch/manticore.conf
Create two folders for storing manticore data and logs. You can change the locations in the manticore.conf file if you want:
sudo mkdir -p /var/lib/manticore/data/
sudo mkdir -p /var/log/manticore/
- Start the Manticore service and enable it to run on boot:
sudo service manticore start
sudo systemctl enable manticore.service
- Run two commands to populate the Manticore indexes with your database's releases and predb data. This might take some time depending on how much data you have:
php artisan nntmux:populate --manticore --releases
php artisan nntmux:populate --manticore --predb
Follow install instruction from here: https://tecadmin.net/setup-elasticsearch-on-ubuntu/
php artisan nntmux:create-es-indexes
php artisan nntmux:populate --elastic --releases
php artisan nntmux:populate --elastic --predb
enable elasticsearch in your .env by setting ELASTICSEARCH_ENABLED=true
We do not recommend doing manual indexing, as NNTmux is heavily using tmux for its scripts.
Automatic indexing is what we recommend.
Indexing using the Tmux scripts
Install tmux. Tmux is similar to the screen but allows multiple terminals and other features to be visible.
sudo apt purge tmux
Run the included tmux install script, it will fetch, compile and install latest tmux from their official github page
./install_tmux.sh
On your website, head to the admin tmux page (http://IpAddressOfYourServer/admin/tmux-edit
)
Take your time and read through all the options carefully.
Click on Save Tmux Settings at the bottom of the page.
From your installation root
- Start the tmux script.
php artisan tmux-ui:start
To stop tmux and optionally kill the session (optional --kill or shorthand -k switch to kill the tmux session)
php artisan tmux-ui:stop --kill
You can now detach from tmux using this keyboard combo (press control and a, let go press d): control+a d
To re-attach to tmux, type tmux attach
or tmux att
There are other automated scripts. You can open them in a text editor, ask around, or do research to see what they do.
IRCScraper is a bot that connects to a IRC server to download PreDB information into your NNTmux SQL database.
This helps renaming releases and gives extra information on your releases.
You need to edit your .env
file to change IRC settings or the defaults from config/irc_settings.php
will be used.
Update at least IRC_USERNAME
with a nickname to be used on the IRC channel
Make sure you set Scrape Irc Channels
to yes within the TMUX Admin settings
Redis is a recommended caching server.
You can enable stats monitoring of the Redis server if you use it).
You need to do the following
sudo apt install redis-server php-redis
sudo apt install rubygems ruby-dev
sudo gem install redis-stat
sudo nano /etc/redis/redis.conf
maxmemory 128mb
maxmemory-policy allkeys-lru
sudo systemctl restart redis-server.service
sudo systemctl enable redis-server.service
For questions join IRC, server Synirc channel #tmux