deb_mutism

Name: MUTiSM Magnum (official) | ๋ผ์ด๋ชฝ (korean)


CPU: Intelยฎ Coreโ„ข i5-3337U CPU @ 1.80GHz (2 cores) โ€” Product info

Memory: 8G

Storages:

  • 128G (m.2 type SSD) โ€” / partition
  • 500G (SATA HDD) โ€” ~/storage partition

Live status of storages

Mounted on     Type  Size  Used Avail Use%
/              ext4  117G   15G   97G  13%
/home/www-data ext4  458G   49G  386G  12%
/home/web-data ext4  916G  266G  605G  31%

Wireless:

  • Intelยฎ Dual Band Wireless-AC 3160 (802.11ac)
  • Realtekยฎ WLAN USB Adapter (802.11ac) โ€” not working after focal fossa

admin Jรบne's MuON Gateway โ€” MU Gateway

admin Jรบne's Xchange Repository โ€” Xchange Service

admin Jรบne's Wiki OWL โ€” One Wiki LAB

Nginx Configuration Showing lively on OWL for MUTiSM Magnum


  • Attach Ubuntu Pro subscription โ€” Updated on 2024/05/21 17:41
  • Upgrade php 8.2 and purge php 7.4, php 8.0 โ€” Updated on 2023/06/04 02:51
  • Upgrade php 8.0 โ€” Updated on 2021/01/26 17:24
  • Upgrade mariadb 10.5 โ€” Updated on 2020/08/31 13:25
  • adjust & optimize value of php-fpm โ€“ /etc/php/7.x/fpm/pool.d/www.conf โ€” Updated on 2020/07/25 21:42
  • Upgrade Ubuntu 20.04 - focal fossa โ€” Updated on 2020/07/24 01:23
  • Change backup rsync to another partition โ€” Updated on 2020/06/27 04:01
  • Migrate mariadb 10.3.22 from mysql โ€” Updated on 2020/03/30 01:42
  • Renew SSL certificates (Let's Encrypt) done โ€” Updated on 2019/08/01 21:17
  • Nextcloud install โ€” Updated on 2019/05/17 01:02
  • Wordpressโ„ข installed โ€” Updated on 2018/09/10 00:44
  • Added first new user for x.meson.ml โ€” Updated on 2018/09/10 00:43 | Registered Users
  • Docker Client/Server installed โ€” Updated on 2018/07/18 01:20
  • wiki.meson.one & x.meson.ml certificates are issued โ€” Updated on 2018/07/17 11:17
  • mu.meson.one page is created and need to attention to edit โ€” Updated on 2018/07/13 02:00
  • Let's Encrypted issued and installed โ€” Updated on 2018/07/10 23:48

๏ผ‹Que to do


In Ubuntu, Login with root

  ssh root@your_server_ip 

Add user, usually first user is required to input during installation steps.

  adduser firstuser

Add user in sudo group

  usermod -aG sudo firstuser

  sudo visudo 

Add following line.

  #includedir /etc/sudoers.d
  username ALL=(ALL) NOPASSWD: ALL

Install wpasupplicant for wireless connection.

  sudo apt install wpasupplicant 

check network adapters with ifconfig and iwconfig โ€“ need to install wireless-tools. Edit /etc/netplan/01-something.yaml for networkd or Network-Manager

network:
  ethernets:
    enp3s0:
      addresses: []
      dhcp4: true
      optional: true
      nameservers:
        search: [search.domain.ltd]
        addresses: [8.8.8.8,8.8.4.4]
  wifis:
    wlp2s0:
      addresses: []
      dhcp4: true
      optional: true
      nameservers:
        search: [search.domain.ltd]
        addresses: [1.1.1.1,1.0.0.1]
      access-points:
        ? "your ssid"
        :
          password: passphrase 
--- 
  renderer: networkd
  version: 2

Manual / Reference Guide for netplan

Live Netplan Configuration for MUTiSM


in Network-Manager path: /etc/Network-Manager/system-connections

edit or delete SSID named file(s).


purge installed driver, which is not working correctly and compile new driver.

  sudo apt purge rtl8812au-dkms
  sudo apt install git
  git clone https://github.com/abperiasamy/rtl8812AU_8821AU_linux.git
  cd rtl8812AU_8821AU_linux
  sudo make -f Makefile.dkms install 
  sudo modprobe rtl8812au

check driver is installed and recognized by system.

  modinfo rtl8812au | grep A811		// Linux kernel module 
  ifconfig    				// network adapters 
  iwconfig    				// wireless configuration 

When a system goes to sleep, suspend or hibernate mode, response from machine is extremely slow or timed out. Soon after waking up, system responses quickly. To prevent this,

  sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

Action to do next is Suspend.target is masked


Let's Encrypt โ€” SSL/TLS certificates


  sudo apt-get install nginx-extras     \\ heavier than other packages, full 

  sudo apt-get install mysql-server 
 
  sudo mysql_secure_installation     \\ to secure MySQL weakness 

without sudo, root authentication identified by temporary password is required. Never pass it. Do with sudo


  sudo apt-get install php-fpm php-mysql 

Configure the PHP Processor

  sudo vi /etc/php/7.x/fpm/php.ini 

Comment out cgi.fix_pathinfo parameter and set value to 0

  cgi.fix_pathinfo=0

And restart service.

  sudo systemctl restart php7.x-fpm 

Default config of Nginx with PHP Processor

server {
    listen 80 default_server;
    listen [::]:80 default_server;
 
    root /var/www/html;
    index index.php index.html index.htm index.nginx-debian.html;
 
    server_name server_domain_or_IP;
 
    location / {
        try_files $uri $uri/ =404;
    }
 
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }
 
    location ~ /\.ht {
        deny all;
    }
}

To use php-fpm, need to edit /etc/php/7.x/fpm/pool.d/www.conf

;listen = 127.0.0.1:9000 
listen = /run/php/php7.0-fpm.sock;  # which creates socket for php-fpm 

pm = dynamic
pm.max_children = ??
pm.start_servers = 8
pm.min_spare_servers = 4
pm.max_spare_servers = 8
pm.max_requests = 500

pm. values could be changed according to resources such as physical memory and an average usage of each php processor. Guide for adjusting values are

Setting Name Suggested value
max_children (Total RAM - Memory used for Linux, DB, etc.) / process size
start_servers Number of CPU cores x 4
min_spare_servers Number of CPU cores x 2
max_spare_servers Same as start_servers

Available memory size can be guessed by commanding free -hl and process size used by php7.x-fpm is calculated by scripts ps_mem.py and sudo python ps_mem.py | grep php-fpm

12.9 MiB +  18.7 MiB =  31.6 MiB       php-fpm7.3 (4)

memory consumed by each php-fpm is assumed as 31.6 Mbyte.


Install required services

Prerequisite: Nginx, MySQL (MariaDB) and related PHP modules

  sudo apt install nginx 
  sudo apt-get install mariadb-server mariadb-client

Install related PHP modules. if one or two modules are not listed on Ubuntu default repository, add additional repository.

  sudo apt install php7.1-fpm php7.1-common php7.1-mbstring php7.1-xmlrpc php7.1-soap php7.1-gd php7.1-xml php7.1-intl php7.1-mysql php7.1-cli php7.1-mcrypt php7.1-zip php7.1-curl

Add third-party repository for PHP

  sudo apt-get install software-properties-common
  sudo add-apt-repository ppa:ondrej/php

Secure Database

  sudo mysql_secure_installation

When prompted, answer the questions below by following the guide.

  • Enter current password for root (enter for none): Just press the Enter
  • Set root password? [Y/n]: Y
  • New password: Enter password
  • Re-enter new password: Repeat password
  • Remove anonymous users? [Y/n]: Y
  • Disallow root login remotely? [Y/n]: Y
  • Remove test database and access to it? [Y/n]: Y
  • Reload privilege tables now? [Y/n]: Y

Restart MySQL (MariaDB) service

  sudo systemctl restart mysql.service

Configure PHP-FPM

  sudo nano /etc/php/7.x/fpm/php.ini

version 7.x is different depending on update. August 2018, version is 7.2

Edit following lines with suggested values

file_uploads = On
allow_url_fopen = On
memory_limit = 256M
upload_max_filesize = 100M
cgi.fix_pathinfo=0
max_execution_time = 360
date.timezone = America/Chicago

Create Wordpress database

  sudo mysql -u root -p

Database name is wordpress here.

CREATE DATABASE wordpress;

Create database user named wordpressuser here.

CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'new_password_here';

new_password_here is your own password.

GRANT ALL ON wordpress.* TO 'wordpressuser'@'localhost' IDENTIFIED BY 'user_password_here' WITH GRANT OPTION;

If you see the error message, omit the password.

GRANT ALL ON wordpress.* TO 'wordpressuser'@'localhost' WITH GRANT OPTION;

Save changes and exit.

FLUSH PRIVILEGES;
EXIT;

Download Wordpress

  cd /tmp && wget https://wordpress.org/latest.tar.gz
  tar -zxvf latest.tar.gz
  sudo mv wordpress /var/www/html/wordpress

Configure web service with Nginx

Create Nginx virtual sites and apply SSL

Configure SSL with Let's Encrypt

Run through web browser to set up initially. โ€” index.php and follow instruction step by step.


Memory caching configuration

Referral manuals โ€” by ownCloud Documentation
Referral manuals โ€” by Nextcloud Documentation

Install Redis
sudo apt install redis-server php-redis
Check running service
sudo ps ax | grep redis
sudo netstat -tlnp | grep redis
Clearing the Redis Cache
sudo redis-cli
  SELECT <dbIndex>
  FLUSHDB
Add configuration in ownCloud

Edit /var/www/owncloud/config/config.php if ownCloud root is /var/www/owncloud and add the followings,

<?php
$CONFIG = array (
... ... ... 
...
),
'memcache.local' => '\\OC\\Memcache\\Redis',
'filelocking.enabled' => 'true',
'memcache.distributed' => '\\OC\\Memcache\\Redis',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' =>
array (
'host' => 'localhost',
'port' => 6379,
'timeout' => 0,
'dbindex' => 0,
),
); 

Run background jobs

Add crontab with web user such as www-data

# crontab -u www-data -e

Add job

*  *  *  *  * /usr/bin/php -f /path/to/your/owncloud/cron.php

Setting for uploading large size files

edit php_value in /etc/php/7.x/fpm/php.ini

upload_max_filesize 16G
post_max_size 16G
 
max_input_time 3600
max_execution_time 3600
 
upload_tmp_dir = /var/big_temp_file/
 
output_buffering = 0 

max_execution_time could be 21600 if showing error during assembling file(s).

edit /etc/php/7.x/fpm/pool.d/www.conf

request_terminate_timeout = 300

edit fastcgi_read_timeout value in Nginx virtual host configuration

location ~ .php$ {
         root /var/www/sites/nginxtips.com;
         try_files $uri =404;
         fastcgi_pass unix:/tmp/php5-fpm.sock;
         fastcgi_index index.php;
         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
         include fastcgi_params;
         fastcgi_read_timeout 300;
}

fastcgi_read_timeout could be 21600 if showing error during assembling file(s).


Enable PHP OPcache

Post installation

Check overview

  • The PHP module โ€œimagickโ€ in this instance has no SVG support.
sudo apt install php-imagick imagemagick

Stop the MySQL service

sudo /etc/init.d/mysql stop

Start MySQL without a password

sudo mysqld_safe --skip-grant-tables &

Connect to MySQL

mysql -uroot

Set a new MySQL root password

use mysql;
update user set authentication_string=PASSWORD("mynewpassword") where User='root';
flush privileges;
quit

Stop and start the MySQL service

sudo /etc/init.d/mysql stop
...
sudo /etc/init.d/mysql start

Log in to the database

mysql -u root -p

Symptom: Stuck in page showing Step 4 is currently in process. Please reload this page later during Nextcloud โ„ข update using updater.

Solution: Delete .step file in nextcloud-data/updater-randomstring/.step.


Symptom: Error showing Has sum mismatch during update procedures.

Solution: Delete saved repositories.

sudo rm /var/lib/apt/lists/*   
or 
sudo rm -r /var/lib/apt/lists/* -vf

and update again

sudo apt update 

Symptom: Error showing No apps found for your version in Nextcloud โ„ข Apps.

Solution: Edit Fetching time in script, located in ../nextcloud_root/lib/private/App/AppStore/Fetcher/Fetcher.php.

 		}
 
 		$options = [
-			'timeout' => 10,
+			'timeout' => 300,
 		];

Symptom: Error shows 2020/07/28 18:13:52 [warn] 42175#42175: the โ€œsslโ€ directive is deprecated, use the โ€œlisten โ€ฆ ssl โ€ฆโ€ directive instead in /etc/nginx

Solution

Edit /etc/nginx/sites-available/site.conf

server {
 
# Add ssl in listen  
 
        listen          443 ssl http2 default_server;
        listen          [::]:443 ssl http2 default_server;
 
# ... comment out ssl  on; 
 
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        X-Forwarded-Proto $scheme;
        port_in_redirect        off;
        #ssl                    on;

Check related error and warning

sudo nginx -t

  • deb_mutism
  • Last modified: 2024/05/21 17:51
  • by Jรบne Park