2019独角兽企业重金招聘Python工程师标准>>>

CentOS 7 + nginx-1.12 + php-7.2 + MySQL-5.7

使用 Netkiller OSCM 一键安装PHP环境

Mr. Neo Chen (陈景峯), netkiller, BG7NYT

中国广东省深圳市龙华新区民治街道溪山美地
518131
+86 13113668890

<netkiller@msn.com>

$Id: setup.xml 608 2013-05-31 11:25:25Z netkiller

版权声明

转载请与作者联系,转载时请务必标明文章原始出处和作者信息及本声明。

文档出处:
http://netkiller.github.io
http://netkiller.sourceforge.net

微信扫描二维码进入 Netkiller 微信订阅号

QQ群:128659835 请注明“读者”

2018-01-12: 2013-05-31 19:25:25 +0800 (Fri, 31 May 2013)

摘要

在工作中,需要经常为新系统安装软件,重复而简单,但又不得不作,我将过去几年中工作中临时写的脚本这里了一下,能够实现半自动化安装标本,只需要Ctrl+C, Ctrl+V 快速粘贴复制,即可快速完成安装

目录

  • 1. CentOS 7 64bit (Minimal ISO) 安装后 新机初始化常用软件包安装
  • 2. MySQL-5.7
  • 3. php-7.2
  • 4. nginx-1.12
    • 4.1. host 配置
  • 5. redis-4.0.6
  • 6. MongoDB

1. CentOS 7 64bit (Minimal ISO) 安装后 新机初始化常用软件包安装

Minimal ISO

初始化操作系统

curl -s https://raw.githubusercontent.com/oscm/shell/master/os/personalise.sh | bash

2. MySQL-5.7

卸载旧的包,以免出现冲突

rpm -e --nodeps mysql-libs
yum localinstall MySQL-*

安装 MySQL

curl -s https://raw.githubusercontent.com/oscm/shell/master/database/mysql/5.7/mysql57-community-release-el7-11.sh | bash
curl -s https://raw.githubusercontent.com/oscm/shell/master/database/mysql/5.7/mysql.server.sh | bash

安装完成后会提示临时密码

2018-01-08T00:39:52.431840Z 1 [Note] A temporary password is generated for root@localhost: 6)?#raQPKf3s       [root@localhost my.cnf.d]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.20Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>

使用这个密码登陆,然后修改密码

ALTER USER root@localhost identified by 'MQiEge1ikst7S_6tlXzBOmt_4b';
ALTER USER root@localhost PASSWORD EXPIRE NEVER;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'chen' WITH GRANT OPTION;
FLUSH PRIVILEGES;

3. php-7.2

安装编译器和一些依赖的devel包。

curl -s https://raw.githubusercontent.com/oscm/shell/master/lang/gcc/gcc.sh | bash
curl -s https://raw.githubusercontent.com/oscm/shell/master/lang/php/7.1/devel.sh | bash

安装 PHP 7.2

curl -s https://raw.githubusercontent.com/oscm/shell/master/lang/php/7.2/php-7.2.1.sh | bash
curl -s https://raw.githubusercontent.com/oscm/shell/master/lang/php/php-profile.sh | bash

安装 PHP 扩展

curl -s https://raw.githubusercontent.com/oscm/shell/master/lang/php/pecl/amqp.sh | bash
curl -s https://raw.githubusercontent.com/oscm/shell/master/lang/php/pecl/mongodb.sh | bash
curl -s https://raw.githubusercontent.com/oscm/shell/master/lang/php/pecl/pthreads.sh | bash
curl -s https://raw.githubusercontent.com/oscm/shell/master/lang/php/pecl/phalcon.sh | bash

Redis 暂不支持 7.2,至少现在没有稳定版本,我们只能使用最新的Release版本。

https://raw.githubusercontent.com/oscm/shell/master/lang/php/7.2/extension/redis.sh

