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 <jemalloc/jemalloc.h>
          ^~~~~~~~~~~~~~~~~~~~~
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

 

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章