#!/bin/bash ##适用于Centos7 ##初始化安装环节 function init_servers(){ echo "初始化安装环境..." echo "正在关闭Selinux" sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config setenforce 0 systemctl stop firewalld.service systemctl disable firewalld.service echo "更换源为阿里云源" yum -y install epel-release wget mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo wget -P /etc/yum.repos.d/ https://mirrors.aliyun.com/repo/epel-7.repo yum clean all yum makecache } ##编译安装nginx+mysql+php7.2 function install_LNMP(){ read -ep "请输入您要设立的Mysql数据库密码:" DbPasswd wget -c http://mirrors.linuxeye.com/oneinstack-full.tar.gz && tar xzf oneinstack-full.tar.gz && ./oneinstack/install.sh --nginx_option 1 --php_option 7 --phpcache_option 1 --php_extensions ldap --db_option 2 --dbinstallmethod 1 --dbrootpwd ${DbPasswd} echo "LNMP安装结束,正在重启服务器..." reboot } ###主安装程序 echo "############################################### ## ## ## LNMP一键安装脚本 ## ## ## ## --极客小屋 ## ###############################################" read -p "请按任意键继续!" anykey init_servers install_LNMP