【README】
本文旨在阐述在linux上安装 redis 的步骤;
【1】具体步骤
step1) 把 redis 压缩包 上传到 /opt/software, 并解压
step2)打开 redis目录,执行 make, 若没有gcc编译器, 执行命令安装gcc;
yum -y install gcc automake autoconf libtool make
step3) 在 redis目录执行make 安装;
step4)在redis目录执行 make install 安装 ;
1、./configure 是用来检测你的安装平台的目标特征的。比如它会检测你是不是有CC或GCC,并不是需要CC或GCC,它是个shell脚本。
2、make 是用来编译的,它从Makefile中读取指令,然后编译。
3、make install是用来安装的,它也从Makefile中读取指令,安装到指定的位置。
注意:AUTOMAKE和AUTOCONF是非常有用的用来发布C程序的东西。
step5)修改redis配置文件
修改1) 把redis.conf 文件拷贝到 /myredis 文件夹下;
修改2) 修改 daemonize yes;
修改3) 指定pid文件名字;
修改4) 指定端口 (默认是6379,可以保留默认);
修改5)指定log文件名字;
修改6)指定 dump.rdb 名字;
// redis.conf################################ GENERAL ###################################### By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
daemonize yes# When running daemonized, Redis writes a pid file in /var/run/redis.pid by
# default. You can specify a custom pid file location here.
pidfile /var/run/redis6381.pid# Accept connections on the specified port, default is 6379.
# If port 0 is specified Redis will not listen on a TCP socket.
port 6381# Specify the log file name. Also the empty string can be used to force
# Redis to log on the standard output. Note that if you use standard
# output for logging but daemonize, logs will be sent to /dev/null
logfile "6381.log"# The filename where to dump the DB
dbfilename dump6381.rdb
step6)开启redis服务 和 redis客户端连接
[root@centos201 /]# redis-server /myredis/redis6379.conf
[root@centos201 /]#
[root@centos201 /]# redis-cli -p 6379
127.0.0.1:6379>
127.0.0.1:6379> set k1 v111
OK