# Docker

# Docker Commands

## General CMD

---

### Show list of dockers:

```bash
docker ps
```

---

### copy CMD

```bash
cp <source file.ext> <new file.ext>
```

---

### Host Web Server

```bash
python3 -m http.server 1337
```

---

### Bash into Docker container

```bash
docker exec -it <container name/id> bash
```

#### accesed via SSH allows to run cmds as the container

---

### Make Dockerfile

[https://stackoverflow.com/questions/45152426/create-docker-compose-file-from-dockerfile](https://stackoverflow.com/questions/45152426/create-docker-compose-file-from-dockerfile)

---

Enable SSH and Root

cd sr

# Jitsi-Meet

<div class="component" id="bkmrk-"></div><div class="component" id="bkmrk-prerequisites"><div class="component"><div class="component"><div class="component split-note-container-widget"><div class="component note-split type-text mime-text-html"><div class="ribbon-container component"><div class="ribbon-top-row"><div class="ribbon-button-container"></div></div></div><div class="floating-buttons no-print component"><div class="floating-buttons-children">Prerequisites</div></div></div></div></div></div></div><div class="component" id="bkmrk-this-image-assumes-t"><div class="component"><div class="component"><div class="component split-note-container-widget"><div class="component note-split type-text mime-text-html"><div class="component scrolling-container"><div class="note-detail component"><div class="note-detail-readonly-text note-detail-printable component"><div class="note-detail-readonly-text-content ck-content"><div class="content"><div class="ck-content">- This image assumes that you are using a reverse proxy such as [jwilder/nginx-proxy](https://github.com/jwilder/nginx-proxy) and optionally the [Let's Encrypt Proxy Companion @ https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion](https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion) in order to serve your pages.

</div></div></div></div></div></div></div></div></div></div></div>This is a complex series of images and relies on all packages to be working together. You will also need to open ports on your firewall (See below).

Installation

Automated builds of the image are available on [Docker Hub](https://hub.docker.com/tiredofit/alpine) and is the recommended method of installation.

docker pull tiredofit/jitsi-meet docker pull tiredofit/jitsi-prosody docker pull tiredofit/jitsi-videobridge docker pull tiredofit/jitsi-jicofo

Quick Start

The quickest way to get started is using [docker-compose](https://docs.docker.com/compose/). See the examples folder for a working [docker-compose.yml](https://github.com/tiredofit/docker-jitsi-meet/blob/master/examples/docker-compose.yml) that can be modified for development or production use. All you will need to do is change the `HOST` and `VIRTUAL_HOST,LETSENCRYPT_HOST` variables and the system will automatically generate certificates for you and the system will function.

Set various [environment variables](https://notepad.thecartwrights.nz/#environment-variables) to understand the capabilities of this image.

Map [persistent storage](https://notepad.thecartwrights.nz/#data-volumes) for access to configuration and data files for backup.

Configuration

### Data-Volumes

The following directories are used for configuration and can be mapped for persistent storage.

#### jitsi-prosody

<div class="component" id="bkmrk-directory-descriptio"><div class="component"><div class="component"><div class="component split-note-container-widget"><div class="component note-split type-text mime-text-html"><div class="component scrolling-container"><div class="note-detail component"><div class="note-detail-readonly-text note-detail-printable component"><div class="note-detail-readonly-text-content ck-content"><div class="content"><div class="ck-content"><figure class="table"><table><thead><tr><th>Directory</th><th>Description</th></tr></thead><tbody><tr><td>`/certs`</td><td>Needed to Automatically Generate Certificates for other containers</td></tr></tbody></table>

</figure></div></div></div></div></div></div></div></div></div></div></div>#### jitsi-videobridge

<div class="component" id="bkmrk-directory-descriptio-1"><div class="component"><div class="component"><div class="component split-note-container-widget"><div class="component note-split type-text mime-text-html"><div class="component scrolling-container"><div class="note-detail component"><div class="note-detail-readonly-text note-detail-printable component"><div class="note-detail-readonly-text-content ck-content"><div class="content"><div class="ck-content"><figure class="table"><table><thead><tr><th>Directory</th><th>Description</th></tr></thead><tbody><tr><td>`/certs`</td><td>Needed to share certificates between containers for Self Signed variants</td></tr></tbody></table>

</figure></div></div></div></div></div></div></div></div></div></div></div>#### jitsi-jicofo

<div class="component" id="bkmrk-directory-descriptio-2"><div class="component"><div class="component"><div class="component split-note-container-widget"><div class="component note-split type-text mime-text-html"><div class="component scrolling-container"><div class="note-detail component"><div class="note-detail-readonly-text note-detail-printable component"><div class="note-detail-readonly-text-content ck-content"><div class="content"><div class="ck-content"><figure class="table"><table><thead><tr><th>Directory</th><th>Description</th></tr></thead><tbody><tr><td>`/certs`</td><td>Needed to share certificates between containers for Self Signed variants</td></tr></tbody></table>

</figure></div></div></div></div></div></div></div></div></div></div></div>#### jitsi-meet

<div class="component" id="bkmrk-directory-descriptio-3"><div class="component"><div class="component"><div class="component split-note-container-widget"><div class="component note-split type-text mime-text-html"><div class="component scrolling-container"><div class="note-detail component"><div class="note-detail-readonly-text note-detail-printable component"><div class="note-detail-readonly-text-content ck-content"><div class="content"><div class="ck-content"><figure class="table"><table><thead><tr><th>Directory</th><th>Description</th></tr></thead><tbody><tr><td>`/assets/jitsi-meet`</td><td>Put your custom config.js/interfaceConfig.js in here and it will be added on bootup</td></tr></tbody></table>

</figure></div></div></div></div></div></div></div></div></div></div></div>### Environment Variables

Below is the complete list of available options that can be used to customize your installation.

#### jitsi-prosody

<div class="component" id="bkmrk-parameter-descriptio"><div class="component"><div class="component"><div class="component split-note-container-widget"><div class="component note-split type-text mime-text-html"><div class="component scrolling-container"><div class="note-detail component"><div class="note-detail-readonly-text note-detail-printable component"><div class="note-detail-readonly-text-content ck-content"><div class="content"><div class="ck-content"><figure class="table"><table><thead><tr><th>Parameter</th><th>Description</th></tr></thead><tbody><tr><td>`HOST`</td><td>Hostname of your server e.g. `meet.example.com` Should be same as all other hostnames</td></tr><tr><td>`JITSI_VIDEO_PASS`</td><td>Jitsi Video Bridge Secret e.g. `secret3`</td></tr><tr><td>`JICOFO_PASS`</td><td>Jitsi Conference Focus Secret e.g. `secret2`</td></tr><tr><td>`JICOFO_USER_PASS`</td><td>Jitsi Conference Focus User Secret e.g. `secret1`</td></tr></tbody></table>

</figure></div></div></div></div></div></div></div></div></div></div></div>#### jitsi-videobridge

<div class="component" id="bkmrk-parameter-descriptio-1"><div class="component"><div class="component"><div class="component split-note-container-widget"><div class="component note-split type-text mime-text-html"><div class="component scrolling-container"><div class="note-detail component"><div class="note-detail-readonly-text note-detail-printable component"><div class="note-detail-readonly-text-content ck-content"><div class="content"><div class="ck-content"><figure class="table"><table><thead><tr><th>Parameter</th><th>Description</th></tr></thead><tbody><tr><td>`HOST`</td><td>Hostname of your server e.g. `meet.example.com` Should be same as all other hostnames</td></tr><tr><td>`PROSODY_HOST`</td><td>Container Name of your prosody server e.g. `prosody`</td></tr><tr><td>`JITSI_VIDEO_PASS`</td><td>Jitsi Video Bridge Secret e.g. `secret3`</td></tr><tr><td>`NETWORK_MODE`</td><td>Network Mode `NAT` or `HOST` - Defaults to `NAT`</td></tr></tbody></table>

</figure></div></div></div></div></div></div></div></div></div></div></div>#### jitsi-jicofo

<div class="component" id="bkmrk-parameter-descriptio-2"><div class="component"><div class="component"><div class="component split-note-container-widget"><div class="component note-split type-text mime-text-html"><div class="component scrolling-container"><div class="note-detail component"><div class="note-detail-readonly-text note-detail-printable component"><div class="note-detail-readonly-text-content ck-content"><div class="content"><div class="ck-content"><figure class="table"><table><thead><tr><th>Parameter</th><th>Description</th></tr></thead><tbody><tr><td>`HOST`</td><td>Hostname of your server e.g. `meet.example.com` Should be same as all other hostnames</td></tr><tr><td>`PROSODY_HOST`</td><td>Container Name of your prosody server e.g. `prosody`</td></tr><tr><td>`JICOFO_PASS`</td><td>Jitsi Conference Focus Secret e.g. `secret2`</td></tr><tr><td>`JICOFO_USER_PASS`</td><td>Jitsi Conference Focus User Secret e.g. `secret1`</td></tr></tbody></table>

</figure></div></div></div></div></div></div></div></div></div></div></div>#### jitsi-meet

<div class="component" id="bkmrk-parameter-descriptio-3"><div class="component"><div class="component"><div class="component split-note-container-widget"><div class="component note-split type-text mime-text-html"><div class="component scrolling-container"><div class="note-detail component"><div class="note-detail-readonly-text note-detail-printable component"><div class="note-detail-readonly-text-content ck-content"><div class="content"><div class="ck-content"><figure class="table"><table><thead><tr><th>Parameter</th><th>Description</th></tr></thead><tbody><tr><td>`PROSODY_HOST`</td><td>Container Name of your prosody server e.g. `prosody`</td></tr></tbody></table>

</figure></div></div></div></div></div></div></div></div></div></div></div>### Networking

This set of images relies on network ports being exposed to the outside world. 80, 443 for the initial web proxy (which should already be handled by the `jwilder/nginx-proxy` image) and then you must open port `4443` and `10000-10100/udp` to the outside world otherwise you *will* have issues with video or audio.

See below diagram:

```text-plain
                           80, 443
               +----------------------------+   |      |
               |                            |   |      |
               | Nginx-Proxy w/ Letsecnrypt |   |      |
               |                            |   |      |
               +----------------------------+   |      |
                   +                            |      |
                   |                            |      |
                   |                            |      |
                   |                            |      |
                   |                            |      |
                   v                            |      |
                  80                            |      |
               +-------+                        |      |
               |       |                        |      |
               | Jitsi |                        |      |
               | Meet  |                        |      |
               +--+-+--+                        |      |
                  | |                           |      |
+------------+    | |    +--------------+       |      |
|            |    | |    |              |       |      |
| jitsi-meet +<---+ +--->+ prosody      |       |      |
|            |files 5280 |              |       |      |
+------------+           +--------------+       v      v
                     5222,5347^    ^5347      4443, 10000-10100
                +--------+    |    |    +-------------+
                |        |    |    |    |             |
                | jicofo +----^    ^----+ videobridge |
                |        |              |             |
                +--------+              +-------------+

```

The following ports are exposed.

#### jitsi-prosody

<div class="component" id="bkmrk-port-description-522"><div class="component"><div class="component"><div class="component split-note-container-widget"><div class="component note-split type-text mime-text-html"><div class="component scrolling-container"><div class="note-detail component"><div class="note-detail-readonly-text note-detail-printable component"><div class="note-detail-readonly-text-content ck-content"><div class="content"><div class="ck-content"><figure class="table"><table><thead><tr><th>Port</th><th>Description</th></tr></thead><tbody><tr><td>`5222`</td><td>Prosody Clent Listening Port</td></tr><tr><td>`5280`</td><td>Prosody Server Listening Port</td></tr><tr><td>`5347`</td><td>Prosody Components</td></tr></tbody></table>

</figure></div></div></div></div></div></div></div></div></div></div></div>#### jitsi-videobridge

<div class="component" id="bkmrk-port-description-443"><div class="component"><div class="component"><div class="component split-note-container-widget"><div class="component note-split type-text mime-text-html"><div class="component scrolling-container"><div class="note-detail component"><div class="note-detail-readonly-text note-detail-printable component"><div class="note-detail-readonly-text-content ck-content"><div class="content"><div class="ck-content"><figure class="table"><table><thead><tr><th>Port</th><th>Description</th></tr></thead><tbody><tr><td>`443`</td><td>Jitsi Video Bridge Harvester Port</td></tr><tr><td>`5347`</td><td>Prosody Components</td></tr><tr><td>`4443`</td><td>Jitsi Video Bridge Harvester Port</td></tr><tr><td>`10000-20000/udp`</td><td>Web RTC / ICE</td></tr></tbody></table>

</figure></div></div></div></div></div></div></div></div></div></div></div>#### jitsi-jicofo

<div class="component" id="bkmrk-port-description-522-1"><div class="component"><div class="component"><div class="component split-note-container-widget"><div class="component note-split type-text mime-text-html"><div class="component scrolling-container"><div class="note-detail component"><div class="note-detail-readonly-text note-detail-printable component"><div class="note-detail-readonly-text-content ck-content"><div class="content"><div class="ck-content"><figure class="table"><table><thead><tr><th>Port</th><th>Description</th></tr></thead><tbody><tr><td>`5222`</td><td>Prosody Client Port</td></tr><tr><td>`5347`</td><td>Prosody Components</td></tr></tbody></table>

</figure></div></div></div></div></div></div></div></div></div></div></div>#### jitsi-meet

<div class="component" id="bkmrk-port-description-80-"><div class="component"><div class="component"><div class="component split-note-container-widget"><div class="component note-split type-text mime-text-html"><div class="component scrolling-container"><div class="note-detail component"><div class="note-detail-readonly-text note-detail-printable component"><div class="note-detail-readonly-text-content ck-content"><div class="content"><div class="ck-content"><figure class="table"><table><thead><tr><th>Port</th><th>Description</th></tr></thead><tbody><tr><td>`80`</td><td>Nginx Listening Port</td></tr><tr><td>`5280`</td><td>Prosody Server Listening Port</td></tr></tbody></table>

</figure></div></div></div></div></div></div></div></div></div></div></div>Maintenance

#### Shell Access

For debugging and maintenance purposes you may want access the containers shell.

docker exec -it (whatever your container name is e.g. jitsi-meet) bash

References

<div class="component" id="bkmrk-https%3A%2F%2Fgithub.com%2Fj"><div class="component"><div class="component"><div class="component split-note-container-widget"><div class="component note-split type-text mime-text-html"><div class="component scrolling-container"><div class="note-detail component"><div class="note-detail-readonly-text note-detail-printable component"><div class="note-detail-readonly-text-content ck-content"><div class="content"><div class="ck-content">- [https://github.com/jitsi/jitsi-meet/blob/master/doc/manual-install.md](https://github.com/jitsi/jitsi-meet/blob/master/doc/manual-install.md)

</div></div></div></div></div></div></div></div></div></div></div><div class="component" id="bkmrk--1"><div class="component"><div class="component" id="bkmrk--2"><div class="card widget component"><div class="body-wrapper" id="bkmrk--3"><div class="card-body"></div></div></div></div></div></div>

# How to Install Docker and Docker Compose on Debian 11

## Prerequisites

- A server running Debian 11.
- A root password is configured on the server.

## Getting Started

First, it is recommended to update your system package cache to the latest version. You can update them using the following command:

```bash
apt-get update -y
```

Once you are done, install other required dependencies using the following command:

```bash
apt-get install apt-transport-https software-properties-common ca-certificates curl gnupg lsb-release -y
```

## Install Docker

By default, the latest version of Docker is not included in the Debian 11 official repository. So you will need to add the Docker CE repository to the APT. You can add it using the following command:

```
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -<br></br>add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
```

Once the Docker repository is added, update the repository and install the Docker CE with the following command:

```bash
apt-get update -y
apt-get install docker-ce docker-ce-cli -y
```

After the installation, verify the Docker CE version using the following command:

```
docker version
```

You should get the following output:

```
Client: Docker Engine - Community
 Version:           20.10.8
 API version:       1.41
 Go version:        go1.16.6
 Git commit:        3967b7d
 Built:             Fri Jul 30 19:54:22 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.8
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.6
  Git commit:       75249d8
  Built:            Fri Jul 30 19:52:31 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.9
  GitCommit:        e25210fe30a0a703442421b0f60afac609f950a3
 runc:
  Version:          1.0.1
  GitCommit:        v1.0.1-0-g4144b63
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
```

## Manage Docker Services

You can manage the Docker service easily using the systemd utility.

To start a Docker service, run the following command:

```
systemctl start docker
```

To restart a Docker service, run the following command:

```
systemctl restart docker
```

To stop a Docker service, run the following command:

```
systemctl stop docker
```

To enable the Docker service to start at system reboot, run the following command:

```
systemctl enable docker
```

To check the Docker status, run the following command:

```
systemctl status docker
```

You should see the status of Docker in the following output:

```
? docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2021-09-10 07:19:35 UTC; 27s ago
TriggeredBy: ? docker.socket
       Docs: https://docs.docker.com
   Main PID: 29018 (dockerd)
      Tasks: 7
     Memory: 32.6M
        CPU: 407ms
     CGroup: /system.slice/docker.service
             ??29018 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Sep 10 07:19:34 debian11 dockerd[29018]: time="2021-09-10T07:19:34.809035575Z" level=info msg="scheme \"unix\" not registered, fallback to def>
Sep 10 07:19:34 debian11 dockerd[29018]: time="2021-09-10T07:19:34.809219999Z" level=info msg="ccResolverWrapper: sending update to cc: {[{uni>
Sep 10 07:19:34 debian11 dockerd[29018]: time="2021-09-10T07:19:34.809410545Z" level=info msg="ClientConn switching balancer to \"pick_first\">
Sep 10 07:19:34 debian11 dockerd[29018]: time="2021-09-10T07:19:34.897972507Z" level=info msg="Loading containers: start."
Sep 10 07:19:35 debian11 dockerd[29018]: time="2021-09-10T07:19:35.186940748Z" level=info msg="Default bridge (docker0) is assigned with an IP>
Sep 10 07:19:35 debian11 dockerd[29018]: time="2021-09-10T07:19:35.298681937Z" level=info msg="Loading containers: done."
Sep 10 07:19:35 debian11 dockerd[29018]: time="2021-09-10T07:19:35.356364773Z" level=info msg="Docker daemon" commit=75249d8 graphdriver(s)=ov>
Sep 10 07:19:35 debian11 dockerd[29018]: time="2021-09-10T07:19:35.357524464Z" level=info msg="Daemon has completed initialization"
Sep 10 07:19:35 debian11 systemd[1]: Started Docker Application Container Engine.
Sep 10 07:19:35 debian11 dockerd[29018]: time="2021-09-10T07:19:35.401626151Z" level=info msg="API listen on /run/docker.sock"
```

## Run a Container Using Docker

You can use the **docker run** command to download any image and run it inside the container.

For example, run the following command to download Debian image and run a container:

```
docker run --rm -it --name test debian:latest /bin/sh
```

You should get the following output:

```
Unable to find image 'debian:latest' locally
latest: Pulling from library/debian
955615a668ce: Pull complete 
Digest: sha256:08db48d59c0a91afb802ebafc921be3154e200c452e4d0b19634b426b03e0e25
Status: Downloaded newer image for debian:latest
#
```

Run the following command to exit from the Debian container

```
#exit
```

## Install Docker Compose

Although you can install Docker Compose from the official Debian repositories, it is several minor versions behind the latest release, so in this tutorial you’ll install it from Docker’s GitHub repository. The command that follows is slightly different than the one you’ll find on the [Releases](https://github.com/docker/compose/releases) page. By using the `-o` flag to specify the output file first rather than redirecting the output, this syntax avoids running into a “permission denied” error caused when using `sudo`.

Check the [current release](https://github.com/docker/compose/releases) and, if necessary, update it in the command that follows:

<div class="code-label" id="bkmrk-" title="">  
</div>```bash
sudo curl -L https://github.com/docker/compose/releases/download/1.25.3/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
```

<div class="code-toolbar" id="bkmrk-copy"><div class="toolbar"><div class="toolbar-item"></div></div></div>Next we’ll set the permissions:

```bash
sudo chmod +x /usr/local/bin/docker-compose
```

<div class="code-toolbar" id="bkmrk-copy-1"><div class="toolbar"><div class="toolbar-item"></div></div></div>Then we’ll verify that the installation was successful by checking the version:

```bash
docker-compose --version
```

<div class="code-toolbar" id="bkmrk-copy-2"><div class="toolbar"><div class="toolbar-item"></div></div></div>This will print out the version we installed:

You should see the following output:

```
docker-compose version 1.29.2, build 5becea4c
docker-py version: 5.0.0
CPython version: 3.7.10
OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019
```

## Docker Compose Commands

To run a Docker compose file, run the following command:

```
docker-compose up -d
```

To stop all running containers, run the following command:

```
docker-compose down
```

To pause and unpause the running container, run the following command:

```
docker-compose pause<br></br>docker-compose unpause
```

To list all running containers, run the following command:

```
docker-compose ps
```

To check the logs of running services, run the following command:

```
docker-compose logs
```

# Installing Docker and Docker Compose on Debian 12

Before installing Docker, ensure your Debian system is up-to-date with the following command:

```sh
sudo apt update && sudo apt upgrade -y
```

<span style="color:rgb(187,187,187);background-color:rgba(224,224,224,0.2);">Shell</span>

Once your system is updated, install the necessary packages to allow apt to use a repository over HTTPS:

```sh
sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg2 -y
```

<span style="color:rgb(187,187,187);background-color:rgba(224,224,224,0.2);">Shell</span>

Next, add the official GPG key of Docker:

```sh
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
```

<span style="color:rgb(187,187,187);background-color:rgba(224,224,224,0.2);">Shell</span>

Add the Docker repository to APT sources:

```sh
echo "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list
```

<span style="color:rgb(187,187,187);background-color:rgba(224,224,224,0.2);">Shell</span>

Update your package index and install Docker CE (Community Edition):

```sh
sudo apt update && sudo apt install docker-ce -y
```

<span style="color:rgb(187,187,187);background-color:rgba(224,224,224,0.2);">Shell</span>

To ensure Docker starts on boot, use the following command:

```sh
sudo systemctl enable docker
```

<span style="color:rgb(187,187,187);background-color:rgba(224,224,224,0.2);">Shell</span>

Verify the Docker installation by running the hello-world image:

```sh
sudo docker run hello-world
```

<span style="color:rgb(187,187,187);background-color:rgba(224,224,224,0.2);">Shell</span>

## Installing Docker Compose on Debian 12

Docker Compose is a tool for defining and running multi-container Docker applications. To install Docker Compose, first, download the latest version from the official GitHub repository:

```sh
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
```

<span style="color:rgb(187,187,187);background-color:rgba(224,224,224,0.2);">Shell</span>

Next, set the appropriate permissions to make the binary executable:

```sh
sudo chmod +x /usr/local/bin/docker-compose
```

<span style="color:rgb(187,187,187);background-color:rgba(224,224,224,0.2);">Shell</span>

Verify the installation by checking the version of Docker Compose:

```sh
docker-compose --version
```

<span style="color:rgb(187,187,187);background-color:rgba(224,224,224,0.2);">Shell</span>

At this point, Docker and Docker Compose are installed and ready for use on your Debian 12 system.

# 🐋Docker / Docker Compose + Dockge Setup Guide (Debian 12 Bookworm)

### Prerequisites

- Debian Bookworm
- Root or sudo privileges
- Internet access

---

### 1. 🔄 Update the System

```bash
apt update && apt upgrade -y
```

---

### 2. 📦 Install Dependencies

```bash
apt install apt-transport-https ca-certificates curl software-properties-common gnupg2 -y
```

---

### 3. 🔑 Add Docker GPG Key and Repository

> **Note:**<span style="white-space:pre-wrap;"> </span>`<span class="editor-theme-code">apt-key</span>`<span style="white-space:pre-wrap;"> is deprecated. A better method is to store the key in </span>`<span class="editor-theme-code">/etc/apt/keyrings/</span>`, but this follows the legacy method used in the original steps.

```bash
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
echo "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list
```

---

### 4. 🐳 Install Docker Engine + Compose Plugin

```bash
apt update && apt install docker-ce -y
```

This installs:

- Docker Engine
- Docker CLI
- Docker Compose plugin (`<span class="editor-theme-code">docker compose</span>`)
- <span style="white-space:pre-wrap;">Supporting packages like </span>`<span class="editor-theme-code">containerd.io</span>`<span style="white-space:pre-wrap;">, </span>`<span class="editor-theme-code">iptables</span>`, etc.

---

### 5. 🚀 Enable Docker on Boot

```bash
systemctl enable docker
```

---

### <span style="white-space:pre-wrap;">6. 🧱 (Optional) Install Legacy </span>`<span class="editor-theme-code">docker-compose</span>`<span style="white-space:pre-wrap;"> Binary</span>

```bash
curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version
```

---

### 7. 📁 Set Up Dockge (Docker Container Manager)

```bash
mkdir -p /opt/stacks /opt/dockge
cd /opt/dockge
curl https://raw.githubusercontent.com/louislam/dockge/master/compose.yaml --output compose.yaml
docker compose up -d
```

This:

- Creates project directories
- <span style="white-space:pre-wrap;">Downloads the </span>`<span class="editor-theme-code">compose.yaml</span>`<span style="white-space:pre-wrap;"> for Dockge</span>
- Deploys Dockge using Docker Compose

<span style="white-space:pre-wrap;">Once running, Dockge will be available via Docker (check </span>`<span class="editor-theme-code">docker ps</span>`<span style="white-space:pre-wrap;"> for ports).</span>

---

### ✅ Result

- Docker installed and running
- Docker Compose (v1 and plugin) available
- <span style="white-space:pre-wrap;">Dockge deployed and managing stacks under </span>`<span class="editor-theme-code">/opt/stacks</span>`

---

### 💡 Notes

- <span style="white-space:pre-wrap;">If </span>`<span class="editor-theme-code">apt-key</span>`<span style="white-space:pre-wrap;"> shows a deprecation warning, consider migrating the key to </span>`<span class="editor-theme-code">/etc/apt/keyrings/docker.gpg</span>`<span style="white-space:pre-wrap;"> and referencing that path in the </span>`<span class="editor-theme-code">.list</span>`<span style="white-space:pre-wrap;"> file.</span>
- <span style="white-space:pre-wrap;">Dockge stores stacks in </span>`<span class="editor-theme-code">/opt/stacks</span>`. You can start new apps here using Dockge's web UI.
- <span style="white-space:pre-wrap;">Port for Dockge is defined in the </span>`<span class="editor-theme-code">compose.yaml</span>`.

# UrBackup Server & Client Installation Guide

### <span style="white-space:pre-wrap;">1. </span>**Prerequisites**

- <span style="white-space:pre-wrap;">You're operating as </span>**root**<span style="white-space:pre-wrap;">—no need for </span>`<span class="editor-theme-code">sudo</span>`<span style="white-space:pre-wrap;"> (and it may not even be installed).</span>
- <span style="white-space:pre-wrap;">On Linux, use filesystems </span>**EXT4**<span style="white-space:pre-wrap;"> or </span>**XFS**<span style="white-space:pre-wrap;"> (necessary for image downloads)</span>
- <span style="white-space:pre-wrap;">Have at least </span>**1–2 GB free**<span style="white-space:pre-wrap;"> in </span>`<span class="editor-theme-code">/tmp</span>`<span style="white-space:pre-wrap;"> (default unpacking site).</span>

---

### <span style="white-space:pre-wrap;">2. </span>**Install UrBackup Server (Debian/Ubuntu-based)**

```bash
# Update base packages
apt update
apt install curl gnupg2 software-properties-common
```

#### Option A: PPA method

```bash
add-apt-repository ppa:uroni/urbackup
apt update
apt install urbackup-server
```

#### Option B: Direct .deb download

```bash
wget https://hndl.urbackup.org/Server/2.5.33/urbackup-server_2.5.33_amd64.deb
dpkg -i urbackup-server_2.5.33_amd64.deb
apt install -f   # fix missing dependencies
```

> <span style="white-space:pre-wrap;">You’ll be prompted to choose a backup directory—e.g., </span>`<span class="editor-theme-code">/media/backup/urbackup</span>`

---

### <span style="white-space:pre-wrap;">3. </span>**Enable &amp; Verify Service**

```bash
systemctl enable urbackupsrv
systemctl start urbackupsrv
systemctl status urbackupsrv
ss -antpl | grep -E "5541[34]"
```

- <span style="white-space:pre-wrap;">Ports: </span>**55413**<span style="white-space:pre-wrap;"> (FastCGI), </span>**55414**<span style="white-space:pre-wrap;"> (HTTP) </span>

---

### <span style="white-space:pre-wrap;">4. </span>**Access Web Interface**

<span style="white-space:pre-wrap;">Open your browser to </span>`<span class="editor-theme-code">http://<server-ip>:55414</span>`.

1. <span style="white-space:pre-wrap;">Go to </span>**Settings → Users**<span style="white-space:pre-wrap;">, create an </span>**admin account**<span style="white-space:pre-wrap;"> to secure the web UI</span>
2. <span style="white-space:pre-wrap;">Tweak general settings like backup retention, temporary path, etc., via </span>`<span class="editor-theme-code">/etc/default/urbackupsrv</span>`<span style="white-space:pre-wrap;"> or the UI</span>

---

### <span style="white-space:pre-wrap;">5. </span>**Install UrBackup Client (Linux)**

On the client machine (as root):

```bash
TF=$(mktemp)
wget "https://hndl.urbackup.org/Client/2.5.25/UrBackup%20Client%20Linux%202.5.25.sh" -O "$TF"
sh "$TF"
rm -f "$TF"
```

- <span style="white-space:pre-wrap;">You’ll be asked to choose a </span>**snapshot mechanism**:
    - **LVM**<span style="white-space:pre-wrap;">, </span>**datto**<span style="white-space:pre-wrap;">, or </span>**none**<span style="white-space:pre-wrap;"> (bare-metal backup needs LVM or root snapshot).</span>

---

### <span style="white-space:pre-wrap;">6. </span>**Register &amp; Configure Client**

<span style="white-space:pre-wrap;">Back on the </span>**server web UI**:

1. <span style="white-space:pre-wrap;">Click </span>**“Add new client”**, choose network or internet type.
2. Copy the install command and run it on the client (as above).

On the client, add directories to back up:

```bash
urbackupclientctl add-backupdir -d /path/to/important
```

Repeat for all directories you want to include

### <span style="white-space:pre-wrap;">7. </span>**Monitor &amp; Manage Backups**

- <span style="white-space:pre-wrap;">Use </span>**Status**<span style="white-space:pre-wrap;">, </span>**Backups**<span style="white-space:pre-wrap;">, and </span>**Activities**<span style="white-space:pre-wrap;"> tabs to check client status and jobs</span>
- **Delete old backups**<span style="white-space:pre-wrap;"> manually in the UI or run </span>`<span class="editor-theme-code">urbackupsrv cleanup</span>`<span style="white-space:pre-wrap;"> on the server for automated cleanup </span>

### <span style="white-space:pre-wrap;">8. </span>**Uninstall Client**<span style="white-space:pre-wrap;"> (if needed)</span>

```bash
uninstall_urbackupclient
```

---

## **Why UrBackup?**

- Simple web interface
- <span style="white-space:pre-wrap;">Supports </span>**file-level + image backups**<span style="white-space:pre-wrap;"> while live</span>
- <span style="white-space:pre-wrap;">Efficient </span>**deduplication**<span style="white-space:pre-wrap;"> – minimizes storage use during repeated backups </span>
- Works across Linux, Windows, FreeBSD

---

### **Quick Tips**

- <span style="white-space:pre-wrap;">As root, </span>**drop `<strong class="editor-theme-bold editor-theme-code">sudo</strong>`.**
- <span style="white-space:pre-wrap;">Choose </span>**EXT4**<span style="white-space:pre-wrap;"> or </span>**XFS**<span style="white-space:pre-wrap;"> on servers for image backup support.</span>
- <span style="white-space:pre-wrap;">Pick the right </span>**snapshot mode**<span style="white-space:pre-wrap;"> on clients: LVM or none.</span>
- <span style="white-space:pre-wrap;">Always protect your </span>**web UI**<span style="white-space:pre-wrap;"> with an admin account.</span>
- <span style="white-space:pre-wrap;">Monitor </span>**ports 55413/55414**<span style="white-space:pre-wrap;"> and ensure they're reachable.</span>

# 🧷 Mounting an External USB Hard Drive on Debian

# 🧷 Mounting an External USB Hard Drive on Debian

## 📋 Overview

<span style="white-space:pre-wrap;">This guide outlines how to properly identify, mount, and persistently configure an external USB hard drive on a Debian-based system. It is particularly useful for setups involving backup containers like </span>`<span class="editor-theme-code">urbackup</span>`<span style="white-space:pre-wrap;"> or media/file storage solutions.</span>

---

## 🔍 Step 1: Identify the USB Drive

```
lsblk
```

<span style="white-space:pre-wrap;">Look for a device (e.g., </span>`<span class="editor-theme-code">/dev/sdb1</span>`) with the expected size and no mount point.

```
sudo blkid /dev/sdb1
```

This confirms the filesystem type and gets the UUID (used for persistent mounting).

---

## 💾 Step 2: Install Required NTFS Support

If the drive is formatted as NTFS (common for Windows drives), install the NTFS driver:

```
sudo apt update
sudo apt install ntfs-3g
```

**Note:**<span style="white-space:pre-wrap;"> Do </span><u>not</u><span style="white-space:pre-wrap;"> install </span>`<span class="editor-theme-code">fuse</span>`<span style="white-space:pre-wrap;"> on Debian 12 (Bookworm); it conflicts with </span>`<span class="editor-theme-code">fuse3</span>`.

---

## 📁 Step 3: Create a Mount Point

```
sudo mkdir -p /mnt/usbbackup
```

---

## 📝 Step 4: Configure /etc/fstab

Edit the fstab file to auto-mount the drive at boot:

```
sudo nano /etc/fstab
```

<span style="white-space:pre-wrap;">Add this line (replace UUID with yours from </span>`<span class="editor-theme-code">blkid</span>`):

```
UUID=5E74F4D874F4B43D  /mnt/usbbackup  ntfs-3g  defaults,noatime,nofail,uid=1001,gid=1001,umask=0022,allow_other  0  2
```

<table id="bkmrk-optiondescriptionntf"><colgroup><col></col><col></col></colgroup><tbody><tr><th>Option

</th><th>Description

</th></tr><tr><td>`<span class="editor-theme-code">ntfs-3g</span>`

</td><td>NTFS filesystem driver with write support

</td></tr><tr><td>`<span class="editor-theme-code">noatime</span>`

</td><td>Improves performance by disabling access-time updates

</td></tr><tr><td>`<span class="editor-theme-code">nofail</span>`

</td><td>Allows boot to continue if the drive is missing

</td></tr><tr><td>`<span class="editor-theme-code">uid/gid</span>`

</td><td>Sets ownership for consistent Docker access

</td></tr><tr><td>`<span class="editor-theme-code">umask=0022</span>`

</td><td><span style="white-space:pre-wrap;">Applies </span>

`<span class="editor-theme-code">rwxr-xr-x</span>`

<span style="white-space:pre-wrap;"> permissions</span>

</td></tr><tr><td>`<span class="editor-theme-code">allow_other</span>`

</td><td>Permits non-root users to access the mount

</td></tr></tbody></table>

---

## 🧪 Step 5: Mount and Verify

```
sudo systemctl daemon-reexec
sudo mount -a
```

Check if it mounted successfully:

```
df -h | grep usbbackup
```

Confirm correct permissions:

```
ls -ld /mnt/usbbackup
```

---

## ✅ Example Output

```
/dev/sdb1 on /mnt/usbbackup type fuseblk (rw,nosuid,nodev,noatime,allow_other,blksize=4096)
```

---

## 🛠️ Troubleshooting

- **Wrong filesystem type?**  
    <span style="white-space:pre-wrap;">Make sure you used </span>`<span class="editor-theme-code">ntfs-3g</span>`<span style="white-space:pre-wrap;"> and not </span>`<span class="editor-theme-code">ext4</span>`<span style="white-space:pre-wrap;"> in your fstab line.</span>
- **"Bad superblock" or mount error?**  
    <span style="white-space:pre-wrap;">Use </span>`<span class="editor-theme-code">dmesg | tail -30</span>`<span style="white-space:pre-wrap;"> to check for detailed kernel messages.</span>
- **Permissions issue in Docker?**  
    Ensure the Docker container’s UID/GID matches the mount options.

---

## 📦 Related

- <span style="white-space:pre-wrap;">To mount an </span>`<span class="editor-theme-code">ext4</span>`<span style="white-space:pre-wrap;"> drive, change </span>`<span class="editor-theme-code">ntfs-3g</span>`<span style="white-space:pre-wrap;"> to </span>`<span class="editor-theme-code">ext4</span>`<span style="white-space:pre-wrap;"> and remove </span>`<span class="editor-theme-code">uid/gid/umask</span>`<span style="white-space:pre-wrap;"> options.</span>
- To temporarily mount a USB without fstab:  
    ```
    sudo mount -t ntfs-3g /dev/sdb1 /mnt/usbbackup
    ```