Skip to content

Install Guide: Ubuntu 18.04

vivianeko edited this page Aug 12, 2022 · 48 revisions

Note: This has been tested and works on my system, feel, it has limited testing outside of that.

This has been adapted from the 16.04 install guide

Install Ubuntu 18.04 LTS

  • Nothing special, just install it

Adding PHP 7.2 Repository

  • sudo add-apt-repository ppa:ondrej/php
  • sudo apt-add-repository multiverse
  • sudo apt-get update

Upgrade Ubuntu

  • sudo apt update
  • sudo apt upgrade -y
  • sudo apt autoremove -y
  • sudo reboot

Install Apache Web Server

  • sudo apt install apache2 apache2-utils
  • sudo systemctl start apache2
  • sudo systemctl enable apache2
  • sudo chown www-data /var/www/html/ -R

Install MariaDB

  • sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
  • sudo add-apt-repository 'deb [arch=amd64] http://mirror.zol.co.zw/mariadb/repo/10.3/ubuntu bionic main'
  • sudo apt update
  • sudo apt install mariadb-server mariadb-client
  • sudo systemctl start mysql
  • sudo rm /etc/systemd/system/mysql.service
  • sudo rm /etc/systemd/system/mysqld.service
  • sudo systemctl enable mysql
  • sudo mysql_secure_installation
• Enter Current Password : Just hit <Enter>
• Set root Password : (Pick a password, or select N)
• For the rest just Hit <Enter>

Install PHP7

  • sudo apt install php7.2-fpm php7.2-mysql php7.2-common php7.2-gd php7.2-json php7.2-cli php7.2-curl libapache2-mod-php7.2 -y
  • sudo a2enmod php7.2
  • sudo systemctl restart apache2
  • sudo apt install

Add your user to the www-data group

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 nzedb.

  • 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 nZEDb step.
  • sudo reboot

Configure MariaDB

  • sudo nano /etc/mysql/my.cnf
  • Add the following lines under[mysqld] section. If there is no [mysqld] section, add it above the lines below or the service will not start
### configurations by nZEDb ####
innodb_file_per_table = 1
innodb_large_prefix = 1 ## Only needed if version < 10.2.2
max_allowed_packet = 16M
group_concat_max_len = 8192
sql_mode                = '' ## Needed only if you want IRCScraper to work | fix Invalid Datetime 
  • Save and close the file.
  • sudo systemctl restart mysql
  • sudo mysql -u root -p
• create database nzedb;
• grant all on nzedb.* to 'nzedb'@'localhost' identified by 'your-password';
• grant file on *.* TO 'nzedb'@'localhost';
• flush privileges;
• exit;
  • mysql_tzinfo_to_sql /usr/share/zoneinfo | sudo mysql -u root mysql -p

• Ignore the "Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it." warning.

  • sudo apt install apparmor-utils
  • sudo aa-complain /usr/sbin/mysqld

• If you get an error after the last command, ignore it !!

Install some Tools

Install unrar

you can skip the install of yEnc for PHP7.2 until a new version of yEnc is released

Install yEnc

continue from here

Grant www-data user login rights

  • sudo nano /etc/passwd
  • replace
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
  • with
www-data:x:33:33:www-data:/var/www:/bin/bash

• this allows the user to be able to login, there is no PW set (but you can run "sudo passwd www-data" to give it one, as well as "su - www-data" to work)

Install nZEDb

  • sudo mkdir /var/www/nZEDb/
  • sudo chown www-data:www-data /var/www/nZEDb -R
  • sudo chmod g+w /var/www/nZEDb/ -R
  • sudo apt install php7.2-imagick php7.2-pear php7.2-curl php7.2-gd php7.2-json php7.2-dev php7.2-gd php7.2-mbstring php7.2-xml curl -y

• Log out for this change to take effect

  • logout

• Log in

Install Composer

Configure Apache2

  • sudo nano /etc/apache2/sites-available/nzedb.conf

• Put the following text into the file. Replace 127.0.0.1 with your Ubuntu server’s IP address. You can also use a domain name.

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName 127.0.0.1
    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>

• Save and close the file

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

Change PHP.ini

  • sudo nano /etc/php/7.2/apache2/php.ini
•   Change the value of max_execution_time from 30 to 120.
o   max_execution_time = 120
•   Change the value of memory_limit from 128M to 1024M.
o   memory_limit = 1024M
•   Define a timezone like America/Chicago (see http://php.net/manual/en/timezones.php) 
o   date.timezone = "America/Chicago"
  • sudo nano /etc/php/7.2/cli/php.ini
•   Change the value of max_execution_time from 30 to 120.
o   max_execution_time = 120
•   Change the value of memory_limit from -1 to 1024M.
o   memory_limit = 1024M
•   Define a timezone like America/Chicago 
o   date.timezone = "America/Chicago"

Install tmux version 2

  • sudo apt install libevent-dev build-essential git autotools-dev automake pkg-config ncurses-dev python -y
  • sudo apt remove tmux -y
  • git clone https://github.com/tmux/tmux.git --branch 2.0 --single-branch
  • cd tmux
  • ./autogen.sh
  • ./configure
  • make -j4
  • sudo make install
  • make clean

Install Optional Tools

  • sudo apt install python-setuptools python-dev build-essential python-pip -y

Install Certificates

  • sudo apt install ca-certificates

Run this before configuring nZEDb

  • mysql_tzinfo_to_sql /usr/share/zoneinfo | sudo mysql -u root -p mysql
  • mkdir -p /var/www/nZEDb/resources/tmp/unrar
  • sudo chmod -R 777 /var/www/nZEDb/
  • sudo chown -R www-data:www-data /var/www/nZEDb/

Configure nZEDb

  • your-server-ip/install or your-domain.com/install
  • use /etc/ssl/certs/ca-certificates.crt as the ca bundle path

Load PreDB

  • cd /var/www/nZEDb/cli
  • php data/predb_import_daily_batch.php 0 local true

Setup IRCScraper

  • cd /var/www/nZEDb/
  • cp configuration/ircscraper_settings_example.php configuration/ircscraper_settings.php
  • vi configuration/ircscraper_settings.php

• Change $username to the username you want.

Run the Scripts in tmux

  • cd /var/www/nZEDb/misc/update/nix/tmux/
  • php start.php
Clone this wiki locally