Windows 10 Windows Subsystem for Linux配置

setp1. 先开启wsl功能

  • 打开控制面板——“程序”——“启用或关闭Windows功能”——勾选“适用于Linux的Windows子系统”——“确定”。完成,已经成功启动WSL功能。最后重启电脑

setp2. windows appstore搜索ubuntu, 点击下载安装

setp3. 修改Ubuntu的apt-get源为国内镜像源

  • 原文件备份
    sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

  • 编辑源列表文件

    sudo vim /etc/apt/sources.list

  • 将原来的列表删除,添加如下内容(中科大镜像源)

deb http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse

setp4. 添加ubuntu目录

  • 打开cmd,输入\wsl$, 点击Ubantu文件夹,右键,点击映射网络驱动器就可以添加到我的电脑里了,注意只有启动Ubantu之后才可以打开该磁盘

Note: 过程中需要重启ubuntu系统:

  • 右键win,选择window powershell管理员,运行net stop LxssManager关闭Ubuntu系统,然后start系统

问题

  • 1 命令行输入 sudo vncserver -geometry 1600x900 :1,出现以下错误:
Warning: LAPTOP-993I9DKB:1 is taken because of /tmp/.X1-lock
Remove this file if there is no X server LAPTOP-993I9DKB:1
A VNC server is already running as :1
  • 输入:sudo vncserver -kill :1
    出现:
     Can't find file /home/givenchy/.vnc/LAPTOP-993I9DKB:0.pid
     You'll have to kill the Xvnc4 process manually
    
    输入 sudo vncserver, 提示:
Warning: LAPTOP-993I9DKB:1 is taken because of /tmp/.X1-lock
Remove this file if there is no X server LAPTOP-993I9DKB:1

Warning: LAPTOP-993I9DKB:2 is taken because of /tmp/.X2-lock
Remove this file if there is no X server LAPTOP-993I9DKB:2

Warning: LAPTOP-993I9DKB:3 is taken because of /tmp/.X3-lock
Remove this file if there is no X server LAPTOP-993I9DKB:3

Warning: LAPTOP-993I9DKB:4 is taken because of /tmp/.X4-lock
Remove this file if there is no X server LAPTOP-993I9DKB:4

如图,说明前四个端口已经被占用:
说明前四个端口已经被占用
按照提示,删除tmp目录下的相关缓存文件,又提示如下错误:
在这里插入图片描述
索性删除/tmp下面的所有文件:sudo rm /tmp/.X11-unix/*,之后便可以重新利用之前的端口号了。

在这里插入图片描述
原因:占用端口号之后,未及时关闭(kill)

reference

https://www.tkdcz.top/post/46.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值