Win10 离线方式安装ubuntu(不使用商店)

一. 启用WSL,并重启电脑

命令方式(管理员方式运行PowerShell):

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux 

图形方式: 控制面板—>程序—>程序和功能—>启用或关闭Windows功能—>适用于linux的Windows子系统

二. 下载需要的安装包, 比如Ubuntu 18.04 ,下载过程有点慢,大概214M。无法下载的微信关注留言,提供百度网盘下载链接

下载页 https://docs.microsoft.com/en-us/windows/wsl/install-manual

三. 修改Ubuntu.appx文件后缀名为Ubuntu.zip

四. 解压到任意目录下面,执行./XXX.exe安装即可

Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: sebazzz
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Installation successful!

五. 修改默认的WSL配置( wslconfig)

PS A:\Ubuntu\Ubuntu> wslconfig /list /all
Windows Subsystem for Linux Distributions:
Ubuntu-18.04 (Default)

六. 更新清华的镜像源

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo vi /etc/apt/sources.list

#替换下面内容
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

七 关闭Window和Ubuntu的PATH共享(非必须。看实际情况,是否需要修改)

sudo vim /etc/wsl.conf

#增加下面内容
# 不加载Windows中的PATH内容
[interop]
appendWindowsPath = false

# 不自动挂载Windows系统所有磁盘分区
[automount]
enabled = false


保存,重启wsl。如果不生效,可以使用

wsl --list
# 适用于 Linux 的 Windows 子系统:
# Ubuntu-18.04 (默认)
wsl --terminate Ubuntu-18.04

发表评论

电子邮件地址不会被公开。 必填项已用*标注