How to install redis and redis extensions for Linux platform
- 2020-11-25 07:48:56
- OfStack
An example of Linux platform shows how to install redis and extend redis. To share for your reference, the details are as follows:
Download address: http: / / redis io/download, download the latest document version.
The documentation version used in this tutorial is 2.8.17. Download and install:
$ wget http://download.redis.io/releases/redis-2.8.17.tar.gz
$ tar xzf redis-2.8.17.tar.gz
$ cd redis-2.8.17
$ make
After the completion of make, the compiled redis service program redis-ES19en and the test client program ES20en-ES21en will appear in the redis-2.8.17 directory. The two programs are located in the installation directory src:
Now start the redis service.
$ cd src
$ ./redis-server
Note that redis is launched this way using the default configuration. You can also tell redis to start using the specified configuration file using the following command via the boot parameter.
$ cd src
$ ./redis-server redis.conf
redis.conf is a default configuration file. We can use our own configuration files as needed.
Once the redis service process is started, you can interact with the test client programs ES39en-ES40en and redis services. Such as:
$ cd src
$ ./redis-cli
redis> set foo bar
OK
redis> get foo
"bar"
This completes the successful installation of redis on linux, but one more extension is needed. Keep going ~~
cd redis-3.2.1/ // Enter the redis directory
Vi redis.conf // The configuration file
bind 127.0.0.1 // Comment that out #
bind liunx ip // Now others can also connect to you redis the
Install the Redis extension
wget https://github.com/phpredis/phpredis/archive/2.2.8.tar.gz // download redis extension
tar xzf 2.2.8.tar.gz.1
cd phpredis-2.2.8/ // Additional extensions:
whereis phpize
yum install php-devel
/usr/bin/phpize
./configure --with-php-config=/usr/bin/php-config
make
make install // The following:
Modify php ini
file
cd ~vi /etc/php.ini
Find extension and put this
extension=redis.so
On php. ini
:wq
systemctl restart httpd // restart Apache Additional extensions:
systemctl restart nginx.service // restart nginx Additional extensions:
systemctl restart php-fpm.service // restart php-fpm View in a browser
phpinfo message If redis appears, the redis extension is ready
Restart ES74en-ES75en Type ip of nginx in the browser to view phpinfo information
If redis is present, the redis extension is ready
This completes the installation of the redis extension. Thank you ~
I hope this article has been helpful in configuring and maintaining the Linux environment.