Docs / Migration Guides / Migrate Ubuntu to Debian or Vice Versa

Migrate Ubuntu to Debian or Vice Versa

By Admin · Mar 15, 2026 · Updated Apr 24, 2026 · 522 views · 2 min read

Understanding the Differences

Ubuntu and Debian share the same package management system (apt/dpkg) and many configuration patterns, but have key differences in default packages, release cycles, and system configuration. Migration typically involves setting up a new server rather than in-place conversion.

Key Differences

FeatureUbuntuDebian
Release cycle6 months (LTS: 2 years)~2 years
Support lengthLTS: 5 years~3 years + LTS
Default initsystemdsystemd
PackagesNewer, more PPAsStable, conservative
Firewallufw (pre-installed)nftables/iptables

Migration Approach: Parallel Setup

# 1. Deploy new server with target OS
# 2. Install equivalent packages
# 3. Transfer configurations
# 4. Transfer data
# 5. DNS cutover

# Export installed packages from source
dpkg --get-selections | grep -v deinstall | awk '{print $1}' > packages.txt

# On destination, install matching packages (skip OS-specific ones)
cat packages.txt | xargs sudo apt install -y 2>&1 | tee install.log

Configuration Transfer

# Key config directories to sync:
rsync -avz root@source:/etc/nginx/ /etc/nginx/
rsync -avz root@source:/etc/php/ /etc/php/
rsync -avz root@source:/etc/mysql/ /etc/mysql/

# Ubuntu-specific adjustments for Debian:
# - Remove PPA repositories (not available on Debian)
# - Replace snap packages with apt or manual installs
# - Adjust firewall (ufw may need installation on Debian)
sudo apt install -y ufw

Data Transfer

# Website files
rsync -avz root@source:/var/www/ /var/www/

# Databases
ssh root@source "mysqldump --all-databases --single-transaction" | mysql

# Home directories
rsync -avz root@source:/home/ /home/

# Cron jobs
ssh root@source "crontab -l" | crontab -

Best Practices

  • Set up new server in parallel, never attempt in-place distribution change
  • Test all services on the new server before DNS cutover
  • Pay attention to PHP version differences between distributions
  • Check that all required packages are available in the target distribution
  • Verify systemd service files are compatible

Was this article helpful?