[CentOS] Remote update OS from 6 to 7

Wed Aug 29 15:06:34 UTC 2018
mark <m.roth at 5-cent.us>

Hi, Jerry,

Jerry Geis wrote:
> I have a remote machine running C6. I desire to update it to C7. Not
> possible to be on-site. Can I copy the Everything ISO for C7 to the
> machine, mount -o loop C7.Everything.iso  /media/cdrom
>
> then do a "yum upgrade" ?
>
> Will that work? The server is using software raid.

Not a good idea. Here's a better one, that we've used here: ideally from
another system running C7 that's the same hardware (otherwise, you need to
rebuild the initrd).
mkdir /new /boot/new
rsync -HPavzx --exclude=/old --exclude=/var/log/wtmp $machine:/. /new/.
rsync -HPavzx $machine:/boot/. /boot/new/.

After the copy, check these files:

/boot/new/grub/device.map - should list the correct device name for hd0
/new/etc/fstab - should have the correct labels for file systems
Do this, too:
rsync -HPavzx /etc/sysconfig/network-scripts/ifcfg-eth*
/new/etc/sysconfig/network-scripts
rsync -HPavzx /etc/sysconfig/hwconf /new/etc/sysconfig
rsync -HPavzx /boot/grub/device.map /boot/new/grub/
rsync -HPavzx /etc/udev/rules.d/70-persistent-net.rules
/new/etc/udev/rules.d/

on the new machine, run

 find /new/var/log/ -type f -exec cp /dev/null {} \;

f this system is using Linux RAID,

 rsync -HPavx /old/etc/md.conf /etc/

Copy the original SSH keys:

rsync -HPavzx /etc/ssh/ssh_host* /new/etc/ssh

Finally, rotate:
zsh
zmodload zsh/files

cd /boot
mkdir old
mv * old
mv old/lost+found .
mv old/new/* .

# Root partition.
cd /
mkdir old
mv * old
mv old/lost+found .
#mv old/root . -- WHY?
mv old/scratch .
mv old/new/* .

sync
sync

Make selinux reset all the security file labels

touch /.autorelabel

Reboot, and when it comes back up, rerun grub2-install....

   mark