Get the most out of your Centmin Mod LEMP stack
Become a Member

Upgrade Upgrade OS to CentOS 7 from CentOS 6

Discussion in 'Install & Upgrades or Pre-Install Questions' started by speedway, Aug 17, 2020.

  1. speedway

    speedway Member

    48
    13
    8
    Nov 28, 2015
    Sydney, AUSTRALIA
    Ratings:
    +18
    Local Time:
    12:51 PM
    1.19.2
    Dont' Know Right Now
    Am trying to figure out the best way to handle an OS upgrade, I want to move to CentOS 7 and there is no easy way that I can find. I do have 2 servers at soyoustart, my main and a small mailserver.


    Do I move all the data to the other server, install CentOS7 on my original and then reinstall centminmod before moving all my data back or is there a different/preferred way of doing things.

    I know just enough to be dangerous so please be gentle :)

    Cheers
    Bruce
     
  2. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    12:51 PM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    Only reliable and safe way to upgrade major CentOS version from 6 to 7 and from 7 to 8 will be full server migration as outlined at Upgrade - Nginx - Insight Guide - Centmin Mod Site Data Migration Guide

    1. Spin up a new CentOS 7 server/vps and install Centmin Mod 123.09beta01 or newer
    2. Then backup and migrate data from CentOS 6 server to the CentOS 7 server created and setup in step 1

    You can treat each data migration as a test run as long as you do not update domain DNS records to point to new CentOS 7 server as outlined at Upgrade - Nginx - Insight Guide - Centmin Mod Site Data Migration Guide and subsequent post after.

     
  3. speedway

    speedway Member

    48
    13
    8
    Nov 28, 2015
    Sydney, AUSTRALIA
    Ratings:
    +18
    Local Time:
    12:51 PM
    1.19.2
    Dont' Know Right Now
    Thank you Sir, I have looked at soyoustart and they have an identical server available so will will get that one and start the migration as per the linked guide.

    Cheers
     
    Last edited: Aug 17, 2020
  4. speedway

    speedway Member

    48
    13
    8
    Nov 28, 2015
    Sydney, AUSTRALIA
    Ratings:
    +18
    Local Time:
    12:51 PM
    1.19.2
    Dont' Know Right Now
    Been installing evrything on the new server and have begun the keygen stuff but it does not seem to be working, I keep getting this:

    Code:
    /usr/bin/ssh-copy-id: ERROR: No identities found
    
    and I have no idea why. I looked up ssh-copy-id and both sshd configs contain what they need to however it still fails.

    Anyone?

    Cheers
     
  5. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    12:51 PM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    outline the commands you used to get to that error
     
  6. speedway

    speedway Member

    48
    13
    8
    Nov 28, 2015
    Sydney, AUSTRALIA
    Ratings:
    +18
    Local Time:
    12:51 PM
    1.19.2
    Dont' Know Right Now
    After setting the parameters as per Upgrade - Nginx - Insight Guide - Centmin Mod Site Data Migration Guide I executed the following:

    Code:
    cd /root/tools/keygen
    ./keygen.sh gen rsa $remoteip $port root $comment $remoterootpass
    
    Just ran it again and got the same: (password removed)

    Code:
    copy /root/.ssh/my1.key.pub to remote: root@158.69.25.2
    sshpass -p <password> ssh-copy-id -o StrictHostKeyChecking=no -i /root/.ssh/my1.key.pub root@158.69.25.2 -p 22
    /usr/bin/ssh-copy-id: ERROR: No identities found
    [22:16][root@es1.ozspeedway.net keygen]#
    
    Checked the destination and there is a file there but it is empty:

    Code:
    [02:17][root@ns516731 ~]# cd /root/.ssh
    [02:17][root@ns516731 .ssh]# ls
    authorized_keys2
    [02:17][root@ns516731 .ssh]# cat authorized_keys2
    [02:17][root@ns516731 .ssh]#
    
    Cheers
     
  7. speedway

    speedway Member

    48
    13
    8
    Nov 28, 2015
    Sydney, AUSTRALIA
    Ratings:
    +18
    Local Time:
    12:51 PM
    1.19.2
    Dont' Know Right Now
    Does it remove the key after trying? I ask because the key is not in /root/.ssh

    Code:
    [01:45][root@es1.ozspeedway.net keygen]# ls -al /root/.ssh
    total 12
    drwxr-xr-x  2 root root 4096 Aug 17 22:25 .
    dr-xr-x--- 13 root root 4096 Aug 16 10:02 ..
    -rw-r--r--  1 root root  794 Aug 17 01:10 known_hosts
    
     
  8. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    12:51 PM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    did you whitelist and allow IP address on both old for new and new for old server so that they can both connect to each other via ssh and ssh-copy-id ?
     
  9. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    12:51 PM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    CentOS 7 uses authorized_keys not authorized_keys2
     
  10. speedway

    speedway Member

    48
    13
    8
    Nov 28, 2015
    Sydney, AUSTRALIA
    Ratings:
    +18
    Local Time:
    12:51 PM
    1.19.2
    Dont' Know Right Now
    Yup, all followed from the linked thread. I can transfer from old to new if I supply the new password while doing so.
     
  11. speedway

    speedway Member

    48
    13
    8
    Nov 28, 2015
    Sydney, AUSTRALIA
    Ratings:
    +18
    Local Time:
    12:51 PM
    1.19.2
    Dont' Know Right Now
    There must be something in a settings file somewhere as it has always indicated keys2. I will, scour the settings of a few items to find out why
     
  12. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    12:51 PM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    That might be why if your system is looking for authorized_keys2 and not authorized_keys
     
  13. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    12:51 PM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    check what openSSH is configured to look for via grepping the openSSH config file's location using
    Code (Text):
    grep AuthorizedKeysFile /etc/ssh/sshd_config
    

    example output
    Code (Text):
    grep AuthorizedKeysFile /etc/ssh/sshd_config
    AuthorizedKeysFile      .ssh/authorized_keys
    
     
  14. speedway

    speedway Member

    48
    13
    8
    Nov 28, 2015
    Sydney, AUSTRALIA
    Ratings:
    +18
    Local Time:
    12:51 PM
    1.19.2
    Dont' Know Right Now
    Did a search as suggested and came up with this:

    Code:
    [23:23][root@es1.ozspeedway.net keygen]# grep AuthorizedKeysFile /etc/ssh/sshd_config
    AuthorizedKeysFile      .ssh/authorized_keys
    [23:23][root@es1.ozspeedway.net keygen]#
    
    Yet in the keygen logs is this:

    Code:
    [23:12][root@es1.ozspeedway.net keygen]# grep -r "keys2" /etc/
    /etc/keygen/logs/keygen-170820-005123.log:-rw-r--r--  1 root root    0 Mar  9  2016 authorized_keys2
    /etc/keygen/logs/keygen-170820-010802.log:-rw-r--r--  1 root root    0 Mar  9  2016 authorized_keys2
    /etc/keygen/logs/keygen-170820-075535.log:-rw-r--r--  1 root root    0 Mar  9  2016 authorized_keys2
    
    will keep checking