系统环境:CentOS 6.5 64位

安装方式:编译安装

防火墙:开启

Redis版本:Redis 3.0.2

一、环境准备

1、安装 gcc gcc-c++

[root@iZ94ebgv853Z ~]# yum install gcc gcc-c++ -y

2、下载redis-3.0.2.tar.gz

[root@iZ94ebgv853Z ~]# wget http://download.redis.io/releases/redis-3.0.2.tar.gz

二、安装Redis

[root@iZ94ebgv853Z ~]# tar xf redis-3.0.2.tar.gz  #解压

[root@iZ94ebgv853Z ~]# cd redis-3.0.2

[root@iZ94ebgv853Z redis-3.0.2]# make

[root@iZ94ebgv853Z redis-3.0.2]# make test

报错如下:

cd src&& make test

make[1]:Entering directory `/root/redis-3.0.2/src'

You needtcl 8.5 or newer in order to run the Redis test

make[1]:*** [test] Error 1

make[1]:Leaving directory `/root/redis-3.0.2/src'

make: *** [test] Error 2

原因:需要安装tcl

[root@iZ94ebgv853Zredis-3.0.2]# yum install tcl –y

[root@iZ94ebgv853Z redis-3.0.2]# make test

[root@iZ94ebgv853Zredis-3.0.2]# cp redis.conf /etc/  #复制配置文件

如果需自定义配置redis,可修改其配置文件/etc/redis.conf

三、在redis3.0.2文件夹下,安装redis的最后一步:

[root@localhost redis-3.0.2]# ls

[root@localhost redis-3.0.2]# cd src

[root@localhost src]# make install

四、启动redis

[root@iZ94ebgv853Z ~]# redis-server /etc/redis.conf

五、设置防火墙

######################################

# Firewall configuration written bysystem-config-firewall

# Manual customization of this file is notrecommended.

*filter

:INPUT ACCEPT [0:0]

:FORWARD ACCEPT [0:0]

:OUTPUT ACCEPT [0:0]

-A INPUT -m state --stateESTABLISHED,RELATED -j ACCEPT

-A INPUT -p icmp -j ACCEPT

-A INPUT -i lo -j ACCEPT

-A INPUT -m state --state NEW -m tcp -p tcp--dport 22 -j ACCEPT

-A INPUT -j REJECT --reject-withicmp-host-prohibited

-A FORWARD -j REJECT --reject-withicmp-host-prohibited

COMMIT

#####################################

把文本框内容写入到/etc/sysconfig/iptables,覆盖原来的内容(如果有的话)。

[root@iZ94ebgv853Z ~]# service iptables start    #启动防火墙

[root@iZ94ebgv853Z ~]# iptables -I INPUT 1 -p tcp --dport6379 -j ACCEPT  #开启6379端口

[root@iZ94ebgv853Z ~]# service iptables save  #保存防火墙的配置

六、设置开机启动

[root@iZ94ebgv853Z~]# chkconfig iptables on  #设置iptables开机启动

设置redis开机启动:

在/etc/rc.local中添加:/usr/local/bin/redis-server /etc/redis.conf > /dev/null &

(Linux的redis服务的开启关闭

1.启动:redis-server(redis-server redis.conf)

2.登陆:redis-cli(redis-cli -p 6379)

3.关闭:redis-cli shutdown

查看redis进程:ps aux | grep redis

杀死进程的方式:kill -9 PID )

七、redis密码设置

首先关闭redis服务,上面有;

然后去解压后的redis-3.0.2中  查看当前目录:[root@localhost redis-3.0.2]# ls ;

找到redis.conf配置文件,编辑redis.conf:        [root@localhost redis-3.0.2]# vim redis.conf

找到内容#requirepass foobared   去掉注释,foobared改为自己的密码,我在这里改为:requirepass 123456

然后 保存  退出 重启redis服务

注意:由于redis中配置内容多而杂,不容易找到注释#requirepass foobared ,但

1、

注释#requirepass foobared在

################################ LUA SCRIPTING  ###############################此注释的下面第十三行处;

2、注释#requirepass foobared在

################################ LIMITS ###############################此注释的上面第二十行处;

3、redis-3.0.2此版本的redis.conf配置文件 共有937行内容此#requirepass foobared注释即在第391行

八、Jedis连接redis

java 代码方式

//连接redis服务器,192.168.0.100:6379
 jedis = new Jedis("ip", 6379);
 //权限认证
jedis.auth("password");

配置文件方式

<bean id=”jedisConnectionFactory”
class=”org.springframework.data.redis.connection.jedis.JedisConnectionFactory”>
<property name=”hostName” value=”${redis.host}” />
<property name=”port” value=”${redis.port}” />
<property name=”password” value=”${redis.pass}” />
</bean>

redis的其他命令。
如果需要关闭redis:
[root@iZ94jzcra1hZ bin]# pkill redis
如果需要开启redis:
[root@iZ94jzcra1hZ bin]# redis-server &
加&符号的作用是为了让此进程转换为后台进程,不占用shell的服务。

。。。。。。。。。

不煮米饭的电饭锅

CentOS 6.5 64位下安装Redis3.0.2的具体流程的更多相关文章

  1. CentOS 6.5 64位下安装MySQL 5.7.11

    昨天花了一下午在CentOS6.5 上安装了MySQL,版本为5.7.11,下面介绍一下我安装时候出现的问题 以及解决方法,供大家参考. 1/清除残留 rpm -qa | grep mysql // ...

  2. Windows10 64位下安装TensorFlow谷歌人工智能系统已官方原生支持

    Windows10 64位下安装TensorFlow谷歌人工智能系统已官方原生支持 GitHub - tensorflow/tensorflow: Computation using data flo ...

  3. 求助下 Ubuntu 15.10(64 位)下安装 pyspider 下的问题 - V2EX

    https://www.v2ex.com/t/279405 求助下 Ubuntu 15.10(64 位)下安装 pyspider 下的问题 - V2EX pip 更新到最新 sudo apt inst ...

  4. CentOS 6.3 64位下MySQL5.1.54源码安装配置详解

    安装环境:CentOS 6.3 64位 一:先安装依赖包(不然配置的时候会报错的!) yum -y install ncurses* libtermcap* 新建mysql用户 [root@clien ...

  5. Windows 64位下安装php的redis扩展(php7.2+redis3.0)

    前置条件:为php7.2搭建redis扩展的前提是在本机上已经成功搭建好php的运行环境,我的电脑的运行环境时 apache2.4+mysql5.5+php7.2. 操作系统为64位,编译环境为Mic ...

  6. CentOS6.3(64位)下安装Oracle11gR2(64)服务器

    安装环境 Linux服务器:Centos6.3 64位 Oracle服务器:Oracle11gR2 64位 系统要求 1.Linux安装Oracle系统要求 系统要求 说明 内存 必须高于1G的物理内 ...

  7. Windows 7/8 64位下安装64位Apache 2.4.7

    准备软件: VC11 运行库 64位的apache版本 传送门:http://www.apachelounge.com/download/ 安装步骤: 修改httpd.conf配置文件 37行: Se ...

  8. windows 64位 下 安装 tomcat

    tomcat 版本 windows 64位 .zip apache-tomcat-7.0.42.zip 注意: 1. 安装目录不得有 空格 或 中文字符 2. 然后,在系统环境变量下,新建一个变量: ...

  9. Linux CentOS 6.5 64位 静默安装Oracle11g 云主机

    本例: 通过SSH远程连接云主机,上传oracle11g安装包,在centos6.5上无图形化界面静默安装oracle11g. 涉及工具及环境: 1.本地环境windows7+ssh远程连接工具xSh ...

随机推荐

  1. Flutter 常用命令

    Flutter 常用命令: Flutter 常用命令 说明 flutter 列出所有的命令 flutter help 查看具体命令的帮助信息 flutter doctor 查看是否还需要安装其它依赖 ...

  2. Sublime Text3 离线安装Package Control并使用GBK编码 --转自https://blog.csdn.net/swhard/article/details/78930371

    1.关闭Sublime Text 3,去https://github.com/wbond/package_control/releases下载一个zip包,我下载的是 2.将包内的顶层文件夹解压至C: ...

  3. python 画图工具matplotlib 去掉坐标轴和坐标的方法

    1. 去掉坐标轴的方法: plt.axis('off') 2.去掉刻度的方法: plt.xticks([]) plt.yticks([]) 以上语句需要将其置于 plt.show() 之前,plt.i ...

  4. C#模拟Https请求时出现 基础连接已经关闭 未能为 SSLTLS 安全通道建立信任关系

    //解决方法: //引入命名空间: using System.Security.Cryptography.X509Certificates; using System.Net.Security; // ...

  5. Linux下mysql的root密码修改方法(ERROR 1054)

    #1.停止mysql数据库 /etc/init.d/mysqld stop #2.执行如下命令 mysqld_safe --user=mysql --skip-grant-tables --skip- ...

  6. 计算机网络学习-20180901-TCP/IP协议的五大分层

    摘要:TCP/IP协议的五大分层:应用层.传输层.网络层.数据链路层.物理层(附带一个第0层物理媒介):互联网的核心,即为ip协议. TCP/IP协议的五大分层 5-应用层:获取主机中进程所产生的数据 ...

  7. Java五种单例区别

    详细请参考如下链接: http://www.voidcn.com/article/p-shzgsluz-bqa.html https://blog.csdn.net/android_freshman/ ...

  8. php中获取当前时间

    因为php种有时区的设置,默认与我们这边差8小时:所以我们直接使用data方法的话,得到的时间是不准确的 所以我们在开头设置时区 //设置时区的方法: date_default_timezone_se ...

  9. 基于ssd的手势识别模型(object detection api方式)

    [Tensorflow]Object Detection API-训练自己的手势识别模型 1. 安装tensorflow以及下载object detection api 1.安装tensorflow: ...

  10. 工作中拓展的加密解密传输方式. DES对称加密传输.

    系统间通过xml传输, 不能采用明文, 就加密传输. 秘钥(真正有效的是前8位)存储于配置中. public static string EncryptStr(this string content, ...