Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Transfer Ubuntu server to new hardware

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Help!
View previous topic :: View next topic  
Author Message
ollie
Moderator


Joined: Mon Jul 25, 2005 12:26 pm
Posts: 2749
Location: Bathurst NSW Australia

PostPosted: Wed Nov 07, 2012 12:25 am    Post subject: Transfer Ubuntu server to new hardware Reply with quote

Hi all,

I've been away from the forums for a long time because of work pressures and illness Sad but I'm back for some advice.

I'm moving an existing Ubuntu Server 10.04.4 LTS amd64 server to new hardware. I have tried installing Ubuntu Server 12.04.1 LTS onto the new hardware and started using rsync to copy over home directories, web server files and some configuration files. I used mysqldump via ssh to copy all of my databses over successfully, including all all of the MySQL users and permissions.

However, I'm having problems restarting the Apache web server with missing configuration files. I'm also not sure if I've got all of the required PHP5 configuration files. There seems to be some differences between the configuration of Apache on 12.04 and 10.04.

I'm starting to realise that moving the server onto a different server version may not be a good idea Embarassed

So here's the big question, if I install Ubuntu 10.04.4 LTS onto the new server and run:
Code:
#mysqlpdump --user=root --password="securePassword" --all-databases | ssh root@192.168.0.35 'mysql --user=root --password="securePassword"'

then
Code:
#rsync -avz / --exclude '/var/mysql/*' | ssh root@192.168.0.35:/


Would I be copying an entire system and overwriting the default files and settings entirely, including passwd and shadow files?

I could then do a running system upgrade to Ubuntu Server 12.04.1 LTS and be happy on the new hardware Very Happy
Back to top
View user's profile Send private message
Dutch_Master
LXF regular


Joined: Tue Mar 27, 2007 2:49 am
Posts: 2437

PostPosted: Wed Nov 07, 2012 2:03 am    Post subject: Reply with quote

You can copy the package list with:
Code:
dpkg --get-selections > selections.txt
Copy the lot over (including the sources.list) then, after you've put the sources.list back in place, execute the following one-liner (as root, obviously):
Code:
aptitude update && aptitude install dselect && dpkg --set-selections < selections.txt && dselect install
Make sure you have the correct path to the selections.txt file! (right, Ubuntu doesn't use root, it insists on sudo Rolling Eyes Oh well, you know what to do then Wink)

This way you should have the entire environment you were working on back on the new server.

Another option to move the lot is making use of RAID: add a few disks to the existing machine, then mirror the new disks (as RAID1) to the old RAID. The kernel will then rebuild the new RAID (i.e. make a 1:1 copy of the old system), which then can be transferred to the new server. Takes time (few hours for a 500 GB disk) so best done overnight. Theoretically it works...
Back to top
View user's profile Send private message
ollie
Moderator


Joined: Mon Jul 25, 2005 12:26 pm
Posts: 2749
Location: Bathurst NSW Australia

PostPosted: Wed Nov 07, 2012 3:27 am    Post subject: Reply with quote

Thanks DM - you've confirmed the process that I'm doing for the environment. I'm just waiting to install the "extra" software I've added to /etc/apt/sources.list like Webmin & MondoRescue. I actually used dpkg and apt-get because it's only 4 commands including the fetching on the new server:
Code:
wget http://oldserver/installed-software.txt
sudo dpkg --set-selections < installed-software.txt
sudo apt-get update
sudo apt-get upgrade

Then it will be doing the MySQL dump, which I know works, and then trying to rsync everything else in one go.

I'm just worried about the final rsync being able to write all of the files to a running system, which will get all of the IP address and name settings of the old server. Will rsync overwrite /etc/passwd and /etc/shadow successfully?

I can't go the RAID route, the old server has 2 x SCSI 3.5" hard drives in RAID1, whilst the "new" server has 8 x 2.5" SAS drives that I've broken up into 2 x RAID1 (/boot, /, swap), 3 x RAID5 (/var) and another 3 x RAID5 (/home).
Back to top
View user's profile Send private message
Dutch_Master
LXF regular


Joined: Tue Mar 27, 2007 2:49 am
Posts: 2437

PostPosted: Wed Nov 07, 2012 7:23 pm    Post subject: Reply with quote

Can't help on MySQL Ollie, but welcome back anyway Wink It's generally not a good idea to replace critical/essential files on a running system, perhaps a live-cd/usbstick would be a better idea. Make sure you copy the to-be replaced files for easy restoring if things go haywire!
Back to top
View user's profile Send private message
ollie
Moderator


Joined: Mon Jul 25, 2005 12:26 pm
Posts: 2749
Location: Bathurst NSW Australia

PostPosted: Wed Nov 07, 2012 9:55 pm    Post subject: Reply with quote

Thanks DM.

Now I'm wondering if I shut down the Apache & MySQL servers on the target system, as well as any other servers other than OpenSSH, and then do the rsync if that would be more successful.

I'm making sure I don't wipe anything on the old system until the new server is totally functional. It is also backed up to tape drive, just in case.

I'm not sure if I'll be trying on Friday, when I can take the old system "offline" for a while, or waiting until December when the system can be offline for a week during a shut down period.
Back to top
View user's profile Send private message
Dutch_Master
LXF regular


Joined: Tue Mar 27, 2007 2:49 am
Posts: 2437

PostPosted: Thu Nov 08, 2012 2:09 am    Post subject: Reply with quote

Plan for next Friday, then you have a week fall-back time to fix errors. The initial rsync is the largest, perhaps use tar to compress the lot? But! You have a backup (of the old system), why not use that to roll data in instead? No chances to compromise the old system, and you get to check your backup roll-back strategy is working Very Happy

As for the tape drive: unless your client is emotionally very attached (sic Razz) to that ancient device, advise them to switch to Blu-Ray instead Wink
Back to top
View user's profile Send private message
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Help! All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast