centos6.3 使用yum方式安装redis

来源:互联网 发布:重生之君颜网络剧免费 编辑:程序博客网 时间:2024/06/05 11:44

我得是centos 6.3,如果直接用yum安装redis,报错,如下:

[root@localhost ~]# yum install redisLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfile* base: mirrors.btte.net* extras: mirrors.btte.net* updates: mirrors.btte.netbase                                                     | 3.7 kB     00:00     extras                                                   | 3.5 kB     00:00     updates                                                  | 3.5 kB     00:00     updates/primary_db                                       | 4.6 MB     00:25     Setting up Install ProcessNo package redis available.Error: Nothing to do
实际上redia位于第三方的yum源里面,不在centos官方yum源里面,如何解决呢?


1:去下面的网站下载EPEL对应的版本:(epel是fedora维护的yum源,里面软件众多)
http://fedoraproject.org/wiki/EPEL
2:我下载的是这个:
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm


3:安装epel:
rpm -ivh epel-release-6-8.noarch.rpm warning: epel-release-6-8.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEYPreparing...                ########################################### [100%]1:epel-release           ########################################### [100%]



4.安装redis 安装方法如下:

[root@localhost ~]# yum install redisLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfile * atomic: mirrors.neusoft.edu.cn * base: mirror.bit.edu.cn * extras: mirror.bit.edu.cn * updates: mirrors.btte.netSetting up Install ProcessResolving Dependencies--> Running transaction check---> Package redis.x86_64 0:2.6.16-2.el6.art will be installed--> Processing Dependency: libtcmalloc.so.4()(64bit) for package: redis-2.6.16-2.el6.art.x86_64--> Running transaction check---> Package gperftools-libs.x86_64 0:2.0-11.el6.1.art will be installed--> Finished Dependency ResolutionDependencies Resolved====================================================================================================================== Package                         Arch                   Version                          Repository              Size======================================================================================================================Installing: redis                           x86_64                 2.6.16-2.el6.art                 atomic                 319 kInstalling for dependencies: gperftools-libs                 x86_64                 2.0-11.el6.1.art                 atomic                 247 kTransaction Summary======================================================================================================================Install       2 Package(s)Total download size: 567 kInstalled size: 2.1 MIs this ok [y/N]: yDownloading Packages:(1/2): gperftools-libs-2.0-11.el6.1.art.x86_64.rpm                                             | 247 kB     00:00     (2/2): redis-2.6.16-2.el6.art.x86_64.rpm                                                       | 319 kB     00:02     ----------------------------------------------------------------------------------------------------------------------Total                                                                                 220 kB/s | 567 kB     00:02     Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning Transaction  Installing : gperftools-libs-2.0-11.el6.1.art.x86_64                                                            1/2   Installing : redis-2.6.16-2.el6.art.x86_64                                                                      2/2   Verifying  : gperftools-libs-2.0-11.el6.1.art.x86_64                                                            1/2   Verifying  : redis-2.6.16-2.el6.art.x86_64                                                                      2/2 Installed:  redis.x86_64 0:2.6.16-2.el6.art                                                                                     Dependency Installed:  gperftools-libs.x86_64 0:2.0-11.el6.1.art                                                                           Complete![root@localhost ~]# find / -name "redis*"/etc/rc.d/init.d/redis/etc/logrotate.d/redis/etc/redis.conf/var/lib/redis/var/log/redis/usr/bin/redis-benchmark/usr/bin/redis-check-aof/usr/bin/redis-cli/usr/bin/redis-check-dump/usr/sbin/redis-server/usr/share/doc/redis-2.6.16

新开一个ssh窗口,打开redis服务端

[root@localhost ~]# redis-server [1863] 19 Feb 13:08:59.379 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf[1863] 19 Feb 13:08:59.380 * Max number of open files set to 10032                _._                                                             _.-``__ ''-._                                                   _.-``    `.  `_.  ''-._           Redis 2.6.16 (00000000/0) 64 bit  .-`` .-```.  ```\/    _.,_ ''-._                                    (    '      ,       .-`  | `,    )     Running in stand alone mode |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379 |    `-._   `._    /     _.-'    |     PID: 1863  `-._    `-._  `-./  _.-'    _.-'                                    |`-._`-._    `-.__.-'    _.-'_.-'|                                   |    `-._`-._        _.-'_.-'    |           http://redis.io          `-._    `-._`-.__.-'_.-'    _.-'                                    |`-._`-._    `-.__.-'    _.-'_.-'|                                   |    `-._`-._        _.-'_.-'    |                                    `-._    `-._`-.__.-'_.-'    _.-'                                         `-._    `-.__.-'    _.-'                                                 `-._        _.-'                                                         `-.__.-'                                               [1863] 19 Feb 13:08:59.381 # Server started, Redis version 2.6.16[1863] 19 Feb 13:08:59.381 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.[1863] 19 Feb 13:08:59.381 * The server is now ready to accept connections on port 6379

然后再使用

[root@localhost ~]# redis-cli redis 127.0.0.1:6379> 
现在可以存东西了。

redis 127.0.0.1:6379> set name chineseOKredis 127.0.0.1:6379> get name"chinese"redis 127.0.0.1:6379> 


0 0
原创粉丝点击