zoukankan      html  css  js  c++  java
  • 【工具软件】-Win10 安装 Linux 子系统

    1. 修改配置

            进入控制面板,进入“程序”子菜单:

            单击“启用或关闭 Windows 功能”:

            勾选“适用于 Linux 的 Windows 子系统”:

    2. 下载 Ubuntu

            进入 Microsoft Store,搜索 Ubuntu,这里会有多个搜索结果,注意下载标注出的版本:

            安装完成后,即可在开始菜单找到 Ubuntu 的入口

            首次进入 Ubuntu 系统,会要求设置用户名和密码。设置完成后,即可使用。

    3. 修改软件源

            在 Ubuntu 使用过程中,经常需要在线下载软件。由于网络问题,使用默认源会出现无法访问或网速很慢的问题,因此需要修改配置,使用国内软件源。软件源在 /etc/apt/sources.list 中配置,直接替换为以下内容即可:

     1 # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
     2 # newer versions of the distribution.
     3 deb http://archive.ubuntu.com/ubuntu/ focal main restricted
     4 # deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted
     5 
     6 ## Major bug fix updates produced after the final release of the
     7 ## distribution.
     8 deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted
     9 # deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted
    10 
    11 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    12 ## team. Also, please note that software in universe WILL NOT receive any
    13 ## review or updates from the Ubuntu security team.
    14 deb http://archive.ubuntu.com/ubuntu/ focal universe
    15 # deb-src http://archive.ubuntu.com/ubuntu/ focal universe
    16 deb http://archive.ubuntu.com/ubuntu/ focal-updates universe
    17 # deb-src http://archive.ubuntu.com/ubuntu/ focal-updates universe
    18 
    19 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    20 ## team, and may not be under a free licence. Please satisfy yourself as to
    21 ## your rights to use the software. Also, please note that software in
    22 ## multiverse WILL NOT receive any review or updates from the Ubuntu
    23 ## security team.
    24 deb http://archive.ubuntu.com/ubuntu/ focal multiverse
    25 # deb-src http://archive.ubuntu.com/ubuntu/ focal multiverse
    26 deb http://archive.ubuntu.com/ubuntu/ focal-updates multiverse
    27 # deb-src http://archive.ubuntu.com/ubuntu/ focal-updates multiverse
    28 
    29 ## N.B. software from this repository may not have been tested as
    30 ## extensively as that contained in the main release, although it includes
    31 ## newer versions of some applications which may provide useful features.
    32 ## Also, please note that software in backports WILL NOT receive any review
    33 ## or updates from the Ubuntu security team.
    34 deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
    35 # deb-src http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
    36 
    37 ## Uncomment the following two lines to add software from Canonical's
    38 ## 'partner' repository.
    39 ## This software is not part of Ubuntu, but is offered by Canonical and the
    40 ## respective vendors as a service to Ubuntu users.
    41 # deb http://archive.canonical.com/ubuntu focal partner
    42 # deb-src http://archive.canonical.com/ubuntu focal partner
    43 
    44 deb http://security.ubuntu.com/ubuntu/ focal-security main restricted
    45 # deb-src http://security.ubuntu.com/ubuntu/ focal-security main restricted
    46 deb http://security.ubuntu.com/ubuntu/ focal-security universe
    47 # deb-src http://security.ubuntu.com/ubuntu/ focal-security universe
    48 deb http://security.ubuntu.com/ubuntu/ focal-security multiverse
    49 # deb-src http://security.ubuntu.com/ubuntu/ focal-security multiverse
    50 
    51 deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
    52 deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
    53 deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
    54 deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
    55 deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
    56 deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
    57 deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
    58 deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
    59 deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

            替换软件源后,要执行以下命令方能生效:

    1 $ sudo apt-get update

    4. 在 Ubuntu 子系统查看文件

            我们可以在 Ubuntu 子系统中查看 Windows 文件。进入 /mnt 目录,即可看到本地磁盘。譬如 /mnt/d,就是 Windows 下的 D 盘。但 Windows 默认仅挂载了当前磁盘。

    4.1 挂载磁盘

            对于 U 盘、移动硬盘,需要挂载后使用。命令如下:

    1 $ sudo mkdir /mnt/g                # 创建挂载目录
    2 $ sudo mount -t drvfs G: /mnt/g    # 挂载
    3 $ sudo umount /mnt/g               # 卸载

    4.2 挂载网络位置

            我们的代码存储在服务器,并将其映射为 Windows 下的盘符,这种盘符在 Linux 子系统中默认是看不到的。但我们可以使用以下命令挂载网络位置:

    1 $ sudo mkdir /mnt/android-server                                          # 创建挂载目录
    2 $ sudo mount -t drvfs '\192.168.10.3
    enzhengzhi' /mnt/android-server/   # 挂载
  • 相关阅读:
    输入两个整数序列,第一个序列表示栈的压入顺序,请判断第二个序列是否为该栈的弹出顺序。假设压入栈的所有数字均不相等。例如序列1,2,3,4,5是某栈的压入顺序,序列4,5,3,2,1是该压栈序列对应的一个弹出序列,但4,3,5,1,2就不可能是该压栈序列的弹出序列。(注意:这两个序列的长度是相等的)
    输入两棵二叉树A,B,判断B是不是A的子结构。(ps:我们约定空树不是任意一个树的子结构)
    输入两个单调递增的链表,输出两个链表合成后的链表,当然我们需要合成后的链表满足单调不减规则。
    输入一个链表,反转链表后,输出链表的所有元素。java实现
    少一点虚荣,多一点务实
    Mysql存储引擎__笔记
    osi七层模型和两主机传输过程:
    redis_笔记
    zookeeper_笔记
    rest和soap_笔记
  • 原文地址:https://www.cnblogs.com/murongmochen/p/14088768.html
Copyright © 2011-2022 走看看