Migrating to new server [1.1.18]

  • So I have been finding some information in other/older posts but most are for migrating from ispcp or other versions of imscp. What I am looking for is more of a "comprehensive" guide for migrating to a new server (fresh server, no unix users, different ip/hostname). I have seen scattered info about nullifing admin-related fields, but not entirely sure what that means etc...


    For this I would be transferring to a new datacenter, the version of Debian would be different, but the version of imscp would be the same (1.1.18).


    Any help would be greatly appreciated, I may just be over-thinking how to do this, but as this is a production-level system I really do not want to mess up my client login information or their sites.


    So with the help of the following posters and some information from other threads these are the steps I did to migrate to a new server:

    • Setup new server
    • Install i-MSCP on new server
    • Export database from old server
      Code
      1. mysqldump -u root -p --all-databases > alldb.sql
    • Import database on new server
      Code
      1. mysql -u root -p < alldb.sql
    • Copy password for the "debian-sys-maint" user in /etc/mysql/debian.cnf
    • Copy over /var/www/virtual, /var/www/fcgi, and /var/mail from older server
    • Setup database for new user creation
      Code
      1. # mysql -u root -p<password>> use imscp;> update domain set domain_status = 'ok';> update subdomain set subdomain_status = 'ok';> update domain_aliasses set alias_status = 'ok';> update subdomain_alias set subdomain_alias_status = 'ok';> update mail_users set status = 'ok';> update admin set admin_status = 'ok', admin_sys_name = null, admin_sys_uid = 0, admin_sys_gname = null, admin_sys_gid = 0;


    • Replace old ip with the new in imscp-database
    • Update IPs for i-MSCP on new server
      Code
      1. /var/www/imscp/engine/setup/imscp-setup --reconfigure ips
    • Update MySQL for i-MSCP on new server
      Code
      1. /var/www/imscp/engine/setup/imscp-setup --reconfigure sql


  • 1 setup new server
    2 install i-mscp on the new server
    3 export databases from old server and import the databases into new server
    4 copy all files from /var/www/virtual and /var/mail from old server to the new server
    5 on the new server:

    Code
    1. # mysql -u root -p<password>
    2. > use imscp;
    3. > update domain set domain_status = 'ok';
    4. > update subdomain set subdomain_status = 'ok';
    5. > update domain_aliasses set alias_status = 'ok';
    6. > update subdomain_alias set subdomain_alias_status = 'ok';
    7. > update mail_users set status = 'ok';
    8. > update admin set admin_status = 'ok', admin_sys_name = null, admin_sys_uid = 0, admin_sys_gname = null, admin_sys_gid = 0;


    6 replace old ip with the new in imscp-database
    7 run the i-mscp installer again with "-r mysql" as parameter


    that should it be. ;)

  • Thanks for the response, I will give this a go as soon as I am able to connect to my old server for more than 5 seconds :(


    As for "export databases" I have seen some posts talking about migrating over /var/lib/mysql directly, would that be a way to export them all?

  • I would export and import all databases with mysqldump.


    Export (on the old server):


    Code
    1. mysqldump -uroot -p --all-databases > alldb.sql


    Then you need to copy the alldb.sql file to your new server.


    Import (on the new server):


    Code
    1. mysql -u root -p < alldb.sql



    When you import the database, the password of the SQL "debian-sys-maint" user will be changed to the password of the old server. You will need to put into the file "/etc/mysql/debian.cnf" the old password from your old server or change the password of the SQL user back to the password before the import.

  • Thank you FISA4 and MR_LOLKOPF, your information helped me enough to get this completed successfully without any headaches! I have also updated my first post with the exact steps along the way in case someone else needs the same information.