安装Redis
下载安装redis
cd /mnt
wget http://download.redis.io/releases/redis-5.0.5.tar.gz
tar xzf redis-5.0.5.tar.gz
cd redis-5.0.5
make && make install PREFIX=/usr/local/redis
移动配置文件
mkdir /usr/local/redis/etc
mv redis.conf /usr/local/redis/etc
配置redis为后台启动
vim /usr/local/redis/etc/redis.conf
daemonize yes
将redis加入到开机启动
vim /etc/rc.local
/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf
设置redis密码
/usr/local/redis/bin/redis-cli config set requirepass 123456
再次连接redis
再次连接redis<br>/usr/local/redis/bin/redis-cli -h 127.0.0.1 -p 6379 -a 123456
启动redis
/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf
停止redis pkill redis
pkill redis
安装 phpredis客户端
cd /mnt/
wget http://pecl.php.net/get/redis-5.2.1.tgz
tar zxf redis-5.2.1.tgz
cd redis-5.2.1/
/usr/local/php/bin/phpize
./configure
make && make install
# 添加redis扩展
vim /usr/local/php/etc/php.ini extension=redis.so
# 重启php-fpm
pkill -USR2 php-fpm
查看是否安装成功
/usr/local/php/bin/php -m | grep redis
安装Swoole
wget http://pecl.php.net/get/swoole-4.4.17.tgz
tar zxf swoole-4.4.17.tgz
cd swoole-4.4.17/
/usr/local/php/bin/phpize
./configure
make && make install
# 添加swoole扩展
vim /usr/local/php/etc/php.ini extension=swoole.so