Post

Proxmox vm105 Debian 13 + Jekyll Chirpy

Proxmox vm105 Debian 13 + Jekyll Chirpy

Proxmox VM Debian

Site communautaire https://community-scripts.org/

Procédure installation debian13

1
2
sudo -s
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/vm/debian-13-vm.sh)"

A la fin de la création

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
    ____       __    _                ________
   / __ \___  / /_  (_)___ _____     <  /__  /
  / / / / _ \/ __ \/ / __ `/ __ \    / / /_ <
 / /_/ /  __/ /_/ / / /_/ / / / /   / /___/ /
/_____/\___/_.___/_/\__,_/_/ /_/   /_//____/
                                              (Trixie)
  ⚙️  Using Default Settings
  🆔  Virtual Machine ID: 105
  📦  Machine Type: i440fx
  💾  Disk Size: 8G
  💾  Disk Cache: None
  🏠  Hostname: debian
  🖥️  CPU Model: KVM64
  🧠  CPU Cores: 2
  🛠️  RAM Size: 2048
  🌉  Bridge: vmbr0
  🔗  MAC Address: 02:23:30:A9:80:CD
  🏷️  VLAN: Default
  ⚙️  Interface MTU Size: Default
  ☁️  Cloud-Init: no
  🌐  Start VM when completed: yes
  🚀  Creating a Debian 13 VM using the above default settings
  ✔️  Using local-lvm for Storage Location.
  ✔️  Virtual Machine ID is 105.
  ✔️  Installed libguestfs-tools
  ✔️  https://cloud.debian.org/images/cloud/trixie/latest/debian-13-nocloud-amd64.qcow2
  ✔️  Downloaded debian-13-nocloud-amd64.qcow2
  ✔️  Customized image
  ✔️  Created a Debian 13 VM (debian)
  ✔️  Started Debian 13 VM
  ✔️  Completed successfully!

More Info at https://github.com/community-scripts/ProxmoxVE/discussions/836

Proxmox, ouvrir la console de la vm 105

Mise à jour debian

1
apt update && apt upgrade

Créer un utilisateur

1
adduser debjek  # mp debjek49

Droits

1
2
# droits root
echo "debjek ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/10-userx

Les outils

1
apt install openssh-server fdisk cloud-guest-utils rsync tmux

Réseau

Quel réseau est installé

1
systemctl list-unit-files | grep -Ei 'networkmanager|systemd-networkd|ifupdown|networking'

systemd-network est installé

1
2
systemctl is-active systemd-networkd
systemctl status systemd-networkd --no-pager

Configuration statique pour systemd-networkd avec IP 192.168.0.220 et DNS 192.168.0.205

Trouver le nom de l’interface

1
networkctl # ens18

Ton interface ens18 est config via un fichier en runtime : /run/systemd/network/10-netplan-all-en.network (donc ton fichier /etc/systemd/network/20-lan.network n’est pas celui qui s’applique).

Ajouter une config statique dans netplan

1
ls -l /etc/netplan/

Puis édite le fichier YAML, par ex :

1
sudo nano /etc/netplan/*.yaml

Mets (remplace les noms si besoin) :

1
2
3
4
5
6
7
8
9
10
11
12
nnetwork:
  version: 2
  renderer: networkd
  ethernets:
    ens18:
      dhcp4: no
      addresses: [192.168.0.229/24]
      nameservers:
        addresses: [192.168.0.205]
      routes:
        - to: default
          via: 192.168.0.254

Appliquer

1
2
sudo netplan apply
sudo systemctl restart systemd-networkd

Vérifier

1
2
3
ip addr show ens18
ip route | grep default
resolvectl status ens18

SSH + Clés

A-Sur le poste appelant
Générer un jeu de clé

1
ssh-keygen -t ed25519 -o -a 100 -f ~/.ssh/vm-105

Envoyer la clé publique sur le container lxc

1
ssh-copy-id -i ~/.ssh/vm-105.pub debjek@192.168.0.229

B-Sur le distant

1
2
echo 'Port = 55229
PasswordAuthentication no' | sudo tee /etc/ssh/sshd_config.d/10-user.conf

C-Sur le poste appelant
Lancer la connexion SSH avec clé

1
ssh -p 55229 -i ~/.ssh/vm-105 debjek@192.168.0.229

Motd

1
rm -f /etc/motd && nano /etc/motd

Contenu motd

1
2
3
4
5
6
7
8
9
10
11
12
13
  ___                                               _   __   ___ 
 | _ \ _ _  ___ __ __ _ __   ___ __ __ __ __ _ __  / | /  \ | __|
 |  _/| '_|/ _ \\ \ /| '  \ / _ \\ \ / \ V /| '  \ | || () ||__ \
 |_|  |_|  \___//_\_\|_|_|_|\___//_\_\  \_/ |_|_|_||_| \__/ |___/
    _       _          _  _       _          _    _              
   (_) ___ | |__ _  _ | || |  ___| |_  __ _ | |_ (_) __          
   | |/ -_)| / /| || || || | (_-<|  _|/ _` ||  _|| |/ _|         
  _/ |\___||_\_\ \_, ||_||_| /__/ \__|\__,_| \__||_|\__|         
 |__/            |__/                                            
  _  ___  ___     _   __  ___     __     ___  ___  ___           
 / |/ _ \|_  )   / | / / ( _ )   /  \   |_  )|_  )/ _ \          
 | |\_, / / /  _ | |/ _ \/ _ \ _| () |_  / /  / / \_, /          
 |_| /_/ /___|(_)|_|\___/\___/(_)\__/(_)/___|/___| /_/           

