Windows10内嵌Ubuntu子系统初始化设置

第一次启动

重启ubuntu

Since Windows 10 version 1803, closing all WSL terminal windows won't kill background processes by default, unless the file /var/run/reboot-required is present. This file will be automatically created by apt on Ubuntu when an update requires a reboot, but if you want to manually reboot the subsystem, you can create the file yourself:linux

sudo touch /var/run/reboot-required

而后关闭ubuntu的shell框就至关于关机。docker

I haven't tested this on other distributions available in the Microsoft Store. An alternative solution is to kill all processes yourself:shell

sudo killall -r '.*'

重置ubuntu,至关于从新安装

配置ubuntu镜像源

阿里源地址为:https://opsx.alibaba.com/mirror?lang=zh-CN,找到ubuntu镜像的帮助,根据提示修改/etc/apt/sources.list,而后执行sudo apt-get update。ubuntu

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

图形化界面

  1. 更新windows

    sudo apt-get update
  2. 开始安装图形化界面session

    sudo apt-get install xorg
    sudo apt-get install xfce4
    sudo apt-get install xrdp
  3. 配置远程端口为3390less

    sudo sed -i 's/port=3389/port=3390/g' /etc/xrdp/xrdp.ini
  4. 向xsession中写入xfce4-sessioncurl

    sudo echo xfce4-session >~/.xsession
  5. 重启xrdp服务ionic

    sudo service xrdp restart
  6. 若是有防火墙,容许就行了。工具

  7. 在Cortana中搜索远程桌面链接,点击进入,输入本机IP:端口,以及子系统用户名(在步骤2中,终端窗口@符号以前)

  1. 登录成功,显示Ubuntu的图形界面。

踩过的坑:个人win10和ubuntu的用户名相同,都是个人姓名全拼。使用远程桌面登录时,链接成功后闪退,后来改用root登录就能够了。

安装docker

ubuntu版本为16.04

  1. 使用阿里云的镜像
  2. 使用阿里云的docker镜像
  3. 安装后,使用sudo service docker start启动docker服务失败了,重启以后有start了两次就能够了。
# step 1: 安装必要的一些系统工具
   sudo apt-get update
   sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
   # step 2: 安装GPG证书
   curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
   # Step 3: 写入软件源信息
   sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
   # Step 4: 更新并安装 Docker-CE
   sudo apt-get -y update
   sudo apt-get -y install docker-ce
   
   # 安装指定版本的Docker-CE:
   # Step 1: 查找Docker-CE的版本:
   # apt-cache madison docker-ce
   #   docker-ce | 17.03.1~ce-0~ubuntu-xenial | http://mirrors.aliyun.com/docker-ce/linux/ubuntu xenial/stable amd64 Packages
   #   docker-ce | 17.03.0~ce-0~ubuntu-xenial | http://mirrors.aliyun.com/docker-ce/linux/ubuntu xenial/stable amd64 Packages
   # Step 2: 安装指定版本的Docker-CE: (VERSION 例如上面的 17.03.1~ce-0~ubuntu-xenial)
   # sudo apt-get -y install docker-ce=[VERSION]

磁盘映射

在ubuntu内部,能够进入/mnt/c等目录,操做windows10的多个磁盘。

相关文章
相关标签/搜索