Redis 7.0.8 installation in Linux system

1 Official website address

Download address: https://redis.io/download/

insert image description here

2 Check if the gcc compiler is installed

redisis C++written, therefore, requiresgcc

gcc --version

Install the gcc compiler if not

yum install -y gcc

3 install redis

3.1 Unzip the uploaded Redis installation package

tar -zvxf redis-7.0.4.tar.gz

3.2 Enter the decompression directory and compile

cd redis-7.0.8/
make
  • Wait for a while, the compilation is complete! ! !
    insert image description here

3.3 Installation command

  • default installation
make install

Default installation directory The contents of /usr/local/bin
the installation are
redis-benchmark: performance testing tools, which can be run on your own computer, to see how your book performs
redis-check-rdb: repairing problematic dump.rdbfiles
redis-sentinel: Rediscluster use
redis-check-aof: repairing problematic AOFfiles
redis-cli: client, operation entry
redis-server: Redisserver startup command
auto Define the installation directory

make install PREFIX=[安装位置目录]

binThe production directory will be created under the custom installation directory

  • Here is a custom installation
make install PREFIX=/opt/redis/redis-7.0.8

insert image description here

4 modify the configuration

4.1 Configure environment variables

  • Open/etc/profile
vim /etc/profile
  • Add at the end:
export REDIS_HOME=/opt/redis/redis-7.0.8
export PATH=$PATH:$REDIS_HOME/bin

insert image description here

  • Refresh the configuration file to make the configuration take effect
source /etc/profile

4.2 Modify the redis configuration file

4.2.1 Setting background startup

  • Modify the file redis.conf, daemonize nochange the setting toyes
vim redis.conf

Due to the large content of the file, you can enter it through a quick search: /daem+ 回车Quickly locate the content that needs to be modified, and press nFind Next.

4.2.2 Set to allow external access

Modify redis.confthe file, commenting out bind 127.0.0.1 -::1orbind 0.0.0.0

4.2.3 Set redis password

Modify redis.confthe file and find requirepassthe setting password

5 start

Switch to the bin directory and use the modified configuration file

redis-server ../redis.conf

6 Whether the test was successful

6.1 Use redis-cli link

redis-cli -p 6379
flushall  //清空数据库
  • display OK, then success!

6.2 Check whether the redis process is enabled

ps -ef|grep redis
  • The port number of the process is6379

7 Close the redis service

shutdown
exit  //退出redis服务

insert image description here

Guess you like

Origin blog.csdn.net/weixin_43684214/article/details/128906857