CentOS 7.5安装Redis 4.0.11

版权声明:本文为博主原创文章。博主:希望可以帮助到爱学习的你。https://github.com/timespacegroup https://blog.csdn.net/typa01_kk/article/details/81436845

1.服务器版本

# lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.5.1804 (Core)
Release:    7.5.1804
Codename:   Core

2.下载redis

# cd /home/install-files/
# wget http://download.redis.io/releases/redis-4.0.11.tar.gz

3.安装redis和依赖

# yum -y install gcc
# tar zxvf redis-4.0.11.tar.gz
# cd redis-4.0.11
# make MALLOC=libc
# cd src && make install
# ./redis-server

可直接启动测试

4.redis配置

# cp redis.conf /etc/

配置请参照:配置说明

5.创建目录和用户和更改拥有者

# mkdir -p /redis/data
# mkdir -p /redis/pid
# mkdir -p /redis/log
# groupadd redis
# useradd redis -g redis -d /redis/ -s /sbin/nologin
# chown -R redis.redis /redis/
# chown -R redis.redis /etc/redis.conf

6.安装启动

# cd /usr/local/bin/
# /usr/local/bin/redis-server /etc/redis.conf
# ps -ef |grep redis
root       741     1  0 17:23 ?        00:00:17 /usr/local/bin/redis-server *:6379
# netstat -tunlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:6379            0.0.0.0:*               LISTEN      741/redis-server *:
tcp6       0      0 :::6379                 :::*                    LISTEN      741/redis-server *:

7.测试redis

# redis-cli -h 192.168.80.168 -a 'T@S99ss:)'
Warning: Using a password with '-a' option on the command line interface may not be safe.
192.168.80.168:6379> set tony 12345
OK
192.168.80.168:6379> get tony
"12345"
192.168.80.168:6379> del tony
(integer) 1
192.168.80.168:6379>

猜你喜欢

转载自blog.csdn.net/typa01_kk/article/details/81436845