Last active
April 7, 2025 23:03
-
-
Save exaland/7b2bfcf33dd1eb5659bb45f9f5a41dae to your computer and use it in GitHub Desktop.
Update Ubuntu 18.04 to 22.04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
echo "==> Étape 0 : Mise à jour actuelle de Ubuntu" | |
sudo apt update && sudo apt upgrade -y && sudo apt dist-upgrade -y | |
sudo apt autoremove --purge -y | |
sudo apt install update-manager-core -y | |
echo "==> Étape 1 : Passage de Ubuntu 18.04 vers 20.04" | |
echo ">>> On va maintenant migrer vers Ubuntu 20.04 LTS..." | |
read -p "Appuie sur [Entrée] pour continuer ou Ctrl+C pour annuler" | |
sudo do-release-upgrade -f DistUpgradeViewNonInteractive | |
echo ">>> Redémarre ton serveur maintenant (sudo reboot) puis relance ce script avec l'argument --step2" | |
exit 0 | |
if [[ "$1" != "--step2" ]]; then | |
echo "Lance ce script avec l'option --step2 après avoir redémarré depuis 20.04" | |
exit 1 | |
fi | |
echo "==> Étape 2 : Mise à jour vers Ubuntu 22.04" | |
sudo apt update && sudo apt upgrade -y && sudo apt dist-upgrade -y | |
sudo apt autoremove --purge -y | |
echo ">>> Migration vers Ubuntu 22.04 LTS..." | |
read -p "Appuie sur [Entrée] pour lancer la mise à jour finale" | |
sudo do-release-upgrade -f DistUpgradeViewNonInteractive | |
echo ">>> Migration terminée ! Pense à redémarrer : sudo reboot" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment