Skip to content

edwardsmarkf/server-migration

Repository files navigation

## FUTURE: put all log files in their own directory like /root/server-migration-logs/


pre-set passwords (optional)


pre-set the decryption password:

echo  'echo   camel-case-decrypt-password    ;  '  >  /root/camel-case-decrypt-password.bsh ;

pre-set the current server sftp:

echo  'echo   ssh-login-password    ;  '           >  /root/ssh-login-password.bsh ;

test:

bash -vx                                              /root/camel-case-decrypt-password.bsh ;
bash -vx                                              /root/ssh-login-password.bsh ;


new server initialization


timedatectl set-timezone America/New_York   ;   timedatectl  ;       ## 2026-04-15 not sure why this is not the default...??

cd  ;  echo "export KVM_NAME=kvm502;" > /etc/profile.d/kvmName.sh  ;   ## 2026-02-20
mkdir  --verbose   /kvm502/                                        ;   ## 2026-04-15

###  (this step takes about 3.5 hours or 210 minutes!)

 dnf  --assumeyes  install  time                                                                                          ;
 cat  <<END_OF_INITIALIZATION                                                                                             |
    cd                                                                                                                    ;
    dnf --assumeyes update                                                                                                ;
    dnf  --assumeyes upgrade                                                                                              ;
    dnf   clean all                                                                                                       ;
    dnf  --assumeyes  install  time                                                                                       ;
    dnf  --assumeyes  install git  && git clone  https://github.com/edwardsmarkf/server-migration                         ;
    cd   /root/server-migration/                                                                                          ;
    time bash -vx  /root/server-migration/Master_Installer.bsh > /root/server-migration/Master_Installer.bsh.log   2>&1   ;
END_OF_INITIALIZATION
nohup  time  bash -vx  -   >  /root/do-all-the-work.bsh.log  2>&1  &


current server data extraction


# on CURRENT server: (NOTE LENGTH OF TIME!!)

export TMP_LOCATION=/tmp/old_server_data/   ;     ##

rm -Rf  ${TMP_LOCATION}   ;  mkdir  ${TMP_LOCATION}   && cd  $_  ;

git clone  https://github.com/edwardsmarkf/server-migration                                                         ;
tar --gzip  --create --file=/kvm301/backup/github-server-migration-$(date +%Y-%m-%d;).tar.gz   ./server-migration/  ;   ## optional save
ls -l  /kvm301/backup/github-server-migration-$(date +%Y-%m-%d;).tar.gz                                             ;

# change to the mariadb password

sed --in-place --expression='1,/CHANGE-THIS/s/CHANGE-THIS/MariaDatabasePassword/;'  ${TMP_LOCATION}/server-migration/mariadb/migration/mariadbDumpAllDatabases.bsh  ;   ## dont copy/paste past here!

# optional to make sure password is correct

grep  '^MARIADB_PASSWORD='                                                  ${TMP_LOCATION}/server-migration/mariadb/migration/mariadbDumpAllDatabases.bsh  ;   ## dont copy/paste past here!
nohup  time  nice bash -vx  ${TMP_LOCATION}/server-migration/bash-misc/current-server-data-extraction.bsh      \
                         >  ${TMP_LOCATION}/server-migration/bash-misc/current-server-data-extraction.bsh.log  &   ## run detached

# test results:

