一键安装lnmp脚本
2015-12-04 16:37
357 查看
仍需完善........... #!/bin/bash # ------------------------------------------------------------------------------- # Filename: install.sh # Revision: 1.1 # Date: 2015/12/04 # Author: ley # Email: xxx # Website: www.xxx.com # Description: Install mysql,php,nginx # Notes: xxxxxxx # ------------------------------------------------------------------------------- # Copyright: 20xx (c) ley #Version 1.0 #The first one , can monitor the system memory #Version 1.1 #Modify the method of the script ,more fast #-------------------------------------------------------------------------------- mysql_filename="mysql-5.5.33-linux2.6-x86_64.tar.gz" php_filename="php-5.5.3.tar.bz2" nginx_filename="nginx-1.8.0.tar.gz" yum install gcc-c++ ncurses-deve libaio* libxml2-devel libjpeg-devel libpng-devel freetype-devel libcurl* libmcr* pcre-devel -y ##安装Mysql cd /home tar zxf $mysql_filename mv mysql-5.5.33-linux2.6-x86_64 /usr/local/mysql useradd -s /sbin/nologin mysql mkdir -p /data/mysql chown -R mysql:mysql /data/mysql cd /usr/local/mysql/ ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql cp -r support-files/my-large.cnf /etc/my.cnf cp -r support-files/mysql.server /etc/init.d/mysqld chmod 755 /etc/init.d/mysqld sed -i "25abasedir=/usr/local/mysql" /etc/my.cnf sed -i "26adatadir=/data/mysql" /etc/my.cnf ln -s /usr/local/mysql/bin/mysql /usr/bin/ ln -s /usr/local/mysql/bin/mysqldump /usr/bin/ ln -s /usr/local/mysql/bin/mysqladmin /usr/bin/ /etc/init.d/mysqld start mysqladmin -u root password "root" mysql_port=`netstat -lntup|grep 3306|awk '{print $4}'|cut -c 9-12` if [ $mysql_port == 3306 ];then echo "mysql install sucessful!" else echo "mysql install failed" fi ##安装Php cd /home useradd -s /sbin/nologin php-fpm tar jxf $php_filename cd php-5.5.3 ./configure --prefix=/usr/local/php-fpm --with-config-file-path=/usr/local/php-fpm/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --disable-ipv6 --with-curl make && make install cp -r php.ini-production /usr/local/php-fpm/etc/php.ini cp -r sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm cp -r /usr/local/php-fpm/etc/php-fpm.conf.default /usr/local/php-fpm/etc/php-fpm.conf chmod 755 /etc/init.d/php-fpm service php-fpm start php_port=`netstat -lntup|grep 9000|awk '{print $4}'|cut -c 11-14` if [ $php_port == 9000 ];then echo "php install sucessful!" else echo "php install failed" fi ##安装Nginx cd /home tar zxf $nginx_filename cd nginx-1.8.0 ./configure --prefix=/usr/local/nginx make && make install /usr/local/nginx/sbin/nginx nginx_port=`netstat -lntup|grep 80|grep -v udp|awk '{print $4}'|cut -c 9-11` if [ $nginx_port == 80 ];then echo "nginx install sucessful!" else echo "nginx install failed" fi
本文出自 “9527” 博客,请务必保留此出处http://liangey.blog.51cto.com/9097868/1719636
相关文章推荐
- PPI是什么意思 手机屏幕PPI计算公式
- 12个Unity5中优化VR 应用的技巧
- Ubuntu 安装 Redis
- 笔记
- android学习笔记(七):Handler消息传递机制
- linux网络配置和工具
- nsdata和nsstring的转换
- iOS 解析xml
- web.xml的配置及加载顺序
- 使用Let's Encrypt客户端免费申请SSL证书
- 12306之梆梆加固libsecexe.so的脱壳及修复
- Redis常用命令
- ios中实现图片的播放
- mybatis mapper的配置
- 初探物联网 - 基于Arduino的气象站和View and Data API的结合实例
- 试一下SVG
- nvm 设置默认 node 版本
- 企业网站建设 企业网络信息化不可怀疑的力量
- ArraryAdapter、SimpleCursorAdapter、SimpleAdapter、MyAdapter四大适配器的实现
- CentOS 时间同步