Skip to main content

STEP 1 - System preparation

    DO NOT USE ROOT FOR INSTALLATION. SUDO ONLY   

Server installation

Install Ubuntu 20.04 or Install Ubuntu 22.04

Update system

sudo apt update
sudo apt dist-upgrade
sudo reboot

Set up your firewall

Set your current timezone on server

sudo tzselect

Install needed software support

sudo apt install snmp nmap traceroute fping snmp-mibs-downloader git wget unzip

To prevent error (Cant get all info or Error “Unknown Object Identifier (Index out of range: XXX (ifIndex))”) on Huawei OLT and other devices we recomended to disable RangeCheck:

sudo nano /etc/snmp/snmp.conf

and add this line

noRangeCheck yes

Install PHP and modules

sudo apt install lsb-release ca-certificates apt-transport-https software-properties-common -y

sudo add-apt-repository ppa:ondrej/php

sudo apt install php8.2 php8.2-fpm php8.2-mysql php8.2-cli php8.2-fpm php8.2-snmp \
php8.2-common php8.2-curl php8.2-gd php8.2-imagick php8.2-mbstring php8.2-opcache \
php8.2-xml php8.2-xmlrpc php8.2-zip php8.2-intl php8.2-memcache php8.2-gmp

sudo update-alternatives --set php /usr/bin/php8.2

Installing Nginx as webserver

sudo add-apt-repository universe
sudo apt update
sudo apt install nginx
sudo ufw allow 'Nginx HTTP'
sudo ufw allow 'Nginx HTTPS'
Edit php.ini for Ngnix
sudo nano /etc/php/8.2/fpm/php.ini

and change this line

file_uploads = On 
allow_url_fopen = On 
memory_limit = 1024M 
upload_max_filesize = 8M 
max_execution_time = 600 
max_input_time = 300 ; or more for low speed devices 
max_input_vars = 20000 ; It is important
post_max_size = 8M 
default_charset = "UTF-8" 
date.timezone = Europe/Kyiv
Edit php.ini for CLI
sudo nano /etc/php/8.2/cli/php.ini

and change this line

memory_limit = 1024M 
max_execution_time = 1800 
max_input_time = 300 ; or more for low speed devices 
max_input_vars = 20000 ; It is important
default_charset = "UTF-8" 
date.timezone = Europe/Kyiv

See also https://wintercms.com/docs/v1.2/docs/setup/configuration

Restart nginx and php8.2-fpm
sudo systemctl restart nginx
sudo systemctl restart php8.2-fpm.service 

Fine PHP-FPM tuning  

You can see configuration example here or search on GOOGLE like "How to optimize php-fpm" 😁

 

Installing Memcached

sudo apt install memcached libmemcached-tools php8.2-memcached php-memcache

Edit memcached.conf

sudo nano /etc/memcached.conf

Change -m 64 to -m 128

sudo systemctl restart memcached
sudo systemctl enable memcached

Install Maria DB 

Installing version from Ubuntu repository (recomended)

sudo apt install mariadb-server mariadb-client

OR install latest

sudo apt install software-properties-common -y
curl -LsS -O https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
sudo bash mariadb_repo_setup --os-type=ubuntu --os-version=focal --mariadb-server-version=11.2
sudo apt update
sudo apt install mariadb-server mariadb-client
Start and enable server
sudo systemctl start mariadb
sudo systemctl enable mariadb
Secure MYSQL
sudo mariadb-secure-installation
Set up user and DB
mysql -u root -p
   MariaDB [(none)]> CREATE DATABASE grusher;
   MariaDB [(none)]> GRANT ALL ON grusher.* TO 'grusher'@'localhost' IDENTIFIED BY 'grusher' WITH GRANT OPTION;
   MariaDB [(none)]> FLUSH PRIVILEGES;
   MariaDB [(none)]> quit;

Install Python virtual enviroment

If you are using Ubuntu 20.04 run this

sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt update

Next

sudo apt install python3.11 python3-venv python3-pip python3-virtualenv
/usr/bin/python3 -m pip install --upgrade pip
sudo mkdir /opt/python3.11
sudo mkdir /opt/python3.11/env
sudo chown -R $USER:www-data /opt/python3.11/
virtualenv --python=/usr/bin/python3.11 /opt/python3.11/env/
cd /opt/python3.11/env/bin/
source /opt/python3.11/env/bin/activate
./python3 -m pip install --upgrade six
./python3 -m pip install --upgrade wheel
./python3 -m pip install --upgrade git+https://github.com/gviabcua/netmiko.git
./python3 -m pip install --upgrade ping3
./python3 -m pip install --upgrade requests
./python3 -m pip install --upgrade psutil
./python3 -m pip install --upgrade zipp
deactivate

Then in Grusher settings check python path

Default is /opt/python3.11/env/bin/python3 (GRUSHER_IP/system/config?option_type=search_param&search_data=python)

Install Composer2

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
php -r "unlink('composer-setup.php');"
sudo mv composer.phar /usr/local/bin/composer