ls  -l   --human   /home/mark/*.gz                     ;
du  --human-readable  --summarize   /home/mark/*.gz    ;
du  --human-readable  --summarize   /home/mark/        ;   ## grand total    ## 3.4 gigs


fetch data to new server


# on new server: (15 minutes)

 dnf  --assumeyes  install sshpass  ;      ## this might not yet be done if this procedure is started too early.

 export TMP_LOCATION=/tmp/old_server_data/   ;     ##

 rm -Rf  ${TMP_LOCATION}   ;  mkdir  ${TMP_LOCATION}   && cd  $_  ;

## get IP number from NEW server and temporarily add it to old server csf firewall port 22 ## ### https://stackoverflow.com/questions/28461713/how-to-ignore-or-pass-yes-when-the-authenticity-of-host-cant-be-established-i

 sshpass -p  "$(bash /root/ssh-login-password.bsh ;)"  sftp  -o StrictHostKeyChecking=no   mark@162.220.165.228  ;   ## grab stuff from OLD server!
  • sftp> ls -lh ## human readable file size /home/ one is 3.3 gigs
  • sftp> mget *.gz ## fetch the gzips
  • sftp> !ls -lh` ## file sizes on NEW server (notice bang character)
  • sftp> rm *.gz` ## can be done in the sftp session!

# test the results:

ls -lh                               ${TMP_LOCATION}/*.gz    ;
du  --human-readable  --summarize    ${TMP_LOCATION}/*.gz    ;
du  --human-readable  --summarize    ${TMP_LOCATION}/        ;   ## grand total


preliminary testing


* preliminary *

# check the ffmpeg install:

 more   /root/ffmpeg-install-logs/99-test.bsh.log   ;    ### look for results

# check all installations for version numbers: (this may need to be ran TWICE)

 bash    /root/server-migration/bash-misc/version_test.bsh    ;    ## notice no dash-v-x switches!

### define/create domain (if it does not yet exist) using new IP into local etc.hosts file

 export DOMAIN='zzyzxzzyzx.com'  ; 

 virtualmin  create-domain  --domain  ${DOMAIN}  --pass  abcdefg --dir  --unix  --dns  --web  ;  ## 2025-08-13  --dns and --web are the ONLY two options requested
 virtualmin  modify-web     --domain  ${DOMAIN}  --enable-fcgiwrap ;  ## can this ever be the default?

* php testing *

 bash  -vx  /root/server-migration/php/02_php_testing.bsh        ;

* perl testing *

 su    fakeperluser    --command 'perl  -W  -e  '\''use File::Basename ; '\'' ;  '     &&  echo  $?  ;   ## test the perl 'use' command.
 su -  fakeperluser    --command 'perl -W -MXML::Writer -e 1                  ;  '     &&  echo  $?  ;   ## not sure what the first dash does...?

 bash -vx   /root/server-migration/perl/perl-cgi-testing.bsh      ;    

* mariadb testing *

 echo  'SELECT VERSION() "Version:" ;' | mariadb                                       &&  echo  $?  ;
 bash     /root/server-migration/mariadb/05_test_perl_mariadb_connection.bsh           &&  echo  $?  ;
 bash     /root/server-migration/mariadb/05_test_php_mariadb_connection.bsh            &&  echo  $?  ;

* clean up *

 virtualmin  delete-domain  --domain  ${DOMAIN}    ;
 userdel  --remove  fakeperluser  ;
 userdel  --remove  fakephpuser   ;

 ls -l  /home/                     ;


unpack all the current data


### also on the new server:

 export TMP_LOCATION=/tmp/old_server_data/   ;     ##

 cd  ${TMP_LOCATION}    ;

 cat  <<END_OF_UNPACK |
   cd  \${TMP_LOCATION}                                               ;
   gzip --decompress          \${TMP_LOCATION}/*.gz                   ;     ### you MAY run into space issues on the new server!

   tar  --extract  --file     \${TMP_LOCATION}/home.tar               ; 
   tar  --extract  --file     \${TMP_LOCATION}/letsencrypt.tar        ;
   tar  --extract  --file     \${TMP_LOCATION}/mariadb-databases.tar  ;
   tar  --extract  --file     \${TMP_LOCATION}/usr_local_bash.tar     ;
   tar  --extract  --file     \${TMP_LOCATION}/usr_local_lib_php.tar  ;
END_OF_UNPACK
nohup time bash -vx  -   >   /root/current-server-tar-gz-unpack.log   2>&1  &   ## detach 

#check the results:

ls  -lh                             ${TMP_LOCATION}                  ;
du  --summarize  --human-readable   ${TMP_LOCATION}                  ;                 ## 13 gigs
ls  -lR                             ${TMP_LOCATION}   | wc  --lines  ;  ## 502k+


create all virtual servers


 cat  <<CREATE_ALL_VIRTUAL_SERVERS |
     bash  -vx  /root/server-migration/webmin/virtualmin-create-vm.bsh    >  /root/server-migration/webmin/virtualmin-create-vm.bsh.log   2>&1  ;
     bash  -vx  /root/server-migration/httpd.conf/apache.bsh              >  /root/server-migration/httpd.conf/apache.bsh.log             2>&1  ;

     [ ! -d "/var/www/html/" ] && mkdir  --verbose  --parents   /var/www/html/                ;   ## 2026-04-13
     ls -l  /var/www  | grep html                                                             ;   ## 2026-04-25
CREATE_ALL_VIRTUAL_SERVERS
nohup time bash -vx  -   >      /root/create-all-virtual-servers.log   2>&1  &   ## detach 

#check the results:

ls  -l         /home/      ;


mariadb data install


### be SURE unpacking is done first.....!

 export TMP_LOCATION=/tmp/old_server_data/                  ;     ##
 cd                  ${TMP_LOCATION}                        ;

## the childs last name (lowercase) and the childs first name (camelCase) and the special one from 1974-1991 (camelCamelCase) no spaces

 sed --in-place --expression="s/^password=''/password='$(bash /root/camel-case-decrypt-password.bsh ;)'/"   /root/server-migration/mariadb/migration/create_db_and_users.bsh    ;    ## edit and add password!

#double-check the password:

 grep  '^password='                                                     /root/server-migration/mariadb/migration/create_db_and_users.bsh    ;    ## inspect it

# create and inspect script to create the empty db's and the users:

 bash   /root/server-migration/mariadb/migration/create_db_and_users.bsh  >  ${TMP_LOCATION}/create_db_and_users.sql                ;
 cat                                                                         ${TMP_LOCATION}/create_db_and_users.sql                ;

#create the empty db's and users:

 mariadb      --verbose                                                   <  ${TMP_LOCATION}/create_db_and_users.sql                ;

# create and inspect script to load the data:

 bash      /root/server-migration/mariadb/migration/create_db_and_users.bsh                               \
         | grep  TEMP_SQL_LOCATION                                                                        \
         | sed -e 's/.* ### //; s/ ## //;1i export TEMP_SQL_LOCATION=${TMP_LOCATION}/tmp/mariadb-tmp/;'   \
         > ${TMP_LOCATION}/load_sql_tables.bsh                                                            \
         ;                                                        ## generate our 'load' script!
 cat   ${TMP_LOCATION}/load_sql_tables.bsh                                                                            ;     ## inspect it 

# load the data into the tables

 nohup time bash  -vx  ${TMP_LOCATION}/load_sql_tables.bsh  >  /root/load_sql_tables.bsh.log    2>&1  &     ## run the newly created bash script   approx 30 minutes run time

# check the results

 du  --summarize  --human-readable  /var/lib/mysql/                                                                        ;     ## check for total size   1.4 gigs
 mariadb-show --count ;   ## spot-check the number of rows!

secure mariadb

 mariadb-secure-installation;   ## IMPORTANT!


move data to proper location


##### put tar files into their proper places (turned into its own script 2026-04-15

nohup time  bash -vx   /root/server-migration/bash-misc/move_data_to_proper_location.bsh  >  /root/server-migration/bash-misc/move_data_to_proper_location.bsh.log  2>&1  &

# check the results

 du   --summarize  --human-readable     /home/                ;   ## 6.5 gigs
 ls -lR      /home/  |  wc  --lines                           ;   ## count: 499920


pm2 . initialize . bsh


### ? ? ? ? npm install uuid@latest ; ### ? ? ? ? ? https://stackoverflow.com/questions/68170853/npm-warn-deprecated-uuid3-4-0-please-upgrade-to-version-7-or-higher

 bash -vx  /root/server-migration/httpd.conf/pm2-httpd-conf-initialize.bsh       >  /root/server-migration/httpd.conf/pm2-httpd-conf-initialize.bsh.log   2>&1  ;

 tail -100                                                                          /root/server-migration/httpd.conf/pm2-httpd-conf-initialize.bsh.log         ;

# check apache is ok

 apachectl  configtest  &&   apachectl  status ;

# create the pm2 jobs:

 nohup  bash -vx  /root/server-migration/node/pm2-initialize.bsh                 >  /root/server-migration/node/pm2-initialize.bsh.log   2>&1  &

# check the results

 pm2 status  ;    ## look for all of them "status  online"

# load the visudo permission file

 bash -vx  /root/server-migration/node/visudo.bsh                                >  /root/server-migration/node/visudo.bsh.log           2>&1  ;

# double-check apache

 apachectl  status  ;    ### or restart - not sure why this was required on 2026-04-02


test the recorder


## go to Cloudns and change the IP number of the comptonpeslonline.com's three places to the new iP number, and set TTL value to 1


s-nail-postfix.bsh


### first get password from Google: https://myaccount.google.com/apppasswords ### or just use the one already in the php-mailer!

 bash    /root/server-migration/s-nail/s-nail-postfix.bsh          ;

# test php outgoing mail

 php   /usr/local/lib/php/SMTPMailer-tester.php  ;   ## test the php mail sender

# check perl outgoing mail

 perl       ./cgi-bin/mailx.pl  ;   ## 2026-04-25   run as comptonpeslonline.com


r s y n c


#### TEST rsync FIRST !!

 sshpass -p  'PASSWORD'   sftp  -o StrictHostKeyChecking=no   mark@162.220.165.228  ;   ## test to make sure this works!

## format: rsync S-O-U-R-C-E D-E-S-T-I-N-A-T-I-O-N

 sshpass -p   'PASSWoRd'                                                                                                               \
      sudo  --user=comptonpeslonline.com  rsync --verbose --archive  --rsh='ssh -o StrictHostKeyChecking=no'                           \
                                                  /home/comptonpeslonline.com/public_html/comptonPractice/user-recorded-audio-files/   \
            comptonpeslonline.com@162.220.165.228:/home/comptonpeslonline.com/public_html/comptonPractice/user-recorded-audio-files/   ;

# fetch data from /user-recorded-audio-files/ from CURRENT server to NEW server

nohup                                                                                                                                \
 sshpass -p   'PASSWoRd'                                                                                                             \
    sudo  --user=comptonpeslonline.com  rsync --stats --archive  --rsh='ssh -o StrictHostKeyChecking=no'                             \
          comptonpeslonline.com@162.220.165.228:/home/comptonpeslonline.com/public_html/comptonPractice/user-recorded-audio-files/   \
                                                /home/comptonpeslonline.com/public_html/comptonPractice/user-recorded-audio-files/   \
&  ## run in background the first time...

# fetch data from /voicefiles/ from CURRENT server to NEW server

nohup                                                                                                                                \
 sshpass -p   'PASSWoRd'                                                                                                             \
    sudo  --user=comptonpeslonline.com  rsync --stats --archive  --rsh='ssh -o StrictHostKeyChecking=no'                             \
          comptonpeslonline.com@162.220.165.228:/home/comptonpeslonline.com/public_html/voicefiles/                                  \
                                                /home/comptonpeslonline.com/public_html/voicefiles/                                  \
&  ## run in background the first time...

# check total size:

 du  --summarize  --human-readable  /home/comptonpeslonline.com/   ;


idrive install


bash -vx  /root/server-migration/idrive/idriveInstall.bsh

# run the first time to initialize

/opt/IDriveForLinux/bin/idrive;

-1) Edit backup set and add /kvm###/ -e ## exit

# create idrive backup location and try out a test file

mkdir    /${KVM_NAME}/backup/  ; 
echo 'tester'  >  /${KVM_NAME}/backup/tester.txt   ;
ls  -l            /${KVM_NAME}/backup/tester.txt   ;

# now run idrive to see if it backs up

/bin/bash  -v     /usr/local/bash/iDriveBackup/idrivePython.bsh   ;

# this MAY have already been done, double-check: add /root/server-migration/idrive/crontab to crontab manually


final testing


## there MAY be an issue with csf.conf TESTING equal one with google-vm, so that is why we are doing that here rather than the csf.bsh script

 sed  --in-place  --expression='s/TESTING = "1"/TESTING = "0"/'    /etc/csf/csf.conf   ;    
 /bin/systemctl restart  lfd.service   ;
 /bin/systemctl restart  csf.service   ;

bash /usr/local/bash/allowIpAddress.bsh 71.223.133.89 Torguard > result.txt 2>&1 ; ### open up NEW ip ##

# #### test this was done: mkdir /var/www/html ; ### is this required ???? should it be part of a script ???

find /home/ -type f -name '*.php' -exec php -l {} ; > php-lint-test.txt 2> php-lint-test-errors.txt ; ## php lint test

 ls  -lR   /home/comptonpeslonline.com/ | grep  -u  "comptonpeslonline.com:comptonpeslonline.com"                  ;    ## double-check correct ownership!
                                                    ####   this need to be tested have "Content-type: text/html" removed and replaced with -M "text/html":

????? working ???? /home/comptonpeslonline.com/cgi-bin/email_link.pl


OPTIONALLY run phonetic transcription remotely


vi /etc/csf/csf.conf -- open ports 3306 in TCP_OUT (or do it in the GUI interface under "Temporary Allow/Deny"

# to test: /usr/bin/mariadb --verbose -A --no-auto-rehash --skip-ssl-verify-server-cert --host=162.220.165.228 --user=comptonTrnsAnls --password='XX' comptonTransAnlys ;

to modify phonetic transcription: /home/comptonpeslonline.com/cgi-bin/evalAuth0.pl line 376
sed --in-place --script='/$ComptonAccessVariables::Port/a
. ';mysql_ssl_verify_server_cert=0' ## 2026-04-18

/home/comptonpeslonline.com/public_html/lib/perl5/ComptonAccessVariables.pm ## line 137 changed localhost to 162.220.165.228 /home/comptonpeslonline.com/public_html/php/phoneticTranscriptionLogin.php ## line 61 changed localhost to 162.220.165.228

############################################################################################################################################################################################## ############################################################################################################################################################################################## ############################################################################################################################################################################################## ############################################################################################################################################################################################## ############################################################################################################################################################################################## ############################################################################################################################################################################################## ############################################################################################################################################################################################## ############################################################################################################################################################################################## ##############################################################################################################################################################################################

chown ${DOMAIN}:${DOMAIN} /home/${DOMAIN}/public_html/* ; chmod 755 /home/${DOMAIN}/public_html/* ; ls -l /home/${DOMAIN}/public_html ;

cat <<END_OF_LINKS; Try the following: http://${DOMAIN}/ http://${DOMAIN}/index.php http://${DOMAIN}/phpinfo.php http://${DOMAIN}/imageMagickTest.php END_OF_LINKS

     ################ mv  --verbose   /home/\${DIR_NAME}/   /home/\${DIR_NAME}-RENAMED/  ;

              ##  misc php archive files:
              ## already done!   rsync --verbose --archive  --rsh=ssh  /usr/local/lib/php/   root@199.231.184.26:/usr/local/lib/php/

###########################################cp --verbose /root/server-migration/php/imageMagickTest.php /home/${DOMAIN}/public_html/imageMagickTest2.php ;

####################################### bash ~/server-migration/bash-misc/chmod-them-all.bsh ; ## tar keeps losing ownership ########################################## mv --verbose /home-RENAMED/fakeperluser/ /home/ ; ########################################## mv --verbose /home-RENAMED/fakephpuser/ /home/ ;

Alter /usr/local/bash/serverUtilitzation because serverUtilization.bsh uses 'Content-type: type/html' --replace with -M "text/html"

        ##  [ -d "/usr/local/share/perl5/5.40" ] || mkdir --parent   /usr/local/share/perl5/5.40               ;   ## 2026-04-02
        #  mv      --verbose  /home/                                             /home-RENAMED/      ;
        #  mv      --verbose  /tmp/old_server_data/home/                         /home/              ;
        #  rsync   --verbose  --archive /home-RENAMED/                           /home/              ;     ## check file owners
  1. virtualmin #######################3) webmin/virtualmin/csf ####################### now need to download and ftp the install file from the website login-area rather than trying to curl it from inside the script

??????? use "--disableplugin subscription-manager" instead

sed --in-place --expression='s/enabled=1/enabled=0/;' /etc/yum/pluginconf.d/product-id.conf ; ## 2025-07-29

  1. bash -vx ./bash-misc/dnf-yum.bsh > ./bash-misc/dnf-yum.bsh.log 2>&1 ;

  2. bash -vx ./bash-misc/root-init.bsh > ./bash-misc/root-init.bsh.log 2>&1 ;

  3. ???? sed --in-place --expression='s/enabled=1/enabled=0/;' /etc/yum/pluginconf.d/product-id.conf ; ## 2025-07-29 for RL-10

  4. ffmpeg (can probably be done anytime but TEST first before starting!)

#) SKIP SKIP Mariadb UPGRADE (LET VIRTUALMIN INSTALL PHP, let github install PERL ## do before perl and php)

  1. php and /php/phpImageMagick.bsh

  2. perl/CPAN

  3. clamav

  4. ./bash-misc/mailx-postfix.bsh

  5. bash -vx ./node/bash-js.bsh ;

  6. httpd.conf/apache.bsh -- not quite ready to run manually do it

  7. contact STRIPE.COM and let them know the new IP ## on the callback hook for ajcomptonpesl.com https://www.edwardsmark.com/textpattern/articles/265/associate-stripe-api-key-with-specific-ip-number

  8. /usr/bin/bash - tar over

  9. crontab-reboot-commands

  10. fail2ban-client --version ; # make sure faile2ban-client is installed! Fail2Ban v0.11.2 at of 2012-07-22

  11. install ./bash-misc/certbot

  12. visudo for node processes

  13. copy over all crontab jobs

  14. bash -vx /node/pm2.bsh ;

  15. edit /etc/hostname and include 'edwardsmark.info'

new 2016-02-28 -- THIS IS COPIED IN WHEN DIRECTORY IS MOVED!

mkdir --verbose /home/comptonpeslonline.com/tmpVoiceSpiceFile/ ; chmod 755 --verbose /home/comptonpeslonline.com/tmpVoiceSpiceFile/ ; chown comptonpeslonline.com:comptonpeslonline.com /home/comptonpeslonline.com/tmpVoiceSpiceFile/ ;

rsync SOURCE DESTINATION

sudo -u comptonpeslonline.com rsync --verbose --archive --rsh=ssh
comptonpeslonline.com@162.220.165.228:/home/comptonpeslonline.com/public_html/comptonPractice/user-recorded-audio-files/
/home/comptonpeslonline.com/public_html/comptonPractice/user-recorded-audio-files/ ;

sudo -u comptonpeslonline.com rsync --verbose --archive --rsh=ssh
comptonpeslonline.com@162.220.165.228:/home/comptonpeslonline.com/public_html/voicefiles/
/home/comptonpeslonline.com/public_html/comptonPractice/voicefiles/ ;

one line no passord prompting:

sshpass -p 'PASSWORD'
sudo --user=comptonpeslonline.com rsync --verbose --archive --rsh=ssh
comptonpeslonline.com@162.220.165.228:/home/comptonpeslonline.com/public_html/voicefiles/
/home/comptonpeslonline.com/public_html/voicefiles/ ;

important misc php archive files:

rsync --verbose --archive --rsh=ssh /usr/local/lib/php/ root@199.231.184.26:/usr/local/lib/php/

######### ftp - START OUT WITH A WORKING DOMAIN NAME (2013-07-03) #####################https://www.digitalocean.com/community/articles/how-to-set-up-proftpd-on-centos-6 moved to sftp.bsh February 2019

rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm ; yum install ftp ; yum install proftpd ; hostname edwardsmark.com ; echo <> /etc/hosts ; 199.231.184.26 server END sed -i -e "s/ServerName whatever/ServerName myNewDomainName.com" /etc/proftpd ; service proftpd restart ; ##mkdir /home/mark ; useradd mark ; passwd mark ; ftp myNewDomainName.com ; ## test login sftp mark@127.0.0.1 ; ## 2016-02-09- notice sftp since regular ftp may not be an option anymore.

2019-11-13 - ran on centos-7/8 successfully.

chkconfig dovecot off ; ### disable dovecot from starting

2013-03-01 -- to supress messages from emailing: echo "/usr/bin/php-cgi" >> /etc/csf/csf.pignore ;

/etc/resolv.conf : nameserver 66.45.228.250 nameserver 8.8.8.8 nameserver 127.0.0.1

I use

nameserver 69.10.54.252

nameserver 66.45.251.218

nameserver 64.20.34.50

nameserver 66.45.228.250

nameserver 1.1.1.1

nameserver 8.8.8.8

(php pear??? do we need it ???)

==== bcc mail

to always bcc mail: (2014-10-17)

/etc/postfix/main.cf -- add this line: always_bcc = edwardsmarkf@gmail.com

==== httpd.conf

add this:

AddType audio/ogg .ogg .ogv
AddType audio/speex .spx

systemctl start mariadb; ## replacement for mysql 2015-12-18

below stuff may be obsolete:

2014-01-05 added by mark - test to make sure that mysql started, if not, remove

the sock file and try again

if [ $(/etc/init.d/mysqld status | grep 'mysqld (pid .*) is running' | wc --lines) -gt 0 ]; then echo 'mysql successfully started -- no action taken'; else echo $0 'mysql did NOT start successfully -- removing the sock and restarting.....'; [ -e /var/lib/mysql/mysql.sock ] && rm /var/lib/mysql/mysql.sock; /etc/init.d/mysqld start; /bin/mail -v -r info@edwardsmarkf.info -s 'mysql start failure notice' mark@edwardsmark.com <<END $(/bin/date) $0 mysql did not start on reboot -- removing sock and trying again please see /var/log/boot.log file for more details END fi;

=================================

==== (OBSOLETE ftp auto-login: (2013-05-10) echo 'machine ftp.adrive.com login mark@edwardsmark.com password JABBERWOLKY' >> ~/.netrc ; chmod 600 ~/.netrc ;

=== two ways to manage dns records ===============

A: using interserver name server

  1. log into the my.interserver.net control panel
  2. Domains---->DNS-Manager (domains is next to "home" second from left)
  3. "Add New DNS Entry" - enter clients domain name and interserver.net ip address 69.10.48.25
  4. click on the little wrench on the far right
  5. create 5 new mx records

B: using our own customized name server and virtualmin:

  1. create ns1/2.XXXX.com subdomains and point "A" records to 69.10.48.25
  2. use nameserver from step one for given domain
  3. log into virtualmin and select(or create) new virtual-server (new website)
  4. ServerConfiguration--->DNS_Records
  5. enter 5 new mx records using "Create Record of Type" button at bottom (be sure to select MX)

======== authorized dns =================== Primary DNS - cdns1.interserver.net 209.159.155.28 Secondary DNS - cdns2.interserver.net 66.45.228.248

OBSOLETE

flvar admin files - THIS MIGHT NOT WORK PROPERLY......

rsync --verbose --archive --rsh=ssh /usr/share/red5/webapps/ root@199.231.184.26:/usr/share/red5/webapps/

==== /etc/init.d/rc.local: (2014-11-02)

mount -a ; ## 2013-05-14 mounts up the stuff in the fstab file /etc/init.d/red5 start >/usr/share/red5/red5.log 2>&1

## ddos-deflate installation 2016-04-20

chmod 0700 install.sh

./install.sh

## dont forget jQuery ! (?)

rsync --verbose --archive --rsh=ssh /usr/local/jquery/ root@edwardsmarkf.info:/usr/local/jquery/

                                               ## mkdir  --verbose  /usr/local/bash/      ;
                                               ## mkdir  --verbose  /usr/local/lib/php/   ;

manually add/edit these to /etc/httpd/conf/httpd.conf: (carouselhouse.com still shows in the OLD httpd.conf, so we ignore it)

SSLCertificateFile /home/accentreduction.online/ssl.cert
SSLCertificateKeyFile /home/accentreduction.online/ssl.key
SSLCertificateChainFile /home/accentreduction.online/ssl.ca

SSLCertificateFile /home/ajcomptonpesl.com/ssl.cert
SSLCertificateKeyFile /home/ajcomptonpesl.com/ssl.key
SSLCertificateChainFile /home/ajcomptonpesl.com/ssl.ca

SSLCertificateFile /home/comptonpeslonline.com/ssl.cert
SSLCertificateKeyFile /home/comptonpeslonline.com/ssl.key
SSLCertificateChainFile /home/comptonpeslonline.com/ssl.ca

SSLCertificateFile /home/comptonpeslonline.info/ssl.cert
SSLCertificateKeyFile /home/comptonpeslonline.info/ssl.key
SSLCertificateChainFile /home/comptonpeslonline.info/ssl.ca

SSLCertificateFile /home/edwardsmark.com/ssl.cert
SSLCertificateKeyFile /home/edwardsmark.com/ssl.key
SSLCertificateChainFile /home/edwardsmark.com/ssl.ca

SSLCertificateFile /home/englishwithoutaccent.com/ssl.cert
SSLCertificateKeyFile /home/englishwithoutaccent.com/ssl.key
SSLCertificateChainFile /home/englishwithoutaccent.com/ssl.ca

SSLCertificateFile /home/gordonredwards.com/ssl.cert
SSLCertificateKeyFile /home/gordonredwards.com/ssl.key
SSLCertificateChainFile /home/gordonredwards.com/ssl.ca

SSLCertificateFile /home/slrh.org/ssl.cert
SSLCertificateKeyFile /home/slrh.org/ssl.key

apachectl configtest ;

apachectl restart ;

cp --verbose /etc/httpd/conf/httpd.conf ./httpd.conf ;

sed --in-place --file=- ./httpd.conf <<END_OF_GENERIC_SED ; s?^ SSLCertificateFile /? #### &?; s?^ SSLCertificateKeyFile /? #### &?; END_OF_GENERIC_SED

sed --file=- ./httpd.conf <<END_OF_ACCENTREDUCTION_ONLINE_SED > x.x ; /RewriteRule .well-known). https://accentreduction.online:10000//,/VirtualHost/{/#SSLCertificateKeyFile/a
####\n
SSLCertificateFile /home/accentreduction.online/ssl.cert\n
SSLCertificateKeyFile /home/accentreduction.online/ssl.key } END_OF_ACCENTREDUCTION_ONLINE_SED

sed --file=- ./httpd.conf <<END_OF_AJCOMPTONPESL_COM_SED > x.x ; /RewriteRule .well-known). https://ajcomptonpesl.com:10000//,/VirtualHost/{/#SSLCertificateKeyFile/a
####\n
SSLCertificateFile /home/ajcomptonpesl.com/ssl.cert\n
SSLCertificateKeyFile /home/ajcomptonpesl.com/ssl.key } END_OF_AJCOMPTONPESL_COM_SED

sed --file=- ./httpd.conf <<END_OF_COMPTONPESLONLINE_COM_SED > x.x ; /RewriteRule .well-known). https://comptonpeslonline.com:10000//,/VirtualHost/{/#SSLCertificateKeyFile/a
####\n
SSLCertificateFile /home/comptonpeslonline.com/ssl.cert\n
SSLCertificateKeyFile /home/comptonpeslonline.com/ssl.key } END_OF_COMPTONPESLONLINE_COM_SED

sed --file=- ./httpd.conf <<END_OF_COMPTONPESLONLINE_INFO_SED > x.x ; /RewriteRule .well-known). https://comptonpeslonline.info:10000//,/VirtualHost/{/#SSLCertificateKeyFile/a
####\n
SSLCertificateFile /home/comptonpeslonline.info/ssl.cert\n
SSLCertificateKeyFile /home/comptonpeslonline.info/ssl.key } END_OF_COMPTONPESLONLINE_INFO_SED

sed --file=- ./httpd.conf <<END_OF_EDWARDSMARK_COM_SED > x.x ; /RewriteRule .well-known). https://edwardsmark.com:10000//,/VirtualHost/{/#SSLCertificateKeyFile/a
####\n
SSLCertificateFile /home/edwardsmark.com/ssl.cert\n
SSLCertificateKeyFile /home/edwardsmark.com/ssl.key } END_OF_EDWARDSMARK_COM_SED

sed --file=- ./httpd.conf <<END_OF_ENGLISHWITHOUTACCENT_COM_SED > x.x ; /RewriteRule .well-known). https://englishwithoutaccent.com:10000//,/VirtualHost/{/#SSLCertificateKeyFile/a
####\n
SSLCertificateFile /home/englishwithoutaccent.com/ssl.cert\n
SSLCertificateKeyFile /home/englishwithoutaccent.com/ssl.key } END_OF_ENGLISHWITHOUTACCENT_COM_SED

sed --file=- ./httpd.conf <<END_OF_GORDONREDWARDS_COM_SED > x.x ; /RewriteRule .well-known). https://gordonredwards.com:10000//,/VirtualHost/{/#SSLCertificateKeyFile/a
####\n
SSLCertificateFile /home/gordonredwards.com/ssl.cert\n
SSLCertificateKeyFile /home/gordonredwards.com/ssl.key } END_OF_GORDONREDWARDS_COM_SED

sed --file=- ./httpd.conf <<END_OF_SLRH_ORG_SED > x.x ; /RewriteRule .well-known). https://slrh.org:10000//,/VirtualHost/{ /SSLCertificateKeyFile /etc/ssl/virtualmin//a
####\n
SSLCertificateFile /home/slrh.org/ssl.cert\n
SSLCertificateKeyFile /home/slrh.org/ssl.key } END_OF_SLRH_ORG_SED

        ######## find  .  -name   mariadbDumpAllDatabases.bsh                                        ;   ## optional
        ######## vi  ./server-migration/mariadb/migration/mariadbDumpAllDatabases.bsh                ;  ## change password  (or use sed)  
        ########                    ## --OR--   ## CHANGE THE HARDCODED  PASSWORD !

echo ' ' > /home/${DOMAIN}/public_html/phpinfo.php ;

cat <<END_OF_MOVE | export PHP_VERSION='php8.5' ; ## the name of the etc directory export TMP_LOCATION=/tmp/old_server_data/ ; ## cd ${TMP_LOCATION} ; mv --verbose ${TMP_LOCATION}/bash_history ~ ; mv --verbose ${TMP_LOCATION}/kvm301_httpd_conf ~ ;

for DIR_NAME in $(ls ${TMP_LOCATION}/home/ ) ; do echo " processing: ${DIR_NAME}" ; if [[ -d /home/${DIR_NAME}/ ]]; then cp --verbose /home/${DIR_NAME}/etc/${PHP_VERSION}/php.ini /tmp/php.ini ; ## save php.ini

       tar   --create --gzip    --file=/tmp/\${DIR_NAME}.gz              /home/\${DIR_NAME}/                       ;   ## save virtualmin created VM
       rm    --verbose  --force --recursive                              /home/\${DIR_NAME}/                       ;
       mv    --verbose  \${TMP_LOCATION}/home/\${DIR_NAME}/              /home/\${DIR_NAME}/                       ;
       mv    --verbose  /home/\${DIR_NAME}/etc                           /home/\${DIR_NAME}/etc-RENAMED            ;   ## save OLD php 7.x stuff
       mv    --verbose  /tmp/\${DIR_NAME}.gz                             /home/\${DIR_NAME}/                       ;   ## move zipped virtualmin 
       mkdir --verbose  --parent /home/\${DIR_NAME}/etc/\${PHP_VERSION}/                                           ; 
       mv    --verbose   /tmp/php.ini                                    /home/\${DIR_NAME}/etc/\${PHP_VERSION}/   ;
       ln    --symbolic  \${PHP_VERSION}/php.ini                         /home/\${DIR_NAME}/etc/php.ini            ;
   fi

done

rsync --verbose --archive ${TMP_LOCATION}/etc/letsencrypt/ /etc/letsencrypt/ ; mv --verbose ${TMP_LOCATION}/usr/local/bash/ /usr/local/ ; mv --verbose ${TMP_LOCATION}/usr/local/lib/php/ /usr/local/lib/ ; cat ${TMP_LOCATION}/crontab.txt | crontab - ;
# quick way to load crontab from old server!

apachectl restart && apachectl status ; # have to restart apache since the ssl stuff was moved around.

bash -vx ~/server-migration/bash-misc/chown-them-all.bsh > ~/server-migration/bash-misc/chown-them-all.bsh.log 2>&1 ; END_OF_MOVE nohup time bash -vx - > ~/current-server-tar-gz-move.log 2>&1 & ## detach

tar --verbose --create --file=/tmp/etc-${DIR_NAME}.tar /home/${DIR_NAME}/etc/ ; ## save new php 8.5 php.ini file for later restore

ls -l /tmp/etc-${DIR_NAME}.tar ;

tar --verbose --extract --file=/home/${DIR_NAME}/etc-${DIR_NAME}.tar ; ## restore new php 8.5 php.ini file

mv --verbose /tmp/etc-${DIR_NAME}.tar ls -l /home/${DIR_NAME}/ ;

cat <<END_OF_CURRENT_SERVER | bash -vx ./server-migration/mariadb/migration/mariadbDumpAllDatabases.bsh ; ## on OLD server!

  cp   --verbose    /etc/httpd/conf/httpd.conf                         /home/mark/kvm301_httpd_conf  ;  ## 2026-04-15
  gzip --verbose                                                       /home/mark/kvm301_httpd_conf  ;  ## 2026-04-15

  crontab  -l         >  /home/mark/crontab.txt  ;  gzip  /home/mark/crontab.txt                  ;
  tar --create --gunzip   --file=/home/mark/usr_local_bash.tar.gz      /usr/local/bash/           ;
  tar --create --gunzip   --file=/home/mark/usr_local_lib_php.tar.gz   /usr/local/lib/php/        ;
  tar --create --gunzip   --file=/home/mark/letsencrypt.tar.gz         /etc/letsencrypt           ;

certbot certificates 2>/dev/null | grep -v 'edwardsmark.com-0001' | grep ' Path: /etc/letsencrypt' | sed --expression='s/^.*Path: //' | sort | tee list-of-certs.txt | xargs ls -l | sed --expression='s?^.archive?/etc/letsencrypt/archive?' >> list-of-certs.txt && tar -vcf test.tar --files-from=list-of-certs.txt ; tar --create --gunzip --file=/home/mark/home.tar.gz
--exclude='/home/mark'
--exclude='
.opus'
--preserve-permissions
--same-owner
/home/ ; ## its very debatable if preserve-permissions and same-owner are necessary since somehow they end up getting changed on the new server. ## is the two --exclude statements working together??? the overall size of /home/ sure is smaller than before.

  #
  history                                                          >   /home/mark/bash_history    ;   
  chmod  --verbose  755                                                /home/mark/bash_history    ;  
  gzip                                                                 /home/mark/bash_history    ;
  #
  ls  -lh   /home/mark/*.gz                                                                       ;
  du  -hs   /home/mark/*.gz ;   ##  confirm 63 megabyte size for mariadb-database-tar.gz

END_OF_CURRENT_SERVER

About

marks server migration

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages