因胸联盟 发表于 2015-1-14 20:14:45

给大家带来全主动装置LNMP的简便Shell剧本

如果您觉得本篇CentOSLinux教程讲得好,请记得点击右边漂浮的分享程序,把好文章分享给你的好朋友们!此剧本在临盆办事器上利用了一年多,本剧本崇尚复杂唯美,只必要一个剧本就能够在任何一台有收集的办事器上主动设置LNMP。
本剧本会在剧本实行目次下,建packages目次用于寄存LNMP所必要的软件。人人装置完能够删除该目次。
利用***:
1、把shell剧本的内容保留为nginx_php
2、root权限下运转:
chmodu+xnginx_php;./nginx_phpinit;./nginx_phpins_mysql-server;./nginx_phpins_mysql-client;./nginx_phpins_php52;./nginx_phpins_php52-ext;./nginx_phpins_mysql
在剧本运转过程当中必要输出一次y确认。
Shell剧本内容以下:
#/bash#author:coralzdpoweredbywww.freebsdsystem.org#writtenbycoralzd2011.05.05#version0.1.3build20110505nginx_dir="/usr/local/nginx"php52_dir="/usr/local/php52"mysql_dir="/usr/local/mysql"functioninit(){LANG=Cyum-yinstallwgetgccgcc-c++autoconflibjpeglibjpeg-devellibpnglibpng-develfreetypefreetype-devellibxml2libxml2-develzlibzlib-develglibcglibc-develglib2glib2-develbzip2bzip2-develncursesncurses-develcurlcurl-devele2fsprogse2fsprogs-develkrb5krb5-devellibidnlibidn-developensslopenssl-developenldapopenldap-develnss_ldapopenldap-clientsopenldap-serversread-p"Now,willdownloadnginxphpsoftware...Y|y:"nginxphpcase"$nginxphp"inY|y)echo-n"startingdownloadnginx_php..."cat>list<<"EOF"&&nginx-1.0.0.tar.gzphp-5.2.17.tar.gzphp-5.2.17-fpm-0.5.14.diff.gzlibiconv-1.13.1.tar.gzlibmcrypt-2.5.8.tar.gzmcrypt-2.6.8.tar.gzmemcache-2.2.5.tgzmhash-0.9.9.9.tar.gzmysql-5.1.52.tar.gzpcre-8.10.tar.gzeaccelerator-0.9.6.1.tar.bz2PDO_MYSQL-1.0.2.tgzlibunwind-0.99.tar.gzImageMagick.tar.gzimagick-2.3.0.tgz谷歌-perftools-1.6.tar.gzfcgi.confphp.ininginx.confphp-fpm.confEOFmkdirpackagesforiin`catlist`doif[-spackages/$i];thenecho"$i"elseecho"Error:$inotfound!!!downloadnow......"wgethttp://www.freebsdsystem.org/linux/nginx-php/$i-Ppackages/fidone;;*)echo-n"exitinstallscript"exit0;;esacgroupaddwww&&useraddwww-s/sbin/nologin-gwwwgroupaddmysql&&useraddmysql-s/sbin/nologin-gmysqlecho"wwwandmysqluser&&groupcreate!"/bin/rm-rflistecho-e"Allofinstalledsucussful!"}functionis_version(){if[`uname-m`=="x86_64"];thentarzxflibunwind-0.99.tar.gztarzxvflibunwind-0.99.tar.gzcdlibunwind-0.99/CFLAGS=-fPIC./configuremakeCFLAGS=-fPICmakeCFLAGS=-fPICinstallcd../elseecho"yoursystemis32bit,notinstalllibunwindlib!"fi}functionins_nginx(){cdpackagesis_versiontarzxf谷歌-perftools-1.6.tar.gzcd谷歌-perftools-1.6./configuremakemakeinstallcd..tarzxfpcre-8.10.tar.gzcdpcre-*./configuremakemakeinstallcd..tarzxfnginx-1.0.0.tar.gzcdnginx-1.0.0./configure--prefix=${nginx_dir}--with-谷歌_perftools_module--user=www--group=www--with-http_stub_status_module--with-http_flv_module--with-http_ssl_modulemake&&makeinstallcd..rm-rf/usr/local/nginx/conf/nginx.confecho"/usr/local/lib">/etc/ld.so.conf.d/usr_local_lib.confcpnginx.conf/usr/local/nginx/conf/cpfcgi.conf/usr/local/nginx/conf/echo"nginxinstalledsucussfully!"}functionins_mysql-server(){cdpackages/tarzxfmysql-5.1.52.tar.gzcdmysql-5.1.52CHOST="x86_64-pc-linux-gnu"CFLAGS="-march=nocona-O2-pipe"CXXFLAGS="${CFLAGS}"./configure"--prefix=${mysql_dir}""--with-server-suffix=-DZWWW""--with-mysqld-user=mysql""--without-debug""--with-charset=utf8""--with-extra-charsets=all""--with-pthread""--with-big-tables""--enable-thread-safe-client""--enable-assembler""--with-readline""--with-ssl""--enable-local-infile""--with-plugins=partition,myisammrg""--without-ndb-debug"make&&makeinstallcpsupport-*/mysql.server/etc/init.d/mysqldcd/usr/local/mysqlchown-Rmysql:mysql.rm-rfsql-benchmysql-testecho"mysqlserver5.1.52installedsuccessfully!"}functionins_mysql-client(){cdpackages/tarzxfmysql-5.1.52.tar.gzcdmysql-5.1.52CHOST="x86_64-pc-linux-gnu"CFLAGS="-march=nocona-O2-pipe"CXXFLAGS="${CFLAGS}"./configure"--prefix=${mysql_dir}""--with-mysqld-user=mysql""--without-debug""--with-charset=utf8""--with-extra-charsets=all""--with-pthread""--with-big-tables""--enable-thread-safe-client""--enable-assembler""--with-readline""--with-ssl""--enable-local-infile""--without-server"make&&makeinstallcd/usr/local/mysqlchown-Rmysql:mysql.rm-rfsql-benchmysql-testecho"mysqlclient5.1.52installedsuccessfully!"}functionins_php52(){cdpackages/tarzxflibiconv-1.13.1.tar.gzcdlibiconv-1.13.1/./configure--prefix=/usr/localmakemakeinstallcd../tarzxflibmcrypt-2.5.8.tar.gzcdlibmcrypt-2.5.8/./configuremakemakeinstall/sbin/ldconfigcdlibltdl/./configure--enable-ltdl-installmakemakeinstallcd../../tarzxfmhash-0.9.9.9.tar.gzcdmhash-0.9.9.9/./configuremakemakeinstallcd../ln-s/usr/local/lib/libmcrypt.la/usr/lib/libmcrypt.laln-s/usr/local/lib/libmcrypt.so/usr/lib/libmcrypt.soln-s/usr/local/lib/libmcrypt.so.4/usr/lib/libmcrypt.so.4ln-s/usr/local/lib/libmcrypt.so.4.4.8/usr/lib/libmcrypt.so.4.4.8ln-s/usr/local/lib/libmhash.a/usr/lib/libmhash.aln-s/usr/local/lib/libmhash.la/usr/lib/libmhash.laln-s/usr/local/lib/libmhash.so/usr/lib/libmhash.soln-s/usr/local/lib/libmhash.so.2/usr/lib/libmhash.so.2ln-s/usr/local/lib/libmhash.so.2.0.1/usr/lib/libmhash.so.2.0.1ln-s/usr/local/bin/libmcrypt-config/usr/bin/libmcrypt-configtarzxfmcrypt-2.6.8.tar.gzcdmcrypt-2.6.8//sbin/ldconfig./configuremakemakeinstallcd../tarzxfphp-5.2.17.tar.gzgzip-cdphp-5.2.17-fpm-0.5.14.diff.gz|patch-dphp-5.2.17-p1cdphp-5.2.17/./configure--prefix=${php52_dir}--with-config-file-path=${php52_dir}/etc--with-mysql=${mysql_dir}--with-mysqli=${mysql_dir}/bin/mysql_config--with-iconv-dir=/usr/local--with-freetype-dir--with-jpeg-dir--with-png-dir--with-zlib--with-libxml-dir=/usr--enable-xml--disable-rpath--enable-discard-path--enable-safe-mode--enable-bcmath--enable-shmop--enable-sysvsem--enable-inline-optimization--with-curl--with-curlwrappers--enable-mbregex--enable-fastcgi--enable-fpm--enable-force-cgi-redirect--enable-mbstring--with-mcrypt--with-gd--enable-gd-native-ttf--with-openssl--with-mhash--enable-pcntl--enable-sockets--with-ldap--with-ldap-sasl--with-xmlrpc--enable-zip--enable-soapmakeZEND_EXTRA_LIBS=-liconvmakeinstallcd..cpphp.ini/usr/local/php52/etc/cpphp-fpm.conf/usr/local/php52/etc/echo"/usr/local/mysql/lib/mysql">>/etc/ld.so.conf.d/mysql_lib.conf/sbin/ldconfigecho"php52installedsuccessfully!"}functionins_php52-ext(){cdpackages/tarzxfmemcache-2.2.5.tgzcdmemcache-2.2.5/${php52_dir}/bin/phpize./configure--with-php-config=${php52_dir}/bin/php-configmakemakeinstallcd../tarjxfeaccelerator-0.9.6.1.tar.bz2cdeaccelerator-0.9.6.1/${php52_dir}/bin/phpize./configure--enable-eaccelerator=shared--with-php-config=${php52_dir}/bin/php-configmakemakeinstallcd../tarzxfPDO_MYSQL-1.0.2.tgzcdPDO_MYSQL-1.0.2/${php52_dir}/bin/phpize./configure--with-php-config=${php52_dir}/bin/php-config--with-pdo-mysql=${mysql_dir}makemakeinstallcd../tarzxfImageMagick.tar.gzcdImageMagick-6.5.1-2/./configuremakemakeinstallcd../tarzxfimagick-2.3.0.tgzcdimagick-2.3.0/${php52_dir}/bin/phpize./configure--with-php-config=${php52_dir}/bin/php-configmakemakeinstallcd../echo"php52extensioninstalledsuccessfully!"}case$1ininit)init;;ins_mysql-server)ins_mysql-server;;ins_mysql-client)ins_mysql-client;;ins_nginx)ins_nginx;;ins_php52)ins_php52;;ins_php52-ext)ins_php52-ext;;*)echo"Usage:`basename$0`{init|ins_mysql-server|ins_mysql-client|ins_php52|ins_php52-ext|ins_mysql}";;esac如果您觉得本篇CentOSLinux教程讲得好,请记得点击右边漂浮的分享程序,把好文章分享给你的好朋友们!

冷月葬花魂 发表于 2015-1-15 07:53:22

给大家带来全主动装置LNMP的简便Shell剧本

楼猪V5啊

精灵巫婆 发表于 2015-1-17 17:47:56

笔者五分钟后就给出了解决方法:“首先备份原文件到其他目录,然后删掉/usr/local/unispim/unispimsp.ksc,编辑/usr/local/unispim/unispimsp.ini,最后重启动计算机

愤怒的大鸟 发表于 2015-1-26 21:16:42

编程学习及开发,Linux是免费,开源的操作系统,并且可开发工具相当多,如果您支持自由软件,一定要同广大热爱自由软件人士一同为其不懈努力。

冷月葬花魂 发表于 2015-2-5 03:04:42

选择交流平台,如QQ群,网站论坛等。

透明 发表于 2015-2-11 04:01:44

生成新的unispimsp.ksc。”另外得到回复后如果问题解决,向帮助过你的人发个说明,让他们知道问题是怎样解决的。

admin 发表于 2015-3-1 21:34:23

如果上面的措施没有解决问题,此时你就需要Linux社区的帮助了。 Linux的使用者一般都是专业人士,他们有着很好的电脑背景且愿意协助他人。

柔情似水 发表于 2015-3-11 02:14:54

这种补充有助于他人在邮件列表/新闻组/论坛中搜索对你有过帮助的完整解决方案,这可能对他们也很有用。

再见西城 发表于 2015-3-17 20:56:29

查阅经典工具书和Howto,特别是Howto是全球数以万计的Linux、Unix的经验总结非常有参考价值通常40%的问题同样可以解决。

因胸联盟 发表于 2015-3-25 04:39:43

硬盘安装及光盘安装,清楚了解安装Linux应注意的有关问题,如安装Linux应在最后一个分区内,至少分二个分区。
页: [1]
查看完整版本: 给大家带来全主动装置LNMP的简便Shell剧本