ubuntu如何安装redis
在终端下输入
sudo apt search redis
查找一下发现了 redis-server
如果找不到 你可能需要使用 update 更新一下了
sudo apt-get update
然后就安装
sudo apt-get install redis-server
安装完毕后启动 redis
/usr/bin/redis-server
启动后可以看到
21154:C 26 Jun 10:27:39.157 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 21154:C 26 Jun 10:27:39.157 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=21154, just started 21154:C 26 Jun 10:27:39.157 # Warning: no config file specified, using the default config. In order to specify a config file use /usr/bin/redis-server /path/to/redis.conf 21154:M 26 Jun 10:27:39.157 # You requested maxclients of 10000 requiring at least 10032 max file descriptors. 21154:M 26 Jun 10:27:39.157 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted. 21154:M 26 Jun 10:27:39.157 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'. _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 4.0.9 (00000000/0) 64 bit .-`` .-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in standalone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 21154 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | http://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-' 21154:M 26 Jun 10:27:39.164 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. 21154:M 26 Jun 10:27:39.164 # Server initialized 21154:M 26 Jun 10:27:39.164 # 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. 21154:M 26 Jun 10:27:39.164 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled. 21154:M 26 Jun 10:27:39.164 * Ready to accept connections
然后开一个终端 进行cli访问
$ /usr/bin/redis-cli 127.0.0.1:6379> keys * (empty list or set) 127.0.0.1:6379> set user name OK 127.0.0.1:6379> get user "name" 127.0.0.1:6379>
好了,就是这么简单。
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· 在鹅厂做java开发是什么体验
· 百万级群聊的设计实践
· WPF到Web的无缝过渡:英雄联盟客户端的OpenSilver迁移实战
· 永远不要相信用户的输入:从 SQL 注入攻防看输入验证的重要性
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析