找回密码
 立即注册
Qt开源社区 门户 查看内容

Win10的Linux子系统中安装Redis过程记录

2019-8-18 07:07| 发布者: admin| 查看: 1079| 评论: 0

摘要: Windows中的设置1. 在Win10"设置"-"更新和安全"- "开发者选项"中选中"开发者选项"2. 在"控制面板" -"程序" - "程序和功能" - "启用和关闭Windows功能"中启用"适用于Linux的Windows子系统"(不同的Win10版本可能无此选 ...
Windows中的设置

1. 在Win10"设置" -> "更新和安全" -> "开发者选项"中选中"开发者选项"



2. 在"控制面板" -> "程序" -> "程序和功能" -> "启用和关闭Windows功能"中启用"适用于Linux的Windows子系统"(不同的Win10版本可能无此选项)



点击"确定",过程中可能重启

3. 打开"Microsoft Store"搜索"Ubuntu",选择Ubuntu 18.04 LTS





分别点击"获取" -> "安装" -> "启动", 进入bash界面,等待子系统安装完成

4. 安装Redis Desktop Manager管理Redis

软件链接:

https://pan.baidu.com/s/1pz4DYqWo6ZKq58RQi975bQ

提取码:

5dge

Linux中的操作步骤

1. 安装完成之后,设置账号和密码
    Enternew UNIX username: ncxEnternew UNIX password:Retypenew UNIX password:passwd: password updated successfully

    2. 切换数据源为国内镜像

      sudo vi /etc/apt/sources.list
      这里使用的是vi编辑器,先删除全部内容,使用下面的内容替换

      vi的操作这里就不说了。。
        deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
        输入:wq保存并退出

        3. 更新数据源中所有软件列表

          sudo apt-get update

          4. 安装vim编辑器[可选]
            sudo apt-get install vim

            5. 安装redis
              sudo apt-get install redis-server
              中间需要按"y"继续

              安装完成之后redis自动启动,输入
                redis-cli
                可进行测试

                6. 修改redis设置

                  sudo vim /etc/redis/redis.conf


                  将bind 127.0.0.1注释掉,如果不注释掉则redis只能本机使用



                  添加一个新行

                    requirepass xxx
                    设置redis连接密码为xxx,如果不指定密码,redis默认会开启保护模式,局域网的其他机器访问有问题

                    输入:wq保存并退出

                    7. 重启redis服务
                      sudo service redis-server restart

                      使用Redis Desktop Manager管理Redis

                      1. 返回到Win10,打开RedisDesktopManager软件



                      2. 点击下方"Connect to Redis Server",弹出连接对话框,输入下方内容



                      Name:  redis-linux

                      Host:    127.0.0.1

                      Port:     6379

                      Auth:    xxx

                      点击"ok",完成连接



                      3. 测试

                      右击"redis-linux"打开Console



                      右下方出现控制台,输入
                        set name zylget name
                        结果为zyl,表示测试成功




                        ----------------------------------------------------------------------------------------------------------------------
                        我们尊重原创,也注重分享,文章来源于微信公众号:dotNET与前端技术总结分享,建议关注公众号查看原文。如若侵权请联系qter@qter.org。
                        ----------------------------------------------------------------------------------------------------------------------

                        鲜花

                        握手

                        雷人

                        路过

                        鸡蛋
                        
                        公告
                        可以关注我们的微信公众号yafeilinux_friends获取最新动态,或者加入QQ会员群进行交流:190741849、186601429(已满) 我知道了