Skip to content

Search is only available in production builds. Try building and previewing the site to test it out locally.

Migration LXC to VM

Voici les informations à renseigner lors de la création de la nouvelle VM (First Installation) :

  • OS : Ubuntu Server 24.04
  • Proxy : renseignez le proxy de votre entreprise si vous en avez un
  • New username : administrateur (sera supprimé à la fin)
  • Mot de passe : mettre un mot de passe temporaire
  • Installer OpenSSH Server
  • Dans les features serveur : ne rien cocher

Une fois la VM démarrée, connectez-vous avec le compte administrateur puis passez en root :

  1. Connectez-vous avec le compte administrateur

  2. Faites un sudo su pour obtenir un shell root

  3. Changez le mot de passe du compte root :

    Terminal window
    passwd
  4. Déconnectez-vous de tous les comptes puis reconnectez-vous avec root

  5. Supprimez le compte administrateur une fois la connexion root établie :

    Terminal window
    deluser administrateur

Ajoutez le proxy d’entreprise dans le .bashrc, on en aura besoin pour l’installation des packages :

Terminal window
PROXY_URL="http://<IP>:<PORT>/"
export http_proxy="$PROXY_URL"
export https_proxy="$PROXY_URL"

Faites une mise à jour du système :

Terminal window
apt update
apt upgrade -y

Installez les paquets suivants :

Terminal window
apt install ncdu gparted fping nmap fd-find

Installez le nouveau bashrc ci-dessous dans /etc/bash.bashrc. Avant cela, faites une sauvegarde du fichier :

Terminal window
cp /etc/bash.bashrc /etc/bash.bashrc_$(date --iso-8601=seconds)

Remplacez le contenu de /etc/bash.bashrc par celui du fichier bash.bashrc fourni.

Sur la nouvelle machine, installez le dépôt (mirror) GitLab :

Terminal window
curl --location "https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh" | bash

Faites une sauvegarde à cette étape, avant de continuer la migration.

Allez sur le GitLab à migrer et regardez la version affichée sur la page https://<FQDN>/help

Ensuite, installez la bonne version sur la nouvelle machine :

Terminal window
apt-get install gitlab-ee=<VERSION>-ee.0

Exemple : gitlab-ee=18.11.7-ee.0

Sur l’ancien GitLab (la LXC), arrêtez les services puis créez la sauvegarde :

Terminal window
gitlab-ctl stop puma
gitlab-ctl stop sidekiq
gitlab-backup create STRATEGY=copy

Transférez les données vers la nouvelle machine :

Terminal window
scp /etc/gitlab/gitlab-secrets.json root@NEW_IP:/etc/gitlab/gitlab-secrets.json
scp /etc/gitlab/gitlab.rb root@NEW_IP:/etc/gitlab/gitlab.rb
scp /etc/gitlab/ssl/ root@NEW_IP:/etc/gitlab/ssl/
scp /etc/ssh/ssh_host_* root@NEW_IP:/etc/ssh/ssh_host_*
scp /var/opt/gitlab/backups/* root@NEW_IP:/var/opt/gitlab/backups/

Par précaution, bloquez la mise à jour de GitLab et appliquez les bons droits avant le reconfigure :

Terminal window
apt-mark hold gitlab-ee
chown root:root /etc/gitlab/gitlab*.{rb,json}
chmod 600 /etc/gitlab/gitlab-secrets.json
gitlab-ctl reconfigure
gitlab-ctl status

Ajoutez les bons droits aux fichiers de sauvegarde :

Terminal window
chown git:git /var/opt/gitlab/backups/*.tar
chmod 600 /var/opt/gitlab/backups/*.tar

Stoppez les services avant de restaurer les sauvegardes :

Terminal window
gitlab-ctl stop puma
gitlab-ctl stop sidekiq
gitlab-ctl status

Puis restaurez la sauvegarde :

Terminal window
gitlab-backup restore

Enfin, terminez par :

Terminal window
gitlab-ctl reconfigure
gitlab-ctl restart
gitlab-rake gitlab:check SANITIZE=true
gitlab-rake gitlab:doctor:secrets
gitlab-rake cache:clear