Install Redis in WSL

1
2
3
4
5
6
7
8
9
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
sudo apt-get update
sudo apt-get install redis
 
# start server
redis-server
 
redis-cli
	config set requirepass 123123

Redis in python,

1
2
3
4
5
6
import redis
 
redis_pool = redis.ConnectionPool(host='127.0.0.1', port=6379, password='123123')
redis_conn = redis.Redis(connection_pool=redis_pool)
redis_conn.set('name_2', 'Zarten_2')
redis_conn.get('name_2')

Redis in Windows, https://github.com/tporadowski/redis/releases

redis.windows.conf
	#bind 127.0.0.1
	protected-mode no
	requirepass 123456
 
redis-server.exe redis.windows.conf
 
redis-cli -h 192.168.10.111 -p 6379

refer to:
https://www.jianshu.com/p/ec8b749cd842
https://blog.csdn.net/weixin_30456039/article/details/97497620
https://blog.csdn.net/csdnhxs/article/details/122450575

Move Ubuntu subsystem elsewhere in Windows

After installing an Ubuntu app from Micosoft Store, open an Administrator's prompt,

1
2
3
4
5
6
7
8
9
10
wsl -l -v
wsl --export Ubuntu-22.04 e:\cext\Ubuntu\ubuntu22.04.tar
 
# or unistall it through System Settings
wsl --unregister Ubuntu-22.04
 
wsl --import Ubuntu e:\cext\Ubuntu\ubuntu22 e:\cext\Ubuntu\ubuntu22.04.tar
 
# start Ubuntu as eu
wsl -d Ubuntu -u eu

refer to:
C:\Users\eu\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu22.04LTS_79rhkp1fndgsc\LocalState
https://blog.csdn.net/popboy29/article/details/126854886
https://blog.csdn.net/csdn_life18/article/details/128246494