Ubuntu 16.04 two ways to install redis tutorial details (apt and compilation)
The tutorials on two ways to install redis for ubuntu 16.04 are as follows:
Method 1: apt installation
To install Redi on a Ubuntu system, you can use the following command:
$sudo apt-get update $sudo apt-get install redis-server
Start Redis
$redis-server
Check to see if redis is started?
$redis-cli
The above command opens the following terminals:
Redis 127.0.0.1 purl 6379 >
127.0.0.1 is the native IP and 6379 is the redis service port. Now let's enter the PING command.
Redis 127.0.0.1 6379 > ping PONG
The above shows that we have successfully installed redis.
Method 2: compile and install
Ensure that the network is smooth, select the download work path, and execute the following command to download redis-3.2.6:
Sudo wget http://download.redis.io/releases/redis-3.2.6.tar.gz
Extract the file:
Sudo tar-zxvf redis-3.2.6.tar.gz
The folder redis-3.2.6 is generated under the current directory, and I moved it to the / usr/redis directory:
If you do not have gcc installed, you need to install:
Sudo apt-get install gcc
Go to the redis-3.2.6 directory and execute the following two commands in turn:
Sudo makesudo make install
Will be installed in the directory / usr/local/bin:
Now enter the folder obtained after the previous decompression (mine in / usr/redis), copy the configuration file redis.conf to / etc/redis/, and use the vi command to edit the file, change "daemonize no" to "daemonize yes", that is, set to run as a background process, save and exit after the modification is completed.
Go to the / usr/local/bin directory and execute the command: (default port 6379)
Redis-server / etc/redis/redis.confredis-cli-p 6379
Then execute the command ping, and if the output is pong, it proves that the service started successfully.
Execute a command
Set k1 helloworldget ki
The following information is output:
Execute the quit command to exit, and you can now view the process with the following command:
Ps-ef | grep redis
Summary
The above is the editor to introduce to you the two ways to install redis ubuntu 16.04 tutorial details (apt and compilation), I hope to help you, if you have any questions, please leave me a message, the editor will reply to you in time. Thank you very much for your support to the website!