Merge remote-tracking branch 'LCTT/master'

This commit is contained in:
Xingyu Wang 2020-11-18 21:52:50 +08:00
commit 5df114ac64
4 changed files with 282 additions and 316 deletions

View File

@ -1,170 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (You can Surf Internet in Linux Terminal With These Command Line Browsers)
[#]: via: (https://itsfoss.com/terminal-web-browsers/)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
You can Surf Internet in Linux Terminal With These Command Line Browsers
======
Im guessing that you are probably using Firefox or a Chrome-based browser like [Brave][1] to read this article. Or, maybe, Google Chrome or [Chromium][2].
In other words, you are utilizing a GUI-based approach to browse the web. However, back in the days, people used the terminal to fetch resources and browse the web because everything was mostly text-based information.
Even though you cannot get every information from a terminal now, you can still try the command line browsers for some text-based information and open a web page from the Linux terminal.
Not just limited to that, but if you are accessing a remote server or stuck in a terminal without a GUI, a terminal web browser can prove to be useful as well.
So, in this article, I will be mentioning some terminal based web browsers that you can try on Linux.
### Best Terminal-based Web Browsers for Linux Users
_**Note:** The list is in no particular order of ranking._
#### 1\. W3M
![][3]
w3m is a popular open-source text-based web browser for the terminal. Even though the original project is no longer active, an active version of it is being maintained by a different developer Tatsuya Kinoshita.
w3m is quite simple, supports SSL connections, colors, and in-line images as well. Of course, depending on what resource you are trying to access, things might look different on your end. As per my quick test, it didnt seem to load up [DuckDuckGo][4] but I could [use Google in terminal][5] just fine.
You can simply type **w3m** in the terminal to get help after installation. If youre curious, you can also check out the repository at [GitHub][6].
##### How to install and use w3m?
W3M is available on most of the default repositories for any Debian-based Linux distribution. If you have an Arch-based distro, you might want to check [AUR][7] if its not available directly.
For Ubuntu, you can install it by typing in:
```
sudo apt install w3m w3m-img
```
Here, we are installing the w3m package along with image extension for in-line image support. Next, to get started, you have to simply follow the command below:
```
w3m xyz.com
```
Of course, you need to replace xyz.com to any website that you want to browse/test. Finally, you should know that you can use the keyboard arrow keys to navigate and press enter when you want to take an action.
To quit, you can press **SHIFT+Q**, and to go back to the previous page — **SHIFT+B**. Additional shortcuts include **SHIFT + T** to open a new tab and **SHIFT + U** to open a new URL.
You can explore more about it by heading to its man page as well.
#### 2\. Lynx
![][8]
Lynx is yet another open source command line browser which you can try. Fortunately, more websites tend to work when using Lynx, so Id say it is definitely better in that aspect. I was able to load up DuckDuckGo and make it work.
In addition to that, I also noticed that it lets you accept/deny cookies when visiting various web resources. You can set it to always accept or deny as well. So, thats a good thing.
On the other hand, the window does not re-size well while using it from the terminal. I havent looked for any solutions to that, so if youre trying this out, you might want to do that. In either case, it works great and you get all the instructions for the keyboard shortcuts right when you launch it in the terminal.
Note that it does not match the system terminal theme, so it will look different no matter how your terminal looks like.
##### How to install Lynx?
Unlike w3m, you do get some Win32 installers if youre interested to try. But, on Linux, it is available on the most of the default repositories.
For Ubuntu, you just need to type in:
```
sudo apt install lynx
```
To get started, you just have to follow the command below:
```
lynx examplewebsite.com
```
Here, you just need to replace the example website with the resource you want to visit.
If you want to explore the packages for other Linux distros, you can check out their [official website resources][9].
#### 3\. Links2
![][10]
Links2 is an interesting text-based browser that you can easily utilize on your terminal with a good user experience. It gives you a nice interface to type in the URL and then proceed as soon as you launch it.
![][11]
It is worth noting that the theme will depend on your terminal settings, I have it set as “black-green”, hence this is what you see. Once you launch it as a command line browser, you just need to press any key to bring the URL prompt or Q to quit it. It works good enough and renders text from most of the sites.
Unlike Lynx, you do not get the ability to accept/reject cookies. Other than that, it seems to work just fine.
##### How to install Links2?
As youd expect, you will find it available in the most of the default repositories. For Ubuntu, you can install it by typing the following command in the terminal:
```
sudo apt install links2
```
You can refer to its [official][12] [][12][website][12] for packages or documentations if you want to install it on any other Linux distribution.
#### 4\. eLinks
![][13]
eLinks is similar to Links2 — but it is no longer maintained. You will still find it in the default repositories of various distributions, hence, I kept it in this list.
It does not blend in with your system terminal theme. So, this may not be a pretty experience as a text-based browser without a “dark” mode if you needed that.
##### How to install eLinks?
On Ubuntu, it is easy to install it. You just have to type in the following in the terminal:
```
sudo apt install elinks
```
For other Linux distributions, you should find it available on the standard repositories. But, you can refer to the [official installation instructions][14] if you do not find it in the repository.
### Wrapping Up
Its no surprise that there arent a lot of text-based web browsers to run on the terminal. Some projects like [Browsh][15] have tried to present a modern Linux command-line browser but it did not work in my case.
While tools like curl and wget allow you to [download files from the Linux command line][16], these terminal-based web browsers provide additional features.
In addition to command-line browsers, you may also like to try some [command line games for Linux][17], if you want to play around in the terminal.
What do you think about the text-based web browsers for Linux terminal? Feel free to let me know your thoughts in the comments below.
--------------------------------------------------------------------------------
via: https://itsfoss.com/terminal-web-browsers/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/brave-web-browser/
[2]: https://itsfoss.com/install-chromium-ubuntu/
[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/w3m-google.jpg?resize=800%2C463&ssl=1
[4]: https://duckduckgo.com/
[5]: https://itsfoss.com/review-googler-linux/
[6]: https://github.com/tats/w3m
[7]: https://itsfoss.com/aur-arch-linux/
[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/lynx-terminal.jpg?resize=800%2C497&ssl=1
[9]: https://lynx.invisible-island.net/lynx-resources.html
[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/links2-terminal.jpg?resize=800%2C472&ssl=1
[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/links2-terminal-welcome.jpg?resize=800%2C541&ssl=1
[12]: http://links.twibright.com/download.php
[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/elinks-terminal.jpg?resize=800%2C465&ssl=1
[14]: http://elinks.or.cz/documentation/installation.html
[15]: https://www.brow.sh/
[16]: https://itsfoss.com/download-files-from-linux-terminal/
[17]: https://itsfoss.com/best-command-line-games-linux/

View File

@ -1,146 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Using Fedora 33 with Microsofts WSL2)
[#]: via: (https://fedoramagazine.org/wsl-fedora-33/)
[#]: author: (Jim Perrin https://fedoramagazine.org/author/jperrin/)
Using Fedora 33 with Microsofts WSL2
======
![][1]
Photo by [Matthias Heil][2] on [Unsplash][3]
If youre like me, you may find yourself running Windows for a variety of reasons from work to gaming. Sure you could run Fedora in a virtual machine or as a container, but those dont blend into a common windows experience as easily as the Windows Subsystem for Linux (WSL). Using Fedora via WSL will let you blend the two environments together for a fantastic development environment.
### Prerequisites
There are a few basics youll need in order to make this all work. You should be running Windows 10, and have WSL2 installed already. If not, check out the [Microsoft documentation for instructions][4], and come back here when youre finished. Microsoft recommends setting wsl2 as the distro default for simplicity. This guide assumes youve done that.
Next, youre going to need some means of unpacking xz compressed files. You can do this with another WSL-based distribution, or use [7zip][5].
### Download a Fedora 33 rootfs
Since Fedora doesnt ship an actual rootfs archive, were going to abuse the one used to generate the container image for dockerhub. You will want to download the [tar.xz file][6] from the fedora-cloud GitHub repository. Once you have the tar.xz, uncompress it, but dont unpack it. You want to end up with something like fedora-33-_datestamp_.tar. Once you have that, youre ready to build the image.
### Composing the WSL Fedora build
I prefer to use _c:\distros_, but you can choose nearly whatever location you want. Whatever you choose, make sure the top level path exists before you import the build. Now open a cmd or powershell prompt, because its time to import:
```
```
wsl.exe --import Fedora-33 c:\distros\Fedora-33 $HOME\Downloads\fedora-33.tar
```
```
You will see Fedora-33 show up in wsls list
```
```
PS C:\Users\jperrin> wsl.exe -l -v
  NAME                   STATE           VERSION
  Fedora-33                 Stopped         2
```
```
From here, you can start to play around with Fedora in wsl, but we have a few things we need to do to make it actually _useful_ as a wsl distro.
```
```
wsl -d Fedora-33
```
```
This will launch Fedoras wsl instance as the root user. From here, youre going to install a few core packages and set a new default user. Youre also going to need to configure sudo, otherwise you wont be able to easily elevate privileges if you need to install something else later.
```
```
dnf update
dnf install wget curl sudo ncurses dnf-plugins-core dnf-utils passwd findutils
```
```
_wslutilites_ uses _curl_ and _wget_ for things like VS Code integration, so theyre useful to have around. Since you need to use a Copr repo for this, you want the added dnf functionality.
### Add your user
Now its time to add your user, and set it as the default.
```
```
useradd -G wheel yourusername
passwd yourusername
```
```
Now that youve created your username and added a password, make sure they work. Exit the wsl instance, and launch it again, this time specifying the username. Youre also going to test sudo, and check your uid.
```
```
wsl -d Fedora-33 -u yourusername
$id -u
1000
$ sudo cat /etc/shadow
```
```
Assuming everything worked fine, youre now ready to set the default user for your Fedora setup in Windows. To do this, exit the wsl instance and get back into Powershell. This Powershell one-liner configures your user properly:
```
```
Get-ItemProperty Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss\\*\ DistributionName | Where-Object -Property DistributionName -eq Fedora-33  | Set-ItemProperty -Name DefaultUid -Value 1000
```
```
Now you should be able to launch WSL again without specifying a user, and be yourself instead of root.
### Customize!
From here, youre done getting the basic Fedora 33 setup running in wsl, but it doesnt have the Windows integration piece yet. If this is something you want, theres a Copr repo to enable. If you choose to add this piece, youll be able to run Windows apps directly from inside your shell, as well as integrate your Linux environment easily with VS Code. Note that Copr is not officially supported by Fedora infrastructure. Use packages at your own risk
```
```
dnf copr enable trustywolf/wslu
```
```
Now you can go configure your terminal, setup a Python development environment, or however else you want to use Fedora 33. Enjoy!
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/wsl-fedora-33/
作者:[Jim Perrin][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://fedoramagazine.org/author/jperrin/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2020/11/wsl-fedora33-816x345.jpg
[2]: https://unsplash.com/@matthias_heil?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
[3]: https://unsplash.com/s/photos/windows?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
[4]: https://docs.microsoft.com/en-us/windows/wsl/install-win10
[5]: https://www.7-zip.org/download.html
[6]: https://github.com/fedora-cloud/docker-brew-fedora/tree/33/x86_64

View File

@ -0,0 +1,170 @@
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (You can Surf Internet in Linux Terminal With These Command Line Browsers)
[#]: via: (https://itsfoss.com/terminal-web-browsers/)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
使用命令行浏览器在 Linux 终端上网浏览
======
我猜你可能是用 Firefox 或基于 Chrome 的浏览器(如 [Brave][1])来阅读这篇文章。或者,也可能是 Chrome 浏览器或 [Chromium][2]。
换句话说,你正在利用基于 GUI 的方式浏览网页。然而,在以前,人们使用终端来获取资源和浏览网页,因为所有的东西大多是基于文本的信息。
虽然现在不能从终端上获取每一个信息,但对于一些文本信息,还是可以尝试使用命令行浏览器,从 Linux 终端上打开网页。
不仅如此,如果你访问的是远程服务器,或者只有一个没有 GUI 的终端,终端网页浏览器也可以证明它是有用的。
因此,在本文中,我将介绍一些基于终端的网络浏览器,你可以在 Linux 上尝试它们。
### Linux 用户的最佳终端 Web 浏览器
注:榜单排名不分先后。
#### 1、W3M
![][3]
`w3m` 是一个流行的基于文本的开源终端 Web 浏览器。尽管最初的项目已经不再活跃,但它的一个活跃版本正由另一个开发者 Tatsuya Kinoshita 维护。
`w3m` 相当简单,支持 SSL 连接、彩色,也支持内嵌图片。当然,根据你试图访问的资源,你那边的情况可能会有所不同。根据我的简单测试,它似乎无法加载 [DuckDuckGo][4],但我可以[在终端中使用 Google][5]就可以了。
安装后,你可以简单的在终端中输入 `w3m` 以得到帮助。如果你感兴趣的话,也可以到 [GitHub][6] 上去查看它的仓库。
**如何安装和使用 w3m**
`w3m` 在任何基于 Debian 的 Linux 发行版的默认仓库中都是可用的。如果你有一个基于 Arch 的发行版,如果没有直接可用的软件包,你可能需要查看一下 [AUR][7]。
对于 Ubuntu你可以通过键入以下内容来安装它
```
sudo apt install w3m w3m-img
```
在这里,我们将 w3m 包和图片扩展一起安装,以支持内嵌图片。接下来,要开始安装,你只需要按照下面的命令进行操作即可:
```
w3m xyz.com
```
当然,你需要将 `xyz.com` 替换成任何你想浏览/测试的网站。最后,你应该知道,你可以使用键盘上的方向键来导航,当你想采取一个动作时,按回车键。
要退出,你可以按 `SHIFT+Q`,返回上一页是 `SHIFT+B`。其他快捷键包括 `SHIFT+T` 打开新标签页和 `SHIFT+U` 打开新的 URL。
你可以通过访问它的手册页面来了解更多信息。
#### 2、Lynx
![][8]
Lynx 是又一个开源的命令行浏览器,你可以试试。幸运的是,很多的网站在使用 Lynx 时往往能正常工作,所以我说它在这方面肯定更好。我能够加载 DuckDuckGo并使其工作。
除此之外,我还注意到它可以让你在访问各种网络资源时接受或拒绝 cookie。你也可以将它设置为总是接受或拒绝。所以这是件好事。
另一方面,在终端上使用时,窗口不能很好地调整大小。我还没有寻找到任何解决方法,所以如果你正在尝试这个,你可能会想要这样做。不管是哪种情况,它都很好用,当你在终端启动它时,你会得到所有键盘快捷键的说明。
请注意,它与系统终端主题不匹配,所以无论你的终端看起来如何,它都会看起来不同。
**如何安装 Lynx**
与 w3m 不同的是,如果你有兴趣尝试的话,确实可以找到一些 Win32 上的安装程序。但是,在 Linux 上,它在大多数的默认仓库中都是可用的。
对于 Ubuntu 来说,你只需要输入:
```
sudo apt install lynx
```
要想使用,你只需要按照下面的命令进行操作:
```
lynx examplewebsite.com
```
在这里,你只需要将示例网站替换成你想要访问的资源即可。
如果你想找其他 Linux 发行版的软件包,可以查看他们的[官网资源][9]。
#### 3、Links2
![][10]
Links2 是一款有趣的基于文本的浏览器,你可以在你的终端上轻松使用,用户体验良好。它给你提供了一个很好的界面,你启动它后,只要输入网址就可以了
![][11]
值得注意的是,主题将取决于你的终端设置,我设置为“黑绿色”主题,因此你看到的就是这个。当你以命令行浏览器的方式启动它后,你只需要按任意键就会出现 URL 提示,或者按 `Q` 键退出。它足够好用,可以渲染大多数网站的文字。
与 Lynx 不同的是,你没有接受或拒绝 cookie 的功能。除此之外,它似乎工作的还不错。
**如何安装 Links2**
正如你所期望的,你会发现它在大多数默认的资源库中都有。对于 Ubuntu你可以在终端输入以下命令来安装它
```
sudo apt install links2
```
如果你想在其他 Linux 发行版上安装它,你可以参考它的[官方网站][12]获取软件包或文档。
#### 4、eLinks
![][13]
eLinks 类似于 Links2但它已经不再维护了。你仍然可以在各种发行版的默认仓库中找到它因此我把它保留在这个列表中。
它不会与你的系统终端主题相融合。所以,如果你需要的话,作为一个没有“黑暗”模式的文本型浏览器,这可能不是一个漂亮的体验。
**如何安装 eLinks**
在 Ubuntu 上,安装它很容易。你只需要在终端中输入以下内容:
```
sudo apt install elinks
```
对于其他 Linux 发行版,你应该可以在标准软件库中找到它。但是,如果你在软件库中找不到它,你可以参考[官方安装说明][14]。
### 总结
在终端上运行的基于文本的 Web 浏览器并不多,这并不奇怪。一些项目,如 [Browsh][15],试图呈现一个现代的 Linux 命令行浏览器,但在我这里它不能工作。
虽然像 `curl``wget` 这样的工具允许你[从 Linux 命令行下载文件][16],但这些基于终端的 Web 浏览器提供了额外的功能。
除了命令行浏览器之外,如果你想在终端上玩玩,也可以尝试一些[Linux 命令行游戏][17]。
对于 Linux 终端上的文本型 Web 浏览器,你有什么看法?欢迎在下面的评论中告诉我你的想法。
--------------------------------------------------------------------------------
via: https://itsfoss.com/terminal-web-browsers/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/brave-web-browser/
[2]: https://itsfoss.com/install-chromium-ubuntu/
[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/w3m-google.jpg?resize=800%2C463&ssl=1
[4]: https://duckduckgo.com/
[5]: https://itsfoss.com/review-googler-linux/
[6]: https://github.com/tats/w3m
[7]: https://itsfoss.com/aur-arch-linux/
[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/lynx-terminal.jpg?resize=800%2C497&ssl=1
[9]: https://lynx.invisible-island.net/lynx-resources.html
[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/links2-terminal.jpg?resize=800%2C472&ssl=1
[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/links2-terminal-welcome.jpg?resize=800%2C541&ssl=1
[12]: http://links.twibright.com/download.php
[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/elinks-terminal.jpg?resize=800%2C465&ssl=1
[14]: http://elinks.or.cz/documentation/installation.html
[15]: https://www.brow.sh/
[16]: https://itsfoss.com/download-files-from-linux-terminal/
[17]: https://itsfoss.com/best-command-line-games-linux/

View File

@ -0,0 +1,112 @@
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: (wxy)
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Using Fedora 33 with Microsofts WSL2)
[#]: via: (https://fedoramagazine.org/wsl-fedora-33/)
[#]: author: (Jim Perrin https://fedoramagazine.org/author/jperrin/)
通过微软的 WSL2 使用 Fedora 33
======
![][1]
如果你像我一样,你可能会发现自己因为各种原因而运行 Windows无论是因为工作还是游戏。当然你可以在虚拟机或容器中运行 Fedora但这些并不像 Windows 的 Linux 子系统WSL那样容易融合到普通的 Windows 体验中。通过 WSL 使用 Fedora 可以让你将这两种环境融合在一起,创造一个奇妙的开发环境。
### 先决条件
为了达成这一目标,你需要一些基本条件。你应该运行 Windows 10并且已经安装了 WSL2。如果没有请查看[微软文档说明][4],完成后再回来这里。微软建议为了简单起见,将 WSL2 设置为发行版的默认设置。本指南假设你已经这样做了。
接下来,你将需要一些解压 xz 压缩文件的方法。你可以用另一个基于 WSL 的发行版来解压,或者使用 [7zip][5]。
### 下载 Fedora 33 rootfs
由于 Fedora 并没有提供实际的 rootfs 存档,所以我们将借用一个用于生成 Dockerhub 容器镜像的存档。你需要从 fedora-cloud 的 GitHub 仓库下载该 [tar.xz 文件][6] 。一旦你有了这个 tar.xz 文件,解压它,但不要展开 tar 包。你会得到一个类似 `fedora-33-时间标签.tar` 的文件。有了这个文件,你就可以构建镜像了。
### 组合 WSL Fedora 的构建版本
我喜欢使用 `c:\distros` 目录,但你可以选择几乎任何你想要的位置。无论你选择什么目录,在你导入该构建版本之前,确保其顶层路径存在。现在打开一个 CMD 或 Powershell 提示符,因为是时候导入了:
```
wsl.exe --import Fedora-33 c:\distros\Fedora-33 $HOME\Downloads\fedora-33.tar
```
你会看到 Fedora-33 显示在 WSL 的列表当中:
```
PS C:\Users\jperrin> wsl.exe -l -v
NAME STATE VERSION
Fedora-33 Stopped 2
```
下面,你就可以开始在 WSL 中摆弄 Fedora 了,但我们还需要做一些事情来使它真正成为一个有用的 WSL 发行版。
```
wsl -d Fedora-33
```
这将以 root 用户的身份启动 Fedora 的 WSL 实例。下面,你将安装一些核心包并设置一个新的默认用户。你还需要配置 `sudo`,否则你将无法在以后需要安装其他东西时轻松提升权限。
```
dnf update
dnf install wget curl sudo ncurses dnf-plugins-core dnf-utils passwd findutils
```
`wslutilites` 使用 `curl``wget` 来实现与 VS Code 的集成,所以它们很有用。由于你需要使用 COPR 仓库,你需要增加 `dnf` 功能。
### 添加你的用户
现在是时候添加你的用户,并将其设置为默认用户。
```
useradd -G wheel 用户名
passwd 用户名
```
现在,你已经创建了你的用户名,并添加了密码,确保它们可以工作。退出 WSL 实例,并再次启动它,这次指定用户名。你还要测试 `sudo`,并检查你的 uid。
```
wsl -d Fedora-33 -u 用户名
$id -u
1000
$ sudo cat /etc/shadow
```
假设一切正常,你现在已经准备好在 Windows 中为你的 Fedora 环境设置默认用户。要做到这一点,请退出 WSL 实例并回到 Powershell 中。这个 Powershell 单行代码可以正确配置你的用户:
```
Get-ItemProperty Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss\\*\ DistributionName | Where-Object -Property DistributionName -eq Fedora-33  | Set-ItemProperty -Name DefaultUid -Value 1000
```
现在你应该可以再次启动 WSL而不需要指定就可以成为自己的用户而不是 root。
### 自定义!
至此,你已经有了可以在 WSL 中运行的基本 Fedora 33 环境,但它还没有 Windows 集成的部分。如果你想要这个,有一个 COPR 仓库可以启用。如果你选择添加这部分,你就可以直接在 shell 里面运行 Windows 应用,也可以轻松地将你的 Linux 环境与 VS Code 集成。需要注意的是COPR 并没有得到 Fedora 基础架构的官方支持。使用该软件包,风险自担。
```
dnf copr enable trustywolf/wslu
```
现在你可以去配置终端、设置一个 Python 开发环境,或者其它你想使用 Fedora 33 的方式。享受吧!
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/wsl-fedora-33/
作者:[Jim Perrin][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://fedoramagazine.org/author/jperrin/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2020/11/wsl-fedora33-816x345.jpg
[2]: https://unsplash.com/@matthias_heil?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
[3]: https://unsplash.com/s/photos/windows?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
[4]: https://docs.microsoft.com/en-us/windows/wsl/install-win10
[5]: https://www.7-zip.org/download.html
[6]: https://github.com/fedora-cloud/docker-brew-fedora/tree/33/x86_64