Welcome to Centmin Mod Community
Become a Member

Featured Upgrade Nginx Insight Guide How to upgrade Centmin Mod + backing up customisations

Discussion in 'Centmin Mod Insights' started by eva2000, Jul 20, 2016.

  1. eva2000

    eva2000 Administrator Staff Member

    54,106
    12,179
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,738
    Local Time:
    3:09 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Centmin Mod code upgrades via centmin.sh menu option 23 don't really make changes to other files needlessly. However, you really need to try and keep the code/routines that Centmin Mod uses up to date.

    You can try the following by backing up the main files first and then do a fresh Centmin Mod code replacement by backing up and moving /usr/local/src/centminmod.

    Replace branchname variable below with branch you want either 123.08stable or 123.09beta01 and type in SSH window the following:.
    Code (Text):
    branchname=123.09beta01
    

    The cp copy commands backup the key files/vhost/ssl etc first. Remember to replace branchname with branch you want either 123.08stable or 123.09beta01
    Code (Text):
    branchname=123.09beta01
    cp -a /etc/my.cnf /etc/my.cnf-old
    cp -a /usr/local/lib/php.ini /usr/local/lib/php.ini-old
    cp -a /usr/local/etc/php-fpm.conf /usr/local/etc/php-fpm.conf-old
    cp -a /etc/centminmod /etc/centminmod-old
    cp -a /usr/local/nginx/conf /usr/local/nginx/conf-old
    cd /usr/local/src
    mv centminmod centminmod-old
    git clone -b ${branchname} --depth=1 https://github.com/centminmod/centminmod.git centminmod
    cd centminmod
    ./centmin.sh

    the last run for centmin.sh syncs any needed changes


    then you can compare all the new and old directory and files and transfer them back manually if needed
    Code (Text):
    sdiff /etc/my.cnf /etc/my.cnf-old
    sdiff /usr/local/lib/php.ini /usr/local/lib/php.ini-old
    sdiff /usr/local/etc/php-fpm.conf /usr/local/etc/php-fpm.conf-old
    diff -qr /etc/centminmod /etc/centminmod-old
    diff -qr /usr/local/nginx/conf /usr/local/nginx/conf-old
    diff -qr /usr/local/src/centminmod /usr/local/src/centminmod-old
    

    example if file differs
    Code (Text):
    diff -qr /etc/centminmod /etc/centminmod-old
    Files /etc/centminmod/email-primary.ini and /etc/centminmod-old/email-primary.ini differ

    then use sdiff to see what the actual difference is

    sdiff side by side view
    Code (Text):
    sdiff /etc/centminmod/email-primary.ini /etc/centminmod-old/email-primary.ini

    sdiff side by side view only differences flag -s
    Code (Text):
    sdiff -s /etc/centminmod/email-primary.ini /etc/centminmod-old/email-primary.ini

    Code (Text):
    sdiff /etc/centminmod/email-primary.ini /etc/centminmod-old/email-primary.ini
    3 | 1


    These steps ensure you're running the latest routines that power Centmin Mod.

    Folks, can post the output of the diff -qr commands and I will tell whether or not there's a better way to ensure some changes persist after Centminn Mod updates i.e. if you can use persistent config file method via /etc/centminmod/custom_config.inc etc

    There's also a list of other file comparison tools you can use within SSH or locally on own PC listed at List of file comparison tools | Centmin Mod Community For windows I use BeyondCompare
     
    Last edited: Mar 1, 2018
  2. ethanpil

    ethanpil Active Member

    173
    55
    28
    Nov 8, 2015
    Ratings:
    +101
    Local Time:
    3:09 PM
    I am thinking that this entire process can be automated with a simple script?
     
  3. eva2000

    eva2000 Administrator Staff Member

    54,106
    12,179
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,738
    Local Time:
    3:09 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    yeah it could if you want to whip up a script yourself

    but you can't do the file/settings diff compare in automated fashion, you'd need your own pair of eyes to determine which changes you'd want to keep or discard
     
  4. ethanpil

    ethanpil Active Member

    173
    55
    28
    Nov 8, 2015
    Ratings:
    +101
    Local Time:
    3:09 PM
    Agreed about the final changes, but it would be simple to create the report in a file so that upgrades are easier.
     
  5. eva2000

    eva2000 Administrator Staff Member

    54,106
    12,179
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,738
    Local Time:
    3:09 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Yeah I suppose. But good manual practice first is always good for beginners :) ;)