Author Topic: Install Guide for Ubuntu 16.04/10 with PHP 7 and MariaDB  (Read 10043 times)

Offline Boinkers

  • Newbie
  • *
  • Posts: 4
  • Helpful: +0/-0
================================================================================================================
Update Ubuntu
================================================================================================================
sudo apt-get update

sudo apt-get upgrade

sudo apt-get dist-upgrade

================================================================================================================
Install Core Requirements
================================================================================================================
sudo apt-get install software-properties-common python-software-properties git make

================================================================================================================
Install PHP 7
================================================================================================================
sudo apt-get install php-pear php-imagick php7.0 php7.0-cli php7.0-dev php7.0-json php7.0-gd php7.0-mysql php7.0-pdo php7.0-curl php7.0-common php7.0-mcrypt php7.0-mbstring php7.0-xml

================================================================================================================
Install MariaDB MySQL
================================================================================================================
sudo apt-get install mariadb-server mariadb-client libmysqlclient-dev

sudo mysql -u root -p

use mysql;

CREATE USER 'nzedb'@'localhost' IDENTIFIED BY 'yourpasswordhere';
GRANT ALL PRIVILEGES ON *.* TO 'nzedb'@'localhost'
WITH GRANT OPTION;
GRANT FILE ON *.* TO 'nzedb'@'localhost';
update user set plugin='' where User='nzedb';
flush privileges;
exit;

sudo mysql_secure_installation

sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf

[mysqld]
group_concat_max_len = 8192
key-buffer-size = 1G
innodb_file_per_table = 1
innodb_buffer_pool_size = 6G
innodb_buffer_pool_instances = 6
innodb_log_buffer_size = 8M
secure_file_priv = ""

sudo service mysql restart

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u nzedb -p mysql

================================================================================================================
Apache - Install and configure
================================================================================================================
sudo apt-get install apache2 libapache2-mod-php7.0

apache2 -v

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

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName localhost
    DocumentRoot "/var/www/nZEDb/www"
    LogLevel warn
    ServerSignature Off
    ErrorLog /var/log/apache2/error.log
    <Directory "/var/www/nZEDb/www">
        Options FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
    Alias /covers /var/www/nZEDb/resources/covers
</VirtualHost>

sudo nano /etc/apache2/apache2.conf

Under <Directory /var/www/>, change AllowOverride None to AllowOverride All

sudo a2dissite 000-default

sudo a2ensite nZEDb.conf

sudo a2enmod rewrite

================================================================================================================
Configure PHP
================================================================================================================
sudo nano /etc/php/7.0/cli/php.ini

max_execution_time = 120
memory_limit = -1
date.timezone = Africa/Johannesburg
error_reporting = E_ALL
log_errors = On
error_log = php-errors.log

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

max_execution_time = 120
memory_limit = -1
date.timezone = Africa/Johannesburg
error_reporting = E_ALL
log_errors = On
error_log = php-errors.log

sudo service apache2 restart

==================================================================================================================
Assign required permission to WWW
==================================================================================================================
sudo usermod -a -G www-data $USER

==================================================================================================================
Install Composer
==================================================================================================================
cd /var/www
sudo chmod 777 .
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r 'if (hash_file("SHA384", "composer-setup.php") === preg_filter("#^.*?<pre>|</pre>.*$#s", "", file_get_contents("https://composer.github.io/pubkeys.html"))) { echo "Installer verified"; } else { echo "Installer corrupt"; unlink("composer-setup.php"); } echo PHP_EOL;'
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
php -r "unlink('composer-setup.php');"
composer -V

=================================================================================================================
Install nZEDb
=================================================================================================================
cd /var
sudo chown www-data:www-data -R www
cd www
newgrp www-data
bash <(curl -s https://raw.githubusercontent.com/nZEDb/nZEDb/0.x/_install/install.sh)

==================================================================================================================
Copy settings file and create tmp directory
==================================================================================================================
sudo cp /var/www/nZEDb/configuration/settings.example.php /var/www/nZEDb/configuration/settings.php
sudo chmod -R 777 /var/www/nZEDb/resources
sudo chmod -R 777 configuration
mkdir /var/www/nZEDb/resources/tmp
mkdir /var/www/nZEDb/resources/tmp/unrar

==================================================================================================================
Install additional features Ubuntu 16.04/10
==================================================================================================================
sudo apt-get install p7zip-full mediainfo lame ffmpeg libav-tools

==================================================================================================================
UNRAR Installation
==================================================================================================================
cd ~
wget https://www.rarlab.com/rar/rarlinux-x64-5.5.0.tar.gz
tar -xvf rarlinux-x64-5.5.0.tar.gz
cd rar
sudo make
sudo make install
cd ..
rm -rf rar
rm rarlinux-x64-5.5.0.tar.gz

==================================================================================================================
yEnc Installation
==================================================================================================================
cd ~
mkdir yenc
cd yenc
wget https://github.com/niel/php-yenc/releases/download/v1.3.0/php7.0-yenc_1.3.0_amd64.deb
sudo dpkg -i php7.0-yenc_1.3.0_amd64.deb
cd ../..
rm -rf ~/yenc

==================================================================================================================
yydecode Installation
==================================================================================================================
cd ~/
mkdir -p yydecode
cd yydecode/
wget https://ayera.dl.sourceforge.net/project/yydecode/yydecode/0.2.10/yydecode-0.2.10.tar.gz
tar -xzf yydecode-0.2.10.tar.gz
cd yydecode-0.2.10/
./configure
make
sudo make install
make clean
cd ~/
rm -rf yydecode/

==================================================================================================================
Configure nZEDb
==================================================================================================================
Open a web browser and head to http://<host/ip of your machine>/install

==================================================================================================================
Convert Tables to INNODB and TPG
==================================================================================================================
php convert_mysql_tables.php cinnodb-noparts
php convert_to_tpg.php true

==================================================================================================================
Setting up Pre Database and import data
==================================================================================================================
cd /var/www/nZEDb/cli/data
php predb_import_daily_batch.php 0 local true

==================================================================================================================
Downgrade TMUX to version 2.0
==================================================================================================================
sudo apt-get remove tmux
sudo apt-get install -y exuberant-ctags cmake libevent-dev libncurses5-dev
cd ~
wget https://github.com/tmux/tmux/releases/download/2.0/tmux-2.0.tar.gz
tar xvf tmux-2.0.tar.gz
cd tmux-2.0
./configure && make
sudo make install
cd ..
rm -rf ~/tmux-2.0

==================================================================================================================
IRC Scraper
==================================================================================================================
cp /var/www/nZEDb/configuration/ircscraper_settings_example.php /var/www/nZEDb/configuration/ircscraper_settings.php
sudo nano /var/www/nZEDb/configuration/ircscraper_settings.php

Edit $username with your IRC Nickname

==================================================================================================================
Optional
==================================================================================================================

==================================================================================================================
Update nZEDb
==================================================================================================================
tmux kill-session -t nZEDb
cd /var/www/nZEDb/
./zed update nzedb

==================================================================================================================
Unrar in memory
==================================================================================================================
rm -R /var/www/nZEDb/resources/tmp/unrar
sudo nano /etc/fstab
tmpfs /var/www/nZEDb/resources/tmp/unrar   tmpfs  nodev,nosuid,size=256M 0 0
sudo reboot

================================================================================================================
Setup Memcached caching
================================================================================================================
sudo apt-get install memcached php-memcached
sudo nano /var/www/nZEDb/configuration/settings.php

Change define('nZEDb_CACHE_TYPE', 0); to define('nZEDb_CACHE_TYPE', 1);
===============================================================================================================
SPHINX Search
===============================================================================================================
sudo add-apt-repository ppa:builds/sphinxsearch-rel22
sudo apt-get update
sudo apt-get install sphinxsearch

sudo service sphinxsearch stop

sudo cp /var/www/nZEDb/misc/sphinxsearch/sphinx.conf /etc/sphinxsearch/sphinx.conf
sudo mkdir -p /var/lib/sphinxsearch/data/
sudo mkdir -p /var/log/sphinxsearch/

sudo service sphinxsearch start

sudo nano /var/www/nZEDb/configuration/settings.php

Change define('nZEDb_RELEASE_SEARCH_TYPE', 0); to define('nZEDb_RELEASE_SEARCH_TYPE', 2);

cd /var/www/nZEDb/misc/sphinxsearch/
php create_se_tables.php 0 9312
php populate_rt_indexes.php releases_rt
« Last Edit: 2017-12-13, 09:54:25 pm by Boinkers »

Offline ebro

  • Junior Indexer
  • **
  • Posts: 27
  • Helpful: +5/-0
Maybe try "sudo tar -xvf predb_dump_08172015.tar"

before this line

php dump_predb.php local /tmp/predb_dump_08172015.tar    - Please note this step currently fails and will update once I figure out why

Offline r1pnu11net

  • Newbie
  • *
  • Posts: 1
  • Helpful: +0/-0
Setting up Pre Database
==============================================================
cd /tmp
wget https://www.dropbox.com/s/qkmgbvmdv9a5w8q/predb_dump_08172015.tar.gz
  tar -xvf predb_dump_08172015.tar.gz #will extract to ./tmp/predb_dump_08172015.csv
  cd /var/www/nZEDb/misc/testing/PreDB
  php dump_predb.php local /tmp/tmp/predb_dump_08172015.csv
cd /var/www/nZEDb/cli
php data/predb_import_daily_batch.php 0 local true

Notes:
1. Only the three indented lines are actually changed.  The other lines are just for context.
2. The tar -xvf and predb_import_daily_batch.php will take a long time to complete.
3. This "script" by OP for Ubuntu 16.10 also works for 16.04.2.
« Last Edit: 2017-05-23, 09:52:26 am by r1pnu11net »