shell下比较完善的LNMP一键安装包
[重要通告]如您遇疑难杂症,本站支持知识付费业务,扫右边二维码加博主微信,可节省您宝贵时间哦!
这是今天一个朋友说他搞了一个LNMP一键安装包脚本,其实这些脚本没必要的,因为会有很多完善的区域来操作;
代码如下:
#!/bin/bash #by cuiyuxin zhanshi(){ echo "+------------------------------------------------+ | | | _o0o_ 1. 编译安装Nginx1.17.10 | | 08880 2. yum安装Apache | | 88"."88 3. yum安装MySQL5.7 | | (|-_-|) 4. yum安装PHP7 | | 0\=/0 5. 部署LNMP环境 | | __/ \ 6.退出此管理程序| | ‘\ ///‘ | | / Linux一键 \ | | || Server || ====================== | | \ //// 一键安装服务 | | ||| i i i ||| by laoliang | | ___ ___ ====================== | |___‘. /--.--\ .‘___ | +------------------------------------------------+ " } install_nginx(){ #1.第一步:依赖环境安装: echo -e "\033[41;33m 开始安装依赖环境 \033[0m" yum install pcre pcre-devel openssl openssl-devel zlib zlib-devel -y yum install gcc gcc-c++ make libtool -y yum install wget -y #2.开始下载nginx源码包,nginx-1.17.10 echo -e "\033[41;33m 开始下载目前稳定版nginx-1.17.10 \033[0m" wget -P /tmp http://nginx.org/download/nginx-1.17.10.tar.gz #3.解压nginxtar包,进行编译 echo -e "\033[41;33m 开始解压nginx-1.17.10 并且进行编译 \033[0m" tar xf /tmp/nginx-1.17.10.tar.gz -C /tmp cd /tmp/nginx-1.17.10 ./configure --prefix=/usr --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/tem/nginx/client --http-proxy-temp-path=/var/tem/nginx/proxy --http-fastcgi-temp-path=/var/tem/nginx/fcgi --with-http_stub_status_module make && make install useradd -s /sbin/nologin -M nginx mkdir -p /var/tem/nginx/client if [ $? == 0 ];then echo -e "\033[41;33m nginx-1.17.10安装完成,安装目录为/etc/nginx 日志目录在/ar/log/nginx/ 输入命令"nginx" 即可启动nginx服务 \033[0m" fi } install_apache(){ echo "开始安装Apache请稍后" yum install httpd -y &>/dev/null if [ "$?" -eq 0 ] then echo "Apache安装成功!" else echo "Apache安装失败!" fi } install_mysql(){ echo "开始下载mysql 5.7的rpm安装包" wget -P /tmp https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm echo "开始安装mysql 5.7的rpm安装包" yum -y localinstall /tmp/mysql57-community-release-el7-11.noarch.rpm echo "开始在线安装MySQL 文件比较大,安装较慢!!" yum -y install mysql-community-server if [ "$?" -eq 0 ] then echo "Mysql安装成功!输入命令:systemctl start mysqld 启动Mysql" echo "mysql安装完成之后,会在/var/log/mysqld.log文件中给root生成了一个临时的默认密码" else echo "Mysql安装失败!" fi } install_php() { echo "开始移除旧的php" yum remove php-mysql-5.4 php php-fpm php-common cat >>/etc/yum.repos.d/php.repo<<'EOF' [php-fpm] name = php Repository baseurl = http://us-east.repo.webtatic.com/yum/el7/x86_64/ gpgcheck = 0 EOF echo "开始安装php7" yum -y install php71w php71w-cli php71w-common php71w-devel php71w-embedded php71w-gd php71w-mcrypt php71w-mbstring php71w-pdo php71w-xml php71w-fpm php71w-mysqlnd php71w-opcache php71w-pecl-memcached php71w-pecl-redis php71w-pecl-mongodb if [ $? -eq 0 ];then echo "php7安装成功,使用systemctl start php-fpm 来启动php-fpm" else echo "php7安装失败" fi } install_lnmp(){ install_nginx install_mysql install_php } zhanshi read -p "请您输入需要安装的服务:" NUM case $NUM in 1) install_nginx ;; 2) install_apache ;; 3) install_mysql ;; 4) install_php ;; 5) install_lnmp ;; 6) exit ;; esac
其实不用这些东西,也有比较完善的脚本~
问题未解决?付费解决问题加Q或微信 2589053300 (即Q号又微信号)右上方扫一扫可加博主微信
所写所说,是心之所感,思之所悟,行之所得;文当无敷衍,落笔求简洁。 以所舍,求所获;有所依,方所成!
赏
支付宝赞助
微信赞助
免责声明,若由于商用引起版权纠纷,一切责任均由使用者承担。
您必须遵守我们的协议,如您下载该资源,行为将被视为对《免责声明》全部内容的认可->联系老梁投诉资源 LaoLiang.Net部分资源来自互联网收集,仅供用于学习和交流,请勿用于商业用途。如有侵权、不妥之处,请联系站长并出示版权证明以便删除。
敬请谅解! 侵权删帖/违法举报/投稿等事物联系邮箱:service@laoliang.net
意在交流学习,欢迎赞赏评论,如有谬误,请联系指正;转载请注明出处: » shell下比较完善的LNMP一键安装包