redis安装
安装依赖
sudo yum install gcc gcc-c++
安装redis
tar zxvf redis-4.0.9.tar.gz
cd redis-4.0.9
make
mkdir /application/redis
mkdir /application/redis/bin
mkdir /application/redis/etc
cp src/redis-server src/redis-cli src/redis-benchmark src/redis-check-aof src/redis-sentinel /application/redis/bin/
cp redis.conf /application/redis/etc/
配置环境变量:
vi /etc/profile
export PATH="$PATH:/application/redis/bin"
source /etc/profile
开启redis服务
cd /application/redis
bin/redis-server etc/redis.conf
关闭redis
kill `cat /var/run/redis_6379.pid`
设置后台运行
vi /application/redis/etc/redis.conf
136行 daemonize yes
将启动脚本写在rc.local(linux)
vi /etc/rc.local
/application/redis/bin/redis-server /application/redis/etc/redis.conf &
redis扩展安装
sudo yum install autoconf
redis扩展安装
cd /root/package/
wget https://pecl.php.net/get/redis-4.0.2.tgz
tar zxvf redis-4.0.2.tgz
cd redis-4.0.2
/application/php/bin/phpize
./configure --with-php-config=/application/php/bin/php-config && make && make install
修改php.ini
vi /application/php/lib/php.ini
extension=redis.so(大约920行)
CentOS7 开机/etc/rc.local不执行问题
chmod +x /etc/rc.d/rc.local