首页 / LINUX / win10安装Linux子系统
win10安装Linux子系统
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了win10安装Linux子系统,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3852字,纯文字阅读大概需要6分钟。
内容图文
![win10安装Linux子系统](/upload/InfoBanner/zyjiaocheng/942/46a5c966011c47138e9459f8f5a8e586.jpg)
本文结构:
一.准备工作
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.
内容总结
以上是互联网集市为您收集整理的win10安装Linux子系统全部内容,希望文章能够帮你解决win10安装Linux子系统所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。