NFS

Installer client NFS

1
sudo apt install nfs-common # debian

Créer le dossier

1
2
sudo mkdir -p /sharenfs
sudo chown $USER:$USER /sharenfs

Modifier le fichier /etc/fstab

1
192.168.0.205:/sharenfs /sharenfs nfs nofail,x-systemd.automount,x-systemd.device-timeout=10s 0 0

Recharger

1
2
sudo systemctl daemon-reload
sudo mount -a

node

Installer NodeJs via nvm

1
2
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
source ~/.bashrc

Installer node LTS

1
nvm install --lts

Versions installée node -v && npm -v

1
2
v24.18.0
11.16.0

🧪 Jekyll

Installation jekyll sur debian

1
2
3
4
5
6
sudo apt install ruby-full build-essential zlib1g-dev -y
echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc
echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc
echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
gem install jekyll bundler

jekyll-theme-chirpy

Générateur site statique (ruby+jekyll) Installer git et imagemagick

1
sudo apt install git imagemagick

Sur le home

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
cd ~
git clone https://github.com/cotes2020/jekyll-theme-chirpy.git chirpy
# initialiser le dépôt
cd ~/chirpy
bash tools/init.sh
#
cd assets/img/favicons/
magick web-app-manifest-512x512.png -resize 16x16 favicon-16x16.png
magick web-app-manifest-512x512.png -resize 32x32 favicon-32x32.png
magick web-app-manifest-512x512.png -resize 150x150 mstile-150x150.png
magick web-app-manifest-512x512.png -resize 192x192 android-chrome-512x512.png
cp web-app-manifest-512x512.png android-chrome-512x512.png
# A partir d'un fichier svg
# mv -f xxxxxx.svg favicon.svg
# svg choisi est renommé favicon.svg
magick input.jpg -resize WIDTHxHEIGHT output.jpg
#
magick favicon.svg -resize 512x512 android-chrome-512x512.png
magick favicon.svg -resize 512x512 web-app-manifest-512x512.png
magick favicon.svg -resize 16x16 favicon-16x16.png
magick favicon.svg -resize 32x32 favicon-32x32.png
magick favicon.svg -resize 150x150 mstile-150x150.png
magick favicon.svg -resize 180x180 apple-touch-icon.png
magick favicon.svg -resize 192x192 android-chrome-512x512.png
magick favicon.svg favicon.ico
magick favicon.svg -resize 192x192 android-chrome-192x192.png
magick favicon.svg -resize 96x96 favicon-96x96.png

Retour racine

1
cd ~/chirpy

Modifier configuration _config.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# The Site Configuration

# Import the theme
theme: jekyll-theme-chirpy

# The language of the webpage › http://www.lingoes.net/en/translator/langcode.htm
# If it has the same name as one of the files in folder `_data/locales`, the layout language wi>
# otherwise, the layout language will use the default value of 'en'.
lang: fr-FR

# Change to your timezone › https://zones.arilyn.cc
timezone: Europe/Paris

# jekyll-seo-tag settings › https://github.com/jekyll/jekyll-seo-tag/blob/master/docs/usage.md
# ↓ --------------------------

title: Chirpy DEV # the main title

social:
  # Change to your full name.
  # It will be displayed as the default author of the posts and the copyright owner in the Foot>
  name: jek
  email: jek@cinay.eu # change to your email address

theme_mode: dark # [light | dark]

Si Gemfile.lock existe, le supprimer et lancer

1
bundle

Info jekyll:

1
bundle info jekyll
1
2
3
4
5
6
7
8
9
10
11
12
13
  * jekyll (4.4.1)
	Summary: A simple, blog aware, static site generator.
	Homepage: https://jekyllrb.com
	Source Code: https://github.com/jekyll/jekyll
	Changelog: https://github.com/jekyll/jekyll/releases
	Bug Tracker: https://github.com/jekyll/jekyll/issues
	Path: /home/debjek/gems/gems/jekyll-4.4.1
	Reverse Dependencies: 
		jekyll-archives (2.3.0) depends on jekyll (>= 3.6, < 5.0)
		jekyll-include-cache (0.2.1) depends on jekyll (>= 3.7, < 5.0)
		jekyll-seo-tag (2.9.0) depends on jekyll (>= 3.8, < 5.0)
		jekyll-sitemap (1.4.0) depends on jekyll (>= 3.7, < 5.0)
		jekyll-theme-chirpy (7.6.0) depends on jekyll (~> 4.3)

Création des liens avec les dossiers files, images et _posts pour le générateur de site

1
2
3
4
5
# Supprimer le dossier _posts par défaut
rm -rf _posts
ln -s /sharenfs/media/statique/images $HOME/chirpy/images
ln -s /sharenfs/media/statique/files $HOME/chirpy/files
ln -s /sharenfs/media/statique/_posts $HOME/chirpy/_posts

Vérification

1
2
3
4
ls -l |grep ^l
lrwxrwxrwx   1 debjek debjek     31 Jun 26 11:52 _posts -> /sharenfs/media/statique/_posts
lrwxrwxrwx   1 debjek debjek     30 Jun 26 11:52 files -> /sharenfs/media/statique/files
lrwxrwxrwx   1 debjek debjek     31 Jun 26 11:52 images -> /sharenfs/media/statique/images

Générer _site (défaut)

Par défaut jekyll build génère le dossier _site

A-Option build

Construction du dossier _site

1
2
cd ~/chirpy
jekyll build

B-Option serveur

1
2
cd ~/chirpy
jekyll serve

C-Option build sur /sharenfs

1
jekyll build --destination /sharenfs/rnmkcy/chirpy

On utilise pour cela la commande bundle pour que la version de jekyll utilisée ainsi que celle des dépendances soient bien celles décrites dans les fichiers Gemfile et Gemfile.lock et ne dépendent pas de l’environnement de la machine.

Le serveur est lancé

1
2
3
4
5
6
7
8
9
10
Configuration file: /home/jek/jekyll-theme-chirpy/_config.yml
 Theme Config file: /home/jek/jekyll-theme-chirpy/_config.yml
            Source: /home/jek/jekyll-theme-chirpy
       Destination: /home/jek/jekyll-theme-chirpy/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
                    done in 59.712 seconds.
 Auto-regeneration: enabled for '/home/jek/jekyll-theme-chirpy'
    Server address: http://127.0.0.1:4000/
  Server running... press ctrl-c to stop.

Accès redirection

Depuis un terminal du desktop PC ou Laptop
Accès à la page par une redirection, lancer la commande depuis un terminal du réseau

1
2
# avec fichier clé
ssh -L 9500:localhost:4000 debjek@192.168.0.229 -p 55229 -i /home/yann/.ssh/vm-105

Navigateur local: http://localhost:9500

Générer chirpy.rnmkcy.eu

Fichier de configuration /etc/nginx/conf.d/chirpy.rnmkcy.eu.conf sur le serveur cwwk debian 23

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
server {
    listen 443 ssl;
    listen [::]:443 ssl;
    http2 on;
    server_name chirpy.rnmkcy.eu;

    include /etc/nginx/conf.d/ssl-modern.inc;
    root /sharenfs/rnmkcy/chirpy/;
#
  # Headers de sécurité au niveau server
  include /etc/nginx/snippets/security-headers.conf;

  # Cache des assets statiques
  location ~* \.(jpg|jpeg|png|gif|ico|css|js|woff|woff2|ttf|svg|webp|avif)$ {
    expires 1y;
    add_header Cache-Control "public, immutable";
    # OBLIGATOIRE : ré-inclure les headers ici !
    include /etc/nginx/snippets/security-headers.conf;
  }

  location ~* \.html$ {
    expires 1h;
    add_header Cache-Control "public, must-revalidate";
    include /etc/nginx/snippets/security-headers.conf;
  }
#
    location / {
      index index.html;
    }
}

Les options : jekyll build --help

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
jekyll build -- Build your site

Usage:

  jekyll build [options]

Options:
            --config CONFIG_FILE[,CONFIG_FILE2,...]  Custom configuration file
        -d, --destination DESTINATION  The current folder will be generated into DESTINATION
        -s, --source SOURCE  Custom source directory
            --future       Publishes posts with a future date
            --limit_posts MAX_POSTS  Limits the number of posts to parse and publish
        -w, --[no-]watch   Watch for changes and rebuild
        -b, --baseurl URL  Serve the website from the given base URL
            --force_polling  Force watch to use polling
            --lsi          Use LSI for improved related posts
        -D, --drafts       Render posts in the _drafts folder
            --unpublished  Render posts that were marked as unpublished
            --disable-disk-cache  Disable caching to disk in non-safe mode
        -q, --quiet        Silence output.
        -V, --verbose      Print verbose output.
        -I, --incremental  Enable incremental rebuild.
            --strict_front_matter  Fail if errors are present in front matter
        -s, --source [DIR]  Source directory (defaults to ./)
        -d, --destination [DIR]  Destination directory (defaults to ./_site)
            --safe         Safe mode (defaults to false)
        -p, --plugins PLUGINS_DIR1[,PLUGINS_DIR2[,...]]  Plugins directory (defaults to ./_plugins)
            --layouts DIR  Layouts directory (defaults to ./_layouts)
            --profile      Generate a Liquid rendering profile
        -h, --help         Show this message
        -v, --version      Print the name and version
        -t, --trace        Show the full backtrace when an error occurs

Le dossier statique du site: /sharenfs/rnmkcy/chirpy/, construction

1
jekyll build -d /sharenfs/rnmkcy/chirpy

Créer le dossier systemd utilisateur

1
mkdir -p ~/.config/systemd/user

pour un service user qui écrit dans un montage NFS, le point clé est d’attendre que le partage NFS soit monté avant de lancer Jekyll. Ajouter l’environnement (PATH/GEM_HOME/GEM_PATH) que systemd user n’a pas.

Crée un fichier ~/.config/systemd/user/chirpy.service :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
[Unit]
Description=Jekyll site for Chirpy (static build)
After=network-online.target sharenfs.mount
Wants=network-online.target sharenfs.mount

[Service]
Type=simple
WorkingDirectory=%h/chirpy
Environment="PATH=/home/debjek/gems/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Environment="GEM_HOME=/home/debjek/gems"
Environment="GEM_PATH=/home/debjek/gems"
ExecStart=/home/debjek/gems/bin/jekyll build --incremental --watch --destination /sharenfs/rnmkcy/chirpy
Restart=always
RestartSec=5

# Optionnel mais souvent utile avec NFS :
ExecStartPre=/bin/sh -c 'for i in $(seq 1 60); do mountpoint -q /sharenfs && exit 0; sleep 1; done; exit 1'

[Install]
WantedBy=default.target

Active et démarre le service (pour le user courant) :

1
2
systemctl --user daemon-reload
systemctl --user enable --now chirpy.service

Vérifie :

1
2
systemctl --user status chirpy.service
journalctl --user -u chirpy.service -f

Activer le démarrage des services systemd user même après fermeture de session, pour l’utilisateur $USER.

1
sudo loginctl enable-linger $USER
Cet article est sous licence CC BY 4.0 par l'auteur.