编译安装

curl -O https://download.redis.io/releases/redis-7.4.9.tar.gz
tar zxf redis-7.4.9.tar.gz
cd /home/zmy/software/redis/redis-7.4.9
make -j$(nproc)
make install PREFIX=/home/zmy/software/redis/install
cp redis.conf /home/zmy/software/redis/install/redis.conf
sudo sh -c 'cat > /etc/systemd/system/redis.service <<EOF
[Unit]
Description=Redis Server
After=network.target

[Service]
User=zmy
Group=zmy
Type=notify

ExecStart=/home/zmy/software/redis/install/bin/redis-server /home/zmy/software/redis/install/redis.conf
ExecStop=/home/zmy/software/redis/install/bin/redis-cli -h 127.0.0.1 -p 6379 -a hushi_redis123 shutdown

Restart=always

[Install]
WantedBy=multi-user.target
EOF'