1、ubuntu子系统安装
2、可能出现的错误
WslRegisterDistribution failed with error: 0x800701bc #5393
解决办法:go to Manual installation steps for older versions of WSL | Microsoft Learn.
then download and install the Linux kernel update package
下载安装之后,就可以正常启动ubutnu了。
3、配置国内的源
注意我这里使用的ubuntu22.04,你需要根据自己安装的ubuntu版本选择对应的源。
编辑/etc/apt/sources.list sudo vim /etc/apt/sources.list
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
4、更新系统
sudo apt-get update
sudo apt-get upgrade
5、更换python pip源
替换源, 在主文件夹下创建.pip/pip.conf,写入如下内容
[global] timeout = 6000 index-url = https://pypi.tuna.tsinghua.edu.cn/simple trusted-host = pypi.tuna.tsinghua.edu.cn
安装pip3
sudo apt-get install pip3
安装虚拟环境
pip install virtualenv
6、安装ssh-server
安装sudo apt-get install openssh-server
配置ssh开机启动
/etc/profile添加
sudo service ssh start
但是这样开机需要输入密码,要想不输入密码增加如下配置
sudo visudo
%sudo ALL=NOPASSWD: /usr/sbin/service ssh start
7、生成密钥对
ssh-keygen
三下回车
8、配置ssh远程登录
复制需要远程连接到此linux的主机的公钥到authorized_keys文件中
OVER