Page 1 of 2

How to move accounts from one (my)Vesta server to another myVesta server

Posted: Sat Jul 25, 2020 10:15 pm
by myVesta
This tutorial is general manual for both situations:
  • moving sites from old Vesta server to new myVesta server
  • moving sites from one myVesta server to another myVesta server

Here we go:
  • On your old (my)Vesta server, in SSH, as root, run:

    Code: Select all

    export ALLOW_BACKUP_ANYTIME='yes'
    nice -n 19 ionice -c 3 v-backup-users
    or if you want to migrate only specific account, then:

    Code: Select all

    export ALLOW_BACKUP_ANYTIME='yes'
    nice -n 19 ionice -c 3 v-backup-user UsernameOfAccount
  • Copy files from /backup to some remote server, or to your computer
  • Install myVesta on new server if it's not already installed
  • Create /backup folder on new myVesta server (if it's not already created)
  • Now copy your generated backup files from remote server (or from your computer) to /backup folder on new myVesta server
  • On new myVesta server, in SSH, as root, run:

    Code: Select all

    nice -n 19 ionice -c 3 v-restore-user UsernameOfAccount UsernameOfAccount.2020-06-20_01-10-02.tar
    (of course use proper username and filename that exists)

Normally, after restoring backups, your imported domains will have DNS that contains NS1, NS2 and IP of the original (old) server.
If it differs from the server you importing backup, you can do in SSH, as root:

Code: Select all

v-normalize-restored-user YOUR_USERNAME
and that command will automatically put NS1, NS2 and IP of your current server.


Advice: don't kill old server before you bring everything on new.
Or, if it's cloud, please make snapshot of old server before you kill it.

We saw the situations where people got corruptred backups because there was no free space on old server to make full backup.
They didn't noticed that (they didn't check /usr/local/vesta/log/backup.log) and killed server with thinking that everything is in backup files.
They had supprise when they tried to restore them on new server :(

Re: How to move accounts from one myVesta server to another myVesta server

Posted: Tue Jun 22, 2021 2:58 pm
by colifato
Thank you for accepting the forum registration.
I have a query .. in the case of migrating from HestiaCP to myVesta, the steps to follow would be the same as from Vesta to myVesta?
From already thank you very much.

Re: How to move accounts from one myVesta server to another myVesta server

Posted: Tue Jun 22, 2021 3:03 pm
by myVesta
colifato wrote: Tue Jun 22, 2021 2:58 pm Thank you for accepting the forum registration.
I have a query .. in the case of migrating from HestiaCP to myVesta, the steps to follow would be the same as from Vesta to myVesta?
From already thank you very much.
I'm afraid Hestia modified backup format.
You can try to import, anyway, maybe old stuff is on the same place in backups...give it a try :|

Re: How to move accounts from one (my)Vesta server to another myVesta server

Posted: Wed Aug 24, 2022 12:03 am
by Amadex
v-normalize-restored-user was not working for me, it replaced new ip with guess what... new ip again. :roll:

So I have added manually my old IP to the script and it worked:


#!/bin/bash

# info:
# Normalize NS1, NS2 and IP of account that is backuped on other server and restored on this server.
# After restoring, user will have DNS that contains NS1, NS2 and IP from original server
# This script will put NS1, NS2 and IP of current server

# options: user

#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#

whoami=$(whoami)
if [ "$whoami" != "root" ] && [ "$whoami" != "admin" ] ; then
echo "You must be root or admin to execute this script";
exit 1;
fi


# Argument definition
user=$1

# Includes
source $VESTA/func/main.sh


#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#

check_args '1' "$#" 'USER'
is_format_valid 'user'
is_object_valid 'user' 'USER' "$user"

#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#

source $VESTA/data/packages/default.pkg

arrNS=(${NS//,/ })
NEWNS1=${arrNS[0]}
NEWNS2=${arrNS[1]}

for domain in $(/usr/local/vesta/bin/v-list-web-domains $user plain |cut -f 1); do
if [ -f "/usr/local/vesta/data/users/$user/dns/$domain.conf" ]; then
NEWIPV4=$(/usr/local/vesta/bin/v-list-dns-domain "$user" "$domain" | grep 'IP:' | awk '{print $2}')
res=$(grep "'www'" /usr/local/vesta/data/users/$user/dns/$domain.conf)
eval $res
OLDIPV4=$VALUE OLDIPV4=123.45.67.89
fi
if [ ! -z "$NEWIPV4" ] && [ ! -z "$OLDIPV4" ]; then
break;
fi
done


source /usr/local/vesta/data/users/$user/user.conf
arrNS=(${NS//,/ })
OLDNS1=${arrNS[0]}
OLDNS2=${arrNS[1]}

echo "user = $user"
echo "old ns1 = $OLDNS1"
echo "old ns2 = $OLDNS2"
echo "new ns1 = $NEWNS1"
echo "new ns2 = $NEWNS2"
echo "old ip = $OLDIPV4"
echo "new ip = $NEWIPV4"

find /home/$user/conf/dns/ -type f -exec sed -i "s#$OLDIPV4#$NEWIPV4#g" {} \;
find /home/$user/conf/dns/ -type f -exec sed -i "s#$OLDNS1#$NEWNS1#g" {} \;
find /home/$user/conf/dns/ -type f -exec sed -i "s#$OLDNS2#$NEWNS2#g" {} \;
find /usr/local/vesta/data/users/$user/dns/ -type f -exec sed -i "s#$OLDIPV4#$NEWIPV4#g" {} \;
find /usr/local/vesta/data/users/$user/dns/ -type f -exec sed -i "s#$OLDNS1#$NEWNS1#g" {} \;
find /usr/local/vesta/data/users/$user/dns/ -type f -exec sed -i "s#$OLDNS2#$NEWNS2#g" {} \;
sed -i "s#$OLDIPV4#$NEWIPV4#g" /usr/local/vesta/data/users/$user/dns.conf
sed -i "s#$OLDNS1#$NEWNS1#g" /usr/local/vesta/data/users/$user/dns.conf
sed -i "s#$OLDNS1#$NEWNS1#g" /usr/local/vesta/data/users/$user/user.conf
sed -i "s#$OLDNS2#$NEWNS2#g" /usr/local/vesta/data/users/$user/user.conf
systemctl reload bind9

echo "Done!"

# Logging
log_event "$OK" "$ARGUMENTS"

exit

Re: How to move accounts from one (my)Vesta server to another myVesta server

Posted: Fri Sep 23, 2022 11:47 pm
by webxtek
Hey mate, any solution for this?
oldns.png
oldns.png (30.96 KiB)
Afer moving the backup from server A to B (both running myvesta), and after running the script you talk about in this thread to replace all ip and dns values, i still keep seeing my old dns there, everything is working fine but its showing the old dns there

Re: How to move accounts from one (my)Vesta server to another myVesta server

Posted: Tue Oct 18, 2022 10:34 am
by halinh
I would be very grateful if there is a video tutorial.

Thank you !

Re: How to move accounts from one (my)Vesta server to another myVesta server

Posted: Tue Dec 20, 2022 11:02 pm
by kjernekrafttrikk
I advice to not so experienced admins (like me) to be careful with their backup files. Transfer them via rsync better, because FTP-transferred file was interpreted as corrupted from the very start.

Re: How to move accounts from one (my)Vesta server to another myVesta server

Posted: Thu Feb 01, 2024 9:10 pm
by Jpsciolli
Hello I am migrating an old vesta to a new server and when I use the v-normalize-restored-user I receive this:
-bash: v-normalize-restored-user: command not found

Is there a path to the command?
thanks

JPS

Re: How to move accounts from one (my)Vesta server to another myVesta server

Posted: Thu Feb 01, 2024 11:29 pm
by bonya
Jpsciolli wrote: Thu Feb 01, 2024 9:10 pm Hello I am migrating an old vesta to a new server and when I use the v-normalize-restored-user I receive this:
-bash: v-normalize-restored-user: command not found

Is there a path to the command?
thanks

JPS
Hi,
you should run this command under root
or (under sudo user)

Code: Select all

/usr/local/vesta/bin/v-normalize-restored-user

Re: How to move accounts from one (my)Vesta server to another myVesta server

Posted: Mon Jun 24, 2024 7:27 am
by Hockeywain
Hello greetings I have a problem running vestacp on my Linux machine I get this error message


package yum has no installation candidate