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 [2020/07/10 23:43] – [Upgrade php 7.x] Júne Parkdebian_common [2024/03/19 11:30] (current) – [Watchlist for backup] Júne Park
Line 19: Line 19:
     * [[:cell_epiaux|Júne's Primus ─ EPiAUX 5X]]     * [[:cell_epiaux|Júne's Primus ─ EPiAUX 5X]]
     * [[:cell_epihex|Júne's Extentus ─ EPiHEX 6]]     * [[:cell_epihex|Júne's Extentus ─ EPiHEX 6]]
 +    * [[:cell_epimer|Júne's Maximus ─ EPiMER 5P]]
     * [[:cell_epinex|Júne's Secondus ─ EPiNEX 5]]     * [[:cell_epinex|Júne's Secondus ─ EPiNEX 5]]
     * [[:cell_epitab|Júne's Laminus - EPiTAB 7]]     * [[:cell_epitab|Júne's Laminus - EPiTAB 7]]
Line 30: Line 31:
 ---- ----
 ===== Initial steps =====  ===== Initial steps ===== 
 +
 +==== Watchlist for backup ==== 
 +
 +<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> 
 +
 +----
  
 ==== Enable SSH ====  ==== Enable SSH ==== 
Line 53: Line 123:
 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 62: Line 146:
 </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> 
 +
  
 ---- ----
Line 172: Line 274:
  
 ---- ----
 +=== 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 443: Line 557:
  
 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/ `lsb_release -cs` 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 528: Line 654:
 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.
  
 ---- ----
Line 647: Line 817:
 </code>  </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.
- 
  
 ---- ----
 +
  
  • debian_common.1594424584
  • Last modified: 2020/07/10 23:43
  • by Júne Park