The Linux server installs the Redis tutorial

  • 2020-05-27 08:03:28
  • OfStack

The website configuration of Redis can increase the concurrency capability of the server. Here is a brief introduction of how to install the Redis service.

Download and install

Distributions of Redis can be found directly here.


wget http://download.redis.io/releases/redis-stable.tar.gz  // Download installation package 
tar zxf redis-stable.tar.gz  // Unpack the 
cd redis-stable  // Go to the unzip folder 
make && make install  // Compile and install 
cp redis.conf /etc/redis.conf  // Copy configuration files 
cd src  // Enter the src folder 
cp redis-server redis-cli redis-benchmark /usr/local/bin/  // copy 2 A binary file 

When you have completed the above steps, Redis will be installed.

Parameter configuration

Before starting the Redis service, you need to make a definite adjustment to the parameters.


mkdir /var/lib/redis_db/ -p  // Create a database folder 
vim /etc/redis.conf  // Edit configuration file 

Find the following parameters in the editor and modify them. If you find it troublesome to search the Shell interface, you can directly download the above configuration files to the computer with FTP software and upload them to the computer after local editing.


daemonize yes  // Enable daemon operation 
logfile "/var/log/redis.log" // Log file path 
dir /var/lib/redis_db/   // Data persistence folder 

Run using


redis-server /etc/redis.conf  // Start with the configuration file Redis

If you want to see if it started correctly, you can look directly at our log file.


tail -100 /var/log/redis.log  // View log files 

If started correctly, you can see the following information in the Shell window (Redis logo on the left).


Redis 3.2.8 (00000000/0) 32 bit
Running in standalone mode
Port: 6379
PID: 5907
http://redis.io

Related articles: