I saw a lot of incorrect installations, so I googled and found one installation was successful.
sudo apt-get install redis-server
This is to install redis
sudo apt-get install php5-redis
This is to install the php redis extension
sudo service php5-fpm restart
There is no need to be so troublesome on the Internet at all, so if you are programming, please Google more.
reference:
How to Install PHP Redis on Ubuntu