Migrate to new server

Discussion in 'Installation/Configuration' started by ikrudolf, Jul 26, 2012.

  1. ikrudolf

    ikrudolf Member

    My server needs to be upgraded to Ubuntu 12.
    What are the right steps to "easily" migrate to the new server?
    (db's, data, mail, ispconfig etc)
     
  2. ikrudolf

    ikrudolf Member

    Pffff as a linux noob this is some job.....

    For example on the old server I want to copy /var folder (using scp) to the new server keeping file permissions. I tried to copy them but access is denied because only root can copy these files?

    I used
    Is this command correct?

    How can I get root access to the new server to be able to copy the files to the new server?
     
  3. falko

    falko Super Moderator ISPConfig Developer

    On Ubuntu, you must enable the root account by setting a root password:

    Code:
    sudo passwd root
     
  4. ikrudolf

    ikrudolf Member

    Falko,
    Did it but when trying to connect I get Permission denied.

     
  5. ikrudolf

    ikrudolf Member

    Changed "PermitRootLogin yes" in /etc/ssh/sshd_config and restarted ssh
    and it works now!
     
  6. ikrudolf

    ikrudolf Member

    2nd question.

    I want to copy the files from the old server to the new server. How should I do this? I want to keep the permissions and owners like it is on the old server.
     
  7. falko

    falko Super Moderator ISPConfig Developer

  8. zbuzanic

    zbuzanic Member

    Hi, I had a need to move twice so first time I've just compressed www and copied on new server with ispconfig and recreated pages. Dunno why but I had troubles with server after doing that. Server would randomly crash. Anyway then I moved to another server but this time I've rsynced almost everything. Problem is I've already installed ispconfig with tutorial and then moved all data. That caused some trouble with cron, mysql, and user accounts but it was all fixable (config files or passwords were wrong) and it's working now without a problem, So rsync worked for me great. Anyway what failed is ssh logins, dunno why but whatever I did, I was unable to login to new server so I had to delete and create again ssh account for all users.
     
  9. ikrudolf

    ikrudolf Member

    There's a saying in Dutch (in my best English translation): I don't see the forrest because of all the trees.
    Untill now it's not clear how to do a "good" migration to a new server. Is it an idea to create a sticky about this?

    *I copied (with rsync) all the data from
    /var/www
    /etc
    /var/log/ispconfig/httpd
    /var/vmail
    /var/lib/mysql
    (databases were not available on new server when I did this, so I dumped the db's on the old server and copied them to the new server with:
    ) For some reason the dbispconfig database was not imported so I imported it by hand via phpmyadmin.

    Do I need to copy more or is this enough??
    Is there anything I missed?
     
    Last edited by a moderator: Nov 29, 2012
  10. ikrudolf

    ikrudolf Member

    Till/Falko,
    Idea to create write a sticky or howto how to backup a server running ispconfig and restoring it to a new server?

    I now try to combine a lot of posts but still not clear what to do and which steps to do.

    Rudolf.
     
    Last edited: Sep 3, 2012
  11. ikrudolf

    ikrudolf Member

    Can somebody make a post explaining all the steps needed to copy all contents from 1 server to another server? (files, db's, changes to ispconfig files eg passwords etc etc)

    Can somebody make a "howto"?
     
  12. till

    till Super Moderator Staff Member ISPConfig Developer

    Here the steps:


    1) Backup the following directories on the old server: /var/www, /var/vmail and /etc, ensure that you preserve permissions e.g. with "tar pczf backupfile.tar.gz /directory/to/backup".
    2) backup all mysql databases.
    3) install ispconfig on the new server.
    4) backup the new dbispconfig database and empty the database afterwards. Then restore the database of the old server.
    5) copy all users and groups of the websites (users are web1, web2, ... , groups are client1, client2, ..., etc.) from the files /etc/passwd, /etc/shadow, /etc/group and /etc/gshadow from the old server to the new server. Copy only the lines of the users and groups, not the whole files! and make a backup of the files before you change them.
    6) restore the contents of /var/vmail and /var/www on the new server.
    7) restore the databases of the clients
    8) Login to ispconfig, go to tools > resync, check all checkboxes and click on start and wait a few minutes to let ispconfig write missing config files.
     
  13. ikrudolf

    ikrudolf Member

    Thank you soo much Till, will try this asap!
     
  14. Appie Thrasher

    Appie Thrasher Member HowtoForge Supporter

    Till Thanks for that, going to try it just yet again...
     
  15. ikrudolf

    ikrudolf Member

    I rsynced /etc from the old to the new server.
    But I think I should not have done that. Server is not reachable and I can't reboot anymore...
     
  16. ikrudolf

    ikrudolf Member

    I have some additional questions.

    1) How to get the backupped files to the new server and how to unpack them?
    Why backup /etc? If you restore on a new server you will get problems?

    2) Should I use
    Code:
    mysqldump --opt --user=root --password=xxxxxxxx --all-databases | gzip > mysql_backup.sql.gz
    to backup db's? How to get this file to new server and how to import them back on the new server?

    Tnx, Rudolf.



     
  17. hellkat

    hellkat New Member

    If anyone's interested I'd be happy to document all the files that are installed/modified by ISPConfig 3.0.5 on Debian, I might be prepared to document for other linux distros aswell if enough people want it.
     
  18. Appie Thrasher

    Appie Thrasher Member HowtoForge Supporter


    Just some extra questions regarding this...
    Here is mentioned to back up ALL mysql databases so with client databases I guess. But in line 7 there is to restore client databases. So now I am guessing to not include the client databases. Must I backup only ISPConfig database in step 2 or indeed all of them?

    What must I do whit this one? or must I use this file to complete step 5.
    So extract it and edit the files from it?

    TIA, think I will need some more help by getting it right but, still am going for it.......
     
  19. hellkat

    hellkat New Member

    You need to back up and restore the all the mysql stuff, unless you want to lose the client databases. I forget if you need to do this for the mysql database itself, but I'm sure till will fill in that blank.

    For step 5, as till said:

    5) copy all users and groups of the websites (users are web1, web2, ... , groups are client1, client2, ..., etc.) from the files /etc/passwd, /etc/shadow, /etc/group and /etc/gshadow from the old server to the new server. Copy only the lines of the users and groups, not the whole files! and make a backup of the files before you change them.

    All the other files will be remade by a) the fresh install of ispconfig and b) the resync.
     
  20. ikrudolf

    ikrudolf Member

    I have some additional questions.

    1) How to get the backupped files to the new server and how to unpack them?
    Please post the correct commands to use.
    (Why backup /etc? If you restore on a new server you will get problems?)

    2) Should I use
    Code:
    mysqldump --opt --user=root --password=xxxxxxxx --all-databases | gzip > mysql_backup.sql.gz
    to backup db's? How to get this file to new server and how to import them back on the new server?

    For me as noob it's not always clear how to get things done...

    Tnx, Rudolf.
     

Share This Page