-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathREADME
More file actions
916 lines (571 loc) · 42.4 KB
/
README
File metadata and controls
916 lines (571 loc) · 42.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
############################################################
# #
# n e w s e r v e r i n i t i a l i z a t i o n #
# #
############################################################
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 /kvm501/ ; ## 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 ~/server-migration/ ;
time bash -vx ~/server-migration/Master_Installer.bsh > ~/server-migration/Master_Installer.bsh.log 2>&1 ;
END_OF_INITIALIZATION
nohup time bash -vx - > ~/do-all-the-work.bsh.log 2>&1 &
#####################################################################
# #
# c u r r e n t s e r v e r d a t a e x t r a c t i o n #
# #
#####################################################################
## on CURRENT server: (NOTE LENGTH OF TIME!!)
rm -Rf /tmp/old_server_data ; mkdir /tmp/old_server_data && 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 ;
sed --in-place --expression='1,/CHANGE-THIS/s/CHANGE-THIS/NewPassWordGoesHere/;' ./server-migration/mariadb/migration/mariadbDumpAllDatabases.bsh ;
grep '^MARIADB_PASSWORD=' ./server-migration/mariadb/migration/mariadbDumpAllDatabases.bsh ;
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 ;
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
nohup time nice bash -vx - > ./current-server-tar-gz-creates.log 2>&1 & ## detach
du --summarize --human-readable /home/mark/*.gz ;
########################################################
# #
# f e t c h d a t a t o n e w s e r v e r #
# #
########################################################
## on new server: (30 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 'MYpASSWORDfORaCCTmARK' sftp -o StrictHostKeyChecking=no mark@162.220.165.228 ; ## grab stuff from OLD server!
sftp> ls -lh ## human readable file size /home/ one is 34.x 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!
ls -lh ${TMP_LOCATION}/*.gz ;
du --human-readable --summarize ${TMP_LOCATION}/*.gz ;
############################################################################
# #
# p r e l i m i n a r y t e s t i n g #
# #
############################################################################
######################################
# p r e l i m i n i a r y #
######################################
more ~/ffmpeg-install-logs/99-test.bsh.log ; ### look for results
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?
##############################
# p h p t e s t i n g #
##############################
bash -vx ~/server-migration/php/02_php_testing.bsh ;
su fakephpuser --command "/bin/composer --version ; " && echo $? ;
################################
# p e r l t e s t i n g #
################################
###more ~/server-migration/perl/README ## look for tests
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 ~/server-migration/perl/perl-cgi-testing.bsh ;
######################################
# m a r i a d b t e s t i n g #
######################################
echo 'SELECT VERSION() "Version:" ;' | mariadb && echo $? ;
bash ~/server-migration/mariadb/05_test_perl_mariadb_connection.bsh && echo $? ;
bash ~/server-migration/mariadb/05_test_php_mariadb_connection.bsh && echo $? ;
#######################
# c l e a n u p #
#######################
virtualmin delete-domain --domain ${DOMAIN} ;
userdel --remove fakeperluser ;
userdel --remove fakephpuser ;
ls -l /home/ ;
######################################################################
# #
# u n p a c k a l l t h e c u r r e n t d a t a #
# #
######################################################################
# 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 - > ~/current-server-tar-gz-unpack.log 2>&1 & ## detach
ls -lh ${TMP_LOCATION} ;
du --summarize --human-readable ${TMP_LOCATION} ; ## 21 gigs
ls -lR ${TMP_LOCATION} | wc --lines ; ## 507000+
### rm --verbose --force ${TMP_LOCATION}/home.tar ; # we MAY need this for space!
######################################################################
# #
# c r e a t e a l l v i r t u a l s e r v e r s #
# #
######################################################################
cat <<CREATE_ALL_VIRTUAL_SERVERS |
bash -vx ~/server-migration/webmin/virtualmin-create-vm.bsh > ~/server-migration/webmin/virtualmin-create-vm.bsh.log 2>&1 ;
bash -vx ~/server-migration/httpd.conf/apache.bsh > ~/server-migration/httpd.conf/apache.bsh.log 2>&1 ;
[ ! -d "/var/www/html/" ] && mkdir /var/www/html/ ; ## 2026-04-13
systemctl restart httpd.service ; ##
apachectl status ;
CREATE_ALL_VIRTUAL_SERVERS
nohup time bash -vx - > ~/create-all-virtual-servers.log 2>&1 & ## detach
###################################################
# #
# m a r i a d b d a t a i n s t a l l #
# #
###################################################
## 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='CHANGE-THIS'/" ~/server-migration/mariadb/migration/create_db_and_users.bsh ; ## edit and add password!
grep '^password=' ~/server-migration/mariadb/migration/create_db_and_users.bsh ; ## inspect it
bash ~/server-migration/mariadb/migration/create_db_and_users.bsh > ${TMP_LOCATION}/create_db_and_users.sql ;
cat ${TMP_LOCATION}/create_db_and_users.sql ;
mariadb --verbose < ${TMP_LOCATION}/create_db_and_users.sql ;
bash ~/server-migration/mariadb/migration/create_db_and_users.bsh \
| grep TEMP_SQL_LOCATION \
| sed -e 's/.* ### //; s/ ## //;1i 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
nohup time bash -vx ${TMP_LOCATION}/load_sql_tables.bsh > ~/load_sql_tables.bsh.log 2>&1 & ## run the newly created bash script approx 30 minutes run time
du --summarize --human-readable /var/lib/mysql/ ; ## check for total size 1.4 gigs
mariadb-secure-installation; ## IMPORTANT!
mariadb-show --count ; ## spot-check the number of rows!
######################################################################
# #
# m o v e d a t a t o p r o p e r l o c a t i o n s #
# #
######################################################################
##### 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 &
#######################################################
# #
# p m 2 . i n i t i a l i z e . b s h #
# #
#######################################################
### ? ? ? ? npm install uuid@latest ; ### ? ? ? ? ? https://stackoverflow.com/questions/68170853/npm-warn-deprecated-uuid3-4-0-please-upgrade-to-version-7-or-higher
bash -vx ~/server-migration/httpd.conf/pm2-httpd-conf-initialize.bsh > ~/server-migration/httpd.conf/pm2-httpd-conf-initialize.bsh.log 2>&1 ;
tail -100 ~/server-migration/httpd.conf/pm2-httpd-conf-initialize.bsh.log ;
apachectl configtest && apachectl status ;
nohup bash -vx ~/server-migration/node/pm2-initialize.bsh > ~/server-migration/node/pm2-initialize.bsh.log 2>&1 &
pm2 status ; ## look for all of them "status online"
bash -vx ~/server-migration/node/visudo.bsh > ~/server-migration/node/visudo.bsh.log 2>&1 ;
apachectl status ; ### or restart - not sure why this was required on 2026-04-02
#######################################################
# #
# t e s t t h e r e c o r d e r #
# #
#######################################################
## 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 - n a i l - p o s t f i x . b s h #
# #
#######################################################
## first get password from Google: https://myaccount.google.com/apppasswords
## or just use the one already in the php-mailer!
bash ~/server-migration/s-nail/s-nail-postfix.bsh ;
php /usr/local/lib/php/SMTPMailer-tester.php ; ## test the php mail sender
##########################
# #
# 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/ ;
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...
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...
#####################################
# #
# i d r i v e i n s t a l l #
# #
#####################################
bash -vx /root/server-migration/idrive/idriveInstall.bsh
/opt/IDriveForLinux/bin/idrive;
1) Edit backup set and add /kvm###/
e ## exit
mkdir /${KVM_NAME}/backup/ ;
echo 'tester' > /${KVM_NAME}/backup/tester.txt ;
/bin/bash -v /usr/local/bash/iDriveBackup/idrivePython.bsh ;
add ./server-migration/idrive/crontab to crontab manually
##################################
# #
# f i n a l t e s t i n g #
# #
##################################
## 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 ;
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
##############################################################################
# #
# r u n p h o n e t i c t r a n s c r i p t i o n r e m o t e l y #
# #
##############################################################################
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
3) 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
4) bash -vx ./bash-misc/dnf-yum.bsh > ./bash-misc/dnf-yum.bsh.log 2>&1 ;
5) bash -vx ./bash-misc/root-init.bsh > ./bash-misc/root-init.bsh.log 2>&1 ;
6) ### ???? sed --in-place --expression='s/enabled=1/enabled=0/;' /etc/yum/pluginconf.d/product-id.conf ; ## 2025-07-29 for RL-10
7) 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)
8) php and /php/phpImageMagick.bsh
9) perl/CPAN
09) clamav
20) ./bash-misc/mailx-postfix.bsh
40) bash -vx ./node/bash-js.bsh ;
41) httpd.conf/apache.bsh -- not quite ready to run manually do it
42) 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
42) /usr/bin/bash - tar over
50) crontab-reboot-commands
60) fail2ban-client --version ; # make sure faile2ban-client is installed! Fail2Ban v0.11.2 at of 2012-07-22
70) install ./bash-misc/certbot
80) visudo for node processes
90) copy over all crontab jobs
95) bash -vx /node/pm2.bsh ;
100) 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 <<END >> /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 ;
## written from http://configserver.com/free/csf/install.txt
/etc/resolv.conf :
nameserver 66.45.228.250
nameserver 8.8.8.8
nameserver 127.0.0.1
#### https://www.interserver.net/forum/threads/strange-error-message-sending-email-on-kvm275.20548/
# 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
#### wget http://www.inetbase.com/scripts/ddos/install.sh
#### 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 '<?php echo $_SERVER["USER"] ; echo " Current script owner: " . get_current_user(); phpinfo(); ?> ' > /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}/ ;