centos7 安装php7+mysql5.7+nginx+redis
、1.先修改yum源 https://webtatic.com
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
rpm -Uvh http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
2.安装nginx
yum install nginx
3.安装mysql5.7
yum -y install mysql-community-server
4.安装php
yum install php70w-devel php70w.x86_64 php70w-pecl-redis php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-pdo.x86_64 php70w-mysqlnd php70w-fpm php70w-opcache
5.开始简单的配置
添加运行目录
mkdir -p /var/run/mysqld/
chown mysql.mysql /var/run/mysqld/
mysql 配置
vim /etc/my.cnf
在[client] 下面添加
default-character-set=utf8
在 [mysqld] 下面添加
character_set_server=utf8
init_connect='SET NAMES utf8'
collation-server=utf8_general_ci
保存退出
获取初始密码
grep 'temporary password' /var/log/mysqld.log
得到
注意 里面包括开头的 ;号
然后登陆mysql 修改密码
alter user root@localhost identified by 'tyzZ001!'
如果密码太过于简单可能不然修改因为mysql默认设置了密码复杂度 至少8位 必须包含 大小写字母数字及符号
查看密码策略:
show variables like '%password%';
说明:
validate_password_dictionary_file:密码策略文件,策略为STRONG才需要
validate_password_length:密码最少长度
validate_password_mixed_case_count:大小写字符长度,至少1个
validate_password_number_count :数字至少1个
validate_password_special_char_count:特殊字符至少1个 上述参数是默认策略MEDIUM的密码检查规则。
validate_password_policy:密码策略,默认为MEDIUM策略 ,共有如下三种密码策略:
0 or LOW Length
1 or MEDIUM Length; numeric, lowercase/uppercase, and special characters
2 or STRONG Length; numeric, lowercase/uppercase, and special characters; dictionary file
可以通过 set GLOBAL validate_password_policy=0 来修改
或者修改/etc/my.cnf文件
validate_password_policy=0 #0(LOW),1(MEDIUM),2(STRONG)其中一种,注意2需要提供密码字典文件
如果不需要密码策略,添加my.cnf文件中添加如下配置禁用即可:
validate_password = off
添加一个可以在外部登陆的mysql用户
grant all privileges on *.* to 创建的用户名 @"%" identified by "密码";
flush privileges;
注意修改配置文件后需要重启mysql
配置nginx:
nginx可以的默认配置文件一般在:
/etc/nginx/nginx.conf
使用 cat 查看一下配置文件
这行表示nginx会引用 conf.d 这个文件夹下面所有.conf后缀的文件
那么在conf.d下面我们来建立我们自己的配置文件
vim /etc/nginx/conf.d/user.conf
在里面写入:
server {
listen ;#端口
server_name admin.com www.admin.com; # 域名 root /home/www/web/newomcat/admin; # 网站根目录
index index.php index.html index.htm;#默认的index # 建议放内网
# allow 192.168.0.0/;
# deny all; location / { if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?$ last;#去除url中的index.php 不需要可以不写 } } location ~ \.php$ {
try_files $uri = ;
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
这样 简单的lnmp就安装好了
systemctl restart php-fpm #启动php
systemctl restart nginx #启动nginx
systemctl restart mysqld #启动mysql
6安装redis
下载源码包:
wget http://download.redis.io/releases/redis-3.2.5.tar.gz
或者使用yum安装也可以
yum install redis
解压下载好的远吗包:
tar -zxf redis-3.2..tar.gz
进入解压后的文件夹
cd redis-3.2.
make编译安装
make
安装完成后 在目录下会有一个 src目录里面放的是 redis的命令 当前目录下会有一个redis.conf 这个是 redis的配置文件 我们需要对他们进行处理一下放别以后的使用
建立两个目录
mkdir -p /usr/local/redis/bin 命令目录
mkdir -p /usr/local/redis/etc 配置文件目录
将配置文件移动到/usr/local/redis/ext 目录 将 src下的mkreleasehdr.sh redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-sentinel redis-server redis-trib.rb 这个几个文件移动到/usr/local/redis/bin这个目录
mv ./redis.conf /usr/local/redis/etc/
mv mkreleasehdr.sh redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-sentinel redis-server redis-trib.rb /usr/local/redis/bin/
打开 /usr/local/redis/etc/redis.conf 文件 修改配置 让redis在启动时在后台运行
找到这一项 改为 yes 原来为 no
最后将其注册为系统服务
在/etc/init.d/目录下建立redis 文件
vim /etc/init.d/redis
写入内容
###########################
#!/bin/sh
#chkconfig:
#description:auto_run
PATH=/usr/local/bin:/sbin:/usr/bin:/bin REDISPORT=
EXEC=/usr/local/redis/bin/redis-server
REDIS_CLI=/usr/local/redis/bin/redis-cli PIDFILE=/var/run/redis_${REDISPORT}.pid
CONF="/usr/local/redis/etc/redis.conf" case "$1" in
start)
if [ -f $PIDFILE ]
then
echo "$PIDFILE exists, process is already running or crashed"
else
echo "Starting Redis server..."
$EXEC $CONF
fi
if [ "$?"="" ]
then
echo "Redis is running..."
fi
;;
stop)
if [ ! -f $PIDFILE ]
then
echo "$PIDFILE does not exist, process is not running"
else
PID=$(cat $PIDFILE)
echo "Stopping ..."
$REDIS_CLI -p $REDISPORT SHUTDOWN
while [ -x ${PIDFILE} ]
do
echo "Waiting for Redis to shutdown ..."
sleep
done
echo "Redis stopped"
fi
;;
restart|force-reload)
${} stop
${} start
;;
*)
echo "Usage: /etc/init.d/redis {start|stop|restart|force-reload}" >&
exit
esac
###########################
保存退出
设置权限
chmod +x /etc/init.d/redis
设置自动启动:
chkconfig redis on
设置 mysql php nginx 自动启动
systemctl enable redis
systemctl enable php-fpm
systemctl enable mysqld
systemctl enable nginx
转载请注明来源:http://www.cnblogs.com/phpshen/p/6222935.html
centos7 安装php7+mysql5.7+nginx+redis的更多相关文章
- centos7.6编译安装php7.2.11及redis/memcached/rabbitmq/openssl/curl等常见扩展
centos7.6编译安装php7..11及redis/memcached/rabbitmq/openssl/curl等常见扩展 获取Php的编译参数方法: [root@eus-api-cms-bac ...
- Centos7 安装PHP7版本及php-fpm,redis ,php-redis,hiredis,swoole 扩展安装
============================PHP7.1 ========================================= 1. 更换rpm 源,执行下面两个 rpm - ...
- centos7安装PHP7的redis扩展
前言: 在本篇博客中,我将给大家介绍如何在Centos7上安装PHP-Redis扩展,关于如何在Centos上安装redis的,可以参考另外一篇博客:Centos7安装redis 想要在php中操作r ...
- CentOS7 安装PHP7的swoole扩展:
一.绪 Swoole简介 PHP异步网络通信引擎 最终编译为so文件作为PHP的扩展 准备工作 Linux环境 PHP7 swoole2.1 redis 源码安装PHP7 源码安装swoole htt ...
- 在ubuntu16.04上安装php7 mysql5.7 nginx1.10并支持http2
安装nginx 首先更新软件包 并且安装nginx sudo apt-get update sudo apt-get install nginx 开放防火墙配置 sudo ufw allow 'Ngi ...
- CentOS7 安装 PHP7.2
点击查看原文 安装源 安装 EPEL 软件包: $ sudo yum install epel-release 安装 remi 源: $ sudo yum install http://rpms.re ...
- centos7安装php7.3
安装php7.3 CentOS/RHEL 7.x: yum install epel-release yum install http://rpms.remirepo.net/enterprise/r ...
- centos7 安装php7遇到的问题
环境中安装过php 5.4,觉得版本太低了,因此删除旧版本安装了新版本 1. 安装epel-release 通过命令: rpm -ivh http://dl.fedoraproject.org/pub ...
- CentOS7 安装PHP7的redis扩展:
phpredis-4.2.0.tar.gz:下载:wget https://github.com/phpredis/phpredis/archive/4.2.0.tar.gz $ tar -z ...
随机推荐
- PHP部分资料
完善PHP登陆注册页面,同时连接mysql数据库 http://blog.csdn.net/tianlu1677/article/details/7765889/ PHP 附录 : 用户注册与登录完整 ...
- 吓哭原生App的HTML5离线存储技术,却出乎意料的容易!【低调转载】
吓哭原生App的HTML5离线存储技术,却出乎意料的容易![WeX5低调转载] 2015-11-16 lakb248 起步软件 近几天,WeX5小编编跟部分移动应用从业人士聊了聊,很多已经准备好全面拥 ...
- CentOS 6.2 SVN搭建 (YUM安装)
安装说明 安装了一下SVN服务器,本文没有与Apache整合,过程如下: 系统环境:CentOS-6.2安装方式:yum install (源码安装容易产生版本兼容的问题)安装软件:系统自动下载SVN ...
- Java工程师三大框架面试题汇总
1. Hibernate3 提供了属性的延迟加载功能? 当Hibernate在查询数据的时候,数据并没有存在与内存中,当程序真正对数据的操作时,对象才存在与内存中,就实现了延迟加载,他节省了服务器的内 ...
- .NET组件控件实例编程系列——5.DataGridView数值列和日期列
在使用DataGridView编辑数据的时候,编辑的单元格一般会显示为文本框,逻辑值和图片会自动显示对应类型的列.当然我们自己可以手工选择列的类型,例如ComboBox列.Button列.Link列. ...
- python学习笔记系列----(六)错误和异常
python至少有2类不同的错误:语法错误(Syntax Errors)和异常(Exceptions). 8.1 语法错误 这个单词应该还是很有必要认识的,呵呵,语法错误,也叫解析错误,是我们最不愿意 ...
- Ideas about the future of management
1. Business markets a. greater competition among companies b. increase in power of global companies ...
- Best Part
- SQLite的优化总结
网上关于SQL优化的教程很多,但是比较杂乱.近日有空整理了一下,写出来跟大家分享一下. 1.对查询进行优化,要尽量避免全表扫描,首先应考虑在 where 及 order by 涉及的列上建立索引. 2 ...
- window7下安装第三方包报错及解决
window7 64位下安装第三方包,,比如安装yaml的exe执行文件,会 报错及解决:python version 2.7(3.4) required,which was not found in ...