-
Notifications
You must be signed in to change notification settings - Fork 0
/
ubuntu_lnmp_with_php5.3.sh
executable file
·996 lines (856 loc) · 33.9 KB
/
ubuntu_lnmp_with_php5.3.sh
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
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
# Check if user is root
if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this script, please use root to install lnmp"
exit 1
fi
clear
printf "=========================================================================\n"
printf "Manager Nginx+MySQL+PHP+FPM, based on LNMP.\n"
printf "Support Ubuntu now...\n"
printf "=========================================================================\n"
cur_dir=$(pwd)
#set mysql root password
mysqlrootpwd="root"
echo "Please input the root password of mysql:"
read -p "(Default password: root):" mysqlrootpwd
if [ "$mysqlrootpwd" = "" ]; then
mysqlrootpwd="root"
fi
echo "==========================="
echo "mysqlrootpwd=$mysqlrootpwd"
echo "==========================="
#do you want to install the InnoDB Storage Engine?
echo "==========================="
installinnodb="n"
echo "Do you want to install the InnoDB Storage Engine?"
read -p "(Default no,if you want please input: y ,if not please press the enter button):" installinnodb
case "$installinnodb" in
y|Y|Yes|YES|yes|yES|yEs|YeS|yeS)
echo "You will install the InnoDB Storage Engine"
installinnodb="y"
;;
n|N|No|NO|no|nO)
echo "You will NOT install the InnoDB Storage Engine!"
installinnodb="n"
;;
*)
echo "INPUT error,The InnoDB Storage Engine will NOT install!"
installinnodb="n"
esac
#which PHP Version do you want to install?
echo "==========================="
isinstallphp53="n"
echo "Install PHP 5.3.28,Please input y"
echo "Install PHP 5.2.17,Please input n or press Enter"
read -p "(Please input y or n):" isinstallphp53
case "$isinstallphp53" in
y|Y|Yes|YES|yes|yES|yEs|YeS|yeS)
echo "You will install PHP 5.3.28"
isinstallphp53="y"
;;
n|N|No|NO|no|nO)
echo "You will install PHP 5.2.17"
isinstallphp53="n"
;;
*)
echo "INPUT error,You will install PHP 5.2.17"
isinstallphp53="n"
esac
#which MySQL Version do you want to install?
echo "==========================="
isinstallmysql55="n"
echo "Install MySQL 5.5.37,Please input y"
echo "Install MySQL 5.1.73,Please input n or press Enter"
echo "Install MariaDB 5.5.37,Please input md"
read -p "(Please input y , n or md):" isinstallmysql55
case "$isinstallmysql55" in
y|Y|Yes|YES|yes|yES|yEs|YeS|yeS)
echo "You will install MySQL 5.5.37"
isinstallmysql55="y"
;;
n|N|No|NO|no|nO)
echo "You will install MySQL 5.1.73"
isinstallmysql55="n"
;;
md|MD|Md|mD)
echo "You will install MariaDB 5.5.37"
isinstallmysql55="md"
;;
*)
echo "INPUT error,You will install MySQL 5.1.73"
isinstallmysql55="n"
esac
get_char()
{
SAVEDSTTY=`stty -g`
stty -echo
stty cbreak
dd if=/dev/tty bs=1 count=1 2> /dev/null
stty -raw
stty echo
stty $SAVEDSTTY
}
echo ""
echo "Press any key to start..."
char=`get_char`
InitInstall()
{
cat /etc/issue
uname -a
MemTotal=`free -m | grep Mem | awk '{print $2}'`
echo -e "\n Memory is: ${MemTotal} MB "
apt-get update
apt-get remove -y apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd
killall apache2
dpkg -l |grep mysql
dpkg -P libmysqlclient15off libmysqlclient15-dev mysql-common
dpkg -l |grep apache
dpkg -P apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2.2-common
dpkg -l |grep php
dpkg -P php5 php5-common php5-cgi php5-mysql php5-curl php5-gd
apt-get purge `dpkg -l | grep php| awk '{print $2}'`
#Synchronization time
rm -rf /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
apt-get install -y ntpdate
ntpdate -u pool.ntp.org
date
#Disable SeLinux
if [ -s /etc/selinux/config ]; then
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
fi
if [ -s /etc/ld.so.conf.d/libc6-xen.conf ]; then
sed -i 's/hwcap 1 nosegneg/hwcap 0 nosegneg/g' /etc/ld.so.conf.d/libc6-xen.conf
fi
apt-get update
apt-get autoremove -y
apt-get -fy install
apt-get install -y build-essential gcc g++ make
for packages in build-essential gcc g++ make cmake automake autoconf re2c wget cron bzip2 libzip-dev libc6-dev file rcconf flex vim nano bison m4 gawk less make cpp binutils diffutils unzip tar bzip2 libbz2-dev unrar p7zip libncurses5-dev libncurses5 libncurses5-dev libncurses5-dev libtool libevent-dev libpcre3 libpcre3-dev libpcrecpp0 libssl-dev zlibc openssl libsasl2-dev libltdl3-dev libltdl-dev libmcrypt-dev zlib1g zlib1g-dev libbz2-1.0 libbz2-dev libglib2.0-0 libglib2.0-dev libpng3 libjpeg62 libjpeg62-dev libjpeg-dev libpng-dev libpng12-0 libpng12-dev curl libcurl3 libmhash2 libmhash-dev libpq-dev libpq5 gettext libncurses5-dev libcurl4-gnutls-dev libjpeg-dev libpng12-dev libxml2-dev zlib1g-dev libfreetype6 libfreetype6-dev libssl-dev libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev mcrypt libcap-dev diffutils ca-certificates debian-keyring debian-archive-keyring;
do apt-get install -y $packages --force-yes;apt-get -fy install;apt-get -y autoremove; done
}
CheckAndDownloadFiles()
{
echo "============================check files=================================="
if [ "$isinstallphp53" = "n" ]; then
if [ -s php-5.2.17.tar.gz ]; then
echo "php-5.2.17.tar.gz [found]"
else
echo "Error: php-5.2.17.tar.gz not found!!!download now......"
wget -c http://soft.vpser.net/web/php/php-5.2.17.tar.gz
fi
if [ -s php-5.2.17-fpm-0.5.14.diff.gz ]; then
echo "php-5.2.17-fpm-0.5.14.diff.gz [found]"
else
echo "Error: php-5.2.17-fpm-0.5.14.diff.gz not found!!!download now......"
wget -c http://soft.vpser.net/web/phpfpm/php-5.2.17-fpm-0.5.14.diff.gz
fi
else
if [ -s php-5.3.28.tar.gz ]; then
echo "php-5.3.28.tar.gz [found]"
else
echo "Error: php-5.3.28.tar.gz not found!!!download now......"
wget -c http://soft.vpser.net/web/php/php-5.3.28.tar.gz
fi
fi
if [ -s memcache-3.0.6.tgz ]; then
echo "memcache-3.0.6.tgz [found]"
else
echo "Error: memcache-3.0.6.tgz not found!!!download now......"
wget -c http://soft.vpser.net/web/memcache/memcache-3.0.6.tgz
fi
if [ -s pcre-8.12.tar.gz ]; then
echo "pcre-8.12.tar.gz [found]"
else
echo "Error: pcre-8.12.tar.gz not found!!!download now......"
wget -c http://soft.vpser.net/web/pcre/pcre-8.12.tar.gz
fi
if [ -s nginx-1.6.0.tar.gz ]; then
echo "nginx-1.6.0.tar.gz [found]"
else
echo "Error: nginx-1.6.0.tar.gz not found!!!download now......"
wget -c http://soft.vpser.net/web/nginx/nginx-1.6.0.tar.gz
fi
if [ "$isinstallmysql55" = "n" ]; then
if [ -s mysql-5.1.73.tar.gz ]; then
echo "mysql-5.1.73.tar.gz [found]"
else
echo "Error: mysql-5.1.73.tar.gz not found!!!download now......"
wget -c http://soft.vpser.net/datebase/mysql/mysql-5.1.73.tar.gz
fi
elif [ "$isinstallmysql55" = "y" ]; then
if [ -s mysql-5.5.37.tar.gz ]; then
echo "mysql-5.5.37.tar.gz [found]"
else
echo "Error: mysql-5.5.37.tar.gz not found!!!download now......"
wget -c http://soft.vpser.net/datebase/mysql/mysql-5.5.37.tar.gz
fi
else
if [ -s mariadb-5.5.37.tar.gz ]; then
echo "mariadb-5.5.37.tar.gz [found]"
else
echo "Error: mariadb-5.5.37.tar.gz not found!!!download now......"
wget -c http://soft.vpser.net/datebase/mariadb/mariadb-5.5.37.tar.gz
fi
fi
if [ -s libiconv-1.14.tar.gz ]; then
echo "libiconv-1.14.tar.gz [found]"
else
echo "Error: libiconv-1.14.tar.gz not found!!!download now......"
wget -c http://soft.vpser.net/web/libiconv/libiconv-1.14.tar.gz
fi
if [ -s libmcrypt-2.5.8.tar.gz ]; then
echo "libmcrypt-2.5.8.tar.gz [found]"
else
echo "Error: libmcrypt-2.5.8.tar.gz not found!!!download now......"
wget -c http://soft.vpser.net/web/libmcrypt/libmcrypt-2.5.8.tar.gz
fi
if [ "$isinstallphp53" = "n" ]; then
if [ -s phpmyadmin-latest.tar.gz ]; then
echo "phpmyadmin-latest.tar.gz [found]"
else
echo "Error: phpmyadmin-latest.tar.gz not found!!!download now......"
wget -c http://soft.vpser.net/datebase/phpmyadmin/phpmyadmin-latest.tar.gz
fi
else
if [ -s phpMyAdmin-lasest.tar.gz ]; then
echo "phpMyAdmin-lasest.tar.gz [found]"
else
echo "Error: phpMyAdmin-lasest.tar.gz not found!!!download now......"
wget -c http://soft.vpser.net/datebase/phpmyadmin/phpMyAdmin-lasest.tar.gz
fi
fi
if [ -s p.tar.gz ]; then
echo "p.tar.gz [found]"
else
echo "Error: p.tar.gz not found!!!download now......"
wget -c http://soft.vpser.net/prober/p.tar.gz
fi
if [ -s autoconf-2.13.tar.gz ]; then
echo "autoconf-2.13.tar.gz [found]"
else
echo "Error: autoconf-2.13.tar.gz not found!!!download now......"
wget -c http://soft.vpser.net/lib/autoconf/autoconf-2.13.tar.gz
fi
if [ -s libxml2-2.7.8.tar.gz ]; then
echo "libxml2-2.7.8.tar.gz [found]"
else
echo "Error: libxml2-2.7.8.tar.gz not found!!!download now......"
wget -c http://soft.vpser.net/lib/libxml/libxml2-2.7.8.tar.gz
fi
if [ -s mysql-openssl.patch ]; then
echo "mysql-openssl.patch [found]"
else
echo "Error: mysql-openssl.patch not found!!!download now......"
wget -c http://soft.vpser.net/lnmp/ext/mysql-openssl.patch
fi
if [ -s freetype-2.4.12.tar.gz ]; then
echo "freetype-2.4.12.tar.gz [found]"
else
echo "Error: freetype-2.4.12.tar.gz not found!!!download now......"
wget -c http://soft.vpser.net/lib/freetype/freetype-2.4.12.tar.gz
fi
echo "============================check files=================================="
}
InstallDependsAndOpt()
{
cd $cur_dir
tar zxf autoconf-2.13.tar.gz
cd autoconf-2.13/
./configure --prefix=/usr/local/autoconf-2.13
make && make install
cd ../
cd $cur_dir
tar zxf libiconv-1.14.tar.gz
cd libiconv-1.14/
./configure
make && make install
cd ../
cd $cur_dir
tar zxf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make && make install
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make && make install
cd ../../
ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
cd $cur_dir
tar zxf libxml2-2.7.8.tar.gz
cd libxml2-2.7.8/
./configure --prefix=/usr
make && make install
cd ../
cd $cur_dir
tar zxf freetype-2.4.12.tar.gz
cd freetype-2.4.12/
./configure --prefix=/usr/local/freetype
make && make install
cd ../
cat > /etc/ld.so.conf.d/freetype.conf<<EOF
/usr/local/freetype/lib
EOF
ldconfig
ln -sf /usr/local/freetype/include/freetype2 /usr/local/include
ln -sf /usr/local/freetype/include/ft2build.h /usr/local/include
if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then
ln -s /usr/lib/x86_64-linux-gnu/libpng* /usr/lib/
ln -s /usr/lib/x86_64-linux-gnu/libjpeg* /usr/lib/
else
ln -s /usr/lib/i386-linux-gnu/libpng* /usr/lib/
ln -s /usr/lib/i386-linux-gnu/libjpeg* /usr/lib/
fi
ulimit -v unlimited
if [ ! `grep -l "/lib" '/etc/ld.so.conf'` ]; then
echo "/lib" >> /etc/ld.so.conf
fi
if [ ! `grep -l '/usr/lib' '/etc/ld.so.conf'` ]; then
echo "/usr/lib" >> /etc/ld.so.conf
fi
if [ -d "/usr/lib64" ] && [ ! `grep -l '/usr/lib64' '/etc/ld.so.conf'` ]; then
echo "/usr/lib64" >> /etc/ld.so.conf
fi
if [ ! `grep -l '/usr/local/lib' '/etc/ld.so.conf'` ]; then
echo "/usr/local/lib" >> /etc/ld.so.conf
fi
ldconfig
cat >>/etc/security/limits.conf<<eof
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535
eof
echo "fs.file-max=65535" >> /etc/sysctl.conf
}
InstallMySQL51()
{
echo "============================Install MySQL 5.1.73=================================="
cd $cur_dir
rm -f /etc/my.cnf
rm -f /etc/mysql/my.cnf
rm -rf /etc/mysql/
apt-get remove -y mysql-server
apt-get remove -y mysql-common mysql-client
cd $cur_dir
tar zxf mysql-5.1.73.tar.gz
cd mysql-5.1.73/
if [ $installinnodb = "y" ]; then
./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-assembler --with-mysqld-ldflags=-all-static --with-charset=utf8 --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=innobase
else
./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-assembler --with-mysqld-ldflags=-all-static --with-charset=utf8 --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile
fi
cat Makefile | sed '/set -ex;/,/done/d' > Makefile.1
rm Makefile
mv Makefile.1 Makefile
make && make install
cd ../
groupadd mysql
useradd -s /sbin/nologin -g mysql mysql
cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
sed -i 's/skip-locking/skip-external-locking/g' /etc/my.cnf
if [ $installinnodb = "y" ]; then
sed -i 's:#innodb:innodb:g' /etc/my.cnf
fi
/usr/local/mysql/bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql
ln -s /usr/local/mysql/share/mysql /usr/share/
chown -R mysql /usr/local/mysql/var
chgrp -R mysql /usr/local/mysql/.
cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql
chmod 755 /etc/init.d/mysql
cat > /etc/ld.so.conf.d/mysql.conf<<EOF
/usr/local/mysql/lib/mysql
/usr/local/lib
EOF
ldconfig
ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
ln -s /usr/local/mysql/include/mysql /usr/include/mysql
ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
ln -s /usr/local/mysql/bin/mysqldump /usr/bin/mysqldump
ln -s /usr/local/mysql/bin/myisamchk /usr/bin/myisamchk
ln -s /usr/local/mysql/bin/mysqld_safe /usr/bin/mysqld_safe
/etc/init.d/mysql start
/usr/local/mysql/bin/mysqladmin -u root password $mysqlrootpwd
cat > /tmp/mysql_sec_script<<EOF
use mysql;
update user set password=password('$mysqlrootpwd') where user='root';
delete from user where not (user='root') ;
delete from user where user='root' and password='';
drop database test;
DROP USER ''@'%';
flush privileges;
EOF
/usr/local/mysql/bin/mysql -u root -p$mysqlrootpwd -h localhost < /tmp/mysql_sec_script
rm -f /tmp/mysql_sec_script
/etc/init.d/mysql restart
/etc/init.d/mysql stop
echo "============================MySQL 5.1.73 install completed========================="
}
InstallMySQL55()
{
echo "============================Install MySQL 5.5.37=================================="
cd $cur_dir
rm -f /etc/my.cnf
rm -f /etc/mysql/my.cnf
rm -rf /etc/mysql/
apt-get remove -y mysql-server
apt-get remove -y mysql-common mysql-client
tar zxf mysql-5.5.37.tar.gz
cd mysql-5.5.37/
patch -p1 < $cur_dir/mysql-openssl.patch
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_READLINE=1 -DWITH_SSL=system -DWITH_ZLIB=system -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1
make && make install
groupadd mysql
useradd -s /sbin/nologin -M -g mysql mysql
cp support-files/my-medium.cnf /etc/my.cnf
sed '/skip-external-locking/i\datadir = /usr/local/mysql/var' -i /etc/my.cnf
if [ $installinnodb = "y" ]; then
sed -i 's:#innodb:innodb:g' /etc/my.cnf
sed -i 's:/usr/local/mysql/data:/usr/local/mysql/var:g' /etc/my.cnf
else
sed '/skip-external-locking/i\default-storage-engine=MyISAM\nloose-skip-innodb' -i /etc/my.cnf
fi
/usr/local/mysql/scripts/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var --user=mysql
chown -R mysql /usr/local/mysql/var
chgrp -R mysql /usr/local/mysql/.
cp support-files/mysql.server /etc/init.d/mysql
chmod 755 /etc/init.d/mysql
cat > /etc/ld.so.conf.d/mysql.conf<<EOF
/usr/local/mysql/lib
/usr/local/lib
EOF
ldconfig
ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
ln -s /usr/local/mysql/include/mysql /usr/include/mysql
if [ -d "/proc/vz" ];then
ulimit -s unlimited
fi
/etc/init.d/mysql start
ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
ln -s /usr/local/mysql/bin/mysqldump /usr/bin/mysqldump
ln -s /usr/local/mysql/bin/myisamchk /usr/bin/myisamchk
ln -s /usr/local/mysql/bin/mysqld_safe /usr/bin/mysqld_safe
/usr/local/mysql/bin/mysqladmin -u root password $mysqlrootpwd
cat > /tmp/mysql_sec_script<<EOF
use mysql;
update user set password=password('$mysqlrootpwd') where user='root';
delete from user where not (user='root') ;
delete from user where user='root' and password='';
drop database test;
DROP USER ''@'%';
flush privileges;
EOF
/usr/local/mysql/bin/mysql -u root -p$mysqlrootpwd -h localhost < /tmp/mysql_sec_script
rm -f /tmp/mysql_sec_script
/etc/init.d/mysql restart
/etc/init.d/mysql stop
echo "============================MySQL 5.5.26 install completed========================="
}
InstallMariaDB()
{
echo "============================Install MariaDB 5.5.37=================================="
cd $cur_dir
rm -f /etc/my.cnf
rm -f /etc/mysql/my.cnf
rm -rf /etc/mysql/
apt-get remove -y mysql-server
apt-get remove -y mysql-common mysql-client
tar zxf mariadb-5.5.37.tar.gz
cd mariadb-5.5.37/
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mariadb -DWITH_ARIA_STORAGE_ENGINE=1 -DWITH_XTRADB_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_READLINE=1 -DWITH_SSL=system -DWITH_ZLIB=system -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1
make && make install
groupadd mariadb
useradd -s /sbin/nologin -M -g mariadb mariadb
cp support-files/my-medium.cnf /etc/my.cnf
sed '/skip-external-locking/i\pid-file = /usr/local/mariadb/var/mariadb.pid' -i /etc/my.cnf
sed '/skip-external-locking/i\log_error = /usr/local/mariadb/var/mariadb.err' -i /etc/my.cnf
sed '/skip-external-locking/i\basedir = /usr/local/mariadb' -i /etc/my.cnf
sed '/skip-external-locking/i\datadir = /usr/local/mariadb/var' -i /etc/my.cnf
sed '/skip-external-locking/i\user = mariadb' -i /etc/my.cnf
if [ $installinnodb = "y" ]; then
sed -i 's:#innodb:innodb:g' /etc/my.cnf
sed -i 's:/usr/local/mariadb/data:/usr/local/mariadb/var:g' /etc/my.cnf
else
sed '/skip-external-locking/i\default-storage-engine=MyISAM\nloose-skip-innodb' -i /etc/my.cnf
fi
/usr/local/mariadb/scripts/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/mariadb --datadir=/usr/local/mariadb/var --user=mariadb
chown -R mariadb /usr/local/mariadb/var
chgrp -R mariadb /usr/local/mariadb/.
cp support-files/mysql.server /etc/init.d/mariadb
chmod 755 /etc/init.d/mariadb
cat > /etc/ld.so.conf.d/mariadb.conf<<EOF
/usr/local/mariadb/lib
/usr/local/lib
EOF
ldconfig
if [ -d "/proc/vz" ];then
ulimit -s unlimited
fi
/etc/init.d/mariadb start
ln -s /usr/local/mariadb/bin/mysql /usr/bin/mysql
ln -s /usr/local/mariadb/bin/mysqldump /usr/bin/mysqldump
ln -s /usr/local/mariadb/bin/myisamchk /usr/bin/myisamchk
ln -s /usr/local/mariadb/bin/mysqld_safe /usr/bin/mysqld_safe
/usr/local/mariadb/bin/mysqladmin -u root password $mysqlrootpwd
cat > /tmp/mariadb_sec_script<<EOF
use mysql;
update user set password=password('$mysqlrootpwd') where user='root';
delete from user where not (user='root') ;
delete from user where user='root' and password='';
drop database test;
DROP USER ''@'%';
flush privileges;
EOF
/usr/local/mariadb/bin/mysql -u root -p$mysqlrootpwd -h localhost < /tmp/mariadb_sec_script
rm -f /tmp/mariadb_sec_script
/etc/init.d/mariadb restart
/etc/init.d/mariadb stop
echo "============================MariaDB 5.5.37 install completed========================="
}
InstallPHP52()
{
echo "============================Install PHP 5.2.17========================="
cd $cur_dir
export PHP_AUTOCONF=/usr/local/autoconf-2.13/bin/autoconf
export PHP_AUTOHEADER=/usr/local/autoconf-2.13/bin/autoheader
tar zxf php-5.2.17.tar.gz
gzip -cd php-5.2.17-fpm-0.5.14.diff.gz | patch -d php-5.2.17 -p1
cd php-5.2.17/
wget -c http://soft.vpser.net/web/php/bug/php-5.2.17-max-input-vars.patch
patch -p1 < php-5.2.17-max-input-vars.patch
./buildconf --force
if [ "$isinstallmysql55" = "md" ]; then
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mariadb --with-mysqli=/usr/local/mariadb/bin/mysql_config --with-pdo-mysql=/usr/local/mariadb --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-discard-path --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --with-mime-magic
else
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-discard-path --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --with-mime-magic
fi
cd ext/openssl/
wget -c http://soft.vpser.net/lnmp/ext/debian_patches_disable_SSLv2_for_openssl_1_0_0.patch
patch -p3 <debian_patches_disable_SSLv2_for_openssl_1_0_0.patch
cd ../../
make ZEND_EXTRA_LIBS='-liconv'
make install
mkdir -p /usr/local/php/etc
cp php.ini-dist /usr/local/php/etc/php.ini
strip /usr/local/php/bin/php-cgi
cd ../
cd $cur_dir
rm -f /usr/local/php/etc/php-fpm.conf
cp conf/php-fpm.conf /usr/local/php/etc/php-fpm.conf
rm -f /usr/bin/php
ln -s /usr/local/php/bin/php /usr/bin/php
ln -s /usr/local/php/bin/phpize /usr/bin/phpize
ln -s /usr/local/php/sbin/php-fpm /usr/bin/php-fpm
cd $cur_dir/
# php extensions
sed -i 's#extension_dir = "./"#extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"\n#' /usr/local/php/etc/php.ini
sed -i 's#output_buffering = Off#output_buffering = On#' /usr/local/php/etc/php.ini
sed -i 's/post_max_size = 8M/post_max_size = 50M/g' /usr/local/php/etc/php.ini
sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 50M/g' /usr/local/php/etc/php.ini
sed -i 's/;date.timezone =/date.timezone = PRC/g' /usr/local/php/etc/php.ini
sed -i 's/short_open_tag = Off/short_open_tag = On/g' /usr/local/php/etc/php.ini
sed -i 's/; cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /usr/local/php/etc/php.ini
sed -i 's/; cgi.fix_pathinfo=0/cgi.fix_pathinfo=0/g' /usr/local/php/etc/php.ini
sed -i 's/max_execution_time = 30/max_execution_time = 300/g' /usr/local/php/etc/php.ini
sed -i 's/disable_functions =.*/disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket/g' /usr/local/php/etc/php.ini
if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then
wget -c http://soft.vpser.net/web/zend/ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz
tar zxf ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz
mkdir -p /usr/local/zend/
cp ZendOptimizer-3.3.9-linux-glibc23-x86_64/data/5_2_x_comp/ZendOptimizer.so /usr/local/zend/
else
wget -c http://soft.vpser.net/web/zend/ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz
tar zxf ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz
mkdir -p /usr/local/zend/
cp ZendOptimizer-3.3.9-linux-glibc23-i386/data/5_2_x_comp/ZendOptimizer.so /usr/local/zend/
fi
cat >>/usr/local/php/etc/php.ini<<EOF
;eaccelerator
;ionCube
[Zend Optimizer]
zend_optimizer.optimization_level=1
zend_extension="/usr/local/zend/ZendOptimizer.so"
EOF
wget -c http://soft.vpser.net/lnmp/ext/init.d.php-fpm5.2
cp init.d.php-fpm5.2 /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
cp $cur_dir/lnmp /root/lnmp
chmod +x /root/lnmp
echo "============================PHP 5.2.17 install completed======================"
}
InstallPHP53()
{
echo "============================Install PHP 5.3.28================================"
cd $cur_dir
export PHP_AUTOCONF=/usr/local/autoconf-2.13/bin/autoconf
export PHP_AUTOHEADER=/usr/local/autoconf-2.13/bin/autoheader
tar zxf php-5.3.28.tar.gz
cd php-5.3.28/
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --disable-fileinfo
make ZEND_EXTRA_LIBS='-liconv'
make install
rm -f /usr/bin/php
ln -s /usr/local/php/bin/php /usr/bin/php
ln -s /usr/local/php/bin/phpize /usr/bin/phpize
ln -s /usr/local/php/sbin/php-fpm /usr/bin/php-fpm
echo "Copy new php configure file."
mkdir -p /usr/local/php/etc
cp php.ini-production /usr/local/php/etc/php.ini
cd $cur_dir
# php extensions
echo "Modify php.ini......"
sed -i 's/post_max_size = 8M/post_max_size = 50M/g' /usr/local/php/etc/php.ini
sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 50M/g' /usr/local/php/etc/php.ini
sed -i 's/;date.timezone =/date.timezone = PRC/g' /usr/local/php/etc/php.ini
sed -i 's/short_open_tag = Off/short_open_tag = On/g' /usr/local/php/etc/php.ini
sed -i 's/; cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /usr/local/php/etc/php.ini
sed -i 's/; cgi.fix_pathinfo=0/cgi.fix_pathinfo=0/g' /usr/local/php/etc/php.ini
sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /usr/local/php/etc/php.ini
sed -i 's/max_execution_time = 30/max_execution_time = 300/g' /usr/local/php/etc/php.ini
sed -i 's/register_long_arrays = On/;register_long_arrays = On/g' /usr/local/php/etc/php.ini
sed -i 's/magic_quotes_gpc = On/;magic_quotes_gpc = On/g' /usr/local/php/etc/php.ini
sed -i 's/disable_functions =.*/disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsockopen/g' /usr/local/php/etc/php.ini
echo "Install ZendGuardLoader for PHP 5.3"
if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then
wget -c http://soft.vpser.net/web/zend/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz
tar zxf ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz
mkdir -p /usr/local/zend/
cp ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/ZendGuardLoader.so /usr/local/zend/
else
wget -c http://soft.vpser.net/web/zend/ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz
tar zxf ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz
mkdir -p /usr/local/zend/
cp ZendGuardLoader-php-5.3-linux-glibc23-i386/php-5.3.x/ZendGuardLoader.so /usr/local/zend/
fi
echo "Write ZendGuardLoader to php.ini......"
cat >>/usr/local/php/etc/php.ini<<EOF
;eaccelerator
;ionCube
[Zend Optimizer]
zend_extension=/usr/local/zend/ZendGuardLoader.so
zend_loader.enable=1
zend_loader.disable_licensing=0
zend_loader.obfuscation_level_support=3
zend_loader.license_path=
EOF
echo "Creating new php-fpm configure file......"
cat >/usr/local/php/etc/php-fpm.conf<<EOF
[global]
pid = /usr/local/php/var/run/php-fpm.pid
error_log = /usr/local/php/var/log/php-fpm.log
log_level = notice
[www]
listen = /tmp/php-cgi.sock
listen.backlog = -1
listen.allowed_clients = 127.0.0.1
listen.owner = www
listen.group = www
listen.mode = 0666
user = www
group = www
pm = dynamic
pm.max_children = 10
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 6
request_terminate_timeout = 100
request_slowlog_timeout = 0
slowlog = var/log/slow.log
EOF
echo "Copy php-fpm init.d file......"
cp $cur_dir/php-5.3.28/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
cp $cur_dir/lnmp /root/lnmp
chmod +x /root/lnmp
sed -i 's:/usr/local/php/logs:/usr/local/php/var/run:g' /root/lnmp
echo "============================PHP 5.3.28 install completed======================"
}
InstallNginx()
{
echo "============================Install Nginx================================="
groupadd www
useradd -s /sbin/nologin -g www www
adduser bae
mkdir -p /home/bae/wwwroot/main
chmod +w /home/bae/wwwroot/main
mkdir -p /home/bae/wwwlogs
chmod 777 /home/bae/wwwlogs
touch /home/bae/wwwlogs/nginx_error.log
cd $cur_dir
chown -R www:www /home/wwwroot/main
# nginx
cd $cur_dir
tar zxf pcre-8.12.tar.gz
cd pcre-8.12/
./configure
make && make install
cd ../
ldconfig
tar zxf nginx-1.6.0.tar.gz
cd nginx-1.6.0/
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ipv6
make && make install
cd ../
ln -s /usr/local/nginx/sbin/nginx /usr/bin/nginx
cd $cur_dir
rm -f /usr/local/nginx/conf/nginx.conf
cp conf/nginx.conf /usr/local/nginx/conf/nginx.conf
cp conf/vhost -rf /usr/local/nginx/conf/
# cp conf/wordpress.conf /usr/local/nginx/conf/wordpress.conf
# cp conf/pathinfo.conf /usr/local/nginx/conf/pathinfo.conf
mv /usr/local/nginx/conf/fcgi.conf /usr/local/nginx/conf/fcgi.conf.bak
cp conf/fcgi.conf /usr/local/nginx/conf/fcgi.conf
}
CreatPHPTools()
{
echo "Create PHP Info Tool..."
#phpinfo
cat >/home/bae/wwwroot/main/pt.php<<eof
<?
phpinfo();
?>
eof
echo "======================= phpMyAdmin install ============================"
cd $cur_dir
#phpmyadmin
if [ "$isinstallphp53" = "n" ]; then
tar zxf phpmyadmin-latest.tar.gz
mv phpMyAdmin-3.4.8-all-languages /home/bae/wwwroot/main/phpmyadmin
else
tar zxf phpMyAdmin-lasest.tar.gz
mv phpMyAdmin-*-all-languages /home/bae/wwwroot/main/phpmyadmin
fi
cp conf/phpmyadmin.config.inc.php /home/bae/wwwroot/main/phpmyadmin/config.inc.php
# cp conf/config.inc.php /home/wwwroot/default/phpmyadmin/config.inc.php
mkdir /home/bae/wwwroot/main/phpmyadmin/upload/
mkdir /home/bae/wwwroot/main/phpmyadmin/save/
chmod 755 -R /home/bae/wwwroot/main/phpmyadmin/
chown www:www -R /home/bae/wwwroot/main/phpmyadmin/
echo "==================== phpMyAdmin install completed ======================"
echo "Copy PHP Prober..."
tar zxvf p.tar.gz
cp p.php /home/bae/wwwroot/main/p.php
cp conf/index.html /home/bae/wwwroot/main/index.html
}
AddAndStartup()
{
echo "============================add nginx and php-fpm on startup============================"
echo "Download new nginx init.d file......"
wget -c http://soft.vpser.net/lnmp/ext/init.d.nginx
cp init.d.nginx /etc/init.d/nginx
chmod +x /etc/init.d/nginx
if [ "$isinstallmysql55" = "md" ]; then
update-rc.d -f mariadb defaults
else
update-rc.d -f mysql defaults
fi
update-rc.d -f nginx defaults
update-rc.d -f php-fpm defaults
# cd $cur_dir
# cp vhost.sh /root/vhost.sh
# chmod +x /root/vhost.sh
if [ "$isinstallmysql55" = "md" ]; then
sed -i 's:/etc/init.d/mysql:/etc/init.d/mariadb:g' /root/lnmp
fi
echo "===========================add nginx and php-fpm on startup completed===================="
echo "Starting LNMP..."
if [ "$isinstallmysql55" = "md" ]; then
/etc/init.d/mariadb start
else
/etc/init.d/mysql start
fi
/etc/init.d/php-fpm start
/etc/init.d/nginx start
#add iptables firewall rules
if [ -s /sbin/iptables ]; then
/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
/sbin/iptables -I INPUT -p tcp --dport 3306 -j DROP
/sbin/iptables-save
fi
}
CheckInstall()
{
echo "===================================== Check install ==================================="
clear
isnginx=""
ismysql=""
isphp=""
echo "Checking..."
if [ -s /usr/local/nginx/conf/nginx.conf ] && [ -s /usr/local/nginx/sbin/nginx ]; then
echo "Nginx: OK"
isnginx="ok"
else
echo "Error: /usr/local/nginx not found!!!Nginx install failed."
fi
if [ "$isinstallmysql55" = "md" ]; then
if [ -s /usr/local/mariadb/bin/mysql ] && [ -s /usr/local/mariadb/bin/mysqld_safe ] && [ -s /etc/my.cnf ]; then
echo "MariaDB: OK"
ismysql="ok"
else
echo "Error: /usr/local/mariadb not found!!!MySQL install failed."
fi
else
if [ -s /usr/local/mysql/bin/mysql ] && [ -s /usr/local/mysql/bin/mysqld_safe ] && [ -s /etc/my.cnf ]; then
echo "MySQL: OK"
ismysql="ok"
else
echo "Error: /usr/local/mysql not found!!!MySQL install failed."
fi
fi
if [ -s /usr/local/php/sbin/php-fpm ] && [ -s /usr/local/php/etc/php.ini ] && [ -s /usr/local/php/bin/php ]; then
echo "PHP: OK"
echo "PHP-FPM: OK"
isphp="ok"
else
echo "Error: /usr/local/php not found!!!PHP install failed."
fi
if [ "$isnginx" = "ok" ] && [ "$ismysql" = "ok" ] && [ "$isphp" = "ok" ]; then
echo "Install NMP completed."
echo "========================================================================="
echo "Usage: /root/nmp {start|stop|reload|restart|kill|status}\n"
echo "=========================================================================\n"
echo "default mysql root password:$mysqlrootpwd"
echo "phpinfo : http://yourIP/pt.php"
echo "phpMyAdmin : http://yourIP/phpmyadmin/"
echo "Prober : http://yourIP/p.php"
echo ""
echo "The path of some dirs:"
echo "mysql dir: /usr/local/mysql, config dir: /usr/local/nginx/conf/nginx.conf"
echo "php dir: /usr/local/php, config dir: /usr/local/php/etc/php.ini"
echo "nginx dir: /usr/local/nginx, config dir: /usr/local/nginx/conf/nginx.conf"
echo "web dir : /home/bae/wwwroot/main"
echo ""
echo "========================================================================="
/root/lnmp status
netstat -ntl
else
echo "NMP install Failed!"
echo "Check /root/nmp-install.log for debug."
fi
}
InitInstall 2>&1 | tee /root/nmp-install.log
CheckAndDownloadFiles 2>&1 | tee -a /root/nmp-install.log
InstallDependsAndOpt 2>&1 | tee -a /root/nmp-install.log
if [ "$isinstallmysql55" = "n" ]; then
InstallMySQL51 2>&1 | tee -a /root/nmp-install.log
elif [ "$isinstallmysql55" = "y" ]; then
InstallMySQL55 2>&1 | tee -a /root/nmp-install.log
else
InstallMariaDB 2>&1 | tee -a /root/nmp-install.log
fi
if [ "$isinstallphp53" = "n" ]; then
InstallPHP52 2>&1 | tee -a /root/nmp-install.log
else
InstallPHP53 2>&1 | tee -a /root/nmp-install.log
fi
InstallNginx 2>&1 | tee -a /root/nmp-install.log
CreatPHPTools 2>&1 | tee -a /root/nmp-install.log
AddAndStartup 2>&1 | tee -a /root/nmp-install.log
CheckInstall 2>&1 | tee -a /root/nmp-install.log