CentOS 安装 Redis

235人浏览 / 0人评论

https://www.cnblogs.com/hellobluecode/p/18035702

redis下载:https://download.redis.io/releases/

sudo yum update

sudo yum install -y gcc make

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

tar -xzvf redis-6.2.5.tar.gz

cd redis-6.2.5

make

make install PREFIX=/usr/local/redis

sudo vim /etc/profile
export PATH=$PATH:/usr/local/redis/bin

source /etc/profile

mkdir -p /usr/local/redis/conf
cp redis.conf /usr/local/redis/conf

sudo vim  /usr/local/redis/conf/redis.conf
bind 0.0.0.0
protected-mode no ##默认yes,开启保护模式,限制为本地访问
requirepass admin123	
appendonly yes ##redis持久化(可选)

cp utils/redis_init_script /etc/init.d/redis
chmod +x /etc/rc.d/init.d/redis


sudo vim /etc/rc.d/init.d/redis
REDISPORT=6379
EXEC=/usr/local/redis/bin/redis-server
CLIEXEC=/usr/local/redis/bin/redis-cli
PIDFILE=/var/run/redis_${REDISPORT}.pid
CONF="/usr/local/redis/conf/redis.conf"

chkconfig redis on

systemctl start redis

netstat -lanp | grep 6379

 

全部评论