Home > Backend Development > PHP Tutorial > Install redis on CentOS7

Install redis on CentOS7

不言
Release: 2023-03-29 15:08:02
Original
1715 people have browsed it

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++
Copy after login

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/
Copy after login

Configure environment variables:

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

Open redis service

cd /application/redis
bin/redis-server etc/redis.conf
Copy after login

Close redis

kill `cat /var/run/redis_6379.pid`
Copy after login

Set up background operation

vi /application/redis/etc/redis.conf
136行 daemonize yes
Copy after login

Write the startup script in rc.local(linux)

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

redis extension installation

sudo yum install autoconf
Copy after login

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
Copy after login

Modify php .ini

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

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

chmod +x /etc/rc.d/rc.local
Copy after login

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template