Win 10 安装 Linux 子系统(Windows Subsystem for Linux)& 安装 Redis 5.0.5

1:MicroSoft Store 搜索 ubuntu,选择应用程序,Ubuntu18.04 点击安装

2:打开Ubuntu18.04,初始化,输入用户名和密码

3:替换源 

 1)  备份:sudo cp /etc/apt/sources.list /etc/apt/sources.list.20181013

 2)编辑:sudo vim /etc/apt/sources.list

 3)依次输入 i -> : 

      :%s/security.ubuntu/mirrors.aliyun/g

      :%s/archive.ubuntu/mirrors.aliyun/g

4:更新 sudo apt update 然后sudo apt upgrade

5:安装 gcc&make

sudo apt-get install gcc
sudo apt-get install make

6:下载Redis安装包,解压&编译

wget http://download.redis.io/releases/redis-5.0.5.tar.gz
tar xzf redis-5.0.5.tar.gz
cd redis-5.0.5
make

make 报错:

cd src && make all
make[1]: Entering directory '/home/ubuntu/redis-4.0.11/src'
    CC adlist.o
In file included from adlist.c:34:0:
zmalloc.h:50:10: fatal error: jemalloc/jemalloc.h: No such file or directory
 #include 
          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Makefile:228: recipe for target 'adlist.o' failed
make[1]: *** [adlist.o] Error 1
make[1]: Leaving directory 

执行 make MALLOC=libc

https://blog.csdn.net/qq_16069927/article/details/82899025

https://blog.csdn.net/libraryhu/article/details/64920124

 

7:安装redis

cd utils

sudo ./install_server.sh

install_server.sh可以创建多个实例,根据需要重复执行即可

8:运行 服务

redis-server

开机启动:sudo update-rc.d redis-server6380 defaults 20 

查询redis服务: ps axu|grep redis 

强制kill进程:kill -9  {pid}

9:链接redis

redis-cli -h IP -p Port -a password

WSL-Ubuntu 不支持 docker

https://blog.csdn.net/u012814856/article/details/86130341

WSL位置

C:\Users\{windows帐户}\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\

WSL访问windows文件位置:

LocalState\rootfs\mnt\{盘符}

wsl执行:cp -a  /mnt/d/MyWinFolder /home/{wsl帐户}/MyUbuntuFolder

dbfilename dump.rdb - 服务启动相对位置

进入root:sudo su

更改权限设置:chown -R 777 john:build /tmp/src

https://blog.csdn.net/tianxuejin/article/details/7230395

 

 

 

 

 

你可能感兴趣的:(WSL,Ubuntu,Linux)