nginx_php---py安装脚本

与世无争的帅哥 提交于 2020-03-18 02:19:08
# -*- coding: utf-8 -*-import os,timedef create__file(file_path,msg):    f=open(file_path,"a")    f.write(msg)    f.closeos.system('rm -rf php-fpm')while os.path.isfile('./php-fpm.tar.gz') == 0:    print('php-fpm.tar.gz文件不存在,终止执行')    os.system('yum install -y lrzsz')    os.system('rz -E')print('\n-----------------6秒后安装nginx服务-------------------------')time.sleep(6)print('\n----------------------删除nginx-----------------------------')Nginx=os.system("yum remove nginx -y")print('\n------------------创建仓库------------------')repo='''[nginx-stable]name=nginx stable repobaseurl=http://nginx.org/packages/centos/$releasever/$basearch/gpgcheck=1enabled=1gpgkey=https://nginx.org/keys/nginx_signing.keymodule_hotfixes=true '''create__file('/etc/yum.repos.d/nginx.repo',repo)print('\n-----------------安装nginx程序---------------------')run=os.system('yum clean all')     #&&yum makecacheif run == 0 :    try:        os.system('yum install -y nginx')        print('\n---------------安装完毕--------------')    except Exception as e:        print(e)print('\n-----------------6秒后安装php服务-------------------------')time.sleep(6)print('\n----------------------删除nginx-----------------------------')Nginx=os.system("yum remove php-mysql* php php-fpm php-common")print('\n------------------安装第三方仓库------------------')os.system('yum localinstall -y http://mirror.webtatic.com/yum/el7/webtatic-release.rpm')print('\n-----------------安装php程序---------------------')os.system('tar zxf php-fpm.tar.gz')try:    os.system('yum localinstall -y php-fpm/*')    print('\n---------------安装完毕--------------')except Exception as e:    print(e)else:    print('\n-----------重启服务并加入开机运行-----------')    os.system('systemctl start nginx php-fpm')    os.system('systemctl enable nginx php-fpm')print()print('\n-----------查看端口---------')os.system("netstat -lntup|egrep '80|9000'")
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!