菜单

Juning
发布于 2021-10-09 / 636 阅读
1
0

Cent OS安装Redis

yum -y install epel-release wget make gcc-c++

wget https://download.redis.io/releases/redis-6.2.6.tar.gz


tar -xf redis-6.2.6.tar.gz
cd redis-6.2.6
make
make install PREFIX=/usr/local/redis


cp redis.conf /etc/redis.conf
sed -i "s/bind 127.0.0.1/bind 0.0.0.0/g" /etc/redis.conf
sed -i "s/daemonize no/daemonize yes/g" /etc/redis.conf
sed -i "481i requirepass weakPassword" /etc/redis.conf

vi /etc/systemd/system/redis.service
[Unit]
Description=Redis persistent key-value database
After=network.target
After=network-online.target
Wants=network-online.target

[Service]
Type=forking
PIDFile=/var/run/redis_6379.pid
ExecStart=/usr/local/redis/bin/redis-server /etc/redis.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID

[Install]
WantedBy=multi-user.target


systemctl enable redis
systemctl start redis

评论