安装nginx
安装nginx源
yum localinstall http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
安装nginx
yum install nginx
启动nginx
service nginx start
安装MySQL5.7.*
安装mysql源
yum localinstall http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
安装mysql
yum install mysql-community-server
安装mysql的开发包,以后会有用
yum install mysql-community-devel
启动mysql
systemctl restart mysqld
查看mysql启动状态
systemctl status mysqld
获取mysql默认生成的密码
grep 'temporary password' /var/log/mysqld.log
换成自己的密码
image.pngmysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '你的密码';
mysql> quit;
安装php7.2
安装 EPEL 软件包
yum install epel-release
安装 remi 源
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
安装 yum 扩展包
yum install yum-utils
启用 remi 仓库
yum-config-manager --enable remi-php72 $ sudo yum update
安装php7.2
yum install php72
安装扩展
sudo yum install php72-php-fpm php72-php-gd php72-php-json php72-php-mbstring php72-php-mysqlnd php72-php-xml php72-php-xmlrpc php72-php-opcache
php-fpm 服务设置开机自启
systemctl enable php72-php-fpm.service
路径整理
nginx 配置文件
/etc/nginx/nginx.conf
nginx 默认项目路径
/usr/share/nginx/html
安装目录
/etc/opt/remi/php72
安装redis
我都是在 usr/local/ 下创建的redis目录,切换到redis目录,执行下面的命令
wget http://download.redis.io/releases/redis-4.0.9.tar.gz
tar -zxvf redis-4.0.9.tar.gz
mv redis-4.0.9 /usr/local/redis
cd /usr/local/redis
make
make install
启动redis服务
cd src
./redis-server
接下来修改redis.conf,设置密码和后台运行方式
requirepass foobared 将“foobared”改成自己的密码
daemonize no 将“no”改为yes
配置redis服务管理脚本:
cp /usr/local/redis/redis-4.0.9/utils/redis_init_script /etc/init.d/redis
修改redis,vim /etc/init.d/redis
CONF="/usr/local/redis/redis-4.0.9/redis.conf"
启动redis服务
$ /etc/init.d/redis start
Starting Redis server...
12797:C 30 May 22:53:34.030 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
12797:C 30 May 22:53:34.030 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=12797, just started
12797:C 30 May 22:53:34.031 # Configuration loaded
安装PHP redis扩展
wget https://github.com/phpredis/phpredis/archive/4.0.2.tar.gz
tar -zxvf phpredis-4.0.2.tar.gz
cd phpredis-4.0.2
find / -name php-config
#找到php-config,如果找不到,执行yum -y install php-devel
#sudo phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
将redis.so添加到php.ini中
extension=redis.so
重启php-fpm
systemctl restart php72-php-fpm
网友评论