4. nginx-1.12

为web服务器创建一个用户,我喜欢使用www,id为80更容易记,同时将一个单独分区挂在/www上用户存放web应用程序。

curl -s https://raw.githubusercontent.com/oscm/shell/master/os/user/www.sh | bash

安装 nginx

curl -s https://raw.githubusercontent.com/oscm/shell/master/web/nginx/stable/nginx.sh | bash

如果你不懂编译器优化,建议你使用yum方案。在不优化的情况下编译出来程序很臃肿。

[root@localhost src]# rpm -qa | grep nginx
nginx-release-centos-7-0.el7.ngx.noarch
nginx-1.12.2-1.el7_4.ngx.x86_64

配置虚拟主机

4.1. host 配置

mkdir -p /www/www.mydomain.com/htdocscd /etc/nginx/conf.d
cp
default.conf www.mydomain.com.conf
vim www.mydomain.com.conf
server {listen 80;server_name www.mydomain.com;charset utf-8;access_log /var/log/nginx/www.mydomain.com.access.log main;location / {root /www/www.mydomain.com/htdocs;index index.html index.php;}#error_page 404 /404.html;# redirect server error pages to thestatic page /50x.html#error_page 500 502 503 504 /50x.html;location = /50x.html {root /usr/share/nginx/html;}# proxy the PHP scripts toApache listening on 127.0.0.1:80##location ~ \.php$ {# proxy_pass http://127.0.0.1;#}# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000#location ~ \.php$ {root html;fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_paramSCRIPT_FILENAME /www/www.mydomain.com/htdocs$fastcgi_script_name;include fastcgi_params;}# deny access to .htaccess files, ifApache's document root# concurs with nginx's one#location ~ /\.ht {deny all;}
}

创建测试页面

cat >> /www/www.mydomain.com/htdocs/index.php <<PHP
<?php
phpinfo();
PHP

启动服务器

service php-fpm startservice nginx start

检查index.php输出

# curl -H HOST:www.mydomain.com http://127.0.0.1/index.php

5. redis-4.0.6

安装 Redis 因为YUM安装的Redis版本比较低,所以我们选择了源码安装

curl -s https://raw.githubusercontent.com/oscm/shell/master/database/redis/source/redis-4.0.6.sh | bash

安装redis

[root@localhost redis-4.0.6]# redis-cli
127.0.0.1:6379> set nickname netkiller 10
(error) ERR syntax error
127.0.0.1:6379> get nickname
(nil)
127.0.0.1:6379> set nickname netkiller
OK
127.0.0.1:6379> get nickname
"netkiller"
127.0.0.1:6379> expire nickname 5
(integer) 1
127.0.0.1:6379> get nickname
(nil)
127.0.0.1:6379>

6. MongoDB

curl -s https://raw.githubusercontent.com/oscm/shell/master/database/mongodb/mongodb.org/mongodb-3.6.sh | bash

转载于:https://my.oschina.net/neochen/blog/1606365

