From da67cadec2170fa95b9feb60eb119e3156d81a1d Mon Sep 17 00:00:00 2001
From: Thomas Dehaeze restic
rclone.conf
snapraid.conf
snapraid-runner.conf
Install Important software
sudo apt install neovim tmux fd-find ripgrep apache2-utils unrar ranger fzf stow
+
sudo apt install neovim tmux fd-find ripgrep apache2-utils unrar ranger fzf stow
infocmp > termite.terminfo # export Termite's Terminfo - scp termite.terminfo user@remote-host:~/ # or any other method to copy to the remote host +infocmp > termite.terminfo # export Termite's Terminfo +scp termite.terminfo user@remote-host:~/ # or any other method to copy to the remote host
termite.terminfo
:
tic -x termite.terminfo # import Terminfo for current user - rm termite.terminfo # optional: remove Terminfo file +tic -x termite.terminfo # import Terminfo for current user +rm termite.terminfo # optional: remove Terminfo file
termite.terminfo~/.inputrc
, like so:
"\e[A": history-search-backward # arrow up - "\e[B": history-search-forward # arrow down +"\e[A": history-search-backward # arrow up +"\e[B": history-search-forward # arrow down
lsblk +lsblk-sudo parted /dev/sda mklabel gpt +sudo parted /dev/sda mklabel gpt
-sudo parted -a opt /dev/sda mkpart "partitionname" ext4 0% 100% +sudo parted -a opt /dev/sda mkpart "partitionname" ext4 0% 100%-@@ -273,7 +273,7 @@ A nice tutorial is available -sudo mkfs.ext4 -L partitionname /dev/sda1 +sudo mkfs.ext4 -L partitionname /dev/sda1
sudo apt install mergerfs +sudo apt install mergerfs
@@ -281,9 +281,9 @@ A nice tutorial is available -sudo mkdir /mnt/disk0 - sudo mkdir /mnt/disk1 - sudo mkdir /mnt/parity +sudo mkdir /mnt/disk0 +sudo mkdir /mnt/disk1 +sudo mkdir /mnt/parity@@ -291,7 +291,7 @@ Create mount points Create folder where disks will be merged.-@@ -299,11 +299,11 @@ Create folder where disks will be merged. Editsudo mkdir /srv/storage +sudo mkdir /srv/storage/etc/fstab
.-@@ -333,7 +333,7 @@ The procedure is well explained -/dev/disk/by-uuid/7fb7873c-83bd-4805-98ab-506e6c7b56fa /mnt/disk0 ext4 defaults 0 0 - /dev/disk/by-uuid/6574b7ae-321c-4078-9793-bc41a4fa5588 /mnt/disk1 ext4 defaults 0 0 - /dev/disk/by-uuid/6fcd38b9-0886-46bd-900d-cb1f170dbcee /mnt/parity ext4 defaults 0 0 +/dev/disk/by-uuid/7fb7873c-83bd-4805-98ab-506e6c7b56fa /mnt/disk0 ext4 defaults 0 0 +/dev/disk/by-uuid/6574b7ae-321c-4078-9793-bc41a4fa5588 /mnt/disk1 ext4 defaults 0 0 +/dev/disk/by-uuid/6fcd38b9-0886-46bd-900d-cb1f170dbcee /mnt/parity ext4 defaults 0 0 - /mnt/disk* /srv/storage fuse.mergerfs direct_io,defaults,allow_other,minfreespace=50G,fsname=mergerfs 0 0 +/mnt/disk* /srv/storage fuse.mergerfs direct_io,defaults,allow_other,minfreespace=50G,fsname=mergerfs 0 0sudo apt remove docker +sudo apt remove docker
@@ -343,7 +343,7 @@ If docker is already installed, remove it:Executing the Docker Command Without Sudo
@@ -361,7 +361,7 @@ To apply the new group membership, log out of the server and back in, or type th-@@ -351,7 +351,7 @@ If docker is already installed, remove it: To apply the new group membership, log out of the server and back in, or type the following:sudo usermod -aG docker ${USER} +sudo usermod -aG docker ${USER}-su - ${USER} +su - ${USER}Install Docker-Compose
@@ -371,8 +371,8 @@ To apply the new group membership, log out of the server and back in, or type th-sudo apt install docker-compose +sudo apt install docker-compose
Setup Docker Networks
@@ -382,7 +382,7 @@ To apply the new group membership, log out of the server and back in, or type th-docker network create --gateway 192.168.90.1 --subnet 192.168.90.0/24 t2_proxy - docker network create docker_default +docker network create --gateway 192.168.90.1 --subnet 192.168.90.0/24 t2_proxy +docker network create docker_defaultChange Timezone
@@ -408,7 +408,7 @@ Most of it comes from here.-sudo timedatectl set-timezone Europe/Paris +sudo timedatectl set-timezone Europe/Paris
-@@ -444,7 +444,7 @@ Create a foldersudo apt install unattended-upgrades update-notifier-common +sudo apt install unattended-upgrades update-notifier-common
~/cron
with all the scripts and logs related to cro To edit the cron jobs, typecrontab -e
and add a line like:-@@ -459,7 +459,7 @@ To check how the first part of the crontab works, check Run*/5 * * * * /home/thomas/cron/caddy_update.sh >> /home/thomas/cron/caddy_update.log 2>&1 +*/5 * * * * /home/thomas/cron/caddy_update.sh >> /home/thomas/cron/caddy_update.log 2>&1docker-compose
@@ -523,9 +523,9 @@ This will delete all unused images, volumes and networks. --cd ~/docker && docker-compose up -d +cd ~/docker && docker-compose up -d
-Snapraid
-++-Snapraid
+To see all files “backed up” by snapraid, use:
@@ -939,9 +939,9 @@ You can uselatest
instead of the ID.-Snapraid
-++Snapraid
+@@ -1754,7 +1754,7 @@ Typesnapraid: container_name: snapraid @@ -1745,7 +1745,7 @@ Create a script~/cron/caddy_update.sh
with: Typecrontab -e
and add this line:-*/5 * * * * /home/thomas/cron/caddy_update.sh >> /home/thomas/cron/caddy_update.log 2>&1 +*/5 * * * * /home/thomas/cron/caddy_update.sh >> /home/thomas/cron/caddy_update.log 2>&1crontab -e
and add this line:diff --git a/nas.org b/nas.org index a6ab375..e1cda53 100644 --- a/nas.org +++ b/nas.org @@ -23,46 +23,46 @@ ** Install Important software #+begin_src bash :eval no - sudo apt install neovim tmux fd-find ripgrep apache2-utils unrar ranger fzf stow +sudo apt install neovim tmux fd-find ripgrep apache2-utils unrar ranger fzf stow #+end_src ** Terminal Problem On the local host, using Termite: #+begin_src bash :eval no - infocmp > termite.terminfo # export Termite's Terminfo - scp termite.terminfo user@remote-host:~/ # or any other method to copy to the remote host +infocmp > termite.terminfo # export Termite's Terminfo +scp termite.terminfo user@remote-host:~/ # or any other method to copy to the remote host #+end_src On the remote host, in the directory where you copied =termite.terminfo=: #+begin_src bash :eval no - tic -x termite.terminfo # import Terminfo for current user - rm termite.terminfo # optional: remove Terminfo file +tic -x termite.terminfo # import Terminfo for current user +rm termite.terminfo # optional: remove Terminfo file #+end_src ** Minor Modifications of =~/.inputrc= Modify =~/.inputrc=, like so: #+begin_src conf - "\e[A": history-search-backward # arrow up - "\e[B": history-search-forward # arrow down +"\e[A": history-search-backward # arrow up +"\e[B": history-search-forward # arrow down #+end_src ** Partition and Format Disk Drives A nice tutorial is available [[https://www.digitalocean.com/community/tutorials/how-to-partition-and-format-storage-devices-in-linux][here]]. #+begin_src bash :eval no - lsblk +lsblk #+end_src #+begin_src bash :eval no - sudo parted /dev/sda mklabel gpt +sudo parted /dev/sda mklabel gpt #+end_src #+begin_src bash :eval no - sudo parted -a opt /dev/sda mkpart "partitionname" ext4 0% 100% +sudo parted -a opt /dev/sda mkpart "partitionname" ext4 0% 100% #+end_src #+begin_src bash :eval no - sudo mkfs.ext4 -L partitionname /dev/sda1 +sudo mkfs.ext4 -L partitionname /dev/sda1 #+end_src ** MergerFS and FStab @@ -70,28 +70,28 @@ A nice tutorial is available [[https://www.digitalocean.com/community/tutorials/ #+begin_src bash :eval no - sudo apt install mergerfs +sudo apt install mergerfs #+end_src Create mount points #+begin_src bash :eval no - sudo mkdir /mnt/disk0 - sudo mkdir /mnt/disk1 - sudo mkdir /mnt/parity +sudo mkdir /mnt/disk0 +sudo mkdir /mnt/disk1 +sudo mkdir /mnt/parity #+end_src Create folder where disks will be merged. #+begin_src bash :eval no - sudo mkdir /srv/storage +sudo mkdir /srv/storage #+end_src Edit =/etc/fstab=. #+begin_src conf :eval no - /dev/disk/by-uuid/7fb7873c-83bd-4805-98ab-506e6c7b56fa /mnt/disk0 ext4 defaults 0 0 - /dev/disk/by-uuid/6574b7ae-321c-4078-9793-bc41a4fa5588 /mnt/disk1 ext4 defaults 0 0 - /dev/disk/by-uuid/6fcd38b9-0886-46bd-900d-cb1f170dbcee /mnt/parity ext4 defaults 0 0 +/dev/disk/by-uuid/7fb7873c-83bd-4805-98ab-506e6c7b56fa /mnt/disk0 ext4 defaults 0 0 +/dev/disk/by-uuid/6574b7ae-321c-4078-9793-bc41a4fa5588 /mnt/disk1 ext4 defaults 0 0 +/dev/disk/by-uuid/6fcd38b9-0886-46bd-900d-cb1f170dbcee /mnt/parity ext4 defaults 0 0 - /mnt/disk* /srv/storage fuse.mergerfs direct_io,defaults,allow_other,minfreespace=50G,fsname=mergerfs 0 0 +/mnt/disk* /srv/storage fuse.mergerfs direct_io,defaults,allow_other,minfreespace=50G,fsname=mergerfs 0 0 #+end_src ** Automating with SnapRAID Runner @@ -104,33 +104,33 @@ The procedure is well explained [[https://www.digitalocean.com/community/tutoria If docker is already installed, remove it: #+begin_src bash - sudo apt remove docker +sudo apt remove docker #+end_src ** Executing the Docker Command Without Sudo #+begin_src bash - sudo usermod -aG docker ${USER} +sudo usermod -aG docker ${USER} #+end_src To apply the new group membership, log out of the server and back in, or type the following: #+begin_src bash - su - ${USER} +su - ${USER} #+end_src ** Install Docker-Compose #+begin_src bash - sudo apt install docker-compose +sudo apt install docker-compose #+end_src ** Setup Docker Networks #+begin_src bash - docker network create --gateway 192.168.90.1 --subnet 192.168.90.0/24 t2_proxy - docker network create docker_default +docker network create --gateway 192.168.90.1 --subnet 192.168.90.0/24 t2_proxy +docker network create docker_default #+end_src ** Change Timezone #+begin_src bash :exec no - sudo timedatectl set-timezone Europe/Paris +sudo timedatectl set-timezone Europe/Paris #+end_src ** Secure the Web Server @@ -141,7 +141,7 @@ Most of it comes from [[https://github.com/imthenachoman/How-To-Secure-A-Linux-S ** Automatic Security Updates The procedure is well explained [[https://www.linuxbabe.com/ubuntu/automatic-security-update-unattended-upgrades-ubuntu][here]]. #+begin_src bash - sudo apt install unattended-upgrades update-notifier-common +sudo apt install unattended-upgrades update-notifier-common #+end_src Edit =/etc/apt/apt.conf.d/50unattended-upgrades=, and change the following lines: @@ -162,7 +162,7 @@ Create a folder =~/cron= with all the scripts and logs related to cron. To edit the cron jobs, type =crontab -e= and add a line like: #+begin_src conf - */5 * * * * /home/thomas/cron/caddy_update.sh >> /home/thomas/cron/caddy_update.log 2>&1 +*/5 * * * * /home/thomas/cron/caddy_update.sh >> /home/thomas/cron/caddy_update.log 2>&1 #+end_src That will run every 5 minutes. @@ -170,7 +170,7 @@ To check how the first part of the crontab works, check [[https://crontab.guru/] ** Run =docker-compose= #+begin_src bash - cd ~/docker && docker-compose up -d +cd ~/docker && docker-compose up -d #+end_src * Maintenance - How To @@ -1941,6 +1941,6 @@ docker exec caddy /bin/sh -c "cd /srv/www && echo -e \"Update repo $(date)\" && Type =crontab -e= and add this line: #+begin_src conf - */5 * * * * /home/thomas/cron/caddy_update.sh >> /home/thomas/cron/caddy_update.log 2>&1 +*/5 * * * * /home/thomas/cron/caddy_update.sh >> /home/thomas/cron/caddy_update.log 2>&1 #+end_src -Created: 2021-01-08 ven. 01:43
+Created: 2021-01-08 ven. 01:45