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的多個磁盤。

相關文章
相關標籤/搜索