Home  >  Article  >  Database  >  How to install redis and redis extension on Ubuntu

How to install redis and redis extension on Ubuntu

王林
王林forward
2023-05-26 17:52:401297browse

1. Download the latest source code package

How to install redis and redis extension on Ubuntu
Copy the link address to be downloaded

How to install redis and redis extension on Ubuntu

wget http://download.redis.io/releases/redis-x.x.x.tar.gz

Warm reminder:Above The redis version number of the downloaded redis code is based on your own version. Don’t copy blindly.

2. Unzip and install.

a. Unzip

tar zxvf redis-x.x.x.tar.gz

b. Installation

cd redis-x.x.x
make

c. After make is completed, the redis-related programs redis-cli and redis-server will be in the src directory
d. Copy redis-server and redis-cli to /usr/local/redis/bin(You can create the directory in advance)
e. Copy the redis configuration file redis.conf to /usr/local/redis
How to install redis and redis extension on Ubuntu

f. Configure the environment variable PATH,Add /usr/local/redis/bin
How to install redis and redis extension on Ubuntu

3. Redis configuration(redis.conf& #xff09;

Password configuration requirepass xxxxxxxx (password)
Monitor bind 0.0.0.0 //Test environment

4. Start Redis

/usr/local/redis/bin/redis-server /usr/local/redis/redis.conf &

5. Log in to Redis

 /usr/local/redis/bin/redis-cli

6. Installation successful

How to install redis and redis extension on Ubuntu

Install Redis extension

1. Check whether the redis extension has been installed:
View phpinfo page or php -m | grep redis
2. Download the extension source code package:
PHP extension official website: pecl.php.net,Search redis
How to install redis and redis extension on Ubuntu
How to install redis and redis extension on Ubuntu
How to install redis and redis extension on Ubuntu
Select the stable version(stable) to download.

2. Compile and install

	解压 源码包: tar xvf xxx.tgz
	进入解压后的目录,依次执行
	phpize
	./configure
	make && make install

3. Modify php.ini

添加  extension = redis.so

4. Restart PHP-FPM

systemctl restart  php

5. Confirm

查看phpinfo页面
或  php -m | grep redis

The above is the detailed content of How to install redis and redis extension on Ubuntu. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete