ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

win10安装Linux子系统

2020-02-21 14:55:25  阅读:390  来源: 互联网

标签:http root Linux bionic ubuntu win10 deb com 子系统


本文结构:

一.准备工作

     1.在控制面版中启用Linux子系统

     2.在设置-更新和安全中-开发者选项中切换到开发人员模式

二.开始安装

    1.在Windows应用商店安装一个Linux发行版本

    2.安装完成后可以在开始菜单找到,点击即可打开

    3.第一次进入ubuntu系统,需等待安装完成

    4.设置ubuntu系统的用户名和密码

    5.设置完成,安装成功

    6.设置root密码并切换为root用户

    7.设置国内安装源,这里安装阿里云的源

    8.切换语言为中文

一.准备工作

1.在控制面版中启用Linux子系统

 2.在设置-更新和安全中-开发者选项中切换到开发人员模式

 

二.开始安装

1.在Windows应用商店安装一个Linux发行版本,选择想要安装的Linux发行版,这里选择ubuntu

 选择要下载的版本,点击下载安装即可:

 2.安装完成后可以在开始菜单找到,点击即可打开

3.第一次进入ubuntu系统,需等待安装完成

4.设置ubuntu系统的用户名和密码

 5.设置完成,安装成功

接下来就可以使用ubuntu系统,例如我们可以输入一些简单的Linux命令

root@scaven:~# lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.2 LTS
Release:        18.04
Codename:       bionic

root@scaven:~# uname -a

Linux scaven 4.4.0-18362-Microsoft #476-Microsoft Fri Nov 01 16:53:00 PST 2019 x86_64 x86_64 x86_64 GNU/Linux

 6.设置root密码并切换为root用户:

scaven@scaven:~$ sudo passwd root

Enter new UNIX password:     #输入root用户密码
Retype new UNIX password:    #再次输入root用户密码
passwd: password updated successfully

scaven@scaven:~$ su - root

Password:     #输入刚刚设置的root用户密码

root@scaven:~# whoami

root

 root@scaven:~# pwd

/root

7.设置国内安装源,这里安装阿里云的源

阿里云源设置方法可参考阿里云网址:https://developer.aliyun.com/mirror/ubuntu?spm=a2c6h.13651102.0.0.3e221b11yfQs1G

root@scaven:~# cp /etc/apt/sources.list{,.bak}    #对现有源文件进行备份

root@scaven:~# ls /etc/apt/

apt.conf.d auth.conf.d preferences.d sources.list sources.list.bak sources.list.d trusted.gpg.

修改/etc/apt/sources.list文件前的内容为:

root@scaven:~# grep -Ev "^#|^$" /etc/apt/sources.list

deb http://archive.ubuntu.com/ubuntu/ bionic main restricted
deb http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted
deb http://archive.ubuntu.com/ubuntu/ bionic universe
deb http://archive.ubuntu.com/ubuntu/ bionic-updates universe
deb http://archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://archive.ubuntu.com/ubuntu/ bionic-updates multiverse
deb http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ bionic-security main restricted
deb http://security.ubuntu.com/ubuntu/ bionic-security universe
deb http://security.ubuntu.com/ubuntu/ bionic-security multiverse

只需将文件中的http://archive.ubuntu.com和http://security.ubuntu.com替换成http://mirrors.aliyun.com

方法1:使用vim打开文件替换指定内容----:%s@http://archive.ubuntu.com@http://mirrors.aliyun.com@g

方法2:使用sed命令:sed -i "s/http://archive.ubuntu.com/http://mirrors.aliyun.com/g" /etc/apt/sources.list

root@scaven:~# grep -Ev "^#|^$" /etc/apt/sources.list

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

root@scaven:~# apt-get update    #更新源

8.切换语言为中文

如果看不惯英文,可以将语言修改成中文,选择zh-CN.UTF-8将系统切换为中文环境。

root@scaven:~# dpkg-reconfigure locales

Generating locales (this might take a while)...
  en_US.UTF-8... done
  zh_CN.UTF-8... done
Generation complete.

标签:http,root,Linux,bionic,ubuntu,win10,deb,com,子系统
来源: https://www.cnblogs.com/scaven-01/p/12341331.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有