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 ...
随机推荐
- ARC 与非 ARC 之间那些的'祸害'
你是否也曾被 assign.retain.copy.release.autorelease.strong.__strong.weak.__weak.__unsafe__unretain.__autor ...
- Windows Server 2008 R2组策略设置计算机配置和用户配置
一.认识Windows Server 2008 R2域控组策略管理 1.域控服务器zhuyu.com的组策略管理默认会读取AD用户和计算机目录下创建的OU容器(组织单元), 在对应的OU容器创建对应的 ...
- 几种获取IP 根据IP获取地址的方法 JS,第三方 新浪 网易 腾讯
第一种是利用纯真ip数据库,这个可以在网上找到很多,缺点是更新有点慢. 第二种是利用门户网站的接口 目前已知的有腾讯.新浪.网易.搜狐和Google提供IP地址查询API,但是找得到的只有腾讯.新浪和 ...
- python基础之元组、文件操作、编码、函数、变量
1.集合set 集合是无序的,不重复的,主要作用: 去重,把一个列表变成集合,就可以自动去重 关系测试,测试两组数据的交集,差集,并集等关系 操作例子如下: list_1 = [1,4,5,7,3,6 ...
- iOS计算完整文字高度(适应iOS 10)
动态计算文字的高度:(切记LineSapcing>=2,不然会显示不全) +(CGSize) boundingALLRectWithSize:(NSString*) txt Font:(UIFo ...
- ps commad
要对系统中进程进行监测控制,查看状态,内存,CPU的使用情况,使用命令:/bin/ps (1) ps :是显示瞬间进程的状态,并不动态连续: (2) top:如果想对进 ...
- ElasticSearch作为Windows服务启动
由于公司服务器用的Windows服务器,所以你懂得…… 直接下载elasticsearch中文发行版.下载地址是:https://github.com/medcl/elasticsear ...
- Leetcode: Android Unlock Patterns
Given an Android 3x3 key ≤ m ≤ n ≤ , count the total number of unlock patterns of the Android lock s ...
- 关于ssh_copy_id脚本解析
[oldgirl@module ~]$ more /usr/bin/ssh-copy-id #!/bin/sh # Shell script to install your public key on ...
- paper 118:计算机视觉、模式识别、机器学习常用牛人主页链接
牛人主页(主页有很多论文代码) Serge Belongie at UC San Diego Antonio Torralba at MIT Alexei Ffros at CMU Ce Liu at ...