recettes/Homelab/Installer serveur Linux.md
gribse ecdfa2f7c4 Squashed 'temp-repo/' content from commit 6688605
git-subtree-dir: temp-repo
git-subtree-split: 6688605ad41f49d1eccead8d29421c658cad0100
2025-10-06 19:14:58 +02:00

298 lines
No EOL
6.3 KiB
Markdown
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
type: ressource
date: 2025-02-18T10:25
maturity: graine
---
```
sudo apt install btop
sudo ubuntu-drivers autoinstall
```
# Installing ZSH
## Zsh
```sh
sudo apt install git fonts-font-awesome
sudo apt install zsh
chsh -s $(which zsh)
echo $SHELL
```
[Installing ZSH · ohmyzsh/ohmyzsh Wiki · GitHub](https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH)
## Oh-my-zsh
### Install
```sh
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
```
### Plugins
```sh
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
nvim ~/.zshrc
```
add :
```.zshrc
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
```
### Themes
```sh
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
nvim ~/.zshrc
```
```
ZSH_THEME="`powerlevel10k/powerlevel10k`"
```
redémarrer zsh et suivre la configuration de powerlever10k
Source : [Install and Setup ZSH on Ubuntu Linux](https://itsfoss.com/zsh-ubuntu/)
# Docker and Docker Compose
## Install Prerequisite Packages
Install the necessary packages to allow apt to use a repository over HTTPS.
```bash
sudo apt update && sudo apt upgrade
sudo apt install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common \
gnupg
```
## Add Dockers Official GPG Key
Add Dockers official GPG key to your system to ensure the authenticity of the packages.
```bash
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
```
## Set Up the Docker Repository
Add the Docker repository to APT sources.
```bash
echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
```
## Install Docker
Update the package index again and install Docker.
```bash
sudo apt install docker-ce docker-ce-cli containerd.io
```
## Verify Docker Installation
Check if Docker is installed correctly by running the `hello-world` image.
```bash
sudo docker run hello-world
```
## Install Docker Compose
Download the current stable release of Docker Compose.
```bash
DOCKER_COMPOSE_VERSION=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep -Po '"tag_name": "\K.*\d')
sudo curl -L "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
```
## Apply Executable Permissions to the Docker Compose Binary
Make the Docker Compose binary executable.
```bash
sudo chmod +x /usr/local/bin/docker-compose
```
## Verify Docker Compose Installation
Check the version of Docker Compose to verify the installation.
```bash
docker-compose --version
```
## Create docker group
1. Add your user to the `docker` group:
```bash
sudo usermod -aG docker $USER
```
2. Log out and log back in, or use the `newgrp` command:
```bash
newgrp docker
```
3. Verify that your user is now part of the `docker` group:
```bash
groups
```
You should see `docker` listed in the output.
4. Try running the Docker Compose command again:
```bash
docker compose up traefik
```
If you still encounter issues, ensure that the Docker daemon is running and accessible:
```bash
sudo systemctl status docker
```
## Create docker networks
To create the external networks `web` and `internal`, you need to manually create them using the Docker CLI before running your `docker-compose` command. Here are the steps:
5. Create the `web` network:
```bash
docker network create web
```
6. Create the `internal` network:
```bash
docker network create internal
```
After creating these networks, you can run your `docker-compose` command without encountering errors related to missing networks.
```bash
docker compose up traefik
```
# Mount remote directories
SSHFS :
```sh
sudo sshfs -o IdentityFile=~/.ssh/id_rsa -o allow_other -o reconnect gribse@217.128.128.22:/media/md0 /mnt/nestor-v3
```
NFS / CIFS :
```sh
sudo mount -t cifs //192.168.1.68/gribse -w -o username=gribse,password="a8t*wN3gx&akd0%tNjrdGtL4c0jy75kL",uid=gribse /mnt/TNAS
```
To ensure that these directories are mounted at startup, you can add entries to the fstab file. Here are the steps:
```sh
sudo nano /etc/fstab
```
2. **Add the SSHFS entry**:
Add the following line to mount the SSHFS directory at startup:
```plaintext
gribse@217.128.128.22:/media/md0 /mnt/nestor-v3 fuse.sshfs IdentityFile=/home/gribse/.ssh/id_rsa,allow_other,reconnect 0 0
```
3. **Add the CIFS entry**:
Add the following line to mount the CIFS directory at startup:
```plaintext
//192.168.1.68/gribse /mnt/TNAS cifs username=gribse,password=a8t*wN3gx&akd0%tNjrdGtL4c0jy75kL,uid=gribse 0 0
```
4. **Save and exit**:
Save the changes and exit the text editor (in nano, press `Ctrl+X`, then `Y`, and `Enter`).
5. **Test the fstab entries**:
Test the new entries by running:
```bash
sudo mount -a
```
### Example
fstab
file:
```
# <file system> <mount point> <type> <options> <dump> <pass>
gribse@217.128.128.22:/media/md0 /mnt/nestor-v3 fuse.sshfs IdentityFile=/home/gribse/.ssh/id_rsa,allow_other,reconnect 0 0
//192.168.1.68/gribse /mnt/TNAS cifs username=gribse,password=a8t*wN3gx&akd0%tNjrdGtL4c0jy75kL,uid=gribse 0 0
```
This will ensure that the SSHFS and CIFS directories are mounted automatically at startup.
# Installing Immich
## Transfer data
- [ ] is tsdata needed ?
- [ ] is pgdata needed ?
- [ ] import library
- [ ] ftp
- [ ]
- [ ] choose storage tempate
- [ ] spécifier uplads/library différent de iploads/thumbs, etc ? pour economiser bande passante et unsiquement stoquer els images sur TNAS
## Configure
- [ ] Rewrite `compose.yml` : [Fetching Title#wk4c](https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml)
- cf [Docker Compose \[Recommended\] | Immich](https://immich.app/docs/install/docker-compose/)
- [ ] rewrite env
- [ ] move env
## Deploy
- [ ] stop immich
- [ ] rsync v3 -> v4
- [ ] move env
- [ ] move pgdata
- [ ] move tsdata
- [ ] start local immich
- [ ] stats prometheus ?