zoukankan      html  css  js  c++  java
  • 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:

    sudo touch /var/run/reboot-required
    

    然后关闭ubuntu的shell框就相当于关机。

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

    sudo killall -r '.*'
    

    重置ubuntu,相当于重新安装

    配置ubuntu镜像源

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

    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. 更新

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

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

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

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

      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的多个磁盘。

  • 相关阅读:
    IO 单个文件的多线程拷贝
    day30 进程 同步 异步 阻塞 非阻塞 并发 并行 创建进程 守护进程 僵尸进程与孤儿进程 互斥锁
    day31 进程间通讯,线程
    d29天 上传电影练习 UDP使用 ScketServer模块
    d28 scoket套接字 struct模块
    d27网络编程
    d24 反射,元类
    d23 多态,oop中常用的内置函数 类中常用内置函数
    d22 封装 property装饰器 接口 抽象类 鸭子类型
    d21天 继承
  • 原文地址:https://www.cnblogs.com/MyLifeMyWay/p/10227134.html
Copyright © 2011-2022 走看看