阿里云服务器安装redis

安装起来也挺快的,废话不多说开整

  1. 首先去官网下载redis的安装包(这个自己找喜欢的版本redis-6.0.16.tar.gz)
    下载链接放这里https://redis.io/download/#redis-downloads
  2. 然后上传到我们的云服务器中,当然前提你要有Xftp工具会比较方便点
    https://www.xshell.com/zh/xftp-download/
    没下载的话建议下载一个,同时也下载一个Xshell
    https://www.xshell.com/zh/xshell-download/
    可以申请家庭和学校用户的免费许可证,然后根据提示把后面把两个都下载好就欧克了。
    在这里插入图片描述3.然后把压缩包上传到服务器就可
    在这里插入图片描述4.使用Xshell进行安装步骤,当然你也可以使用宝塔面板安装,看个人喜好了
[root@iZwz9j7k3sf89o50yaw9ctZ ~]# cd /opt
//切换到压缩包的路径,再列出文件
[root@iZwz9j7k3sf89o50yaw9ctZ opt]# ll
total 2240
drwxrwxr-x 7 root root    4096 Apr  9 23:08 redis-6.0.16
-rw-r--r-- 1 root root 2288647 Apr  9 20:41 redis-6.0.16.tar.gz
[root@iZwz9j7k3sf89o50yaw9ctZ opt]# 
//解压
[root@iZwz9j7k3sf89o50yaw9ctZ opt]# tar xzvf redis-6.0.16.tar.gz 

5.编译make命令

//解压后切换到redis-6.0.16文件夹下编译
[root@iZwz9j7k3sf89o50yaw9ctZ opt]# cd redis-6.0.16/
[root@iZwz9j7k3sf89o50yaw9ctZ redis-6.0.16]# make

6.安装

cd src && make install
make[1]: Entering directory '/opt/redis-6.0.16/src'
    CC Makefile.dep

Hint: It's a good idea to run 'make test' ;)

    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install

7.设置redis.conf配置文件,在redis文件目录下

[root@iZwz9j7k3sf89o50yaw9ctZ opt]# cd redis-6.0.16/
[root@iZwz9j7k3sf89o50yaw9ctZ redis-6.0.16]# ll
total 308
-rw-rw-r--  1 root root 120547 Oct  4  2021 00-RELEASENOTES
-rw-rw-r--  1 root root     51 Oct  4  2021 BUGS
-rw-rw-r--  1 root root   2499 Oct  4  2021 CONTRIBUTING
-rw-rw-r--  1 root root   1487 Oct  4  2021 COPYING
drwxrwxr-x  6 root root    192 Apr  9 21:02 deps
-rw-r--r--  1 root root    124 Apr  9 23:08 dump.rdb
-rw-rw-r--  1 root root     11 Oct  4  2021 INSTALL
-rw-rw-r--  1 root root    151 Oct  4  2021 Makefile
-rw-rw-r--  1 root root   6888 Oct  4  2021 MANIFESTO
-rw-rw-r--  1 root root  21099 Oct  4  2021 README.md
-rw-rw-r--  1 root root  85555 Apr  9 22:16 redis.conf 这里
-rwxrwxr-x  1 root root    275 Oct  4  2021 runtest
-rwxrwxr-x  1 root root    280 Oct  4  2021 runtest-cluster
-rwxrwxr-x  1 root root    826 Oct  4  2021 runtest-moduleapi
-rwxrwxr-x  1 root root    281 Oct  4  2021 runtest-sentinel
-rw-rw-r--  1 root root  10744 Oct  4  2021 sentinel.conf
drwxrwxr-x  3 root root   8192 Apr  9 21:06 src
drwxrwxr-x 11 root root    182 Oct  4  2021 tests
-rw-rw-r--  1 root root   3055 Oct  4  2021 TLS.md
drwxrwxr-x  9 root root   4096 Oct  4  2021 utils

8.vim redis.conf去修改

我把原始密码改为了000000
requirepass 000000


修改其他地址是否允许访问
把
bind 127.0.0.1
修改为
bind 0.0.0.0
这样任何人都可以访问到该redis了


修改是否后台启动
daemonize yes
最后保存退出:wq


最后记得把6379端口放行
[root@iZwz9j7k3sf89o50yaw9ctZ bin] redis-server   /opt/redis-6.0.16/redis.conf
1839204:C 09 Apr 2022 21:31:39.441 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1839204:C 09 Apr 2022 21:31:39.441 # Redis version=6.0.16, bits=64, commit=00000000, modified=0, pid=1839204, just started
1839204:C 09 Apr 2022 21:31:39.441 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 6.0.16 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 1839204
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

1839204:M 09 Apr 2022 21:31:39.442 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
1839204:M 09 Apr 2022 21:31:39.442 # Server initialized
1839204:M 09 Apr 2022 21:31:39.442 # 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.
1839204:M 09 Apr 2022 21:31:39.442 # 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 madvise > /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 (set to 'madvise' or 'never').
1839204:M 09 Apr 2022 21:31:39.442 * Ready to accept connections

9.运行试一试吧

[root@iZwz9j7k3sf89o50yaw9ctZ redis-6.0.16]# redis-cli
127.0.0.1:6379> ping
PONG
127.0.0.1:6379> set k1 tom
OK
127.0.0.1:6379> set k2 jack
OK
127.0.0.1:6379> get k1
"tom"
127.0.0.1:6379> get k2
"jack"
127.0.0.1:6379> exit
[root@iZwz9j7k3sf89o50yaw9ctZ redis-6.0.16]# 

希望能帮助到大家

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值