Ubuntu redis快速安装指南

前端之家收集整理的这篇文章主要介绍了Ubuntu redis快速安装指南前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
  1. sudoapt-getupdate
  2. sudoapt-getinstallmakegccpython-dev-y
  3. wgethttp://download.redis.io/releases/redis-3.2.8.tar.gz
  4. tarxzfredis-3.2.8.tar.gz
  5. cdredis-3.2.8
  6. make
  7. sudomakeinstall
  8.  
  9. #启动服务端
  10. redis-serverredis.conf
  11.  
  12. #启动客户端连接
  13. ancongadmin@yancongadmin-All-Series:~/downloads/redis-3.2.8/src$./redis-cli
  14. 127.0.0.1:6379>
  15. 127.0.0.1:6379>
  16. 127.0.0.1:6379>setfoobar
  17. OK
  18. 127.0.0.1:6379>getfoo
  19. "bar"
  20. 127.0.0.1:6379>
  21.  
  22.  
  23. #Linux上为Python语言安装Redis客户端库
  24. ~:$wget-qhttp://peak.telecommunity.com/dist/ez_setup.py#下载ez_setup模块
  25. ~:$sudopythonez_setup.py#通过运行ez_setup模块来下载并安装setuptools。
  26. Downloadinghttp://pypi.python.org/packages/2.7/s/setuptools/...#
  27. [trimmed]#
  28. Finishedprocessingdependenciesforsetuptools==0.6c11#
  29. ~:$sudopython-measy_installredishiredis#通过运行setuptools的easy_install包来安装redis包以及hiredis包。
  30. Searchingforredis#redis包为Python提供了一个连接至Redis的接口。
  31. [trimmed]#
  32. Finishedprocessingdependenciesforredis#
  33. Searchingforhiredis#hiredis包是一个C库,它可以提高Python的Redis客户端的速度。
  34. [trimmed]#
  35. Finishedprocessingdependenciesforhiredis#
  36. ~:$
  37.  
  38.  
  39.  
  40. #使用Python来测试Redis
  41. $python
  42. Python2.7.12(default,Nov192016,06:48:10)
  43. [GCC5.4.020160609]onlinux2
  44. Type"help","copyright","credits"or"license"formoreinformation.
  45. >>>importredis
  46. >>>conn=redis.Redis()
  47. >>>conn.set('hello','world')
  48. True
  49. >>>conn.get('hello')
  50. 'world'
  51. >>>
  52.  
  53. redis使用key-value,键值
  54. 默认端口:6379

参考:

  • Redis 实战 一位博士写的书,书中的redis为2.6版本

Redis开发运维实践指南

猜你在找的Ubuntu相关文章