Linux installation Redis server detailed tutorial

Linux installation Redis server detailed tutorial

1. Redis official website download

1.1. Direct access to the download address of each version of Redis: link: Redis download address , here I choose redis-3.0.7.tar.gz version, this version is relatively stable at present, and then right-click to copy its link address, this The address we will use below.
1.2. Log in to your own Linux server through the ssh tool. Here I use the xshell tool. We log in to our own server and use the following command: (Note: The address below is the address just copied by right-clicking above)
wget http://download.redis.io/releases/redis-3.0.7.tar.gz
1.3. The blogger chooses to download its tar.gz compressed package from /home/sofeware under Linux (the software folder here is customized by the blogger, of course you can also create folders with other names), here you can create your own Define the selected download directory, as shown in the following figure:insert image description here
1.4. Click the OK button to download. After downloading, check the directory. The code is downloaded successfully as shown in the figure below: (you can see that the red circle below is the Redis we downloaded)

insert image description here

2. Linux environment and its Redis configuration file modification

2.1. Before operation, we need to download some environment required by Redis in Linux, use the following command:
yum install gcc-c++
yum install -y tcl
2.2. Then we unzip the compressed package in the current directory and use the following command:
tar -zxvf redis-3.0.7.tar.gz
2.3. Then get the redis file directory, as shown in the figure below:insert image description here
2.4. Use the following command to enter the root directory of redis
cd redis-3.0.7/
2.5. Then use the following command to compile:
make
ERROR prompt: The following errors may be reported:
zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directory
zmalloc.h:55:2: error: #error "Newer version of jemalloc required"
Solution: Use the following command to compile:
make MALLOC=libc
2.6. Next, use the following command to install: (/home/app/redis here is my custom directory, you can customize it according to your favorite directory, the same below)
make install PREFIX=/home/app/redis/
Then we move redis.conf under redis-3.0.7 to /home/app/redis/bin and use the following command:
mv redis.conf /home/app/redis/bin/
Then we enter this directory and modify the files in redis.conf, as follows:
cd  /home/app/redis/bin/
vim redis.conf
Find this line in the file and change no to yesinsert image description here

3. Redis startup test

3.1 Start Redis in the foreground, use the following command (in the bin directory):
./redis-server 
As shown in the figure, the startup is successful:

insert image description here

3.1 Start Redis in the background, use the following command (in the bin directory):
./redis-server redis.conf 
Use the following commands to view ports and connect clients
netstat -tunlp |grep 6379(查看端口)

insert image description here

./redis-cli(客户端连接)

insert image description here

At this point, the Linux installation of Redis has been completed!

Guess you like

Origin blog.csdn.net/qq_32575047/article/details/106473140