Home  >  Article  >  Backend Development  >  Install redis on CentOS7

Install redis on CentOS7

不言
不言Original
2018-06-02 16:07:121702browse

This article mainly introduces the installation of redis on CentOS7, which has certain reference value. Now I share it with everyone. Friends in need can refer to it

redis installation

Install dependencies

sudo yum install gcc gcc-c++

Install redis

tar zxvf redis-4.0.9.tar.gzcd 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/

Configure environment variables:

vi /etc/profileexport PATH="$PATH:/application/redis/bin"source /etc/profile

Open redis service

cd /application/redis
bin/redis-server etc/redis.conf

Close redis

kill `cat /var/run/redis_6379.pid`

Set up background operation

vi /application/redis/etc/redis.conf
136行 daemonize yes

Write the startup script in rc.local(linux)

vi /etc/rc.local
/application/redis/bin/redis-server /application/redis/etc/redis.conf &

redis extension installation

sudo yum install autoconf

redis extension installation

cd /root/package/
wget https://pecl.php.net/get/redis-4.0.2.tgztar 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

Modify php .ini

vi /application/php/lib/php.ini
extension=redis.so(大约920行)

CentOS7 boot /etc/rc.local does not execute problem

chmod +x /etc/rc.d/rc.local

The above is the detailed content of Install redis on CentOS7. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:yum install lanmpNext article:yum install lanmp