ubuntu安装redis记录

第一步,命令安装redis:apt-get install redis-server

root@luoyh6:~# apt-get install redis-server
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  libjemalloc2 liblua5.1-0 liblzf1 lua-bitop lua-cjson redis-tools
Suggested packages:
  ruby-redis
The following NEW packages will be installed:
  libjemalloc2 liblua5.1-0 liblzf1 lua-bitop lua-cjson redis-server redis-tools
0 upgraded, 7 newly installed, 0 to remove and 90 not upgraded.
Need to get 1,273 kB of archives.
After this operation, 5,725 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy/universe amd64 libjemalloc2 amd64 5.2.1-4ubuntu1 [240 kB]
Get:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy/universe amd64 liblua5.1-0 amd64 5.1.5-8.1build4 [99.9 kB]
Get:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy/universe amd64 liblzf1 amd64 3.6-3 [7,444 B]
Get:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy/universe amd64 lua-bitop amd64 1.0.2-5 [6,680 B]
Get:5 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy/universe amd64 lua-cjson amd64 2.1.0+dfsg-2.1 [17.4 kB]
Get:6 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy/universe amd64 redis-tools amd64 5:6.0.16-1ubuntu1 [856 kB]
Get:7 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy/universe amd64 redis-server amd64 5:6.0.16-1ubuntu1 [45.9 kB]
Fetched 1,273 kB in 4s (293 kB/s)  
Selecting previously unselected package libjemalloc2:amd64.
(Reading database ... 136952 files and directories currently installed.)
Preparing to unpack .../0-libjemalloc2_5.2.1-4ubuntu1_amd64.deb ...
Unpacking libjemalloc2:amd64 (5.2.1-4ubuntu1) ...
Selecting previously unselected package liblua5.1-0:amd64.
Preparing to unpack .../1-liblua5.1-0_5.1.5-8.1build4_amd64.deb ...
Unpacking liblua5.1-0:amd64 (5.1.5-8.1build4) ...
Selecting previously unselected package liblzf1:amd64.
Preparing to unpack .../2-liblzf1_3.6-3_amd64.deb ...
Unpacking liblzf1:amd64 (3.6-3) ...
Selecting previously unselected package lua-bitop:amd64.
Preparing to unpack .../3-lua-bitop_1.0.2-5_amd64.deb ...
Unpacking lua-bitop:amd64 (1.0.2-5) ...
Selecting previously unselected package lua-cjson:amd64.
Preparing to unpack .../4-lua-cjson_2.1.0+dfsg-2.1_amd64.deb ...
Unpacking lua-cjson:amd64 (2.1.0+dfsg-2.1) ...
Selecting previously unselected package redis-tools.
Preparing to unpack .../5-redis-tools_5%3a6.0.16-1ubuntu1_amd64.deb ...
Unpacking redis-tools (5:6.0.16-1ubuntu1) ...
Selecting previously unselected package redis-server.
Preparing to unpack .../6-redis-server_5%3a6.0.16-1ubuntu1_amd64.deb ...
Unpacking redis-server (5:6.0.16-1ubuntu1) ...
Setting up libjemalloc2:amd64 (5.2.1-4ubuntu1) ...
Setting up lua-cjson:amd64 (2.1.0+dfsg-2.1) ...
Setting up liblzf1:amd64 (3.6-3) ...
Setting up lua-bitop:amd64 (1.0.2-5) ...
Setting up liblua5.1-0:amd64 (5.1.5-8.1build4) ...
Setting up redis-tools (5:6.0.16-1ubuntu1) ...
Setting up redis-server (5:6.0.16-1ubuntu1) ...
Created symlink /etc/systemd/system/redis.service → /lib/systemd/system/redis-server.service.
Created symlink /etc/systemd/system/multi-user.target.wants/redis-server.service → /lib/systemd/system/redis-server.service.
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.6) ...
Scanning processes...                                                                                         
Scanning candidates...                                                                                        
Scanning linux images...                                                                                      

Restarting services...
 systemctl restart packagekit.service systemd-resolved.service

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.
root@luoyh6:~# 
root@luoyh6:~# 

第二步:修改密码:在/etc/redis/redis.conf文件里面增添或修改port、requirepass (默认端口是6379,根据自己项目需求进行修改)

# 1) The server is not binding explicitly to a set of addresses using the
#    "bind" directive.
# 2) No password is configured.
#
# The server only accepts connections from clients connecting from the
# IPv4 and IPv6 loopback addresses 127.0.0.1 and ::1, and from Unix domain
# sockets.
#
# By default protected mode is enabled. You should disable it only if
# you are sure you want clients from other hosts to connect to Redis
# even if no authentication is configured, nor a specific set of interfaces
# are explicitly listed using the "bind" directive.
protected-mode yes

# Accept connections on the specified port, default is 6379 (IANA #815344).
# If port 0 is specified Redis will not listen on a TCP socket.
port 31778
requirepass 123456
# TCP listen() backlog.
#
# In high requests-per-second environments you need a high backlog in order
# to avoid slow clients connection issues. Note that the Linux kernel
# will silently truncate it to the value of /proc/sys/net/core/somaxconn so
# make sure to raise both the value of somaxconn and tcp_max_syn_backlog
# in order to get the desired effect.
tcp-backlog 511

# Unix socket.

第三步:重启redis

service redis restart

第四步:连接redis,输入密码

root@luoyh6:~# 
root@luoyh6:~# 
root@luoyh6:~# redis-cli -p 31778
127.0.0.1:31778> 
127.0.0.1:31778> 
127.0.0.1:31778> AUTH 123456
OK
127.0.0.1:31778> 
127.0.0.1:31778> 
127.0.0.1:31778> 

相关推荐

  1. ubuntu安装redis记录

    2024-02-03 01:34:01       40 阅读
  2. 记录 | ubuntu安装Albert

    2024-02-03 01:34:01       31 阅读
  3. 记录:podman安装redis

    2024-02-03 01:34:01       6 阅读
  4. Ubuntu安装 Redis

    2024-02-03 01:34:01       28 阅读
  5. ubuntu安装redis

    2024-02-03 01:34:01       14 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-02-03 01:34:01       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-02-03 01:34:01       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-02-03 01:34:01       19 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-02-03 01:34:01       20 阅读

热门阅读

  1. QT 加载 mysql 驱动

    2024-02-03 01:34:01       32 阅读
  2. 【笔记】SPN和PLMN 运营商网络名称显示

    2024-02-03 01:34:01       64 阅读
  3. <网络安全>《13 上网行为管理》

    2024-02-03 01:34:01       33 阅读
  4. SpringCloud引入父项目需要注意的地方

    2024-02-03 01:34:01       31 阅读
  5. Vite 官方文档速通

    2024-02-03 01:34:01       47 阅读
  6. 七、测试计划(软件工程)

    2024-02-03 01:34:01       29 阅读
  7. Hook 技术 相关的博客链接(还有一些其他的)

    2024-02-03 01:34:01       41 阅读
  8. 组播目的地址

    2024-02-03 01:34:01       34 阅读