CentOS 7 + nginx-1.12 + php-7.2 + MySQL-5.7相关推荐

  1. 基于Centos搭建nginx+uwsgi运行django环境

    环境: CentOS 7 nginx/1.9.12 Python 2.7.5 一:安装依赖包5 yum install zlib-devel bzip2-devel pcre-devel openss ...

  2. RHEL5(CentOS)下nginx+php+mysql+tomcat+memchached配置全过程(转)

    RHEL5(CentOS)下nginx+php+mysql+tomcat+memchached配置全过程 一.准备工作:SSH,telnet终端中文显示乱码解决办法vi /etc/sysconfig/ ...

  3. php5.3+for+linux,Centos 安装 nginx + php5.3

    Centos 安装 nginx + php5.3,点开查看详情. #查看系统版本信息cat /etc/issue uname -a#设置时区 rm -rf /etc/localtime ln -s / ...

  4. Centos 通过 Nginx 和 vsftpd 构建图片服务器

    1.Nginx 简介 nginx_百度百科 Nginx (engine x) 是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP服务器.Nginx是由伊戈尔·赛索耶夫为俄罗斯 ...

  5. 在阿里云上打造属于你自己的APEX完整开发环境 (安装CentOS, Tomcat, Nginx)

    2019独角兽企业重金招聘Python工程师标准>>> Oracle APEX 系列文章3:在阿里云上打造属于你自己的APEX完整开发环境 (安装CentOS, Tomcat, Ng ...

  6. 重启centOS丢失nginx.pid导致无法启动nginx的解决方法

    重启centOS丢失nginx.pid导致无法启动nginx的解决方法 参考文章: (1)重启centOS丢失nginx.pid导致无法启动nginx的解决方法 (2)https://www.cnbl ...

  7. 12.6 Nginx安装 12.7 默认虚拟主机 12.8 Nginx用户认证 12.9 Nginx

    12.6 Nginx安装 [root@martin001 conf]# chkconfig --add nginx [root@martin001 conf]# chkconfig nginx on ...

  8. Centos中安装VMware 12

    Centos中安装VMware 12 下载linux版,VMware-Workstation-Full-*.bundle:(下载链接:http://pan.baidu.com/s/1o8CIr0Y 提 ...

  9. Centos配置nginx代理上网

    Centos配置Nginx正向代理上网 环境准备: 服务器:Centos(可以上网) 客户机:Centos(不能上网) 代理服务器 1.关闭防火墙 [root@localhost]# systemct ...

  10. Oracle APEX 系列文章3:在阿里云上打造属于你自己的APEX完整开发环境 (安装CentOS, Tomcat, Nginx)

    本文是钢哥的Oracle APEX系列文章中的第三篇,完整 Oracle APEX 系列文章如下: - Oracle APEX 系列文章1:Oracle APEX, 让你秒变全栈开发的黑科技 - Or ...

最新文章

  1. C# 获取当前路径方法
  2. mysql .net core_MySQL官方.NET Core驱动已出,支持EF Core
  3. springboot配置Redis哨兵主从服务 以及 Redis 集群
  4. ubuntu server安装php mysql_Ubuntu Server 下Apache+MySQL+PHP安装
  5. JAVA随机数之多种方法从给定范围内随机N个不重复数
  6. numpy基础(part4)--统计量
  7. js滑动到底部加载更多
  8. WMI 使用教程_.NET 入门教程
  9. pil python 安装_20行Python代码给微信头像戴帽子
  10. Spark-大规模数据处理计算引擎
  11. EXT学习经验分享:深刻理解EXT与服务器端的交互
  12. 如何简单快速的修改Bootstrap
  13. c++primer 第2章 书上例子 资料截图等
  14. 基于28181协议的视频与平台的对接
  15. 卸载微信重装微信聊天记录
  16. 计算机二级ms通过率,计算机二级office通过率高吗
  17. 移动开发期末大作业-备忘录app
  18. 如何在没有密码的情况下打开 Vivo 手机
  19. 重庆航天职业技术学院计算机系在哪个校区,重庆航天职业技术学院地址在哪里,哪个城市...
  20. 程序员必备技能之英语学习(一)

热门文章

  1. 《JavaScript面向对象编程指南》——1.7 训练环境设置
  2. 编写简单的UDP应用
  3. 【JAVA SERVLET 开发系列之二】创建WEBAPP详细步骤,通过SERVLET实现HTTP简单交互
  4. Eclipse helios 上编写arduino程序并进行烧录
  5. PHP + Redis 实现一个简单的twitter
  6. LeetCode-240 Search a 2D Matrix II
  7. 1.Easy Touch 3.1
  8. linux内核3.6版本及以下的bug引发的故障--cpu使用率100%
  9. UI学习笔记---第十四天数据持久化
  10. upload-labs--wp(21关)