当前位置:   article > 正文

Windows使用Linux子系统_lxrunoffline.exe

lxrunoffline.exe

两种安装方法:

完成权限设置+命令行激活+cmd安装打开 
    

  1. 系统升级到一周年正式版及以上(1607)

  2. 依次在 设置 - 更新与安全 - 针对开发人员 选项中,启用"开发人员模式"

  3. 在资源管理器中打开 控制面板\所有控制面板项\程序和功能 , 打开 启用或关闭 Windows功能 , 勾选 适用于Linux的Windows子系统(Beta)

  4. 重启电脑

  5. 命令行运行 lxrun /install /y 开始安装
    安装速度取决于网络情况,下载的文件在 %localappdata%\lxss 目录下 lxss.tar.gz (181M),解压后大概500M, rootfs 目录即为子系统根目录。

  6. 命令行运行 bash 进入Ubuntu
    默认使用的 root 帐号登录,通过指令 passwd 设置密码。

  • 注:本文脚本均在root帐号下操作,因此建议使用root帐号
  1. 毕竟爱折腾,难免会把子系统环境(lxss目录)玩坏掉,因此干正事前最好先备份下以便快速还原。注意,不要直接右键复制或者打包,可能会导致文件权限丢失的。
    xcopy %localappdata%\lxss %localappdata%\lxss.bak /E
  2. 当然,如果你比较任性也可以不执行上一步的备份操作,通过命令行运行 lxrun /uninstall /full 轻松卸载子系统,重复上面的步骤即可重装,不过要注意下载速度时好时坏哦。


完成权限设置+命令行激活+应用商城安装 

在应用商店中搜索linux,选中箱安装的linux系统进行安装

(注意:安装路径必须是系统安装盘;在设置里修改过新内容保存路径的无效)


 

针对第一种安装方法,即只用命令行没有在windows应用商场安装Ubuntu的用户:这时,你的Linux子系统安装路径是:C:\Users\username\AppData\Local\lxss,注意,lxss是系统隐藏文件且是系统文件夹

针对第二种安装方法,在windows应用商场安装Ubuntu的用户: C:\Users\username\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc

 

Linux子系统迁移:

下载 LxRunOffline(点此下载


查看已经安装的子系统

LxRunOffline list

移动子系统到新的目录

LxRunOffline move -n Ubuntu-18.04 -d D:\Ubuntu.windows\installed\Ubuntu

查看子系统安装路径

lxrunoffline get-dir -n Ubuntu-18.04

安装一个子系统

LxRunOffline i -n Ubuntu-18.04 -d D:\Ubuntu.windows\installed\Ubuntu -s

注册一个子系统

LxRunOffline rg -n Ubuntu-18.04 -d D:\Ubuntu.windows\installed\Ubuntu

LxRunOffline使用说明

  1. Supported actions are:
  2.     l, list            List all installed distributions.
  3.     gd, get-default    Get the default distribution, which is used by bash.exe.
  4.     sd, set-default    Set the default distribution, which is used by bash.exe.
  5.     i, install         Install a new distribution.
  6.     ui, uninstall      Uninstall a distribution.
  7.     rg, register       Register an existing installation directory.
  8.     ur, unregister     Unregister a distribution but not delete the installation directory.
  9.     m, move            Move a distribution to a new directory.
  10.     d, duplicate       Duplicate an existing distribution in a new directory.
  11.     e, export          Export a distribution's filesystem to a .tar.gz file, which can be imported by the "install" command.
  12.     r, run             Run a command in a distribution.
  13.     di, get-dir        Get the installation directory of a distribution.
  14.     gv, get-version    Get the filesystem version of a distribution.
  15.     ge, get-env        Get the default environment variables of a distribution.
  16.     se, set-env        Set the default environment variables of a distribution.
  17.     ae, add-env        Add to the default environment variables of a distribution.
  18.     re, remove-env     Remove from the default environment variables of a distribution.
  19.     gu, get-uid        Get the UID of the default user of a distribution.
  20.     su, set-uid        Set the UID of the default user of a distribution.
  21.     gk, get-kernelcmd  Get the default kernel command line of a distribution.
  22.     sk, set-kernelcmd  Set the default kernel command line of a distribution.
  23.     gf, get-flags      Get some flags of a distribution. See https://docs.microsoft.com/en-us/previous-versions/windows/desktop/api/wslapi/ne-wslapi-wsl_distribution_flags for details.
  24.     sf, set-flags      Set some flags of a distribution. See https://docs.microsoft.com/en-us/previous-versions/windows/desktop/api/wslapi/ne-wslapi-wsl_distribution_flags for details.
  25.     s, shortcut        Create a shortcut to launch a distribution.
  26.     ec, export-config  Export configuration of a distribution to an XML file.
  27.     ic, import-config  Import configuration of a distribution from an XML file.
  28.     version            Get version information about this LxRunOffline.exe.

支持的操作包括:

  1. l, list            列出所有已安装的分发版。
  2. gd, get-default    获取bash.exe使用的默认分发。
  3. sd, set-default    设置bash.exe使用的默认分发。
  4. i, install         安装新的分发版。
  5. ui, uninstall      卸载卸载一个分发。
  6. rg, register       注册一个现有的安装目录。
  7. ur, unregister     注销注销分发,但不删除安装目录。
  8. m, move            将分发移动到新目录。
  9. d, duplicate       复制复制新目录中的现有分发。
  10. e, export          导出将分发的文件系统导出到.tar.gz文件,该文件可以通过“install”命令导入。而且。
  11. r, run             在分发中运行一个命令。
  12. di, get-dir        获取一个分发版的安装目录。
  13. gv, get-version    获取分发版的文件系统版本。
  14. ge, get-env        获取分布的默认环境变量。
  15. se, set-env        设置分发的默认环境变量。
  16. ae, add-env        添加到分发的默认环境变量中。
  17. re, remove-env     从分发的默认环境变量中移除。
  18. gu, get-uid        获取分发的默认用户的uid。
  19. su, set-uid        设置分发的默认用户的uid。
  20. gk, get-kernelcmd  获取分发的默认内核命令行。
  21. sk, set-kernelcmd  设置分发的默认内核命令行。
  22. gf, get-flags      得到一些分布的标志。有关详细信息,请参阅https://docs.microsoft.com/en-us/...
  23. sf, set-flags      设置分发的一些标志。有关详细信息,请参阅https://docs.microsoft.com/en-us/...
  24. s, shortcut        快捷方式创建启动分发的快捷方式。
  25. ec, export-config  将分发的配置导出配置导出到XML文件。
  26. ic, import-config  从XML文件导入分发的配置。
  27. version            version获取有关此lxrunoffline.exe的版本信息。

 

使用阿里的镜像源:

  1. # 1.备份原来的数据源配置文件
  2. cp /etc/apt/sources.list /etc/apt/sources.list_backup
  3. # 2.编辑数据源配置文件
  4. vi /etc/apt/sources.list

源路径: 

  1. deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
  2. deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
  3. deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
  4. deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
  5. deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
  6. deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
  7. deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
  8. deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
  9. deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
  10. deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse


 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/article/detail/53589
推荐阅读
相关标签
  

闽ICP备14008679号