2015-01-04 01:33:42

How to install a Debian with DTC?

I wanted to migrate my virtually running server to a new one to have the updates done easily. I had to dig and test a bit as there were no full description about this process. Here you will find the commands in order, with minimal explanation...

Installation  steps:

  1. Install Debian without any additional features.
  2. Configurethe network: (supposing eth0 is the connection)
    edit /etc/network/interfaces:
          iface eth0 inet static
          address [server IP address behind the firewall]
          netmask [server netmask behind the firewall]
          gateway [gateway IP behind the firewall]
          dns-nameservers [DNS server IP behind the firewall]
  3. ifdown eth0
  4. ifup eth0
  5. echo "deb ftp://ftp.gplhost.com/debian wheezy main" >>/etc/apt/sources.list
  6. wget -q ftp://ftp.gplhost.com/debian/repository_key.asc -O - | apt-key add -
  7. apt-get update
  8. apt-get install mc ('cause I like MC :) )
  9. apt-get install postfix dtc-postfix-dovecot   (or apt-get install postfix dtc-postfix-courier, whichever you want to use)
    Two important questions to answer: (For the other questions answer wahtever you want)
    - Create directories for web-based administration ? -> yes.
    - Postfix general type of configuration? -> Internet Site.
  10. /usr/share/dtc/admin/install/install
  11. chown dtc:dtcgrp /var/lock/apache2
  12.  dpkg-reconfigure dtc-postfix-dovecot (or dpkg-reconfigure dtc-postfix-courier  )
  13. Login to DTC admin page in a web browser and creat an FTP and e-mail address
  14. apt-get install ntp
  15. apt-get install ntpdate
  16. apt-get install mysqmail-postfix-logger  mysqmail-pure-ftpd-logger (or apt-get install mysqmail-postfix-logger mysqmail-courier-logger mysqmail-pure-ftpd-logger)
  17. apt-get install phpmyadmin
  18. apt-get install roundcube (or apt-get install squirremail  )
  19. dpkg-reconfigure roundcube-core (or chown dtc:dtcgrp /var/lib/squirrelmail/data)
  20. chown -R dtc:dtcgrp /var/lib/roundcube/config
  21. Also check other places for roundcube (eg: /etc/roundcube, and apply chown if roundcube still not running)

Installaion now done.

To do the migration from another DTC server:

  1. Modify one FTP user in ftp_access table in DTC database to have homedir /var on the old server.
  2. This will copy all files and mails to the new server. Can take long time...
    ncftpget -R -T -u FTPUSER -p FTPUSERPASSWORD OLD_SERVER_IP /var/www www/sites
  3. aptitude install rsync
  4. (If old server still online for users, turn off the availability for everyone, eg: disallow the port forwardings to the old server.)
  5. on the old server execute:
    1. ssh-keygen            (note: no passwd needed)
    2. copy the content of the generated .pub file NEW server: /root/.ssh/authorized_keys file
    3. cd /usr/share/dtc/admin/
    4. ./dtc_migrate NEW_SERVER_IP
  6. /usr/share/dtc/admin/install/install
  7. chown -Rh dtc:dtcgrp /var/www/sites
  8. Now you can swithc to the new server. (Allow port forwards on router to the new server.)
    But as the ncftpget can take long time, there might be new mails and modified files not copied to the new, so a sync can be helpful:
    1. apt-get install lftp
    2. cd /var/www/sites
      1. cd www/sites
      2. set ftp:list-options -a
      3. mirror -c --delete --allow-chown --no-symlinks --only-newer --parallel=10
      4. quit
    4. chown -Rh dtc:dtcgrp /var/www/sites


If you are using dovecot but somewhere in the history you migrated from courier, do not forget to edit the /etc/dovecot/dovecot.conf at pop3_uidl_format section to avoid POP3 mails downloaded for users. This modification has to be done after step 6 of Migration.