Migrate OpenVZ VPS to KVM VPS

The guides you will find on Google won’t work. At least not with Debian. Unless you know what to exclude.

The easiest way, is to copy the config files you need to the new VPS, I used rsync. Then make a file with everything that is installed. Then create a bash script to install everything in the installed file.

To get the installed packages:


dpkg --get-selections | grep -w 'install$' > installed

To install them:


#!/bin/bash
for package in `cat installed | grep -w 'install$' | cut -f 1`; do
apt-get install -y $package;
done

There’s probably a better & faster way. Like putting all the packages in one apt-get command.

That works with Debian.