-
-
Notifications
You must be signed in to change notification settings - Fork 55
Ubuntu Install guide
This guide was designed for Ubuntu 16.04+ and derivatives (Linux Mint/Elemantary OS/etc.), using this guide on Debian or other Linux Distributions might or might not function. This guide might have errors or be obsolete by the time you read it, doing some research on your part on how to fix issues if they arise dkpg-iis required.
In this guide you will see commands within grey rectangles, example:
this is an example
When you see these, you must type them into a command line interface (terminal window).
PHP 8.2 and MariaDB 10.2 are the minimum supported versions.
Update all your sources:
sudo apt update
Upgrade your applications:
sudo apt upgrade
Optional: Upgrade some other stuff (like the kernel).
sudo apt dist-upgrade
You must now reboot your server.
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 python-software-properties git make
NNtmux supports PHP version 8.2 or higher, if your distro does not have 8.2+, you must add a repository.
To add PHP 8.2 which is the current supported versions of PHP:
sudo add-apt-repository ppa:ondrej/php
sudo apt update
Note that some extensions might be missing here,
sudo apt install php-pear php8.2 php8.2-cli php8.2-dev php8.2-common php8.2-curl php8.2-json php8.2-gd php8.2-mysql php8.2-mbstring php8.2-xml php8.2-intl php8.2-fpm php8.2-bcmath php8.2-zip php-imagick
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
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:
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_buffer_pool_size = 256M
Consider raising the key_buffer_size to 256M to start, later on you can raise this more as your database grows.
You will be required to change the innodb_buffer_pool_size as your database grows a good starting point is 256M. 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
[Mandatory] Create a MySQL user.
Never use the root user for your scripts.
Log in to MySQL with the root user
sudo mysql -u root -p
nntmux is the databasename, you can change this if you want.
CREATE DATABASE nntmux;
Change YourMySQLServerHostName to the hostname of the server.
If your MySQL server is local, use localhost. If remote, try the domain name or IP address. It has been reported 127.0.0.1 does not work for the hostname.
Change YourMySQLUsername for the username you will use 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 2 options, Apache2 or Nginx. Only install Apache2 or Nginx, do not install both to avoid issues.
sudo apt install apache2
You also need to install the following package:
sudo apt install libapache2-mod-php8.1
apache2 -v
Apache 2.4:
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>
Save and exit nano.
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/>
, changeAllowOverride None
toAllowOverride All
Save and exit nano.
Disable the default site, enable NNTmux, enable rewrite, restart apache:
sudo a2dissite 000-default
sudo a2ensite NNTmux.conf
sudo a2enmod rewrite
sudo service apache2 restart
Nginx:
(Optional) You might want to remove apache2 first:
sudo apt remove apache2
Install Nginx:
sudo apt install -y nginx
[Optional - Start]
If you wish to install the newest stable version of Nginx, follow these steps.
You can check if your current version is outdated compared to the Nginx downloads page by typing this command:
nginx -v
Add the Nginx PPA:
sudo add-apt-repository ppa:nginx/stable
Update your sources:
sudo apt update
Install the latest version of Nginx:
sudo apt install -y nginx
[Optional - End]
Install php fpm, which sends the PHP files to Nginx:
sudo apt install -y php8.1-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 however.
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;
}
}
Save and exit nano.
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
Changelisten = /var/run/php8.1-fpm.sock
tolisten = 127.0.0.1:9000
Save and exit nano.
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:
sudo unlink /etc/nginx/sites-enabled/default
Make NNTmux the default Nginx site:
sudo ln -s /etc/nginx/sites-available/NNTmux /etc/nginx/sites-enabled/NNTmux
Restart Nginx and php8.1-fpm:
sudo service nginx restart
sudo service php8.1-fpm restart
orsudo /etc/init.d/php8.1-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. Replace $USER for your username, if you will not use the current user for nntmux.
sudo usermod -a -G www-data $USER
This requires you to log back in before it takes effect. Do so now or before the Aquiring NNTmux step.
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
Close and save this file.
Open the Web SAPI php.ini (for PHP8 /etc/php/8.1/).
If you have installed Apache2:
sudo nano /etc/php/8.1/apache2/php.ini
If you have installed Nginx:
sudo nano /etc/php/8.1/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.1-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 http://www.rarlab.com/download.htm, look for the newest unrar version (5.5.0 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 http://www.rarlab.com/rar/rarlinux-x64-5.2.1.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:
sudo apt install p7zip-full mediainfo lame ffmpeg libav-tools
7zip:
sudo apt install p7zip-full
Go to http://mediaarea.net/en/MediaInfo/Download/Ubuntu, download the deb files for libmediainfo, libzen0 and mediainfo (CLI)
You can download by right clicking on them, copy link, then type
wget
and paste the link after.
Once you have all 3 deb files, install them by typing
sudo dpkg -i
followed by the name of the file. You may have to install libzen0 package first. If so do:
sudo apt install libzen0
Lame:
sudo apt install lame
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.2 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
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 empty hostname use 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 you are setting your server up in a testing environment else you need to set APP_ENV=production. Fail to set it to production and disabling debug 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
Open your web browser and point it to your site.
If this only shows you the web servers default page, you probably need to use a domain name of some kind. Open your local hosts file (on the computer which 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 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 figure out the path to the optional software, type
which
followed by the name of the program. Example:which unrar
Signing up to 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.
[Mandatory (Manticore or Elasticsearch)]
Manticore Search:
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 the 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 the releases and predb data from your database. This might take some time depending on how much data you have:
php artisan nntmux:populate --manticore --releases
php artisan nntmux:populate --manticore --predb
Elasticsearch:
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(this is the only option now, screen scripts have been removed):
Install tmux, tmux is similar to screen but allows to have multiple terminals visible and other features.
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 optionaly 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
ortmux att
There are other automated scripts, you can open them in a text editor or ask around / do research to see what they do.
IRCScraper:
IRCSraper 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 for irc settings change, or 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 server stats:
You can enable stats monitoring of 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
Redis is recommended caching server
For questions join IRC, server Synirc channel #tmux