在CentOS6上安装Redis

时间:2023-03-09 19:24:17
在CentOS6上安装Redis

检查安装依赖程序

yum install -y gcc-c++ tcl wget

获取安装文件

wget http://download.redis.io/releases/redis-2.8.17.tar.gz

解压文件

tar -xzvf redis-2.8.17.tar.gz
mv redis-2.8.17 /usr/local/redis

编译安装

cd /usr/local/redis
make
make install

设置配置文件路径

mkdir -p /etc/redis
cp redis.conf /etc/redis

修改配置文件

vi /etc/redis/redis.conf
仅修改: daemonize yes (no-->yes)

启动

/usr/local/bin/redis-server /etc/redis/redis.conf

查看启动

ps -ef | grep redis

使用客户端

redis-cli
>set name david
OK
>get name
"david"

关闭客户端

redis-cli shutdown

开机启动配置

echo "/usr/local/bin/redis-server /etc/redis/redis.conf &" >> /etc/rc.local