Install Redis Cache on Ubuntu Server with PHP 7 and ownCloud

参考:
https://www.techandme.se/install-redis-cache-on-ubuntu-server-with-php-7-and-owncloud/

缓存,owncloud推荐使用的是 APCu 和 Redis,we with PHP 7 needed to build the PHP module as well, because PECL install didn’t work on PHP 7 yet. And as usual – as we didn’t find any good straight forward guide, here is one that works, enjoy!

原文说的已经很清楚了,细心点应该不会出错,我这里只记录我遇到的坑和How to through it.

tip1:

6. IF THE TEST WAS FINE, PROCEED WITH INSTALLATION

这步的命令是在redis的根目录下运行的

可能你会遇到提示信息: Hint: It's a good idea to run 'make test' ;)

$ sudo make install
$ cd utils && sudo ./install_server.sh

tip2:

git 的克隆和下载动作无法在虚拟机内完成,有墙,所以在本地完成后,然后去虚拟机,通过目录隐射来传递文件,把clone下来的文件放到指定的位置.

tip3:

无法安装 php7.0-dev
If you are coming from the old obsolete repository then remove it

$ sudo apt-get install python-software-properties
$ sudo apt-get install ppa-purge
$ sudo ppa-purge ppa:ondrej/php-7.0

Add the new repository and update

$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get autoremove

再安装一遍:

$ sudo apt-get install php7.0-dev

tip4:

由于我安装的是php7,所以 /etc/php/7.0 才是php所在目录,那么

$ touch /etc/php/mods-available/redis.ini

执行不会成功,应当是:

$ sudo touch /etc/php/7.0/mods-available/redis.ini

同样,

$ echo 'extension=redis.so' > /etc/php/mods-available/redis.ini

也不会成功了,我这里即使目录设置正确的情况下也是不行,所以就 vim 编辑 然后把 extension=redis.so 写到里面了.

tip5:

$ cd .. && rm -rf phpredis

这句删除的目录是 /etc/phpredis.