在RHEL/CentOS安装Redis

0. preinstall

  • User set
$ useradd tdtc
$ passwd tdtc

1) yum install

$sudo yum groupinstall "Development Tools"
$sudo yum install tcl wget

v6+

Just to clarify: there is no way this issue will be fixed, Redis >= 6 will require a C11 compiler.

sudo yum install centos-release-scl
sudo yum install devtoolset-8
scl enable devtoolset-8 bash

2) verification

$gcc -v
$make -v
$echo 'puts [info patchlevel];exit 0' | tclsh

1. installation

1) install

$wget https://download.redis.io/releases/redis-6.0.16.tar.gz
$tar xzvf redis-6.0.16.tar.gz
$cd redis-6.0.16
$make
## Single Core
$taskset -c 0 make test
## sudo
$sudo make install

2) config

$sudo mkdir /etc/redis
$sudo mkdir -p /var/redis
$sudo cp /home/tdtc/redis-6.0.16/redis.conf /etc/redis

redis.conf

port  6379				         #default port is already 6379.
daemonize yes			         #run as a daemon
supervised systemd			     #signal systemd
pidfile /var/run/redis_6379.pid  #specify pid file
loglevel notice			         #server verbosity level
logfile /var/log/redis.log		 #log file name
dir  /var/redis/		         #redis directory

2. command

You do not need to execute the following commands when you are not maintaining it, only the first time.

»