首页 > 代码库 > lnmp一键安装脚本
lnmp一键安装脚本
入职新公司的第一天,带我的哥们就分配给我一个任务,让我装一个lnmp,并且写成脚本,这不是so easy 吗,于是我马上就开搞了,现在把我的脚本分享一下给大家。
#lnmp安装脚本 #Email:1445675350@qq.com #autor:fujinzhou #create time: 2016-11-29 yum -y install vim-enhanced ncurses-devel elinks gcc gcc-c++ flex bison autoconf automake gzip net-snmp-devel net-snmp ncurses-devel pcre pcre-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel libXpm-devel gettext-devel pam-devel libtool libtool-ltdl openssl openssl-devel fontconfig-devel libxml2-devel curl-devel libicu libicu-devel libmcrypt libmcrypt-devel libmhash libmhash-devel #添加nginx用户 user=‘nginx‘ group=‘nginx‘ user_exists=$(id -nu $user) if [ ! $user_exists ]; then /usr/sbin/groupadd -f $group /usr/sbin/useradd -g $group $user -s /sbin/nologin -M fi #安装nginx wget http://nginx.org/download/nginx-1.8.1.tar.gz tar -zxf nginx-1.8.1.tar.gz && cd nginx-1.8.1 ./configure --prefix=/usr/local/nginx --pid-path=/usr/local/nginx/nginx.pid --user=nginx --group=nginx --with-http_ssl_module --with-http_flv_module --with-http_stub_status_module --with-http_gzip_static_module --http-client-body-temp-path=/usr/local/nginx/client --http-proxy-temp-path=/usr/local/nginx/proxy --http-fastcgi-temp-path=/usr/local/nginx/fcgi --http-uwsgi-temp-path=/usr/local/nginx/uwsgi --http-scgi-temp-path=/usr/local/nginx/scgi --with-pcre make && make install #启动nginx /usr/local/nginx/sbin/nginx #配置nginx sed -i ‘56a\location ~ \.php$ {\n\ root html;\n\ fastcgi_pass 127.0.0.1:9000;\n\ fastcgi_index index.php;\n\ fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;\n\ include fastcgi_params;\n\}\n‘ /usr/local/nginx/conf/nginx.conf /usr/local/nginx/sbin/nginx -s reload echo -e ‘<?php\n echo "nginx and PHP is OK";\n?>\n‘ >/usr/local/nginx/html/index.php #添加mysql用户 user=‘mysql‘ group=‘mysql‘ user_exists=$(id -nu $user) if [ ! $user_exists ]; then /usr/sbin/groupadd -f $group /usr/sbin/useradd -g $group $user -s /sbin/nologin -M fi #安装Mysql wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz tar -xf mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz && mv mysql-5.6.33-linux-glibc2.5-x86_64 /usr/local/mysql #配置mysql mkdir -p /data/mysql chown -R mysql:mysql /data/mysql/ chown -R mysql:mysql /usr/local/mysql/ /usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/data/mysql/ --user=mysql >>/dev/null cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld sed -i ‘s#^datadir=#datadir=/data/mysql#‘ /etc/init.d/mysqld sed -i ‘s#^basedir=#basedir=/usr/local/mysql#‘ /etc/init.d/mysqld #启动mysql service mysqld start chkconfig mysqld on #添加php用户 #添加mysql用户 user=‘www‘ group=‘www‘ user_exists=$(id -nu $user) if [ ! $user_exists ]; then /usr/sbin/groupadd -f $group /usr/sbin/useradd -g $group $user -s /sbin/nologin -M fi #安装php yum install -y libxml2-devel openssl-devel libcurl-devel libjpeg-devel libpng-devel libicu-devel openldap-devel wget http://mirrors.sohu.com/php/php-5.6.12.tar.gz tar -xf php-5.6.12.tar.gz && cd php-5.6.12 ./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 --enable-fpm --enable-mbstring=all --enable-soap --enable-zip --enable-calendar --enable-bcmath --enable-exif --enable-ftp --enable-intl --with-openssl --with-zlib --with-curl --with-gd --with-zlib-dir=/usr/lib --with-png-dir=/usr/lib --with-jpeg-dir=/usr/lib --with-gettext --with-mhash --with-fpm-user=www --with-fpm-group=www make && make install #配置php cp php.ini-development /usr/local/php/etc/php.ini sed -i ‘s#^;date.timezone =#date.timezone=Asia/Shanghai#‘ /usr/local/php/etc/php.ini cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm #启动php-fpm service php-fpm start chkconfig php-fpm on #删除解压目录 rm /root/lnmp/php-5.6.12 -rf rm /root/lnmp/nginx-1.8.1 -rf
本文出自 “不抛弃!不放弃” 博客,请务必保留此出处http://thedream.blog.51cto.com/6427769/1877631
lnmp一键安装脚本
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。