Line 141: |
Line 141: |
| | | |
| As you can see this is a quick example of what you can do with this contribs, you can take this as an example for all your needs. | | As you can see this is a quick example of what you can do with this contribs, you can take this as an example for all your needs. |
| + | |
| + | ===Server Migration=== |
| + | ====Migrate user accounts to a new server==== |
| + | Perhaps your SME server was first installed in 2005 or earlier, and has suffered at your hands over the years as you tested add-ons, contribs, and procedures. |
| + | |
| + | The time has come to start fresh -- but you don't want to have to reconfigure all of your users' computers, phones, tablets, etc. |
| + | |
| + | Using Lazy Admin Tools, you can migrate your user accounts to a shiny new server -- with their existing passwords. Transferring their existing email folders is also relatively simple. |
| + | |
| + | Assumptions: |
| + | * Existing SME server '''legacySME''' |
| + | ** ssh access enabled using port xxx |
| + | ** IP address is legacySME_IP |
| + | * Existing or newly installed SME server '''newSME''' |
| + | ** use the same domain name that was used by '''legacySME''' |
| + | ** disable DHCP |
| + | |
| + | Results: |
| + | * User accounts and passwords from '''legacySME''' will be created on '''newSME''' |
| + | :(optionally transfer user files and email) |
| + | * Users' devices will have access to email on '''newSME''' without any reconfiguration |
| + | |
| + | |
| + | ;1. On '''legacySME''' |
| + | : Create Lazy Admin Tools backup files |
| + | <div style="margin-left: 2em;"> |
| + | <nowiki>mkdir /root/lat |
| + | cd /root/lat |
| + | lat-dump -d</nowiki> |
| + | </div> |
| + | |
| + | ;2. On '''newSME''' |
| + | : Copy the files from '''legacySME''' |
| + | : (scp uses an uppercase "P" to specify the ssh port number) |
| + | <div style="margin-left: 2em;"> |
| + | <nowiki>mkdir /root/lat |
| + | scp -P xxx root@legacySME_IP:/root/lat/* /root/lat</nowiki> |
| + | </div> |
| + | |
| + | : Restore the user accounts and passwords from '''legacySME''' on '''newSME''' |
| + | :: lat-dump from '''legacySME''' created a file called ''lat-restore'' that shows the commands required to restore everything that was backed up. To create the user accounts from '''legacySME''' on '''newSME''' you need to run the ''lat-users'' and ''lat-shadow'' commands. The commands below will execute these two commands, but you could also review the contents of ''lat-restore'' and run these two commands manually. |
| + | <div style="margin-left: 2em;"> |
| + | <nowiki>$(grep lat-users lat-restore) |
| + | $(grep lat-shadow lat-restore)</nowiki> |
| + | </div> |
| + | |
| + | : Optional - transfer users' files (including email) |
| + | ::The commands below will transfer all of the user files and email from '''legacySME''' to '''newSME''' |
| + | ::(ssh uses a lowercase "p" when specifying the port number) |
| + | <div style="margin-left: 2em;"> |
| + | <nowiki># get the user files and folders from the old server |
| + | rsync -rltzq -e "ssh -p xxx" "root@legacySME_IP:/home/e-smith/files/users/" "/home/e-smith/files/users/" |
| + | # |
| + | # fix file ownership for all users |
| + | cd /home/e-smith/files/users |
| + | for f in *; do chown -R $f:$f $f; done</nowiki> |
| + | </div> |
| + | |
| + | ;3. Cleanup |
| + | * On '''legacySME''' |
| + | ** Turn it off and disconnect it |
| + | *: or |
| + | ** Run <tt>su admin</tt> and: |
| + | *** Change the hostname |
| + | *** Change the IP address |
| + | *** Disable DHCP (if it is enabled) |
| + | * On '''newSME''' |
| + | ** Run <tt>su admin</tt> and: |
| + | *** Change the hostname to '''legacySME''' (the original name of the old server) |
| + | *** Change the IP address to '''legacySME_IP''' |
| + | *** Enable DHCP (if it was enabled on '''legacySME''') |
| + | * Other Considerations |
| + | ** SSL Certificates |
| + | *: If you had a commercial or LetsEncrypt certificate on '''legacySME''', you will need to set it up on the new server, too. |
| + | ** Repeated data transfers |
| + | *: The <tt>rsync</tt> command shown above does *not* delete files from '''newSME''' that have been deleted from '''legacySME'''. If you choose to do the process above, test the new server, then repeat the data transfer -- your users will see some emails returned to their inbox that they had filed or deleted. To prevent this, add "-delete-before" to the rsync command: |
| + | *:<tt>rsync -rltzq -delete-before -e "ssh -p xxx" "root@legacySME:/home/e-smith/files/users/" "/home/e-smith/files/users/"</tt> |
| + | **'''legacySME''' vs '''legacySME_IP''' |
| + | *: Since '''newSME''' is using the same domain name as '''legacySME''', it will not find '''legacySME''' by name unless you add it in server-manager as a host. If you do that, you'll also have to delete that entry before renaming '''newSME''' at the end. It is easier to use the '''legacySME_IP''' for scp and rsync. |
| | | |
| ===Forum References=== | | ===Forum References=== |