搜索

WSL——windows上的linux子系统

看不見的法師
发布: 2025-09-19 09:04:27
原创
506人浏览过

引言

自从Windows 10的软件商店开始提供Linux子系统后,用户不再需要像使用虚拟机那样进行繁琐的网络和内存配置。这使得在本地环境中学习和测试Linux变得更为便捷。

在Windows中启用Linux子系统可以通过控制面板中的程序选项,进入“启用或关闭Windows功能”并开启“适用于Linux的Windows子系统”。之后,您可以从微软商店下载并安装Ubuntu(虽然CentOS也可用,但需要付费)。

WSL——windows上的linux子系统下载并安装Ubuntu后,打开应用程序即可启动一个Linux的黑色终端窗口。

WSL——windows上的linux子系统在Windows的Linux子系统中,访问计算机目录可以使用以下命令:

cd /mnt
登录后复制

/mnt目录是计算机目录在子系统中的共享挂载点,每个磁盘都对应一个挂载的文件夹。

如果您希望将Ubuntu的镜像源修改为国内的源,可以执行以下步骤:

Dzine
Dzine

一站式AI图像生成、设计、编辑平台

Dzine76
查看详情 Dzine
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 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。

以上就是WSL——windows上的linux子系统的详细内容,更多请关注php中文网其它相关文章!

Windows激活工具
Windows激活工具

Windows激活工具是正版认证的激活工具,永久激活,一键解决windows许可证即将过期。可激活win7系统、win8.1系统、win10系统、win11系统。下载后先看完视频激活教程,再进行操作,100%激活成功。

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 //m.sbmmt.com/ All Rights Reserved | php.cn | 湘ICP备2023035733号