下載redis4.0的安裝包:http://download.redis.io/releases/redis-4.0.11.tar.gzredis
這裏用的是已經下載到電腦上,只需上傳便可vim
解壓縮spa
[root@67 ~]# tar xvf redis-4.0.11.tar.gz
查看,會生成redis-4.0.11code
[root@67 ~]# ls redis-4.0.11
移動程序包server
[root@67 ~]# mv redis-4.0.11 /usr/local/redis
建立文件保存目錄blog
[root@67 ~]# mkdir /redis
建立用戶get
[root@67 ~]# useradd redis
生成配置文件io
[root@67 ~]# cp -a /usr/local/redis/redis.conf /redis
修改配置文件class
[root@67 ~]# vim /redis/redis.conf
68 bind 10.220.5.67
91 port 6379 <<<默認6379
135 daemonize yes <<<是否工做在後臺運行模式
157 pidfile /redis/redis_6379.pid
170 logfile /redis/redis.log
262 dir /redis
修改屬主,屬組後臺
[root@67 ~]# chown -R redis.redis /redis
啓動,並查看
[root@67 ~]# /usr/local/redis/src/redis-server /redis/redis.conf [root@67 ~]# ss -tnl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 10.220.5.67:6379 *:* LISTEN 0 128 *:22 *:* LISTEN 0 128 :::22
爲了之後啓動方便,須要導出二進制文件
[root@67 ~]# vim /etc/profile.d/redis.sh
PATH=$PATH:/usr/local/redis/
export PATH
[root@67 ~]# source /etc/profile.d/redis.sh
先關閉redis,因爲是在作實驗,用暴力的方法關閉
[root@67 ~]# pkill redis
[root@67 ~]# ss -tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:22 *:* LISTEN 0 128 :::22 :::*
使用二進制命令啓動
[root@67 ~]# redis-server /redis/redis.conf [root@67 ~]# ss -tnl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 10.220.5.67:6379 *:* LISTEN 0 128 *:22 *:* LISTEN 0 128 10.220.5.67:16379 *:* LISTEN 0 128 :::22 :::*