You will have to follow the following steps :
1. Prepare an “empty” VPS Hosting. For OpenVZ which mean the following (assume you choose VE ID of 123):
Quote:
mkdir /vz/root/123 /vz/private/123
cat /etc/vz/conf/ve-VPS Hosting.basic.conf-sample > /etc/vz/conf/123.conf
|
2. Stop most services on a machine to be migrated. “Most” means services such as web server, databases and the like — so you will not loose your data. Just leave the bare minimum (including ssh).
3. Copy all your data from the machine to an OpenVZ box. Say you will be utilizing VE with ID of 123, then all the data should be placed to /vz/private/123/ directory (so there will be directories such as /vz/private/123/bin, etc, var and so on). This could be done by scp or rsync.
4. Set some VE parameters. You have to add OSTEMPLATE=xxx line to /etc/vz/conf/123.conf file, where xxx would be distribution name (like debian-3.0) for vzctl to be capable to make changes specific for this distribution.
Also, you have to supply an IP for a new VE:
Quote:
|
vzctl set 123 --ipadd x.x.x.x --save
|
5. You have to edit some files inside a VE. For example, virtual server doesn't have real ttys, so you have to disable getty in /etc/inittab (i. e. /vz/private/123/etc/inittab). Also, link /etc/mtab to /proc/mounts.
Quote:
sed -i -e '/getty/d' /vz/private/123/etc/inittab
rm -f /vz/private/123/etc/mtab
ln -s /proc/mounts /vz/private/123/etc/mtab
|
There might be other adjustments needed.
6. Try to start your new VE: