debian_common

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
debian_common [2019/06/23 15:12] โ€“ [Delete all files except for desired file types] Jรบne Parkdebian_common [2024/04/18 08:58] (current) โ€“ Jรบne Park
Line 1: Line 1:
 <nav>  <nav> 
   * {{fa>server?color=#8B0000}} Linux   * {{fa>server?color=#8B0000}} Linux
-    * [[:rpi_common|General Things on Raspbian]]ย +    * [[rpi_common|โ–  General Things on Raspbian]]ย 
-    * [[:rpi_autism|Media Ditorium โ”€ AUTiSM Rainbow]]ย +    * [[rpi_nimbus|๐๐ข๐Œ๐๐”๐’ ๐••๐•–๐”น๐•๐•’๐•Ÿ๐•”]]ย 
-    * [[:rpi_epigen|Private Cellarium โ”€ EPiGEN Crystal]]ย +    * [[debian_common|โ–  General info on Debian Linux]]ย 
-    * [[:rpi_nimbus|Webius Officium โ”€ NiMBUS deBlanc]]ย +    * [[deb_cicada|๐‚๐ข๐‚๐€๐ƒ๐€ ๐•Š๐•’๐•ฉ๐• ๐•ฅ๐•ฆ๐•ž]]ย 
-    * [[:debian_common|General info on Debian Linux]]ย +    * [[deb_mutism|๐Œ๐”๐“๐ข๐’๐Œ ๐•„๐•’๐•˜๐•Ÿ๐•ฆ๐•ž]] ย 
-    * [[:deb_mutism|Opus Imperium โ”€ MUTiSM Magnum]]+    * [[deb_gilead|๐†๐ข๐‹๐„๐€๐ƒ ๐”ธ๐•ฃ๐•˜๐•–๐•Ÿ๐•ฅ๐•’]] ย 
 +    * [[deb_symbio|๐’๐˜๐Œ๐๐ข๐Ž โ„‚๐• ๐•Ÿ๐•’๐•ฅ๐•ฆ๐•ค]]ย 
 +    * [[deb_tardis|๐“๐€๐‘๐ƒ๐ข๐’ ๐•Š๐•ก๐•’๐•ฅ๐•š๐•ฆ๐•ž]] ย 
 +    * [[deb_debris|๐ƒ๐„๐๐‘๐ข๐’ โ„‚๐•™๐•ฃ๐• ๐•ž๐•–]] 
   * {{fa>windows?color=#0000A0}} Windows   * {{fa>windows?color=#0000A0}} Windows
-    * [[:pc_common|Common Works on Windows]]ย +    * [[:pc_common|โ–  Common Works on Windows]]ย 
-    * [[:pc_mesonism|Primus Workstation โ”€ MESONiSM]]ย +    * [[PC_MESONiSM|๐Œ๐„๐’๐Ž๐๐ข๐’๐Œ]] ย 
-    * [[:pc_mesonium|Manibus Tablet โ”€ MESONiUM]]ย +    * [[PC_MESONiST|๐Œ๐„๐’๐Ž๐๐ข๐’๐“]]
-    * [[:pc_mesonist|Domumus Workstage โ”€ MESONiST]]ย +
-    * [[:pc_mesonity|Praevus Station โ”€ MESONiTY]]+
   * {{fa>android?color=#006400}} Android   * {{fa>android?color=#006400}} Android
-    * [[:cell_common|Common Stuffs on Androids]]ย +    * [[:cell_common|โ–  Common Stuffs on Androids]]ย 
-    * [[:cell_epiaux|Jรบne's Primus โ”€ EPiAUX 5X]]ย +    * [[CELL_EPiCON|๐„๐๐ข๐‚๐Ž๐ ๐”ฝ๐Ÿ™]] ย 
-    * [[:cell_epihex|Jรบne's Extentus โ”€ EPiHEX 6]]ย +    * [[CELL_EPiMER|๐„๐๐ข๐Œ๐„๐‘ ๐Ÿก]] ย 
-    * [[:cell_epinex|Jรบne's Secondus โ”€ EPiNEX 5]]ย +    * [[CELL_EPiLUX|๐„๐๐ข๐‹๐”๐— ๐ŸŸ]]   ย 
-    * [[:cell_epitab|Jรบne's Laminus - EPiTAB 7]]ย +    * [[CELL_EPiTAP|๐„๐๐ข๐“๐€๐ ๐Ÿ™๐Ÿ™]] ย 
-    * [[:cell_epixus|Jรบne's Tertius โ”€ EPiXUS 4]]+    * [[CELL_EPiETA|๐„๐๐ข๐„๐“๐€ ๐Ÿœ]] 
 </nav> </nav>
  
-===== General info on Debian Linux ===== +====== General info on Debian ======
  
 {{:playground:boo_the_bunny_36.png?nolink&250|}} {{:playground:boo_the_bunny_36.png?nolink&250|}}
  
 ---- ----
-==== Initial steps freshly ==== +===== Initial steps ===== 
  
-=== Enable SSH === +==== Watchlist for backup ==== 
  
-Genesis step for all {{fa>linux}} Linux works. +<code bash> ย 
 +/etc/nginx/sites-available/* ย 
 +/var/www/*ย 
 +/etc/transmission-daemon/  ย 
 +/opt/scripts/ ย 
 +</code>ย 
 +ย 
 +**update-motd** ย 
 +<code bash>ย 
 +/etc/update-motd.d/ย 
 +</code>ย 
 +ย 
 +**crontab** ย 
 +<code bash> ย 
 +sudo crontab -l ย 
 +sudo -u www-data crontab -l ย 
 +crontab -l ย 
 +</code>ย 
 +ย 
 +**MariaDB** ''per DATABASE''ย 
 +=== Backup MariaDB DATABASE === ย 
 +ย 
 +<code bash> ย 
 +/usr/bin/mysqldump --single-transaction -h localhost -u root -p[database_passwd] [database_name] > /..(path)../.backup/[database_name]-sqlbkp_`date +"%Y%m%d"`.bakย 
 +</code> ย 
 +ย 
 +---- ย 
 +ย 
 +=== Backup using rsync command === ย 
 +ย 
 +== Backup Nginx configuration files == ย 
 +<code bash> ย 
 +sudo rsync -avh --progress /etc/nginx/sites-available/ /home/meson/.backup/nginx/nginx_config_`date +"%Y%m"`/ ย 
 +</code> ย 
 +ย 
 +== Backup HTML source files == ย 
 +<code bash> ย 
 +sudo rsync -avh --progress /var/www/ /home/meson/.backup/html/html_backup_`date +"%Y%m"`/ย 
 +</code> ย 
 +ย 
 +----ย 
 +=== Remote backup for webpages === ย 
 +Rsync with ''[TARGET]'' using rsync from ''[SOURCE]''  ย 
 +<code bash> ย 
 +sudo -u www-data rsync -azP --exclude '.ssh' -e 'ssh -p [port_number]' --rsync-path="sudo rsync" /var/www/ [user]@[TARGET]:"/[TARGET PATH]../../"ย 
 +</code> ย 
 +Put ''[SOURCE]'' public key in ''[TARGET]'' user's ''authorized_keys'' ย 
 +ย 
 +----ย 
 +==== Configure log files ==== ย 
 +ย 
 +Edit ''/etc/nginx/nginx.conf'' ย 
 +<code nginx> ย 
 +        access_log /var/log/nginx/_access.log;ย 
 +        error_log /var/log/nginx/_error.log;ย 
 +</code> ย 
 +ย 
 +----ย 
 +==== Purge log files ==== ย 
 +ย 
 +== Cleaning compressed log files == ย 
 +<code bash> ย 
 +sudo find /var/log -name '*.gz' -exec rm {} \;ย 
 +</code> ย 
 +ย 
 +----ย 
 +ย 
 +==== Set hostnames ==== ย 
 +ย 
 +<code bash> ย 
 +sudo hostname HOSTiD ย 
 +sudo hostnamectl HOSTiD ย 
 +</code> ย 
 +ย 
 +Edit ''/etc/hostname'' with full domain name ย 
 +ย 
 +<code bash> ย 
 +hostid.mydomain.comย 
 +</code> ย 
 +ย 
 +----ย 
 +==== Enable SSH ==== ย 
 +ย 
 +Genesis step for all {{mdi>debian?2x}} Linux works. 
  
 ---- ----
Line 51: Line 135:
 Append ''public keys'' for SSH client.  Append ''public keys'' for SSH client. 
  
-=== Enable colorful terminal === +---ย 
 +ย 
 +=== SSH Key to ED25519 === ย 
 +ย 
 +<code bash> ย 
 +ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "john@example.com"ย 
 +</code>ย 
 +ย 
 +  * ''-o'': Save the private-key using the new OpenSSH formatย 
 +  * ''-a'': KDF (Key Derivation Function) rounds. Higher numbers result in slower passphrase verification, increasing the resistance to brute-force password cracking should the private-key be stolen.ย 
 +  * ''-C'': An option to specify a commentย 
 +ย 
 +---ย 
 +ย 
 +==== Enable colorful terminal ==== 
  
 Comment out **''force_color_prompt=yes''** in ''~/.bashrc'' Comment out **''force_color_prompt=yes''** in ''~/.bashrc''
Line 60: Line 158:
 </code> </code>
    
 +=== Time stamp prompt === 
 +
 +Edit ''~/.bashrc'' and change ''PS1'' line 
 +
 +<code bash> 
 +if [ "$color_prompt" = yes ]; then
 +    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]: \[\033[01;33m\]\D{%T}\[\033[00m\] \[\033[01;37m\]\w\$\[\033[00m\] '
 +else
 +    PS1='${debian_chroot:+($debian_chroot)}\u@\h: \D{%T} \w\$ '
 +fi
 +</code> 
 +
 +Save and load ''.bashrc'' 
 +
 +<code bash> 
 +source ~/.bashrc 
 +</code> 
 +
 +
 +----
 +
 +==== User aliases command ==== 
 +
 +If you don't have ''.bash_aliases'' in your home directory. 
 +<code bash> 
 +touch .bash_aliases    
 +</code> 
 +
 +''Edit'' ''.bash_aliases''. Example: Backup Nginx configuration files with date stamp. 
 +
 +<code bash> 
 +alias backup_nginx='sudo rsync -avh --progress /etc/nginx/ /home/user/storage/Nginx.Config//nginx_config_`date +"%Y%m%d"`/'
 +</code> 
  
 ---- ----
-==== Configure Dynamic DNS ==== +===== Configure Dynamic DNS ===== 
  
 === Google Domains with ddclient ===  === Google Domains with ddclient === 
Line 155: Line 286:
  
 ---- ----
 +=== NO-IP with ddclient === 
 +
 +<code ini>
 +  protocol=dyndns2
 +  server=dynupdate.no-ip.com
 +  login=your_login_id
 +  password=your_password
 +  your_domain.com
 +</code>
 +
 +----
 +
 === Google Domains with API ===  === Google Domains with API === 
  
Line 284: Line 427:
  
 ---- ----
 +
 +===== Disable unused settings =====
  
 ==== Disable suspend mode ====  ==== Disable suspend mode ==== 
Line 319: Line 464:
  
 ---- ----
 +
 +==== Disable power wireless off ==== 
 +
 +<code bash> 
 + sudo iwconfig wlan0 power off 
 +</code> 
 +
 +----
 +
 +==== Disable Bluetooth service ==== 
 +
 +<code bash> 
 +vi /etc/bluetooth/main.conf
 +</code> 
 +
 +Edit the line with ''AutoEnable'' with ''false'' 
 +<code ini>
 +AutoEnable = false
 +</code> 
 +
 +A more radical way is to either stop the bluetooth service
 +
 +<code bash>
 +sudo systemctl stop bluetooth.service
 +</code>
 +
 +Or even more radical is to disable it permanently
 +<code bash> 
 +sudo systemctl disable bluetooth
 +</code> 
 +
 +----
 +
 ==== Debugging service ====  ==== Debugging service ==== 
  
Line 330: Line 508:
 ---- ----
  
-ย +==== Configure locales ==== 
-ย +
-==== Disable power wireless off ==== +
  
 <code bash>  <code bash> 
- sudo iwconfig wlan0 power off + sudo dpkg-reconfigure locales
 </code>  </code> 
 +
 +Deselect unused ''locales'' and save them.
  
 ---- ----
-==== User defined command alias ====  
  
-If you don't have ''.bash_aliases'' in your home directory+ย 
 +ย 
 +ย 
 +===== Install Services ===== ย 
 +ย 
 +==== Nextcloudโ„ข ====ย 
 +ย 
 +[[os_nextcloud|Nextcloud 101]] --- Nextcloud user's Guidesย 
 +ย 
 +----ย 
 +ย 
 +===== Upgrade & Maintenance =====ย 
 +ย 
 +==== Major LTS upgrade ==== ย 
 +ย 
 +Upgrade from 18.04 LTS to 20.04 LTS (''Focal Fossa'') ย 
 +ย 
 +Official Guide on upgrade [[https://meson.in/2ALsTwg|How to upgrade from Ubuntu 18.04 LTS to 20.04 LTS today]] <sub>  --- Updated on //2020/07/11 03:40// </sub> ย 
 +ย 
 +=== Upgrade on the command line === ย 
 +ย 
 +Update all repository for packages, which already installed on the systemย 
 <code bash>  <code bash> 
-touch .bash_aliases    + sudo apt update && sudo apt dist-upgrade -y && sudo apt autoremove 
 </code>  </code> 
  
-''Edit'' ''.bash_aliases''. Example: Backup Nginx configuration files with date stamp. +Upgrade with major LTS with 
  
 <code bash>  <code bash> 
-alias backup_nginx='sudo rsync -avh --progress /etc/nginx/ /home/user/storage/Nginx.Config//nginx_config_`date +"%Y%m%d"`/'+ sudo do-release-upgrade -d 
 </code>  </code> 
 +
 +Follow the procedures and finish.  
 +
 +<code text> 
 +Some third party entries in your sources.list were disabled. You can 
 +re-enable them after the upgrade with the 'software-properties' tool 
 +or your package manager. 
 +</code>
  
 ---- ----
 +
 ==== Fetch error during update ====  ==== Fetch error during update ==== 
  
Line 368: Line 576:
  
 ----  ---- 
-===== Upgrade php 7.x ===== +==== Upgrade php 7.x ==== 
  
 Append additional source for php7.x latest, Append additional source for php7.x latest,
- +<code bash> ย 
 +sudo apt install software-properties-commonย 
 +sudo add-apt-repository ppa:ondrej/phpย 
 +</code> ย 
 <code bash>  <code bash> 
 wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add - wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
-echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list+echo "deb https://packages.sury.org/php/ `lsb_release -cs` main" | sudo tee /etc/apt/sources.list.d/php.list
 </code> </code>
 +
 +Append ''Nginx mainline'' packages 
 +
 +<code bash> 
 +sudo add-apt-repository ppa:ondrej/nginx-mainline
 +</code> 
 +
 +Update source lists
  
 <code bash>  <code bash> 
Line 409: Line 629:
  
 ---- ----
-====Nginx repository ===== +==== Install & upgrade Nginx ==== 
  
 Install the prerequisites: Install the prerequisites:
Line 456: Line 676:
 sudo apt install nginx sudo apt install nginx
 </code>  </code> 
 +
 +----
 +
 +==== Upgrade mariadb ==== 
 +
 +<button type="link" icon="mdi mdi-database-plus">[[https://downloads.mariadb.org/mariadb/repositories|Setting up MariaDB Repositories]]</button>
 +
 +Select ''Disto'', ''Release'' and ''Version'' and follow the instruction 
 +
 +<code bash> 
 +sudo apt-get install software-properties-common
 +sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
 +sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] https://ftp.harukasan.org/mariadb/repo/10.5/ubuntu focal main'
 +</code>
 +
 +Once the key is imported and the repository added you can install MariaDB 10.5 from the MariaDB repository with:
 +
 +<code bash>
 +sudo apt update
 +sudo apt install mariadb-server
 +</code>
 +
 +Check service is working correctly and installed version. 
 +
 +<code bash> 
 +sudo mysql -uroot -p
 +</code> 
 +
 +Alternatively, edit ''/etc/apt/sources.list'' or add repository with command line. 
 +
 +<code>
 +# MariaDB 10.5 repository list - created 2020-08-31 04:34 UTC
 +# http://downloads.mariadb.org/mariadb/repositories/
 +deb [arch=amd64] https://ftp.harukasan.org/mariadb/repo/10.5/ubuntu focal main
 +deb-src https://ftp.harukasan.org/mariadb/repo/10.5/ubuntu focal main
 +</code>
 +
 +If you need debug packages, add the debug component to your sources.list with:
 +
 +<code bash>
 +sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] https://ftp.harukasan.org/mariadb/repo/10.5/ubuntu focal main/debug'
 +</code> 
 +
 +MariaDB debug packages will now show up when searching for 'mariadb' with apt and are distinguished by the `-dbgsym` suffix. Debug packages are generally only needed during development and usually should not be installed unless you know that you need them.
  
 ---- ----
 ==== Basic commands 101 ====  ==== Basic commands 101 ==== 
  
-{{fa>terminal?size=24&color=#AABBCC}} [[https://devhints.io/|Rico's cheatsheets]] -- First glimpse on {{fa>linux?color=#a80030}} **Linux commands**+{{fa>terminal?size=24&color=#AABBCC}} [[https://devhints.io/|Rico's cheatsheets]] -- first glimpse on {{fa>linux?color=#a80030}} **Linux commands**ย 
  
 === rm ===  === rm === 
Line 494: Line 759:
  
 ---- ----
 +
 +=== find string(s) in files ===
 +
 +<code bash> 
 +find /path/to/files/ -type f | xargs grep -n 'string_to_search'
 +</code> 
 +
 +----
 +
 === [output to file] ===  === [output to file] === 
  
Line 511: Line 785:
 | | | | | | |  | | | | | | | 
  
-ย +<code bash>ย 
-  command > output.txtย +command > output.txt   ย 
 +</code> 
 The standard output stream will be redirected to the file only, it will not be visible in the terminal. If the file already exists, it gets overwritten. The standard output stream will be redirected to the file only, it will not be visible in the terminal. If the file already exists, it gets overwritten.
  
-  command >> output.txtย +<code bash>ย 
 +command >> output.txtย 
 +</code> 
 The standard output stream will be redirected to the file only, it will not be visible in the terminal. If the file already exists, the new data will get appended to the end of the file. The standard output stream will be redirected to the file only, it will not be visible in the terminal. If the file already exists, the new data will get appended to the end of the file.
  
-  command 2> output.txtย +<code bash>ย 
 +command 2> output.txtย 
 +</code> 
 The standard error stream will be redirected to the file only, it will not be visible in the terminal. If the file already exists, it gets overwritten. The standard error stream will be redirected to the file only, it will not be visible in the terminal. If the file already exists, it gets overwritten.
  
-  command 2>> output.txtย +<code bash>ย 
 +command 2>> output.txtย 
 +</code> 
 The standard error stream will be redirected to the file only, it will not be visible in the terminal. If the file already exists, the new data will get appended to the end of the file. The standard error stream will be redirected to the file only, it will not be visible in the terminal. If the file already exists, the new data will get appended to the end of the file.
  
-  command &> output.txtย +<code bash>ย 
 +command &> output.txtย 
 +</code> 
 Both the standard output and standard error stream will be redirected to the file only, nothing will be visible in the terminal. If the file already exists, it gets overwritten. Both the standard output and standard error stream will be redirected to the file only, nothing will be visible in the terminal. If the file already exists, it gets overwritten.
  
-  command &>> output.txtย +<code bash>ย 
 +command &>> output.txtย 
 +</code> 
 Both the standard output and standard error stream will be redirected to the file only, nothing will be visible in the terminal. If the file already exists, the new data will get appended to the end of the file.. Both the standard output and standard error stream will be redirected to the file only, nothing will be visible in the terminal. If the file already exists, the new data will get appended to the end of the file..
  
-  command | tee output.txtย +<code bash>ย 
 +command | tee output.txtย 
 +</code> 
 The standard output stream will be copied to the file, it will still be visible in the terminal. If the file already exists, it gets overwritten. The standard output stream will be copied to the file, it will still be visible in the terminal. If the file already exists, it gets overwritten.
  
-  command | tee -a output.txtย +<code bash>ย 
 +command | tee -a output.txtย 
 +</code> 
 The standard output stream will be copied to the file, it will still be visible in the terminal. If the file already exists, the new data will get appended to the end of the file. The standard output stream will be copied to the file, it will still be visible in the terminal. If the file already exists, the new data will get appended to the end of the file.
  
-  (*)ย +<code bash>ย 
 +(*)ย 
 +</code> 
 Bash has no shorthand syntax that allows piping only StdErr to a second command, which would be needed here in combination with tee again to complete the table. If you really need something like that, please look at "How to pipe stderr, and not stdout?" on Stack Overflow for some ways how this can be done e.g. by swapping streams or using process substitution. Bash has no shorthand syntax that allows piping only StdErr to a second command, which would be needed here in combination with tee again to complete the table. If you really need something like that, please look at "How to pipe stderr, and not stdout?" on Stack Overflow for some ways how this can be done e.g. by swapping streams or using process substitution.
  
-  command |& tee output.txtย +<code bash>ย 
 +command |& tee output.txtย 
 +</code> 
 Both the standard output and standard error streams will be copied to the file while still being visible in the terminal. If the file already exists, it gets overwritten. Both the standard output and standard error streams will be copied to the file while still being visible in the terminal. If the file already exists, it gets overwritten.
  
-  command |& tee -a output.txtย +<code bash>ย 
 +command |& tee -a output.txtย 
 +</code> 
 Both the standard output and standard error streams will be copied to the file while still being visible in the terminal. If the file already exists, the new data will get appended to the end of the file. Both the standard output and standard error streams will be copied to the file while still being visible in the terminal. If the file already exists, the new data will get appended to the end of the file.
- 
  
 ---- ----
-=== Find string(s) in files === 
  
-<code bash>  
-find /path/to/files/ -type f | xargs grep -n 'string_to_search' 
-</code>  
  
----- 
  • debian_common.1561302732
  • Last modified: 2019/06/23 15:12
  • by Jรบne Park