Jump to content
IPS Community Suite 简体中文
Sign in to follow this  
ipscn

Install Redis in Ubuntu

Recommended Posts

 

 

sudo apt install build-essential tcl

 

 

sudo apt install redis-server
sudo systemctl status redis-server

 

Just in case, if it is not started already, you can start it as shown below.

sudo nano chmod 644 /etc/redis/redis.conf

 

sudo systemctl enable redis-server
sudo systemctl start redis-server
sudo systemctl restart redis
Warning: The unit file, source configuration file or drop-ins of redis.service changed on disk. Run 'systemctl daemon-reload' to reload units.

 

2018-10-17 01-31-30 的屏幕截图.png

 

测试是否可用

redis-cli

2018-10-17 01-32-32 的屏幕截图.png

 

2018-10-17 01-34-13 的屏幕截图.png

修改配置

sudo nano /etc/redis/redis.conf

 

maxmemory 768mb
maxmemory-policy allkeys-lru

重启服务‘

sudo systemctl restart redis-server.service

 

安装 php-redis

pecl config-set php_ini /ect/php/7.2/fpm/php.ini
pecl install redis

或者编译安装

wget http://download.redis.io/releases/redis-stable.tar.gz
tar -xzvf redis-stable.tar.gz
cd redis-stable

 

/usr/bin/phpize7.2 

看到

uuu@uuu:~/下载/redis-4.1.1$ /usr/bin/phpize7.2
Configuring for:
PHP Api Version:         20170718
Zend Module Api No:      20170718
Zend Extension Api No:   320170718

编译前的配置

./configure --with-php-config=/usr/bin/php-config7.2

编译和安装

make
make test

没有异常后,安装

sudo make install

2018-10-17 01-57-15 的屏幕截图.png

修改php.ini

sudo nano /etc/php/7.2/fpm/php.ini

添加

extension_dir = "/usr/lib/php/20170718/"
[redis]
extension=redis.so

 

http://pecl.php.net/package/redis

 

 

 

https://www.ostechnix.com/install-configure-redis-server-ubuntu/

https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-redis-on-ubuntu-18-04

php7.2 + redis

https://blog.csdn.net/moliyiran/article/details/80890799

https://www.howtoforge.com/tutorial/install-apache-with-php-and-mysql-on-ubuntu-18-04-lamp/

https://www.linode.com/docs/web-servers/

https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-ubuntu-18-04

 

https://devanswers.co/ubuntu-php-php-ini-configuration-file/

https://blog.csdn.net/Eric_Alive/article/details/79713727?utm_source=blogxgwz0

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×