windows运行Linux子系统

引言

自从windows10软件商店提供linux子系统,再不需要像虚拟机一样繁琐的配置网络和内存等了。特别适合用来做本地linux环境学习和测试。

windows开启linux

控制面板->程序->启用或关闭windows服务->开启运行Linux的windows子系统
微软商店安装ubuntu(centos也有,但是收费)
下载ubuntu
安装好打开应用就启动一个linux黑窗口
windows的linux

子系统访问电脑目录

cd /mnt

/mnt为电脑目录挂载在子系统的共享目录,里面挂载的文件夹对应每个电脑盘

下载镜像源修改为国内

  • ubuntu
	sudo vim /etc/apt/sources.list

清空文件内容,填写下面内容(中文注释删除)

	# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
	deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
	# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main main restricted universe multiverse
	deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
	# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
	deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
	# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
	deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
	# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
	
	# 预发布软件源,不建议启用
	# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
	# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse

执行

	sudo apt-get update
  • centos
	mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
	cd /etc/yum.repos.d/
	wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
	yum makecache
	yum -y update

更多文章,请搜索公众号歪歪梯Club
更多资料,请搜索公众号歪歪梯Club

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值