Correct indentation

This commit is contained in:
Thomas Dehaeze 2021-01-08 01:45:55 +01:00
parent d5e5b6cd57
commit 0e9a45e9c5
2 changed files with 72 additions and 72 deletions

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2021-01-08 ven. 01:43 -->
<!-- 2021-01-08 ven. 01:45 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Home Server</title>
<meta name="generator" content="Org mode" />
@ -48,7 +48,7 @@
<li><a href="#orgab9cc12">Update System/Packages</a></li>
<li><a href="#orgbd671d1">Docker Commands</a></li>
<li><a href="#orgc233df6">Add User and Password for Basic Authentication</a></li>
<li><a href="#orgc2e8650">Snapraid</a></li>
<li><a href="#org42ad31f">Snapraid</a></li>
<li><a href="#orged978b5">Restore Online backup with <code>restic</code></a></li>
</ul>
</li>
@ -66,7 +66,7 @@
<li><a href="#orgb2219b0"><code>rclone.conf</code></a></li>
</ul>
</li>
<li><a href="#org42ad31f">Snapraid</a>
<li><a href="#orge8a6010">Snapraid</a>
<ul>
<li><a href="#org243fb45"><code>snapraid.conf</code></a></li>
<li><a href="#orgf79de7e"><code>snapraid-runner.conf</code></a></li>
@ -192,7 +192,7 @@
<h3 id="orgbc4de87">Install Important software</h3>
<div class="outline-text-3" id="text-orgbc4de87">
<div class="org-src-container">
<pre class="src src-bash"> <span class="org-type">sudo</span> apt install neovim tmux fd-find ripgrep apache2-utils unrar ranger fzf stow
<pre class="src src-bash"><span class="org-type">sudo</span> apt install neovim tmux fd-find ripgrep apache2-utils unrar ranger fzf stow
</pre>
</div>
</div>
@ -205,8 +205,8 @@
On the local host, using Termite:
</p>
<div class="org-src-container">
<pre class="src src-bash"> infocmp &gt; termite.terminfo <span class="org-comment-delimiter"># </span><span class="org-comment">export Termite's Terminfo</span>
scp termite.terminfo user@remote-host:~/ <span class="org-comment-delimiter"># </span><span class="org-comment">or any other method to copy to the remote host</span>
<pre class="src src-bash">infocmp &gt; termite.terminfo <span class="org-comment-delimiter"># </span><span class="org-comment">export Termite's Terminfo</span>
scp termite.terminfo user@remote-host:~/ <span class="org-comment-delimiter"># </span><span class="org-comment">or any other method to copy to the remote host</span>
</pre>
</div>
@ -214,8 +214,8 @@ On the local host, using Termite:
On the remote host, in the directory where you copied <code>termite.terminfo</code>:
</p>
<div class="org-src-container">
<pre class="src src-bash"> tic -x termite.terminfo <span class="org-comment-delimiter"># </span><span class="org-comment">import Terminfo for current user</span>
<span class="org-type">rm</span> termite.terminfo <span class="org-comment-delimiter"># </span><span class="org-comment">optional: remove Terminfo file</span>
<pre class="src src-bash">tic -x termite.terminfo <span class="org-comment-delimiter"># </span><span class="org-comment">import Terminfo for current user</span>
<span class="org-type">rm</span> termite.terminfo <span class="org-comment-delimiter"># </span><span class="org-comment">optional: remove Terminfo file</span>
</pre>
</div>
</div>
@ -228,8 +228,8 @@ On the remote host, in the directory where you copied <code>termite.terminfo</co
Modify <code>~/.inputrc</code>, like so:
</p>
<div class="org-src-container">
<pre class="src src-conf"> <span class="org-string">"\e[A"</span>: history-search-backward <span class="org-comment-delimiter"># </span><span class="org-comment">arrow up</span>
<span class="org-string">"\e[B"</span>: history-search-forward <span class="org-comment-delimiter"># </span><span class="org-comment">arrow down</span>
<pre class="src src-conf"><span class="org-string">"\e[A"</span>: history-search-backward <span class="org-comment-delimiter"># </span><span class="org-comment">arrow up</span>
<span class="org-string">"\e[B"</span>: history-search-forward <span class="org-comment-delimiter"># </span><span class="org-comment">arrow down</span>
</pre>
</div>
</div>
@ -243,22 +243,22 @@ A nice tutorial is available <a href="https://www.digitalocean.com/community/tut
</p>
<div class="org-src-container">
<pre class="src src-bash"> lsblk
<pre class="src src-bash">lsblk
</pre>
</div>
<div class="org-src-container">
<pre class="src src-bash"> <span class="org-type">sudo</span> parted /dev/sda mklabel gpt
<pre class="src src-bash"><span class="org-type">sudo</span> parted /dev/sda mklabel gpt
</pre>
</div>
<div class="org-src-container">
<pre class="src src-bash"> <span class="org-type">sudo</span> parted -a opt /dev/sda mkpart <span class="org-string">"partitionname"</span> ext4 0% 100%
<pre class="src src-bash"><span class="org-type">sudo</span> parted -a opt /dev/sda mkpart <span class="org-string">"partitionname"</span> ext4 0% 100%
</pre>
</div>
<div class="org-src-container">
<pre class="src src-bash"> <span class="org-type">sudo</span> mkfs.ext4 -L partitionname /dev/sda1
<pre class="src src-bash"><span class="org-type">sudo</span> mkfs.ext4 -L partitionname /dev/sda1
</pre>
</div>
</div>
@ -273,7 +273,7 @@ A nice tutorial is available <a href="https://www.digitalocean.com/community/tut
<div class="org-src-container">
<pre class="src src-bash"> <span class="org-type">sudo</span> apt install mergerfs
<pre class="src src-bash"><span class="org-type">sudo</span> apt install mergerfs
</pre>
</div>
@ -281,9 +281,9 @@ A nice tutorial is available <a href="https://www.digitalocean.com/community/tut
Create mount points
</p>
<div class="org-src-container">
<pre class="src src-bash"> <span class="org-type">sudo</span> <span class="org-type">mkdir</span> /mnt/disk0
<span class="org-type">sudo</span> <span class="org-type">mkdir</span> /mnt/disk1
<span class="org-type">sudo</span> <span class="org-type">mkdir</span> /mnt/parity
<pre class="src src-bash"><span class="org-type">sudo</span> <span class="org-type">mkdir</span> /mnt/disk0
<span class="org-type">sudo</span> <span class="org-type">mkdir</span> /mnt/disk1
<span class="org-type">sudo</span> <span class="org-type">mkdir</span> /mnt/parity
</pre>
</div>
@ -291,7 +291,7 @@ Create mount points
Create folder where disks will be merged.
</p>
<div class="org-src-container">
<pre class="src src-bash"> <span class="org-type">sudo</span> <span class="org-type">mkdir</span> /srv/storage
<pre class="src src-bash"><span class="org-type">sudo</span> <span class="org-type">mkdir</span> /srv/storage
</pre>
</div>
@ -299,11 +299,11 @@ Create folder where disks will be merged.
Edit <code>/etc/fstab</code>.
</p>
<div class="org-src-container">
<pre class="src src-conf"> /dev/disk/by-uuid/7fb7873c-83bd-4805-98ab-506e6c7b56fa /mnt/disk0 ext4 defaults <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span>
/dev/disk/by-uuid/6574b7ae-321c-4078-9793-bc41a4fa5588 /mnt/disk1 ext4 defaults <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span>
/dev/disk/by-uuid/6fcd38b9-0886-46bd-900d-cb1f170dbcee /mnt/parity ext4 defaults <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span>
<pre class="src src-conf">/dev/disk/by-uuid/7fb7873c-83bd-4805-98ab-506e6c7b56fa /mnt/disk0 ext4 defaults <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span>
/dev/disk/by-uuid/6574b7ae-321c-4078-9793-bc41a4fa5588 /mnt/disk1 ext4 defaults <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span>
/dev/disk/by-uuid/6fcd38b9-0886-46bd-900d-cb1f170dbcee /mnt/parity ext4 defaults <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span>
<span class="org-variable-name">/mnt/disk* /srv/storage fuse.mergerfs direct_io,defaults,allow_other,minfreespace</span>=50G,fsname=mergerfs <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span>
<span class="org-variable-name">/mnt/disk* /srv/storage fuse.mergerfs direct_io,defaults,allow_other,minfreespace</span>=50G,fsname=mergerfs <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span>
</pre>
</div>
</div>
@ -333,7 +333,7 @@ The procedure is well explained <a href="https://www.digitalocean.com/community/
If docker is already installed, remove it:
</p>
<div class="org-src-container">
<pre class="src src-bash"> <span class="org-type">sudo</span> apt remove docker
<pre class="src src-bash"><span class="org-type">sudo</span> apt remove docker
</pre>
</div>
</div>
@ -343,7 +343,7 @@ If docker is already installed, remove it:
<h3 id="org1f7f7d7">Executing the Docker Command Without Sudo</h3>
<div class="outline-text-3" id="text-org1f7f7d7">
<div class="org-src-container">
<pre class="src src-bash"> <span class="org-type">sudo</span> usermod -aG docker $<span class="org-rainbow-delimiters-depth-1">{</span><span class="org-variable-name">USER</span><span class="org-rainbow-delimiters-depth-1">}</span>
<pre class="src src-bash"><span class="org-type">sudo</span> usermod -aG docker $<span class="org-rainbow-delimiters-depth-1">{</span><span class="org-variable-name">USER</span><span class="org-rainbow-delimiters-depth-1">}</span>
</pre>
</div>
@ -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:
</p>
<div class="org-src-container">
<pre class="src src-bash"> su - $<span class="org-rainbow-delimiters-depth-1">{</span><span class="org-variable-name">USER</span><span class="org-rainbow-delimiters-depth-1">}</span>
<pre class="src src-bash">su - $<span class="org-rainbow-delimiters-depth-1">{</span><span class="org-variable-name">USER</span><span class="org-rainbow-delimiters-depth-1">}</span>
</pre>
</div>
</div>
@ -361,7 +361,7 @@ To apply the new group membership, log out of the server and back in, or type th
<h3 id="org88013e8">Install Docker-Compose</h3>
<div class="outline-text-3" id="text-org88013e8">
<div class="org-src-container">
<pre class="src src-bash"> <span class="org-type">sudo</span> apt install docker-compose
<pre class="src src-bash"><span class="org-type">sudo</span> apt install docker-compose
</pre>
</div>
</div>
@ -371,8 +371,8 @@ To apply the new group membership, log out of the server and back in, or type th
<h3 id="orgd2ef096">Setup Docker Networks</h3>
<div class="outline-text-3" id="text-orgd2ef096">
<div class="org-src-container">
<pre class="src src-bash"> docker network create --gateway 192.168.90.1 --subnet 192.168.90.0/24 t2_proxy
docker network create docker_default
<pre class="src src-bash">docker network create --gateway 192.168.90.1 --subnet 192.168.90.0/24 t2_proxy
docker network create docker_default
</pre>
</div>
</div>
@ -382,7 +382,7 @@ To apply the new group membership, log out of the server and back in, or type th
<h3 id="orgefaaeb5">Change Timezone</h3>
<div class="outline-text-3" id="text-orgefaaeb5">
<div class="org-src-container">
<pre class="src src-bash"> <span class="org-type">sudo</span> timedatectl set-timezone Europe/Paris
<pre class="src src-bash"><span class="org-type">sudo</span> timedatectl set-timezone Europe/Paris
</pre>
</div>
</div>
@ -408,7 +408,7 @@ Most of it comes from <a href="https://github.com/imthenachoman/How-To-Secure-A-
The procedure is well explained <a href="https://www.linuxbabe.com/ubuntu/automatic-security-update-unattended-upgrades-ubuntu">here</a>.
</p>
<div class="org-src-container">
<pre class="src src-bash"> <span class="org-type">sudo</span> apt install unattended-upgrades update-notifier-common
<pre class="src src-bash"><span class="org-type">sudo</span> apt install unattended-upgrades update-notifier-common
</pre>
</div>
@ -444,7 +444,7 @@ Create a folder <code>~/cron</code> with all the scripts and logs related to cro
To edit the cron jobs, type <code>crontab -e</code> and add a line like:
</p>
<div class="org-src-container">
<pre class="src src-conf"> */5 * * * * /home/thomas/cron/caddy_update.sh &gt;&gt; /home/thomas/cron/caddy_update.log 2&gt;&amp;1
<pre class="src src-conf">*/5 * * * * /home/thomas/cron/caddy_update.sh &gt;&gt; /home/thomas/cron/caddy_update.log 2&gt;&amp;1
</pre>
</div>
@ -459,7 +459,7 @@ To check how the first part of the crontab works, check <a href="https://crontab
<h3 id="orgcb0d234">Run <code>docker-compose</code></h3>
<div class="outline-text-3" id="text-orgcb0d234">
<div class="org-src-container">
<pre class="src src-bash"> <span class="org-type">cd</span> ~/docker &amp;&amp; docker-compose up -d
<pre class="src src-bash"><span class="org-type">cd</span> ~/docker &amp;&amp; docker-compose up -d
</pre>
</div>
</div>
@ -523,9 +523,9 @@ This will delete all unused images, volumes and networks.
</div>
</div>
<div id="outline-container-orgc2e8650" class="outline-3">
<h3 id="orgc2e8650">Snapraid</h3>
<div class="outline-text-3" id="text-orgc2e8650">
<div id="outline-container-org42ad31f" class="outline-3">
<h3 id="org42ad31f">Snapraid</h3>
<div class="outline-text-3" id="text-org42ad31f">
<p>
To see all files &ldquo;backed up&rdquo; by snapraid, use:
</p>
@ -939,9 +939,9 @@ You can use <code>latest</code> instead of the ID.
</div>
</div>
<div id="outline-container-org42ad31f" class="outline-3">
<h3 id="org42ad31f">Snapraid</h3>
<div class="outline-text-3" id="text-org42ad31f">
<div id="outline-container-orge8a6010" class="outline-3">
<h3 id="orge8a6010">Snapraid</h3>
<div class="outline-text-3" id="text-orge8a6010">
<div class="org-src-container">
<pre class="src src-yaml"> <span class="org-variable-name">snapraid</span>:
<span class="org-variable-name">container_name</span>: snapraid
@ -1745,7 +1745,7 @@ Create a script <code>~/cron/caddy_update.sh</code> with:
Type <code>crontab -e</code> and add this line:
</p>
<div class="org-src-container">
<pre class="src src-conf"> */5 * * * * /home/thomas/cron/caddy_update.sh &gt;&gt; /home/thomas/cron/caddy_update.log 2&gt;&amp;1
<pre class="src src-conf">*/5 * * * * /home/thomas/cron/caddy_update.sh &gt;&gt; /home/thomas/cron/caddy_update.log 2&gt;&amp;1
</pre>
</div>
</div>
@ -1754,7 +1754,7 @@ Type <code>crontab -e</code> and add this line:
</div>
<div id="postamble" class="status">
<p class="author">Author: Dehaeze Thomas</p>
<p class="date">Created: 2021-01-08 ven. 01:43</p>
<p class="date">Created: 2021-01-08 ven. 01:45</p>
</div>
</body>
</html>

62
nas.org
View File

@ -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