ISPConfig 3 move to another server

Discussion in 'Installation/Configuration' started by rputnins, Dec 8, 2009.

  1. rputnins

    rputnins New Member

    Hello!

    I have searched the forum but no real answer found.
    I have server with > 20 sites running on ISPConfig 3, standart installation on Ubuntu 9.10. I have new server on which I have Ubuntu 9.10 and ISPConfig3, also the standart installation. I want to move the sites, users, settings, clients to new server. What should be the correct procedure?

    I would start with copying over the /var/www folder, export/import mysql db and what next? How to make sure that users will have their accounts/passwords migrated?

    Any suggestions/hints?

    Thank you!
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

  3. rputnins

    rputnins New Member

    Thank you, Till, for the link! I have seen this post but there is no answer how to restore the backup to the new server. Regarding the files it is more or less clear but regarding DB? There will be already the ISPConfig db on the new server, should I drop the tables and then import db from old server?

    I am kinda newbie in Ubuntu world so I would apreciate more precise info.
    Thanks!
     
  4. falko

    falko Super Moderator ISPConfig Developer

  5. pedm

    pedm New Member

    EDIT: This method might not work well please, read the replies.

    Backup entire ispconfig 3 and restore


    I have Ubuntu Server 12, ISPConfig 3, Apache 2, Php5, Bind9, Postfix, Dovecot:

    Backup from old server:
    Code:
    root@server:~# cd /
    
    root@server:/# tar -pczf /tmp/completesystembackup.tar.gz /var/vmail /var/log /var/www /etc/cron.d /etc/apache2 /etc/bind /usr/local/ispconfig/interface/lib /usr/local/ispconfig/server/lib /etc/postfix /etc/dovecot /etc/php5
    
    root@server:/# mysqldump -u root -pXXXXXX --all-databases > /tmp/all-database.sql
    
    XXXXXX - change with your mysql root password.

    Download the file completesystembackup.tar.gz and all-database.sql from your server.

    Restore on new server:
    1. Install everything from scratch :
    http://www.howtoforge.com/perfect-server-ubuntu-12.10-apache2-bind-dovecot-ispconfig-3
    2. Upload completesystembackup.tar.gz and all-database.sql to your system root directory "/"
    3. Follow the code lines:
    Code:
    root@server:~# cd /
    
    root@server:/# tar xvfz completesystembackup.tar.gz
    
    root@server:/# mysql -u root -pXXXXXX < /all-database.sql
    
    XXXXXX - change with your mysql root password.
    4. Reboot at the end.

    If you have inadyn installed don't forget to include /etc/inadyn.conf in your backup.
    Please, if I done something wrong, I accept any advise. Thanks!

    This worked for me. Even the emails where restored.
    Hope this will also work for you.
    Good luck,
    Pedro
     
    Last edited: Mar 21, 2015
  6. skoena

    skoena Member

    Question about the import of the DB's.
    I have a about 50 db's.
    Will it create the db's (with correct passwrods) if you import them like this?

     
  7. kike

    kike New Member

    importing db's

    No. When import you recreate all.
     
  8. tuxfan

    tuxfan New Member

    pedm:
    Just copying the passwd file is not a good idea. First, if you don´t copy the shadow file (that would realy mess up things) - you will have users without shadow entries. Secondary - if the new installation for example has one daemon-user that the old version laks - the daemon-user will bee lost.
     
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    I second that. Plesae copy only the web* users from passwd and shadow and the client* groups from group and gshadow files to the new server instead if including them in the tar file.
     
  10. tuxfan

    tuxfan New Member

    I think theres is ispapps and a ispconfig users and a sshusers group to.



    But what I see as the main problem with this method is the moving of the database.

    If I loose the passwords during the move thats no problem with the normal web-site databases. Those can be changed or is perhaps known.

    But what about those vital for Ispconfig?

    I have on my system users witch i know not the password:
    ispconfig
    ispcsrv2
    ispcsrv3
    etc.

    Can i find them somewhere in clear text or can i change them someway?
     
  11. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes, but they have been added by the ispconfig installer already on the new server. So no need for any manual action.

    You will not loose any passwords. The passwords of the mysql client database can be copied over with phpmyadmin or the mysqkl commandline tool, same with the ispcsrv users and the password of the ispconfig user has been set already by the ispconfig installer on the new server.
     
  12. pawan

    pawan Member

    Migration of ISPCONFIG step by step to new machine (Final) for Ubuntu 12.04

    install ubuntu Desktop AMD64 on new hdd.
    1. install ISPCONFIG using installation guide step by step.
    2. copy /var/www to /var/ using command -
      Code:
      sudo cp -pr souce-location/var/www /var/
    3. copy /etc/apache2 -> /etc/apache2/
    4. copy /etc/group, /etc/group-, /etc/gshadow, /etc/gshadow-, /etc/password/, /etc/password- from old location (before copy rename original folder appeding .orig if something goes wrong e.g. group to group.orig)
    5. copy /etc/bind9 -> /etc/ (rename original bind9 to bind9.orig)
    6. copy old /var/lib/mysql -> /var/lib/ (rename mysql folder to mysql.orig before copy) run command -
      Code:
       sudo chown -R mysql:mysql /var/lib/mysql
    7. copy old /var/vmail -> /var/ using sudo cp -pr sourcelocation/var/vmail to /var/
    8. copy old /usr/local/ispconfig -> /usr/local using cp -pr sourcelocation/usr/local/ispconfig to /usr/local (rename ispconfig to ispconfig.orig before copy)
    9. copy /var/log -> /var/ (skipping to copy this folder may prevent apache to start)
    10. copy old /var/db/ -> /var/ (this folder stores the DKIM keys generated for sending DKIM signed mails.
    11. you may have to install additional apache modules like mod-evasive to make apache run.(if you had modules in old installation, which is not installed by default)
    12. you may have to run the command chown - R postfix:postfix /var/lib/postfix for setting permissions.
    13. you may have to run the command chown - R amavis:amavis /var/lib/amavis


    Other Notes:


    • if you want to copy postfix setting from old installation - just copy files - main.cf, master.cf and body_checks from /etc/postfix/. Do not copy full folder as many files in that folder for example virtual_domain contains password for ispconfig to connect to database.
    • It is assumed that one is using nearly same version (not exactly) of software for example ispconfig, mysql, postfix, dovecot etc.
     
    Last edited: Aug 4, 2013
  13. tuxfan

    tuxfan New Member

    After a successful move (as far as i can se) i might share my experience with this method. I suppose that most people that moves an server will install on a newer version.

    1 Running a ispconfig install prior to installing the backuped data indeed creates the users/groups ispconfig ispaps - but in my case with different UIDs and GIDs - can be fixed with usermod -u 1234 ispconfig /groupmod -g 4321 ispconfig. But keep track of the old UID/GID. Remeber that you cant change UID/GID to an occupied one.

    You might fix this using tar parameters maping users.


    2 The /var/log/ directory that really needs to be copied is /var/log/ispconfig

    3 The MYSQL might not get the right permissions if you dont run a upgrade:

    mysql_upgrade -u root -pXXXXX --force
     
  14. fino

    fino New Member

    After Migration i have this problem

    After this migration i look this problem

    postfix/smtpd[3824]: connect from outrelay08.libero.it[212.52.84.112]
    Jan 6 17:18:02 postfix/proxymap[3828]: warning: mysql:/etc/postfix/mysql-virtual_domains.cf is unavailable. open /etc/postfix/mysql-virtual_domains.cf: Permission denied
    Jan 6 17:18:02 postfix/trivial-rewrite[3866]: warning: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf: table lookup problem
    Jan 6 17:18:02 postfix/trivial-rewrite[3866]: warning: virtual_mailbox_domains lookup failure
    Jan 6 17:18:02 postfix/smtpd[3824]: NOQUEUE: reject: RCPT from outrelay08.libero.it[212.52.84.112]: 451 4.3.0 <[email protected]>: Temporary lookup failure; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<outrelay08.libero.it>
    Jan 6 17:18:02 ODSGsrv1 postfix/smtpd[3824]: disconnect from outrelay08.libero.it[212.52.84.112]

    And

    PHP Fatal error: require_once(): Failed opening required '../lib/config.inc.php' (include_path='.:/usr/share/php:/usr/share/pear') in /usr/local/ispconfig/interface/web/index.php on line 31
     
  15. till

    till Super Moderator Staff Member ISPConfig Developer

    seems as if you missed the first step which is to do a complete and working ispconfig install on the new server which has the same ispconfig version then the old one before you start the migration.
     
  16. Unfaiir

    Unfaiir New Member

    Don't backup the users and groups, just leave those alone. I tried that the first time I migrated and have learned that its better to just create the users within ISPConfig on the new server with exactly the same client IDs and usernames as those on the old server. Then the DB import will do the rest.

    You can use this on the old server to get those values from the command line:
    Code:
    mysql -u USER -pPASS -e "SELECT client_id, company_name, contact_name, username FROM client;" dbispconfig
     
    Last edited: May 7, 2014
  17. otacon

    otacon New Member

    I followed these steps and then used useradd to add my web2, web3, and web5 users. They have the exact same group and user id as the previous server.

    I assume that I am having some sort of permission error, because when I try to go to ispconfig through ssl it is blank.

    /var/log/apache2/error.log:
    Code:
    [Wed Jul 09 16:32:27 2014] [warn] [client 50.195.240.193] mod_fcgid: stderr: PHP Fatal error:  require_once(): Failed opening required '../lib/config.inc.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/ispconfig/index.php on line 31
    I tried to check to see if it existed and I am sure the path ../lib/config.inc.php does not exist.

    Code:
    root@server2:/var/log/apache2# find / -name config.inc.php
    /tmp/ispconfig3_install/interface/lib/config.inc.php
    /etc/phpmyadmin/config.inc.php
    /usr/share/phpmyadmin/setup/frames/config.inc.php
    /usr/local/ispconfig/server/lib/config.inc.php
    /usr/local/ispconfig/interface/lib/config.inc.php
    /usr/local/ispconfig.old/server/lib/config.inc.php
    /usr/local/ispconfig.old/interface/lib/config.inc.php
    /var/lib/phpmyadmin/config.inc.php
    Any suggestions on what can be done or where this file is suppose to be?
     
  18. till

    till Super Moderator Staff Member ISPConfig Developer

    The ISPConfig configuration files are:

    /usr/local/ispconfig/server/lib/config.inc.php
    /usr/local/ispconfig/interface/lib/config.inc.php
     
  19. otacon

    otacon New Member

    Thanks till!

    I copied the /var/www/ispconfig from old server to the new server. However, the /var/www/ispconfig is suppose to be a soft link.

    I solved my issue with the following commands:

    Code:
    root@server2:/var/www# rm -rf ispconfig/
    root@server2:/var/www# ln -s /usr/local/ispconfig/interface/web ispconfig
     
  20. urgensherpa

    urgensherpa New Member

    Postfix problem

    (Greetings .Im beginner with ispconfig)I followed the process given by Pawan to migrate ispconfig from ubuntu 12.04 to ubuntu 12.04.
    here is what i did :-
    1.Install a fresh ispconfig (followed falko tutorial for ISPconfig on ubuntu 12.04)
    2.backup files (renaming default config files) in new server.
    3. tar -pczf files and copy_paste the /etc/passwd , group, group- ,shadow and other files
    4. tar -pczf files and copy_paste /etc/postfix , /usr/local/ispconfig ,/var/lib/mysql , /var/log/ispconfig ,/var/vmail , /etc/dovecot from OLD server to New Server


    the mailq command shows below output:-

    -Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
    867782522366 310 Wed Aug 13 07:06:04 [email protected]
    (host 127.0.0.1[127.0.0.1] said: 421 4.3.2 Service shutting down, closing channel (in reply to RCPT TO command))
    [email protected]

    -- 0 Kbytes in 1 Request.



    in the /var/log/mail.log

    Aug 13 07:06:04 vps01 postfix/proxymap[19818]: error: open /etc/postfix/mysql-virtual_forwardings.cf: Permission denied
    Aug 13 07:06:04 vps01 postfix/proxymap[19818]: error: open /etc/postfix/mysql-virtual_email2email.cf: Permission denied
    Aug 13 07:06:04 vps01 postfix/pickup[19534]: 867782522366: uid=0 from=<root>
    Aug 13 07:06:04 vps01 postfix/proxymap[19818]: error: open /etc/postfix/mysql-virtual_domains.cf: Permission denied
    Aug 13 07:06:04 vps01 postfix/proxymap[19818]: error: open /etc/postfix/mysql-virtual_transports.cf: Permission denied
    Aug 13 07:06:04 vps01 postfix/proxymap[19818]: warning: mysql:/etc/postfix/mysql-virtual_transports.cf is unavailable. open /etc/postfix/mysql-virtual_transports.cf: Permission denied
    Aug 13 07:06:04 vps01 postfix/trivial-rewrite[19819]: warning: proxy:mysql:/etc/postfix/mysql-virtual_transports.cf lookup error for "*"
    Aug 13 07:06:04 vps01 postfix/proxymap[19818]: warning: mysql:/etc/postfix/mysql-virtual_transports.cf is unavailable. open /etc/postfix/mysql-virtual_transports.cf: Permission denied
    Aug 13 07:06:04 vps01 postfix/trivial-rewrite[19819]: warning: proxy:mysql:/etc/postfix/mysql-virtual_transports.cf lookup error for "*"
    Aug 13 07:06:04 vps01 postfix/cleanup[19817]: 867782522366: message-id=<[email protected]>
    Aug 13 07:06:04 vps01 postfix/qmgr[16971]: 867782522366: from=<[email protected]>, size=310, nrcpt=1 (queue active)
    Aug 13 07:06:04 vps01 amavis[18899]: (18899-01) (!)connect_to_sql: unable to connect to DSN 'DBI:mysql:database=dbispconfig;host=127.0.0.1;port=3306': Access denied for user 'ispconfig'@'localhost' (using password: YES)
    Aug 13 07:06:04 vps01 amavis[18899]: (18899-01) (!!)TROUBLE in process_request: connect_to_sql: unable to connect to any dataset at (eval 100) line 241, <GEN35> line 4.
    Aug 13 07:06:04 vps01 amavis[18899]: (18899-01) (!)Requesting process rundown after fatal error
    Aug 13 07:06:04 vps01 postfix/smtp[19820]: 867782522366: to=<[email protected]>, relay=127.0.0.1[127.0.0.1]:10024, delay=0.42, delays=0.28/0/0.01/0.13, dsn=4.3.2, status=deferred (host 127.0.0.1[127.0.0.1] said: 421 4.3.2 Service shutting down, closing channel (in reply to RCPT TO command))

    heres the partof file permissions in /etc/postfix

    -rw-r----- 1 root postfix 231 May 5 2013 mysql-virtual_client.cf
    -rw-r----- 1 root postfix 221 May 5 2013 mysql-virtual_domains.cf
    -rw-r----- 1 root postfix 218 May 5 2013 mysql-virtual_email2email.cf
    -rw-r----- 1 root postfix 230 May 5 2013 mysql-virtual_forwardings.cf
    -rw-r----- 1 root postfix 288 May 5 2013 mysql-virtual_mailboxes.cf
    -rw-r----- 1 root postfix 252 May 5 2013 mysql-virtual_recipient.cf
    -rw-r----- 1 root postfix 224 May 5 2013 mysql-virtual_relaydomains.cf
    -rw-r----- 1 root postfix 230 May 5 2013 mysql-virtual_relayrecipientmaps.cf
    -rw-r----- 1 root postfix 249 May 5 2013 mysql-virtual_sender.cf
    -rw-r----- 1 root postfix 227 May 5 2013 mysql-virtual_transports.cf


    i have not configured dns but
    the websites seems to be working(editing the host file in my windows 7),FTP users also working but i cannot send email ,im trying to send email using terminal apps like mail and mutt with system user 'root'
    Thank you
     

Share This Page