這篇文章主要介紹了關於CentOS7安裝redis ,有著一定的參考價值,現在分享給大家,有需要的朋友可以參考一下
redis安裝
安裝依賴
sudo yum install gcc gcc-c++
安裝redis
tar zxvf redis-4.0.9.tar.gzcd redis-4.0.9makemkdir /application/redismkdir /application/redis/binmkdir /application/redis/etccp 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/profileexport PATH="$PATH:/application/redis/bin"source /etc/profile
開啟redis服務
cd /application/redisbin/redis-server etc/redis.conf
關閉redis
kill `cat /var/run/redis_6379.pid`
設定後台運行
vi /application/redis/etc/redis.conf136行 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.tgztar zxvf redis-4.0.2.tgzcd 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.iniextension=redis.so(大約920行)
CentOS7 開機/etc/rc.local不執行問題
chmod +x /etc/rc.d/rc.local