From ff12562754b0e227147fb4b0fb05781f6afe9eeb Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 29 Jun 2020 05:01:59 +0800 Subject: [PATCH 0001/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[talk]:=2020200628?= =?UTF-8?q?=20Roy=20Fielding's=20Misappropriated=20REST=20Dissertation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200628 Roy Fielding-s Misappropriated REST Dissertation.md --- ...ing-s Misappropriated REST Dissertation.md | 125 ++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 sources/talk/20200628 Roy Fielding-s Misappropriated REST Dissertation.md diff --git a/sources/talk/20200628 Roy Fielding-s Misappropriated REST Dissertation.md b/sources/talk/20200628 Roy Fielding-s Misappropriated REST Dissertation.md new file mode 100644 index 0000000000..5906fd1d92 --- /dev/null +++ b/sources/talk/20200628 Roy Fielding-s Misappropriated REST Dissertation.md @@ -0,0 +1,125 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Roy Fielding's Misappropriated REST Dissertation) +[#]: via: (https://twobithistory.org/2020/06/28/rest.html) +[#]: author: (Two-Bit History https://twobithistory.org) + +Roy Fielding's Misappropriated REST Dissertation +====== + +RESTful APIs are everywhere. This is funny, because how many people really know what “RESTful” is supposed to mean? + +I think most of us can empathize with [this Hacker News poster][1]: + +> I’ve read several articles about REST, even a bit of the original paper. But I still have quite a vague idea about what it is. I’m beginning to think that nobody knows, that it’s simply a very poorly defined concept. + +I had planned to write a blog post exploring how REST came to be such a dominant paradigm for communication across the internet. I started my research by reading [Roy Fielding’s 2000 dissertation][2], which introduced REST to the world. After reading Fielding’s dissertation, I realized that the much more interesting story here is how Fielding’s ideas came to be so widely misunderstood. + +Many more people know that Fielding’s dissertation is where REST came from than have read the dissertation (fair enough), so misconceptions about what the dissertation actually contains are pervasive. + +The biggest of these misconceptions is that the dissertation directly addresses the problem of building APIs. I had always assumed, as I imagine many people do, that REST was intended from the get-go as an architectural model for web APIs built on top of HTTP. I thought perhaps that there had been some chaotic experimental period where people were building APIs on top of HTTP all wrong, and then Fielding came along and presented REST as the sane way to do things. But the timeline doesn’t make sense here: APIs for web services, in the sense that we know them today, weren’t a thing until a few years after Fielding published his dissertation. + +Fielding’s dissertation (titled “Architectural Styles and the Design of Network-based Software Architectures”) is not about how to build APIs on top of HTTP but rather about HTTP itself. Fielding contributed to the HTTP/1.0 specification and co-authored the HTTP/1.1 specification, which was published in 1999. He was interested in the architectural lessons that could be drawn from the design of the HTTP protocol; his dissertation presents REST as a distillation of the architectural principles that guided the standardization process for HTTP/1.1. Fielding used these principles to make decisions about which proposals to incorporate into HTTP/1.1. For example, he rejected a proposal to batch requests using new `MGET` and `MHEAD` methods because he felt the proposal violated the constraints prescribed by REST, especially the constraint that messages in a REST system should be easy to proxy and cache.[1][3] So HTTP/1.1 was instead designed around persistent connections over which multiple HTTP requests can be sent. (Fielding also felt that cookies are not RESTful because they add state to what should be a stateless system, but their usage was already entrenched.[2][4]) REST, for Fielding, was not a guide to building HTTP-based systems but a guide to extending HTTP. + +This isn’t to say that Fielding doesn’t think REST could be used to build other systems. It’s just that he assumes these other systems will also be “distributed hypermedia systems.” This is another misconception people have about REST: that it is a general architecture you can use for any kind of networked application. But you could sum up the part of the dissertation where Fielding introduces REST as, essentially, “Listen, we just designed HTTP, so if you also find yourself designing a _distributed hypermedia system_ you should use this cool architecture we worked out called REST to make things easier.” It’s not obvious why Fielding thinks anyone would ever attempt to build such a thing given that the web already exists; perhaps in 2000 it seemed like there was room for more than one distributed hypermedia system in the world. Anyway, Fielding makes clear that REST is intended as a solution for the scalability and consistency problems that arise when trying to connect hypermedia across the internet, _not_ as an architectural model for distributed applications in general. + +We remember Fielding’s dissertation now as the dissertation that introduced REST, but really the dissertation is about how much one-size-fits-all software architectures suck, and how you can better pick a software architecture appropriate for your needs. Only a single chapter of the dissertation is devoted to REST itself; much of the word count is spent on a taxonomy of alternative architectural styles[3][5] that one could use for networked applications. Among these is the Pipe-and-Filter (PF) style, inspired by Unix pipes, along with various refinements of the Client-Server style (CS), such as Layered-Client-Server (LCS), Client-Cache-Stateless-Server (C$SS), and Layered-Client-Cache-Stateless-Server (LC$SS). The acronyms get unwieldy but Fielding’s point is that you can mix and match constraints imposed by existing styles to derive new styles. REST gets derived this way and could instead have been called—but for obvious reasons was not—Uniform-Layered-Code-on-Demand-Client-Cache-Stateless-Server (ULCODC$SS). Fielding establishes this taxonomy to emphasize that different constraints are appropriate for different applications and that this last group of constraints were the ones he felt worked best for HTTP. + +This is the deep, deep irony of REST’s ubiquity today. REST gets blindly used for all sorts of networked applications now, but Fielding originally offered REST as an illustration of how to derive a software architecture tailored to an individual application’s particular needs. + +I struggle to understand how this happened, because Fielding is so explicit about the pitfalls of not letting form follow function. He warns, almost at the very beginning of the dissertation, that “design-by-buzzword is a common occurrence” brought on by a failure to properly appreciate software architecture.[4][6] He picks up this theme again several pages later: + +> Some architectural styles are often portrayed as “silver bullet” solutions for all forms of software. However, a good designer should select a style that matches the needs of a particular problem being solved.[5][7] + +REST itself is an especially poor “silver bullet” solution, because, as Fielding later points out, it incorporates trade-offs that may not be appropriate unless you are building a distributed hypermedia application: + +> REST is designed to be efficient for large-grain hypermedia data transfer, optimizing for the common case of the Web, but resulting in an interface that is not optimal for other forms of architectural interaction.[6][8] + +Fielding came up with REST because the web posed a thorny problem of “anarchic scalability,” by which Fielding means the need to connect documents in a performant way across organizational and national boundaries. The constraints that REST imposes were carefully chosen to solve this anarchic scalability problem. Web service APIs that are _public-facing_ have to deal with a similar problem, so one can see why REST is relevant there. Yet today it would not be at all surprising to find that an engineering team has built a backend using REST even though the backend only talks to clients that the engineering team has full control over. We have all become the architect in [this Monty Python sketch][9], who designs an apartment building in the style of a slaughterhouse because slaughterhouses are the only thing he has experience building. (Fielding uses a line from this sketch as an epigraph for his dissertation: “Excuse me… did you say ‘knives’?”) + +So, given that Fielding’s dissertation was all about avoiding silver bullet software architectures, how did REST become a de facto standard for web services of every kind? + +My theory is that, in the mid-2000s, the people who were sick of SOAP and wanted to do something else needed their own four-letter acronym. + +I’m only half-joking here. SOAP, or the Simple Object Access Protocol, is a verbose and complicated protocol that you cannot use without first understanding a bunch of interrelated XML specifications. Early web services offered APIs based on SOAP, but, as more and more APIs started being offered in the mid-2000s, software developers burned by SOAP’s complexity migrated away en masse. + +Among this crowd, SOAP inspired contempt. Ruby-on-Rails dropped SOAP support in 2007, leading to this emblematic comment from Rails creator David Heinemeier Hansson: “We feel that SOAP is overly complicated. It’s been taken over by the enterprise people, and when that happens, usually nothing good comes of it.”[7][10] The “enterprise people” wanted everything to be formally specified, but the get-shit-done crowd saw that as a waste of time. + +If the get-shit-done crowd wasn’t going to use SOAP, they still needed some standard way of doing things. Since everyone was using HTTP, and since everyone would keep using HTTP at least as a transport layer because of all the proxying and caching support, the simplest possible thing to do was just rely on HTTP’s existing semantics. So that’s what they did. They could have called their approach Fuck It, Overload HTTP (FIOH), and that would have been an accurate name, as anyone who has ever tried to decide what HTTP status code to return for a business logic error can attest. But that would have seemed recklessly blasé next to all the formal specification work that went into SOAP. + +Luckily, there was this dissertation out there, written by a co-author of the HTTP/1.1 specification, that had something vaguely to do with extending HTTP and could offer FIOH a veneer of academic respectability. So REST was appropriated to give cover for what was really just FIOH. + +I’m not saying that this is exactly how things happened, or that there was an actual conspiracy among irreverent startup types to misappropriate REST, but this story helps me understand how REST became a model for web service APIs when Fielding’s dissertation isn’t about web service APIs at all. Adopting REST’s constraints makes some sense, especially for public-facing APIs that do cross organizational boundaries and thus benefit from REST’s “uniform interface.” That link must have been the kernel of why REST first got mentioned in connection with building APIs on the web. But imagining a separate approach called “FIOH,” that borrowed the “REST” name partly just for marketing reasons, helps me account for the many disparities between what today we know as RESTful APIs and the REST architectural style that Fielding originally described. + +REST purists often complain, for example, that so-called REST APIs aren’t actually REST APIs because they do not use Hypermedia as The Engine of Application State (HATEOAS). Fielding himself [has made this criticism][11]. According to him, a real REST API is supposed to allow you to navigate all its endpoints from a base endpoint by following links. If you think that people are actually out there trying to build REST APIs, then this is a glaring omission—HATEOAS really is fundamental to Fielding’s original conception of REST, especially considering that the “state transfer” in “Representational State Transfer” refers to navigating a state machine using hyperlinks between resources (and not, as many people seem to believe, to transferring resource state over the wire).[8][12] But if you imagine that everyone is just building FIOH APIs and advertising them, with a nudge and a wink, as REST APIs, or slightly more honestly as “RESTful” APIs, then of course HATEOAS is unimportant. + +Similarly, you might be surprised to know that there is nothing in Fielding’s dissertation about which HTTP verb should map to which CRUD action, even though software developers like to argue endlessly about whether using PUT or PATCH to update a resource is more RESTful. Having a standard mapping of HTTP verbs to CRUD actions is a useful thing, but this standard mapping is part of FIOH and not part of REST. + +This is why, rather than saying that nobody understands REST, we should just think of the term “REST” as having been misappropriated. The modern notion of a REST API has historical links to Fielding’s REST architecture, but really the two things are separate. The historical link is good to keep in mind as a guide for when to build a RESTful API. Does your API cross organizational and national boundaries the same way that HTTP needs to? Then building a RESTful API with a predictable, uniform interface might be the right approach. If not, it’s good to remember that Fielding favored having form follow function. Maybe something like GraphQL or even just JSON-RPC would be a better fit for what you are trying to accomplish. + +_If you enjoyed this post, more like it come out every four weeks! Follow [@TwoBitHistory][13] on Twitter or subscribe to the [RSS feed][14] to make sure you know when a new post is out._ + +_Previously on TwoBitHistory…_ + +> New post is up! I wrote about how to solve differential equations using an analog computer from the '30s mostly made out of gears. As a bonus there's even some stuff in here about how to aim very large artillery pieces. +> +> — TwoBitHistory (@TwoBitHistory) [April 6, 2020][15] + + 1. Roy Fielding. “Architectural Styles and the Design of Network-based Software Architectures,” 128. 2000. University of California, Irvine, PhD Dissertation, accessed June 28, 2020, . [↩︎][16] + + 2. Fielding, 130. [↩︎][17] + + 3. Fielding distinguishes between software architectures and software architecture “styles.” REST is an architectural style that has an instantiation in the architecture of HTTP. [↩︎][18] + + 4. Fielding, 2. [↩︎][19] + + 5. Fielding, 15. [↩︎][20] + + 6. Fielding, 82. [↩︎][21] + + 7. Paul Krill. “Ruby on Rails 2.0 released for Web Apps,” InfoWorld. Dec 7, 2007, accessed June 28, 2020,  [↩︎][22] + + 8. Fielding, 109. [↩︎][23] + + + + +-------------------------------------------------------------------------------- + +via: https://twobithistory.org/2020/06/28/rest.html + +作者:[Two-Bit History][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://twobithistory.org +[b]: https://github.com/lujun9972 +[1]: https://news.ycombinator.com/item?id=7201871 +[2]: https://www.ics.uci.edu/~fielding/pubs/dissertation/fielding_dissertation_2up.pdf +[3]: tmp.o6JUcKs91D#fn:1 +[4]: tmp.o6JUcKs91D#fn:2 +[5]: tmp.o6JUcKs91D#fn:3 +[6]: tmp.o6JUcKs91D#fn:4 +[7]: tmp.o6JUcKs91D#fn:5 +[8]: tmp.o6JUcKs91D#fn:6 +[9]: https://www.youtube.com/watch?v=vNoPJqm3DAY +[10]: tmp.o6JUcKs91D#fn:7 +[11]: https://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven +[12]: tmp.o6JUcKs91D#fn:8 +[13]: https://twitter.com/TwoBitHistory +[14]: https://twobithistory.org/feed.xml +[15]: https://twitter.com/TwoBitHistory/status/1247187881946275841?ref_src=twsrc%5Etfw +[16]: tmp.o6JUcKs91D#fnref:1 +[17]: tmp.o6JUcKs91D#fnref:2 +[18]: tmp.o6JUcKs91D#fnref:3 +[19]: tmp.o6JUcKs91D#fnref:4 +[20]: tmp.o6JUcKs91D#fnref:5 +[21]: tmp.o6JUcKs91D#fnref:6 +[22]: tmp.o6JUcKs91D#fnref:7 +[23]: tmp.o6JUcKs91D#fnref:8 From e5c6028e1790f544f9a82e19b531b6894e52f0d5 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Sun, 30 Aug 2020 15:49:55 +0800 Subject: [PATCH 0002/1156] Translating. --- ...08 6 best practices for teams using Git.md | 125 ++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 translated/tech/20200708 6 best practices for teams using Git.md diff --git a/translated/tech/20200708 6 best practices for teams using Git.md b/translated/tech/20200708 6 best practices for teams using Git.md new file mode 100644 index 0000000000..a28b6047ec --- /dev/null +++ b/translated/tech/20200708 6 best practices for teams using Git.md @@ -0,0 +1,125 @@ +[#]: collector: (lujun9972) +[#]: translator: (LazyWolfLin) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 best practices for teams using Git) +[#]: via: (https://opensource.com/article/20/7/git-best-practices) +[#]: author: (Ravi Chandran https://opensource.com/users/ravichandran) + +团队中使用 Git 的 6 个最佳实践 +====== + +> Work more effectively by using these Git collaboration strategies. + +![Women in tech boardroom][1] + +Git is very useful for helping small teams manage their software development processes, but there are ways you can make it even more effective. I've found a number of best practices that help my team, especially as new team members join with varying levels of Git expertise. + +### Formalize Git conventions for your team + +Everyone should follow standard conventions for branch naming, tagging, and coding. Every organization has standards or best practices, and many recommendations are freely available on the internet. What's important is to pick a suitable convention early on and follow it as a team. + +Also, different team members will have different levels of expertise with Git. You should create and maintain a basic set of instructions for performing common Git operations that follow the project's conventions. + +### Merge changes properly + +Each team member should work on a separate feature branch. But even when separate branches are used, everyone eventually modifies some common files. When merging the changes back into the `master` branch, the merge typically will not be automatic. Human intervention may be needed to reconcile different changes made by two authors to the same file. This is where you have to learn to deal with Git merge techniques. + +Modern editors have features to help with [Git merge conflicts][2]. They indicate various options for a merge in each part of a file, such as whether to keep your changes, the other branch's changes, or both. It may be time to pick a different code editor if yours doesn't support such capabilities. + +### Rebase your feature branch often + +As you continue to develop your feature branch, rebase it against `master` often. This means executing the following steps regularly: + +``` +git checkout master +git pull +git checkout feature-xyz  # name of your hypothetical feature branch +git rebase master  # may need to fix merge conflicts in feature-xyz +``` + +These steps [rewrite history][3] in your feature branch (and that's not a bad thing). First, it makes your feature branch look like `master` with all the updates made to `master` up to that point. Then all your commits to the feature branch are replayed on top, so they appear sequentially in the Git log. You may get merge conflicts that you'll need to resolve along the way, which can be a challenge. However, this is the best point to deal with merge conflicts because it only impacts your feature branch. + +After you fix any conflicts and perform regression testing, if you're ready to merge your feature back into `master`, do the above rebase steps one more time, then perform the merge: + +``` +git checkout master +git pull +git merge feature-xyz +``` + +In the interim, if someone else pushes changes to `master` that conflict with yours, the Git merge will have conflicts again. You'll need to resolve them and repeat the regression testing. + +There are other merge philosophies (e.g., without rebasing and only using merge to avoid rewriting history), some of which may even be simpler to use. However, I've found the approach above to be a clean and reliable strategy. The commit history is stacked up as a meaningful sequence of features. + +With "pure merge" strategies (without rebasing regularly, as suggested above), the history in the `master` branch will be interspersed with the commits from all the features being developed concurrently. Such a mixed-up history is harder to review. The exact commit times are usually not that important. It's better to have a history that's easier to review. + +### Squash commits before merging + +When working on your feature branch, it's fine to add a commit for even minor changes. However, if every feature branch produced 50 commits, the resulting number of commits in the `master` branch could grow unnecessarily large as features are added. In general, there should only be one or a few commits added to `master` from each feature branch. To achieve this, _squash_ multiple commits into one or a handful of commits with more elaborate messages for each one. This is typically done using a command such as: + +``` +`git rebase -i HEAD~20  # look at up to 20 commits to consider squashing` +``` + +When this is executed, an editor pops up with a list of commits that you can act upon in several ways, including _pick_ or _squash_. Picking a commit means keeping that commit message. Squashing implies combining that commit's message into the previous commit. Using these and other options, you can combine commit messages into one and do some editing and cleanup. It's also an opportunity to get rid of the commit messages that aren't important (e.g., a commit message about fixing a typo). + +In summary, keep all the actions associated with the commits, but combine and edit the associated message text for improved clarity before merging into `master`. Don't inadvertently drop a commit during the rebase process. + +After performing such a rebase, I like to look at the `git log` one last time to make final edits: + +``` +`git commit --amend` +``` + +Finally, forcing an update to your remote feature branch is necessary, since the Git commit history for the branch has been rewritten: + +``` +`git push -f` +``` + +### Use tags + +After you have finished testing and are ready to deploy the software from the `master` branch, or if you want to preserve the current state as a significant milestone for any other reason, create a Git tag. While a branch accumulates a history of changes corresponding to commits, a tag is a snapshot of the branch's state at that instant. A tag can be thought of as a history-less branch or as a named pointer to a specific commit immediately before the tag was created. + +Configuration control is about preserving the state of code at various milestones. Being able to reproduce software source code for any milestone so that it can be rebuilt when necessary is a requirement in most projects. A Git tag provides a unique identifier for such a code milestone. Tagging is straightforward: + +``` +git tag milestone-id -m "short message saying what this milestone is about" +git push --tags   # don't forget to explicitly push the tag to the remote +``` + +Consider a scenario where software corresponding to a given Git tag is distributed to a customer, and the customer reports an issue. While the code in the repository may continue to evolve, it's often necessary to go back to the state of the code corresponding to the Git tag to reproduce the customer issue precisely to create a bug fix. Sometimes newer code may have already fixed the issue but not always. Typically, you'd check out the specific tag and create a branch from that tag: + +``` +git checkout milestone-id        # checkout the tag that was distributed to the customer +git checkout -b new-branch-name  # create new branch to reproduce the bug +``` + +Beyond this, consider using annotated tags and signed tags if they may be beneficial to your project. + +### Make the software executable print the tag + +In most embedded projects, the resulting binary file created from a software build has a fixed name. The Git tag corresponding to the software binary file cannot be inferred from its filename. It is useful to "embed the tag" into the software at build time to correlate any future issues precisely to a given build. Embedding the tag can be automated within the build process. Typically, the tag string `git describe` generates is inserted into the code before code compilation so that the resulting executable will print the tag string while booting up. When a customer reports an issue, they can be guided to send you a copy of the boot output. + +### Conclusion + +Git is a sophisticated tool that takes time to master. Using these practices can help teams successfully collaborate using Git, regardless of their expertise level. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/git-best-practices + +作者:[Ravi Chandran][a] +选题:[lujun9972][b] +译者:[LazyWolfLin](https://github.com/LazyWolfLin) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ravichandran +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/christina-wocintechchat-com-rg1y72ekw6o-unsplash_1.jpg?itok=MoIv8HlK (Women in tech boardroom) +[2]: https://opensource.com/article/20/4/git-merge-conflict +[3]: https://opensource.com/article/20/4/git-rebase-i From b530799956ed19b3b7f6bdf59151cbcd4007cc3e Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Wed, 2 Sep 2020 09:30:07 +0800 Subject: [PATCH 0003/1156] Translating. --- ...08 6 best practices for teams using Git.md | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/translated/tech/20200708 6 best practices for teams using Git.md b/translated/tech/20200708 6 best practices for teams using Git.md index a28b6047ec..1d43be7f9f 100644 --- a/translated/tech/20200708 6 best practices for teams using Git.md +++ b/translated/tech/20200708 6 best practices for teams using Git.md @@ -10,25 +10,25 @@ 团队中使用 Git 的 6 个最佳实践 ====== -> Work more effectively by using these Git collaboration strategies. +> 采用这些 Git 协作策略,让团队工作更高效。 -![Women in tech boardroom][1] +![技术会议上得女性们][1] -Git is very useful for helping small teams manage their software development processes, but there are ways you can make it even more effective. I've found a number of best practices that help my team, especially as new team members join with varying levels of Git expertise. +Git 非常有助于小团队管理自身的软件开发进度,但有些方法能让你把它变得更高效。我发现了许多有助于我的团队的最佳实践,尤其是当不同 Git 水平的新人加入时。 -### Formalize Git conventions for your team +### 在你的团队中正式确立 Git 约定 Everyone should follow standard conventions for branch naming, tagging, and coding. Every organization has standards or best practices, and many recommendations are freely available on the internet. What's important is to pick a suitable convention early on and follow it as a team. Also, different team members will have different levels of expertise with Git. You should create and maintain a basic set of instructions for performing common Git operations that follow the project's conventions. -### Merge changes properly +### 正确地合并变更 Each team member should work on a separate feature branch. But even when separate branches are used, everyone eventually modifies some common files. When merging the changes back into the `master` branch, the merge typically will not be automatic. Human intervention may be needed to reconcile different changes made by two authors to the same file. This is where you have to learn to deal with Git merge techniques. Modern editors have features to help with [Git merge conflicts][2]. They indicate various options for a merge in each part of a file, such as whether to keep your changes, the other branch's changes, or both. It may be time to pick a different code editor if yours doesn't support such capabilities. -### Rebase your feature branch often +### 经常重整你的功能分支 As you continue to develop your feature branch, rebase it against `master` often. This means executing the following steps regularly: @@ -55,7 +55,7 @@ There are other merge philosophies (e.g., without rebasing and only using merge With "pure merge" strategies (without rebasing regularly, as suggested above), the history in the `master` branch will be interspersed with the commits from all the features being developed concurrently. Such a mixed-up history is harder to review. The exact commit times are usually not that important. It's better to have a history that's easier to review. -### Squash commits before merging +### 在合并前整理提交 When working on your feature branch, it's fine to add a commit for even minor changes. However, if every feature branch produced 50 commits, the resulting number of commits in the `master` branch could grow unnecessarily large as features are added. In general, there should only be one or a few commits added to `master` from each feature branch. To achieve this, _squash_ multiple commits into one or a handful of commits with more elaborate messages for each one. This is typically done using a command such as: @@ -79,7 +79,7 @@ Finally, forcing an update to your remote feature branch is necessary, since t `git push -f` ``` -### Use tags +### 使用标签 After you have finished testing and are ready to deploy the software from the `master` branch, or if you want to preserve the current state as a significant milestone for any other reason, create a Git tag. While a branch accumulates a history of changes corresponding to commits, a tag is a snapshot of the branch's state at that instant. A tag can be thought of as a history-less branch or as a named pointer to a specific commit immediately before the tag was created. @@ -99,13 +99,13 @@ git checkout -b new-branch-name  # create new branch to reproduce the bug Beyond this, consider using annotated tags and signed tags if they may be beneficial to your project. -### Make the software executable print the tag +### 让软件运行时打印标签 In most embedded projects, the resulting binary file created from a software build has a fixed name. The Git tag corresponding to the software binary file cannot be inferred from its filename. It is useful to "embed the tag" into the software at build time to correlate any future issues precisely to a given build. Embedding the tag can be automated within the build process. Typically, the tag string `git describe` generates is inserted into the code before code compilation so that the resulting executable will print the tag string while booting up. When a customer reports an issue, they can be guided to send you a copy of the boot output. -### Conclusion +### 总结 -Git is a sophisticated tool that takes time to master. Using these practices can help teams successfully collaborate using Git, regardless of their expertise level. +Git 是一个需要花时间去掌握的复杂工具。使用这些实践可以帮助团队成功地使用 Git 协作,无论他们的知识水平。 -------------------------------------------------------------------------------- From 21638f912c5751348b0aac0c1e58ccbcce507704 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Thu, 3 Sep 2020 16:25:59 +0800 Subject: [PATCH 0004/1156] Translating. --- .../tech/20200708 6 best practices for teams using Git.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/translated/tech/20200708 6 best practices for teams using Git.md b/translated/tech/20200708 6 best practices for teams using Git.md index 1d43be7f9f..d9acf80df5 100644 --- a/translated/tech/20200708 6 best practices for teams using Git.md +++ b/translated/tech/20200708 6 best practices for teams using Git.md @@ -18,15 +18,15 @@ Git 非常有助于小团队管理自身的软件开发进度,但有些方法 ### 在你的团队中正式确立 Git 约定 -Everyone should follow standard conventions for branch naming, tagging, and coding. Every organization has standards or best practices, and many recommendations are freely available on the internet. What's important is to pick a suitable convention early on and follow it as a team. +每个人都应当遵循对于分支命名,标记和编码的规范。每个组织都有自己的规范或者最佳实践,并且很多建议都可以从网上免费获取。而重要的是尽早选择合适的规范并在团队中遵循。 -Also, different team members will have different levels of expertise with Git. You should create and maintain a basic set of instructions for performing common Git operations that follow the project's conventions. +同时,不同的团队成员的 Git 水平参差不齐。你需要创建并维护一组符合团队规范的基础指令,用于执行通用 Git 操作。 ### 正确地合并变更 -Each team member should work on a separate feature branch. But even when separate branches are used, everyone eventually modifies some common files. When merging the changes back into the `master` branch, the merge typically will not be automatic. Human intervention may be needed to reconcile different changes made by two authors to the same file. This is where you have to learn to deal with Git merge techniques. +每个团队成员都需要在独立的功能分支上开发。但是尽管使用了独立的分支,每个人最终都会修改到一些通用文件。当把更改合并回 `master` 分支时,合并通常无法自动进行。可能需要手动解决不同作者对同一文件不同变更的冲突。这就是你必须学会如何处理 Git 合并技术的原因。 -Modern editors have features to help with [Git merge conflicts][2]. They indicate various options for a merge in each part of a file, such as whether to keep your changes, the other branch's changes, or both. It may be time to pick a different code editor if yours doesn't support such capabilities. +现代编辑器具有协助解决 [Git 合并冲突][2]的功能。Modern editors have features to help with [Git merge conflicts][2]. 它们对同一文件合并的每一个部分提供多种选择,例如,是否保留你的更改,或者是保留另一分支的更改,亦或者是全部保留。如果你的编辑器不支持这些功能,那么可能是时候换一个代码编辑器了。 ### 经常重整你的功能分支 From c5d4ec303648bcf1cec27ead2b897fa1c625b1d7 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Fri, 4 Sep 2020 13:56:41 +0800 Subject: [PATCH 0005/1156] Translating. --- ...00708 6 best practices for teams using Git.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/translated/tech/20200708 6 best practices for teams using Git.md b/translated/tech/20200708 6 best practices for teams using Git.md index d9acf80df5..181e730f98 100644 --- a/translated/tech/20200708 6 best practices for teams using Git.md +++ b/translated/tech/20200708 6 best practices for teams using Git.md @@ -30,18 +30,18 @@ Git 非常有助于小团队管理自身的软件开发进度,但有些方法 ### 经常重整你的功能分支 -As you continue to develop your feature branch, rebase it against `master` often. This means executing the following steps regularly: +当你持续地开发你的功能分支时,请经常对它做 `rebase master`。这意味着要经常执行以下步骤: ``` git checkout master git pull -git checkout feature-xyz  # name of your hypothetical feature branch -git rebase master  # may need to fix merge conflicts in feature-xyz +git checkout feature-xyz  # 假设的功能分支名称 +git rebase master  # 可能需要解决 feature-xyz 上的合并冲突 ``` -These steps [rewrite history][3] in your feature branch (and that's not a bad thing). First, it makes your feature branch look like `master` with all the updates made to `master` up to that point. Then all your commits to the feature branch are replayed on top, so they appear sequentially in the Git log. You may get merge conflicts that you'll need to resolve along the way, which can be a challenge. However, this is the best point to deal with merge conflicts because it only impacts your feature branch. +这些步骤会在你的功能分支上[重写历史][3](这并不是件坏事)。首先,它会使你的功能分支获得 `master` 分支上当前的所有更新。其次,你在功能分支上的所有提交都会在分支历史的顶部重写,因此它们会顺序地出现在日志中。你可能需要一路解决遇到地合并冲突,这也许是个挑战。但是,这是解决冲突最好的时间,因为它只影响你的功能分支。 -After you fix any conflicts and perform regression testing, if you're ready to merge your feature back into `master`, do the above rebase steps one more time, then perform the merge: +在解决完所有冲突并进行回归测试后,如果你准备好将功能分支合并回 `master`,那么就可以在再次执行上述的 `rebase` 步骤后进行合并: ``` git checkout master @@ -49,11 +49,11 @@ git pull git merge feature-xyz ``` -In the interim, if someone else pushes changes to `master` that conflict with yours, the Git merge will have conflicts again. You'll need to resolve them and repeat the regression testing. +在次期间,如果其他人也将和你有冲突的更改推送到 `master`,那么 Git 合并将再次发生冲突。你需要解决它们并重新进行回归测试。 -There are other merge philosophies (e.g., without rebasing and only using merge to avoid rewriting history), some of which may even be simpler to use. However, I've found the approach above to be a clean and reliable strategy. The commit history is stacked up as a meaningful sequence of features. +还有一些其他的合并哲学(例如,只使用合并不使用 rebase 以防止重写历史),其中一些甚至可能更简单易用。但是,我发现上述方法是一个干净可靠的策略。提交历史日志将以有意义的功能序列进行排列。 -With "pure merge" strategies (without rebasing regularly, as suggested above), the history in the `master` branch will be interspersed with the commits from all the features being developed concurrently. Such a mixed-up history is harder to review. The exact commit times are usually not that important. It's better to have a history that's easier to review. +如果使用“纯合并”策略(上面所说的,不定期 rebase),那么 `master` 分支的历史将穿插着所有同时开发的功能的提交。这样混乱的历史很难回顾。确切的提交时间通常并不是那么重要。最好是有一个易于查看的历史日志。 ### 在合并前整理提交 From 3c7abd397037172e863f2243f501ff934f744ade Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 4 Sep 2020 21:49:53 +0800 Subject: [PATCH 0006/1156] PRF @geekpi --- ...d run Python apps on your Android phone.md | 81 +++++++++---------- 1 file changed, 36 insertions(+), 45 deletions(-) diff --git a/translated/tech/20200826 Create and run Python apps on your Android phone.md b/translated/tech/20200826 Create and run Python apps on your Android phone.md index e383f09ca9..61ba1e259a 100644 --- a/translated/tech/20200826 Create and run Python apps on your Android phone.md +++ b/translated/tech/20200826 Create and run Python apps on your Android phone.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Create and run Python apps on your Android phone) @@ -9,14 +9,16 @@ 在你的 Android 手机上创建和运行 Python 应用 ====== -使用 Termux 和 Flask 在你的移动设备上创建、开发和运行一个网络应用。 -![Tux and Android stuffed animals on shelf][1] -学习和使用 Python 是很有趣的。由于它越来越受欢迎,有大量的方式可以让计算世界比现在更好。 +> 使用 Termux 和 Flask 在你的移动设备上创建、开发和运行一个网页应用。 -想象一下,构建和运行 python 应用,无论是开发一个命令行工具,从互联网上获取你最喜欢的文章,还是启动一个直接在掌上运行的网络服务器,所有这些都只需要一个 Android 移动设备和开源工具。这将完全改变你对移动设备的看法,将它从一个仅仅让你消费内容的设备变成一个帮助你发挥创造力的设备。 +![](https://img.linux.net.cn/data/attachment/album/202009/04/214901zsohgryndzrcs6zz.jpg) -在本文中,我将演示运行和测试一个简单的 Python 应用所需的所有的工具、软件包、步骤等等。我使用 [Flask 框架][2]来创建一个简单的 “Hello, World!” 应用,并在一个简单而强大的 Web 服务器上运行。最棒的是,这一切都发生在手机上。不需要笔记本或台式机。 +学习和使用 Python 是很有趣的。由于它越来越受欢迎,有越来越多的方式可以让计算世界比现在更好。 + +想象一下,只需一个 Android 移动设备和开源工具,就可以构建和运行一个 Python 应用,无论是开发一个命令行工具从互联网上获取你最喜欢的文章,还是启动一个直接在掌上设备运行的网页服务器,所有这些都可以实现。这将完全改变你对移动设备的看法,将它从一个仅仅让你消费内容的设备变成一个帮助你发挥创造力的设备。 + +在本文中,我将演示运行和测试一个简单的 Python 应用所需的所有的工具、软件包、步骤和各种零零散散的东西。我使用 [Flask 框架][2]来创建一个简单的 “Hello, World!” 应用,并在一个简单而强大的网页服务器上运行。最棒的是,这一切都发生在手机上。不需要笔记本或台式机。 ### 在 Android 上安装 Termux @@ -24,27 +26,24 @@ ![Welcome to Termux][6] -安装 Termux 后,启动它并使用 Termux 的 **pkg** 命令执行一些必要的软件安装。 - -订阅额外的仓库 “root-repo”: +安装 Termux 后,启动它并使用 Termux 的 `pkg` 命令执行一些必要的软件安装。 +订阅附加仓库 `root-repo`: ``` -`$ pkg install root-repo` +$ pkg install root-repo ``` 执行更新,使所有安装的软件达到最新状态。 - ``` -`$ pkg update` +$ pkg update ``` 最后,安装 Python: - ``` -`$ pkg install python` +$ pkg install python ``` ![Install Python][7] @@ -57,7 +56,6 @@ 首先创建一个项目目录: - ``` $ mkdir Source $ cd Source @@ -65,55 +63,50 @@ $ cd Source 接下来,创建一个 Python 虚拟环境。这是 Python 开发者的常见做法,它有助于让你的 Python 项目独立于你的开发系统(在本例中是你的手机)。在你的虚拟环境中,你将能够安装特定于你应用的 Python 模块。 - ``` -`$ python -m venv venv` +$ python -m venv venv ``` 激活你的新虚拟环境(注意,开头的两个点用空格隔开) - ``` $ . ./venv/bin/activate (env)$ ``` -请注意你的 shell 提示符现在以 **(env)** 开头,表示你在虚拟环境中。 - -现在使用 **pip** 安装 Flask Python 模块。 +请注意你的 shell 提示符现在以 `(env)` 开头,表示你在虚拟环境中。 +现在使用 `pip` 安装 Flask Python 模块。 ``` -`(env) $ pip install flask` +(env) $ pip install flask ``` ### 在 Android 上写 Python 代码 你已经准备好了。现在你需要为你的应用编写代码。 -要做到这一点,你需要有经典文本编辑器的经验。我使用的是 **vi**。如果你不熟悉 **vi**,请安装并试用 **vimtutor**,它(如其名称所暗示的)可以教你如何使用这个编辑器。如果你有其他你喜欢的编辑器,如 **jove**、**jed**、**joe** 或 **emacs**,你可以安装并使用其中一个。 - -现在,由于这个演示程序非常简单,你也可以直接使用 shell 的 **heredoc** 功能,它允许你直接在提示符中输入文本。 +要做到这一点,你需要有经典文本编辑器的经验。我使用的是 `vi`。如果你不熟悉 `vi`,请安装并试用 `vimtutor`,它(如其名称所暗示的)可以教你如何使用这个编辑器。如果你有其他你喜欢的编辑器,如 `jove`、`jed`、`joe` 或 `emacs`,你可以安装并使用其中一个。 +现在,由于这个演示程序非常简单,你也可以直接使用 shell 的 heredoc 功能,它允许你直接在提示符中输入文本。 ``` -(env)$ cat << EOF >> hello_world.py -> from flask import Flask -> app = Flask(__name__) -> -> @app.route('/') -> def hello_world(): ->     return 'Hello, World!' -> EOF +(env)$ cat << EOF >> hello_world.py +> from flask import Flask +> app = Flask(__name__) +> +> @app.route('/') +> def hello_world(): +> return 'Hello, World!' +> EOF (env)$ ``` -这是仅六行的代码,但有了它,你可以导入 Flask,创建一个应用,并将传入流量路由到名为 **hello_world** 的函数。 +这只有六行代码,但有了它,你可以导入 Flask,创建一个应用,并将传入流量路由到名为 `hello_world` 的函数。 ![Vim on Android][8] -现在你已经准备好了 Web 服务器的代码。现在是时候设置一些[环境变量][9],并在你的手机上启动一个 Web 服务器了。 - +现在你已经准备好了网页服务器的代码。现在是时候设置一些[环境变量][9],并在你的手机上启动一个网页服务器了。 ``` (env) $ export FLASK_APP=hello_world.py @@ -125,32 +118,30 @@ $ . ./venv/bin/activate 启动应用后,你会看到这条消息: - ``` -`serving Flask app… running on http://127.0.0.1:5000/` +serving Flask app… running on http://127.0.0.1:5000/ ``` -这表明你现在在 **localhost**(也就是你的设备)上运行着一个微型 Web 服务器。该服务器正在监听来自 5000 端口的请求。 +这表明你现在在 localhost(也就是你的设备)上运行着一个微型网页服务器。该服务器正在监听来自 5000 端口的请求。 -打开你的手机浏览器并进入到 ****,查看你的网络应用。 +打开你的手机浏览器并进入到 `http://localhost:5000`,查看你的网页应用。 ![Your web app][11] 你并没有损害手机的安全性。你只运行了一个本地服务器,这意味着你的手机不接受来自外部世界的请求。只有你可以访问你的 Flask 服务器。 -为了让别人看到你的服务器,你可以在**运行**命令中加入 **/\--host=0.0.0.0** 来禁用 Flask 的调试模式。这确实会打开手机上的端口,所以要谨慎使用。 - +为了让别人看到你的服务器,你可以在 `run` 命令中加入 `--host=0.0.0.0` 来禁用 Flask 的调试模式。这会打开你的手机上的端口,所以要谨慎使用。 ``` (env) $ export FLASK_ENV=”” (env) $ flask run –host=0.0.0.0 ``` -按 **Ctrl+C** 停止服务器(使用特殊的 Termux 控制键)。 +按 `Ctrl+C` 停止服务器(使用特殊的 `Termux` 键来作为 `Ctrl` 键)。 ### 决定下一步怎么做 -你的手机可能不是一个严肃的网络应用的理想服务器平台,但这个例子证明了可能性是无限的。你可能会在 Android 手机上编程,只是因为这是一种方便的实践方式,或者因为你有一个令人兴奋的本地化网络应用的新想法,或者你只是碰巧使用 Flask 应用来完成自己的日常任务。正如爱因斯坦曾经说过的”想象力比知识更重要“,对于任何一个新手编码者,或者一个经验丰富的 Linux 或 Android 爱好者来说,这是一个有趣的小项目。它可以扩展到无穷的层次,所以让你的好奇心接手,并做出一些令人兴奋的东西! +你的手机可能不是一个严肃的网页应用的理想服务器平台,但这个例子证明了可能性是无限的。你可能会在 Android 手机上编程,只是因为这是一种方便的实践方式,或者因为你有一个令人兴奋的本地化网页应用的新想法,或者你只是碰巧使用 Flask 应用来完成自己的日常任务。正如爱因斯坦曾经说过的“想象力比知识更重要”,对于任何一个新手编码者,或者一个经验丰富的 Linux 或 Android 爱好者来说,这是一个有趣的小项目。它可以扩展到无穷的层次,所以让你的好奇心接手,并做出一些令人兴奋的东西! -------------------------------------------------------------------------------- @@ -159,7 +150,7 @@ via: https://opensource.com/article/20/8/python-android-mobile 作者:[Phani Adabala][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 859704fcad9cfb6dc3d0779022653553856e99f6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 4 Sep 2020 21:55:31 +0800 Subject: [PATCH 0007/1156] PUB @geekpi https://linux.cn/article-12582-1.html --- ...200826 Create and run Python apps on your Android phone.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200826 Create and run Python apps on your Android phone.md (99%) diff --git a/translated/tech/20200826 Create and run Python apps on your Android phone.md b/published/20200826 Create and run Python apps on your Android phone.md similarity index 99% rename from translated/tech/20200826 Create and run Python apps on your Android phone.md rename to published/20200826 Create and run Python apps on your Android phone.md index 61ba1e259a..09d8138226 100644 --- a/translated/tech/20200826 Create and run Python apps on your Android phone.md +++ b/published/20200826 Create and run Python apps on your Android phone.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12582-1.html) [#]: subject: (Create and run Python apps on your Android phone) [#]: via: (https://opensource.com/article/20/8/python-android-mobile) [#]: author: (Phani Adabala https://opensource.com/users/adabala) From 65723556a99da843eec4187c1a5b821a918ef73e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 5 Sep 2020 05:02:04 +0800 Subject: [PATCH 0008/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200904?= =?UTF-8?q?=20Build=20a=20remote=20management=20console=20using=20Python?= =?UTF-8?q?=20and=20Jupyter=20Notebooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200904 Build a remote management console using Python and Jupyter Notebooks.md --- ...sole using Python and Jupyter Notebooks.md | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 sources/tech/20200904 Build a remote management console using Python and Jupyter Notebooks.md diff --git a/sources/tech/20200904 Build a remote management console using Python and Jupyter Notebooks.md b/sources/tech/20200904 Build a remote management console using Python and Jupyter Notebooks.md new file mode 100644 index 0000000000..b75f027e10 --- /dev/null +++ b/sources/tech/20200904 Build a remote management console using Python and Jupyter Notebooks.md @@ -0,0 +1,111 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Build a remote management console using Python and Jupyter Notebooks) +[#]: via: (https://opensource.com/article/20/9/remote-management-jupyter) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +Build a remote management console using Python and Jupyter Notebooks +====== +Turn Jupyter into a remote administration console. +![Computer laptop in space][1] + +Secure shell (SSH) is a powerful tool for remote administration, but it lacks some niceties. Writing a full-fledged remote administration console sounds like it would be a lot of work. Surely, someone in the open source community has already written something? + +They have, and its name is [Jupyter][2]. You might think Jupyter is one of those tools data scientists use to analyze trends in ad clicks over a week or something. This is not wrong—they do, and it is a great tool for that. But that is just scratching its surface. + +### About SSH port forwarding + +Sometimes, there is a server that you can SSH into over port 22. There is no reason to assume you can connect to any other port. Maybe you are SSHing through another "jumpbox" server that has more access or there are host or network firewalls that restrict ports. There are good reasons to restrict IP ranges for access, of course. SSH is a secure protocol for remote management, but allowing anyone to connect to any port is quite unnecessary. + +Here is an alternative: Run a simple SSH command with port forwarding to forward a local port to a _remote_ _local_ connection. When you run an SSH port-forwarding command like `-L 8111:127.0.0.1:8888`, you are telling SSH to forward your _local_ port `8111` to what the _remote_ host thinks `127.0.0.1:8888` is. The remote host thinks `127.0.0.1` is itself. + +Just like on _Sesame Street_, "here" is a subtle word. + +The address `127.0.0.1` is how you spell "here" to the network. + +### Learn by doing + +This might sound confusing, but running this is less complicated than explaining it: + + +``` +$ ssh -L 8111:127.0.0.1:8888 moshez@172.17.0.3 +Linux 6ad096502e48 5.4.0-40-generic #44-Ubuntu SMP Tue Jun 23 00:01:04 UTC 2020 x86_64 + +The programs included with the Debian GNU/Linux system are free software; +the exact distribution terms for each program are described in the +individual files in /usr/share/doc/*/copyright. + +Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent +permitted by applicable law. +Last login: Wed Aug  5 22:03:25 2020 from 172.17.0.1 +$ jupyter/bin/jupyter lab --ip=127.0.0.1 +[I 22:04:29.771 LabApp] JupyterLab application directory is /home/moshez/jupyter/share/jupyter/lab +[I 22:04:29.773 LabApp] Serving notebooks from local directory: /home/moshez +[I 22:04:29.773 LabApp] Jupyter Notebook 6.1.1 is running at: +[I 22:04:29.773 LabApp] +<MORE STUFF SNIPPED> +``` + +Port-forward `8111` to `127.0.0.1` and start Jupyter on the remote host that's listening on `127.0.0.1:8888`. + +Now you need to understand that Jupyter is lying. It thinks you need to connect to port `8888`, but you forwarded that to port `8111`. So, after you copy the URL to your browser, but before clicking Enter, modify the port from `8888` to `8111`: + +![Jupyter remote management console][3] + +(Moshe Zadka, [CC BY-SA 4.0][4]) + +There it is: your remote management console. As you can see, there is a "Terminal" icon at the bottom. Click it to get a terminal: + +![Terminal in Jupyter remote console][5] + +(Moshe Zadka, [CC BY-SA 4.0][4]) + +You can run a command. Creating a file will show it in the file browser on the side. You can click on that file to open it in an editor that is running locally: + +![Opening a file][6] + +(Moshe Zadka, [CC BY-SA 4.0][4]) + +You can also download, rename, or delete files: + +![File options in Jupyter remote console][7] + +(Moshe Zadka, [CC BY-SA 4.0][4]) + +Clicking on the little **Up arrow** will let you upload files. Why not upload the screenshot above? + +![Uploading a screenshot][8] + +(Moshe Zadka, [CC BY-SA 4.0][4]) + +As a nice final tidbit, Jupyter lets you view the remote images directly by double-clicking on them. + +Oh, right, and if you want to do systems automation using Python, you can also use Jupyter to open a notebook. + +So the next time you need to remotely manage a firewalled environment, why not use Jupyter? + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/remote-management-jupyter + +作者:[Moshe Zadka][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://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_space_graphic_cosmic.png?itok=wu493YbB (Computer laptop in space) +[2]: https://jupyter.org/ +[3]: https://opensource.com/sites/default/files/uploads/output_1_0.png (Jupyter remote management console) +[4]: https://creativecommons.org/licenses/by-sa/4.0/ +[5]: https://opensource.com/sites/default/files/uploads/output_3_0.png (Terminal in Jupyter remote console) +[6]: https://opensource.com/sites/default/files/uploads/output_5_0.png (Opening a file) +[7]: https://opensource.com/sites/default/files/uploads/output_7_0.png (File options in Jupyter remote console) +[8]: https://opensource.com/sites/default/files/uploads/output_9_0.png (Uploading a screenshot) From 014834daa1ffd5f6748c8d51b6f18c4a43308825 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 5 Sep 2020 05:02:17 +0800 Subject: [PATCH 0009/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200904?= =?UTF-8?q?=20Managing=20a=20non-profit=20organization's=20supply=20chain?= =?UTF-8?q?=20with=20Groovy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200904 Managing a non-profit organization-s supply chain with Groovy.md --- ...organization-s supply chain with Groovy.md | 229 ++++++++++++++++++ 1 file changed, 229 insertions(+) create mode 100644 sources/tech/20200904 Managing a non-profit organization-s supply chain with Groovy.md diff --git a/sources/tech/20200904 Managing a non-profit organization-s supply chain with Groovy.md b/sources/tech/20200904 Managing a non-profit organization-s supply chain with Groovy.md new file mode 100644 index 0000000000..e715dc47d5 --- /dev/null +++ b/sources/tech/20200904 Managing a non-profit organization-s supply chain with Groovy.md @@ -0,0 +1,229 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Managing a non-profit organization's supply chain with Groovy) +[#]: via: (https://opensource.com/article/20/9/groovy) +[#]: author: (Chris Hermansen https://opensource.com/users/clhermansen) + +Managing a non-profit organization's supply chain with Groovy +====== +Let's use Groovy to solve a charity's distribution problem. +![Jars with food inside on a shelf][1] + +There are many reasons I'm a big fan of [Java][2], but perhaps most of all, because of the particular combo of static typing and object-orientedness that imbues its design. However, when I need a quick solution, especially to a "solve it and forget it" problem dealing with data, I usually reach for [Groovy][3] (or sometimes [Python][4]) instead, especially if the library that addresses my problem exists and is well-documented. Sometimes even [awk][5] will do. But I keep meaning to start using [Julia][6] more, and then there's [Go][7]. + +Every so often, I run across a different kind of problem, and when it is sufficiently compact, sometimes I will solve it in a few languages, just to learn more about how each addresses the problem. + +Recently, a non-programmer colleague introduced me to just such a problem. It goes like this: + +> Many people living in community XYZ struggle to make ends meet on a daily basis. Employment opportunities in the community are limited and tend to be low-paying. The cost of living is comparatively high: water, electricity, and healthcare are expensive. Post-secondary education, whether academic or technical, means moving to the nearest city. On the plus side, the community is small and close-knit. People help each other out as much as their circumstances permit. +> +> COVID-19 has hit this community hard in the economic sense. Although there haven't been any infections yet, the two main employers in the town are facing financial ruin and have laid off almost all of their workers. The government has helped out, but the amount of help is not enough for the families struggling the hardest. +> +> A local branch of a national charity has received some funding to provide support to families in need. Seeking to stretch this funding as much as possible, the charity arranges to buy bulk lots of food and household supplies, then break up the bulk lots into family hampers of approximately equal monetary value. Their question is, how to do so? + +My colleague thought that perhaps I could help him with a spreadsheet to handle the distribution. However, to me, this seemed to be the perfect little problem to solve with a small program. What might the steps be? + + 1. Unpack the bulk packages into their individual units. + 2. While there are still units left: + 1. Grab a fresh hamper. + 2. Set the hamper value to zero. + 3. While the hamper value is less than the ideal hamper value and there are still units left: + 1. Pick a unit at random. + 2. If that unit isn't in the hamper and if the hamper value wouldn't be too high by adding it: + 1. Move the unit to the hamper. + 2. Increment the hamper value by the unit price. + + + +That seems like a good first approximation. It also seems like the perfect small algorithm to implement in Groovy. + +### The Groovy solution + +In Java, I find myself declaring utility classes to hold tuples of data (the new record feature is going to be great for that). In Groovy, I tend to use the language support for maps. Let's use a list of maps to hold the bulk items picked up from the wholesaler: + + +``` +def packs = [ +    [item:'Rice',brand:'Best Family',units:10,price:5650,quantity:1], +    [item:'Spaghetti',brand:'Best Family',units:1,price:327,quantity:10], +    [item:'Sardines',brand:'Fresh Caught',units:3,price:2727,quantity:3], +    [item:'Chickpeas',brand:'Southern Style',units:2,price:2600,quantity:5], +    [item:'Lentils',brand:'Southern Style',units:2,price:2378,quantity:5], +    [item:'Vegetable oil',brand:'Crafco',units:12,price:10020,quantity:1], +    [item:'UHT milk',brand:'Atlantic',units:6,price:4560,quantity:2], +    [item:'Flour',brand:'Neighbor Mills',units:10,price:5200,quantity:1], +    [item:'Tomato sauce',brand:'Best Family',units:1,price:190,quantity:10], +    [item:'Sugar',brand:'Good Price',units:1,price:565,quantity:10], +    [item:'Tea',brand:'Superior',units:5,price:2720,quantity:2], +    [item:'Coffee',brand:'Colombia Select',units:2,price:4180,quantity:5], +    [item:'Tofu',brand:'Gourmet Choice',units:1,price:1580,quantity:10], +    [item:'Bleach',brand:'Blanchite',units:5,price:3550,quantity:2], +    [item:'Soap',brand:'Sunny Day',units:6,price:1794,quantity:2]] +``` + +There is one bulk pack of 10 bags of rice and 10 bulk packs with one bag each of spaghetti. In the above, the variable `packs` is set to a list (actually a Java `ArrayList` underneath) of maps (actually a Java `HashMap` underneath). Because Groovy is dynamically typed (by default, anyway), I use `def` to declare the `packs` variable and am happy to have both `String` and `Integer` values in my maps. + +And yes, those prices do look a bit strange, but this problem happened in a place with a different currency. + +The next step is to unpack these bulk packages. Unpacking the single bulk package of rice yields 10 units of rice; that is, the total number of units yielded is `units * quantity`. Groovy provides a handy function called `collectMany` that can be used to flatten lists of lists, so the code to carry out the unpacking is really straightforward: + + +``` +def units = packs.collectMany { pack -> +    [[item:pack.item, brand:pack.brand, price:(pack.price / pack.units)]] * +                (pack.units * pack.quantity) +} +``` + +Note that `collectMany` takes a `Closure` as its argument; so this is a kind of locally declared function with a single parameter, `pack`, that returns a list of (`units * quantity`) maps, with each map including the item, brand, and calculated unit price from the corresponding bulk pack. Of note here is that the Groovy multiply operator (`*`) with a list on the left side and a number (`N`) on the right will produce a list with the original items replicated in order `N` times. + +The final step is to repack the units into the hampers for distribution. But first, I need to get a bit more specific about the ideal hamper value, and I might as well not be overly restrictive when there are just a few units left: + + +``` +def valueIdeal = 5000 +def valueMax = valueIdeal * 1.1 +``` + +OK! Let's repack the hampers: + + +``` +def rnd = new [Random][8]() +def hamperNumber = 0    // [1] + +while (units.size()) {  // [2] +    hamperNumber++ +    def hamper = [] +    def value = 0       // [2.1] +    for (boolean canAdd = true; canAdd; ) {        // [2.2] +        int u = rnd.nextInt(units.size())          // [2.2.1] +        canAdd = false                             // [2.2.2] +        for (int o = 0; o < units.size(); o++) {   // [2.2.3] +            int uo = (u + o) % units.size() +            def unit = units[uo]                   // [2.2.3.1] +            if (units.size() < 3 || +                        !(unit in hamper) && +                        (value + unit.price) < valueMax) { // [2.2.3.2] +                hamper.add(unit) +                value += unit.price +                units.remove(uo)                   // [2.2.3.3] +                canAdd = units.size() > 0 +                break                              // [2.2.3.4] +            } +        }                                          // [2.2.4] +    } +    println "" +    println "Hamper $hamperNumber value $value:" +    hamper.each { item -> +        printf "%-25s%-25s%7.2f\n",item.item,item.brand,item.price +    }                                                                   // [2.3] +    println "Remaining units ${units.size()} average price = $avgPrice" // [2.4] +} +``` + +Some clarification, with numbers in brackets in the comments above (e.g., _[1]_) corresponding to the clarifications below: + + * 1\. Initialize Groovy's random number generator and the hamper number. + * 2\. This `while {}` loop will redistribute units into hampers as long as there are more available: + * 2.1 Increment the hamper number, get a new empty hamper (a list of units), and set its value to 0. + * 2.2 This `for {}` loop will add as many units to the hamper as possible: + * 2.2.1 Get a random number between zero and the number of remaining units minus 1. + * 2.2.2 Assume you can't find more units to add. + * 2.2.3 This `for {}` loop, starting at the randomly chosen index, will try to find a unit that can be added to the hamper. + * 2.2.3.1 Figure out which unit to look at. + * 2.2.3.2 Add this unit to the hamper if there are only a few left or if the value of the hamper isn't too high once the unit is added. + * 2.2.3.3 Add the unit to the hamper, increment the hamper value by the unit price, and remove the unit from the available units list. + * 2.2.3.4 As long as there are units left, you can add more, so break out of this loop to keep looking. + * 2.2.4 On exit from this `for {}` loop, if you inspected every remaining unit and could not find one to add to the hamper, the hamper is complete; otherwise, you found one and can continue looking for more. + * 2.3 Print out the contents of the hamper. + * 2.4 Print out the remaining units info. + + + +When you run this code, the output looks like: + + +``` +Hamper 1 value 5414: +Vegetable oil            Crafco                    835.00 +Coffee                   Colombia Select          2090.00 +Tofu                     Gourmet Choice           1580.00 +Sardines                 Fresh Caught              909.00 +Remaing units 151 + +Hamper 2 value 5309: +Flour                    Neighbor Mills            520.00 +Sugar                    Good Price                565.00 +Vegetable oil            Crafco                    835.00 +Coffee                   Colombia Select          2090.00 +Rice                     Best Family               565.00 +Tomato sauce             Best Family               190.00 +Tea                      Superior                  544.00 +Remaing units 144 + +Hamper 3 value 5395: +Flour                    Neighbor Mills            520.00 +UHT milk                 Atlantic                  760.00 +Tomato sauce             Best Family               190.00 +Tofu                     Gourmet Choice           1580.00 +Spaghetti                Best Family               327.00 +Sugar                    Good Price                565.00 +Sardines                 Fresh Caught              909.00 +Tea                      Superior                  544.00 +Remaing units 136 + +… + +Hamper 23 value 5148: +Flour                    Neighbor Mills            520.00 +Tea                      Superior                  544.00 +Chickpeas                Southern Style           1300.00 +Lentils                  Southern Style           1189.00 +Vegetable oil            Crafco                    835.00 +UHT milk                 Atlantic                  760.00 +Remaing units 3 + +Hamper 24 value 3955: +Chickpeas                Southern Style           1300.00 +Sugar                    Good Price                565.00 +Coffee                   Colombia Select          2090.00 +Remaing units 0 +``` + +The last hamper is abbreviated in contents and value. + +### Closing thoughts + +Note there is some fiddly business about being able to add units to the hamper. Basically, you pick a random position in the list of units and, starting at that position, iterate through the list until you either find a unit whose price allows it to be included or until you exhaust the list. Also, when there are only a few items left, you just toss them into the last hamper. + +Another issue worth mentioning: This isn't a particularly efficient approach. Removing elements from `ArrayLists`, letting Groovy use its default `BigDecimal`, and a few other things make this less suitable for a huge redistribution problem. Still, it runs quite rapidly on my aging dual-core machine. + +And one final thought—using `while { … }` and `for { … }`? Really? Not some cool functional code? Afraid so. I couldn't think of a way to use map and reduce style closures in Groovy in collaboration with a random selection of units for repackaging. Can you? + +In another article article, I'll solve this in Python, and future articles will do it in Java, Julia, and Go. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/groovy + +作者:[Chris Hermansen][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://opensource.com/users/clhermansen +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_secret_ingredient_520x292.png?itok=QbKzJq-N (Jars with food inside on a shelf) +[2]: https://www.java.com/en/ +[3]: https://groovy-lang.org/ +[4]: https://www.python.org/ +[5]: https://www.gnu.org/software/gawk/manual/gawk.html +[6]: https://julialang.org/ +[7]: https://golang.org/ +[8]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+random From 0f0f3c1f06db6fd16e93cabe803393bfd04426cd Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 5 Sep 2020 20:55:02 +0800 Subject: [PATCH 0010/1156] APL --- sources/talk/20200826 What is DNS and how does it work.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20200826 What is DNS and how does it work.md b/sources/talk/20200826 What is DNS and how does it work.md index 3771b3da79..a99416aca5 100644 --- a/sources/talk/20200826 What is DNS and how does it work.md +++ b/sources/talk/20200826 What is DNS and how does it work.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 2dbe3fc7f84534088236dd487157c752cfc10e87 Mon Sep 17 00:00:00 2001 From: SilentDawn Date: Sat, 5 Sep 2020 21:06:59 +0800 Subject: [PATCH 0011/1156] Update 20190105 Why Sorting is O(N log N).md --- sources/talk/20190105 Why Sorting is O(N log N).md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20190105 Why Sorting is O(N log N).md b/sources/talk/20190105 Why Sorting is O(N log N).md index 34a1d3bf97..68a40384c8 100644 --- a/sources/talk/20190105 Why Sorting is O(N log N).md +++ b/sources/talk/20190105 Why Sorting is O(N log N).md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (silentdawn-zz) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f0a2238440063fb80b8363c43bed7bb7f1647217 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 5 Sep 2020 22:35:37 +0800 Subject: [PATCH 0012/1156] TSL --- ...200826 What is DNS and how does it work.md | 140 ------------------ ...200826 What is DNS and how does it work.md | 135 +++++++++++++++++ 2 files changed, 135 insertions(+), 140 deletions(-) delete mode 100644 sources/talk/20200826 What is DNS and how does it work.md create mode 100644 translated/tech/20200826 What is DNS and how does it work.md diff --git a/sources/talk/20200826 What is DNS and how does it work.md b/sources/talk/20200826 What is DNS and how does it work.md deleted file mode 100644 index a99416aca5..0000000000 --- a/sources/talk/20200826 What is DNS and how does it work.md +++ /dev/null @@ -1,140 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (What is DNS and how does it work?) -[#]: via: (https://www.networkworld.com/article/3268449/what-is-dns-and-how-does-it-work.html) -[#]: author: (Keith Shaw and Josh Fruhlinger ) - -What is DNS and how does it work? -====== -The Domain Name System resolves the names of internet sites with their underlying IP addresses adding efficiency and even security in the process. -Thinkstock - -The Domain Name System (DNS) is one of the foundations of the internet, yet most people outside of networking probably don’t realize they use it every day to do their jobs, check their email or waste time on their smartphones. - -At its most basic, DNS is a directory of names that match with numbers. The numbers, in this case are IP addresses, which computers use to communicate with each other. Most descriptions of DNS use the analogy of a phone book, which is fine for people over the age of 30 who know what a phone book is. - -[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] - -If you’re under 30, think of DNS like your smartphone’s contact list, which matches people’s names with their phone numbers and email addresses. Then multiply that contact list by everyone else on the planet. - -### A brief history of DNS - -When the internet was very, very small, it was easier for people to correspond specific IP addresses with specific computers, but that didn’t last for long as more devices and people joined the growing network. It's still possible to type a specific IP address into a browser to reach a website, but then, as now, people wanted an address made up of easy-to-remember words, of the sort that we would recognize as a domain name (like networkworld.com) today. In the 1970s and early '80s, those names and addresses were assigned by one person — [Elizabeth Feinler at Stanford][2] – who maintained a master list of every Internet-connected computer in a text file called [HOSTS.TXT][3]. - -This was obviously an untenable situation as the Internet grew, not least because Feinler only handled requests before 6 p.m. California time, and took time off for Christmas. In 1983, Paul Mockapetris, a researcher at USC, was tasked with coming up with a compromise among multiple suggestions for dealing with the problem. He basically ignored them all and developed his own system, which he dubbed DNS. While it's obviously changed quite a bit since then, at a fundamental level it still works the same way it did nearly 40 years ago. - -### How DNS servers work - -The DNS directory that matches name to numbers isn’t located all in one place in some dark corner of the internet. With [more than 332 million domain names listed at the end of 2017][4], a single directory would be very large indeed. Like the internet itself, the directory is distributed around the world, stored on domain name servers (generally referred to as DNS servers for short) that all communicate with each other on a very regular basis to provide updates and redundancies. - -### Authoritative DNS servers vs. recursive DNS servers - -When your computer wants to find the IP address associated with a domain name, it first makes its request to a recursive DNS server, also known as recursive resolver*.* A recursive resolver is a server that is usually operated by an ISP or other third-party provider, and it knows which other DNS servers it needs to ask to resolve the name of a site with its IP address. The servers that actually have the needed information are called authoritative DNS servers*.* - -### DNS servers and IP addresses - -Each domain can correspond to more than one IP address. In fact, some sites have hundreds or more IP addresses that correspond with a single domain name. For example, the server your computer reaches for [www.google.com][5] is likely completely different from the server that someone in another country would reach by typing the same site name into their browser. - -Another reason for the distributed nature of the directory is the amount of time it would take for you to get a response when you were looking for a site if there was only one location for the directory, shared among the millions, probably billions, of people also looking for information at the same time. That’s one long line to use the phone book. - -### What is DNS caching? - -To get around this problem, DNS information is shared among many servers. But information for sites visited recently is also cached locally on client computers. Chances are that you use google.com several times a day. Instead of your computer querying the DNS name server for the IP address of google.com every time, that information is saved on your computer so it doesn’t have to access a DNS server to resolve the name with its IP address. Additional caching can occur on the routers used to connect clients to the internet, as well as on the servers of the user’s Internet Service Provider (ISP). With so much caching going on, the number of queries that actually make it to DNS name servers is a lot lower than it would seem. - -### How do I find my DNS server? - -Generally speaking, the DNS server you use will be established automatically by your network provider when you connect to the internet. If you want to see which servers are your primary nameservers — generally the recursive resolver, as described above — there are web utilities that can provide a host of information about your current network connection. [Browserleaks.com][6] is a good one, and it provides a lot of information, including your current DNS servers. - -### Can I use 8.8.8.8 DNS? - -It's important to keep in mind, though, that while your ISP will set a default DNS server, you're under no obligation to use it. Some users may have reason to avoid their ISP's DNS — for instance, some ISPs use their DNS servers to redirect requests for nonexistent addresses to [pages with advertising][7]. - -If you want an alternative, you can instead point your computer to a public DNS server that will act as a recursive resolver. One of the most prominent public DNS servers is Google's; its IP address is 8.8.8.8. Google's DNS services tend to be [fast][8], and while there are certain questions about the [ulterior motives Google has for offering the free service][9], they can't really get any more information from you that they don't already get from Chrome. Google has a page with detailed instructions on how to [configure your computer or router][10] to connect to Google's DNS. - -### How DNS adds efficiency - -DNS is organized in a hierarchy that helps keep things running quickly and smoothly. To illustrate, let’s pretend that you wanted to visit networkworld.com. - -The initial request for the IP address is made to a recursive resolver, as discussed above. The recursive resolver knows which other DNS servers it needs to ask to resolve the name of a site (networkworld.com) with its IP address. This search leads to a root server, which knows all the information about top-level domains, such as .com, .net, .org and all of those country domains like .cn (China) and .uk (United Kingdom). Root servers are located all around the world, so the system usually directs you to the closest one geographically. - -Once the request reaches the correct root server, it goes to a top-level domain (TLD) name server, which stores the information for the second-level domain, the words used before you get to the .com, .org, .net (for example, that information for networkworld.com is “networkworld”). The request then goes to the Domain Name Server, which holds the information about the site and its IP address. Once the IP address is discovered, it is sent back to the client, which can now use it to visit the website. All of this takes mere milliseconds. - -Because DNS has been working for the past 30-plus years, most people take it for granted. Security also wasn’t considered when building the system, so [hackers have taken full advantage of this][11], creating a variety of attacks. - -### DNS reflection attacks - -DNS reflection attacks can swamp victims with high-volume messages from DNS resolver servers. Attackers request large DNS files from all the open DNS resolvers they can find and do so using the spoofed IP address of the victim. When the resolvers respond, the victim receives a flood of unrequested DNS data that overwhelms their machines. - -### DNS cache poisoning - -[DNS cache poisoning][12] can divert users to malicious Web sites. Attackers manage to insert false address records into the DNS so when a potential victim requests an address resolution for one of the poisoned sites, the DNS responds with the IP address for a different site, one controlled by the attacker. Once on these phony sites, victims may be tricked into giving up passwords or suffer malware downloads. - -### DNS resource exhaustion - -[DNS resource exhaustion][13] attacks can clog the DNS infrastructure of ISPs, blocking the ISP’s customers from reaching sites on the internet. This can be done by attackers registering a domain name and using the victim’s name server as the domain’s authoritative server. So if a recursive resolver can’t supply the IP address associated with the site name, it will ask the name server of the victim. Attackers generate large numbers of requests for their domain and toss in non-existent subdomains to boot, which leads to a torrent of resolution requests being fired at the victim’s name server, overwhelming it. - -### What is DNSSec? - -DNS Security Extensions is an effort to make communication among the various levels of servers involved in DNS lookups more secure. It was devised by the Internet Corporation for Assigned Names and Numbers (ICANN), the organization in charge of the DNS system. - -ICANN became aware of weaknesses in the communication between the DNS top-level, second-level and third-level directory servers that could allow attackers to hijack lookups. That would allow the attackers to respond to requests for lookups to legitimate sites with the IP address for malicious sites. These sites could upload malware to users or carry out phishing and pharming attacks. - -DNSSEC would address this by having each level of DNS server digitally sign its requests, which insures that the requests sent in by end users aren’t commandeered by attackers. This creates a chain of trust so that at each step in the lookup, the integrity of the request is validated. - -In addition, DNSSec can determine if domain names exist, and if one doesn’t, it won’t let that fraudulent domain be delivered to innocent requesters seeking to have a domain name resolved. - -As more domain names are created, and more devices continue to join the network via internet of things devices and other “smart” systems, and as [more sites migrate to IPv6][14], maintaining a healthy DNS ecosystem will be required. The growth of big data and analytics also [brings a greater need for DNS management][15]. - -### SIGRed: A wormable DNS flaw rears its head - -The world got a good look recently at the sort of chaos weaknesses in DNS could cause with the discovery of a flaw in Windows DNS servers. The potential security hole, dubbed SIGRed, [requires a complex attack chain][16], but can exploit unpatched Windows DNS servers to potentially install and execute arbitrary malicious code on clients. And the exploit is "wormable," meaning that it can spread from computer to computer without human intervention. The vulnerability was considered alarming enough that U.S. federal agencies were [given only a few days to install patches][17]. - -### DNS over HTTPS: A new privacy landscape - -As of this writing, DNS is on the verge of one of its biggest shifts in its history. Google and Mozilla, who together control the lion's share of the browser market, are encouraging a move towards [DNS over HTTPS][18], or DoH, in which DNS requests are encrypted by the same HTTPS protocol that already protects most web traffic. In Chrome's implementation, the browser checks to see if the DNS servers support DoH, and if they don't, it reroutes DNS requests to Google's 8.8.8.8. - -It's a move not without controversy. Paul Vixie, who did much of the early work on the DNS protocol back in the 1980s, calls the move a "[disaster][19]" for security: corporate IT will have a much harder time monitoring or directing DoH traffic that traverses their network, for instance. Still, Chrome is omnipresent and DoH will soon be turned on by default, so we'll see what the future holds. - -_(Keith Shaw is_ _a former senior editor for Network World and_ _an award-winning writer, editor and product reviewer who has written for many publications and websites around the world.)_ - -_(Josh Fruhlinger is a writer and editor who lives in Los Angeles.)_ - -Join the Network World communities on [Facebook][20] and [LinkedIn][21] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3268449/what-is-dns-and-how-does-it-work.html - -作者:[Keith Shaw and Josh Fruhlinger][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: -[b]: https://github.com/lujun9972 -[1]: https://www.networkworld.com/newsletters/signup.html -[2]: https://www.internethalloffame.org/blog/2012/07/23/why-does-net-still-work-christmas-paul-mockapetris -[3]: https://tools.ietf.org/html/rfc608 -[4]: http://www.verisign.com/en_US/domain-names/dnib/index.xhtml?section=cc-tlds -[5]: http://www.google.com -[6]: https://browserleaks.com/ip -[7]: https://www.networkworld.com/article/2246426/comcast-redirects-bad-urls-to-pages-with-advertising.html -[8]: https://www.networkworld.com/article/3194890/comparing-the-performance-of-popular-public-dns-providers.html -[9]: https://blog.dnsimple.com/2015/03/why-and-how-to-use-googles-public-dns/ -[10]: https://developers.google.com/speed/public-dns/docs/using -[11]: https://www.networkworld.com/article/2838356/network-security/dns-is-ubiquitous-and-its-easily-abused-to-halt-service-or-steal-data.html -[12]: https://www.networkworld.com/article/2277316/tech-primers/tech-primers-how-dns-cache-poisoning-works.html -[13]: https://www.cloudmark.com/releases/docs/whitepapers/dns-resource-exhaustion-v01.pdf -[14]: https://www.networkworld.com/article/3254575/lan-wan/what-is-ipv6-and-why-aren-t-we-there-yet.html -[15]: http://social.dnsmadeeasy.com/blog/opinion/future-big-data-dns-analytics/ -[16]: https://www.csoonline.com/article/3567188/wormable-dns-flaw-endangers-all-windows-servers.html -[17]: https://federalnewsnetwork.com/cybersecurity/2020/07/cisa-gives-agencies-a-day-to-remedy-windows-dns-server-vulnerability/ -[18]: https://www.networkworld.com/article/3322023/dns-over-https-seeks-to-make-internet-use-more-private.html -[19]: https://www.theregister.com/2018/10/23/paul_vixie_slaps_doh_as_dns_privacy_feature_becomes_a_standard/ -[20]: https://www.facebook.com/NetworkWorld/ -[21]: https://www.linkedin.com/company/network-world diff --git a/translated/tech/20200826 What is DNS and how does it work.md b/translated/tech/20200826 What is DNS and how does it work.md new file mode 100644 index 0000000000..a2eabb03e9 --- /dev/null +++ b/translated/tech/20200826 What is DNS and how does it work.md @@ -0,0 +1,135 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What is DNS and how does it work?) +[#]: via: (https://www.networkworld.com/article/3268449/what-is-dns-and-how-does-it-work.html) +[#]: author: (Keith Shaw, Josh Fruhlinger ) + +什么是 DNS,它是如何工作的? +====== + +> 域名系统解析互联网网站的名称及其底层 IP 地址,并在此过程中增加了效率和安全性。 + +![](https://images.techhive.com/images/article/2017/04/domain-name-systems-dns-100719737-large.jpg) + +域名系统Domain Name System(DNS)是互联网的基础之一,然而大多数不懂网络的人可能并不知道他们每天都在使用它来工作、查看电子邮件或在智能手机上浪费时间。 + +就其本质而言,DNS 是一个与数字匹配的名称目录。这些数字,在这种情况下是 IP 地址,计算机用 IP 地址来相互通信。大多数对 DNS 的描述都是用电话簿来比喻,这对于 30 岁以上的人来说是没有问题的,因为他们知道电话簿是什么。 + +如果你还不到 30 岁,可以把 DNS 想象成你的智能手机的联系人名单,它将人们的名字与他们的电话号码及电子邮件地址进行匹配,然后这个联系人名单的就像地球上的人一样多。 + +### DNS 简史 + +当互联网还非常、非常小的时候,人们很容易将特定的 IP 地址与特定的计算机对应起来,但随着越来越多的设备和人加入到不断发展的网络中,这种简单的情况就没法持续多久了。现在仍然可以在浏览器中输入一个特定的 IP 地址来到达一个网站,但当时和现在一样,人们希望得到一个由容易记忆的单词组成的地址,也就是我们今天所认识的那种域名(比如 linux.cn)。在 20 世纪 70 年代和 80 年代早期,这些名称和地址是由一个人指定的,她是[斯坦福大学的 Elizabeth Feinler][2],她在一个名为 [HOSTS.TXT][3] 的文本文件中维护着一个主列表,记录了每一台连接互联网的计算机。 + +随着互联网的发展,这种局面显然无法维持下去,尤其是因为 Feinler 只处理加州时间下午 6 点之前的请求,而且圣诞节也要请假。1983 年,南加州大学的研究人员 Paul Mockapetris 受命在处理这个问题的多种建议中提出一个折中方案。他基本上无视了所有提出的建议,并开发了自己的系统,他将其称为 DNS。虽然从那时起,现今的它显然发生了很大的变化,但在基本层面上,它的工作方式仍然与将近 40 年前相同。 + +### DNS 服务器是如何工作的 + +将名字与数字相匹配的 DNS 目录并不是整个藏在互联网的某个黑暗角落的一个地方。截至 2017 年底,[它记录了超过 3.32 亿个域名][4],如果作为一个目录确实会非常庞大。就像互联网本身一样,该目录分布在世界各地,存储在域名服务器(一般简称 DNS 服务器)上,这些服务器都会非常有规律地相互沟通,以提供更新和冗余。 + +### 权威 DNS 服务器与递归 DNS 服务器的比较 + +当你的计算机想要找到与域名相关联的 IP 地址时,它首先会向递归recursive DNS 服务器提出请求,也称为递归解析器。递归解析器是一个通常由 ISP 或其他第三方提供商运营的服务器,它知道需要向其他哪些 DNS 服务器请求解析一个网站的名称与其 IP 地址。实际拥有所需信息的服务器称为权威authoritative DNS 服务器。 + +### DNS 服务器和 IP 地址 + +每个域名可以对应一个以上的 IP 地址。事实上,有些网站有数百个或更多的 IP 地址与一个域名相对应。例如,你的计算机访问 [www.google.com][5] 所到达的服务器,很可能与其他国家的人在浏览器中输入相同的网站名称所到达的服务器完全不同。 + +该目录的分布式性质的另一个原因是,如果这个目录只有一个位置,在数百万,可能是数十亿同样在同一时间寻找信息的人中共享,那么当你在寻找一个网站时,你需要花费多少时间才能得到响应 —— 这就像是排着长队使用电话簿一样。 + +### 什么是 DNS 缓存? + +为了解决这个问题,DNS 信息在许多服务器之间共享。但最近访问过的网站的信息也会在客户端计算机上本地缓存。你有可能每天使用 google.com 好几次。你的计算机不是每次都向 DNS 名称服务器查询 google.com 的 IP 地址,而是将这些信息保存在你的计算机上,这样它就不必访问 DNS 服务器来解析这个带有 IP 地址的名称。额外的缓存可能出现在用于将客户端连接到互联网的路由器上,以及用户的互联网服务提供商(ISP)的服务器上。有了这么多的缓存,实际上对 DNS 名称服务器的查询数量比看起来要少很多。 + +### 如何找到我的 DNS 服务器? + +一般来说,当你连接到互联网时,你使用的 DNS 服务器将由你的网络提供商自动建立。如果你想看看哪些服务器是你的主要名称服务器(一般是递归解析器,如上所述),有一些网络实用程序可以提供关于你当前网络连接的信息。[Browserleaks.com][6] 是一个很好的工具,它提供了很多信息,包括你当前的 DNS 服务器。 + +### 我可以使用 8.8.8.8 的 DNS 吗? + +但要记住,虽然你的 ISP 会设置一个默认的 DNS 服务器,但你没有义务使用它。有些用户可能有理由避开他们 ISP 的 DNS —— 例如,有些 ISP 使用他们的 DNS 服务器将不存在的地址的请求重定向到[带有广告的网页][7]。 + +如果你想要一个替代方案,你可以将你的计算机指向一个公共 DNS 服务器,以它作为一个递归解析器。最著名的公共 DNS 服务器之一是谷歌的,它的 IP 地址是 8.8.8.8 和 8.8.4.4。Google 的 DNS 服务往往是[快速的][8],虽然对 [Google 提供免费服务的别有用心的动机][9]有一定的质疑,但他们无法真正从你那里获得比他们从 Chrome 中获得的更多信息。Google 有一个页面,详细说明了如何[配置你的电脑或路由器][10]连接到 Google 的 DNS。 + +### DNS 如何提高效率 + +DNS 的组织结构有助于保持事情的快速和顺利运行。为了说明这一点,让我们假设你想访问 linux.cn。 + +如上所述,对 IP 地址的初始请求是向递归解析器提出的。递归解析器知道它需要请求哪些其他 DNS 服务器来解析一个网站(linux.cn)的名称与其 IP 地址。这种搜索会传递至根服务器,它知道所有顶级域名的信息,如 .com、.net、.org 以及所有国家域名,如 .cn(中国)和 .uk(英国)。根服务器位于世界各地,所以系统通常会将你引导到地理上最近的一个服务器。 + +一旦请求到达正确的根服务器,它就会进入一个顶级域名(TLD)名称服务器,该服务器存储二级域名的信息,即在你到达 .com、.org、.net 之前所使用的单词(例如,linux.cn 的信息是 “linux”)。然后,请求进入域名服务器,域名服务器掌握着网站的信息和 IP 地址。一旦 IP 地址被发现,它就会被发回给客户端,客户端现在可以用它来访问网站。所有这一切都只需要几毫秒的时间。 + +因为 DNS 在过去的 30 多年里一直在工作,所以大多数人都认为它是理所当然的。在构建系统的时候也没有考虑到安全问题,所以[黑客们充分利用了这一点][11],制造了各种各样的攻击。 + +### DNS 反射攻击 + +DNS 反射攻击可以用 DNS 解析器服务器的大量信息淹没受害者。攻击者使用受害者的欺骗 IP 地址来向他们能找到的所有开放的 DNS 解析器请求大量的 DNS 数据。当解析器响应时,受害者会收到大量未请求的 DNS 数据,使其机器不堪重负。 + +### DNS 缓存投毒 + +[DNS 缓存投毒][12]可将用户转移到恶意网站。攻击者设法在 DNS 中插入虚假的地址记录,这样,当潜在的受害者请求解析其中一个中毒网站的地址时,DNS 就会以另一个由攻击者控制的网站的 IP 地址作出回应。一旦访问了这些假网站,受害者可能会被欺骗,泄露密码或下载了恶意软件。 + +### DNS 资源耗尽 + +[DNS 资源耗尽][13]攻击可以堵塞 ISP 的 DNS 基础设施,阻止 ISP 的客户访问互联网上的网站。攻击者注册一个域名,并通过将受害者的名称服务器作为域名的权威服务器来实现。因此,如果递归解析器不能提供与网站名称相关的 IP 地址,就会询问受害者的名称服务器。攻击者会对自己注册的域名产生大量的请求,并查询不存在的子域名,这就会导致大量的解析请求发送到受害者的名称服务器,使其不堪重负。 + +### 什么是 DNSSec? + +DNS 安全扩展是为了使参与 DNS 查询的各级服务器之间的通信更加安全。它是由负责 DNS 系统的互联网名称与数字地址分配机构Internet Corporation for Assigned Names and Numbers(ICANN)设计的。 + +ICANN 意识到 DNS 顶级、二级和三级目录服务器之间的通信存在弱点,可能会让攻击者劫持查询。这将允许攻击者用恶意网站的 IP 地址来响应合法网站的查询请求。这些网站可能会向用户上传恶意软件,或者进行网络钓鱼和网络欺骗攻击。 + +DNSSec 将通过让每一级 DNS 服务器对其请求进行数字签名来解决这个问题,这就保证了终端用户发送进来的请求不会被攻击者利用。这就建立了一个信任链,这样在查询的每一步,请求的完整性都会得到验证。 + +此外,DNSSec 可以确定域名是否存在,如果不存在,它就不会让该欺诈性域名交付给寻求域名解析的无辜请求者。 + +随着越来越多的域名被创建,越来越多的设备继续通过物联网设备和其他“智能”系统加入网络,随着[更多的网站迁移到 IPv6][14],将需要维持一个健康的 DNS 生态系统。大数据和分析的增长也[带来了对 DNS 管理的更大需求][15]。 + +### SIGRed: 蠕虫病毒 DNS 漏洞再次出现 + +最近,随着 Windows DNS 服务器缺陷的发现,全世界都看到了 DNS 中的弱点可能造成的混乱。这个潜在的安全漏洞被称为 SIGRed,[它需要一个复杂的攻击链][16],但利用未打补丁的 Windows DNS 服务器,有可能在客户端安装和执行任意恶意代码。而且该漏洞是“可蠕虫”的,这意味着它可以在没有人为干预的情况下从计算机传播到计算机。该漏洞被认为足够令人震惊,以至于美国联邦机构[被要求在几天时间内安装补丁][17]。 + +### DNS over HTTPS:新的隐私格局 + +截至本报告撰写之时,DNS 正处于其历史上最大的一次转变的边缘。谷歌和 Mozilla 共同控制着浏览器市场的大部分份额,他们正在鼓励向 [DNS over HTTPS][18](DoH)的方向发展,在这种情况下,DNS 请求将被已经保护了大多数 Web 流量的 HTTPS 协议加密。在 Chrome 的实现中,浏览器会检查 DNS 服务器是否支持 DoH,如果不支持,则会将 DNS 请求重新路由到谷歌的 8.8.8.8。 + +这是一个并非没有争议的举动。早在上世纪 80 年代就在 DNS 协议上做了大量早期工作的 Paul Vixie 称此举对安全来说是“[灾难][19]”:例如,企业 IT 部门将更难监控或引导穿越其网络的 DoH 流量。不过,Chrome 浏览器是无所不在的,DoH 不久就会被默认打开,所以我们会看到未来会发生什么。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3268449/what-is-dns-and-how-does-it-work.html + +作者:[Keith Shaw][a], [Josh Fruhlinger][c] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Keith-Shaw/ +[c]: https://www.networkworld.com/author/Josh-Fruhlinger/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.internethalloffame.org/blog/2012/07/23/why-does-net-still-work-christmas-paul-mockapetris +[3]: https://tools.ietf.org/html/rfc608 +[4]: http://www.verisign.com/en_US/domain-names/dnib/index.xhtml?section=cc-tlds +[5]: http://www.google.com +[6]: https://browserleaks.com/ip +[7]: https://www.networkworld.com/article/2246426/comcast-redirects-bad-urls-to-pages-with-advertising.html +[8]: https://www.networkworld.com/article/3194890/comparing-the-performance-of-popular-public-dns-providers.html +[9]: https://blog.dnsimple.com/2015/03/why-and-how-to-use-googles-public-dns/ +[10]: https://developers.google.com/speed/public-dns/docs/using +[11]: https://www.networkworld.com/article/2838356/network-security/dns-is-ubiquitous-and-its-easily-abused-to-halt-service-or-steal-data.html +[12]: https://www.networkworld.com/article/2277316/tech-primers/tech-primers-how-dns-cache-poisoning-works.html +[13]: https://www.cloudmark.com/releases/docs/whitepapers/dns-resource-exhaustion-v01.pdf +[14]: https://www.networkworld.com/article/3254575/lan-wan/what-is-ipv6-and-why-aren-t-we-there-yet.html +[15]: http://social.dnsmadeeasy.com/blog/opinion/future-big-data-dns-analytics/ +[16]: https://www.csoonline.com/article/3567188/wormable-dns-flaw-endangers-all-windows-servers.html +[17]: https://federalnewsnetwork.com/cybersecurity/2020/07/cisa-gives-agencies-a-day-to-remedy-windows-dns-server-vulnerability/ +[18]: https://www.networkworld.com/article/3322023/dns-over-https-seeks-to-make-internet-use-more-private.html +[19]: https://www.theregister.com/2018/10/23/paul_vixie_slaps_doh_as_dns_privacy_feature_becomes_a_standard/ +[20]: https://www.facebook.com/NetworkWorld/ +[21]: https://www.linkedin.com/company/network-world From 8158573126467e2894c4183af6f50dfa668f0629 Mon Sep 17 00:00:00 2001 From: SilentDawn Date: Sat, 5 Sep 2020 23:30:34 +0800 Subject: [PATCH 0013/1156] Update 20190105 Why Sorting is O(N log N).md --- .../20190105 Why Sorting is O(N log N).md | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/sources/talk/20190105 Why Sorting is O(N log N).md b/sources/talk/20190105 Why Sorting is O(N log N).md index 68a40384c8..73bf9d0d55 100644 --- a/sources/talk/20190105 Why Sorting is O(N log N).md +++ b/sources/talk/20190105 Why Sorting is O(N log N).md @@ -7,56 +7,56 @@ [#]: via: (https://theartofmachinery.com/2019/01/05/sorting_is_nlogn.html) [#]: author: (Simon Arneaud https://theartofmachinery.com) -Why Sorting is O(N log N) +为什么排序的复杂度为 O(N log N) ====== -Any decent algorithms textbook will explain how fast sorting algorithms like quicksort and heapsort are, but it doesn’t take crazy maths to prove that they’re as asymptotically fast as you can possibly get. +基本上所有正而八经的算法教材都会解释什么是快速排序算法,比如 quicksort 和堆排序,但又都基本上不会动用复杂的数学来证明这些算法只能趋近你所能达到的速度。 -### A pedantic note about notation +### 关于标记的说明 -Most computer scientists use big-O notation to mean “asymptotically equal, up to a constant scaling factor”, which isn’t quite what it means to other mathematicians. Sorry, I’ll use big-O like in CS textbooks, but at least I won’t mix it with other mathematical notation. +大多数计算机专业的科学家使用大写字母 O 标记来指代“趋近与乘以一个常数比例因子”,这与数学专业所指代的意义是有所区别的。这里我使用的大 O 标记的含义与计算机教材所指相同,且不会混杂使用数学专业所指含义。 -## Comparison-based sorting +## 基于比较的排序 -Let’s look at the special case of algorithms that compare values two at a time (like quicksort and heapsort, and most other popular algorithms). The ideas can be extended to all sorting algorithms later. +先来看个特例,即每次比较两个值大小的算法(quicksort、堆排序及其它通用排序算法基本上都是这样的)。这种思想后续可以扩展至所有排序算法。 ### A simple counting argument for the worst case -Suppose you have an array of four elements, all different, in random order. Can you sort it by comparing just one pair of elements? Obviously not, but here’s one good reason that proves you can’t: By definition, to sort the array, you need to how to rearrange the elements to put them in order. In other words, you need to know which permutation is needed. How many possible permutations are there? The first element could be moved to one of four places, the second one could go to one of the remaining three, the third element has two options, and the last element has to take the one remaining place. So there are (4 \times 3 \times 2 \times 1 = 4! = 24) possible permutations to choose from, but there are only two possible results from comparing two different things: “BIGGER” and “SMALLER”. If you made a list of all the possible permutations, you might decide that “BIGGER” means you need permutation #8 and “SMALLER” means you need permutation #24, but there’s no way you could know when you need the other 22 permutations. +假设有 4 个互不相等的数,且顺序随机,那么,可以通过比较一对数字完成排序吗?显然不能,证明如下:根据定义,对该数组排序,需要按照某种顺序重新排列数字。那么究竟有多少种可能的排列呢?第一个数字可以放在四个位置中的任意一个,第二个数字可以放在剩下三个位置中的任意一个,第三个数字可以放在剩下两个位置中的任意一个,最后一个数字只有剩下的一个位置可选。这样,共有 4×3×2×1 = 4! = 24 种排列可供选择。通过一次比较大小,只能产生两种可能的结果。如果列出所有的排列,那么“从小到大”排序对应的可能是第 8 种排列,按“从大到小”排序对应的可能是第 22 种排列,但无法知道什么时候需要的是其它 22 种排列。 -With two comparisons, you have (2 \times 2 = 4) possible outputs, which still isn’t enough. You can’t sort every possible shuffled array unless you do at least five comparisons ((2^{5} = 32)). If (W(N)) is the worst-case number of comparisons needed to sort (N) different elements using some algorithm, we can say +通过 2 次比较,可以得到 2×2=4 种可能的结果,这仍然不够。只要比较的次数少于 5(对应 (2^{5} = 32) 种输出),就无法完成 4 个随机次序的数字的排序。如果 (W(N)) 是最差情况下对 (N) 个不同元素进行排序所需要的比较次数,那么 [2^{W(N)} \geq N!] -Taking a logarithm base 2, +两边取以 2 为底的对数,得 [W(N) \geq \log_{2}{N!}] -Asymptotically, (N!) grows like (N^{N}) (see also [Stirling’s formula][1]), so +(N!) 的增长近似于 (N^{N}) (参阅 [Stirling 公式][1]),那么 [W(N) \succeq \log N^{N} = N\log N] -And that’s an (O(N\log N)) limit on the worst case just from counting outputs. +这就是最差情况下从输出计数的角度得出的 (O(N\log N)) 上限。 -### Average case from information theory +### 信息论角度平均状态的例子 -We can get a stronger result if we extend that counting argument with a little information theory. Here’s how we could use a sorting algorithm as a code for transmitting information: +使用一些信息论知识,就可以从上面的讨论中得到一个更有力的结论。下面,使用排序算法作为信息传输的编码器: - 1. I think of a number — say, 15 - 2. I look up permutation #15 from the list of permutations of four elements - 3. I run the sorting algorithm on this permutation and record all the “BIGGER” and “SMALLER” comparison results - 4. I transmit the comparison results to you in binary code - 5. You re-enact my sorting algorithm run, step by step, referring to my list of comparison results as needed - 6. Now that you know how I rearranged my array to make it sorted, you can reverse the permutation to figure out my original array - 7. You look up my original array in the permutation list to figure out I transmitted the number 15 + 1. 任取一个数,比如 15 + 2. 从 4 个数字的排列列表中查找第 15 种排列 + 3. 对这种排列运行排序算法,记录所有的“大”、“小”比较结果 + 4. 用二进制编码发送比较结果 + 5. 接收端重新逐步执行发送端的排序算法,需要的话可以引用发送端的比较结果 + 6. 现在接收端就可以知道发送端如何重新排列数字以按照需要排序,接收端可以对排列进行逆算,得到 4 个数字的初始顺序 + 7. 接收端在排列表中检索发送端的原始排列,指出发送端发送的是 15 -Okay, it’s a bit strange, but it could be done. That means that sorting algorithms are bound by the same laws as normal encoding schemes, including the theorem proving there’s no universal data compressor. I transmitted one bit per comparison the algorithm does, so, on average, the number of comparisons must be at least the number of bits needed to represent my data, according to information theory. More technically, [the average number of comparisons must be at least the Shannon entropy of my input data, measured in bits][2]. Entropy is a mathematical measure of the information content, or unpredictability, of something. +确实,这有点奇怪,但确实可以。这意味着排序算法遵循着与编码方案相同的定律,包括理论所证明的通用数据压缩算法的不存在。算法中每次比较发送 1 bit 的比较结果编码数据,根据信息论,比较的次数至少是能表示所有数据的二进制位数。更技术语言点,[平均所需的最小比较次数是输入数据的香农熵以二进制的位数][2]。熵是信息等不可预测量的数学度量。 -If I have an array of (N) elements that could be in any possible order without bias, then entropy is maximised and is (\log_{2}{N!}) bits. That proves that (O(N\log N)) is an optimal average for a comparison-based sort with arbitrary input. +包含 (N) 个元素的数组,元素次序随机且无偏时的熵最大,其值为 (\log_{2}{N!}) 二进制位。这证明 (O(N\log N)) 是基于比较的排序对任意输入所需的比较次数。 -That’s the theory, but how do real sorting algorithms compare? Below is a plot of the average number of comparisons needed to sort an array. I’ve compared the theoretical optimum against naïve quicksort and the [Ford-Johnson merge-insertion sort][3], which was designed to minimise comparisons (though it’s rarely faster than quicksort overall because there’s more to life than minimising comparisons). Since it was developed in 1959, merge-insertion sort has been tweaked to squeeze a few more comparisons out, but the plot shows it’s already almost optimal. +以上都是理论说法,那么实际的排序算法如何做比较的哪? Below is a plot of the average number of comparisons needed to sort an array. I’ve compared the theoretical optimum against naïve quicksort and the [Ford-Johnson merge-insertion sort][3], which was designed to minimise comparisons (though it’s rarely faster than quicksort overall because there’s more to life than minimising comparisons). Since it was developed in 1959, merge-insertion sort has been tweaked to squeeze a few more comparisons out, but the plot shows it’s already almost optimal. ![Plot of average number of comparisons needed to sort randomly shuffled arrays of length up to 100. Bottom line is theoretical optimum. Within about 1% is merge-insertion sort. Naïve quicksort is within about 25% of optimum.][4] From 59ac5e33663d7b632553a955d9a11a8db57e5dfb Mon Sep 17 00:00:00 2001 From: SilentDawn Date: Sun, 6 Sep 2020 00:56:04 +0800 Subject: [PATCH 0014/1156] Update 20190105 Why Sorting is O(N log N).md --- .../20190105 Why Sorting is O(N log N).md | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/sources/talk/20190105 Why Sorting is O(N log N).md b/sources/talk/20190105 Why Sorting is O(N log N).md index 73bf9d0d55..3b5510b625 100644 --- a/sources/talk/20190105 Why Sorting is O(N log N).md +++ b/sources/talk/20190105 Why Sorting is O(N log N).md @@ -56,43 +56,43 @@ 包含 (N) 个元素的数组,元素次序随机且无偏时的熵最大,其值为 (\log_{2}{N!}) 二进制位。这证明 (O(N\log N)) 是基于比较的排序对任意输入所需的比较次数。 -以上都是理论说法,那么实际的排序算法如何做比较的哪? Below is a plot of the average number of comparisons needed to sort an array. I’ve compared the theoretical optimum against naïve quicksort and the [Ford-Johnson merge-insertion sort][3], which was designed to minimise comparisons (though it’s rarely faster than quicksort overall because there’s more to life than minimising comparisons). Since it was developed in 1959, merge-insertion sort has been tweaked to squeeze a few more comparisons out, but the plot shows it’s already almost optimal. +以上都是理论说法,那么实际的排序算法如何做比较的呢?下面是一个数组排序所需比较次数均值的图。我比较的是理论值与 quicksort 及 [Ford-Johnson 合并插入排序][3] 的表现。后者设计目的就是最小化比较次数(整体上没比 quicksort 快多少,因为生命中相对于最小化比较,还有更多其它的事情)。又因为合并插入排序是在 1959 年提出的,它又减少了一些比较次数,但图示说明,它基本上达到了最优状态。 -![Plot of average number of comparisons needed to sort randomly shuffled arrays of length up to 100. Bottom line is theoretical optimum. Within about 1% is merge-insertion sort. Naïve quicksort is within about 25% of optimum.][4] +![随机排列 100 个元素所需的平均排序次数图。最下面的线是理论值,约 1% 处的是合并插入算法,原始 quicksort 大约在 25% 处。][4] -It’s nice when a little theory gives such a tight practical result. +一点点理论导出这么实用的结论,这感觉真棒! -### Summary so far +### 小结 -Here’s what’s been proven so far: +证明了: - 1. If the array could start in any order, at least (O(N\log N)) comparisons are needed in the worst case - 2. The average number of comparisons must be at least the entropy of the array, which is (O(N\log N)) for random input + 1. 如果数组可以是任意顺序,在最坏情况下至少需要 (O(N\log N)) 次比较。 + 2. 数组的平均比较次数最少是数组的熵,对随机输入而言,其值是 (O(N\log N)) 。 -Note that #2 allows comparison-based sorting algorithms to be faster than (O(N\log N)) if the input is low entropy (in other words, more predictable). Merge sort is close to (O(N)) if the input contains many sorted subarrays. Insertion sort is close to (O(N)) if the input is an array that was sorted before being perturbed a bit. None of them beat (O(N\log N)) in the worst case unless some array orderings are impossible as inputs. +注意,第 2 个结论允许基于比较的算法优于 (O(N\log N)),前提是输入是低熵的(换言之,是部分可预测的)。如果输入包含很多有序的子序列,那么合并排序的性能接近 (O(N))。如果在确定一个位之前,其输入是有序的,插入排序性能接近 (O(N))。在最差情况下,以上算法的性能表现都不超出 (O(N\log N))。 -## General sorting algorithms +## 一般排序算法 -Comparison-based sorts are an interesting special case in practice, but there’s nothing theoretically special about [`CMP`][5] as opposed to any other instruction on a computer. Both arguments above can be generalised to any sorting algorithm if you note a couple of things: +基于比较的排序在实践中是个有趣的特例,但计算机的 [`CMP`][5] 指令与其它指令相比,并没有任何理论上的区别。在下面两条的基础上,前面两种情形都可以扩展至任意排序算法: - 1. Most computer instructions have more than two possible outputs, but still have a limited number - 2. The limited number of outputs means that one instruction can only process a limited amount of entropy + 1. 大多数计算机指令有多于两个的输出,但输出的数量仍然是有限的。 + 2. 一条指令有限的输出意味着一条指令只能处理有限的熵。 -That gives us the same (O(N\log N)) lower bound on the number of instructions. Any physically realisable computer can only process a limited number of instructions at a time, so that’s an (O(N\log N)) lower bound on the time required, as well. +这给出了 (O(N\log N)) 对应的指令下限。任何物理可实现的计算机都只能在给定时间内执行有限数量的指令,所以算法的执行时间也有对应 (O(N\log N)) 的下限。 -### But what about “faster” algorithms? +### 什么是更快的算法? -The most useful practical implication of the general (O(N\log N)) bound is that if you hear about any asymptotically faster algorithm, you know it must be “cheating” somehow. There must be some catch that means it isn’t a general purpose sorting algorithm that scales to arbitrarily large arrays. It might still be a useful algorithm, but it’s a good idea to read the fine print closely. +一般意义上的 (O(N\log N)) 下限,放在实践中来看,如果听人说到任何更快的算法,你要知道,它肯定以某种方式“作弊”了,其中肯定有圈套,即它不是一个可以处理任意大数组的通用排序算法。可能它是一个有用的算法,但最好看明白它字里行间隐含的东西。 -A well-known example is radix sort. It’s often called an (O(N)) sorting algorithm, but the catch is that it only works if all the numbers fit into (k) bits, and it’s really (O({kN})). +一个广为人知的例子是基数排序算法 radix sort,它经常被称为 (O(N)) 排序算法,但它只能处理所有数字都是 (k) 位的情况,所以实际上它的性能是 (O({kN}))。 -What does that mean in practice? Suppose you have an 8-bit machine. You can represent (2^{8} = 256) different numbers in 8 bits, so if you have an array of thousands of numbers, you’re going to have duplicates. That might be okay for some applications, but for others you need to upgrade to at least 16 bits, which can represent (2^{16} = 65,536) numbers distinctly. 32 bits will support (2^{32} = 4,294,967,296) different numbers. As the size of the array goes up, the number of bits needed will tend to go up, too. To represent (N) different numbers distinctly, you’ll need (k \geq \log_{2}N). So, unless you’re okay with lots of duplicates in your array, (O({kN})) is effectively (O(N\log N)). +什么意思呢?假如你用的 8 位计算机,那么 8 个二进制位可以表示 (2^{8} = 256) 个不同的数字,如果数组有上千个数字,那么其中必有重复。对有些应用而言这是可以的,但对有些应用就必须用 16 个二进制位来表示,16 个二进制位可以表示 (2^{16} = 65,536) 个不同的数字。32 个二进制位可以表示 (2^{32} = 4,294,967,296) 不同的数字。随着数组长度的增长,所需要的二进制位数也在增长。要表示 (N) 个不同的数字,需要 (k \geq \log_{2}N) 个二进制位。所以,只有允许数组中存在重复的数字时,(O({kN})) 才优于 (O(N\log N))。 -The need for (O(N\log N)) of input data in the general case actually proves the overall result by itself. That argument isn’t so interesting in practice because we rarely need to sort billions of integers on a 32-bit machine, and [if anyone’s hit the limits of a 64-bit machine, they haven’t told the rest of us][6]. +一般意义上输入数据的 (O(N\log N)) 的性能已经说明了全部问题。这个讨论不那么有趣因为很少需要在 32 位计算机上对几十亿整数进行排序,[如果有谁的需求超出了 64 位计算机的极限,他一定没有说出他的全部][6]。 -------------------------------------------------------------------------------- @@ -100,7 +100,7 @@ via: https://theartofmachinery.com/2019/01/05/sorting_is_nlogn.html 作者:[Simon Arneaud][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[silentdawn-zz](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 627c984ba2db1f0d81f928b12349cdac9621b2bc Mon Sep 17 00:00:00 2001 From: SilentDawn Date: Sun, 6 Sep 2020 00:57:26 +0800 Subject: [PATCH 0015/1156] Rename sources/talk/20190105 Why Sorting is O(N log N).md to translated/talk/20190105 Why Sorting is O(N log N).md --- .../talk/20190105 Why Sorting is O(N log N).md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/talk/20190105 Why Sorting is O(N log N).md (100%) diff --git a/sources/talk/20190105 Why Sorting is O(N log N).md b/translated/talk/20190105 Why Sorting is O(N log N).md similarity index 100% rename from sources/talk/20190105 Why Sorting is O(N log N).md rename to translated/talk/20190105 Why Sorting is O(N log N).md From 370dcf81d8671a5f1e61bbf0bacd273bb3149262 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 6 Sep 2020 05:01:34 +0800 Subject: [PATCH 0016/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200906?= =?UTF-8?q?=20PCLinuxOS=20Review:=20This=20Classic=20Independent=20Linux?= =?UTF-8?q?=20Distribution=20is=20Definitely=20Worth=20a=20Look?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200906 PCLinuxOS Review- This Classic Independent Linux Distribution is Definitely Worth a Look.md --- ...Distribution is Definitely Worth a Look.md | 144 ++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 sources/tech/20200906 PCLinuxOS Review- This Classic Independent Linux Distribution is Definitely Worth a Look.md diff --git a/sources/tech/20200906 PCLinuxOS Review- This Classic Independent Linux Distribution is Definitely Worth a Look.md b/sources/tech/20200906 PCLinuxOS Review- This Classic Independent Linux Distribution is Definitely Worth a Look.md new file mode 100644 index 0000000000..0b5d0637a7 --- /dev/null +++ b/sources/tech/20200906 PCLinuxOS Review- This Classic Independent Linux Distribution is Definitely Worth a Look.md @@ -0,0 +1,144 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (PCLinuxOS Review: This Classic Independent Linux Distribution is Definitely Worth a Look) +[#]: via: (https://itsfoss.com/pclinuxos-review/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +PCLinuxOS Review: This Classic Independent Linux Distribution is Definitely Worth a Look +====== + +Most of the Linux distributions that we cover on It’s FOSS are based on either Ubuntu or Arch. + +No, we don’t have any affinity for either Ubuntu or Arch though personally, [I love using Manjaro][1]. It’s just that majority of new Linux distributions are based on these two. + +While discussing within the team, we thought, why fixate over new distributions. Why not go for the classic distributions? Distributions that don’t belong to DEB/Arch domain. + +So, today, we are going to be looking at an independent distro that tends to go against the flow. We’ll be looking at PCLinuxOS. + +### What is PCLinuxOS? + +![][2] + +Back in 2000, Bill Reynolds (also known as Texstar) created a series of packages to improve Mandrake Linux, which later became [Mandriva Linux][3]. [PCLinuxOS][4] first became a separate distro in 2003 when Texstar forked Mandrake. He [said][5] that he made the move because he wanted “to provide an outlet for my crazy desire to package source code without having to deal with egos, arrogance and politics”. + +As I said earlier, PCLinuxOS does not follow the rest of the Linux world. PCLinuxOS does not use systemd. Instead, it uses SysV init and “[will continue to do so for the foreseeable future][6]“. + +It also has one of the oddest package management systems, I have ever encountered. PCLinuxOS uses apt and [synaptic][7] to handle RPM packages. Unlike most distros that use either apt or rpm, PCLinuxOS is a rolling distro. It also supports [Flatpak][8]. + +The PCLinuxOS team offers [three different versions][9]: **KDE**, **MATE**, and **XFCE**. The PCLinuxOS community has also created a number of [community][10] [releases][11] with more desktop options. + +![PCLinuxOS Updater][12] + +### System requirements for PCLinuxOS + +According to the [PCLinuxOS wiki][13], the following hardware is recommended to run PCLinuxOS: + + * Modern Intel or AMD processor. + * 10 GB or more free space recommended. + * Minimum 2 GB of memory. – Recommended 4 GB or more. + * Any modern video card by Nvidia, ATI, Intel, SiS, Matrox, or VIA. + * 3D desktop support requires a 3D instructions set compatible card. + * Any Sound Blaster, AC97, or HDA compatible card. + * A CD or DVD drive. + * Flash drives can also be used to install, with PCLinuxOS-LiveUSB script just for this purpose. + * Generally any onboard network card will suffice. + * A high-speed internet connection is recommended for performing any updates/software installations as necessary. + + + +### Experience with PCLinuxOS + +I originally encountered PCLinuxOS when I was first entering the Linux world about 7+ years ago. Back then I was trying out distros like crazy. At the time, I didn’t quite understand it and ended up going with Lubuntu. + +Recently, I was reminded of the distro when [Matt Hartley][14], community manager at [OpenShot][15] mentioned it on the [Bryan Lunduke podcast][16]. PCLinuxOS is Hartley’s daily driver and has been for a while. Based on his comments, I decided to take another look at it. + +#### Smooth installation + +![PCLinuxOS installer][17] + +The majority of Linux distros use one of three installers, [Ubiquity][18], [Anaconda][19], or [Calamares][20]. PCLinuxOS is one of the few that has its own installer, which it inherited from Mandrake. The installation went quickly and without any issue. + +After the installation, I booted into the MATE [desktop environment][21] (because I had to). A dialog box asked me if I wanted to enable the update notifier. It’s always best to be up-to-date, so I did. + +#### Handy set of utilities + +Besides the usual list of utilities, office programs, and web tools, PCLinuxOS has a couple of interesting additions. Both Zoom (a videoconferencing tool) and AnyDesk (a remote desktop application) come pre-installed for your remote working needs. The menu also includes an option to install VirtualBox GuestAdditions (in case you installed PCLinuxOS on VirtualBox). + +![PCLinuxOS Control Center][22] + +PCLinuxOS comes with a control center to handle all of your system admin needs. It covers installing software, file sharing, handles network connections, handles hardware issues, and security. + +#### Create your own custom PCLinuxOS live disk + +It also comes with a couple of apps that allow you to download a new PCLinuxOS ISO, write that ISO to a disc or USB, or create [your own LiveCD][23] based on your current system. + +![It is easy to create your own custom PCLinuxOS ISO][24] + +#### No sudo in PCLinuxOS + +Interestingly, PCLinuxOS doesn’t have `sudo` installed. According to the [FAQ][6], “Some distros…leaving sudo in a default state where all administrator functions are allowed without the requirement to enter the root password. We consider this an unacceptable security risk.” Whenever you perform a task that requires admin privileges, a window appears asking for your password. + +#### Strong community + +One of the cool things about PCLinuxOS is its strong community. That community creates a monthly [e-magazine][25]. Each issue contains news, tutorials, puzzles, and even recipes. The only other distro (or family of distros) that has sustained a community publication for over 15 years is Ubuntu with the [Full Circle Magazine][26]. Be sure to check it out. + +#### No hardware issues noticed (for my system) + +This is one of the last distros I will review on my Dell Latitude D630. (I’m moving up to a newer Thinkpad.) One of the major problems I’ve had in the past was getting the Nvidia GPU to work correctly. I didn’t have any issues with PCLinuxOS. It just worked out of the box. + +### Final Thoughts + +![PCLinuxOS Desktop][27] + +PCLinuxOS also provides an easy way to remaster the system after installation. It allows you to create a live disk of PCLinuxOS with your customization. I + +PCLinuxOS feels like part of the past and part of the present. It reflects the pre-systemd days and offers a modern desktop and apps at the same time. The only thing I would complain about is that there are fewer applications available in the repos than more popular distros, but the availability of Flatpak and AppImages should fix that. + +PCLinuxOS’ tag line is: “_**So cool ice cubes are jealous**_“. It might sound corny, but I think it’s true, especially if you aren’t a fan of the direction the rest of the Linux world has taken. If you find something lacking in the big Linux distros, check out this old-little distro with a great community. + +Have you ever used PCLinuxOS? What is your favorite independent distro? Please let us know in the comments below. If you found this article interesting, please take a minute to share it on social media, Hacker News or [Reddit][28]. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/pclinuxos-review/ + +作者:[John Paul][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/john/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/why-use-manjaro-linux/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/PCLinuxOS-review.png?resize=800%2C450&ssl=1 +[3]: https://en.wikipedia.org/wiki/Mandriva_Linux +[4]: https://www.pclinuxos.com/ +[5]: http://linux-blog.org/Experiment-Interview-with-Texstar-of-PCLinuxOS/ +[6]: https://pclinuxoshelp.com/index.php/Frequently_Asked_Questions +[7]: https://itsfoss.com/synaptic-package-manager/ +[8]: https://pclinuxoshelp.com/index.php/Installing_Software#Using_Flatpak +[9]: https://www.pclinuxos.com/?page_id=10 +[10]: https://ftp.nluug.nl/pub/os/Linux/distr/pclinuxos/pclinuxos/live-cd/community/ +[11]: https://pclosusers.com/communityiso/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/PCLinuxOS-updater.jpg?resize=800%2C487&ssl=1 +[13]: https://pclinuxoshelp.com/index.php/Hardware_Recommendations +[14]: https://twitter.com/matthartley +[15]: https://www.openshot.org/ +[16]: http://www.lunduke.com/ +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/PCLinuxOS-installer.jpg?resize=800%2C500&ssl=1 +[18]: http://launchpad.net/ubiquity +[19]: https://fedoraproject.org/wiki/Anaconda +[20]: https://calamares.io/ +[21]: https://itsfoss.com/what-is-desktop-environment/ +[22]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/PCLinuxOS-Control-Center.jpg?resize=800%2C585&ssl=1 +[23]: https://pclinuxoshelp.com/index.php/LiveCD,_Create_your_own +[24]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/PCLinuxOS-downloader.jpg?resize=800%2C608&ssl=1 +[25]: https://pclosmag.com/index.html +[26]: https://fullcirclemagazine.org/ +[27]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/08/PCLinuxOS-desktop.jpg?resize=800%2C500&ssl=1 +[28]: http://reddit.com/r/linuxusersgroup From 8e06f23ca110942819f884e3bc86c49ea0b3848a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 6 Sep 2020 11:01:28 +0800 Subject: [PATCH 0017/1156] PRF @geekpi --- ...0826 Customize your GNOME desktop theme.md | 44 ++++++++----------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/translated/tech/20200826 Customize your GNOME desktop theme.md b/translated/tech/20200826 Customize your GNOME desktop theme.md index 3226315bd1..501a7eddc9 100644 --- a/translated/tech/20200826 Customize your GNOME desktop theme.md +++ b/translated/tech/20200826 Customize your GNOME desktop theme.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Customize your GNOME desktop theme) @@ -9,76 +9,68 @@ 自定义你的 GNOME 桌面主题 ====== -使用 Tweaks 和它的用户主题扩展来改变你的 Linux UI。 -![Gnomes in a window.][1] -GNOME 是一个相当简单和精简的 Linux 图形用户界面 (GUI),很多用户喜欢它的简约外观。虽然它初始非常基本,但你可以根据自己的喜好来定制 [GNOME][2] 。多亏了 GNOME Tweaks 和用户主题扩展,你可以改变顶部栏、窗口标题栏、图标、光标和许多其他 UI 选项的外观。 +> 使用“优化”和它的用户主题扩展来改变你的 Linux UI。 + +![](https://img.linux.net.cn/data/attachment/album/202009/06/110116kmufkkc31akwfp1w.jpg) + +GNOME 是一个相当简单和精简的 Linux 图形用户界面(GUI),很多用户喜欢它的简约外观。虽然它基本上是开箱即用的,但你可以根据自己的喜好来定制 [GNOME][2] 。有了 GNOME “优化” 和用户主题扩展,你可以改变顶部栏、窗口标题栏、图标、光标和许多其他 UI 选项的外观。 ### 开始使用 -在你改变你的 GNOME 主题之前,你必须安装 [Tweaks][3] 并启用用户主题扩展。 +在你改变你的 GNOME 主题之前,你必须安装 “[优化][3]Tweaks” 并启用用户主题扩展。 -#### 安装 GNOME Tweaks +#### 安装 GNOME “优化” -你可以在 GNOME 软件中心找到 Tweaks,只需点击一个按钮就可以快速安装。 +你可以在 GNOME “软件”中找到“优化”,只需点击一个按钮就可以快速安装。 ![Install Tweaks in Software Center][4] -(Alan Formy-Duval, [CC BY-SA 4.0][5]) - 如果你喜欢命令行,请使用你的软件包管理器。例如,在 Fedora 或 CentOS 上: - ``` -`$ sudo dnf install gnome-tweaks` +$ sudo dnf install gnome-tweaks ``` 在 Debian 或类似的发行版: - ``` -`$ sudo apt install gnome-tweaks` +$ sudo apt install gnome-tweaks ``` #### 启用用户主题 -要启用用户主题扩展,启动 Tweaks 并选择 **Extensions**。找到 **User themes**,点击滑块启用。 +要启用用户主题扩展,启动“优化”并选择“扩展Extensions”。找到 “用户主题User themes”,点击滑块启用。 ![Enable User Themes Extension][6] -(Alan Formy-Duval, [CC BY-SA 4.0][5]) - ### 获取主题 现在你已经完成了这些预先条件,你已经准备好寻找和下载一些主题了。一个寻找新主题的好网站是 [GNOME-Look.org][7]。 在页面的左侧有一个主题类别的列表。当你找到一个你想要的主题,你需要下载它。我直接把 `.tar` 文件下载到我的家目录下的 `.themes` 目录(你可能需要先创建这个目录)。 - ``` -`$ mkdir ~/.themes` +$ mkdir ~/.themes ``` 如果你想让所有用户都能使用这个主题,请把它放在 `/usr/share/themes` 中。 - ``` -`$ tar xvf theme_archive.tar.xz` +$ tar xvf theme_archive.tar.xz ``` 下载后,解压压缩包。你可以删除 `.tar.xz` 文件以节省一些磁盘空间。 ### 应用主题 -要应用你的新主题,在 Tweaks 中进入 **Appearance**。在这里,你可以为你的桌面的每个方面选择不同的选项。 +要应用你的新主题,在“优化”中进入“外观Appearance”。在这里,你可以为你的桌面的每个方面选择不同的选项。 ![Apply a theme][8] -(Alan Formy-Duval, [CC BY-SA 4.0][5]) +### 多样性是生活的调剂品 -### 多样性是生活的调剂品。 - -自从第一个图形界面面市以来,能够用不同的墙纸、颜色、字体等个性化电脑桌面一直是一个受欢迎的功能。GNOME Tweaks 和用户主题扩展使这种自定义功能能够在所有 GNU/Linux 操作系统上的 GNOME 桌面环境中实现。而且开源社区还在继续提供广泛的主题、图标、字体和壁纸,任何人都可以下载、尝试和定制。 +自从第一个图形界面面市以来,能够用不同的墙纸、颜色、字体等个性化电脑桌面一直是一个受欢迎的功能。GNOME “优化”和用户主题扩展可以在所有 GNU/Linux 操作系统上的 GNOME 桌面环境中实现这种自定义。而且开源社区还在持续提供广泛的主题、图标、字体和壁纸,任何人都可以下载、尝试和定制。 你最喜欢的 GNOME 主题是什么,你为什么喜欢它们?请在评论中分享。 @@ -89,7 +81,7 @@ via: https://opensource.com/article/20/8/gnome-themes 作者:[Alan Formy-Duval][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 4257359cf9f86fe902b8a7523cf348962d3edf71 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 6 Sep 2020 11:02:06 +0800 Subject: [PATCH 0018/1156] PUB @geekpi https://linux.cn/article-12586-1.html --- .../20200826 Customize your GNOME desktop theme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200826 Customize your GNOME desktop theme.md (98%) diff --git a/translated/tech/20200826 Customize your GNOME desktop theme.md b/published/20200826 Customize your GNOME desktop theme.md similarity index 98% rename from translated/tech/20200826 Customize your GNOME desktop theme.md rename to published/20200826 Customize your GNOME desktop theme.md index 501a7eddc9..096944a7a7 100644 --- a/translated/tech/20200826 Customize your GNOME desktop theme.md +++ b/published/20200826 Customize your GNOME desktop theme.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12586-1.html) [#]: subject: (Customize your GNOME desktop theme) [#]: via: (https://opensource.com/article/20/8/gnome-themes) [#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) From 2f8d16a93502b549ee634c4e73daa9e8f7256882 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 6 Sep 2020 20:50:55 +0800 Subject: [PATCH 0019/1156] PRF @geekpi --- ...an API gateway to monitor microservices.md | 56 +++++++++---------- 1 file changed, 26 insertions(+), 30 deletions(-) diff --git a/translated/tech/20200828 Use GraphQL as an API gateway to monitor microservices.md b/translated/tech/20200828 Use GraphQL as an API gateway to monitor microservices.md index a6531140ef..907acc0b5a 100644 --- a/translated/tech/20200828 Use GraphQL as an API gateway to monitor microservices.md +++ b/translated/tech/20200828 Use GraphQL as an API gateway to monitor microservices.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Use GraphQL as an API gateway to monitor microservices) @@ -9,10 +9,12 @@ 使用 GraphQL 作为 API 网关来监控微服务 ====== -在一个问题使一个关键的微服务瘫痪之前,使用 GraphQL 的监控功能,帮助你及早发现问题。 -![Net catching 1s and 0s or data in the clouds][1] -[微服务][2]和 [GraphQL][3] 就像面包和黄油一样,是一个很好的组合。它们本身都很好,结合起来就更好了。了解你的微服务的健康状况是很重要的,因为它们运行着重要的服务。如果等到某个关键的服务崩溃了才诊断问题,那是很愚蠢的。让 GraphQL 帮助你及早发现问题并不需要花费太多精力。 +> 在问题导致关键的微服务瘫痪之前,使用 GraphQL 的监控功能帮助你及早发现问题。 + +![](https://img.linux.net.cn/data/attachment/album/202009/06/205052ve8eebyamcace4v8.jpg) + +[微服务][2]和 [GraphQL][3] 就像面包和黄油一样,是一个很好的组合。它们本身都很棒,结合起来就更棒了。了解你的微服务的健康状况是很重要的,因为它们运行着重要的服务。如果等到某个关键的服务崩溃了才诊断问题,那是很愚蠢的。让 GraphQL 帮助你及早发现问题并不需要花费太多精力。 ![GraphQL in Microservices][4] @@ -20,15 +22,13 @@ 以下是我在设计服务检查时考虑的因素: -**服务器健康检查的要求:** +服务器健康检查的要求: 1. 我需要了解我的微服务的可用性状态。 2. 我希望能够管理服务器的负载。 3. 我希望对我的微服务进行端到端(e2e)测试。 4. 我应该能够预测中断。 - - ![Service health in microservices][5] ### 做服务器健康检查的方法 @@ -39,22 +39,19 @@ 2. **脚本化浏览器:**脚本化浏览器比较高级。像 [Selenium][6] 这样的浏览器自动化工具可以让你实现自定义的监控规则集。 3. **API 测试:**API 测试用于监控 API 端点。这是 ping 检查模型的高级版本,你可以根据 API 响应来定义监控计划。 - - ### 使用 GraphQL 进行健康检查 在一个典型的基于 REST 的微服务中,你需要从头开始构建健康检查功能。这是一个时间密集型的过程,但使用 GraphQL 就不用担心了。 -根据它的[网站][7]: +根据它的[网站][7]称: -> “GraphQL 是一种用于 API 的查询语言,也是一种用现有数据完成这些查询的运行时。GraphQL 为你的 API 中的数据提供了一个完整的、可理解的描述,让客户有能力精确地仅查询他们所需要的东西,让 API 更容易随着时间的推移而进化,并实现强大的开发者工具。” +> “GraphQL 是一种用于 API 的查询语言,也是一种用现有数据完成这些查询的运行时环境。GraphQL 为你的 API 中的数据提供了一个完整的、可理解的描述,让客户有能力精确地仅查询他们所需要的东西,让 API 更容易随着时间的推移而进化,并实现强大的开发者工具。” - -当你启动一个 GraphQL 微服务时,你还可以获得监控微服务的运行状况的预置。这是一个隐藏的宝贝。 +当你启动一个 GraphQL 微服务时,你还可以获得监控微服务的运行状况的供给。这是一个隐藏的宝贝。 正如我上面提到的,你可以用 GraphQL 端点执行 API 测试以及 ping 检查。 -Apollo GraphQL Server 提供了一个默认的端点,它可以返回有关你的微服务和服务器健康的信息。它不是很复杂:如果服务器正在运行,它就会返回状态码 200。 +Apollo GraphQL 服务器提供了一个默认的端点,它可以返回有关你的微服务和服务器健康的信息。它不是很复杂:如果服务器正在运行,它就会返回状态码 200。 默认端点是 `/.well-known/apollo/server-health`。 @@ -66,27 +63,26 @@ Apollo GraphQL Server 提供了一个默认的端点,它可以返回有关你 Apollo GraphQL 在定义服务器的同时,通过声明一个 `onHealthCheck` 函数来有效地管理这种情况。 - ``` * Defining the Apollo Server */ const apollo = new ApolloServer({ -  playground: process.env.NODE_ENV !== 'production', -  typeDefs: gqlSchema, -  resolvers: resolver, -  onHealthCheck: () => { -    return new Promise((resolve, reject) => { -      // Replace the `true` in this conditional with more specific checks! -      if (true) { -        resolve(); -      } else { -        reject(); -      } -    }); -  } + playground: process.env.NODE_ENV !== 'production', + typeDefs: gqlSchema, + resolvers: resolver, + onHealthCheck: () => { + return new Promise((resolve, reject) => { + // Replace the `true` in this conditional with more specific checks! + if (true) { + resolve(); + } else { + reject(); + } + }); + } }); ``` -当你定义一个 `onHealthCheck` 方法时,它返回一个 promise,如果服务器准备好了,它就会返回 _resolve_,如果有错误,它就会返回 _reject_。 +当你定义一个 `onHealthCheck` 方法时,它返回一个 promise,如果服务器准备好了,它就会返回 `resolve`,如果有错误,它就会返回 `reject`。 GraphQL 让监控 API 变得更容易。此外,在你的服务器基础架构中使用它可以使代码变得可扩展。如果你想尝试采用 GraphQL 作为你的新基础设施定义,请参见我的 GitHub 仓库中的[示例代码和配置][9]。 @@ -97,7 +93,7 @@ via: https://opensource.com/article/20/8/microservices-graphql 作者:[Rigin Oommen][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 71c3c09d79f3b790addda02fe367656c6ec2e035 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 6 Sep 2020 20:51:52 +0800 Subject: [PATCH 0020/1156] PUB @geekpi https://linux.cn/article-12588-1.html --- ... Use GraphQL as an API gateway to monitor microservices.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200828 Use GraphQL as an API gateway to monitor microservices.md (98%) diff --git a/translated/tech/20200828 Use GraphQL as an API gateway to monitor microservices.md b/published/20200828 Use GraphQL as an API gateway to monitor microservices.md similarity index 98% rename from translated/tech/20200828 Use GraphQL as an API gateway to monitor microservices.md rename to published/20200828 Use GraphQL as an API gateway to monitor microservices.md index 907acc0b5a..a9daa6a877 100644 --- a/translated/tech/20200828 Use GraphQL as an API gateway to monitor microservices.md +++ b/published/20200828 Use GraphQL as an API gateway to monitor microservices.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12588-1.html) [#]: subject: (Use GraphQL as an API gateway to monitor microservices) [#]: via: (https://opensource.com/article/20/8/microservices-graphql) [#]: author: (Rigin Oommen https://opensource.com/users/riginoommen) From 6b2d965c841897ded8cbb242f7f385211f5ea36b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 6 Sep 2020 21:30:33 +0800 Subject: [PATCH 0021/1156] PRF @wxy --- ...splay Server in Linux- What is it Used for.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/translated/tech/20200830 Linux Jargon Buster- What is a Display Server in Linux- What is it Used for.md b/translated/tech/20200830 Linux Jargon Buster- What is a Display Server in Linux- What is it Used for.md index 46f2bbd591..1418761c00 100644 --- a/translated/tech/20200830 Linux Jargon Buster- What is a Display Server in Linux- What is it Used for.md +++ b/translated/tech/20200830 Linux Jargon Buster- What is a Display Server in Linux- What is it Used for.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Linux Jargon Buster: What is a Display Server in Linux? What is it Used for?) @@ -18,13 +18,13 @@ Linux 黑话解释:什么是显示服务器,用来做什么? ### 什么是显示服务器? -显示服务器是一个程序,它负责协调其客户端,与操作系统的其他部分之间,以及硬件和操作系统之间的输入和输出。基本上,多亏了显示服务器,你才能以图形化的方式使用你的计算机(GUI)。如果没有显示服务器,你只能局限于命令行界面(TTY)。 +显示服务器是一个程序,它负责协调其客户端与操作系统的其他部分之间,以及硬件和操作系统之间的输入和输出。基本上,多亏了显示服务器,你才能以图形化的方式使用你的计算机(GUI)。如果没有显示服务器,你只能局限于命令行界面(TTY)。 显示服务器提供了一个图形环境的框架,使你可以使用鼠标和键盘与应用程序进行交互。 显示服务器通过[显示服务器协议][1](如 X11)与客户端进行通信。显示服务器是图形用户界面 —— 特别是窗口系统 —— 中的一个关键组件。 -不要把显示服务器和[桌面环境][2]混淆。桌面环境下面使用的是显示服务器。 +不要把显示服务器和[桌面环境][2]混淆。桌面环境的下层使用的是显示服务器。 听起来很熟悉,但又不完全清楚?让我来解释一下。 @@ -38,7 +38,7 @@ X11(也称 X)是已经存在多年的传统显示服务器。它是 Linux ![X 架构][4] -X11 通信协议,使用 [X.org 服务器][5]显示服务器。它接收来自[设备驱动程序][6]的输入事件,并将它们提供给它的一个客户端。 +X11 通信协议,使用显示服务器 [X.org 服务器][5]。它接收来自[设备驱动程序][6]的输入事件,并将它们提供给它的一个客户端。 显示服务器也从客户端接收数据,它处理数据并进行合成,在 Linux 上,它将数据传递给三个内核组件之一:[DRM][7]、[gem][8] 或 [KMS 驱动][9]。 @@ -48,13 +48,13 @@ X.Org 服务器是一个显示服务器,它依靠第二个程序:[合成窗 按照其网站的说法,Wayland “旨在作为 X 的更简单的替代品,更容易开发和维护”。 -而事实上 [Wayland][13] 就是现代显示服务器,它应该取代传统的 X 显示服务器。 +而事实上 [Wayland][13] 就是现代的显示服务器,它应该取代传统的 X 显示服务器。 -它的采用还在进行中。Ubuntu 曾试图在 17.10 版本中改用 Wayland 作为默认的显示服务器,但这个实验遭到了负面反馈。 +对它的采用还在普及中。Ubuntu 曾试图在 17.10 版本中改用 Wayland 作为默认的显示服务器,但这个尝试遭到了负面反馈。 很多 GUI 应用程序及其框架都依赖于 X 服务器。这些应用程序在 Wayland 上无法正常工作。 -这迫使 Ubuntu 继续使用 X 作为默认显示服务器。它仍然提供了使用 Wayland 的选项,但它不再是默认的了。 +这迫使 Ubuntu 继续使用 X 作为默认显示服务器。它仍然提供了使用 Wayland 的选项,但不再是默认的了。 即使在今天,绝大多数的发行版都默认使用 X 显示服务器。 @@ -89,7 +89,7 @@ via: https://itsfoss.com/display-server/ 作者:[Dimitrios Savvopoulos][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ec137376bb04f2d19033d4e4b2b54e9f5430d756 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 6 Sep 2020 21:31:07 +0800 Subject: [PATCH 0022/1156] PUB @wxy https://linux.cn/article-12589-1.html --- ... What is a Display Server in Linux- What is it Used for.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200830 Linux Jargon Buster- What is a Display Server in Linux- What is it Used for.md (98%) diff --git a/translated/tech/20200830 Linux Jargon Buster- What is a Display Server in Linux- What is it Used for.md b/published/20200830 Linux Jargon Buster- What is a Display Server in Linux- What is it Used for.md similarity index 98% rename from translated/tech/20200830 Linux Jargon Buster- What is a Display Server in Linux- What is it Used for.md rename to published/20200830 Linux Jargon Buster- What is a Display Server in Linux- What is it Used for.md index 1418761c00..e89055455c 100644 --- a/translated/tech/20200830 Linux Jargon Buster- What is a Display Server in Linux- What is it Used for.md +++ b/published/20200830 Linux Jargon Buster- What is a Display Server in Linux- What is it Used for.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12589-1.html) [#]: subject: (Linux Jargon Buster: What is a Display Server in Linux? What is it Used for?) [#]: via: (https://itsfoss.com/display-server/) [#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) From 2ce03b184983896638b2630764869244c9981c47 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 6 Sep 2020 21:34:15 +0800 Subject: [PATCH 0023/1156] PRF --- ...r- What is a Display Server in Linux- What is it Used for.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20200830 Linux Jargon Buster- What is a Display Server in Linux- What is it Used for.md b/published/20200830 Linux Jargon Buster- What is a Display Server in Linux- What is it Used for.md index e89055455c..f5a7bbcdb3 100644 --- a/published/20200830 Linux Jargon Buster- What is a Display Server in Linux- What is it Used for.md +++ b/published/20200830 Linux Jargon Buster- What is a Display Server in Linux- What is it Used for.md @@ -76,7 +76,7 @@ Wayland 作为比较新的产品,相比 Xorg 来说,还不是很稳定。作 因此,很多程序在使用 Wayland 时可能无法运行。Ubuntu 默认切换到 Wayland 的实验证实了这一点。 -#### 结束语 +### 结束语 我希望你对 Linux 中的显示服务器概念有了更好的理解。我已经尽量不谈太多的技术细节,但我无法完全避免。 From 9b5d012ebb7ffdf8712c423e8d5814e6951ff4e1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 6 Sep 2020 22:28:24 +0800 Subject: [PATCH 0024/1156] APL --- ...n could be half the world-s mass by 2245, says researcher.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20200827 Information could be half the world-s mass by 2245, says researcher.md b/sources/talk/20200827 Information could be half the world-s mass by 2245, says researcher.md index 2144d45c9a..6b3e0b0fff 100644 --- a/sources/talk/20200827 Information could be half the world-s mass by 2245, says researcher.md +++ b/sources/talk/20200827 Information could be half the world-s mass by 2245, says researcher.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 31cf5966c786c53fa21320584420da4b88d2ad2b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 6 Sep 2020 22:40:02 +0800 Subject: [PATCH 0025/1156] TSL --- ...e world-s mass by 2245, says researcher.md | 60 ------------------- ...e world-s mass by 2245, says researcher.md | 58 ++++++++++++++++++ 2 files changed, 58 insertions(+), 60 deletions(-) delete mode 100644 sources/talk/20200827 Information could be half the world-s mass by 2245, says researcher.md create mode 100644 translated/talk/20200827 Information could be half the world-s mass by 2245, says researcher.md diff --git a/sources/talk/20200827 Information could be half the world-s mass by 2245, says researcher.md b/sources/talk/20200827 Information could be half the world-s mass by 2245, says researcher.md deleted file mode 100644 index 6b3e0b0fff..0000000000 --- a/sources/talk/20200827 Information could be half the world-s mass by 2245, says researcher.md +++ /dev/null @@ -1,60 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Information could be half the world's mass by 2245, says researcher) -[#]: via: (https://www.networkworld.com/article/3570438/information-could-be-half-the-worlds-mass-by-2245-says-researcher.html) -[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) - -Information could be half the world's mass by 2245, says researcher -====== -Because of the amount of energy and resources used to create and store digital information, the data should be considered physical, and not just invisible ones and zeroes, according to one theoretical physicist. -Luza Studios / Getty Images - -Digital content should be considered a fifth state of matter, along with gas, liquid, plasma and solid, suggests one university scholar. - -Because of the energy and resources used to create, store and distribute data physically and digitally, data has evolved and should now be considered as mass, according to Melvin Vopson, a senior lecturer at the U.K.'s University of Portsmouth and author of an article, "[The information catastrophe][1]," published in the journal AIP Advances. - -Vopson also claims digital bits are on a course to overwhelm the planet and will eventually outnumber atoms. - -The idea of assigning mass to digital information builds off some existing data points. Vopson cites an IBM estimate that finds data is created at a rate of 2.5 quintillion bytes every day. He also factors in data storage densities of more than 1 terabit per inch to compare the size of a bit to the size of an atom. - -Presuming 50% annual growth in data generation, "the number of bits would equal the number of atoms on Earth in approximately 150 years," according to a [media release][2] announcing Vopson's research. - -"It would be approximately 130 years until the power needed to sustain digital information creation would equal all the power currently produced on planet Earth, and by 2245, half of Earth's mass would be converted to digital information mass," the release reads. - -The COVID-19 pandemic is increasing the rate of digital data creation and accelerating this process, Vopson adds. - -He warns of an impending saturation point: "Even assuming that future technological progress brings the bit size down to sizes closer to the atom itself, this volume of digital information will take up more than the size of the planet, leading to what we define as the information catastrophe," Vopson writes in the [paper][3]. - -"We are literally changing the planet bit by bit, and it is an invisible crisis," says Vopson, a former R&D scientist at Seagate Technology. - -Vopson isn't alone in exploring the idea that information isn't simply imperceptible ones and zeroes. According to the release, Vopson draws on the mass-energy comparisons in Einstein's theory of general relativity; the work of Rolf Landauer, who applied the laws of thermodynamics to information; and the work of Claude Shannon, the inventor of the digital bit. - -"When one brings information content into existing physical theories, it is almost like an extra dimension to everything in physics," Vopson says. - -With a growth rate that seems unstoppable, digital information production "will consume most of the planetary power capacity, leading to ethical and environmental concerns," his paper concludes. - -Interestingly – and a bit more out there – Vopson also suggests that if, as he projects, the future mass of the planet is made up predominantly of bits of information, and there exists enough power created to do it (not certain), then "one could envisage a future world mostly computer simulated and dominated by digital bits and computer code," he writes. - -Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3570438/information-could-be-half-the-worlds-mass-by-2245-says-researcher.html - -作者:[Patrick Nelson][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://www.networkworld.com/author/Patrick-Nelson/ -[b]: https://github.com/lujun9972 -[1]: https://aip.scitation.org/doi/10.1063/5.0019941 -[2]: https://publishing.aip.org/publications/latest-content/digital-content-on-track-to-equal-half-earths-mass-by-2245/ -[3]: https://aip.scitation.org/doi/full/10.1063/5.0019941 -[4]: https://www.facebook.com/NetworkWorld/ -[5]: https://www.linkedin.com/company/network-world diff --git a/translated/talk/20200827 Information could be half the world-s mass by 2245, says researcher.md b/translated/talk/20200827 Information could be half the world-s mass by 2245, says researcher.md new file mode 100644 index 0000000000..0bcd47ab61 --- /dev/null +++ b/translated/talk/20200827 Information could be half the world-s mass by 2245, says researcher.md @@ -0,0 +1,58 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Information could be half the world's mass by 2245, says researcher) +[#]: via: (https://www.networkworld.com/article/3570438/information-could-be-half-the-worlds-mass-by-2245-says-researcher.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +研究人员表示,到 2245 年信息量可能占世界质量的一半 +====== + +> 根据一位理论物理学家的说法,由于创建和存储数字信息所使用的能源和资源数量,数据应该被视为物理的,而不仅仅是看不见的一和零。 + +一位大学学者建议,数字内容应该与气体、液体、等离子体和固体一样,被视为第五种物质状态。 + +英国朴茨茅斯大学高级讲师、发表在《AIP Advances》杂志上的《[信息灾难][1]》一文的作者 Melvin Vopson 称,由于以物理和数字方式创建、存储和分发数据所使用的能量和资源,数据已经发生了演变,现在应该被视为质量。 + +Vopson 还声称,数字比特正在走向压倒地球的道路,最终将超过原子的数量。 + +给数字信息分配质量的想法建立在一些现有数据点的基础上。Vopson 引用了 IBM 的一项估计,发现数据每天以 2.5 万亿字节的速度产生。他还将每英寸超过 1 太比特terabit的数据存储密度考虑在内,将比特的大小与原子的大小进行比较。 + +假设数据生成量每年增长 50%,根据宣布 Vopson 研究的[媒体发布][2],“比特的数量将在大约 150 年内等于地球上的原子数量。” + +新闻稿中写道:“大约 130 年后,维持数字信息创造所需的动力将等于地球上目前产生的所有动力,到 2245 年,地球上一半的质量将转化为数字信息质量。” + +Vopson 补充说,COVID-19 大流行正在提高数字数据创造的速度,并加速这一进程。 + +他警告说,一个饱和点即将到来:“即使假设未来的技术进步将比特大小降低到接近原子本身的大小,这个数字信息量所占的比重将超过地球的大小,从而导致我们所定义的信息灾难。”Vopson 在[论文][3]中写道。 + +“我们正在一点一点地改变这个星球,这是一场看不见的危机,”Vopson 说,他是希捷科技公司的前研发科学家。 + +Vopson 并不是一个人在探索,信息并不是简单的不可察觉的 1 和 0。根据发布的消息,Vopson 借鉴了爱因斯坦广义相对论中的质能对比;将热力学定律应用于信息的 Rolf Landauer 的工作;以及数字比特的发明者 Claude Shannon 的工作。 + +“当一个人将信息内容带入现有的物理理论中时,这几乎就像物理学中的一切都多了一个维度,”Vopson 说。 + +他的论文总结道,随着增长速度似乎不可阻挡,数字信息生产“将消耗地球上大部分的电力能源,从而导致道德和环境问题。”他的论文总结道。 + +有趣的是,除此以外,Vopson 还提出,如果像他所预测的那样,未来地球的质量主要由信息位组成,并且存在足够的动力创造出来(不确定),那么“可以设想未来的世界主要由计算机模拟,并由数字比特和计算机代码主导,”他写道。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3570438/information-could-be-half-the-worlds-mass-by-2245-says-researcher.html + +作者:[Patrick Nelson][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://www.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://aip.scitation.org/doi/10.1063/5.0019941 +[2]: https://publishing.aip.org/publications/latest-content/digital-content-on-track-to-equal-half-earths-mass-by-2245/ +[3]: https://aip.scitation.org/doi/full/10.1063/5.0019941 +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world From a1bb8c93f78794e4346b535e61329f88a321926f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 7 Sep 2020 05:01:37 +0800 Subject: [PATCH 0026/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200907?= =?UTF-8?q?=20Linux=20Jargon=20Buster:=20What=20is=20a=20Linux=20Distribut?= =?UTF-8?q?ion=3F=20Why=20is=20it=20Called=20a=20=E2=80=98Distribution?= =?UTF-8?q?=E2=80=99=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md --- ...ution- Why is it Called a ‘Distribution.md | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 sources/tech/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md diff --git a/sources/tech/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md b/sources/tech/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md new file mode 100644 index 0000000000..6ed3d9312c --- /dev/null +++ b/sources/tech/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux Jargon Buster: What is a Linux Distribution? Why is it Called a ‘Distribution’?) +[#]: via: (https://itsfoss.com/what-is-linux-distribution/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Linux Jargon Buster: What is a Linux Distribution? Why is it Called a ‘Distribution’? +====== + +In this chapter of the Linux Jargon Buster, let’s discuss something elementary. + +Let’s discuss what is a Linux distribution, why it is called a distribution (or distro) and how is it different from the Linux kernel. You’ll also learn a thing or two about why some people insist of calling Linux as GNU/Linux. + +### What is a Linux distribution? + +A Linux distribution is an operating system composed of the Linux kernel, [GNU tools][1], additional software and a package manager. It may also include display server and [desktop environment][2] to be used as regular desktop operating system. + +The term is Linux distribution (or distro in short form) because an entity like Debian or Ubuntu ‘distributes’ the Linux kernel along with all the necessary software and utilities (like network manager, package manager, desktop environments etc) so that it can be used as an operating system. + +Your distributions also takes the responsibility of providing updates to maintain the kernel and other utilities. + +So, Linux is the kernel whereas the Linux distribution is the operating system. This is the reason why they are also sometime referred as Linux-based operating systems. + +Don’t worry if not all the above makes sense right away. I’ll explain it in a bit more detail. + +### Linux is just a kernel, not an operating system: What does it mean? + +You might have come across that phrase and that’s entirely correct. The kernel is at the core of an operating system and it is close to the actual hardware. You interact with it using the applications and shell. + +![Linux Kernel Structure][3] + +To understand that, I’ll use the same analogy that I had used in my [detailed guide on what is Linux][4]. Think of operating systems as vehicles and kernel as engine. You cannot drive an engine directly. Similarly, you cannot use kernel directly. + +![Operating System Analogy][5] + +A Linux distribution can be seen as a vehicle manufacturer like Toyota or Ford that provides you ready to use cars just like Ubuntu or Fedora distributions provide you a ready to use operating systems based on Linux. + +### What is GNU/Linux? + +Take a look at this picture once again. What [Linus Torvalds][6] created in 1991 is just the innermost circle, i.e. the Linux kernel. + +![Linux Kernel Structure][3] + +To use Linux even in the most primitive form (without even a GUI), you need a shell. Most commonly, it is Bash shell. + +And then, you need to run some commands in the shell to do some work. Can you recall some basic Linux commands? There is cat, cp, mv, grep find, diff, gzip and more. + +Technically, not all of these so called ‘Linux commands’ belong to Linux exclusively. A lot of them originate mainly from the UNIX operating system. + +Even before Linux came into existence, Richard Stallman had created the GNU (recursive acronym for GNU is not Unix) project, the first of the free software project, in 1983. The [GNU project][7] implemented many of the popular Unix utilities like cat, grep, awk, shell (bash) along with developing their own compilers (GCC) and editors (Emacs). + +Back in the 80s UNIX was proprietary and super expensive. This is why Linus Torvalds developed a new kernel that was like UNIX. To interact with the Linux kernel, Torvalds used GNU tools which were available for free under their open source GPL license. + +With the GNU tools, it also behaved like UNIX. This is the reason why Linux is also termed as UNIX-like operating system. + +You cannot imagine Linux without the shell and all those commands. Since Linux integrates deeply with the GNU tools, almost dependent on it, the purists demand that GNU should get its fair share of recognition and this is why they insist on calling it GNU Linux (written as GNU/Linux). + +### Conclusion + +![][8] + +So, what is the correct term? Linux, GNU/Linux, Linux distribution, Linux distro, Linux based operating system or UNIX-like operating system? I say it depends on you and the context. I have provided you enough detail so that you have a better understanding of these related terms. + +I hope you are liking this **Linux Jargon Buster** series and learning new things. Your feedback and suggestions are welcome. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/what-is-linux-distribution/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.gnu.org/manual/blurbs.html +[2]: https://itsfoss.com/what-is-desktop-environment/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/Linux_Kernel_structure.png?resize=800%2C350&ssl=1 +[4]: https://itsfoss.com/what-is-linux/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/operating_system_analogy.png?resize=800%2C350&ssl=1 +[6]: https://itsfoss.com/linus-torvalds-facts/ +[7]: https://www.gnu.org/gnu/thegnuproject.en.html +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/what-is-linux-distribution.png?resize=800%2C450&ssl=1 From c062c2526d8516ca3b0c6b6fcbd7bccad47c27ef Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 7 Sep 2020 08:45:13 +0800 Subject: [PATCH 0027/1156] translated --- ...repositories with this open source tool.md | 84 ------------------ ...repositories with this open source tool.md | 86 +++++++++++++++++++ 2 files changed, 86 insertions(+), 84 deletions(-) delete mode 100644 sources/tech/20200826 Manage your software repositories with this open source tool.md create mode 100644 translated/tech/20200826 Manage your software repositories with this open source tool.md diff --git a/sources/tech/20200826 Manage your software repositories with this open source tool.md b/sources/tech/20200826 Manage your software repositories with this open source tool.md deleted file mode 100644 index a457219fe6..0000000000 --- a/sources/tech/20200826 Manage your software repositories with this open source tool.md +++ /dev/null @@ -1,84 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Manage your software repositories with this open source tool) -[#]: via: (https://opensource.com/article/20/8/manage-repositories-pulp) -[#]: author: (Melanie Corr https://opensource.com/users/melanie-corr) - -Manage your software repositories with this open source tool -====== -An introduction to Pulp, the open source repository management solution -that is growing in scope and functionality. -![Cut pieces of citrus fruit and pomegranates][1] - -[Foreman][2] is a robust management and automation product that provides administrators of Linux environments with enterprise-level solutions for four key scenarios: provisioning management, configuration management, patch management, and content management. A major component of the content management functionality in Foreman is provided by the Pulp project. While Pulp is an integral part of this product, it is also a standalone, free, and open source project that is making huge progress on its own. - -Let's take a look at the Pulp project, especially the features of the latest release, Pulp 3. - -### What is Pulp? - -Pulp is a platform for managing repositories of software packages and making them available to a large number of consumers. You can use Pulp to mirror, synchronize, upload, and promote content like RPMs, Python packages, Ansible collections, container images, and more across different environments. If you have dozens, hundreds, or even thousands of software packages and need a better way to manage them, Pulp can help. - -The latest major version is [Pulp 3][3], which was released in December 2019. Pulp 3 is the culmination of years of gathering user requirements and a complete technical overhaul of the existing Pulp architecture to increase reliability and flexibility. Plus, it includes a vast range of new features. - -### Who uses Pulp? - -For the most part, Pulp users administer enterprise software environments where the stability and reliability of content are paramount. Pulp users want a platform to develop content without worrying that repositories might disappear. They want to promote content across the different stages of their lifecycle environment in a secure manner that optimizes disk space and scales their environment to meet new demands. They also need the flexibility to work with a wide variety of content types. Pulp 3 provides that and more. - -### Manage a wide variety of content in one place - -After you install Pulp, you can add [content plugins][4] for the content types that you plan to manage, mirror the content locally, add privately hosted content, and blend content to suit your requirements. If you’re an Ansible user, for example, and you don't want to host your private content on Ansible Galaxy, you can add the Pulp Ansible plugin, mirror the public Ansible content that you require, and use Pulp as an on-premise platform to manage and distribute a scalable blend of public and private Ansible roles and collections across your organization. You can do this with any content type. There is a wide variety of content plugins available, including RPM, Debian, Python, Container, and Ansible, to name but a few. There is also a File plugin, which you can use to manage files like ISO images. - -If you don't find a plugin for the content type that you require, Pulp 3 has introduced a new plugin API and plugin template to make it easy to create a Pulp plugin of your own. You can use the [plugin writing guide][5] to autogenerate a minimal viable plugin, and then start building from there. - -### High availability - -With Pulp 3, the change from MongoDB to PostgreSQL facilitated major improvements around performance and data integrity. Pulp users now have a fully open source tech stack that provides high availability (HA) and better scalability. - -### Repository versioning - -Using Pulp 3, you can experiment without risk. Every time you add or remove content, Pulp creates an immutable repository version so that you can roll back to earlier versions and thereby guarantee the safety and stability of your operation. Using publications and distributions, you can expose multiple versions of a repository, which you can use as another method of rolling back to an earlier version. To roll back, you can simply point your distribution to an older publication. - -### Disk optimization - -One of the major challenges for any software development environment is disk optimization. If you're downloading a constant stream of packages—for example, nightly builds of repositories that you require today but will no longer require tomorrow—disk space will quickly become an issue. Pulp 3 has been designed with disk optimization in mind. While the default option downloads and saves all software packages, you can also enable either the "on demand" or "streamed" option. The "on demand" option saves disk space by downloading and saving only the content that clients request. With the "streamed" option, you also download upon client request, but you don't save the content in Pulp. This is ideal for synchronizing content, for example, from a nightly repository, and saves you from having to perform a disk cleanup at a later stage. - -### Multiple storage options - -Even with the best disk optimization, as your project grows, you might need a way to scale your deployment to match your requirements. As well as local file storage, Pulp supports a range of cloud storage options, such as Amazon S3 and Azure, to ensure that you can scale to meet the demands of your deployment. - -### Protect your content - -Pulp 3 has the option of adding the [Certguard][6] plugin, which provides an X.509 capable ContentGuard that requires clients to submit a certificate proving their entitlement to content before receiving content from Pulp. - -Any client presenting an X.509 or Red Hat Subscription Management-based certificate at request time will be authorized, as long as the client certification is not expired, is signed by the Certificate Authority, and was stored on the Certguard when it was created. The client presents the certificate using transport layer security (TLS), which proves that the client has not only the certificate but also its key. You can develop, confident in the knowledge that your content is being protected. - -The Pulp team is also actively working on a role-based access control system for the entire Pulp deployment so that administrators can ensure that the right users have access to the right environments. - -### Try Pulp in a container - -If you're interested in evaluating Pulp 3 for yourself, you can easily install [Pulp 3 in a Container][7] using Docker or Podman. The Pulp team is constantly working on simplifying the installation process. You can also use an [Ansible playbook][8] to automate the full installation and configuration of Pulp 3. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/8/manage-repositories-pulp - -作者:[Melanie Corr][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://opensource.com/users/melanie-corr -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/fruit-orange-pomegranate-pulp-unsplash.jpg?itok=4cvODZDJ (Oranges and pomegranates) -[2]: https://opensource.com/article/17/8/system-management-foreman -[3]: https://pulpproject.org/about-pulp-3/ -[4]: https://pulpproject.org/content-plugins/ -[5]: https://docs.pulpproject.org/plugins/plugin-writer/index.html -[6]: https://pulp-certguard.readthedocs.io/en/latest/ -[7]: https://pulpproject.org/pulp-in-one-container/ -[8]: https://pulp-installer.readthedocs.io/en/latest/ diff --git a/translated/tech/20200826 Manage your software repositories with this open source tool.md b/translated/tech/20200826 Manage your software repositories with this open source tool.md new file mode 100644 index 0000000000..6fba95ae9a --- /dev/null +++ b/translated/tech/20200826 Manage your software repositories with this open source tool.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Manage your software repositories with this open source tool) +[#]: via: (https://opensource.com/article/20/8/manage-repositories-pulp) +[#]: author: (Melanie Corr https://opensource.com/users/melanie-corr) + +用这个开源工具管理你的软件仓库 +====== +这篇介绍 Pulp,一个开源仓库管理解决方案,它的范围和功能在不断增长。 +![Cut pieces of citrus fruit and pomegranates][1] + +[Foreman][2] 是一个强大的管理和自动化产品,它为 Linux 环境的管理员提供了企业级的解决方案,来用于四个关键场景:预备管理、配置管理、补丁管理和内容管理。Foreman 中内容管理功能的一个主要组成部分是由 Pulp 项目提供的。虽然 Pulp 是这个产品的一个组成部分,但它也是一个独立的、免费的、开源的项目,自身也在取得巨大的进步。 + + +让我们来看看 Pulp 项目,特别是最新版本 Pulp 3 的功能。 + +### 什么是 Pulp? + +Pulp 是一个管理软件包仓库的平台,并将其提供给大量的消费者。你可以使用 Pulp 来跨不同环境镜像、同步、上传和推广内容,如 RPM、Python 包、Ansible 集合、容器镜像等。如果你有几十个、几百个甚至上千个软件包,并需要更好的方式来管理它们,Pulp可以帮 助你。 + +最新的主要版本是 [Pulp 3][3],它于 2019 年 12 月发布。Pulp 3 是多年来收集用户需求的结晶,并对现有的 Pulp 架构进行了全面的技术改造,以提高可靠性和灵活性。另外,它还包含了大量的新功能。 + +### 谁在使用 Pulp? + + +大多数情况下,Pulp 用户管理的企业软件环境中,内容的稳定性和可靠性是最重要的。Pulp 用户希望有一个平台来开发内容,而不用担心仓库可能会消失。他们希望以安全的方式在其生命周期环境的不同阶段推广内容,优化磁盘空间并扩展环境以满足新的需求。他们还需要灵活处理各种内容类型。Pulp 3 提供了这些以及更多。 + +### 在一处管理各类内容 + +安装 Pulp 后,你可以为你计划管理的内容类型添加[内容插件][4],将内容镜像到本地,添加私人托管的内容,并根据你的需求混合内容。例如,如果你是 Ansible 用户,而你又不想在Ansible Galaxy 上托管你的私有内容,你可以添加 Pulp Ansible 插件,镜像你所需要的公共 Ansible 内容,并将 Pulp 作为一个内部平台,在你的组织中管理和分发可扩展的公共和私有 Ansible 角色和集合的混合。你可以用任何内容类型都能实现。有各种各样的内容插件可供选择,包括 RPM、Debian、Python、容器和 Ansible 等等。还有一个文件插件,你可以用它来管理 ISO 镜像等文件。 + +如果你没有找到你所需的内容类型插件,Pulp 3 引入了新的插件 API 和插件模板,你可以轻松创建一个属于自己的 Pulp 插件。你可以根据[插件编写指南][5]自动生成一个最小可用的插件,然后从那里开始构建。 + +### 高可用性 + +在 Pulp 3 中,从 MongoDB 到 PostgreSQL 的变化促成了性能和数据完整性的重大改进。Pulp 用户现在有了一个完全开源的技术栈,它可以提供高可用性 (HA) 和更好的扩展性。 + +### 仓库版本管理 + +使用 Pulp 3,你可以毫无风险地进行试验。每次你添加或删除内容时,Pulp 都会创建一个不可变的仓库版本,这样你就可以回滚到早期的版本,从而保证你操作的安全性和稳定性。通过使用发布和分发,你可以公开一个仓库的多个版本,你可以将其作为回滚到早期版本的另一种方法。如要回滚,你可以简单地将你的分发指向一个旧的发布。 + +### 磁盘优化 + +任何软件开发环境的主要挑战之一是磁盘优化。如果你不断地下载包,例如,你今天需要但明天不再需要的仓库每日构建,那么磁盘空间将很快成为一个问题。Pulp 3 的设计已经考虑到了磁盘优化。虽然默认选项下载并保存所有的软件包,你也可以启用“按需”或“流”选项。“按需”选项只下载和保存客户要求的内容,从而节省了磁盘空间。使用“流” +选项,它也会根据客户的要求进行下载,但它不会将内容保存在 Pulp 中。这对于同步内容是非常理想的,例如,从一个每日仓库同步,并让你在后期免于执行磁盘清理。 + +### 多个存储选项 + +即使有最好的磁盘优化,随着项目的发展,你可能需要一种方法来扩展你的部署以满足需求。除了本地文件存储,Pulp 还支持一系列的云存储选项,如 Amazon S3 和 Azure,以确保你可以扩展满足你的部署需求。 + +### 保护你的内容 + +Pulp 3 可以选择添加 [Certguard][6] 插件,该插件提供了一个支持 X.509 的 Contentguard,它要求客户在收到 Pulp 的内容之前提交证明其对内容的权利的证书。 + +只要客户端的证书没有过期,且由证书颁发机构签署,并在创建时存储在 Certguard 上,任何客户端在请求时提供基于 X.509 或基于 Red Hat 订阅管理证书都将获得授权。客户端使用安全传输层(TLS)提供证书,这证明客户端不仅有证书,还有它的密钥。你可以放心地开发,知道你的内容正在受到保护。 + +Pulp 团队也在积极为整个 Pulp 部署一个基于角色的访问控制系统,这样管理员就可以确保正确的用户可以访问正确的环境。 + +### 在容器中试用 Pulp + +如果你有兴趣亲自评估Pulp 3,你可以使用 Docker 或 Podman 轻松[在容器中安装 Pulp 3][7]。Pulp 团队一直在努力简化安装过程。你也可以使用 [Ansible playbook][8] 来自动完成 Pulp 3 的全部安装和配置。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/manage-repositories-pulp + +作者:[Melanie Corr][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/melanie-corr +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/fruit-orange-pomegranate-pulp-unsplash.jpg?itok=4cvODZDJ (Oranges and pomegranates) +[2]: https://opensource.com/article/17/8/system-management-foreman +[3]: https://pulpproject.org/about-pulp-3/ +[4]: https://pulpproject.org/content-plugins/ +[5]: https://docs.pulpproject.org/plugins/plugin-writer/index.html +[6]: https://pulp-certguard.readthedocs.io/en/latest/ +[7]: https://pulpproject.org/pulp-in-one-container/ +[8]: https://pulp-installer.readthedocs.io/en/latest/ From 5f60dd442943bbcfff842598f7394e99c236b563 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 7 Sep 2020 08:50:04 +0800 Subject: [PATCH 0028/1156] translating --- ...ote management console using Python and Jupyter Notebooks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200904 Build a remote management console using Python and Jupyter Notebooks.md b/sources/tech/20200904 Build a remote management console using Python and Jupyter Notebooks.md index b75f027e10..2c6d25c1aa 100644 --- a/sources/tech/20200904 Build a remote management console using Python and Jupyter Notebooks.md +++ b/sources/tech/20200904 Build a remote management console using Python and Jupyter Notebooks.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 0816a76a57b9b615c661a8f8e9248d1c5c196344 Mon Sep 17 00:00:00 2001 From: leommxj Date: Mon, 7 Sep 2020 13:47:22 +0800 Subject: [PATCH 0029/1156] 20190226 Reducing security risks with centralized logging translated --- ...security risks with centralized logging.md | 82 ------------------- ...security risks with centralized logging.md | 82 +++++++++++++++++++ 2 files changed, 82 insertions(+), 82 deletions(-) delete mode 100644 sources/talk/20190226 Reducing security risks with centralized logging.md create mode 100644 translated/talk/20190226 Reducing security risks with centralized logging.md diff --git a/sources/talk/20190226 Reducing security risks with centralized logging.md b/sources/talk/20190226 Reducing security risks with centralized logging.md deleted file mode 100644 index 5e3089eac5..0000000000 --- a/sources/talk/20190226 Reducing security risks with centralized logging.md +++ /dev/null @@ -1,82 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (leommxj) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Reducing security risks with centralized logging) -[#]: via: (https://opensource.com/article/19/2/reducing-security-risks-centralized-logging) -[#]: author: (Hannah Suarez https://opensource.com/users/hcs) - -Reducing security risks with centralized logging -====== -Centralizing logs and structuring log data for processing can mitigate risks related to insufficient logging. - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security_privacy_lock.png?itok=ZWjrpFzx) - -Logging and log analysis are essential to securing infrastructure, particularly when we consider common vulnerabilities. This article, based on my lightning talk [Let's use centralized log collection to make incident response teams happy][1] at FOSDEM'19, aims to raise awareness about the security concerns around insufficient logging, offer a way to avoid the risk, and advocate for more secure practices _(disclaimer: I work for NXLog)._ - -### Why log collection and why centralized logging? - -Logging is, to be specific, an append-only sequence of records written to disk. In practice, logs help you investigate an infrastructure issue as you try to find a cause for misbehavior. A challenge comes up when you have heterogeneous systems with their own standards and formats, and you want to be able to handle and process these in a dependable way. This often comes at the cost of metadata. Centralized logging solutions require commonality, and that commonality often removes the rich metadata many open source logging tools provide. - -### The security risk of insufficient logging and monitoring - -The Open Web Application Security Project ([OWASP][2]) is a nonprofit organization that contributes to the industry with incredible projects (including many [tools][3] focusing on software security). The organization regularly reports on the riskiest security challenges for application developers and maintainers. In its most recent report on the [top 10 most critical web application security risks][4], OWASP added Insufficient Logging and Monitoring to its list. OWASP warns of risks due to insufficient logging, detection, monitoring, and active response in the following types of scenarios. - - * Important auditable events, such as logins, failed logins, and high-value transactions are not logged. - * Warnings and errors generate none, inadequate, or unclear log messages. - * Logs are only being stored locally. - * The application is unable to detect, escalate, or alert for active attacks in real time or near real time. - - - -These instances can be mitigated by centralizing logs (i.e., not storing logs locally) and structuring log data for processing (i.e., in alerting dashboards and security suites). - -For example, imagine a DNS query leads to a malicious site named **hacked.badsite.net**. With DNS monitoring, administrators monitor and proactively analyze DNS queries and responses. The efficiency of DNS monitoring relies on both sufficient logging and log collection in order to catch potential issues as well as structuring the resulting DNS log for further processing: - -``` -2019-01-29 -Time (GMT)      Source                  Destination             Protocol-Info -12:42:42.112898 SOURCE_IP               xxx.xx.xx.x             DNS     Standard query 0x1de7  A hacked.badsite.net -``` - -You can try this yourself and run through other examples and snippets with the [NXLog Community Edition][5] _(disclaimer again: I work for NXLog)._ - -### Important aside: unstructured vs. structured data - -It's important to take a moment and consider the log data format. For example, let's consider this log message: - -``` -debug1: Failed password for invalid user amy from SOURCE_IP port SOURCE_PORT ssh2 -``` - -This log contains a predefined structure, such as a metadata keyword before the colon ( **debug1** ). However, the rest of the log field is an unstructured string ( **Failed password for invalid user amy from SOURCE_IP port SOURCE_PORT ssh2** ). So, while the message is easily available in a human-readable format, it is not a format a computer can easily parse. - -Unstructured event data poses limitations including difficulty of parsing, searching, and analyzing the logs. The important metadata is too often set in an unstructured data field in the form of a freeform string like the example above. Logging administrators will come across this problem at some point as they attempt to standardize/normalize log data and centralize their log sources. - -### Where to go next - -Alongside centralizing and structuring your logs, make sure you're collecting the right log data—Sysmon, PowerShell, Windows EventLog, DNS debug, NetFlow, ETW, kernel monitoring, file integrity monitoring, database logs, external cloud logs, and so on. Also have the right tools and processes in place to collect, aggregate, and help make sense of the data. - -Hopefully, this gives you a starting point to centralize log collection across diverse sources; send them to outside sources like dashboards, monitoring software, analytics software, specialized software like security information and event management (SEIM) suites; and more. - -What does your centralized logging strategy look like? Share your thoughts in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/2/reducing-security-risks-centralized-logging - -作者:[Hannah Suarez][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://opensource.com/users/hcs -[b]: https://github.com/lujun9972 -[1]: https://fosdem.org/2019/schedule/event/lets_use_centralized_log_collection_to_make_incident_response_teams_happy/ -[2]: https://www.owasp.org/index.php/Main_Page -[3]: https://github.com/OWASP -[4]: https://www.owasp.org/index.php/Top_10-2017_Top_10 -[5]: https://nxlog.co/products/nxlog-community-edition/download diff --git a/translated/talk/20190226 Reducing security risks with centralized logging.md b/translated/talk/20190226 Reducing security risks with centralized logging.md new file mode 100644 index 0000000000..5144cf68ea --- /dev/null +++ b/translated/talk/20190226 Reducing security risks with centralized logging.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: (leommxj) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Reducing security risks with centralized logging) +[#]: via: (https://opensource.com/article/19/2/reducing-security-risks-centralized-logging) +[#]: author: (Hannah Suarez https://opensource.com/users/hcs) + +通过集中日志记录来减少安全风险 +====== +集中日志并结构化待处理的日志数据可缓解与缺少日志相关的风险 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security_privacy_lock.png?itok=ZWjrpFzx) + +日志记录和日志分析对于保护基础设施安全来说至关重要,尤其是当我们考虑到通用漏洞的时候。这篇文章基于我在 FOSDEM'19 上的闪电秀[Let's use centralized log collection to make incident response teams happy][1],目的是提高大家对缺少日志这种安全问题的重视,提供一种避免风险的方法,并且倡议更多的安全实现 _(声明: 我为 NXLog 工作)._ + +### 为什么收集日志?为什么集中日志记录? + +确切的说,日志是写入磁盘的仅追加的记录序列在实际生活中,日志可以在你尝试寻找异常的根源时帮助你调查基础设施问题。当你有多个使用自己标准与格式的日志的异构系统并且想用一种可靠的方法来接收和处理它们的时候,挑战就来临了。这通常以元数据为代价。集中日志记录解决方案需要共性,这种共性常常会去除许多开源日志记录工具所提供的丰富的元数据。 + +### 缺少日志记录与监控的安全风险 + +开源 Web 应用程序安全项目 ([OWASP][2]) 是一个为业界贡献了许多杰出项目(包括许多专注于软件安全的[工具][3])的非营利组织。OWASP定期为应用开发人员和维护者报告危险的安全挑战。在最新一版[10项最严重的 Web 应用程序安全风险][4] 中,OWASP 将不足的日志记录和监控加入了列表中。OWASP 警告下列情况会导致不足的日志记录、检测、监控和响应: + + * 未记录可审计性事件,如:登录、登录失败和高额交易。 + * 告警和错误事件未能产生或产生不足的和不清晰的日志信息。 + * 日志信息仅在本地存储。 + * 对于实时或准实时的攻击,应用程序无法检测、处理和告警。 + + + +可以通过集中日志记录(例如, 不仅将日志本地存储)和结构化日志数据来缓解上述情形(例如,在告警仪表盘和安全套件中)。 + +举例来说, 假设一个DNS查询会导向名为 **hacked.badsite.net** 的恶意网站通过 DNS 监控,管理员监控并且主动的分析 DNS 请求与响应。DNS 监控的效果依赖于充足的日志记录与收集来发现潜在问题,同样也依赖于结构化 DNS 日志的结果来进一步分析。 + +``` +2019-01-29 +Time (GMT)      Source                  Destination             Protocol-Info +12:42:42.112898 SOURCE_IP               xxx.xx.xx.x             DNS     Standard query 0x1de7  A hacked.badsite.net +``` + +你可以在 [NXLog Community Edition][5] 自己尝试一下这个例子也可以尝试其他例子和代码片段。 _(再次声明: 我为 NXLog 工作)._ + +### 重要的一点:非结构化数据与结构化数据 + +花费一点时间来考虑下日志数据格式是很重要的例如,让我们来考虑以下日志消息: + +``` +debug1: Failed password for invalid user amy from SOURCE_IP port SOURCE_PORT ssh2 +``` + +这段日志包含了一个预定义的结构,例如冒号前面的元数据关键词(**debug1**)然而,余下的日志字段是一个未结构化的字符串(**Failed password for invalid user amy from SOURCE_IP port SOURCE_PORT ssh2** )。因此,即便这个消息是人类可轻松阅读的格式,但它不是一个计算机容易解析的格式。 + +非结构化的事件数据存在局限性,包括难以解析,搜索和分析日志。重要的元数据通常以一种自由字符串的形式作为非结构化数据字段,就像上面的例子一样。日志管理员会在他们尝试标准化/归一化日志数据与集中日志源的过程中遇到这个问题。 + +### 接下来怎么做 + +除了集中和结构化日志之外,确保你收集了正确的日志数据——Sysmon、PowerShell、Windows 事件日志、 DNS 调试日志、ETW、内核监控、文件完整性监控、数据库日志、外部云日志等等。同样选用适当的工具和流程来来收集,汇总和帮助理解数据。 + +希望这对你从不同日志源中集中日志收集提供了一个开始; 将日志发送到仪表盘,监控软件,分析软件以及像安全性资讯与事件管理(SIEM)套件等外部源。 + +你的集中日志策略会是怎么样?请在评论中分享你的想法。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/reducing-security-risks-centralized-logging + +作者:[Hannah Suarez][a] +选题:[lujun9972][b] +译者:[leommxj](https://github.com/leommxj) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/hcs +[b]: https://github.com/lujun9972 +[1]: https://fosdem.org/2019/schedule/event/lets_use_centralized_log_collection_to_make_incident_response_teams_happy/ +[2]: https://www.owasp.org/index.php/Main_Page +[3]: https://github.com/OWASP +[4]: https://www.owasp.org/index.php/Top_10-2017_Top_10 +[5]: https://nxlog.co/products/nxlog-community-edition/download From fd7bcdd5f8ef3d8697b90b2732237e80452a356c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 7 Sep 2020 14:01:19 +0800 Subject: [PATCH 0030/1156] APL --- sources/tech/20200415 Tweaking history on Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200415 Tweaking history on Linux.md b/sources/tech/20200415 Tweaking history on Linux.md index b17a666a8a..11a23f4832 100644 --- a/sources/tech/20200415 Tweaking history on Linux.md +++ b/sources/tech/20200415 Tweaking history on Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 8d8faeeb512dea37821060436d03b55a99a68873 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 7 Sep 2020 16:02:35 +0800 Subject: [PATCH 0031/1156] TSL&PRF --- .../20200415 Tweaking history on Linux.md | 189 ------------------ .../20200415 Tweaking history on Linux.md | 189 ++++++++++++++++++ 2 files changed, 189 insertions(+), 189 deletions(-) delete mode 100644 sources/tech/20200415 Tweaking history on Linux.md create mode 100644 translated/tech/20200415 Tweaking history on Linux.md diff --git a/sources/tech/20200415 Tweaking history on Linux.md b/sources/tech/20200415 Tweaking history on Linux.md deleted file mode 100644 index 11a23f4832..0000000000 --- a/sources/tech/20200415 Tweaking history on Linux.md +++ /dev/null @@ -1,189 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Tweaking history on Linux) -[#]: via: (https://www.networkworld.com/article/3537214/tweaking-history-on-linux.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -Tweaking history on Linux -====== -The bash shell's history command in Linux makes it easy to review and reuse commands, but there's a lot you do to control how much it remembers and how much forgets. -[Claudio Testa][1] [(CC0)][2] - -The bash **history** command on Linux systems helps with remembering commands you’ve previously run and repeating those commands without having to retype them. - -You could decide, however, that you’d be just as happy to forget that you referenced a dozen man pages, listed your files every 10 minutes or viewed previously run commands by typing “history”. In this post, we’re going to look at how you can get the history command to remember just what you want it to remember and forget commands that are likely to be of little "historic value". - -### Viewing your command history - -To view previously run commands, you simply type “history”. You’ll probably see a long list of commands. The number of commands remembered depends on an environment variable called **$HISTSIZE** that is set up in your **~/.bashrc** file, but there’s nothing stopping you from changing this setting if you want to save more or fewer commands. - -To view history, use the **history** command: - -``` -$ history -209 uname -v -210 date -211 man chage -... -``` - -To see the maximum number of commands that will be displayed: - -``` -$ echo $HISTSIZE -500 -``` - -You can change **$HISTSIZE** and make the change permanent by running commands like these: - -``` -$ export HISTSIZE=1000 -$ echo “HISTSIZE=1000” >> ~/.bashrc -``` - -There’s also a difference between how much history is preserved for you and how much is displayed when you type “history”. The **$HISTSIZE** variable controls how much history is displayed while the **$HISTFILESIZE** variable controls how many commands are retained in your **.bash_history** file. - -[][3] - -``` -$ echo $HISTSIZE -1000 -$ echo $HISTFILESIZE -2000 -``` - -You can verify the second variable by counting the lines in your history file: - -``` -$ wc -l .bash_history -2000 .bash_history -``` - -One thing to keep in mind is that commands that you enter during a login session aren’t added to your **.bash_history** file until you log off, even though they show up in the **history** command output right away. - -### Using history - -There are three ways to reissue commands that you find in your history. The simplest way, especially if the command you want to reuse was run recently, is often to type a ! followed by enough of the first letters in the command's name to uniquely identify it. - -``` -$ !u -uname -v -#37-Ubuntu SMP Thu Mar 26 20:41:27 UTC 2020 -``` - -Another easy way to repeat a command is to simply press your up-arrow key until the command is displayed and then press enter. - -Alternately, if you run the history command and see the command you want to rerun listed, you can type an ! followed by the sequence number shown to the left of the command. - -``` -$ !209 -uname -v -#37-Ubuntu SMP Thu Mar 26 20:41:27 UTC 2020 -``` - -### Hiding history - -If you want to stop recording commands for some period of time, you can use this command: - -``` -$ set +o history -``` - -Commands will not show up when you type "history" nor will they be added to your **.bash_history** file when you exit the session by logging off or exiting the terminal. - -To reverse this setting, use **set -o history**. To make it permanent, you can add it to your **.bashrc** file, though failing to make use of command history altogether is generally not a good idea. - -``` -$ echo 'set +o history' >> ~/.bashrc -``` - -To temporarily clear history, so that only commands that you enter afterwards show up when you type "history", use the **history -c** (clear) command: - -``` -$ history | tail -3 -209 uname -v -210 date -211 man chage -$ history -c -$ history -1 history -``` - -NOTE: The commands entered after typing "history -c" will not be added to your .bash_history file. - -### Controlling history - -The command history settings on many systems will default to including one called **$HISTCONTROL** that ensures that, even if you run the same command seven times in a row, it will only be remembered once. It also ensures that commands that you type after first entering one or more blanks will be omitted from your command history. - -``` -$ grep HISTCONTROL .bashrc -HISTCONTROL=ignoreboth -``` - -The "ignoreboth" means "ignore both duplicate commands and command starting with blanks". For example, if you type these commands: - -``` -$ echo try this -$ date -$ date -$ date -$ pwd -$ history -``` - -your history command should report something like this: - -``` -$ history -$ echo try this -$ date -$ history -``` - -Notice that the sequential date commands were reduced to one and the indented command was omitted. - -### Overlooking history - -To ignore certain commands so that they never show up when you type "history" and are never added to your **.bash_history** file, use the **$HISTIGNORE** setting. For example: - -``` -$ export HISTIGNORE=”history:cd:exit:ls:pwd:man” -``` - -This setting will cause all **history**, **cd**, **exit**, **ls**, **pwd** and **man** commands to be omitted from your **history** output and your **.bash_history** file. - -If you want to make this setting permanent, you have to add it to your **.bashrc** file. - -``` -$ echo 'HISTIGNORE="history:cd:exit:ls:pwd:man"' >> .bashrc -``` - -This setting just means that when you look back through previously run commands, the list won’t be cluttered by commands that you're unlikely to be looking for when you are looking through your command history. - -### Remembering, ignoring and forgetting the past - -Command history is useful because it helps you remember what commands you’ve recently used and reminds you about changes you’ve recently made. It also makes it easier to rerun commands, especially those with a string of arguments that you don't necessarily want to recreate. Tailoring your history settings can make your use of command history a little easier and more efficient. - -Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3537214/tweaking-history-on-linux.html - -作者:[Sandra Henry-Stocker][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://www.networkworld.com/author/Sandra-Henry_Stocker/ -[b]: https://github.com/lujun9972 -[1]: https://unsplash.com/photos/iqeG5xA96M4 -[2]: https://creativecommons.org/publicdomain/zero/1.0/ -[3]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) -[4]: https://www.facebook.com/NetworkWorld/ -[5]: https://www.linkedin.com/company/network-world diff --git a/translated/tech/20200415 Tweaking history on Linux.md b/translated/tech/20200415 Tweaking history on Linux.md new file mode 100644 index 0000000000..216350861a --- /dev/null +++ b/translated/tech/20200415 Tweaking history on Linux.md @@ -0,0 +1,189 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Tweaking history on Linux) +[#]: via: (https://www.networkworld.com/article/3537214/tweaking-history-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +在 Linux 上调整命令历史 +====== + +> 在 Linux 系统上,bash shell 的 history 命令可以方便地回顾和重用命令,但是你要控制它记住多少,忘记多少,有很多事情要做。 + +![](https://images.idgesg.net/images/article/2019/08/uk_united_kingdom_england_london_natural_history_museum_by_claudio_testa_cc0_via_unsplash_2400x1600-100808449-large.jpg) + +Linux 系统中的 bash `history` 命令有助于记住你以前运行过的命令,并重复这些命令,而不必重新输入。 + +如果可以的话,你肯定会很高兴不用翻阅十几页的手册,每过一会再次列出你的文件,而是通过输入 `history` 查看以前运行的命令。在这篇文章中,我们将探讨如何让 `history` 命令记住你希望它记住的内容,并忘记那些可能没有什么“历史价值”的命令。 + +### 查看你的命令历史 + +要查看以前运行过的命令,你只需输入 `history`。你可能会看到一长串命令。记忆的命令数量取决于在 `~/.bashrc` 文件中设置的名为 `$HISTSIZE` 的环境变量,但是如果你想保存更多或更少的命令,你可以根据你的需要改变这个设置。 + +要查看历史记录,请使用 `history` 命令: + +``` +$ history +209 uname -v +210 date +211 man chage +... +``` + +要查看将显示的最大命令数量: + +``` +$ echo $HISTSIZE +500 +``` + +你可以通过运行这样的命令来改变 `$HISTSIZE` 并使之永久化: + +``` +$ export HISTSIZE=1000 +$ echo "HISTSIZE=1000" >> ~/.bashrc +``` + +在为你保留多少历史记录和当你输入 `history` 时显示多少历史记录之间也有区别。`$HISTSIZE` 变量控制显示多少历史记录,而 `$HISTFILESIZE` 变量控制在你的 `.bash_history` 文件中保留多少命令。 + +``` +$ echo $HISTSIZE +1000 +$ echo $HISTFILESIZE +2000 +``` + +你可以通过计算历史文件中的行数来验证第二个变量: + +``` +$ wc -l .bash_history +2000 .bash_history +``` + +需要注意的是,在登录会话中输入的命令在注销前不会被添加到你的 `.bash_history` 文件中,尽管它们会立即显示在 `history` 命令输出中。 + +### 使用历史 + +有三种方法可以重发你在 `history` 中发现的命令。最简单的方法,特别是当你想重用的命令是最近运行的时候,通常是输入一个 `!` 后面跟上命令中足够多的首字母来唯一地识别它。 + +``` +$ !u +uname -v +#37-Ubuntu SMP Thu Mar 26 20:41:27 UTC 2020 +``` + +另一种简单的重复命令的方法是,只需按上箭头键,直到显示了该命令,然后按回车键。 + +另外,如果你运行 `history` 命令,并看到你想重新运行的命令被列出,你可以输入一个 `!` 后面跟着命令左边显示的序号。 + +``` +$ !209 +uname -v +#37-Ubuntu SMP Thu Mar 26 20:41:27 UTC 2020 +``` + +### 隐藏历史 + +如果你想在一段时间内停止记录命令,你可以使用这个命令: + +``` +$ set +o history +``` + +当你输入 `history` 时,你输入的命令不会显示出来,当你退出会话或退出终端时,它们也不会被添加到你的 `.bash_history` 文件中。 + +要取消这个设置,使用 `set -o history`。 + +要使它永久化,你可以把它添加到你的 `.bashrc` 文件中,尽管不使用命令历史记录通常不是一个好主意。 + +``` +$ echo 'set +o history' >> ~/.bashrc +``` + +要暂时清除历史记录,这样在输入 `history` 时只显示之后输入的命令,可以使用 `history -c`(清除)命令: + +``` +$ history | tail -3 +209 uname -v +210 date +211 man chage +$ history -c +$ history +1 history +``` + +注意:在输入 `history -c` 后输入的命令不会被添加到 `.bash_history` 文件中。 + +### 控制历史 + +许多系统上的 `history` 命令的设置会默认包括一个名为 `$HISTCONTROL` 的变量,以确保即使你连续运行同一命令七次,也只会被记住一次。它还可以确保你在首先输入一个或多个空格后跟着的命令将从你的命令历史记录中忽略。 + +``` +$ grep HISTCONTROL .bashrc +HISTCONTROL=ignoreboth +``` + +`ignoreboth` 的意思是“忽略重复的命令和以空格开头的命令”。例如,如果你输入这些命令: + +``` +$ echo try this +$ date +$ date +$ date +$ pwd +$ history +``` + +你的 `history` 命令应该像这样报告: + +``` +$ history +$ echo try this +$ date +$ history +``` + +请注意,连续的 `date` 命令被缩减为一条,以空格缩进的命令被省略。 + +### 忽略历史 + +要忽略某些命令,使它们在你输入 `history` 时不会出现,也不会被添加到你的 `.bash_history` 文件中,可以使用 `$HISTIGNORE` 设置。例如: + +``` +$ export HISTIGNORE=”history:cd:exit:ls:pwd:man” +``` + +这个设置将导致所有的 `history`、`cd`、`exit`、`ls`、`pwd` 和 `man` 命令从你的 `history` 命令的输出和 `.bash_history` 文件中被忽略。 + +如果你想把这个设置变成永久性的,你必须把它添加到你的 `.bashrc` 文件中。 + +``` +$ echo 'HISTIGNORE="history:cd:exit:ls:pwd:man"' >> .bashrc +``` + +这个设置只是意味着当你回看以前运行的命令时,列表不会被你在查看命令历史记录时不想看到的命令所干扰。 + +### 记住、忽略和忘记过去的命令 + +命令历史记录很有用,因为它可以帮助你记住最近使用过的命令,并提醒你最近所做的更改。它还可以让你更容易地重新运行命令,特别是那些有一串参数但你不一定想重新创建的命令。定制你的历史设置可以让你对命令历史的使用变得更容易,更有效率。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3537214/tweaking-history-on-linux.html + +作者:[Sandra Henry-Stocker][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://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://unsplash.com/photos/iqeG5xA96M4 +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world From cf38017e682fc16cf2997fb1251252391f5983be Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Mon, 7 Sep 2020 16:31:00 +0800 Subject: [PATCH 0032/1156] Translating. --- ...708 6 best practices for teams using Git.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/translated/tech/20200708 6 best practices for teams using Git.md b/translated/tech/20200708 6 best practices for teams using Git.md index 181e730f98..a5b4609770 100644 --- a/translated/tech/20200708 6 best practices for teams using Git.md +++ b/translated/tech/20200708 6 best practices for teams using Git.md @@ -55,28 +55,28 @@ git merge feature-xyz 如果使用“纯合并”策略(上面所说的,不定期 rebase),那么 `master` 分支的历史将穿插着所有同时开发的功能的提交。这样混乱的历史很难回顾。确切的提交时间通常并不是那么重要。最好是有一个易于查看的历史日志。 -### 在合并前整理提交 +### 在合并前压缩提交 -When working on your feature branch, it's fine to add a commit for even minor changes. However, if every feature branch produced 50 commits, the resulting number of commits in the `master` branch could grow unnecessarily large as features are added. In general, there should only be one or a few commits added to `master` from each feature branch. To achieve this, _squash_ multiple commits into one or a handful of commits with more elaborate messages for each one. This is typically done using a command such as: +当你在功能分支上开发时,即使再小的修改也可以作为一个 commit。但是,如果每个个功能分支都要产生五十个 commit,那么随着不断地增添新功能,`master` 分支的 commit 数终将无谓地膨胀。通常来说,每个功能分支只应该往 `master` 中增加一个或几个 commit。为此,你需要将多个 commit 压缩成一个或者几个带有更详细信息的提交中。通常使用以下命令来完成: ``` -`git rebase -i HEAD~20  # look at up to 20 commits to consider squashing` +git rebase -i HEAD~20  # 查看可进行压缩的二十个 commit ``` -When this is executed, an editor pops up with a list of commits that you can act upon in several ways, including _pick_ or _squash_. Picking a commit means keeping that commit message. Squashing implies combining that commit's message into the previous commit. Using these and other options, you can combine commit messages into one and do some editing and cleanup. It's also an opportunity to get rid of the commit messages that aren't important (e.g., a commit message about fixing a typo). +当这条命令执行后,将弹出一个 commit 列表的编辑器,你可以通过包括 _pick_ 或 _squash_ 内的数种方式编辑它。_pick_ 一个 commit 即保留这个 commit。_squash_ 一个 commit 则是将这个 commit 合并到前一个中。使用这些方法,你就可以将多个 commit 合并到一个并做编辑和清理。这也是一个清理不重要的 commit 信息的机会(例如,带错字的提交)。 -In summary, keep all the actions associated with the commits, but combine and edit the associated message text for improved clarity before merging into `master`. Don't inadvertently drop a commit during the rebase process. +总之,保留所有与 commit 相关的操作,但在合并到 `master` 分支前,合并并编辑相关信息以明确意图。注意,不要在 rebase 的过程中不小心删掉 commit。 -After performing such a rebase, I like to look at the `git log` one last time to make final edits: +在执行完诸如 rebase 之类的操作后,我会再次看看 `git log` 并做最终的修改: ``` -`git commit --amend` +git commit --amend ``` -Finally, forcing an update to your remote feature branch is necessary, since the Git commit history for the branch has been rewritten: +最后,由于重写了分支的 Git 提交历史,必需强制更新远程分支: ``` -`git push -f` +git push -f ``` ### 使用标签 From b65413524c37bc075c050897f256f20853367643 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 7 Sep 2020 23:11:03 +0800 Subject: [PATCH 0033/1156] PRF @leommxj --- ...security risks with centralized logging.md | 43 +++++++++---------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/translated/talk/20190226 Reducing security risks with centralized logging.md b/translated/talk/20190226 Reducing security risks with centralized logging.md index 5144cf68ea..fdca17e89d 100644 --- a/translated/talk/20190226 Reducing security risks with centralized logging.md +++ b/translated/talk/20190226 Reducing security risks with centralized logging.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (leommxj) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Reducing security risks with centralized logging) @@ -9,30 +9,29 @@ 通过集中日志记录来减少安全风险 ====== -集中日志并结构化待处理的日志数据可缓解与缺少日志相关的风险 -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security_privacy_lock.png?itok=ZWjrpFzx) +> 集中日志并结构化待处理的日志数据可缓解与缺少日志相关的风险 -日志记录和日志分析对于保护基础设施安全来说至关重要,尤其是当我们考虑到通用漏洞的时候。这篇文章基于我在 FOSDEM'19 上的闪电秀[Let's use centralized log collection to make incident response teams happy][1],目的是提高大家对缺少日志这种安全问题的重视,提供一种避免风险的方法,并且倡议更多的安全实现 _(声明: 我为 NXLog 工作)._ +![](https://img.linux.net.cn/data/attachment/album/202009/07/231016a8v8gva9gmc5hgv9.jpg) -### 为什么收集日志?为什么集中日志记录? +日志记录和日志分析对于保护基础设施安全来说至关重要,尤其是当我们考虑到通用漏洞的时候。这篇文章基于我在 FOSDEM'19 上的闪电秀《[Let's use centralized log collection to make incident response teams happy][1]》,目的是提高大家对日志匮乏这种安全问题的重视,提供一种避免风险的方法,并且倡议更多的安全实践(利益声明: 我为 NXLog 工作)。 -确切的说,日志是写入磁盘的仅追加的记录序列在实际生活中,日志可以在你尝试寻找异常的根源时帮助你调查基础设施问题。当你有多个使用自己标准与格式的日志的异构系统并且想用一种可靠的方法来接收和处理它们的时候,挑战就来临了。这通常以元数据为代价。集中日志记录解决方案需要共性,这种共性常常会去除许多开源日志记录工具所提供的丰富的元数据。 +### 为什么要收集日志?为什么要集中日志记录? -### 缺少日志记录与监控的安全风险 +确切的说,日志是写入磁盘的仅追加的记录序列。在实际生活中,日志可以在你尝试寻找异常的根源时帮助你调查基础设施的问题。当你有多个使用自己的标准与格式的日志的异构系统,并且想用一种可靠的方法来接收和处理它们的时候,挑战就来临了。这通常以元数据为代价的。集中日志记录解决方案需要共性,这种共性常常会去除许多开源日志记录工具所提供的丰富的元数据。 -开源 Web 应用程序安全项目 ([OWASP][2]) 是一个为业界贡献了许多杰出项目(包括许多专注于软件安全的[工具][3])的非营利组织。OWASP定期为应用开发人员和维护者报告危险的安全挑战。在最新一版[10项最严重的 Web 应用程序安全风险][4] 中,OWASP 将不足的日志记录和监控加入了列表中。OWASP 警告下列情况会导致不足的日志记录、检测、监控和响应: +### 日志记录与监控匮乏的安全风险 - * 未记录可审计性事件,如:登录、登录失败和高额交易。 - * 告警和错误事件未能产生或产生不足的和不清晰的日志信息。 +开源 Web 应用程序安全项目Open Web Application Security Project([OWASP][2])是一个为业界贡献了许多杰出项目(包括许多专注于软件安全的[工具][3])的非营利组织。OWASP 定期为应用开发人员和维护者报告最危险的安全挑战。在最新一版《[10 项最严重的 Web 应用程序安全风险][4]》中,OWASP 将日志记录和监控匮乏加入了列表中。OWASP 警告下列情况会导致日志记录、检测、监控和主动响应的匮乏: + + * 未记录重要的可审计性事件,如:登录、登录失败和高额交易。 + * 告警和错误事件未能产生、产生不足或不清晰的日志信息。 * 日志信息仅在本地存储。 - * 对于实时或准实时的攻击,应用程序无法检测、处理和告警。 + * 对于实时或准实时的主动攻击,应用程序无法检测、处理和告警。 +可以通过集中日志记录(例如,不仅将日志本地存储)和结构化日志数据以进一步分析来缓解上述情形(例如,在告警仪表盘和安全套件中)。 - -可以通过集中日志记录(例如, 不仅将日志本地存储)和结构化日志数据来缓解上述情形(例如,在告警仪表盘和安全套件中)。 - -举例来说, 假设一个DNS查询会导向名为 **hacked.badsite.net** 的恶意网站通过 DNS 监控,管理员监控并且主动的分析 DNS 请求与响应。DNS 监控的效果依赖于充足的日志记录与收集来发现潜在问题,同样也依赖于结构化 DNS 日志的结果来进一步分析。 +举例来说, 假设一个 DNS 查询会导向名为 hacked.badsite.net 的恶意网站。通过 DNS 监控,管理员监控并且主动的分析 DNS 请求与响应。DNS 监控的效果依赖于充足的日志记录与收集来发现潜在问题,同样也依赖于结构化 DNS 日志的结果来进一步分析。 ``` 2019-01-29 @@ -40,25 +39,25 @@ Time (GMT)      Source                  Destination           12:42:42.112898 SOURCE_IP               xxx.xx.xx.x             DNS     Standard query 0x1de7  A hacked.badsite.net ``` -你可以在 [NXLog Community Edition][5] 自己尝试一下这个例子也可以尝试其他例子和代码片段。 _(再次声明: 我为 NXLog 工作)._ +你可以在 [NXLog 社区版][5] 中自己尝试一下这个例子,也可以尝试其他例子和代码片段。 (再次声明:我为 NXLog 工作) ### 重要的一点:非结构化数据与结构化数据 -花费一点时间来考虑下日志数据格式是很重要的例如,让我们来考虑以下日志消息: +花费一点时间来考虑下日志数据格式是很重要的。例如,让我们来考虑以下日志消息: ``` debug1: Failed password for invalid user amy from SOURCE_IP port SOURCE_PORT ssh2 ``` -这段日志包含了一个预定义的结构,例如冒号前面的元数据关键词(**debug1**)然而,余下的日志字段是一个未结构化的字符串(**Failed password for invalid user amy from SOURCE_IP port SOURCE_PORT ssh2** )。因此,即便这个消息是人类可轻松阅读的格式,但它不是一个计算机容易解析的格式。 +这段日志包含了一个预定义的结构,例如冒号前面的元数据关键词(`debug1`)然而,余下的日志字段是一个未结构化的字符串(`Failed password for invalid user amy from SOURCE_IP port SOURCE_PORT ssh2`)。因此,即便这个消息是人类可轻松阅读的格式,但它不是一个计算机容易解析的格式。 -非结构化的事件数据存在局限性,包括难以解析,搜索和分析日志。重要的元数据通常以一种自由字符串的形式作为非结构化数据字段,就像上面的例子一样。日志管理员会在他们尝试标准化/归一化日志数据与集中日志源的过程中遇到这个问题。 +非结构化的事件数据存在局限性,包括难以解析、搜索和分析日志。重要的元数据通常以一种自由字符串的形式作为非结构化数据字段,就像上面的例子一样。日志管理员会在他们尝试标准化/归一化日志数据与集中日志源的过程中遇到这个问题。 ### 接下来怎么做 -除了集中和结构化日志之外,确保你收集了正确的日志数据——Sysmon、PowerShell、Windows 事件日志、 DNS 调试日志、ETW、内核监控、文件完整性监控、数据库日志、外部云日志等等。同样选用适当的工具和流程来来收集,汇总和帮助理解数据。 +除了集中和结构化日志之外,确保你收集了正确的日志数据——Sysmon、PowerShell、Windows 事件日志、DNS 调试日志、ETW、内核监控、文件完整性监控、数据库日志、外部云日志等等。同样也要选用适当的工具和流程来来收集、汇总和帮助理解数据。 -希望这对你从不同日志源中集中日志收集提供了一个开始; 将日志发送到仪表盘,监控软件,分析软件以及像安全性资讯与事件管理(SIEM)套件等外部源。 +希望这对你从不同日志源中集中日志收集提供了一个起点:将日志发送到仪表盘、监控软件、分析软件以及像安全性资讯与事件管理(SIEM)套件等外部源。 你的集中日志策略会是怎么样?请在评论中分享你的想法。 @@ -69,7 +68,7 @@ via: https://opensource.com/article/19/2/reducing-security-risks-centralized-log 作者:[Hannah Suarez][a] 选题:[lujun9972][b] 译者:[leommxj](https://github.com/leommxj) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From c2118b416062df0d27d50b4ec7946a498effdad6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 7 Sep 2020 23:11:36 +0800 Subject: [PATCH 0034/1156] PUB @leommxj https://linux.cn/article-12591-1.html --- ...190226 Reducing security risks with centralized logging.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20190226 Reducing security risks with centralized logging.md (98%) diff --git a/translated/talk/20190226 Reducing security risks with centralized logging.md b/published/20190226 Reducing security risks with centralized logging.md similarity index 98% rename from translated/talk/20190226 Reducing security risks with centralized logging.md rename to published/20190226 Reducing security risks with centralized logging.md index fdca17e89d..030f7450ed 100644 --- a/translated/talk/20190226 Reducing security risks with centralized logging.md +++ b/published/20190226 Reducing security risks with centralized logging.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (leommxj) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12591-1.html) [#]: subject: (Reducing security risks with centralized logging) [#]: via: (https://opensource.com/article/19/2/reducing-security-risks-centralized-logging) [#]: author: (Hannah Suarez https://opensource.com/users/hcs) From b789e896935084f349d9c6b011d137e33ee4a129 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 7 Sep 2020 23:30:44 +0800 Subject: [PATCH 0035/1156] PRF @wxy --- ...half the world-s mass by 2245, says researcher.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/translated/talk/20200827 Information could be half the world-s mass by 2245, says researcher.md b/translated/talk/20200827 Information could be half the world-s mass by 2245, says researcher.md index 0bcd47ab61..a04c50cf34 100644 --- a/translated/talk/20200827 Information could be half the world-s mass by 2245, says researcher.md +++ b/translated/talk/20200827 Information could be half the world-s mass by 2245, says researcher.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Information could be half the world's mass by 2245, says researcher) @@ -12,13 +12,15 @@ > 根据一位理论物理学家的说法,由于创建和存储数字信息所使用的能源和资源数量,数据应该被视为物理的,而不仅仅是看不见的一和零。 +![](https://images.idgesg.net/images/article/2019/07/global_connections_digital_world_map_planet_earth_particles_light_by_luza_studios_gettyimages-1022793086_2400x1600-100806717-large.jpg) + 一位大学学者建议,数字内容应该与气体、液体、等离子体和固体一样,被视为第五种物质状态。 英国朴茨茅斯大学高级讲师、发表在《AIP Advances》杂志上的《[信息灾难][1]》一文的作者 Melvin Vopson 称,由于以物理和数字方式创建、存储和分发数据所使用的能量和资源,数据已经发生了演变,现在应该被视为质量。 Vopson 还声称,数字比特正在走向压倒地球的道路,最终将超过原子的数量。 -给数字信息分配质量的想法建立在一些现有数据点的基础上。Vopson 引用了 IBM 的一项估计,发现数据每天以 2.5 万亿字节的速度产生。他还将每英寸超过 1 太比特terabit的数据存储密度考虑在内,将比特的大小与原子的大小进行比较。 +给数字信息分配质量的想法建立在一些现有数据点的基础之上。Vopson 引用了 IBM 的一项估计,发现数据每天以 2.5 万亿字节的速度产生。他还将每英寸超过 1 太比特terabit的数据存储密度考虑在内,将比特的大小与原子的大小进行比较。 假设数据生成量每年增长 50%,根据宣布 Vopson 研究的[媒体发布][2],“比特的数量将在大约 150 年内等于地球上的原子数量。” @@ -26,7 +28,7 @@ Vopson 还声称,数字比特正在走向压倒地球的道路,最终将超 Vopson 补充说,COVID-19 大流行正在提高数字数据创造的速度,并加速这一进程。 -他警告说,一个饱和点即将到来:“即使假设未来的技术进步将比特大小降低到接近原子本身的大小,这个数字信息量所占的比重将超过地球的大小,从而导致我们所定义的信息灾难。”Vopson 在[论文][3]中写道。 +他警告说,一个饱和点即将到来:“即使假设未来的技术进步将比特大小降低到接近原子本身的大小,这个数字信息量所占的比重将超过地球的大小,从而导致我们所定义的‘信息灾难’。”Vopson 在[论文][3]中写道。 “我们正在一点一点地改变这个星球,这是一场看不见的危机,”Vopson 说,他是希捷科技公司的前研发科学家。 @@ -36,7 +38,7 @@ Vopson 并不是一个人在探索,信息并不是简单的不可察觉的 1 他的论文总结道,随着增长速度似乎不可阻挡,数字信息生产“将消耗地球上大部分的电力能源,从而导致道德和环境问题。”他的论文总结道。 -有趣的是,除此以外,Vopson 还提出,如果像他所预测的那样,未来地球的质量主要由信息位组成,并且存在足够的动力创造出来(不确定),那么“可以设想未来的世界主要由计算机模拟,并由数字比特和计算机代码主导,”他写道。 +有趣的是,除此以外,Vopson 还提出,如果像他所预测的那样,未来地球的质量主要由信息位组成,并且有足够的动力创造出来(不确定),那么“可以设想未来的世界主要由计算机模拟,并由数字比特和计算机代码主导,”他写道。 -------------------------------------------------------------------------------- @@ -45,7 +47,7 @@ via: https://www.networkworld.com/article/3570438/information-could-be-half-the- 作者:[Patrick Nelson][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From b65fd3ee9db3850de6bc0f668194f8926388f1f6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 7 Sep 2020 23:31:14 +0800 Subject: [PATCH 0036/1156] PUB @wxy https://linux.cn/article-12592-1.html --- ...could be half the world-s mass by 2245, says researcher.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20200827 Information could be half the world-s mass by 2245, says researcher.md (98%) diff --git a/translated/talk/20200827 Information could be half the world-s mass by 2245, says researcher.md b/published/20200827 Information could be half the world-s mass by 2245, says researcher.md similarity index 98% rename from translated/talk/20200827 Information could be half the world-s mass by 2245, says researcher.md rename to published/20200827 Information could be half the world-s mass by 2245, says researcher.md index a04c50cf34..4cd711cf56 100644 --- a/translated/talk/20200827 Information could be half the world-s mass by 2245, says researcher.md +++ b/published/20200827 Information could be half the world-s mass by 2245, says researcher.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12592-1.html) [#]: subject: (Information could be half the world's mass by 2245, says researcher) [#]: via: (https://www.networkworld.com/article/3570438/information-could-be-half-the-worlds-mass-by-2245-says-researcher.html) [#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) From 410fe20aa0e2583c45dc7605e6d37c918ebcaaec Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 8 Sep 2020 05:01:48 +0800 Subject: [PATCH 0037/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200907?= =?UTF-8?q?=20A=20beginner=E2=80=99s=20guide=20to=20SSH=20for=20remote=20c?= =?UTF-8?q?onnection=20on=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200907 A beginner-s guide to SSH for remote connection on Linux.md --- ...e to SSH for remote connection on Linux.md | 183 ++++++++++++++++++ 1 file changed, 183 insertions(+) create mode 100644 sources/tech/20200907 A beginner-s guide to SSH for remote connection on Linux.md diff --git a/sources/tech/20200907 A beginner-s guide to SSH for remote connection on Linux.md b/sources/tech/20200907 A beginner-s guide to SSH for remote connection on Linux.md new file mode 100644 index 0000000000..64c7c297b7 --- /dev/null +++ b/sources/tech/20200907 A beginner-s guide to SSH for remote connection on Linux.md @@ -0,0 +1,183 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A beginner’s guide to SSH for remote connection on Linux) +[#]: via: (https://opensource.com/article/20/9/ssh) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +A beginner’s guide to SSH for remote connection on Linux +====== +Establish connections with remote computers using secure shell. +![woman on laptop sitting at the window][1] + +One of Linux's most appealing features is the ability to skillfully use a computer with nothing but commands entered into the keyboard—and better yet, to be able to do that on computers anywhere in the world. Thanks to OpenSSH, [POSIX][2] users can open a secure shell on any computer they have permission to access and use it from a remote location. It's a daily task for many Linux users, but it can be confusing for someone who has yet to try it. This article explains how to configure two computers for secure shell (SSH) connections, and how to securely connect from one to the other without a password. + +### Terminology + +When discussing more than one computer, it can be confusing to identify one from the other. The IT community has well-established terms to help clarify descriptions of the process of networking computers together. + + * **Service:** A service is software that runs in the background so it can be used by computers other than the one it's installed on. For instance, a web server hosts a web-sharing _service_. The term implies (but does not insist) that it's software without a graphical interface. + * **Host:** A host is any computer. In IT, computers are called a _host_ because technically any computer can host an application that's useful to some other computer. You might not think of your laptop as a "host," but you're likely running some service that's useful to you, your mobile, or some other computer. + * **Local:** The local computer is the one you or some software is using. Every computer refers to itself as `localhost`, for example. + * **Remote:** A remote computer is one you're not physically in front of nor physically using. It's a computer in a _remote_ location. + + + +Now that the terminology is settled, you can begin. + +### Activate SSH on each host + +For two computers to be connected over SSH, each host must have SSH installed. SSH has two components: the command you use on your local machine to start a connection, and a _server_ to accept incoming connection requests. Some computers come with one or both parts of SSH already installed. The commands vary, depending on your system, to verify whether you have both the command and the server installed, so the easiest method is to look for the relevant configuration files: + + +``` +$ file /etc/ssh/ssh_config +/etc/ssh/ssh_config: ASCII text +``` + +Should this return a `No such file or directory` error, then you don't have the SSH command installed. + +Do a similar check for the SSH service (note the `d` in the filename): + + +``` +$ file /etc/ssh/sshd_config +/etc/ssh/sshd_config: ASCII text +``` + +Install one or the other, as needed: + + +``` +`$ sudo dnf install openssh-clients openssh-server` +``` + +On the remote computer, enable the SSH service with systemd: + + +``` +`$ sudo systemctl enable --now sshd` +``` + +Alternately, you can enable the SSH service from within **System Settings** on GNOME or **System Preferences** on macOS. On the GNOME desktop, it's located in the **Sharing** panel: + +![Activate SSH in GNOME System Settings][3] + +(Seth Kenlon, [CC BY-SA 4.0][4]) + +### Start a secure shell + +Now that you've installed and enabled SSH on the remote computer, you can try logging in with a password as a test. To access the remote computer, you must have a user account and a password. + +Your remote user doesn't have to be the same as your local user. You can log in as any user on the remote machine as long as you have that user's password. For instance, I'm `sethkenlon` on my work computer, but I'm `seth` on my personal computer. If I'm on my personal computer (making it my current local machine) and I want to SSH into my work computer, I can do that by identifying myself as `sethkenlon` and using my work password. + +To SSH into the remote computer, you must know its internet protocol (IP) address or its resolvable hostname. To find the remote machine's IP address, use the `ip` command (on the remote computer): + + +``` +$ ip addr show | grep "inet " +inet 127.0.0.1/8 scope host lo +inet 10.1.1.5/27 brd 10.1.1.31 [...] +``` + +If the remote computer doesn't have the `ip` command, try `ifconfig` instead (or even `ipconfig` on Windows). + +The address 127.0.0.1 is a special one and is, in fact, the address of `localhost`. It's a "loopback" address, which your system uses to reach itself. That's not useful when logging into a remote machine, so in this example, the remote computer's correct IP address is 10.1.1.5. In real life, I would know that because my local network uses the 10.1.1.0 subnet. If the remote computer is on a different network, then the IP address could be nearly anything (never 127.0.0.1, though), and some special routing is probably necessary to reach it through various firewalls. Assume your remote computer is on the same network, but if you're interested in reaching computers more remote than your own network, [read my article about opening ports in your firewall][5]. + +If you can ping the remote machine by its IP address _or_ its hostname, and have a login account on it, then you can SSH into it: + + +``` +$ ping -c1 10.1.1.5 +PING 10.1.1.5 (10.1.1.5) 56(84) bytes of data. +64 bytes from 10.1.1.5: icmp_seq=1 ttl=64 time=4.66 ms +$ ping -c1 akiton.local +PING 10.1.1.5 (10.1.1.5) 56(84) bytes of data. +``` + +That's a success. Now use SSH to log in: + + +``` +$ whoami +seth +$ ssh sethkenlon@10.1.1.5 +bash$ whoami +sethkenlon +``` + +The test login works, so now you're ready to activate passwordless login. + +### Create an SSH key + +To log in securely to another computer without a password, you must have an SSH key. You may already have an SSH key, but it doesn't hurt to create a new one. An SSH key begins its life on your local machine. It consists of two components: a private key, which you never share with anyone or anything, and a public one, which you copy onto any remote machine you want to have passwordless access to. + +Some people create one SSH key and use it for everything from remote logins to GitLab authentication. However, I use different keys for different groups of tasks. For instance, I use one key at home to authenticate to local machines, a different key to authenticate to web servers I maintain, a separate one for Git hosts, another for Git repositories I host, and so on. In this example, I'll create a unique key to use on computers within my local area network. + +To create a new SSH key, use the `ssh-keygen` command: + + +``` +`$ ssh-keygen -t ed25519 -f ~/.ssh/lan` +``` + +The `-t` option stands for _type_ and ensures that the encryption used for the key is higher than the default. The `-f` option stands for _file_ and sets the key's file name and location. After running this command, you're left with an SSH private key called `lan` and an SSH public key called `lan.pub`. + +To get the public key over to your remote machine, use the `ssh-copy-id`. For this to work, you must verify that you have SSH access to the remote machine. If you can't log into the remote host with a password, you can't set up passwordless login either: + + +``` +`$ ssh-copy-id -i ~/.ssh/lan.pub sethkenlon@10.1.1.5` +``` + +During this process, you'll be prompted for your login password on the remote host. + +Upon success, try logging in again, but this time using the `-i` option to point the SSH command to the appropriate key (`lan`, in this example): + + +``` +$ ssh -i ~/.ssh/lan sethkenlon@10.1.1.5 +bash$ whoami +sethkenlon +``` + +Repeat this process for all computers on your network, and you'll be able to wander through each host without ever thinking about passwords again. In fact, once you have passwordless authentication set up, you can edit the `/etc/ssh/sshd_config` file to disallow password authentication. This prevents anyone from using SSH to authenticate to a computer unless they have your private key. To do this, open `/etc/ssh/sshd_config` in a text editor with `sudo` permissions and search for the string `PasswordAuthentication`. Change the default line to this: + + +``` +`PasswordAuthentication no` +``` + +Save it and restart the SSH server (or just reboot): + + +``` +$ sudo systemctl restart sshd && echo "OK" +OK +$ +``` + +### Using SSH every day + +OpenSSH changes your view of computing. No longer are you bound to just the computer in front of you. With SSH, you have access to any computer in your house, or servers you have accounts on, and even mobile and Internet of Things devices. Unlocking the power of SSH also unlocks the power of the Linux terminal. If you're not using SSH every day, start now. Get comfortable with it, collect some keys, live more securely, and expand your world. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/ssh + +作者:[Seth Kenlon][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://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-window-focus.png?itok=g0xPm2kD (young woman working on a laptop) +[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains +[3]: https://opensource.com/sites/default/files/uploads/gnome-activate-remote-login.png (Activate SSH in GNOME System Settings) +[4]: https://creativecommons.org/licenses/by-sa/4.0/ +[5]: https://opensource.com/article/20/8/open-ports-your-firewall From 50b7a03b0e2c95d6cc45b54777f9e6f58cf539ad Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 8 Sep 2020 05:02:01 +0800 Subject: [PATCH 0038/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200907?= =?UTF-8?q?=20Program=20hardware=20from=20the=20Linux=20command=20line?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200907 Program hardware from the Linux command line.md --- ...am hardware from the Linux command line.md | 239 ++++++++++++++++++ 1 file changed, 239 insertions(+) create mode 100644 sources/tech/20200907 Program hardware from the Linux command line.md diff --git a/sources/tech/20200907 Program hardware from the Linux command line.md b/sources/tech/20200907 Program hardware from the Linux command line.md new file mode 100644 index 0000000000..5076b3025a --- /dev/null +++ b/sources/tech/20200907 Program hardware from the Linux command line.md @@ -0,0 +1,239 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Program hardware from the Linux command line) +[#]: via: (https://opensource.com/article/20/9/hardware-command-line) +[#]: author: (Alan Smithee https://opensource.com/users/alansmithee) + +Program hardware from the Linux command line +====== +Programming hardware has become more common thanks to the rise of the +Internet of Things (IoT). RT-Thread lets you contact devices from the +Linux command line with FinSH. +![Command line prompt][1] + +RT-Thread is an open source [real-time operating system][2] used for programming Internet of Things (IoT) devices. FinSH is [RT-Thread][3]'s command-line component, and it provides a set of operation interfaces enabling users to contact a device from the command line. It's mainly used to debug or view system information. + +Usually, development debugging is displayed using hardware debuggers and `printf` logs. In some cases, however, these two methods are not very useful because it's abstracted from what's running, and they can be difficult to parse. RT-Thread is a multi-thread system, though, which is helpful when you want to know the state of a running thread, or the current state of a manual control system. Because it's multi-threaded, you're able to have an interactive shell, so you can enter commands, call a function directly on the device to get the information you need, or control the program's behavior. This may seem ordinary to you if you're only used to modern operating systems such as Linux or BSD, but for hardware hackers this is a profound luxury, and a far cry from wiring serial cables directly onto boards to get glimpses of errors. + +FinSH has two modes: + + * A C-language interpreter mode, known as c-style + * A traditional command-line mode, known as `msh` (module shell) + + + +In the C-language interpretation mode, FinSH can parse expressions that execute most of the C language and access functions and global variables on the system using function calls. It can also create variables from the command line. + +In `msh` mode, FinSH operates similarly to traditional shells such as Bash. + +### The GNU command standard + +When we were developing FinSH, we learned that before you can write a command-line application, you need to become familiar with GNU command-line standards. This framework of standard practices helps bring familiarity to an interface, which helps developers feel comfortable and productive when using it. + +A complete GNU command consists of four main parts: + + 1. **Command name (executable):** The name of the command line program + 2. **Sub-command:** The sub-function name of the command program + 3. **Options:** Configuration options for the sub-command function + 4. **Arguments:** The corresponding arguments for the configuration options of the sub-command function + + + +You can see this in action with any command. Taking Git as an example: + + +``` +`git reset --hard HEAD~1` +``` + +Which breaks down as: + +![GNU command line standards][4] + +(Cathy, [CC BY-SA 4.0][5]) + +The executable command is **git**, the sub-command is **reset**, the option used is **\--head**, and the argument is **HEAD~1**. + +Another example: + + +``` +`systemctl enable --now firewalld` +``` + +The executable command is **systemctl**, the sub-command is **enable**, the option is **\--now**, and the argument is **firewalld**. + +Imagine you want to write a command-line program that complies with the GNU standards using RT-Thread. FinSH has everything you need, and will run your code as expected. Better still, you can rely on this compliance so you can confidently port your favorite Linux programs. + +### Write an elegant command-line program + +Here's an example of RT-Thread running a command that RT-Thread developers use every day. + + +``` +usage: env.py package [-h] [--force-update] [--update] [--list] [--wizard] +                      [--upgrade] [--printenv] + +optional arguments: +  -h, --help      show this help message and exit +  --force-update  force update and clean packages, install or remove the +                  packages by your settings in menuconfig +  --update        update packages, install or remove the packages by your +                  settings in menuconfig +  --list          list target packages +  --wizard        create a new package with wizard +  --upgrade       upgrade local packages list and ENV scripts from git repo +  --printenv      print environmental variables to check +``` + +As you can tell, it looks familiar and acts like most POSIX applications that you might already run on Linux or BSD. Help is provided when incorrect or insufficient syntax is used, both long and short options are supported, and the general user interface is familiar to anyone who's used a Unix terminal. + +### Kinds of options + +There are many different kinds of options, and they can be divided into two main categories by length: + + 1. **Short options:** Consist of one hyphen plus a single letter, e.g., the `-h` option in `pkgs -h` + 2. **Long options:** Consist of two hyphens plus words or letters, e.g., the `--target` option in `scons- --target-mdk5` + + + +You can divide these options into three categories, determined by whether they have arguments: + + 1. **No arguments:** The option cannot be followed by arguments + 2. **Arguments must be included:** The option must be followed by arguments + 3. **Arguments optional:** Arguments after the option are allowed but not required + + + +As you'd expect from most Linux commands, FinSH option parsing is pretty flexible. It can distinguish an option from an argument based on a space or equal sign as delimiter, or just by extracting the option itself and assuming that whatever follows is the argument (in other words, no delimiter at all): + + * `wavplay -v 50` + * `wavplay -v50` + * `wavplay --vol=50` + + + +### Using optparse + +If you've ever written a command-line application, you may know there's generally a library or module for your language of choice called optparse. It's provided to programmers so that options (such as **-v** or **\--verbose**) entered as part of a command can be _parsed_ in relation to the rest of the command. It's what helps your code know an option from a sub-command or argument. + +When writing a command for FinSH, the `optparse` package expects this format: + + +``` +`MSH_CMD_EXPORT_ALIAS(pkgs, pkgs, this is test cmd.);` +``` + +You can implement options using the long or short form, or both. For example: + + +``` +static struct optparse_long long_opts[] = +{ +    {"help"        , 'h', OPTPARSE_NONE}, // Long command: help, corresponding to short command h, without arguments. +    {"force-update",  0 , OPTPARSE_NONE}, // Long comman: force-update, without arguments +    {"update"      ,  0 , OPTPARSE_NONE}, +    {"list"        ,  0 , OPTPARSE_NONE}, +    {"wizard"      ,  0 , OPTPARSE_NONE}, +    {"upgrade"     ,  0 , OPTPARSE_NONE}, +    {"printenv"    ,  0 , OPTPARSE_NONE}, +    { NULL         ,  0 , OPTPARSE_NONE} +}; +``` + +After the options are created, write the command and instructions for each option and its arguments: + + +``` +static void usage(void) +{ +    rt_kprintf("usage: env.py package [-h] [--force-update] [--update] [--list] [--wizard]\n"); +    rt_kprintf("                      [--upgrade] [--printenv]\n\n"); +    rt_kprintf("optional arguments:\n"); +    rt_kprintf("  -h, --help      show this help message and exit\n"); +    rt_kprintf("  --force-update  force update and clean packages, install or remove the\n"); +    rt_kprintf("                  packages by your settings in menuconfig\n"); +    rt_kprintf("  --update        update packages, install or remove the packages by your\n"); +    rt_kprintf("                  settings in menuconfig\n"); +    rt_kprintf("  --list          list target packages\n"); +    rt_kprintf("  --wizard        create a new package with wizard\n"); +    rt_kprintf("  --upgrade       upgrade local packages list and ENV scripts from git repo\n"); +    rt_kprintf("  --printenv      print environmental variables to check\n"); +} +``` + +The next step is parsing. While you can't implement its functions yet, the framework of the parsed code is the same: + + +``` +int pkgs(int argc, char **argv) +{ +    int ch; +    int option_index; +    struct optparse options; + +    if(argc == 1) +    { +        usage(); +        return RT_EOK; +    } + +    optparse_init(&options, argv); +    while((ch = optparse_long(&options, long_opts, &option_index)) != -1) +    { +        ch = ch; + +        rt_kprintf("\n"); +        rt_kprintf("optopt = %c\n", options.optopt); +        rt_kprintf("optarg = %s\n", options.optarg); +        rt_kprintf("optind = %d\n", options.optind); +        rt_kprintf("option_index = %d\n", option_index); +    } +    rt_kprintf("\n"); + +    return RT_EOK; +} +``` + +Here is the function head file: + + +``` +#include "optparse.h" +#include "finsh.h" +``` + +Then, compile and download onto a device. + +![Output][6] + +(Cathy, [CC BY-SA 4.0][5]) + +### Hardware hacking + +Programming hardware can seem intimidating, but with IoT it's becoming more and more common. Not everything can or should be run on a Raspberry Pi, but with RT-Thread you can maintain a familiar Linux feel, thanks to FinSH. + +If you're curious about coding on bare metal, give RT-Thread a try. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/hardware-command-line + +作者:[Alan Smithee][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://opensource.com/users/alansmithee +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/command_line_prompt.png?itok=wbGiJ_yg (Command line prompt) +[2]: https://opensource.com/article/20/6/open-source-rtos +[3]: https://github.com/RT-Thread/rt-thread +[4]: https://opensource.com/sites/default/files/uploads/command-line-apps_2.png (GNU command line standards) +[5]: https://creativecommons.org/licenses/by-sa/4.0/ +[6]: https://opensource.com/sites/default/files/uploads/command-line-apps_3.png (Output) From 83eb039ebb32eafa7c7970816f9a167fa7c3a1a4 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 8 Sep 2020 08:44:51 +0800 Subject: [PATCH 0039/1156] translated --- ...ith Cloud Services in Linux Graphically.md | 136 ------------------ ...ith Cloud Services in Linux Graphically.md | 136 ++++++++++++++++++ 2 files changed, 136 insertions(+), 136 deletions(-) delete mode 100644 sources/tech/20200903 Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically.md create mode 100644 translated/tech/20200903 Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically.md diff --git a/sources/tech/20200903 Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically.md b/sources/tech/20200903 Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically.md deleted file mode 100644 index 0de782e949..0000000000 --- a/sources/tech/20200903 Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically.md +++ /dev/null @@ -1,136 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically) -[#]: via: (https://itsfoss.com/rclone-browser/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically -====== - -_**Brief: Rclone Browser is an effective GUI program that makes it easy to manage and sync data on cloud storage using Rclone. Here, we take a look at what it offers and how it works.**_ - -If you want to use One Drive or [Google Drive on Linux][1] natively and effortlessly, you can opt for a premium GUI tool like [Insync][2] ([affiliate][3] link). - -If you can put some effort in the terminal, you can use [Rclone][4] to sync with many [cloud storage services on Linux][5]. We have a detailed [guide on using Rclone for syncing with OneDrive in Linux][6]. - -[Rclone][4] is a pretty popular and useful command-line tool. A lot of power users will need to use Rclone for its features. - -However, not everyone is comfortable using it from the terminal even if it’s useful enough. - -So, in this article, I’ll talk about an impressive GUI “Rclone Browser” that makes it easy to manage and sync your data on cloud storage using Rclone. - -It is also worth noting that Rclone does offer an experimental web-based GUI — but we are going to focus on [Rclone Browser][7] here. - -![][8] - -### Rclone Browser: An Open-Source GUI for Rclone - -Rclone Browser is a GUI that lets you browse, modify, upload/download, list files, and do a lot more stuff that you’d want to do when you want to make the most out of managing a remote storage location. - -It offers a simple user interface and works just fine (as per my quick test). Let’s take a detailed look at the features it offers and how to get started using it. - -### Features of Rclone Browser - -![][9] - -It offers a lot of options and control to manage remote storage locations. You may find it feature-rich or overwhelming depending on your use-case. Here they are: - - * Browse and modify rclone remote storage locations - * Encrypted cloud storage supported - * Custom location and encryption for configuration supported - * No extra configuration required. It will use the same rclone configuration files (if you have any). - * Simultaneous navigation of multiple locations in separate tabs - * List files hierarchically (by file name, size, and modified date) - * Rclone commands are executed asynchronously without the GUI freezing - * You get the ability to upload, download, create new folders, rename, delete files and folders - * Drag and drop support for dragging files while uploading - * Streaming media files in player like VLC - * Mount and unmount folders/cloud drives - * Ability to calculate size of folder, export list of files, and copy rclone commands to clipboard - * Supports portable mode - * Supports shared drivers (if you’re using Google Drive) - * Gives you the ability to have public link sharing option for remote storage services that offers it - * Ability to create tasks that you can easily save to run it again or edit it later - * Dark mode - * Cross-platform support (Windows, macOS, and Linux) - - - -### Installing Rclone Browser on Linux - -_You need to have rclone installed on your Linux distribution before you use Rclone Browser. Follow the [official installation instructions][10] to do that._ - -You will find an AppImage file available for Rclone Browser from the [releases section][11] of its [GitHub page][7]. So, you shouldn’t have an issue running it on any Linux distribution. - -In case you didn’t know about AppImage, I’ll recommend going through our guide to [use AppImage on Linux][12]. - -You can also choose to build it as well. The instructions to do that is in the GitHub page. - -[Rclone Browser][7] - -### Getting Started With Rclone Browser - -Here, I’ll just share a few things that you should know to get started using Rclone Browser. - -![][13] - -If you had any existing remote locations using rclone in the terminal, it will automatically show up in the GUI. You can also hit the “**Refresh**” button to get the latest additions. - -As shown in the screenshot above, when you click the “**Config**” button it launches the terminal that lets you easily add a new remote or configure it as you want. Don’t worry when the terminal pops up, Rclone browser executes the commands to do all the necessary tasks, you just have to set up or edit a few things when needed. You don’t need to execute any Rclone commands. - -If you have some existing remotes, you can simply open them using the “**Open**” button and have the cloud storage accessible in a different tab as shown below. - -![][14] - -You can easily mount the cloud drive, upload/download files, get the details, share a public link for a folder (if supported), and directly stream media files as well. - -If you want to copy, move, or sync data with a remote storage location, you can simply create a task to do it. Just to make sure that you have the right settings, you can perform a dry run or go ahead with running the task. - -You can find all the running tasks under the “**Jobs**” section and you can cancel/stop them if needed. - -![][15] - -In addition to all the basic functionalities mentioned above, you can just head to **File->Preferences** to change the rclone location, mount option, download folder, bandwidth settings, and proxy as well. - -![][16] - -To learn more about its usage and features, you might want to check out the [GitHub page][7] for all the technical information. - -### Wrapping Up - -Rclone Browser should definitely come in handy for every Linux user looking to use Rclone for its powerful features. - -Have you tried it yet? Do you prefer using the GUI or the terminal for using rclone? Let me know your thoughts in the comments below! - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/rclone-browser/ - -作者:[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/use-google-drive-linux/ -[2]: https://itsfoss.com/recommends/insync/ -[3]: https://itsfoss.com/affiliate-policy/ -[4]: https://rclone.org/ -[5]: https://itsfoss.com/cloud-services-linux/ -[6]: https://itsfoss.com/use-onedrive-linux-rclone/ -[7]: https://github.com/kapitainsky/RcloneBrowser -[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/Cloud-sync.gif?resize=800%2C450&ssl=1 -[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/rclone-browser-screenshot.jpg?resize=800%2C618&ssl=1 -[10]: https://rclone.org/install/ -[11]: https://github.com/kapitainsky/RcloneBrowser/releases/tag/1.8.0 -[12]: https://itsfoss.com/use-appimage-linux/ -[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/rclone-browser-howto.png?resize=800%2C412&ssl=1 -[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/rclone-browser-drive.png?resize=800%2C505&ssl=1 -[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/rclone-browser-task.jpg?resize=800%2C493&ssl=1 -[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/rclone-browser-preferences.jpg?resize=800%2C590&ssl=1 diff --git a/translated/tech/20200903 Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically.md b/translated/tech/20200903 Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically.md new file mode 100644 index 0000000000..82ecbaa231 --- /dev/null +++ b/translated/tech/20200903 Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically.md @@ -0,0 +1,136 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically) +[#]: via: (https://itsfoss.com/rclone-browser/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Rclone Browser 让你在 Linux 中以图形化的方式与云服务同步数据 +====== + +_**简介:Rclone Browser 是一款高效的 GUI 程序,它可以让你轻松地使用 Rclone 管理和同步云存储上的数据。在这里,我们来看看它提供的功能和工作方式。**_ + +如果你想原生地在 Linux上毫不费力地使用 One Drive 或[Google Drive][1],你可以选择像 [Insync][2] 这样的高级 GUI 工具([联盟][3]链接)。 + +如果你能在终端上下功夫,你可以使用 [Rclone][4] 与许多 [Linux 上的云存储服务][5]进行同步。我们有一份详细的[在 Linux 中使用 Rclone 与 OneDrive 同步的指南][6]。 + +[Rclone][4] 是一个相当流行且有用的命令行工具。很多有经验的用户会需要使用 Rclone 的功能。 + +然而,即使它足够有用,也不是每个人都能从终端使用它。 + +因此,在本文中,我将介绍一个令人印象深刻的 GUI ”Rclone Browser”“,它可以让你轻松地使用 Rclone 管理和同步云存储上的数据。 + +值得注意的是,Rclone 确实提供了一个实验性的基于 Web 的 GUI。但我们将在这里专注于 [Rclone Browser][7]。 + +![][8] + +### Rclone Browser:Rclone 的开源 GUI + +Rclone Browser 是一款可以让你浏览、修改、上传/下载、列出文件,并在想充分利用远程存储位置的情况下,做更多你想做的事情的 GUI。 + +它提供了一个简单的用户界面,并且工作良好(根据我的快速测试)。让我们详细看看它提供的功能以及如何开始使用它。 + +### Rclone Browse r的功能 + +![][9] + +它提供了很多选项和控制来管理远程存储位置。根据你的使用情况,你可能会发现它的功能丰富或不知所措。以下是它的功能: + + * 浏览和修改 rclone 远程存储位置。 + * 支持加密云存储 + * 支持自定义位置和配置加密 + * 不需要额外的配置。它将使用相同的 rclone 配置文件(如果你有的话) + * 在不同的标签页中同时导航多个位置 + * 按层次列出文件(按文件名、大小和修改日期) + * Rclone 命令的执行是异步的,不会使 GUI 冻结 + * 你可以上传、下载、创建新文件夹、重命名、删除文件和文件夹 + * 上传文件时支持拖放 + * 在 VLC 等播放器中播放流媒体文件 + * 挂载和卸载文件夹/云端驱动器 + * 能够计算文件夹的大小、导出文件列表,并将 rclone 命令复制到剪贴板 + * 支持便携模式 + * 支持共享驱动器(如果你使用 Google Drive)。 + * 针对支持共享链接的远程存储服务,支持获取共享链接 + * 能够创建任务,你可以很容易地保存,以便以后再次运行或编辑。 + * 黑暗模式 + * 跨平台支持(Windows、macOS 和 Linux)。 + + + +### 在 Linux 上安装 Rclone Browser + +_在使用 Rclone Browser 之前,你需要在你的 Linux 发行版上安装 rclone。请按照[官方安装说明][10]来安装。_ + +你可以在 [GitHub 页面][7]的[发布页][11]找到 Rclone Browser 的 AppImage 文件。所以,你在任何 Linux 发行版上运行它都不会有问题。 + +如果你不知道 AppImage,我会推荐你阅读我们的[在 Linux 上使用 AppImage][12] 指南。 + +你也可以选择构建它。操作说明在 GitHub 页面上。 + +[Rclone Browser][7] + +### 开始使用Rclone Browser + +在这里,我只分享一下使用 Rclone Browser 应该知道的几件事。 + +![][13] + +如果你在终端中使用 rclone 时有任何现有的远程位置,它将自动显示在 GUI 中。你也可以点击 ”**Refresh**“ 按钮来获取最新的新增内容。 + +如上图所示,当你点击 ”**Config**“ 按钮时,它会启动终端,让你轻松地添加一个新的远程或按你的要求配置它。当终端弹出的时候不用担心,Rclone browser 会执行命令来完成所有必要的任务,你只需要在需要的时候设置或编辑一些东西。你不需要执行任何 Rclone 命令。 + +如果你有一些现有的远程位置,你可以使用 ”**Open**“ 按钮打开它们,并在不同的标签页中访问云存储,如下所示。 + +![][14] + +你可以轻松地挂载云驱动器,上传/下载文件,获取详细信息,共享文件夹的公共链接(如果支持),以及直接播放流媒体文件。 + +如果你想复制、移动或与远程存储位置同步数据,你可以简单地创建一个任务来完成。只需确保设置正确,你可以模拟执行或者直接运行任务。 + +你可以在 ”**Jobs**“ 页面找到所有正在运行的任务,如果需要,你可以取消/停止它们。 + +![][15] + +除了上面提到的所有基本功能外,你可以前往 **File->Preferences** 更改 rclone 位置、挂载选项、下载文件夹、带宽设置以及代理。 + +![][16] + +要了解更多关于它的用法和功能,你可能需要前往 [GitHub 页面][7]了解所有的技术信息。 + +### 总结 + +Rclone Browser 对于每一位想要使用 Rclone 强大功能的 Linux 用户来说,绝对是得心应手。 + +你是否已经尝试过了呢?你更喜欢通过 GUI 还是终端来使用 Rclone?请在下面的评论中告诉我你的想法! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/rclone-browser/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者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/use-google-drive-linux/ +[2]: https://itsfoss.com/recommends/insync/ +[3]: https://itsfoss.com/affiliate-policy/ +[4]: https://rclone.org/ +[5]: https://itsfoss.com/cloud-services-linux/ +[6]: https://itsfoss.com/use-onedrive-linux-rclone/ +[7]: https://github.com/kapitainsky/RcloneBrowser +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/Cloud-sync.gif?resize=800%2C450&ssl=1 +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/rclone-browser-screenshot.jpg?resize=800%2C618&ssl=1 +[10]: https://rclone.org/install/ +[11]: https://github.com/kapitainsky/RcloneBrowser/releases/tag/1.8.0 +[12]: https://itsfoss.com/use-appimage-linux/ +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/rclone-browser-howto.png?resize=800%2C412&ssl=1 +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/rclone-browser-drive.png?resize=800%2C505&ssl=1 +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/rclone-browser-task.jpg?resize=800%2C493&ssl=1 +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/rclone-browser-preferences.jpg?resize=800%2C590&ssl=1 From bfcaff11934821697b8f72176f9d1116f05b7acf Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 8 Sep 2020 08:55:50 +0800 Subject: [PATCH 0040/1156] translating --- ... a book cover with an open source alternative to InDesign.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200902 Design a book cover with an open source alternative to InDesign.md b/sources/tech/20200902 Design a book cover with an open source alternative to InDesign.md index 7e80d21c38..b9a54b1006 100644 --- a/sources/tech/20200902 Design a book cover with an open source alternative to InDesign.md +++ b/sources/tech/20200902 Design a book cover with an open source alternative to InDesign.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 0514b519143fee5cac6df3fdd1a08b09c74d27ac Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 8 Sep 2020 14:49:38 +0800 Subject: [PATCH 0041/1156] PRF @silentdawn-zz --- .../20190105 Why Sorting is O(N log N).md | 84 +++++++++---------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/translated/talk/20190105 Why Sorting is O(N log N).md b/translated/talk/20190105 Why Sorting is O(N log N).md index 3b5510b625..cb8ab187bd 100644 --- a/translated/talk/20190105 Why Sorting is O(N log N).md +++ b/translated/talk/20190105 Why Sorting is O(N log N).md @@ -1,44 +1,50 @@ [#]: collector: (lujun9972) [#]: translator: (silentdawn-zz) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) -[#]: subject: (Why Sorting is O(N log N)) +[#]: subject: (Why Sorting is O\(N log N\)) [#]: via: (https://theartofmachinery.com/2019/01/05/sorting_is_nlogn.html) [#]: author: (Simon Arneaud https://theartofmachinery.com) 为什么排序的复杂度为 O(N log N) ====== -基本上所有正而八经的算法教材都会解释什么是快速排序算法,比如 quicksort 和堆排序,但又都基本上不会动用复杂的数学来证明这些算法只能趋近你所能达到的速度。 +基本上所有正而八经的算法教材都会解释像快速排序quicksort堆排序heapsort这样的排序算法有多快,但并不需要复杂的数学就能证明你可以逐渐趋近的速度有多快。 -### 关于标记的说明 +> 关于标记的一个严肃说明: +> +> 大多数计算机专业的科学家使用大写字母 O 标记来指代“趋近,直到到达一个常数比例因子”,这与数学专业所指代的意义是有所区别的。这里我使用的大 O 标记的含义与计算机教材所指相同,但至少不会和其他数学符号混用。 -大多数计算机专业的科学家使用大写字母 O 标记来指代“趋近与乘以一个常数比例因子”,这与数学专业所指代的意义是有所区别的。这里我使用的大 O 标记的含义与计算机教材所指相同,且不会混杂使用数学专业所指含义。 +### 基于比较的排序 -## 基于比较的排序 +先来看个特例,即每次比较两个值大小的算法(快速排序、堆排序,及其它通用排序算法)。这种思想后续可以扩展至所有排序算法。 -先来看个特例,即每次比较两个值大小的算法(quicksort、堆排序及其它通用排序算法基本上都是这样的)。这种思想后续可以扩展至所有排序算法。 +#### 一个简单的最差情况下的计数角度 -### A simple counting argument for the worst case +假设有 4 个互不相等的数,且顺序随机,那么,可以通过只比较一对数字完成排序吗?显然不能,证明如下:根据定义,要对该数组排序,需要按照某种顺序重新排列数字。换句话说,你需要知道用哪种排列方式?有多少种可能的排列?第一个数字可以放在四个位置中的任意一个,第二个数字可以放在剩下三个位置中的任意一个,第三个数字可以放在剩下两个位置中的任意一个,最后一个数字只有剩下的一个位置可选。这样,共有 $4×3×2×1 = 4! = 24$ 种排列可供选择。通过一次比较大小,只能产生两种可能的结果。如果列出所有的排列,那么“从小到大”排序对应的可能是第 8 种排列,按“从大到小”排序对应的可能是第 24 种排列,但无法知道什么时候需要的是其它 22 种排列。 -假设有 4 个互不相等的数,且顺序随机,那么,可以通过比较一对数字完成排序吗?显然不能,证明如下:根据定义,对该数组排序,需要按照某种顺序重新排列数字。那么究竟有多少种可能的排列呢?第一个数字可以放在四个位置中的任意一个,第二个数字可以放在剩下三个位置中的任意一个,第三个数字可以放在剩下两个位置中的任意一个,最后一个数字只有剩下的一个位置可选。这样,共有 4×3×2×1 = 4! = 24 种排列可供选择。通过一次比较大小,只能产生两种可能的结果。如果列出所有的排列,那么“从小到大”排序对应的可能是第 8 种排列,按“从大到小”排序对应的可能是第 22 种排列,但无法知道什么时候需要的是其它 22 种排列。 +通过 2 次比较,可以得到 2×2=4 种可能的结果,这仍然不够。只要比较的次数少于 5(对应 $2^{5} = 32$ 种输出),就无法完成 4 个随机次序的数字的排序。如果 $W(N)$ 是最差情况下对 $N$ 个不同元素进行排序所需要的比较次数,那么, -通过 2 次比较,可以得到 2×2=4 种可能的结果,这仍然不够。只要比较的次数少于 5(对应 (2^{5} = 32) 种输出),就无法完成 4 个随机次序的数字的排序。如果 (W(N)) 是最差情况下对 (N) 个不同元素进行排序所需要的比较次数,那么 +$$ +2^{W(N)} \geq N! +$$ -[2^{W(N)} \geq N!] +两边取以 2 为底的对数,得: -两边取以 2 为底的对数,得 +$$ +W(N) \geq \log_{2}{N!} +$$ -[W(N) \geq \log_{2}{N!}] +$N!$ 的增长近似于 $N^{N}$ (参阅 [Stirling 公式][1]),那么, -(N!) 的增长近似于 (N^{N}) (参阅 [Stirling 公式][1]),那么 +$$ +W(N) \succeq \log N^{N} = N\log N +$$ -[W(N) \succeq \log N^{N} = N\log N] +这就是最差情况下从输出计数的角度得出的 $O(N\log N)$ 上限。 -这就是最差情况下从输出计数的角度得出的 (O(N\log N)) 上限。 - -### 信息论角度平均状态的例子 +#### 从信息论角度的平均状态的例子 使用一些信息论知识,就可以从上面的讨论中得到一个更有力的结论。下面,使用排序算法作为信息传输的编码器: @@ -50,49 +56,43 @@ 6. 现在接收端就可以知道发送端如何重新排列数字以按照需要排序,接收端可以对排列进行逆算,得到 4 个数字的初始顺序 7. 接收端在排列表中检索发送端的原始排列,指出发送端发送的是 15 +确实,这有点奇怪,但确实可以。这意味着排序算法遵循着与编码方案相同的定律,包括理论所证明的不存在通用的数据压缩算法。算法中每次比较发送 1 比特的比较结果编码数据,根据信息论,比较的次数至少是能表示所有数据的二进制位数。更技术语言点,[平均所需的最小比较次数是输入数据的香农熵,以比特为单位][2]。熵是衡量信息等不可预测量的数学度量。 +包含 $N$ 个元素的数组,元素次序随机且无偏时的熵最大,其值为 $\log_{2}{N!}$ 个比特。这证明 $O(N\log N)$ 是一个基于比较的对任意输入排序的最优平均值。 -确实,这有点奇怪,但确实可以。这意味着排序算法遵循着与编码方案相同的定律,包括理论所证明的通用数据压缩算法的不存在。算法中每次比较发送 1 bit 的比较结果编码数据,根据信息论,比较的次数至少是能表示所有数据的二进制位数。更技术语言点,[平均所需的最小比较次数是输入数据的香农熵以二进制的位数][2]。熵是信息等不可预测量的数学度量。 - -包含 (N) 个元素的数组,元素次序随机且无偏时的熵最大,其值为 (\log_{2}{N!}) 二进制位。这证明 (O(N\log N)) 是基于比较的排序对任意输入所需的比较次数。 - -以上都是理论说法,那么实际的排序算法如何做比较的呢?下面是一个数组排序所需比较次数均值的图。我比较的是理论值与 quicksort 及 [Ford-Johnson 合并插入排序][3] 的表现。后者设计目的就是最小化比较次数(整体上没比 quicksort 快多少,因为生命中相对于最小化比较,还有更多其它的事情)。又因为合并插入排序是在 1959 年提出的,它又减少了一些比较次数,但图示说明,它基本上达到了最优状态。 +以上都是理论说法,那么实际的排序算法如何做比较的呢?下面是一个数组排序所需比较次数均值的图。我比较的是理论值与快速排序及 [Ford-Johnson 合并插入排序][3] 的表现。后者设计目的就是最小化比较次数(整体上没比快速排序快多少,因为生活中相对于最大限度减少比较次数,还有更重要的事情)。又因为合并插入排序merge-insertion sort是在 1959 年提出的,它一直在调整,以减少了一些比较次数,但图示说明,它基本上达到了最优状态。 ![随机排列 100 个元素所需的平均排序次数图。最下面的线是理论值,约 1% 处的是合并插入算法,原始 quicksort 大约在 25% 处。][4] 一点点理论导出这么实用的结论,这感觉真棒! -### 小结 +#### 小结 证明了: - 1. 如果数组可以是任意顺序,在最坏情况下至少需要 (O(N\log N)) 次比较。 - 2. 数组的平均比较次数最少是数组的熵,对随机输入而言,其值是 (O(N\log N)) 。 + 1. 如果数组可以是任意顺序,在最坏情况下至少需要 $O(N\log N)$ 次比较。 + 2. 数组的平均比较次数最少是数组的熵,对随机输入而言,其值是 $O(N\log N)$ 。 +注意,第 2 个结论允许基于比较的算法优于 $O(N\log N)$,前提是输入是低熵的(换言之,是部分可预测的)。如果输入包含很多有序的子序列,那么合并排序的性能接近 $O(N)$。如果在确定一个位之前,其输入是有序的,插入排序性能接近 $O(N)$。在最差情况下,以上算法的性能表现都不超出 $O(N\log N)$。 +### 一般排序算法 -注意,第 2 个结论允许基于比较的算法优于 (O(N\log N)),前提是输入是低熵的(换言之,是部分可预测的)。如果输入包含很多有序的子序列,那么合并排序的性能接近 (O(N))。如果在确定一个位之前,其输入是有序的,插入排序性能接近 (O(N))。在最差情况下,以上算法的性能表现都不超出 (O(N\log N))。 - -## 一般排序算法 - -基于比较的排序在实践中是个有趣的特例,但计算机的 [`CMP`][5] 指令与其它指令相比,并没有任何理论上的区别。在下面两条的基础上,前面两种情形都可以扩展至任意排序算法: +基于比较的排序在实践中是个有趣的特例,但从理论上讲,计算机的 [CMP][5] 指令与其它指令相比,并没有什么特别之处。在下面两条的基础上,前面两种情形都可以扩展至任意排序算法: 1. 大多数计算机指令有多于两个的输出,但输出的数量仍然是有限的。 2. 一条指令有限的输出意味着一条指令只能处理有限的熵。 +这给出了 $O(N\log N)$ 对应的指令下限。任何物理上可实现的计算机都只能在给定时间内执行有限数量的指令,所以算法的执行时间也有对应 $O(N\log N)$ 的下限。 +#### 什么是更快的算法? -这给出了 (O(N\log N)) 对应的指令下限。任何物理可实现的计算机都只能在给定时间内执行有限数量的指令,所以算法的执行时间也有对应 (O(N\log N)) 的下限。 +一般意义上的 $O(N\log N)$ 下限,放在实践中来看,如果听人说到任何更快的算法,你要知道,它肯定以某种方式“作弊”了,其中肯定有圈套,即它不是一个可以处理任意大数组的通用排序算法。可能它是一个有用的算法,但最好看明白它字里行间隐含的东西。 -### 什么是更快的算法? +一个广为人知的例子是基数排序radix sort算法,它经常被称为 $O(N)$ 排序算法,但它只能处理所有数字都能放入 $k$ 比特的情况,所以实际上它的性能是 $O({kN})$。 -一般意义上的 (O(N\log N)) 下限,放在实践中来看,如果听人说到任何更快的算法,你要知道,它肯定以某种方式“作弊”了,其中肯定有圈套,即它不是一个可以处理任意大数组的通用排序算法。可能它是一个有用的算法,但最好看明白它字里行间隐含的东西。 +什么意思呢?假如你用的 8 位计算机,那么 8 个二进制位可以表示 $2^{8} = 256$ 个不同的数字,如果数组有上千个数字,那么其中必有重复。对有些应用而言这是可以的,但对有些应用就必须用 16 个二进制位来表示,16 个二进制位可以表示 $2^{16} = 65,536$ 个不同的数字。32 个二进制位可以表示 $2^{32} = 4,294,967,296$ 不同的数字。随着数组长度的增长,所需要的二进制位数也在增长。要表示 $N$ 个不同的数字,需要 $k \geq \log_{2}N$ 个二进制位。所以,只有允许数组中存在重复的数字时,$O({kN})$ 才优于 $O(N\log N)$。 -一个广为人知的例子是基数排序算法 radix sort,它经常被称为 (O(N)) 排序算法,但它只能处理所有数字都是 (k) 位的情况,所以实际上它的性能是 (O({kN}))。 - -什么意思呢?假如你用的 8 位计算机,那么 8 个二进制位可以表示 (2^{8} = 256) 个不同的数字,如果数组有上千个数字,那么其中必有重复。对有些应用而言这是可以的,但对有些应用就必须用 16 个二进制位来表示,16 个二进制位可以表示 (2^{16} = 65,536) 个不同的数字。32 个二进制位可以表示 (2^{32} = 4,294,967,296) 不同的数字。随着数组长度的增长,所需要的二进制位数也在增长。要表示 (N) 个不同的数字,需要 (k \geq \log_{2}N) 个二进制位。所以,只有允许数组中存在重复的数字时,(O({kN})) 才优于 (O(N\log N))。 - -一般意义上输入数据的 (O(N\log N)) 的性能已经说明了全部问题。这个讨论不那么有趣因为很少需要在 32 位计算机上对几十亿整数进行排序,[如果有谁的需求超出了 64 位计算机的极限,他一定没有说出他的全部][6]。 +一般意义上输入数据的 $O(N\log N)$ 的性能已经说明了全部问题。这个讨论不那么有趣因为很少需要在 32 位计算机上对几十亿整数进行排序,[如果有谁的需求超出了 64 位计算机的极限,他一定没有告诉别人][6]。 -------------------------------------------------------------------------------- @@ -100,8 +100,8 @@ via: https://theartofmachinery.com/2019/01/05/sorting_is_nlogn.html 作者:[Simon Arneaud][a] 选题:[lujun9972][b] -译者:[silentdawn-zz](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[silentdawn-zz](https://github.com/silentdawn-zz) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -110,6 +110,6 @@ via: https://theartofmachinery.com/2019/01/05/sorting_is_nlogn.html [1]: http://hyperphysics.phy-astr.gsu.edu/hbase/Math/stirling.html [2]: https://en.wikipedia.org/wiki/Shannon%27s_source_coding_theorem [3]: https://en.wikipedia.org/wiki/Merge-insertion_sort -[4]: /images/sorting_is_nlogn/sorting_algorithms_num_comparisons.svg +[4]: https://theartofmachinery.com/images/sorting_is_nlogn/sorting_algorithms_num_comparisons.svg [5]: https://c9x.me/x86/html/file_module_x86_id_35.html [6]: https://sortbenchmark.org/ From 2005d7bee249868ca6a583dbe8a5ec858cc16dc3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 8 Sep 2020 14:51:21 +0800 Subject: [PATCH 0042/1156] PUB @silentdawn-zz https://linux.cn/article-12594-1.html --- .../talk => published}/20190105 Why Sorting is O(N log N).md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20190105 Why Sorting is O(N log N).md (99%) diff --git a/translated/talk/20190105 Why Sorting is O(N log N).md b/published/20190105 Why Sorting is O(N log N).md similarity index 99% rename from translated/talk/20190105 Why Sorting is O(N log N).md rename to published/20190105 Why Sorting is O(N log N).md index cb8ab187bd..36aadec5bb 100644 --- a/translated/talk/20190105 Why Sorting is O(N log N).md +++ b/published/20190105 Why Sorting is O(N log N).md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (silentdawn-zz) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12594-1.html) [#]: subject: (Why Sorting is O\(N log N\)) [#]: via: (https://theartofmachinery.com/2019/01/05/sorting_is_nlogn.html) [#]: author: (Simon Arneaud https://theartofmachinery.com) From d51cf95144ea14f768c0f4d9649d623bd47e7685 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 8 Sep 2020 23:26:32 +0800 Subject: [PATCH 0043/1156] PUB @wxy https://linux.cn/article-12596-1.html --- .../20200415 Tweaking history on Linux.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20200415 Tweaking history on Linux.md (96%) diff --git a/translated/tech/20200415 Tweaking history on Linux.md b/published/20200415 Tweaking history on Linux.md similarity index 96% rename from translated/tech/20200415 Tweaking history on Linux.md rename to published/20200415 Tweaking history on Linux.md index 216350861a..0bd28438f6 100644 --- a/translated/tech/20200415 Tweaking history on Linux.md +++ b/published/20200415 Tweaking history on Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12596-1.html) [#]: subject: (Tweaking history on Linux) [#]: via: (https://www.networkworld.com/article/3537214/tweaking-history-on-linux.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) @@ -12,7 +12,7 @@ > 在 Linux 系统上,bash shell 的 history 命令可以方便地回顾和重用命令,但是你要控制它记住多少,忘记多少,有很多事情要做。 -![](https://images.idgesg.net/images/article/2019/08/uk_united_kingdom_england_london_natural_history_museum_by_claudio_testa_cc0_via_unsplash_2400x1600-100808449-large.jpg) +![](https://img.linux.net.cn/data/attachment/album/202009/08/232418c2121m2euw3aaw58.jpg) Linux 系统中的 bash `history` 命令有助于记住你以前运行过的命令,并重复这些命令,而不必重新输入。 From e3c08f7425da5997d3e58a93bbf450fee6fc2119 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 9 Sep 2020 03:50:15 +0800 Subject: [PATCH 0044/1156] =?UTF-8?q?Revert=20"=E7=94=B3=E9=A2=86=E6=96=87?= =?UTF-8?q?=E7=AB=A0"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 2c4dcb51067e578646d45963c2feafa9e15612fa. --- ...0325 Reducing sysadmin toil with Kubernetes controllers.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20190325 Reducing sysadmin toil with Kubernetes controllers.md b/sources/tech/20190325 Reducing sysadmin toil with Kubernetes controllers.md index ab1207cc30..80ddb77264 100644 --- a/sources/tech/20190325 Reducing sysadmin toil with Kubernetes controllers.md +++ b/sources/tech/20190325 Reducing sysadmin toil with Kubernetes controllers.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (chen-ni) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -140,7 +140,7 @@ via: https://opensource.com/article/19/3/reducing-sysadmin-toil-kubernetes-contr 作者:[Paul Czarkowski][a] 选题:[lujun9972][b] -译者:[chen-ni](https://github.com/chen-ni) +译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 93bebe13aa7fdb4755b02d1bd880878bf83c4218 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 9 Sep 2020 05:01:51 +0800 Subject: [PATCH 0045/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200909?= =?UTF-8?q?=20How=20to=20Connect=20to=20WiFi=20from=20the=20Terminal=20in?= =?UTF-8?q?=20Ubuntu=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md --- ... WiFi from the Terminal in Ubuntu Linux.md | 201 ++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 sources/tech/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md diff --git a/sources/tech/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md b/sources/tech/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md new file mode 100644 index 0000000000..5b57e7cee8 --- /dev/null +++ b/sources/tech/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md @@ -0,0 +1,201 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Connect to WiFi from the Terminal in Ubuntu Linux) +[#]: via: (https://itsfoss.com/connect-wifi-terminal-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +How to Connect to WiFi from the Terminal in Ubuntu Linux +====== + +_**In this tutorial, you’ll learn how to connect to wireless network from the terminal in Ubuntu. This is particularly helpful if you are using Ubuntu server where you don’t have access to the regular [desktop environment][1].**_ + +I primarily use desktop Linux on my home computers. I also have multiple Linux servers for hosting It’s FOSS and related websites and open source software like [Nextcloud][2], [Discourse][3], Ghost, Rocket Chat etc. + +I use [Linode][4] for quickly deploying Linux servers in cloud in minutes. But recently, I installed [Ubuntu server on my Raspberry Pi][5]. This is the first time I installed a server on a physical device and I had to do extra stuff to connect Ubuntu server to WiFi via command line. + +In this tutorial, I’ll show the steps to connect to WiFi using terminal in Ubuntu Linux. You should + + * not be afraid of using terminal to edit files + * know the wifi access point name (SSID) and the password + + + +### Connect to WiFi from terminal in Ubuntu + +![][6] + +It is easy when you are using Ubuntu desktop because you have the GUI to easily do that. It’s not the same when you are using Ubuntu server and restricted to the command line. + +Ubuntu uses [Netplan][7] utility for easily configuring networking. In Netplan, you create YAML file with the description of network interface and with the help of the netplan command line tool, you generate all the required configuration. + +Let’s see how to connect to wireless networking from the terminal using Netplan. + +#### Step 1: Identify your wireless network interface name + +There are several ways to identify your network interface name. You can use the ip command, the deprecated ipconfig command or check this file: + +``` +ls /sys/class/net +``` + +This should give you all the available networking interface (Ethernet, wifi and loopback). The wireless network interface name starts with ‘w’ and it is usually named similar to wlanX, wlpxyz. + +``` +[email protected]:~$ ls /sys/class/net +eth0 lo wlan0 +``` + +Take a note of this interface name. You’ll use it in the next step. + +#### Step 2: Edit the Netplan configuration file with the wifi interface details + +The Netplan configuration file resides in /etc/netplan directory. If you check the contents of this directory, you should see files like 01-network-manager-all.yml or 50-cloud-init.yaml. + +If it is Ubuntu server, you should have cloud-init file. For desktops, it should be network-manager file. + +The Network Manager on the Linux desktop allows you to choose a wireless network. You may hard code the wifi access point in its configuration. This could help you in some cases (like suspend) where connection drops automatically. + +Whichever file it is, open it for editing. I hope you are a tad bit [familiar with Nano editor][8] because Ubuntu comes pre-installed with it. + +``` +sudo nano /etc/netplan/50-cloud-init.yaml +``` + +YAML files are very sensitive about spaces, indention and alignment. Don’t use tabs, use 4 (or 2, whichever is already used in the YAML file) spaces instead where you see an indention. + +Basically, you’ll have to add the following lines with the access point name (SSID) and its password (usually) in quotes: + +``` +wifis: + wlan0: + dhcp4: true + optional: true + access-points: + "SSID_name": + password: "WiFi_password" +``` + +Again, keep the alignment as I have shown or else YAML file won’t be parsed and it will throw an error. + +Your complete configuration file may look like this: + +``` +# This file is generated from information provided by the datasource. Changes +# to it will not persist across an instance reboot. To disable cloud-init's +# network configuration capabilities, write a file +# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following: +# network: {config: disabled} +network: + ethernets: + eth0: + dhcp4: true + optional: true + version: 2 + wifis: + wlan0: + dhcp4: true + optional: true + access-points: + "SSID_name": + password: "WiFi_password" +``` + +I find it strange that despite the message that changes will not persist across an instance reboot, it still works. + +Anyway, generate the configuration using this command: + +``` +sudo netplan generate +``` + +And now apply this: + +``` +sudo netplan apply +``` + +If you are lucky, you should have network connected. Try to ping a website or run apt update command. + +However, things may not go as smooth and you may see some errors. Try some extra steps if that’s the case. + +#### Possible troubleshooting + +It is possible that when you use the netplan apply command, you see an error in the output that reads something like this: + +``` +Failed to start netplan-wpa-wlan0.service: Unit netplan-wpa-wlan0.service not found. +Traceback (most recent call last): + File "/usr/sbin/netplan", line 23, in + netplan.main() + File "/usr/share/netplan/netplan/cli/core.py", line 50, in main + self.run_command() + File "/usr/share/netplan/netplan/cli/utils.py", line 179, in run_command + self.func() + File "/usr/share/netplan/netplan/cli/commands/apply.py", line 46, in run + self.run_command() + File "/usr/share/netplan/netplan/cli/utils.py", line 179, in run_command + self.func() + File "/usr/share/netplan/netplan/cli/commands/apply.py", line 173, in command_apply + utils.systemctl_networkd('start', sync=sync, extra_services=netplan_wpa) + File "/usr/share/netplan/netplan/cli/utils.py", line 86, in systemctl_networkd + subprocess.check_call(command) + File "/usr/lib/python3.8/subprocess.py", line 364, in check_call + raise CalledProcessError(retcode, cmd) +subprocess.CalledProcessError: Command '['systemctl', 'start', '--no-block', 'systemd-networkd.service', 'netplan-wpa-wlan0.service']' returned non-zero exit status 5. +``` + +It is possible that wpa_supplicant service is not running. Run this command: + +``` +sudo systemctl start wpa_supplicant +``` + +Run netplan apply once again. If it fixes the issue well and good. Otherwise, [shutdown your Ubuntu system][9] using: + +``` +shutdown now +``` + +Start your Ubuntu system again, log in and generate and apply netplan once again: + +``` +sudo netplan generate +sudo netplan apply +``` + +It may show warning (instead of error) now. It is warning and not an error. I checked the [running systemd services][10] and found that netplan-wpa-wlan0.service was already running. Probably it showed the warning because it was already running and ‘netplan apply’ updated the config file (even without any changes). + +``` +Warning: The unit file, source configuration file or drop-ins of netplan-wpa-wlan0.service changed on disk. Run 'systemctl daemon-reload' to reload units. +``` + +It is not crtical and you may check that the internet is probably working already by running apt update. + +I hope you were able to connect to wifi using the command line in Ubuntu with the help of this tutorial. If you are still facing trouble with it, do let me know in the comment section. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/connect-wifi-terminal-ubuntu/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/what-is-desktop-environment/ +[2]: https://itsfoss.com/nextcloud/ +[3]: https://www.discourse.org/ +[4]: https://itsfoss.com/recommends/linode/ +[5]: https://itsfoss.com/install-ubuntu-server-raspberry-pi/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/connect-to-wifi-from-terminal-ubuntu.png?resize=800%2C450&ssl=1 +[7]: https://netplan.io/ +[8]: https://itsfoss.com/nano-editor-guide/ +[9]: https://itsfoss.com/schedule-shutdown-ubuntu/ +[10]: https://linuxhandbook.com/systemd-list-services/ From 1ac1b173392962677ab92d6e866ad3c40487fd81 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 9 Sep 2020 05:02:04 +0800 Subject: [PATCH 0046/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200909?= =?UTF-8?q?=20How=20to=20Install=20Ubuntu=20Server=20on=20a=20Raspberry=20?= =?UTF-8?q?Pi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200909 How to Install Ubuntu Server on a Raspberry Pi.md --- ...Install Ubuntu Server on a Raspberry Pi.md | 210 ++++++++++++++++++ 1 file changed, 210 insertions(+) create mode 100644 sources/tech/20200909 How to Install Ubuntu Server on a Raspberry Pi.md diff --git a/sources/tech/20200909 How to Install Ubuntu Server on a Raspberry Pi.md b/sources/tech/20200909 How to Install Ubuntu Server on a Raspberry Pi.md new file mode 100644 index 0000000000..075091a91b --- /dev/null +++ b/sources/tech/20200909 How to Install Ubuntu Server on a Raspberry Pi.md @@ -0,0 +1,210 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Install Ubuntu Server on a Raspberry Pi) +[#]: via: (https://itsfoss.com/install-ubuntu-server-raspberry-pi/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +How to Install Ubuntu Server on a Raspberry Pi +====== + +The [Raspberry Pi][1] is the best-known [single-board computer][2]. Initially, the scope of the Raspberry Pi project was targeted to the promotion of teaching of basic computer science in schools and in developing countries. + +Its low cost, portability and very low power consumption, made the models far more popular than anticipated. From weather station to home automation, tinkerers built so many [cool projects using Raspberry Pi][3]. + +The [4th generation of the Raspberry Pi][4], is equipped with features and processing power of a regular desktop computer. But this article is not about using RPi as desktop. Instead, I’ll show you how to install Ubuntu server on Raspberry Pi. + +In this tutorial I will use a Raspberry Pi 4 and I will cover the following: + + * Installing Ubuntu Server on a microSD card + * Setting up a wireless network connection on the Raspberry Pi + * Accessing your Raspberry Pi via SSH + + + +![][5] + +**You’ll need the following things for this tutorial**: + + * A micro SD card (8 GB or greater recommended) + * A computer (running Linux, Windows or macOS) with a micro SD card reader + * A Raspberry Pi 2, 3 or 4 + * Good internet connection + * An HDMI cable for the Pi 2 & 3 and a micro HDMI cable for the Pi 4 (optional) + * A USB keyboard set (optional) + + + +### Installing Ubuntu Server on a Raspberry Pi + +![][6] + +I have used Ubuntu for creating Raspberry Pi SD card in this tutorial but you may follow it on other Linux distributions, macOS and Windows as well. This is because the steps for preparing the SD card is the same with Raspberry Pi Imager tool. + +The Raspberry Pi Imager tool downloads the image of your [choice of Raspberry Pi OS][7] automatically. This means that you need a good internet connection for downloading data around 1 GB. + +#### Step 1: Prepare the SD Card with Raspberry Pi Imager + +Make sure you have inserted the microSD card into your computer, and install the Raspberry Pi Imager at your computer. + +You can download the Imager tool for your operating system from these links: + + * [Raspberry Pi Imager for Ubuntu/Debian][8] + * [Raspberry Pi Imager for Windows][9] + * [Raspberry Pi Imager for MacOS][10] + + + +Despite I use Ubuntu, I won’t use the Debian package that is listed above, but I will install the snap package using the command line. This method can be applied to wider range of Linux distributions. + +``` +sudo snap install rpi-imager +``` + +Once you have installed Raspberry Pi Imager tool, find and open it and click on the “CHOOSE OS” menu. + +![][11] + +Scroll across the menu and click on “Ubuntu” (Core and Server Images). + +![][12] + +From the available images, I choose the Ubuntu 20.04 LTS 64 bit. If you have a Raspberry Pi 2, you are limited to the 32bit image. + +**Important Note: If you use the latest Raspberry Pi 4 – 8 GB RAM model, you should choose the 64bit OS, otherwise you will be able to use 4 GB RAM only.** + +![][13] + +Select your microSD card from the “SD Card” menu, and click on “WRITE”after. + +![][14] + +If it shows some error, try writing it again. It will now download the Ubuntu server image and write it to the micro SD card. + +It will notify you when the process is completed. + +![][15] + +#### Step 2: Add WiFi support to Ubuntu server + +Once the micro SD card flashing is done, you are almost ready to use it. There is one thng that you may want to do before using it and that is to add Wi-Fi support. + +With the SD card still inserted in the card reader, open the file manager and locate the “system-boot” partition on the card. + +The file that you are looking for and need to edit is named `network-config`. + +![][16] + +This process can be done on Windows and MacOS too. Edit the **`network-config`** file as already mentioned to add your Wi-Fi credentials. + +Firstly, uncomment (remove the hashtag “#” at the beginning) from lines that are included in the rectangular box. + +After that, replace myhomewifi with your Wi-Fi network name enclosed in quotation marks, such as “itsfoss” and the “S3kr1t” with the Wi-Fi password enclosed in quotation marks, such as “12345679”. + +![][17] + +It may look like this: + +``` +wifis: + wlan0: + dhcp4: true + optional: true + access-points: + "your wifi name": + password: "your_wifi_password" +``` + +Save the file and insert the micro SD card into your Raspberry Pi. During the first boot, if your Raspberry Pi fails connect to the Wi-Fi network, simply reboot your device. + +#### Step 3: Use Ubuntu server on Raspberry Pi (if you have dedicated monitor, keyboard and mouse for Raspberry Pi) + +If you have got an additional set of mouse, keyboard and a monitor for the Raspberry Pi, you can use easily use it like any other computer (but without GUI). + +Simply insert the micro SD card to the Raspberry Pi, plug in the monitor, keyboard and mouse. Now [turn on your Raspberry Pi][18]. It will present TTY login screen (black terminal screen) and aks for username and password. + + * Default username: ubuntu + * Default password: ubuntu + + + +When prompted, use “**ubuntu**” for the password. Right after a successful login, [Ubuntu will ask you to change the default password][19]. + +Enjoy your Ubuntu Server! + +#### Step 3: Connect remotely to your Raspberry Pi via SSH (if you don’t have monitor, keyboard and mouse for Raspberry Pi) + +It is okay if you don’t have a dedicated monitor to be used with Raspberry Pi. Who needs a monitor with a server when you can just SSH into it and use it the way you want? + +**On Ubuntu and Mac OS**, an SSH client is usually already installed. To connect remotely to your Raspberry Pi, you need to discover its IP address. Check the [devices connected to your network][20] and see which one is the Raspberry Pi. + +Since I don’t have access to a Windows machine, you can access a comprehensive guide provided by [Microsoft][21]. + +Open a terminal and run the following command: + +``` +ssh [email protected]_pi_ip_address +``` + +You will be asked to confirm the connection with the message: + +``` +Are you sure you want to continue connecting (yes/no/[fingerprint])? +``` + +Type “yes” and click the enter key. + +![][22] + +When prompted, use “ubuntu” for the password as mentioned earlier. You’ll be asked to change the password of course. + +Once done, you will be automatically logged out and you have to reconnect, using your new password. + +Your Ubuntu server is up and running on a Raspberry Pi! + +**Conclusion** + +Installing Ubuntu Server on a Raspberry Pi is an easy process and it comes pre-configured at a great degree which the use a pleasant experience. + +I have to say that among all the [operating systems that I tried on my Raspberry Pi][7], Ubuntu Server was the easiest to install. I am not exaggerating. Check my guide on [installing Arch Linux on Raspberry Pi][23] for reference. + +I hope this guide helped you in installing Ubuntu server on your Raspberry Pi as well. If you have questions or suggestions, please let me know in the comment section. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-ubuntu-server-raspberry-pi/ + +作者:[Dimitrios Savvopoulos][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/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://www.raspberrypi.org/ +[2]: https://itsfoss.com/raspberry-pi-alternatives/ +[3]: https://itsfoss.com/raspberry-pi-projects/ +[4]: https://itsfoss.com/raspberry-pi-4/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/Ubuntu-Server-20.04.1-LTS-aarch64.png?resize=800%2C600&ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/ubuntu-server-raspberry-pi.png?resize=800%2C450&ssl=1 +[7]: https://itsfoss.com/raspberry-pi-os/ +[8]: https://downloads.raspberrypi.org/imager/imager_amd64.deb +[9]: https://downloads.raspberrypi.org/imager/imager.exe +[10]: https://downloads.raspberrypi.org/imager/imager.dmg +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/raspberry-pi-imager.png?resize=800%2C600&ssl=1 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/raspberry-pi-imager-choose-ubuntu.png?resize=800%2C600&ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/raspberry-pi-imager-ubuntu-server.png?resize=800%2C600&ssl=1 +[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/raspberry-pi-imager-sd-card.png?resize=800%2C600&ssl=1 +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/ubuntu-server-installed-raspberry-pi.png?resize=799%2C506&ssl=1 +[16]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/ubuntu-server-pi-network-config.png?resize=800%2C565&ssl=1 +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/Ubuntu-server-wifi.png?resize=800%2C600&ssl=1 +[18]: https://itsfoss.com/turn-on-raspberry-pi/ +[19]: https://itsfoss.com/change-password-ubuntu/ +[20]: https://itsfoss.com/how-to-find-what-devices-are-connected-to-network-in-ubuntu/ +[21]: https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse +[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/ubuntu-server-change-password.png?resize=800%2C600&ssl=1 +[23]: https://itsfoss.com/install-arch-raspberry-pi/ From 1a78dacf5cba731758299c8433755bf1f479cf7c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 9 Sep 2020 05:02:22 +0800 Subject: [PATCH 0047/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200908?= =?UTF-8?q?=20Tux=20the=20Linux=20Penguin=20in=20its=20first=20video=20gam?= =?UTF-8?q?e,=20better=20DNS=20and=20firewall=20on=20Android,=20Gitops=20I?= =?UTF-8?q?DE=20goes=20open=20source,=20and=20more=20open=20source=20news?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200908 Tux the Linux Penguin in its first video game, better DNS and firewall on Android, Gitops IDE goes open source, and more open source news.md --- ... open source, and more open source news.md | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 sources/tech/20200908 Tux the Linux Penguin in its first video game, better DNS and firewall on Android, Gitops IDE goes open source, and more open source news.md diff --git a/sources/tech/20200908 Tux the Linux Penguin in its first video game, better DNS and firewall on Android, Gitops IDE goes open source, and more open source news.md b/sources/tech/20200908 Tux the Linux Penguin in its first video game, better DNS and firewall on Android, Gitops IDE goes open source, and more open source news.md new file mode 100644 index 0000000000..dbb4be38cb --- /dev/null +++ b/sources/tech/20200908 Tux the Linux Penguin in its first video game, better DNS and firewall on Android, Gitops IDE goes open source, and more open source news.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Tux the Linux Penguin in its first video game, better DNS and firewall on Android, Gitops IDE goes open source, and more open source news) +[#]: via: (https://opensource.com/article/20/9/news-sept-8) +[#]: author: (Lauren Maffeo https://opensource.com/users/lmaffeo) + +Tux the Linux Penguin in its first video game, better DNS and firewall on Android, Gitops IDE goes open source, and more open source news +====== +Catch up on the biggest open source headlines from the past two weeks. +![][1] + +In this week’s edition of our open source news roundup, Gitpod open sources its IDE platform, BraveDNS launches an all-in-one platform, and more open source news. + +### Engineers debut an open source-powered robot + +Matthias Müller and Vladlen Koltun, two engineers at Intel, have shared their new robot to tackle computer vision tasks. [The robot][2], called "OpenBot", is powered by a smartphone, which acts as a camera and computing unit.  + +The OpenBot prototype components cost $50. It's intended to be a low-cost alternative to commercially available radio-controlled models, with more computing power than educational models. + +To use OpenBot, users can connect their smartphones to an electromechanical body. They can also use Bluetooth to connect their smartphone to a video game controller like an Xbox or PlayStation.  + +Müller and Koltun say they want OpenBot to address two key issues in robotics: Scalability and accessibility. Its source code is still pending [on GitHub][3], although models for 3D-printing the case are up. + +### Tux the Linux Penguin gets his video game dues + +A new update to [a free and open source 3D kart racer][4] features an unlikely hero: Tux, the Linux penguin. + +Born in the early aughts as a project called _TuxKart_, Joerg Henrichs renamed it "Super Tux Kart" in 2006. Lux is the latest open source mascot to feature in the project: Blender and GIMP's mascots are represented as well. + +Along with adding Tux to the mix, Super Tux Kart Version 1.2 includes lots of updates. iOS users can create racing servers in-game, while all official tracks are now included in the release built on Android. And since the game is open source [on four platforms][5], all players can make their own changes to submit for review. + +### BraveDNS offers three services in one for Android users + +It's notoriously tough for Android users to find a firewall, adblocker, and DNS-over-HTTPS client in one product. But if BraveDNS lives up to the hype, this free and open source tool offers all three in one.  + +Self-described as “an [OpenSnitch][6]-inspired firewall and network monitor + a [pi-hole][7]-inspired DNS over HTTPS client with blocklists”, BraveDNS uses its own ads, trackers, and spyware-blocking DNS endpoint. Users who need features like custom blocklists and ability to store DNS logs can use the tool's DNS resolver service as a paid option. + +Along with a robust [list of firewall features][8], BraveDNS offers to backport support for dual-mode DNS and firewall execution to legacy Android versions. You'll need at least Android 8 Oreo to use the latest version of BraveDNS on their website and Google Play, but their developers pledge to make it compatible down to Android Marshmellow in the near future.  + +### Gitpod open sources its IDE platform + +With projects like Theia, Xtext, and Open VSX under its belt, Gitpod has been a strong open source presence for 10 years. Now, Gitpod -- an IDE platform for GitHub projects -- is [officially open source][9] as well. + +The move marks a big change for Gitpod, which was previously closed to community development from the start. Founders Sven Efftinge and Johannes Landgraf shared that Gitpod now meets GitHub's open source criteria under AGPL license. This allows Gitpod developers to co-collaborate on Kubernetes applications. + +Along with Gitpod's open source status, they've expanded into software as well. Self-Hosted, a private cloud platform, is now available for free to unlimited users. Designed for DevOps teams to work on enterprise projects, Self-Hosted's features include collaboration tools, analytics, dashboards, and more. + +In other news: + + * [5 open source software applications for virtualization][10] + * [Building a heavy duty open source ventilator][11] + * [China looks at Gitee as an open source alternative to Microsoft's GitHub][12] + * [The future of American industry depends on open source tech][13] + + + +Thanks, as always, to Opensource.com staff members and [Correspondents][14] for their help this week. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/news-sept-8 + +作者:[Lauren Maffeo][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://opensource.com/users/lmaffeo +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/weekly_news_roundup_tv.png?itok=tibLvjBd +[2]: https://www.inceptivemind.com/openbot-open-source-low-cost-smartphone-powered-robot/15023/ +[3]: https://github.com/intel-isl/OpenBot +[4]: https://hothardware.com/news/super-tux-kart-update +[5]: https://supertuxkart.net/Download +[6]: https://github.com/evilsocket/opensnitch +[7]: https://github.com/pi-hole/pi-hole +[8]: https://www.xda-developers.com/bravedns-open-source-dns-over-https-client-firewall-adblocker-android/ +[9]: https://aithority.com/it-and-devops/gitpod-goes-open-source-with-its-ide-platform-launches-self-hosted-cloud-package/ +[10]: https://searchservervirtualization.techtarget.com/tip/5-open-source-software-applications-for-virtualization +[11]: https://hackaday.com/2020/08/28/building-a-heavy-duty-open-source-ventilator/ +[12]: https://www.scmp.com/abacus/tech/article/3099107/china-pins-its-hopes-gitee-open-source-alternative-microsofts-github +[13]: https://www.wired.com/story/opinon-the-future-of-american-industry-depends-on-open-source-tech/ +[14]: https://opensource.com/correspondent-program From c8a1b9db23dd162f0d1a891e78c97d5b9f22205c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 9 Sep 2020 05:02:35 +0800 Subject: [PATCH 0048/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200908?= =?UTF-8?q?=20How=20to=20install=20software=20with=20Ansible?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200908 How to install software with Ansible.md --- ...08 How to install software with Ansible.md | 229 ++++++++++++++++++ 1 file changed, 229 insertions(+) create mode 100644 sources/tech/20200908 How to install software with Ansible.md diff --git a/sources/tech/20200908 How to install software with Ansible.md b/sources/tech/20200908 How to install software with Ansible.md new file mode 100644 index 0000000000..ab119175ef --- /dev/null +++ b/sources/tech/20200908 How to install software with Ansible.md @@ -0,0 +1,229 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to install software with Ansible) +[#]: via: (https://opensource.com/article/20/9/install-packages-ansible) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +How to install software with Ansible +====== +Automate software installations and updates across your devices with +Ansible playbooks. +![Puzzle pieces coming together to form a computer screen][1] + +Ansible is a popular automation tool used by sysadmins and developers to keep their computer systems in prime condition. As is often the case with extensible frameworks, [Ansible][2] has limited use on its own, with its real power dwelling in its many modules. Ansible modules are, in a way, what commands are to a [Linux][3] computer. They provide solutions to specific problems, and one common task when maintaining computers is keeping all the ones you use updated and consistent. + +I used to use a text list of packages to keep my systems more or less synchronized: I'd list the packages installed on my laptop and then cross-reference that with my desktop, or between one server and another server, making up for any difference manually. Of course, installing and maintaining applications on a Linux machine is a basic task for Ansible, and it means you can list what you want across all computers under your care. + +### Finding the right Ansible module + +The number of Ansible modules can be overwhelming. How do you find the one you need for a given task? In Linux, you might look in your Applications menu or in `/usr/bin` to discover new applications to run. When you're using Ansible, you refer to the [Ansible module index][4]. + +The index is listed primarily by category. With a little searching, you're very likely to find a module for whatever you need. For package management, the [Packaging modules][5] section contains a module for nearly any system with a package manager. + +### Writing an Ansible playbook + +To begin, choose the package manager on your local computer. For instance, if you're going to write your Ansible instructions (a "playbook," as it's called in Ansible) on a laptop running Fedora, start with the `dnf` module. If you're writing on Elementary OS, use the `apt` module, and so on. This gets you started with something you can test and verify as you go, and you can expand your work for your other computers later. + +The first step is to create a directory representing your playbook. This isn't strictly necessary, but it's a good idea to establish the habit. Ansible can run with just a configuration file written in YAML, but if you want to expand your playbook later, you can control Ansible by how you lay out your directories and files. For now, just create a directory called `install_packages` or similar: + + +``` +`$ mkdir ~/install_packages` +``` + +The file that serves as the Ansible playbook can be named anything you like, but it's traditional to name it `site.yml`: + + +``` +`$ touch ~/install_packages/site.yml` +``` + +Open `site.yml` in your favorite text editor, and add this: + + +``` +\--- +\- hosts: localhost +  tasks: +    - name: install packages +      become: true +      become_user: root +      dnf: +        state: present +        name: +         - tcsh +         - htop +``` + +You must adjust the module name you use to match the distribution you're using. In this example, I used `dnf` because I wrote the playbook on Fedora Linux. + +Like with a command in a Linux terminal, knowing _how_ to invoke an Ansible module is half the battle. This playbook example follows the standard playbook format: + + * `hosts` targets a computer or computers. In this case, the computer being targeted is `localhost`, which is the computer you're using right now (as opposed to a remote system you want Ansible to connect with). + * `tasks` opens a list of tasks you want to be performed on the hosts. + * `name` is a human-friendly title for a task. In this case, I'm using `install packages` because that's what this task is doing. + * `become` permits Ansible to change which user is running this task. + * `become_user` permits Ansible to become the `root` user to run this task. This is necessary because only the root user can install new applications using `dnf`. + * `dnf` is the name of the module, which you discovered from the module index on the Ansible website. + + + +The items under the `dnf` item are specific to the `dnf` module. This is where the module documentation is essential. Like a man page for a Linux command, the module documentation tells you what options are available and what kinds of arguments are required. + +![Ansible documentation][6] + +Ansible module documentation (Seth Kenlon, [CC BY-SA 4.0][7]) + +Package installation is a relatively simple task and only requires two elements. The `state` option instructs Ansible to check whether or not _some package_ is present on the system, and the `name` option lists which packages to look for. Ansible deals in machine _state_, so module instructions always imply change. Should Ansible scan a system and find a conflict between how a playbook describes a system (in this case, that the commands `tcsh` and `htop` are present) and what the system state actually is (in this example, `tcsh` and `htop` are not present), then Ansible's task is to make whatever changes are necessary for the system to match the playbook. Ansible can make those changes because of the `dnf` (or `apt` or whatever your package manager is) module. + +Each module is likely to have a different set of options, so when you're writing playbooks, anticipate referring to the module documentation often. Until you're very familiar with a module, it's the only reasonable way to expect a module to do what you need it to do. + +### Verifying YAML + +Playbooks are written in YAML. Because YAML adheres to a strict syntax, it's helpful to install the `yamllint` command to check (or "lint," in computer terminology) your work. Better still, there's a linter specific to Ansible called `ansible-lint` created specifically for playbooks. Install these before continuing. + +On Fedora or CentOS: + + +``` +`$ sudo dnf install yamllint python3-ansible-lint` +``` + +On Debian, Elementary, Ubuntu, or similar: + + +``` +`$ sudo apt install yamllint ansible-lint` +``` + +Verify your playbook with `ansible-lint`. If you don't have access to `ansible-lint`, you can use `yamllint`. + + +``` +`$ ansible-lint ~/install_packages/site.yml` +``` + +Success returns nothing, but if there are errors in your file, you must fix them before continuing. Common errors from copying and pasting include omitting a newline character at the end of the final line and using tabs instead of spaces for indentation. Fix them in a text editor, rerun the linter, and repeat this process until you get no feedback from `ansible-lint` or `yamllint`. + +### Installing an application with Ansible + +Now that you have a verifiably valid playbook, you can finally run it on your local machine. Because you happen to know that the task defined by the playbook requires root permissions, you must use the `--ask-become-pass` option when invoking Ansible, so you will be prompted for your administrative password. + +Start the installation: + + +``` +$ ansible-playbook --ask-become-pass ~/install_packages/site.yml +BECOME password: +PLAY [localhost] ****************************** + +TASK [Gathering Facts] ****************************** +ok: [localhost] + +TASK [install packages] ****************************** +ok: [localhost] + +PLAY RECAP ****************************** +localhost: ok=0 changed=2 unreachable=0 failed=0 [...] +``` + +The commands are installed, leaving the target system in an identical state to the one described by the playbook. + +### Installing an application on remote systems + +Going through all of that to replace one simple command would be counterproductive, but Ansible's advantage is that it can be automated across all of your systems. You can use conditional statements to cause Ansible to use a specific module on different systems, but for now, assume all your computers use the same package manager. + +To connect to a remote system, you must define the remote system in the `/etc/ansible/hosts` file. This file was installed along with Ansible, so it already exists, but it's probably empty, aside from explanatory comments. Use `sudo` to open the file in your favorite text editor. + +You can define a host by its IP address or hostname, as long as the hostname can be resolved. For instance, if you've already defined `liavara` in `/etc/hosts` and can successfully ping it, then you can set `liavara` as a host in `/etc/ansible/hosts`. Alternately, if you're running a domain name server or Avahi server and can ping `liavara`, then you can set it as a host in `/etc/ansible/hosts`. Otherwise, you must use its internet protocol address. + +You also must have set up a successful secure shell (SSH) connection to your target hosts. The easiest way to do that is with the `ssh-copy-id` command, but if you've never set up an SSH connection with a host before, [read my article on how to create an automated SSH connection][8]. + +Once you've entered the hostname or IP address in the `/etc/ansible/hosts` file, change the `hosts` definition in your playbook: + + +``` +\--- +\- hosts: all +  tasks: +    - name: install packages +      become: true +      become_user: root +      dnf: +        state: present +        name: +         - tcsh +         - htop +``` + +Run `ansible-playbook` again: + + +``` +`$ ansible-playbook --ask-become-pass ~/install_packages/site.yml` +``` + +This time, the playbook runs on your remote system. + +Should you add more hosts, there are many ways to filter which host performs which task. For instance, you can create groups of hosts (`webservers` for servers, `workstations` for desktop machines, and so on). + +### Ansible for mixed environments + +The logic used in the solution so far assumes that all hosts being configured by Ansible run the same OS (specifically, one that uses the **dnf** command for package management). So what do you do if you're managing hosts running a different distribution, such as Ubuntu (which uses **apt**) or Arch (using **pacman**), or even different operating systems? + +As long as the targeted OS has a package manager (and these days even [MacOS has Homebrew][9] and [Windows has Chocolatey][10]), Ansible can help. + +This is where Ansible's advantage becomes most apparent. In a shell script, you'd have to check for what package manager is available on the target host, and even with pure Python you'd have to check for the OS. Ansible not only has those checks built in, but it also has mechanisms to use the results in your playbook. Instead of using the **dnf** module, you can use the **action** keyword to perform tasks defined by variables provided by Ansible's fact gathering subsystem. + + +``` +\--- +\- hosts: all +  tasks: +    - name: install packages +      become: true +      become_user: root +      action: > +       {{ ansible_pkg_mgr }} name=htop,transmission state=present update_cache=yes +``` + +The **action** keyword loads action plugins. In this example, it's using the **ansible_pkg_mgr** variable, which is populated by Ansible during the initial **Gathering Facts** task. You don't have to tell Ansible to gather facts about the OS it's running on, so it's easy to overlook it, but when you run a playbook, you see it listed in the default output: + + +``` +TASK [Gathering Facts] ***************************************** +ok: [localhost] +``` + +The **action** plugin uses information from this probe to populate **ansible_pkg_mgr** with the relevant package manager command to install the packages listed after the **name** argument. With 8 lines of code, you can overcome a complex cross-platform quandary that few other scripting options allow. + +### Use Ansible + +It's the 21st century, and we all expect our computing devices to be connected and relatively consistent. Whether you maintain two or 200 computers, you shouldn't have to perform the same maintenance tasks over and over again. Use Ansible to synchronize the computers in your life, then see what else Ansible can do for you. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/install-packages-ansible + +作者:[Seth Kenlon][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://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/puzzle_computer_solve_fix_tool.png?itok=U0pH1uwj (Puzzle pieces coming together to form a computer screen) +[2]: https://opensource.com/resources/what-ansible +[3]: https://opensource.com/resources/linux +[4]: https://docs.ansible.com/ansible/latest/modules/modules_by_category.html +[5]: https://docs.ansible.com/ansible/latest/modules/list_of_packaging_modules.html +[6]: https://opensource.com/sites/default/files/uploads/ansible-module.png (Ansible documentation) +[7]: https://creativecommons.org/licenses/by-sa/4.0/ +[8]: https://opensource.com/article/20/8/how-ssh +[9]: https://opensource.com/article/20/6/homebrew-mac +[10]: https://opensource.com/article/20/3/chocolatey From 89c1f38f937137d9598445c34c878944437fbb5e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 9 Sep 2020 05:02:49 +0800 Subject: [PATCH 0049/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200908?= =?UTF-8?q?=20Deploy=20a=20deep=20learning=20model=20on=20Kubernetes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200908 Deploy a deep learning model on Kubernetes.md --- ...loy a deep learning model on Kubernetes.md | 265 ++++++++++++++++++ 1 file changed, 265 insertions(+) create mode 100644 sources/tech/20200908 Deploy a deep learning model on Kubernetes.md diff --git a/sources/tech/20200908 Deploy a deep learning model on Kubernetes.md b/sources/tech/20200908 Deploy a deep learning model on Kubernetes.md new file mode 100644 index 0000000000..ca6d98438a --- /dev/null +++ b/sources/tech/20200908 Deploy a deep learning model on Kubernetes.md @@ -0,0 +1,265 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Deploy a deep learning model on Kubernetes) +[#]: via: (https://opensource.com/article/20/9/deep-learning-model-kubernetes) +[#]: author: (Chaimaa Zyani https://opensource.com/users/chaimaa) + +Deploy a deep learning model on Kubernetes +====== +Learn how to deploy, scale, and manage a deep learning model that serves +up image recognition predictions with Kubermatic Kubernetes Platform. +![Brain on a computer screen][1] + +As enterprises increase their use of artificial intelligence (AI), machine learning (ML), and deep learning (DL), a critical question arises: How can they scale and industrialize ML development? These conversations often focus on the ML model; however, this is only one step along the way to a complete solution. To achieve in-production application and scale, model development must include a repeatable process that accounts for the critical activities that precede and follow development, including getting the model into a public-facing deployment. + +This article demonstrates how to deploy, scale, and manage a deep learning model that serves up image recognition predictions using [Kubermatic Kubernetes Platform][2]. + +Kubermatic Kubernetes Platform is a production-grade, open source Kubernetes cluster-management tool that offers flexibility and automation to integrate with ML/DL workflows with full cluster lifecycle management. + +### Get started + +This example deploys a deep learning model for image recognition. It uses the [CIFAR-10][3] dataset that consists of 60,000 32x32 color images in 10 classes with the [Gluon][4] library in [Apache MXNet][5] and NVIDIA GPUs to accelerate the workload. If you want to use a pre-trained model on the CIFAR-10 dataset, check out the [getting started guide][6]. + +The model was trained over a span of 200 epochs, as long as the validation error kept decreasing slowly without causing the model to overfit. This plot shows the training process: + +![Deep learning model training plot][7] + +(Chaimaa Zyami, [CC BY-SA 4.0][8]) + +After training, it's essential to save the model's parameters so they can be loaded later: + + +``` +file_name = "net.params" +net.save_parameters(file_name) +``` + +Once the model is ready, wrap your prediction code in a Flask server. This allows the server to accept an image as an argument to its request and return the model's prediction in the response: + + +``` +from gluoncv.model_zoo import get_model +import matplotlib.pyplot as plt +from mxnet import gluon, nd, image +from mxnet.gluon.data.vision import transforms +from gluoncv import utils +from PIL import Image +import io +import flask +app = flask.Flask(__name__) + +@app.route("/predict",methods=["POST"]) +def predict(): +    if flask.request.method == "POST": +        if flask.request.files.get("img"): +           img = Image.open(io.BytesIO(flask.request.files["img"].read())) +            transform_fn = transforms.Compose([ +            transforms.Resize(32), +            transforms.CenterCrop(32), +            transforms.ToTensor(), +            transforms.Normalize([0.4914, 0.4822, 0.4465], [0.2023, 0.1994, 0.2010])]) +            img = transform_fn(nd.array(img)) +            net = get_model('cifar_resnet20_v1', classes=10) +            net.load_parameters('net.params') +            pred = net(img.expand_dims(axis=0)) +            class_names = ['airplane', 'automobile', 'bird', 'cat', 'deer', +                       'dog', 'frog', 'horse', 'ship', 'truck'] +            ind = nd.argmax(pred, axis=1).astype('int') +            prediction = 'The input picture is classified as [%s], with probability %.3f.'% +                         (class_names[ind.asscalar()], nd.softmax(pred)[0][ind].asscalar()) +    return prediction + +if __name__ == '__main__': +   app.run(host='0.0.0.0') +``` + +### Containerize the model + +Before you can deploy your model to Kubernetes, you need to install Docker and create a container image with your model. + + 1. Download, install, and start Docker: [code] + +sudo yum install -y yum-utils device-mapper-persistent-data lvm2 + +sudo yum-config-manager --add-repo + +sudo yum install docker-ce + +sudo systemctl start docker + +``` + 2. Create a directory where you can organize your code and dependencies: [code] + +mkdir kubermatic-dl +cd kubermatic-dl +``` + + 3. Create a `requirements.txt` file to contain the packages the code needs to run: [code] + +flask +gluoncv +matplotlib +mxnet +requests +Pillow + +``` + 4. Create the Dockerfile that Docker will read to build and run the model: [code] + +FROM python:3.6 +WORKDIR /app +COPY requirements.txt /app +RUN pip install -r ./requirements.txt +COPY app.py /app +CMD ["python", "app.py"]~ + +[/code] This Dockerfile can be broken down into three steps. First, it creates the Dockerfile and instructs Docker to download a base image of Python 3. Next, it asks Docker to use the Python package manager `pip` to install the packages in `requirements.txt`. Finally, it tells Docker to run your script via `python app.py`. + + 5. Build the Docker container: [code]`sudo docker build -t kubermatic-dl:latest .`[/code] This instructs Docker to build a container for the code in your current working directory, `kubermatic-dl`. + + 6. Check that your container is working by running it on your local machine: [code]`sudo docker run -d -p 5000:5000 kubermatic-dl` +``` + + 7. Check the status of your container by running `sudo docker ps -a`: + +![Checking the container's status][9] + +(Chaimaa Zyami, [CC BY-SA 4.0][8]) + + + + +### Upload the model to Docker Hub + +Before you can deploy the model on Kubernetes, it must be publicly available. Do that by adding it to [Docker Hub][10]. (You will need to create a Docker Hub account if you don't have one.) + + 1. Log into your Docker Hub account: [code]`sudo docker login` +``` + 2. Tag the image so you can refer to it for versioning when you upload it to Docker Hub: [code] + +sudo docker tag <your-image-id> <your-docker-hub-name>/<your-app-name> + +sudo docker push <your-docker-hub-name>/<your-app-name> +``` + +![Tagging the image][11] + +(Chaimaa Zyami, [CC BY-SA 4.0][8]) + + 3. Check your image ID by running `sudo docker images`. + + + + +### Deploy the model to a Kubernetes cluster + + 1. Create a project on the Kubermatic Kubernetes Platform, then create a Kubernetes cluster using the [quick start tutorial][12]. + +![Create a Kubernetes cluster][13] + +(Chaimaa Zyami, [CC BY-SA 4.0][8]) + + 2. Download the `kubeconfig` used to configure access to your cluster, change it into the download directory, and export it into your environment: + +![Kubernetes cluster example][14] + +(Chaimaa Zyami, [CC BY-SA 4.0][8]) + + 3. Using `kubectl`, check the cluster information, such as the services that `kube-system` starts on your cluster: [code]`kubectl cluster-info` +``` +![Checking the cluster info][15] + +(Chaimaa Zyami, [CC BY-SA 4.0][8]) + + 4. To run the container in the cluster, you need to create a deployment (`deployment.yaml`) and apply it to the cluster: [code] + +apiVersion: apps/v1 +kind: Deployment +metadata: +  name: kubermatic-dl-deployment +spec: +  selector: +    matchLabels: +      app: kubermatic-dl +  replicas: 3 +  template: +    metadata: +      labels: +        app: kubermatic-dl +    spec: +     containers: +     - name: kubermatic-dl +       image: kubermatic00/kubermatic-dl:latest +       imagePullPolicy: Always +       ports: +       - containerPort: 8080 + +[/code] [code]`kubectl apply -f deployment.yaml` +``` + + 5. To expose your deployment to the outside world, you need a service object that will create an externally reachable IP for your container: [code]`kubectl expose deployment kubermatic-dl-deployment  --type=LoadBalancer --port 80 --target-port 5000` +``` +6. You're almost there! Check your services to determine the status of your deployment and get the IP address to call your image recognition API: [code]`kubectl get service` +``` + +![Get the IP address to call your image recognition API][16] + +(Chaimaa Zyami, [CC BY-SA 4.0][8]) + + 7. Test your API with these two images using the external IP: + +![Horse][17] + +(Chaimaa Zyami, [CC BY-SA 4.0][8]) + +![Dog][18] + +(Chaimaa Zyami, [CC BY-SA 4.0][8]) + +![Testing the API][19] + +(Chaimaa Zyami, [CC BY-SA 4.0][8]) + + + + +### Summary + +In this tutorial, you created a deep learning model to be served as a [REST API][20] using Flask. It put the application inside a Docker container, uploaded the container to Docker Hub, and deployed it with Kubernetes. Then, with just a few commands, Kubermatic Kubernetes Platform deployed the app and exposed it to the world. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/deep-learning-model-kubernetes + +作者:[Chaimaa Zyani][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://opensource.com/users/chaimaa +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/brain_computer_solve_fix_tool.png?itok=okq8joti (Brain on a computer screen) +[2]: https://www.loodse.com/products/kubermatic/ +[3]: https://www.cs.toronto.edu/~kriz/cifar.html +[4]: https://gluon.mxnet.io/ +[5]: https://mxnet.apache.org/ +[6]: https://gluon-cv.mxnet.io/build/examples_classification/demo_cifar10.html +[7]: https://opensource.com/sites/default/files/uploads/trainingplot.png (Deep learning model training plot) +[8]: https://creativecommons.org/licenses/by-sa/4.0/ +[9]: https://opensource.com/sites/default/files/uploads/containerstatus.png (Checking the container's status) +[10]: https://hub.docker.com/ +[11]: https://opensource.com/sites/default/files/uploads/tagimage.png (Tagging the image) +[12]: https://docs.kubermatic.com/kubermatic/v2.13/installation/install_kubermatic/_installer/ +[13]: https://opensource.com/sites/default/files/uploads/kubernetesclusterempty.png (Create a Kubernetes cluster) +[14]: https://opensource.com/sites/default/files/uploads/kubernetesexamplecluster.png (Kubernetes cluster example) +[15]: https://opensource.com/sites/default/files/uploads/clusterinfo.png (Checking the cluster info) +[16]: https://opensource.com/sites/default/files/uploads/getservice.png (Get the IP address to call your image recognition API) +[17]: https://opensource.com/sites/default/files/uploads/horse.jpg (Horse) +[18]: https://opensource.com/sites/default/files/uploads/dog.jpg (Dog) +[19]: https://opensource.com/sites/default/files/uploads/testapi.png (Testing the API) +[20]: https://www.redhat.com/en/topics/api/what-is-a-rest-api From 501e0dfba5849d8d17d29b383a36f5e762050e0b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 9 Sep 2020 05:03:03 +0800 Subject: [PATCH 0050/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200908?= =?UTF-8?q?=20Open=20source=20data=20control=20for=20cloud=20services=20wi?= =?UTF-8?q?th=20Apache=20Ranger?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200908 Open source data control for cloud services with Apache Ranger.md --- ...l for cloud services with Apache Ranger.md | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 sources/tech/20200908 Open source data control for cloud services with Apache Ranger.md diff --git a/sources/tech/20200908 Open source data control for cloud services with Apache Ranger.md b/sources/tech/20200908 Open source data control for cloud services with Apache Ranger.md new file mode 100644 index 0000000000..38e6da27a5 --- /dev/null +++ b/sources/tech/20200908 Open source data control for cloud services with Apache Ranger.md @@ -0,0 +1,63 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open source data control for cloud services with Apache Ranger) +[#]: via: (https://opensource.com/article/20/9/apache-ranger) +[#]: author: (Balaji Ganesan https://opensource.com/users/balajiganesan) + +Open source data control for cloud services with Apache Ranger +====== +Comparing different approaches to make more data available to more users +while maintaining security and compliance with data privacy regulations. +![Tools in a cloud][1] + +As the movement to migrate enterprise data to the cloud gathers steam, there is an active debate on the best approach to securing and protecting it. But before we talk about the details of the various access control frameworks, let us first understand the breadth of challenges a company faces when it begins migrating its data to the cloud. First and foremost is the wide array of storage and analysis or compute services offered by cloud and third-party providers. In other words, when a company decides to move its data to the cloud, it needs to decide the type of repository in which it is going to store its data. + +Each cloud company offers many different data stores, and there are a dozen different services to analyze data once it has been migrated to the cloud. Then there are cloud-native third-party services to allow data science platforms and data warehouses to operate as part of the leading public cloud infrastructure. Each of these services offers a unique mechanism by which to administer access to data consumers such as data analysts and scientists in the organization. + +If you think this is beginning to sound a lot like Hadoop-based data lakes, you're right. Needless to say, this places a very heavy burden on the administrators that have to make data widely available in the organization and comply with privacy and industry regulations such as California Consumer Privacy Act (CCPA), General Data Protection Regulation (GDPR), and Health Insurance Portability and Accountability Act (HIPAA) at the same time. + +### The fundamentals of two popular approaches: RBAC vs. ABAC + +Access control mechanisms have been part of the enterprise IT landscape since the advent of computer systems, and there are two key aspects to controlling access to data. The first relates to authenticating the identity of the user and establishing whether the individual or system is actually who they claim to be. The second has to do with ensuring that the user has the appropriate permission to access a data system, a process known as authorization. These principles also apply to the data stored in the cloud. Today, role-based access control (RBAC) and attribute-based access control (ABAC) are the two most prevalent approaches to managing access to data in the enterprise. The goal of these approaches is to help define and enforce the policies and privileges that grant authorized users access to the required data. + +RBAC is based on the concepts of users, roles, groups, and privileges in an organization. Administrators grant privileges or permissions to pre-defined organizational roles—roles that are assigned to subjects or users based on their responsibility or area of expertise. For example, a user who is assigned the role of a manager might have access to a different set of objects and/or is given permission to perform a broader set of actions on them as compared to a user with the assigned role of an analyst. When the user generates a request to access a data object, the access control mechanism evaluates the role assigned to the user and the set of operations this role is authorized to perform on the object before deciding whether to grant or deny the request. + +RBAC simplifies the administration of data access controls because concepts such as users and roles are well-understood constructs in a majority of organizations. In addition to being based on familiar database concepts, RBAC also offers administrators the flexibility to assign users to various roles, reassign users from one role to another, and grant or revoke permissions as required. Once an RBAC framework is established, the administrator's role is primarily to assign or revoke users to specific roles. In RBAC, a user can be assigned many roles, a role can have many users, and a role/user can perform many operations. + +The concept of attribute-based access control appeared on the scene in the early 2000s. Prior to ABAC, managing access to enterprise data involved granting a user or subject permission to perform a specific action on an entity—in this case, a database, table, or column. In ABAC, the decision to grant access or request to perform an operation on an object is based on assigned attributes of the subject, object, environment conditions, and a set of policies that are specific to those attributes and conditions. Environment conditions are dynamic factors that are independent of user or object and can include things such as the time and location of the subject. Just like subjects or users have attributes, so do objects such as databases, files, or tables. Object attributes may include author, creation date, version, effective date, last update, etc. + +ABAC operates by assigning attributes to subjects and objects and developing policies that govern rules of data access. Each component in the information system is assigned attributes that are specific to the object. For example, a file can be classified as an intellectual property (IP). Similarly, each user or subject in the system can be assigned attributes that may include the user's location and time zone. Based on these attributes, an administrator can build an access policy that specifies that any document that has been classified as IP cannot be accessed by a user who is located outside the US or that it can only be accessed by users who are affiliated with the company's legal department during the hours of 8:00am and 5:00pm PST. You can now see how ABAC extends the concept of role, users, and privileges to include attributes. + +ABAC also offers several advantages to infrastructure administrators. For instance, they do not require knowledge of specific users or subjects that need access to data. The combination of user and object attributes governed by a set of policies can accommodate an unlimited number of users. As new users are added to the platform, they, too, can be governed by the same set of rules. Because ABAC does not require administrators to have prior knowledge of the users, this approach is better suited to environments where individuals are routinely added and removed from the data platform. + +### Making the right choice + +It is important to point out that the distinction between RBAC and ABAC approaches is increasingly blurred by access control platforms such as Apache Ranger, a data governance framework originally developed to manage Big Data in Hadoop data lakes. + +Today, Apache Ranger is the leading open source project for data access governance for Big Data environments, including Apache Spark. It's in use at hundreds of enterprises around the world, utilized to define and enforce data access control policies to govern sensitive data as mandated by regulations like GDPR and CCPA. + +Apache Ranger was built to centrally manage access to data used by different engines that are part of the Hadoop platforms. It is inherently architected to handle the diversity of data storage and compute environments presented by multiple cloud services in use at enterprises today. + +Apache Ranger's approach to data authorization is based on ABAC, which is a combination of the subject, action, resource, and environment. At the same time, Ranger can provide fine-grained access control to users based on the concepts of role, user, and permission. + +The best strategy for organizations migrating to the cloud is to select a data access control platform that strikes a balance between empowering administrators to make more data available to more data consumers and complying with industry and privacy regulations. More importantly, it must do this without adversely affecting the performance of the data platform or user behavior.  + +Looking for ways to draw meaningful conclusions from big data? Rommel Garcia runs through three... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/apache-ranger + +作者:[Balaji Ganesan][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://opensource.com/users/balajiganesan +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cloud_tools_hardware.png?itok=PGjJenqT (Tools in a cloud) From 2905fcec8ca939bdc915050b92e943213faf58a1 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 9 Sep 2020 08:32:54 +0800 Subject: [PATCH 0051/1156] translating --- ...sole using Python and Jupyter Notebooks.md | 111 ------------------ ...sole using Python and Jupyter Notebooks.md | 111 ++++++++++++++++++ 2 files changed, 111 insertions(+), 111 deletions(-) delete mode 100644 sources/tech/20200904 Build a remote management console using Python and Jupyter Notebooks.md create mode 100644 translated/tech/20200904 Build a remote management console using Python and Jupyter Notebooks.md diff --git a/sources/tech/20200904 Build a remote management console using Python and Jupyter Notebooks.md b/sources/tech/20200904 Build a remote management console using Python and Jupyter Notebooks.md deleted file mode 100644 index 2c6d25c1aa..0000000000 --- a/sources/tech/20200904 Build a remote management console using Python and Jupyter Notebooks.md +++ /dev/null @@ -1,111 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Build a remote management console using Python and Jupyter Notebooks) -[#]: via: (https://opensource.com/article/20/9/remote-management-jupyter) -[#]: author: (Moshe Zadka https://opensource.com/users/moshez) - -Build a remote management console using Python and Jupyter Notebooks -====== -Turn Jupyter into a remote administration console. -![Computer laptop in space][1] - -Secure shell (SSH) is a powerful tool for remote administration, but it lacks some niceties. Writing a full-fledged remote administration console sounds like it would be a lot of work. Surely, someone in the open source community has already written something? - -They have, and its name is [Jupyter][2]. You might think Jupyter is one of those tools data scientists use to analyze trends in ad clicks over a week or something. This is not wrong—they do, and it is a great tool for that. But that is just scratching its surface. - -### About SSH port forwarding - -Sometimes, there is a server that you can SSH into over port 22. There is no reason to assume you can connect to any other port. Maybe you are SSHing through another "jumpbox" server that has more access or there are host or network firewalls that restrict ports. There are good reasons to restrict IP ranges for access, of course. SSH is a secure protocol for remote management, but allowing anyone to connect to any port is quite unnecessary. - -Here is an alternative: Run a simple SSH command with port forwarding to forward a local port to a _remote_ _local_ connection. When you run an SSH port-forwarding command like `-L 8111:127.0.0.1:8888`, you are telling SSH to forward your _local_ port `8111` to what the _remote_ host thinks `127.0.0.1:8888` is. The remote host thinks `127.0.0.1` is itself. - -Just like on _Sesame Street_, "here" is a subtle word. - -The address `127.0.0.1` is how you spell "here" to the network. - -### Learn by doing - -This might sound confusing, but running this is less complicated than explaining it: - - -``` -$ ssh -L 8111:127.0.0.1:8888 moshez@172.17.0.3 -Linux 6ad096502e48 5.4.0-40-generic #44-Ubuntu SMP Tue Jun 23 00:01:04 UTC 2020 x86_64 - -The programs included with the Debian GNU/Linux system are free software; -the exact distribution terms for each program are described in the -individual files in /usr/share/doc/*/copyright. - -Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent -permitted by applicable law. -Last login: Wed Aug  5 22:03:25 2020 from 172.17.0.1 -$ jupyter/bin/jupyter lab --ip=127.0.0.1 -[I 22:04:29.771 LabApp] JupyterLab application directory is /home/moshez/jupyter/share/jupyter/lab -[I 22:04:29.773 LabApp] Serving notebooks from local directory: /home/moshez -[I 22:04:29.773 LabApp] Jupyter Notebook 6.1.1 is running at: -[I 22:04:29.773 LabApp] -<MORE STUFF SNIPPED> -``` - -Port-forward `8111` to `127.0.0.1` and start Jupyter on the remote host that's listening on `127.0.0.1:8888`. - -Now you need to understand that Jupyter is lying. It thinks you need to connect to port `8888`, but you forwarded that to port `8111`. So, after you copy the URL to your browser, but before clicking Enter, modify the port from `8888` to `8111`: - -![Jupyter remote management console][3] - -(Moshe Zadka, [CC BY-SA 4.0][4]) - -There it is: your remote management console. As you can see, there is a "Terminal" icon at the bottom. Click it to get a terminal: - -![Terminal in Jupyter remote console][5] - -(Moshe Zadka, [CC BY-SA 4.0][4]) - -You can run a command. Creating a file will show it in the file browser on the side. You can click on that file to open it in an editor that is running locally: - -![Opening a file][6] - -(Moshe Zadka, [CC BY-SA 4.0][4]) - -You can also download, rename, or delete files: - -![File options in Jupyter remote console][7] - -(Moshe Zadka, [CC BY-SA 4.0][4]) - -Clicking on the little **Up arrow** will let you upload files. Why not upload the screenshot above? - -![Uploading a screenshot][8] - -(Moshe Zadka, [CC BY-SA 4.0][4]) - -As a nice final tidbit, Jupyter lets you view the remote images directly by double-clicking on them. - -Oh, right, and if you want to do systems automation using Python, you can also use Jupyter to open a notebook. - -So the next time you need to remotely manage a firewalled environment, why not use Jupyter? - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/9/remote-management-jupyter - -作者:[Moshe Zadka][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://opensource.com/users/moshez -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_space_graphic_cosmic.png?itok=wu493YbB (Computer laptop in space) -[2]: https://jupyter.org/ -[3]: https://opensource.com/sites/default/files/uploads/output_1_0.png (Jupyter remote management console) -[4]: https://creativecommons.org/licenses/by-sa/4.0/ -[5]: https://opensource.com/sites/default/files/uploads/output_3_0.png (Terminal in Jupyter remote console) -[6]: https://opensource.com/sites/default/files/uploads/output_5_0.png (Opening a file) -[7]: https://opensource.com/sites/default/files/uploads/output_7_0.png (File options in Jupyter remote console) -[8]: https://opensource.com/sites/default/files/uploads/output_9_0.png (Uploading a screenshot) diff --git a/translated/tech/20200904 Build a remote management console using Python and Jupyter Notebooks.md b/translated/tech/20200904 Build a remote management console using Python and Jupyter Notebooks.md new file mode 100644 index 0000000000..5126bb57ff --- /dev/null +++ b/translated/tech/20200904 Build a remote management console using Python and Jupyter Notebooks.md @@ -0,0 +1,111 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Build a remote management console using Python and Jupyter Notebooks) +[#]: via: (https://opensource.com/article/20/9/remote-management-jupyter) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +使用 Python 和 Jupyter Notebooks 构建一个远程管理控制台 +====== +把 Jupyter 变成一个远程管理控制台。 +![Computer laptop in space][1] + +SSH 是一个强大的远程管理工具,但它缺乏一些细节。编写一个成熟的远程管理控制台听起来好像是一件很费劲的事情。当然,开源社区中肯定有人已经写了一些东西。 + +他们已经写了,它的名字是 [Jupyter][2]。你可能会认为 Jupyter 是那些数据科学家用来分析一周内的广告点击趋势之类的工具。这并没有错,他们确实是这样做的,而且它是一个很好的工具。但这只是它的表面。 + +### 关于 SSH 端口转发 + +有时,你可以通过 22 端口进入一台服务器。没有理由认为你可以连接到任何其他端口。也许你是通过另一个有更多访问权限的”堡垒机“,或者有主机或者限制端口的网络防火墙访问 SSH。当然,限制访问的 IP 范围是有充分理由的。SSH 是远程管理的安全协议,但允许任何人连接到任何端口是相当不必要的。 + +这里有一个替代方案:运行一个简单的 SSH 端口转发命令,将本地端口转发到一个_远程本地_连接上。当你运行像 `-L 8111:127.0.0.1:8888` 这样的 SSH 端口转发命令时,你是在告诉 SSH 将你的_本地_端口 `8111` 转发到_远程_主机 `127.0.0.1:8888`。远程主机认为 `127.0.0.1` 就是它本身。 + +就像在_芝麻街_一样,“这里”(here)是一个微妙的词。 + +地址 `127.0.0.1` 就是你告诉网络的“这里”。 + +### 实际动手学习 + +这可能听起来很混乱,但运行比解释它更简单。 + + +``` +$ ssh -L 8111:127.0.0.1:8888 moshez@172.17.0.3 +Linux 6ad096502e48 5.4.0-40-generic #44-Ubuntu SMP Tue Jun 23 00:01:04 UTC 2020 x86_64 + +The programs included with the Debian GNU/Linux system are free software; +the exact distribution terms for each program are described in the +individual files in /usr/share/doc/*/copyright. + +Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent +permitted by applicable law. +Last login: Wed Aug  5 22:03:25 2020 from 172.17.0.1 +$ jupyter/bin/jupyter lab --ip=127.0.0.1 +[I 22:04:29.771 LabApp] JupyterLab application directory is /home/moshez/jupyter/share/jupyter/lab +[I 22:04:29.773 LabApp] Serving notebooks from local directory: /home/moshez +[I 22:04:29.773 LabApp] Jupyter Notebook 6.1.1 is running at: +[I 22:04:29.773 LabApp] +<MORE STUFF SNIPPED> +``` + +端口转发 `8111` 到 `127.0.0.1`,并在远程主机上启动 Jupyter,它在 `127.0.0.1:8888` 上监听。 + +现在你要明白,Jupyter 在撒谎。它认为你需要连接到 `8888` 端口,但你把它转发到 `8111` 端口。所以,当你把 URL 复制到浏览器后,但在点击回车之前,把端口从 `8888` 修改为 `8111`。 + +![Jupyter remote management console][3] + +(Moshe Zadka, [CC BY-SA 4.0][4]) + +这就是你的远程管理控制台。如你所见,底部有一个“终端”图标。点击它可以启动一个终端。 + +![Terminal in Jupyter remote console][5] + +(Moshe Zadka, [CC BY-SA 4.0][4]) + +你可以运行一条命令。创建一个文件会在旁边的文件浏览器中显示出来。你可以点击该文件,在本地的编辑器中打开它。 + +![Opening a file][6] + +(Moshe Zadka, [CC BY-SA 4.0][4]) + +你还可以下载、重命名或删除文件: + +![File options in Jupyter remote console][7] + +(Moshe Zadka, [CC BY-SA 4.0][4]) + +点击**上箭头**就可以上传文件了。为什么不上传上面的截图呢? + +![Uploading a screenshot][8] + +(Moshe Zadka, [CC BY-SA 4.0][4]) + +最后说个小功能,Jupyter 可以让你直接通过双击远程图像查看。 + +哦,对了,如果你想用 Python 做系统自动化,还可以用 Jupyter 打开笔记本。 + +所以,下次你需要远程管理防火墙环境的时候,为什么不使用 Jupyter 呢? + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/remote-management-jupyter + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_space_graphic_cosmic.png?itok=wu493YbB (Computer laptop in space) +[2]: https://jupyter.org/ +[3]: https://opensource.com/sites/default/files/uploads/output_1_0.png (Jupyter remote management console) +[4]: https://creativecommons.org/licenses/by-sa/4.0/ +[5]: https://opensource.com/sites/default/files/uploads/output_3_0.png (Terminal in Jupyter remote console) +[6]: https://opensource.com/sites/default/files/uploads/output_5_0.png (Opening a file) +[7]: https://opensource.com/sites/default/files/uploads/output_7_0.png (File options in Jupyter remote console) +[8]: https://opensource.com/sites/default/files/uploads/output_9_0.png (Uploading a screenshot) From 4e79057d1505b8f0a3477f906ec0626f4888729b Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 9 Sep 2020 08:36:33 +0800 Subject: [PATCH 0052/1156] translating --- ...cognize more devices on Linux with this USB ID Repository.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200824 Recognize more devices on Linux with this USB ID Repository.md b/sources/tech/20200824 Recognize more devices on Linux with this USB ID Repository.md index 1a5270f736..0194513cf0 100644 --- a/sources/tech/20200824 Recognize more devices on Linux with this USB ID Repository.md +++ b/sources/tech/20200824 Recognize more devices on Linux with this USB ID Repository.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 1b854746063bf940a534b846d569d5ee261e6941 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 10 Sep 2020 05:02:05 +0800 Subject: [PATCH 0053/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200909?= =?UTF-8?q?=20Manage=20your=20SSH=20connections=20with=20this=20open=20sou?= =?UTF-8?q?rce=20tool?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200909 Manage your SSH connections with this open source tool.md --- ... connections with this open source tool.md | 132 ++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 sources/tech/20200909 Manage your SSH connections with this open source tool.md diff --git a/sources/tech/20200909 Manage your SSH connections with this open source tool.md b/sources/tech/20200909 Manage your SSH connections with this open source tool.md new file mode 100644 index 0000000000..18fcb43ec6 --- /dev/null +++ b/sources/tech/20200909 Manage your SSH connections with this open source tool.md @@ -0,0 +1,132 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Manage your SSH connections with this open source tool) +[#]: via: (https://opensource.com/article/20/9/ssh-connection-manager) +[#]: author: (Kenneth Aaron https://opensource.com/users/flyingrhino) + +Manage your SSH connections with this open source tool +====== +This open source project makes connecting to any SSH session quick and +seamless, and downright relaxing. +![Penguins][1] + +OpenSSH is widely used, but there isn't a well-known connection manager, so I developed the ncurses SSH connection manager (`nccm`) to fill that significant gap in the process. `nccm` is a simple SSH connection manager with an ultra-portable terminal interface (written in ncurses, as the project name suggests). And best of all, it's straightforward to use. With `nccm`, you can connect to an SSH session of your choice with minimum distraction and minimal keystrokes. + +### Install nccm + +The quickest way to get going is to clone the project from its [Git repository][2]: + + +``` +`$ git clone https://github.com/flyingrhinonz/nccm nccm.git` +``` + +In the `nccm.git/nccm` directory, there are two files—`nccm` itself and an `nccm.yml` configuration file. + +First, copy the nccm script to `/usr/local/bin/` and grant it executable permissions. You can do this in one step with the `install` command: + + +``` +$ sudo install -m755 nccm +–target-directory /usr/local/bin +``` + +The `nccm.yml` file can be copied to any one of these locations, and is loaded from the first location found: + + * `~/.config/nccm/nccm.yml` + * `~/.nccm.yml` + * `~/nccm.yml` + * `/etc/nccm.yml` + + + +The `nccm` command requires Python 3 to be installed on your machine, which shouldn't be a problem on most Linux boxes. Most Python library dependencies are already present as part of Python 3; however, there are some YAML dependencies and utilities you must install. + +If you don't have `pip` installed, you can install it with your package manager. And while you're at it, install the `yamllint` application to help you validate the `nccm.yml` file. + +On Debian or similar, use `apt`: + + +``` +`$ sudo apt install python3-pip yamllint` +``` + +On Fedora or similar, use `dnf`: + + +``` +`$ sudo dnf install python3-pip yamllint` +``` + +You also need PyYAML, which you can install with the `pip` command: + + +``` +`$ pip3 install --user PyYAML` +``` + +### Using nccm + +Before starting, edit the `nccm.yml` file and add your SSH configuration. Formatting YAML is easy, and there are examples provided in the file. Just follow the structure—provide the connection name at the beginning of the line, with config items indented two spaces. Don't forget the colons—these are part of the YAML language. + +Don't worry about ordering your SSH session blocks in any specific way, because `nccm` gives you "sort by" options within the program. + +Once you've finished editing, check your work with `yamllint`: + + +``` +`$ yamllint ~/.config/nccm/nccm.yml` +``` + +If no errors are returned, then you've formatted your file correctly, and it's safe to continue. + +If `nccm` is accessible [from your path][3] and is executable, then typing `nccm` is all that's required to launch the TUI (terminal user interface). If you see Python 3 exceptions, check whether you have satisfied the dependencies. Any exceptions should mention any package that's missing. + +As long as you're using the YAML config file without changing `nccm_config_control mode`, then you can use these keyboard controls: + + * Up/Down arrows - Move the marker the traditional way + * Home/End - Jump marker to list first/last entry + * PgUp/PgDn - Page up/down in the list + * Left/Right arrows - Scroll the list horizontally + * TAB - Moves the cursor between text boxes + * Enter - Connect to the selected entry + * Ctrl-h - Display this help menu + * Ctrl-q or Ctrl-c - Quit the program + * F1-F5 or !@#$% - Sort by respective column (1-5) + + + +Use keys F1 through F5 to sort by columns 1 through 5. If your desktop captures F-key input, you can instead sort by pressing **!@#$%** in the "Conn" text box. The display shows 4 visible columms but we treat username and server address as separate columns for sorting purposes giving us 5 controls for sorting. You can reverse the order by pressing the same "sort" key a second time. A connection can be made by pressing **Enter** on the highlighted line. + +![nccm screenshot terminal view][4] + +Typing text into the "Filter" text box filters the output with an "and" function between everything entered. This is case-insensitive, and a blank space delimits entries. The same is true for the "Conn" text box, but pressing **Enter** here connects to that specific entry number. + +There are a few more interesting features to discover, such as focus mode, but I'll leave it up to you to explore the details. See the project page or built-in help for more details. + +The config YAML file is well-documented, so you'll know how to edit the settings to make `nccm` work best for you. The `nccm` program is highly commented, too, so you may wish to fork or mod it to add more features. Pull requests are welcome! + +### Relax into SSH with nccm + +I hope this program serves you well and is as useful to you as it is to me. Thanks for being part of the open source community, and please accept `nccm` as my contribution to the ongoing efforts toward seamless, painless, and efficient computing experiences. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/ssh-connection-manager + +作者:[Kenneth Aaron][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://opensource.com/users/flyingrhino +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux-penguins.png?itok=yKOpaJM_ (Penguins) +[2]: https://github.com/flyingrhinonz/nccm +[3]: https://opensource.com/article/17/6/set-path-linux +[4]: https://opensource.com/sites/default/files/uploads/nccm_screenshot.png (nccm screenshot terminal view) From 406ca568ca4adae7d651e3c36a76dbfca2281429 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 10 Sep 2020 05:02:20 +0800 Subject: [PATCH 0054/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200909?= =?UTF-8?q?=20Create=20a=20slide=20deck=20using=20Jupyter=20Notebooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200909 Create a slide deck using Jupyter Notebooks.md --- ...te a slide deck using Jupyter Notebooks.md | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 sources/tech/20200909 Create a slide deck using Jupyter Notebooks.md diff --git a/sources/tech/20200909 Create a slide deck using Jupyter Notebooks.md b/sources/tech/20200909 Create a slide deck using Jupyter Notebooks.md new file mode 100644 index 0000000000..5ba0d7fe1a --- /dev/null +++ b/sources/tech/20200909 Create a slide deck using Jupyter Notebooks.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Create a slide deck using Jupyter Notebooks) +[#]: via: (https://opensource.com/article/20/9/presentation-jupyter-notebooks) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +Create a slide deck using Jupyter Notebooks +====== +Jupyter may not be the most straightforward way to create presentation +slides and handouts, but it affords more control than simpler options. +![Person reading a book and digital copy][1] + +There are many options when it comes to creating slides for a presentation. There are straightforward ways, and generating slides directly from [Jupyter][2] is not one of them. But I was never one to do things the easy way. I also have high expectations that no other slide-generation software quite meets. + +### Why transition from slides to Jupyter? + +I want four features in my presentation software: + + 1. An environment where I can run the source code to check for errors + 2. A way to include speaker notes but hide them during the presentation + 3. To give attendees a useful handout for reading + 4. To give attendees a useful handout for exploratory learning + + + +There is nothing more uncomfortable about giving a talk than having someone in the audience point out that there is a coding mistake on one of my slides. Often, it's misspelling a word, forgetting a return statement, or doing something else that becomes invisible as soon as I leave my development environment, where I have [a linter][3] running to catch these mistakes. + +After having one too many of these moments, I decided to find a way to run the code directly from my slide editor to make sure it is correct. There are three "gotchas" I needed to consider in my solution: + + * A lot of code is boring. Nobody cares about three slides worth of `import` statements, and my hacks to mock out the `socket` module distract from my point. But it's essential that I can test the code without creating a network outage. + * Including boilerplate code is _almost_ as boring as hearing me read words directly off of the slide. We have all heard (or even given) talks where there are three bullet points, and the presenter reads them verbatim. I try to avoid this behavior by using speaker notes. + * There is nothing more annoying to the audience when the talk's reference material doesn't have any of the speaker notes. So I want to generate a beautiful handout containing all of my notes and the slides from the same source. Even better, I don't want to have slides on one handout and a separate GitHub repository for the source code. + + + +As is often the case, to solve this issue, I found myself reaching for [JupyterLab][4] and its notebook management capabilities. + +### Using Jupyter Notebooks for presentations + +I begin my presentations by using Markdown and code blocks in a Jupyter Notebook, just like I would for anything else in JupyterLab. I write out my presentation using separate Markdown sections for the text I want to show on the slides and for the speaker notes. Code snippets go into their own blocks, as you would expect. + +Because you can add a "tag" to cells, I tag any cell that has "boring" code as `no_markdown`. + +![Using tags in Jupyter Notebook][5] + +(Moshe Zadka, [CC BY-SA 4.0][6]) + +Then I convert my Notebook to Markdown with: + + +``` +`$ jupyter nbconvert presentation.ipynb --to markdown --TagRemovePreprocessor.remove_cell_tags='{"no_markdown"}'  --output build/presentation.md` +``` + +There are ways to [convert Markdown to slides][7]—but I have no idea how to use any of them and even less desire to learn. Plus, I already have my favorite presentation-creation tool: [Beamer][8]. + +But Beamer requires custom LaTeX, and that is not usually generated when you convert Markdown to LaTeX. Thankfully, one Markdown implementation–[Pandoc Markdown][9]—has a feature that lets me do what I want. Its [raw_attribute][10] extension allows including "raw" bits of the target format in the Markdown. + +This means if I run `pandoc` on the Markdown export from a notebook that includes `raw_attribute` LaTeX bits, I can have as much control over the LaTeX as I want: + + +``` +`$ pandoc --listings -o build/presentation.tex build/presentation.md` +``` + +The `--listings` makes `pandoc` use LaTeX's `listings` package, which makes code look much prettier. Putting those two pieces together, I can generate LaTeX from the notebook. + +Through a series of conversion steps, I was able to hide the parts I wanted to hide by using: + + * LaTeX `raw_attribute` bits inside Jupyter Notebook's Markdown cells + * Tagging boring cells as `no_markdown` + * Jupyter's "nbconvert" to convert the notebook to Markdown + * Pandoc to convert the Markdown to LaTeX while interpolating the `raw_attribute` bits + * Beamer to convert the Pandoc output to a PDF slide-deck + * Beamer's beamerarticle mode + + + +All combined with a little bit of duct-tape, in the form of a UNIX shell script, to produce slide-deck creation software. Ultimately, this pipeline works for me. With these tools, or similar, and some light UNIX scripting, you can make your own customized slide created pipeline, optimized to your needs and preferences. + +What is the most complicated pipeline you have ever used to build a slide deck? Let me know about it—and whether you would use it again—in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/presentation-jupyter-notebooks + +作者:[Moshe Zadka][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://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/read_book_guide_tutorial_teacher_student_apaper.png?itok=_GOufk6N (Person reading a book and digital copy) +[2]: https://jupyter.org/ +[3]: https://opensource.com/article/19/5/python-flake8 +[4]: https://jupyterlab.readthedocs.io/en/stable/index.html +[5]: https://opensource.com/sites/default/files/uploads/jupyter_presentations_tags.png (Using tags in Jupyter Notebook) +[6]: https://creativecommons.org/licenses/by-sa/4.0/ +[7]: https://opensource.com/article/18/5/markdown-slide-generators +[8]: https://opensource.com/article/19/1/create-presentations-beamer +[9]: https://pandoc.org/MANUAL.html#pandocs-markdown +[10]: https://pandoc.org/MANUAL.html#extension-raw_attribute From 410711513af205249ff84978fb9b7f2ba179091d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 10 Sep 2020 05:03:26 +0800 Subject: [PATCH 0055/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200909?= =?UTF-8?q?=20Using=20the=20Linux=20stat=20command=20to=20create=20flexibl?= =?UTF-8?q?e=20file=20listings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200909 Using the Linux stat command to create flexible file listings.md --- ...ommand to create flexible file listings.md | 138 ++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 sources/tech/20200909 Using the Linux stat command to create flexible file listings.md diff --git a/sources/tech/20200909 Using the Linux stat command to create flexible file listings.md b/sources/tech/20200909 Using the Linux stat command to create flexible file listings.md new file mode 100644 index 0000000000..50aa2b3c7f --- /dev/null +++ b/sources/tech/20200909 Using the Linux stat command to create flexible file listings.md @@ -0,0 +1,138 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using the Linux stat command to create flexible file listings) +[#]: via: (https://www.networkworld.com/article/3573802/using-the-linux-stat-command-to-create-flexible-file-listings.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Using the Linux stat command to create flexible file listings +====== + +D3Damon / Getty Images + +The **stat** command supplies a lot of detailed information on files. + +It provides not just the date/time of the most recent file changes, but also shows when files were most recently accessed and permissions changed. It tells you the file size in both bytes and blocks. It displays the inode being used by the file along with the file type. It includes the file owner and the associated user group both by name and UID/GID. It displays file permissions in both the “rwx” (referred to as the “human-readable” format) and numerically. On some systems, it might even include the date and time that a file was created (called its “birth”). + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +In addition to providing all this information, the **stat** command can also be used to create file listings. These listings are extremely flexible in that you can choose to include any or all of the information described above. + +To generate a custom listing, you just need to use the **stat** command’s **-c** (or --**format**) option and specify the fields you want included. For example, to create a listing that shows file permissions in both of the available formats, use this command: + +``` +$ stat -c '%n %a %A' my* +my.banner 664 -rw-rw-r-- +mydir 775 drwxrwxr-x +myfile 664 -rw-rw-r-- +myjunk 777 lrwxrwxrwx +mykey 664 -rw-rw-r-- +mylog 664 -rw-rw-r-- +myscript 755 -rwxr-xr-x +mytext 664 -rw-rw-r-- +mytext.bak 664 -rw-rw-r-- +mytwin 50 -rw-r----- +mywords 664 -rw-rw-r-- +``` + +As you can see in the example above, **%n** represents the file name, **%a** the permissions in octal and **%A** the permissions in the **rwx** form. A complete list is shown below. + +To create an alias for this command, type this or add this definition to your **.bashrc** file: + +``` +$ alias ls_perms="stat -c '%n %a %A'" +``` + +To create a listing that is very close to the long listing provided by **ls -l**, do this: + +``` +$ stat -c '%A %h %U %G %s %y %n' my* +-rw-rw-r-- 1 shs shs 255 2020-04-01 16:20:00.899374215 -0400 my.banner +drwxrwxr-x 2 shs shs 4096 2020-09-07 12:50:20.224470760 -0400 mydir +-rw-rw-r-- 1 shs shs 6 2020-05-16 11:12:00.460355387 -0400 myfile +lrwxrwxrwx 1 shs shs 11 2020-05-28 18:49:21.666792608 -0400 myjunk +-rw-rw-r-- 1 shs shs 655 2020-01-14 15:56:08.540540488 -0500 mykey +-rw-rw-r-- 1 shs shs 8 2020-03-04 17:13:21.406874246 -0500 mylog +-rwxr-xr-x 1 shs shs 201 2020-09-07 12:50:41.316745867 -0400 myscript +-rw-rw-r-- 1 shs shs 40 2019-06-06 08:54:09.538663323 -0400 mytext +-rw-rw-r-- 1 shs shs 24 2019-06-06 08:48:59.652712578 -0400 mytext.bak +-rw-r----- 2 shs shs 228 2019-04-12 19:37:12.790284604 -0400 mytwin +-rw-rw-r-- 1 shs shs 1983 2020-08-10 14:39:57.164842370 -0400 mywords +``` + +The differences include: 1) no attempt to line up the fields in discernible columns, 2) the date in a _**yyyy-mm-dd**_ format, 3) considerably more precision in the time field and 4) the addition of the time zone (-0400 is EDT). + +If you want to see files listed according to the date they were most last accessed (e.g., displayed with the **cat** command), use a command like this: + +``` +$ stat -c '%n %x' my* | sort -k2 +mytwin 2019-04-22 11:25:20.656828964 -0400 +mykey 2020-08-20 16:10:34.479324431 -0400 +mylog 2020-08-20 16:10:34.527325066 -0400 +myfile 2020-08-20 16:10:57.815632794 -0400 +mytext.bak 2020-08-20 16:10:57.935634379 -0400 +mytext 2020-08-20 16:15:42.323391985 -0400 +mywords 2020-08-20 16:15:43.479407259 -0400 +myjunk 2020-09-07 10:04:26.543980300 -0400 +myscript 2020-09-07 12:50:41.312745815 -0400 +my.banner 2020-09-07 13:22:38.105826116 -0400 +mydir 2020-09-07 14:53:10.171867194 -0400 +``` + +The field options available for listing file details with **stat** include: + + * %a – access rights in octal (note '#' and '0' printf flags) + * %A – access rights in human readable form + * %b – number of blocks allocated (see %B) + * %B – the size in bytes of each block reported by %b + * %C – SELinux security context string + * %d – device number in decimal + * %D – device number in hex + * %f – raw mode in hex + * %F – file type + * %g – group ID of owner + * %G – group name of owner + * %h – number of hard links + * %i – inode number + * %m – mount point + * %n – file name + * %N – quoted file name with dereference if symbolic link + * %o – optimal I/O transfer size hint + * %s – total size, in bytes + * %t – major device type in hex, for character/block device special files + * %T – minor device type in hex, for character/block device special files + * %u – user ID of owner + * %U – user name of owner + * %w – time of file birth, human-readable; - if unknown + * %W – time of file birth, seconds since Epoch; 0 if unknown + * %x – time of last access, human-readable + * %X – time of last access, seconds since Epoch + * %y – time of last data modification, human-readable + * %Y – time of last data modification, seconds since Epoch + * %z – time of last status change, human-readable + * %Z – time of last status change, seconds since Epoch + + + +These field choices are all listed in the man page and you can choose any, though creating a few aliases with your preferred details should save you a lot of trouble. Some options, like the SELinux security context string, will not be available unless that option is in use on the system. File birth is only available if your system retains that information. + +Join the Network World communities on [Facebook][2] and [LinkedIn][3] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3573802/using-the-linux-stat-command-to-create-flexible-file-listings.html + +作者:[Sandra Henry-Stocker][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://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world From 0500a7f16c89c97da9d0d882aeb4c8e3235f9541 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 10 Sep 2020 08:42:07 +0800 Subject: [PATCH 0056/1156] translated --- ... an open source alternative to InDesign.md | 127 ------------------ ... an open source alternative to InDesign.md | 126 +++++++++++++++++ 2 files changed, 126 insertions(+), 127 deletions(-) delete mode 100644 sources/tech/20200902 Design a book cover with an open source alternative to InDesign.md create mode 100644 translated/tech/20200902 Design a book cover with an open source alternative to InDesign.md diff --git a/sources/tech/20200902 Design a book cover with an open source alternative to InDesign.md b/sources/tech/20200902 Design a book cover with an open source alternative to InDesign.md deleted file mode 100644 index b9a54b1006..0000000000 --- a/sources/tech/20200902 Design a book cover with an open source alternative to InDesign.md +++ /dev/null @@ -1,127 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Design a book cover with an open source alternative to InDesign) -[#]: via: (https://opensource.com/article/20/9/open-source-publishing-scribus) -[#]: author: (Jim Hall https://opensource.com/users/jim-hall) - -Design a book cover with an open source alternative to InDesign -====== -Use the open source publishing software, Scribus to create a cover for -your next self-published book. -![Stack of books for reading][1] - -I recently finished writing a book about [C programming][2], which I self-published through [Lulu.com][3]. I've used Lulu for several book projects, and it's a great platform. Earlier this year, Lulu made changes that give authors greater control over creating their book covers. Previously, you just uploaded a pair of large-format images for the front and back book covers. Now, Lulu allows authors to upload a custom PDF exactly sized to your book's dimensions. - -You can create the cover using [Scribus][4], the open source page layout program. Here's how I do it. - -### Download a template - -When you're entering your book project information on Lulu's website, eventually, you'll navigate to the **Design** tab. Under the **Design Your Cover** section on this page, you will find a handy **Download Template** button that provides a PDF template for your book cover. - -![Lulu Design your Cover page][5] - -(Jim Hall, [CC BY-SA 4.0][6]) - -Download this template, which gives you the information you need to create your own book cover in Scribus. - -![Lulu's cover template][7] - -(Jim Hall, [CC BY-SA 4.0][6]) - -The most important details are: - - * Total document size (with bleed) - * Bleed area (from trim edge) - * Spine area - - - -**Bleed** is a printing term that is important when preparing a **print-ready** file for a printer. It is different from a margin in a regular document. When you print a document, you set a page margin for the top, bottom, and sides. In most documents, the margin is usually around an inch. - -But in print-ready files, the document size needs to be a little bigger than the finished book because book covers usually include colors or pictures that go all the way to the cover's edge. To create this design, you make the colors or images go beyond your margin, and the print shop trims off the excess to get the cover down to the exact size. Therefore, the **trim** is where the print shop cuts the cover exactly to size. The **bleed area** is the extra part the printer cuts off. - -If you didn't have a bleed, the print shop would have a hard time printing the cover exactly to size. If the printer was off by only a little bit, your cover would end up with a tiny, white, unprinted border on one edge. Using a bleed and trim means your cover looks right every time. - -### Set up your book cover document in Scribus - -To create a new document in Scribus, start with the **New Document** dialog box where you define the document's dimensions. Click on the **Bleeds** tab and enter the bleed size the PDF template says to use. Lulu books usually use 0.125" bleeds on all edges. - -For the total document dimension in Scribus, you can't just use the total document size on the PDF template. If you do, your Scribus document will have the wrong dimensions. Instead, you need to do a little math to get the right size. - -Look at **Total Document Size (with bleed)** on the PDF template. This is the total size of the PDF that will be sent to the printer, and it includes the back cover, the book spine, and the front cover—including the bleeds. To enter the right dimensions in Scribus, you have to subtract the bleeds from all edges. For example, my latest book is Crown quarto size, which is 7.44" x 9.68" with a spine width of 0.411" after it's bound. With 0.125" bleeds, the **Total Document Size (with bleed)** is 15.541" x 9.93". So, my document size in Scribus is: - - * Width: 15.541-(2 x 0.125)=15.291" - * Height: 9.93-(2 x 0.125)=9.68" - - - -![Scribus document setup][8] - -(Jim Hall, [CC BY-SA 4.0][6]) - -This sets up a new Scribus document that's the right size for my book cover. The new Scribus document dimensions should match exactly what is listed as the **Total Document Size (with bleed)** on the PDF template. - -### Start with the spine - -When I create a new book cover in Scribus, I like to start with the spine area. This helps me verify that I defined the document correctly in Scribus. - -Use the **Rectangle** tool to draw a colored box on the document where the book's spine needs to go. You don't have to draw it exactly the right size and location; just get close and use the **Properties** to set the correct values. In the shape's **Properties**, select the upper-left base point, and enter the x,y position and dimensions where the spine needs to go. Again, you'll need to do a little math and use the dimensions on the PDF template as a reference. - -![Empty Scribus document][9] - -(Jim Hall, [CC BY-SA 4.0][6]) - -For example, my book's trim size is 7.44" x 9.68"; that's the size of the front and back covers after the printer trims it. My book's spine area is 0.411", and its bleed is 0.125". That means the correct upper-left x,y position for the book's spine is: - - * X-Pos (bleed + trim width): 0.411+7.44=7.8510" - * Y-Pos (minus bleed): -0.125" - - - -The rectangle's dimensions are the full height (including bleed) of my book cover and the spine width indicated in the PDF template: - - * Width: 0.411" - * Height: 9.93" - - - -Set the rectangle's **Fill** to your favorite color and the **Stroke** to **None** to hide the border. If you defined your Scribus document correctly, you should end up with a rectangle that stretches to the top and bottom edges of your book cover positioned in the center of the document. - -![Book spine in Scribus][10] - -(Jim Hall, [CC BY-SA 4.0][6]) - -If the rectangle doesn't fit the document exactly, you probably set the wrong dimensions when you created the Scribus document. Since you haven't put a lot of effort into the book cover yet, it's probably easiest to start over rather than trying to fix your mistakes. - -### The rest is up to you - -From there, you can create the rest of your book's cover. Always use the PDF template as a guide. The back cover is on the left, and the front cover is on the right. - -I can manage a simple book cover, but I lack the artistic abilities to create a truly eye-catching design. After designing several of my own book covers, I've gained respect for those who can design a good cover. But if you just need to create a simple book cover, you can do it yourself with open source software. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/9/open-source-publishing-scribus - -作者:[Jim Hall][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://opensource.com/users/jim-hall -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/books_read_list_stack_study.png?itok=GZxb9OAv (Stack of books for reading) -[2]: https://opensource.com/article/20/8/c-programming-cheat-sheet -[3]: https://www.lulu.com/ -[4]: https://www.scribus.net/ -[5]: https://opensource.com/sites/default/files/uploads/lulu-download-template.jpg (Lulu Design your Cover page) -[6]: https://creativecommons.org/licenses/by-sa/4.0/ -[7]: https://opensource.com/sites/default/files/uploads/lulu-pdf-template.jpg (Lulu's cover template) -[8]: https://opensource.com/sites/default/files/uploads/scribus-new-document.jpg (Scribus document setup) -[9]: https://opensource.com/sites/default/files/uploads/scribus-empty-document.jpg (Empty Scribus document) -[10]: https://opensource.com/sites/default/files/uploads/scribus-spine-rectangle.jpg (Book spine in Scribus) diff --git a/translated/tech/20200902 Design a book cover with an open source alternative to InDesign.md b/translated/tech/20200902 Design a book cover with an open source alternative to InDesign.md new file mode 100644 index 0000000000..eaac4172f6 --- /dev/null +++ b/translated/tech/20200902 Design a book cover with an open source alternative to InDesign.md @@ -0,0 +1,126 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Design a book cover with an open source alternative to InDesign) +[#]: via: (https://opensource.com/article/20/9/open-source-publishing-scribus) +[#]: author: (Jim Hall https://opensource.com/users/jim-hall) + +用 InDesign 的开源替代方案设计书籍封面 +====== +使用开源的出版软件 Scribus 来制作你的下一本自己出版书籍的封面。 +![Stack of books for reading][1] + +我最近写完了一本关于 [C 语言编程][2]的书,我通过 [Lulu.com][3] 自行出版。我已经用 Lulu 做了好几个图书项目,它是一个很棒的平台。今年早些时候,Lulu 做了一些改变,让作者在创作图书封面时有了更大的控制权。以前,你只需上传一对大尺寸图片作为书的封面和封底。现在,Lulu 允许作者上传完全按照你的书的尺寸定制的 PDF。 + +你可以使用 [Scribus][4] 这个开源页面布局程序来创建封面。下面是我的做法。 + +### 下载一个模板 + +当你在 Lulu 上输入图书的信息时,最终会进入**设计**栏。在该页面的**设计封面**部分,你会发现一个方便的**下载模板**按钮,它为你的图书封面提供了一个 PDF 模板。 + +![Lulu Design your Cover page][5] + +(Jim Hall, [CC BY-SA 4.0][6]) + +下载此模板,它为你提供了在 Scribus 中创建自己的书籍封面所需的信息。 + +![Lulu's cover template][7] + +(Jim Hall, [CC BY-SA 4.0][6]) + +最重要的细节是: + + * 文件总大小(含出血(bleed)) + * 出血区(从裁切边缘) + * 书脊区 + + + +**出血**(Bleed)是一个印刷术语,在准备**打印就绪**文件时,这个术语很重要。它与普通文件中的页边距不同。打印文件时,你会为顶部、底部和侧面设置一个页边距。在大多数文档中,页边距通常为一英寸左右。 + +但在打印就绪的文件中,文档的尺寸需要比成品书大一些,因为书籍的封面通常包括颜色或图片,一直到封面的边缘。为了创建这种设计,你要使颜色或图片超出你的边距,印刷厂就会把多余的部分修剪掉,使封面缩小到准确的尺寸。因此,**修剪**就是印刷厂将封面精确地裁剪成相应尺寸。而**出血区** (bleed area) 就是印刷厂裁掉的多余部分。 + +如果你没有出血,印刷厂就很难完全按照尺寸印刷封面。如果打印机只偏离了一点点,你的封面最终会在边缘留下一个微小的、白色的、没有印刷的边缘。使用出血和修剪意味着你的封面每次都能看起来正确。 + +### 在 Scribus 中设置书籍的封面文档 + +要在 Scribus 中创建新文档,请从定义文档尺寸的 **New Document** 对话框开始。单击 “**Bleeds**” 选项卡,并输入 PDF 模板所说的出血尺寸。Lulu 图书通常在所有边缘使用 0.125 英寸的出血量。 + +对于 Scribus 中的文档总尺寸,你不能只使用 PDF 模板上的文档总尺寸。如果这样做,你的 Scribus 文档将有错误的尺寸。相反,你需要做一些数学计算来获取正确的尺寸。 + +看下 PDF 模板中的 **Total Document Size (with bleed)**。这是将要发送给打印机的 PDF 的总尺寸,它包括封底、书脊和封面(包含出血量)。要在 Scribus 中输入正确的尺寸,你必须从所有边缘中减去出血量。例如,我最新的书的尺寸是 Crown Quarto,装订后书脊宽度为 7.44" x 9.68",宽度为 0.411"。加上 0.125" 的出血量,**Total Document Size (with bleed)** 是 15.541"×9.93"。因此,我在 Scribus 中的文档尺寸是: + + * 宽:15.541-(2 x 0.125)=15.291" + * 高:9.93-(2 x 0.125)=9.68" + + + +![Scribus document setup][8] + +(Jim Hall, [CC BY-SA 4.0][6]) + +这将设置一个新的适合我的书的封面尺寸的 Scribus 文档。新的 Scribus 文档尺寸应与 PDF 模板上列出的 **Total Document Size (with bleed)** 完全匹配。 + +### 从书脊开始 + +在 Scribus 中创建新的书籍封面时,我喜欢从书脊区域开始。这可以帮助我验证我是否在 Scribus 中正确定义了文档。 + +使用**矩形**工具在文档上绘制一个彩色方框,书脊需要在那里。你不必完全按照正确的尺寸和位置来绘制,只要接近并使用**属性**来设置正确的值即可。在形状的**属性**中,选择左上角基点,然后输入书脊需要去的 x,y 位置和尺寸。同样,你需要做一些数学计算,并使用 PDF 模板上的尺寸作为参考。 + +![Empty Scribus document][9] + +(Jim Hall, [CC BY-SA 4.0][6]) + +例如,我的书的修边尺寸是 7.44"×9.68",这是印刷厂修边后的封面和封底的尺寸。我的书的书脊大小是 0.411",出血量是 0.125"。也就是说,书脊的左上角 X,Y 的正确位置是: + + * X-Pos (出血量+裁剪宽度):0.411+7.44=7.8510" + * Y-Pos(减去出血量):-0.125" + + + +矩形的尺寸是我的书封面的全高(包括出血)和 PDF 模板中标明的书脊宽度。 + + * 宽度: 0.411" + * 高度:9.93" + + + +将矩形的 **Fill** 设置为你喜欢的颜色,将 **Stroke** 设置为 **None** 以隐藏边界。如果你正确地定义了 Scribus 文档,你应该最终得到一个矩形,它可以延伸到位于文档中心的图书封面的顶部和底部边缘。 + +![Book spine in Scribus][10] + +(Jim Hall, [CC BY-SA 4.0][6]) + +如果矩形与文档不完全匹配,可能是你在创建 Scribus 文档时设置了错误的尺寸。由于你还没有在书的封面上花太多精力,所以可能最容易的做法是重新开始,而不是尝试修复你的错误。 + +### 剩下的就看你自己了 + +接下来,你可以创建你的书的封面的其余部分。始终使用 PDF 模板作为指导。封底在左边,封面在右边 + +我可以管理一个简单的书籍封面,但我缺乏艺术能力,无法创造出真正醒目的设计。在自己设计了几个书的封面后,我对那些能设计出好封面的人产生了敬意。但如果你只是需要制作一个简单的封面,你可以通过开源软件自己动手。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/open-source-publishing-scribus + +作者:[Jim Hall][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jim-hall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/books_read_list_stack_study.png?itok=GZxb9OAv (Stack of books for reading) +[2]: https://opensource.com/article/20/8/c-programming-cheat-sheet +[3]: https://www.lulu.com/ +[4]: https://www.scribus.net/ +[5]: https://opensource.com/sites/default/files/uploads/lulu-download-template.jpg (Lulu Design your Cover page) +[6]: https://creativecommons.org/licenses/by-sa/4.0/ +[7]: https://opensource.com/sites/default/files/uploads/lulu-pdf-template.jpg (Lulu's cover template) +[8]: https://opensource.com/sites/default/files/uploads/scribus-new-document.jpg (Scribus document setup) +[9]: https://opensource.com/sites/default/files/uploads/scribus-empty-document.jpg (Empty Scribus document) +[10]: https://opensource.com/sites/default/files/uploads/scribus-spine-rectangle.jpg (Book spine in Scribus) From fcee822b91c2659d4a6900ae14242302144a53e1 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 10 Sep 2020 08:47:46 +0800 Subject: [PATCH 0057/1156] translating --- ... How to Connect to WiFi from the Terminal in Ubuntu Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md b/sources/tech/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md index 5b57e7cee8..ce3de67e93 100644 --- a/sources/tech/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md +++ b/sources/tech/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From bfc08a0a474237e9ee9c36f16b8885db22bccede Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 10 Sep 2020 10:03:16 +0800 Subject: [PATCH 0058/1156] PRF @FSSlc --- ... from the Linux command line with nmcli.md | 92 +++++++++---------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/translated/tech/20200721 Manage network connections from the Linux command line with nmcli.md b/translated/tech/20200721 Manage network connections from the Linux command line with nmcli.md index a7e6462486..a46b9c146d 100644 --- a/translated/tech/20200721 Manage network connections from the Linux command line with nmcli.md +++ b/translated/tech/20200721 Manage network connections from the Linux command line with nmcli.md @@ -1,45 +1,45 @@ [#]: collector: "lujun9972" [#]: translator: "FSSlc" -[#]: reviewer: " " +[#]: reviewer: "wxy" [#]: publisher: " " [#]: url: " " [#]: subject: "Manage network connections from the Linux command line with nmcli" [#]: via: "https://opensource.com/article/20/7/nmcli" [#]: author: "Dave McKay https://opensource.com/users/davemckay" -在命令行中使用 nmcli 来管理网络连接 +在命令行中使用 nmcli 来管理网络连接 ====== -nmcli 命令赋予你直接在 Linux 命令行操作 NetworkManager 工具的能力。 +> nmcli 命令赋予你直接在 Linux 命令行操作 NetworkManager 工具的能力。 -![坐在窗前笔记本电脑的一位商业女士][1] +![](https://img.linux.net.cn/data/attachment/album/202009/10/100302z2xq9cieqyekxbdc.jpg) -[nmcli][2] 命令赋予你直接在 Linux 命令行操作 NetworkManager 工具的能力。它是 NetworkManager 软件包集成的一部分,通过使用一些 [应用程序接口][3](API)来获取 NetworkManager 的功能。 +[nmcli][2] 命令赋予你直接在 Linux 命令行操作 NetworkManager 工具的能力。它是 NetworkManager 软件包集成的一部分,通过使用一些 [应用程序接口][3](API)来获取 NetworkManager 的功能。 -nmcli 于 2010 年发布,用以替代其他配置网络接口和连接的方法,例如 [ifconfig][4]。因为它是 [命令行界面][5](CLI)工具, 被设计用在终端窗口和脚本中,所以对于那些工作在没有 [图形界面][6](GUI)的系统管理员来说是它是一个非常理想的工具。 +`nmcli` 发布于 2010 年,用以替代其他配置网络接口和连接的方法,例如 [ifconfig][4]。因为它是一个 [命令行界面][5](CLI)工具,被设计用在终端窗口和脚本中,所以对于那些工作在没有 [图形用户界面][6](GUI)的系统的管理员来说,它是一个非常理想的工具。 ### ncmli 的语法 -nmcli 命令接受 __选项__ (options) 来更改 nmcli 的行为,接受 __子命令__ (section) 来告诉 nmcli 想使用它的那部分功能,使用 __操作__ (action) 来告诉 nmcli 你想执行什么操作。 +`nmcli` 命令可以使用*选项*来更改它的行为,使用*子命令*来告诉 `nmcli` 想使用它的那部分功能,使用*操作*来告诉 `nmcli` 你想执行什么操作。 ``` -$ nmcli
+$ nmcli <选项> <子命令> <操作> ``` -nmcli 一共有 8 个子命令,每个子命令有一些相关的网络操作: +`nmcli` 一共有 8 个子命令,每个子命令有一些相关的网络操作: - * **help** 提供有关 nmcli 命令和使用方法的帮助信息 - * **general** 返回 NetworkManager 的状态和总体配置信息 - * **networking** 提供命令来查询某个网络连接的状态和启动、禁用连接的功能 - * **radio** 提供命令来查询某个 WiFi 网络连接的状态和启动、禁用连接的功能 - * **monitor** 提供命令来监控 NetworkManager 的活动并观察网络连接的状态改变 - * **connection** 提供命令来启用或禁用网络接口、添加新的连接、删除已有连接等功能 - * **device** 主要被用于更改与某个设备(例如接口名称)相关联的连接的参数或者使用一个已有的连接来连接设备 - * **secret** 注册 nmcli 来作为一个 NetworkManager 的秘密代理,用以监听秘密信息。这个子命令很少会被用到,因为当连接到网络时, nmcli 会自动做这些事 + * `help` 提供有关 `nmcli` 命令和使用方法的帮助信息 + * `general` 返回 NetworkManager 的状态和总体配置信息 + * `networking` 提供命令来查询某个网络连接的状态和启动、禁用连接的功能 + * `radio` 提供命令来查询某个 WiFi 网络连接的状态和启动、禁用连接的功能 + * `monitor` 提供命令来监控 NetworkManager 的活动并观察网络连接的状态改变 + * `connection` 提供命令来启用或禁用网络接口、添加新的连接、删除已有连接等功能 + * `device` 主要被用于更改与某个设备(例如接口名称)相关联的连接参数或者使用一个已有的连接来连接设备 + * `secret` 注册 `nmcli` 来作为一个 NetworkManager 的秘密代理,用以监听秘密信息。这个子命令很少会被用到,因为当连接到网络时,`nmcli` 会自动做这些事 ### 简单的示例 -首先,我们验证一下 NetworkManager 正在运行并且 nmcli 可以与之通信: +首先,我们验证一下 NetworkManager 正在运行并且 `nmcli` 可以与之通信: ``` $ nmcli general @@ -63,20 +63,20 @@ Wired connection 3  52d89737-de92-35ec-b082-8cf2e5ac36e6  ethernet  enp0s9 ### 连接管理 -理解 nmcli 的术语是非常重要的。一个网络 **连接** 包含了一个连接的所有信息。你可以将它看作一个网络**配置**。一个连接包含了与一个连接相关的所有信息,包括 [数据链路层][7] 和 [IP 地址信息][8] 。它们是 [OSI 网络模型][9] 中的第 2 和第 3 层。 +理解 `nmcli` 的术语是非常重要的。一个网络连接connection包含了一个连接的所有信息。你可以将它看作一个网络配置configuration。“连接”包含了与其相关的所有信息,包括 [数据链路层][7] 和 [IP 地址信息][8] 。它们是 [OSI 网络模型][9] 中的第 2 和第 3 层。 -当你在 LInux 上配置网络时,通常来说你在为某个网络设备(它们是安装在一个电脑中的网络接口)配置连接。当一个连接被某个设备所使用,那么就可以说这个连接被**激活**或者**启用**了,反之是**停用**或**下线**。 +当你在 Linux 上配置网络时,通常来说你是在为某个网络设备(它们是安装在一个电脑中的网络接口)配置连接。当一个连接被某个设备所使用,那么就可以说这个连接被激活active或者上线up了,反之是停用inactive下线down。 #### 添加网络连接 -nmcli 允许你快速地创建网络连接并同时为该连接指定参数。为了通过使用 有线连接 2 `enp0s8`来创建一个新的连接,你可以利用`sudo` 来运行下面的命令: +`nmcli` 允许你快速地创建网络连接并同时为该连接指定参数。为了通过使用“有线连接 2” `enp0s8` 来创建一个新的连接,你可以利用 `sudo` 来运行下面的命令: ``` $ sudo nmcli connection add type ethernet ifname enp0s8 Connection 'ethernet-enp0s8' (09d26960-25a0-440f-8b20-c684d7adc2f5) successfully added. ``` -其中 `type` 选项指定需要一个 [Ethernet][10] 的连接,而 `ifname`(接口名)选项指定你想要为这个连接使用的网络接口设备。 +其中 `type` 选项指定需要一个 [Ethernet][10] 类型的连接,而 `ifname`(接口名)选项指定你想要为这个连接使用的网络接口设备。 让我们看看发生了什么变化: @@ -89,7 +89,7 @@ Wired connection 3  52d89737-de92-35ec-b082-8cf2e5ac36e6  ethernet  enp0s9 ethernet-enp0s8     09d26960-25a0-440f-8b20-c684d7adc2f5  ethernet  --   ``` -通过上图可以看到新的连接 `ethernet-enp0s8` 已经创建好了。它的 [通用唯一标识符][11](UUID)也一同被赋予,并且其连接类型为 Ethernet。我们可以使用 `up` 子命令再加上连接名称(或 UUID)来使得这个连接被激活: +通过上图可以看到新的连接 `ethernet-enp0s8` 已经创建好了。它的 [通用唯一标识符][11]Universally Unique IDentifier(UUID)也一同被赋予,并且其连接类型为 “Ethernet”。我们可以使用 `up` 子命令再加上连接名称(或 UUID)来使得这个连接被激活: ``` $ nmcli connection up ethernet-enp0s8 @@ -110,16 +110,16 @@ Wired connection 3  52d89737-de92-35ec-b082-8cf2e5ac36e6  ethernet  enp0s9 #### 调整连接 -nmcli 命令使得调整现有连接的参数变得更加容易。也许你想将某个网络接口从 [动态主机配置协议][12](DHCP)改为静态 IP 地址。 +`nmcli` 命令使得调整现有连接的参数变得更加容易。也许你想将某个网络接口从 [动态主机配置协议][12]Dynamic Host Configuration Protocol(DHCP)改为静态 IP 地址。 -假设你需要为你的新连接分配一个固定的 IP 地址 `192.168.4.26`,那么你需要使用两个命令,一个用于设定 IP 地址,另一个用来将获取 IP 地址的方法改为 `manual`: +假设你需要为你的新连接分配一个固定的 IP 地址 `192.168.4.26`,那么你需要使用两个命令,一个用于设定 IP 地址,另一个用来将获取 IP 地址的方法改为 `manual`(手动): ``` $ nmcli connection modify ethernet-enp0s8 ipv4.address 192.168.4.26/24 $ nmcli connection modify ethernet-enp0s8 ipv4.method manual ``` -记得特别指定 [子网掩码][13],在我们这个测试的连接中,它是 [无类域间路由][14](CIDR)中的 `255.255.255.0` 或 `/24` +记得指定 [子网掩码][13],在我们这个测试的连接中,它是 [无类域间路由][14] Classless Inter-Domain Routing(CIDR)中的 `255.255.255.0` 或 `/24` 为了使得你的更改生效,你需要通过停止再重新启用该连接。下面的第一个命令是停用该连接,第二个命令则是启用它: @@ -130,15 +130,15 @@ $ nmcli connection up ethernet-enp0s8 Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6) ``` -假如你想将连接设置为使用 DHCP,则需要将上面的 manual` 改为 `auto`: +假如你想将连接设置为使用 DHCP,则需要将上面的 `manual` 改为 `auto`(自动): ``` -`$ nmcli connection modify ethernet-enp0s8 ipv4.method auto` +$ nmcli connection modify ethernet-enp0s8 ipv4.method auto ``` ### 设备管理 -nmcli 命令中的 `device` 子命令允许你管理安装在你电脑中的网络接口。 +`nmcli` 命令中的 `device` 子命令允许你管理安装在你电脑中的网络接口。 #### 检查设备状态 @@ -155,9 +155,9 @@ lo      loopback  unmanaged  --   #### 显示设备详情 -为了检查某个网络接口的详情,可以使用 `device` 设备中的 `show` 操作。假如你不提供某个设备的名称,那么所有设备的详情都将会被获取再进行展示。你可以上下翻动来查看这些信息。 +为了检查某个网络接口的详情,可以使用 `device` 子命令中的 `show` 操作。假如你不提供某个设备的名称,那么会获取并展示所有设备的详情。你可以上下翻动来查看这些信息。 -要查看你最近添加的连接所对应的设备 `enp0s8`,你可以使用下面的命令,请注意验证它使用的 IP 地址是否为先前你请求的那个: +要查看你最近添加的连接所对应的设备 `enp0s8`,你可以使用下面的命令,请注意验证它使用的 IP 地址是否为先前你要求设置的那个: ``` $ nmcli device show enp0s8 @@ -180,25 +180,25 @@ IP6.ROUTE[2]:                           dst = ff00::/8, nh = ::, mt 上面的输出非常细致,它主要显示了下面这些内容: - * **网络接口名称**,在这个示例中是`enp0s8`,它是 [udev][15] 分配的 + * **网络接口名称**,在这个示例中是 `enp0s8`,它是 [udev][15] 分配的 * **网络连接类型**,在这个示例中是物理的 Ethernet 连接 - * 设备的 **媒体访问控制(MAC)地址**,它被用来在网络中识别该设备 + * 设备的媒介访问控制media access control(MAC)地址,它被用来在网络中识别该设备 * [最大传输单元][17],在单个传输中最大协议数据单位的大小,任何大于这个大小的数据将被分为多个包来进行传输 - * 该设备 **当前已经处于连接状态** - * 这个设备使用的连接名称是`ethernet-enp0s8` - * 这个设备使用的 IP 地址如上面所请求的那样,被设置为 `192.168.4.26/24` + * 该设备**当前已经处于连接状态** + * 这个设备使用的连接名称是 `ethernet-enp0s8` + * 这个设备使用的 IP 地址如上面所要求的那样,被设置为 `192.168.4.26/24` 其他的信息则是与这个设备连接的网络相关的默认路由和网关设置信息。 #### nmcli 的交互式编辑器 -尽管 nmcli 是一个命令行工具,但它还包含一个交互式工具, `edit` 子命令将为你指定的连接打开一个交互式编辑器,例如: +尽管 `nmcli` 是一个命令行工具,但它还包含一个基本的交互式编辑器,`edit` 子命令将为你指定的连接打开一个交互式编辑器,例如: ``` $ nmcli connection edit ethernet-enp0s8 ``` -它将显示少量的帮助文字,接着是 nmcli 的命令提示符: +它将显示少量的帮助文字,接着是 `nmcli` 的命令提示符: ``` ===| nmcli interactive connection editor |=== @@ -213,7 +213,7 @@ You may edit the following settings: connection, 802-3-ethernet (ethernet), 802- nmcli> ``` -假如你输入 `print` 然后敲击 **Enter** 键, nmcli 将列举出与这个接口相关的所有属性。这些属性有很多,你可以上下翻动来查看这个列表: +假如你输入 `print` 然后敲击 `Enter` 键, `nmcli` 将列举出与这个接口相关的所有属性。这些属性有很多,你可以上下翻动来查看这个列表: ``` =============================================================================== @@ -239,7 +239,7 @@ connection.autoconnect-slaves:          -1 (default) connection.secondaries:                 -- ``` -如果你想将你的连接改为 DHCP,则请输入 `goto ipv4` 然后敲 **Enter**键: +如果你想将你的连接改为 DHCP,则请输入 `goto ipv4` 然后敲 `Enter` 键: ``` nmcli> goto ipv4 @@ -247,14 +247,14 @@ You may edit the following properties: method, dns, dns-search, dns-options, dns nmcli ipv4> ``` -你想改变的属性是 `method`,再继续敲 `set method auto` 然后敲 **Enter** 键: +你想改变的属性是 `method`,再继续敲 `set method auto` 然后敲 `Enter` 键: ``` nmcli ipv4> set method auto Do you also want to clear 'ipv4.addresses'? [yes]: ``` -假如你想让这个连接清除掉这个静态 IP 地址,则请敲 **Enter**键,如果要保留,则输入 `no` 然后敲 **Enter**键。假如你想在将来再次使用它,你可以保留这个 IP 地址。即便存储了一个静态的 IP 地址,如果 `method` 被设置为 `auto` ,它仍然会使用 DHCP。 +假如你想让这个连接清除掉这个静态 IP 地址,则请敲 `Enter` 键,如果要保留,则输入 `no` 然后敲 `Enter` 键。假如你想在将来再次使用它,你可以保留这个 IP 地址。即便存储了一个静态的 IP 地址,如果 `method` 被设置为 `auto` ,它仍然会使用 DHCP。 最后输入 `save` 来保存你的更改: @@ -264,13 +264,13 @@ Connection 'ethernet-enp0s8' (09d26960-25a0-440f-8b20-c684d7adc2f5) successfully nmcli ipv4> ``` -输入 `quit` 来离开 nmcli 的交互式编辑器窗口。假如你不想离开,可以输入 `back` 来回到最开始的命令行提示符界面,然后继续使用这个编辑器。 +输入 `quit` 来离开 `nmcli` 的交互式编辑器窗口。假如你不想离开,可以输入 `back` 来回到最开始的命令行提示符界面,然后继续使用这个编辑器。 ### nmcli 的更多内容 -浏览交互式编辑器,你就可以看到 nmcli 有多少设定和每个设定有多少属性。交互式编辑器是一个简洁的工具,但如果需要在命令行或者在脚本中使用 nmcli,你还是需要使用常规的命令行版本。 +浏览交互式编辑器,你就可以看到 `nmcli` 有多少设定和每个设定有多少属性。交互式编辑器是一个简洁的工具,但如果需要在命令行或者在脚本中使用 `nmcli`,你还是需要使用常规的命令行版本。 -现在你有了这些基础知识,你还可以查看 nmcli 的 [man 页面][2] 来查看它还可以提供什么额外功能。 +现在你有了这些基础知识,你还可以查看 `nmcli` 的 [man 页面][2] 来查看它还可以提供什么更多功能。 -------------------------------------------------------------------------------- @@ -279,7 +279,7 @@ via: https://opensource.com/article/20/7/nmcli 作者:[Dave McKay][a] 选题:[lujun9972][b] 译者:[FSSLC](https://github.com/FSSlc) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a49ab32df842523eb0d455349aab34920efe3b72 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 10 Sep 2020 10:03:43 +0800 Subject: [PATCH 0059/1156] PUB @FSSlc https://linux.cn/article-12599-1.html --- ...work connections from the Linux command line with nmcli.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200721 Manage network connections from the Linux command line with nmcli.md (99%) diff --git a/translated/tech/20200721 Manage network connections from the Linux command line with nmcli.md b/published/20200721 Manage network connections from the Linux command line with nmcli.md similarity index 99% rename from translated/tech/20200721 Manage network connections from the Linux command line with nmcli.md rename to published/20200721 Manage network connections from the Linux command line with nmcli.md index a46b9c146d..8b9b2f8d36 100644 --- a/translated/tech/20200721 Manage network connections from the Linux command line with nmcli.md +++ b/published/20200721 Manage network connections from the Linux command line with nmcli.md @@ -1,8 +1,8 @@ [#]: collector: "lujun9972" [#]: translator: "FSSlc" [#]: reviewer: "wxy" -[#]: publisher: " " -[#]: url: " " +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12599-1.html" [#]: subject: "Manage network connections from the Linux command line with nmcli" [#]: via: "https://opensource.com/article/20/7/nmcli" [#]: author: "Dave McKay https://opensource.com/users/davemckay" From c20c4fe0b1343dde1fde11f5efb28346467d9c9c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 10 Sep 2020 20:03:09 +0800 Subject: [PATCH 0060/1156] LCTT 7 Years --- lctt2020.md | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 lctt2020.md diff --git a/lctt2020.md b/lctt2020.md new file mode 100644 index 0000000000..ededeb7081 --- /dev/null +++ b/lctt2020.md @@ -0,0 +1,64 @@ +# Linux 中国旗下贡献者组织 LCTT 七年回顾和展望 + +> 这是一篇 LCTT 七周年的纪念文章,也是 LCTT 承前启后的一个里程碑。 + +### 写在 LCTT 七年之际 + +在 7 年前的今天,我并没有想到,在一个偶然的机会下诞生的 LCTT,它能走过这么长的时间,留下这么多的印痕。是的,一些老朋友或许记得,LCTT 这个 Linux 中国旗下的最主要的开源活动/组成部分,最初只是我发心想完善 man 的中文翻译而产生的副产品。结果,man 中文翻译项目没有做成,而 LCTT 却持续地运营了下来。 + +虽然,这些年 LCTT 屡有改进和完善,但是总体来说还是相对保守。当然,LCTT 这些年已经陆续有 400 多位贡献者实质性的参与了贡献,并在此基础上创建了几个 SIG(特别兴趣小组),如[红帽代码英雄 SIG](https://linux.cn/article-12436-1.html)、漫画 SIG、LFS SIG 等。 + +作为回顾,我来介绍一下 LCTT 这 7 年间在主项目(TranslateProject)上取得的成就: + +- 贡献者: [435 位](https://linux.cn/lctt-list) +- 翻译文章:[5687 篇](https://linux.cn/) +- GitHub 提交:[54629 次](https://github.com/LCTT/TranslateProject) +- GitHub 拉取请求:[19243 次](https://github.com/LCTT/TranslateProject/pulls) + +这是 LCTT 主项目的提交图: + +![](https://postimg.aliavv.com/mbp/uglsc.png) + +这其中,[钻石级的贡献者有 5 名,五星级贡献者有 6 名,13 位 4 星贡献者](https://linux.cn/lctt-list)。那么,请让我来用一段视频展示一下 LCTT 七年来的历程: + +![](https://img.linux.net.cn/static/video/LCTT%207%20Years.mp4) + +当然,整体的贡献水平呈现长尾分布,大部分贡献者浅尝辄止,我想除了贡献者存在着体验的心态之外,也与 LCTT 没有建立起来合适的社区引导和激励机制有关。此外,就开源社区/开源项目而言,我们也存在一些不足,比如,按 GitHub 建议,我们在如下社区建设方面还缺乏: + +- 社区行为准则 +- 贡献指南 +- 议题模板 +- 拉取请求模板 + +因此,在写这篇文章时,我也要宣布一件事,就是我会逐渐淡出 LCTT 的日常管理,改组 LCTT 管理团队,将更多未来的可能交给社区成员来建设,也希望新的社区管理团队可以为 LCTT 创造出一个不同的明天。 + +以下,请我们的 Linux 中国的核心合伙人 Bestony 来介绍一下今后 LCTT 的发展计划。 + +--- + +大家好,我是 Bestony,感谢老王数年来的坚持不懈的投入,正是有老王的坚守,才能有我们如今的成就。在接下来的时间里,我将会帮助老王,更好的运作 LCTT,让老王可以喘口气,也为 LCTT 带来一些新的气象。 + +在过去的七年里,我们 LCTT 做了很多事情,我们翻译了数千篇文章,有数百位技能精湛的贡献者。如今,到了 7 年的这个节点上,我也在思考,我们下一步应该怎么走。 + +其实,在过去的一年里,LCTT 的问题在不断的浮现:选题方向单一、译者进入门槛较高、大家翻译的质量水平参差不齐、校对的人手不足、译稿外发的反馈不足,这些问题都是我们在过去遇见,但一直没有足够的精力和人力来解决的问题。不过,如今我将加入到 LCTT 的管理团队中,配合老王,一起一个个的解决这些过去遇见的问题。 + +![](https://postimg.aliavv.com/mbp/3kfwy.png) + +对于这些问题,有一些我们已经在解决,比如“**选题方向单一**”,在今年的年初,LCTT 与红帽公司(RedHat)[联合建立了 LCRH SIG](https://linux.cn/article-12436-1.html),面向红帽旗下的原创播客《[代码英雄](https://www.redhat.com/en/command-line-heroes) Command Line Heroes》进行定向的翻译,目前,第一季度的翻译成功已经全部在 Linux 中国公众号上发布,而第二、三季度的内容,也正在不断的发布过程中。 + +![](https://postimg.aliavv.com/mbp/71eup.png) + +LCTT - SIG 将是后续的新的发展方向。**我们将会在保留 LCTT 主体的基础上,鼓励各位译者探索更多的兴趣方向,通过建立起不同的 SIG,引入更多的翻译内容,来帮助大家更好的达成自己想要的翻译目标。** 并且,通过 LCTT 的技术和经验,赋能每一位译者,帮助译者更好的学习、了解各种不同领域的知识。 + +而在“**进入门槛较高**”方面,一直以来 Github 的访问慢问题、Git 的概念不熟悉等问题,都是困扰不少新同学的点。而也正是这些点,在不断制约着 LCTT 的发展。在将来,我希望 LCTT 可以打造出自己的翻译工具(也将会为之而奋斗),通过工具辅助的方式,帮助更多人走上翻译的道路,让更多的爱好者们,可以为中文的技术环境贡献一份力。 + +![](https://postimg.aliavv.com/mbp/8183e.png) + +后续,我们将会引入翻译工具、自建关键词表、多轮校对手段等方案,帮助更多的译者完成自己的翻译文章,通过翻译,学到自己想要的知识。 + +当然,问题并不止我点出来的这些,我们能发展到今天,一定有很多做对了的地方,但同样,我们也有做错了的地方。欢迎你随时联系我,讨论你对于 LCTT 下一步的想法,我相信,你的意见能够帮助 LCTT 变得更好。 + +![](https://postimg.aliavv.com/mbp/aq5m9.png) + +最后,**千里之行,始于足下**,刚刚走过 7 年的 LCTT, 希望我们可以在下一个七年,再次相遇。 + From 39230170d727cdb32c560383bb10eb5cd281a5fb Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 10 Sep 2020 20:43:32 +0800 Subject: [PATCH 0061/1156] PRF @wxy --- ...200826 What is DNS and how does it work.md | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/translated/tech/20200826 What is DNS and how does it work.md b/translated/tech/20200826 What is DNS and how does it work.md index a2eabb03e9..c6d22bdec6 100644 --- a/translated/tech/20200826 What is DNS and how does it work.md +++ b/translated/tech/20200826 What is DNS and how does it work.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (What is DNS and how does it work?) @@ -16,7 +16,7 @@ 域名系统Domain Name System(DNS)是互联网的基础之一,然而大多数不懂网络的人可能并不知道他们每天都在使用它来工作、查看电子邮件或在智能手机上浪费时间。 -就其本质而言,DNS 是一个与数字匹配的名称目录。这些数字,在这种情况下是 IP 地址,计算机用 IP 地址来相互通信。大多数对 DNS 的描述都是用电话簿来比喻,这对于 30 岁以上的人来说是没有问题的,因为他们知道电话簿是什么。 +就其本质而言,DNS 是一个与数字匹配的名称目录。这些数字,在这里指的是 IP 地址,计算机用 IP 地址来相互通信。大多数对 DNS 的描述都是用电话簿来比喻,这对于 30 岁以上的人来说是没有问题的,因为他们知道电话簿是什么。 如果你还不到 30 岁,可以把 DNS 想象成你的智能手机的联系人名单,它将人们的名字与他们的电话号码及电子邮件地址进行匹配,然后这个联系人名单的就像地球上的人一样多。 @@ -24,25 +24,25 @@ 当互联网还非常、非常小的时候,人们很容易将特定的 IP 地址与特定的计算机对应起来,但随着越来越多的设备和人加入到不断发展的网络中,这种简单的情况就没法持续多久了。现在仍然可以在浏览器中输入一个特定的 IP 地址来到达一个网站,但当时和现在一样,人们希望得到一个由容易记忆的单词组成的地址,也就是我们今天所认识的那种域名(比如 linux.cn)。在 20 世纪 70 年代和 80 年代早期,这些名称和地址是由一个人指定的,她是[斯坦福大学的 Elizabeth Feinler][2],她在一个名为 [HOSTS.TXT][3] 的文本文件中维护着一个主列表,记录了每一台连接互联网的计算机。 -随着互联网的发展,这种局面显然无法维持下去,尤其是因为 Feinler 只处理加州时间下午 6 点之前的请求,而且圣诞节也要请假。1983 年,南加州大学的研究人员 Paul Mockapetris 受命在处理这个问题的多种建议中提出一个折中方案。他基本上无视了所有提出的建议,并开发了自己的系统,他将其称为 DNS。虽然从那时起,现今的它显然发生了很大的变化,但在基本层面上,它的工作方式仍然与将近 40 年前相同。 +随着互联网的发展,这种局面显然无法维持下去,尤其是因为 Feinler 只处理加州时间下午 6 点之前的请求,而且圣诞节也要请假。1983 年,南加州大学的研究人员 Paul Mockapetris 受命在处理这个问题的多种建议中提出一个折中方案。但他基本上无视了所有提出的建议,而是开发了自己的系统,他将其称为 DNS。虽然从那时起,现今的它显然发生了很大的变化,但在基本层面上,它的工作方式仍然与将近 40 年前相同。 ### DNS 服务器是如何工作的 -将名字与数字相匹配的 DNS 目录并不是整个藏在互联网的某个黑暗角落的一个地方。截至 2017 年底,[它记录了超过 3.32 亿个域名][4],如果作为一个目录确实会非常庞大。就像互联网本身一样,该目录分布在世界各地,存储在域名服务器(一般简称 DNS 服务器)上,这些服务器都会非常有规律地相互沟通,以提供更新和冗余。 +将名字与数字相匹配的 DNS 目录并不是整个藏在互联网的某个黑暗角落。截至 2017 年底,[它记录了超过 3.32 亿个域名][4],如果作为一个目录确实会非常庞大。就像互联网本身一样,该目录分布在世界各地,存储在域名服务器(一般简称为 DNS 服务器)上,这些服务器都会非常有规律地相互沟通,以提供更新和冗余。 ### 权威 DNS 服务器与递归 DNS 服务器的比较 -当你的计算机想要找到与域名相关联的 IP 地址时,它首先会向递归recursive DNS 服务器提出请求,也称为递归解析器。递归解析器是一个通常由 ISP 或其他第三方提供商运营的服务器,它知道需要向其他哪些 DNS 服务器请求解析一个网站的名称与其 IP 地址。实际拥有所需信息的服务器称为权威authoritative DNS 服务器。 +当你的计算机想要找到与域名相关联的 IP 地址时,它首先会向递归recursive DNS 服务器(也称为递归解析器)提出请求。递归解析器是一个通常由 ISP 或其他第三方提供商运营的服务器,它知道需要向其他哪些 DNS 服务器请求解析一个网站的名称与其 IP 地址。实际拥有所需信息的服务器称为权威authoritative DNS 服务器。 ### DNS 服务器和 IP 地址 -每个域名可以对应一个以上的 IP 地址。事实上,有些网站有数百个或更多的 IP 地址与一个域名相对应。例如,你的计算机访问 [www.google.com][5] 所到达的服务器,很可能与其他国家的人在浏览器中输入相同的网站名称所到达的服务器完全不同。 +每个域名可以对应一个以上的 IP 地址。事实上,有些网站有数百个甚至更多的 IP 地址与一个域名相对应。例如,你的计算机访问 [www.google.com][5] 所到达的服务器,很可能与其他国家的人在浏览器中输入相同的网站名称所到达的服务器完全不同。 -该目录的分布式性质的另一个原因是,如果这个目录只有一个位置,在数百万,可能是数十亿同样在同一时间寻找信息的人中共享,那么当你在寻找一个网站时,你需要花费多少时间才能得到响应 —— 这就像是排着长队使用电话簿一样。 +该目录的分布式性质的另一个原因是,如果这个目录只在一个位置,在数百万,可能是数十亿在同一时间寻找信息的人中共享,那么当你在寻找一个网站时,你需要花费多少时间才能得到响应 —— 这就像是排着长队使用电话簿一样。 ### 什么是 DNS 缓存? -为了解决这个问题,DNS 信息在许多服务器之间共享。但最近访问过的网站的信息也会在客户端计算机上本地缓存。你有可能每天使用 google.com 好几次。你的计算机不是每次都向 DNS 名称服务器查询 google.com 的 IP 地址,而是将这些信息保存在你的计算机上,这样它就不必访问 DNS 服务器来解析这个带有 IP 地址的名称。额外的缓存可能出现在用于将客户端连接到互联网的路由器上,以及用户的互联网服务提供商(ISP)的服务器上。有了这么多的缓存,实际上对 DNS 名称服务器的查询数量比看起来要少很多。 +为了解决这个问题,DNS 信息在许多服务器之间共享。但最近访问过的网站的信息也会在客户端计算机本地缓存。你有可能每天使用 google.com 好几次。你的计算机不是每次都向 DNS 名称服务器查询 google.com 的 IP 地址,而是将这些信息保存在你的计算机上,这样它就不必访问 DNS 服务器来解析这个名称的 IP 地址。额外的缓存也可能出现在用于将客户端连接到互联网的路由器上,以及用户的互联网服务提供商(ISP)的服务器上。有了这么多的缓存,实际上对 DNS 名称服务器的查询数量比看起来要少很多。 ### 如何找到我的 DNS 服务器? @@ -52,7 +52,7 @@ 但要记住,虽然你的 ISP 会设置一个默认的 DNS 服务器,但你没有义务使用它。有些用户可能有理由避开他们 ISP 的 DNS —— 例如,有些 ISP 使用他们的 DNS 服务器将不存在的地址的请求重定向到[带有广告的网页][7]。 -如果你想要一个替代方案,你可以将你的计算机指向一个公共 DNS 服务器,以它作为一个递归解析器。最著名的公共 DNS 服务器之一是谷歌的,它的 IP 地址是 8.8.8.8 和 8.8.4.4。Google 的 DNS 服务往往是[快速的][8],虽然对 [Google 提供免费服务的别有用心的动机][9]有一定的质疑,但他们无法真正从你那里获得比他们从 Chrome 中获得的更多信息。Google 有一个页面,详细说明了如何[配置你的电脑或路由器][10]连接到 Google 的 DNS。 +如果你想要一个替代方案,你可以将你的计算机指向一个公共 DNS 服务器,以它作为一个递归解析器。最著名的公共 DNS 服务器之一是谷歌的,它的 IP 地址是 8.8.8.8 和 8.8.4.4。Google 的 DNS 服务往往是[快速的][8],虽然对 [Google 提供免费服务的别有用心的动机][9]有一定的质疑,但他们无法真正从你那里获得比他们从 Chrome 浏览器中获得的更多信息。Google 有一个页面,详细说明了如何[配置你的电脑或路由器][10]连接到 Google 的 DNS。 ### DNS 如何提高效率 @@ -60,13 +60,13 @@ DNS 的组织结构有助于保持事情的快速和顺利运行。为了说明 如上所述,对 IP 地址的初始请求是向递归解析器提出的。递归解析器知道它需要请求哪些其他 DNS 服务器来解析一个网站(linux.cn)的名称与其 IP 地址。这种搜索会传递至根服务器,它知道所有顶级域名的信息,如 .com、.net、.org 以及所有国家域名,如 .cn(中国)和 .uk(英国)。根服务器位于世界各地,所以系统通常会将你引导到地理上最近的一个服务器。 -一旦请求到达正确的根服务器,它就会进入一个顶级域名(TLD)名称服务器,该服务器存储二级域名的信息,即在你到达 .com、.org、.net 之前所使用的单词(例如,linux.cn 的信息是 “linux”)。然后,请求进入域名服务器,域名服务器掌握着网站的信息和 IP 地址。一旦 IP 地址被发现,它就会被发回给客户端,客户端现在可以用它来访问网站。所有这一切都只需要几毫秒的时间。 +一旦请求到达正确的根服务器,它就会进入一个顶级域名(TLD)名称服务器,该服务器存储二级域名的信息,即在你写在 .com、.org、.net 之前的单词(例如,linux.cn 的信息是 “linux”)。然后,请求进入域名服务器,域名服务器掌握着网站的信息和 IP 地址。一旦 IP 地址被找到,它就会被发回给客户端,客户端现在可以用它来访问网站。所有这一切都只需要几毫秒的时间。 因为 DNS 在过去的 30 多年里一直在工作,所以大多数人都认为它是理所当然的。在构建系统的时候也没有考虑到安全问题,所以[黑客们充分利用了这一点][11],制造了各种各样的攻击。 ### DNS 反射攻击 -DNS 反射攻击可以用 DNS 解析器服务器的大量信息淹没受害者。攻击者使用受害者的欺骗 IP 地址来向他们能找到的所有开放的 DNS 解析器请求大量的 DNS 数据。当解析器响应时,受害者会收到大量未请求的 DNS 数据,使其机器不堪重负。 +DNS 反射攻击可以用 DNS 解析器服务器的大量信息淹没受害者。攻击者使用伪装成受害者的 IP 地址来向他们能找到的所有开放的 DNS 解析器请求大量的 DNS 数据。当解析器响应时,受害者会收到大量未请求的 DNS 数据,使其不堪重负。 ### DNS 缓存投毒 @@ -74,7 +74,7 @@ DNS 反射攻击可以用 DNS 解析器服务器的大量信息淹没受害者 ### DNS 资源耗尽 -[DNS 资源耗尽][13]攻击可以堵塞 ISP 的 DNS 基础设施,阻止 ISP 的客户访问互联网上的网站。攻击者注册一个域名,并通过将受害者的名称服务器作为域名的权威服务器来实现。因此,如果递归解析器不能提供与网站名称相关的 IP 地址,就会询问受害者的名称服务器。攻击者会对自己注册的域名产生大量的请求,并查询不存在的子域名,这就会导致大量的解析请求发送到受害者的名称服务器,使其不堪重负。 +[DNS 资源耗尽][13]攻击可以堵塞 ISP 的 DNS 基础设施,阻止 ISP 的客户访问互联网上的网站。攻击者注册一个域名,并通过将受害者的名称服务器作为域名的权威服务器来实现这种攻击。因此,如果递归解析器不能提供与网站名称相关的 IP 地址,就会询问受害者的名称服务器。攻击者会对自己注册的域名产生大量的请求,并查询不存在的子域名,这就会导致大量的解析请求发送到受害者的名称服务器,使其不堪重负。 ### 什么是 DNSSec? @@ -90,13 +90,13 @@ DNSSec 将通过让每一级 DNS 服务器对其请求进行数字签名来解 ### SIGRed: 蠕虫病毒 DNS 漏洞再次出现 -最近,随着 Windows DNS 服务器缺陷的发现,全世界都看到了 DNS 中的弱点可能造成的混乱。这个潜在的安全漏洞被称为 SIGRed,[它需要一个复杂的攻击链][16],但利用未打补丁的 Windows DNS 服务器,有可能在客户端安装和执行任意恶意代码。而且该漏洞是“可蠕虫”的,这意味着它可以在没有人为干预的情况下从计算机传播到计算机。该漏洞被认为足够令人震惊,以至于美国联邦机构[被要求在几天时间内安装补丁][17]。 +最近,随着 Windows DNS 服务器缺陷的发现,全世界都看到了 DNS 中的弱点可能造成的混乱。这个潜在的安全漏洞被称为 SIGRed,[它需要一个复杂的攻击链][16],但利用未打补丁的 Windows DNS 服务器,有可能在客户端安装和执行任意恶意代码。而且该漏洞是“可蠕虫传播”的,这意味着它可以在没有人为干预的情况下从计算机传播到计算机。该漏洞被认为足够令人震惊,以至于美国联邦机构[被要求他们在几天时间内安装补丁][17]。 ### DNS over HTTPS:新的隐私格局 截至本报告撰写之时,DNS 正处于其历史上最大的一次转变的边缘。谷歌和 Mozilla 共同控制着浏览器市场的大部分份额,他们正在鼓励向 [DNS over HTTPS][18](DoH)的方向发展,在这种情况下,DNS 请求将被已经保护了大多数 Web 流量的 HTTPS 协议加密。在 Chrome 的实现中,浏览器会检查 DNS 服务器是否支持 DoH,如果不支持,则会将 DNS 请求重新路由到谷歌的 8.8.8.8。 -这是一个并非没有争议的举动。早在上世纪 80 年代就在 DNS 协议上做了大量早期工作的 Paul Vixie 称此举对安全来说是“[灾难][19]”:例如,企业 IT 部门将更难监控或引导穿越其网络的 DoH 流量。不过,Chrome 浏览器是无所不在的,DoH 不久就会被默认打开,所以我们会看到未来会发生什么。 +这是一个并非没有争议的举动。早在上世纪 80 年代就在 DNS 协议上做了大量早期工作的 Paul Vixie 称此举对安全来说是“[灾难][19]”:例如,企业 IT 部门将更难监控或引导穿越其网络的 DoH 流量。不过,Chrome 浏览器是无所不在的,DoH 不久就会被默认打开,所以让我们拭目以待。 -------------------------------------------------------------------------------- @@ -105,7 +105,7 @@ via: https://www.networkworld.com/article/3268449/what-is-dns-and-how-does-it-wo 作者:[Keith Shaw][a], [Josh Fruhlinger][c] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 01264f0a7d44807c441dd07b527fa9c4c9083a9a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 10 Sep 2020 20:43:58 +0800 Subject: [PATCH 0062/1156] PUB @wxy https://linux.cn/article-12602-1.html --- .../20200826 What is DNS and how does it work.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200826 What is DNS and how does it work.md (99%) diff --git a/translated/tech/20200826 What is DNS and how does it work.md b/published/20200826 What is DNS and how does it work.md similarity index 99% rename from translated/tech/20200826 What is DNS and how does it work.md rename to published/20200826 What is DNS and how does it work.md index c6d22bdec6..344cd3d372 100644 --- a/translated/tech/20200826 What is DNS and how does it work.md +++ b/published/20200826 What is DNS and how does it work.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12602-1.html) [#]: subject: (What is DNS and how does it work?) [#]: via: (https://www.networkworld.com/article/3268449/what-is-dns-and-how-does-it-work.html) [#]: author: (Keith Shaw, Josh Fruhlinger ) From 8fa23aa38476eca5477f754fe3b213270e1680bd Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 11 Sep 2020 03:50:14 +0800 Subject: [PATCH 0063/1156] Revert "Update 20160921 lawyer The MIT License, Line by Line.md" This reverts commit c33637aee62f83b3f12a22dfeac6dccb00490897. --- sources/talk/20160921 lawyer The MIT License, Line by Line.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20160921 lawyer The MIT License, Line by Line.md b/sources/talk/20160921 lawyer The MIT License, Line by Line.md index a63121e30f..78abc6b9f1 100644 --- a/sources/talk/20160921 lawyer The MIT License, Line by Line.md +++ b/sources/talk/20160921 lawyer The MIT License, Line by Line.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (hongcha8385) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From e8aa3886b6dbdd047443d74c56f0334cee8cf6bb Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 11 Sep 2020 05:01:47 +0800 Subject: [PATCH 0064/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200911?= =?UTF-8?q?=20The=20New=20YubiKey=205C=20NFC=20Security=20Key=20Lets=20You?= =?UTF-8?q?=20Use=20NFC=20to=20Easily=20Authenticate=20Your=20Secure=20Dev?= =?UTF-8?q?ices?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md --- ...Easily Authenticate Your Secure Devices.md | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 sources/tech/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md diff --git a/sources/tech/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md b/sources/tech/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md new file mode 100644 index 0000000000..7868e418c1 --- /dev/null +++ b/sources/tech/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices) +[#]: via: (https://itsfoss.com/yubikey-5c-nfc/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices +====== + +If you are extra cautious about securing your online accounts with the best possible authentication method, you probably know about [Yubico][1]. They make hardware authentication security keys to replace [two-factor authentication][2] and get rid of the password authentication system for your online accounts. + +Basically, you just plug the security key on your computer or use the NFC on your smartphone to unlock access to accounts. In this way, your authentication method stays completely offline. + +![][3] + +Of course, you can always use a [good password manager for Linux][4] available out there. But if you own or work for a business or just extra cautious about your privacy and security and want to add an extra layer of security, these hardware security keys could be worth a try. These devices have gained some popularity lately. + +Yubico’s latest product – ‘[YubiKey 5C NFC][5]‘ is probably something impressive because it can be used both as USB type C key and NFC (just touch your device with the key). + +Here, let’s take a look at an overview of this security key. + +_Please note that It’s FOSS is an affiliate partner of Yubico. Please read our [affiliate policy][6]._ + +### Yubico 5C NFC: Overview + +![][7] + +YubiKey 5C NFC is the latest offering that uses both USB-C and NFC. So, you can easily plug it in on Windows, macOS, and Linux computers. In addition to the computers, you can also use it with your Android or iOS smartphones or tablets. + +Not just limited to USB-C and NFC support (which is a great thing), it also happens to be the world’s first multi-protocol security key with smart card support as well. + +Hardware security keys aren’t that common because of their cost for an average consumer. But, amidst the pandemic, with the rise of remote work, a safer authentication system will definitely come in handy. + +Here’s what Yubico mentioned in their press release: + +> “The way that people work and go online is vastly different today than it was a few years ago, and especially within the last several months. Users are no longer tied to just one device or service, nor do they want to be. That’s why the YubiKey 5C NFC is one of our most sought-after security keys — it’s compatible with a majority of modern-day computers and mobile phones and works well across a range of legacy and modern applications. At the end of the day, our customers crave security that ‘just works’ no matter what.”  said Guido Appenzeller, Chief Product Officer, Yubico. + +The protocols that YubiKey 5C NFC supports are FIDO2, WebAuthn, FIDO U2F, PIV (smart card), OATH-HOTP and OATH-TOTP (hash-based and time-based one-time passwords), [OpenPGP][8], YubiOTP, and challenge-response. + +Considering all those protocols, you can easily secure any online account that supports hardware authentication while also having the ability to access identity access management (IAM) solutions. So, it’s a great option for both individual users and enterprises. + +### Pricing & Availability + +The YubiKey 5C NFC costs $55. You can order it directly from their [online store][5] or get it from any authorized resellers in your country. The cost might also vary depending on the shipping charges but $55 seems to be a sweet spot for serious users who want the best-level of security for their online accounts. + +It’s also worth noting that you get volume discounts if you order more than two YubiKeys. + +[Order YubiKey 5C NFC][5] + +### Wrapping Up + +No matter whether you want to secure your cloud storage account or any other online account, Yubico’s latest offering is something that’s worth taking a look at if you don’t mind spending some money to secure your data. + +Have you ever used YubiKey or some other secure key like LibremKey etc? How is your experience with it? Do you think these devices are worth spending the extra money? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/yubikey-5c-nfc/ + +作者:[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/recommends/yubikey/ +[2]: https://ssd.eff.org/en/glossary/two-factor-authentication +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/yubikey-5c-nfc-desktop.jpg?resize=800%2C671&ssl=1 +[4]: https://itsfoss.com/password-managers-linux/ +[5]: https://itsfoss.com/recommends/yubico-5c-nfc/ +[6]: https://itsfoss.com/affiliate-policy/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/yubico-5c-nfc.jpg?resize=800%2C671&ssl=1 +[8]: https://www.openpgp.org/ From 63dd0d8b4fb5fe63903046bf4d14ccb067eb92bf Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 11 Sep 2020 05:02:11 +0800 Subject: [PATCH 0065/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200910?= =?UTF-8?q?=20Automate=20your=20container=20orchestration=20with=20Ansible?= =?UTF-8?q?=20modules=20for=20Kubernetes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md --- ...ion with Ansible modules for Kubernetes.md | 266 ++++++++++++++++++ 1 file changed, 266 insertions(+) create mode 100644 sources/tech/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md diff --git a/sources/tech/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md b/sources/tech/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md new file mode 100644 index 0000000000..358304a9a8 --- /dev/null +++ b/sources/tech/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md @@ -0,0 +1,266 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Automate your container orchestration with Ansible modules for Kubernetes) +[#]: via: (https://opensource.com/article/20/9/ansible-modules-kubernetes) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Automate your container orchestration with Ansible modules for Kubernetes +====== +Combine Ansible with Kubernetes for cloud automation. Plus, get our +cheat sheet for using the Ansible k8s module. +![Ship captain sailing the Kubernetes seas][1] + +[Ansible][2] is one of the best tools for automating your work. [Kubernetes][3] is one of the best tools for orchestrating containers. What happens when you combine the two? As you might expect, Ansible combined with Kubernetes lets you automate your container orchestration.  + +### Ansible modules + +On its own, Ansible is basically just a framework for interpreting YAML files. Its true power comes from its [many modules][4]. Modules are what enable you to invoke external applications with just a few simple configuration settings in a playbook. + +There are a few modules that deal directly with Kubernetes, and a few that handle related technology like [Docker][5] and [Podman][6]. Learning a new module is often similar to learning a new terminal command or a new API. You get familiar with a module from its documentation, you learn what arguments it accepts, and you equate its options to how you might use the application it interfaces with. + +### Access a Kubernetes cluster + +To try out Kubernetes modules in Ansible, you must have access to a Kubernetes cluster. If you don't have that, then you might try to open a trial account online, but most of those are short term. Instead, you can install [Minikube][7], as described on the Kubernetes website or in Bryant Son's excellent article on [getting started with Minikube][8]. Minikube provides a local instance of a single-node Kubernetes install, allowing you to configure and interact with it as you would a full cluster. + +**[Download the [Ansible k8s cheat sheet][9]]** + +Before installing Minikube, you must ensure that your environment is ready to serve as a virtualization backend. You may need to install `libvirt` and grant yourself permission to the `libvirt` group: + + +``` +$ sudo dnf install libvirt +$ sudo systemctl start libvirtd +$ sudo usermod --append --groups libvirt `whoami` +$ newgrp libvirt +``` + +#### Install Python modules + +To prepare for using Kubernetes-related Ansible modules, you should also install a few helper Python modules: + + +``` +$ pip3.6 install kubernetes --user +$ pip3.6 install openshift --user +``` + +#### Start Kubernetes + +If you're using Minikube instead of a Kubernetes cluster, use the `minikube` command to start up a local, miniaturized Kubernetes instance on your computer: + + +``` +`$ minikube start --driver=kvm2 --kvm-network default` +``` + +Wait for Minikube to initialize. Depending on your internet connection, this could take several minutes. + +### Get information about your cluster + +Once you've started your cluster successfully, you can get information about it with the `cluster-info` option: + + +``` +$ kubectl cluster-info +Kubernetes master is running at +KubeDNS is running at + +To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'. +``` + +### Use the k8s module + +The entry point for using Kubernetes through Ansible is the `k8s` module, which enables you to manage Kubernetes objects from your playbooks. This module describes states resulting from `kubectl` instructions. For instance, here's how you would create a new [namespace][10] with `kubectl`: + + +``` +`$ kubectl create namespace my-namespace` +``` + +It's a simple action, and the YAML representation of the same result is similarly terse: + + +``` +\- hosts: localhost +  tasks: +    - name: create namespace +      k8s: +        name: my-namespace +        api_version: v1 +        kind: Namespace +        state: present +``` + +In this case, the host is defined as `localhost`, under the assumption that you're running this against Minikube. Notice that the module in use defines the syntax of the parameters available (such as `api_version` and `kind`). + +Before using this playbook, verify it with `yamllint`: + + +``` +`$ yamllint example.yaml` +``` + +Correct any errors, and then run the playbook: + + +``` +`$ ansible-playbook ./example.yaml` +``` + +Verify that the new namespace has been created: + + +``` +$ kubectl get namespaces +NAME              STATUS   AGE +default           Active   37h +kube-node-lease   Active   37h +kube-public       Active   37h +kube-system       Active   37h +demo              Active   11h +my-namespace      Active   3s +``` + +### Pull a container image with Podman + +Containers are Linux systems, almost impossibly minimal in scope, that can be managed by Kubernetes. Much of the container specifications have been defined by the [LXC project][11] and Docker. A recent addition to the container toolset is Podman, which is popular because it runs without requiring a daemon. + +With Podman, you can pull a container image from a repository, such as Docker Hub or Quay.io. The Ansible syntax for this is simple, and all you need to know is the location of the container, which is available from the repository's website: + + +``` +   - name: pull an image +      podman_image: +        name: quay.io/jitesoft/nginx +``` + +Verify it with `yamllint`: + + +``` +`$ yamllint example.yaml` +``` + +And then run the playbook: + + +``` +$ ansible-playbook ./example.yaml +[WARNING]: provided hosts list is empty, only localhost is available. +Note that the implicit localhost does not match 'all' + +PLAY [localhost] ************************ + +TASK [Gathering Facts] ************************ +ok: [localhost] + +TASK [create k8s namespace] ************************ +ok: [localhost] + +TASK [pull an image] ************************ +changed: [localhost] + +PLAY RECAP ************************ +localhost: ok=3 changed=1 unreachable=0 failed=0 +           skipped=0 rescued=0 ignored=0 +``` + +### Deploy with Ansible + +You're not limited to small maintenance tasks with Ansible. Your playbook can interact with Ansible in much the same way a configuration file does with `kubectl`. In fact, in many ways, the YAML you know by using Kubernetes translates to your Ansible plays. Here's a configuration you might pass directly to `kubectl` to deploy an image (in this example, a web server): + + +``` +apiVersion: apps/v1 +kind: Deployment +metadata: +  name: my-webserver +spec: +  selector: +    matchLabels: +      run: my-webserver +  replicas: 1 +  template: +    metadata: +      labels: +        run: my-webserver +    spec: +      containers: +      - name: my-webserver +        image: nginx +        ports: +        - containerPort: 80 +``` + +If you know these parameters, then you mostly know the parameters required to accomplish the same with Ansible. You can, with very little modification, move that YAML into a `definition` element in your Ansible playbook: + + +``` +   - name: deploy a web server +      k8s: +        api_version: v1 +        namespace: my-namespace +        definition: +          kind: Deployment +          metadata: +            labels: +              app: nginx +            name: nginx-deploy +          spec: +            replicas: 1 +            selector: +              matchLabels: +                app: nginx +            template: +              metadata: +                labels: +                  app: nginx +              spec: +                containers: +                  - name: my-webserver +                    image: quay.io/jitesoft/nginx +                    ports: +                      - containerPort: 80 +                        protocol: TCP +``` + +After running this, you can see the deployment with `kubectl`, as usual: + + +``` +$ kubectl -n my-namespace get pods +NAME                      READY  STATUS +nginx-deploy-7fdc9-t9wc2  1/1    Running +``` + +### Modules for the cloud + +As more development and deployments move to the cloud, it's important to understand how to automate the important aspects of your cloud. The `k8s` and `podman_image` modules are only two examples of modules related to Kubernetes and a mere fraction of modules developed for the cloud. Take a look at your workflow, find the tasks you want to track and automate, and see how Ansible can help you do more by doing less. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/ansible-modules-kubernetes + +作者:[Seth Kenlon][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://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/ship_captain_devops_kubernetes_steer.png?itok=LAHfIpek (Ship captain sailing the Kubernetes seas) +[2]: https://opensource.com/resources/what-ansible +[3]: https://opensource.com/resources/what-is-kubernetes +[4]: https://docs.ansible.com/ansible/latest/modules/modules_by_category.html +[5]: https://opensource.com/resources/what-docker +[6]: http://podman.io +[7]: https://kubernetes.io/docs/tasks/tools/install-minikube +[8]: https://opensource.com/article/18/10/getting-started-minikube +[9]: https://opensource.com/downloads/ansible-k8s-cheat-sheet +[10]: https://opensource.com/article/19/10/namespaces-and-containers-linux +[11]: https://www.redhat.com/sysadmin/exploring-containers-lxc From 691c217dc8161004ad888a28049de53244ddf627 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 11 Sep 2020 05:02:24 +0800 Subject: [PATCH 0066/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200910?= =?UTF-8?q?=20How=20this=20open=20source=20test=20framework=20evolves=20wi?= =?UTF-8?q?th=20.NET?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200910 How this open source test framework evolves with .NET.md --- ...source test framework evolves with .NET.md | 156 ++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 sources/tech/20200910 How this open source test framework evolves with .NET.md diff --git a/sources/tech/20200910 How this open source test framework evolves with .NET.md b/sources/tech/20200910 How this open source test framework evolves with .NET.md new file mode 100644 index 0000000000..e9acf235d7 --- /dev/null +++ b/sources/tech/20200910 How this open source test framework evolves with .NET.md @@ -0,0 +1,156 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How this open source test framework evolves with .NET) +[#]: via: (https://opensource.com/article/20/9/testing-net-fixie) +[#]: author: (Patrick Lioi https://opensource.com/users/patricklioi) + +How this open source test framework evolves with .NET +====== +Re-evaluating and overhauling a software project's design are crucial +steps to keep up as circumstances change. +![magnifying glass on computer screen, finding a bug in the code][1] + +A software project's design is a consequence of the time it was written. As circumstances change, it's wise to take a step back and consider whether old ideas still make for a good design. If not, you risk missing out on enhancements, simplifications, new degrees of freedom, or even a project's very survival. + +This is relevant advice for [.NET][2] developers whose dependencies are subject to constant updates or are preparing for .NET 5. The [Fixie][3] project confronted this reality as we flexed to outside circumstances during the early adoption phase of .NET Core. Fixie is an open source .NET test framework similar to NUnit and xUnit with an emphasis on [developer ergonomics][4] and customization. It was developed before .NET Core and has gone through a few major design overhauls in response to platform updates. + +### The problem: Reliable assembly loading + +A .NET test project tends to feel a lot like a library: a bunch of classes with no visible entry point. The assumption is that a test runner, like Fixie's Visual Studio Test Explorer plugin, will load your test assembly, use reflection to find all the tests within it, and invoke the tests to collect results. Unlike a regular library, test projects share some similarities with regular console applications: + + 1. The test project's dependencies should be naturally loadable, as with any executable, from their own build output folder. + 2. When running multiple test projects, the loaded assemblies for test project A should be separate from the loaded assemblies for test project B. + 3. When the system under test relies on an App.config file, it should use the one local to the test project while the tests are running. + + + +I'll call these behaviors the Big Three. The Big Three are so natural that you rarely find a need to even _say_ them. A test project should resemble a console executable: It should be able to have dependencies, it should not conflict with the assemblies loaded for another project, and each project should respect its own dedicated config file. We take this all for granted. The sky is blue, water is wet, and the Big Three must be honored as tests run. + +### Fixie v1: Designing for the Big Three + +The Big Three pose a _huge_ problem for .NET test frameworks: the primary running process, such as Visual Studio Test Explorer, is nowhere near the test project's build output folder. The most natural attempt to load a test project and run it will fail all of the Big Three. + +Early alpha builds of Fixie were naive about assembly loading: The test runner .exe would load a test project and run simple tests, but it would fail as soon as a test tried to run code in another assembly—like the application being tested. By default, it searched for assemblies _near the test runner_, nowhere near the test project's build output folder. + +Once we resolved that, using that test runner to run more than one test project would result in conflicts at runtime, such as when each test project referenced different versions of the same library. + +And when we resolved that, the test runner would fail to look in the right config files, mistakenly thinking the test runner's config file was the one to use. + +In the days of the regular old .NET Framework, the solution to the Big Three came in the form of AppDomains. AppDomains are a fairly old and now-deprecated technology. Fixie v1 was developed when this was the primary solution, with no deprecation in sight, to the Big Three. _Under those circumstances_, using AppDomains to solve the Big Three was the ideal design, though it was a bit frustrating to work with them. In short, they let a single test runner carve out little pockets of loaded assemblies with rigid communication boundaries between them. + +![Fixie version 1][5] + +The Test Explorer plugin and its own dependencies (like [Mono.Cecil][6]) live in one AppDomain. The test assembly and its dependencies live in a second AppDomain. A painful serialization boundary allows requests to cross the chasm with no risk of mixing the loaded assemblies. + +AppDomains let you identify each test project's build output folder as the home of that test project's config file and dependencies. You could successfully load a test project's folder into the test runner process, call into it, and get test results while meeting the Big Three requirements. + +And then .NET Core came along. Suddenly, AppDomains were an old and deprecated concept that simply would not continue to exist in the .NET Core world. + +Circumstances had changed with a vengeance. + +### Fixie v2: Adapting to the .NET Core crisis + +At first, this seemed like the end of the Fixie project. The entire design depended on AppDomains, and if this newfangled .NET Core thing survived, Fixie would have no answer to the Big Three. Despair. Close up shop. Delete the repository. + +In these moments of despair, we were making a classic software development mistake: confusing the _solution_ with the _requirements_. The _actual requirements_ (the Big Three) had not changed. The circumstances _around_ the design had changed: AppDomains were no longer available. When people make the mistake of confusing their solution with their requirements, they may double down, grip their steering wheel tighter, and just flail around while they try to force their solution to continue working. + +Instead, we needed to recognize the plain truth: we had familiar requirements, but new circumstances, and it was time to throw out the old design for something new that met the same requirements under the new circumstances. Once we gave ourselves permission to go back to the drawing board, the solution was clear: + +The Big Three let your "library" test project feel like a console application. So, what if your test project _was_ a console application? + +A console application already has meaningful notions of loading dependencies from the right folder, distinct from the dependencies of another application, while respecting its own config file. The test runner is no longer the only process in the mix. Instead, the test runner's job is to _start_ the test project as a process of its own and communicate with it to collect results. We traded away AppDomains for interprocess communication, resulting in a new design that met all the original requirements while also working in the context of .NET Framework _and_ .NET Core projects. + +![Fixie version 2][7] + +This design kept the project alive and allowed us to serve both platforms during those shaky years when it wasn't certain which platform would survive in the long run. However, maintaining support for two worlds became increasingly painful, especially in keeping the Visual Studio Test Explorer plugin alive through every minor Visual Studio release. Every minor Fixie release involved a huge matrix of use cases to do regression testing, and every new little bump in the road brought innovation to a halt. + +On top of that, Microsoft was starting to show clear signs that it was abandoning the .NET Framework: the old Framework no longer kept up with advances in .NET Standard, ASP.NET, or C#. The .NET Framework would exist but would quickly fall by the wayside. + +Circumstances had changed again. + +### Fixie v3: Embracing One .NET + +Fixie v3 is a work in progress that we intend to release shortly after .NET 5 arrives. .NET 5 is the resolution to the .NET Framework vs. .NET Core development lines, arriving at [One .NET][8]. Instead of fighting it, we're following Microsoft's evolution: Fixie v3 will no longer run on the .NET Framework. Removing .NET Framework support allowed us to remove a lot of old, slow implementation details and dramatically simplified the regression testing scenarios we had to consider for reach release. It also allowed us to reconsider our design. + +The Big Three requirements changed only slightly: .NET Core does away with the notion of an App.config file closely tied to your executable, instead relying on a more convention-based configuration. All of Fixie's assembly-loading requirements remained. More importantly, the circumstances _around_ the design changed in a fundamental way: we were no longer limited to using types available in both .NET Framework and .NET Core. + +By promising _less_ with the removal of .NET Framework support, we _gained_ new degrees of freedom to modernize the system. + +.NET's [AssemblyLoadContext][9] is a distant cousin of AppDomains. It's not available to the .NET Framework, so it hadn't been an option for us before. AssemblyLoadContext lets you set up a dedicated loading area for an assembly and its own dependencies without polluting the surrounding process and without being limited to the original process's own folder of assemblies. In other words, it gives AppDomains' "load this folder of assemblies off to the side" behavior without the frustrating AppDomains quirks. + +We defined the concept of a **TestAssemblyLoadContext**, the little pocket of assembly-loading necessary for one test assembly folder: + + +``` +class TestAssemblyLoadContext : AssemblyLoadContext +{ +    readonly AssemblyDependencyResolver resolver; + +    public TestAssemblyLoadContext(string testAssemblyPath) +        => resolver = [new][10] AssemblyDependencyResolver(testAssemblyPath); + +    protected override Assembly? Load(AssemblyName assemblyName) +    { +        // Reuse the Fixie.dll already loaded in the containing process. +        if (assemblyName.Name == "Fixie") +            return null; + +        var assemblyPath = resolver.ResolveAssemblyToPath(assemblyName); + +        if (assemblyPath != null) +            return LoadFromAssemblyPath(assemblyPath); + +        return null; +    } + +    ... +} +``` + +Armed with this class, we can successfully load a test assembly and all its dependencies in a safe way and from the right folder. The test runner can work with the loaded Assembly directly, knowing that the loading effort won't pollute the test runner's own dependencies: + + +``` +var assemblyName = [new][10] AssemblyName(Path.GetFileNameWithoutExtension(assemblyPath)); +var testAssemblyLoadContext = [new][10] TestAssemblyLoadContext(assemblyPath); +var assembly = testAssemblyLoadContext.LoadFromAssemblyName(assemblyName); +// Use System.Reflection.* against `assembly` to find and run test methods... +``` + +We've come full circle: The Fixie v3 Visual Studio plugin uses TestAssemblyLoadContext to load test assemblies in process, similar to the way the Fixie v1 plugin did with AppDomains. The core Fixie.dll assembly need only be loaded once. Most importantly, we got to eliminate all the interprocess communication while taking advantage of the best that the new circumstances allowed. + +![Fixie version 3][11] + +### Always be designing + +When you work with any long-lived system, some of your maintenance pains are really clues that outside circumstances have changed. If your circumstances are changing, take a step back and reconsider your design. Are you mistaking your _solution_ for your _requirements_? Articulate your requirements separate from your solution, and see whether your circumstances suggest a new and perhaps even exciting direction. + +With news of Microsoft making the server side of .NET open source, we look at how the creation of... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/testing-net-fixie + +作者:[Patrick Lioi][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://opensource.com/users/patricklioi +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/mistake_bug_fix_find_error.png?itok=PZaz3dga (magnifying glass on computer screen, finding a bug in the code) +[2]: https://en.wikipedia.org/wiki/.NET_Framework +[3]: https://github.com/fixie/fixie +[4]: https://headspring.com/2020/04/01/fixie-test-framework-developer-ergonomics/ +[5]: https://opensource.com/sites/default/files/fixie-design-diagram-v1-cropped.jpg (Fixie version 1) +[6]: https://www.mono-project.com/docs/tools+libraries/libraries/Mono.Cecil/ +[7]: https://opensource.com/sites/default/files/fixie-design-diagram-v2-cropped_0.jpg (Fixie version 2) +[8]: https://channel9.msdn.com/Events/Build/2020/BOD106 +[9]: https://docs.microsoft.com/en-us/dotnet/core/tutorials/creating-app-with-plugin-support +[10]: http://www.google.com/search?q=new+msdn.microsoft.com +[11]: https://opensource.com/sites/default/files/fixie-design-diagram-v3-cropped_0.jpg (Fixie version 3) From 467bc592e92465ee71e0975eeee475f766c84955 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 11 Sep 2020 08:46:07 +0800 Subject: [PATCH 0067/1156] translated --- ...es on Linux with this USB ID Repository.md | 43 +++++++++---------- 1 file changed, 21 insertions(+), 22 deletions(-) rename {sources => translated}/tech/20200824 Recognize more devices on Linux with this USB ID Repository.md (51%) diff --git a/sources/tech/20200824 Recognize more devices on Linux with this USB ID Repository.md b/translated/tech/20200824 Recognize more devices on Linux with this USB ID Repository.md similarity index 51% rename from sources/tech/20200824 Recognize more devices on Linux with this USB ID Repository.md rename to translated/tech/20200824 Recognize more devices on Linux with this USB ID Repository.md index 0194513cf0..0857c71e62 100644 --- a/sources/tech/20200824 Recognize more devices on Linux with this USB ID Repository.md +++ b/translated/tech/20200824 Recognize more devices on Linux with this USB ID Repository.md @@ -7,17 +7,16 @@ [#]: via: (https://opensource.com/article/20/8/usb-id-repository) [#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) -Recognize more devices on Linux with this USB ID Repository +利用这个 USB ID 仓库识别更多 Linux 上的设备 ====== -An open source project contains a public repository of all known IDs -used in USB devices. +一个包含了所有已知 USB 设备 ID 的开源项目。 ![Multiple USB plugs in different colors][1] -There are thousands of USB devices on the market—keyboards, scanners, printers, mouses, and countless others that all work on Linux. Their vendor details are stored in the USB ID Repository. +市场上有成千上万的 USB 设备:键盘、扫描仪、打印机、鼠标和其他无数的设备都能在 Linux 上工作。它们的供应商详情都存储在 USB ID 仓库中。 ### lsusb -The Linux `lsusb` command lists information about the USB devices connected to a system, but sometimes the information is incomplete. For example, I recently noticed that the brand of one of my USB devices was not recognized. the device was functional, but listing the details of my connected USB devices provided no identification information. Here is the output from my `lsusb` command: +Linux `lsusb` 命令列出了连接到系统的 USB 设备的信息,但有时信息不完整。例如,我最近注意到我的一个 USB 设备的品牌没有被识别。设备是可以使用的,但是在列出我所连接的 USB 设备的详情中没有提供任何识别信息。以下是我的 `lsusb` 命令的输出: ``` @@ -30,11 +29,11 @@ Bus 001 Device 005: ID 051d:0002 American Power Conversion Uninterruptible Power Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub ``` -As you can see in the last column, there is one device with no manufacturers description. To determine what the device is, I would have to do a deeper inspection of my USB device tree. Fortunately, the `lsusb` command has more options. One is `-D device`, to elicit per-device details, as the man page explains: +正如你在最后一栏中看到的,有一个设备没有制造商描述。要确定这个设备是什么,我必须对我的 USB 设备树进行更深入的检查。幸运的是,`lsusb` 命令有更多的选项。其中一个选项是 `-D device`,来获取每个设备的详细信息,正如手册页面所解释的那样。 -> "Do not scan the /dev/bus/usb directory, instead display only information about the device whose device file is given. The device file should be something like /dev/bus/usb/001/001. This option displays detailed information like the **v** option; you must be root to do this." +> “不会扫描 /dev/bus/usb 目录,而只显示给定设备文件所属设备的信息。设备文件应该是类似 /dev/bus/usb/001/001 这样的文件。这个选项会像 **v** 选项一样显示详细信息,但你必须是 root 用户才行。" -I didn't think it was easily apparent how to pass the device path to the lsusb command, but after carefully reading the man page and the initial output I was able to determine how to construct it. USB devices reside in the UDEV filesystem. Their device path begins in the USB device directory `/dev/bus/usb/`. The rest of the path is made up of the device's Bus ID and Device ID. My non-descript device is Bus 001, Device 002, which translates to 001/002, and completes the path `/dev/bus/usb/001/002`. Now I can pass this path to `lsusb`. I'll also pipe to `more` since there is often quite a lot of information there: +我认为如何将设备路径传递给 lsusb 命令并不容易,但在仔细阅读手册页和初始输出后,我能够确定如何构造它。USB 设备驻留在 UDEV 文件系统中。它们的设备路径始于 USB 设备目录 `/dev/bus/usb/`。路径的其余部分由设备的总线 ID 和设备 ID 组成。我的非描述设备是 Bus 001、Device 002,被翻译成了 001/002,完成路径 `/dev/bus/usb/001/002`。现在我可以把这个路径传给 `lsusb`。我还会用管道传给 `more`,因为这里往往有很多信息: ``` @@ -79,30 +78,30 @@ Device Descriptor:         HID Device Descriptor: ``` -Unfortunately, this didn't provide the detail I was hoping to find. The two fields that appear in the initial output, `idVendor` and `idProduct`, are both empty. There is some help, as scanning down a bit reveals the word **Mouse**. A-HA! So, this device is my mouse. +不幸的是,这里并没有提供我希望找到的细节。初始输出中出现的两个字段 `idVendor` 和 `idProduct` 都是空的。这里有些帮助,因为往下扫描一下,就会发现 **Mouse** 这个词。所以,这个设备就是我的鼠标。 -## The USB ID Repository +## USB ID 仓库 -This made me wonder how I could populate these fields, not only for myself but also for other Linux users. It turns out there is already an open source project for this: the [USB ID Repository][2]. It is a public repository of all known IDs used in USB devices. It is also used in various programs, including the [USB Utilities][3], to display human-readable device names. +这让我不禁想知道如何才能填充这些字段,不仅是为了自己,也是为了其他 Linux 用户。原来已经有了一个开源项目:[USB ID Repository][2]。它是一个公共仓库,它包含了 USB 设备中使用的所有已知 ID。它也被用于各种程序中,包括 [USB Utilities][3],用于显示人类可读的设备名称。 ![The USB ID Repository Site][4] (Alan Formy-Duval, [CC BY-SA 4.0][5]) -You can browse the repository for particular devices either from the website or by downloading the database. Users are also welcome to submit new data. This is what I did for my mouse, which was absent. +你可以从网站上或通过下载数据库来浏览特定设备的仓库。也欢迎用户提交新的数据。这是我为我的鼠标做的,它是没有的。 -### Update your USB IDs +### 更新你的 USB ID -The USB ID database is stored in a file called `usb.ids`. This location may vary depending on the Linux distribution. +USB ID 数据库存储在一个名为 `usb.ids` 的文件中。这个文件的位置可能会因 Linux 发行版的不同而不同。 -On Ubuntu 18.04, this file is located in `/var/lib/usbutils`. To update the database, use the command `update-usbids`, which you need to run with root privileges or with `sudo`: +在 Ubuntu 18.04 中,这个文件位于 `/var/lib/usbutils`。要更新数据库,使用命令 `update-usbids`,你需要用 root 权限或 `sudo` 来运行。 ``` `$ sudo update-usbids` ``` -If a new file is available, it will be downloaded. The current file will be backed up and replaced by the new one: +如果有新文件,它就会被下载。当前的文件将被备份,并被替换为新文件: ``` @@ -114,7 +113,7 @@ drwxr-xr-x 85 root root   4096 Nov  7 08:05 .. -rw-r--r--  1 root root 551472 Jan 15 00:34 usb.ids.old ``` -Recent versions of Fedora Linux store the database file in `/usr/share/hwdata`. Also, there is no update script. Instead, the database is maintained in a package named `hwdata`. +最新版本的 Fedora Linux 将数据库文件保存在 `/usr/share/hwdata` 中。而且,没有更新脚本。相反,数据库被维护在一个名为 `hwdata` 的包中。 ``` @@ -136,7 +135,7 @@ Description  : hwdata contains various hardware identification and configuratio              : such as the pci.ids and usb.ids databases. ``` -Now my USB device list shows a name next to this previously unnamed device. Compare this to the output above: +现在我的 USB 设备列表在这个之前未命名的设备旁边显示了一个名字。比较一下上面的输出: ``` @@ -149,13 +148,13 @@ Bus 001 Device 005: ID 051d:0002 American Power Conversion Uninterruptible Power Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub ``` -You may notice that other device descriptions change as the repository is regularly updated with new devices and details about existing ones. +你可能会注意到,随着仓库定期更新新设备和现有设备的详细信息,其他设备的描述也会发生变化。 -### Submit new data +### 提交新数据 -There are two ways to submit new data: by using the web interface or by emailing a specially formatted patch file. Before I began, I read through the submission guidelines. First, I had to register an account, and then I needed to use the project's submission system to provide my mouse's ID and name. The process is the same for adding any USB device. +提交新数据有两种方式:使用网站或通过电子邮件发送特殊格式的补丁文件。在开始之前,我阅读了提交指南。首先,我必须注册一个账户,然后我需要使用项目的提交系统提供我鼠标的 ID 和名称。添加任何 USB 设备的过程都是一样的。 -Have you used the USB ID Repository? If so, please share your reaction in the comments. +你使用过 USB ID 仓库么?如果有,请在评论中分享你的反馈。 -------------------------------------------------------------------------------- From 6e029c0a69d7b1fab42911d7e6d62897417df4cd Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 11 Sep 2020 08:51:36 +0800 Subject: [PATCH 0068/1156] translating --- ...g the Linux stat command to create flexible file listings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200909 Using the Linux stat command to create flexible file listings.md b/sources/tech/20200909 Using the Linux stat command to create flexible file listings.md index 50aa2b3c7f..5dc598d310 100644 --- a/sources/tech/20200909 Using the Linux stat command to create flexible file listings.md +++ b/sources/tech/20200909 Using the Linux stat command to create flexible file listings.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From a0d8b71e5eb6eed23cfb0433716617cacffaa4f5 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Fri, 11 Sep 2020 15:28:55 +0800 Subject: [PATCH 0069/1156] Translating. --- ...0200708 6 best practices for teams using Git.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/translated/tech/20200708 6 best practices for teams using Git.md b/translated/tech/20200708 6 best practices for teams using Git.md index a5b4609770..8e065930fa 100644 --- a/translated/tech/20200708 6 best practices for teams using Git.md +++ b/translated/tech/20200708 6 best practices for teams using Git.md @@ -81,23 +81,23 @@ git push -f ### 使用标签 -After you have finished testing and are ready to deploy the software from the `master` branch, or if you want to preserve the current state as a significant milestone for any other reason, create a Git tag. While a branch accumulates a history of changes corresponding to commits, a tag is a snapshot of the branch's state at that instant. A tag can be thought of as a history-less branch or as a named pointer to a specific commit immediately before the tag was created. +当你完成测试并准备从 `master` 分支部署软件到线上时,又或者当你出于某种原因想要保留当前状态作为一个里程碑时,那么可以创建一个 Git 的标签。对于一个积累了一些变更和相应提交的分支而言,标签就是该分支在那一时刻的快照。一个标签可以看作是没有历史记录的分支,也可以看作是直接指向标签创建前那个提交的命名指针。 -Configuration control is about preserving the state of code at various milestones. Being able to reproduce software source code for any milestone so that it can be rebuilt when necessary is a requirement in most projects. A Git tag provides a unique identifier for such a code milestone. Tagging is straightforward: +配置控制是关于保留各个里程碑上代码的状态。大多数项目都有一个需求,允许重现任一里程碑上的软件源码,以便在需要时重新构建。Git 标签为每个代码的里程碑提供了一个唯一标识。打标签非常简单: ``` git tag milestone-id -m "short message saying what this milestone is about" -git push --tags   # don't forget to explicitly push the tag to the remote +git push --tags   # 不要忘记将标签显式推送到远程 ``` -Consider a scenario where software corresponding to a given Git tag is distributed to a customer, and the customer reports an issue. While the code in the repository may continue to evolve, it's often necessary to go back to the state of the code corresponding to the Git tag to reproduce the customer issue precisely to create a bug fix. Sometimes newer code may have already fixed the issue but not always. Typically, you'd check out the specific tag and create a branch from that tag: +考虑一种情况,Git 标签对应的软件版本已经分发给客户,而且客户提了个问题。尽管代码库中的代码可能已经继续在开发,但通常情况下为了准确地重现客户问题以便做出修复,必须回退到 Git 标签对应的代码状态。偶尔,新代码已经修复了那个问题,但并非一直如此。通常你需要切换到特定的标签并从那个标签创建一个分支: ``` -git checkout milestone-id        # checkout the tag that was distributed to the customer -git checkout -b new-branch-name  # create new branch to reproduce the bug +git checkout milestone-id        # 切换到分发给客户的标签 +git checkout -b new-branch-name  # 创建新的分支用于重现 bug ``` -Beyond this, consider using annotated tags and signed tags if they may be beneficial to your project. +此外,如果带注释的标记和带符号的标记有助于你的项目,可以考虑使用它们。 ### 让软件运行时打印标签 From e1dab03e24757b8feea75480c245153f6cc85a2e Mon Sep 17 00:00:00 2001 From: jlztan Date: Fri, 11 Sep 2020 16:00:18 +0800 Subject: [PATCH 0070/1156] Update 20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit jlztan 申请翻译 --- ...e Docker Containers with Portainer.io (GUI tool) - Part-1.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md b/sources/tech/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md index 27bf04eb05..338bf058f6 100644 --- a/sources/tech/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md +++ b/sources/tech/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (jlztan) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 5ddfd8706c1e869eb58a6305d977e94683e4b159 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 11 Sep 2020 22:22:33 +0800 Subject: [PATCH 0071/1156] PRF @geekpi --- ...ith Cloud Services in Linux Graphically.md | 44 +++++++++---------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/translated/tech/20200903 Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically.md b/translated/tech/20200903 Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically.md index 82ecbaa231..11604ab180 100644 --- a/translated/tech/20200903 Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically.md +++ b/translated/tech/20200903 Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically) @@ -10,19 +10,19 @@ Rclone Browser 让你在 Linux 中以图形化的方式与云服务同步数据 ====== -_**简介:Rclone Browser 是一款高效的 GUI 程序,它可以让你轻松地使用 Rclone 管理和同步云存储上的数据。在这里,我们来看看它提供的功能和工作方式。**_ +> Rclone Browser 是一款高效的 GUI 程序,它可以让你轻松地使用 Rclone 管理和同步云存储上的数据。在这里,我们来看看它提供的功能和工作方式。 -如果你想原生地在 Linux上毫不费力地使用 One Drive 或[Google Drive][1],你可以选择像 [Insync][2] 这样的高级 GUI 工具([联盟][3]链接)。 +如果你想原生地在 Linux 上毫不费力地使用 One Drive 或 [Google Drive][1],你可以选择像 [Insync][2] 这样的高级 GUI 工具。 -如果你能在终端上下功夫,你可以使用 [Rclone][4] 与许多 [Linux 上的云存储服务][5]进行同步。我们有一份详细的[在 Linux 中使用 Rclone 与 OneDrive 同步的指南][6]。 +如果你能在终端上下功夫,你可以使用 [rclone][4] 与许多 [Linux 上的云存储服务][5]进行同步。我们有一份详细的[在 Linux 中使用 Rclone 与 OneDrive 同步的指南][6]。 -[Rclone][4] 是一个相当流行且有用的命令行工具。很多有经验的用户会需要使用 Rclone 的功能。 +[rclone][4] 是一个相当流行且有用的命令行工具。rclone 提供的功能是很多有经验的用户需要的。 然而,即使它足够有用,也不是每个人都能从终端使用它。 -因此,在本文中,我将介绍一个令人印象深刻的 GUI ”Rclone Browser”“,它可以让你轻松地使用 Rclone 管理和同步云存储上的数据。 +因此,在本文中,我将介绍一个令人印象深刻的 GUI “Rclone Browser”,它可以让你轻松地使用 Rclone 管理和同步云存储上的数据。 -值得注意的是,Rclone 确实提供了一个实验性的基于 Web 的 GUI。但我们将在这里专注于 [Rclone Browser][7]。 +值得注意的是,rclone 确实提供了一个实验性的基于 Web 的 GUI。但我们将在这里专注于 [Rclone Browser][7]。 ![][8] @@ -32,19 +32,19 @@ Rclone Browser 是一款可以让你浏览、修改、上传/下载、列出文 它提供了一个简单的用户界面,并且工作良好(根据我的快速测试)。让我们详细看看它提供的功能以及如何开始使用它。 -### Rclone Browse r的功能 +### Rclone Browser 的功能 ![][9] 它提供了很多选项和控制来管理远程存储位置。根据你的使用情况,你可能会发现它的功能丰富或不知所措。以下是它的功能: - * 浏览和修改 rclone 远程存储位置。 + * 浏览和修改 rclone 远程存储位置 * 支持加密云存储 * 支持自定义位置和配置加密 * 不需要额外的配置。它将使用相同的 rclone 配置文件(如果你有的话) * 在不同的标签页中同时导航多个位置 * 按层次列出文件(按文件名、大小和修改日期) - * Rclone 命令的执行是异步的,不会使 GUI 冻结 + * rclone 命令的执行是异步的,不会使 GUI 冻结 * 你可以上传、下载、创建新文件夹、重命名、删除文件和文件夹 * 上传文件时支持拖放 * 在 VLC 等播放器中播放流媒体文件 @@ -57,11 +57,9 @@ Rclone Browser 是一款可以让你浏览、修改、上传/下载、列出文 * 黑暗模式 * 跨平台支持(Windows、macOS 和 Linux)。 - - ### 在 Linux 上安装 Rclone Browser -_在使用 Rclone Browser 之前,你需要在你的 Linux 发行版上安装 rclone。请按照[官方安装说明][10]来安装。_ +在使用 Rclone Browser 之前,你需要在你的 Linux 发行版上安装 rclone。请按照[官方安装说明][10]来安装。 你可以在 [GitHub 页面][7]的[发布页][11]找到 Rclone Browser 的 AppImage 文件。所以,你在任何 Linux 发行版上运行它都不会有问题。 @@ -69,19 +67,19 @@ _在使用 Rclone Browser 之前,你需要在你的 Linux 发行版上安装 r 你也可以选择构建它。操作说明在 GitHub 页面上。 -[Rclone Browser][7] +- [下载 Rclone Browser][7] -### 开始使用Rclone Browser +### 开始使用 Rclone Browser 在这里,我只分享一下使用 Rclone Browser 应该知道的几件事。 ![][13] -如果你在终端中使用 rclone 时有任何现有的远程位置,它将自动显示在 GUI 中。你也可以点击 ”**Refresh**“ 按钮来获取最新的新增内容。 +如果你在终端中使用 rclone 时有任何现有的远程位置,它将自动显示在 GUI 中。你也可以点击 “Refresh” 按钮来获取最新的新增内容。 -如上图所示,当你点击 ”**Config**“ 按钮时,它会启动终端,让你轻松地添加一个新的远程或按你的要求配置它。当终端弹出的时候不用担心,Rclone browser 会执行命令来完成所有必要的任务,你只需要在需要的时候设置或编辑一些东西。你不需要执行任何 Rclone 命令。 +如上图所示,当你点击 “Config” 按钮时,它会启动终端,让你轻松地添加一个新的远程或按你的要求配置它。当终端弹出的时候不用担心,Rclone browser 会执行命令来完成所有必要的任务,你只需要在需要的时候设置或编辑一些东西。你不需要执行任何 rclone 命令。 -如果你有一些现有的远程位置,你可以使用 ”**Open**“ 按钮打开它们,并在不同的标签页中访问云存储,如下所示。 +如果你有一些现有的远程位置,你可以使用 “Open” 按钮打开它们,并在不同的标签页中访问云存储,如下所示。 ![][14] @@ -89,11 +87,11 @@ _在使用 Rclone Browser 之前,你需要在你的 Linux 发行版上安装 r 如果你想复制、移动或与远程存储位置同步数据,你可以简单地创建一个任务来完成。只需确保设置正确,你可以模拟执行或者直接运行任务。 -你可以在 ”**Jobs**“ 页面找到所有正在运行的任务,如果需要,你可以取消/停止它们。 +你可以在 “Jobs” 页面找到所有正在运行的任务,如果需要,你可以取消/停止它们。 ![][15] -除了上面提到的所有基本功能外,你可以前往 **File->Preferences** 更改 rclone 位置、挂载选项、下载文件夹、带宽设置以及代理。 +除了上面提到的所有基本功能外,你可以前往 “File->Preferences” 更改 rclone 位置、挂载选项、下载文件夹、带宽设置以及代理。 ![][16] @@ -101,9 +99,9 @@ _在使用 Rclone Browser 之前,你需要在你的 Linux 发行版上安装 r ### 总结 -Rclone Browser 对于每一位想要使用 Rclone 强大功能的 Linux 用户来说,绝对是得心应手。 +Rclone Browser 对于每一位想要使用 rclone 强大功能的 Linux 用户来说,绝对是得心应手。 -你是否已经尝试过了呢?你更喜欢通过 GUI 还是终端来使用 Rclone?请在下面的评论中告诉我你的想法! +你是否已经尝试过了呢?你更喜欢通过 GUI 还是终端来使用 rclone?请在下面的评论中告诉我你的想法! -------------------------------------------------------------------------------- @@ -112,7 +110,7 @@ via: https://itsfoss.com/rclone-browser/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 7ff16332451efd69bf6278614d43747ed06f4edd Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 11 Sep 2020 22:35:41 +0800 Subject: [PATCH 0072/1156] PUB @geekpi https://linux.cn/article-12605-1.html --- ...u to Sync Data With Cloud Services in Linux Graphically.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200903 Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically.md (98%) diff --git a/translated/tech/20200903 Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically.md b/published/20200903 Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically.md similarity index 98% rename from translated/tech/20200903 Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically.md rename to published/20200903 Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically.md index 11604ab180..df58ec759d 100644 --- a/translated/tech/20200903 Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically.md +++ b/published/20200903 Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12605-1.html) [#]: subject: (Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically) [#]: via: (https://itsfoss.com/rclone-browser/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From 54dfcfe9feb9df773fb23a40c371a46bc655dc1f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 12 Sep 2020 05:01:36 +0800 Subject: [PATCH 0073/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200911?= =?UTF-8?q?=20Ankur=20Sinha:=20How=20do=20you=20Fedora=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200911 Ankur Sinha- How do you Fedora.md --- ...20200911 Ankur Sinha- How do you Fedora.md | 151 ++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 sources/tech/20200911 Ankur Sinha- How do you Fedora.md diff --git a/sources/tech/20200911 Ankur Sinha- How do you Fedora.md b/sources/tech/20200911 Ankur Sinha- How do you Fedora.md new file mode 100644 index 0000000000..9d965e9840 --- /dev/null +++ b/sources/tech/20200911 Ankur Sinha- How do you Fedora.md @@ -0,0 +1,151 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Ankur Sinha: How do you Fedora?) +[#]: via: (https://fedoramagazine.org/ankur-sinha-how-do-you-fedora/) +[#]: author: (climoiselle https://fedoramagazine.org/author/climoiselle/) + +Ankur Sinha: How do you Fedora? +====== + +![][1] + +We recently interviewed Ankur Sinha on how he uses Fedora. This is part of a [series][2] on the Fedora Magazine. The series profiles Fedora users and how they use Fedora to get things done. Contact us on the [feedback form][3] to express your interest in becoming an interviewee. + +### Who is Ankur Sinha? + +Ankur is a Computational Neuroscientist and has just started his first post-doctoral fellowship at University College London and a FLOSS enthusiast trying to spread the message of FOSS and evidence based science. Ankur started using Linux a decade ago, when he was introduced to Linux in a [LUG][4] doing an install fest during his undergraduate degree. + +Ankur loves reading: + +_“I read a lot and tend to get attached to characters from books quite easily. Holmes, Poirot (I’m a detective fiction fan), Francisco D’Anconia (fan of the book Atlas Shrugged, but not so much Ayn Rand’s philosophy), lots of random characters from books I’d read. I also read lots of Hindi comics as a child—Doga, Super commando Dhruv, Naagraj, and Chacha Chaudhary—loved them all!”._ + +As far as all time favorite movies go, [Swades][5] comes to his mind. His favorite genre is science fiction thrillers (think “The Prestige” and ” Predestination”). When not busy working or engaging people on IRC channels, he enjoys listening to podcasts and classic rock. + +Ankur’s favorite food is his mother’s Chhole Bhature. Otherwise, if he’s away from home, his go-tos are Butter chicken, Butter Naan, and Chilli Chicken from North Indian restaurants. + +### The Fedora Community + +Ankur found about Fedora after a distro hopping phase in 2008, and since then he has been a fedora user. His first memory of the Fedora community is an IRC workshop on packaging fonts that the Fedora India community had organised back in 2008. Talking to and meeting other community members has been one of the most exciting parts of the Fedora community for him. _“I found this great bunch of people to hang out and geek out with! It was so much fun, and extremely educational both in terms of technical knowledge and the social/philosophical side of FOSS and life in general.”_ + +When asked what he would change in the Fedora Project if he could change one thing, he said that he prefers “Smaller tweaks” since _“Smaller tweaks also allow work to be spread out, and that really helps”_. Specifically, he would like to see more discussion on the philosophy and nuances of FOSS in the community. + +_"Perhaps we all know it so well that we take it for granted and focus on the work that needs to be done. It’s so easy to get bogged down in the work, though, that I worry that we forget the bigger picture sometimes. The end for us is to promote FOSS, and everything we do is the means to this end. So, I worry that the means sometimes becomes the end for us — that we focus so much on producing deliverables that we forget why we produce them."_ + +Since he works in academia and science, Ankur would like the Fedora community (and FOSS in general) to get more involved with academic/scientific communities. _“I think we have an excellent platform to enable education and research. NeuroFedora is a start in this direction.”_ + +He wishes that other people knew that the Fedora community are not just OS developers, but a global community, and he’d like folks to just hang out and communicate even if they’re not contributing in the traditional sense of the word. + +Ankur tries to help wherever he can, especially if newbies are involved. Nowadays, he tries to focus more on [NeuroFedora][6] as it fits well for his day-job and there’s so much to do in this Field + Open Science. + +Ankur learnt most of the things from his >10 years of experience in Fedora and FOSS. He had learned theories of software development at undergrad but got to experience practical implementations from his colleagues in the community. He is a firm believer of _“No question is a stupid question”_. He adds that Fedora is perfect because it gets better as you start working with it. + +His piece of advice for anyone thinking of getting involved in Fedora is to just go ahead and start. One doesn’t need to know anything at all. All of it can be learned over time. Secondly, don’t focus on tasks. Yes, that’s a good way of learning, but it is far more important to get to know the people of Fedora! As one meets more people, one learns more about how Fedora works and one has way more fun working and learning!! + +Just like a lot of our community members, Ankur struggles from time constraints. His new challenge is to find more time to work on FOSS and Fedora. During his college years, it was to learn more and more. + +One of the challenges Ankur faces about promoting open source is to explain to non-FOSS people that Windows/Mac aren’t the only OSes present. He thinks that having Fedora shipped with Lenovo systems will give a start for the community. It makes Fedora and FOSS more "official". + +### What Hardware? + +Ankur has three machines and runs Fedora 32 on each of them: + +![Ankur’s Desk][7] + + * Thinkpad E490 laptop + * a custom workstation that university IT set up for research work + * a headless MacPro5,1 + * 2x Microsoft Sculpt Ergonomic keyboard/mouse/numpad + * Netgear wifi extender + * TP-Link TL-PA8033PKIT AV1300 3-Port Gigabit Passthrough Powerline Adapters + * Moto g7 phone with Android 10 + + + +### What Software? + +Fedora 32 workstation, and server on the MacPro. + +– [Workstation][8]/Gnome3 with a few extensions: [caffeine][9], [pomodoro][10], + +  [syncthing][11]. + +– [byobu][12] with [tmux][13]: multiple sessions: default, work, fedora + +– [taskwarrior][14], [vit][15], [timewarrior][16], [gnome-pomodoro][10], [gnome-calendar][17]/[evolution][18] for calendars + +– [neomutt][19] with [msmtp][20] \+ [offlineimap][21] \+ [notmuch][22] for e-mail + +– [vim][23] for *everything* possible – [vimrc link][24] + +– [qutebrowser][25], [weechat][26], [zathura][27], [vimiv][28] + +– syncthing + dropbox + git for syncing/version control + +For research work: + +– [NEST][29] \+ lots of python and [Gnuplot][30] for analysis, LaTeX for writing + +  (stuff from NeuroFedora!) + +– [inkscape][31] \+ [gimp][32] \+ [dia][33] \+ [freemind][34] for figures/mind mapping + +– [jabref][35] for bibliography management + +Other bits: – occasional gamer? + +– [Oad][36] \+ [endless sky][37] \+ [openttd][38]! + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/ankur-sinha-how-do-you-fedora/ + +作者:[climoiselle][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/climoiselle/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/09/hdyf-asinha-816x346.png +[2]: https://fedoramagazine.org/tag/how-do-you-fedora/ +[3]: https://fedoramagazine.org/submit-an-idea-or-tip/ +[4]: https://en.wikipedia.org/wiki/Linux_user_group +[5]: https://www.imdb.com/title/tt0367110/ +[6]: https://docs.fedoraproject.org/en-US/neurofedora/overview/ +[7]: https://fedoramagazine.org/wp-content/uploads/2020/08/WhatsApp-Image-2020-08-28-at-3.27.16-PM-768x1024.jpeg +[8]: https://getfedora.org/en/workstation/ +[9]: https://extensions.gnome.org/extension/517/caffeine/ +[10]: https://github.com/codito/gnome-pomodoro/ +[11]: https://docs.syncthing.net/ +[12]: https://www.byobu.org/ +[13]: https://github.com/tmux/tmux +[14]: https://taskwarrior.org/ +[15]: https://github.com/scottkosty/vit +[16]: https://timewarrior.net/ +[17]: https://wiki.gnome.org/Apps/Calendar +[18]: https://wiki.gnome.org/Apps/Evolution +[19]: https://neomutt.org/ +[20]: https://marlam.de/msmtp/ +[21]: http://www.offlineimap.org/ +[22]: https://notmuchmail.org/ +[23]: https://www.vim.org/ +[24]: https://github.com/sanjayankur31/vimfiles +[25]: https://www.qutebrowser.org/ +[26]: https://weechat.org/ +[27]: https://pwmt.org/projects/zathura/ +[28]: https://karlch.github.io/vimiv-qt/index.html +[29]: https://www.nest-simulator.org/ +[30]: http://gnuplot.info/ +[31]: https://inkscape.org/ +[32]: https://www.gimp.org/ +[33]: http://dia-installer.de/ +[34]: http://freemind.sourceforge.net/wiki/index.php/Main_Page +[35]: http://www.jabref.org/ +[36]: https://play0ad.com/ +[37]: http://endless-sky.github.io/ +[38]: https://www.openttd.org/ From e448f8f2c1c4b78d4a8aefae8d60a55267607a0d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 12 Sep 2020 05:02:19 +0800 Subject: [PATCH 0074/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200912?= =?UTF-8?q?=20Shutdown=20Taking=20Too=20Long=3F=20Here=E2=80=99s=20How=20t?= =?UTF-8?q?o=20Investigate=20and=20Fix=20Long=20Shutdown=20Time=20in=20Lin?= =?UTF-8?q?ux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md --- ...ate and Fix Long Shutdown Time in Linux.md | 135 ++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 sources/tech/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md diff --git a/sources/tech/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md b/sources/tech/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md new file mode 100644 index 0000000000..c3929cf387 --- /dev/null +++ b/sources/tech/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md @@ -0,0 +1,135 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Shutdown Taking Too Long? Here’s How to Investigate and Fix Long Shutdown Time in Linux) +[#]: via: (https://itsfoss.com/long-shutdown-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Shutdown Taking Too Long? Here’s How to Investigate and Fix Long Shutdown Time in Linux +====== + +_**Your Linux system is taking too long to shut down? Here are the steps you can take to find out what is causing the delayed shutdown and fix the issue.**_ + +I hope you are a tad bit familiar with the [sigterm and sigkill][1] concept. + +When you [shut down your Linux system][2], it sends the sigterm and politely asks the running processes to stop. Some processes misbehave and they ignore the sigterm and keep on running. + +This could cause a delay to the shutdown process as your system will wait for the running processes to stop for a predefined time period. After this time period, it sends the kill signal to force stop all the remaining running processes and shuts down the system. + +In fact, in some cases, you would see a message like ‘a stop job is running’ on the black screen. + +If your system is taking too long in shutting down, you can do the following: + + * Check which process/service is taking too long and if you can remove or reconfigure it to behave properly. + * Change the default waiting period before your system force stops the running processes. [Quick and dirty fix] + + + +I am using Ubuntu here which uses systemd. The commands and steps here are valid for any Linux distribution that uses systemd (most of them do). + +![][3] + +### Check which processes are causing long shutdown in Linux + +If you want to figure out what’s wrong, you should check what happened at the last shutdown. Use this command to get the power of ‘I know what you did last session’ (pun intended): + +``` +journalctl -rb -1 +``` + +The [journalctl command][4] allows you to read system logs. With options ‘-b -1’ you filter the logs for the last boot session. With option ‘-r’, the logs are shown in reverse chronological order. + +In other words, the ‘journalctl -rb -1’ command will show the system logs just before your Linux system was shutdown the last time. This is what you need to analyze the long shutdown problem in Linux. + +No journal logs? Here’s what you should do + +If there are no journal logs, please make sure that your distribution uses systemd. + +Even on some Linux distributions with systemd, the journal logs are not activated by default. + +Make sure that /var/log/journal exists. If it doesn’t, create it: + +``` +sudo mkdir /var/log/journal +``` + +You should also check the content of /etc/systemd/journald.conf file and make sure that the value of Storage is set to either auto or persistent. + +Do you find something suspicious in the logs? Is there a process/service refusing to stop? If yes, investigate if you could remove it without side effects or if you could reconfigure it. Don’t go blindly removing stuff here, please. You should have knowledge of the process. + +### Speed up shutdown in Linux by reducing default stop timeout [Quick fix] + +The default wait period for the shut down is usually set at 90 seconds. Your system tries to force stop the services after this time period. + +If you want your Linux system to shut down quickly, you can change this waiting period. + +You’ll find all the systemd settings in the config file located at /etc/systemd/system.conf. This file should be filled with lots of line starting with #. They represent the default values of the entries in the file. + +Before you do anything, it will be a good idea to make a copy of the original file. + +``` +sudo cp /etc/systemd/system.conf /etc/systemd/system.conf.orig +``` + +Look for DefaultTimeoutStopSec here. It should probably be set to 90 sec. + +``` +#DefaultTimeoutStopSec=90s +``` + +You have to change this value to something more convenient like 5 or 10 seconds. + +``` +DefaultTimeoutStopSec=5s +``` + +If you don’t know how to edit the config file in terminal, use this command to open the file for editing in your system’s default text editor (like Gedit): + +``` +sudo xdg-open /etc/systemd/system.conf +``` + +![Change Shutdown Time Settings Ubuntu][5] + +Don’t forget to **remove the # before DefaultTimeoutStopSec**. Save the file and reboot your system. + +This should help you reduce the shutdown delay for your Linux system. + +Watchdog issue! + +Linux has a module named watchdog that is used for monitoring whether certain services are running or not. It could be configured to automatically reboot systems if they are hanged due to software error. + +It is unusual to use Watchdog on desktop systems because you can manually shutdown or reboot the system. It is often used on remote servers. + +First check watchdog is running: + +``` +ps -af | grep watch* +``` + +If watchdog is running on your system, you can change the ShutdownWatchdogSec value from 10 minutes to something lower in the systemd config file /etc/systemd/system.conf. + +**Were you able to fix the lengthy shutdown?** + +I hope this tutorial helped you in investigating and fixing the long shutdown issue on your system. Do let me know in the comments if you managed to fix it. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/long-shutdown-linux/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://linuxhandbook.com/sigterm-vs-sigkill/ +[2]: https://itsfoss.com/schedule-shutdown-ubuntu/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/troubleshoot-long-shutdown-linux.gif?resize=800%2C450&ssl=1 +[4]: https://linuxhandbook.com/journalctl-command/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/change-shutdown-time-settings-ubuntu.png?resize=797%2C322&ssl=1 From 350bbc41ed5ac3cd567282f595346b2a0c95f6b8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 12 Sep 2020 05:02:48 +0800 Subject: [PATCH 0075/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200911?= =?UTF-8?q?=20How=20open=20source=20legal=20teams=20can=20get=20to=20yes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200911 How open source legal teams can get to yes.md --- ... open source legal teams can get to yes.md | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 sources/tech/20200911 How open source legal teams can get to yes.md diff --git a/sources/tech/20200911 How open source legal teams can get to yes.md b/sources/tech/20200911 How open source legal teams can get to yes.md new file mode 100644 index 0000000000..3470ea0806 --- /dev/null +++ b/sources/tech/20200911 How open source legal teams can get to yes.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How open source legal teams can get to yes) +[#]: via: (https://opensource.com/article/20/9/advice-open-source-lawyer) +[#]: author: (Jeffrey Robert Kaufman https://opensource.com/users/jkaufman) + +How open source legal teams can get to yes +====== +Open source law has unusual requirements for success. Learn ways lawyers +can help their organizations find a path to open. +![whiteboard collaboration with the team][1] + +As I shared in the [first part][2] of this two-part series, I am an open source lawyer for Red Hat. One important part of my job is to provide information to other companies, including their in-house counsel, about how Red Hat builds enterprise-class products with a completely open source development model and to answer their questions about open source licensing in general. After hearing about Red Hat's success, these conversations often turn to discussions about how their organization can evolve to be more open source-aware and capable, and lawyers at these meetings regularly ask how they can modify their practices to be more skilled in providing open source counsel to their employees. In these two articles, I'll share what I normally tell in-house counsel on these topics. + +### Always find a path to open + +My employer, Red Hat, is unique in its use of open source software in that our development model begins in the open source community with thousands of contributors and results in finished products that are tried, tested, and trusted. More specifically, through our unique development model, we start with community-created open source software and build upon each project to harden security, fix bugs, patch vulnerabilities, and add new features. We then contribute these improvements back to each project, so the entire open source community can benefit. The utilities to this approach are significant, including: + + 1. Leveraging innovation from others outside your organization by collaborating outside your internal teams + 2. Avoiding the cost and inefficiency of developing and maintaining an open source solution by yourself when there are existing or potential communities working on the same problem with which you could collaborate + 3. Through productive collaboration with partners and upstream project communities, avoiding the costly consequences of maintaining a downstream fork of the main project + 1. Some companies find it tempting to create non-public forks of upstream code as a quick way to address a specific use case or because they are not inclined to collaborate in a community. However, the long-term maintenance burdens of such forks can be prohibitive because of increased development costs, loss of interoperability, and other reasons. By contrast, concentrating development in the original upstream community enables sharing development costs among all participants. + + + +With few exceptions (such as Red Hat), most organizations that may use open source software have a proprietary licensing model (or the equivalent concept for software-as-a-service companies) and license proprietary software as part of their business. Such organizations feel that they have software components that provide some competitive advantage and do not wish to see those become available to others under open source terms. That is understandable. I would, however, encourage any open source lawyers counseling such companies to urge their clients towards an open source development model, especially for any software bits that are non-differentiating and common. + +For example, if your company develops applications for mobile phones and you need a software module to read and write PNG image files, it would be much less expensive to use one of the popular open source PNG software modules available on GitHub. Encoding and decoding PNG images is likely a non-differentiating element to your business, so why spend precious engineering time to write your own version? Furthermore, writing your own module for this function may also lead to compatibility issues with other software that uses a commonly used open source module. Why? Although your module and the open source module may have been written to encode and decode to the published PNG specifications, oftentimes, there may be different interpretations of the specifications or errors in implementation. Everyone using the same module for this function ensures compatibility for most users and lowers the cost of development and maintenance. + +It must also be appreciated that certain software may be required to remain proprietary and not subject to open source terms. Depending on the software architecture of your system and the open source software licenses in use, software bits that are intended to remain proprietary may become subject to open source license terms unless certain actions are taken (beyond the scope of this article). This is where some counseling to clients about license choice and architecture will become useful. + +### Develop scalable solutions + +For organizations that primarily license proprietary software grow and increase their use of open source software, review and approval requirements may grow (even exponentially in my experience). As such, such an organization may find itself in a difficult situation due to resource constraints. Scalable solutions that must be put into place are described below. + +#### Empower and delegate to others + +Lawyers cannot and should not be gatekeepers. It is inefficient and will most certainly cause bottlenecks in development and release times, producing frustration and lost revenue. Instead, explore delegating authority to capable individuals in product or project management and engineering. This allows an organization to scale efficiently and effectively. Educating your clients (see the next section) is vitally important for this to succeed. + +One approach I have taken is to provide open source training to entire engineering organizations so that they can make basic licensing and architecture choices, while providing more specialized training to software leads to enable them to provide more complex guidance and decisions. Consider providing clear limits on authority at each level, including what types of issues and decisions must be escalated to you as their open source legal attorney. The specific levels of delegation for your organization will be a function of your team's experience with open source and sensitivities to certain open source concerns. + +#### Educate clients + +I have found that training is one of the most effective tools to migrate your organization to be more open source-aware. Training your software engineers and product managers is crucially important. Let me elaborate. + +Although your software engineers are on the frontlines and may be quite knowledgeable about open source issues and licensing in general, it is still important to train them on your organization's particular requirements. For example, your company may permit only permissive open source licenses to be used and may have certain requirements for its copyright notices and source availability. To avoid problems in development that must be corrected later (a costly and time-consuming exercise), it is best to train engineers to minimize the likelihood of improper behavior, especially at the beginning of any development process (see the next section). + +Product managers must also be trained. In many companies, a product manager is responsible for the classic four P's of marketing—Product, Price, Position, and Promotion—and is accountable for the full lifecycle of a product from cradle to death. All these aspects of a product manager's job may be impacted by the use of open source software. Understanding the requirements when using open source software is useful to them for the same reasons mentioned above. In addition and more importantly, product managers' significant influence in an organization means they are often able to effectuate any required change to process and policy. Product managers may become one of your strongest advocates for instituting process changes towards "open". + +#### Early detection + +It is very difficult and costly to resolve open source licensing issues near the end of the development process. As software approaches its release date, the architecture and the open source software modules have already been chosen. If an issue is detected, such as a copyleft software embedded in a proprietary software module (when that proprietary module is intended to not be subject to open source terms), modifying the architecture or modules at that development phase could be very difficult and expensive. Instead, work on developing processes that analyze architecture and choice of open source modules early in the process so that less costly and more effective course corrections may be made. + +### Open source law's rewards + +Practicing open source law is a rewarding profession due to the ability to influence an organization towards "open," which has significant benefits. Success depends on your ability to develop solutions for your organization that are workable and scalable as your organization grows and matures. + +Find out what it takes to become an open source lawyer. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/advice-open-source-lawyer + +作者:[Jeffrey Robert Kaufman][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://opensource.com/users/jkaufman +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/whiteboard-collaboration-team.png?itok=0A3WcgxZ (whiteboard collaboration with the team) +[2]: https://opensource.com/article/20/7/transitioning-open-source-part-1 From 89e866ae631c8637a90db738971f57745ba626e8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 12 Sep 2020 05:03:00 +0800 Subject: [PATCH 0076/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200911?= =?UTF-8?q?=20Why=20the=20future=20of=20IoT=20depends=20on=20open=20source?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200911 Why the future of IoT depends on open source.md --- ...he future of IoT depends on open source.md | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 sources/tech/20200911 Why the future of IoT depends on open source.md diff --git a/sources/tech/20200911 Why the future of IoT depends on open source.md b/sources/tech/20200911 Why the future of IoT depends on open source.md new file mode 100644 index 0000000000..4bac5d8013 --- /dev/null +++ b/sources/tech/20200911 Why the future of IoT depends on open source.md @@ -0,0 +1,80 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why the future of IoT depends on open source) +[#]: via: (https://opensource.com/article/20/9/open-source-ai-iot) +[#]: author: (Pin Xue https://opensource.com/users/pinxue) + +Why the future of IoT depends on open source +====== +We're quickly moving from the Internet of Things (IoT) to the Artificial +Intelligence of Things (AIoT). +![Brain on a computer screen][1] + +Most people are familiar with the [Internet of Things (IoT)][2], which refers to smart objects in a connected network, as this diagram shows. + +![IoT diagram][3] + +(PinXue, [CC BY-SA 4.0][4]) + +A "smart" object has a sense of its environment, and it makes decisions (locally or together with peers and a cloud server), then puts those decisions into action. + +To be smart, the object must have a brain to carry intelligence. So far, the way to do this is to embed a computer in the object. For example, you can put a Cortex-M CPU with Bluetooth 5.1 in a chip smaller than 2x2mm and embed it into almost anything. This tiny device is more powerful than my first desktop PC. + +A developer can write software for this tiny computer that uses the device's ability to gather input from all kinds of sensors (e.g., heat, light, moisture, and so on) and share and act on it using the device's screen, speaker, actuators (step motors, servos, and so on), and network. + +### AI + IoT = AIoT + +We often associate IoT with small programmable objects, like a smart lightbulb or door lock. While those are good uses of IoT, IoT is bigger than this. IoT is driving the next stage of our information-centric society. + +Information systems have become a natural part of our everyday lives. You no longer have to sit in front of a computer to surf the internet because a smartphone can bring the whole world into the palm of your hand. Soon, you won't even need a phone—the popularization of smartwatches and other wearables is proving that. The convenience of these information systems encourages us to collect and use more data from everything. For instance, why couldn't a red light tell your car it will turn +green in 5 seconds, so it is not a smart move to release the brake +just yet. + +![Relationships between computers, people, and things][5] + +(PinXue, [CC BY-SA 4.0][4]) + +In a few years, humans won't be the major data producers and consumers. "Things" will be. + +The abundance of data these things will create means we can no longer expect people to be able to analyze all the patterns and contents or even to write parsers to process the data. Based on the sheer amount of data, we need artificial intelligence (AI) to deal with it. AI will be applied to the entire data-processing process, and AI can transmit results instead of raw data. This will also reduce network traffic. Ideally, an AI will be able to drive smart objects to make decisions based on analyzed data on the spot. + +Eventually, the goal is for smart objects to be able to live on their own, as you can see in _[This one owns itself][6]_, a story about a drone earning money to pay its recharging bill by making deliveries for a coffee company. The focus of this story is about the smart contract powered by blockchain, but in my opinion, it's achievable with the artificial intelligence of things (AIoT), the most fundamental element in smart devices. + +### Open source AIoT operating systems + +In the past, smart objects were programmed on bare metal. Now the scenario is a lot more complex. When creating a real-life AIoT system, there are too many details to account for on your own—all of the types of Systems on a Chip (SoC), sensors, actuators, network protocols, AI modeling, performance optimization, reliability, power management, firmware over the air (FOTA), security, and more. However, using an AIoT operating system enables all of this hard work to be accumulated and reused instead of starting over for each hardware or project. + +AIoT is an open world, by its nature. The diversity of smart objects means no one can dominate the entire market, and we must work together to make things talk to each other. There are many levels of openness, such as file formats, protocol stacks, and APIs. These are all dependent upon the openness of the interface and the implementation of the source code. + +Open source makes it possible to customize, reuse, and improve our code. This flexibility is important. The original author of an AIoT operating system cannot be an expert on everything. Other developers have different types of expertise they can use to build upon an open foundation. + +If an operating system is well-designed and has an active community, it can provide reusable drivers, protocols, libraries, frameworks, middleware, and all manner of tools. All these components can speed product development dramatically. Without an open source platform, people have to build those parts again and again. + +The [RT-Thread project][7] has been working toward this goal. RT-Thread is an open source IoT OS that started in 2006 and currently powers 600 million devices. Its IoTOS project is part of the general AIoT blueprint. It also comes with more than 200 open source packages and some commercial packages—and the number of each keeps increasing—that make it easier to develop for the AIoT. + +If you're interested in building the IoT and working toward a better, smarter, and open future of AIoT, visit the [RT-Thread website][8] and see how you can lend a hand. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/open-source-ai-iot + +作者:[Pin Xue][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://opensource.com/users/pinxue +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/brain_computer_solve_fix_tool.png?itok=okq8joti (Brain on a computer screen) +[2]: https://opensource.com/resources/internet-of-things +[3]: https://opensource.com/sites/default/files/uploads/iot-diagram.png (IoT diagram) +[4]: https://creativecommons.org/licenses/by-sa/4.0/ +[5]: https://opensource.com/sites/default/files/uploads/computer-people-things.png (Relationships between computers, people, and things) +[6]: https://medium.com/@creole/6-this-one-owns-itself-9f6a3aa4382d +[7]: https://github.com/RT-Thread/rt-thread +[8]: https://www.rt-thread.io/ From a5e7869f99898a403b6376eff38f869689640a57 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 12 Sep 2020 05:03:32 +0800 Subject: [PATCH 0077/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[talk]:=2020200911?= =?UTF-8?q?=20Lenovo=20introduces=20four=20new=20HCI=20solutions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200911 Lenovo introduces four new HCI solutions.md --- ...enovo introduces four new HCI solutions.md | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 sources/talk/20200911 Lenovo introduces four new HCI solutions.md diff --git a/sources/talk/20200911 Lenovo introduces four new HCI solutions.md b/sources/talk/20200911 Lenovo introduces four new HCI solutions.md new file mode 100644 index 0000000000..1fb45cd7ae --- /dev/null +++ b/sources/talk/20200911 Lenovo introduces four new HCI solutions.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Lenovo introduces four new HCI solutions) +[#]: via: (https://www.networkworld.com/article/3573787/lenovo-introduces-four-new-hci-solutions.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Lenovo introduces four new HCI solutions +====== +Hyperconverged infrastructure from Lenovo targets workloads including VDI, SAP HANA, Microsoft Azure, and Kubernetes. +Martyn Williams + +Lenovo Data Center Group on Thursday introduced four new [hyperconverged infrastructure][1] (HCI) products aimed at a variety of workloads, including virtual desktop infrastructure (VDI), SAP HANA, Microsoft Azure, and Kubernetes. + +HCI products have grown in popularity because they are easily deployed and can get a variety of workloads up and running quickly. HCI is available either in hardware/appliance form or as software. HCI hardware vendors are the usual suspects – HP Enterprise, Dell, Lenovo – while the software vendors include Nutanix and VMware. + +Lenovo is focused on ready-to-deploy HCI solutions from both software firms. It boasts that its hardware is easy to deploy and manage with simple updates, automatic scalability and a consumption-based use model. + +**READ MORE:** [Making the right hyperconvergence choice: HCI hardware or software?][2] + +"This new normal is forcing many companies of different sizes and scale to think different. They are looking to figure out, 'how do I drive more resiliency to be able to be more efficient? How do I drive more agility to pivot based on my end customer needs and the way they are going to consume my services or my resources?'" said Kamran Amini, vice president and general manager of server, storage and software defined infrastructure, Lenovo Data Center Group, on a conference call briefing with reporters. + +Here are the four products Lenovo announced. + +### ThinkAgile HX + +ThinkAgile HX is a new device powered by AMD EPYC processors and Nutanix software targeted at VDI and virtualization consolidation. With two CPUs and two GPUs in a 1U chassis, Lenovo customers can run their virtual desktop workloads with consistent performance with up to 50% fewer servers. + +ThinkAgile HX is preloaded, factory-integrated and configured with Nutanix Enterprise Cloud software. Lenovo's ThinkAgile Network Orchestrator software is integrated with Nutanix Prism to reduce human error and downtime by automating virtualization configuration changes. + +Availability is planned in late November as an appliance or a certified node. + +### ThinkAgile MX And Microsoft Azure Stack + +Lenovo and Microsoft have partnered to create the Lenovo ThinkAgile MX Azure Stack HCI Edge and Data Center line. [Azure Stack][3] is Microsoft's on-premises cloud software that allows an enterprise to replicate an Azure environment in their own data center and move workloads back and forth between on-prem and Azure. + +The new ThinkAgile MX series of appliances provides a one-stop-shop for the Azure Stack HCI to give businesses an easy way to deploy, manage and scale Azure services from edge to core to cloud. The ThinkAgile MX is designed to enable customers to rapidly deploy a hybrid cloud infrastructure. + +ThinkAgile MX will offer consumption-based, pay-as-you-go pricing of Azue Stack HCI and Azure Stack Hub. Lenovo did not say when it would be available. + +### ThinkAgile VX and VMware + +VMware and Lenovo have partnered to create a new series, the ThinkAgile VX HCI, which runs VMware's vSAN and ESXi and is designed specifically for SAP HANA databases. Lenovo said its new ThinkAgile VX 4S solution offers double the SAP HANA database memory and has direct connect NVMe to accelerate response times, speed business insights and improve total cost of ownership. + +Lenovo ThinkAgile VX HCI are S/4HANA certified nodes that enable customers to modernize their infrastructure and improve performance of vSAN environments via the integration of Lenovo XClarity Management software and the new vSphere Lifecycle Manager (vLCM) tools. + +The ThinkAgile VX will be generally available later in September. + +### Diamanti SR360 + +Lenovo has also partnered with Diamanti, maker of Kubernetes management software, to create the Diamanti SR630 solution based on a ThinkSystem server. Diamanti specializes in enabling fast Kubernetes deployments and allowing organizations to run containerized applications across hybrid cloud environments. + +The SR630 is a purpose-built application platform that combines Diamanti's Spektra Kubernetes platform with acceleration cards and Lenovo servers. The Diamanti SR630 enables customers to rapidly deploy a complete container and Kubernetes solution through plug-and-play networking and persistent storage. + +The Diamanti SR630 is available now. + +Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3573787/lenovo-introduces-four-new-hci-solutions.html + +作者:[Andy Patrizio][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://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3207567/what-is-hyperconvergence.html +[2]: https://www.networkworld.com/article/3318683/making-the-right-hyperconvergence-choice-hci-hardware-or-software.html +[3]: https://www.networkworld.com/article/3385078/microsoft-introduces-azure-stack-for-hci.html +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world From 7f0f0ebdb7baff9429bffed67b3bf405278f29f0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 12 Sep 2020 11:15:06 +0800 Subject: [PATCH 0078/1156] Rename sources/tech/20200911 Ankur Sinha- How do you Fedora.md to sources/talk/20200911 Ankur Sinha- How do you Fedora.md --- sources/{tech => talk}/20200911 Ankur Sinha- How do you Fedora.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200911 Ankur Sinha- How do you Fedora.md (100%) diff --git a/sources/tech/20200911 Ankur Sinha- How do you Fedora.md b/sources/talk/20200911 Ankur Sinha- How do you Fedora.md similarity index 100% rename from sources/tech/20200911 Ankur Sinha- How do you Fedora.md rename to sources/talk/20200911 Ankur Sinha- How do you Fedora.md From eb36bf2910a2f5d3df3e3087fa3e3724f06f6928 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 12 Sep 2020 11:55:10 +0800 Subject: [PATCH 0079/1156] PRF @geekpi --- ...sole using Python and Jupyter Notebooks.md | 41 ++++++++----------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/translated/tech/20200904 Build a remote management console using Python and Jupyter Notebooks.md b/translated/tech/20200904 Build a remote management console using Python and Jupyter Notebooks.md index 5126bb57ff..c048dbfa24 100644 --- a/translated/tech/20200904 Build a remote management console using Python and Jupyter Notebooks.md +++ b/translated/tech/20200904 Build a remote management console using Python and Jupyter Notebooks.md @@ -1,28 +1,30 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Build a remote management console using Python and Jupyter Notebooks) [#]: via: (https://opensource.com/article/20/9/remote-management-jupyter) [#]: author: (Moshe Zadka https://opensource.com/users/moshez) -使用 Python 和 Jupyter Notebooks 构建一个远程管理控制台 +使用 Jupyter Notebooks 构建一个远程管理控制台 ====== -把 Jupyter 变成一个远程管理控制台。 -![Computer laptop in space][1] -SSH 是一个强大的远程管理工具,但它缺乏一些细节。编写一个成熟的远程管理控制台听起来好像是一件很费劲的事情。当然,开源社区中肯定有人已经写了一些东西。 +> 把 Jupyter 变成一个远程管理控制台。 -他们已经写了,它的名字是 [Jupyter][2]。你可能会认为 Jupyter 是那些数据科学家用来分析一周内的广告点击趋势之类的工具。这并没有错,他们确实是这样做的,而且它是一个很好的工具。但这只是它的表面。 +![](https://img.linux.net.cn/data/attachment/album/202009/12/115114jct1g15e9ucsr6ua.jpg) + +SSH 是一个强大的远程管理工具,但有些细节还不够好。编写一个成熟的远程管理控制台听起来好像是一件很费劲的事情。当然,开源社区中肯定有人已经写了一些东西吧? + +是的,他们已经写出来了,它的名字是 [Jupyter][2]。你可能会认为 Jupyter 是那些数据科学家用来分析一周内的广告点击趋势之类的工具。这并没有错,它确实是的,而且它是一个很好的工具。但这仅仅刻画是它的表面。 ### 关于 SSH 端口转发 -有时,你可以通过 22 端口进入一台服务器。没有理由认为你可以连接到任何其他端口。也许你是通过另一个有更多访问权限的”堡垒机“,或者有主机或者限制端口的网络防火墙访问 SSH。当然,限制访问的 IP 范围是有充分理由的。SSH 是远程管理的安全协议,但允许任何人连接到任何端口是相当不必要的。 +有时,你可以通过 22 端口进入一台服务器。一般你也连接不到其他端口。也许你是通过另一个有更多访问权限的“堡垒机”,或者限制主机或端口的网络防火墙访问 SSH。当然,限制访问的 IP 范围是有充分理由的。SSH 是远程管理的安全协议,但允许任何人连接到任何端口是相当不必要的。 -这里有一个替代方案:运行一个简单的 SSH 端口转发命令,将本地端口转发到一个_远程本地_连接上。当你运行像 `-L 8111:127.0.0.1:8888` 这样的 SSH 端口转发命令时,你是在告诉 SSH 将你的_本地_端口 `8111` 转发到_远程_主机 `127.0.0.1:8888`。远程主机认为 `127.0.0.1` 就是它本身。 +这里有一个替代方案:运行一个简单的 SSH 端口转发命令,将本地端口转发到一个“远程”本地连接上。当你运行像 `-L 8111:127.0.0.1:8888` 这样的 SSH 端口转发命令时,你是在告诉 SSH 将你的*本地*端口 `8111` 转发到它认为的“远程”主机 `127.0.0.1:8888`。远程主机认为 `127.0.0.1` 就是它本身。 -就像在_芝麻街_一样,“这里”(here)是一个微妙的词。 +就像在《芝麻街》节目一样,“这里”是一个微妙的词。 地址 `127.0.0.1` 就是你告诉网络的“这里”。 @@ -30,7 +32,6 @@ SSH 是一个强大的远程管理工具,但它缺乏一些细节。编写一 这可能听起来很混乱,但运行比解释它更简单。 - ``` $ ssh -L 8111:127.0.0.1:8888 moshez@172.17.0.3 Linux 6ad096502e48 5.4.0-40-generic #44-Ubuntu SMP Tue Jun 23 00:01:04 UTC 2020 x86_64 @@ -41,13 +42,13 @@ individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. -Last login: Wed Aug  5 22:03:25 2020 from 172.17.0.1 +Last login: Wed Aug 5 22:03:25 2020 from 172.17.0.1 $ jupyter/bin/jupyter lab --ip=127.0.0.1 [I 22:04:29.771 LabApp] JupyterLab application directory is /home/moshez/jupyter/share/jupyter/lab [I 22:04:29.773 LabApp] Serving notebooks from local directory: /home/moshez [I 22:04:29.773 LabApp] Jupyter Notebook 6.1.1 is running at: -[I 22:04:29.773 LabApp] -<MORE STUFF SNIPPED> +[I 22:04:29.773 LabApp] http://127.0.0.1:8888/?token=df91012a36dd26a10b4724d618b2e78cb99013b36bb6a0d1 +<删节> ``` 端口转发 `8111` 到 `127.0.0.1`,并在远程主机上启动 Jupyter,它在 `127.0.0.1:8888` 上监听。 @@ -56,32 +57,22 @@ $ jupyter/bin/jupyter lab --ip=127.0.0.1 ![Jupyter remote management console][3] -(Moshe Zadka, [CC BY-SA 4.0][4]) - 这就是你的远程管理控制台。如你所见,底部有一个“终端”图标。点击它可以启动一个终端。 ![Terminal in Jupyter remote console][5] -(Moshe Zadka, [CC BY-SA 4.0][4]) - 你可以运行一条命令。创建一个文件会在旁边的文件浏览器中显示出来。你可以点击该文件,在本地的编辑器中打开它。 ![Opening a file][6] -(Moshe Zadka, [CC BY-SA 4.0][4]) - 你还可以下载、重命名或删除文件: ![File options in Jupyter remote console][7] -(Moshe Zadka, [CC BY-SA 4.0][4]) - -点击**上箭头**就可以上传文件了。为什么不上传上面的截图呢? +点击**上箭头**就可以上传文件了。那就上传上面的截图吧。 ![Uploading a screenshot][8] -(Moshe Zadka, [CC BY-SA 4.0][4]) - 最后说个小功能,Jupyter 可以让你直接通过双击远程图像查看。 哦,对了,如果你想用 Python 做系统自动化,还可以用 Jupyter 打开笔记本。 @@ -95,7 +86,7 @@ via: https://opensource.com/article/20/9/remote-management-jupyter 作者:[Moshe Zadka][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 0b07844cc6f9dfeff21d4a882a40dd537d37ab08 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 12 Sep 2020 11:55:47 +0800 Subject: [PATCH 0080/1156] PUB @geekpi https://linux.cn/article-12606-1.html --- ...e management console using Python and Jupyter Notebooks.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200904 Build a remote management console using Python and Jupyter Notebooks.md (98%) diff --git a/translated/tech/20200904 Build a remote management console using Python and Jupyter Notebooks.md b/published/20200904 Build a remote management console using Python and Jupyter Notebooks.md similarity index 98% rename from translated/tech/20200904 Build a remote management console using Python and Jupyter Notebooks.md rename to published/20200904 Build a remote management console using Python and Jupyter Notebooks.md index c048dbfa24..8134eb911a 100644 --- a/translated/tech/20200904 Build a remote management console using Python and Jupyter Notebooks.md +++ b/published/20200904 Build a remote management console using Python and Jupyter Notebooks.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12606-1.html) [#]: subject: (Build a remote management console using Python and Jupyter Notebooks) [#]: via: (https://opensource.com/article/20/9/remote-management-jupyter) [#]: author: (Moshe Zadka https://opensource.com/users/moshez) From ba71ef8945e065a25bffbc329d13e73750506158 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 12 Sep 2020 12:12:58 +0800 Subject: [PATCH 0081/1156] Rename sources/tech/20200911 How open source legal teams can get to yes.md to sources/talk/20200911 How open source legal teams can get to yes.md --- .../20200911 How open source legal teams can get to yes.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200911 How open source legal teams can get to yes.md (100%) diff --git a/sources/tech/20200911 How open source legal teams can get to yes.md b/sources/talk/20200911 How open source legal teams can get to yes.md similarity index 100% rename from sources/tech/20200911 How open source legal teams can get to yes.md rename to sources/talk/20200911 How open source legal teams can get to yes.md From 518eb419e4feeea2f3d3c28f40fc787fd2e9fc1b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 12 Sep 2020 12:41:10 +0800 Subject: [PATCH 0082/1156] Rename sources/tech/20200911 Why the future of IoT depends on open source.md to sources/talk/20200911 Why the future of IoT depends on open source.md --- .../20200911 Why the future of IoT depends on open source.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200911 Why the future of IoT depends on open source.md (100%) diff --git a/sources/tech/20200911 Why the future of IoT depends on open source.md b/sources/talk/20200911 Why the future of IoT depends on open source.md similarity index 100% rename from sources/tech/20200911 Why the future of IoT depends on open source.md rename to sources/talk/20200911 Why the future of IoT depends on open source.md From 355d19df29035bf33121b3c26b16805db9930c65 Mon Sep 17 00:00:00 2001 From: SilentDawn Date: Sat, 12 Sep 2020 15:52:25 +0800 Subject: [PATCH 0083/1156] Update 20200831 Military looks to ultraviolet networks for secure battlefield communication.md --- ...ultraviolet networks for secure battlefield communication.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20200831 Military looks to ultraviolet networks for secure battlefield communication.md b/sources/talk/20200831 Military looks to ultraviolet networks for secure battlefield communication.md index 64a8645654..693b3eb4d1 100644 --- a/sources/talk/20200831 Military looks to ultraviolet networks for secure battlefield communication.md +++ b/sources/talk/20200831 Military looks to ultraviolet networks for secure battlefield communication.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (silentdawn-zz) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f23321f8722bdcebb6f0e833fa39610e90985ed0 Mon Sep 17 00:00:00 2001 From: SilentDawn Date: Sat, 12 Sep 2020 17:41:44 +0800 Subject: [PATCH 0084/1156] Update 20200831 Military looks to ultraviolet networks for secure battlefield communication.md --- ...ks for secure battlefield communication.md | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/sources/talk/20200831 Military looks to ultraviolet networks for secure battlefield communication.md b/sources/talk/20200831 Military looks to ultraviolet networks for secure battlefield communication.md index 693b3eb4d1..0083aee60b 100644 --- a/sources/talk/20200831 Military looks to ultraviolet networks for secure battlefield communication.md +++ b/sources/talk/20200831 Military looks to ultraviolet networks for secure battlefield communication.md @@ -7,42 +7,42 @@ [#]: via: (https://www.networkworld.com/article/3572372/military-looks-to-ultraviolet-networks-for-secure-battlefield-communication.html) [#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) -Military looks to ultraviolet networks for secure battlefield communication +美国军方正探索战场保密通信用紫外网络 ====== -The U.S. Army wants to develop new, more secure communications networks for soldiers in the field using free-space ultra-violet optical transmissions. -Thinkstock +美国军方想以开放空间传输的紫外线为载体,为士兵开发新的更安全的通讯网络。 +智库 -U.S. Army researchers are exploring the use of ultraviolet optical communications in battlefield situations because, under the right circumstances, the technology might support links that are undetectable to the enemy. +美国军方研究者之所以探索战场环境下的紫外光通信的应用,是因为这种技术可能实现敌对方无法侦测的通信。 -One thing the researchers looked at was the effects of attenuation, the natural phenomenon of the signals getting weaker over distance. They wanted to know whether there was a distance range in which the signals were weak enough that adversaries likely couldn’t detect them, but still be strong enough that friendly receivers could. They say they observed that to be the case, but the [research paper about their work][1] doesn’t say what those distances are. +研究者关注的一个方面是衰减效应,信号强度随传播距离的增加而减弱的自然现象。他们想知道是否存在一个合适的距离范围,在该范围内,信号强度足够弱,以至于敌对方几乎无法侦测,但又足够强,使得友方可以侦测并建立通信。他们说他们观察到了这种情况,但关于他们相关工作的 [研究论文][1] 并没有讲这个距离范围究竟是多少。 -According to an army press release, “ultraviolet communication has unique propagation characteristics that not only allow for a novel non-line-of-sight optical link, but also imply that the transmissions may be harder for an adversary to detect.” +一份军方出版物提到,“紫外通信具有独特的传输特性,不但可以神奇的实现非视距连接,而且让敌对方难以侦测。” -The main thrust of the study by the U.S. Army Combat Capabilities Development Command’s [Army Research Laboratory][2] was to develop a framework for future research that could quantify the circumstances under which ultraviolet communications could be both useful to friendly forces and undetectable to hostiles. In the course of that research they gleaned two other important insights: +这个研究由美军作战能力发展司令部 [军队研究实验室][2] 主导,其重点是开发一个基础架构,为未来研究提供可量化环境,在该环境下,己方既可以使用紫外通信,也能够避免敌对方的侦测。研究过程中他们还有另外两个发现: - * The worst case scenario – when the enemy detector is in direct line-of-sight with the transmitter and the friendly receiver is not – isn’t as big a concern as might be feared. - * Steering the signal of the UV transmitter doesn’t seem to be an effective way to mitigate detection of the signal by an adversary. + * 最差情况,即敌对方探测器与己方发射器在视线范围内,但右方接收器不在视线范围内,问题不像想象中严重。 + * 看起来转换紫外线发射器的发射方向不是降低敌对方探测到通信信号可能性的有效方式。 -The researchers plan to analyze four scenarios involving the placement of the UV transmitter, the intended receiver and the enemy detector: +研究者计划分析下面四种场景,场景中涵盖了己方紫外发射器、友方接收器、敌对方探测器相对位置关系: - * The friendly receiver and the adversary detector are both in line-of-sight with the transmitter. - * The friendly receiver is in line-of-sight but the adversary detector is not. (Best case) - * The adversary’s detector is in line-of-sight but the friendly receiver is not. (Worst case) - * Neither the friendly receiver nor adversary detector is in line-of-sight. + * 友方接收器、敌对方探测器都在发射器的视线范围内。 + * 友方接收器在发射器视线范围内,但敌对方探测器不在视线范围内(最佳场景)。 + * 敌对方探测器在发射器的视线范围内,但友方接收器不在视线范围内(最差场景)。 + * 友方接收器、敌对方探测器均不在视线范围内。 -The assumption is that an opponent would try to count photons over time to detect a coherent transmission signal that would indicate that communication was underway. +假定敌对方试图通过时域上的光子计数来发现相干通信信号,进而判定正在进行通信。 -The scientists accept the fact that close-in to the transmitter, the signal is easy to detect, so effective use of the UV transmissions would rely on having a good sense of where the opposing detectors are located. +科学家们承认这么一个事实,即越靠近发射器,信号越容易被侦测。所以紫外通信中发射器的有效使用依赖于对敌对方探测器位置的准确感知。 -“Our work provides a framework enabling the study of the fundamental limits of detectability for an ultraviolet communication system meeting desired communication performance requirements,” said Dr. Robert Drost, one of the researchers. +”我们提供了一个基础框架,使得对紫外通信系统实际可探测性与期望性能间差距的根本限制因素的研究得以进行。“ 研究者之一,Robert Drost 博士如是说。 -“Our research is ensuring that the community has the fundamental understanding of the potential for and limitations of using ultraviolet wavelengths for communications, and I am confident that this understanding will inform the development of future Army networking capabilities.” +“我们的研究确保了团队O紫外波段用于通信的潜力及有限性有了根本上的理解。我坚信这种理解将影响到未来军队网络通信能力的发展。” -Join the Network World communities on [Facebook][3] and [LinkedIn][4] to comment on topics that are top of mind. +欢迎通过 [Facebook][3] 和 [LinkedIn][4] 加入 Network World 社团,点评顶级话题。 -------------------------------------------------------------------------------- @@ -50,7 +50,7 @@ via: https://www.networkworld.com/article/3572372/military-looks-to-ultraviolet- 作者:[Patrick Nelson][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[silentdawn-zz](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 487bbe18150e2eeb0accc25a22ba7b1f25019026 Mon Sep 17 00:00:00 2001 From: SilentDawn Date: Sat, 12 Sep 2020 17:44:49 +0800 Subject: [PATCH 0085/1156] Update 20200831 Military looks to ultraviolet networks for secure battlefield communication.md --- ...violet networks for secure battlefield communication.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sources/talk/20200831 Military looks to ultraviolet networks for secure battlefield communication.md b/sources/talk/20200831 Military looks to ultraviolet networks for secure battlefield communication.md index 0083aee60b..b89671b294 100644 --- a/sources/talk/20200831 Military looks to ultraviolet networks for secure battlefield communication.md +++ b/sources/talk/20200831 Military looks to ultraviolet networks for secure battlefield communication.md @@ -10,18 +10,19 @@ 美国军方正探索战场保密通信用紫外网络 ====== 美国军方想以开放空间传输的紫外线为载体,为士兵开发新的更安全的通讯网络。 + 智库 美国军方研究者之所以探索战场环境下的紫外光通信的应用,是因为这种技术可能实现敌对方无法侦测的通信。 -研究者关注的一个方面是衰减效应,信号强度随传播距离的增加而减弱的自然现象。他们想知道是否存在一个合适的距离范围,在该范围内,信号强度足够弱,以至于敌对方几乎无法侦测,但又足够强,使得友方可以侦测并建立通信。他们说他们观察到了这种情况,但关于他们相关工作的 [研究论文][1] 并没有讲这个距离范围究竟是多少。 +研究者关注的一个方面是衰减效应,即信号强度随传播距离的增加而减弱的自然现象。他们想知道是否存在一个合适的距离范围,在该范围内,信号强度足够弱,以至于敌对方几乎无法侦测,但又足够强,使得友方可以侦测并建立通信。他们说他们观察到了这种情况,但关于他们相关工作的 [研究论文][1] 并没有讲这个距离范围究竟是多少。 -一份军方出版物提到,“紫外通信具有独特的传输特性,不但可以神奇的实现非视距连接,而且让敌对方难以侦测。” +一份军方出版物提到,“紫外通信具有独特的传输特性,不但可以实现非视距连接,而且让敌对方难以侦测。” 这个研究由美军作战能力发展司令部 [军队研究实验室][2] 主导,其重点是开发一个基础架构,为未来研究提供可量化环境,在该环境下,己方既可以使用紫外通信,也能够避免敌对方的侦测。研究过程中他们还有另外两个发现: * 最差情况,即敌对方探测器与己方发射器在视线范围内,但右方接收器不在视线范围内,问题不像想象中严重。 - * 看起来转换紫外线发射器的发射方向不是降低敌对方探测到通信信号可能性的有效方式。 + * 转换紫外线发射器的发射方向不是降低敌对方探测到通信信号可能性的有效方式。 From ca376ce590ff6ad72202291bd636e0310a54f7bf Mon Sep 17 00:00:00 2001 From: SilentDawn Date: Sat, 12 Sep 2020 17:45:29 +0800 Subject: [PATCH 0086/1156] Rename sources/talk/20200831 Military looks to ultraviolet networks for secure battlefield communication.md to translated/talk/20200831 Military looks to ultraviolet networks for secure battlefield communication.md --- ...o ultraviolet networks for secure battlefield communication.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/talk/20200831 Military looks to ultraviolet networks for secure battlefield communication.md (100%) diff --git a/sources/talk/20200831 Military looks to ultraviolet networks for secure battlefield communication.md b/translated/talk/20200831 Military looks to ultraviolet networks for secure battlefield communication.md similarity index 100% rename from sources/talk/20200831 Military looks to ultraviolet networks for secure battlefield communication.md rename to translated/talk/20200831 Military looks to ultraviolet networks for secure battlefield communication.md From e4eb0434e35f32236080c0c6e9667f66748b9f8a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 12 Sep 2020 20:21:00 +0800 Subject: [PATCH 0087/1156] APL --- ...is a Linux Distribution- Why is it Called a ‘Distribution.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md b/sources/tech/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md index 6ed3d9312c..2c93f12792 100644 --- a/sources/tech/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md +++ b/sources/tech/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 6773d475ad5778cebb6e4e722ac36fd4812cbda9 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 12 Sep 2020 22:04:50 +0800 Subject: [PATCH 0088/1156] TSL&PRF @wxy --- ...ution- Why is it Called a ‘Distribution.md | 89 ------------------ ...ution- Why is it Called a ‘Distribution.md | 90 +++++++++++++++++++ 2 files changed, 90 insertions(+), 89 deletions(-) delete mode 100644 sources/tech/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md create mode 100644 translated/tech/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md diff --git a/sources/tech/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md b/sources/tech/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md deleted file mode 100644 index 2c93f12792..0000000000 --- a/sources/tech/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md +++ /dev/null @@ -1,89 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Linux Jargon Buster: What is a Linux Distribution? Why is it Called a ‘Distribution’?) -[#]: via: (https://itsfoss.com/what-is-linux-distribution/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -Linux Jargon Buster: What is a Linux Distribution? Why is it Called a ‘Distribution’? -====== - -In this chapter of the Linux Jargon Buster, let’s discuss something elementary. - -Let’s discuss what is a Linux distribution, why it is called a distribution (or distro) and how is it different from the Linux kernel. You’ll also learn a thing or two about why some people insist of calling Linux as GNU/Linux. - -### What is a Linux distribution? - -A Linux distribution is an operating system composed of the Linux kernel, [GNU tools][1], additional software and a package manager. It may also include display server and [desktop environment][2] to be used as regular desktop operating system. - -The term is Linux distribution (or distro in short form) because an entity like Debian or Ubuntu ‘distributes’ the Linux kernel along with all the necessary software and utilities (like network manager, package manager, desktop environments etc) so that it can be used as an operating system. - -Your distributions also takes the responsibility of providing updates to maintain the kernel and other utilities. - -So, Linux is the kernel whereas the Linux distribution is the operating system. This is the reason why they are also sometime referred as Linux-based operating systems. - -Don’t worry if not all the above makes sense right away. I’ll explain it in a bit more detail. - -### Linux is just a kernel, not an operating system: What does it mean? - -You might have come across that phrase and that’s entirely correct. The kernel is at the core of an operating system and it is close to the actual hardware. You interact with it using the applications and shell. - -![Linux Kernel Structure][3] - -To understand that, I’ll use the same analogy that I had used in my [detailed guide on what is Linux][4]. Think of operating systems as vehicles and kernel as engine. You cannot drive an engine directly. Similarly, you cannot use kernel directly. - -![Operating System Analogy][5] - -A Linux distribution can be seen as a vehicle manufacturer like Toyota or Ford that provides you ready to use cars just like Ubuntu or Fedora distributions provide you a ready to use operating systems based on Linux. - -### What is GNU/Linux? - -Take a look at this picture once again. What [Linus Torvalds][6] created in 1991 is just the innermost circle, i.e. the Linux kernel. - -![Linux Kernel Structure][3] - -To use Linux even in the most primitive form (without even a GUI), you need a shell. Most commonly, it is Bash shell. - -And then, you need to run some commands in the shell to do some work. Can you recall some basic Linux commands? There is cat, cp, mv, grep find, diff, gzip and more. - -Technically, not all of these so called ‘Linux commands’ belong to Linux exclusively. A lot of them originate mainly from the UNIX operating system. - -Even before Linux came into existence, Richard Stallman had created the GNU (recursive acronym for GNU is not Unix) project, the first of the free software project, in 1983. The [GNU project][7] implemented many of the popular Unix utilities like cat, grep, awk, shell (bash) along with developing their own compilers (GCC) and editors (Emacs). - -Back in the 80s UNIX was proprietary and super expensive. This is why Linus Torvalds developed a new kernel that was like UNIX. To interact with the Linux kernel, Torvalds used GNU tools which were available for free under their open source GPL license. - -With the GNU tools, it also behaved like UNIX. This is the reason why Linux is also termed as UNIX-like operating system. - -You cannot imagine Linux without the shell and all those commands. Since Linux integrates deeply with the GNU tools, almost dependent on it, the purists demand that GNU should get its fair share of recognition and this is why they insist on calling it GNU Linux (written as GNU/Linux). - -### Conclusion - -![][8] - -So, what is the correct term? Linux, GNU/Linux, Linux distribution, Linux distro, Linux based operating system or UNIX-like operating system? I say it depends on you and the context. I have provided you enough detail so that you have a better understanding of these related terms. - -I hope you are liking this **Linux Jargon Buster** series and learning new things. Your feedback and suggestions are welcome. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/what-is-linux-distribution/ - -作者:[Abhishek Prakash][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/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://www.gnu.org/manual/blurbs.html -[2]: https://itsfoss.com/what-is-desktop-environment/ -[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/Linux_Kernel_structure.png?resize=800%2C350&ssl=1 -[4]: https://itsfoss.com/what-is-linux/ -[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/operating_system_analogy.png?resize=800%2C350&ssl=1 -[6]: https://itsfoss.com/linus-torvalds-facts/ -[7]: https://www.gnu.org/gnu/thegnuproject.en.html -[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/what-is-linux-distribution.png?resize=800%2C450&ssl=1 diff --git a/translated/tech/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md b/translated/tech/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md new file mode 100644 index 0000000000..07c07cad49 --- /dev/null +++ b/translated/tech/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md @@ -0,0 +1,90 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux Jargon Buster: What is a Linux Distribution? Why is it Called a ‘Distribution’?) +[#]: via: (https://itsfoss.com/what-is-linux-distribution/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Linux 黑话解释:什么是 Linux 发行版?为什么它被称为“发行版”? +====== + +> 在这一章的 Linux 黑话解释中,我们来讨论一些基本的东西。 + +让我们来讨论一下什么是 Linux 发行版,为什么它被称为发行版distribution(或简称 distro),以及,它与 Linux 内核有什么不同。你还会了解到为什么有些人坚称 Linux 为 GNU/Linux。 + +### 什么是 Linux 发行版? + +Linux 发行版是一个由 Linux 内核、[GNU 工具][1]、附加软件和软件包管理器组成的操作系统,它也可能包括[显示服务器][9]和[桌面环境][2],以用作常规的桌面操作系统。 + +这个术语之所以是 “Linux 发行版”,是因为像 Debian、Ubuntu 这样的机构“发行”了 Linux 内核以及所有必要的软件及实用程序(如网络管理器、软件包管理器、桌面环境等),使其可以作为一个操作系统使用。 + +你的发行版还负责提供更新来维护其内核和其他实用程序。 + +所以,“Linux” 是内核,而 “Linux 发行版”是操作系统。这就是为什么它们有时也被称为基于 Linux 的操作系统的原因。 + +如果不是很理解以上所有的内容,不要担心。下面我将详细解释一下。 + +### “Linux 只是一个内核,不是一个操作系统。”这是什么意思? + +你可能看到到过这句话,这说的没错。内核是一个操作系统的核心,它接近于具体硬件。你使用应用程序和 shell 与它交互。 + +![Linux 内核结构][3] + +为了理解这一点,我就用我在《[什么是 Linux 的详细指南][4]》中曾用过的那个比喻。把操作系统看成车辆,把内核看成引擎。你不能直接驱动引擎。同样,你也不能直接使用内核。 + +![操作系统类比][5] + +一个 Linux 发行版可以看作是一个汽车制造商(比如丰田或福特)为你提供的现成的汽车,就像 Ubuntu 或 Fedora 发行版的发行商为你提供的一个基于 Linux 的现成操作系统一样。 + +### 什么是 GNU/Linux? + +让我们再来看看这张图片。1991 年的时候,[Linus Torvalds][6] 创造的只是其中的最内圈,即 Linux 内核。 + +![Linux 内核结构][3] + +要使用 Linux,即使是以最原始的形式,甚至没有 GUI,你也需要一个 shell。最常见的是 Bash shell。 + +然后,你需要在 shell 中运行一些命令来完成一些工作。你能记起一些基本的 Linux 命令吗?比如 `cat`、`cp`、`mv`、`grep`、`find`、`diff`、`gzip` 等等。 + +严格来说,这些所谓的“Linux 命令”并不是只属于 Linux。它们中的很多都来源于 UNIX 操作系统。 + +在 Linux 诞生之前,Richard Stallman 就已经在 1983 年创建了自由软件项目free software project中的第一个项目:GNU(GNU 是“GNU is Not Unix” 的递归缩写)。[GNU 项目][7]实现了许多流行的 Unix 实用程序,如 `cat`、`grep`、`awk`、shell(`bash`),同时还开发了自己的编译器(GCC)和编辑器(Emacs)。 + +在 80 年代,UNIX 是专有软件,而且超级昂贵。这就是为什么 Linus Torvalds 开发了一个类似 UNIX 的新内核的原因。为了与 Linux 内核进行交互,Linus Torvalds 使用了 GNU 工具,这些工具在其 GPL 开源许可证下是免费的。 + +有了这些 GNU 工具,它的行为也像 UNIX 一样。这就是为什么 Linux 也被称为类 UNIX 操作系统的原因。 + +你无法想象没有 shell 和所有这些命令的 Linux。由于 Linux 与 GNU 工具集成得很深,几乎是完全依赖于 GNU 工具,所以纯粹主义者要求 GNU 应该得到应有的认可,这就是为什么他们坚称它为 GNU Linux(写成 GNU/Linux)。 + +### 总结 + +![][8] + +那么,该用哪个术语?Linux、GNU/Linux、Linux 发行版,基于 Linux 的操作系统还是类 UNIX 操作系统?这取决于你的上下文。我已经为你提供了足够的细节,让你对这些相关的术语有更好的理解。 + +我希望你喜欢这个 Linux 黑话解释系列,并能学习到新的东西。欢迎你的反馈和建议。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/what-is-linux-distribution/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.gnu.org/manual/blurbs.html +[2]: https://itsfoss.com/what-is-desktop-environment/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/Linux_Kernel_structure.png?resize=800%2C350&ssl=1 +[4]: https://itsfoss.com/what-is-linux/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/operating_system_analogy.png?resize=800%2C350&ssl=1 +[6]: https://itsfoss.com/linus-torvalds-facts/ +[7]: https://www.gnu.org/gnu/thegnuproject.en.html +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/what-is-linux-distribution.png?resize=800%2C450&ssl=1 +[9]: https://linux.cn/article-12589-1.html \ No newline at end of file From a76ff505df07d829ca3105089fbb665dde4e680e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 12 Sep 2020 22:15:43 +0800 Subject: [PATCH 0089/1156] PUB @wxy https://linux.cn/article-12609-1.html --- ...inux Distribution- Why is it Called a ‘Distribution.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename {translated/tech => published}/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md (98%) diff --git a/translated/tech/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md b/published/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md similarity index 98% rename from translated/tech/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md rename to published/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md index 07c07cad49..88dcc5cdeb 100644 --- a/translated/tech/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md +++ b/published/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12609-1.html) [#]: subject: (Linux Jargon Buster: What is a Linux Distribution? Why is it Called a ‘Distribution’?) [#]: via: (https://itsfoss.com/what-is-linux-distribution/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) @@ -12,6 +12,8 @@ Linux 黑话解释:什么是 Linux 发行版?为什么它被称为“发行 > 在这一章的 Linux 黑话解释中,我们来讨论一些基本的东西。 +![][8] + 让我们来讨论一下什么是 Linux 发行版,为什么它被称为发行版distribution(或简称 distro),以及,它与 Linux 内核有什么不同。你还会了解到为什么有些人坚称 Linux 为 GNU/Linux。 ### 什么是 Linux 发行版? @@ -60,8 +62,6 @@ Linux 发行版是一个由 Linux 内核、[GNU 工具][1]、附加软件和软 ### 总结 -![][8] - 那么,该用哪个术语?Linux、GNU/Linux、Linux 发行版,基于 Linux 的操作系统还是类 UNIX 操作系统?这取决于你的上下文。我已经为你提供了足够的细节,让你对这些相关的术语有更好的理解。 我希望你喜欢这个 Linux 黑话解释系列,并能学习到新的东西。欢迎你的反馈和建议。 From 49547638838dd93dd760ecc13a2869ae079a80ac Mon Sep 17 00:00:00 2001 From: SilentDawn Date: Sat, 12 Sep 2020 22:23:20 +0800 Subject: [PATCH 0090/1156] Update 20200831 Military looks to ultraviolet networks for secure battlefield communication.md --- ...traviolet networks for secure battlefield communication.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translated/talk/20200831 Military looks to ultraviolet networks for secure battlefield communication.md b/translated/talk/20200831 Military looks to ultraviolet networks for secure battlefield communication.md index b89671b294..58911ea7f3 100644 --- a/translated/talk/20200831 Military looks to ultraviolet networks for secure battlefield communication.md +++ b/translated/talk/20200831 Military looks to ultraviolet networks for secure battlefield communication.md @@ -29,8 +29,8 @@ 研究者计划分析下面四种场景,场景中涵盖了己方紫外发射器、友方接收器、敌对方探测器相对位置关系: * 友方接收器、敌对方探测器都在发射器的视线范围内。 - * 友方接收器在发射器视线范围内,但敌对方探测器不在视线范围内(最佳场景)。 - * 敌对方探测器在发射器的视线范围内,但友方接收器不在视线范围内(最差场景)。 + * 友方接收器在发射器视线范围内,但敌对方探测器不在视线范围内(最佳条件)。 + * 敌对方探测器在发射器的视线范围内,但友方接收器不在视线范围内(最差条件)。 * 友方接收器、敌对方探测器均不在视线范围内。 From 720ca80a4f6741b5ed1d47a737a4d8c30ea9d274 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 13 Sep 2020 05:01:42 +0800 Subject: [PATCH 0091/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200912?= =?UTF-8?q?=20How=20breaking=20my=20back=20led=20me=20to=20open=20source?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200912 How breaking my back led me to open source.md --- ... breaking my back led me to open source.md | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 sources/tech/20200912 How breaking my back led me to open source.md diff --git a/sources/tech/20200912 How breaking my back led me to open source.md b/sources/tech/20200912 How breaking my back led me to open source.md new file mode 100644 index 0000000000..b3f8666895 --- /dev/null +++ b/sources/tech/20200912 How breaking my back led me to open source.md @@ -0,0 +1,97 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How breaking my back led me to open source) +[#]: via: (https://opensource.com/article/20/9/breaking-back-open-source) +[#]: author: (Sara Kelly https://opensource.com/users/sarapk) + +How breaking my back led me to open source +====== +Open source gave a voice and a community to someone coping with the +aftermath of a major injury, and eventually led to a new career. +![Open source doctor.][1] + +Recently, I noticed some unusual activity on my blog. A very old post about [how I broke my back][2] while living in London had a lot of hits. Was it yet another case of Internet spammers finding a new target for their lewd advertisements? I finally put two and two together when I read [the headlines][3] that British personality Simon Cowell had broken his back in a freak motorcycle accident. Aha. So, a little celebrity mishap had led to a renewed interest in my story. Not to worry, if my recovery is anything to go by, then Simon should be just fine, folks. + +Breaking my back was a pivotal experience on many fronts. It scared the hell out of me. But the road to recovery helped me become a more resilient, courageous, and patient human being. Interestingly, it was this incident that also led me to the world of open source. Living with chronic pain is lonely, but I found my voice and a community via WordPress. Now, nearly eight years later, I'm working for the number one open source company in the world. + +### Wiggle your toes + +When I woke up in the trauma ward of Whitechapel Hospital back in 2011, I was tightly swaddled in white cotton, like an infant. Pitiful moans echoed around me, and I saw nurses scurrying to-and-fro. There was barely time to balk at my surroundings before a stern-looking doctor with a clipboard approached my cot. He skipped the niceties, and gravely informed me that I had broken my back. + +My first reaction was to wiggle my toes as a cold sweat hit my face. Would I ever walk again? + +"But doctor, I can feel my toes!" I cried, desperately hoping that would be the end of the nightmare. + +I was curtly informed that breaking your back is not the same as a spinal injury. One is a case of broken bones, which can heal over time. The other means permanent disability. In my case, the L1 bone had shattered into small pieces which were resting scarily close to the spinal cord. The doctor recommended complex spinal surgery to collect the bone fragments and piece them back together with metal rods. However, until surgery occurred, I should not make any sudden movements in case the bones slipped and damaged the spinal cord. + +It was five days before I underwent surgery, during which I was in a constant state of terror. I was afraid to move an inch lest I become wheelchair-bound. Lying in the same position for hours on end is painful. Even worse were the well-meaning nurses who needed to carefully maneuver me to change the bed sheets each morning. Those five days seemed like an eternity, but eventually, I had my surgery, and a few days later, I was discharged from the hospital. + +### Learning to walk + +Muscles waste away at an alarming rate. Broken back patients are encouraged to start moving as soon after surgery as possible for the best chance of recovery. During spinal surgery, most of the muscles in your back are spliced through so that the surgeons have room to focus on inserting titanium metal rods around the broken bones. So, when you wake up, you are starting from a position of zero muscle strength. + +The day after my surgery, my first goal was to take two steps. The next day, it was ten steps. Then it was walking to the bathroom and back. By the time I left the hospital, I still couldn't walk more than 15 feet without assistance, but I continued to set myself small goals and started hydrotherapy to regain my mobility. + +Funny enough, my pain only increased as I learned to walk again. Up until that point, I had avoided any serious reliance on drugs. But by the time I could take a shower independently, walk upstairs, or catch public transport with confidence, I was in utter agony. + +### Chronic pain is a lonely place + +It felt like thick, iron poles were constantly stabbing my right hip and knee. At first, the pain would creep on in the early afternoon, but eventually, it became constant chronic pain. The most difficult part was not knowing why it was happening. I was supposed to be getting better, so why was I hurting so badly? + +Nobody explained to me what nerve pain is. Now I know it is a common side effect of any surgery and can be temporary or permanent. Back then, various disinterested doctors and physiotherapists put it down to me not walking correctly or simply complaining. + +Being in constant pain, especially when nobody is listening, is incredibly lonely. For the next couple of years, I experimented with all sorts of medications, yoga, pilates, meditation, and even chiropractic treatments. Nothing would make the pain go away. I became heavily dependent on opiates, which caused other health problems such as constipation, insomnia, and mild hallucinations. + +### Introducing WordPress + +Just as I was giving in to depression, I was introduced to WordPress. A friend of mine had created their own personal blog, and they were posting creative articles about their life and opinions. Up until that time, I had thought the realm of websites was reserved for techie folks. I didn't have a clue about programming, let alone what a domain name was. + +My friend insisted it was easy and invited me to post a guest blog on their site. I decided to share the story of my accident. Publishing the blog was cathartic—I needed that emotional release—and from a technical perspective, it was easy peasy. WordPress allowed me to format the text and add pictures with ease. Afterward, my friend informed me of the number of views my blog posting received, and I toyed with the idea of starting my own website. + +### The doctor calls + +A few weeks after publishing my first ever blog, I was going for a routine checkup at Whitechapel Hospital. Shortly after signing in at the reception counter, the original doctor—the one with the clipboard who had performed my spinal surgery, beckoned me into his office. + +Gone was the serious expression and grouchy-looking eyebrows. The doctor actually looked happy to see me. As usual, he skipped the pleasantries and hastened to share that he had read my blog about breaking my back. I was shocked something I had posted had reached him! He went on to say how moved he was by my struggles, as well as concerned by some of the "remedies" I had tried. He promised he would do whatever he could to get to the bottom of my issue. + +Well, long story short, the doctor eventually discovered the nerve pain I was experiencing was caused by the placement of two of the metal pins around my spine. I went in for a second spinal surgery to remove them, and ever since, I have been pain-free. + +### I'm an open source believer + +![What happens when you break your back][4] + +Sara Kelly [[CC-BY-SA][5]] + +That experience taught me about the power of communication, and it wasn't long before I became a WordPress ninja! I entrenched myself in the [WordPress community][6] and soaked up everything there is to know about [running a website][7], thanks to the amazing network of contributors who post hacks, how-to guides, and respond to troubleshooting forums. + +[WordPress][8] is a completely free platform that anyone can use, study, and even change. I am a huge fan of their [mission statement][9], which reads: "We believe in democratizing publishing and the freedoms that come with open source." My own humble story is just one example of how having a voice made an impact. My original blog is long gone, but I have written subsequent stories about my recovery, which my doctor now shares with new patients, so they know what to expect after a broken back. Perhaps my story has even helped a celebrity like Simon? In any case, I like the idea that there are millions of people the world over, with their own struggles and aspirations, who can make a positive difference in the world by using free platforms like WordPress. + +What can I say? When I got the phone call almost a year ago that Red Hat was hiring, it felt like destiny. It's only by working at Red Hat I've come to appreciate how the idea of "open" unlocks the world's potential. The principles of open source—from decision-making to management practices—are firmly embedded in Red Hat's culture. Now, I truly am an open source believer. + +Besides its popularity, WordPress is also known for usability and an easy-to-develop environment. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/breaking-back-open-source + +作者:[Sara Kelly][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://opensource.com/users/sarapk +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_520x292_opensourcedoctor.png?itok=fk79NwpC (Open source doctor.) +[2]: https://bossyflossie.com/recover-broken-back/ +[3]: https://edition.cnn.com/2020/08/09/us/simon-cowell-bike-accident-trnd/index.html +[4]: https://opensource.com/sites/default/files/what_happens_if_you_break_your_back.jpg (What happens when you break your back) +[5]: https://creativecommons.org/licenses/by-sa/4.0/legalcode +[6]: https://make.wordpress.org/ +[7]: https://opensource.com/article/20/4/updating-wordpress +[8]: http://wordpress.org +[9]: https://wordpress.org/about/ From 68adf9975fec64a7384a8d30a31ac07670415f7f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 13 Sep 2020 08:10:01 +0800 Subject: [PATCH 0092/1156] Rename sources/tech/20200912 How breaking my back led me to open source.md to sources/talk/20200912 How breaking my back led me to open source.md --- .../20200912 How breaking my back led me to open source.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200912 How breaking my back led me to open source.md (100%) diff --git a/sources/tech/20200912 How breaking my back led me to open source.md b/sources/talk/20200912 How breaking my back led me to open source.md similarity index 100% rename from sources/tech/20200912 How breaking my back led me to open source.md rename to sources/talk/20200912 How breaking my back led me to open source.md From 14b71027cb8141cd2e53f5c991964a2a1fe200aa Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sun, 13 Sep 2020 11:19:08 +0800 Subject: [PATCH 0093/1156] Translating --- sources/tech/20200908 How to install software with Ansible.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200908 How to install software with Ansible.md b/sources/tech/20200908 How to install software with Ansible.md index ab119175ef..c6a48fd6a2 100644 --- a/sources/tech/20200908 How to install software with Ansible.md +++ b/sources/tech/20200908 How to install software with Ansible.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 3d1d18d3a0c2318bea544380666ef0494b5dba66 Mon Sep 17 00:00:00 2001 From: Jonathan Wang Date: Sun, 13 Sep 2020 20:42:45 +0800 Subject: [PATCH 0094/1156] Finish translating --- .../20200804 Leaving Google- Five Years On.md | 140 ------------------ .../20200804 Leaving Google- Five Years On.md | 139 +++++++++++++++++ 2 files changed, 139 insertions(+), 140 deletions(-) delete mode 100644 sources/talk/20200804 Leaving Google- Five Years On.md create mode 100644 translated/talk/20200804 Leaving Google- Five Years On.md diff --git a/sources/talk/20200804 Leaving Google- Five Years On.md b/sources/talk/20200804 Leaving Google- Five Years On.md deleted file mode 100644 index 5f94eafc04..0000000000 --- a/sources/talk/20200804 Leaving Google- Five Years On.md +++ /dev/null @@ -1,140 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (JonnieWayy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Leaving Google: Five Years On) -[#]: via: (https://theartofmachinery.com/2020/08/04/leaving_google.html) -[#]: author: (Simon Arneaud https://theartofmachinery.com) - -Leaving Google: Five Years On -====== - -About five years ago now, I handed in my Google employee badge and walked out of the Sydney Google office to start a new life of self-employment. I figured I should write up this story because I got a lot out of reading [Michael Lynch’s][1]. As you can see, it’s still taken me a couple of years to get around to writing this post, but I finally told myself that if I don’t write it for the fifth anniversary, I never will. - -This post is kind of long, but I hope it has something useful for new developers who are interested in working at a big tech company, or for big company employees who are wondering what it’s like to quit. I’ll talk about my story of getting into, working at and quitting Google, and what I’ve done since. Feel free to ask if you want more detail about something, though I already have a lot of blog posts to write, so I can’t promise anything in-depth straight away. - -Also, at the risk of labouring the obvious: I haven’t worked at Google for five years, so don’t take this story as a literal description of Google today or what all Google employees experience. However, I think a lot of it’s still relevant to tech careers in general. - -### The windy road to Google - -I got my first paid programming job in 2005. It was working at the local power company, taking some old Pascal code and making it work on a different OS with a different compiler. It was basically just a summer job for extra money while doing the maths and physics degree I’d started that same year. They were happy to have an undergraduate who could do the job; I was just blown away that these grown ups were not only interested in my programming hobby, but actually going to give me real money for it. - -I kept doing stuff like that until I graduated in 2007. I liked programming work, and Google was a cool company doing cool programming stuff, so I applied for an internship. The Google interview process was famous for being tough, so I spent weeks practising on all the Google interview problems I could find online. I don’t think the process has changed much in 13 years: I submitted a résumé, and I got invited to a few rounds of phone interviews that were mostly algorithmic problems (I remember a dynamic programming one and a divide-and-conquer geometric one). I passed the initial interviews, and got invited to come to Sydney for a day of on-site interviews with Google engineers. I went home and waited for what felt like an eternity for the phone call from Google HR. I got rejected. - -It’s natural to feel bad about our rejections and failures, so we don’t talk about them much. But for the same reason, other people don’t talk about theirs, which only makes things worse. When I _did_ get into Google later, I felt like there must be something a bit wrong with me as a “ex-reject”, but one day I was at a table with a bunch of colleagues and the conversation came up. That’s when I discovered that actually a lot of people around me had been rejected at least once. I wasn’t even the “worst”. One guy joked that he must have only got in because Google HR got tired of rejecting him. I’m talking about some pretty impressive engineers, as well — some were responsible for code I use all the time, and I bet you use, too. - -Companies that do interviews usually interview two or more candidates for each hire. That means there are more rejections around than acceptances, so the average interviewee gets rejected more often than not. Yet we keep forgetting that. Four developers go into an interview; one gets hired, the other three rant on social media about how the interview was totally flawed because they personally got rejected. Sure, interviews are far from perfect, but we need to stop taking them so personally. - -Rejection and failure aren’t so bad as long as you can figure out what went wrong and how you could improve yourself. The Google interviews were heavily algorithm-oriented, and I fumbled through a lot of them but definitely didn’t come out shining. - -After the Google rejection, I got two things and took a kind of sabbatical year. The first thing was an Australian Business Number (ABN) that I used to do maths and science tuition, as well as tech job contracts. The other thing I got was a library card at the university science and tech library. I wasn’t planning to interview at Google again, but the interview experience told me there was a lot I didn’t know. I’d give tutorials in the library and read books in between. By the way, a few people thought I was weird for doing all that accounting and stuff for my tuition business, when most tutors just did it cash-in-hand. But I learned a lot that’s helped me later in life, so I don’t regret a thing. - -In 2009, I did a maths honours year (a.k.a, bachelors fourth year) based on the work of a magician-turned-mathematician called Persi Diaconis. The computer science department let me take one of their algorithms units as part of it. - -As I said, I hadn’t planned to interview for Google again, but let me fast forward to how it happened. I’d been studying Japanese since high school, so in 2012 I decided to try living in Tokyo. That mostly worked out, except I made one pretty big mistake: I didn’t have any paper qualifications in Japanese, so it was really hard to get job interviews. Eventually, a friend of mine who had been accepted at Google suggested I give it another try. Like all Google offices, the official business language at Google Tokyo is English, so they didn’t require me to have Japanese qualifications. - -### Google interviews, again - -My friend gave me a recommendation to Google HR. That definitely helps, but don’t get too excited if you get a recommendation, yourself. It ensures your résumé gets noticed (not trivial) and cuts one of the phone interviews, but you still have to pass the remaining phone and on-site interviews. - -This time I practised using problems from [Project Euler][2] and [Google CodeJam][3]. I had to do some live programming in a Google Doc during the phone interview, which was a bit awkward, but otherwise the phone interviews went okay. Then I got invited to the Mori Tower office in Roppongi for a day of onsite interviews. - -![Mori Tower in Tokyo, where I interviewed for Google. It's the sixth tallest building in the city, which means it's huge. \(Photo from here.\)][4] - -My first interview went terribly. I got brain freeze. I knew I could solve the problem, but I couldn’t think straight until the interviewer walked out of the room. Instantly I relaxed and recognised it as a ternary search problem. That was pretty frustrating, but I decided to just keep going and see how the rest of the interviews went. - -Two of the interviews were bad. One is still today the worst interview question I’ve ever had. The interviewer said, “You run a program twice with the same input and get different results. Tell me why.” I replied, “When that’s happened on modern computers and I didn’t expect it, it’s usually been a race condition.” He just said, “No, it’s not a race condition,” and looked at me waiting for my next answer. The question could have been a great question if he’d been interested in a discussion, but apparently he really did just want to play “guess the secret number”. For almost everything I said, he simply replied, “No.” Apparently the program was fully deterministic, stored no state, and had no dependence on the environment (such as disk or the real time clock), but gave different results each time it was executed. I suspect we had a different understanding of what “stored state” or “environment” meant or something, but I had no way to tell. At one point (getting desperate) I tried asking if temperature changes in the electronic components were having an effect, and he said, “No, that would be a race condition, and I’ve already told you it’s not a race condition.” Eventually the interview ended, and I still don’t know what that secret number was. - -I’m telling that story because I’ve heard much tamer horror stories being told as proof that interviewers are terrible people who hate interviewees. But, contrary to popular stereotype, most of the interviews that day were basically okay, and the interviewers were friendly and respectful. Interviewing is genuinely really hard, too, so it’s good to cut interviewers some slack. Hopefully, the “guess the number” interviewer got feedback from Google HR that his question just wasn’t helpful for making hiring decisions. - -This time, the interviews resulted in an offer, but with a little catch: the job was in Sydney, working as a site reliability engineer. I’d never heard of SRE before, but I had a phone call with a senior Sydney SRE who explained that he’d noticed my experience doing embedded engineering in the natural gas industry, and thought SRE would be a good fit because of a similar emphasis on reliability and fitting tight constraints. - -Having spent about a year building up a life in Tokyo, I didn’t want to drop everything and move to Sydney, but no way in hell was I in a position to turn down an offer from Google. I did make one very stupid mistake when talking with the recruiter: I got asked how much money I was making, and I blurted it right out. [Don’t do that.][5] It means it doesn’t matter what happens in the interview, or how much you were being underpaid at your previous job, or whatever; you’ll probably either be rejected or get offered some token amount on top of your old pay and be treated as crazy and unreasonable if you try to negotiate more. In my case, I was making much less than even an entry-level position at Google. I can’t say for sure that’s the whole story, but in 2013 I moved to Sydney to be a new-grad level SRE on Google Maps. - -### Google Maps SRE at Sydney - -A product like Maps is really several software projects, each with its own team of developers. Even a feature like route-finding is really multiple software projects — from gathering transport timetable data, to calculating routes, to rendering results, etc. There are two sides to the SRE job: One is being oncall for the various projects, responding in real time to any production incidents. The other side of the job (when there aren’t any fires to fight) is applying experience from production incidents to other projects and pre-emptively finding ways they could go wrong, or opportunities to make them perform better. Google’s SREs also act like an internal consulting group for developers with questions about deployment practices, or automation, or monitoring, or things like that. - -The work was pretty intense. As a team, we were expected to deal with at least one production incident a week, or else take on responsibility for more services. Every week, all the SREs in Sydney would get together to swap stories of failures that had happened, or new tips for how to make things work better. The learning curve felt like being an undergraduate again. - -I sometimes get a shocked, “But don’t you miss the benefits?!” from people who hear I chose to quit Google. The material benefits (like meals, etc.) are definitely nice, but they’re things that you can buy, so, no, they’re not things I miss. If you ask me what I miss, I’d say it’s the people who worked there. Contrary to what you might have heard, arrogant people don’t enjoy working at places like Google. There’s an infamous story of a narcissist who got a job at Google and kept embarrassing himself by pretending to be a top expert in all kinds of things. He lasted less than half a year before leaving. Overall, the culture was very low on arrogance and blame slinging and politics compared to other places I’ve worked at. On the other hand, Google doesn’t have a monopoly on nice colleagues. - -There’s one kind of corporate politics that was a big problem, though. Getting promoted required “demonstrating impact”, and it was well known that the easiest way to do that was to launch some new thing (not the only way, but easiest). The result was Googlers who were more interesting in promoting their own alpha-quality, prototype solutions to problems than improving existing solutions. We had a standing joke in SRE that there were two kinds of software inside Google: old things that worked well but were deprecated and were Ungoogly to even consider using, and hot new things that were the 100% official tools to use today even though they didn’t work yet. As SREs, we often saw first hand what went wrong with the new hotness (which sometimes became the old deprecated thing before it even got out of alpha). ([I’ve talked more in depth about this kind of thing before.][6]) - -This isn’t something that we cynical SREs just imagined; it was openly recognised as a problem in the company, and I remember being reassured that promotion committees had started looking for evidence of impact through things like maintenance work. - -### The promotion application - -In 2015, after working at Google for a couple of years, my manager told me it really was about time to apply for a promotion above my new-grad level. The promotion process was centrally managed through promotion committees twice a year. You’d make your application and back it up with a short description of projects you’d worked on, supported by references from your colleagues. The committee would do a review and give you the thumbs up or down. Your manager’s recommendation alone wasn’t enough because your manager had an incentive to get you promoted. Having high-ranked staff under you helps your own career advancement. - -To cut a long story short, I made my application and the committee said no. Actually, it was a pretty damning no. I don’t remember the response in detail, but it felt like the committee had just gone hunting through my application looking for things to be dismissive about. For example, one project I’d worked on was an internal tool that was building up a backlog of feature requests. I’d looked at the project and figured out that the root problem was that it had outgrown the key-value store it had been built on, and needed a proper database. I argued for switching to a relational DB, and I went ahead and implemented it: schema, data migration, queries, the live site migration, etc. The new queries were much faster, and (more importantly) the new features could be supported efficiently. One problem I had to solve before migrating was that most of the code wasn’t covered by tests, and that was because most of the code wasn’t testable. I refactored the code using dependency injection and [other tricks I’ve talked about before][7], and that let me build a regression test suite. I remember that project was mostly dismissed with the comment that writing unit tests is “new-grad-level work”. - -My manager was really supportive and wrote an appeal. He didn’t show it to me, but I think it was several pages that could be reduced down to “WTF” (argued more eloquently and with more detail). Here are some of the reasons I also thought this response was a bit WTF: - -Google SRE has a concept of “point-personship”. The point person for a project has two roles: One is to know the software project to a greater depth than other SREs, so that you can answer questions they might have. The other role is to be the first point of contact for the devs on the project itself, so that they can get answers to all their SRE questions. The Google job ladder guide said that point-personship wasn’t required at the new-grad level, but looked good for promotion. As my application had said, I was point person for three projects. - -My point-personships made it easy to find senior developers who agreed to help support my promotion application. They were all shocked when they found out I was new-grad level. They’d all agreed to support my application assuming I was already at a higher level. - -On my application, I mentioned being a mentor for a group of new-grad interns we had. When I made my application, many of them were being hired as permanent employees. I was senior enough to be their mentor, but firmly not enough to be promoted above their level. - -The response to my manager’s appeal took a completely different tack from the original review. This time I was “strongly exceeding expections for my [new-grad] job level”, but the problem was that they just needed a little bit more time to be sure I could be promoted to new-grad-plus-one. I was told I could keep strongly exceeding expectations for another six months until the next promotion cycle, and maybe I’d get a promotion then. The appeal was over; that was the deal. - -I wrote an email that I was taking another option. Like many tech companies, Google has an employee stock program. You’re given a nominal grant when you start work, and you actually receive real shares at various “vestment” milestones. My next stock vestment was a couple of months away. The day after that, I wouldn’t be working for Google any more. - -### My reasons for quitting - -The decision to quit any job isn’t easy, and one day you might face the same decision. Here are some of the factors that helped me make my choice. ([Some of this thinking I explained in more depth in an older post.][8]) - -If you think about it, given that I wasn’t literally a new grad, Google’s review should have been something like, “You’re doing some things very wrong. You simply won’t get a promotion until you improve at X and Y and Z.” Being told, “You’re strongly exceeding expectations, but we need another six months or so,” didn’t make any sense. No one raised concerns about whether I was capable of doing my job. I was getting a lot of excuses, but not any useful feedback to help me do better. (NB: sometimes you have to explicitly ask for feedback. Managers can fall into the trap of defending the performance ratings they give, instead of thinking about the report’s need for feedback.) - -I also wasn’t sure what the promotion committee might see in six months that they hadn’t already seen in two years. Why wouldn’t they ask for another six months again? If I needed to prove myself for years to get new-grad-plus-one, how old would I be before I got new-grad-plus-two? - -When I first started at Google, my job level was irrelevant because I was learning so much and getting a famous company on my résumé. Two years in, the equation was different. The value of the future that Google was offering me was waning, while the value of opportunities outside Google had gone up. Google job levels mean practically nothing outside Google. In the past five years, plenty of people have asked about what I did at Google, but not a single person has asked me what my Google job level was, or called me a new grad. Although I took a financial hit short term, I effectively got a promotion that day I handed in my badge. - -Credit where it’s due, Google didn’t do anything like this, but it’s common in other companies: trying to make employees feel guilty about asking for pay rises. At a place I worked a few years ago, some engineers asked for a payrise after a highly successful launch following a lot of crunch time. Management played the victim and accused the engineers of “twisting their arms”. (About six months later they lost most of their engineering team.) If you’re genuinely co-operative about the timing of when you might quit (e.g., after a launch date, not the week before) and willing to document your knowledge and clean up after yourself, etc., you’re only twisting your employers’ arms by as much as they’re underpaying you. - -Nominally, I left a large amount of unvested stock behind at Google. But stock isn’t yours until it’s yours. I just had a promise of being paid shares in future, and I could convert it to an equivalent pay rate by dividing it by time required. Working two months for that vestment was worth it. Working years for the remaining vestments wasn’t. Don’t fall for endowment bias. - -When shouldn’t you quit? Well, are you’re getting a good deal compared to what you could get elsewhere? Corporate career paths aren’t mandated by heaven; they’re a series of business offers representing what the company estimates you’ll work for. If you think you’re getting a good deal (considering all compensation and intangibles like the work environment), great! Otherwise, it’s time to think hard about what to do next. - -### After Google - -I should warn you that I took a strategy that was high growth, at the expense of short-term stability. If stability is more important to you, you’ll do things differently. My plan A, plan B and plan C all fell apart, and I ended up spending a few months struggling to find a way. Eventually I got a contract at a small web shop, working on [Safety Town][9], a government road safety website for kids. The pay was a big cut from Google, especially considering it was my first work in months. But, you know, I really enjoyed that project. Sure, it wasn’t “cool” like Google, and maybe some kids at school didn’t think it was cool. On the other hand, at Google I was a tiny part of a huge thing. Safety Town had a small team, with everyone playing a crucial role. For part of the Safety Town project, I was _the_ backend engineer, and Safety Town was the only thing I had to worry about at that time. And, heck, maybe some kids have learned a thing or two about road safety from that website. I’ve done plenty of projects since then, most of them bigger, but I still show people Safety Town. - -![Screenshot of Safety Town home page, owned by Australian NSW government.][10] - -I remember a poster in the Sydney Google office that said, “Shoot for the moon! Even if you miss, you’ll land among the stars!” It’s easy to forget that you can have a quality life even if you’re not doing moonshots for famous companies, or doing moonshots for startups. - -Here’s one trick that helped me get contracts. I’d go to Sydney tech events, stand within view of the job board, and wait until I saw someone writing on it. Suppose they were writing about CSS development for an insurance company project. Even if I weren’t especially interested in CSS or insurance, I’d wander over and say, “Hi, what kind of insurance project is that?” It’s the easiest conversation starter because their head’s full of the project while they’re trying to fit it into a tiny space on the job board. Usually the conversation still wouldn’t lead to a job for me, but occasionally I’d discover something I could help with. Some events don’t have a job board, but the organisers are often glad to offer the microphone to someone for a few minutes. It adds community engagement to their events. - -I got a major break after working on a website for government procurement, just because I learned to not be so clueless about government procurement. It’s hard to say exactly how much that knowledge was worth, but less than a year afterwards I signed a government contract for about 40% more than I would have hoped was possible before. (I don’t do so much government and big enterprise work nowadays, though.) - -After about a year and a half, I had my own one-person company. As I built up a reputation, I gradually got more SRE-like work. Basically, doing dev work was my “in”, then several months later I’d get contacted by someone who needed SRE/DevOps help and remembered me. I actually like both SRE and pure dev work, but supply and demand means SRE work is good business. I can still do programming in my spare time. - -Speaking of which, work/life balance is my favourite thing about my new lifestyle. No one pays me between contracts, but I can make the most of it by learning new things doing side projects. After one long, intense contract, I took a break and did [a month-long backpacking trip exploring rural Japan][11]. It was a trip I’d wanted to do for a long time, but before Google I needed more money, and during Google I needed more time. Being self-employed is far from stress free and isn’t for everyone, but there’s stress that makes you feel dead, and there’s stress that makes you feel more alive. For me, self-employment is the second kind, and I’d say I’ve been less stressed overall in the past five years than I was while at Google. In my case, at least, I can honestly say I don’t regret joining Google when I did, and I don’t regret leaving when I did, either. - --------------------------------------------------------------------------------- - -via: https://theartofmachinery.com/2020/08/04/leaving_google.html - -作者:[Simon Arneaud][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://theartofmachinery.com -[b]: https://github.com/lujun9972 -[1]: https://mtlynch.io/why-i-quit-google/ -[2]: https://projecteuler.net -[3]: https://codingcompetitions.withgoogle.com/codejam -[4]: https://theartofmachinery.com/images/leaving_google/mori-tower.jpg -[5]: https://www.kalzumeus.com/2012/01/23/salary-negotiation/ -[6]: https://theartofmachinery.com/2019/03/19/hello_world_marketing.html -[7]: https://theartofmachinery.com/2016/03/28/dirtying_pure_functions_can_be_useful.html -[8]: https://theartofmachinery.com/2018/10/07/payrise_by_switching_jobs.html -[9]: https://www.safetytown.com.au/ -[10]: https://theartofmachinery.com/images/leaving_google/safetytown.png -[11]: https://theartofmachinery.com/2018/03/23/seto_trip_1.html diff --git a/translated/talk/20200804 Leaving Google- Five Years On.md b/translated/talk/20200804 Leaving Google- Five Years On.md new file mode 100644 index 0000000000..b93d845c25 --- /dev/null +++ b/translated/talk/20200804 Leaving Google- Five Years On.md @@ -0,0 +1,139 @@ +[#]: collector: (lujun9972) +[#]: translator: (JonnieWayy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Leaving Google: Five Years On) +[#]: via: (https://theartofmachinery.com/2020/08/04/leaving_google.html) +[#]: author: (Simon Arneaud https://theartofmachinery.com) + +离开 Google:五年以来 +====== + +大约五年前的今天,我上交了 Google 员工证,然后走出来悉尼 Google 办公室,开启了一段自谋职业的崭新生活。我认为我应该详述一下这个故事,因为我通过阅读 [Michael Lynch][1] 的作品而收获颇丰。正如你所看到的,我仍然花费了几年时间才开始考虑写这篇文章,但是最终我告诉自己,倘若我不在五周年纪念日写它,我就永远也不会写了。 + +这篇文章有点儿长,但是我希望它对那些对于在大型技术公司工作感兴趣的新开发人员或是想要离职的大型企业雇员能够有所帮助。我将谈谈我进入 Google,在 Google 工作,以及退出 Google 的故事,还有我自开始以来所做的事情。尽管我已经写了很多博文,但是如果想知道更多关于某事的细节的话,随时可以提问,因此我无法立即保证任何深入的事情。 + +同样地,冒着显而易见的劳工风险:我已经有 5 年不在 Google 工作了,所以请不要以这个故事来作为当今 Google 或是 Google 雇员经历全貌的字面描述。但是,我认为其中的许多内容仍然与一般性的技术职业有关。 + +### 通往 Google 的艰辛道路 + +2005 年,我获得了第一份有偿编程工作,是在当地的电力公司工作,采用一些旧的 Pascal 代码并使其能够在另一款具有不同编译器的操作系统上运行。这基本上只是我为了挣外快而做的暑期工,同年我还刚刚开始攻读我数学和物理的学位。他们很高兴有一个本科生能够胜任这份工作。我被这些大人吓了一跳,因为他们不仅只是对我的编程爱好感兴趣,而且真的还会为此给我钱。 + +直到 2007 年毕业以前,我一直在做类似的工作。我喜欢编程工作,而 Google 是一家从事着很酷的编程工作的很酷的公司,因此我申请了实习。 Google 的面试过程以困难而著称,所以我花了好几个星期时间练习了所有我在网上能够找到的 Google 面试题。我认为 13 年里面试流程并没有发生太大的变化 —— 我提交了简历,受邀参加了几轮电话面试,这些面试问的几乎都是算法问题(我记得有一个动态规划问题和一个分治几何问题)。我通过了最初的几轮面试,然后受邀前往悉尼接受了由 Google 的工程师们进行的为期一天的现场面试。我回到家里,等待 Google HR 的电话,这个过程漫长得像是有一辈子。我被拒绝了。 + +对于我们收到的拒绝和失败感到难过很自然,因此我们并不会经常谈及它们。但是出于同样的原因,其他人也不会去谈论他们自己的失败,这只会使得情况变得更加糟糕。当我后来真的进入 Google 时,我觉得作为一个此前被拒绝过的人,我一定有哪里做得不对,但是有一天我和一群同事坐在一张桌子旁,开始交谈。那时候我才发现,实际上我身边的很多人都至少被拒绝过一次。我甚至都不是“最差的”。有个家伙开玩笑说,他肯定是因为 Google HR 厌倦了拒绝他才得以进来的。我也在谈论一些相当令人印象深刻的工程师 —— 有些人负责着我一直在用的代码,而我打赌你也在用。 + +进行面试的公司通常会为每个名额面试两名或更多的候选人。这意味着比起录用,会有更多的拒绝,所以普通的面试参与者被拒绝的可能性要大于被录用。然而我们一直忘记了这一点。四个开发人员参加面试,一个被录用了,其他三个在社交媒体上抱怨这场面试充满了缺陷,因为他们被拒绝了。当然,面试远非完美,但是我们需要停止如此个人化地谈论它们。 + +只要你能够找到问题所在并知道如何去改进自己,拒绝和失败就没有那么糟糕。 Google 的面试主要针对算法,我在其中磕磕拌拌地摸索,但绝对没有能够脱颖而出。 + +在被 Google 拒绝以后,我得到了两样东西,并进行了为期一年的休假。第一件东西是 Australian Business Number ( ABN ),我用它来做数学与科学课程,以及技术工作合同。我获得的另一样东西是一张大学科技图书馆的借书证。我当时并不打算再次去参加 Google 的面试,但是那次的面试经历告诉我还有很多东西是我所不知道的。我会在图书馆开设课程,并在期间阅读书籍。顺便说一句,有些人认为我为我的学费业务所做的所有这些财务工作和其他东西很奇怪,而大多数导数都只收现金。但是我学到了许多对我日后生活很有帮助的东西,所以我一点儿都不后悔。 + +2009 年,我进行了一个数学荣誉年(又称学士学位四年级),基于一名由魔术师转行的名叫 Persi Diaconis 的数学家的工作。计算机科学系让我将他们的算法单元之一作为其中的一部分。 + +就像我所说的那样,我本来并没有打算再去 Google 面试,但是让我快速地讲讲这是怎么发生的。我从高中就开始学习日语,因此在 2012 年,我决定尝试住在东京。这基本上行得通,除了我犯了一个相当大的错误 —— 我没有任何日语方面的纸质资质证明,因此很难获得工作面试。最终,我的一个已经被 Google 录用的朋友建议我再试一次。与 Google 所有的办事处一样, Google Tokyo 的官方商务语言是英语,因此他们不要求我具有日语资质证明。 + +### Google 面试,再一次 + +我的朋友向 Google HR 推荐了我。这绝对有帮助,但是如果你自己得到了被推荐的机会,也不要太过于兴奋。它所能够确保的是你的简历会被注意到(不太过潦草)并且免去一次电话面试,但你仍然得通过剩下的电话面试和现场面试。 + +这一次我用来自 [Project Euler][2] 和 [Google CodeJam][3] 的题进行练习。电话面试过程中,我不得不在 Google Doc 上进行一些在线编程,这有点儿尴尬,但是除此以外电话面试一切顺利。然后我受邀前往六本木的 Mori Tower 办公室进行了为期一天的现场面试。 + +![Mori Tower in Tokyo, where I interviewed for Google. It's the sixth tallest building in the city, which means it's huge. \(Photo from here.\)][4] + +我的首个面试非常糟糕。我的脑子僵住了。我知道我能够解出那些题目,但是直到面试官走出房间我才想出答案。我立刻就感到很放松,并且意识到这是一个三元搜索问题。这是在是很令人沮丧,但是我觉得继续前进,看看剩下的面试进展如何。 + +其中的两次面试很糟糕。其中之一直至今日仍然是我遇到过的最糟糕的面试问题。面试官说:“你用同一输入运行一个程序两次,得到了两个不同的结果。告诉我这是为什么。”我回答道:“当这种情况在现代计算机上发生而且并不在我的预期之中时,通常是竞态条件。”他只说:“不,这不是竞态条件。”然后看着我等着我的下一个回答。如果他有兴趣讨论一下的话,这个问题本该是一个很棒的问题,但是很显然他实际上只想玩“猜猜神秘数”。对于我所说的几乎全部内容,他只是回答:“不。”显然,该程序完全是确定性的,不存储任何状态,并且不依赖于环境(例如磁盘或是实时时钟),但却在每次执行时都给出不同的结果。我怀疑我们对于“被存储的状态”或是“环境”的含义还是某些东西有着不同的理解,但是我无法区分。有一次(变得绝望了)我试着问电子元件的温度变化是否会有影响,而他说:“不,那会是一个竞态条件,我已经告诉过你这不是竞态条件了。”最终,面试结束了,而我仍然不知道那个秘密数字是什么。 + +我将这个故事的原因是,我听说过许多更为温和的恐怖故事,用以证明面试官是憎恶面试者的坏人。然而,与流行的刻板印象所相反的是,当天的大多数面试基本上都还可以,面试官也很友好并且很尊重人。面试也着实很困难,因此最好减少面试官的工作量。希望那个“猜数字”面试官从 Google HR 那里得到的反馈是,他的问题对于作出聘用决定没什么帮助。 + +这次,面试带来了一份要约,但是有一个小问题:这份工作在悉尼,担任站点可靠性工程师( SRE )。我以前从未听说过 SRE,但是我和一位悉尼的资深 SRE 通了电话,他解释说他注意到了我在天然气行业从事嵌入式工程的经历,并且认为 SRE 会和适合我,由于类似的可靠性与拟合紧密约束方面的重心。 + +在东京花了大约一年时间来建立起自己的生活,我不想抛弃一切然后搬到悉尼,但是我绝不可能会拒绝一份来自 Google 的要约。与招聘人员交谈时,我确实犯了一个非常愚蠢的错误:我被问到当时能赚多少钱,然后我就脱口而出。[别这么做。][5] 这意味着在面试中发生了什么事情,或是你上一份工作中你的工资有多低,等等都无关紧要。你可能会被拒绝,或者会在原来的薪水基础上得到一些象征性的提升,并且如果你试图进一步协商,会被认为疯狂而又不合理。就我而言,我的收入甚至远远低于 Google 的入门级职位。我无法肯定地说这就是整个故事,但是在 2013 年我搬到了悉尼,在 Google Maps 成为了一名新毕业生级别的 SRE。 + +### Google Maps SRE 在悉尼 + +像 Maps 这样的产品实际上是若干个软件项目,每一个都有自己的开发人员团队。甚至诸如路线查找之类的功能实际上也涉及多个软件项目 —— 从交通时刻表数据收集,到线路计算,再到结果渲染,等等等等。 SRE 的工作包含两个方面:一方面是为各个项目提供待命,实时响应任何生产事故;另一方面(在无需救火时)则是将生产事故中所积攒的经验应用到其他项目中去,并且发现其中可能出错的方式,或是发现使其性能更好的机会。 Google 的 SRE 还需要像开发人员的内部咨询小组一样,对部署实践、自动化、监控或是类似的问题提供咨询。 + +这项工作相当紧张。作为一个团队,我们每周至少需要处理一次生产事故,否则就要承担更多服务的责任。每个礼拜,悉尼的所有 SRE 都会聚在一起,交流发生过的故障事件或是有关如何使事情更好地运转的新技巧。学习曲线感觉就像是再次成为了一名本科生。 + +我有时会感到震惊,听说我选择离开 Google 的人会问:“但是你不会想念这些好处吗?!”物质上的好处(例如伙食等等)绝对很棒,但是他们是你可以买到的东西,因此,不,他们不是我所想念的东西。如果你问我所想念的是什么,我会说是在那里工作的人们。与你可能听说过的不同,自大的人不喜欢在 Google 之类的地方工作。有一个臭名昭著的有关一个自恋者的故事,他在 Google 找了份工作,并假装自己是各方面的顶级专家,让自己尴尬不已。他待了不到半年就离开了。总的来说,与我工作过的其他地方相比,这里的文化在傲慢、指责以及政治方面很少。另一方面, Google 并没有垄断好同事。 + +不过,在有一种公司,政治是个大问题。晋升需要“展示影响”,而众所周知的是,要做到这一点最简单的方法是发布一些新事物(不是惟一的方法,但是最简单)。结果是 Googler 们比起改进现有的解决方案,对于推广他们自己质量一流的原型方案更感兴趣。在 SRE 之间,我们经常开玩笑说, Google内部有两种软件:运行良好但是已经过时甚至不被考虑使用的旧东西,以及现如今正在作为 100% 官方工具使用的热门新东西,即使它们还尚未能正常运行,作为 SRE,我们经常亲眼看到新的热点事物出了什么问题(有时甚至在脱离 alpha 之前它就已经成了过时的旧东西)。([我此前已经对这类事物进行了更为深入的讨论。][6]) + +这不是我们愤世疾俗的 SRE 所想象的东西;这在公司中被公认为是一个问题,而我记得令人放心的是促销委员会已经开始通过维护工作等方式寻找关于其影响的证据。 + +### 晋升申请 + +2015 年,在 Google 工作了两年之后,我的经理告诉我,现在是时候申请一个高于我新毕业生水准的晋升了。晋升过程每两年一次由晋升委员会进行集中管理。你可以先提出申请,然后加上一份对你所从事过的项目的简短描述,再加上同事的推荐信。委员会将会进行审查,然后给你赞成或反对的意见。仅仅有你经理的推荐是不够的,因为你的经历有想让你获得晋升的动机。手下有高级别的员工有助于你自己的职业发展。 + +长话短说,我提交了我的申请,而委员会说不。事实上,这是个相当糟糕的拒绝。我不记得详细的答复了,但感觉就像是委员会在我的申请中寻找可以轻视的东西。例如,我从事过的一个项目是一个内部工具,它建立起了功能需求的积压。我查看了这个项目,发现根本问题在于它已经超出了构建它的键值存储,需要一个合适的数据库。我主张切换到关系数据库,并实现了它:模式、数据迁移、查询、实时站点迁移等等。新查询的速度要快得多,而且(更重要的是)可以有效地支持新功能。在进行迁移之前,我必须要解决的一个问题是大部分代码没有被测试所覆盖,而这是由于大部分的代码都不可测试。我使用依赖注入以及[我此前讨论过的其他技巧][7]重构了代码,而这使我能够构建一组回归测试套件。我记得这个项目主要是因为测试单元的编写是“新毕业生水平的工作”而被驳回。 + +我的经理真的很支持我,并且写了上诉。他没有给我看,但是我认为这是可以被缩减成 “WTF” 的若干页(更雄辩而详尽地论述)。以下是一些我也认为这一回复有点 “WTF” 的原因: + +Google SRE 有一种“关键人物( point-personship )”的概念。一个项目的关键人物有两个角色:一个是比起其他 SRE 对于软件项目有着更为深入的了解,以便你能够回答他们可能会提出的问题;另一个角色是作为开发人员在项目本身上的第一联络点,以便他们能够获得对所有 SRE 问题的回答。 Google 的职业阶梯指南说,毕业生水准并不需要扮演关键人物,但是看起来很适合晋升。正如我在申请中所写的,我是三个项目的关键人物。 + +我的关键人物经历使得想要找到同意支持我的晋升申请的资深开发人员很容易。当他们发现我是新毕业生级别时都十分震惊。他们都同意支持我的申请,假设我已经处在了一个更高的级别。 + +在我的申请之中,我提到曾担任过一组新毕业实习生的导师。当我提出申请时,他们之中的许多人都已经被聘用为了长期雇员。我足够资深,可以去担任他们的导师,但是还绝不足以晋升到比他们更高的级别。 + +给我经理上诉的回复与原始评论截然不同。这次,我“大大超出了对于我新毕业生级别工作的期望”,但是问题在于他们需要稍多一些时间来确保我能够晋升到新毕业生加一的级别。我被告知在接下来的 6 个月时间里,倘若我能够继续超出预期,知道下一个晋升周期,也许那时我就会得到晋升。上诉结束了;这就是最终结果。 + +我写了一封电子邮件,表示我正在采取另一种选择。就像许多科技公司一样, Google 也有员工持股计划。在开始工作时,你会得到一笔象征性的补助金,而在各个“投资”里程碑时刻,你会收到真正的股份。我的下一次股票投资实在几个月之后。从那以后,我将不再为 Google 工作。 + +### 我离开的原因 + +辞职的决定并不容易,而某天你或许会面临同样的抉择。以下是一些有助于我作出决定的因素。([我在以前的一篇贴子里对一些这类想法进行了更深入的解释。][8]) + +如果你思考一下,考虑到我并不是字面意义上真正的应届毕业生, Google 的评价应该是这样的:“你正在做一些非常错误的事情。”在 X、 Y 还有 Z 方面有所改进之前,你根本不会得到晋升。被告知“你远远超出了预期,但是我们还需要 6 个月左右的时间”,这是毫无道理的。没有人关注我是否有能力做好我的工作。我得到了许多接口,但是没有能够帮助我提高的任何有用反馈。(注意:有时候你必须要明确地要求反馈。经理们可能会陷入捍卫自己所给出的绩效评级的陷阱,而不会去考虑报告是否需要反馈。) + +我也不确定晋升委员会会在 6 个月里看到什么他们在已经过去的 2 年时间里都没有看到的问题。他们为什么不会在要求 6 个月时间呢?如果我需要花上多年时间来证明自己以获得新毕业生加一的级别晋升,那么我升到新毕业生加二的时候得有多老呢? + +刚加入 Google 时,我的工作级别无关紧要,因为我当时学到了那么多东西,并且能在我的简历里写入一家著名的公司。两年过后,方程式变得不同了。 Google 所提供给我的未来所具有的价值正在下降,而 Google 之外机会的价值却正在上升。 Google 的职位实际上在 Google 之外几乎毫无意义。在过去的 5 年间,许多人都问过我在 Google 做过什么,但是没有一个人问我在 Google 是什么职位,或是称我为“新毕业生”。尽管我在短期内受到了财务方面的打击,但实际上在我上交员工证的那天我就已经得到了晋升。 + +值得称赞的是, Google 没有做过任何类似于以下的事情,但是在其他公司中却很常见:试图让员工对于要求加薪感到内疚。在几年前我工作过的地方,一些工程师在经历了许多紧要关头的成功发布后要求加薪。管理层扮演起了受害者的角色,并且职责工程师们是在“扭曲他们的手臂”。(大约 6 个月时间后,他们失去了自己大部分的工程团队。)如果你真的愿意就辞职时间进行配合(例如,在发布日期之后,而不是前一周),并且愿意记录下你的知识并在自己之后清理等等,那么你仅仅是由于雇主支付给你的工资不足而“扭曲他们的手臂”。 + +名义上,我在 Google 留下了大量未投资的股票。但是知道你拥有股票时,股票才属于你。我只是得到了未来会有分红的承诺,而我可以将其除以所需的时间来将其转换为同等的工资率。为这项投资工作 2 个月是值得的,为了剩余的投资工作数年不是。不要被禀赋偏见所迷惑。 + +什么时候不应该辞职呢?嗯,与在其他地方相比,你能得到的很多吗?公司的职业发展道路不是天上掉下来的,他们是一系列的业务报价,代表着你将为什么样的公司评估而工作。如果你认为自己能得到很多(考虑到所有的薪酬和像是工作环境之类的无形资产),很好!否则,是时候认真考虑一下下一步该做什么了。 + +### Google 之后 + +我应当警告你的是,我采取了高增长的战略,但是牺牲了短期稳定性。如果对你而言稳定性更为重要,你应该做出不一样的选择。我的 A 计划、 B 计划、 C 计划都失败了,我最终花费了几个月时间苦苦找寻出路。最后,我在一家小型网络商店得到了一份合同,为 [Safety Town][9] 工作,一家面向孩子们的政府道路安全网站。那里的薪水较之于 Google 是一个巨大的缩减,尤其是考虑到这是我几个月以来的第一份工作。但是,你知道,我真的很享受这个项目。当然了,它不像 Google 那么“酷”,而且可能一些学校里的孩子也不觉得它酷。另一方面,在 Google,我只是一件大事的一小部分。 Safety Town 有一个小团队,每个人都扮演着至关重要的角色。在 Safety Town 项目中,我是后端工程师, Safety Town 但是我唯一需要费心的事情。而且可能一些孩子已经在这个网站上学到了一两件有关道路安全的事情。从那以后,我做了很多项目,大多数都要更大,但是我仍然会向人们展示 Safety Town。 + +![Screenshot of Safety Town home page, owned by Australian NSW government.][10] + +我记得 Google 悉尼办事处的一张海报,上面写着:“飞向月球吧!即使你错过了,你也会降落在群星之中!”人们很容易忘记,即使你不是在为知名公司或初创公司做“登月计划”,你也可以拥有高质量的生活。 + +这儿有一个帮助我获得合同的窍门。我会去参加悉尼的科技活动,站在能看到求职公告板的范围之中,等着直到我看见有人在上面写东西。假设他们正在为一个保险公司项目写 CSS 开发方面的信息。即使我对 CSS 或保险不是特别感兴趣,我也会来回徘徊并说:“嗨,这是个什么类型的保险项目?”这是最容易的开启谈话的方式,因为在他们努力往求职公告板上的狭小缝隙中写字的时候,满脑子都是这个项目。通常情况下,这样的谈话仍然不会为我带来一份工作,但是偶尔也会发现一些我能够帮上忙的东西。有些活动没有求职公告板,但是组织者们往往很乐意把麦克风递给别人几分钟。这为他们的活动增添了社区参与度。 + +在为政府采购网站工作后,我取得了重大的突破,因为我学着不对政府采购一窍不通。很难确切说出这些知识的价值,但是不到一年过后,我签署了一份政府合同,比我此前所期望的要多了 40%。(不过,我如今没有做太多的政府和大型企业工作。) + +大约一年半过后,我有了自己的一人公司。随着我声誉的建立,我逐渐获得了更多类似于 SRE 的工作。基本上,从事开发工作是我的“工作”,然后几个月后一个需要 SRE/DevOps 帮助并想起了我的人联系了我。我事实上既喜欢 SRE,也喜欢纯开发工作,但是供求关系意味着 SRE 工作是个好工作。我仍然可以在空余时间编程。 + +说起这个,工作与生活的平衡是我在新生活中最喜欢的事情。没有人在两份合同之间给我酬劳,但是我可以通过在业余项目中学习新东西来充分利用这一间隙。在一个漫长而又紧张的合同之后,我休息了一下,[进行了为期一个月的背包徒步旅行,探索了日本乡村][11]。这是我期待了很长时间的一次旅行,但是在入职 Google 之前我需要更多的钱,而在 Google 供职期间我又需要更多的时间。自营职业远非没有压力,也不是适合每一个人的,但是有的压力会让你感到死气沉沉,有的压力则会让你越发充满活力。于我而言,自主营生是第二种,我想说,和在 Google 时相比,过去的 5 年间我的压力总体上有所减轻。对于我来说,至少我能够诚实地说我不后悔当初加入 Google,也不后悔当初离开 Google。 + +-------------------------------------------------------------------------------- + +via: https://theartofmachinery.com/2020/08/04/leaving_google.html + +作者:[Simon Arneaud][a] +选题:[lujun9972][b] +译者:[JonnieWayy](https://github.com/JonnieWayy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://theartofmachinery.com +[b]: https://github.com/lujun9972 +[1]: https://mtlynch.io/why-i-quit-google/ +[2]: https://projecteuler.net +[3]: https://codingcompetitions.withgoogle.com/codejam +[4]: https://theartofmachinery.com/images/leaving_google/mori-tower.jpg +[5]: https://www.kalzumeus.com/2012/01/23/salary-negotiation/ +[6]: https://theartofmachinery.com/2019/03/19/hello_world_marketing.html +[7]: https://theartofmachinery.com/2016/03/28/dirtying_pure_functions_can_be_useful.html +[8]: https://theartofmachinery.com/2018/10/07/payrise_by_switching_jobs.html +[9]: https://www.safetytown.com.au/ +[10]: https://theartofmachinery.com/images/leaving_google/safetytown.png From 411212bb414ad8a16663190e713e3d89943d1282 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 13 Sep 2020 22:01:01 +0800 Subject: [PATCH 0095/1156] PRF @silentdawn-zz --- ...ks for secure battlefield communication.md | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/translated/talk/20200831 Military looks to ultraviolet networks for secure battlefield communication.md b/translated/talk/20200831 Military looks to ultraviolet networks for secure battlefield communication.md index 58911ea7f3..3fa7e1f83a 100644 --- a/translated/talk/20200831 Military looks to ultraviolet networks for secure battlefield communication.md +++ b/translated/talk/20200831 Military looks to ultraviolet networks for secure battlefield communication.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (silentdawn-zz) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Military looks to ultraviolet networks for secure battlefield communication) @@ -9,9 +9,10 @@ 美国军方正探索战场保密通信用紫外网络 ====== -美国军方想以开放空间传输的紫外线为载体,为士兵开发新的更安全的通讯网络。 -智库 +> 美国军方想以开放空间传输的紫外线为载体,为士兵开发新的更安全的通讯网络。 + +![](https://images.idgesg.net/images/article/2018/02/security_safety_guarding_mobile_laptop_endpoint_protection_thinkstock_906578404-100750806-large.jpg) 美国军方研究者之所以探索战场环境下的紫外光通信的应用,是因为这种技术可能实现敌对方无法侦测的通信。 @@ -21,11 +22,9 @@ 这个研究由美军作战能力发展司令部 [军队研究实验室][2] 主导,其重点是开发一个基础架构,为未来研究提供可量化环境,在该环境下,己方既可以使用紫外通信,也能够避免敌对方的侦测。研究过程中他们还有另外两个发现: - * 最差情况,即敌对方探测器与己方发射器在视线范围内,但右方接收器不在视线范围内,问题不像想象中严重。 + * 最差情况,即敌对方探测器与己方发射器在视线范围内,但友方接收器不在视线范围内,问题不像想象中严重。 * 转换紫外线发射器的发射方向不是降低敌对方探测到通信信号可能性的有效方式。 - - 研究者计划分析下面四种场景,场景中涵盖了己方紫外发射器、友方接收器、敌对方探测器相对位置关系: * 友方接收器、敌对方探测器都在发射器的视线范围内。 @@ -33,17 +32,13 @@ * 敌对方探测器在发射器的视线范围内,但友方接收器不在视线范围内(最差条件)。 * 友方接收器、敌对方探测器均不在视线范围内。 - - 假定敌对方试图通过时域上的光子计数来发现相干通信信号,进而判定正在进行通信。 科学家们承认这么一个事实,即越靠近发射器,信号越容易被侦测。所以紫外通信中发射器的有效使用依赖于对敌对方探测器位置的准确感知。 -”我们提供了一个基础框架,使得对紫外通信系统实际可探测性与期望性能间差距的根本限制因素的研究得以进行。“ 研究者之一,Robert Drost 博士如是说。 +“我们提供了一个基础框架,使得对紫外通信系统实际可探测性与期望性能间差距的根本限制因素的研究得以进行。” 研究者之一,Robert Drost 博士如是说。 -“我们的研究确保了团队O紫外波段用于通信的潜力及有限性有了根本上的理解。我坚信这种理解将影响到未来军队网络通信能力的发展。” - -欢迎通过 [Facebook][3] 和 [LinkedIn][4] 加入 Network World 社团,点评顶级话题。 +“我们的研究确保了团队对紫外波段用于通信的潜力及有限性有了根本上的理解。我坚信这种理解将影响到未来军队网络通信能力的发展。” -------------------------------------------------------------------------------- @@ -51,8 +46,8 @@ via: https://www.networkworld.com/article/3572372/military-looks-to-ultraviolet- 作者:[Patrick Nelson][a] 选题:[lujun9972][b] -译者:[silentdawn-zz](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[silentdawn-zz](https://github.com/silentdawn-zz) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From b0f85b76f036e6c68918609d824a6943ed38f12a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 13 Sep 2020 22:01:41 +0800 Subject: [PATCH 0096/1156] PUB @silentdawn-zz https://linux.cn/article-12611-1.html --- ...traviolet networks for secure battlefield communication.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20200831 Military looks to ultraviolet networks for secure battlefield communication.md (98%) diff --git a/translated/talk/20200831 Military looks to ultraviolet networks for secure battlefield communication.md b/published/20200831 Military looks to ultraviolet networks for secure battlefield communication.md similarity index 98% rename from translated/talk/20200831 Military looks to ultraviolet networks for secure battlefield communication.md rename to published/20200831 Military looks to ultraviolet networks for secure battlefield communication.md index 3fa7e1f83a..4e4c176e60 100644 --- a/translated/talk/20200831 Military looks to ultraviolet networks for secure battlefield communication.md +++ b/published/20200831 Military looks to ultraviolet networks for secure battlefield communication.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (silentdawn-zz) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12611-1.html) [#]: subject: (Military looks to ultraviolet networks for secure battlefield communication) [#]: via: (https://www.networkworld.com/article/3572372/military-looks-to-ultraviolet-networks-for-secure-battlefield-communication.html) [#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) From 9228849551377e82a5002d80c8082b070113e0ab Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Sun, 13 Sep 2020 22:50:17 +0800 Subject: [PATCH 0097/1156] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=AF=91=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...kage on CentOS-RHEL 7 and CentOS-RHEL 6.md | 84 +++++++++---------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/sources/tech/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md b/sources/tech/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md index 031984ff5c..32359f6117 100644 --- a/sources/tech/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md +++ b/sources/tech/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md @@ -7,38 +7,38 @@ [#]: via: (https://www.2daygeek.com/install-php-7-on-centos-6-centos-7-rhel-7-redhat-7/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -3 Methods to Install the Latest PHP 7 Package on CentOS/RHEL 7 and CentOS/RHEL 6 +在 CentOS/RHEL 7 和 CentOS/RHEL 6 上安装最新 PHP 7 软件包的 3 种方法 ====== -PHP is the most popular open-source general-purpose scripting language and is widely used for web development. +PHP 是最流行的开源通用脚本语言,被广泛用于 Web 开发。 -It’s part of the LAMP stack application suite and is used to create dynamic websites. +它是 LAMP 栈应用程序套件的一部分,用于创建动态网站。 -Popular CMS applications WordPress, Joomla and Drupal are developed in PHP language. +流行的 CMS 应用程序 WordPress,Joomla 和 Drupal 都是用 PHP 语言开发的。 -These applications require PHP 7 for their installation and configuration. +这些应用程序的安装和配置都需要 PHP 7。 -PHP 7 loads your web application faster and consumes less server resources. +PHP 7 可以更快地加载您的 Web 应用程序,并消耗更少的服务器资源。 -By default the CentOS/RHEL 6 operating system provides PHP 5.3 in their official repository and CentOS/RHEL 7 provides PHP 5.4. +在默认情况下,CentOS/RHEL 6 操作系统在其官方存储库中提供 PHP 5.3,而 CentOS/RHEL 7 则提供 PHP 5.4。 -In this article we will show you how to install the latest version of PHP on CentOS/RHEL 7 and CentOS/RHEL 6 systems. +在本文中,我们将向您展示如何在 CentOS/RHEL 7 和 CentOS/RHEL 6 系统上安装最新版本的 PHP。 -This can be done by adding the necessary **[additional third-party RPM repository][1]** to the system. +这可以通过在系统中添加必要的 **[附加第三方 RPM 存储库][1]** 来完成。 -### Method-1 : How to Install PHP 7 on CentOS 6/7 Using the Software Collections Repository (SCL) +### 方法-1:如何使用 软件集合存储库Software Collections Repository(SCL)在 CentOS 6/7 上安装 PHP 7 -The SCL repository is now maintained by a CentOS SIG, which rebuilds the Red Hat Software Collections and also provides some additional packages of their own. +现在,SCL 存储库由 CentOS SIG 维护,该组织不仅重新构建了 Red Hat Software Collections,还提供了自己的一些其他软件包。 -It contains newer versions of various programs that can be installed alongside existing older packages and invoked by using the scl command. +它包含各种程序的较新版本,这些程序可以与现有的旧软件包一起安装,并可以使用 scl 命令调用。 -Run the following **[yum command][2]** to install Software Collections Repository (SCL) on CentOS +要想在 CentOS 上安装软件集合存储库(SCL),请运行以下 **[yum 命令][2]** ``` # yum install centos-release-scl ``` -Run the following command to verify the PHP 7 version available in the scl repository. +运行以下命令可以验证 SCL 存储库中可用的 PHP 7 版本。 ``` # yum --disablerepo="*" --enablerepo="centos-sclo-rh" list *php @@ -54,21 +54,21 @@ rh-php71-php.x86_64 7.1.30-2.el7 centos-sclo-rh rh-php72-php.x86_64 7.2.24-1.el7 centos-sclo-rh ``` -Run the command below to install the PHP 7.2 on your system from scl. +运行以下命令可以从 scl 中安装 PHP 7.2 到你的系统中。 ``` # yum --disablerepo="*" --enablerepo="centos-sclo-rh" install rh-php72-php ``` -If you need to install additional modules for PHP 7.2, you can install them by running the command format below. For instance, you can install the **“gd”** and **“pdo”** packages by executing the command below. +如果需要为 PHP 7.2 安装其他模块,则可以通过运行以下命令格式来安装它们。 例如,您可以通过执行以下命令来安装 **“gd”** 和 **“pdo”** 软件包。 ``` # yum --disablerepo="*" --enablerepo="centos-sclo-rh" install rh-php72-php-gd rh-php72-php-pdo ``` -### Method-1a : How to Install PHP 7 on RHEL 7 Using the Software Collections Repository (SCL) +### 方法-1a:如何使用软件集合存储库(SCL)在 RHEL 7 上安装 PHP 7 -For Red Hat 7, enable the following repositories to install the latest PHP 7 package. +对于 Red Hat 7,启用以下存储库以安装最新的 PHP 7 软件包。 ``` # sudo subscription-manager repos --enable rhel-7-server-extras-rpms @@ -76,27 +76,27 @@ For Red Hat 7, enable the following repositories to install the latest PHP 7 pac # sudo subscription-manager repos --enable rhel-server-rhscl-7-rpms ``` -Run the command below to search the available PHP 7 version from the RHSCL repository. +运行以下命令从 RHSCL 库中搜索可用的 PHP 7 版本。 ``` # yum search rh-php* ``` -You can easily install PHP 7.3 on the RHEL 7 machine by running the command below from the RHSCL repository. +运行以下命令,您可以轻松地从 RHSCL 存储库中把 PHP7.3 安装到您的 RHEL 7 计算机上。 ``` # yum install rh-php73 ``` -### Method-2 : How to Install PHP 7 on CentOS 6/7 Using the Remi Repository +### 方法-2:如何使用 Remi 存储库在 CentOS 6/7 上安装 PHP 7 -The **[Remi repository][3]** stores and maintains the latest version of PHP packages with a large collection of libraries, extensions and tools. Some of them are back-ported from Fedora and EPEL. +**[Remi 存储库][3]** 存储和维护着最新版本的 PHP 软件包,其中包含大量的库,扩展和工具。 有一些是从 Fedora 和 EPEL 反向移植的。 -This is a CentOS community-recognized repository and doesn’t modify or affect any underlying packages. +这是 CentOS 社区认可的存储库,它不会修改或影响任何基础软件包。 -As a prerequisite, this installs the **[EPEL repository][4]** if it is not already installed on your system. +作为前提条件,如果您的系统上尚未安装 **[EPEL 存储库][4]**,该操作会首先安装它。 -You can easily find the available version of the PHP 7 package from the Remy repository because it adds a separate repo to each version. You can view them using the **[ls command][5]**. +您可以轻松地从 Remi 存储库中找到可用的 PHP 7 软件包版本,因为它会为每个版本添加一个单独的存储库。 您可以使用 **[ls 命令][5]** 查看它们。 ``` # ls -lh /etc/yum.repos.d/remi-php* @@ -109,41 +109,41 @@ You can easily find the available version of the PHP 7 package from the Remy rep -rw-r--r--. 1 root root 1.3K Sep 6 01:31 /etc/yum.repos.d/remi-php74.repo ``` -You can easily install PHP 7.4 on the CentOS 6/7 systems by running the command below from the remi repository. +运行以下命令,您可以轻松地从 Remi 存储库中把 PHP7.4 安装到您的 CentOS 6/7 计算机上。 ``` # yum --disablerepo="*" --enablerepo="remi-php74" install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo ``` -### Method-2a : How to Install PHP 7 on RHEL 7 Using the Remi Reposiotry +### 方法-2a:如何使用 Remi 存储库在 RHEL 7 上安装 PHP 7 -For Red Hat 7, install the following repositories to install the latest PHP 7 package. +对于 Red Hat 7,请安装以下存储库以安装最新的 PHP 7 软件包。 -To install EPEL Repository on RHEL 7 +在 RHEL 7 上安装 EPEL 存储库 ``` # yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm ``` -To install Remi Repository on RHEL 7 +在 RHEL 7 上安装 Remi 存储库 ``` # yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm ``` -To enable the optional RPMS repository. +启用可选的 RPMS 存储库。 ``` # subscription-manager repos --enable=rhel-7-server-optional-rpms ``` -You can easily install PHP 7.4 on the RHEL 7 systems by running the below command from the remi repository. +运行以下命令,可以轻松地从 remi 存储库中,把 PHP 7.4 安装在 RHEL 7 系统上。 ``` # yum --disablerepo="*" --enablerepo="remi-php74" install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo ``` -To verify the PHP 7 installation, run the following command +要验证 PHP 7 的安装版本,请运行以下命令 ``` # php -v @@ -153,19 +153,19 @@ Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies ``` -### Method-3 : How to Install PHP 7 on CentOS 6/7 Using the IUS Community Repository +### 方法-3:如何使用 IUS 社区存储库在 CentOS 6/7 上安装 PHP 7 -IUS Community is a CentOS Community Approved third-party RPM repository which contains latest upstream versions of PHP, Python, MySQL, etc.., packages for Enterprise Linux (RHEL & CentOS) 5, 6 & 7. +IUS 社区是 CentOS 社区批准的第三方 RPM 存储库,其中包含 PHP、Python、MySQL 等软件的最新上游版本,以及用于 Enterprise Linux(RHEL 和 CentOS)5、6 和 7 的软件包。 -**[IUS Community Repository][6]** have dependency with EPEL Repository so we have to install EPEL repository prior to IUS repository installation. Follow the below steps to install & enable EPEL & IUS Community Repository to RPM systems and install the packages. +**[IUS 社区存储库][6]** 与 EPEL 存储库具有依赖性,因此我们必须在安装 IUS 存储库之前先安装 EPEL 存储库。 请按照以下步骤将 EPEL 和 IUS 社区存储库安装并启用到 RPM 系统,然后再安装软件包。 -EPEL package is included in the CentOS Extras repository and enabled by default so, we can install this by running below command. +EPEL软件包包含在 CentOS Extras 存储库中,并默认启用,因此,我们可以通过运行以下命令来安装它。 ``` # yum install epel-release ``` -Download IUS Community Repository Shell script +下载 IUS 社区存储库的 Shell 脚本如下 ``` # curl 'https://setup.ius.io/' -o setup-ius.sh @@ -174,13 +174,13 @@ Download IUS Community Repository Shell script 100 1914 100 1914 0 0 6563 0 --:--:-- --:--:-- --:--:-- 133k ``` -Install/Enable IUS Community Repository. +安装/启用 IUS 社区存储库。 ``` # sh setup-ius.sh ``` -Run the following command to check available PHP 7 version in the IUS repository. +运行如下命来检查 IUS 存储库中可用的 PHP 7 版本。 ``` # yum --disablerepo="*" --enablerepo="ius" list *php7* @@ -200,7 +200,7 @@ php71u-devel.x86_64 7.1.33-1.el7.ius php71u-embedded.x86_64 7.1.33-1.el7.ius ius ``` -You can easily install PHP 7.3 on the CentOS 6/7 systems by running the command below from the IUS Community repository. +运行以下命令您可以轻松地从 IUS 存储库中安装 PHP 7.3 到你 CentOS 6/7 系统上。 ``` # yum --disablerepo="*" --enablerepo="ius" install php73-common php73-cli php73-gd php73-gd php73-mysqlnd php73-ldap php73-soap php73-mbstring @@ -212,7 +212,7 @@ via: https://www.2daygeek.com/install-php-7-on-centos-6-centos-7-rhel-7-redhat-7 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[gxlct008](https://github.com/gxlct008) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 68b9e8a043076519020b65249ba533f80c2c7b78 Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Sun, 13 Sep 2020 22:53:42 +0800 Subject: [PATCH 0098/1156] =?UTF-8?q?=E5=B0=86=E8=AF=91=E6=96=87=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E5=88=B0=20translated/tech/=20=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md (100%) diff --git a/sources/tech/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md b/translated/tech/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md similarity index 100% rename from sources/tech/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md rename to translated/tech/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md From 1c2b99d99e7818380e9a939587714df5b218f783 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 13 Sep 2020 22:55:34 +0800 Subject: [PATCH 0099/1156] PRF @geekpi --- ...es on Linux with this USB ID Repository.md | 42 ++++++++----------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/translated/tech/20200824 Recognize more devices on Linux with this USB ID Repository.md b/translated/tech/20200824 Recognize more devices on Linux with this USB ID Repository.md index 0857c71e62..adce9f89cf 100644 --- a/translated/tech/20200824 Recognize more devices on Linux with this USB ID Repository.md +++ b/translated/tech/20200824 Recognize more devices on Linux with this USB ID Repository.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Recognize more devices on Linux with this USB ID Repository) @@ -9,16 +9,17 @@ 利用这个 USB ID 仓库识别更多 Linux 上的设备 ====== -一个包含了所有已知 USB 设备 ID 的开源项目。 -![Multiple USB plugs in different colors][1] -市场上有成千上万的 USB 设备:键盘、扫描仪、打印机、鼠标和其他无数的设备都能在 Linux 上工作。它们的供应商详情都存储在 USB ID 仓库中。 +> 这是一个包含了所有已知 USB 设备 ID 的开源项目。 + +![](https://img.linux.net.cn/data/attachment/album/202009/13/225426zpfbfopxhjxomuxf.jpg) + +市场上有成千上万的 USB 设备:键盘、扫描仪、打印机、鼠标和其他无数的设备,都能在 Linux 上工作。它们的供应商详情都存储在 USB ID 仓库中。 ### lsusb Linux `lsusb` 命令列出了连接到系统的 USB 设备的信息,但有时信息不完整。例如,我最近注意到我的一个 USB 设备的品牌没有被识别。设备是可以使用的,但是在列出我所连接的 USB 设备的详情中没有提供任何识别信息。以下是我的 `lsusb` 命令的输出: - ``` $ lsusb Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub @@ -29,12 +30,11 @@ Bus 001 Device 005: ID 051d:0002 American Power Conversion Uninterruptible Power Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub ``` -正如你在最后一栏中看到的,有一个设备没有制造商描述。要确定这个设备是什么,我必须对我的 USB 设备树进行更深入的检查。幸运的是,`lsusb` 命令有更多的选项。其中一个选项是 `-D device`,来获取每个设备的详细信息,正如手册页面所解释的那样。 +正如你在最后一栏中看到的,有一个设备没有制造商描述。要确定这个设备是什么,我必须对我的 USB 设备树进行更深入的检查。幸运的是,`lsusb` 命令有更多的选项。其中一个选项是 `-D device`,来获取每个设备的详细信息,正如手册页面所解释的那样: -> “不会扫描 /dev/bus/usb 目录,而只显示给定设备文件所属设备的信息。设备文件应该是类似 /dev/bus/usb/001/001 这样的文件。这个选项会像 **v** 选项一样显示详细信息,但你必须是 root 用户才行。" - -我认为如何将设备路径传递给 lsusb 命令并不容易,但在仔细阅读手册页和初始输出后,我能够确定如何构造它。USB 设备驻留在 UDEV 文件系统中。它们的设备路径始于 USB 设备目录 `/dev/bus/usb/`。路径的其余部分由设备的总线 ID 和设备 ID 组成。我的非描述设备是 Bus 001、Device 002,被翻译成了 001/002,完成路径 `/dev/bus/usb/001/002`。现在我可以把这个路径传给 `lsusb`。我还会用管道传给 `more`,因为这里往往有很多信息: +> “不会扫描 `/dev/bus/usb` 目录,而只显示给定设备文件所属设备的信息。设备文件应该是类似 `/dev/bus/usb/001/001` 这样的文件。这个选项会像 `v` 选项一样显示详细信息,但你必须是 root 用户才行。" +我认为如何将设备路径传递给 `lsusb` 命令并不容易,但在仔细阅读手册页和初始输出后,我能够确定如何构造它。USB 设备驻留在 UDEV 文件系统中。它们的设备路径始于 USB 设备目录 `/dev/bus/usb/`。路径的其余部分由设备的总线 ID 和设备 ID 组成。我的无描述设备是 `Bus 001 Device 002`,被翻译成了 `001/002`,完成的路径为 `/dev/bus/usb/001/002`。现在我可以把这个路径传给 `lsusb`。我还会用管道传给 `more`,因为这里往往有很多信息: ``` $ lsusb -D /dev/bus/usb/001/002 |more @@ -78,17 +78,15 @@ Device Descriptor:         HID Device Descriptor: ``` -不幸的是,这里并没有提供我希望找到的细节。初始输出中出现的两个字段 `idVendor` 和 `idProduct` 都是空的。这里有些帮助,因为往下扫描一下,就会发现 **Mouse** 这个词。所以,这个设备就是我的鼠标。 +不幸的是,这里并没有提供我希望找到的细节。初始输出中出现的两个字段 `idVendor` 和 `idProduct` 都是空的。这有些帮助,因为往下看一下,就会发现 `Mouse` 这个词。所以,这个设备就是我的鼠标。 -## USB ID 仓库 +### USB ID 仓库 -这让我不禁想知道如何才能填充这些字段,不仅是为了自己,也是为了其他 Linux 用户。原来已经有了一个开源项目:[USB ID Repository][2]。它是一个公共仓库,它包含了 USB 设备中使用的所有已知 ID。它也被用于各种程序中,包括 [USB Utilities][3],用于显示人类可读的设备名称。 +这让我不禁想知道如何才能填充这些字段,不仅是为了自己,也是为了其他 Linux 用户。原来已经有了一个开源项目:[USB ID 仓库][2]。它是一个公共仓库,它包含了 USB 设备中使用的所有已知 ID。它也被用于各种程序中,包括 [USB Utilities][3],用于显示人类可读的设备名称。 ![The USB ID Repository Site][4] -(Alan Formy-Duval, [CC BY-SA 4.0][5]) - -你可以从网站上或通过下载数据库来浏览特定设备的仓库。也欢迎用户提交新的数据。这是我为我的鼠标做的,它是没有的。 +你可以从网站上或通过下载数据库来浏览特定设备的仓库。也欢迎用户提交新的数据。我要为我的鼠标提交数据,因为它没有在里面。 ### 更新你的 USB ID @@ -96,14 +94,12 @@ USB ID 数据库存储在一个名为 `usb.ids` 的文件中。这个文件的 在 Ubuntu 18.04 中,这个文件位于 `/var/lib/usbutils`。要更新数据库,使用命令 `update-usbids`,你需要用 root 权限或 `sudo` 来运行。 - ``` -`$ sudo update-usbids` +$ sudo update-usbids ``` 如果有新文件,它就会被下载。当前的文件将被备份,并被替换为新文件: - ``` $ ls -la total 1148 @@ -113,8 +109,7 @@ drwxr-xr-x 85 root root   4096 Nov  7 08:05 .. -rw-r--r--  1 root root 551472 Jan 15 00:34 usb.ids.old ``` -最新版本的 Fedora Linux 将数据库文件保存在 `/usr/share/hwdata` 中。而且,没有更新脚本。相反,数据库被维护在一个名为 `hwdata` 的包中。 - +最新版本的 Fedora Linux 将数据库文件保存在 `/usr/share/hwdata` 中。而且,没有更新脚本。而是,数据库由一个名为 `hwdata` 的软件包维护。 ``` # dnf info hwdata @@ -129,7 +124,7 @@ Source       : hwdata-0.332-1.fc31.src.rpm Repository   : @System From repo    : updates Summary      : Hardware identification and configuration data -URL          : +URL          : https://github.com/vcrhonek/hwdata License      : GPLv2+ Description  : hwdata contains various hardware identification and configuration data,              : such as the pci.ids and usb.ids databases. @@ -137,7 +132,6 @@ Description  : hwdata contains various hardware identification and configuratio 现在我的 USB 设备列表在这个之前未命名的设备旁边显示了一个名字。比较一下上面的输出: - ``` $ lsusb Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub @@ -162,8 +156,8 @@ via: https://opensource.com/article/20/8/usb-id-repository 作者:[Alan Formy-Duval][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 860884bf4a5576cdc06b28012d2b5732a79e4bfc Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 13 Sep 2020 22:57:11 +0800 Subject: [PATCH 0100/1156] PUB @geekpi https://linux.cn/article-12612-1.html --- ...gnize more devices on Linux with this USB ID Repository.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200824 Recognize more devices on Linux with this USB ID Repository.md (99%) diff --git a/translated/tech/20200824 Recognize more devices on Linux with this USB ID Repository.md b/published/20200824 Recognize more devices on Linux with this USB ID Repository.md similarity index 99% rename from translated/tech/20200824 Recognize more devices on Linux with this USB ID Repository.md rename to published/20200824 Recognize more devices on Linux with this USB ID Repository.md index adce9f89cf..ecd9d71005 100644 --- a/translated/tech/20200824 Recognize more devices on Linux with this USB ID Repository.md +++ b/published/20200824 Recognize more devices on Linux with this USB ID Repository.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12612-1.html) [#]: subject: (Recognize more devices on Linux with this USB ID Repository) [#]: via: (https://opensource.com/article/20/8/usb-id-repository) [#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) From 8a0bfb8d0a25d76314516c70511f1f903b138a1a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 13 Sep 2020 23:24:31 +0800 Subject: [PATCH 0101/1156] APL --- ...st Free Online Markdown Editors That Are Also Open Source.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200829 Best Free Online Markdown Editors That Are Also Open Source.md b/sources/tech/20200829 Best Free Online Markdown Editors That Are Also Open Source.md index 610ef22d20..8c1907c611 100644 --- a/sources/tech/20200829 Best Free Online Markdown Editors That Are Also Open Source.md +++ b/sources/tech/20200829 Best Free Online Markdown Editors That Are Also Open Source.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 28cbe1556b681d1bdd2b2b9d3c6a623ff4648bed Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Sun, 13 Sep 2020 23:43:27 +0800 Subject: [PATCH 0102/1156] =?UTF-8?q?=E7=94=B3=E9=A2=86=E5=8E=9F=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20200811 TCP window scaling, timestamps and SACK.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200811 TCP window scaling, timestamps and SACK.md b/sources/tech/20200811 TCP window scaling, timestamps and SACK.md index 547ae52677..01d10dfb4f 100644 --- a/sources/tech/20200811 TCP window scaling, timestamps and SACK.md +++ b/sources/tech/20200811 TCP window scaling, timestamps and SACK.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (gxlct008) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 4f3fa8f01a2c04642c219eab5c4a6b56ce6fff12 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 14 Sep 2020 00:05:25 +0800 Subject: [PATCH 0103/1156] TSL --- ...kdown Editors That Are Also Open Source.md | 188 ------------------ ...kdown Editors That Are Also Open Source.md | 188 ++++++++++++++++++ 2 files changed, 188 insertions(+), 188 deletions(-) delete mode 100644 sources/tech/20200829 Best Free Online Markdown Editors That Are Also Open Source.md create mode 100644 translated/tech/20200829 Best Free Online Markdown Editors That Are Also Open Source.md diff --git a/sources/tech/20200829 Best Free Online Markdown Editors That Are Also Open Source.md b/sources/tech/20200829 Best Free Online Markdown Editors That Are Also Open Source.md deleted file mode 100644 index 8c1907c611..0000000000 --- a/sources/tech/20200829 Best Free Online Markdown Editors That Are Also Open Source.md +++ /dev/null @@ -1,188 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Best Free Online Markdown Editors That Are Also Open Source) -[#]: via: (https://itsfoss.com/online-markdown-editors/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Best Free Online Markdown Editors That Are Also Open Source -====== - -[Markdown][1] is a useful lightweight [markup language][2] and a lot of people prefer for writing documentation or web publishing. Many of us at It’s FOSS use markdown for writing our articles. - -There are [several Markdown editors available for Linux][3] that you can install and use. - -But, what if you don’t want to install another program on your system? Perhaps you are using a system temporarily and cannot install an application? Maybe you just want a markdown editor that lets you collaborate in real-time? - -No matter what you require, online markdown editors makes a lot of things easy by providing collaboration features, publishing integration, notes synchronization, and some online-only features. - -Hence, I’ve compiled a list of the best online markdown editors. - -### Free Online Markdown Editors - -I have tried to keep the focus on online markdown editor with open source code. You may use the official website or deploy them on your server. - -**Note:** _The list is in no particular order of ranking._ - -#### 1\. StackEdit - -![][4] - -[StackEdit][5] is one of the most popular open-source online Markdown editors available. - -It provides a great user interface and offers a bunch of useful features. The ability to collaborate, synchronizing capability, and being able to publish/save your files to Blogger, WordPress, GitHub, and a couple other services are some key features that you get with StackEdit. - -Not to forget, you also get an extended markdown support some extensions available to support LaTeX mathematical expressions, UML diagrams, and more. It presents a WYSIWYG editor that makes it easy for you to work with Markdown. It also works offline and offers a chrome app and extension — if that’s your requirement. - -It’s easy to import/export files on StackEdit as well. You can take a look at its source code on [GitHub][6] for more details if you need to host it on your server. - -[StackEdit][7] - -#### 2\. Dillinger - -![][8] - -Dillinger is yet another interesting open-source online Markdown editor. Similar to StackEdit, you also get the ability to link and save the documents with Dropbox, GitHub, Medium, Google Drive, Bitbucket, and OneDrive. - -You can also choose to simply import/export files when needed. The user interface for Dillinger is simpler than what you get on StackEdit — but it gets the job intended. Unlike StackEdit, you may not get extended Markdown support with LaTeX expressions or diagrams but if you just need simple online Markdown editor, this is a good pick. - -If you need, you can choose to deploy it in a Docker container on your server. For more technical details on it, you might want to check out its [GitHub page][9]. - -[Dillinger][10] - -#### 3\. Write.as - -![][11] - -Write.as is based on the free and open source software [WriteFreely][12], developed by the same team. So you can simply host it on your own server and start using it for free if you want. - -You can also use Write.as service as a free online Markdown editor with basic features. To make the most out of it, you may want to choose a subscription. Some paid features include custom themes, newsletters, photo hosting, and multiple blogs. - -It supports Markdown and also lets anyone on [Mastodon][13], [ActivityPub][14], and [Pleroma][15] to follow and share your blog posts easily. - -You can explore more about WriteFreely on its [GitHub page][16] or get started using Write.as. - -[Write.as][17] - -#### 4\. Editor.md - -![][18] - -An interesting open-source Markdown editor that you can also embed on your own web pages if you require. - -It supports real-time preview, GitHub flavored markdown, and also presents a WYSIWYG editor along with a bunch of useful features. In addition to the basic Markdown support, it also supports emojis, LaTeX expressions, Flowchart, and more. - -You can choose to configure your own by hosting it yourself as well. Take a look at its [GitHub page][19] for more information. - -[Editor.md][20] - -#### 5\. CodiMD - -![][21] - -CodiMD isn’t available as a full-fledged online service from the get-go. But, it is an open-source project that lets you collaborate on documentations or notes in real-time by giving you the ability to host it on your server. - -It’s based on [HackMD][22]‘s source code and offers a [demo instance][23] to test it out. Personally, I like the fact that it also offers a dark mode and it’s easy to use. - -For its future release (at the time of writing this), it will be renamed as “**HedgeDoc**“. - -You can find all the relevant information on deploying it on your server through Docker/Kubernetes and other manual configuration options on its [GitHub page][24]. - -[CodiMD][25] - -#### 6\. Wri.pe - -![][26] - -Wri.pe is a simple open-source online Markdown editor that’s no longer maintained but it is still active and usable. - -It features real-time preview and the options to export or save your notes to Dropbox/Evernote. Considering that it’s not actively maintained — you may not rely on it but it works as expected when I tested it. - -You can take a look at its [GitHub page][27] or the official site to learn more about it. - -[Wri.pe][28] - -### Honorable Mentions - -Here are a few tools that provide markdown access. - -#### Markdown Web Dingus - -![][29] - -A simple and free online Markdown editor by the creator of Markdown language. It’s not a full-fledged online editor with integrations or that supports import/export. - -But, if you just want an online editor to get a preview for your Markdown source, this could be a great option to use. Not just limited to the editor, but you also get a syntax cheatsheet in the sidebar of the website. So, you can try and learn here as well. - -[Markdown Web Dingus][30] - -#### Markdown Journal - -![][31] - -[Markdown Journal][32] was an interesting open-source project on [GitHub][33] which has been discontinued. It gave you the ability to use its online editor to create journals using Markdown language and save them directly on your Dropbox account. I noticed Internal Server error when I tried to create a journal — but you can take a look at it. - -#### Etherpad - -![][34] - -[Etherpad][35] is yet another impressive open-source online editor but it doesn’t come with Markdown support out of the box. You might notice some plugins available to enable Markdown editing on your server — but that’s not something that works flawlessly yet. So, you might want to keep an eye out for it. There’s a list of [public instances][36] to try it out as well. - -### Wrapping Up - -Considering that a lot of online editors, CMSs, and note-taking services support Markdown, services/applications like [WordPress][37] can also be a good option if you want to publish it to the web. - -Which one do you prefer to use as a Markdown editor? Did I miss any of your favorites? Let me know in the comments below! - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/online-markdown-editors/ - -作者:[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://en.wikipedia.org/wiki/Markdown -[2]: https://en.wikipedia.org/wiki/Markup_language -[3]: https://itsfoss.com/best-markdown-editors-linux/ -[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/stackedit-screenshot.png?resize=800%2C396&ssl=1 -[5]: https://itsfoss.com/stackedit-markdown-editor/ -[6]: https://github.com/benweet/stackedit -[7]: https://stackedit.io/ -[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/dillinger-screenshot.jpg?resize=800%2C390&ssl=1 -[9]: https://github.com/joemccann/dillinger -[10]: https://dillinger.io/ -[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/write-as-screenshot.jpg?resize=800%2C505&ssl=1 -[12]: https://writefreely.org/ -[13]: https://itsfoss.com/mastodon-open-source-alternative-twitter/ -[14]: https://en.wikipedia.org/wiki/ActivityPub -[15]: https://pleroma.social/ -[16]: https://github.com/writeas/writefreely -[17]: https://write.as/ -[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/editor-md-screenshot.jpg?resize=800%2C436&ssl=1 -[19]: https://github.com/pandao/editor.md -[20]: http://editor.md.ipandao.com/en.html -[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/codiMD.png?resize=800%2C525&ssl=1 -[22]: https://hackmd.io/ -[23]: https://demo.codimd.org/ -[24]: https://github.com/codimd/server -[25]: https://demo.codimd.org -[26]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/wri-pe-screenshot.jpg?resize=800%2C558&ssl=1 -[27]: https://github.com/masuidrive/open-wripe -[28]: https://wri.pe/ -[29]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/markdown-web-dingus.jpg?resize=800%2C616&ssl=1 -[30]: https://daringfireball.net/projects/markdown/dingus -[31]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/08/markdown-journal.jpg?resize=800%2C656&ssl=1 -[32]: https://markdownjournal.com/ -[33]: https://github.com/maciakl/MarkdownJournal -[34]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/08/etherpad-public-instance.png?resize=800%2C556&ssl=1 -[35]: https://etherpad.org/ -[36]: https://github.com/ether/etherpad-lite/wiki/Sites-that-run-Etherpad-Lite -[37]: https://wordpress.com/ diff --git a/translated/tech/20200829 Best Free Online Markdown Editors That Are Also Open Source.md b/translated/tech/20200829 Best Free Online Markdown Editors That Are Also Open Source.md new file mode 100644 index 0000000000..af22401caf --- /dev/null +++ b/translated/tech/20200829 Best Free Online Markdown Editors That Are Also Open Source.md @@ -0,0 +1,188 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Best Free Online Markdown Editors That Are Also Open Source) +[#]: via: (https://itsfoss.com/online-markdown-editors/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +免费的开源在线 Markdown 编辑器 +====== + +[Markdown][1] 是一种有用的轻量级[标记语言][2],很多人喜欢用它来编写文档或网页发布。很多人都使用 Markdown 来写文章。 + +有[几个适用于 Linux 的 Markdown 编辑器][3],你可以安装并使用。 + +但是,如果你不想在你的系统上安装另一个程序怎么办?也许你暂时使用一个系统,无法安装一个应用程序?也许你只是想要一个能让你实时协作的标记编辑器? + +无论你的需求是什么,在线 Markdown 编辑器通过提供协作功能、发布集成、笔记同步和一些在线功能,让很多事情变得简单。 + +因此,我整理了一份最好的在线 Markdown 编辑器列表。 + +### 免费的在线 Markdown 编辑器 + +我尽量把重点放在代码开源的在线 Markdown 编辑器上。你可以使用它们的官方网站或将其部署到你的服务器上。 + +注:本列表没有特定排名顺序。 + +#### 1、StackEdit + +![][4] + +[StackEdit][5] 是目前最流行的开源在线 Markdown 编辑器之一。 + +它提供了一个很好的用户界面,并提供了一堆有用的功能。协作能力、同步能力,以及能够将你的文件发布/保存到 Blogger,WordPress,GitHub 和其他一些服务是 StackEdit 的一些关键功能。 + +不要忘了,你还可以得到一个扩展的 Markdown 支持一些可用的扩展,以支持 LaTeX 数学表达式,UML 图等。它呈现了一个所见即所得的编辑器,让你轻松使用 Markdown。它还可以离线工作,并提供了一个 chrome 应用程序和扩展,如果你要的话。 + +在 StackEdit 上导入/导出文件也很容易。如果你需要在你的服务器上托管它,你可以看看它在 [GitHub][6] 上的源代码,了解更多细节。 + +- [StackEdit][7] + +#### 2、Dillinger + +![][8] + +Dillinger 是又一个有趣的开源在线 Markdown 编辑器。与 StackEdit 类似,你也可以与 Dropbox、GitHub、Medium、Google Drive、Bitbucket 和 OneDrive 链接并保存文件。 + +你也可以选择在需要时简单地导入/导出文件。Dillinger 的用户界面比你在 StackEdit 上看到的更简单,但它也能达到工作的目的。与 StackEdit 不同的是,你可能得不到带有 LaTeX 表达式或图表的扩展 Markdown 支持,但如果你只是需要简单的在线 Markdown 编辑器,这是一个不错的选择。 + +如果你需要,你可以选择将它部署在服务器上的 Docker 容器中。关于它的更多技术细节,你不妨看看它的 [GitHub 页面][9]。 + +- [Dillinger][10] + +#### 3、Write.as + +![][11] + +Write.as 基于同一个团队开发的自由开源软件 [WriteFreely][12],所以你可以简单地把它托管在自己的服务器上,如果你愿意的话,就可以开始免费使用它。 + +你也可以使用 Write.as 服务作为一个具有基本功能的免费在线 Markdown 编辑器。为了使它发挥最大的作用,你可能想选择一份订阅。一些付费功能包括自定义主题、新闻通讯、照片托管和多个博客。 + +它支持 Markdown,还可以让 [Mastodon][13]、[ActivityPub][14] 和 [Pleroma][15] 上的任何人轻松关注和分享你的博客文章。 + +你可以在它的 [GitHub 页面][16]上探索更多关于 WriteFreely 的信息,或者使用 Write.as 开始。 + +- [Write.as][17] + +#### 4、Editor.md + +![][18] + +一个有趣的开源 Markdown 编辑器,如果你有需要,还可以嵌入到自己的网页上。 + +它支持实时预览、GitHub 风格的 Markdown,还呈现了一个所见即所得的编辑器以及一堆有用的功能。除了基本的 Markdown 支持外,它还支持 emojis、LaTeX 表达式、Flowchart 等。 + +你也可以选择自己托管来配置。更多信息请看它的 [GitHub 页面][19]。 + +- [Editor.md][20] + +#### 5、CodiMD + +![][21] + +CodiMD 从一开始就不是一个成熟的在线服务。但是,它是一个开源项目,通过给你在服务器上托管的能力,让你可以实时协作文档或笔记。 + +它基于 [HackMD][22] 的源代码,并提供了一个[演示实例][23]来测试它。我个人很喜欢它还提供了一个黑暗模式,而且它很容易使用。 + +对于它未来的发布(在写这篇文章的时候),它将改名为 “HedgeDoc”。 + +你可以在它的 [GitHub 页面][24]上找到所有关于通过 Docker/Kubernetes 在服务器上部署它的相关信息以及其他手动配置选项。 + +- [CodiMD][25] + +#### 6、Wri.pe + +![][26] + +Wri.pe 是一款简单的开源在线 Markdown 编辑器,虽然已经不再维护,但它仍然活跃且可用。 + +它的特点是实时预览和可选导出或保存你的笔记到 Dropbox/Evernote。考虑到它没有活跃维护,你可能不会依赖它,但当我测试它时,它的工作原理和预期一样。 + +你可以看看它的 [GitHub 页面][27]或官方网站来了解更多关于它的信息。 + +- [Wri.pe][28] + +### 附带提名 + +下面是一些提供 Markdown 访问的工具。 + +#### Markdown Web Dingus + +![][29] + +由 Markdown 语言的创造者提供的一个简单而免费的在线 Markdown 编辑器。它并不是一个成熟的在线编辑器,也不支持导入/导出, + +但是,如果你只是想要一个在线编辑器来预览你的 Markdown 代码,这可能是一个不错的选择。不仅仅局限于编辑器,你还可以在网站的侧边栏得到一个语法速查表。所以,你也可以在这里尝试和学习。 + +- [Markdown Web Dingus][30] + +#### Markdown Journal + +![][31] + +[Markdown Journal][32] 是 [GitHub][33] 上的一个有趣的开源项目,但已经停止了。它让你能够使用它的在线编辑器用 Markdown 语言创建日记,并直接保存在你的 Dropbox 账户上。当我试图创建日志时,我注意到内部服务器错误,但你可以看看它。 + +#### Etherpad + +![][34] + +[Etherpad][35] 是另一个令人印象深刻的开源在线编辑器,但它并没有开箱即用的 Markdown 支持。你可能会注意到一些插件可以在你的服务器上启用 Markdown 编辑,但那还不是完美无缺的东西。所以,你可能要留意一下它。有一个[公共实例][36]的列表,也可以尝试一下。 + +### 总结 + +考虑到很多在线编辑器、CMS 和记事本服务都支持 Markdown,如果你想把它发布到网络上,像 [WordPress][37] 这样的服务/应用也是一个不错的选择。 + +你更喜欢用哪个作为 Markdown 编辑器?我是否错过了你最喜欢的东西?请在下面的评论中告诉我 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/online-markdown-editors/ + +作者:[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://en.wikipedia.org/wiki/Markdown +[2]: https://en.wikipedia.org/wiki/Markup_language +[3]: https://itsfoss.com/best-markdown-editors-linux/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/stackedit-screenshot.png?resize=800%2C396&ssl=1 +[5]: https://itsfoss.com/stackedit-markdown-editor/ +[6]: https://github.com/benweet/stackedit +[7]: https://stackedit.io/ +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/dillinger-screenshot.jpg?resize=800%2C390&ssl=1 +[9]: https://github.com/joemccann/dillinger +[10]: https://dillinger.io/ +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/write-as-screenshot.jpg?resize=800%2C505&ssl=1 +[12]: https://writefreely.org/ +[13]: https://itsfoss.com/mastodon-open-source-alternative-twitter/ +[14]: https://en.wikipedia.org/wiki/ActivityPub +[15]: https://pleroma.social/ +[16]: https://github.com/writeas/writefreely +[17]: https://write.as/ +[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/editor-md-screenshot.jpg?resize=800%2C436&ssl=1 +[19]: https://github.com/pandao/editor.md +[20]: http://editor.md.ipandao.com/en.html +[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/codiMD.png?resize=800%2C525&ssl=1 +[22]: https://hackmd.io/ +[23]: https://demo.codimd.org/ +[24]: https://github.com/codimd/server +[25]: https://demo.codimd.org +[26]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/wri-pe-screenshot.jpg?resize=800%2C558&ssl=1 +[27]: https://github.com/masuidrive/open-wripe +[28]: https://wri.pe/ +[29]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/markdown-web-dingus.jpg?resize=800%2C616&ssl=1 +[30]: https://daringfireball.net/projects/markdown/dingus +[31]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/08/markdown-journal.jpg?resize=800%2C656&ssl=1 +[32]: https://markdownjournal.com/ +[33]: https://github.com/maciakl/MarkdownJournal +[34]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/08/etherpad-public-instance.png?resize=800%2C556&ssl=1 +[35]: https://etherpad.org/ +[36]: https://github.com/ether/etherpad-lite/wiki/Sites-that-run-Etherpad-Lite +[37]: https://wordpress.com/ From e7e9d71cc1cabb6eddc09e5123cfacb2ef399722 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 14 Sep 2020 05:01:33 +0800 Subject: [PATCH 0104/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200914?= =?UTF-8?q?=20Linux=20Jargon=20Buster:=20What=20is=20a=20Long=20Term=20Sup?= =?UTF-8?q?port=20(LTS)=20Release=3F=20What=20is=20Ubuntu=20LTS=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md --- ...pport (LTS) Release- What is Ubuntu LTS.md | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 sources/tech/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md diff --git a/sources/tech/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md b/sources/tech/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md new file mode 100644 index 0000000000..f750b6958b --- /dev/null +++ b/sources/tech/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux Jargon Buster: What is a Long Term Support (LTS) Release? What is Ubuntu LTS?) +[#]: via: (https://itsfoss.com/long-term-support-lts/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Linux Jargon Buster: What is a Long Term Support (LTS) Release? What is Ubuntu LTS? +====== + +In Linux world, specially when it comes to [Ubuntu][1], you’ll come across the term LTS (long term support). + +If you’re an experienced Linux user, you probably know the various aspects of a Linux distribution like an LTS release. But, new users or less tech-savvy users may not know about it. + +In this chapter of Linux Jargon Buster, you’ll learn about what is an LTS release for Linux distributions. + +### What is a Long Term Support (LTS) Release? + +Long-Term Support (LTS) release is normally associated with an application or an operating system for which you will get security, maintenance and (sometimes) feature updates for a longer duration of time. + +The LTS versions are considered to be the most stable releases which undergoes extensive testing and mostly includes years of improvements along the way. + +It is important to note that an LTS version of software does not necessarily involve feature updates unless there’s a newer LTS release. But, you will get the necessary bug fixes and security fixes in the updates of a Long Term Support version. + +An LTS release is recommended for production-ready consumers, businesses, and enterprises because you get years of software support and no system-breaking changes with software updates. + +If you notice a non-LTS release for any software, it is usually the bleeding-edge version of it with new features and a short span of support (say 6-9 months) when compared to 3-5 years of support on an LTS release. + +![][2] + +To give you more clarity on LTS and non-LTS releases, let’s take a look at some pros and cons of choosing an LTS release. + +#### Pros of LTS releases + + * Software updates with security and maintenance fixes for a long time (5 year support for Ubuntu). + * Extensive testing + * No system-breaking changes with software updates + * You get plenty of time to prep your system for the next LTS release + + + +#### Cons of LTS releases + + * Does not offer the latest and greatest features + * You may miss out on the latest hardware support + * You may also miss out on the latest application upgrades + + + +Now, that you know what is an LTS release and its pros and cons it’s time to know about Ubuntu’s LTS release. Ubuntu is one of the most popular Linux distribution and one of the few distributions that has both LTS and non-LTS releases. + +This is why I decided to dedicate an entire section to it. + +### What is Ubuntu LTS? + +Ubuntu has a non-LTS release every six months and a LTS release every 2 years since 2006 and that’s not going to change. + +The latest LTS release is — [Ubuntu 20.04][3] and it will be supported until **April 2025**. In other words, Ubuntu 20.04 will receive software updates till then. The non-LTS releases are supported for nine months only. + +You will always find an Ubuntu LTS release to be labelled as “**LTS**“. At least, when it comes to the [official Ubuntu website][4] to explore the latest Ubuntu releases. + +To give you some clarity, if you notice Ubuntu 16.04 LTS, that means — it was **released back in April 2016 and is supported until 2021** (considering **5 years of software updates**). + +Similarly, you can guess the update support for each Ubuntu LTS release by considering the next **5 years** of its release date for software support. + +### Ubuntu LTS software updates: What does it include? + +![][5] + +Ubuntu LTS versions receive security and maintenance updates for the lifecycle of their release. Unless the release reaches the [End of Life][6], you will get all the necessary security and bug fixes. + +You will not notice any functional upgrades in an LTS release. So, if you want to try the latest experimental technologies, you may want to upgrade your Ubuntu release to a non-LTS release. + +I’d suggest you to refer our latest [Ubuntu upgrade guide][7] to know more about upgrading Ubuntu. + +I would also recommend you to read our article on [which Ubuntu version to install][8] to clear your confusion on different Ubuntu flavours available like [Xubuntu][9] or [Kubuntu][10] and how are they different. + +I hope you have a better understanding of the term LTS now specially when it comes to Ubuntu LTS. Stay tuned for more Linux jargon explainers in the future. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/long-term-support-lts/ + +作者:[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://ubuntu.com/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/display-server-linux.png?resize=800%2C450&ssl=1 +[3]: https://itsfoss.com/download-ubuntu-20-04/ +[4]: https://ubuntu.com +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/ubuntu-lts-release.png?resize=800%2C397&ssl=1 +[6]: https://itsfoss.com/end-of-life-ubuntu/ +[7]: https://itsfoss.com/upgrade-ubuntu-version/ +[8]: https://itsfoss.com/which-ubuntu-install/ +[9]: https://xubuntu.org/ +[10]: https://kubuntu.org/ From 3b9ab24df5ac66415c884b821471d17a44ef1aac Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 14 Sep 2020 05:01:50 +0800 Subject: [PATCH 0105/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200913?= =?UTF-8?q?=20Overcoming=20resistance=20to=20open=20management?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200913 Overcoming resistance to open management.md --- ...vercoming resistance to open management.md | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 sources/tech/20200913 Overcoming resistance to open management.md diff --git a/sources/tech/20200913 Overcoming resistance to open management.md b/sources/tech/20200913 Overcoming resistance to open management.md new file mode 100644 index 0000000000..016106361c --- /dev/null +++ b/sources/tech/20200913 Overcoming resistance to open management.md @@ -0,0 +1,58 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Overcoming resistance to open management) +[#]: via: (https://opensource.com/open-organization/20/9/overcoming-resistance-open-management) +[#]: author: (Heidi Hess von Ludewig https://opensource.com/users/heidi-hess-von-ludewig) + +Overcoming resistance to open management +====== +In some organizations, a cultural aversion to openness is strong. How +can managers overcome it—and create a new sense of shared purpose on +their teams? +![Tug of war][1] + +In this installment of our "[Managing with Open Values][2]" series, I chat again with Braxton, Director of Pricing for a nationwide U.S. insurance company and people manager. + +In June 2018, Braxton reached out to Red Hatters in the Open Organization community. He wanted to learn more about how both he _and_ his team could work differently—using open values. We were happy to help. So I co-organized a workshop on [open organization principles][3] for Braxton and his team—and kept in touch afterward, so I could learn about his adventure in becoming more open. + +In this second interview (which includes collaborators Tracy Guiliani, [industrial/organizational psychologist and expert in associate engagement][4], and [Bryan Behrenshausen][5]), we explored what it was like to learn firsthand about open source values, and how to use them to transform an organization. In particular, we discussed the value of feedback, managing resistance to using open values, and how the management practice of creating shared purpose caused unexpected benefits for a team with dissimilar roles. It's another enlightening conversation, one that allowed us to witness—directly—how someone transformed Open Organization community-driven workshop material into dynamic change with benefits for him, his team, and his organization. + +One striking point to note is that the "journey to open" is complex and worthwhile. Braxton and his team must confront habituated cultural practices that constrict openness. To overcome this, they engage one habit at a time using community (what it means to be a member of an open team), collaboration (defining what each open values mean to them) and inclusivity (actively listening to dissenters and negotiating a solution or understanding). In other words, they _use_ open values to _create the use_ of open values among the team. + +"Being open" can’t be mandatory; it’s important to actively manage conflicts within the team regarding the miscommunication or misunderstanding of open values. + +Put another way: in order to _have_ open, you have to _be_ open. This is actually counterintuitive in conventional organizations. For example, Braxton articulates how "being open" can’t be mandatory; it’s important to actively manage conflicts within the team regarding the miscommunication or misunderstanding of open values. [Conflict, fortunately, is a necessary part of collaboration][6]; it's also the engine for negotiation and change if we allow it, so it's the natural place for translation and transition (i.e., growth) to occur. As Tracy points out during this conversation, when conflict is positive and well-managed, it becomes a force for developing support, increased trust, and psychological safety—which can all reinforce shared purpose. + +Listen to the rest of this interview to learn: + + * How Braxton inspired shared purpose in through open values on his team, using consistent and regular feedback (including being open to negative feedback)  + * How he found himself coming back to the theme of "transparency" to help the team develop specific open values, resulting in faster and clearer communication + * The impact of resistance or late adopters to the open values among his team, the difference between misunderstanding and miscommunication, and the clarification of value to change—working through differences and conflict + * Whether Braxton thinks he would have the same results from his team if he'd chosen to manage _without_ open values as his guides. + + + +Listen to the interview with Braxton + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/9/overcoming-resistance-open-management + +作者:[Heidi Hess von Ludewig][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://opensource.com/users/heidi-hess-von-ludewig +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LIFE_information_wants_to_be.jpg?itok=keUyg1RH (Tug of war) +[2]: https://opensource.com/open-organization/managing-with-open-values +[3]: https://github.com/open-organization/open-org-definition +[4]: https://opensource.com/open-organization/20/5/commitment-engagement-org-psychology +[5]: https://opensource.com/users/bbehrens +[6]: https://opensource.com/open-organization/19/5/productive-arguments From 01bff1e038f7d6ba4fda98eb0aa4d7ba11e6303a Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 14 Sep 2020 08:54:31 +0800 Subject: [PATCH 0106/1156] translated --- ... WiFi from the Terminal in Ubuntu Linux.md | 201 ------------------ ... WiFi from the Terminal in Ubuntu Linux.md | 201 ++++++++++++++++++ 2 files changed, 201 insertions(+), 201 deletions(-) delete mode 100644 sources/tech/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md create mode 100644 translated/tech/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md diff --git a/sources/tech/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md b/sources/tech/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md deleted file mode 100644 index ce3de67e93..0000000000 --- a/sources/tech/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md +++ /dev/null @@ -1,201 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Connect to WiFi from the Terminal in Ubuntu Linux) -[#]: via: (https://itsfoss.com/connect-wifi-terminal-ubuntu/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -How to Connect to WiFi from the Terminal in Ubuntu Linux -====== - -_**In this tutorial, you’ll learn how to connect to wireless network from the terminal in Ubuntu. This is particularly helpful if you are using Ubuntu server where you don’t have access to the regular [desktop environment][1].**_ - -I primarily use desktop Linux on my home computers. I also have multiple Linux servers for hosting It’s FOSS and related websites and open source software like [Nextcloud][2], [Discourse][3], Ghost, Rocket Chat etc. - -I use [Linode][4] for quickly deploying Linux servers in cloud in minutes. But recently, I installed [Ubuntu server on my Raspberry Pi][5]. This is the first time I installed a server on a physical device and I had to do extra stuff to connect Ubuntu server to WiFi via command line. - -In this tutorial, I’ll show the steps to connect to WiFi using terminal in Ubuntu Linux. You should - - * not be afraid of using terminal to edit files - * know the wifi access point name (SSID) and the password - - - -### Connect to WiFi from terminal in Ubuntu - -![][6] - -It is easy when you are using Ubuntu desktop because you have the GUI to easily do that. It’s not the same when you are using Ubuntu server and restricted to the command line. - -Ubuntu uses [Netplan][7] utility for easily configuring networking. In Netplan, you create YAML file with the description of network interface and with the help of the netplan command line tool, you generate all the required configuration. - -Let’s see how to connect to wireless networking from the terminal using Netplan. - -#### Step 1: Identify your wireless network interface name - -There are several ways to identify your network interface name. You can use the ip command, the deprecated ipconfig command or check this file: - -``` -ls /sys/class/net -``` - -This should give you all the available networking interface (Ethernet, wifi and loopback). The wireless network interface name starts with ‘w’ and it is usually named similar to wlanX, wlpxyz. - -``` -[email protected]:~$ ls /sys/class/net -eth0 lo wlan0 -``` - -Take a note of this interface name. You’ll use it in the next step. - -#### Step 2: Edit the Netplan configuration file with the wifi interface details - -The Netplan configuration file resides in /etc/netplan directory. If you check the contents of this directory, you should see files like 01-network-manager-all.yml or 50-cloud-init.yaml. - -If it is Ubuntu server, you should have cloud-init file. For desktops, it should be network-manager file. - -The Network Manager on the Linux desktop allows you to choose a wireless network. You may hard code the wifi access point in its configuration. This could help you in some cases (like suspend) where connection drops automatically. - -Whichever file it is, open it for editing. I hope you are a tad bit [familiar with Nano editor][8] because Ubuntu comes pre-installed with it. - -``` -sudo nano /etc/netplan/50-cloud-init.yaml -``` - -YAML files are very sensitive about spaces, indention and alignment. Don’t use tabs, use 4 (or 2, whichever is already used in the YAML file) spaces instead where you see an indention. - -Basically, you’ll have to add the following lines with the access point name (SSID) and its password (usually) in quotes: - -``` -wifis: - wlan0: - dhcp4: true - optional: true - access-points: - "SSID_name": - password: "WiFi_password" -``` - -Again, keep the alignment as I have shown or else YAML file won’t be parsed and it will throw an error. - -Your complete configuration file may look like this: - -``` -# This file is generated from information provided by the datasource. Changes -# to it will not persist across an instance reboot. To disable cloud-init's -# network configuration capabilities, write a file -# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following: -# network: {config: disabled} -network: - ethernets: - eth0: - dhcp4: true - optional: true - version: 2 - wifis: - wlan0: - dhcp4: true - optional: true - access-points: - "SSID_name": - password: "WiFi_password" -``` - -I find it strange that despite the message that changes will not persist across an instance reboot, it still works. - -Anyway, generate the configuration using this command: - -``` -sudo netplan generate -``` - -And now apply this: - -``` -sudo netplan apply -``` - -If you are lucky, you should have network connected. Try to ping a website or run apt update command. - -However, things may not go as smooth and you may see some errors. Try some extra steps if that’s the case. - -#### Possible troubleshooting - -It is possible that when you use the netplan apply command, you see an error in the output that reads something like this: - -``` -Failed to start netplan-wpa-wlan0.service: Unit netplan-wpa-wlan0.service not found. -Traceback (most recent call last): - File "/usr/sbin/netplan", line 23, in - netplan.main() - File "/usr/share/netplan/netplan/cli/core.py", line 50, in main - self.run_command() - File "/usr/share/netplan/netplan/cli/utils.py", line 179, in run_command - self.func() - File "/usr/share/netplan/netplan/cli/commands/apply.py", line 46, in run - self.run_command() - File "/usr/share/netplan/netplan/cli/utils.py", line 179, in run_command - self.func() - File "/usr/share/netplan/netplan/cli/commands/apply.py", line 173, in command_apply - utils.systemctl_networkd('start', sync=sync, extra_services=netplan_wpa) - File "/usr/share/netplan/netplan/cli/utils.py", line 86, in systemctl_networkd - subprocess.check_call(command) - File "/usr/lib/python3.8/subprocess.py", line 364, in check_call - raise CalledProcessError(retcode, cmd) -subprocess.CalledProcessError: Command '['systemctl', 'start', '--no-block', 'systemd-networkd.service', 'netplan-wpa-wlan0.service']' returned non-zero exit status 5. -``` - -It is possible that wpa_supplicant service is not running. Run this command: - -``` -sudo systemctl start wpa_supplicant -``` - -Run netplan apply once again. If it fixes the issue well and good. Otherwise, [shutdown your Ubuntu system][9] using: - -``` -shutdown now -``` - -Start your Ubuntu system again, log in and generate and apply netplan once again: - -``` -sudo netplan generate -sudo netplan apply -``` - -It may show warning (instead of error) now. It is warning and not an error. I checked the [running systemd services][10] and found that netplan-wpa-wlan0.service was already running. Probably it showed the warning because it was already running and ‘netplan apply’ updated the config file (even without any changes). - -``` -Warning: The unit file, source configuration file or drop-ins of netplan-wpa-wlan0.service changed on disk. Run 'systemctl daemon-reload' to reload units. -``` - -It is not crtical and you may check that the internet is probably working already by running apt update. - -I hope you were able to connect to wifi using the command line in Ubuntu with the help of this tutorial. If you are still facing trouble with it, do let me know in the comment section. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/connect-wifi-terminal-ubuntu/ - -作者:[Abhishek Prakash][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/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/what-is-desktop-environment/ -[2]: https://itsfoss.com/nextcloud/ -[3]: https://www.discourse.org/ -[4]: https://itsfoss.com/recommends/linode/ -[5]: https://itsfoss.com/install-ubuntu-server-raspberry-pi/ -[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/connect-to-wifi-from-terminal-ubuntu.png?resize=800%2C450&ssl=1 -[7]: https://netplan.io/ -[8]: https://itsfoss.com/nano-editor-guide/ -[9]: https://itsfoss.com/schedule-shutdown-ubuntu/ -[10]: https://linuxhandbook.com/systemd-list-services/ diff --git a/translated/tech/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md b/translated/tech/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md new file mode 100644 index 0000000000..1209596c8a --- /dev/null +++ b/translated/tech/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md @@ -0,0 +1,201 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Connect to WiFi from the Terminal in Ubuntu Linux) +[#]: via: (https://itsfoss.com/connect-wifi-terminal-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Ubuntu Linux 中在终端连接 WiFi? +====== + +_**在本教程中,你将学习如何在 Ubuntu 中从终端连接到无线网络。如果你在使用 Ubuntu 服务器时,无法访问常规的[桌面环境][1],这将对你非常有帮助。**_ + +我的家用电脑主要使用桌面 Linux。我也有多台 Linux 服务器用于托管 It's FOSS 和相关网站以及开源软件,如 [Nextcloud][2]、[Discourse][3]、Ghost、Rocket Chat 等。 + +我使用 [Linode][4] 在云端几分钟内快速部署 Linux 服务器。但最近,我在我的 Raspberry Pi 上安装了 [Ubuntu 服务器][5]。这是我第一次在物理设备上安装服务器,我不得不做一些额外的事情来通过命令行将 Ubuntu 服务器连接到 WiFi。 + +在本教程中,我将展示在 Ubuntu Linux 中使用终端连接到 WiFi 的步骤。你应该: + + * 不要害怕使用终端编辑文件。 + * 知道 wifi 接入点名称 (SSID) 和密码。 + + + +### 在 Ubuntu 中从终端连接到 WiFi + +![][6] + +当你使用 Ubuntu 桌面时,这是很容易的,因为你有图形用户界面,可以很容易地做到这一点。但当你使用 Ubuntu 服务器时就不一样了,因为你只能使用命令行。 + +Ubuntu 使用 [Netplan][7] 工具来轻松配置网络。在 Netplan 中,你可以创建一个包含网络接口描述的 YAML 文件,然后在 netplan 命令行工具的帮助下,生成所有需要的配置。 + +让我们看看如何使用 Netplan 从终端连接到无线网络。 + +#### 步骤 1:确定你的无线网络接口名称 + +有几种方法可以识别你的网络接口名称。你可以使用 ip 命令、过时的 ipconfig 命令或查看这个文件: + +``` +ls /sys/class/net +``` + +这应该会展示所有可用的网络接口(以太网、wifi 和环回)。无线网络接口名称以 “w” 开头,通常命名为类似 wlanX、wlpxyz。 + +``` +[email protected]:~$ ls /sys/class/net +eth0 lo wlan0 +``` + +记下这个接口名。你将在下一步使用它。 + +#### 步骤 2:编辑 Netplan 配置文件中的 wifi 接口详细信息 + +Netplan 配置文件在 /etc/netplan 目录下。如果你查看这个目录的内容,你应该看到类似 01-network-manager-all.yml 或 50-cloud-init.yaml 等文件。 + +如果是 Ubuntu 服务器,你应该有 loud-init 文件。如果是台式机,应该是 network-manager 文件。 + +Linux 桌面上的 Network Manager 允许你选择一个无线网络。你可以在它的配置中对 wifi 接入点硬编码。这可以在自动掉线的情况下(比如挂起)时帮助到你。 + +不管是哪个文件,都可以打开编辑。我希望你对 Nano 编辑器有一点[熟悉][8],因为 Ubuntu 预装了它。 + +``` +sudo nano /etc/netplan/50-cloud-init.yaml +``` + +YAML 文件对空格、缩进和对齐方式非常敏感。不要使用制表符,在看到缩进的地方使用4 个(或 2 个,以 YAML 文件中已经使用的为准)空格代替。 + +基本上,你需要添加以下几行,引号中是接入点名称 (SSID) 和密码(通常): + +``` +wifis: + wlan0: + dhcp4: true + optional: true + access-points: + "SSID_name": + password: "WiFi_password" +``` + +再说一次,保持我所展示的对齐方式,否则 YAML 文件不会被解析,它会抛出一个错误。 + +你的完整配置文件可能是这样的: + +``` +# This file is generated from information provided by the datasource. Changes +# to it will not persist across an instance reboot. To disable cloud-init's +# network configuration capabilities, write a file +# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following: +# network: {config: disabled} +network: + ethernets: + eth0: + dhcp4: true + optional: true + version: 2 + wifis: + wlan0: + dhcp4: true + optional: true + access-points: + "SSID_name": + password: "WiFi_password" +``` + +我觉得很奇怪,尽管有消息说更改不会在实例重启后存在,但它仍然有效。 + +不管怎样,用这个命令生成配置: + +``` +sudo netplan generate +``` + +现在应用它: + +``` +sudo netplan apply +``` + +如果你幸运的话,你应该连上网络。尝试 ping 一个网站或运行 apt 更新命令。 + +然而,事情可能不会那么顺利,你可能会看到一些错误。如果是这种情况,请尝试一些额外的步骤。 + +#### 可能的故障排除 + +当你使用 netplan apply 命令时,你有可能在输出中看到类似这样的错误。 + +``` +Failed to start netplan-wpa-wlan0.service: Unit netplan-wpa-wlan0.service not found. +Traceback (most recent call last): + File "/usr/sbin/netplan", line 23, in + netplan.main() + File "/usr/share/netplan/netplan/cli/core.py", line 50, in main + self.run_command() + File "/usr/share/netplan/netplan/cli/utils.py", line 179, in run_command + self.func() + File "/usr/share/netplan/netplan/cli/commands/apply.py", line 46, in run + self.run_command() + File "/usr/share/netplan/netplan/cli/utils.py", line 179, in run_command + self.func() + File "/usr/share/netplan/netplan/cli/commands/apply.py", line 173, in command_apply + utils.systemctl_networkd('start', sync=sync, extra_services=netplan_wpa) + File "/usr/share/netplan/netplan/cli/utils.py", line 86, in systemctl_networkd + subprocess.check_call(command) + File "/usr/lib/python3.8/subprocess.py", line 364, in check_call + raise CalledProcessError(retcode, cmd) +subprocess.CalledProcessError: Command '['systemctl', 'start', '--no-block', 'systemd-networkd.service', 'netplan-wpa-wlan0.service']' returned non-zero exit status 5. +``` + +可能是 wpa_supplicant 服务没有运行。运行这个命令: + +``` +sudo systemctl start wpa_supplicant +``` + +再次运行 netplan apply。如果它能解决这个问题,那就太好了。否则,使用下面的命令[关闭 Ubuntu 系统][9]: + +``` +shutdown now +``` + +重新启动 Ubuntu 系统,登录并再次生成和应用 netplan: + +``` +sudo netplan generate +sudo netplan apply +``` + +现在可能会显示警告(而不是错误)。这是警告而不是错误。我检查了[正在运行的 systemd 服务][10],发现 netplan-wpa-wlan0.service 已经在运行了。可能是因为它已经在运行了,而且 “netplan apply” 更新了配置文件(即使没有任何改变),所以显示了警告。 + +``` +Warning: The unit file, source configuration file or drop-ins of netplan-wpa-wlan0.service changed on disk. Run 'systemctl daemon-reload' to reload units. +``` + +这并不重要,你可以通过运行 apt update 来检查网络是否已经正常工作。 + +我希望你能够在本教程的帮助下,在 Ubuntu 中使用命令行连接到 wifi。如果你仍然遇到困难,请在评论区告诉我。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/connect-wifi-terminal-ubuntu/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/what-is-desktop-environment/ +[2]: https://itsfoss.com/nextcloud/ +[3]: https://www.discourse.org/ +[4]: https://itsfoss.com/recommends/linode/ +[5]: https://itsfoss.com/install-ubuntu-server-raspberry-pi/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/connect-to-wifi-from-terminal-ubuntu.png?resize=800%2C450&ssl=1 +[7]: https://netplan.io/ +[8]: https://itsfoss.com/nano-editor-guide/ +[9]: https://itsfoss.com/schedule-shutdown-ubuntu/ +[10]: https://linuxhandbook.com/systemd-list-services/ From ed64593ae62cb472ef9b13a2008f630845d7126f Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 14 Sep 2020 09:01:00 +0800 Subject: [PATCH 0107/1156] translating --- ...-s How to Investigate and Fix Long Shutdown Time in Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md b/sources/tech/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md index c3929cf387..9107a4d319 100644 --- a/sources/tech/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md +++ b/sources/tech/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From bc0ff8cc0cb41749ff2a31acd198d1840a0c5a99 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 14 Sep 2020 15:21:35 +0800 Subject: [PATCH 0108/1156] Rename sources/tech/20200913 Overcoming resistance to open management.md to sources/talk/20200913 Overcoming resistance to open management.md --- .../20200913 Overcoming resistance to open management.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200913 Overcoming resistance to open management.md (100%) diff --git a/sources/tech/20200913 Overcoming resistance to open management.md b/sources/talk/20200913 Overcoming resistance to open management.md similarity index 100% rename from sources/tech/20200913 Overcoming resistance to open management.md rename to sources/talk/20200913 Overcoming resistance to open management.md From 2448af765a4b5789f48680f11e0e3ce9d100be53 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 14 Sep 2020 23:12:02 +0800 Subject: [PATCH 0109/1156] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @JonnieWayy 辛苦了! --- .../20200804 Leaving Google- Five Years On.md | 86 ++++++++++--------- 1 file changed, 44 insertions(+), 42 deletions(-) diff --git a/translated/talk/20200804 Leaving Google- Five Years On.md b/translated/talk/20200804 Leaving Google- Five Years On.md index b93d845c25..3bbc2fb889 100644 --- a/translated/talk/20200804 Leaving Google- Five Years On.md +++ b/translated/talk/20200804 Leaving Google- Five Years On.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (JonnieWayy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Leaving Google: Five Years On) @@ -10,107 +10,109 @@ 离开 Google:五年以来 ====== -大约五年前的今天,我上交了 Google 员工证,然后走出来悉尼 Google 办公室,开启了一段自谋职业的崭新生活。我认为我应该详述一下这个故事,因为我通过阅读 [Michael Lynch][1] 的作品而收获颇丰。正如你所看到的,我仍然花费了几年时间才开始考虑写这篇文章,但是最终我告诉自己,倘若我不在五周年纪念日写它,我就永远也不会写了。 +![](https://img.linux.net.cn/data/attachment/album/202009/14/231115kqsf6q25s25ms66m.jpg) -这篇文章有点儿长,但是我希望它对那些对于在大型技术公司工作感兴趣的新开发人员或是想要离职的大型企业雇员能够有所帮助。我将谈谈我进入 Google,在 Google 工作,以及退出 Google 的故事,还有我自开始以来所做的事情。尽管我已经写了很多博文,但是如果想知道更多关于某事的细节的话,随时可以提问,因此我无法立即保证任何深入的事情。 +大约五年前的今天,我上交了 Google 员工证,然后走出了悉尼 Google 办公室,开启了一段自谋职业的崭新生活。我认为我应该详述一下这个故事,因为我通过阅读 [Michael Lynch][1] 的作品而收获颇丰。正如你所看到的,我仍然花费了几年时间才开始考虑写这篇文章,但是最终我告诉自己,倘若我不在五周年纪念日写它,我就永远也不会写了。 + +这篇文章有点儿长,但是我希望它对那些对于在大型技术公司工作感兴趣的新开发人员或是想要离职的大型企业雇员能够有所帮助。我将谈谈我进入 Google,在 Google 工作和辞职的故事,以及之后我做了什么。如果你想了解更多的细节,可以随时询问,不过我已经有很多博文要写,所以不能保证有什么深入的内容。 同样地,冒着显而易见的劳工风险:我已经有 5 年不在 Google 工作了,所以请不要以这个故事来作为当今 Google 或是 Google 雇员经历全貌的字面描述。但是,我认为其中的许多内容仍然与一般性的技术职业有关。 ### 通往 Google 的艰辛道路 -2005 年,我获得了第一份有偿编程工作,是在当地的电力公司工作,采用一些旧的 Pascal 代码并使其能够在另一款具有不同编译器的操作系统上运行。这基本上只是我为了挣外快而做的暑期工,同年我还刚刚开始攻读我数学和物理的学位。他们很高兴有一个本科生能够胜任这份工作。我被这些大人吓了一跳,因为他们不仅只是对我的编程爱好感兴趣,而且真的还会为此给我钱。 +2005 年,我获得了第一份带薪的编程工作,是在当地的电力公司工作,把一些旧的 Pascal 代码用不同的编译器在不同的操作系统上运行。这基本上只是我为了挣外快而做的暑期工,同年我还刚刚开始攻读我数学和物理的学位。他们很高兴有一个本科生能够胜任这份工作。我被这些大人吓了一跳,因为他们不仅只是对我的编程爱好感兴趣,而且真的还会为此给我钱。 -直到 2007 年毕业以前,我一直在做类似的工作。我喜欢编程工作,而 Google 是一家从事着很酷的编程工作的很酷的公司,因此我申请了实习。 Google 的面试过程以困难而著称,所以我花了好几个星期时间练习了所有我在网上能够找到的 Google 面试题。我认为 13 年里面试流程并没有发生太大的变化 —— 我提交了简历,受邀参加了几轮电话面试,这些面试问的几乎都是算法问题(我记得有一个动态规划问题和一个分治几何问题)。我通过了最初的几轮面试,然后受邀前往悉尼接受了由 Google 的工程师们进行的为期一天的现场面试。我回到家里,等待 Google HR 的电话,这个过程漫长得像是有一辈子。我被拒绝了。 +直到 2007 年毕业以前,我一直在做类似的工作。我喜欢编程工作,而 Google 是一家从事着很酷的编程工作的很酷的公司,因此我申请了实习。 Google 的面试过程以困难而著称,所以我花了好几个星期时间练习了所有我在网上能够找到的 Google 面试题。我认为 13 年里面试流程并没有发生太大的变化 —— 我提交了简历,受邀参加了几轮电话面试,这些面试问的几乎都是算法问题(我记得有一个动态规划问题和一个分治几何问题)。我通过了最初的几轮面试,然后受邀前往悉尼接受了由 Google 的工程师们进行的为期一天的现场面试。我回到家里,等待 Google HR 的电话,这个过程漫长得像是有一辈子。我被拒绝了。 -对于我们收到的拒绝和失败感到难过很自然,因此我们并不会经常谈及它们。但是出于同样的原因,其他人也不会去谈论他们自己的失败,这只会使得情况变得更加糟糕。当我后来真的进入 Google 时,我觉得作为一个此前被拒绝过的人,我一定有哪里做得不对,但是有一天我和一群同事坐在一张桌子旁,开始交谈。那时候我才发现,实际上我身边的很多人都至少被拒绝过一次。我甚至都不是“最差的”。有个家伙开玩笑说,他肯定是因为 Google HR 厌倦了拒绝他才得以进来的。我也在谈论一些相当令人印象深刻的工程师 —— 有些人负责着我一直在用的代码,而我打赌你也在用。 +对于我们收到的拒绝和失败感到难过很自然,因此我们并不会经常谈及它们。但是出于同样的原因,其他人也不会去谈论他们自己的失败,这只会使得情况变得更加糟糕。当我后来真的进入 Google 时,我觉得作为一个此前被拒绝过的人,我一定有哪里做得不对,但是有一天我和一群同事坐在一张桌子旁,开始交谈。那时候我才发现,实际上我身边的很多人都至少被拒绝过一次。我甚至都不是“最差的”。有个家伙开玩笑说,他肯定是因为 Google HR 厌倦了拒绝他才得以进来的。我说的也是一些相当厉害的工程师 —— 有些人负责着我一直在用的代码,而我打赌你也在用。 -进行面试的公司通常会为每个名额面试两名或更多的候选人。这意味着比起录用,会有更多的拒绝,所以普通的面试参与者被拒绝的可能性要大于被录用。然而我们一直忘记了这一点。四个开发人员参加面试,一个被录用了,其他三个在社交媒体上抱怨这场面试充满了缺陷,因为他们被拒绝了。当然,面试远非完美,但是我们需要停止如此个人化地谈论它们。 +进行面试的公司通常会为每个名额面试两名或更多的候选人。这意味着比起录用,会有更多的拒绝,所以一般面试参与者被拒绝的可能性要大于被录用。然而我们一直忘记了这一点。四个开发人员参加面试,一个被录用了,其他三个在社交媒体上抱怨这场面试是如何的漏洞百出,因为他们个人被拒绝了。当然,面试远非完美,但是我们需要停止如此个人化地谈论它。 -只要你能够找到问题所在并知道如何去改进自己,拒绝和失败就没有那么糟糕。 Google 的面试主要针对算法,我在其中磕磕拌拌地摸索,但绝对没有能够脱颖而出。 +只要你能够找到问题所在并知道如何去改进自己,拒绝和失败就没有那么糟糕。Google 的面试主要针对算法,我在其中磕磕拌拌地摸索,但绝对没有能够脱颖而出。 -在被 Google 拒绝以后,我得到了两样东西,并进行了为期一年的休假。第一件东西是 Australian Business Number ( ABN ),我用它来做数学与科学课程,以及技术工作合同。我获得的另一样东西是一张大学科技图书馆的借书证。我当时并不打算再次去参加 Google 的面试,但是那次的面试经历告诉我还有很多东西是我所不知道的。我会在图书馆开设课程,并在期间阅读书籍。顺便说一句,有些人认为我为我的学费业务所做的所有这些财务工作和其他东西很奇怪,而大多数导数都只收现金。但是我学到了许多对我日后生活很有帮助的东西,所以我一点儿都不后悔。 +在被 Google 拒绝以后,我得到了两样东西,并进行了为期一年的休假。第一件东西是澳大利亚商务编号(ABN),我用它来提供数学与科学补习课程,以及技术工作合同。我获得的另一样东西是一张大学科技图书馆的借书证。我当时并不打算再次去参加 Google 的面试,但是那次的面试经历告诉我还有很多东西是我所不知道的。我就在图书馆开设课程给大家做辅导,并在期间阅读书籍。顺便说一句,有些人认为我为我的补习业务所做的所有这些财务工作和其他东西很奇怪,而大多数补习老师都只收现金。但是我学到了许多对我日后生活很有帮助的东西,所以我一点儿都不后悔。 -2009 年,我进行了一个数学荣誉年(又称学士学位四年级),基于一名由魔术师转行的名叫 Persi Diaconis 的数学家的工作。计算机科学系让我将他们的算法单元之一作为其中的一部分。 +2009 年,我根据一个叫 Persi Diaconis 的魔术师转行为数学家的作品,进行了一个数学荣誉课程(也就是学士学位四年级)。计算机科学系让我选修他们的一个算法单元作为其中的一部分。 -就像我所说的那样,我本来并没有打算再去 Google 面试,但是让我快速地讲讲这是怎么发生的。我从高中就开始学习日语,因此在 2012 年,我决定尝试住在东京。这基本上行得通,除了我犯了一个相当大的错误 —— 我没有任何日语方面的纸质资质证明,因此很难获得工作面试。最终,我的一个已经被 Google 录用的朋友建议我再试一次。与 Google 所有的办事处一样, Google Tokyo 的官方商务语言是英语,因此他们不要求我具有日语资质证明。 +就像我所说的那样,我本来并没有打算再去 Google 面试,但是让我快速地讲讲这是怎么发生的。我从高中就开始学习日语,因此在 2012 年,我决定尝试在东京生活。这基本上行得通,除了我犯了一个相当大的错误 —— 我没有任何日语方面的纸质资质证明,因此很难获得工作面试。最终,我的一个已经被 Google 录用的朋友建议我再试一次。与 Google 所有的办事处一样, Google 东京的官方商务语言是英语,因此他们不要求我具有日语资质证明。 ### Google 面试,再一次 -我的朋友向 Google HR 推荐了我。这绝对有帮助,但是如果你自己得到了被推荐的机会,也不要太过于兴奋。它所能够确保的是你的简历会被注意到(不太过潦草)并且免去一次电话面试,但你仍然得通过剩下的电话面试和现场面试。 +我的朋友向 Google HR 推荐了我。这绝对有帮助,但是如果你自己得到了被推荐的机会,也不要太过于兴奋。它所能够确保的是你的简历会被注意到(不是小事)并且免去一次电话面试,但你仍然得通过剩下的电话面试和现场面试。 这一次我用来自 [Project Euler][2] 和 [Google CodeJam][3] 的题进行练习。电话面试过程中,我不得不在 Google Doc 上进行一些在线编程,这有点儿尴尬,但是除此以外电话面试一切顺利。然后我受邀前往六本木的 Mori Tower 办公室进行了为期一天的现场面试。 ![Mori Tower in Tokyo, where I interviewed for Google. It's the sixth tallest building in the city, which means it's huge. \(Photo from here.\)][4] -我的首个面试非常糟糕。我的脑子僵住了。我知道我能够解出那些题目,但是直到面试官走出房间我才想出答案。我立刻就感到很放松,并且意识到这是一个三元搜索问题。这是在是很令人沮丧,但是我觉得继续前进,看看剩下的面试进展如何。 +我的首个面试非常糟糕。我的脑子僵住了。我知道我能够解出那些题目,但是直到面试官走出房间我才想出答案。我立刻就感到很放松,并且意识到这是一个三元搜索问题。这是在是很令人沮丧,但是我觉得继续前进,看看剩下的面试进展如何。 -其中的两次面试很糟糕。其中之一直至今日仍然是我遇到过的最糟糕的面试问题。面试官说:“你用同一输入运行一个程序两次,得到了两个不同的结果。告诉我这是为什么。”我回答道:“当这种情况在现代计算机上发生而且并不在我的预期之中时,通常是竞态条件。”他只说:“不,这不是竞态条件。”然后看着我等着我的下一个回答。如果他有兴趣讨论一下的话,这个问题本该是一个很棒的问题,但是很显然他实际上只想玩“猜猜神秘数”。对于我所说的几乎全部内容,他只是回答:“不。”显然,该程序完全是确定性的,不存储任何状态,并且不依赖于环境(例如磁盘或是实时时钟),但却在每次执行时都给出不同的结果。我怀疑我们对于“被存储的状态”或是“环境”的含义还是某些东西有着不同的理解,但是我无法区分。有一次(变得绝望了)我试着问电子元件的温度变化是否会有影响,而他说:“不,那会是一个竞态条件,我已经告诉过你这不是竞态条件了。”最终,面试结束了,而我仍然不知道那个秘密数字是什么。 +其中的两道面试题很糟糕。其中之一直至今日仍然是我遇到过的最糟糕的面试问题。面试官说:“你用同一输入运行一个程序两次,得到了两个不同的结果。告诉我这是为什么。”我回答道:“当这种情况在现代计算机上发生而且并不在我的预期之中时,通常是竞态条件。”他只说:“不,这不是竞态条件。”然后看着我等着我的下一个回答。如果他有兴趣讨论一下的话,这个问题本该是一个很棒的问题,但是很显然他实际上只想玩“猜猜神秘数”。对于我所说的几乎全部内容,他只是回答:“不。”显然,该程序完全是确定性的,不存储任何状态,并且不依赖于环境(例如磁盘或是实时时钟),但却在每次执行时都给出不同的结果。我怀疑我们对于“被存储的状态”或是“环境”的含义还是某些东西有着不同的理解,但是我无法区分。有一次(变得绝望了)我试着问电子元件的温度变化是否会有影响,而他说:“不,那会是一个竞态条件,我已经告诉过你这不是竞态条件了。”最终,面试结束了,而我仍然不知道那个秘密数字是什么。 -我将这个故事的原因是,我听说过许多更为温和的恐怖故事,用以证明面试官是憎恶面试者的坏人。然而,与流行的刻板印象所相反的是,当天的大多数面试基本上都还可以,面试官也很友好并且很尊重人。面试也着实很困难,因此最好减少面试官的工作量。希望那个“猜数字”面试官从 Google HR 那里得到的反馈是,他的问题对于作出聘用决定没什么帮助。 +我讲这个故事的原因是,我听说过许多更为平淡的恐怖故事,用以证明面试官是憎恶面试者的坏人。然而,与流行的刻板印象所相反的是,当天的大多数面试基本上都还可以,面试官也很友好并且很尊重人。面试也着实很困难,因此最好减少面试官的工作量。希望那个“猜数字”面试官从 Google HR 那里得到的反馈是,他的问题对于作出聘用决定没什么帮助。 -这次,面试带来了一份要约,但是有一个小问题:这份工作在悉尼,担任站点可靠性工程师( SRE )。我以前从未听说过 SRE,但是我和一位悉尼的资深 SRE 通了电话,他解释说他注意到了我在天然气行业从事嵌入式工程的经历,并且认为 SRE 会和适合我,由于类似的可靠性与拟合紧密约束方面的重心。 +这次,面试带来了一份要约,但是有一个小问题:这份工作在悉尼,担任站点可靠性工程师(SRE)。我以前从未听说过 SRE,但是我和一位悉尼的资深 SRE 通了电话,他解释说他注意到了我在天然气行业从事嵌入式工程的经历,并且认为 SRE 会和适合我,因为同样强调可靠性与拟合紧密约束。 -在东京花了大约一年时间来建立起自己的生活,我不想抛弃一切然后搬到悉尼,但是我绝不可能会拒绝一份来自 Google 的要约。与招聘人员交谈时,我确实犯了一个非常愚蠢的错误:我被问到当时能赚多少钱,然后我就脱口而出。[别这么做。][5] 这意味着在面试中发生了什么事情,或是你上一份工作中你的工资有多低,等等都无关紧要。你可能会被拒绝,或者会在原来的薪水基础上得到一些象征性的提升,并且如果你试图进一步协商,会被认为疯狂而又不合理。就我而言,我的收入甚至远远低于 Google 的入门级职位。我无法肯定地说这就是整个故事,但是在 2013 年我搬到了悉尼,在 Google Maps 成为了一名新毕业生级别的 SRE。 +在东京花了大约一年时间来建立起自己的生活,我不想抛弃一切然后搬到悉尼,但是我绝不可能会拒绝一份来自 Google 的要约。与招聘人员交谈时,我确实犯了一个非常愚蠢的错误:我被问到当时能赚多少钱,然后我就脱口而出。[别这么做][5]。这意味着不管在面试中发生了什么事情,或是你上一份工作中被底薪了多少,或者其它什么。你可能会被拒绝,或者会在原来的薪水基础上得到一些象征性的提升,并且如果你试图进一步协商,会被认为疯狂而又不合理。就我而言,我的收入甚至远远低于 Google 的入门级职位。我无法肯定地说全是这样,但是在 2013 年我搬到了悉尼,在 Google Maps 成为了一名新毕业生级别的 SRE。 -### Google Maps SRE 在悉尼 +### 悉尼的 Google Maps SRE -像 Maps 这样的产品实际上是若干个软件项目,每一个都有自己的开发人员团队。甚至诸如路线查找之类的功能实际上也涉及多个软件项目 —— 从交通时刻表数据收集,到线路计算,再到结果渲染,等等等等。 SRE 的工作包含两个方面:一方面是为各个项目提供待命,实时响应任何生产事故;另一方面(在无需救火时)则是将生产事故中所积攒的经验应用到其他项目中去,并且发现其中可能出错的方式,或是发现使其性能更好的机会。 Google 的 SRE 还需要像开发人员的内部咨询小组一样,对部署实践、自动化、监控或是类似的问题提供咨询。 +像 Maps 这样的产品实际上是若干个软件项目,每个都有自己的开发人员团队。甚至诸如路线查找之类的功能实际上也是多个软件项目 —— 从交通时刻表数据收集,到线路计算,再到结果渲染,等等等等。 SRE 的工作包含两个方面:一方面是为各个项目提供待命,实时响应任何生产事故;另一方面(在无需救火时)则是将生产事故中所积攒的经验应用到其他项目中去,并且发现其中可能出错的方式,或是发现使其性能更好的机会。Google 的 SRE 还需要像开发人员的内部咨询小组一样,对部署实践、自动化、监控或是类似的问题提供咨询。 -这项工作相当紧张。作为一个团队,我们每周至少需要处理一次生产事故,否则就要承担更多服务的责任。每个礼拜,悉尼的所有 SRE 都会聚在一起,交流发生过的故障事件或是有关如何使事情更好地运转的新技巧。学习曲线感觉就像是再次成为了一名本科生。 +这项工作相当紧张。作为一个团队,我们每周至少需要处理一次生产事故,否则就要为更多的服务提供支持。每个礼拜,悉尼的所有 SRE 都会聚在一起,交流发生过的故障事件或是有关如何使事情更好地运转的新技巧。学习曲线的感觉就像是再次成为了一名本科生。 -我有时会感到震惊,听说我选择离开 Google 的人会问:“但是你不会想念这些好处吗?!”物质上的好处(例如伙食等等)绝对很棒,但是他们是你可以买到的东西,因此,不,他们不是我所想念的东西。如果你问我所想念的是什么,我会说是在那里工作的人们。与你可能听说过的不同,自大的人不喜欢在 Google 之类的地方工作。有一个臭名昭著的有关一个自恋者的故事,他在 Google 找了份工作,并假装自己是各方面的顶级专家,让自己尴尬不已。他待了不到半年就离开了。总的来说,与我工作过的其他地方相比,这里的文化在傲慢、指责以及政治方面很少。另一方面, Google 并没有垄断好同事。 +我有时会感到震惊,听说我选择离开 Google 的人会问:“但是你不会想念那些福利吗?!”物质上的福利(例如伙食等等)绝对很棒,但是它们是你可以买到的东西,因此,不,它们不是我所想念的东西。如果你问我所想念的是什么,我会说是在那里工作的人们。与你可能听说过的不同,傲慢的人不喜欢在 Google 之类的地方工作。有一个臭名昭著的故事,一个自恋的人在 Google 找了份工作,并假装自己是各方面的顶级专家,让自己尴尬不已。他待了不到半年就离开了。总的来说,与我工作过的其他地方相比,这里的文化在傲慢、指责以及政治方面很少。另一方面,Google 并没有垄断好同事。 -不过,在有一种公司,政治是个大问题。晋升需要“展示影响”,而众所周知的是,要做到这一点最简单的方法是发布一些新事物(不是惟一的方法,但是最简单)。结果是 Googler 们比起改进现有的解决方案,对于推广他们自己质量一流的原型方案更感兴趣。在 SRE 之间,我们经常开玩笑说, Google内部有两种软件:运行良好但是已经过时甚至不被考虑使用的旧东西,以及现如今正在作为 100% 官方工具使用的热门新东西,即使它们还尚未能正常运行,作为 SRE,我们经常亲眼看到新的热点事物出了什么问题(有时甚至在脱离 alpha 之前它就已经成了过时的旧东西)。([我此前已经对这类事物进行了更为深入的讨论。][6]) +不过,有一种公司政治是个大问题。晋升需要“展示影响”,而众所周知的是,要做到这一点最简单的方法是发布一些新事物(不是惟一的方法,但是最简单)。结果是 Googler 们比起改进现有的解决方案,对于推广他们自己内测品质的原型方案更感兴趣。在 SRE 之间,我们经常开玩笑说, Google 内部有两种软件:一种是老的东西,工作得很好,但已经废弃了,甚至连考虑使用都是不够谷歌化的;另一种是热门的新东西,尽管它们还不能用,但却是今天 100% 可以使用的官方工具。作为 SRE,我们经常亲眼看到新的热点事物出了什么问题(有时甚至在没出 alpha 之前它就已经成了过时的旧东西)。([我此前已经对这类事物进行了更为深入的讨论。][6]) -这不是我们愤世疾俗的 SRE 所想象的东西;这在公司中被公认为是一个问题,而我记得令人放心的是促销委员会已经开始通过维护工作等方式寻找关于其影响的证据。 +这不是我们这些愤世疾俗的 SRE 所想象的东西;这在公司中被公认为是一个问题,而我记得有人向我保证,晋升委员会已经开始通过维护工作等方式寻找关于其影响的证据。 ### 晋升申请 -2015 年,在 Google 工作了两年之后,我的经理告诉我,现在是时候申请一个高于我新毕业生水准的晋升了。晋升过程每两年一次由晋升委员会进行集中管理。你可以先提出申请,然后加上一份对你所从事过的项目的简短描述,再加上同事的推荐信。委员会将会进行审查,然后给你赞成或反对的意见。仅仅有你经理的推荐是不够的,因为你的经历有想让你获得晋升的动机。手下有高级别的员工有助于你自己的职业发展。 +2015 年,在 Google 工作了两年之后,我的经理告诉我,现在是时候申请一个高于我新毕业生水准的晋升了。晋升过程是每年两次由晋升委员会进行集中管理的。你可以先提出申请,然后加上一份对你所从事过的项目的简短描述,再加上同事的推荐信。委员会将会进行审查,然后给你赞成或反对的意见。仅仅有你经理的推荐是不够的,因为你的经理有想让你获得晋升的动机。手下有高级别的员工有助于你自己的职业发展。 -长话短说,我提交了我的申请,而委员会说不。事实上,这是个相当糟糕的拒绝。我不记得详细的答复了,但感觉就像是委员会在我的申请中寻找可以轻视的东西。例如,我从事过的一个项目是一个内部工具,它建立起了功能需求的积压。我查看了这个项目,发现根本问题在于它已经超出了构建它的键值存储,需要一个合适的数据库。我主张切换到关系数据库,并实现了它:模式、数据迁移、查询、实时站点迁移等等。新查询的速度要快得多,而且(更重要的是)可以有效地支持新功能。在进行迁移之前,我必须要解决的一个问题是大部分代码没有被测试所覆盖,而这是由于大部分的代码都不可测试。我使用依赖注入以及[我此前讨论过的其他技巧][7]重构了代码,而这使我能够构建一组回归测试套件。我记得这个项目主要是因为测试单元的编写是“新毕业生水平的工作”而被驳回。 +长话短说,我提交了我的申请,而委员会说不。事实上,这是个相当糟糕的拒绝。我不记得详细的答复了,但感觉就像是委员会在我的申请中寻找可以不屑一顾的东西。例如,我从事过的一个项目是一个内部工具,它出现了功能需求的积压。我查看了这个项目,发现根本问题在于它已经超出了构建它的键值存储,需要一个合适的数据库。我主张切换到关系数据库,并实现了它:模式、数据迁移、查询、实时站点迁移等等。新查询的速度要快得多,而且(更重要的是)可以有效地支持新功能。在进行迁移之前,我必须要解决的一个问题是大部分代码没有被测试所覆盖,而这是由于大部分的代码都不可测试。我使用依赖注入以及[我此前讨论过的其他技巧][7]重构了代码,而这使我能够构建一组回归测试套件。我记得这个项目被驳回主要是被评价为测试单元的编写是“新毕业生水平的工作”。 我的经理真的很支持我,并且写了上诉。他没有给我看,但是我认为这是可以被缩减成 “WTF” 的若干页(更雄辩而详尽地论述)。以下是一些我也认为这一回复有点 “WTF” 的原因: -Google SRE 有一种“关键人物( point-personship )”的概念。一个项目的关键人物有两个角色:一个是比起其他 SRE 对于软件项目有着更为深入的了解,以便你能够回答他们可能会提出的问题;另一个角色是作为开发人员在项目本身上的第一联络点,以便他们能够获得对所有 SRE 问题的回答。 Google 的职业阶梯指南说,毕业生水准并不需要扮演关键人物,但是看起来很适合晋升。正如我在申请中所写的,我是三个项目的关键人物。 +Google SRE 有一种“关键人物”的概念。一个项目的关键人物有两个角色:一个是比起其他 SRE 对于软件项目有着更为深入的了解,以便你能够回答他们可能会提出的问题;另一个角色是作为项目本身的开发人员的第一联络人,以便他们的所有 SRE 问题都能得到回答。 Google 的职业阶梯指南说,关键人物不应该处于“新毕业生水准”,而应该晋升。正如我在申请中所写的,我是三个项目的关键人物。 -我的关键人物经历使得想要找到同意支持我的晋升申请的资深开发人员很容易。当他们发现我是新毕业生级别时都十分震惊。他们都同意支持我的申请,假设我已经处在了一个更高的级别。 +我的关键人物经历使得想要找到同意支持我的晋升申请的资深开发人员很容易。当他们发现我是新毕业生级别时都十分震惊。他们都同意支持我的申请,认可我已经处在了一个更高的级别。 -在我的申请之中,我提到曾担任过一组新毕业实习生的导师。当我提出申请时,他们之中的许多人都已经被聘用为了长期雇员。我足够资深,可以去担任他们的导师,但是还绝不足以晋升到比他们更高的级别。 +在我的申请之中,我提到曾担任过一组新毕业实习生的导师。当我提出申请时,他们之中的许多人都已经被聘用为了正式雇员。我足够资深,可以去担任他们的导师,但是还绝不足以晋升到比他们更高的级别。 -给我经理上诉的回复与原始评论截然不同。这次,我“大大超出了对于我新毕业生级别工作的期望”,但是问题在于他们需要稍多一些时间来确保我能够晋升到新毕业生加一的级别。我被告知在接下来的 6 个月时间里,倘若我能够继续超出预期,知道下一个晋升周期,也许那时我就会得到晋升。上诉结束了;这就是最终结果。 +给我经理上诉的回复与最初的审查截然不同。这次,我“大大超出了对于我‘新毕业生’级别工作的期望”,但是问题在于他们需要稍多一些时间来确保我能够晋升到新毕业生加一的级别。我被告知在接下来的 6 个月时间里,倘若我能够继续超出预期,直到下一个晋升周期,也许那时我就会得到晋升。上诉结束了;这就是最终结果。 -我写了一封电子邮件,表示我正在采取另一种选择。就像许多科技公司一样, Google 也有员工持股计划。在开始工作时,你会得到一笔象征性的补助金,而在各个“投资”里程碑时刻,你会收到真正的股份。我的下一次股票投资实在几个月之后。从那以后,我将不再为 Google 工作。 +我写了一封电子邮件,表示我要采取另一种选择。就像许多科技公司一样, Google 也有员工持股计划。在开始工作时,你会得到一笔象征性的补助金,而在各个“投资”里程碑时刻,你会收到真正的股份。我的下一次股票授予是在几个月之后。从那以后,我将不再为 Google 工作。 ### 我离开的原因 -辞职的决定并不容易,而某天你或许会面临同样的抉择。以下是一些有助于我作出决定的因素。([我在以前的一篇贴子里对一些这类想法进行了更深入的解释。][8]) +任何辞职的决定并不容易,而某天你或许会面临同样的抉择。以下是一些有助于我作出决定的因素。([我在以前的一篇贴子里对一些这类想法进行了更深入的解释。][8]) -如果你思考一下,考虑到我并不是字面意义上真正的应届毕业生, Google 的评价应该是这样的:“你正在做一些非常错误的事情。”在 X、 Y 还有 Z 方面有所改进之前,你根本不会得到晋升。被告知“你远远超出了预期,但是我们还需要 6 个月左右的时间”,这是毫无道理的。没有人关注我是否有能力做好我的工作。我得到了许多接口,但是没有能够帮助我提高的任何有用反馈。(注意:有时候你必须要明确地要求反馈。经理们可能会陷入捍卫自己所给出的绩效评级的陷阱,而不会去考虑报告是否需要反馈。) +如果你思考一下,考虑到我并不是字面意义上真正的应届毕业生, Google 的评价应该是这样的:“你正在做一些非常错误的事情。在 X、 Y 还有 Z 方面有所改进之前,你根本不会得到晋升。”被告知“你远远超出了预期,但是我们还需要 6 个月左右的时间”,这是毫无道理的。没有人关注我是否有能力做好我的工作。我得到了许多借口,但是没有能够帮助我提高的任何有用反馈。(注意:有时候你必须要明确地要求反馈。经理们可能会陷入捍卫自己所给出的绩效评级的陷阱,而不会去考虑报告是否需要反馈。) -我也不确定晋升委员会会在 6 个月里看到什么他们在已经过去的 2 年时间里都没有看到的问题。他们为什么不会在要求 6 个月时间呢?如果我需要花上多年时间来证明自己以获得新毕业生加一的级别晋升,那么我升到新毕业生加二的时候得有多老呢? +我也不确定晋升委员会会在 6 个月里看到什么他们在已经过去的 2 年时间里都没有看到的问题。他们难保不会再要求 6 个月时间?如果我需要花上多年时间来证明自己以获得新毕业生加一的级别晋升,那么我升到新毕业生加二的时候得有多老呢? -刚加入 Google 时,我的工作级别无关紧要,因为我当时学到了那么多东西,并且能在我的简历里写入一家著名的公司。两年过后,方程式变得不同了。 Google 所提供给我的未来所具有的价值正在下降,而 Google 之外机会的价值却正在上升。 Google 的职位实际上在 Google 之外几乎毫无意义。在过去的 5 年间,许多人都问过我在 Google 做过什么,但是没有一个人问我在 Google 是什么职位,或是称我为“新毕业生”。尽管我在短期内受到了财务方面的打击,但实际上在我上交员工证的那天我就已经得到了晋升。 +刚加入 Google 时,我的工作级别无关紧要,因为我当时学到了那么多东西,并且能在我的简历里写入一家著名的公司。两年过后,等式变得不同了。 Google 所提供给我的未来所具有的价值正在下降,而 Google 之外机会的价值却正在上升。 Google 的职位实际上在 Google 之外几乎毫无意义。在过去的 5 年间,许多人都问过我在 Google 做过什么,但是没有一个人问我在 Google 是什么职位,也没人称我为“新毕业生”。尽管我在短期内受到了财务方面的打击,但实际上在我上交员工证的那天我就已经得到了晋升。 -值得称赞的是, Google 没有做过任何类似于以下的事情,但是在其他公司中却很常见:试图让员工对于要求加薪感到内疚。在几年前我工作过的地方,一些工程师在经历了许多紧要关头的成功发布后要求加薪。管理层扮演起了受害者的角色,并且职责工程师们是在“扭曲他们的手臂”。(大约 6 个月时间后,他们失去了自己大部分的工程团队。)如果你真的愿意就辞职时间进行配合(例如,在发布日期之后,而不是前一周),并且愿意记录下你的知识并在自己之后清理等等,那么你仅仅是由于雇主支付给你的工资不足而“扭曲他们的手臂”。 +值得称赞的是,Google 没有做过任何类似于以下的事情,但是在其他公司中却很常见:试图让员工对于要求加薪感到内疚。在几年前我工作过的地方,一些工程师在一次成功发布会后,在许多紧要关头要求加薪。管理层扮演起了受害者的角色,并且指责工程师们是在“强迫他们”。(大约 6 个月时间后,他们失去了自己大部分的工程团队。)如果你真的愿意就辞职时间进行配合(例如,在发布日期之后,而不是前一周),并且愿意记录下你的知识并做了整理等等,那么你仅仅是由于雇主支付给你的工资不足而“强迫他们”。 -名义上,我在 Google 留下了大量未投资的股票。但是知道你拥有股票时,股票才属于你。我只是得到了未来会有分红的承诺,而我可以将其除以所需的时间来将其转换为同等的工资率。为这项投资工作 2 个月是值得的,为了剩余的投资工作数年不是。不要被禀赋偏见所迷惑。 +名义上,我在 Google 留下了大量未授予的股票。但是知道你拥有股票时,股票才属于你。我只是得到了未来会有分红的承诺,而我可以将其除以所需的时间来将其转换为同等的工资率。为这项投资工作 2 个月是值得的,为了剩余的投资工作数年是不值得的。不要被授予股票的偏见所迷惑。 什么时候不应该辞职呢?嗯,与在其他地方相比,你能得到的很多吗?公司的职业发展道路不是天上掉下来的,他们是一系列的业务报价,代表着你将为什么样的公司评估而工作。如果你认为自己能得到很多(考虑到所有的薪酬和像是工作环境之类的无形资产),很好!否则,是时候认真考虑一下下一步该做什么了。 -### Google 之后 +### 离开 Google 之后 -我应当警告你的是,我采取了高增长的战略,但是牺牲了短期稳定性。如果对你而言稳定性更为重要,你应该做出不一样的选择。我的 A 计划、 B 计划、 C 计划都失败了,我最终花费了几个月时间苦苦找寻出路。最后,我在一家小型网络商店得到了一份合同,为 [Safety Town][9] 工作,一家面向孩子们的政府道路安全网站。那里的薪水较之于 Google 是一个巨大的缩减,尤其是考虑到这是我几个月以来的第一份工作。但是,你知道,我真的很享受这个项目。当然了,它不像 Google 那么“酷”,而且可能一些学校里的孩子也不觉得它酷。另一方面,在 Google,我只是一件大事的一小部分。 Safety Town 有一个小团队,每个人都扮演着至关重要的角色。在 Safety Town 项目中,我是后端工程师, Safety Town 但是我唯一需要费心的事情。而且可能一些孩子已经在这个网站上学到了一两件有关道路安全的事情。从那以后,我做了很多项目,大多数都要更大,但是我仍然会向人们展示 Safety Town。 +我应当警告你的是,我采取了高增长的战略,但是牺牲了短期稳定性。如果对你而言稳定性更为重要,你应该做出不一样的选择。我的 A 计划、 B 计划、 C 计划都失败了,我最终花费了几个月时间苦苦找寻出路。最后,我在一家小型网店得到了一份合同,为 [Safety Town][9] 工作,一家政府建立的面向孩子们的道路安全网站。那里的薪水较之于 Google 是一个巨大的缩减,尤其是考虑到这是我几个月以来的第一份工作。但是,你知道,我真的很享受这个项目。当然了,它不像 Google 那么“酷”,而且可能一些学校里的孩子也不觉得它酷。另一方面,在 Google,我只是机器中的一个螺丝钉。 Safety Town 有一个小团队,每个人都扮演着至关重要的角色。在 Safety Town 项目中,我是后端工程师, Safety Town 当时是我唯一需要费心的事情。而且可能一些孩子已经在这个网站上学到了一两件有关道路安全的事情。从那以后,我做了很多项目,大多数都更大,但是我仍然会向人们展示 Safety Town。 ![Screenshot of Safety Town home page, owned by Australian NSW government.][10] 我记得 Google 悉尼办事处的一张海报,上面写着:“飞向月球吧!即使你错过了,你也会降落在群星之中!”人们很容易忘记,即使你不是在为知名公司或初创公司做“登月计划”,你也可以拥有高质量的生活。 -这儿有一个帮助我获得合同的窍门。我会去参加悉尼的科技活动,站在能看到求职公告板的范围之中,等着直到我看见有人在上面写东西。假设他们正在为一个保险公司项目写 CSS 开发方面的信息。即使我对 CSS 或保险不是特别感兴趣,我也会来回徘徊并说:“嗨,这是个什么类型的保险项目?”这是最容易的开启谈话的方式,因为在他们努力往求职公告板上的狭小缝隙中写字的时候,满脑子都是这个项目。通常情况下,这样的谈话仍然不会为我带来一份工作,但是偶尔也会发现一些我能够帮上忙的东西。有些活动没有求职公告板,但是组织者们往往很乐意把麦克风递给别人几分钟。这为他们的活动增添了社区参与度。 +这儿有一个帮助我获得合同的窍门。我会去参加悉尼的科技活动,站在能看到求职公告板的范围之中,等着看见有人在上面写东西。假设他们正在为一个保险公司项目写 CSS 开发方面的信息。即使我对 CSS 或保险不是特别感兴趣,我也会晃悠过去说:“嗨,这是个什么类型的保险项目?”这是最容易的开启谈话的方式,因为在他们努力往求职公告板上的狭小缝隙中写字的时候,满脑子都是这个项目。通常情况下,这样的谈话仍然不会为我带来一份工作,但是偶尔也会发现一些我能够帮上忙的东西。有些活动没有求职公告板,但是组织者们往往很乐意把麦克风递给别人几分钟。这为他们的活动增添了社区参与度。 -在为政府采购网站工作后,我取得了重大的突破,因为我学着不对政府采购一窍不通。很难确切说出这些知识的价值,但是不到一年过后,我签署了一份政府合同,比我此前所期望的要多了 40%。(不过,我如今没有做太多的政府和大型企业工作。) +我在做了一个政府采购的网站后,我取得了重大的突破,因为我学会了不至于对政府采购一窍不通。很难确切说出这些知识的价值,但是不到一年过后,我就签署了一份政府合同,比我此前所期望的要多了 40%。(不过,我如今没有做那么多的政府和大型企业的工作了。) -大约一年半过后,我有了自己的一人公司。随着我声誉的建立,我逐渐获得了更多类似于 SRE 的工作。基本上,从事开发工作是我的“工作”,然后几个月后一个需要 SRE/DevOps 帮助并想起了我的人联系了我。我事实上既喜欢 SRE,也喜欢纯开发工作,但是供求关系意味着 SRE 工作是个好工作。我仍然可以在空余时间编程。 +大约一年半过后,我有了自己的一人公司。随着我声誉的建立,我逐渐获得了更多类似于 SRE 的工作。基本上,从事开发工作是我的“工作”,然后几个月后就有一个需要 SRE/DevOps 帮助的人联系了我。我事实上既喜欢 SRE,也喜欢纯开发工作,但是供求关系意味着 SRE 工作是个好工作。我仍然可以在空余时间编程。 说起这个,工作与生活的平衡是我在新生活中最喜欢的事情。没有人在两份合同之间给我酬劳,但是我可以通过在业余项目中学习新东西来充分利用这一间隙。在一个漫长而又紧张的合同之后,我休息了一下,[进行了为期一个月的背包徒步旅行,探索了日本乡村][11]。这是我期待了很长时间的一次旅行,但是在入职 Google 之前我需要更多的钱,而在 Google 供职期间我又需要更多的时间。自营职业远非没有压力,也不是适合每一个人的,但是有的压力会让你感到死气沉沉,有的压力则会让你越发充满活力。于我而言,自主营生是第二种,我想说,和在 Google 时相比,过去的 5 年间我的压力总体上有所减轻。对于我来说,至少我能够诚实地说我不后悔当初加入 Google,也不后悔当初离开 Google。 @@ -121,7 +123,7 @@ via: https://theartofmachinery.com/2020/08/04/leaving_google.html 作者:[Simon Arneaud][a] 选题:[lujun9972][b] 译者:[JonnieWayy](https://github.com/JonnieWayy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From eac2053bbc2f08a143a46058aed17e46028f47e0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 14 Sep 2020 23:12:41 +0800 Subject: [PATCH 0110/1156] PUB @JonnieWayy https://linux.cn/article-12614-1.html --- .../20200804 Leaving Google- Five Years On.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20200804 Leaving Google- Five Years On.md (99%) diff --git a/translated/talk/20200804 Leaving Google- Five Years On.md b/published/20200804 Leaving Google- Five Years On.md similarity index 99% rename from translated/talk/20200804 Leaving Google- Five Years On.md rename to published/20200804 Leaving Google- Five Years On.md index 3bbc2fb889..796b5b0c01 100644 --- a/translated/talk/20200804 Leaving Google- Five Years On.md +++ b/published/20200804 Leaving Google- Five Years On.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (JonnieWayy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12614-1.html) [#]: subject: (Leaving Google: Five Years On) [#]: via: (https://theartofmachinery.com/2020/08/04/leaving_google.html) [#]: author: (Simon Arneaud https://theartofmachinery.com) From 89fd7084e82125d540f4c58a1545e20abbb6b5f0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 14 Sep 2020 23:55:06 +0800 Subject: [PATCH 0111/1156] PRF @gxlct008 --- ...kage on CentOS-RHEL 7 and CentOS-RHEL 6.md | 70 +++++++++---------- 1 file changed, 32 insertions(+), 38 deletions(-) diff --git a/translated/tech/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md b/translated/tech/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md index 32359f6117..9b9184f8a9 100644 --- a/translated/tech/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md +++ b/translated/tech/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md @@ -1,44 +1,38 @@ [#]: collector: (lujun9972) [#]: translator: (gxlct008) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (3 Methods to Install the Latest PHP 7 Package on CentOS/RHEL 7 and CentOS/RHEL 6) [#]: via: (https://www.2daygeek.com/install-php-7-on-centos-6-centos-7-rhel-7-redhat-7/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -在 CentOS/RHEL 7 和 CentOS/RHEL 6 上安装最新 PHP 7 软件包的 3 种方法 +在 CentOS/RHEL 7/6 上安装最新 PHP 7 软件包的 3 种方法 ====== -PHP 是最流行的开源通用脚本语言,被广泛用于 Web 开发。 +![](https://img.linux.net.cn/data/attachment/album/202009/14/235431i92iqjj2we0vegyj.jpg) -它是 LAMP 栈应用程序套件的一部分,用于创建动态网站。 - -流行的 CMS 应用程序 WordPress,Joomla 和 Drupal 都是用 PHP 语言开发的。 - -这些应用程序的安装和配置都需要 PHP 7。 - -PHP 7 可以更快地加载您的 Web 应用程序,并消耗更少的服务器资源。 +PHP 是最流行的开源通用脚本语言,被广泛用于 Web 开发。它是 LAMP 栈应用程序套件的一部分,用于创建动态网站。流行的 CMS 应用程序 WordPress,Joomla 和 Drupal 都是用 PHP 语言开发的。这些应用程序的安装和配置都需要 PHP 7。PHP 7 可以更快地加载你的 Web 应用程序,并消耗更少的服务器资源。 在默认情况下,CentOS/RHEL 6 操作系统在其官方存储库中提供 PHP 5.3,而 CentOS/RHEL 7 则提供 PHP 5.4。 -在本文中,我们将向您展示如何在 CentOS/RHEL 7 和 CentOS/RHEL 6 系统上安装最新版本的 PHP。 +在本文中,我们将向你展示如何在 CentOS/RHEL 7 和 CentOS/RHEL 6 系统上安装最新版本的 PHP。 -这可以通过在系统中添加必要的 **[附加第三方 RPM 存储库][1]** 来完成。 +这可以通过在系统中添加必要的 [附加第三方 RPM 存储库][1] 来完成。 -### 方法-1:如何使用 软件集合存储库Software Collections Repository(SCL)在 CentOS 6/7 上安装 PHP 7 +### 方法-1:如何使用软件集合存储库(SCL)在 CentOS 6/7 上安装 PHP 7 现在,SCL 存储库由 CentOS SIG 维护,该组织不仅重新构建了 Red Hat Software Collections,还提供了自己的一些其他软件包。 -它包含各种程序的较新版本,这些程序可以与现有的旧软件包一起安装,并可以使用 scl 命令调用。 +它包含各种程序的较新版本,这些程序可以与现有的旧软件包一起安装,并可以使用 `scl` 命令调用。 -要想在 CentOS 上安装软件集合存储库(SCL),请运行以下 **[yum 命令][2]** +要想在 CentOS 上安装软件集合存储库(SCL),请运行以下 [yum 命令][2]: ``` # yum install centos-release-scl ``` -运行以下命令可以验证 SCL 存储库中可用的 PHP 7 版本。 +运行以下命令可以验证 SCL 存储库中可用的 PHP 7 版本: ``` # yum --disablerepo="*" --enablerepo="centos-sclo-rh" list *php @@ -54,13 +48,13 @@ rh-php71-php.x86_64 7.1.30-2.el7 centos-sclo-rh rh-php72-php.x86_64 7.2.24-1.el7 centos-sclo-rh ``` -运行以下命令可以从 scl 中安装 PHP 7.2 到你的系统中。 +运行以下命令可以从 SCL 中安装 PHP 7.2 到你的系统中: ``` # yum --disablerepo="*" --enablerepo="centos-sclo-rh" install rh-php72-php ``` -如果需要为 PHP 7.2 安装其他模块,则可以通过运行以下命令格式来安装它们。 例如,您可以通过执行以下命令来安装 **“gd”** 和 **“pdo”** 软件包。 +如果需要为 PHP 7.2 安装其他模块,则可以通过运行以下命令格式来安装它们。 例如,你可以通过执行以下命令来安装 `gd` 和 `pdo` 软件包: ``` # yum --disablerepo="*" --enablerepo="centos-sclo-rh" install rh-php72-php-gd rh-php72-php-pdo @@ -68,7 +62,7 @@ rh-php72-php.x86_64 7.2.24-1.el7 centos-sclo-rh ### 方法-1a:如何使用软件集合存储库(SCL)在 RHEL 7 上安装 PHP 7 -对于 Red Hat 7,启用以下存储库以安装最新的 PHP 7 软件包。 +对于 Red Hat 7,启用以下存储库以安装最新的 PHP 7 软件包: ``` # sudo subscription-manager repos --enable rhel-7-server-extras-rpms @@ -76,13 +70,13 @@ rh-php72-php.x86_64 7.2.24-1.el7 centos-sclo-rh # sudo subscription-manager repos --enable rhel-server-rhscl-7-rpms ``` -运行以下命令从 RHSCL 库中搜索可用的 PHP 7 版本。 +运行以下命令从 RHSCL 库中搜索可用的 PHP 7 版本: ``` # yum search rh-php* ``` -运行以下命令,您可以轻松地从 RHSCL 存储库中把 PHP7.3 安装到您的 RHEL 7 计算机上。 +运行以下命令,你可以轻松地从 RHSCL 存储库中把 PHP7.3 安装到你的 RHEL 7 计算机上: ``` # yum install rh-php73 @@ -90,13 +84,13 @@ rh-php72-php.x86_64 7.2.24-1.el7 centos-sclo-rh ### 方法-2:如何使用 Remi 存储库在 CentOS 6/7 上安装 PHP 7 -**[Remi 存储库][3]** 存储和维护着最新版本的 PHP 软件包,其中包含大量的库,扩展和工具。 有一些是从 Fedora 和 EPEL 反向移植的。 +[Remi 存储库][3] 存储和维护着最新版本的 PHP 软件包,其中包含大量的库,扩展和工具。 有一些是从 Fedora 和 EPEL 反向移植的。 这是 CentOS 社区认可的存储库,它不会修改或影响任何基础软件包。 -作为前提条件,如果您的系统上尚未安装 **[EPEL 存储库][4]**,该操作会首先安装它。 +作为前提条件,如果你的系统上尚未安装 [EPEL 存储库][4],该操作会首先安装它。 -您可以轻松地从 Remi 存储库中找到可用的 PHP 7 软件包版本,因为它会为每个版本添加一个单独的存储库。 您可以使用 **[ls 命令][5]** 查看它们。 +你可以轻松地从 Remi 存储库中找到可用的 PHP 7 软件包版本,因为它会为每个版本添加一个单独的存储库。 你可以使用 [ls 命令][5] 查看它们: ``` # ls -lh /etc/yum.repos.d/remi-php* @@ -109,7 +103,7 @@ rh-php72-php.x86_64 7.2.24-1.el7 centos-sclo-rh -rw-r--r--. 1 root root 1.3K Sep 6 01:31 /etc/yum.repos.d/remi-php74.repo ``` -运行以下命令,您可以轻松地从 Remi 存储库中把 PHP7.4 安装到您的 CentOS 6/7 计算机上。 +运行以下命令,你可以轻松地从 Remi 存储库中把 PHP7.4 安装到你的 CentOS 6/7 计算机上: ``` # yum --disablerepo="*" --enablerepo="remi-php74" install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo @@ -119,31 +113,31 @@ rh-php72-php.x86_64 7.2.24-1.el7 centos-sclo-rh 对于 Red Hat 7,请安装以下存储库以安装最新的 PHP 7 软件包。 -在 RHEL 7 上安装 EPEL 存储库 +在 RHEL 7 上安装 EPEL 存储库: ``` # yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm ``` -在 RHEL 7 上安装 Remi 存储库 +在 RHEL 7 上安装 Remi 存储库: ``` # yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm ``` -启用可选的 RPMS 存储库。 +启用可选的 RPMS 存储库: ``` # subscription-manager repos --enable=rhel-7-server-optional-rpms ``` -运行以下命令,可以轻松地从 remi 存储库中,把 PHP 7.4 安装在 RHEL 7 系统上。 +运行以下命令,可以轻松地从 remi 存储库中,把 PHP 7.4 安装在 RHEL 7 系统上: ``` # yum --disablerepo="*" --enablerepo="remi-php74" install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo ``` -要验证 PHP 7 的安装版本,请运行以下命令 +要验证 PHP 7 的安装版本,请运行以下命令: ``` # php -v @@ -155,17 +149,17 @@ Zend Engine v3.4.0, Copyright (c) Zend Technologies ### 方法-3:如何使用 IUS 社区存储库在 CentOS 6/7 上安装 PHP 7 -IUS 社区是 CentOS 社区批准的第三方 RPM 存储库,其中包含 PHP、Python、MySQL 等软件的最新上游版本,以及用于 Enterprise Linux(RHEL 和 CentOS)5、6 和 7 的软件包。 +IUS 社区存储库是 CentOS 社区批准的第三方 RPM 存储库,其中包含 PHP、Python、MySQL 等软件的最新上游版本,以及用于 Enterprise Linux(RHEL 和 CentOS)5、6 和 7 的软件包。 -**[IUS 社区存储库][6]** 与 EPEL 存储库具有依赖性,因此我们必须在安装 IUS 存储库之前先安装 EPEL 存储库。 请按照以下步骤将 EPEL 和 IUS 社区存储库安装并启用到 RPM 系统,然后再安装软件包。 +[IUS 社区存储库][6] 与 EPEL 存储库具有依赖性,因此我们必须在安装 IUS 存储库之前先安装 EPEL 存储库。 请按照以下步骤将 EPEL 和 IUS 社区存储库安装并启用到 RPM 系统,然后再安装软件包。 -EPEL软件包包含在 CentOS Extras 存储库中,并默认启用,因此,我们可以通过运行以下命令来安装它。 +EPEL软件包包含在 CentOS Extras 存储库中,并默认启用,因此,我们可以通过运行以下命令来安装它: ``` # yum install epel-release ``` -下载 IUS 社区存储库的 Shell 脚本如下 +下载 IUS 社区存储库的 Shell 脚本如下: ``` # curl 'https://setup.ius.io/' -o setup-ius.sh @@ -174,13 +168,13 @@ EPEL软件包包含在 CentOS Extras 存储库中,并默认启用,因此, 100 1914 100 1914 0 0 6563 0 --:--:-- --:--:-- --:--:-- 133k ``` -安装/启用 IUS 社区存储库。 +安装/启用 IUS 社区存储库: ``` # sh setup-ius.sh ``` -运行如下命来检查 IUS 存储库中可用的 PHP 7 版本。 +运行如下命来检查 IUS 存储库中可用的 PHP 7 版本: ``` # yum --disablerepo="*" --enablerepo="ius" list *php7* @@ -200,7 +194,7 @@ php71u-devel.x86_64 7.1.33-1.el7.ius php71u-embedded.x86_64 7.1.33-1.el7.ius ius ``` -运行以下命令您可以轻松地从 IUS 存储库中安装 PHP 7.3 到你 CentOS 6/7 系统上。 +运行以下命令你可以轻松地从 IUS 存储库中安装 PHP 7.3 到你 CentOS 6/7 系统上: ``` # yum --disablerepo="*" --enablerepo="ius" install php73-common php73-cli php73-gd php73-gd php73-mysqlnd php73-ldap php73-soap php73-mbstring @@ -213,7 +207,7 @@ via: https://www.2daygeek.com/install-php-7-on-centos-6-centos-7-rhel-7-redhat-7 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] 译者:[gxlct008](https://github.com/gxlct008) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 88b2714f3c6fb1d53a5b4a4c539b312578d1f6ec Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 14 Sep 2020 23:55:38 +0800 Subject: [PATCH 0112/1156] PUB @gxlct008 https://linux.cn/article-12615-1.html --- ...Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md (99%) diff --git a/translated/tech/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md b/published/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md similarity index 99% rename from translated/tech/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md rename to published/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md index 9b9184f8a9..c1525f1969 100644 --- a/translated/tech/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md +++ b/published/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (gxlct008) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12615-1.html) [#]: subject: (3 Methods to Install the Latest PHP 7 Package on CentOS/RHEL 7 and CentOS/RHEL 6) [#]: via: (https://www.2daygeek.com/install-php-7-on-centos-6-centos-7-rhel-7-redhat-7/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) From 5458980f4bfd66587c7c69225f7613d4d8a2e00d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 15 Sep 2020 00:19:37 +0800 Subject: [PATCH 0113/1156] APL --- ... is a Long Term Support (LTS) Release- What is Ubuntu LTS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md b/sources/tech/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md index f750b6958b..7e7c07ca3e 100644 --- a/sources/tech/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md +++ b/sources/tech/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 8194a24e2d453ed7329ad95fd12cabc8ee8ba741 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 15 Sep 2020 00:55:46 +0800 Subject: [PATCH 0114/1156] TSL&PRF --- ...pport (LTS) Release- What is Ubuntu LTS.md | 104 ------------------ ...pport (LTS) Release- What is Ubuntu LTS.md | 100 +++++++++++++++++ 2 files changed, 100 insertions(+), 104 deletions(-) delete mode 100644 sources/tech/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md create mode 100644 translated/tech/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md diff --git a/sources/tech/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md b/sources/tech/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md deleted file mode 100644 index 7e7c07ca3e..0000000000 --- a/sources/tech/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md +++ /dev/null @@ -1,104 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Linux Jargon Buster: What is a Long Term Support (LTS) Release? What is Ubuntu LTS?) -[#]: via: (https://itsfoss.com/long-term-support-lts/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Linux Jargon Buster: What is a Long Term Support (LTS) Release? What is Ubuntu LTS? -====== - -In Linux world, specially when it comes to [Ubuntu][1], you’ll come across the term LTS (long term support). - -If you’re an experienced Linux user, you probably know the various aspects of a Linux distribution like an LTS release. But, new users or less tech-savvy users may not know about it. - -In this chapter of Linux Jargon Buster, you’ll learn about what is an LTS release for Linux distributions. - -### What is a Long Term Support (LTS) Release? - -Long-Term Support (LTS) release is normally associated with an application or an operating system for which you will get security, maintenance and (sometimes) feature updates for a longer duration of time. - -The LTS versions are considered to be the most stable releases which undergoes extensive testing and mostly includes years of improvements along the way. - -It is important to note that an LTS version of software does not necessarily involve feature updates unless there’s a newer LTS release. But, you will get the necessary bug fixes and security fixes in the updates of a Long Term Support version. - -An LTS release is recommended for production-ready consumers, businesses, and enterprises because you get years of software support and no system-breaking changes with software updates. - -If you notice a non-LTS release for any software, it is usually the bleeding-edge version of it with new features and a short span of support (say 6-9 months) when compared to 3-5 years of support on an LTS release. - -![][2] - -To give you more clarity on LTS and non-LTS releases, let’s take a look at some pros and cons of choosing an LTS release. - -#### Pros of LTS releases - - * Software updates with security and maintenance fixes for a long time (5 year support for Ubuntu). - * Extensive testing - * No system-breaking changes with software updates - * You get plenty of time to prep your system for the next LTS release - - - -#### Cons of LTS releases - - * Does not offer the latest and greatest features - * You may miss out on the latest hardware support - * You may also miss out on the latest application upgrades - - - -Now, that you know what is an LTS release and its pros and cons it’s time to know about Ubuntu’s LTS release. Ubuntu is one of the most popular Linux distribution and one of the few distributions that has both LTS and non-LTS releases. - -This is why I decided to dedicate an entire section to it. - -### What is Ubuntu LTS? - -Ubuntu has a non-LTS release every six months and a LTS release every 2 years since 2006 and that’s not going to change. - -The latest LTS release is — [Ubuntu 20.04][3] and it will be supported until **April 2025**. In other words, Ubuntu 20.04 will receive software updates till then. The non-LTS releases are supported for nine months only. - -You will always find an Ubuntu LTS release to be labelled as “**LTS**“. At least, when it comes to the [official Ubuntu website][4] to explore the latest Ubuntu releases. - -To give you some clarity, if you notice Ubuntu 16.04 LTS, that means — it was **released back in April 2016 and is supported until 2021** (considering **5 years of software updates**). - -Similarly, you can guess the update support for each Ubuntu LTS release by considering the next **5 years** of its release date for software support. - -### Ubuntu LTS software updates: What does it include? - -![][5] - -Ubuntu LTS versions receive security and maintenance updates for the lifecycle of their release. Unless the release reaches the [End of Life][6], you will get all the necessary security and bug fixes. - -You will not notice any functional upgrades in an LTS release. So, if you want to try the latest experimental technologies, you may want to upgrade your Ubuntu release to a non-LTS release. - -I’d suggest you to refer our latest [Ubuntu upgrade guide][7] to know more about upgrading Ubuntu. - -I would also recommend you to read our article on [which Ubuntu version to install][8] to clear your confusion on different Ubuntu flavours available like [Xubuntu][9] or [Kubuntu][10] and how are they different. - -I hope you have a better understanding of the term LTS now specially when it comes to Ubuntu LTS. Stay tuned for more Linux jargon explainers in the future. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/long-term-support-lts/ - -作者:[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://ubuntu.com/ -[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/display-server-linux.png?resize=800%2C450&ssl=1 -[3]: https://itsfoss.com/download-ubuntu-20-04/ -[4]: https://ubuntu.com -[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/ubuntu-lts-release.png?resize=800%2C397&ssl=1 -[6]: https://itsfoss.com/end-of-life-ubuntu/ -[7]: https://itsfoss.com/upgrade-ubuntu-version/ -[8]: https://itsfoss.com/which-ubuntu-install/ -[9]: https://xubuntu.org/ -[10]: https://kubuntu.org/ diff --git a/translated/tech/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md b/translated/tech/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md new file mode 100644 index 0000000000..0abbd12e91 --- /dev/null +++ b/translated/tech/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux Jargon Buster: What is a Long Term Support \(LTS\) Release? What is Ubuntu LTS?) +[#]: via: (https://itsfoss.com/long-term-support-lts/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Linux 黑话解释:什么是长期支持(LTS)版本?什么是 Ubuntu LTS? +====== + +在 Linux 的世界里,特别是谈到 [Ubuntu][1] 的时候,你会遇到 LTS(长期支持Long Term Support)这个词。 + +如果你是一个经验丰富的 Linux 用户,你可能知道 Linux 发行版的各个方面,比如 LTS 版本。但是,新用户或不太懂技术的用户可能不知道。 + +在这一章 Linux 黑话解释中,你将了解什么是 Linux 发行版的 LTS 版本。 + +### 什么是长期支持(LTS)版本? + +长期支持(LTS)版本通常与应用程序或操作系统有关,你会在较长的时间内获得安全、维护和(有时有)功能的更新。 + +LTS 版本被认为是最稳定的版本,它经历了广泛的测试,并且大多包含了多年积累的改进。 + +需要注意的是,LTS 版本的软件不一定涉及功能更新,除非有一个更新的 LTS 版本。但是,你会在 LTS 版本的更新中得到必要的错误修复和安全修复。 + +LTS 版本被推荐给生产级的消费者、企业和商家,因为你可以获得多年的软件支持,而且软件更新不会破坏系统。 + +如果你注意到任何软件的非 LTS 版本,它通常是具有新功能和较短支持时间跨度(例如 6-9 个月)的前沿版本,而 LTS 版本的支持时间为3-5年。 + +![][2] + +为了让大家更清楚的了解 LTS 和非 LTS 版本的区别,我们来看看选择 LTS 版本的一些优缺点。 + +#### LTS 版本的优点 + + * 软件更新与安全和维护修复的时间很长(Ubuntu 有 5 年支持) + * 广泛的测试 + * 软件更新不会带来破坏系统的变化 + * 你有足够的时间为下一个 LTS 版本准备系统 + +#### LTS 版本的缺点 + + * 不提供最新和最强的功能 + * 你可能会错过最新的硬件支持 + * 你也可能会错过最新的应用程序升级 + +现在,你知道了什么是 LTS 版本及其优缺点,是时候了解一下 Ubuntu 的 LTS 版本了。Ubuntu 是最流行的 Linux 发行版之一,也是少数同时拥有 LTS 和非 LTS 版本的发行版之一。 + +这就是为什么我决定用一整个章节来介绍它。 + +### 什么是 Ubuntu LTS? + +自 2006 年以来,Ubuntu 每六个月发布一个非 LTS 版本,每两年发布一个 LTS 版本,这一点一直如此。 + +最新的 LTS 版本是 [Ubuntu 20.04][3],它将被支持到 2025 年 4 月。换句话说,Ubuntu 20.04 在那之前都会收到软件更新。非 LTS 版本只支持九个月。 + +你会发现 Ubuntu LTS 版本总是被标为 “LTS”。至少,在 [Ubuntu 官方网站][4]上浏览最新的 Ubuntu 版本时是这样的。 + +为了让你更清楚,如果你见过 Ubuntu 16.04 LTS,那就意味着:**它早在 2016 年 4 月就已经发布,并且支持到 2021 年**(想想**5 年的软件更新**)。 + +同样,你也可以通过计算每个 Ubuntu LTS 版本发布日期接下来的**5 年**软件支持期来估计其更新支持情况。 + +### Ubuntu LTS 软件更新包括什么? + +![][5] + +Ubuntu LTS 版本在其发布的生命周期内都会收到安全和维护更新。除非该版本达到[生命末期(EOL)][6],否则你将获得所有必要的安全和错误修复。 + +在 LTS 版本中你不会注意到任何功能升级。所以,如果你想尝试最新的实验性技术,你可能需要将你的 Ubuntu 版本升级到一个非 LTS 版本。 + +我建议你参考我们最新的 [Ubuntu 升级指南][7]来了解更多关于升级 Ubuntu 的信息。 + +我也建议你阅读我们的文章[安装哪个 Ubuntu 版本][8],以消除你对不同 Ubuntu 版本的困惑,比如 [Xubuntu][9] 或 [Kubuntu][10],它们有什么不同。 + +我希望你现在对 LTS 这个术语有了更好的理解,尤其是在 Ubuntu LTS 方面。敬请关注未来更多的 Linux 黑话解释。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/long-term-support-lts/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://ubuntu.com/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/display-server-linux.png?resize=800%2C450&ssl=1 +[3]: https://itsfoss.com/download-ubuntu-20-04/ +[4]: https://ubuntu.com +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/ubuntu-lts-release.png?resize=800%2C397&ssl=1 +[6]: https://itsfoss.com/end-of-life-ubuntu/ +[7]: https://itsfoss.com/upgrade-ubuntu-version/ +[8]: https://itsfoss.com/which-ubuntu-install/ +[9]: https://xubuntu.org/ +[10]: https://kubuntu.org/ From 2ade7ecd4a4f607b6621a3684855a38f1f107250 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 15 Sep 2020 05:01:31 +0800 Subject: [PATCH 0115/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200914?= =?UTF-8?q?=20Incremental=20backups=20with=20Btrfs=20snapshots?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200914 Incremental backups with Btrfs snapshots.md --- ...ncremental backups with Btrfs snapshots.md | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 sources/tech/20200914 Incremental backups with Btrfs snapshots.md diff --git a/sources/tech/20200914 Incremental backups with Btrfs snapshots.md b/sources/tech/20200914 Incremental backups with Btrfs snapshots.md new file mode 100644 index 0000000000..b8d980cb2f --- /dev/null +++ b/sources/tech/20200914 Incremental backups with Btrfs snapshots.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Incremental backups with Btrfs snapshots) +[#]: via: (https://fedoramagazine.org/btrfs-snapshots-backup-incremental/) +[#]: author: (Alessio https://fedoramagazine.org/author/alciregi/) + +Incremental backups with Btrfs snapshots +====== + +![][1] + +Snapshots are an interesting feature of Btrfs. A snapshot is a copy of a subvolume. Taking a snapshot is immediate. However, taking a snapshot is not like performing a _rsync_ or a _cp_, and a snapshot doesn’t occupy space as soon as it is created. + +Editors note: From the [BTRFS Wiki][2] – A snapshot is simply a subvolume that shares its data (and metadata) with some other subvolume, using Btrfs’s COW capabilities. + +Occupied space will increase alongside the data changes in the original subvolume or in the snapshot itself, if it is writeable. Added/modified files, and deleted files in the subvolume still reside in the snapshots. This is a convenient way to perform backups. + +### Using snapshots for backups + +A snapshot resides on the same disk where the subvolume is located. You can browse it like a regular directory and recover a copy of a file as it was when the snapshot was performed. By the way, a snapshot on the same disk of the snapshotted subvolume is not an ideal backup strategy: if the hard disk broke, snapshots will be lost as well. An interesting feature of snapshots is the ability to send them to another location. The snapshot can be sent to an external hard drive or to a remote system via SSH (the destination filesystems need to be formatted as Btrfs as well). To do this, the commands _btrfs send_ and _btrfs receive_ are used. + +### Taking a snapshot + +In order to use the _send_ and the _receive_ commands, it is important to create the snapshot as read-only, and snapshots are writeable by default. + +The following command will take a snapshot of the _/home_ subvolume. Note the _-r_ flag for readonly. + +sudo btrfs subvolume snapshot -r /home /.snapshots/home-day1 + +Instead of day1, the snapshot name can be the current date, like _home-$(date +%Y%m%d)_. Snapshots look like regular subdirectories. You can place them wherever you like. The directory _/.snapshots_ could be a good choice to keep them neat and to avoid confusion. + +Editors note: Snapshots will not take recursive snapshots of themselves. If you create a snapshot of a subvolume, every subvolume or snapshot that the subvolume contains is mapped to an empty directory of the same name inside the snapshot. + +### Backup using btrfs send + +In this example the destination Btrfs volume in the USB drive is mounted as _/run/media/user/mydisk/bk_ . The command to send the snapshot to the destination is: + +sudo btrfs send /.snapshots/home-day1 | sudo btrfs receive /run/media/user/mydisk/bk + +This is called initial bootstrapping, and it corresponds to a full backup. This task will take some time, depending on the size of the _/home_ directory. Obviously, subsequent incremental sends will take a shorter time. + +### Incremental backup + +Another useful feature of snapshots is the ability to perform the send task in an incremental way. Let’s take another snapshot. + +sudo btrfs subvolume snapshot -r /home /.snapshots/home-day2 + +In order to perform the send task incrementally, you need to specify the previous snapshot as a base and this snapshot has to exist in the source and in the destination. Please note the _-p_ option. + +sudo btrfs send -p /.snapshot/home-day1 /.snapshot/home-day2 | sudo btrfs receive /run/media/user/mydisk/bk + +And again (the day after): + +sudo btrfs subvolume snapshot -r /home /.snapshots/home-day3 + +sudo btrfs send -p /.snapshot/home-day2 /.snapshot/home-day3 | sudo btrfs receive /run/media/user/mydisk/bk + +### Cleanup + +Once the operation is complete, you can keep the snapshot. But if you perform these operations on a daily basis, you could end up with a lot of them. This could lead to confusion and potentially a lot of used space on your disks. So it is a good advice to delete some snapshots if you think you don’t need them anymore. + +Keep in mind that in order to perform an incremental send you need at least the last snapshot. This snapshot must be present in the source and in the destination. + +sudo btrfs subvolume delete /.snapshot/home-day1 + +sudo btrfs subvolume delete /.snapshot/home-day2 + +sudo btrfs subvolume delete /run/media/user/mydisk/bk/home-day1 + +sudo btrfs subvolume delete /run/media/user/mydisk/bk/home-day2 + +Note: the day 3 snapshot was preserved in the source and in the destination. In this way, tomorrow (day 4), you can perform a new incremental _btrfs send_. + +As some final advice, if the USB drive has a bunch of space, you could consider maintaining multiple snapshots in the destination, while in the source disk you would keep only the last one. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/btrfs-snapshots-backup-incremental/ + +作者:[Alessio][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/alciregi/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/08/butterfs-816x346.png +[2]: https://btrfs.wiki.kernel.org/index.php/SysadminGuide#Snapshots From a24a3fce594bcd2156d2689c34d8d97549751cf3 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 15 Sep 2020 05:02:31 +0800 Subject: [PATCH 0116/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200915?= =?UTF-8?q?=20KeePassXC=20is=20An=20Amazing=20Community=20Driven=20Open=20?= =?UTF-8?q?Source=20Password=20Manager=20[Not=20Cloud=20Based]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md --- ...ource Password Manager -Not Cloud Based.md | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 sources/tech/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md diff --git a/sources/tech/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md b/sources/tech/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md new file mode 100644 index 0000000000..ce3a0af765 --- /dev/null +++ b/sources/tech/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (KeePassXC is An Amazing Community Driven Open Source Password Manager [Not Cloud Based]) +[#]: via: (https://itsfoss.com/keepassxc/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +KeePassXC is An Amazing Community Driven Open Source Password Manager [Not Cloud Based] +====== + +_**Brief: KeePassXC is a useful open-source cross-platform password manager that doesn’t compromise on features even if it’s not a cloud-based tool. Here, we take a quick look at it.**_ + +### KeePassXC: A Cross-Platform Open Source Password Manager + +![][1] + +KeePassXC is a community fork of [KeePassX][2] which aims to be a cross-platform port for [KeePass Password Safe][3] (available for Windows). It is completely free to use and cross-platform as well (Windows, Linux, and macOS) + +In fact, it is one of the [best password managers for Linux][4] out there. It features options for both newbies and power users who want advanced controls to secure their password database on their system. + +Yes, unlike my [favorite Bitwarden password manager][5], KeePassXC is not cloud-based and the passwords never leave the system. Some users do prefer to not save their passwords and secrets in cloud servers. + +You should find all the essential features you will ever need on a password manager when you start using it. But, here, to give you a head start, I’ll highlight some features offered. + +### Features of KeePassXC + +![][6] + +It is worth noting that the features might prove to be a little overwhelming for a newbie. But, considering that you want to make the most out of it, I think you should actually know what it offers: + + * Password Generator + * Ability to import passwords from 1Password, KeePass 1, and any CSV files + * Easily share databases by exporting and synchronizing with SSL certificate support + * Database Encryption supported (256 bit AES) + * Browser Integration Available (optional) + * Ability to search for your credentials + * Auto-type passwords into applications + * Database reports to check password health and other stats + * Supports exporting to CSV and HTML + * 2-factor authentication token support + * Attach files to passwords + * YubiKey support + * Command line option available + * SSH Agent integration available + * Change encryption algorithms if required + * Ability to use DuckDuckGO to download the website icons + * Database auto-lock timeout + * Ability to clear the clipboard and the search query + * Auto-file save + * Folder/Nested Folder support + * Set expiration of a credential + * Dark theme available + * Cross-platform support + + + +As you can observe, it is a feature-rich password manager indeed. So, I’d advise you to properly explore it if you want to utilize every option present. + +![][7] + +### Installing KeePassXC on Linux + +You should find it listed in your software center of the distribution you’ve installed. + +You can also get the AppImage file from the official website. I’d suggest you to check out our guide on [using AppImage files in Linux][8] if you didn’t know already. + +In either case, you will also find a snap available for it. In addition to that, you also get an Ubuntu PPA, Debian package, Fedora package, and Arch package. + +If you’re curious, you can just explore the [official download page][9] for the available packages and check out their [GitHub page][10] for the source code as well. + +[Get KeePassXC][11] + +### Wrapping Up + +If you’re not a fan of cloud-based open-source password managers like [Bitwarden][5], KeePassXC should be an excellent choice for you. + +The number of options that you get here lets you keep your password secure and easy to maintain across multiple platforms. Even though you don’t have an “official” mobile app from the developer team, you may try some of their [recommended apps][12] which are compatible with the database and offer the same functionalities. + +Have you tried KeePassXC yet? What do you prefer using as your password manager? Let me know your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/keepassxc/ + +作者:[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://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/keepassxc-screenshot.jpg?resize=800%2C580&ssl=1 +[2]: https://www.keepassx.org/ +[3]: https://keepass.info +[4]: https://itsfoss.com/password-managers-linux/ +[5]: https://itsfoss.com/bitwarden/ +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/keepassxc-screenshot-1.jpg?resize=800%2C579&ssl=1 +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/keepassxc-settings.png?resize=800%2C587&ssl=1 +[8]: https://itsfoss.com/use-appimage-linux/ +[9]: https://keepassxc.org/download/ +[10]: https://github.com/keepassxreboot/keepassxc +[11]: https://keepassxc.org +[12]: https://keepassxc.org/docs/#faq-platform-mobile From 5e2eff77ec85a76b5fd0b0d4719b42b4b4ef7e71 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 15 Sep 2020 05:02:48 +0800 Subject: [PATCH 0117/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200914?= =?UTF-8?q?=20The=20future=20of=20virtual=20conferences,=20service=20mesh,?= =?UTF-8?q?=20and=20more=20industry=20trends?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200914 The future of virtual conferences, service mesh, and more industry trends.md --- ... service mesh, and more industry trends.md | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 sources/tech/20200914 The future of virtual conferences, service mesh, and more industry trends.md diff --git a/sources/tech/20200914 The future of virtual conferences, service mesh, and more industry trends.md b/sources/tech/20200914 The future of virtual conferences, service mesh, and more industry trends.md new file mode 100644 index 0000000000..8a895eba9e --- /dev/null +++ b/sources/tech/20200914 The future of virtual conferences, service mesh, and more industry trends.md @@ -0,0 +1,69 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The future of virtual conferences, service mesh, and more industry trends) +[#]: via: (https://opensource.com/article/20/9/virtual-conferences-service-mesh-industry-trends) +[#]: author: (Tim Hildred https://opensource.com/users/thildred) + +The future of virtual conferences, service mesh, and more industry trends +====== +A weekly look at open source community and industry trends. +![Computer laptop in space][1] + +As part of my role as a principal communication strategist at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends. Here are some of my and their favorite articles from that update. + +## [Enough with the Linux security FUD][2] + +> Whether you're running Windows Server, Linux, NetBSD, whatever on your mission-critical systems, if you utterly fail at security, it doesn't matter how "secure" your operating system is. It's like leaving your car keys in an unlocked car, your system will be hacked, your car will be stolen.  + +**The impact**: I worry a bit about the organizations at the size that comes before "can afford fulltime expert IT" where you might find someone who likes computers taking on that responsibility by default. If that sounds like you or your organization, get that person some training! + +## [A look back at our FIRST KubeCon + CloudNativeCon virtual conference][3] + +> The first virtual KubeCon + CloudNativeCon just wrapped up and it was a huge success thanks to our amazing community of doers – builders, operators and advocates. We are so thrilled that the cloud native community came together with hope and positivity to make this a truly community-driven event we will remember for a long time. We may not have been able to meet in person this year but we are indomitable!  + +**The impact**: These virtual experiences keep getting better and adding to the state of the art; running them requires important muscles that have until this point gone underused. Whatever else happens as the pandemic progresses, I hope we get a sense of "if we really think hard about it, we can build powerful bonds within our communities without airfares and hotel rooms." It doesn't have to be the same as sharing a beer to be impactful. + +## [Istio 1.7: Security improvements take centre stage as users continue to speculate about the service mesh’s future][4] + +> Lately, Istio has been anything but boring, especially after originator Google came into some criticism for handing the project’s trademarks over to its recently founded [Open Usage Commons][5]. The step led to some turmoil, raising questions about how neutral OUC really was as well as basically smothering the hopes of those who had wished for Istio to become a CNCF project one day. [According to IBM][6], a founding member of the project, there had actually been an “agreement” to do so with Google, which only seems sensible, given that the Envoy proxy, which is central to Istio, has found a vendor-neutral home at the organisation. + +**The impact**: My guess is that the project has enough adoption and functionality leading over competitive projects that it would take some truly dastardly governance to blow it. + +## [Z is for Zowe–the open path to mainframe DevOps][7] + +> This article describes the framework’s ability to onboard the mainframe to enterprise DevOps, so developers, systems programmers and others who work with the mainframe can now do so the same way their peers do with other IT platforms (i.e., cloud, mobile, distributed). These shared experiences close the gap between mainframers and others while preserving the core advantages of the platform. Common tools fuel a common language that benefits all, especially when deploying hybrid applications (e.g., web front-end with mainframe back-end). + +**The impact**: The point about common tools fueling a common language is subtle but important. Tools for tools' sake won't get you very far; bringing more minds to bear on a problem will. + +## [Tiering self-service by user competence][8] + +> The degree to which each team can reasonably create its own configurations is related to the team’s competence with cloud solution architecture, cloud engineering, and cloud security. Not every person on the team may have a high level of competence; in fact, that will generally not be the case. However, the very least, for full self-service there needs to be at least one person with strong competencies in each of those areas, who has oversight responsibilities, acts an expert (provides assistance/mentorship within the team), and does any necessary code review. + +**The impact**: We do it for driving cars and learning to ski; so why shouldn't we do it when it comes to letting people deploy sometimes critical applications? + +_I hope you enjoyed this list and come back next week for more open source community, market, and industry trends._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/virtual-conferences-service-mesh-industry-trends + +作者:[Tim Hildred][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://opensource.com/users/thildred +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_space_graphic_cosmic.png?itok=wu493YbB (Computer laptop in space) +[2]: https://www.zdnet.com/article/enough-with-the-linux-security-fud/#ftag=RSSbaffb68 +[3]: https://www.cncf.io/blog/2020/08/26/a-look-back-at-our-first-kubecon-cloudnativecon-virtual-conference/ +[4]: https://devclass.com/2020/08/24/istio-service-mesh-1_7/ +[5]: https://istio.io/latest/blog/2020/open-usage/ +[6]: https://developer.ibm.com/blogs/istio-google-open-usage-commons/ +[7]: https://devops.com/z-is-for-zowe-the-open-path-to-mainframe-devops/ +[8]: https://cloudpundit.com/2020/08/10/tiering-self-service-by-user-competence/ From 7de6a1166ec946ca24fe93630f30f78187683e23 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 15 Sep 2020 05:03:00 +0800 Subject: [PATCH 0118/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200914?= =?UTF-8?q?=20Use=20Python=20to=20solve=20a=20charity's=20business=20probl?= =?UTF-8?q?em?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200914 Use Python to solve a charity-s business problem.md --- ...n to solve a charity-s business problem.md | 215 ++++++++++++++++++ 1 file changed, 215 insertions(+) create mode 100644 sources/tech/20200914 Use Python to solve a charity-s business problem.md diff --git a/sources/tech/20200914 Use Python to solve a charity-s business problem.md b/sources/tech/20200914 Use Python to solve a charity-s business problem.md new file mode 100644 index 0000000000..febc102037 --- /dev/null +++ b/sources/tech/20200914 Use Python to solve a charity-s business problem.md @@ -0,0 +1,215 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use Python to solve a charity's business problem) +[#]: via: (https://opensource.com/article/20/9/solve-problem-python) +[#]: author: (Chris Hermansen https://opensource.com/users/clhermansen) + +Use Python to solve a charity's business problem +====== +Comparing how different programming languages solve the same problem is +fun and instructive. Next up, Python. +![Python programming language logo with question marks][1] + +In my [first article][2] in this series, I described a problem of dividing bulk supplies into hampers of similar value to distribute to struggling neighbors in your community. I also wrote about how I enjoy solving small problems like this with small programs in various languages and comparing how they do it. + +In the first article, I solved this problem with the [Groovy][3] programming language. Groovy is like [Python][4] in many ways, but syntactically it's more like C and Java. Therefore, it should be interesting and instructive to create the same solution in Python. + +### The Python solution + +In Java, I declare utility classes to hold tuples of data (the new record feature is going to be great for that). In Groovy, I use the language support for maps, and I follow the same approach in Python. + +Use a list of dictionaries to hold the bulk items picked up from the wholesaler: + + +``` +packs = [ +        {'item':'Rice','brand':'Best Family','units':10,'price':5650,'quantity':1}, +        {'item':'Spaghetti','brand':'Best Family','units':1,'price':327,'quantity':10}, +        {'item':'Sardines','brand':'Fresh Caught','units':3,'price':2727,'quantity':3}, +        {'item':'Chickpeas','brand':'Southern Style','units':2,'price':2600,'quantity':5}, +        {'item':'Lentils','brand':'Southern Style','units':2,'price':2378,'quantity':5}, +        {'item':'Vegetable oil','brand':'Crafco','units':12,'price':10020,'quantity':1}, +        {'item':'UHT milk','brand':'Atlantic','units':6,'price':4560,'quantity':2}, +        {'item':'Flour','brand':'Neighbor Mills','units':10,'price':5200,'quantity':1}, +        {'item':'Tomato sauce','brand':'Best Family','units':1,'price':190,'quantity':10}, +        {'item':'Sugar','brand':'Good Price','units':1,'price':565,'quantity':10}, +        {'item':'Tea','brand':'Superior','units':5,'price':2720,'quantity':2}, +        {'item':'Coffee','brand':'Colombia Select','units':2,'price':4180,'quantity':5}, +        {'item':'Tofu','brand':'Gourmet Choice','units':1,'price':1580,'quantity':10}, +        {'item':'Bleach','brand':'Blanchite','units':5,'price':3550,'quantity':2}, +        {'item':'Soap','brand':'Sunny Day','units':6,'price':1794,'quantity':2}] +``` + +There is one bulk pack of 10 bags of rice and 10 bulk packs with one bag each of spaghetti. In the above, the variable `packs` is set to a Python list of dictionaries. This turns out to be very similar to the Groovy approach. A few points worth noting about the difference between Groovy and Python: + + 1. In Python, there is no keyword used to define the variable `packs`; Python expects the first use to set a value. + 2. Python dictionary keys (e.g., `item`, `brand`, `units`, `price`, `quantity`) require quotes to indicate they are strings; Groovy assumes these are strings, but accepts quotes as well. + 3. In Python, the notation `{ … }` indicates a dictionary declaration; Groovy uses the same square brackets as a list, but the structure in both cases must have key-value pairs. + + + +And, yes, those prices aren't in US dollars. + +Next, unpack the bulk packages. Unpacking the single bulk package of rice, for example, will yield 10 units of rice; that is, the total number of units yielded is `units * quantity`. The Groovy script uses a handy function called `collectMany` that can be used to flatten out lists of lists. As far as I know, Python doesn't have anything similar, so use two list comprehensions to produce the same result: + + +``` +units = [[{'item':pack['item'],'brand':pack['brand'], +        'price':(pack['price'] / pack['units'])}] * +        (pack['units'] * pack['quantity']) for pack in packs] +units = [x for sublist in units for x in sublist] +``` + +The first list comprehension (assignment to units) builds the list of lists of dictionaries. The second "flattens" that into just a list of dictionaries. Note that both Python and Groovy provide an `*` operator that takes a list on the left and a number `N` on the right and replicates the list `N` times. + +The final step is to repack the units into the hampers for distribution. As in the Groovy version, you need to get a bit more specific about the ideal hamper value, and you might as well not be overly restrictive when you get down to just a few units left: + + +``` +valueIdeal = 5000 +valueMax = valueIdeal * 1.1 +``` + +OK! Repack the hampers: + + +``` +import random +hamperNumber = 0           # [1] +while len(units) > 0:      # [2] +    hamperNumber += 1 +    hamper = [] +    value = 0 +    canAdd = True              # [2.1] +    while canAdd:              # [2.2] +        u = random.randint(0,len(units)-1)  # [2.2.1] +        canAdd = False                      # [2.2.2] +        o = 0                               # [2.2.3] +        while o < len(units):               # [2.2.4] +            uo = (u + o) % len(units) +            unit = units[uo] +            unitPrice = unit['price']          # [2.2.4.1] +            if len(units) < 3 or not (unit in hamper) and (value + unitPrice) < valueMax: +                                               # [2.2.4.2] +                hamper.append(unit) +                value += unitPrice +                units.pop(u)                   # [2.2.4.3] +                canAdd = len(units) > 0 +                break                          # [2.2.4.4] +            o += 1                             # [2.2.4.5] +                                            # [2.2.5] +    print('') +    print('Hamper',hamperNumber,'value',value) +    for item in hamper: +        print('%-25s%-25s%7.2f' % (item['item'],item['brand'],item['price'])) # [2.3] +    print('Remaining units',len(units))                                       # [2.4] +``` + +Some clarification, with numbers in brackets in the comments above (e.g., _[1]_) corresponding to the clarifications below: + + * 1\. Import Python's random number generator facilities and initialize the hamper number. + * 2\. This `while` loop will redistribute units into hampers as long as there are more available: + * 2.1 Increment the hamper number, get a new empty hamper (a list of units), and set its value to 0; start off assuming you can add more items to the hamper. + * 2.2 This `while` loop will add as many units to the hamper as possible (the Groovy code used a `for` loop, but Python's `for` loops expect to iterate over something, while Groovy has the more traditional C form of `for` loop): + * 2.2.1 Get a random number between zero and the number of remaining units minus 1. + * 2.2.2 Assume you can't find more units to add. + * 2.2.3 Create a variable to be used for the offset from the starting point where you're looking for items to put in the hamper. + * 2.2.4 Starting at the randomly chosen index, this `while` loop will try to find a unit that can be added to the hamper (once again, note that the Python `for` loop probably isn't suitable here since the length of the list will change during processing). + * 2.2.4.1. Figure out which unit to look at (random starting point + offset) and get its price. + * 2.2.4.2 You can add this unit to the hamper if there are only a few left or if the value of the hamper isn't too high once the unit is added. + * 2.2.4.3 Add the unit to the hamper, increment the hamper value by the unit price, remove the unit from the available units list. + * 2.2.4.4 As long as there are units left, you can add more, so break out of this loop to keep looking. + * 2.2.4.5 Increment the offset. + * 2.2.5 On exit from this `while` loop, if you inspected every remaining unit and could not find one to add to the hamper, the hamper is complete; otherwise, you found one and can continue looking for more. + * 2.3 Print out the contents of the hamper. + * 2.4 Print out the remaining units info. + + + +When you run this code, the output looks quite similar to the output from the Groovy program: + + +``` +Hamper 1 value 5304.0 +UHT milk                 Atlantic                  760.00 +Tomato sauce             Best Family               190.00 +Rice                     Best Family               565.00 +Coffee                   Colombia Select          2090.00 +Sugar                    Good Price                565.00 +Vegetable oil            Crafco                    835.00 +Soap                     Sunny Day                 299.00 +Remaining units 148 + +Hamper 2 value 5428.0 +Tea                      Superior                  544.00 +Lentils                  Southern Style           1189.00 +Flour                    Neighbor Mills            520.00 +Tofu                     Gourmet Choice           1580.00 +Vegetable oil            Crafco                    835.00 +UHT milk                 Atlantic                  760.00 +Remaining units 142 + +Hamper 3 value 5424.0 +Soap                     Sunny Day                 299.00 +Chickpeas                Southern Style           1300.00 +Sardines                 Fresh Caught              909.00 +Rice                     Best Family               565.00 +Vegetable oil            Crafco                    835.00 +Spaghetti                Best Family               327.00 +Lentils                  Southern Style           1189.00 +Remaining units 135 + +… + +Hamper 21 value 5145.0 +Tomato sauce             Best Family               190.00 +Tea                      Superior                  544.00 +Chickpeas                Southern Style           1300.00 +Spaghetti                Best Family               327.00 +UHT milk                 Atlantic                  760.00 +Vegetable oil            Crafco                    835.00 +Lentils                  Southern Style           1189.00 +Remaining units 4 + +Hamper 22 value 2874.0 +Sardines                 Fresh Caught              909.00 +Vegetable oil            Crafco                    835.00 +Rice                     Best Family               565.00 +Rice                     Best Family               565.00 +Remaining units 0 +``` + +The last hamper is abbreviated in contents and value. + +### Closing thoughts + +At a glance, there isn't a whole lot of difference between the Python and Groovy versions of this program. Both have a similar set of constructs that make handling lists and dictionaries very straightforward. Neither requires a lot of "boilerplate code" or other "ceremonial" actions. + +Also, as in the Groovy example, there is some fiddly business about being able to add units to the hamper. Basically, you pick a random position in the list of units and, starting at that position, iterate through the list until you either find a unit whose price allows it to be included or until you exhaust the list. Also, when there are only a few items left, you just toss them into the last hamper. + +Another issue worth mentioning: This isn't a particularly efficient approach. Removing elements from lists, being careless about repeated expressions, and a few other things make this less suitable for a huge redistribution problem. Still, it runs in a blink on my old machine. + +If you are shuddering at my use of `while` loops and mutating the data in this code, you probably wish I made it more functional. I couldn't think of a way to use map and reduce features in Python in conjunction with a random selection of units for repackaging. Can you? + +In the next article, I'll re-do this in Java just to see how much less effort Groovy and Python are, and future articles will cover Julia and Go. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/solve-problem-python + +作者:[Chris Hermansen][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://opensource.com/users/clhermansen +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python_programming_question.png?itok=cOeJW-8r (Python programming language logo with question marks) +[2]: https://opensource.com/article/20/8/solving-problem-groovy +[3]: https://groovy-lang.org/ +[4]: https://www.python.org/ From e89a7ee0b61b1f974a51136f4e413581614d1319 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 15 Sep 2020 05:03:13 +0800 Subject: [PATCH 0119/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200914?= =?UTF-8?q?=20How=20Nextcloud=20simplified=20the=20signup=20process=20for?= =?UTF-8?q?=20decentralization?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200914 How Nextcloud simplified the signup process for decentralization.md --- ...the signup process for decentralization.md | 125 ++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 sources/tech/20200914 How Nextcloud simplified the signup process for decentralization.md diff --git a/sources/tech/20200914 How Nextcloud simplified the signup process for decentralization.md b/sources/tech/20200914 How Nextcloud simplified the signup process for decentralization.md new file mode 100644 index 0000000000..84be285f3e --- /dev/null +++ b/sources/tech/20200914 How Nextcloud simplified the signup process for decentralization.md @@ -0,0 +1,125 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How Nextcloud simplified the signup process for decentralization) +[#]: via: (https://opensource.com/article/20/9/decentralization-signup) +[#]: author: (Jan C. Borchardt https://opensource.com/users/jancborchardt) + +How Nextcloud simplified the signup process for decentralization +====== +Nextcloud is open source software and we don’t provide a hosted service, +yet we managed to radically simplify the signup experience. +![clouds in the sky with blue pattern][1] + +We always had a nice list of dozens of Nextcloud providers, yet the most common question I heard, even from technically apt friends of mine, was: + +> "Hi, Jan, umm…so, which Nextcloud provider do you recommend?" + +Which is, of course, understandable. If you have a long list of providers, how do you choose? Hosted nearby? Cute name? Biggest logo? + +Every decentralized open source solution using servers struggles with this: + + * Mastodon has [joinmastodon.org][2] for choosing a community, but clearly a main instance with mastodon.social. + * Diaspora has [joindiaspora.com][3], which is also the main instance. + * Matrix has [matrix.to][4] and an app (for multiple platforms) at [Element.io][5]. + * WordPress has [wordpress.com][6]—and I'm not sure any provider comes close to its popularity. + * PeerTube has a bunch of instances, all with different technical details. + * Pixelfed has an early version of an instance picker at [beta.joinpixelfed.org][7], as well as a large instance at [pixelfed.social][8] + * … lots more examples of decentralized open source apps, which list how you can access it via the terminal, set up the Rust implementation, or make it run on your networked printer. + + + +This leads to problems: + + * 🔮 People don't know which one to pick, have FOMO (Fear Of Missing Out), and then don't pick at all. It's the paradox of choice! + * 🕸 The network is not really decentralized because the majority of people are on a handful of servers, or mainly just a single one. + + + +Nextcloud does not have any of these problems. + +### Our solution: Simple Signup + +How it works: + +When you download the mobile or desktop app, the first thing you see is a choice for "Log in" or "Sign up with a provider." This is what any proprietary app does: + +![Android client][9] + +Choosing "Sign up" opens [the Simple Signup page][10] in the app. + +![Web client][11] + +You put in your email address and click "sign up." + +Enter a password, and you're done! 🎉 + +> "Wait a second; how is this so simple?" + +I know, right? ✨ + +In fact, it's even simpler than lots of centralized apps where you need to put in your full name and phone number and then click on pictures of fire hydrants for Google. + +It basically boils down to this: + +### We choose for you + +Instead of being faced with a list of providers where you could not possibly judge what works for you, we only show you one option. It's as if I'm your friend, and I answer that question about which provider I recommend. + +Neat! 😊 + +Just to clarify: You do have the ability to change the provider, but the default should suit you fine. For now, it's simply the provider geographically closest to you. + +On top of that, we have some requirements for the providers which are listed through Simple Signup to ensure a good user experience no matter which one you get: + + * 🎁 2 GB of free storage minimum, and not only for a trial period. + * 🍱 A core set of apps: Files, Calendar, Contacts, Mail, Talk, Tasks, Notes. Some providers offer even more. + * 🛡 The latest version, so you are always up to date with the latest features, fixes, and security updates. + + + +Beyond that, we came up with a privacy respecting process. When you click "sign up," your email is not sent to us but directly to the provider you chose, which seamlessly transitions you to their setup step where you choose a password. This means no data leaks to us at Nextcloud—we don't even know which provider you picked! + +So, while we offer this service, and while it is super easy to use, we only do the absolute minimum in terms of data handling to connect you with your ideal provider. + +### Decentralized projects need simple signup + +A lot of open source software projects could benefit from an onboarding experience like Simple Signup. We [wrote about it when we initially released it][12], and we hope this post clarifies the design decisions that make it successful so it can be adopted by more projects. + +Decentralization is empowering, but only truly revolutionary when people can simply sign up even if they don't know what a server is. + +Of course, it's not perfect just yet, either. For example, if you already have an account on a Nextcloud instance, the login process in any of the apps asks you to put in a server address, and a lot of people have no idea what that even is. In lots of email apps, for example, there is a list of the most popular providers at this step, with a "custom server" entry on the bottom. This could be a possibility as well, but again brings the risk of centralizing the system too much or leaving people confused as to what to pick. + +So, we constantly try to improve this for any of the Nextcloud desktop and mobile apps, like Nextcloud Talk or all of the great community-developed apps. On Android, we have tight integration with DAVx5 (Calendar and Contact sync on Android), and, for other Android apps, there is a [single sign-on library][13]. On iOS, it is, unfortunately, not so easy, since apps have to be from the same developer to share credentials. + +If you want to collaborate on solving interesting challenges like these, [come join our Nextcloud design team][14]! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/decentralization-signup + +作者:[Jan C. Borchardt][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://opensource.com/users/jancborchardt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003601_05_mech_osyearbook2016_cloud_cc.png?itok=XSV7yR9e (clouds in the sky with blue pattern) +[2]: https://joinmastodon.org/ +[3]: https://joindiaspora.com +[4]: https://matrix.to +[5]: http://Element.io +[6]: https://wordpress.com +[7]: http://beta.joinpixelfed.org +[8]: http://pixelfed.social +[9]: https://opensource.com/sites/default/files/nextcloud-android-small.png (Android client) +[10]: https://nextcloud.com/signup +[11]: https://opensource.com/sites/default/files/nextcloud-web-small.png (Web client) +[12]: https://nextcloud.com/blog/introducing-simple-signup-you-can-now-get-started-with-nextcloud-in-2-steps/ +[13]: https://github.com/nextcloud/Android-SingleSignOn +[14]: https://nextcloud.com/design From 6897afc2850b0078295781029af3ad7a446f15d9 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 15 Sep 2020 05:03:45 +0800 Subject: [PATCH 0120/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[talk]:=2020200914?= =?UTF-8?q?=20NFC=20vs.=20Bluetooth=20LE:=20When=20to=20use=20which?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200914 NFC vs. Bluetooth LE- When to use which.md --- ...NFC vs. Bluetooth LE- When to use which.md | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 sources/talk/20200914 NFC vs. Bluetooth LE- When to use which.md diff --git a/sources/talk/20200914 NFC vs. Bluetooth LE- When to use which.md b/sources/talk/20200914 NFC vs. Bluetooth LE- When to use which.md new file mode 100644 index 0000000000..9656a12a99 --- /dev/null +++ b/sources/talk/20200914 NFC vs. Bluetooth LE- When to use which.md @@ -0,0 +1,66 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (NFC vs. Bluetooth LE: When to use which) +[#]: via: (https://www.networkworld.com/article/3574932/nfc-vs-bluetooth-le-when-to-use-which.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +NFC vs. Bluetooth LE: When to use which +====== +Near-field communications and Bluetooth LE are low-power wireless technologies suited for different uses in enterprises. +Metamorworks / Getty Images + +Among many options for low-power, relatively short-ranged connectivity, two technologies stand out – near-field communication and Bluetooth low energy. Both have relatively low deployment costs and are simple to use. + +NFC is best known for being the technology behind many modern smart cards. NFC chips need to be very close – within a few centimeters – to a reader for a connection to be made, but that’s an upside in its primary enterprise use case, which is security and access control. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +Bluetooth LE is a low-power derivative of the main Bluetooth standard, offsetting lower potential throughput with substantially reduced energy consumption and the consequent ability to fit into a wider range of potential use cases. + +Next, we’ll delve into more in-depth descriptions of each technology and their primary use cases. + +### NFC features + +NFC operates at near-contact ranges – devices must be within several centimeters of each other in order to make contact. A readable passive NFC “tag” requires no independent power source at all, drawing energy from the initiator’s signal, which operates at around 13.5MHz and requires between 100 and 700 µA of power when actively reading a tag. + +“The short range is actually an advantage,” said Gartner research senior director and analyst Bill Ray. “The big thing about NFC is that it’s not just the radio, there’s a massive security protocol built-in.” That is, a potential bad actor would have to be very close – within a few meters, using specialized equipment – to even be able to detect an NFC connection taking place. NFC implementations can also layer on SSL technology for additional safety. + +That’s not a surprise, given NFC’s origins as a contactless payment technology. Its roots in that area create an appeal for retailers, which could use NFC to let customers get additional information about items before they buy, get coupons or ask for assistance from a clerk simply by touching their phones to an NFC hotspot. + +While the short range involved has limited the number of use cases that make sense for NFC technology, it’s not solely about opening doors and buying lattes. NFC can be used to bootstrap connections for quick and easy pairing between devices, so a user could simply tap their phone on a properly equipped projector in a conference room to create an NFC connection, validate that the smartphone is an approved device to connect to, and give a presentation. The presentation or video data itself wouldn’t be transferred via NFC, but the NFC handshake acts as a validation for a different wireless protocol, eliminating the need to sign into, for example, a Wi-Fi network, or any other higher-bandwidth network that could stream that data. + +### Bluetooth LE characteristics + +Bluetooth LE, by contrast, operates over substantially longer distances – anywhere up to several dozen meters – and has about twice the maximum bandwidth of an NFC connection at 1 Mbit/second. It’s an outgrowth of the well-known Bluetooth technology, optimized for machine-to-machine connectivity, thanks to its lower power usage than the main-line standard. It uses less than 15 mA of power at either end of a connection, and has a practical range of about 10 meters, securing connections with AES encryption. + +Yet it’s far from a drop-in replacement for NFC, according to Forrester principal analyst Andre Kindness. + +“From an information transfer perspective [NFC is] a lot quicker than BLE,” he said. BLE usually takes an appreciable fraction of a second or longer to identify and secure a connection, while that process is more or less instantaneous with NFC. + +Bluetooth LE, however, is considerably more versatile than NFC, thanks to its greater range, according to IDC senior research analyst Patrick Filkins. + +“I think Bluetooth [LE] is a little better suited for enterprise,” he said. Use cases like asset tracking, indoor navigation, and targeted advertisements are just the tip of the iceberg. + +For enterprises, then, the upshot is fairly straightforward – NFC use cases are mostly separate from those for which a company would use Bluetooth, but, for the rare overlap where a choice can be made, the relative advantages and disadvantages are clear. NFC is very short-ranged, cheap, connects instantly and has a lower data transfer rate. Bluetooth LE works over much longer distances and at higher speeds, costs somewhat more and takes a moment to “handshake” its connections. + +Join the Network World communities on [Facebook][2] and [LinkedIn][3] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3574932/nfc-vs-bluetooth-le-when-to-use-which.html + +作者:[Jon Gold][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://www.networkworld.com/author/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world From 48db8c964347fd6ba89a1f1e425493b16fc70e70 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 15 Sep 2020 08:42:55 +0800 Subject: [PATCH 0121/1156] translated --- ...ommand to create flexible file listings.md | 138 ------------------ ...ommand to create flexible file listings.md | 133 +++++++++++++++++ 2 files changed, 133 insertions(+), 138 deletions(-) delete mode 100644 sources/tech/20200909 Using the Linux stat command to create flexible file listings.md create mode 100644 translated/tech/20200909 Using the Linux stat command to create flexible file listings.md diff --git a/sources/tech/20200909 Using the Linux stat command to create flexible file listings.md b/sources/tech/20200909 Using the Linux stat command to create flexible file listings.md deleted file mode 100644 index 5dc598d310..0000000000 --- a/sources/tech/20200909 Using the Linux stat command to create flexible file listings.md +++ /dev/null @@ -1,138 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Using the Linux stat command to create flexible file listings) -[#]: via: (https://www.networkworld.com/article/3573802/using-the-linux-stat-command-to-create-flexible-file-listings.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -Using the Linux stat command to create flexible file listings -====== - -D3Damon / Getty Images - -The **stat** command supplies a lot of detailed information on files. - -It provides not just the date/time of the most recent file changes, but also shows when files were most recently accessed and permissions changed. It tells you the file size in both bytes and blocks. It displays the inode being used by the file along with the file type. It includes the file owner and the associated user group both by name and UID/GID. It displays file permissions in both the “rwx” (referred to as the “human-readable” format) and numerically. On some systems, it might even include the date and time that a file was created (called its “birth”). - -[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] - -In addition to providing all this information, the **stat** command can also be used to create file listings. These listings are extremely flexible in that you can choose to include any or all of the information described above. - -To generate a custom listing, you just need to use the **stat** command’s **-c** (or --**format**) option and specify the fields you want included. For example, to create a listing that shows file permissions in both of the available formats, use this command: - -``` -$ stat -c '%n %a %A' my* -my.banner 664 -rw-rw-r-- -mydir 775 drwxrwxr-x -myfile 664 -rw-rw-r-- -myjunk 777 lrwxrwxrwx -mykey 664 -rw-rw-r-- -mylog 664 -rw-rw-r-- -myscript 755 -rwxr-xr-x -mytext 664 -rw-rw-r-- -mytext.bak 664 -rw-rw-r-- -mytwin 50 -rw-r----- -mywords 664 -rw-rw-r-- -``` - -As you can see in the example above, **%n** represents the file name, **%a** the permissions in octal and **%A** the permissions in the **rwx** form. A complete list is shown below. - -To create an alias for this command, type this or add this definition to your **.bashrc** file: - -``` -$ alias ls_perms="stat -c '%n %a %A'" -``` - -To create a listing that is very close to the long listing provided by **ls -l**, do this: - -``` -$ stat -c '%A %h %U %G %s %y %n' my* --rw-rw-r-- 1 shs shs 255 2020-04-01 16:20:00.899374215 -0400 my.banner -drwxrwxr-x 2 shs shs 4096 2020-09-07 12:50:20.224470760 -0400 mydir --rw-rw-r-- 1 shs shs 6 2020-05-16 11:12:00.460355387 -0400 myfile -lrwxrwxrwx 1 shs shs 11 2020-05-28 18:49:21.666792608 -0400 myjunk --rw-rw-r-- 1 shs shs 655 2020-01-14 15:56:08.540540488 -0500 mykey --rw-rw-r-- 1 shs shs 8 2020-03-04 17:13:21.406874246 -0500 mylog --rwxr-xr-x 1 shs shs 201 2020-09-07 12:50:41.316745867 -0400 myscript --rw-rw-r-- 1 shs shs 40 2019-06-06 08:54:09.538663323 -0400 mytext --rw-rw-r-- 1 shs shs 24 2019-06-06 08:48:59.652712578 -0400 mytext.bak --rw-r----- 2 shs shs 228 2019-04-12 19:37:12.790284604 -0400 mytwin --rw-rw-r-- 1 shs shs 1983 2020-08-10 14:39:57.164842370 -0400 mywords -``` - -The differences include: 1) no attempt to line up the fields in discernible columns, 2) the date in a _**yyyy-mm-dd**_ format, 3) considerably more precision in the time field and 4) the addition of the time zone (-0400 is EDT). - -If you want to see files listed according to the date they were most last accessed (e.g., displayed with the **cat** command), use a command like this: - -``` -$ stat -c '%n %x' my* | sort -k2 -mytwin 2019-04-22 11:25:20.656828964 -0400 -mykey 2020-08-20 16:10:34.479324431 -0400 -mylog 2020-08-20 16:10:34.527325066 -0400 -myfile 2020-08-20 16:10:57.815632794 -0400 -mytext.bak 2020-08-20 16:10:57.935634379 -0400 -mytext 2020-08-20 16:15:42.323391985 -0400 -mywords 2020-08-20 16:15:43.479407259 -0400 -myjunk 2020-09-07 10:04:26.543980300 -0400 -myscript 2020-09-07 12:50:41.312745815 -0400 -my.banner 2020-09-07 13:22:38.105826116 -0400 -mydir 2020-09-07 14:53:10.171867194 -0400 -``` - -The field options available for listing file details with **stat** include: - - * %a – access rights in octal (note '#' and '0' printf flags) - * %A – access rights in human readable form - * %b – number of blocks allocated (see %B) - * %B – the size in bytes of each block reported by %b - * %C – SELinux security context string - * %d – device number in decimal - * %D – device number in hex - * %f – raw mode in hex - * %F – file type - * %g – group ID of owner - * %G – group name of owner - * %h – number of hard links - * %i – inode number - * %m – mount point - * %n – file name - * %N – quoted file name with dereference if symbolic link - * %o – optimal I/O transfer size hint - * %s – total size, in bytes - * %t – major device type in hex, for character/block device special files - * %T – minor device type in hex, for character/block device special files - * %u – user ID of owner - * %U – user name of owner - * %w – time of file birth, human-readable; - if unknown - * %W – time of file birth, seconds since Epoch; 0 if unknown - * %x – time of last access, human-readable - * %X – time of last access, seconds since Epoch - * %y – time of last data modification, human-readable - * %Y – time of last data modification, seconds since Epoch - * %z – time of last status change, human-readable - * %Z – time of last status change, seconds since Epoch - - - -These field choices are all listed in the man page and you can choose any, though creating a few aliases with your preferred details should save you a lot of trouble. Some options, like the SELinux security context string, will not be available unless that option is in use on the system. File birth is only available if your system retains that information. - -Join the Network World communities on [Facebook][2] and [LinkedIn][3] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3573802/using-the-linux-stat-command-to-create-flexible-file-listings.html - -作者:[Sandra Henry-Stocker][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://www.networkworld.com/author/Sandra-Henry_Stocker/ -[b]: https://github.com/lujun9972 -[1]: https://www.networkworld.com/newsletters/signup.html -[2]: https://www.facebook.com/NetworkWorld/ -[3]: https://www.linkedin.com/company/network-world diff --git a/translated/tech/20200909 Using the Linux stat command to create flexible file listings.md b/translated/tech/20200909 Using the Linux stat command to create flexible file listings.md new file mode 100644 index 0000000000..99e9d6c5a0 --- /dev/null +++ b/translated/tech/20200909 Using the Linux stat command to create flexible file listings.md @@ -0,0 +1,133 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using the Linux stat command to create flexible file listings) +[#]: via: (https://www.networkworld.com/article/3573802/using-the-linux-stat-command-to-create-flexible-file-listings.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +使用 Linux stat 命令创建灵活的文件列表 +====== + +**stat** 命令提供了很多关于文件的详细信息。 + +它不仅提供了文件最近变化的日期/时间,还显示了最近访问文件的时间和权限变化。它可以同时告诉你文件的字节大小和块的数量。它显示文件使用的 inode 以及文件类型。它包括文件所有者和相关用户组的名称和 UID/GID。它以 “rwx”(被称为 "人类可读 "格式)和数字方式显示文件权限。在某些系统中,它甚至可能包括文件创建的日期和时间(称为"出生")。 + +除了提供所有这些信息外,**stat** 命令还可以用来创建文件列表。这些列表非常灵活,你可以选择包含上述任何或全部信息。 + +要生成一个自定义列表,你只需要使用 **stat** 命令的 **-c**(或 --**format**)选项,并指定你想要包含的字段。例如,要创建一个以两种格式显示文件权限的列表,使用这个命令: + +``` +$ stat -c '%n %a %A' my* +my.banner 664 -rw-rw-r-- +mydir 775 drwxrwxr-x +myfile 664 -rw-rw-r-- +myjunk 777 lrwxrwxrwx +mykey 664 -rw-rw-r-- +mylog 664 -rw-rw-r-- +myscript 755 -rwxr-xr-x +mytext 664 -rw-rw-r-- +mytext.bak 664 -rw-rw-r-- +mytwin 50 -rw-r----- +mywords 664 -rw-rw-r-- +``` + +如上例所示,**%n** 代表文件名,**%a** 代表八进制的权限,**%A** 代表 **rwx** 形式的权限。完整的列表如下所示。 + +要为这个命令创建一个别名,输入这个,或在 **.bashrc** 文件中添加这个定义。 + +``` +$ alias ls_perms="stat -c '%n %a %A'" +``` + +要创建一个非常接近 **ls -l** 提供的长列表,可以这样做: + +``` +$ stat -c '%A %h %U %G %s %y %n' my* +-rw-rw-r-- 1 shs shs 255 2020-04-01 16:20:00.899374215 -0400 my.banner +drwxrwxr-x 2 shs shs 4096 2020-09-07 12:50:20.224470760 -0400 mydir +-rw-rw-r-- 1 shs shs 6 2020-05-16 11:12:00.460355387 -0400 myfile +lrwxrwxrwx 1 shs shs 11 2020-05-28 18:49:21.666792608 -0400 myjunk +-rw-rw-r-- 1 shs shs 655 2020-01-14 15:56:08.540540488 -0500 mykey +-rw-rw-r-- 1 shs shs 8 2020-03-04 17:13:21.406874246 -0500 mylog +-rwxr-xr-x 1 shs shs 201 2020-09-07 12:50:41.316745867 -0400 myscript +-rw-rw-r-- 1 shs shs 40 2019-06-06 08:54:09.538663323 -0400 mytext +-rw-rw-r-- 1 shs shs 24 2019-06-06 08:48:59.652712578 -0400 mytext.bak +-rw-r----- 2 shs shs 228 2019-04-12 19:37:12.790284604 -0400 mytwin +-rw-rw-r-- 1 shs shs 1983 2020-08-10 14:39:57.164842370 -0400 mywords +``` + +不同之处包括: 1) 不试图将字段排成可辨认的一列,2) 日期是 _**yy-mm-dd**_ 格式,3) 时间字段更精确,4) 增加了时区(-0400 是 EDT)。 + +如果你想根据最后一次访问的日期来列出文件(例如,用 **cat** 命令来显示),使用这样的命令: + +``` +$ stat -c '%n %x' my* | sort -k2 +mytwin 2019-04-22 11:25:20.656828964 -0400 +mykey 2020-08-20 16:10:34.479324431 -0400 +mylog 2020-08-20 16:10:34.527325066 -0400 +myfile 2020-08-20 16:10:57.815632794 -0400 +mytext.bak 2020-08-20 16:10:57.935634379 -0400 +mytext 2020-08-20 16:15:42.323391985 -0400 +mywords 2020-08-20 16:15:43.479407259 -0400 +myjunk 2020-09-07 10:04:26.543980300 -0400 +myscript 2020-09-07 12:50:41.312745815 -0400 +my.banner 2020-09-07 13:22:38.105826116 -0400 +mydir 2020-09-07 14:53:10.171867194 -0400 +``` + +用 **stat** 列出文件细节时,可用的选项包括: + + * %a - 八进制的访问权限(注意 “#”和 “0” printf标志)。 + * %A – 人类可读的访问权限; + * %b – 分配的块数(见 %B)。 + * %B – %b 报告的每个块的字节数。 + * %C – SELinux 安全上下文字符串。 + * %d – 十进制的设备编号 + * %D – 十六进制的设备编号 + * %f – 十六进制的原始模式 + * %F – 文件类型 + * %g – 所有者的组 ID + * %G – 所有者的组名 + * %h – 硬链接的数量 + * %i – inode 编号 + * %m – 挂载点 + * %n – 文件名 + * %N – 如果是符号链接,则引用的文件名会解引用。 + * %o – 最佳 I/O 传输大小提示 + * %s – 以字节为单位的总大小。 + * %t – 十六进制的主要设备类型,用于字符/块设备特殊文件。 + * %T – 十六进制的次要设备类型,用于字符/块设备特殊文件。 + * %u – 所有者的用户 ID + * %U – 所有者的用户名 + * %w – 文件创建时间,以人类可读形式; 如果未知,则为 -。 + * %W – 文件创建时间,以纪元以来的秒数形式;如果未知,则为 0。 + * %x – 上次访问时间,以人类可读形式。 + * %X – 上次访问时间,以纪元以来的秒数形式。 + * %y – 上次数据修改时间,以人类可读形式。 + * %Y – 上次数据修改时间,以纪元以来的秒数形式。 + * %z – 上次状态改变的时间,以人类可读形式。 + * %Z – 上次状态改变的时间,以纪元以来的秒数形式。 + + + +这些字段的选择都列在手册页中,你可以选择任何一个,不过用你喜欢的选项创建一些别名应该可以省去很多麻烦。有些选项,如 SELinux 安全上下文字符串,除非在系统中有使用,它将无法使用。文件创建只有在你的系统保留该信息的情况下才能使用。 + +加入 [Facebook][2] 和 [LinkedIn][3] 上的 Network World 社区,评论热门主题。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3573802/using-the-linux-stat-command-to-create-flexible-file-listings.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world From eb3565ae04f5008caa648dfe0c4afa93d8f4fd8e Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 15 Sep 2020 08:49:19 +0800 Subject: [PATCH 0122/1156] translating --- ...ts You Use NFC to Easily Authenticate Your Secure Devices.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md b/sources/tech/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md index 7868e418c1..fbbcb3faa6 100644 --- a/sources/tech/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md +++ b/sources/tech/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From a5014fd730ae27ca53dcee613c404a87235269c7 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Tue, 15 Sep 2020 08:44:46 +0800 Subject: [PATCH 0123/1156] Translated. --- ...08 6 best practices for teams using Git.md | 130 ------------------ ...08 6 best practices for teams using Git.md | 4 +- 2 files changed, 2 insertions(+), 132 deletions(-) delete mode 100644 sources/tech/20200708 6 best practices for teams using Git.md diff --git a/sources/tech/20200708 6 best practices for teams using Git.md b/sources/tech/20200708 6 best practices for teams using Git.md deleted file mode 100644 index 6d9260b0f8..0000000000 --- a/sources/tech/20200708 6 best practices for teams using Git.md +++ /dev/null @@ -1,130 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (LazyWolfLin) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (6 best practices for teams using Git) -[#]: via: (https://opensource.com/article/20/7/git-best-practices) -[#]: author: (Ravi Chandran https://opensource.com/users/ravichandran) - -6 best practices for teams using Git -====== -Work more effectively by using these Git collaboration strategies. -![Women in tech boardroom][1] - -Git is very useful for helping small teams manage their software development processes, but there are ways you can make it even more effective. I've found a number of best practices that help my team, especially as new team members join with varying levels of Git expertise. - -### Formalize Git conventions for your team - -Everyone should follow standard conventions for branch naming, tagging, and coding. Every organization has standards or best practices, and many recommendations are freely available on the internet. What's important is to pick a suitable convention early on and follow it as a team. - -Also, different team members will have different levels of expertise with Git. You should create and maintain a basic set of instructions for performing common Git operations that follow the project's conventions. - -### Merge changes properly - -Each team member should work on a separate feature branch. But even when separate branches are used, everyone eventually modifies some common files. When merging the changes back into the `master` branch, the merge typically will not be automatic. Human intervention may be needed to reconcile different changes made by two authors to the same file. This is where you have to learn to deal with Git merge techniques. - -Modern editors have features to help with [Git merge conflicts][2]. They indicate various options for a merge in each part of a file, such as whether to keep your changes, the other branch's changes, or both. It may be time to pick a different code editor if yours doesn't support such capabilities. - -### Rebase your feature branch often - -As you continue to develop your feature branch, rebase it against `master` often. This means executing the following steps regularly: - - -``` -git checkout master -git pull -git checkout feature-xyz  # name of your hypothetical feature branch -git rebase master  # may need to fix merge conflicts in feature-xyz -``` - -These steps [rewrite history][3] in your feature branch (and that's not a bad thing). First, it makes your feature branch look like `master` with all the updates made to `master` up to that point. Then all your commits to the feature branch are replayed on top, so they appear sequentially in the Git log. You may get merge conflicts that you'll need to resolve along the way, which can be a challenge. However, this is the best point to deal with merge conflicts because it only impacts your feature branch. - -After you fix any conflicts and perform regression testing, if you're ready to merge your feature back into `master`, do the above rebase steps one more time, then perform the merge: - - -``` -git checkout master -git pull -git merge feature-xyz -``` - -In the interim, if someone else pushes changes to `master` that conflict with yours, the Git merge will have conflicts again. You'll need to resolve them and repeat the regression testing. - -There are other merge philosophies (e.g., without rebasing and only using merge to avoid rewriting history), some of which may even be simpler to use. However, I've found the approach above to be a clean and reliable strategy. The commit history is stacked up as a meaningful sequence of features. - -With "pure merge" strategies (without rebasing regularly, as suggested above), the history in the `master` branch will be interspersed with the commits from all the features being developed concurrently. Such a mixed-up history is harder to review. The exact commit times are usually not that important. It's better to have a history that's easier to review. - -### Squash commits before merging - -When working on your feature branch, it's fine to add a commit for even minor changes. However, if every feature branch produced 50 commits, the resulting number of commits in the `master` branch could grow unnecessarily large as features are added. In general, there should only be one or a few commits added to `master` from each feature branch. To achieve this, _squash_ multiple commits into one or a handful of commits with more elaborate messages for each one. This is typically done using a command such as: - - -``` -`git rebase -i HEAD~20  # look at up to 20 commits to consider squashing` -``` - -When this is executed, an editor pops up with a list of commits that you can act upon in several ways, including _pick_ or _squash_. Picking a commit means keeping that commit message. Squashing implies combining that commit's message into the previous commit. Using these and other options, you can combine commit messages into one and do some editing and cleanup. It's also an opportunity to get rid of the commit messages that aren't important (e.g., a commit message about fixing a typo). - -In summary, keep all the actions associated with the commits, but combine and edit the associated message text for improved clarity before merging into `master`. Don't inadvertently drop a commit during the rebase process. - -After performing such a rebase, I like to look at the `git log` one last time to make final edits: - - -``` -`git commit --amend` -``` - -Finally, forcing an update to your remote feature branch is necessary, since the Git commit history for the branch has been rewritten: - - -``` -`git push -f` -``` - -### Use tags - -After you have finished testing and are ready to deploy the software from the `master` branch, or if you want to preserve the current state as a significant milestone for any other reason, create a Git tag. While a branch accumulates a history of changes corresponding to commits, a tag is a snapshot of the branch's state at that instant. A tag can be thought of as a history-less branch or as a named pointer to a specific commit immediately before the tag was created. - -Configuration control is about preserving the state of code at various milestones. Being able to reproduce software source code for any milestone so that it can be rebuilt when necessary is a requirement in most projects. A Git tag provides a unique identifier for such a code milestone. Tagging is straightforward: - - -``` -git tag milestone-id -m "short message saying what this milestone is about" -git push --tags   # don't forget to explicitly push the tag to the remote -``` - -Consider a scenario where software corresponding to a given Git tag is distributed to a customer, and the customer reports an issue. While the code in the repository may continue to evolve, it's often necessary to go back to the state of the code corresponding to the Git tag to reproduce the customer issue precisely to create a bug fix. Sometimes newer code may have already fixed the issue but not always. Typically, you'd check out the specific tag and create a branch from that tag: - - -``` -git checkout milestone-id        # checkout the tag that was distributed to the customer -git checkout -b new-branch-name  # create new branch to reproduce the bug -``` - -Beyond this, consider using annotated tags and signed tags if they may be beneficial to your project. - -### Make the software executable print the tag - -In most embedded projects, the resulting binary file created from a software build has a fixed name. The Git tag corresponding to the software binary file cannot be inferred from its filename. It is useful to "embed the tag" into the software at build time to correlate any future issues precisely to a given build. Embedding the tag can be automated within the build process. Typically, the tag string `git describe` generates is inserted into the code before code compilation so that the resulting executable will print the tag string while booting up. When a customer reports an issue, they can be guided to send you a copy of the boot output. - -### Conclusion - -Git is a sophisticated tool that takes time to master. Using these practices can help teams successfully collaborate using Git, regardless of their expertise level. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/7/git-best-practices - -作者:[Ravi Chandran][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://opensource.com/users/ravichandran -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/christina-wocintechchat-com-rg1y72ekw6o-unsplash_1.jpg?itok=MoIv8HlK (Women in tech boardroom) -[2]: https://opensource.com/article/20/4/git-merge-conflict -[3]: https://opensource.com/article/20/4/git-rebase-i diff --git a/translated/tech/20200708 6 best practices for teams using Git.md b/translated/tech/20200708 6 best practices for teams using Git.md index 8e065930fa..45db9c3840 100644 --- a/translated/tech/20200708 6 best practices for teams using Git.md +++ b/translated/tech/20200708 6 best practices for teams using Git.md @@ -26,7 +26,7 @@ Git 非常有助于小团队管理自身的软件开发进度,但有些方法 每个团队成员都需要在独立的功能分支上开发。但是尽管使用了独立的分支,每个人最终都会修改到一些通用文件。当把更改合并回 `master` 分支时,合并通常无法自动进行。可能需要手动解决不同作者对同一文件不同变更的冲突。这就是你必须学会如何处理 Git 合并技术的原因。 -现代编辑器具有协助解决 [Git 合并冲突][2]的功能。Modern editors have features to help with [Git merge conflicts][2]. 它们对同一文件合并的每一个部分提供多种选择,例如,是否保留你的更改,或者是保留另一分支的更改,亦或者是全部保留。如果你的编辑器不支持这些功能,那么可能是时候换一个代码编辑器了。 +现代编辑器具有协助解决 [Git 合并冲突][2]的功能。它们对同一文件合并的每一个部分提供多种选择,例如,是否保留你的更改,或者是保留另一分支的更改,亦或者是全部保留。如果你的编辑器不支持这些功能,那么可能是时候换一个代码编辑器了。 ### 经常重整你的功能分支 @@ -101,7 +101,7 @@ git checkout -b new-branch-name  # 创建新的分支用于重现 bug ### 让软件运行时打印标签 -In most embedded projects, the resulting binary file created from a software build has a fixed name. The Git tag corresponding to the software binary file cannot be inferred from its filename. It is useful to "embed the tag" into the software at build time to correlate any future issues precisely to a given build. Embedding the tag can be automated within the build process. Typically, the tag string `git describe` generates is inserted into the code before code compilation so that the resulting executable will print the tag string while booting up. When a customer reports an issue, they can be guided to send you a copy of the boot output. +在大多数嵌入式项目中,从代码版本构建出二进制文件有固定的名称。但无法从它的名称推断出对应的 Git 标签。在构建时“嵌入标签”有助于将未来的问题精准地关联到特定的构建。在构建过程中可以自动地嵌入标签。通常,`git describe` 生成地标签代码会在代码编译前插入到代码中,以便生成的可执行文件能够在启时输出标签代码。当客户报告问题时,可以指导他们给你发送启动时输出的数据。 ### 总结 From 58c56bf3f75131670ba5dee3a3d26f63388a0099 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 15 Sep 2020 20:54:46 +0800 Subject: [PATCH 0124/1156] PRF @geekpi --- ...repositories with this open source tool.md | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/translated/tech/20200826 Manage your software repositories with this open source tool.md b/translated/tech/20200826 Manage your software repositories with this open source tool.md index 6fba95ae9a..4c0e293e4b 100644 --- a/translated/tech/20200826 Manage your software repositories with this open source tool.md +++ b/translated/tech/20200826 Manage your software repositories with this open source tool.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Manage your software repositories with this open source tool) @@ -9,59 +9,58 @@ 用这个开源工具管理你的软件仓库 ====== -这篇介绍 Pulp,一个开源仓库管理解决方案,它的范围和功能在不断增长。 -![Cut pieces of citrus fruit and pomegranates][1] -[Foreman][2] 是一个强大的管理和自动化产品,它为 Linux 环境的管理员提供了企业级的解决方案,来用于四个关键场景:预备管理、配置管理、补丁管理和内容管理。Foreman 中内容管理功能的一个主要组成部分是由 Pulp 项目提供的。虽然 Pulp 是这个产品的一个组成部分,但它也是一个独立的、免费的、开源的项目,自身也在取得巨大的进步。 +> 这篇文章介绍 Pulp,一个开源仓库管理解决方案,它的使用范围和功能在不断增长。 +![](https://img.linux.net.cn/data/attachment/album/202009/15/205353hlidoullmmj44vzq.jpg) + +[Foreman][2] 是一个强大的管理和自动化产品,它为 Linux 环境的管理员提供了企业级的解决方案,它适用于四个关键场景:供应管理、配置管理、补丁管理和内容管理。Foreman 中内容管理功能的一个主要组成部分是由 Pulp 项目提供的。虽然 Pulp 是这个产品的一个组成部分,但它也是一个独立的、自由开源的项目,自身也在取得巨大的进步。 让我们来看看 Pulp 项目,特别是最新版本 Pulp 3 的功能。 ### 什么是 Pulp? -Pulp 是一个管理软件包仓库的平台,并将其提供给大量的消费者。你可以使用 Pulp 来跨不同环境镜像、同步、上传和推广内容,如 RPM、Python 包、Ansible 集合、容器镜像等。如果你有几十个、几百个甚至上千个软件包,并需要更好的方式来管理它们,Pulp可以帮 助你。 +Pulp 是一个管理软件包仓库,并将其提供给大量的消费者的平台。你可以使用 Pulp 在不同环境中镜像、同步、上传和推广各种内容,如 RPM、Python 包、Ansible 集合、容器镜像等。如果你有几十个、几百个甚至上千个软件包,并需要更好的方式来管理它们,Pulp 可以帮助你。 最新的主要版本是 [Pulp 3][3],它于 2019 年 12 月发布。Pulp 3 是多年来收集用户需求的结晶,并对现有的 Pulp 架构进行了全面的技术改造,以提高可靠性和灵活性。另外,它还包含了大量的新功能。 ### 谁在使用 Pulp? - -大多数情况下,Pulp 用户管理的企业软件环境中,内容的稳定性和可靠性是最重要的。Pulp 用户希望有一个平台来开发内容,而不用担心仓库可能会消失。他们希望以安全的方式在其生命周期环境的不同阶段推广内容,优化磁盘空间并扩展环境以满足新的需求。他们还需要灵活处理各种内容类型。Pulp 3 提供了这些以及更多。 +大多数情况下,在 Pulp 用户管理的企业软件环境中,内容的稳定性和可靠性是最重要的。Pulp 用户希望有一个平台来开发内容,而不用担心仓库可能会消失。他们希望以安全的方式在其生命周期环境的不同阶段推广内容,优化磁盘空间并扩展环境以满足新的需求。他们还需要灵活处理各种内容类型。Pulp 3 提供了这些以及更多功能。 ### 在一处管理各类内容 -安装 Pulp 后,你可以为你计划管理的内容类型添加[内容插件][4],将内容镜像到本地,添加私人托管的内容,并根据你的需求混合内容。例如,如果你是 Ansible 用户,而你又不想在Ansible Galaxy 上托管你的私有内容,你可以添加 Pulp Ansible 插件,镜像你所需要的公共 Ansible 内容,并将 Pulp 作为一个内部平台,在你的组织中管理和分发可扩展的公共和私有 Ansible 角色和集合的混合。你可以用任何内容类型都能实现。有各种各样的内容插件可供选择,包括 RPM、Debian、Python、容器和 Ansible 等等。还有一个文件插件,你可以用它来管理 ISO 镜像等文件。 +安装 Pulp 后,你可以为你计划管理的内容类型添加[内容插件][4],将内容镜像到本地,添加私人托管的内容,并根据你的需求混合内容。例如,如果你是 Ansible 用户,而你又不想在 Ansible Galaxy 上托管你的私有内容,你可以添加 Pulp Ansible 插件,镜像你所需要的公共 Ansible 内容,并将 Pulp 作为一个内部平台,在你的组织中管理和分发可扩展的公共和私有 Ansible 角色和集合的混合。你可以用任何内容类型执行此操作。有各种各样的内容插件可供选择,包括 RPM、Debian、Python、容器和 Ansible 等等。还有一个文件插件,你可以用它来管理 ISO 镜像等文件。 如果你没有找到你所需的内容类型插件,Pulp 3 引入了新的插件 API 和插件模板,你可以轻松创建一个属于自己的 Pulp 插件。你可以根据[插件编写指南][5]自动生成一个最小可用的插件,然后从那里开始构建。 ### 高可用性 -在 Pulp 3 中,从 MongoDB 到 PostgreSQL 的变化促成了性能和数据完整性的重大改进。Pulp 用户现在有了一个完全开源的技术栈,它可以提供高可用性 (HA) 和更好的扩展性。 +在 Pulp 3 中,从 MongoDB 到 PostgreSQL 的转变促进了性能和数据完整性的重大改进。Pulp 用户现在有了一个完全开源的技术栈,它可以提供高可用性(HA)和更好的扩展性。 ### 仓库版本管理 -使用 Pulp 3,你可以毫无风险地进行试验。每次你添加或删除内容时,Pulp 都会创建一个不可变的仓库版本,这样你就可以回滚到早期的版本,从而保证你操作的安全性和稳定性。通过使用发布和分发,你可以公开一个仓库的多个版本,你可以将其作为回滚到早期版本的另一种方法。如要回滚,你可以简单地将你的分发指向一个旧的发布。 +使用 Pulp 3,你可以毫无风险地进行试验。每次你添加或删除内容时,Pulp 都会创建一个不可变的仓库版本,这样你就可以回滚到早期的版本,从而保证操作的安全性和稳定性。通过使用发布和分发,你可以公开一个仓库的多个版本,你可以将其作为回滚到早期版本的另一种方法。如要回滚,你可以简单地将你的分发指向一个旧的发布。 ### 磁盘优化 -任何软件开发环境的主要挑战之一是磁盘优化。如果你不断地下载包,例如,你今天需要但明天不再需要的仓库每日构建,那么磁盘空间将很快成为一个问题。Pulp 3 的设计已经考虑到了磁盘优化。虽然默认选项下载并保存所有的软件包,你也可以启用“按需”或“流”选项。“按需”选项只下载和保存客户要求的内容,从而节省了磁盘空间。使用“流” -选项,它也会根据客户的要求进行下载,但它不会将内容保存在 Pulp 中。这对于同步内容是非常理想的,例如,从一个每日仓库同步,并让你在后期免于执行磁盘清理。 +任何软件开发环境的主要挑战之一是磁盘优化。如果你不断地下载包,例如,你今天需要但明天不再需要的仓库每日构建,那么磁盘空间将很快成为一个问题。Pulp 3 的设计已经考虑到了磁盘优化。当默认下载并保存所有的软件包,你也可以启用“按需”或“流式”选项。“按需”选项只下载和保存客户要求的内容,从而节省了磁盘空间。使用“流式”选项,它也会根据客户的要求进行下载,但它不会将内容保存在 Pulp 中。这对于同步内容是非常理想的,例如,从一个每日仓库同步,并让你在后期免于执行磁盘清理。 -### 多个存储选项 +### 多种存储选项 -即使有最好的磁盘优化,随着项目的发展,你可能需要一种方法来扩展你的部署以满足需求。除了本地文件存储,Pulp 还支持一系列的云存储选项,如 Amazon S3 和 Azure,以确保你可以扩展满足你的部署需求。 +即使进行了最好的磁盘优化,随着项目的发展,你可能需要一种方法来扩展你的部署以满足需求。除了本地文件存储,Pulp 还支持一系列的云存储选项,如 Amazon S3 和 Azure,以确保你可以扩展满足你的部署需求。 ### 保护你的内容 -Pulp 3 可以选择添加 [Certguard][6] 插件,该插件提供了一个支持 X.509 的 Contentguard,它要求客户在收到 Pulp 的内容之前提交证明其对内容的权利的证书。 +Pulp 3 可以选择添加 [Certguard][6] 插件,该插件提供了一个支持 X.509 的 ContentGuard,它要求客户在收到 Pulp 的内容之前提交证明其对内容的权利的证书。 -只要客户端的证书没有过期,且由证书颁发机构签署,并在创建时存储在 Certguard 上,任何客户端在请求时提供基于 X.509 或基于 Red Hat 订阅管理证书都将获得授权。客户端使用安全传输层(TLS)提供证书,这证明客户端不仅有证书,还有它的密钥。你可以放心地开发,知道你的内容正在受到保护。 +只要客户端的证书没有过期,且由证书颁发机构签署,并在创建时存储在 Certguard 上,任何客户端在请求时提供基于 X.509 或基于 Red Hat 订阅管理证书都将获得授权。客户端使用安全传输层(TLS)提供证书,这证明客户端不仅有证书,还有它的密钥。你可以放心地开发,知道你的内容正在受到保护。 Pulp 团队也在积极为整个 Pulp 部署一个基于角色的访问控制系统,这样管理员就可以确保正确的用户可以访问正确的环境。 ### 在容器中试用 Pulp -如果你有兴趣亲自评估Pulp 3,你可以使用 Docker 或 Podman 轻松[在容器中安装 Pulp 3][7]。Pulp 团队一直在努力简化安装过程。你也可以使用 [Ansible playbook][8] 来自动完成 Pulp 3 的全部安装和配置。 +如果你有兴趣亲自评估 Pulp 3,你可以使用 Docker 或 Podman 轻松[在容器中安装 Pulp 3][7]。Pulp 团队一直在努力简化安装过程。你也可以使用 [Ansible 剧本][8] 来自动完成 Pulp 3 的全部安装和配置。 -------------------------------------------------------------------------------- @@ -70,7 +69,7 @@ via: https://opensource.com/article/20/8/manage-repositories-pulp 作者:[Melanie Corr][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From adf9b7403f86cc19769d4eefcc804325e7f2a860 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 15 Sep 2020 20:55:59 +0800 Subject: [PATCH 0125/1156] PUB @geekpi https://linux.cn/article-12617-1.html --- ...e your software repositories with this open source tool.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200826 Manage your software repositories with this open source tool.md (98%) diff --git a/translated/tech/20200826 Manage your software repositories with this open source tool.md b/published/20200826 Manage your software repositories with this open source tool.md similarity index 98% rename from translated/tech/20200826 Manage your software repositories with this open source tool.md rename to published/20200826 Manage your software repositories with this open source tool.md index 4c0e293e4b..47eee04059 100644 --- a/translated/tech/20200826 Manage your software repositories with this open source tool.md +++ b/published/20200826 Manage your software repositories with this open source tool.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12617-1.html) [#]: subject: (Manage your software repositories with this open source tool) [#]: via: (https://opensource.com/article/20/8/manage-repositories-pulp) [#]: author: (Melanie Corr https://opensource.com/users/melanie-corr) From 8c024c6d480a674698f3d2c9536f906086a9e595 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 15 Sep 2020 21:21:45 +0800 Subject: [PATCH 0126/1156] PUB @wxy https://linux.cn/article-12618-1.html --- ...a Long Term Support (LTS) Release- What is Ubuntu LTS.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md (97%) diff --git a/translated/tech/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md b/published/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md similarity index 97% rename from translated/tech/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md rename to published/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md index 0abbd12e91..12a89fe142 100644 --- a/translated/tech/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md +++ b/published/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12618-1.html) [#]: subject: (Linux Jargon Buster: What is a Long Term Support \(LTS\) Release? What is Ubuntu LTS?) [#]: via: (https://itsfoss.com/long-term-support-lts/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) @@ -26,7 +26,7 @@ LTS 版本被认为是最稳定的版本,它经历了广泛的测试,并且 LTS 版本被推荐给生产级的消费者、企业和商家,因为你可以获得多年的软件支持,而且软件更新不会破坏系统。 -如果你注意到任何软件的非 LTS 版本,它通常是具有新功能和较短支持时间跨度(例如 6-9 个月)的前沿版本,而 LTS 版本的支持时间为3-5年。 +如果你注意到任何软件的非 LTS 版本,它通常是具有新功能和较短支持时间跨度(例如 6-9 个月)的前沿版本,而 LTS 版本的支持时间为 3-5 年。 ![][2] From e88562392c08f7ed7c0896963185665b76a18aea Mon Sep 17 00:00:00 2001 From: jlztan Date: Tue, 15 Sep 2020 21:45:03 +0800 Subject: [PATCH 0127/1156] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...s with Portainer.io (GUI tool) - Part-1.md | 247 ------------------ ...s with Portainer.io (GUI tool) - Part-1.md | 242 +++++++++++++++++ 2 files changed, 242 insertions(+), 247 deletions(-) delete mode 100644 sources/tech/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md create mode 100644 translated/tech/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md diff --git a/sources/tech/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md b/sources/tech/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md deleted file mode 100644 index 338bf058f6..0000000000 --- a/sources/tech/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md +++ /dev/null @@ -1,247 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (jlztan) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Monitor and Manage Docker Containers with Portainer.io (GUI tool) – Part-1) -[#]: via: (https://www.linuxtechi.com/monitor-manage-docker-containers-portainer-part1/) -[#]: author: (Shashidhar Soppin https://www.linuxtechi.com/author/shashidhar/) - -Monitor and Manage Docker Containers with Portainer.io (GUI tool) – Part-1 -====== - -As **Docker** usage and adoption is growing faster and faster, monitoring **Docker container** images is becoming more challenging. As multiple Docker container images are getting created day-by-day, monitoring them is very important. There are already some in built tools and technologies, but configuring them is little complex. As micro-services based architecture is becoming the de-facto standard in coming days, learning such tool adds one more arsenal to your tool-set. - -Based on the above scenarios, there was in need of one light weight and robust tool requirement was growing. So Portainer.io addressed this. “ **Portainer.io** “,(Latest version is 1.20.2) the tool is very light weight(with 2-3 commands only one can configure it) and has become popular among Docker users. - -**This tool has advantages over other tools; some of these are as below** , - - * Light weight (requires only 2-3 commands to be required to run to install this tool) {Also installation image is only around 26-30MB of size) - * Robust and easy to use - * Can be used for Docker monitor and Build - * This tool provides us a detailed overview of your Docker environments - * This tool allows us to manage your containers, images, networks and volumes. - * Portainer is simple to deploy – this requires just one Docker command (can be run from anywhere.) - * Complete Docker-container environment can be monitored easily - - - -**Portainer is also equipped with** , - - * Community support - * Enterprise support - * Has professional services available(along with partner OEM services) - - - -**Functionality and features of Portainer tool are,** - - 1. It comes-up with nice Dashboard, easy to use and monitor. - 2. Many in-built templates for ease of operation and creation - 3. Support of services (OEM, Enterprise level) - 4. Monitoring of Containers, Images, Networks, Volume and configuration at almost real-time. - 5. Also includes Docker-Swarm monitoring - 6. User management with many fancy capabilities - - - -**Read Also :[How to Install Docker CE on Ubuntu 16.04 / 18.04 LTS System][1]** - -### How to install and configure Portainer.io on Ubuntu Linux / RHEL / CentOS - -**Note:** This installation is done on Ubuntu 18.04 but the installation on RHEL & CentOS would be same. We are assuming Docker CE is already installed on your system. - -``` -root@linuxtechi:~$ lsb_release -a -No LSB modules are available. -Distributor ID: Ubuntu -Description: Ubuntu 18.04 LTS -Release: 18.04 -Codename: bionic -root@linuxtechi:~$ -``` - -Create the Volume for portainer - -``` -root@linuxtechi:~$ sudo docker volume create portainer_data -portainer_data -root@linuxtechi:~$ -``` - -Launch and start Portainer Container using the beneath docker command, - -``` -root@linuxtechi:~$ sudo docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer -Unable to find image 'portainer/portainer:latest' locally -latest: Pulling from portainer/portainer -d1e017099d17: Pull complete -0b1e707a06d2: Pull complete -Digest: sha256:d6cc2c20c0af38d8d557ab994c419c799a10fe825e4aa57fea2e2e507a13747d -Status: Downloaded newer image for portainer/portainer:latest -35286de9f2e21d197309575bb52b5599fec24d4f373cc27210d98abc60244107 -root@linuxtechi:~$ -``` - -Once the complete installation is done, use the ip of host or Docker using port 9000 of the Docker engine where portainer is running using your browser. - -**Note:** If OS firewall is enabled on your Docker host then make sure 9000 port is allowed else its GUI will not come up. - -In my case, IP address of my Docker Host / Engine is “192.168.1.16” so URL will be, - - - -[![Portainer-Login-User-Name-Password][2]][3] - -Please make sure that you enter 8-character passwords. Let the admin be the user as it is and then click “Create user”. - -Now the following screen appears, in this select “Local” rectangle box. - -[![Connect-Portainer-Local-Docker][4]][5] - -Click on “Connect” - -Nice GUI with admin as user home screen appears as below, - -[![Portainer-io-Docker-Monitor-Dashboard][6]][7] - -Now Portainer is ready to launch and manage your Docker containers and it can also be used for containers monitoring. - -### Bring-up container image on Portainer tool - -[![Portainer-Endpoints][8]][9] - -Now check the present status, there are two container images are already running, if you create one more that appears instantly. - -From your command line kick-start one or two containers as below, - -``` -root@linuxtechi:~$ sudo docker run --name test -it debian -Unable to find image 'debian:latest' locally -latest: Pulling from library/debian -e79bb959ec00: Pull complete -Digest: sha256:724b0fbbda7fda6372ffed586670573c59e07a48c86d606bab05db118abe0ef5 -Status: Downloaded newer image for debian:latest -root@linuxtechi:/# -``` - -Now click Refresh button (Are you sure message appears, click “continue” on this) in Portainer GUI, you will now see 3 container images as highlighted below, - -[![Portainer-io-new-container-image][10]][11] - -Click on the “ **containers** ” (in which it is red circled above), next window appears with “ **Dashboard Endpoint summary** ” - -[![Portainer-io-Docker-Container-Dash][12]][13] - -In this page, click on “ **Containers** ” as highlighted in red color. Now you are ready to monitor your container image. - -### Simple Docker container image monitoring - -From the above step, it appears that a fancy and nice looking “Container List” page appears as below, - -[![Portainer-Container-List][14]][15] - -All the container images can be controlled from here (stop, start, etc) - -**1)** Now from this page, stop the earlier started {“test” container (this was the debian image that we started earlier)} - -To do this select the check box in front of this image and click stop button from above, - -[![Stop-Container-Portainer-io-dashboard][16]][17] - -From the command line option, you will see that this image has been stopped or exited now, - -``` -root@linuxtechi:~$ sudo docker container ls -a -CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -d45902e717c0 debian "bash" 21 minutes ago Exited (0) 49 seconds ago test -08b96eddbae9 centos:7 "/bin/bash" About an hour ago Exited (137) 9 minutes ago mycontainer2 -35286de9f2e2 portainer/portainer "/portainer" 2 hours ago Up About an hour 0.0.0.0:9000->9000/tcp compassionate_benz -root@linuxtechi:~$ -``` - -**2)** Now start the stopped containers (test & mycontainer2) from Portainer GUI, - -Select the check box in front of stopped containers, and the click on Start - -[![Start-Containers-Portainer-GUI][18]][19] - -You will get a quick window saying, “ **Container successfully started** ” and with running state - -[![Conatiner-Started-successfully-Portainer-GUI][20]][21] - -### Various other options and features are explored as below step-by-step - -**1)** Click on “ **Images** ” which is highlighted, you will get the below window, - -[![Docker-Container-Images-Portainer-GUI][22]][23] - -This is the list of container images that are available but some may not running. These images can be imported, exported or uploaded to various locations, below screen shot shows the same, - -[![Upload-Docker-Container-Image-Portainer-GUI][24]][25] - -**2)** Click on “ **volumes”** which is highlighted, you will get the below window, - -[![Volume-list-Portainer-io-gui][26]][27] - -**3)** Volumes can be added easily with following option, click on add volume button, below window appears, - -Provide the name as “ **myvol** ” in the name box and click on “ **create the volume** ” button. - -[![Volume-Creation-Portainer-io-gui][28]][29] - -The newly created volume appears as below, (with unused state) - -[![Volume-unused-Portainer-io-gui][30]][31] - -#### Conclusion: - -As from the above installation steps, configuration and playing around with various options you can see how easy and fancy looking is Portainer.io tool is. This provides multiple features and options to explore on building, monitoring docker container. As explained this is very light weight tool, so doesn’t add any overload to host system. Next set-of options will be explored in part-2 of this series. - -Read Also: **[Monitor and Manage Docker Containers with Portainer.io (GUI tool) – Part-2][32]** - --------------------------------------------------------------------------------- - -via: https://www.linuxtechi.com/monitor-manage-docker-containers-portainer-part1/ - -作者:[Shashidhar Soppin][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://www.linuxtechi.com/author/shashidhar/ -[b]: https://github.com/lujun9972 -[1]: https://www.linuxtechi.com/how-to-setup-docker-on-ubuntu-server-16-04/ -[2]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Login-User-Name-Password-1024x681.jpg -[3]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Login-User-Name-Password.jpg -[4]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Connect-Portainer-Local-Docker-1024x538.jpg -[5]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Connect-Portainer-Local-Docker.jpg -[6]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-Docker-Monitor-Dashboard-1024x544.jpg -[7]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-Docker-Monitor-Dashboard.jpg -[8]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Endpoints-1024x252.jpg -[9]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Endpoints.jpg -[10]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-new-container-image-1024x544.jpg -[11]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-new-container-image.jpg -[12]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-Docker-Container-Dash-1024x544.jpg -[13]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-Docker-Container-Dash.jpg -[14]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Container-List-1024x538.jpg -[15]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Container-List.jpg -[16]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Stop-Container-Portainer-io-dashboard-1024x447.jpg -[17]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Stop-Container-Portainer-io-dashboard.jpg -[18]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Start-Containers-Portainer-GUI-1024x449.jpg -[19]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Start-Containers-Portainer-GUI.jpg -[20]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Conatiner-Started-successfully-Portainer-GUI-1024x538.jpg -[21]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Conatiner-Started-successfully-Portainer-GUI.jpg -[22]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Docker-Container-Images-Portainer-GUI-1024x544.jpg -[23]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Docker-Container-Images-Portainer-GUI.jpg -[24]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Upload-Docker-Container-Image-Portainer-GUI-1024x544.jpg -[25]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Upload-Docker-Container-Image-Portainer-GUI.jpg -[26]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-list-Portainer-io-gui-1024x544.jpg -[27]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-list-Portainer-io-gui.jpg -[28]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-Creation-Portainer-io-gui-1024x544.jpg -[29]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-Creation-Portainer-io-gui.jpg -[30]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-unused-Portainer-io-gui-1024x544.jpg -[31]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-unused-Portainer-io-gui.jpg -[32]: https://www.linuxtechi.com/monitor-manage-docker-containers-portainer-io-part-2/ diff --git a/translated/tech/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md b/translated/tech/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md new file mode 100644 index 0000000000..b23ce0d4d8 --- /dev/null +++ b/translated/tech/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md @@ -0,0 +1,242 @@ +[#]: collector: "lujun9972" +[#]: translator: "jlztan" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "Monitor and Manage Docker Containers with Portainer.io (GUI tool) – Part-1" +[#]: via: "https://www.linuxtechi.com/monitor-manage-docker-containers-portainer-part1/" +[#]: author: "Shashidhar Soppin https://www.linuxtechi.com/author/shashidhar/" + +用 Portainer.io (图形界面工具)来监控和管理 Docker 容器 – 1 +====== + +随着 **Docker** 的使用量越来越大,监控 **Docker** 容器正在变得更有挑战性。每天都有大量的 Docker 容器被创建,因此如何监控它们就变得非常重要。已经有一些用于监控容器的构建工具和技术,不过对它们进行配置有一些复杂。随着基于微服务的架构正在变成接下来事实上的标准,学会这种技术将为你的知识库再添一项新技能。 + +基于上述场景,对一种轻量、健壮的镜像管理工具的需求日益增加。Portainer.io 解决了这个问题。“**Portainer.io**“(最新版本是 1.20.2)非常轻量(只有 2-3 个可以配置的命令),在 Docker 用户之间很流行。 + +**比起其他工具,这个工具有很多优势,其中一些如下所示:** + + * 轻量(安装此工具仅需 2 到 3 个命令,与此同时安装镜像的大小在 26 M 到 30 M 之间) + * 健壮且易用 + * 可用于 Docker 监控和构建 + * 提供对 Docker 环境的详细概况 + * 可以管理容器、镜像、网络和卷 + * Portainer 部署方便,仅需一个 Docker 命令(可以在任意地方运行) + * 可以对完整的 Docker 容器环境进行监控 + +**Portainer 同时具有以下服务:** + +- 社区支持 +- 企业支持 +- 与合作伙伴 OEM 服务一起的专业服务 + +**Portainer 的功能和特性如下:** + + 1. 配备了漂亮的仪表盘,易于使用和监控 + 2. 自带大量内置模板,便于操作和创建 + 3. 服务支持(仅 OEM 和企业用户) + 4. 对容器、镜像、网络、卷以及配置进行几乎实时的监控 + 5. 包含 Docker 集群监控功能 + 6. 功能多样的用户管理 + +**另请阅读:[如何在 Ubuntu 16.04 / 18.04 LTS 版本中安装 Docker CE][1]** + +### 如何在 Ubuntu Linux / RHEL / CentOS 系统上安装和配置 Portainer.io + +**注意:**下面的安装过程是在 Ubuntu 18.04 上完成的,但是对 RHEL 和 CentOS 同样适用,同时假设你已经在系统上安装了 Docker CE。 + +``` +root@linuxtechi:~$ lsb_release -a +No LSB modules are available. +Distributor ID: Ubuntu +Description: Ubuntu 18.04 LTS +Release: 18.04 +Codename: bionic +root@linuxtechi:~$ +``` + +为 Portainer 创建卷, + +``` +root@linuxtechi:~$ sudo docker volume create portainer_data +portainer_data +root@linuxtechi:~$ +``` + +使用下面的 Docker 命令来运行 Portainer 容器, + +``` +root@linuxtechi:~$ sudo docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer +Unable to find image 'portainer/portainer:latest' locally +latest: Pulling from portainer/portainer +d1e017099d17: Pull complete +0b1e707a06d2: Pull complete +Digest: sha256:d6cc2c20c0af38d8d557ab994c419c799a10fe825e4aa57fea2e2e507a13747d +Status: Downloaded newer image for portainer/portainer:latest +35286de9f2e21d197309575bb52b5599fec24d4f373cc27210d98abc60244107 +root@linuxtechi:~$ +``` + +安装完成之后,通过主机或 Docker 的 IP 加上 Docker 引擎使用的 9000 端口在浏览器中打开 Portainer。 + +**注意:**如果 Docker 所在主机的系统防火墙开启,需要确保 9000 端口被放行,否则浏览器页面将无法打开。 + +在我这边,我的 Docker 主机/引擎的 IP 是“192.168.1.16”,所以 URL 就是 + + + +[![Portainer-Login-User-Name-Password][2]][3] + +在创建管理员用户时,请确保密码是 8 个字符,同时用户名为 admin,然后点击“Create User”。 + +接下来进入如下所示的页面,选中“Local”矩形框。 + +[![Connect-Portainer-Local-Docker][4]][5] + +点击“Connect”, + +可以看到 admin 用户的漂亮首页如下所示, + +[![Portainer-io-Docker-Monitor-Dashboard][6]][7] + +现在 Portainer 已经准备好运行和管理你的 Docker 容器了,同时也可用于容器监控。 + +### 在 Portainer 中管理容器镜像 + +[![Portainer-Endpoints][8]][9] + +检查当前的状态,可以看到有两个容器已经在运行了,如果你创建另一个也会立即显示出来。 + +像下面这样,在命令行中启动一个或两个容器, + +``` +root@linuxtechi:~$ sudo docker run --name test -it debian +Unable to find image 'debian:latest' locally +latest: Pulling from library/debian +e79bb959ec00: Pull complete +Digest: sha256:724b0fbbda7fda6372ffed586670573c59e07a48c86d606bab05db118abe0ef5 +Status: Downloaded newer image for debian:latest +root@linuxtechi:/# +``` + +然后在 Portainer 页面中点击刷新按钮(会出现一条让你确认的消息,点击上面的“Continue”),就可以像下面高亮显示的一样看到 3 个容器了。 + +[![Portainer-io-new-container-image][10]][11] + +点击上图中红圈圈出来的“containers”,下一个页面会显示“**Dashboard Endpoint summary** ”。 + +[![Portainer-io-Docker-Container-Dash][12]][13] + +在这个页面中,点击上图高亮和红圈圈出来的“Containers”,就可以对容器进行监控了。 + +### 以简单的方式对容器进行监控 + +继续上面的步骤,就会出现一个如下所示精致、漂亮的“Container list”页面。 + +[![Portainer-Container-List][14]][15] + +所有的容器都可以在这里进行控制(停止,启动等等)。 + +**1)** 在这个页面上,停止我们之前启动的“test”容器(这是一个我们早先启动的 debian 容器) + +选中此容器前面的复选框,然后点击上面的“Stop”按钮来停止。 + +[![Stop-Container-Portainer-io-dashboard][16]][17] + +在命令行中,你也会看到这个容器现在已经停止或退出了。 + +``` +root@linuxtechi:~$ sudo docker container ls -a +CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES +d45902e717c0 debian "bash" 21 minutes ago Exited (0) 49 seconds ago test +08b96eddbae9 centos:7 "/bin/bash" About an hour ago Exited (137) 9 minutes ago mycontainer2 +35286de9f2e2 portainer/portainer "/portainer" 2 hours ago Up About an hour 0.0.0.0:9000->9000/tcp compassionate_benz +root@linuxtechi:~$ +``` + +**2)** 现在,在 Portainer 页面中启动已经停止的两个容器(test 和 mycontainer2) + +选中已停止的这两个容器前面的复选框,然后点击“Start”。 + +[![Start-Containers-Portainer-GUI][18]][19] + +你会立即看到两条窗口提醒,内容是“容器成功启动”,并且两个容器的状态变为正在运行。 + +[![Conatiner-Started-successfully-Portainer-GUI][20]][21] + +### 一步步探索其他多种选项和特性 + +**1)** 点击高亮的“Images”,你会看到如下页面 + +[![Docker-Container-Images-Portainer-GUI][22]][23] + +这是可用的容器列表,其中一些可能没在运行。这些容器可以被导入、导出或者上传到不同的位置,截图如下所示。 + +[![Upload-Docker-Container-Image-Portainer-GUI][24]][25] + +**2)** 点击高亮的“Volumes”,显示如下页面 + +[![Volume-list-Portainer-io-gui][26]][27] + +**3)** 通过下面的操作,可以很容易的添加卷。点击添加卷按钮,出现如下页面 + +在名称输入框中输入卷名称,例如 “**myvol**”,然后点击 “**Create the volume**” 按钮。 + +[![Volume-Creation-Portainer-io-gui][28]][29] + +新创建的卷如下所示(状态为未使用)。 + +[![Volume-unused-Portainer-io-gui][30]][31] + +### 结论 + +通过上面的安装步骤,你可以到配置和使用 Portainer.io 的多种选项是多么简单和精美,它提供了用于构建和监控 Docker 容器的多种功能和选项。如前所述,这个一个非常轻量的工具,因此不会给主机系统增加任何负担。下一组选项将在本系列的第 2 部分中进行探讨。 + +另请阅读: **[用 Portainer.io (图形界面工具) 来监控和管理 Docker 容器 – 2][32]** + + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/monitor-manage-docker-containers-portainer-part1/ + +作者:[Shashidhar Soppin][a] +选题:[lujun9972][b] +译者:[jlztan](https://github.com/jlztan) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linuxtechi.com/author/shashidhar/ +[b]: https://github.com/lujun9972 +[1]: https://www.linuxtechi.com/how-to-setup-docker-on-ubuntu-server-16-04/ +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Login-User-Name-Password-1024x681.jpg +[3]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Login-User-Name-Password.jpg +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Connect-Portainer-Local-Docker-1024x538.jpg +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Connect-Portainer-Local-Docker.jpg +[6]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-Docker-Monitor-Dashboard-1024x544.jpg +[7]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-Docker-Monitor-Dashboard.jpg +[8]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Endpoints-1024x252.jpg +[9]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Endpoints.jpg +[10]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-new-container-image-1024x544.jpg +[11]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-new-container-image.jpg +[12]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-Docker-Container-Dash-1024x544.jpg +[13]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-Docker-Container-Dash.jpg +[14]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Container-List-1024x538.jpg +[15]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Container-List.jpg +[16]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Stop-Container-Portainer-io-dashboard-1024x447.jpg +[17]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Stop-Container-Portainer-io-dashboard.jpg +[18]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Start-Containers-Portainer-GUI-1024x449.jpg +[19]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Start-Containers-Portainer-GUI.jpg +[20]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Conatiner-Started-successfully-Portainer-GUI-1024x538.jpg +[21]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Conatiner-Started-successfully-Portainer-GUI.jpg +[22]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Docker-Container-Images-Portainer-GUI-1024x544.jpg +[23]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Docker-Container-Images-Portainer-GUI.jpg +[24]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Upload-Docker-Container-Image-Portainer-GUI-1024x544.jpg +[25]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Upload-Docker-Container-Image-Portainer-GUI.jpg +[26]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-list-Portainer-io-gui-1024x544.jpg +[27]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-list-Portainer-io-gui.jpg +[28]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-Creation-Portainer-io-gui-1024x544.jpg +[29]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-Creation-Portainer-io-gui.jpg +[30]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-unused-Portainer-io-gui-1024x544.jpg +[31]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-unused-Portainer-io-gui.jpg +[32]: https://www.linuxtechi.com/monitor-manage-docker-containers-portainer-io-part-2/ From 6b0369c12ebc7fbf70036b5e22c077e9e74d9d03 Mon Sep 17 00:00:00 2001 From: jlztan Date: Tue, 15 Sep 2020 21:46:46 +0800 Subject: [PATCH 0128/1156] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90-?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=B8=80=E4=B8=AA=E5=A4=9A=E4=BD=99=E7=9A=84?= =?UTF-8?q?=E7=A9=BA=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...e Docker Containers with Portainer.io (GUI tool) - Part-1.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md b/translated/tech/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md index b23ce0d4d8..17bf552aff 100644 --- a/translated/tech/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md +++ b/translated/tech/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md @@ -7,7 +7,7 @@ [#]: via: "https://www.linuxtechi.com/monitor-manage-docker-containers-portainer-part1/" [#]: author: "Shashidhar Soppin https://www.linuxtechi.com/author/shashidhar/" -用 Portainer.io (图形界面工具)来监控和管理 Docker 容器 – 1 +用 Portainer.io(图形界面工具)来监控和管理 Docker 容器 – 1 ====== 随着 **Docker** 的使用量越来越大,监控 **Docker** 容器正在变得更有挑战性。每天都有大量的 Docker 容器被创建,因此如何监控它们就变得非常重要。已经有一些用于监控容器的构建工具和技术,不过对它们进行配置有一些复杂。随着基于微服务的架构正在变成接下来事实上的标准,学会这种技术将为你的知识库再添一项新技能。 From 0f13d3db79c873fd6c820a9a5213dfc21485bf28 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 15 Sep 2020 22:12:32 +0800 Subject: [PATCH 0129/1156] APL --- .../talk/20200826 What is IPv6, and why aren-t we there yet.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20200826 What is IPv6, and why aren-t we there yet.md b/sources/talk/20200826 What is IPv6, and why aren-t we there yet.md index 228970852b..fea8067def 100644 --- a/sources/talk/20200826 What is IPv6, and why aren-t we there yet.md +++ b/sources/talk/20200826 What is IPv6, and why aren-t we there yet.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f14ab06438117cdeb0596487070aed465825197e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 15 Sep 2020 23:07:48 +0800 Subject: [PATCH 0130/1156] TSL --- ...at is IPv6, and why aren-t we there yet.md | 73 +++++++++---------- 1 file changed, 36 insertions(+), 37 deletions(-) diff --git a/sources/talk/20200826 What is IPv6, and why aren-t we there yet.md b/sources/talk/20200826 What is IPv6, and why aren-t we there yet.md index fea8067def..1d46571148 100644 --- a/sources/talk/20200826 What is IPv6, and why aren-t we there yet.md +++ b/sources/talk/20200826 What is IPv6, and why aren-t we there yet.md @@ -5,85 +5,84 @@ [#]: url: ( ) [#]: subject: (What is IPv6, and why aren’t we there yet?) [#]: via: (https://www.networkworld.com/article/3254575/what-is-ipv6-and-why-aren-t-we-there-yet.html) -[#]: author: (Keith Shaw and Josh Fruhlinger ) +[#]: author: (Keith Shaw, Josh Fruhlinger ) -What is IPv6, and why aren’t we there yet? +什么是 IPv6,为什么我们还普及? ====== -IPv6 has been in the works since 1998 to address the shortfall of IP addresses available under Ipv4, yet despite its efficiency and security advantages, adoption is still slow. -Thinkstock -For the most part the dire warnings about running out of internet addresses have ceased because, slowly but surely, migration from the world of Internet Protocol Version 4 (IPv4) to IPv6 has begun, and software is in place to prevent the address apocalypse that many were predicting. +自 1998 年以来,IPv6 一直在努力解决 IPv4 可用 IP 地址的不足的问题,然而尽管 IPv6 在效率和安全方面具有优势,但其采用速度仍然缓慢。 -But before we see where are and where we’re going with IPv6, let’s go back to the early days of internet addressing. +![](https://images.idgesg.net/images/article/2017/11/ipv6newip-100740801-large.jpg) -**[ Related: [IPv6 deployment guide][1] + [How to plan your migration to IPv6][2] ]** +在大多数情况下,已经没人一再警告互联网地址耗尽的可怕境况,因为,虽然缓慢,但坚定地,从互联网协议版本 4(IPv4)的世界到 IPv6 的迁移已经开始,并且相关软件已经到位,以防止许多人预测的地址耗竭。 -### What is IPv6 and why is it important? +但在我们看到 IPv6 的现状和发展方向之前,让我们先回到互联网寻址的早期。 -IPv6 is the latest version of the Internet Protocol, which identifies devices across the internet so they can be located. Every device that uses the internet is identified through its own IP address in order for internet communication to work. In that respect, it’s just like the street addresses and zip codes you need to know in order to mail a letter. +### 什么是 IPv6,为什么它很重要? -The previous version, IPv4, uses a 32-bit addressing scheme to support 4.3 billion devices, which was thought to be enough. However, the growth of the internet, personal computers, smartphones and now Internet of Things devices proves that the world needed more addresses. +IPv6 是最新版本的互联网协议Internet Protocol(IP),它可以识别互联网上的设备,从而确定它们的位置。每一个使用互联网的设备都要通过自己的 IP 地址来识别,以便互联网通信工作。在这方面,它就像你需要知道的街道地址和邮政编码一样,以便邮寄信件。 -Fortunately, the Internet Engineering Task Force (IETF) recognized this 20 years ago. In 1998 it created IPv6, which instead uses 128-bit addressing to support approximately 340 trillion trillion (or 2 to the 128th power, if you like). Instead of the IPv4 address method of four sets of one- to three-digit numbers, IPv6 uses eight groups of four hexadecimal digits, separated by colons. +之前的版本 IPv4 采用 32 位寻址方案,可以支持 43 亿台设备,本以为已经足够。然而,互联网、个人电脑、智能手机以及现在物联网设备的发展证明,这个世界需要更多的地址。 -### What are the benefits of IPv6? +幸运的是,互联网工程任务组Internet Engineering Task Force(IETF)在 20 年前就认识到了这一点。1998 年,它创建了 IPv6,使用 128 位寻址方式来支持大约 340 亿亿亿trillion trillion(或者 2 的 128 次幂,如果你喜欢的话)。IPv4 的地址可表示为四组一至三位十进制数,IPv6 则使用八组四位十六进制数字,用冒号隔开。 -In its work, the IETF included enhancements to IPv6 compared with IPv4. The IPv6 protocol can handle packets more efficiently, improve performance and increase security. It enables internet service providers to reduce the size of their routing tables by making them more hierarchical. +### IPv6 的好处是什么? -### Network address translation (NAT) and IPv6 +IETF 在其工作中加入了 IPv6 对 IPv4 增强的功能。IPv6 协议可以更有效地处理数据包,提高性能和增加安全性。它使互联网服务提供商(ISP)能够通过使他们的路由表更有层次性来减少其大小。 -Adoption of IPv6 has been delayed in part due to network address translation (NAT), which takes private IP addresses and turns them into public IP addresses. That way a corporate machine with a private IP address can send to and receive packets from machines located outside the private network that have public IP addresses. +### 网络地址转换(NAT)和 IPv6 -Without NAT, large corporations with thousands or tens of thousands of computers would devour enormous quantities of public IPv4 addresses if they wanted to communicate with the outside world. But those IPv4 addresses are limited and nearing exhaustion to the point of having to be rationed. +IPv6 的采用被推迟,部分原因是网络地址转换network address translation(NAT)导致的,它将私有 IP 地址转化为公共 IP 地址。这样一来,拥有私也 IP 地址的企业的机器就可以向位于私人网络之外拥有公共 IP 地址的机器发送和接收数据包。 -NAT helps alleviate the problem. With NAT, thousands of privately addressed computers can be presented to the public internet by a NAT machine such as a firewall or router. +如果没有 NAT,拥有数千台或数万台计算机的大公司如果要与外界通信,就会吞噬大量的公有 IPv4 地址。但是这些 IPv4 地址是有限的,而且接近枯竭,以至于不得不限制分配。 -The way NAT works is when a corporate computer with a private IP address sends a packet to a public IP address outside the corporate network, it first goes to the NAT device. The NAT notes the packet’s source and destination addresses in a translation table. +NAT 有助于缓解这个问题。有了 NAT,成千上万的私有地址计算机可以通过防火墙或路由器等 NAT 机器呈现在公共互联网上。 -The NAT changes the source address of the packet to the public-facing address of the NAT device and sends it along to the external destination. When a packet replies, the NAT translates the destination address to the private IP address of the computer that initiated the communication. This can be done so that a single public IP address can represent multiple privately addressed computers. +NAT 的工作方式是,当一台拥有私有 IP 地址的企业计算机向企业网络外的公共 IP 地址发送数据包时,首先会进入 NAT 设备。NAT 在翻译表中记下数据包的源地址和目的地址。 -### Who is deploying IPv6? +NAT 将数据包的源地址改为 NAT 设备面向公众的地址,并将数据包一起发送到外部目的地。当数据包回复时,NAT 将目的地址翻译成发起通信的计算机的私有 IP 地址。这样一来,一个公网 IP 地址可以代表多台私有地址的计算机。 -Carrier networks and ISPs have been the first group to start deploying IPv6 on their networks, with mobile networks leading the charge. For example, T-Mobile USA has more than 90% of its traffic going over IPv6, with Verizon Wireless close behind at 82.25%. Comcast and AT&T have its networks at 63% and 65%, respectively, according to the industry group [World Ipv6 Launch][3]. +### 谁在部署 IPv6? -Major websites are following suit - just under 30% of the Alexa Top 1000 websites are currently reachable over IPv6, World IPv6 Launch says. +运营商网络和互联网服务供应商是最早开始在其网络上部署 IPv6 的群体,其中移动网络处于领先地位。例如,T-Mobile USA 有超过 90% 的流量通过 IPv6,Verizon Wireless 紧随其后,占 82.25%。根据行业组织 [World Ipv6 Launch][3] 的数据,Comcast 和 AT&T 的网络分别为 63% 和 65%。 -Enterprises are trailing in deployment, with slightly under one-fourth of enterprises advertising IPv6 prefixes, according to the Internet Society’s [“State of IPv6 Deployment 2017” report][4]. Complexity, costs and time needed to complete are all reasons given. In addition, some projects have been delayed due to software compatibility. For example, a [January 2017 report][5] said a bug in Windows 10 was “undermining Microsoft’s efforts to roll out an IPv6-only network at its Seattle headquarters.” +主要网站则排在其后 —— World IPv6 Launch 称,目前 Alexa 前 1000 的网站中只有不到 30% 可以通过 IPv6 到达。 -### When will more deployments occur? +企业在部署方面比较落后,根据互联网协会Internet Society的[《2017年 IPv6 部署状况》报告][4],只有不到四分之一的企业宣传其 IPv6 前缀。复杂性、成本和完成迁移所需时间都是给出的理由。此外,一些项目由于软件兼容性的问题而被推迟。例如,一份 [2017 年 1 月的报告][5]称,Windows 10 中的一个 bug “破坏了微软在其西雅图总部推出纯 IPv6 网络的努力”。 -The Internet Society said the price of IPv4 addresses will peak in 2018, and then prices will drop after IPv6 deployment passes the 50% mark. Currently, [according to Google][6], the world has 20% to 22% IPv6 adoption, but in the U.S. it’s about 32%). +### 何时会有更多部署? -As the price of IPv4 addresses begin to drop, the Internet Society suggests that enterprises sell off their existing IPv4 addresses to help fund IPv6 deployment. The Massachusetts Institute of Technology has done this, according to [a note posted on GitHub][7]. The university concluded that 8 million of its IPv4 addresses were “excess” and could be sold without impacting current or future needs since it also holds 20 nonillion IPv6 addresses. (A nonillion is the numeral one followed by 30 zeroes.) +互联网协会表示,IPv4 地址的价格将在 2018 年达到顶峰,然后在 IPv6 部署通过 50% 大关后,价格会下降。目前,[根据 Google][6],全球的 IPv6 采用率为 20% 到 22%,但在美国约为 32%。 -In addition, as more deployments occur, more companies will start charging for the use of IPv4 addresses, while providing IPv6 services for free. [UK-based ISP Mythic Beasts][8] says “IPv6 connectivity comes as standard,” while “IPv4 connectivity is an optional extra.” +随着 IPv4 地址的价格开始下降,互联网协会建议企业出售现有的 IPv4 地址,以帮助资助其 IPv6 的部署。根据[一个发布在 GitHub 上的说明][7],麻省理工学院已经这样做了。这所大学得出的结论是,其 800 万个 IPv4 地址是“过剩”的,可以在不影响当前或未来需求的情况下出售,因为它还持有 20 个非亿级nonillion IPv6 地址。(非亿级地址是指数字 1 后面跟着 30 个零)。 -### When will IPv4 be “shut off”? +此外,随着部署的增多,更多的公司将开始对 IPv4 地址的使用收费,而免费提供 IPv6 服务。[英国的 ISP Mythic Beasts][8] 表示,“IPv6 连接是标配”,而 “IPv4 连接是可选的额外服务”。 -Most of the world [“ran out” of new IPv4 addresses][9] between 2011 and 2018 – but we won’t completely be out of them as IPv4 addresses get sold and re-used (as mentioned earlier), and any leftover addresses will be used for IPv6 transitions. +### IPv4 何时会被“关闭”? -There’s no official switch-off date, so people shouldn’t be worried that their internet access will suddenly go away one day. As more networks transition, more content sites support IPv6 and more end users upgrade their equipment for IPv6 capabilities, the world will slowly move away from IPv4. +在 2011 年至 2018 年期间,世界上大部分地区[“用完”了新的 IPv4 地址][9] —— 但我们不会完全没有了这些地址,因为 IPv4 地址会被出售和重新使用(如前所述),而任何剩余的地址将用于 IPv6 过渡。 -### Why is there no IPv5? +目前还没有正式的关闭日期,所以人们不应该担心有一天他们的互联网接入会突然消失。随着越来越多的网络过渡,越来越多的内容网站支持 IPv6,以及越来越多的终端用户为 IPv6 功能升级设备,世界将慢慢远离 IPv4。 -There was an IPv5 that was also known as Internet Stream Protocol, abbreviated simply as ST. It was designed for connection-oriented communications across IP networks with the intent of supporting voice and video. +### 为什么没有 IPv5? -It was successful at that task, and was used experimentally. One shortcoming that undermined  its popular use was its 32-bit address scheme – the same scheme used by IPv4. As a result, it had the same problem that IPv4 had – a limited number of possible IP addresses. That led to the development and eventual adoption of IPv6. Even though IPv5 was never adopted publicly, it had used up the name IPv5. +曾经有一个 IPv5,也被称为互联网流协议Internet Stream Protocol,简称 ST。它被设计用于跨 IP 网络的面向连接的通信,目的是支持语音和视频。 -Join the Network World communities on [Facebook][10] and [LinkedIn][11] to comment on topics that are top of mind. +它在这个任务上是成功的,并被实验性地使用。它的一个缺点是它的 32 位地址方案 —— 与 IPv4 使用的方案相同,从而影响了它的普及。因此,它存在着与 IPv4 相同的问题 —— 可用的 IP 地址数量有限。这导致了 IPv6 的发展和最终采用。尽管 IPv5 从未被公开采用,但它已经用掉了 IPv5 这个名字。 -------------------------------------------------------------------------------- via: https://www.networkworld.com/article/3254575/what-is-ipv6-and-why-aren-t-we-there-yet.html -作者:[Keith Shaw and Josh Fruhlinger][a] +作者:[Keith Shaw][a],[Josh Fruhlinger][c] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[wxy](https://github.com/wxy) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 -[a]: +[a]: https://www.networkworld.com/author/Keith-Shaw/ +[c]: https://www.networkworld.com/author/Josh-Fruhlinger/ [b]: https://github.com/lujun9972 [1]: https://www.networkworld.com/article/3235805/lan-wan/ipv6-deployment-guide.html#tk.nww-fsb [2]: https://www.networkworld.com/article/3214388/lan-wan/how-to-plan-your-migration-to-ipv6.html#tk.nww-fsb From f9c8ee9538a64ec76d371ae3e6ca42f84eae95d8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 16 Sep 2020 05:02:10 +0800 Subject: [PATCH 0131/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200915?= =?UTF-8?q?=20Improve=20your=20time=20management=20with=20Jupyter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200915 Improve your time management with Jupyter.md --- ...prove your time management with Jupyter.md | 324 ++++++++++++++++++ 1 file changed, 324 insertions(+) create mode 100644 sources/tech/20200915 Improve your time management with Jupyter.md diff --git a/sources/tech/20200915 Improve your time management with Jupyter.md b/sources/tech/20200915 Improve your time management with Jupyter.md new file mode 100644 index 0000000000..65c9e05f86 --- /dev/null +++ b/sources/tech/20200915 Improve your time management with Jupyter.md @@ -0,0 +1,324 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Improve your time management with Jupyter) +[#]: via: (https://opensource.com/article/20/9/calendar-jupyter) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +Improve your time management with Jupyter +====== +Discover how you are spending time by parsing your calendar with Python +in Jupyter. +![Calendar close up snapshot][1] + +[Python][2] has incredibly scalable options for exploring data. With [Pandas][3] or [Dask][4], you can scale [Jupyter][5] up to big data. But what about small data? Personal data? Private data? + +JupyterLab and Jupyter Notebook provide a great environment to scrutinize my laptop-based life. + +My exploration is powered by the fact that almost every service I use has a web application programming interface (API). I use many such services: a to-do list, a time tracker, a habit tracker, and more. But there is one that almost everyone uses: _a calendar_. The same ideas can be applied to other services, but calendars have one cool feature: an open standard that almost all web calendars support: `CalDAV`. + +### Parsing your calendar with Python in Jupyter + +Most calendars provide a way to export into the `CalDAV` format. You may need some authentication for accessing this private data. Following your service's instructions should do the trick. How you get the credentials depends on your service, but eventually, you should be able to store them in a file. I store mine in my root directory in a file called `.caldav`: + + +``` +import os +with open(os.path.expanduser("~/.caldav")) as fpin: +    username, password = fpin.read().split() +``` + +Never put usernames and passwords directly in notebooks! They could easily leak with a stray `git push`. + +The next step is to use the convenient PyPI [caldav][6] library. I looked up the CalDAV server for my email service (yours may be different): + + +``` +import caldav +client = caldav.DAVClient(url="", username=username, password=password) +``` + +CalDAV has a concept called the `principal`. It is not important to get into right now, except to know it's the thing you use to access the calendars: + + +``` +principal = client.principal() +calendars = principal.calendars() +``` + +Calendars are, literally, all about time. Before accessing events, you need to decide on a time range. One week should be a good default: + + +``` +from dateutil import tz +import datetime +now = datetime.datetime.now(tz.tzutc()) +since = now - datetime.timedelta(days=7) +``` + +Most people use more than one calendar, and most people want all their events together. The `itertools.chain.from_iterable` makes this straightforward: ` ` + + +``` +import itertools + +raw_events = list( +    itertools.chain.from_iterable( +        calendar.date_search(start=since, end=now, expand=True) +        for calendar in calendars +    ) +) +``` + +Reading all the events into memory is important, and doing so in the API's raw, native format is an important practice. This means that when fine-tuning the parsing, analyzing, and displaying code, there is no need to go back to the API service to refresh the data. + +But "raw" is not an understatement. The events come through as strings in a specific format: + + +``` +`print(raw_events[12].data)`[/code] [code] + +    BEGIN:VCALENDAR +    VERSION:2.0 +    PRODID:-//CyrusIMAP.org/Cyrus +     3.3.0-232-g4bdb081-fm-20200825.002-g4bdb081a//EN +    BEGIN:VEVENT +    DTEND:20200825T230000Z +    DTSTAMP:20200825T181915Z +    DTSTART:20200825T220000Z +    SUMMARY:Busy +    UID: +     1302728i-040000008200E00074C5B7101A82E00800000000D939773EA578D601000000000 +     000000010000000CD71CC3393651B419E9458134FE840F5 +    END:VEVENT +    END:VCALENDAR +``` + +Luckily, PyPI comes to the rescue again with another helper library, [vobject][7]: + + +``` +import io +import vobject + +def parse_event(raw_event): +    data = raw_event.data +    parsed = vobject.readOne(io.StringIO(data)) +    contents = parsed.vevent.contents +    return contents + +[/code] [code]`parse_event(raw_events[12])`[/code] [code] + +    {'dtend': [<DTEND{}2020-08-25 23:00:00+00:00>], +     'dtstamp': [<DTSTAMP{}2020-08-25 18:19:15+00:00>], +     'dtstart': [<DTSTART{}2020-08-25 22:00:00+00:00>], +     'summary': [<SUMMARY{}Busy>], +     'uid': [<UID{}1302728i-040000008200E00074C5B7101A82E00800000000D939773EA578D601000000000000000010000000CD71CC3393651B419E9458134FE840F5>]} +``` + +Well, at least it's a little better. + +There is still some work to do to convert it to a reasonable Python object. The first step is to _have_ a reasonable Python object. The [attrs][8] library provides a nice start: + + +``` +import attr +from __future__ import annotations +@attr.s(auto_attribs=True, frozen=True) +class Event: +    start: datetime.datetime +    end: datetime.datetime +    timezone: Any +    summary: str +``` + +Time to write the conversion code! + +The first abstraction gets the value from the parsed dictionary without all the decorations: + + +``` +def get_piece(contents, name): +    return contents[name][0].value + +[/code] [code]`get_piece(_, "dtstart")`[/code] [code]`    datetime.datetime(2020, 8, 25, 22, 0, tzinfo=tzutc())` +``` + +Calendar events always have a start, but they sometimes have an "end" and sometimes a "duration." Some careful parsing logic can harmonize both into the same Python objects: + + +``` +def from_calendar_event_and_timezone(event, timezone): +    contents = parse_event(event) +    start = get_piece(contents, "dtstart") +    summary = get_piece(contents, "summary") +    try: +        end = get_piece(contents, "dtend") +    except KeyError: +        end = start + get_piece(contents, "duration") +    return Event(start=start, end=end, summary=summary, timezone=timezone) +``` + +Since it is useful to have the events in your _local_ time zone rather than UTC, this uses the local timezone: + + +``` +`my_timezone = tz.gettz()`[/code] [code]`from_calendar_event_and_timezone(raw_events[12], my_timezone)`[/code] [code]`    Event(start=datetime.datetime(2020, 8, 25, 22, 0, tzinfo=tzutc()), end=datetime.datetime(2020, 8, 25, 23, 0, tzinfo=tzutc()), timezone=tzfile('/etc/localtime'), summary='Busy')` +``` + +Now that the events are real Python objects, they really should have some additional information. Luckily, it is possible to add methods retroactively to classes. + +But figuring which _day_ an event happens is not that obvious. You need the day in the _local_ timezone: + + +``` +def day(self): +    offset = self.timezone.utcoffset(self.start) +    fixed = self.start + offset +    return fixed.date() +Event.day = property(day) + +[/code] [code]`print(_.day)`[/code] [code]`    2020-08-25` +``` + +Events are always represented internally as start/end, but knowing the duration is a useful property. Duration can also be added to the existing class: + + +``` +def duration(self): +    return self.end - self.start +Event.duration = property(duration) + +[/code] [code]`print(_.duration)`[/code] [code]`    1:00:00` +``` + +Now it is time to convert all events into useful Python objects: + + +``` +all_events = [from_calendar_event_and_timezone(raw_event, my_timezone) +              for raw_event in raw_events] +``` + +All-day events are a special case and probably less useful for analyzing life. For now, you can ignore them: + + +``` +# ignore all-day events +all_events = [event for event in all_events if not type(event.start) == datetime.date] +``` + +Events have a natural order—knowing which one happened first is probably useful for analysis: + + +``` +`all_events.sort(key=lambda ev: ev.start)` +``` + +Now that the events are sorted, they can be broken into days: + + +``` +import collections +events_by_day = collections.defaultdict(list) +for event in all_events: +    events_by_day[event.day].append(event) +``` + +And with that, you have calendar events with dates, duration, and sequence as Python objects. + +### Reporting on your life in Python + +Now it is time to write reporting code! It is fun to have eye-popping formatting with proper headers, lists, important things in bold, etc. + +This means HTML and some HTML templating. I like to use [Chameleon][9]: + + +``` +template_content = """ +<html><body> +<div tal:repeat="item items"> +<h2 tal:content="item[0]">Day</h2> +<ul> +    <li tal:repeat="event item[1]"><span tal:replace="event">Thing</span></li> +</ul> +</div> +</body></html>""" +``` + +One cool feature of Chameleon is that it will render objects using its `html` method. I will use it in two ways: + + * The summary will be in **bold** + * For most events, I will remove the summary (since this is my personal information) + + + + +``` +def __html__(self): +    offset = my_timezone.utcoffset(self.start) +    fixed = self.start + offset +    start_str = str(fixed).split("+")[0] +    summary = self.summary +    if summary != "Busy": +        summary = "&lt;REDACTED&gt;" +    return f"<b>{summary[:30]}</b> \-- {start_str} ({self.duration})" +Event.__html__ = __html__ +``` + +In the interest of brevity, the report will be sliced into one day's worth. + + +``` +import chameleon +from IPython.display import HTML +template = chameleon.PageTemplate(template_content) +html = template(items=itertools.islice(events_by_day.items(), 3, 4)) +HTML(html) +``` + +#### When rendered, it will look something like this: + +#### 2020-08-25 + + * **<REDACTED>** \-- 2020-08-25 08:30:00 (0:45:00) + * **<REDACTED>** \-- 2020-08-25 10:00:00 (1:00:00) + * **<REDACTED>** \-- 2020-08-25 11:30:00 (0:30:00) + * **<REDACTED>** \-- 2020-08-25 13:00:00 (0:25:00) + * **Busy** \-- 2020-08-25 15:00:00 (1:00:00) + * **<REDACTED>** \-- 2020-08-25 15:00:00 (1:00:00) + * **<REDACTED>** \-- 2020-08-25 19:00:00 (1:00:00) + * **<REDACTED>** \-- 2020-08-25 19:00:12 (1:00:00) + + + +### Endless options with Python and Jupyter + +This only scratches the surface of what you can do by parsing, analyzing, and reporting on the data that various web services have on you. + +Why not try it with your favorite service? + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/calendar-jupyter + +作者:[Moshe Zadka][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://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/calendar.jpg?itok=jEKbhvDT (Calendar close up snapshot) +[2]: https://opensource.com/resources/python +[3]: https://pandas.pydata.org/ +[4]: https://dask.org/ +[5]: https://jupyter.org/ +[6]: https://pypi.org/project/caldav/ +[7]: https://pypi.org/project/vobject/ +[8]: https://opensource.com/article/19/5/python-attrs +[9]: https://chameleon.readthedocs.io/en/latest/ From 446a24c43e8b69bb2ba76b71f74945be07169c8b Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 16 Sep 2020 08:44:08 +0800 Subject: [PATCH 0132/1156] translated --- ...ate and Fix Long Shutdown Time in Linux.md | 135 ------------------ ...ate and Fix Long Shutdown Time in Linux.md | 135 ++++++++++++++++++ 2 files changed, 135 insertions(+), 135 deletions(-) delete mode 100644 sources/tech/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md create mode 100644 translated/tech/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md diff --git a/sources/tech/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md b/sources/tech/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md deleted file mode 100644 index 9107a4d319..0000000000 --- a/sources/tech/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md +++ /dev/null @@ -1,135 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Shutdown Taking Too Long? Here’s How to Investigate and Fix Long Shutdown Time in Linux) -[#]: via: (https://itsfoss.com/long-shutdown-linux/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -Shutdown Taking Too Long? Here’s How to Investigate and Fix Long Shutdown Time in Linux -====== - -_**Your Linux system is taking too long to shut down? Here are the steps you can take to find out what is causing the delayed shutdown and fix the issue.**_ - -I hope you are a tad bit familiar with the [sigterm and sigkill][1] concept. - -When you [shut down your Linux system][2], it sends the sigterm and politely asks the running processes to stop. Some processes misbehave and they ignore the sigterm and keep on running. - -This could cause a delay to the shutdown process as your system will wait for the running processes to stop for a predefined time period. After this time period, it sends the kill signal to force stop all the remaining running processes and shuts down the system. - -In fact, in some cases, you would see a message like ‘a stop job is running’ on the black screen. - -If your system is taking too long in shutting down, you can do the following: - - * Check which process/service is taking too long and if you can remove or reconfigure it to behave properly. - * Change the default waiting period before your system force stops the running processes. [Quick and dirty fix] - - - -I am using Ubuntu here which uses systemd. The commands and steps here are valid for any Linux distribution that uses systemd (most of them do). - -![][3] - -### Check which processes are causing long shutdown in Linux - -If you want to figure out what’s wrong, you should check what happened at the last shutdown. Use this command to get the power of ‘I know what you did last session’ (pun intended): - -``` -journalctl -rb -1 -``` - -The [journalctl command][4] allows you to read system logs. With options ‘-b -1’ you filter the logs for the last boot session. With option ‘-r’, the logs are shown in reverse chronological order. - -In other words, the ‘journalctl -rb -1’ command will show the system logs just before your Linux system was shutdown the last time. This is what you need to analyze the long shutdown problem in Linux. - -No journal logs? Here’s what you should do - -If there are no journal logs, please make sure that your distribution uses systemd. - -Even on some Linux distributions with systemd, the journal logs are not activated by default. - -Make sure that /var/log/journal exists. If it doesn’t, create it: - -``` -sudo mkdir /var/log/journal -``` - -You should also check the content of /etc/systemd/journald.conf file and make sure that the value of Storage is set to either auto or persistent. - -Do you find something suspicious in the logs? Is there a process/service refusing to stop? If yes, investigate if you could remove it without side effects or if you could reconfigure it. Don’t go blindly removing stuff here, please. You should have knowledge of the process. - -### Speed up shutdown in Linux by reducing default stop timeout [Quick fix] - -The default wait period for the shut down is usually set at 90 seconds. Your system tries to force stop the services after this time period. - -If you want your Linux system to shut down quickly, you can change this waiting period. - -You’ll find all the systemd settings in the config file located at /etc/systemd/system.conf. This file should be filled with lots of line starting with #. They represent the default values of the entries in the file. - -Before you do anything, it will be a good idea to make a copy of the original file. - -``` -sudo cp /etc/systemd/system.conf /etc/systemd/system.conf.orig -``` - -Look for DefaultTimeoutStopSec here. It should probably be set to 90 sec. - -``` -#DefaultTimeoutStopSec=90s -``` - -You have to change this value to something more convenient like 5 or 10 seconds. - -``` -DefaultTimeoutStopSec=5s -``` - -If you don’t know how to edit the config file in terminal, use this command to open the file for editing in your system’s default text editor (like Gedit): - -``` -sudo xdg-open /etc/systemd/system.conf -``` - -![Change Shutdown Time Settings Ubuntu][5] - -Don’t forget to **remove the # before DefaultTimeoutStopSec**. Save the file and reboot your system. - -This should help you reduce the shutdown delay for your Linux system. - -Watchdog issue! - -Linux has a module named watchdog that is used for monitoring whether certain services are running or not. It could be configured to automatically reboot systems if they are hanged due to software error. - -It is unusual to use Watchdog on desktop systems because you can manually shutdown or reboot the system. It is often used on remote servers. - -First check watchdog is running: - -``` -ps -af | grep watch* -``` - -If watchdog is running on your system, you can change the ShutdownWatchdogSec value from 10 minutes to something lower in the systemd config file /etc/systemd/system.conf. - -**Were you able to fix the lengthy shutdown?** - -I hope this tutorial helped you in investigating and fixing the long shutdown issue on your system. Do let me know in the comments if you managed to fix it. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/long-shutdown-linux/ - -作者:[Abhishek Prakash][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/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://linuxhandbook.com/sigterm-vs-sigkill/ -[2]: https://itsfoss.com/schedule-shutdown-ubuntu/ -[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/troubleshoot-long-shutdown-linux.gif?resize=800%2C450&ssl=1 -[4]: https://linuxhandbook.com/journalctl-command/ -[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/change-shutdown-time-settings-ubuntu.png?resize=797%2C322&ssl=1 diff --git a/translated/tech/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md b/translated/tech/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md new file mode 100644 index 0000000000..c9bbc18e6b --- /dev/null +++ b/translated/tech/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md @@ -0,0 +1,135 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Shutdown Taking Too Long? Here’s How to Investigate and Fix Long Shutdown Time in Linux) +[#]: via: (https://itsfoss.com/long-shutdown-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +关机时间太长?下面是如何调查和解决 Linux 中关机时间过长的问题 +====== + +_**你的 Linux 系统关机时间太长么?以下是你可以采取的步骤,来找出导致延迟关机的原因并解决这个问题。**_ + +我希望你对 [sigterm 和 sigkill][1] 的概念有一点熟悉。 + +当你[关闭 Linux 系统][2]时,它会发送 sigterm,并礼貌地要求正在运行的进程停止。有些进程不符合该行为,它们会忽略 sigterm 并继续运行。 + +这可能会导致关机过程的延迟,因为你的系统会在一个预定义的时间段内等待运行的进程停止。在这个时间段之后,它会发送 kill 信号来强制停止所有剩余的运行进程并关闭系统。 + +事实上,在某些情况下,你会在黑屏上看到一个类似 “a stop job is running” 的信息。 + +如果你的系统关闭时间太长,你可以做以下工作: + + * 检查哪个进程/服务耗时过长,以及你是否能删除或重新配置它,使其正常运行。 + * 更改系统强制停止运行进程前的默认等待时间。(快速而不优雅的方式) + + + +我这里使用的是使用 systemd 的 Ubuntu。这里的命令和步骤适用于任何使用 systemd 的 Linux 发行版(大多数发行版都是这样)。 + +![][3] + +### 检查哪些进程会导致 Linux 的长时间关机 + +如果你想找出问题所在,你应该检查上次关机时发生了什么。使用这个命令来获得“我知道你上个会话做了什么”(I Know What You Did Last Summer 的双关语)的力量。 + +``` +journalctl -rb -1 +``` + +[journalctl 命令][4]能让你读取系统日志。使用选项 “-b -1” 可以过滤最后一次启动会话的日志。使用选项 “-r” 时,日志将按时间倒序显示。 + +换句话说,“journalctl -rb -1” 命令将显示最后一次关闭 Linux 系统之前的系统日志。这里就是你需要分析 Linux 系统长时间关机问题的地方。 + +没有 journal 日志?下面是你应该做的。 + +如果没有 journal 日志,请确认你的发行版是否使用 systemd。 + +即使在一些使用 systemd 的 Linux 发行版上,journal 日志也没有被默认激活。 + +请确认 /var/log/journal 是否存在。如果不存在,请创建它: + +``` +sudo mkdir /var/log/journal +``` + +你还应该检查 /etc/systemd/journald.conf 文件的内容,并确保 Storage 的值被设置为自动或持久。 + +你是否在日志中发现可疑的东西?是否有一个进程/服务拒绝停止?如果是,调查一下是否可以在没有副作用的情况下删除它,或者是否可以重新配置它。请不要在这里盲目地去删除东西。你应该对这个进程有所了解。 + +### 通过减少默认停止超时来加快 Linux 中的关机速度(快速修复) + +关机的默认等待时间通常设置为 90 秒。在这个时间之后,你的系统会尝试强制停止服务。 + +如果你想让你的 Linux 系统快速关闭,你可以改变这个等待时间。 + +你可以在位于 /etc/systemd/system.conf 的配置文件中找到所有的 systemd 设置。这个文件中应该有很多以 # 开头的行。它们代表了文件中各条目的默认值。 + +在开始之前,最好先复制一份原始文件。 + +``` +sudo cp /etc/systemd/system.conf /etc/systemd/system.conf.orig +``` + +在这里寻找 DefaultTimeoutStopSec。它可能被设置为 90 秒。 + +``` +#DefaultTimeoutStopSec=90s +``` + +你得把这个值改成更方便的,比如 5 秒或 10 秒。 + +``` +DefaultTimeoutStopSec=5s +``` + +如果你不知道如何在终端中编辑配置文件,可以使用这个命令在系统默认的文本编辑器(如 Gedit)中打开文件进行编辑: + +``` +sudo xdg-open /etc/systemd/system.conf +``` + +![Change Shutdown Time Settings Ubuntu][5] + +不要忘记**删除 DefaultTimeoutStopSec 前的 # 号**。保存文件并重启系统。 + +这将帮助你减少 Linux 系统的关机延迟。 + +看门狗问题! + +Linux 有一个名为看门狗的模块,用于监控某些服务是否在运行。它可以被配置为在系统因软件错误而挂起时自动重启系统。 + +在桌面系统上使用看门狗是不常见的,因为你可以手动关闭或重启系统。它经常被用于远程服务器上。 + +首先检查看门狗是否在运行: + +``` +ps -af | grep watch* +``` + +如果你的系统正在运行看门狗,你可以在 systemd 配置文件 /etc/systemd/system.conf 中将 ShutdownWatchdogSec的 值从 10 分钟改为更低的值。 + +**你能解决关机时间过长的问题吗?** + +希望本教程能帮助你解决系统长时间关机的问题。如果你成功解决了这个问题,请在评论中告诉我。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/long-shutdown-linux/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://linuxhandbook.com/sigterm-vs-sigkill/ +[2]: https://itsfoss.com/schedule-shutdown-ubuntu/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/troubleshoot-long-shutdown-linux.gif?resize=800%2C450&ssl=1 +[4]: https://linuxhandbook.com/journalctl-command/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/change-shutdown-time-settings-ubuntu.png?resize=797%2C322&ssl=1 From 2aff3e5c9d39fcfc7bae88433a857bcdb788f34f Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 16 Sep 2020 08:48:27 +0800 Subject: [PATCH 0133/1156] translating --- .../tech/20200914 Incremental backups with Btrfs snapshots.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200914 Incremental backups with Btrfs snapshots.md b/sources/tech/20200914 Incremental backups with Btrfs snapshots.md index b8d980cb2f..f19b9f3d95 100644 --- a/sources/tech/20200914 Incremental backups with Btrfs snapshots.md +++ b/sources/tech/20200914 Incremental backups with Btrfs snapshots.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From e48a77ff59f14054b32e33de2bde8f4477348f3c Mon Sep 17 00:00:00 2001 From: mengj <813935532@qq.com> Date: Wed, 16 Sep 2020 14:41:25 +0800 Subject: [PATCH 0134/1156] feat: apply my github userinfo --- ...09 Manage your SSH connections with this open source tool.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200909 Manage your SSH connections with this open source tool.md b/sources/tech/20200909 Manage your SSH connections with this open source tool.md index 18fcb43ec6..d81db8fc74 100644 --- a/sources/tech/20200909 Manage your SSH connections with this open source tool.md +++ b/sources/tech/20200909 Manage your SSH connections with this open source tool.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (hom) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 3cffbd5d426c6986271ec7efcb538b8b5f6cf0b0 Mon Sep 17 00:00:00 2001 From: mengj <813935532@qq.com> Date: Wed, 16 Sep 2020 16:06:05 +0800 Subject: [PATCH 0135/1156] reforce: move translated report to translated directory --- ... connections with this open source tool.md | 132 ------------------ ... connections with this open source tool.md | 131 +++++++++++++++++ 2 files changed, 131 insertions(+), 132 deletions(-) delete mode 100644 sources/tech/20200909 Manage your SSH connections with this open source tool.md create mode 100644 translated/tech/20200909 Manage your SSH connections with this open source tool.md diff --git a/sources/tech/20200909 Manage your SSH connections with this open source tool.md b/sources/tech/20200909 Manage your SSH connections with this open source tool.md deleted file mode 100644 index d81db8fc74..0000000000 --- a/sources/tech/20200909 Manage your SSH connections with this open source tool.md +++ /dev/null @@ -1,132 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (hom) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Manage your SSH connections with this open source tool) -[#]: via: (https://opensource.com/article/20/9/ssh-connection-manager) -[#]: author: (Kenneth Aaron https://opensource.com/users/flyingrhino) - -Manage your SSH connections with this open source tool -====== -This open source project makes connecting to any SSH session quick and -seamless, and downright relaxing. -![Penguins][1] - -OpenSSH is widely used, but there isn't a well-known connection manager, so I developed the ncurses SSH connection manager (`nccm`) to fill that significant gap in the process. `nccm` is a simple SSH connection manager with an ultra-portable terminal interface (written in ncurses, as the project name suggests). And best of all, it's straightforward to use. With `nccm`, you can connect to an SSH session of your choice with minimum distraction and minimal keystrokes. - -### Install nccm - -The quickest way to get going is to clone the project from its [Git repository][2]: - - -``` -`$ git clone https://github.com/flyingrhinonz/nccm nccm.git` -``` - -In the `nccm.git/nccm` directory, there are two files—`nccm` itself and an `nccm.yml` configuration file. - -First, copy the nccm script to `/usr/local/bin/` and grant it executable permissions. You can do this in one step with the `install` command: - - -``` -$ sudo install -m755 nccm -–target-directory /usr/local/bin -``` - -The `nccm.yml` file can be copied to any one of these locations, and is loaded from the first location found: - - * `~/.config/nccm/nccm.yml` - * `~/.nccm.yml` - * `~/nccm.yml` - * `/etc/nccm.yml` - - - -The `nccm` command requires Python 3 to be installed on your machine, which shouldn't be a problem on most Linux boxes. Most Python library dependencies are already present as part of Python 3; however, there are some YAML dependencies and utilities you must install. - -If you don't have `pip` installed, you can install it with your package manager. And while you're at it, install the `yamllint` application to help you validate the `nccm.yml` file. - -On Debian or similar, use `apt`: - - -``` -`$ sudo apt install python3-pip yamllint` -``` - -On Fedora or similar, use `dnf`: - - -``` -`$ sudo dnf install python3-pip yamllint` -``` - -You also need PyYAML, which you can install with the `pip` command: - - -``` -`$ pip3 install --user PyYAML` -``` - -### Using nccm - -Before starting, edit the `nccm.yml` file and add your SSH configuration. Formatting YAML is easy, and there are examples provided in the file. Just follow the structure—provide the connection name at the beginning of the line, with config items indented two spaces. Don't forget the colons—these are part of the YAML language. - -Don't worry about ordering your SSH session blocks in any specific way, because `nccm` gives you "sort by" options within the program. - -Once you've finished editing, check your work with `yamllint`: - - -``` -`$ yamllint ~/.config/nccm/nccm.yml` -``` - -If no errors are returned, then you've formatted your file correctly, and it's safe to continue. - -If `nccm` is accessible [from your path][3] and is executable, then typing `nccm` is all that's required to launch the TUI (terminal user interface). If you see Python 3 exceptions, check whether you have satisfied the dependencies. Any exceptions should mention any package that's missing. - -As long as you're using the YAML config file without changing `nccm_config_control mode`, then you can use these keyboard controls: - - * Up/Down arrows - Move the marker the traditional way - * Home/End - Jump marker to list first/last entry - * PgUp/PgDn - Page up/down in the list - * Left/Right arrows - Scroll the list horizontally - * TAB - Moves the cursor between text boxes - * Enter - Connect to the selected entry - * Ctrl-h - Display this help menu - * Ctrl-q or Ctrl-c - Quit the program - * F1-F5 or !@#$% - Sort by respective column (1-5) - - - -Use keys F1 through F5 to sort by columns 1 through 5. If your desktop captures F-key input, you can instead sort by pressing **!@#$%** in the "Conn" text box. The display shows 4 visible columms but we treat username and server address as separate columns for sorting purposes giving us 5 controls for sorting. You can reverse the order by pressing the same "sort" key a second time. A connection can be made by pressing **Enter** on the highlighted line. - -![nccm screenshot terminal view][4] - -Typing text into the "Filter" text box filters the output with an "and" function between everything entered. This is case-insensitive, and a blank space delimits entries. The same is true for the "Conn" text box, but pressing **Enter** here connects to that specific entry number. - -There are a few more interesting features to discover, such as focus mode, but I'll leave it up to you to explore the details. See the project page or built-in help for more details. - -The config YAML file is well-documented, so you'll know how to edit the settings to make `nccm` work best for you. The `nccm` program is highly commented, too, so you may wish to fork or mod it to add more features. Pull requests are welcome! - -### Relax into SSH with nccm - -I hope this program serves you well and is as useful to you as it is to me. Thanks for being part of the open source community, and please accept `nccm` as my contribution to the ongoing efforts toward seamless, painless, and efficient computing experiences. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/9/ssh-connection-manager - -作者:[Kenneth Aaron][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://opensource.com/users/flyingrhino -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux-penguins.png?itok=yKOpaJM_ (Penguins) -[2]: https://github.com/flyingrhinonz/nccm -[3]: https://opensource.com/article/17/6/set-path-linux -[4]: https://opensource.com/sites/default/files/uploads/nccm_screenshot.png (nccm screenshot terminal view) diff --git a/translated/tech/20200909 Manage your SSH connections with this open source tool.md b/translated/tech/20200909 Manage your SSH connections with this open source tool.md new file mode 100644 index 0000000000..4a8115ee1e --- /dev/null +++ b/translated/tech/20200909 Manage your SSH connections with this open source tool.md @@ -0,0 +1,131 @@ +[#]: collector: "lujun9972" +[#]: translator: "hom" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "Manage your SSH connections with this open source tool" +[#]: via: "https://opensource.com/article/20/9/ssh-connection-manager" +[#]: author: "Kenneth Aaron https://opensource.com/users/flyingrhino" + +使用开源工具 `nccm` 管理 `SSH` 连接 +====== +使用 `nccm` 让你的终端连接更快,更稳定 +![Penguins][1] + +`OpenSSH`很常用,但是仍然有其他的连接工具,因此我开发了 `nccm`来使运行进程更高效。 `nccm` 是一个使用标准终端接口(就像项目所命名的`ncurses`)的建议终端连接工具 + +### 安装 nccm + +最简单的方式是从这个 [仓库][2]下载 + + +``` +`$ git clone https://github.com/flyingrhinonz/nccm nccm.git` +``` + +在`nccm.git/nccm`的文件夹中有两个文件:`nccm`执行文件和`nccm.yml`配置文件 + +首先将执行文件`nccm`拷贝到系统目录`/usr/local/bin/`中并添加执行权限,也可以通过使用`install`命令来完成操作 + + +``` +$ sudo install -m755 nccm +–target-directory /usr/local/bin +``` + +配置文件`nccm.yml`可以拷贝到以下任意一个文件夹中,终端会默认从第一个顺序获取配置。 + + * `~/.config/nccm/nccm.yml` + * `~/.nccm.yml` + * `~/nccm.yml` + * `/etc/nccm.yml` + + + +`nccm`需要在`Python 3`的环境中运行,因此你的电脑需要事先安装`Python 3`,大部分的环境依赖在`Python 3`中默认安装了。以下是必须要安装的`YAML`依赖 + +如果为暗中`pip`,你需要使用包管理器来安装,然后安装`yamlinit`包来验证安装`nccm.yml` + +在`Debian`或相似系统使用`apt`命令: + + +``` +`$ sudo apt install python3-pip yamllint` +``` + +在`Fedora`或者相似系统使用`dnf`: + + +``` +`$ sudo dnf install python3-pip yamllint` +``` + +`PyYAML`也是必须安装的,可以通过使用`pip`来安装 + + +``` +`$ pip3 install --user PyYAML` +``` + +### 使用`nccm` + +开始之前需要修改`nccm.yml`文件来添加终端连接配置,可以参照示例文件格式化`YAML`文件。仿照示例文件再开始行添加连接名称,文件使用两个空格缩进。不要忘了`YAML`的语言类型 + +不要担心你的终端登录信息以何顺序排列,`nccm`会提示用户如何排序 + +如果修改完成,可以使用`yamllint`来校验配置 + + +``` +`$ yamllint ~/.config/nccm/nccm.yml` +``` + +如果没有错误信息返回,说明文件的内容格式是正确的,可以进行下面的步骤 + +如果`nccm`可以从 [环境变量][3] 中找到并且可以执行,由于`nccm`会加载 TUI 来执行界面操作,因此需要查看`Python3`的执行环境,依赖包是否正确安装,缺少任一依赖都会在命令行中展示出来 + +只要你没有在配置文件中更改`ncm_config_control mode`,你可以使用以下的键盘按键来控制 + + * 上/下方向键 - 移动光标 + * Home/End -跳转到文件开始和结尾 + * PgUp/PgDn - 以页为单位查看 + * 左/右 方向键 - 水平滚动 + * TAB - 在字块中移动 + * 回车 - 连接选中的终端 + * Ctrl-h -显示帮助菜单 + * Ctrl-q or Ctrl-c - 退出 + * F1-F5 or !@#$% - 在列(1-5)之间切换 + + + +使用`F1`到`F5`来切换列,如果你的设备`Fn`键冲突你可以使用`!@#$%`来替代。默认界面显示 4 列内容,但是可以通过将用户名和服务地址分隔开来显示 5 列。你也可以通过再次使用和第一次过滤相同的按键来切换显示,选中的行会高亮显示 + +![nccm screenshot terminal view][4] + +在过滤条件中输入过滤内容,会将包含的内容过滤显示,过滤的关键词是大小写敏感的,字符中间的空格不是必须的。在`Conn`部分也是同样的输入限制,然后按回车键就可以选中所输入的序号配置 + +这个工具还有许多功能需要你去发掘,比如专注模式,这些部分留下等待你去探索,也可以查看项目主页或者内置的帮助文档查看更多细节内容 + +项目的`YAML`配置文件的文档是完善的,所以你可以查阅修改使你的终端工具使用起来更加顺手。`nccm`项目是非常希望得到你的反馈的,所以你可以 fork 该项目然后添加更多新功能,我们欢迎你的合并请求。 + +### 轻松使用 nccm来连接 SSH + +我希望这个工具可以对您有用,感谢能够为开源工作增加自己的贡献,请接收`nccm`作为我对开源项目自由、高效工作所做的贡献 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/ssh-connection-manager + +作者:[Kenneth Aaron][a] +选题:[lujun9972][b] +译者:[hom](https://github.com/hom) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/flyingrhino +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux-penguins.png?itok=yKOpaJM_ "Penguins" +[2]: https://github.com/flyingrhinonz/nccm +[3]: https://opensource.com/article/17/6/set-path-linux +[4]: https://opensource.com/sites/default/files/uploads/nccm_screenshot.png "nccm screenshot terminal view" From 5f6e1c4547ba8576410cf06355efc810d2af6606 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 16 Sep 2020 21:39:21 +0800 Subject: [PATCH 0136/1156] PRF @geekpi --- ... an open source alternative to InDesign.md | 66 +++++++------------ 1 file changed, 25 insertions(+), 41 deletions(-) diff --git a/translated/tech/20200902 Design a book cover with an open source alternative to InDesign.md b/translated/tech/20200902 Design a book cover with an open source alternative to InDesign.md index eaac4172f6..77af02726c 100644 --- a/translated/tech/20200902 Design a book cover with an open source alternative to InDesign.md +++ b/translated/tech/20200902 Design a book cover with an open source alternative to InDesign.md @@ -1,16 +1,18 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Design a book cover with an open source alternative to InDesign) [#]: via: (https://opensource.com/article/20/9/open-source-publishing-scribus) [#]: author: (Jim Hall https://opensource.com/users/jim-hall) -用 InDesign 的开源替代方案设计书籍封面 +用 InDesign 的开源替代方案 Scribus 设计书籍封面 ====== -使用开源的出版软件 Scribus 来制作你的下一本自己出版书籍的封面。 -![Stack of books for reading][1] + +> 使用开源的出版软件 Scribus 来制作你的下一本自出版书籍的封面。 + +![](https://img.linux.net.cn/data/attachment/album/202009/16/213714ppvfzm6idv9nnynp.jpg) 我最近写完了一本关于 [C 语言编程][2]的书,我通过 [Lulu.com][3] 自行出版。我已经用 Lulu 做了好几个图书项目,它是一个很棒的平台。今年早些时候,Lulu 做了一些改变,让作者在创作图书封面时有了更大的控制权。以前,你只需上传一对大尺寸图片作为书的封面和封底。现在,Lulu 允许作者上传完全按照你的书的尺寸定制的 PDF。 @@ -18,88 +20,70 @@ ### 下载一个模板 -当你在 Lulu 上输入图书的信息时,最终会进入**设计**栏。在该页面的**设计封面**部分,你会发现一个方便的**下载模板**按钮,它为你的图书封面提供了一个 PDF 模板。 +当你在 Lulu 上输入图书的信息时,最终会进入设计Design栏。在该页面的设计封面Design Your Cover部分,你会发现一个方便的下载模板Download Template按钮,它为你的图书封面提供了一个 PDF 模板。 ![Lulu Design your Cover page][5] -(Jim Hall, [CC BY-SA 4.0][6]) - 下载此模板,它为你提供了在 Scribus 中创建自己的书籍封面所需的信息。 ![Lulu's cover template][7] -(Jim Hall, [CC BY-SA 4.0][6]) - 最重要的细节是: - * 文件总大小(含出血(bleed)) - * 出血区(从裁切边缘) - * 书脊区 + * 文件总尺寸(含出血)Total Document Size (with bleed) + * 出血区(从裁切边缘)Bleed area (from trim edge) + * 书脊区Spine area +出血Bleed是一个印刷术语,在准备“印刷就绪”文件时,这个术语很重要。它与普通文件中的页边距不同。打印文件时,你会为顶部、底部和侧面设置一个页边距。在大多数文档中,页边距通常为一英寸左右。 +但在印刷就绪的文件中,文档的尺寸需要比成品书大一些,因为书籍的封面通常包括颜色或图片,一直到封面的边缘。为了创建这种设计,你要使颜色或图片超出你的边距,印刷厂就会把多余的部分裁切掉,使封面缩小到准确的尺寸。因此,“裁切”就是印刷厂将封面精确地裁剪成相应尺寸。而“出血区”就是印刷厂裁掉的多余部分。 -**出血**(Bleed)是一个印刷术语,在准备**打印就绪**文件时,这个术语很重要。它与普通文件中的页边距不同。打印文件时,你会为顶部、底部和侧面设置一个页边距。在大多数文档中,页边距通常为一英寸左右。 - -但在打印就绪的文件中,文档的尺寸需要比成品书大一些,因为书籍的封面通常包括颜色或图片,一直到封面的边缘。为了创建这种设计,你要使颜色或图片超出你的边距,印刷厂就会把多余的部分修剪掉,使封面缩小到准确的尺寸。因此,**修剪**就是印刷厂将封面精确地裁剪成相应尺寸。而**出血区** (bleed area) 就是印刷厂裁掉的多余部分。 - -如果你没有出血,印刷厂就很难完全按照尺寸印刷封面。如果打印机只偏离了一点点,你的封面最终会在边缘留下一个微小的、白色的、没有印刷的边缘。使用出血和修剪意味着你的封面每次都能看起来正确。 +如果你没有出血区,印刷厂就很难完全按照尺寸印刷封面。如果打印机只偏离了一点点,你的封面最终会在边缘留下一个微小的、白色的、没有印刷的边缘。使用出血和修剪意味着你的封面每次都能看起来正确。 ### 在 Scribus 中设置书籍的封面文档 -要在 Scribus 中创建新文档,请从定义文档尺寸的 **New Document** 对话框开始。单击 “**Bleeds**” 选项卡,并输入 PDF 模板所说的出血尺寸。Lulu 图书通常在所有边缘使用 0.125 英寸的出血量。 +要在 Scribus 中创建新文档,请从定义文档尺寸的新文档New Document对话框开始。单击出血Bleeds选项卡,并输入 PDF 模板所说的出血尺寸。Lulu 图书通常在所有边缘使用 0.125 英寸的出血量。 -对于 Scribus 中的文档总尺寸,你不能只使用 PDF 模板上的文档总尺寸。如果这样做,你的 Scribus 文档将有错误的尺寸。相反,你需要做一些数学计算来获取正确的尺寸。 +对于 Scribus 中的文档总尺寸,你不能只使用 PDF 模板上的文档总尺寸。如果这样做,你的 Scribus 文档的尺寸会出现错误。相反,你需要做一些数学计算来获取正确的尺寸。 -看下 PDF 模板中的 **Total Document Size (with bleed)**。这是将要发送给打印机的 PDF 的总尺寸,它包括封底、书脊和封面(包含出血量)。要在 Scribus 中输入正确的尺寸,你必须从所有边缘中减去出血量。例如,我最新的书的尺寸是 Crown Quarto,装订后书脊宽度为 7.44" x 9.68",宽度为 0.411"。加上 0.125" 的出血量,**Total Document Size (with bleed)** 是 15.541"×9.93"。因此,我在 Scribus 中的文档尺寸是: +看下 PDF 模板中的文件总尺寸(含出血)Total Document Size (with bleed)。这是将要发送给打印机的 PDF 的总尺寸,它包括封底、书脊和封面(包含出血)。要在 Scribus 中输入正确的尺寸,你必须从所有边缘中减去出血。例如,我最新的书的尺寸是四开本Crown Quarto,装订后尺寸为 7.44" x 9.68",书脊宽度为 0.411"。加上 0.125" 的出血量,文件总尺寸(含出血)是 15.541" × 9.93"。因此,我在 Scribus 中的文档尺寸是: * 宽:15.541-(2 x 0.125)=15.291" * 高:9.93-(2 x 0.125)=9.68" - - ![Scribus document setup][8] -(Jim Hall, [CC BY-SA 4.0][6]) - -这将设置一个新的适合我的书的封面尺寸的 Scribus 文档。新的 Scribus 文档尺寸应与 PDF 模板上列出的 **Total Document Size (with bleed)** 完全匹配。 +这将设置一个新的适合我的书的封面尺寸的 Scribus 文档。新的 Scribus 文档尺寸应与 PDF 模板上列出的“文件总尺寸(含出血)”完全匹配。 ### 从书脊开始 在 Scribus 中创建新的书籍封面时,我喜欢从书脊区域开始。这可以帮助我验证我是否在 Scribus 中正确定义了文档。 -使用**矩形**工具在文档上绘制一个彩色方框,书脊需要在那里。你不必完全按照正确的尺寸和位置来绘制,只要接近并使用**属性**来设置正确的值即可。在形状的**属性**中,选择左上角基点,然后输入书脊需要去的 x,y 位置和尺寸。同样,你需要做一些数学计算,并使用 PDF 模板上的尺寸作为参考。 +使用矩形Rectangle工具在文档上绘制一个彩色方框,书脊需要出现在那里。你不必完全按照正确的尺寸和位置来绘制,只要大小差不多并使用属性Properties来设置正确的值即可。在形状的属性中,选择左上角基点,然后输入书脊需要放在的 x、y 位置和尺寸。同样,你需要做一些数学计算,并使用 PDF 模板上的尺寸作为参考。 ![Empty Scribus document][9] -(Jim Hall, [CC BY-SA 4.0][6]) - -例如,我的书的修边尺寸是 7.44"×9.68",这是印刷厂修边后的封面和封底的尺寸。我的书的书脊大小是 0.411",出血量是 0.125"。也就是说,书脊的左上角 X,Y 的正确位置是: - - * X-Pos (出血量+裁剪宽度):0.411+7.44=7.8510" - * Y-Pos(减去出血量):-0.125" - +例如,我的书的修边尺寸是 7.44"×9.68",这是印刷厂修边后的封面和封底的尺寸。我的书的书脊大小是 0.411",出血量是 0.125"。也就是说,书脊的左上角 X、Y 的正确位置是: + * X 位置(出血量+裁剪宽度):0.411+7.44=7.8510" + * Y 位置(减去出血量):-0.125" 矩形的尺寸是我的书封面的全高(包括出血)和 PDF 模板中标明的书脊宽度。 - * 宽度: 0.411" + * 宽度:0.411" * 高度:9.93" - - -将矩形的 **Fill** 设置为你喜欢的颜色,将 **Stroke** 设置为 **None** 以隐藏边界。如果你正确地定义了 Scribus 文档,你应该最终得到一个矩形,它可以延伸到位于文档中心的图书封面的顶部和底部边缘。 +将矩形的填充Fill设置为你喜欢的颜色,将笔触Stroke设置为None以隐藏边界。如果你正确地定义了 Scribus 文档,你应该最终得到一个矩形,它可以延伸到位于文档中心的图书封面的顶部和底部边缘。 ![Book spine in Scribus][10] -(Jim Hall, [CC BY-SA 4.0][6]) - 如果矩形与文档不完全匹配,可能是你在创建 Scribus 文档时设置了错误的尺寸。由于你还没有在书的封面上花太多精力,所以可能最容易的做法是重新开始,而不是尝试修复你的错误。 ### 剩下的就看你自己了 接下来,你可以创建你的书的封面的其余部分。始终使用 PDF 模板作为指导。封底在左边,封面在右边 -我可以管理一个简单的书籍封面,但我缺乏艺术能力,无法创造出真正醒目的设计。在自己设计了几个书的封面后,我对那些能设计出好封面的人产生了敬意。但如果你只是需要制作一个简单的封面,你可以通过开源软件自己动手。 +我可以做一个简单的书籍封面,但我缺乏艺术能力,无法创造出真正醒目的设计。在自己设计了几个书的封面后,我对那些能设计出好封面的人产生了敬意。但如果你只是需要制作一个简单的封面,你可以通过开源软件自己动手。 -------------------------------------------------------------------------------- @@ -108,7 +92,7 @@ via: https://opensource.com/article/20/9/open-source-publishing-scribus 作者:[Jim Hall][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 5075e92996ff1ee624dede8799539b6b749a648a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 16 Sep 2020 21:39:51 +0800 Subject: [PATCH 0137/1156] PUB @geekpi https://linux.cn/article-12620-1.html --- ... book cover with an open source alternative to InDesign.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200902 Design a book cover with an open source alternative to InDesign.md (99%) diff --git a/translated/tech/20200902 Design a book cover with an open source alternative to InDesign.md b/published/20200902 Design a book cover with an open source alternative to InDesign.md similarity index 99% rename from translated/tech/20200902 Design a book cover with an open source alternative to InDesign.md rename to published/20200902 Design a book cover with an open source alternative to InDesign.md index 77af02726c..390747395c 100644 --- a/translated/tech/20200902 Design a book cover with an open source alternative to InDesign.md +++ b/published/20200902 Design a book cover with an open source alternative to InDesign.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12620-1.html) [#]: subject: (Design a book cover with an open source alternative to InDesign) [#]: via: (https://opensource.com/article/20/9/open-source-publishing-scribus) [#]: author: (Jim Hall https://opensource.com/users/jim-hall) From 5d07e87ddbea6cc07ea661505c91434d5da64e3a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 16 Sep 2020 23:49:48 +0800 Subject: [PATCH 0138/1156] PRF --- ...08 6 best practices for teams using Git.md | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/translated/tech/20200708 6 best practices for teams using Git.md b/translated/tech/20200708 6 best practices for teams using Git.md index 45db9c3840..3f71072128 100644 --- a/translated/tech/20200708 6 best practices for teams using Git.md +++ b/translated/tech/20200708 6 best practices for teams using Git.md @@ -1,36 +1,36 @@ [#]: collector: (lujun9972) [#]: translator: (LazyWolfLin) -[#]: reviewer: ( ) -[#]: publisher: ( ) +[#]: reviewer: (wxy) +[#]: publisher: () [#]: url: ( ) [#]: subject: (6 best practices for teams using Git) [#]: via: (https://opensource.com/article/20/7/git-best-practices) [#]: author: (Ravi Chandran https://opensource.com/users/ravichandran) -团队中使用 Git 的 6 个最佳实践 + 6 个在团队中使用 Git 的最佳实践 ====== > 采用这些 Git 协作策略,让团队工作更高效。 -![技术会议上得女性们][1] +![](https://img.linux.net.cn/data/attachment/album/202009/16/234908ge77j9j799i4eaj7.jpg) -Git 非常有助于小团队管理自身的软件开发进度,但有些方法能让你把它变得更高效。我发现了许多有助于我的团队的最佳实践,尤其是当不同 Git 水平的新人加入时。 +Git 非常有助于小团队管理他们的软件开发进度,但有些方法能让你变得更高效。我发现了许多有助于我的团队的最佳实践,尤其是当不同 Git 水平的新人加入时。 ### 在你的团队中正式确立 Git 约定 -每个人都应当遵循对于分支命名,标记和编码的规范。每个组织都有自己的规范或者最佳实践,并且很多建议都可以从网上免费获取。而重要的是尽早选择合适的规范并在团队中遵循。 +每个人都应当遵循对于分支命名、标记和编码的规范。每个组织都有自己的规范或者最佳实践,并且很多建议都可以从网上免费获取,而重要的是尽早选择合适的规范并在团队中遵循。 -同时,不同的团队成员的 Git 水平参差不齐。你需要创建并维护一组符合团队规范的基础指令,用于执行通用 Git 操作。 +同时,不同的团队成员的 Git 水平参差不齐。你需要创建并维护一组符合团队规范的基础指令,用于执行通用的 Git 操作。 ### 正确地合并变更 -每个团队成员都需要在独立的功能分支上开发。但是尽管使用了独立的分支,每个人最终都会修改到一些通用文件。当把更改合并回 `master` 分支时,合并通常无法自动进行。可能需要手动解决不同作者对同一文件不同变更的冲突。这就是你必须学会如何处理 Git 合并技术的原因。 +每个团队成员都需要在一个单独的功能分支上开发。但即使是使用了单独的分支,每个人也会修改一些共同的文件。当把更改合并回 `master` 分支时,合并通常无法自动进行。可能需要手动解决不同的人对同一文件不同变更的冲突。这就是你必须学会如何处理 Git 合并的原因。 -现代编辑器具有协助解决 [Git 合并冲突][2]的功能。它们对同一文件合并的每一个部分提供多种选择,例如,是否保留你的更改,或者是保留另一分支的更改,亦或者是全部保留。如果你的编辑器不支持这些功能,那么可能是时候换一个代码编辑器了。 +现代编辑器具有协助解决 [Git 合并冲突][2]的功能。它们对同一文件的每个部分提供了合并的各种选择,例如,是否保留你的更改,或者是保留另一分支的更改,亦或者是全部保留。如果你的编辑器不支持这些功能,那么可能是时候换一个代码编辑器了。 -### 经常重整你的功能分支 +### 经常变基你的功能分支 -当你持续地开发你的功能分支时,请经常对它做 `rebase master`。这意味着要经常执行以下步骤: +当你持续地开发你的功能分支时,请经常对它做变基rebase:`rebase master`。这意味着要经常执行以下步骤: ``` git checkout master @@ -39,9 +39,9 @@ git checkout feature-xyz  # 假设的功能分支名称 git rebase master  # 可能需要解决 feature-xyz 上的合并冲突 ``` -这些步骤会在你的功能分支上[重写历史][3](这并不是件坏事)。首先,它会使你的功能分支获得 `master` 分支上当前的所有更新。其次,你在功能分支上的所有提交都会在分支历史的顶部重写,因此它们会顺序地出现在日志中。你可能需要一路解决遇到地合并冲突,这也许是个挑战。但是,这是解决冲突最好的时间,因为它只影响你的功能分支。 +这些步骤会在你的功能分支上[重写历史][3](这并不是件坏事)。首先,它会使你的功能分支获得 `master` 分支上当前的所有更新。其次,你在功能分支上的所有提交都会在该分支历史的顶部重写,因此它们会顺序地出现在日志中。你可能需要一路解决遇到的合并冲突,这也许是个挑战。但是,这是解决冲突最好的时机,因为它只影响你的功能分支。 -在解决完所有冲突并进行回归测试后,如果你准备好将功能分支合并回 `master`,那么就可以在再次执行上述的 `rebase` 步骤后进行合并: +在解决完所有冲突并进行回归测试后,如果你准备好将功能分支合并回 `master`,那么就可以在再次执行上述的变基步骤几次后进行合并: ``` git checkout master @@ -49,31 +49,31 @@ git pull git merge feature-xyz ``` -在次期间,如果其他人也将和你有冲突的更改推送到 `master`,那么 Git 合并将再次发生冲突。你需要解决它们并重新进行回归测试。 +在此期间,如果其他人也将和你有冲突的更改推送到 `master`,那么 Git 合并将再次发生冲突。你需要解决它们并重新进行回归测试。 -还有一些其他的合并哲学(例如,只使用合并不使用 rebase 以防止重写历史),其中一些甚至可能更简单易用。但是,我发现上述方法是一个干净可靠的策略。提交历史日志将以有意义的功能序列进行排列。 +还有一些其他的合并哲学(例如,只使用合并而不使用变基以防止重写历史),其中一些甚至可能更简单易用。但是,我发现上述方法是一个干净可靠的策略。提交历史日志将以有意义的功能序列进行排列。 -如果使用“纯合并”策略(上面所说的,不定期 rebase),那么 `master` 分支的历史将穿插着所有同时开发的功能的提交。这样混乱的历史很难回顾。确切的提交时间通常并不是那么重要。最好是有一个易于查看的历史日志。 +如果使用“纯合并”策略(上面所说的,不进行定期的变基),那么 `master` 分支的历史将穿插着所有同时开发的功能的提交。这样混乱的历史很难回顾。确切的提交时间通常并不是那么重要。最好是有一个易于查看的历史日志。 -### 在合并前压缩提交 +### 在合并前压扁提交 -当你在功能分支上开发时,即使再小的修改也可以作为一个 commit。但是,如果每个个功能分支都要产生五十个 commit,那么随着不断地增添新功能,`master` 分支的 commit 数终将无谓地膨胀。通常来说,每个功能分支只应该往 `master` 中增加一个或几个 commit。为此,你需要将多个 commit 压缩成一个或者几个带有更详细信息的提交中。通常使用以下命令来完成: +当你在功能分支上开发时,即使再小的修改也可以作为一个提交。但是,如果每个功能分支都要产生五十个提交,那么随着不断地增添新功能,`master` 分支的提交数终将无谓地膨胀。通常来说,每个功能分支只应该往 `master` 中增加一个或几个提交。为此,你需要将多个提交压扁Squash成一个或者几个带有更详细信息的提交中。通常使用以下命令来完成: ``` -git rebase -i HEAD~20  # 查看可进行压缩的二十个 commit +git rebase -i HEAD~20  # 查看可进行压扁的二十个提交 ``` -当这条命令执行后,将弹出一个 commit 列表的编辑器,你可以通过包括 _pick_ 或 _squash_ 内的数种方式编辑它。_pick_ 一个 commit 即保留这个 commit。_squash_ 一个 commit 则是将这个 commit 合并到前一个中。使用这些方法,你就可以将多个 commit 合并到一个并做编辑和清理。这也是一个清理不重要的 commit 信息的机会(例如,带错字的提交)。 +当这条命令执行后,将弹出一个提交列表的编辑器,你可以通过包括遴选pick压扁squash在内的数种方式编辑它。“遴选”一个提交即保留这个提交。“压扁”一个提交则是将这个提交合并到前一个之中。使用这些方法,你就可以将多个提交合并到一个提交之中,对其进行编辑和清理。这也是一个清理不重要的提交信息的机会(例如,带错字的提交)。 -总之,保留所有与 commit 相关的操作,但在合并到 `master` 分支前,合并并编辑相关信息以明确意图。注意,不要在 rebase 的过程中不小心删掉 commit。 +总之,保留所有与提交相关的操作,但在合并到 `master` 分支前,合并并编辑相关信息以明确意图。注意,不要在变基的过程中不小心删掉提交。 -在执行完诸如 rebase 之类的操作后,我会再次看看 `git log` 并做最终的修改: +在执行完诸如变基之类的操作后,我会再次看看 `git log` 并做最终的修改: ``` git commit --amend ``` -最后,由于重写了分支的 Git 提交历史,必需强制更新远程分支: +最后,由于重写了分支的 Git 提交历史,必须强制更新远程分支: ``` git push -f @@ -81,27 +81,27 @@ git push -f ### 使用标签 -当你完成测试并准备从 `master` 分支部署软件到线上时,又或者当你出于某种原因想要保留当前状态作为一个里程碑时,那么可以创建一个 Git 的标签。对于一个积累了一些变更和相应提交的分支而言,标签就是该分支在那一时刻的快照。一个标签可以看作是没有历史记录的分支,也可以看作是直接指向标签创建前那个提交的命名指针。 +当你完成测试并准备从 `master` 分支部署软件到线上时,又或者当你出于某种原因想要保留当前状态作为一个里程碑时,那么可以创建一个 Git 标签。对于一个积累了一些变更和相应提交的分支而言,标签就是该分支在那一时刻的快照。一个标签可以看作是没有历史记录的分支,也可以看作是直接指向标签创建前那个提交的命名指针。 -配置控制是关于保留各个里程碑上代码的状态。大多数项目都有一个需求,允许重现任一里程碑上的软件源码,以便在需要时重新构建。Git 标签为每个代码的里程碑提供了一个唯一标识。打标签非常简单: +所谓的“配置控制”就是在不同的里程碑上保存代码的状态。大多数项目都有一个需求,能够重现任一里程碑上的软件源码,以便在需要时重新构建。Git 标签为每个代码的里程碑提供了一个唯一标识。打标签非常简单: ``` git tag milestone-id -m "short message saying what this milestone is about" git push --tags   # 不要忘记将标签显式推送到远程 ``` -考虑一种情况,Git 标签对应的软件版本已经分发给客户,而且客户提了个问题。尽管代码库中的代码可能已经继续在开发,但通常情况下为了准确地重现客户问题以便做出修复,必须回退到 Git 标签对应的代码状态。偶尔,新代码已经修复了那个问题,但并非一直如此。通常你需要切换到特定的标签并从那个标签创建一个分支: +考虑这样一种情况:Git 标签对应的软件版本已经分发给客户,而客户报告了一个问题。尽管代码库中的代码可能已经在继续开发,但通常情况下为了准确地重现客户问题以便做出修复,必须回退到 Git 标签对应的代码状态。有时候新代码可能已经修复了那个问题,但并非一直如此。通常你需要切换到特定的标签并从那个标签创建一个分支: ``` git checkout milestone-id        # 切换到分发给客户的标签 git checkout -b new-branch-name  # 创建新的分支用于重现 bug ``` -此外,如果带注释的标记和带符号的标记有助于你的项目,可以考虑使用它们。 +此外,如果带附注的标记和带签名的标记有助于你的项目,可以考虑使用它们。 ### 让软件运行时打印标签 -在大多数嵌入式项目中,从代码版本构建出二进制文件有固定的名称。但无法从它的名称推断出对应的 Git 标签。在构建时“嵌入标签”有助于将未来的问题精准地关联到特定的构建。在构建过程中可以自动地嵌入标签。通常,`git describe` 生成地标签代码会在代码编译前插入到代码中,以便生成的可执行文件能够在启时输出标签代码。当客户报告问题时,可以指导他们给你发送启动时输出的数据。 +在大多数嵌入式项目中,从代码版本构建出的二进制文件有固定的名称,这样无法从它的名称推断出对应的 Git 标签。在构建时“嵌入标签”有助于将未来发现的问题精准地关联到特定的构建版本。在构建过程中可以自动地嵌入标签。通常,`git describe` 生成的标签字符串会在代码编译前插入到代码中,以便生成的可执行文件能够在启时时输出标签字符串。当客户报告问题时,可以指导他们给你发送启动时输出的内容。 ### 总结 @@ -114,7 +114,7 @@ via: https://opensource.com/article/20/7/git-best-practices 作者:[Ravi Chandran][a] 选题:[lujun9972][b] 译者:[LazyWolfLin](https://github.com/LazyWolfLin) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 68e1d8d87b1d7a449c7686ad280922cfd241ffb3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 16 Sep 2020 23:50:47 +0800 Subject: [PATCH 0139/1156] PUB @LazyWolfLin https://linux.cn/article-12621-1.html --- .../20200708 6 best practices for teams using Git.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200708 6 best practices for teams using Git.md (99%) diff --git a/translated/tech/20200708 6 best practices for teams using Git.md b/published/20200708 6 best practices for teams using Git.md similarity index 99% rename from translated/tech/20200708 6 best practices for teams using Git.md rename to published/20200708 6 best practices for teams using Git.md index 3f71072128..22db8f87b8 100644 --- a/translated/tech/20200708 6 best practices for teams using Git.md +++ b/published/20200708 6 best practices for teams using Git.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (LazyWolfLin) [#]: reviewer: (wxy) -[#]: publisher: () -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12621-1.html) [#]: subject: (6 best practices for teams using Git) [#]: via: (https://opensource.com/article/20/7/git-best-practices) [#]: author: (Ravi Chandran https://opensource.com/users/ravichandran) From 46218ae1d3d7ea64a51f69e2cb3d1e94032560ef Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 17 Sep 2020 05:02:26 +0800 Subject: [PATCH 0140/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200917?= =?UTF-8?q?=20GNOME=203.38=20is=20Here=20With=20Customizable=20App=20Grid,?= =?UTF-8?q?=20Performance=20Improvements=20and=20Tons=20of=20Other=20Chang?= =?UTF-8?q?es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md --- ... Improvements and Tons of Other Changes.md | 119 ++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 sources/tech/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md diff --git a/sources/tech/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md b/sources/tech/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md new file mode 100644 index 0000000000..c7c7326a23 --- /dev/null +++ b/sources/tech/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md @@ -0,0 +1,119 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes) +[#]: via: (https://itsfoss.com/gnome-3-38-release/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes +====== + +[GNOME 3.36][1] brought some much-needed improvements along with a major performance boost. Now, after 6 months, we’re finally here with GNOME 3.38 with a big set of changes. + +### GNOME 3.38 Key Features + +Here are the main highlight of GNOME 3.38 codenamed Orbis: + +[Subscribe to our YouTube channel for more Linux videos][2] + +#### Customizable App Menu + +The app grid or the app menu will now be customizable as part of a big change in GNOME 3.38. + +Now, you can create folders by dragging application icons over each other and move them to/from folders and set it right back in the app grid. You can also just reposition the icons as you want in the app grid. + +![][3] + +Also, these changes are some basic building blocks for upcoming design changes planned for future updates — so it’ll be exciting to see what we can expect. + +#### Calendar Menu Updates + +![][4] + +The notification area is a lot cleaner with the recent GNOME updates but now with GNOME 3.38, you can finally access calendar events right below the calendar area to make things convenient and easy to access. + +It’s not a major visual overhaul, but there’s a few improvements to it. + +#### Parental Controls Improvement + +You will observe a parental control service as a part of GNOME 3.38. It supports integration with various components of the desktop, the shell, the settings, and others to help you limit what a user can access. + +#### The Restart Button + +Some subtle improvements lead to massive changes and this is exactly one of those changes. It’s always annoying to click on the “Power Off” / “Shut down” button first and then hit the “Restart” button to reboot the system. + +So, with GNOME 3.38, you will finally notice a “Restart” entry as a separate button which will save you click and give you a peace of mind. + +#### Screen Recording Improvements + +[GNOME shell’s built-in screen record][5] is now a separate system service which should potentially make recording the screen a smooth experience. + +Also, window screencasting had several improvements to it along with some bug fixes: + +#### GNOME apps Updates + +The GNOME calculator has received a lot of bug fixes. In addition to that, you will also find some major changes to the [epiphany GNOME browser][6]. + +GNOME Boxes now lets you pick the OS from a list of operating systems and GNOME Maps was updated with some UI changes as well. + +Not just limited to these, you will also find subtle updates and fixes to GNOME control center, Contacts, Photos, Nautilus, and some other packages. + +#### Performance & multi-monitor support improvements + +There’s a bunch of under-the-hood improvements to improve GNOME 3.38 across the board. For instance, there were some serious fixes to [Mutter][7] which now lets two monitors run at different refresh rates. + +![][8] + +Previously, if you had one monitor with a 60 Hz refresh rate and another with 144 Hz, the one with the slower rate will limit the second monitor. But, with the improvements in GNOME 3.38, it will handle multi-monitors without limiting any of them. + +Also, some changes reported by [Phoronix][9] pointed out around 10% lower render time in some cases. So, that’s definitely a great performance optimization. + +#### Miscellaneous other changes + + * Battery percentage indicator + * Restart option in the power menu + * New welcome tour + * Fingerprint login + * QR code scanning for sharing Wi-Fi hotspot + * Privacy and other improvements to GNOME Browser + * GNOME Maps is now responsive and changes its size based on the screen + * Revised icons + + + +You can find a details list of changes in their official [changelog][10]. + +### Wrapping Up + +GNOME 3.38 is indeed an impressive update to improve the GNOME experience. Even though the performance was greatly improved with GNOME 3.36, more optimizations is a very good thing for GNOME 3.38. + +GNOME 3.38 will be available in Ubuntu 20.10 and [Fedora 33][11]. Arch and Manjaro users should be getting it soon. + +I think there are plenty of changes in right direction. What do you think? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gnome-3-38-release/ + +作者:[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/gnome-3-36-release/ +[2]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/gnome-app-arranger.jpg?resize=799%2C450&ssl=1 +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/gnome-3-38-calendar-menu.png?resize=800%2C721&ssl=1 +[5]: https://itsfoss.com/gnome-screen-recorder/ +[6]: https://en.wikipedia.org/wiki/GNOME_Web +[7]: https://en.wikipedia.org/wiki/Mutter_(software) +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/gnome-multi-monitor-refresh-rate.jpg?resize=800%2C369&ssl=1 +[9]: https://www.phoronix.com/scan.php?page=news_item&px=GNOME-3.38-Last-Min-Mutter +[10]: https://help.gnome.org/misc/release-notes/3.38 +[11]: https://itsfoss.com/fedora-33/ From 9032f6eb6a5e4b698042e44daeb08d8adc960126 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 17 Sep 2020 05:02:38 +0800 Subject: [PATCH 0141/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200917?= =?UTF-8?q?=20Open=20Usage=20Commons:=20Google=E2=80=99s=20Initiative=20to?= =?UTF-8?q?=20Manage=20Trademark=20for=20Open=20Source=20Projects=20Runs?= =?UTF-8?q?=20into=20Controversy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200917 Open Usage Commons- Google-s Initiative to Manage Trademark for Open Source Projects Runs into Controversy.md --- ...n Source Projects Runs into Controversy.md | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 sources/tech/20200917 Open Usage Commons- Google-s Initiative to Manage Trademark for Open Source Projects Runs into Controversy.md diff --git a/sources/tech/20200917 Open Usage Commons- Google-s Initiative to Manage Trademark for Open Source Projects Runs into Controversy.md b/sources/tech/20200917 Open Usage Commons- Google-s Initiative to Manage Trademark for Open Source Projects Runs into Controversy.md new file mode 100644 index 0000000000..1ba65ad315 --- /dev/null +++ b/sources/tech/20200917 Open Usage Commons- Google-s Initiative to Manage Trademark for Open Source Projects Runs into Controversy.md @@ -0,0 +1,83 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open Usage Commons: Google’s Initiative to Manage Trademark for Open Source Projects Runs into Controversy) +[#]: via: (https://itsfoss.com/open-usage-commons-controversy/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Open Usage Commons: Google’s Initiative to Manage Trademark for Open Source Projects Runs into Controversy +====== + +Back in July, Google [announced][1] a new organization named Open Usage Commons. The aim of the organization is to help “projects protect their project identity through programs such as trademark management and usage guidelines”. + +Google believes that “creating a neutral, independent ownership for these trademarks gives contributors and consumers peace of mind regarding their use of project names in a fair and transparent way”. + +### Open Usage Commons and the controversy with IBM + +![][2] + +Everything seems good in theory, right? But soon after the Google’s announcement of the Open Usage Commons, [IBM made an objection][3]. + +The problem is that Google included [Istio][4] project under [Open Usage Commons][5]. IBM is one of the founding members of the Istio project and it wants the project to be under open governance with [CNCF][6]. + +On behalf of It’s FOSS, I had a quick interaction with [Heikki Nousiainen][7], CTO at [Aiven][8] to clear some air on the entire Open Usage Commons episode. + +#### What is the Open Usage Commons trying to do? + +**Heikki Nousiainen**: The stated purpose of Google’s Open Usage Commons (OUC) is to provide a neutral and independent organization for open source projects to host and manage their trademarks. By applying open source software principles to trademarks, this will provide transparency and consistency. The idea is that this will lead to a more vibrant ecosystem for end users because vendors and developers can confidently build something that relies on projects’ brands.  + +Although other foundations, such as the Cloud Native Computing Foundation (CNCF) and [Apache Foundation][9], provide some direction on trademarks, OUC provides more precision and consistency in what constitutes fair use for vendors. This avoids what has generally been left to the individual projects to decide, which has resulted in a confusing patchwork of guidelines. + +Additionally, it is likely an attempt by Google to avoid situations similar to what [Amazon Web Services (AWS) has faced with Elasticsearch][10], e.g. where trademarks have appeared to be increasingly used to prevent exactly what Google is attempting to accomplish with this foundation, _**relatively open use of project brand identifiers by competing vendors**_. + +#### What are the problems surrounding the Commons? + +**Heikki Nousiainen**: The main controversy surrounds the question as to why [Istio][11] was not placed under CNCF governance as IBM was clearly expecting it to be placed under an [Open Governance model][12] once it matured. + +However, Open Usage Commons does not touch the governance model at all. Google, of course, has incentive to be able to trust they can utilize the recognized brands and trademarks to help customers recognize the services built on top of these familiar technologies. + +#### How will it impact the open source world, both positive and negative impacts? + +**Heikki Nousiainen**: It will remain to be seen what the long-term impact will be due to the fact that the only member projects are currently driven by Google. Although controversial, it doesn’t seem like the fears that Google would be able to enact effective control over member projects will materialize. + +A more telling question is, “Who will be likely to participate?” One thing is for sure, this will spark a long overdue discussion on how Open Source trademarks should be used when moving from software bundles to services offered in the cloud. + +#### Does it sound like some big players will have control over the definition of ‘open source trademarks’?  + +**Heikki Nousiainen**: Despite all the controversy over licensing, big players in this space have been and will remain key in securing the resources and support needed for the open source community to thrive. + +Although there is some self-interest here, the creation of vehicles such as this do not necessarily constitute an attempt at imposing unjustified control over projects. As a community-driven software, all must work alongside one another to achieve success. + +* * * + +Personally, I think Google’s long term game plan is to protect its Google Cloud Platform from possible lawsuits over the use of popular source projects’ trademarks and branding. + +What do you think of the entire Open Usage Commons episode? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/open-usage-commons-controversy/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://opensource.googleblog.com/2020/07/announcing-new-kind-of-open-source.html +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/google-open-usage-commons.png?resize=800%2C450&ssl=1 +[3]: https://developer.ibm.com/components/istio/blogs/istio-google-open-usage-commons/ +[4]: https://istio.io +[5]: https://openusage.org +[6]: https://www.cncf.io/ +[7]: https://www.linkedin.com/in/heikki-nousiainen/ +[8]: https://aiven.io +[9]: http://apache.org +[10]: https://news.bloomberglaw.com/ip-law/amazon-sued-for-allegedly-infringing-elasticsearch-trademarks +[11]: https://istio.io/ +[12]: https://developer.ibm.com/articles/open-governance-community/ From b90da29e404f2be12bb2d75e570ad94160b17641 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 17 Sep 2020 05:02:55 +0800 Subject: [PATCH 0142/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200916?= =?UTF-8?q?=20Manage=20your=20Raspberry=20Pi=20fleet=20with=20Ansible?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200916 Manage your Raspberry Pi fleet with Ansible.md --- ...ge your Raspberry Pi fleet with Ansible.md | 229 ++++++++++++++++++ 1 file changed, 229 insertions(+) create mode 100644 sources/tech/20200916 Manage your Raspberry Pi fleet with Ansible.md diff --git a/sources/tech/20200916 Manage your Raspberry Pi fleet with Ansible.md b/sources/tech/20200916 Manage your Raspberry Pi fleet with Ansible.md new file mode 100644 index 0000000000..42d39c2843 --- /dev/null +++ b/sources/tech/20200916 Manage your Raspberry Pi fleet with Ansible.md @@ -0,0 +1,229 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Manage your Raspberry Pi fleet with Ansible) +[#]: via: (https://opensource.com/article/20/9/raspberry-pi-ansible) +[#]: author: (Ken Fallon https://opensource.com/users/kenfallon) + +Manage your Raspberry Pi fleet with Ansible +====== +A solution to the problem of updating difficult-to-reach Raspberry Pis +in the enterprise. +![Raspberries with pi symbol overlay][1] + +The Raspberry Pi is a small, versatile device that makes interfacing with the real world a breeze for mere mortals. The Raspberry Pi Foundation's idea was to sell the devices at such a low cost that breaking one would be sad—but not a disaster. This is one reason it has been a massive success as an [educational tool][2]. But their usefulness has not escaped the business world, where they are becoming a valuable tool for automating the physical world. + +Whether they are used for powering information displays, automating testing, controlling machinery, monitoring an environment, or doing other tasks, enterprises see Raspberry Pis as serious devices for doing serious tasks. Each model has a long product lifecycle—even the older models ([1B+][3], [2B][4], [3A+][5], [3B][6], and [3B+][7]) will remain in production until at least January 2026. There is little risk that they will go obsolete, so you can maintain a sufficiently large stock and treat them as modular components that you replace rather than fix. + +### Stable hardware vs. changing software + +While you can rely on the hardware to remain constant, the same is not true for the software. The Raspberry Pi's official supported operating system is [Raspberry Pi OS][8] (previously called Raspbian), and it should be updated regularly to get the latest [security and bug fixes][9]. + +This presents a problem. Because Raspberry Pis provide a bridge between the physical and virtual worlds, they are often installed in difficult-to-reach locations. They also tend to be installed by hardware folks, typically electricians for plants and assembly technicians for products. You do not want to waste their time by requiring them to connect a keyboard and monitor, log in [to run `raspi-config`][10], install software with `apt-get`, and then configure the software. + +Since Raspberry Pi OS boots off an SD card, one approach is to always maintain an up-to-date version of the software on the SD card that the installer can just plug (and hot glue) in. A good quality assurance (QA) department will keep the SD cards under version control, so you can be assured that all new installations are on the latest release. But this solution is costly to maintain since every software update requires preparing a new image and burning it to all the SD cards. It also doesn't address how to fix all your existing devices. In some cases, you may need to create custom images for specific Raspberry Pis doing specific jobs, and it may be unavoidable that you need an installer to connect a keyboard and monitor to configure something. + +A better approach is to use the same minimal base operating system install and then use [network boot][11] to maintain all the customizations and updates on the network. This requires maintaining just one base image, which is easier to manage, so it is a good approach if you have a reliable network infrastructure. Unfortunately, not all networks support this method; as the Raspberry Pi's network boot documentation says: "Due to the huge range of networking devices available, we can't guarantee that network booting will work with any device." Sadly, it is no longer an option on the [Raspberry Pi 4][12]. Furthermore, this is not an option when devices are disconnected from the network for a long period of time. + +The better goal, therefore, is to produce a common base Raspberry Pi OS image that doesn't change often but, once it's installed, can automatically be customized, maintained, and managed remotely. + +### Create the base image + +Your base image will almost certainly need small changes from the default Raspberry Pi OS image. Fortunately, you only need to recreate the base image if the Raspberry Pi OS image is updated or you need to change something in your configuration. The typical time between major versions of Raspberry Pi OS is about two years, which is a good target maintenance lifecycle. It gives you plenty of time to swap out older devices for new ones while keeping things manageable for the QA department to maintain releases. Older versions will still be supported for security and bug fixes for [some time][13] after that. + +On my Hacker Public Radio episode _[Safely enabling SSH in the default Raspbian image][14]_ in 2017, I walked through the steps to automate updating the base image. The script I created: + + * Downloads the latest image ZIP file + * Verifies it is valid + * Extracts the image itself + * Enables SSH for secure remote management + * Changes the default passwords for the root and Pi users + * Secures the SSH server on the Pi + + + +Since then, I have augmented the script to: + + * Enable connections to a WiFi network (`wpa_supplicant.conf`) + * Load its configuration from an INI file, keeping sensitive information separate from the main script. + * Use [`losetup` to simplify mounting][15] the image + * Create a [firstboot script][16] + + + +These changes ensure that the devices are locked down before deploying them. You can find an updated version of the [fix-ssh-on-pi script][17] on GitHub. + +Now is a good time to modify the script for your environment and especially to add any security keys or digital certificates necessary for authentication. However, it's best to hold off adding any custom applications or configurations at this point, as they can be added later. For the most part, the image will behave like a generic Raspberry Pi OS image, meaning it will boot and resize the SD card as usual and install the typical default software and firmware. + +The notable addition is support for a firstboot script. This is the glue that makes the Raspberry Pi run your custom configuration after the first time it configures itself. Again, I encourage you to modify the script for your environment. For example, you can have the device register itself, run through a system test and diagnostic procedures, pull down a client application, etc. + +If you don't want to customize it, it will do the bare minimum needed to get your Raspberry Pi on the network so that it can be uniquely identified by the network-management software. + +### Set up automatic management + +If you're managing servers in a [DevOps][18] environment, you won't blink an eye at the idea of using [configuration management software][19] to control your Raspberry Pi devices. If you use a tool that requires an agent, you can include the agent software as part of the base image. Given the resources on the Raspberry Pi, though, an agentless solution such as [Ansible][20] might be the best option. It just uses SSH and Python, doesn't require any additional software on the client, the control software is easy to install, and it is easy to use. + +All you need is the [Ansible software][21], a list of devices you want to manage saved in an [inventory file][22], and a [playbook][23], which is a set of instructions that you want carried out. For example, you can [update][9] the base Raspberry Pi OS image using the `apt update && apt full-upgrade` equivalent [apt module][24]. The playbook would be: + + +``` + - name: Run the equivalent of "apt-get update" as a separate step +    apt: +      update_cache: true +      cache_valid_time: 3600 +  - name: Update all packages to the latest version +    apt: +      upgrade: dist +``` + +You may think installing Ansible for Raspberry Pi is overkill, but I find it is worthwhile if you need to manage more than two or three computers. Using Ansible also gives you a more hygienic network—your inventory is audited and listed in its host file, software installations are documented through its playbooks, and data and configurations are kept away from their devices, so they are easier to back up regularly. + +According to [Wikipedia][25], Ansible's design goals include: + +> * **Minimal in nature**. Management systems should not impose additional dependencies on the environment. +> * **Consistent**. With Ansible, one should be able to create consistent environments. +> * **Secure**. Ansible does not deploy agents to nodes. Only OpenSSH and Python are required on the managed nodes. +> * **Highly reliable**. When carefully written, an Ansible playbook can be [idempotent][26] to prevent unexpected side effects on the managed systems. It is entirely possible to have a poorly written playbook that is not idempotent. +> * **Minimal learning required**. Playbooks use an easy and descriptive language based on YAML and Jinja templates. +> + + +Anyone with the correct authorization can configure a device, but you can limit authorization using standard Unix permissions. You can apply granular access to playbooks so that, for example, test operators can access just the test and diagnostic tools you install. + +### How it works + +Imagine you have a widget factory that includes a Raspberry Pi in its product. Your facilities team also uses them to monitor the environmental plant and security. Likewise, the engineering team uses the devices on the production lines within the manufacturing monitoring process. And the IT department uses them as disposable dumb terminals to access the head office enterprise resource planning ([ERP][27]) system. In all of these cases, downtime needs to be kept to a minimum. + +We aim to deliver the exact same device with the exact same image to each of the teams. + +#### Preparing the image + +Common to all stages is preparing the image itself. After cloning the [fix-ssh-on-pi.bash script from github][17], a one time action is needed to edit and rename the files `fix-ssh-on-pi.ini_example` to `fix-ssh-on-pi.ini`, and `wpa_supplicant.conf_example` to `wpa_supplicant.conf`. + +You only need to run the script any time that [Raspberry Pi OS][8](Raspbian) is updated, or when you changed your configuration files. I would recommend including this as part of your devops workflow. If you don’t have that in place yet then it can be automated using a simple cron job. + +I would recommend having a Raspberry Pi Station dedicated to burning the latest SDCards in the store room. This would automatically burn the latest image from the network once a new card is inserted into the [external SD Card Reader][28]. With some imagination and a 3D printer, a nice unit could be manufactured for giving feedback on progress. + +When a Raspberry Pi is requisitioned, the store keepers can then remove one of the finished SDCards and include it with the work order. + +#### Inventory/Hosts File + +In our fictitious example, the role of the device will be determined by the location of the network that it has connected to. Therefore we need to be able to identify Raspberry Pies once they come onto the network. How you approach this will entirely depend on how your network is configured, and what tools is available to you. I would advise listening to the episode by [operat0r][29] called [hpr3090 :: Locating Computers on a Enterprise Network][30] for some great tips on how to do this. + +Each department would have their own provisioning server running the Ansible Software, which of course could be another Raspberry Pi. It is the standard unix/ssh permissions that dictate who has access to what within your organization. In episode [hpr3080 :: Ansible ping][31] I walked through the absolute basics of installing and troubleshooting [Ansible][20]. Since then [klaatu][32] added [hpr3162 :: Introduction to Ansible][33] which is a great introduction to the topic in general. + +How the provisioning server becomes aware of the new devices can be active or passive. + +You could have the [First Boot script][16] actively calling a url to register itself. You would need to have a web application listening and using the received information to register the new host in the Ansible Inventory. + +This might be a good approach for departments where devices are replaced infrequently and you want them provisioned as soon as possible. As an example when a water quality monitoring station gets replaced, it would be a good idea to have it register. The Electrician could then select the exact Playbook to deploy to the device via a smart phone app. + +On the other hand a passive approach may be better if you are going to be installing devices constantly, like on a production line. In that case we can assume that any new devices found on the production line network will have our test and diagnostic software installed at the beginning of the line. This can also be removed automatically prior to shipping. + +One of the changes that `fix-ssh-on-pi.bash` does is that it renames the hostname of each Raspberry Pi to a version based on it’s [Ethernet MAC address][34]. As an example a [Ethernet MAC address][34] of `dc:a6:32:01:23:45` will result in a [hostname][35] of `dca632012345`. + +When the Raspberry Pi finishes it’s first time boot sequence, the 3rd automatic reboot will request a IP Address from your [DHCP][36] server, that hostname will (probably) become available in the office [DNS][37] network. + +At this point your Raspberry Pi is accessible using something like `ssh dca632012345`, `ssh dca632012345.local`, `ssh dca632012345.lan`, or in our example `ssh dca632012345.production.example.com`. + +I included a small script on [github][17] to locate Raspberry Pies based on [Ethernet MAC address][34]. I discussed this recently on my Hacker Public Radio episode _[Locating computers on a network][38]_: + + +``` +# ./put-pi-in-ansible-host.bash | tee all_pies.ini +[all_pies] +b827eb012345 ansible_host=192.168.1.123 +dca632012345 ansible_host=192.168.1.127 +b827eb897654 ansible_host=192.168.1.143 +dca632897654 ansible_host=192.168.1.223 +``` + +In my _[Ansible ping][31]_ episode on Hacker Public Radio, I used a YAML inventory file instead of the INI version above. + +#### Execute a playbook + +Regardless of how the provisioning server becomes aware of the devices, you now know they exist. In this example, you would deploy different playbooks based on the subnet the device is in. + +Perhaps the simplest playbook you can try is this one (from _Ansible ping_ and available on [GitHub][17]): + + +``` +\- name: Test Ping +  hosts: all +  tasks: +  - action: ping +``` + +You should now have everything you need to communicate with the new devices: + + +``` +`ansible-playbook --inventory-file all_pies.ini ping-example-playbook.yaml` +``` + +By modifying the playbook, you can update and configure your devices any way you like. I use this to create users, update the system to the latest version, add and remove software, and do other configurations. There are several good examples available about updating your systems, such as the [Ansible apt update all packages on Ubuntu / Debian Linux][39] tutorial. + +At this point, the devices cease to be generic. You will know the exact role each Raspberry Pi should have, and you can provision it as such. How custom it is will depend on the playbook, but I advise having a specific [Ansible role][40] for each task you need a Pi to do. For example, even if your widget factory has only one water-quality monitoring station, you should still define a role for it. Not only will this allow you to quickly deploy an identical replacement if necessary, but you are also documenting the process, which may be required for certifications such as [ISO 9000][41]. + +You now have the means to audit that updates to your network are in place and being done regularly. Hopefully, this will keep your devices secure for many years of service. This method also applies to products you ship, as they can be updated via hotspots operated by field service engineers. During regular system maintenance, the Raspberry Pi is automatically updated using credentials supplied in the `wpa_supplicant.conf` file. + +### Make management easier + +I hope this has opened your mind about how to tackle managing many devices more easily. All you need to get started is your PC or laptop and a Raspberry Pi. The principles of burning a generic image, creating a device inventory, and deploying a playbook are the same whether you're working on a small scale or scaling up to hundreds of devices. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/raspberry-pi-ansible + +作者:[Ken Fallon][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://opensource.com/users/kenfallon +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life-raspberrypi_0.png?itok=Kczz87J2 (Raspberries with pi symbol overlay) +[2]: https://www.raspberrypi.org/education/ +[3]: https://www.raspberrypi.org/products/raspberry-pi-1-model-b-plus/ +[4]: https://www.raspberrypi.org/products/raspberry-pi-2-model-b/ +[5]: https://www.raspberrypi.org/products/raspberry-pi-3-model-a-plus/ +[6]: https://www.raspberrypi.org/products/raspberry-pi-3-model-b/ +[7]: https://www.raspberrypi.org/products/raspberry-pi-3-model-b-plus/ +[8]: https://www.raspbian.org/ +[9]: https://www.raspberrypi.org/documentation/raspbian/updating.md +[10]: https://www.raspberrypi.org/documentation/configuration/raspi-config.md +[11]: https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/net_tutorial.md +[12]: https://www.raspberrypi.org/blog/raspberry-pi-4-on-sale-now-from-35/#comment-1510410 +[13]: https://wiki.debian.org/DebianReleases +[14]: http://hackerpublicradio.org/eps.php?id=2356 +[15]: http://man7.org/linux/man-pages/man8/losetup.8.html +[16]: https://github.com/nmcclain/raspberian-firstboot +[17]: https://github.com/kenfallon/fix-ssh-on-pi +[18]: https://en.wikipedia.org/wiki/DevOps +[19]: https://en.wikipedia.org/wiki/Comparison_of_open-source_configuration_management_software +[20]: https://www.ansible.com/ +[21]: https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html +[22]: https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html +[23]: https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html +[24]: https://docs.ansible.com/ansible/latest/modules/apt_module.html +[25]: https://en.wikipedia.org/wiki/Ansible_%28software%29%23Design_goals +[26]: https://en.wikipedia.org/wiki/Idempotent +[27]: https://en.wikipedia.org/wiki/Enterprise_resource_planning +[28]: https://www.amazon.com/StarTech-com-4-Slot-USB-C-Card-Reader/dp/B07HVPNQRQ/ +[29]: http://hackerpublicradio.org/correspondents.php?hostid=36 +[30]: http://hackerpublicradio.org/eps.php?id=3090 +[31]: http://hackerpublicradio.org/eps.php?id=3080 +[32]: http://hackerpublicradio.org/correspondents.php?hostid=78 +[33]: http://hackerpublicradio.org/eps.php?id=3162 +[34]: https://en.wikipedia.org/wiki/MAC_address +[35]: https://en.wikipedia.org/wiki/Hostname +[36]: https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol +[37]: https://en.wikipedia.org/wiki/Domain_Name_System +[38]: http://hackerpublicradio.org/eps.php?id=3052 +[39]: https://www.cyberciti.biz/faq/ansible-apt-update-all-packages-on-ubuntu-debian-linux/ +[40]: https://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse_roles.html +[41]: https://en.wikipedia.org/wiki/ISO_9000 From ebe9f8328ec942d16f09d6a5fe97d60efebef039 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 17 Sep 2020 05:03:08 +0800 Subject: [PATCH 0143/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200916?= =?UTF-8?q?=20Teach=20Python=20with=20Jupyter=20Notebooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200916 Teach Python with Jupyter Notebooks.md --- ...916 Teach Python with Jupyter Notebooks.md | 330 ++++++++++++++++++ 1 file changed, 330 insertions(+) create mode 100644 sources/tech/20200916 Teach Python with Jupyter Notebooks.md diff --git a/sources/tech/20200916 Teach Python with Jupyter Notebooks.md b/sources/tech/20200916 Teach Python with Jupyter Notebooks.md new file mode 100644 index 0000000000..43e488a6a3 --- /dev/null +++ b/sources/tech/20200916 Teach Python with Jupyter Notebooks.md @@ -0,0 +1,330 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Teach Python with Jupyter Notebooks) +[#]: via: (https://opensource.com/article/20/9/teach-python-jupyter) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +Teach Python with Jupyter Notebooks +====== +With Jupyter, PyHamcrest, and a little duct tape of a testing harness, +you can teach any Python topic that is amenable to unit testing. +![Person reading a book and digital copy][1] + +Some things about the Ruby community have always impressed me. Two examples are the commitment to testing and the emphasis on making it easy to get started. The best example of both is [Ruby Koans][2], where you learn Ruby by fixing tests. + +With the amazing tools we have for Python, we should be able to do something even better. We can. Using [Jupyter Notebook][3], [PyHamcrest][4], and just a little bit of duct tape-like code, we can make a tutorial that includes teaching, code that works, and code that needs fixing. + +First, some duct tape. Usually, you do your tests using some nice command-line test runner, like [pytest][5] or [virtue][6]. Usually, you do not even run it directly. You use a tool like [tox][7] or [nox][8] to run it. However, for Jupyter, you need to write a little harness that can run the tests directly in the cells. + +Luckily, the harness is short, if not simple: ` ` + + +``` +import unittest + +def run_test(klass): +    suite = unittest.TestLoader().loadTestsFromTestCase(klass) +    unittest.TextTestRunner(verbosity=2).run(suite) +    return klass +``` + +Now that the harness is done, it's time for the first exercise. + +In teaching, it is always a good idea to start small with an easy exercise to build confidence. + +So why not fix a really simple test? + + +``` +@run_test +class TestNumbers(unittest.TestCase): +    +    def test_equality(self): +        expected_value = 3 # Only change this line +        self.assertEqual(1+1, expected_value) + +[/code] [code] + +    test_equality (__main__.TestNumbers) ... FAIL +    +    ====================================================================== +    FAIL: test_equality (__main__.TestNumbers) +    ---------------------------------------------------------------------- +    Traceback (most recent call last): +      File "<ipython-input-7-5ebe25bc00f3>", line 6, in test_equality +        self.assertEqual(1+1, expected_value) +    AssertionError: 2 != 3 +    +    ---------------------------------------------------------------------- +    Ran 1 test in 0.002s +    +    FAILED (failures=1) +``` + +`Only change this line` is a useful marker for students. It shows exactly what needs to be changed. Otherwise, students could fix the test by changing the first line to `return`. + +In this case, the fix is easy: ` ` + + +``` +@run_test +class TestNumbers(unittest.TestCase): +    +    def test_equality(self): +        expected_value = 2 # Fixed this line +        self.assertEqual(1+1, expected_value) + +[/code] [code] + +    test_equality (__main__.TestNumbers) ... ok +    +    ---------------------------------------------------------------------- +    Ran 1 test in 0.002s +    +    OK +``` + +Quickly, however, the `unittest` library's native assertions will prove lacking. In `pytest`, this is fixed with rewriting the bytecode in `assert` to have magical properties and all kinds of heuristics. This would not work easily in a Jupyter notebook. Time to dig out a good assertion library: PyHamcrest: + + +``` +`from hamcrest import *`[/code] [code] + +@run_test +class TestList(unittest.TestCase): +    +    def test_equality(self): +        things = [1, +                  5, # Only change this line +                  3] +        assert_that(things, has_items(1, 2, 3)) + +[/code] [code] + +    test_equality (__main__.TestList) ... FAIL +    +    ====================================================================== +    FAIL: test_equality (__main__.TestList) +    ---------------------------------------------------------------------- +    Traceback (most recent call last): +      File "<ipython-input-11-96c91225ee7d>", line 8, in test_equality +        assert_that(things, has_items(1, 2, 3)) +    AssertionError: +    Expected: (a sequence containing <1> and a sequence containing <2> and a sequence containing <3>) +         but: a sequence containing <2> was <[1, 5, 3]> +    +    +    ---------------------------------------------------------------------- +    Ran 1 test in 0.004s +    +    FAILED (failures=1) +``` + +PyHamcrest is not just good at flexible assertions; it is also good at clear error messages. Because of that, the problem is plain to see: `[1, 5, 3]` does not contain `2`, and it looks ugly besides: + + +``` +@run_test +class TestList(unittest.TestCase): +    +    def test_equality(self): +        things = [1, +                  2, # Fixed this line +                  3] +        assert_that(things, has_items(1, 2, 3)) + +[/code] [code] + +    test_equality (__main__.TestList) ... ok +    +    ---------------------------------------------------------------------- +    Ran 1 test in 0.001s +    +    OK +``` + +With Jupyter, PyHamcrest, and a little duct tape of a testing harness, you can teach any Python topic that is amenable to unit testing. + +For example, the following can help show the differences between the different ways Python can strip whitespace from a string: + + +``` +source_string = "  hello world  " + +@run_test +class TestList(unittest.TestCase): +    +    # This one is a freebie: it already works! +    def test_complete_strip(self): +        result = source_string.strip() +        assert_that(result, +                   all_of(starts_with("hello"), ends_with("world"))) + +    def test_start_strip(self): +        result = source_string # Only change this line +        assert_that(result, +                   all_of(starts_with("hello"), ends_with("world  "))) + +    def test_end_strip(self): +        result = source_string # Only change this line +        assert_that(result, +                   all_of(starts_with("  hello"), ends_with("world"))) + +[/code] [code] + +    test_complete_strip (__main__.TestList) ... ok +    test_end_strip (__main__.TestList) ... FAIL +    test_start_strip (__main__.TestList) ... FAIL +    +    ====================================================================== +    FAIL: test_end_strip (__main__.TestList) +    ---------------------------------------------------------------------- +    Traceback (most recent call last): +      File "<ipython-input-16-3db7465bd5bf>", line 19, in test_end_strip +        assert_that(result, +    AssertionError: +    Expected: (a string starting with '  hello' and a string ending with 'world') +         but: a string ending with 'world' was '  hello world  ' +    +    +    ====================================================================== +    FAIL: test_start_strip (__main__.TestList) +    ---------------------------------------------------------------------- +    Traceback (most recent call last): +      File "<ipython-input-16-3db7465bd5bf>", line 14, in test_start_strip +        assert_that(result, +    AssertionError: +    Expected: (a string starting with 'hello' and a string ending with 'world  ') +         but: a string starting with 'hello' was '  hello world  ' +    +    +    ---------------------------------------------------------------------- +    Ran 3 tests in 0.006s +    +    FAILED (failures=2) +``` + +Ideally, students would realize that the methods `.lstrip()` and `.rstrip()` will do what they need. But if they do not and instead try to use `.strip()` everywhere: + + +``` +source_string = "  hello world  " + +@run_test +class TestList(unittest.TestCase): +    +    # This one is a freebie: it already works! +    def test_complete_strip(self): +        result = source_string.strip() +        assert_that(result, +                   all_of(starts_with("hello"), ends_with("world"))) + +    def test_start_strip(self): +        result = source_string.strip() # Changed this line +        assert_that(result, +                   all_of(starts_with("hello"), ends_with("world  "))) + +    def test_end_strip(self): +        result = source_string.strip() # Changed this line +        assert_that(result, +                   all_of(starts_with("  hello"), ends_with("world"))) + +[/code] [code] + +    test_complete_strip (__main__.TestList) ... ok +    test_end_strip (__main__.TestList) ... FAIL +    test_start_strip (__main__.TestList) ... FAIL +    +    ====================================================================== +    FAIL: test_end_strip (__main__.TestList) +    ---------------------------------------------------------------------- +    Traceback (most recent call last): +      File "<ipython-input-17-6f9cfa1a997f>", line 19, in test_end_strip +        assert_that(result, +    AssertionError: +    Expected: (a string starting with '  hello' and a string ending with 'world') +         but: a string starting with '  hello' was 'hello world' +    +    +    ====================================================================== +    FAIL: test_start_strip (__main__.TestList) +    ---------------------------------------------------------------------- +    Traceback (most recent call last): +      File "<ipython-input-17-6f9cfa1a997f>", line 14, in test_start_strip +        assert_that(result, +    AssertionError: +    Expected: (a string starting with 'hello' and a string ending with 'world  ') +         but: a string ending with 'world  ' was 'hello world' +    +    +    ---------------------------------------------------------------------- +    Ran 3 tests in 0.007s +    +    FAILED (failures=2) +``` + +They would get a different error message that shows too much space has been stripped: + + +``` +source_string = "  hello world  " + +@run_test +class TestList(unittest.TestCase): +    +    # This one is a freebie: it already works! +    def test_complete_strip(self): +        result = source_string.strip() +        assert_that(result, +                   all_of(starts_with("hello"), ends_with("world"))) + +    def test_start_strip(self): +        result = source_string.lstrip() # Fixed this line +        assert_that(result, +                   all_of(starts_with("hello"), ends_with("world  "))) + +    def test_end_strip(self): +        result = source_string.rstrip() # Fixed this line +        assert_that(result, +                   all_of(starts_with("  hello"), ends_with("world"))) + +[/code] [code] + +    test_complete_strip (__main__.TestList) ... ok +    test_end_strip (__main__.TestList) ... ok +    test_start_strip (__main__.TestList) ... ok +    +    ---------------------------------------------------------------------- +    Ran 3 tests in 0.005s +    +    OK +``` + +In a more realistic tutorial, there would be more examples and more explanations. This technique using a notebook with some examples that work and some that need fixing can work for real-time teaching, a video-based class, or even, with a lot more prose, a tutorial the student can complete on their own. + +Now go out there and share your knowledge! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/teach-python-jupyter + +作者:[Moshe Zadka][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://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/read_book_guide_tutorial_teacher_student_apaper.png?itok=_GOufk6N (Person reading a book and digital copy) +[2]: https://github.com/edgecase/ruby_koans +[3]: https://jupyter.org/ +[4]: https://github.com/hamcrest/PyHamcrest +[5]: https://docs.pytest.org/en/stable/ +[6]: https://github.com/Julian/Virtue +[7]: https://tox.readthedocs.io/en/latest/ +[8]: https://nox.thea.codes/en/stable/ From 90094615d91714ef2bf9459c82376b8b7008c2fe Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 17 Sep 2020 05:03:21 +0800 Subject: [PATCH 0144/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200916?= =?UTF-8?q?=20Analyze=20Linux=20startup=20performance?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200916 Analyze Linux startup performance.md --- ...00916 Analyze Linux startup performance.md | 422 ++++++++++++++++++ 1 file changed, 422 insertions(+) create mode 100644 sources/tech/20200916 Analyze Linux startup performance.md diff --git a/sources/tech/20200916 Analyze Linux startup performance.md b/sources/tech/20200916 Analyze Linux startup performance.md new file mode 100644 index 0000000000..855251cfc1 --- /dev/null +++ b/sources/tech/20200916 Analyze Linux startup performance.md @@ -0,0 +1,422 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Analyze Linux startup performance) +[#]: via: (https://opensource.com/article/20/9/systemd-startup-configuration) +[#]: author: (David Both https://opensource.com/users/dboth) + +Analyze Linux startup performance +====== +Use systemd-analyze to get insights and solve problems with Linux +startup performance. +![Magnifying glass on code][1] + +Part of the system administrator's job is to analyze the performance of systems and to find and resolve problems that cause poor performance and long startup times. Sysadmins also need to check other aspects of systemd configuration and usage. + +The systemd init system provides the `systemd-analyze` tool that can help uncover performance problems and other important systemd information. In a previous article, [_Analyzing systemd calendar and timespans_][2], I used `systemd-analyze` to analyze timestamps and timespans in systemd timers, but this tool has many other uses, some of which I will explore in this article. + +### Startup overview + +The Linux startup sequence is a good place to begin exploring because many `systemd-analyze` tool functions are targeted at startup. But first, it is important to understand the difference between boot and startup. The boot sequence starts with the BIOS power-on self test (POST) and ends when the kernel is finished loading and takes control of the host system, which is the beginning of startup and the point when the systemd journal begins. + +In the second article in this series, [_Understanding systemd at startup on Linux_][3], I discuss startup in a bit more detail with respect to what happens and in what sequence. In this article, I want to examine the startup sequence to look at the amount of time it takes to go through startup and which tasks take the most time. + +The results I'll show below are from my primary workstation, which is much more interesting than a virtual machine's results. This workstation consists of an ASUS TUF X299 Mark 2 motherboard, an Intel i9-7960X CPU with 16 cores and 32 CPUs (threads), and 64GB of RAM. Some of the commands below can be run by a non-root user, but I will use root in this article to prevent having to switch between users. + +There are several options for examining the startup sequence. The simplest form of the `systemd-analyze` command displays an overview of the amount of time spent in each of the main sections of startup, the kernel startup, loading and running `initrd` (i.e., initial ramdisk, a temporary system image that is used to initialize some hardware and mount the `/` [root] filesystem), and userspace (where all the programs and daemons required to bring the host up to a usable state are loaded). If no subcommand is passed to the command, `systemd-analyze time` is implied: + + +``` +[root@david ~]$ systemd-analyze +Startup finished in 53.921s (firmware) + 2.643s (loader) + 2.236s (kernel) + 4.348s (initrd) + 10.082s (userspace) = 1min 13.233s +graphical.target reached after 10.071s in userspace +[root@david ~]# +``` + +The most notable data in this output is the amount of time spent in firmware (BIOS): almost 54 seconds. This is an extraordinary amount of time, and none of my other physical systems take anywhere near as long to get through BIOS. + +My System76 Oryx Pro laptop spends only 8.506 seconds in BIOS, and all of my home-built systems take a bit less than 10 seconds. After some online searches, I found that this motherboard is known for its inordinately long BIOS boot time. My motherboard never "just boots." It always hangs, and I need to do a power off/on cycle, and then BIOS starts with an error, and I need to press F1 to enter BIOS configuration, from where I can select the boot drive and finish the boot. This is where the extra time comes from. + +Not all hosts show firmware data. My unscientific experiments lead me to believe that this data is shown only for Intel generation 9 processors or above. But that could be incorrect. + +This overview of the boot startup process is interesting and provides good (though limited) information, but there is much more information available about startup, as I'll describe below. + +### Assigning blame + +You can use `systemd-analyze blame` to discover which systemd units take the most time to initialize. The results are displayed in order by the amount of time they take to initialize, from most to least: + + +``` +[root@david ~]$ systemd-analyze blame                                                                         +       5.417s NetworkManager-wait-online.service                                                       +       3.423s dracut-initqueue.service                                                                 +       2.715s systemd-udev-settle.service                                                               +       2.519s fstrim.service                                                                           +       1.275s udisks2.service                                                                           +       1.271s smartd.service                                                                           +        996ms upower.service                                                                           +        637ms lvm2-monitor.service                                                                     +        533ms lvm2-pvscan@8:17.service                                                                 +        520ms dmraid-activation.service                                                                 +        460ms vboxdrv.service                                                                           +        396ms initrd-switch-root.service +<SNIP – removed lots of entries with increasingly small times> +``` + +Because many of these services start in parallel, the numbers may add up to significantly more than the total given by `systemd-analyze time` for everything after the BIOS. All of these are small numbers, so I cannot find any significant savings here. + +The data from this command can provide indications about which services you might consider to improve boot times. Services that are not used can be disabled. There does not appear to be any single service that is taking an excessively long time during this startup sequence. You may see different results for each boot and startup. + +### Critical chains + +Like the critical path in project management, a _critical chain_ shows the time-critical chain of events that take place during startup. These are the systemd units you want to look at if startup is slow, as they are the ones that would cause delays. This tool does not display all the units that start, only those in this critical chain of events: + + +``` +[root@david ~]# systemd-analyze critical-chain +The time when unit became active or started is printed after the "@" character. +The time the unit took to start is printed after the "+" character. + +graphical.target @10.071s +└─lxdm.service @10.071s +  └─plymouth-quit.service @10.047s +22ms +    └─systemd-user-sessions.service @10.031s +7ms +      └─remote-fs.target @10.026s +        └─remote-fs-pre.target @10.025s +          └─nfs-client.target @4.636s +            └─gssproxy.service @4.607s +28ms +              └─network.target @4.604s +                └─NetworkManager.service @4.383s +219ms +                  └─dbus-broker.service @4.434s +136ms +                    └─dbus.socket @4.369s +                      └─sysinit.target @4.354s +                        └─systemd-update-utmp.service @4.345s +9ms +                          └─auditd.service @4.301s +42ms +                            └─systemd-tmpfiles-setup.service @4.254s +42ms +                              └─import-state.service @4.233s +19ms +                                └─local-fs.target @4.229s +                                  └─Virtual.mount @4.019s +209ms +                                    └─systemd-fsck@dev-mapper-vg_david2\x2dVirtual.service @3.742s +274ms +                                      └─local-fs-pre.target @3.726s +                                        └─lvm2-monitor.service @356ms +637ms +                                          └─dm-event.socket @319ms +                                            └─-.mount +                                              └─system.slice +                                                └─-.slice +[root@david ~]# +``` + +The numbers preceded with `@` show the absolute number of seconds since startup began when the unit becomes active. The numbers preceded by `+` show the amount of time it takes for the unit to start. + +### System state + +Sometimes you need to determine the system's current state. The `systemd-analyze dump` command dumps a _massive_ amount of data about the current system state. It starts with a list of the primary boot timestamps, a list of each systemd unit, and a complete description of the state of each: + + +``` +[root@david ~]# systemd-analyze dump +Timestamp firmware: 1min 7.983523s +Timestamp loader: 3.872325s +Timestamp kernel: Wed 2020-08-26 12:33:35 EDT +Timestamp initrd: Wed 2020-08-26 12:33:38 EDT +Timestamp userspace: Wed 2020-08-26 12:33:42 EDT +Timestamp finish: Wed 2020-08-26 16:33:56 EDT +Timestamp security-start: Wed 2020-08-26 12:33:42 EDT +Timestamp security-finish: Wed 2020-08-26 12:33:42 EDT +Timestamp generators-start: Wed 2020-08-26 16:33:42 EDT +Timestamp generators-finish: Wed 2020-08-26 16:33:43 EDT +Timestamp units-load-start: Wed 2020-08-26 16:33:43 EDT +Timestamp units-load-finish: Wed 2020-08-26 16:33:43 EDT +Timestamp initrd-security-start: Wed 2020-08-26 12:33:38 EDT +Timestamp initrd-security-finish: Wed 2020-08-26 12:33:38 EDT +Timestamp initrd-generators-start: Wed 2020-08-26 12:33:38 EDT +Timestamp initrd-generators-finish: Wed 2020-08-26 12:33:38 EDT +Timestamp initrd-units-load-start: Wed 2020-08-26 12:33:38 EDT +Timestamp initrd-units-load-finish: Wed 2020-08-26 12:33:38 EDT +-> Unit system.slice: +        Description: System Slice +        Instance: n/a +        Unit Load State: loaded +        Unit Active State: active +        State Change Timestamp: Wed 2020-08-26 12:33:38 EDT +        Inactive Exit Timestamp: Wed 2020-08-26 12:33:38 EDT +        Active Enter Timestamp: Wed 2020-08-26 12:33:38 EDT +        Active Exit Timestamp: n/a +        Inactive Enter Timestamp: n/a +        May GC: no +<SNIP – Deleted a bazillion lines of output> +``` + +On my main workstation, this command generated a stream of 49,680 lines and about 1.66MB. This command is very fast, so you don't need to wait for the results. + +I do like the wealth of detail provided for the various connected devices, such as storage. Each systemd unit has a section with details such as modes for various runtimes, cache, and log directories, the command line used to start the unit, the process ID (PID), the start timestamp, as well as memory and file limits. + +The man page for `systemd-analyze` shows the `systemd-analyze --user dump` option, which is intended to display information about the internal state of the user manager. This fails for me, and internet searches indicate that there may be a problem with it. In systemd, `--user` instances are used to manage and control the resources for the hierarchy of processes belonging to each user. The processes for each user are part of a control group, which I'll cover in a future article. + +### Analytic graphs + +Most pointy-haired-bosses (PHBs) and many good managers find pretty graphs easier to read and understand than the text-based system performance data I usually prefer. Sometimes, though, even I like a good graph, and `systemd-analyze` provides the capability to display boot/startup data in an [SVG][4] vector graphics chart. + +The following command generates a vector graphics file that displays the events that take place during boot and startup. It only takes a few seconds to generate this file: + + +``` +`[root@david ~]# systemd-analyze plot > /tmp/bootup.svg` +``` + +This command creates an SVG, which is a text file that defines a series of graphic vectors that applications, including Image Viewer, Ristretto, Okular, Eye of Mate, LibreOffice Draw, and others, use to generate a graph. These applications process SVG files to create an image. + +I used LibreOffice Draw to render a graph. The graph is huge, and you need to zoom in considerably to make out any detail. Here is a small portion of it: + +![The bootup.svg file displayed in LibreOffice Draw.][5] + +(David Both, [CC BY-SA 4.0][6]) + +The bootup sequence is to the left of the zero (0) on the timeline in the graph, and the startup sequence is to the right of zero. This small portion shows the kernel, `initrd`, and the processes `initrd` started. + +This graph shows at a glance what started when, how long it took to start up, and the major dependencies. The critical path is highlighted in red. + +Another command that generates graphical output is `systemd-analyze plot`. It generates textual dependency graph descriptions in [DOT][7] format. The resulting data stream is then piped through the `dot` utility, which is part of a family of programs that can be used to generate vector graphic files from various types of data. These SVG files can also be processed by the tools listed above. + +First, generate the file. This took almost nine minutes on my primary workstation: + + +``` +[root@david ~]# time systemd-analyze dot | dot -Tsvg > /tmp/test.svg +   Color legend: black     = Requires +                 dark blue = Requisite +                 dark grey = Wants +                 red       = Conflicts +                 green     = After + +real    8m37.544s +user    8m35.375s +sys     0m0.070s +[root@david ~]# +``` + +I won't reproduce the output here because the resulting graph is pretty much spaghetti. But you should try it and view the result to see what I mean. + +### Conditionals + +One of the more interesting, yet somewhat generic, capabilities I discovered while reading the `systemd-analyze(1)` man page is the `condition` subcommand. (Yes—I do read the man pages, and it is amazing what I have learned this way!) This `condition` subcommand can be used to test the conditions and asserts that can be used in systemd unit files. + +It can also be used in scripts to evaluate one or more conditions—it returns a zero (0) if all are met or a one (1) if any condition is not met. In either case, it also spews text about its findings. + +The example below, from the man page, is a bit complex. It tests for a kernel version between 4.0 and 5.1, that the host is running on AC power, that the system architecture is anything but ARM, and that the directory `/etc/os-release` exists. I added the `echo $?` statement to print the return code. + + +``` +[root@david ~]# systemd-analyze condition 'ConditionKernelVersion = ! <4.0' \ +                    'ConditionKernelVersion = >=5.1' \ +                    'ConditionACPower=|false' \ +                    'ConditionArchitecture=|!arm' \ +                    'AssertPathExists=/etc/os-release' ; \ +echo $? +test.service: AssertPathExists=/etc/os-release succeeded. +Asserts succeeded. +test.service: ConditionArchitecture=|!arm succeeded. +test.service: ConditionACPower=|false failed. +test.service: ConditionKernelVersion=>=5.1 succeeded. +test.service: ConditionKernelVersion=!<4.0 succeeded. +Conditions succeeded. +0 +[root@david ~]# +``` + +The list of conditions and asserts starts around line 600 on the `systemd.unit(5)` man page. + +### Listing configuration files + +The `systemd-analyze` tool provides a way to send the contents of various configuration files to `STDOUT`, as shown here. The base directory is `/etc/`: + + +``` +[root@david ~]# systemd-analyze cat-config systemd/system/display-manager.service +# /etc/systemd/system/display-manager.service +[Unit] +Description=LXDM (Lightweight X11 Display Manager) +#Documentation=man:lxdm(8) +Conflicts=[getty@tty1.service][8] +After=systemd-user-sessions.service [getty@tty1.service][8] plymouth-quit.service livesys-late.service +#Conflicts=plymouth-quit.service + +[Service] +ExecStart=/usr/sbin/lxdm +Restart=always +IgnoreSIGPIPE=no +#BusName=org.freedesktop.lxdm + +[Install] +Alias=display-manager.service +[root@david ~]# +``` + +This is a lot of typing to do nothing more than a standard `cat` command does. I find the next command a tiny bit helpful. It can search out files with the specified pattern within the standard systemd locations: + + +``` +[root@david ~]# systemctl cat backup* +# /etc/systemd/system/backup.timer +# This timer unit runs the local backup program +# (C) David Both +# Licensed under GPL V2 +# + +[Unit] +Description=Perform system backups +Requires=backup.service + +[Timer] +Unit=backup.service +OnCalendar=*-*-* 00:15:30 + +[Install] +WantedBy=timers.target + +# /etc/systemd/system/backup.service +# This service unit runs the rsbu backup program +# By David Both +# Licensed under GPL V2 +# + +[Unit] +Description=Backup services using rsbu +Wants=backup.timer + +[Service] +Type=oneshot +Environment="HOME=/root" +ExecStart=/usr/local/bin/rsbu -bvd1 +ExecStart=/usr/local/bin/rsbu -buvd2 + +[Install] +WantedBy=multi-user.target + +[root@david ~]# +``` + +Both of these commands preface the contents of each file with a comment line containing the file's full path and name. + +### Unit file verification + +After creating a new unit file, it can be helpful to verify that its syntax is correct. This is what the `verify` subcommand does. It can list directives that are spelled incorrectly and call out missing service units: + + +``` +`[root@david ~]# systemd-analyze verify /etc/systemd/system/backup.service` +``` + +Adhering to the Unix/Linux philosophy that "silence is golden," a lack of output messages means that there are no errors in the scanned file. + +### Security + +The `security` subcommand checks the security level of specified services. It only works on service units and not on other types of unit files: + + +``` +[root@david ~]# systemd-analyze security display-manager +  NAME                                                        DESCRIPTION                                                     > +✗ PrivateNetwork=                                             Service has access to the host's network                        > +✗ User=/DynamicUser=                                          Service runs as root user                                       > +✗ CapabilityBoundingSet=~CAP_SET(UID|GID|PCAP)                Service may change UID/GID identities/capabilities              > +✗ CapabilityBoundingSet=~CAP_SYS_ADMIN                        Service has administrator privileges                            > +✗ CapabilityBoundingSet=~CAP_SYS_PTRACE                       Service has ptrace() debugging abilities                        > +✗ RestrictAddressFamilies=~AF_(INET|INET6)                    Service may allocate Internet sockets                           > +✗ RestrictNamespaces=~CLONE_NEWUSER                           Service may create user namespaces                              > +✗ RestrictAddressFamilies=~…                                  Service may allocate exotic sockets                             > +✗ CapabilityBoundingSet=~CAP_(CHOWN|FSETID|SETFCAP)           Service may change file ownership/access mode/capabilities unres> +✗ CapabilityBoundingSet=~CAP_(DAC_*|FOWNER|IPC_OWNER)         Service may override UNIX file/IPC permission checks            > +✗ CapabilityBoundingSet=~CAP_NET_ADMIN                        Service has network configuration privileges                    > +✗ CapabilityBoundingSet=~CAP_SYS_MODULE                       Service may load kernel modules +<SNIP> +✗ CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG                   Service may issue vhangup()                                     > +✗ CapabilityBoundingSet=~CAP_WAKE_ALARM                       Service may program timers that wake up the system              > +✗ RestrictAddressFamilies=~AF_UNIX                            Service may allocate local sockets                              > + +→ Overall exposure level for backup.service: 9.6 UNSAFE 😨 +lines 34-81/81 (END) +``` + +Yes, the emoji is part of the output. But, of course, many services need pretty much complete access to everything in order to do their work. I ran this program against several services, including my own backup service; the results may differ, but the bottom line seems to be mostly the same. + +This tool would be very useful for checking and fixing userspace service units in security-critical environments. I don't think it has much to offer for most of us. + +### Final thoughts + +This powerful tool offers some interesting and amazingly useful options. Much of what this article explores is about using `systemd-analyze` to provide insights into Linux's startup performance using systemd. It can also analyze other aspects of systemd. + +Some of these tools are of limited use, and a couple should be forgotten completely. But most can be used to good effect when resolving problems with startup and other systemd functions. + +### Resources + +There is a great deal of information about systemd available on the internet, but much is terse, obtuse, or even misleading. In addition to the resources mentioned in this article, the following webpages offer more detailed and reliable information about systemd startup. This list has grown since I started this series of articles to reflect the research I have done. + + * The [systemd.unit(5) manual page][9] contains a nice list of unit file sections and their configuration options along with concise descriptions of each. + * The Fedora Project has a good, practical [guide to systemd][10]. It has pretty much everything you need to know in order to configure, manage, and maintain a Fedora computer using systemd. + * The Fedora Project also has a good [cheat sheet][11] that cross-references the old SystemV commands to comparable systemd ones. + * Red Hat documentation contains a good description of the [Unit file structure][12] as well as other important information.   + * For detailed technical information about systemd and the reasons for creating it, check out Freedesktop.org's [description of systemd][13]. + * [Linux.com][14]'s "More systemd fun" offers more advanced systemd [information and tips][15]. + + + +There is also a series of deeply technical articles for Linux sysadmins by Lennart Poettering, the designer and primary developer of systemd. These articles were written between April 2010 and September 2011, but they are just as relevant now as they were then. Much of everything else good that has been written about systemd and its ecosystem is based on these papers. + + * [Rethinking PID 1][16] + * [systemd for Administrators, Part I][17] + * [systemd for Administrators, Part II][18] + * [systemd for Administrators, Part III][19] + * [systemd for Administrators, Part IV][20] + * [systemd for Administrators, Part V][21] + * [systemd for Administrators, Part VI][22] + * [systemd for Administrators, Part VII][23] + * [systemd for Administrators, Part VIII][24] + * [systemd for Administrators, Part IX][25] + * [systemd for Administrators, Part X][26] + * [systemd for Administrators, Part XI][27] + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/systemd-startup-configuration + +作者:[David Both][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://opensource.com/users/dboth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/find-file-linux-code_magnifying_glass_zero.png?itok=E2HoPDg0 (Magnifying glass on code) +[2]: https://opensource.com/article/20/7/systemd-calendar-timespans +[3]: https://opensource.com/article/20/5/systemd-startup?utm_campaign=intrel +[4]: https://en.wikipedia.org/wiki/Scalable_Vector_Graphics +[5]: https://opensource.com/sites/default/files/uploads/bootup.svg-graph.png (The bootup.svg file displayed in LibreOffice Draw.) +[6]: https://creativecommons.org/licenses/by-sa/4.0/ +[7]: https://en.wikipedia.org/wiki/DOT_(graph_description_language) +[8]: mailto:getty@tty1.service +[9]: https://man7.org/linux/man-pages/man5/systemd.unit.5.html +[10]: https://docs.fedoraproject.org/en-US/quick-docs/understanding-and-administering-systemd/index.html +[11]: https://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet +[12]: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_basic_system_settings/managing-services-with-systemd_configuring-basic-system-settings#Managing_Services_with_systemd-Unit_File_Structure +[13]: https://www.freedesktop.org/wiki/Software/systemd/ +[14]: http://Linux.com +[15]: https://www.linux.com/training-tutorials/more-systemd-fun-blame-game-and-stopping-services-prejudice/ +[16]: http://0pointer.de/blog/projects/systemd.html +[17]: http://0pointer.de/blog/projects/systemd-for-admins-1.html +[18]: http://0pointer.de/blog/projects/systemd-for-admins-2.html +[19]: http://0pointer.de/blog/projects/systemd-for-admins-3.html +[20]: http://0pointer.de/blog/projects/systemd-for-admins-4.html +[21]: http://0pointer.de/blog/projects/three-levels-of-off.html +[22]: http://0pointer.de/blog/projects/changing-roots +[23]: http://0pointer.de/blog/projects/blame-game.html +[24]: http://0pointer.de/blog/projects/the-new-configuration-files.html +[25]: http://0pointer.de/blog/projects/on-etc-sysinit.html +[26]: http://0pointer.de/blog/projects/instances.html +[27]: http://0pointer.de/blog/projects/inetd.html From 00ae0e0c39d97d4e8344e9830dc2102eed24e909 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 17 Sep 2020 05:04:23 +0800 Subject: [PATCH 0145/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[talk]:=2020200916?= =?UTF-8?q?=20Huawei=20ban=20could=20complicate=205G=20deployment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200916 Huawei ban could complicate 5G deployment.md --- ...awei ban could complicate 5G deployment.md | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 sources/talk/20200916 Huawei ban could complicate 5G deployment.md diff --git a/sources/talk/20200916 Huawei ban could complicate 5G deployment.md b/sources/talk/20200916 Huawei ban could complicate 5G deployment.md new file mode 100644 index 0000000000..7a9f20f127 --- /dev/null +++ b/sources/talk/20200916 Huawei ban could complicate 5G deployment.md @@ -0,0 +1,83 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Huawei ban could complicate 5G deployment) +[#]: via: (https://www.networkworld.com/article/3575408/huawei-ban-could-complicate-5g-deployment.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +Huawei ban could complicate 5G deployment +====== +Bans on Huawei, ZTE mean fewer choices for wireless carriers building 5G services +Vertigo3D / Getty Images + +As carriers race to build out their 5G networks, options for buying the gear they need are fewer in the U.S. than in other countries thanks to federal pressure, which could be slowing deployments. + +### 5G resources + + * [What is 5G? Fast wireless technology for enterprises and phones][1] + * [How 5G frequency affects range and speed][2] + * [Private 5G can solve some problems that Wi-Fi can’t][3] + * [Private 5G keeps Whirlpool driverless vehicles rolling][4] + * [5G can make for cost-effective private backhaul][5] + * [CBRS can bring private 5G to enterprises][6] + + + +China-based Huawei and ZTE were both banned from providing equipment to the government itself in the Defense Authorization Act of 2018, and a general import ban followed shortly thereafter. That has changed the competitive landscape considerably, and raises questions about how the shape of 5G in America could change as a consequence. + +Michael Porowski , a Gartner analyst, said it’s possible, though not completely clear, that the restriction on where carriers can buy their 5G equipment is slowing deployment. + +“There’s still an ample number of suppliers – Ericsson, Nokia, Samsung,” he said. Both ZTE and Huawei are more economical options, he said, and “if they were available, you might see a bit faster adoption.” + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][7] + +There’s a sense in the industry that Huawei equipment is both sophisticated and priced to move, according to Christian Renaud, research director at 451 Research, but there’s also no clear alternative that carriers will gravitate to in the absence of Huawei. + +“Here, you’ll have carriers that have standardized on Nokia or Ericsson,” he said. “[And] it’s too soon to tell who’s most sophisticated because deployments are so limited.” + +That contention is borne out by coverage maps from the carriers themselves. While they have been quick to trumpet the presence of 5G service in many U.S. markets, the actual geographic coverage is mostly restricted to public spaces in the urban cores of major cities. The lion’s share of 5G deployment, in short, is yet to come. + +There are good reasons for slow deployment. 5G access points have to be deployed far more densely than earlier generation wireless technology, making the process more involved and time-consuming. There’s also the issue that the number of currently available 5G user devices is vanishingly small. + +“It’s like saying ‘I’ve got this eight-lane superhighway,’ before someone has invented cars,” said Renaud. + +Part of the current goal for equipment vendors is demonstrating the potentials of 5G through private deployments that use the technology for backhaul, supporting [IoT][8] and other link use cases specific to a single enterprise. + +“[The equipment vendors] are all pushing hard on the private piece, and then they can use that to say, ‘Look, I’m working the Brooklyn dockyards or something in a private 5G network, so … if I can do that I can run people’s YouTube connections,’” Renaud said. + +An unfortunate result of the China ban might be a splintering of the specifications that vendors follow to meet 5G requirements. If non-China vendors have to make one version for markets where Huawei and ZTE are allowed and a different version for places they are not, it could create a new headache for them, according to Renaud. + +“That’ll shift the burden of costs to the device makers to try to support the different carrier implementations," he said. “We’ll have created nontechnical barriers.” And those, in turn, could cause customer experience to suffer. + +But 5G has embraced a move toward greater interoperability with [open radio access network technology][9] that standardizes the software interfaces between layers of the 5G stack. The push is embraced by carriers and equipment vendors alike, making interoperability more likely, which could draw in even more players in the future. + +Of course, even with pervasive interoperability, equipment makers will still try to build customer dependency. “There’s always going to be a tug of war between vendors trying to lock in customers and customers trying to stay vendor-neutral,” he said. “That’s not going to change a lot. [But] we’ve obviously seen a move toward trying to be more open.” + +Join the Network World communities on [Facebook][10] and [LinkedIn][11] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3575408/huawei-ban-could-complicate-5g-deployment.html + +作者:[Jon Gold][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://www.networkworld.com/author/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3203489/what-is-5g-fast-wireless-technology-for-enterprises-and-phones.html +[2]: https://www.networkworld.com/article/3568253/how-5g-frequency-affects-range-and-speed.html +[3]: https://www.networkworld.com/article/3568614/private-5g-can-solve-some-enterprise-problems-that-wi-fi-can-t.html +[4]: https://www.networkworld.com/article/3488799/private-5g-keeps-whirlpool-driverless-vehicles-rolling.html +[5]: https://www.networkworld.com/article/3570724/5g-can-make-for-cost-effective-private-backhaul.html +[6]: https://www.networkworld.com/article/3529291/cbrs-wireless-can-bring-private-5g-to-enterprises.html +[7]: https://www.networkworld.com/newsletters/signup.html +[8]: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html +[9]: https://www.networkworld.com/article/3574977/carriers-vendors-work-to-promote-5g-network-flexibility-with-open-standards.html +[10]: https://www.facebook.com/NetworkWorld/ +[11]: https://www.linkedin.com/company/network-world From 62a86184c97664d17b98919859d86446e0aad4c9 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 17 Sep 2020 08:41:34 +0800 Subject: [PATCH 0146/1156] translated --- ...Easily Authenticate Your Secure Devices.md | 79 ------------------- ...Easily Authenticate Your Secure Devices.md | 79 +++++++++++++++++++ 2 files changed, 79 insertions(+), 79 deletions(-) delete mode 100644 sources/tech/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md create mode 100644 translated/tech/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md diff --git a/sources/tech/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md b/sources/tech/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md deleted file mode 100644 index fbbcb3faa6..0000000000 --- a/sources/tech/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md +++ /dev/null @@ -1,79 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices) -[#]: via: (https://itsfoss.com/yubikey-5c-nfc/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices -====== - -If you are extra cautious about securing your online accounts with the best possible authentication method, you probably know about [Yubico][1]. They make hardware authentication security keys to replace [two-factor authentication][2] and get rid of the password authentication system for your online accounts. - -Basically, you just plug the security key on your computer or use the NFC on your smartphone to unlock access to accounts. In this way, your authentication method stays completely offline. - -![][3] - -Of course, you can always use a [good password manager for Linux][4] available out there. But if you own or work for a business or just extra cautious about your privacy and security and want to add an extra layer of security, these hardware security keys could be worth a try. These devices have gained some popularity lately. - -Yubico’s latest product – ‘[YubiKey 5C NFC][5]‘ is probably something impressive because it can be used both as USB type C key and NFC (just touch your device with the key). - -Here, let’s take a look at an overview of this security key. - -_Please note that It’s FOSS is an affiliate partner of Yubico. Please read our [affiliate policy][6]._ - -### Yubico 5C NFC: Overview - -![][7] - -YubiKey 5C NFC is the latest offering that uses both USB-C and NFC. So, you can easily plug it in on Windows, macOS, and Linux computers. In addition to the computers, you can also use it with your Android or iOS smartphones or tablets. - -Not just limited to USB-C and NFC support (which is a great thing), it also happens to be the world’s first multi-protocol security key with smart card support as well. - -Hardware security keys aren’t that common because of their cost for an average consumer. But, amidst the pandemic, with the rise of remote work, a safer authentication system will definitely come in handy. - -Here’s what Yubico mentioned in their press release: - -> “The way that people work and go online is vastly different today than it was a few years ago, and especially within the last several months. Users are no longer tied to just one device or service, nor do they want to be. That’s why the YubiKey 5C NFC is one of our most sought-after security keys — it’s compatible with a majority of modern-day computers and mobile phones and works well across a range of legacy and modern applications. At the end of the day, our customers crave security that ‘just works’ no matter what.”  said Guido Appenzeller, Chief Product Officer, Yubico. - -The protocols that YubiKey 5C NFC supports are FIDO2, WebAuthn, FIDO U2F, PIV (smart card), OATH-HOTP and OATH-TOTP (hash-based and time-based one-time passwords), [OpenPGP][8], YubiOTP, and challenge-response. - -Considering all those protocols, you can easily secure any online account that supports hardware authentication while also having the ability to access identity access management (IAM) solutions. So, it’s a great option for both individual users and enterprises. - -### Pricing & Availability - -The YubiKey 5C NFC costs $55. You can order it directly from their [online store][5] or get it from any authorized resellers in your country. The cost might also vary depending on the shipping charges but $55 seems to be a sweet spot for serious users who want the best-level of security for their online accounts. - -It’s also worth noting that you get volume discounts if you order more than two YubiKeys. - -[Order YubiKey 5C NFC][5] - -### Wrapping Up - -No matter whether you want to secure your cloud storage account or any other online account, Yubico’s latest offering is something that’s worth taking a look at if you don’t mind spending some money to secure your data. - -Have you ever used YubiKey or some other secure key like LibremKey etc? How is your experience with it? Do you think these devices are worth spending the extra money? - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/yubikey-5c-nfc/ - -作者:[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/recommends/yubikey/ -[2]: https://ssd.eff.org/en/glossary/two-factor-authentication -[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/yubikey-5c-nfc-desktop.jpg?resize=800%2C671&ssl=1 -[4]: https://itsfoss.com/password-managers-linux/ -[5]: https://itsfoss.com/recommends/yubico-5c-nfc/ -[6]: https://itsfoss.com/affiliate-policy/ -[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/yubico-5c-nfc.jpg?resize=800%2C671&ssl=1 -[8]: https://www.openpgp.org/ diff --git a/translated/tech/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md b/translated/tech/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md new file mode 100644 index 0000000000..9a46da7928 --- /dev/null +++ b/translated/tech/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices) +[#]: via: (https://itsfoss.com/yubikey-5c-nfc/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +全新的 YubiKey 5C NFC 安全密钥让你可以使用 NFC 轻松认证你的安全设备 +====== + +如果你对用最好的认证方法来保护你的在线帐户的安全格外谨慎,你可能知道 [Yubico][1]。他们制作的硬件认证安全密钥可以取代[双因素认证][2],并摆脱在线账户的密码认证系统。 + +基本上,你只需将安全密钥插在电脑上,或者使用智能手机上的 NFC 来解锁访问账户。这样一来,你的认证方式就会完全保持离线状态。 + +![][3] + +当然,你可以随时使用 [Linux 中好用的密码管理器][4]。但如果你拥有或为企业工作,或者只是对自己的隐私和安全格外谨慎,想增加一层额外的安全保护,这些硬件安全密钥可能值得一试。这些设备最近获得了一些人气。 + +Yubico 的最新产品 ”[YubiKey 5C NFC][5]“ 可能是令人印象深刻的东西,因为它既可以作为 Type-C 的 USB 密钥使用,也可以作为 NFC 使用(只要用密钥碰触你的设备)。 + +下面,让我们来看看这款安全密钥的概况。 + +_请注意,It's FOSS 是 Yubico 的附属合作伙伴。请阅读我们的[联盟政策][6]_。 + +### Yubico 5C NFC:概述 + +![][7] + +YubiKey 5C NFC 是最新的产品,它同时使用 USB-C 和 NFC。因此,你可以轻松地将它插入 Windows、macOS 和 Linux 电脑。除了电脑,你也可以用你的 Android 或 iOS 智能手机或平板电脑来使用它。 + +不仅仅局限于 USB-C 和 NFC 的支持(这是件好事),它也恰好是世界上第一个支持智能卡的多协议安全密钥。 + +对于普通消费者来说,硬件安全密钥并不那么常见,因为它的成本很高。但在疫情流行的过程中,随着远程办公的兴起,一个更安全的认证系统肯定会派上用场。 + +以下是 Yubico 在其新闻稿中提到的内容: + +> Yubico 首席产品官 Guido Appenzeller 表示:“如今人们工作和上网的方式与几年前大不相同,尤其是在过去几个月内。用户不再仅仅被一种设备或服务所束缚,他们也不希望如此。这就是为什么 YubiKey 5C NFC 是我们最受欢迎的安全密钥之一。它与大多数现代电脑和手机兼容,并在一系列传统和现代应用中运行良好。归根结底,我们的客户渴望的是无论如何都能”正常工作“的安全性。” + +YubiKey 5C NFC 支持的协议有 FIDO2、WebAuthn、FIDO U2F、PIV (智能卡)、OATH-HOTP 和 OATH-TOTP (基于哈希和时间的一次性密码)、[OpenPGP][8]、YubiOTP 和挑战应答认证。 + +考虑到所有这些协议,你可以轻松地保护任何支持硬件认证的在线帐户,同时还可以访问身份访问管理 (IAM) 解决方案。因此,这对个人用户和企业来说都是一个很好的选择。 + +### 定价和渠道 + +YubiKey 5C NFC 的价格为 55 美元。你可以直接从他们的[在线商店][5]订购,或者从你所在国家的任何授权经销商处购买。花费可能也会根据运输费用的不同而有所不同,但对于那些想要为他们的在线账户提供最佳安全级别的用户而言,55 美元似乎是个不错的价格。 + +值得注意的是,如果你订购两个以上的 YubiKeys,你可以获得批量折扣。 + +[Order YubiKey 5C NFC][5] + +### 总结 + +无论你是想保护你的云存储帐户还是其他在线帐户的安全,如果你不介意花点钱来保护你的数据安全,Yubico 的最新产品是值得一试的。 + +你是否使用过 YubiKey 或其他安全密钥,如 LibremKey 等?你对它的体验如何?你认为这些设备值得花钱吗? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/yubikey-5c-nfc/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者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/recommends/yubikey/ +[2]: https://ssd.eff.org/en/glossary/two-factor-authentication +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/yubikey-5c-nfc-desktop.jpg?resize=800%2C671&ssl=1 +[4]: https://itsfoss.com/password-managers-linux/ +[5]: https://itsfoss.com/recommends/yubico-5c-nfc/ +[6]: https://itsfoss.com/affiliate-policy/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/yubico-5c-nfc.jpg?resize=800%2C671&ssl=1 +[8]: https://www.openpgp.org/ From dad0028edb377fcb45f0e4c768846ad32ca991a6 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 17 Sep 2020 08:47:51 +0800 Subject: [PATCH 0147/1156] translating --- ...nity Driven Open Source Password Manager -Not Cloud Based.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md b/sources/tech/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md index ce3a0af765..0325d1136a 100644 --- a/sources/tech/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md +++ b/sources/tech/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 6aae41df41ed75a85e6ec5bba93048a36dbba0e8 Mon Sep 17 00:00:00 2001 From: M4tr1xt4ng <42641719+MATRIXKOO@users.noreply.github.com> Date: Thu, 17 Sep 2020 10:38:43 +0800 Subject: [PATCH 0148/1156] Update 20191009 Why to choose Rust as your next programming language.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 提交翻译申请 --- ...1009 Why to choose Rust as your next programming language.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20191009 Why to choose Rust as your next programming language.md b/sources/talk/20191009 Why to choose Rust as your next programming language.md index d8cad5c342..871b31abc6 100644 --- a/sources/talk/20191009 Why to choose Rust as your next programming language.md +++ b/sources/talk/20191009 Why to choose Rust as your next programming language.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MATRIXKOO) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 4f6293376ab19ae1ad8a8f4b893d3c0e80817dd4 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 18 Sep 2020 00:41:57 +0800 Subject: [PATCH 0149/1156] PRF @wxy --- ...kdown Editors That Are Also Open Source.md | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/translated/tech/20200829 Best Free Online Markdown Editors That Are Also Open Source.md b/translated/tech/20200829 Best Free Online Markdown Editors That Are Also Open Source.md index af22401caf..7a8cd8ac22 100644 --- a/translated/tech/20200829 Best Free Online Markdown Editors That Are Also Open Source.md +++ b/translated/tech/20200829 Best Free Online Markdown Editors That Are Also Open Source.md @@ -1,24 +1,24 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Best Free Online Markdown Editors That Are Also Open Source) [#]: via: (https://itsfoss.com/online-markdown-editors/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -免费的开源在线 Markdown 编辑器 +免费开源的在线 Markdown 编辑器 ====== -[Markdown][1] 是一种有用的轻量级[标记语言][2],很多人喜欢用它来编写文档或网页发布。很多人都使用 Markdown 来写文章。 +[Markdown][1] 是一种有用的轻量级[标记语言][2],很多人喜欢用它来编写文档或做网页发布。很多人都使用 Markdown 来写文章。 有[几个适用于 Linux 的 Markdown 编辑器][3],你可以安装并使用。 -但是,如果你不想在你的系统上安装另一个程序怎么办?也许你暂时使用一个系统,无法安装一个应用程序?也许你只是想要一个能让你实时协作的标记编辑器? +但是,如果你不想在你的系统上安装另一个程序怎么办?也许你暂时使用的系统无法安装一个应用程序?也许你只是想要一个能让你实时协作的 Markdown 编辑器? 无论你的需求是什么,在线 Markdown 编辑器通过提供协作功能、发布集成、笔记同步和一些在线功能,让很多事情变得简单。 -因此,我整理了一份最好的在线 Markdown 编辑器列表。 +因此,我整理了一份在线 Markdown 编辑器列表。 ### 免费的在线 Markdown 编辑器 @@ -32,9 +32,9 @@ [StackEdit][5] 是目前最流行的开源在线 Markdown 编辑器之一。 -它提供了一个很好的用户界面,并提供了一堆有用的功能。协作能力、同步能力,以及能够将你的文件发布/保存到 Blogger,WordPress,GitHub 和其他一些服务是 StackEdit 的一些关键功能。 +它提供了一个很好的用户界面,并有一堆有用的功能。协作能力、同步能力,以及能够将你的文件发布/保存到 Blogger、WordPress、GitHub 和其他一些服务是 StackEdit 的一些关键功能。 -不要忘了,你还可以得到一个扩展的 Markdown 支持一些可用的扩展,以支持 LaTeX 数学表达式,UML 图等。它呈现了一个所见即所得的编辑器,让你轻松使用 Markdown。它还可以离线工作,并提供了一个 chrome 应用程序和扩展,如果你要的话。 +不要忘了,你还可以使用一些 Markdown 扩展来支持 LaTeX 数学表达式、UML 图等。它的界面是一个所见即所得的编辑器,可以让你轻松使用 Markdown。它还可以离线工作,如果你需要的话,它还提供了一个 chrome 应用程序和扩展。 在 StackEdit 上导入/导出文件也很容易。如果你需要在你的服务器上托管它,你可以看看它在 [GitHub][6] 上的源代码,了解更多细节。 @@ -44,9 +44,9 @@ ![][8] -Dillinger 是又一个有趣的开源在线 Markdown 编辑器。与 StackEdit 类似,你也可以与 Dropbox、GitHub、Medium、Google Drive、Bitbucket 和 OneDrive 链接并保存文件。 +Dillinger 也是一个有趣的开源在线 Markdown 编辑器。与 StackEdit 类似,你也可以与 Dropbox、GitHub、Medium、Google Drive、Bitbucket 和 OneDrive 链接并保存文件。 -你也可以选择在需要时简单地导入/导出文件。Dillinger 的用户界面比你在 StackEdit 上看到的更简单,但它也能达到工作的目的。与 StackEdit 不同的是,你可能得不到带有 LaTeX 表达式或图表的扩展 Markdown 支持,但如果你只是需要简单的在线 Markdown 编辑器,这是一个不错的选择。 +你也可以选择在需要时简单地导入/导出文件。Dillinger 的用户界面比你在 StackEdit 上看到的更简单,但它也可以工作。与 StackEdit 不同的是,你没有 LaTeX 表达式或图表的 Markdown 扩展支持,如果你只是需要一个简单的在线 Markdown 编辑器,这是一个不错的选择。 如果你需要,你可以选择将它部署在服务器上的 Docker 容器中。关于它的更多技术细节,你不妨看看它的 [GitHub 页面][9]。 @@ -56,11 +56,11 @@ Dillinger 是又一个有趣的开源在线 Markdown 编辑器。与 StackEdit ![][11] -Write.as 基于同一个团队开发的自由开源软件 [WriteFreely][12],所以你可以简单地把它托管在自己的服务器上,如果你愿意的话,就可以开始免费使用它。 +Write.as 基于该团队开发的自由开源软件 [WriteFreely][12],所以如果你愿意的话,你可以简单地把它托管在自己的服务器上免费使用它。 -你也可以使用 Write.as 服务作为一个具有基本功能的免费在线 Markdown 编辑器。为了使它发挥最大的作用,你可能想选择一份订阅。一些付费功能包括自定义主题、新闻通讯、照片托管和多个博客。 +你也可以使用 Write.as 服务作为一个具有基本功能的免费在线 Markdown 编辑器。为了使它发挥最大的作用,你可能想选购一份付费订阅。付费的功能包括自定义主题、新闻通讯、照片托管和多个博客等等。 -它支持 Markdown,还可以让 [Mastodon][13]、[ActivityPub][14] 和 [Pleroma][15] 上的任何人轻松关注和分享你的博客文章。 +它支持 Markdown,可以让 [Mastodon][13]、[ActivityPub][14] 和 [Pleroma][15] 上的任何人轻松关注和分享你的博客文章。 你可以在它的 [GitHub 页面][16]上探索更多关于 WriteFreely 的信息,或者使用 Write.as 开始。 @@ -70,11 +70,11 @@ Write.as 基于同一个团队开发的自由开源软件 [WriteFreely][12], ![][18] -一个有趣的开源 Markdown 编辑器,如果你有需要,还可以嵌入到自己的网页上。 +这是一个有趣的开源 Markdown 编辑器,还可以嵌入到自己的网页上。 -它支持实时预览、GitHub 风格的 Markdown,还呈现了一个所见即所得的编辑器以及一堆有用的功能。除了基本的 Markdown 支持外,它还支持 emojis、LaTeX 表达式、Flowchart 等。 +它支持实时预览、GitHub 风格的 Markdown,它有一个所见即所得的编辑器以及一堆有用的功能。除了基本的 Markdown 支持外,它还支持表情符、LaTeX 表达式、流程图等。 -你也可以选择自己托管来配置。更多信息请看它的 [GitHub 页面][19]。 +你也可以选择自己托管,更多信息请看它的 [GitHub 页面][19]。 - [Editor.md][20] @@ -82,11 +82,11 @@ Write.as 基于同一个团队开发的自由开源软件 [WriteFreely][12], ![][21] -CodiMD 从一开始就不是一个成熟的在线服务。但是,它是一个开源项目,通过给你在服务器上托管的能力,让你可以实时协作文档或笔记。 +CodiMD 从一开始就不是一个成熟的在线服务。但是,它是一个开源项目,通过托管在服务器上,你可以实时协作文档或笔记。 -它基于 [HackMD][22] 的源代码,并提供了一个[演示实例][23]来测试它。我个人很喜欢它还提供了一个黑暗模式,而且它很容易使用。 +它基于 [HackMD][22] 的源代码,并提供了一个[演示实例][23]来提供测试。我个人很喜欢它还提供了一个黑暗模式,而且很容易使用。 -对于它未来的发布(在写这篇文章的时候),它将改名为 “HedgeDoc”。 +对于它未来的发布版本(在写这篇文章的时候),它将改名为 “HedgeDoc”。 你可以在它的 [GitHub 页面][24]上找到所有关于通过 Docker/Kubernetes 在服务器上部署它的相关信息以及其他手动配置选项。 @@ -96,9 +96,9 @@ CodiMD 从一开始就不是一个成熟的在线服务。但是,它是一个 ![][26] -Wri.pe 是一款简单的开源在线 Markdown 编辑器,虽然已经不再维护,但它仍然活跃且可用。 +Wri.pe 是一款简单的开源在线 Markdown 编辑器,虽然已经不再维护,但它仍然活着而且可用。 -它的特点是实时预览和可选导出或保存你的笔记到 Dropbox/Evernote。考虑到它没有活跃维护,你可能不会依赖它,但当我测试它时,它的工作原理和预期一样。 +它的特点是实时预览和可以导出或保存你的笔记到 Dropbox/Evernote。考虑到它没有积极维护,你可能不会依赖它,但当我测试它时,它和预期一样可以工作。 你可以看看它的 [GitHub 页面][27]或官方网站来了解更多关于它的信息。 @@ -112,7 +112,7 @@ Wri.pe 是一款简单的开源在线 Markdown 编辑器,虽然已经不再维 ![][29] -由 Markdown 语言的创造者提供的一个简单而免费的在线 Markdown 编辑器。它并不是一个成熟的在线编辑器,也不支持导入/导出, +这是由 Markdown 语言的创造者提供的一个简单而免费的在线 Markdown 编辑器。它并不是一个成熟的在线编辑器,也不支持导入/导出, 但是,如果你只是想要一个在线编辑器来预览你的 Markdown 代码,这可能是一个不错的选择。不仅仅局限于编辑器,你还可以在网站的侧边栏得到一个语法速查表。所以,你也可以在这里尝试和学习。 @@ -122,19 +122,19 @@ Wri.pe 是一款简单的开源在线 Markdown 编辑器,虽然已经不再维 ![][31] -[Markdown Journal][32] 是 [GitHub][33] 上的一个有趣的开源项目,但已经停止了。它让你能够使用它的在线编辑器用 Markdown 语言创建日记,并直接保存在你的 Dropbox 账户上。当我试图创建日志时,我注意到内部服务器错误,但你可以看看它。 +[Markdown Journal][32] 是 [GitHub][33] 上的一个有趣的开源项目,但已经停止开发了。你可以通过它的在线编辑器使用 Markdown 语言创建日记,并直接保存在你的 Dropbox 账户上。当我试图创建日志时,我注意到发生了内部服务器错误,但你可以了解一下它。 #### Etherpad ![][34] -[Etherpad][35] 是另一个令人印象深刻的开源在线编辑器,但它并没有开箱即用的 Markdown 支持。你可能会注意到一些插件可以在你的服务器上启用 Markdown 编辑,但那还不是完美无缺的东西。所以,你可能要留意一下它。有一个[公共实例][36]的列表,也可以尝试一下。 +[Etherpad][35] 是另一个令人印象深刻的开源在线编辑器,但它并没有开箱即用的 Markdown 支持。你可能会注意到通过一些插件可以在你的服务器上启用 Markdown 编辑,但还不够完美。所以,你可能要注意一点。它有一个[公共实例][36]的列表,也可以尝试一下。 ### 总结 -考虑到很多在线编辑器、CMS 和记事本服务都支持 Markdown,如果你想把它发布到网络上,像 [WordPress][37] 这样的服务/应用也是一个不错的选择。 +考虑到很多在线编辑器、CMS 和记事本服务都支持 Markdown,如果你想把它发布到网站上,像 [WordPress][37] 这样的服务/应用也是一个不错的选择。 -你更喜欢用哪个作为 Markdown 编辑器?我是否错过了你最喜欢的东西?请在下面的评论中告诉我 +你更喜欢用哪个 Markdown 编辑器?我是否错过了你最喜欢的东西?请在下面的评论中告诉我。 -------------------------------------------------------------------------------- @@ -143,7 +143,7 @@ via: https://itsfoss.com/online-markdown-editors/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 7bb2629111ab28f5bdd197535e23b2bcdec31be3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 18 Sep 2020 00:42:30 +0800 Subject: [PATCH 0150/1156] PUB @wxy https://linux.cn/article-12624-1.html --- ... Free Online Markdown Editors That Are Also Open Source.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200829 Best Free Online Markdown Editors That Are Also Open Source.md (99%) diff --git a/translated/tech/20200829 Best Free Online Markdown Editors That Are Also Open Source.md b/published/20200829 Best Free Online Markdown Editors That Are Also Open Source.md similarity index 99% rename from translated/tech/20200829 Best Free Online Markdown Editors That Are Also Open Source.md rename to published/20200829 Best Free Online Markdown Editors That Are Also Open Source.md index 7a8cd8ac22..d15d98c8ff 100644 --- a/translated/tech/20200829 Best Free Online Markdown Editors That Are Also Open Source.md +++ b/published/20200829 Best Free Online Markdown Editors That Are Also Open Source.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12624-1.html) [#]: subject: (Best Free Online Markdown Editors That Are Also Open Source) [#]: via: (https://itsfoss.com/online-markdown-editors/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From 409bfa1653f4c4bf096249da31fb09962f812eb4 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 18 Sep 2020 05:01:38 +0800 Subject: [PATCH 0151/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200918?= =?UTF-8?q?=20How=20to=20Extend/Increase=20LVM=E2=80=99s=20(Logical=20Volu?= =?UTF-8?q?me=20Resize)=20in=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md --- ... LVM-s (Logical Volume Resize) in Linux.md | 177 ++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 sources/tech/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md diff --git a/sources/tech/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md b/sources/tech/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md new file mode 100644 index 0000000000..937dbcc744 --- /dev/null +++ b/sources/tech/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md @@ -0,0 +1,177 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Extend/Increase LVM’s (Logical Volume Resize) in Linux) +[#]: via: (https://www.2daygeek.com/extend-increase-resize-lvm-logical-volume-in-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +How to Extend/Increase LVM’s (Logical Volume Resize) in Linux +====== + +Expanding the logical volume is extremely easy, it takes very few steps and can be done online without unmounting a certain logical volume. + +The main purpose of LVM is flexible disk management, which allows you to easily resize, extend and reduce the logical volume size when you need it. + +If you are new to Logical Volume Management (LVM), I suggest you start with our previous article. + + * **Part-1: [How to Create/Configure LVM (Logical Volume Management) in Linux][1]** + + + +![][2] + +Expanding the logical volume involves the below steps. + + * Check if you have sufficient unallocated disk space in the volume group where the LV was residing. + * If yes, you can use that space to extend the logical volume. + * If not, add new disks or LUNs to your system. + * Convert a physical disk as a physical volume (PV). + * Extend the Volume Group + * Increase the logical Volume + * Grow the filesystem + * Check the extended filesystem size + + + +### How to Create LVM Physical Volumes + +Create LVM physical volumes with the pvcreate command. + +Once the disk is detected in the OS, use the pvcreate command to initialize the LVM PV (Physical Volumes). + +``` +# pvcreate /dev/sdc +Physical volume "/dev/sdc" successfully created +``` + +**Make a note:** + + * The above command erases any data on the given disk /dev/sdc. + * Physical disk can be added directly into the LVM PV instead of the disk partition. + + + +Use the pvdisplay command to display the PVs you have created. + +``` +# pvdisplay /dev/sdc + +"/dev/sdc" is a new physical volume of "10.00 GiB" +--- NEW Physical volume --- +PV Name /dev/sdc +VG Name +PV Size 10.00 GiB +Allocatable NO +PE Size 0 +Total PE 0 +Free PE 0 +Allocated PE 0 +PV UUID 69d9dd18-36be-4631-9ebb-78f05fe3217f +``` + +### How to Extend the Volume Group + +Use the following command to add a new physical volume to the existing volume group. + +``` +# vgextend vg01 /dev/sdc +Volume group "vg01" successfully extended +``` + +Use the vgdisplay command to display the PVs you have created. + +``` +# vgdisplay vg01 +--- Volume group --- +VG Name vg01 +System ID +Format lvm2 +Metadata Areas 2 +Metadata Sequence No 1 +VG Access read/write +VG Status resizable +MAX LV 0 +Cur LV 0 +Open LV 0 +Max PV 0 +Cur PV 2 +Act PV 2 +VG Size 14.99 GiB +PE Size 4.00 MiB +Total PE 3840 +Alloc PE / Size 1280 / 4.99 +Free PE / Size 2560 / 9.99 GiB +VG UUID d17e3c31-e2c9-4f11-809c-94a549bc43b7 +``` + +### How to Extend the Logical Volume + +Use the following command to increase the existing logical volume. + +**Common syntax for logical volume extension (lvextend).** + +``` +lvextend [Additional space to be added] [Existing Logical Volume Name] +``` + +Use the below command to increase the existing logical volume additionally to 10GB. + +``` +# lvextend -L +10G /dev/mapper/vg01-lv002 +Rounding size to boundary between physical extents: 5.90 GiB +Size of logical volume vg01/lv002 changed from 5.00 GiB (1280 extents) to 15.00 GiB (3840 extents). +Logical volume var successfully resized +``` + +To extend logical volume using PE size’s. + +``` +# lvextend -l +2560 /dev/mapper/vg01-lv002 +``` + +To extend the logical volume using percentage (%), use the following command. + +``` +# lvextend -l +40%FREE /dev/mapper/vg01-lv002 +``` + +Now, the logical volume is extended and you need to resize the file system to extend the space inside the logical volume. + +For an ext3 and ext4 based file system, run the following command. + +``` +# resize2fs /dev/mapper/vg01-lv002 +``` + +For the xfs file system, use the following command. + +``` +# xfs_growfs /dev/mapper/vg01-lv002 +``` + +Use the **[df command][3]** to view the file system size. + +``` +# df -h /lvmtest1 +Filesystem Size Used Avail Use% Mounted on +/dev/mapper/vg01-lv002 15360M 34M 15326M 4% /lvmtest1 +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/extend-increase-resize-lvm-logical-volume-in-linux/ + +作者:[Magesh Maruthamuthu][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://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/create-lvm-storage-logical-volume-manager-in-linux/ +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: https://www.2daygeek.com/linux-check-disk-space-usage-df-command/ From 9dd429e27a8b0a9b568493ea6e2e33d540d52989 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 18 Sep 2020 05:02:07 +0800 Subject: [PATCH 0152/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200918?= =?UTF-8?q?=20How=20to=20Fix=20=E2=80=9CRepository=20is=20not=20valid=20ye?= =?UTF-8?q?t=E2=80=9D=20Error=20in=20Ubuntu=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md --- ...is not valid yet- Error in Ubuntu Linux.md | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 sources/tech/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md diff --git a/sources/tech/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md b/sources/tech/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md new file mode 100644 index 0000000000..7fba88db3d --- /dev/null +++ b/sources/tech/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md @@ -0,0 +1,98 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Fix “Repository is not valid yet” Error in Ubuntu Linux) +[#]: via: (https://itsfoss.com/fix-repository-not-valid-yet-error-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +How to Fix “Repository is not valid yet” Error in Ubuntu Linux +====== + +I recently [installed Ubuntu server on my Raspberry Pi][1]. I [connected it to the Wi-Fi from Ubuntu terminal][2] and went about doing what I do after installing any Linux system which is to update the system. + +When I used the ‘sudo apt update’ command, it gave me an error which was kind of unique to me. It complained that release file for the repository was invalid for a certain time period. + +**E: Release file for is not valid yet (invalid for another 159d 15h 20min 52s). Updates for this repository will not be applied.** + +Here’s the complete output: + +``` +[email protected]:~$ sudo apt update +Hit:1 http://ports.ubuntu.com/ubuntu-ports focal InRelease +Get:2 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease [111 kB] +Get:3 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease [98.3 kB] +Get:4 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease [107 kB] +Reading package lists... Done +E: Release file for http://ports.ubuntu.com/ubuntu-ports/dists/focal/InRelease is not valid yet (invalid for another 21d 23h 17min 25s). Updates for this repository will not be applied. +E: Release file for http://ports.ubuntu.com/ubuntu-ports/dists/focal-updates/InRelease is not valid yet (invalid for another 159d 15h 21min 2s). Updates for this repository will not be applied. +E: Release file for http://ports.ubuntu.com/ubuntu-ports/dists/focal-backports/InRelease is not valid yet (invalid for another 159d 15h 21min 32s). Updates for this repository will not be applied. +E: Release file for http://ports.ubuntu.com/ubuntu-ports/dists/focal-security/InRelease is not valid yet (invalid for another 159d 15h 20min 52s). Updates for this repository will not be applied. +``` + +### Fixing “release file is not valid yet” error in Ubuntu and other Linux distributions + +![][3] + +The reason for the error is the difference in the time on the system and the time in real world. + +You see, every repository file is signed on some date and you can see this information by viewing the release file: + +``` +sudo head /var/lib/apt/lists/ports.ubuntu.com_ubuntu_dists_focal_InRelease +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA512 + +Origin: Ubuntu +Label: Ubuntu +Suite: focal +Version: 20.04 +Codename: focal +Date: Thu, 23 Apr 2020 17:33:17 UTC +Architectures: amd64 arm64 armhf i386 ppc64el riscv64 s390x +``` + +Now, for some reasons, the time on my Ubuntu server was in the past and this is why Ubuntu complained that the release file is not valid yet for X many days. + +If you are connected to the internet, you may **wait a few minutes for your system to synchronize the time**. + +If it doesn’t work, you may force the system to use local time as real time clock (hardware clock): + +``` +sudo timedatectl set-local-rtc 1 +``` + +The timedatectl command enables you to configure time, date and [change timezone on Linux][4]. + +You shouldn’t need to restart. It works immediately and you can verify it by [updating your Ubuntu system][5] again. + +If the problem is solved, you may set the [real time clock][6] to use UTC (as recommended by Ubuntu). + +``` +sudo timedatectl set-local-rtc 0 +``` + +**Did it fix the issue for you?** + +I hope this quick tip helped you to fix this error. If you are still facing the issue, let me know in the comment section and I’ll try to help you out. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/fix-repository-not-valid-yet-error-ubuntu/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/install-ubuntu-server-raspberry-pi/ +[2]: https://itsfoss.com/connect-wifi-terminal-ubuntu/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/Repository-not-valid-yet-error-ubuntu.png?resize=800%2C450&ssl=1 +[4]: https://itsfoss.com/change-timezone-ubuntu/ +[5]: https://itsfoss.com/update-ubuntu/ +[6]: https://www.computerhope.com/jargon/r/rtc.htm From 2246d2ac6afa30177a35c2f9298ef5334647be1a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 18 Sep 2020 05:02:23 +0800 Subject: [PATCH 0153/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200917?= =?UTF-8?q?=20What's=20new=20with=20rdiff-backup=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200917 What-s new with rdiff-backup.md --- .../20200917 What-s new with rdiff-backup.md | 125 ++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 sources/tech/20200917 What-s new with rdiff-backup.md diff --git a/sources/tech/20200917 What-s new with rdiff-backup.md b/sources/tech/20200917 What-s new with rdiff-backup.md new file mode 100644 index 0000000000..bbd4f81962 --- /dev/null +++ b/sources/tech/20200917 What-s new with rdiff-backup.md @@ -0,0 +1,125 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What's new with rdiff-backup?) +[#]: via: (https://opensource.com/article/20/9/rdiff-backup-linux) +[#]: author: (Patrik Dufresne https://opensource.com/users/patrik-dufresne) + +What's new with rdiff-backup? +====== +The longstanding Linux backup solution's migration to Python 3 opens +opportunity to add many new features. +![Hand putting a Linux file folder into a drawer][1] + +In March 2020, [rdiff-backup][2] advanced to version 2, 11 years after the last major release. The deprecation of Python 2 at the beginning of 2020 was the impetus for this update, but it gave the development team the opportunity to incorporate other features and benefits. + +For about two decades, rdiff-backup has helped Linux users maintain full backups of their data locally or remotely without needlessly draining resources. This is because the open source solution does reverse incremental backups—backing up only the files that changed from the previous backup. + +The revamp (or, as some are saying, rebirth) came thanks to the efforts of a new, self-organized development team (led by Eric Zolf and Patrik Dufresne from [IKUS Software][3] and Otto Kekäläinen from [Seravo][4]) that put heads and hands together for the benefit of all rdiff-backup users. + +### New features in rdiff-backup + +Along with the migration to Python 3, spearheaded by Eric, the project was migrated to a new, enterprise-free [repository][5] to welcome contributions. The team also incorporated all of the patches submitted over the years, including sparse file support and a fix for hard links. + +#### Automation with Travis CI + +Another huge improvement is the addition of a continuous integration/continuous delivery (CI/CD) pipeline using open source [Travis CI][6]. This permits rdiff-backup testing in various environments, which ensures that changes do not affect the solution's stability. The CI/CD pipeline includes integration of builds and binary distribution for all major platforms. + +#### Easy installation with yum and apt + +The new rdiff-backup solution runs on all major Linux distributions, including Fedora, Red Hat, Elementary, Debian, and many more. Frank and Otto worked arduously to provide open repositories to facilitate access and installation. You can install rdiff-backup using your package manager or follow the [step-by-step instructions][7] on the GitHub project page. + +#### A new home + +The team migrated the website from Savannah to GitHub Pages and is revamping the official [rdiff-backup.net][2] website to include new content and make the look and feel more on point. + +### How to use rdiff-backup + +If you're new to rdiff-backup, you might be surprised by how easy it is to use. A backup solution needs to be non-intimidating so that you feel comfortable with the backup and restoration processes. + +#### Start a backup + +To initiate a backup to a local drive, such as one attached by USB, enter the `rdiff-backup` command followed by the drive you want to back up and the target directory where you want to store the files. + +For example, to back up to a local drive called `my_backup_drive`, enter: + + +``` +`$ rdiff-backup /home/tux/ /run/media/tux/my_backup_drive/` +``` + +To back up your data to offsite storage, use the remote server's location followed by `::` to point to the backup drive's mount point: + + +``` +`$ rdiff-backup /home/tux/ tux@example.com::/my_backup_drive/` +``` + +You may need to [set up SSH keys][8] to make this process effortless. + +#### Restore files + +The reason to make backups is that sometimes files go missing. To make recovery as simple as possible, you don't even need rdiff-backup to restore files (although using the `rdiff-backup` command provides some conveniences). + +If you need to get a file from your backup drive, you can just copy it over from the backup drive to your local system using `cp` for a local drive or `scp` for a remote drive. + +For a local drive, use: + + +``` +`$ cp _run_media/tux/my_backup_drive/Documents/example.txt \ ~/Documents` +``` + +Or for a remote drive: + + +``` +`$ scp tux@example.com::/my_backup_drive/Documents/example.txt \ ~/Documents` +``` + +However, using the `rdiff-backup` command provides other options, including the `--restore-as-of` option. This allows you to specify which version of your file you want to rescue. + +For example, suppose you want to rescue a file as it appeared four days ago: + + +``` +`$ rdiff-backup --restore-as-of 4D \ /run/media/tux/foo.txt ~/foo_4D.txt` +``` + +You can also use `rdiff-backup` to grab the latest version: + + +``` +`$ rdiff-backup --restore-as-of now \ /run/media/tux/foo.txt ~/foo_4D.txt` +``` + +It's that easy. Also, rdiff-backup has many other options, e.g., you can exclude files from a list, back up from one remote to another remote, and more, which you can learn about in the [documentation][9]. + +### Back it up + +Our development team hopes users will appreciate this revamped open source rdiff-backup solution, which is the culmination of our continuous efforts. We also appreciate our contributors, who truly demonstrate the power of open source. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/rdiff-backup-linux + +作者:[Patrik Dufresne][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://opensource.com/users/patrik-dufresne +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer) +[2]: https://rdiff-backup.net/ +[3]: https://www.ikus-soft.com/en/ +[4]: https://seravo.fi/english +[5]: https://github.com/rdiff-backup/rdiff-backup +[6]: https://en.wikipedia.org/wiki/Travis_CI +[7]: https://github.com/rdiff-backup/rdiff-backup#installation +[8]: https://opensource.com/article/20/8/how-ssh +[9]: https://rdiff-backup.net/docs/examples.html From ddfc5f5ee7562bdf3146be8fe38a061c5484080e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 18 Sep 2020 05:02:35 +0800 Subject: [PATCH 0154/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200917?= =?UTF-8?q?=20Update=20devices=20remotely=20with=20this=20open=20source=20?= =?UTF-8?q?tool?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200917 Update devices remotely with this open source tool.md --- ...ces remotely with this open source tool.md | 277 ++++++++++++++++++ 1 file changed, 277 insertions(+) create mode 100644 sources/tech/20200917 Update devices remotely with this open source tool.md diff --git a/sources/tech/20200917 Update devices remotely with this open source tool.md b/sources/tech/20200917 Update devices remotely with this open source tool.md new file mode 100644 index 0000000000..5b4ee15fb4 --- /dev/null +++ b/sources/tech/20200917 Update devices remotely with this open source tool.md @@ -0,0 +1,277 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Update devices remotely with this open source tool) +[#]: via: (https://opensource.com/article/20/9/update-remote-devices-updatehub) +[#]: author: (Domarys https://opensource.com/users/domarys) + +Update devices remotely with this open source tool +====== +Handle all your complete device updates, including firmware and +bootloaders, over the air with UpdateHub Community Edition. +![Working from home at a laptop][1] + +The ability to access, connect, and [manage multiple devices remotely][2] through a single account is important. Going a step further, being able to completely update devices remotely is another way for sysadmins to reduce effort and minimize headaches. + +[UpdateHub][3] is an open source solution that allows you to do complete device updates, including firmware and bootloaders, remotely. Its goal is to make it easier to do device updates and reduce rework and risk, whether you're updating thousands of devices or managing small deployments. UpdateHub handles all aspects of over-the-air (OTA) updates, including package integrity and authenticity, while you take care of your other work. + +This step-by-step guide to UpdateHub aims to help you get started with this professional tool. There are two UpdateHub server options: [UpdateHub Cloud][4] and [UpdateHub Community Edition][3] (UpdateHub CE), a fully open source server (distributed under the MIT License), which is what this tutorial uses. + +### Check the requirements + +First, make sure your Linux distribution has installed all [the required packages][5] to build an image using the Yocto Project. + +You also need the following hardware: + + * **Target** is the development device. This tutorial uses a [Raspberry Pi 3 Model B+][6], but you could also use a Raspberry Pi 3, Model B, or Model B+. + * **Host** is the computer where you will build the image using the Yocto Project. This tutorial uses [Yocto 3.1 Dunfell][7]. + + + +To start UpdateHub CE, you must have [Docker][8] installed on the host. If you don't have it, see Docker's [orientation and setup][9] instructions. + +This tutorial uses Google's [repo tool][10] to facilitate the process, as it requires multiple repositories. You can learn more about repo in the [Android development setup guide][11]. + +On Debian and Ubuntu distros, install repo with: + + +``` +`sudo apt install repo` +``` + +If you're using another Linux distribution, download repo directly and set your distro with: + + +``` +mkdir ~/bin +curl > ~/bin/repo +chmod a+x ~/bin/repo +PATH=${PATH}:~/bin +``` + +Finally, you need network connectivity via [DHCP][12], or you must know how to change the internet protocol (IP) address or to create a Yocto Project layer that handles this configuration. + +### Prepare your environment for the build + +UpdateHub provides a repository with a manifest file used by the repo tool, which makes it easier to manage multiple layers. + +Download the source code by creating a directory and fetching the necessary Yocto Project layers: + + +``` +mkdir updatehub-platform +cd updatehub-platform +repo init -u -b dunfell +repo sync +``` + +After the `repo sync` command completes, you will see all the layers you need in the `sources` directory. + +The UpdateHub platform provides support for multiple [supported devices][13]. During the Yocto Project environment setup, it will ask if you want to accept the end-user license agreement (EULA) of the `meta-freescale` layer; this is not necessary for this project. + +Load the Yocto Project environment: + + +``` +`MACHINE="raspberrypi3" source ./setup-environment build` +``` + +Note that this command is valid only for the terminal session where you loaded the environment. If you use a new terminal, you will need to load the environment again. However, you won't need to configure the machine again because the configuration content is stored in the `conf/local.conf` file. + +### Start UpdateHub CE + +With Docker installed, download the Docker image and start the server on port 8080: + + +``` +`docker run -d -p 8080:8080 updatehub/updatehub-ce:latest` +``` + +![Installing and running the server with Docker image][14] + +(Domarys Correa, [CC BY-SA 4.0][15]) + +Access the UpdateHub CE dashboard through the host IP address and port 8080 (`http://IP_ADDRESS:8080`). The host IP in the example is 192.168.15.50, so that would be `http://192.168.15.50:8080`. + +Use the default of `admin` for the login and password, and click **Login**. + +You need to configure the `UPDATEHUB_SERVER_URL` to use the UpdateHub CE address because the device needs to know the server's IP address. By default, the `meta-updatehub` layer uses the UpdateHub Cloud address in the server URL variable. + +You should see UpdateHub CE's main interface: + +![Accessing the UpdateHub CE dashboard][16] + +(Domarys Correa, [CC BY-SA 4.0][15]) + +### Configure the environment to generate the image + +The next step is to generate the Linux image that will be used by the device. But first, you need to set up some variables in the `conf/local.conf` file: + + +``` +UPDATEHUB_SERVER_URL = "" +UPDATEHUB_PACKAGE_VERSION_SUFFIX = "-test-image-1" +ENABLE_UART = "1" +UPDATEHUB_POLLING_INTERVAL = "1m" +``` + +Going line by line in the above code: + + * `UPDATEHUB_SERVER_URL` contains the IP address where UpdateHub CE is running. + * `UPDATEHUB_PACKAGE_VERSION_SUFFIX` adds a suffix in the image version. This is useful for placing a version number and incrementing it for each new image. This variable will be the `VERSION_ID`, which is composed of the `DISTRO_VERSION` (described in the [docs][17]) plus the `UPDATEHUB_PACKAGE_VERSION_SUFFIX`. You can verify this in the `/etc/os-release` file in the target. + * `ENABLE_UART`: There are several ways to access the target device, such as using the serial console or connecting a keyboard and a monitor. This variable allows access to a serial console on a Raspberry Pi by using the serial ports available on the GPIO header. + * `UPDATEHUB_POLLING_INTERVAL`: By default, communication between UpdateHub's agent and server happens every 24 hours. Use this variable to set up a new consultation time of 1 minute. + + + +This tutorial uses [Minicom][18] to connect with the target; if you want, you can learn more about [using the serial connection in Raspberry Pi][19]. + +### Generate the image + +Now that the Yocto Project environment is ready, compile the image using the [BitBake][20] task-execution engine by running: + + +``` +`bitbake updatehub-image-base` +``` + +Image generation can take a while, depending on the host machine. If this is the first time you are building an image for `raspberrypi3` in Yocto's Dunfell branch, BitBake will download the entire source code, so your download speed will influence the time it takes to generate the image. + +Once the image is compiled, navigate to the `build/tmp/deploy/images/raspberrypi3/` host directory and verify the image file, `updatehub-image-minimal-raspberrypi3.wic.gz`, is there. + +Insert an SD card into your Raspberry Pi and check its name by running `dmesg`. Then flash the image to your SD card with the following command, but make sure to change `/dev/sdX` to your SD card name: + + +``` +`zcat updatehub-image-base-raspberrypi3.wic.gz | sudo dd of=/dev/sdX` +``` + +Insert the imaged SD card into the target device to connect to Raspberry Pi. The image has a network configured to obtain an IP address using DHCP. Access the console with user `root` and leave the password empty. + +Confirm the version of the image running on the target using `cat /etc/os-release`. + +![Viewing a version of the image with Minicom][21] + +(Domarys Correa, [CC BY-SA 4.0][15]) + +### Generate the update package + +Your device should be running and working correctly, but you need to add the feature to create an update package. This creates an image to update your target. The following example adds support for an SSH server on the target and creates an update package to install this functionality. + +Add support for the OpenSSH server by adding the following line to the `build/conf/local.conf` file: + + +``` +`IMAGE_FEATURES += "ssh-server-openssh"` +``` + +To make it clear that the updated image will have another version, put the suffix `-test-image-2` in the `UPDATEHUB_PACKAGE_VERSION_SUFFIX` variable: + + +``` +`UPDATEHUB_PACKAGE_VERSION_SUFFIX = "-test-image-2"` +``` + +Save the file and run: + + +``` +`bitbake updatehub-image-base -c uhuarchive` +``` + +This command generates a file with a `.uhupkg` extension, a format used by UpdateHub to update the system. The generated file will be in the same directory as the images are, `tmp/deploy/images/raspberrypi3`; in this example, that's `updatehub-image-base-raspberrypi3.uhupkg`. + +### Check your device + +To access the UpdateHub CE dashboard, click the **Devices** tab to see if your device is listed: + +![Device section on the UpdateHub CE][22] + +(Domarys Correa, [CC BY-SA 4.0][15]) + +### Send an update package + +UpdateHub CE dashboard's **Packages** tab shows a list of available packages, but you do not have any yet. To add a package, click the **Upload Package** button, and select the `updatehub-image-minimal-raspberrypi3.uhupkg` file. In this example, it is in `tmp/deploy/images/raspberrypi3/directory`. A screen showing the package details will appear. This shows the process of adding an update package to the dashboard: + +![Add an update package][23] + +(Domarys Correa, [CC BY-SA 4.0][15]) + +### Create a rollout + +With the device recognized and the packet sent to the server, you can create a rollout, which is essentially a deployment plan. Navigate to the **Rollouts** tab and click **Create Rollout**. Choose which package version you want to use in the upgrade. This example only has the package from the previous step, with version `20.04-test-image-2`. Choose this version, and make sure it includes the list of devices that will be updated. + +![Creating a rollout and checking the device update][24] + +(Domarys Correa, [CC BY-SA 4.0][15]) + +Previously, you configured the image running on the target to perform an update query on the UpdateHub server every minute, so within one minute of creating the rollout, the update process will start. To track the update status, check the **Rollouts** tab. + +![The update process][25] + +(Domarys Correa, [CC BY-SA 4.0][15]) + +After finishing an upgrade process, the target reboots automatically. The new image boots up and automatically queries the server for updates. The server responds that it does not have any updates and ends the update cycle. + +When the status shows `updated`, run the command below on the host to access the target over SSH: + + +``` +`ssh root@IP_DO_TARGET` +``` + +No password is required; just press **Enter**, and you will be in the target console. You can check the version in the `/etc/os-release` file to confirm. + +### Congratulations! You're done! + +Now you have access to a professional tool to update your devices remotely. This tutorial used a Raspberry Pi 3 with the Yocto Project version Dunfell 3.1.2, but [other devices and versions][13] are supported. + +If you have any questions about integrating your device, access the developers' team through [Gitter][26] or by emailing [contact@updatehub.io][27]. + +* * * + +_This article is based on [UpdateHub: Sending OTA Updates using the Yocto Project][28] on UpdateHub's blog._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/update-remote-devices-updatehub + +作者:[Domarys][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://opensource.com/users/domarys +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/wfh_work_home_laptop_work.png?itok=VFwToeMy (Working from home at a laptop) +[2]: https://opensource.com/article/20/7/linux-shellhub +[3]: https://github.com/UpdateHub/updatehub-ce +[4]: https://updatehub.io/ +[5]: https://www.yoctoproject.org/docs/2.6.1/mega-manual/mega-manual.html#required-packages-for-the-build-host +[6]: https://www.raspberrypi.org/products/raspberry-pi-3-model-b-plus/ +[7]: https://old.yoctoproject.org/yoctoproject/dunfell +[8]: https://www.docker.com/ +[9]: https://docs.docker.com/get-started/ +[10]: https://gerrit.googlesource.com/git-repo/+/refs/heads/master/README.md +[11]: https://source.android.com/setup/develop +[12]: https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol +[13]: https://docs.updatehub.io/yocto-project/supported-machines/ +[14]: https://opensource.com/sites/default/files/uploads/yocto1_installserver.gif (Installing and running the server with Docker image) +[15]: https://creativecommons.org/licenses/by-sa/4.0/ +[16]: https://opensource.com/sites/default/files/uploads/yocto2_updatehubce-dashboard.gif (Accessing the UpdateHub CE dashboard) +[17]: https://www.yoctoproject.org/docs/2.6.1/ref-manual/ref-manual.html#var-DISTRO_VERSION +[18]: https://wiki.emacinc.com/wiki/Getting_Started_With_Minicom +[19]: https://elinux.org/RPi_Serial_Connection +[20]: https://github.com/openembedded/bitbake +[21]: https://opensource.com/sites/default/files/uploads/yocto_confirm.gif (Viewing a version of the image with Minicom) +[22]: https://opensource.com/sites/default/files/uploads/yocto_device-dashboard.gif (Device section on the UpdateHub CE) +[23]: https://opensource.com/sites/default/files/uploads/yocto_addupdate.gif (Add an update package) +[24]: https://opensource.com/sites/default/files/uploads/yocto6_createrollout.gif (Creating a rollout and checking the device update) +[25]: https://opensource.com/sites/default/files/uploads/yocto7.gif (The update process) +[26]: https://gitter.im/UpdateHub +[27]: mailto:contact@updatehub.io +[28]: https://blog.updatehub.io/updatehub-sending-ota-updates-using-the-yocto-project/ From f2ff67f5dee5064f4af9fdac361ecd8d06a7db3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Fri, 18 Sep 2020 07:24:16 +0800 Subject: [PATCH 0155/1156] Translating --- ... Grid, Performance Improvements and Tons of Other Changes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md b/sources/tech/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md index c7c7326a23..a0b0100c13 100644 --- a/sources/tech/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md +++ b/sources/tech/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (tanslating) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 85914db755cf9173839ed3cd443c22c50f156eec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Fri, 18 Sep 2020 07:26:43 +0800 Subject: [PATCH 0156/1156] Translating --- sources/tech/20200820 Learn the basics of programming with C.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200820 Learn the basics of programming with C.md b/sources/tech/20200820 Learn the basics of programming with C.md index ead1f35a6a..4bcece769f 100644 --- a/sources/tech/20200820 Learn the basics of programming with C.md +++ b/sources/tech/20200820 Learn the basics of programming with C.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (robsean) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 02dac06d4c73b1681f502580fc132afb5d6112e7 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 18 Sep 2020 08:45:22 +0800 Subject: [PATCH 0157/1156] translated --- ...ncremental backups with Btrfs snapshots.md | 93 ------------------- ...ncremental backups with Btrfs snapshots.md | 93 +++++++++++++++++++ 2 files changed, 93 insertions(+), 93 deletions(-) delete mode 100644 sources/tech/20200914 Incremental backups with Btrfs snapshots.md create mode 100644 translated/tech/20200914 Incremental backups with Btrfs snapshots.md diff --git a/sources/tech/20200914 Incremental backups with Btrfs snapshots.md b/sources/tech/20200914 Incremental backups with Btrfs snapshots.md deleted file mode 100644 index f19b9f3d95..0000000000 --- a/sources/tech/20200914 Incremental backups with Btrfs snapshots.md +++ /dev/null @@ -1,93 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Incremental backups with Btrfs snapshots) -[#]: via: (https://fedoramagazine.org/btrfs-snapshots-backup-incremental/) -[#]: author: (Alessio https://fedoramagazine.org/author/alciregi/) - -Incremental backups with Btrfs snapshots -====== - -![][1] - -Snapshots are an interesting feature of Btrfs. A snapshot is a copy of a subvolume. Taking a snapshot is immediate. However, taking a snapshot is not like performing a _rsync_ or a _cp_, and a snapshot doesn’t occupy space as soon as it is created. - -Editors note: From the [BTRFS Wiki][2] – A snapshot is simply a subvolume that shares its data (and metadata) with some other subvolume, using Btrfs’s COW capabilities. - -Occupied space will increase alongside the data changes in the original subvolume or in the snapshot itself, if it is writeable. Added/modified files, and deleted files in the subvolume still reside in the snapshots. This is a convenient way to perform backups. - -### Using snapshots for backups - -A snapshot resides on the same disk where the subvolume is located. You can browse it like a regular directory and recover a copy of a file as it was when the snapshot was performed. By the way, a snapshot on the same disk of the snapshotted subvolume is not an ideal backup strategy: if the hard disk broke, snapshots will be lost as well. An interesting feature of snapshots is the ability to send them to another location. The snapshot can be sent to an external hard drive or to a remote system via SSH (the destination filesystems need to be formatted as Btrfs as well). To do this, the commands _btrfs send_ and _btrfs receive_ are used. - -### Taking a snapshot - -In order to use the _send_ and the _receive_ commands, it is important to create the snapshot as read-only, and snapshots are writeable by default. - -The following command will take a snapshot of the _/home_ subvolume. Note the _-r_ flag for readonly. - -sudo btrfs subvolume snapshot -r /home /.snapshots/home-day1 - -Instead of day1, the snapshot name can be the current date, like _home-$(date +%Y%m%d)_. Snapshots look like regular subdirectories. You can place them wherever you like. The directory _/.snapshots_ could be a good choice to keep them neat and to avoid confusion. - -Editors note: Snapshots will not take recursive snapshots of themselves. If you create a snapshot of a subvolume, every subvolume or snapshot that the subvolume contains is mapped to an empty directory of the same name inside the snapshot. - -### Backup using btrfs send - -In this example the destination Btrfs volume in the USB drive is mounted as _/run/media/user/mydisk/bk_ . The command to send the snapshot to the destination is: - -sudo btrfs send /.snapshots/home-day1 | sudo btrfs receive /run/media/user/mydisk/bk - -This is called initial bootstrapping, and it corresponds to a full backup. This task will take some time, depending on the size of the _/home_ directory. Obviously, subsequent incremental sends will take a shorter time. - -### Incremental backup - -Another useful feature of snapshots is the ability to perform the send task in an incremental way. Let’s take another snapshot. - -sudo btrfs subvolume snapshot -r /home /.snapshots/home-day2 - -In order to perform the send task incrementally, you need to specify the previous snapshot as a base and this snapshot has to exist in the source and in the destination. Please note the _-p_ option. - -sudo btrfs send -p /.snapshot/home-day1 /.snapshot/home-day2 | sudo btrfs receive /run/media/user/mydisk/bk - -And again (the day after): - -sudo btrfs subvolume snapshot -r /home /.snapshots/home-day3 - -sudo btrfs send -p /.snapshot/home-day2 /.snapshot/home-day3 | sudo btrfs receive /run/media/user/mydisk/bk - -### Cleanup - -Once the operation is complete, you can keep the snapshot. But if you perform these operations on a daily basis, you could end up with a lot of them. This could lead to confusion and potentially a lot of used space on your disks. So it is a good advice to delete some snapshots if you think you don’t need them anymore. - -Keep in mind that in order to perform an incremental send you need at least the last snapshot. This snapshot must be present in the source and in the destination. - -sudo btrfs subvolume delete /.snapshot/home-day1 - -sudo btrfs subvolume delete /.snapshot/home-day2 - -sudo btrfs subvolume delete /run/media/user/mydisk/bk/home-day1 - -sudo btrfs subvolume delete /run/media/user/mydisk/bk/home-day2 - -Note: the day 3 snapshot was preserved in the source and in the destination. In this way, tomorrow (day 4), you can perform a new incremental _btrfs send_. - -As some final advice, if the USB drive has a bunch of space, you could consider maintaining multiple snapshots in the destination, while in the source disk you would keep only the last one. - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/btrfs-snapshots-backup-incremental/ - -作者:[Alessio][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/alciregi/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2020/08/butterfs-816x346.png -[2]: https://btrfs.wiki.kernel.org/index.php/SysadminGuide#Snapshots diff --git a/translated/tech/20200914 Incremental backups with Btrfs snapshots.md b/translated/tech/20200914 Incremental backups with Btrfs snapshots.md new file mode 100644 index 0000000000..f82ce56526 --- /dev/null +++ b/translated/tech/20200914 Incremental backups with Btrfs snapshots.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Incremental backups with Btrfs snapshots) +[#]: via: (https://fedoramagazine.org/btrfs-snapshots-backup-incremental/) +[#]: author: (Alessio https://fedoramagazine.org/author/alciregi/) + +使用 Btrfs 快照进行增量备份 +====== + +![][1] + +快照是 Btrfs 的一个有趣的功能。快照是一个子卷的副本。生成快照是立即的。然而,生成快照与执行 _rsync_ 或 _cp_ 不同,快照并不是一创建就会占用空间。 + +编者注:来自 [BTRFS Wiki][2 ]:快照是一个简单的子卷,它使用 Btrfs 的 COW 功能与其他子卷共享其数据(和元数据)。 + +如果它是可写的,占用的空间将随着原始子卷或快照本身的数据变化而增加。子卷中已添加/修改的文件和已删除的文件仍然存在于快照中。这是一种方便的备份方式。 + +### 使用快照进行备份 + +快照保存在子卷所在的同一磁盘上。你可以像浏览普通目录一样浏览它,并按照生成快照时的状态恢复文件的副本。顺便说一下,在被快照子卷的同一磁盘上做快照并不是一个理想的备份策略:如果硬盘坏了,快照也会丢失。快照的一个有趣的功能是可以将快照发送到另一个位置。快照可以被发送到外部硬盘或通过 SSH 发送到远程系统(目标文件系统也需要格式化为 Btrfs)。要实现这个,需要使用命令 _btrfs send_ 和 _btrfs receive_。 + +### 生成快照 + +要使用 _send_ 和 _receive_ 命令,重要的是要将快照创建为只读,而快照默认是可写的。 + +下面的命令将对 _/home_ 子卷进行快照。请注意 _-r_ 标志为只读。 + +sudo btrfs subvolume snapshot -r /home /.snapshots/home-day1 + +快照的名称可以是当前日期,而不是 day1,比如 _home-$(date +%Y%m%d)_。快照看起来像普通的子目录。你可以把它们放在任何你喜欢的地方。目录 _/.snapshots_ 可能是一个不错的选择,以保持它们的整洁和避免混淆。 + +编者注:快照不会对自己进行递归快照。如果你创建了一个子卷的快照,子卷所包含的每一个子卷或快照都会被映射到快照里面的一个同名的空目录。 + +### 使用 btrfs send 进行备份 + +在本例中,U 盘中的目标 Btrfs 卷被挂载为 _/run/media/user/mydisk/bk_。发送快照到目标卷的命令是: + +sudo btrfs send /.snapshots/home-day1 | sudo btrfs receive /run/media/user/mydisk/bk + +这被称为初始启动,它相当于一个完整的备份。这个任务需要一些时间,取决于 _/home_ 目录的大小。显然,后续的增量发送只需要更短的时间。 + +### 增量备份 + +快照的另一个有用的功能是能够以增量的方式执行发送任务。让我们再来生成一个快照。 + +sudo btrfs subvolume snapshot -r /home /.snapshots/home-day2 + +为了执行增量发送任务,需要指定上一个快照作为基础,并且这个快照必须存在于源文件和目标文件中。请注意 _-p_ 选项。 + +sudo btrfs send -p /.snapshot/home-day1 /.snapshot/home-day2 | sudo btrfs receive /run/media/user/mydisk/bk + +再来一次(之后一天): + +sudo btrfs subvolume snapshot -r /home /.snapshots/home-day3 + +sudo btrfs send -p /.snapshot/home-day2 /.snapshot/home-day3 | sudo btrfs receive /run/media/user/mydisk/bk + +### 清理 + +操作完成后,你可以保留快照。但如果你每天都执行这些操作,你可能最终会有很多快照。这可能会导致混乱,并可能会在你的磁盘上使用大量的空间。因此,如果你认为你不再需要一些快照,删除它们是一个很好的建议。 + +请记住,为了执行增量发送,你至少需要最后一个快照。这个快照必须存在于源文件和目标文件中。 + +sudo btrfs subvolume delete /.snapshot/home-day1 + +sudo btrfs subvolume delete /.snapshot/home-day2 + +sudo btrfs subvolume delete /run/media/user/mydisk/bk/home-day1 + +sudo btrfs subvolume delete /run/media/user/mydisk/bk/home-day2 + +注意:第 3 天的快照被保存在源文件和目标文件中。这样,明天(第 4 天),你就可以执行新的增量 _btrfs send_。 + +最后的建议是,如果 U 盘的空间很大,可以考虑在目标盘中保留多个快照,而在源盘中只保留最后一个快照。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/btrfs-snapshots-backup-incremental/ + +作者:[Alessio][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/alciregi/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/08/butterfs-816x346.png +[2]: https://btrfs.wiki.kernel.org/index.php/SysadminGuide#Snapshots From ecd5983db899d54541fae893a2e167b7e8f1d5ea Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 18 Sep 2020 08:54:45 +0800 Subject: [PATCH 0158/1156] translating --- ...tcloud simplified the signup process for decentralization.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200914 How Nextcloud simplified the signup process for decentralization.md b/sources/tech/20200914 How Nextcloud simplified the signup process for decentralization.md index 84be285f3e..d9e2eafd10 100644 --- a/sources/tech/20200914 How Nextcloud simplified the signup process for decentralization.md +++ b/sources/tech/20200914 How Nextcloud simplified the signup process for decentralization.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 3f5996e2061e71e18675bab4c96b8efc4f5c2eca Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 18 Sep 2020 17:13:44 +0800 Subject: [PATCH 0159/1156] PRF @geekpi --- ... WiFi from the Terminal in Ubuntu Linux.md | 52 +++++++++---------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/translated/tech/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md b/translated/tech/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md index 1209596c8a..13c68e3f97 100644 --- a/translated/tech/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md +++ b/translated/tech/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md @@ -1,47 +1,45 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Connect to WiFi from the Terminal in Ubuntu Linux) [#]: via: (https://itsfoss.com/connect-wifi-terminal-ubuntu/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -如何在 Ubuntu Linux 中在终端连接 WiFi? +如何在 Linux 终端中连接 WiFi? ====== -_**在本教程中,你将学习如何在 Ubuntu 中从终端连接到无线网络。如果你在使用 Ubuntu 服务器时,无法访问常规的[桌面环境][1],这将对你非常有帮助。**_ +> 在本教程中,你将学习如何在 Ubuntu 中从终端连接到无线网络。如果你在使用 Ubuntu 服务器时,无法访问常规的[桌面环境][1],这将对你非常有帮助。 -我的家用电脑主要使用桌面 Linux。我也有多台 Linux 服务器用于托管 It's FOSS 和相关网站以及开源软件,如 [Nextcloud][2]、[Discourse][3]、Ghost、Rocket Chat 等。 +我的家用电脑主要使用桌面 Linux。我也有多台 Linux 服务器用于托管网站以及开源软件,如 [Nextcloud][2]、[Discourse][3]、Ghost、Rocket Chat 等。 -我使用 [Linode][4] 在云端几分钟内快速部署 Linux 服务器。但最近,我在我的 Raspberry Pi 上安装了 [Ubuntu 服务器][5]。这是我第一次在物理设备上安装服务器,我不得不做一些额外的事情来通过命令行将 Ubuntu 服务器连接到 WiFi。 +我可以使用 [Linode][4] 在云端几分钟内快速部署 Linux 服务器。但最近,我在我的树莓派上安装了 [Ubuntu 服务器][5]。这是我第一次在物理设备上安装服务器,我不得不做一些额外的事情来通过命令行将 Ubuntu 服务器连接到 WiFi。 在本教程中,我将展示在 Ubuntu Linux 中使用终端连接到 WiFi 的步骤。你应该: * 不要害怕使用终端编辑文件。 * 知道 wifi 接入点名称 (SSID) 和密码。 - - ### 在 Ubuntu 中从终端连接到 WiFi ![][6] -当你使用 Ubuntu 桌面时,这是很容易的,因为你有图形用户界面,可以很容易地做到这一点。但当你使用 Ubuntu 服务器时就不一样了,因为你只能使用命令行。 +当你使用 Ubuntu 桌面时,连接到 WiFi 是很容易的,因为你有图形用户界面,可以很容易地做到这一点。但当你使用 Ubuntu 服务器时就不一样了,因为你只能使用命令行。 -Ubuntu 使用 [Netplan][7] 工具来轻松配置网络。在 Netplan 中,你可以创建一个包含网络接口描述的 YAML 文件,然后在 netplan 命令行工具的帮助下,生成所有需要的配置。 +Ubuntu 使用 [Netplan][7] 工具来轻松配置网络。在 Netplan 中,你可以创建一个包含网络接口描述的 YAML 文件,然后在 `netplan` 命令行工具的帮助下,生成所有需要的配置。 让我们看看如何使用 Netplan 从终端连接到无线网络。 #### 步骤 1:确定你的无线网络接口名称 -有几种方法可以识别你的网络接口名称。你可以使用 ip 命令、过时的 ipconfig 命令或查看这个文件: +有几种方法可以识别你的网络接口名称。你可以使用 `ip` 命令、过时的 `ipconfig` 命令或查看这个文件: ``` ls /sys/class/net ``` -这应该会展示所有可用的网络接口(以太网、wifi 和环回)。无线网络接口名称以 “w” 开头,通常命名为类似 wlanX、wlpxyz。 +这应该会展示所有可用的网络接口(以太网、WiFi 和环回)。无线网络接口名称以 `w` 开头,通常命名类似 `wlanX`、`wlpxyz`。 ``` [email protected]:~$ ls /sys/class/net @@ -52,11 +50,11 @@ eth0 lo wlan0 #### 步骤 2:编辑 Netplan 配置文件中的 wifi 接口详细信息 -Netplan 配置文件在 /etc/netplan 目录下。如果你查看这个目录的内容,你应该看到类似 01-network-manager-all.yml 或 50-cloud-init.yaml 等文件。 +Netplan 配置文件在 `/etc/netplan` 目录下。如果你查看这个目录的内容,你应该看到类似 `01-network-manager-all.yml` 或 `50-cloud-init.yaml` 等文件。 -如果是 Ubuntu 服务器,你应该有 loud-init 文件。如果是台式机,应该是 network-manager 文件。 +如果是 Ubuntu 服务器,你应该有 `50-cloud-init.yaml` 文件。如果是桌面计算机,应该是 `01-network-manager-all.yml` 文件。 -Linux 桌面上的 Network Manager 允许你选择一个无线网络。你可以在它的配置中对 wifi 接入点硬编码。这可以在自动掉线的情况下(比如挂起)时帮助到你。 +Linux 桌面计算机的 Network Manager 允许你选择一个无线网络。你可以在它的配置中硬编码写入 WiFi 接入点。这可以在自动掉线的情况下(比如挂起)时帮助到你。 不管是哪个文件,都可以打开编辑。我希望你对 Nano 编辑器有一点[熟悉][8],因为 Ubuntu 预装了它。 @@ -64,9 +62,9 @@ Linux 桌面上的 Network Manager 允许你选择一个无线网络。你可以 sudo nano /etc/netplan/50-cloud-init.yaml ``` -YAML 文件对空格、缩进和对齐方式非常敏感。不要使用制表符,在看到缩进的地方使用4 个(或 2 个,以 YAML 文件中已经使用的为准)空格代替。 +YAML 文件对空格、缩进和对齐方式非常敏感。不要使用制表符,在看到缩进的地方使用 4 个空格(或 2 个,以 YAML 文件中已经使用的为准)代替。 -基本上,你需要添加以下几行,引号中是接入点名称 (SSID) 和密码(通常): +基本上,你需要添加以下几行,引号中是接入点名称(SSID) 和密码(通常): ``` wifis: @@ -78,7 +76,7 @@ wifis: password: "WiFi_password" ``` -再说一次,保持我所展示的对齐方式,否则 YAML 文件不会被解析,它会抛出一个错误。 +再说一次,保持我所展示的对齐方式,否则 YAML 文件不能被解析,它会抛出一个错误。 你的完整配置文件可能是这样的: @@ -103,7 +101,7 @@ network: password: "WiFi_password" ``` -我觉得很奇怪,尽管有消息说更改不会在实例重启后存在,但它仍然有效。 +我觉得很奇怪,尽管有消息说更改不会在实例重启后保留,但它仍然可以工作。 不管怎样,用这个命令生成配置: @@ -117,13 +115,13 @@ sudo netplan generate sudo netplan apply ``` -如果你幸运的话,你应该连上网络。尝试 ping 一个网站或运行 apt 更新命令。 +如果你幸运的话,你应该连上网络。尝试 `ping` 一个网站或运行 `apt` 更新命令。 然而,事情可能不会那么顺利,你可能会看到一些错误。如果是这种情况,请尝试一些额外的步骤。 #### 可能的故障排除 -当你使用 netplan apply 命令时,你有可能在输出中看到类似这样的错误。 +当你使用 `netplan apply` 命令时,你有可能在输出中看到类似这样的错误。 ``` Failed to start netplan-wpa-wlan0.service: Unit netplan-wpa-wlan0.service not found. @@ -147,34 +145,34 @@ Traceback (most recent call last): subprocess.CalledProcessError: Command '['systemctl', 'start', '--no-block', 'systemd-networkd.service', 'netplan-wpa-wlan0.service']' returned non-zero exit status 5. ``` -可能是 wpa_supplicant 服务没有运行。运行这个命令: +可能是 `wpa_supplicant` 服务没有运行。运行这个命令: ``` sudo systemctl start wpa_supplicant ``` -再次运行 netplan apply。如果它能解决这个问题,那就太好了。否则,使用下面的命令[关闭 Ubuntu 系统][9]: +再次运行 `netplan apply`。如果它能解决这个问题,那就太好了。否则,使用下面的命令[关闭 Ubuntu 系统][9]: ``` shutdown now ``` -重新启动 Ubuntu 系统,登录并再次生成和应用 netplan: +重新启动 Ubuntu 系统,登录并再次生成和运行 `netplan apply`: ``` sudo netplan generate sudo netplan apply ``` -现在可能会显示警告(而不是错误)。这是警告而不是错误。我检查了[正在运行的 systemd 服务][10],发现 netplan-wpa-wlan0.service 已经在运行了。可能是因为它已经在运行了,而且 “netplan apply” 更新了配置文件(即使没有任何改变),所以显示了警告。 +现在可能会显示警告(而不是错误)。这是警告而不是错误。我检查了[正在运行的 systemd 服务][10],发现 `netplan-wpa-wlan0.service` 已经在运行了。可能是因为它已经在运行了,而且 `netplan apply` 更新了配置文件(即使没有任何改变),所以显示了警告。 ``` Warning: The unit file, source configuration file or drop-ins of netplan-wpa-wlan0.service changed on disk. Run 'systemctl daemon-reload' to reload units. ``` -这并不重要,你可以通过运行 apt update 来检查网络是否已经正常工作。 +这并不重要,你可以通过运行 `apt update` 来检查网络是否已经正常工作。 -我希望你能够在本教程的帮助下,在 Ubuntu 中使用命令行连接到 wifi。如果你仍然遇到困难,请在评论区告诉我。 +我希望你能够在本教程的帮助下,在 Ubuntu 中使用命令行连接到 WiFi。如果你仍然遇到困难,请在评论区告诉我。 -------------------------------------------------------------------------------- @@ -183,7 +181,7 @@ via: https://itsfoss.com/connect-wifi-terminal-ubuntu/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 146783e21c544d8d9b35fee0fb6441033bec3749 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 18 Sep 2020 17:15:10 +0800 Subject: [PATCH 0160/1156] PUB @geekpi https://linux.cn/article-12629-1.html --- ...ow to Connect to WiFi from the Terminal in Ubuntu Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md (99%) diff --git a/translated/tech/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md b/published/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md similarity index 99% rename from translated/tech/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md rename to published/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md index 13c68e3f97..0d5ba1fe40 100644 --- a/translated/tech/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md +++ b/published/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12629-1.html) [#]: subject: (How to Connect to WiFi from the Terminal in Ubuntu Linux) [#]: via: (https://itsfoss.com/connect-wifi-terminal-ubuntu/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From 37d51b134218ae765f9583b97dcf285c0905a25a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 18 Sep 2020 17:43:38 +0800 Subject: [PATCH 0161/1156] PRF @geekpi --- ...Easily Authenticate Your Secure Devices.md | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/translated/tech/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md b/translated/tech/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md index 9a46da7928..97e171951b 100644 --- a/translated/tech/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md +++ b/translated/tech/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices) @@ -10,25 +10,25 @@ 全新的 YubiKey 5C NFC 安全密钥让你可以使用 NFC 轻松认证你的安全设备 ====== -如果你对用最好的认证方法来保护你的在线帐户的安全格外谨慎,你可能知道 [Yubico][1]。他们制作的硬件认证安全密钥可以取代[双因素认证][2],并摆脱在线账户的密码认证系统。 +如果你格外谨慎,会使用最好的认证方法来保护你的在线帐户的安全,你可能知道 [Yubico][1]。他们制作的硬件认证安全密钥可以取代[双因素认证][2],并摆脱在线账户的密码认证系统。 基本上,你只需将安全密钥插在电脑上,或者使用智能手机上的 NFC 来解锁访问账户。这样一来,你的认证方式就会完全保持离线状态。 -![][3] +![](https://img.linux.net.cn/data/attachment/album/202009/18/174323ior6v6xp1y1or1ov.jpg) -当然,你可以随时使用 [Linux 中好用的密码管理器][4]。但如果你拥有或为企业工作,或者只是对自己的隐私和安全格外谨慎,想增加一层额外的安全保护,这些硬件安全密钥可能值得一试。这些设备最近获得了一些人气。 +当然,你可以随时使用 [Linux 中好用的密码管理器][4]。但如果你拥有一家公司,或为公司工作,或者只是对自己的隐私和安全格外谨慎,想增加一层额外的安全保护,这些硬件安全密钥可能值得一试。这些设备最近得到的进一步普及。 -Yubico 的最新产品 ”[YubiKey 5C NFC][5]“ 可能是令人印象深刻的东西,因为它既可以作为 Type-C 的 USB 密钥使用,也可以作为 NFC 使用(只要用密钥碰触你的设备)。 +Yubico 的最新产品 [YubiKey 5C NFC][5] 可能令人印象深刻,因为它既可以作为 Type-C 的 USB 密钥使用,也可以作为 NFC 使用(只要用密钥碰触你的设备)。 下面,让我们来看看这款安全密钥的概况。 -_请注意,It's FOSS 是 Yubico 的附属合作伙伴。请阅读我们的[联盟政策][6]_。 +(LCTT 译注:请注意本文中的购买连接是原文作者的受益链接,如果你对此担心,请阅读其[受益政策][6]。) ### Yubico 5C NFC:概述 ![][7] -YubiKey 5C NFC 是最新的产品,它同时使用 USB-C 和 NFC。因此,你可以轻松地将它插入 Windows、macOS 和 Linux 电脑。除了电脑,你也可以用你的 Android 或 iOS 智能手机或平板电脑来使用它。 +YubiKey 5C NFC 是最新的产品,它同时使用 USB-C 和 NFC。因此,你可以轻松地将它插入 Windows、macOS 和 Linux 电脑。除了电脑,你还可以将其与 Android 或 iOS 智能手机或平板电脑配合使用。 不仅仅局限于 USB-C 和 NFC 的支持(这是件好事),它也恰好是世界上第一个支持智能卡的多协议安全密钥。 @@ -36,9 +36,9 @@ YubiKey 5C NFC 是最新的产品,它同时使用 USB-C 和 NFC。因此,你 以下是 Yubico 在其新闻稿中提到的内容: -> Yubico 首席产品官 Guido Appenzeller 表示:“如今人们工作和上网的方式与几年前大不相同,尤其是在过去几个月内。用户不再仅仅被一种设备或服务所束缚,他们也不希望如此。这就是为什么 YubiKey 5C NFC 是我们最受欢迎的安全密钥之一。它与大多数现代电脑和手机兼容,并在一系列传统和现代应用中运行良好。归根结底,我们的客户渴望的是无论如何都能”正常工作“的安全性。” +> Yubico 首席产品官 Guido Appenzeller 表示:“如今人们工作和上网的方式与几年前大不相同,尤其是在过去几个月内。用户不再仅仅被一种设备或服务所束缚,也不再希望受限于此。这就是为什么 YubiKey 5C NFC 是我们最受欢迎的安全密钥之一。它与大多数现代电脑和手机兼容,并可以在一系列传统和现代应用中良好运行。归根结底,我们的客户渴望的是无论如何都能“正常工作”的安全性。” -YubiKey 5C NFC 支持的协议有 FIDO2、WebAuthn、FIDO U2F、PIV (智能卡)、OATH-HOTP 和 OATH-TOTP (基于哈希和时间的一次性密码)、[OpenPGP][8]、YubiOTP 和挑战应答认证。 +YubiKey 5C NFC 支持的协议有 FIDO2、WebAuthn、FIDO U2F、PIV(智能卡)、OATH-HOTP 和 OATH-TOTP (基于哈希和时间的一次性密码)、[OpenPGP][8]、YubiOTP 和挑战应答认证。 考虑到所有这些协议,你可以轻松地保护任何支持硬件认证的在线帐户,同时还可以访问身份访问管理 (IAM) 解决方案。因此,这对个人用户和企业来说都是一个很好的选择。 @@ -48,7 +48,7 @@ YubiKey 5C NFC 的价格为 55 美元。你可以直接从他们的[在线商店 值得注意的是,如果你订购两个以上的 YubiKeys,你可以获得批量折扣。 -[Order YubiKey 5C NFC][5] +- [订购 YubiKey 5C NFC][5] ### 总结 @@ -63,7 +63,7 @@ via: https://itsfoss.com/yubikey-5c-nfc/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 234a397c4d338f81a58580a459707d06b04e6115 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 18 Sep 2020 17:48:15 +0800 Subject: [PATCH 0162/1156] PUB @geekpi https://linux.cn/article-12630-1.html --- ... You Use NFC to Easily Authenticate Your Secure Devices.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md (98%) diff --git a/translated/tech/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md b/published/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md similarity index 98% rename from translated/tech/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md rename to published/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md index 97e171951b..aa56effebd 100644 --- a/translated/tech/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md +++ b/published/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12630-1.html) [#]: subject: (The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices) [#]: via: (https://itsfoss.com/yubikey-5c-nfc/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From 60350c65f2276186d5b62ddfd5f3524696c9e017 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 19 Sep 2020 05:02:25 +0800 Subject: [PATCH 0163/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200918?= =?UTF-8?q?=20Add=20throwing=20mechanics=20to=20your=20Python=20game?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200918 Add throwing mechanics to your Python game.md --- ... throwing mechanics to your Python game.md | 682 ++++++++++++++++++ 1 file changed, 682 insertions(+) create mode 100644 sources/tech/20200918 Add throwing mechanics to your Python game.md diff --git a/sources/tech/20200918 Add throwing mechanics to your Python game.md b/sources/tech/20200918 Add throwing mechanics to your Python game.md new file mode 100644 index 0000000000..8022106421 --- /dev/null +++ b/sources/tech/20200918 Add throwing mechanics to your Python game.md @@ -0,0 +1,682 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Add throwing mechanics to your Python game) +[#]: via: (https://opensource.com/article/20/9/add-throwing-python-game) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Add throwing mechanics to your Python game +====== +Running around avoiding enemies is one thing. Fighting back is another. +Learn how in the 12th article in this series on creating a platformer in +Pygame. +![Gaming on a grid with penguin pawns][1] + +This is part 12 in an ongoing series about creating video games in [Python 3][2] using the [Pygame][3] module. Previous articles are: + + 1. [Learn how to program in Python by building a simple dice game][4] + 2. [Build a game framework with Python using the Pygame module][5] + 3. [How to add a player to your Python game][6] + 4. [Using Pygame to move your game character around][7] + 5. [What's a hero without a villain? How to add one to your Python game][8] + 6. [Put platforms in a Python game with Pygame][9] + 7. [Simulate gravity in your Python game][10] + 8. [Add jumping to your Python platformer game][11] + 9. [Enable your Python game player to run forward and backward][12] + 10. [Put some loot in your Python platformer game][13] + 11. [Add scorekeeping to your Python game][14] + + + +My previous article was meant to be the final article in this series, and it encouraged you to go program your own additions to this game. Many of you did! I got emails asking for help with a common mechanic that I hadn't yet covered: combat. After all, jumping to avoid baddies is one thing, but sometimes it's awfully satisfying to just make them go away. It's common in video games to throw something at your enemies, whether it's a ball of fire, an arrow, a bolt of lightning, or whatever else fits the game. + +Unlike anything you have programmed for your platformer game in this series so far, throwable items have a _time to live_. Once you throw an object, it's expected to travel some distance and then disappear. If it's an arrow or something like that, it may disappear when it passes the edge of the screen. If it's a fireball or a bolt of lightning, it might fizzle out after some amount of time. + +That means each time a throwable item is spawned, a unique measure of its lifespan must also be spawned. To introduce this concept, this article demonstrates how to throw only one item at a time. (In other words, only one throwable item may exist at a time.) On the one hand, this is a game limitation, but on the other hand, it is a game mechanic in itself. Your player won't be able to throw 50 fireballs at once, since you only allow one at a time, so it becomes a challenge for your player to time when they release a fireball to try to hit an enemy. And behind the scenes, this also keeps your code simple. + +If you want to enable more throwable items at once, challenge yourself after you finish this tutorial by building on the knowledge you gain. + +### Create the throwable class + +If you followed along with the other articles in this series, you should be familiar with the basic `__init__` function when spawning a new object on the screen. It's the same function you used for spawning your [player][6] and your [enemies][8]. Here's an `__init__` function to spawn a throwable object: + + +``` +class Throwable(pygame.sprite.Sprite): +    """ +    Spawn a throwable object +    """ +    def __init__(self, x, y, img, throw): +        pygame.sprite.Sprite.__init__(self) +        self.image = pygame.image.load(os.path.join('images',img)) +        self.image.convert_alpha() +        self.image.set_colorkey(ALPHA) +        self.rect   = self.image.get_rect() +        self.rect.x = x +        self.rect.y = y +        self.firing = throw +``` + +The primary difference in this function compared to your `Player` class or `Enemy` class `__init__` function is that it has a `self.firing` variable. This variable keeps track of whether or not a throwable object is currently alive on screen, so it stands to reason that when a throwable object is created, the variable is set to `1`. + +### Measure time to live + +Next, just as with `Player` and `Enemy`, you need an `update` function so that the throwable object moves on its own once it's thrown into the air toward an enemy. + +The easiest way to determine the lifespan of a throwable object is to detect when it goes off-screen. Which screen edge you need to monitor depends on the physics of your throwable object. + + * If your player is throwing something that travels quickly along the horizontal axis, like a crossbow bolt or arrow or a very fast magical force, then you want to monitor the horizontal limit of your game screen. This is defined by `worldx`. + * If your player is throwing something that travels vertically or both horizontally and vertically, then you must monitor the vertical limit of your game screen. This is defined by `worldy`. + + + +This example assumes your throwable object goes a little forward and eventually falls to the ground. The object does not bounce off the ground, though, and continues to fall off the screen. You can try different settings to see what fits your game best: + + +``` +    def update(self,worldy): +        ''' +        throw physics +        ''' +        if self.rect.y < worldy: #vertical axis +            self.rect.x  += 15 #how fast it moves forward +            self.rect.y  += 5  #how fast it falls +        else: +            self.kill()     #remove throwable object +            self.firing = 0 #free up firing slot +``` + +To make your throwable object move faster, increase the momentum of the `self.rect` values. + +If the throwable object is off-screen, then the object is destroyed, freeing up the RAM that it had occupied. In addition, `self.firing` is set back to `0` to allow your player to take another shot. + +### Set up your throwable object + +Just like with your player and enemies, you must create a sprite group in your setup section to hold the throwable object. + +Additionally, you must create an inactive throwable object to start the game with. If there isn't a throwable object when the game starts, the first time a player attempts to throw a weapon, it will fail. + +This example assumes your player starts with a fireball as a weapon, so each instance of a throwable object is designated by the `fire` variable. In later levels, as the player acquires new skills, you could introduce a new variable using a different image but leveraging the same `Throwable` class. + +In this block of code, the first two lines are already in your code, so don't retype them: + + +``` +player_list = pygame.sprite.Group() #context +player_list.add(player)             #context +fire = Throwable(player.rect.x,player.rect.y,'fire.png',0) +firepower = pygame.sprite.Group() +``` + +Notice that a throwable item starts at the same location as the player. That makes it look like the throwable item is coming from the player. The first time the fireball is generated, a `0` is used so that `self.firing` shows as available. + +### Get throwing in the main loop + +Code that doesn't appear in the main loop will not be used in the game, so you need to add a few things in your main loop to get your throwable object into your game world. + +First, add player controls. Currently, you have no firepower trigger. There are two states for a key on a keyboard: the key can be down, or the key can be up. For movement, you use both: pressing down starts the player moving, and releasing the key (the key is up) stops the player. Firing needs only one signal. It's a matter of taste as to which key event (a key press or a key release) you use to trigger your throwable object. + +In this code block, the first two lines are for context: + + +``` +            if event.key == pygame.K_UP or event.key == ord('w'): +                player.jump(platform_list) +            if event.key == pygame.K_SPACE: +                if not fire.firing: +                    fire = Throwable(player.rect.x,player.rect.y,'fire.png',1) +                    firepower.add(fire) +``` + +Unlike the fireball you created in your setup section, you use a `1` to set `self.firing` as unavailable. + +Finally, you must update and draw your throwable object. The order of this matters, so put this code between your existing `enemy.move` and `player_list.draw` lines: + + +``` +    enemy.move()  # context + +    if fire.firing: +        fire.update(worldy) +        firepower.draw(world) +    player_list.draw(screen)  # context +    enemy_list.draw(screen)   # context +``` + +Notice that these updates are performed only if the `self.firing` variable is set to 1. If it is set to 0, then `fire.firing` is not true, and the updates are skipped. If you tried to do these updates, no matter what, your game would crash because there wouldn't be a `fire` object to update or draw. + +Launch your game and try to throw your weapon. + +### Detect collisions + +If you played your game with the new throwing mechanic, you probably noticed that you can throw objects, but it doesn't have any effect on your foes. + +The reason is that your enemies do not check for a collision. An enemy can be hit by your throwable object and never know about it. + +You've already done collision detection in your `Player` class, and this is very similar. In your `Enemy` class, add a new `update` function: + + +``` +    def update(self,firepower, enemy_list): +        """ +        detect firepower collision +        """ +        fire_hit_list = pygame.sprite.spritecollide(self,firepower,False) +        for fire in fire_hit_list: +            enemy_list.remove(self) +``` + +The code is simple. Each enemy object checks to see if it has been hit by the `firepower` sprite group. If it has, then the enemy is removed from the enemy group and disappears. + +To integrate that function into your game, call the function in your new firing block in the main loop: + + +``` +    if fire.firing:                             # context +        fire.update(worldy)                    # context +        firepower.draw(screen)                  # context +        enemy_list.update(firepower,enemy_list) # update enemy +``` + +You can try your game now, and most everything works as expected. There's still one problem, though, and that's the direction of the throw. + +### Change the throw mechanic direction + +Currently, your hero's fireball moves only to the right. This is because the `update` function of the `Throwable` class adds pixels to the position of the fireball, and in Pygame, a larger number on the X-axis means movement toward the right of the screen. When your hero turns the other way, you probably want it to throw its fireball to the left. + +By this point, you know how to implement this, at least technically. However, the easiest solution uses a variable in what may be a new way for you. Generically, you can "set a flag" (sometimes also termed "flip a bit") to indicate the direction your hero is facing. Once you do that, you can check that variable to learn whether the fireball needs to move left or right. + +First, create a new variable in your `Player` class to represent which direction your hero is facing. Because my hero faces right naturally, I treat that as the default: + + +``` +        self.score = 0 +        self.facing_right = True  # add this +        self.is_jumping = True +``` + +When this variable is `True`, your hero sprite is facing right. It must be set anew every time the player changes the hero's direction, so do that in your main loop on the relevant `keyup` events: + + +``` +        if event.type == pygame.KEYUP: +            if event.key == pygame.K_LEFT or event.key == ord('a'): +                player.control(steps, 0) +                player.facing_right = False  # add this line +            if event.key == pygame.K_RIGHT or event.key == ord('d'): +                player.control(-steps, 0) +                player.facing_right = True  # add this line +``` + +Finally, change the `update` function of your `Throwable` class to check whether the hero is facing right or not and to add or subtract pixels from the fireball's position as appropriate: + + +``` +        if self.rect.y < worldy: +            if player.facing_right: +                self.rect.x += 15 +            else: +                self.rect.x -= 15 +            self.rect.y += 5 +``` + +Try your game again and clear your world of some baddies. + +![Python platformer with throwing capability][15] + +(Seth Kenlon, [CC BY-SA 4.0][16]) + +As a bonus challenge, try incrementing your player's score whenever an enemy is vanquished. + +### The complete code + + +``` +#!/usr/bin/env python3 +# by Seth Kenlon + +# GPLv3 +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program.  If not, see <[http://www.gnu.org/licenses/\>][17]. + +import pygame +import pygame.freetype +import sys +import os + +''' +Variables +''' + +worldx = 960 +worldy = 720 +fps = 40 +ani = 4 +world = pygame.display.set_mode([worldx, worldy]) +forwardx  = 600 +backwardx = 120 + +BLUE = (80, 80, 155) +BLACK = (23, 23, 23) +WHITE = (254, 254, 254) +ALPHA = (0, 255, 0) + +tx = 64 +ty = 64 + +font_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "fonts", "amazdoom.ttf") +font_size = tx +pygame.freetype.init() +myfont = pygame.freetype.Font(font_path, font_size) + +''' +Objects +''' + +def stats(score, health): +    myfont.render_to(world, (4, 4), "Score:"+str(score), BLUE, None, size=64) +    myfont.render_to(world, (4, 72), "Health:"+str(health), BLUE, None, size=64) + +class Throwable(pygame.sprite.Sprite): +    """ +    Spawn a throwable object +    """ +    def __init__(self, x, y, img, throw): +        pygame.sprite.Sprite.__init__(self) +        self.image = pygame.image.load(os.path.join('images', img)) +        self.image.convert_alpha() +        self.image.set_colorkey(ALPHA) +        self.rect = self.image.get_rect() +        self.rect.x = x +        self.rect.y = y +        self.firing = throw + +    def update(self, worldy): +        ''' +        throw physics +        ''' +        if self.rect.y < worldy: +            if player.facing_right: +                self.rect.x += 15 +            else: +                self.rect.x -= 15 +            self.rect.y += 5 +        else: +            self.kill() +            self.firing = 0 + +# x location, y location, img width, img height, img file +class Platform(pygame.sprite.Sprite): +    def __init__(self, xloc, yloc, imgw, imgh, img): +        pygame.sprite.Sprite.__init__(self) +        self.image = pygame.image.load(os.path.join('images', img)).convert() +        self.image.convert_alpha() +        self.image.set_colorkey(ALPHA) +        self.rect = self.image.get_rect() +        self.rect.y = yloc +        self.rect.x = xloc + +class Player(pygame.sprite.Sprite): +    """ +    Spawn a player +    """ + +    def __init__(self): +        pygame.sprite.Sprite.__init__(self) +        self.movex = 0 +        self.movey = 0 +        self.frame = 0 +        self.health = 10 +        self.damage = 0 +        self.score = 0 +        self.facing_right = True +        self.is_jumping = True +        self.is_falling = True +        self.images = [] +        for i in range(1, 5): +            img = pygame.image.load(os.path.join('images', 'walk' + str(i) + '.png')).convert() +            img.convert_alpha() +            img.set_colorkey(ALPHA) +            self.images.append(img) +            self.image = self.images[0] +            self.rect = self.image.get_rect() + +    def gravity(self): +        if self.is_jumping: +            self.movey += 3.2 + +    def control(self, x, y): +        """ +        control player movement +        """ +        self.movex += x + +    def jump(self): +        if self.is_jumping is False: +            self.is_falling = False +            self.is_jumping = True + +    def update(self): +        """ +        Update sprite position +        """ + +        # moving left +        if self.movex < 0: +            self.is_jumping = True +            self.frame += 1 +            if self.frame > 3 * ani: +                self.frame = 0 +            self.image = pygame.transform.flip(self.images[self.frame // ani], True, False) + +        # moving right +        if self.movex > 0: +            self.is_jumping = True +            self.frame += 1 +            if self.frame > 3 * ani: +                self.frame = 0 +            self.image = self.images[self.frame // ani] + +        # collisions +        enemy_hit_list = pygame.sprite.spritecollide(self, enemy_list, False) +        if self.damage == 0: +            for enemy in enemy_hit_list: +                if not self.rect.contains(enemy): +                    self.damage = self.rect.colliderect(enemy) +        if self.damage == 1: +            idx = self.rect.collidelist(enemy_hit_list) +            if idx == -1: +                self.damage = 0   # set damage back to 0 +                self.health -= 1  # subtract 1 hp + +        ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) +        for g in ground_hit_list: +            self.movey = 0 +            self.rect.bottom = g.rect.top +            self.is_jumping = False  # stop jumping + +        # fall off the world +        if self.rect.y > worldy: +            self.health -=1 +            print(self.health) +            self.rect.x = tx +            self.rect.y = ty + +        plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) +        for p in plat_hit_list: +            self.is_jumping = False  # stop jumping +            self.movey = 0 +            if self.rect.bottom <= p.rect.bottom: +               self.rect.bottom = p.rect.top +            else: +               self.movey += 3.2 + +        if self.is_jumping and self.is_falling is False: +            self.is_falling = True +            self.movey -= 33  # how high to jump + +        loot_hit_list = pygame.sprite.spritecollide(self, loot_list, False) +        for loot in loot_hit_list: +            loot_list.remove(loot) +            self.score += 1 +            print(self.score) + +        plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) + +        self.rect.x += self.movex +        self.rect.y += self.movey + +class Enemy(pygame.sprite.Sprite): +    """ +    Spawn an enemy +    """ + +    def __init__(self, x, y, img): +        pygame.sprite.Sprite.__init__(self) +        self.image = pygame.image.load(os.path.join('images', img)) +        self.image.convert_alpha() +        self.image.set_colorkey(ALPHA) +        self.rect = self.image.get_rect() +        self.rect.x = x +        self.rect.y = y +        self.counter = 0 + +    def move(self): +        """ +        enemy movement +        """ +        distance = 80 +        speed = 8 + +        if self.counter >= 0 and self.counter <= distance: +            self.rect.x += speed +        elif self.counter >= distance and self.counter <= distance * 2: +            self.rect.x -= speed +        else: +            self.counter = 0 + +        self.counter += 1 + +    def update(self, firepower, enemy_list): +        """ +        detect firepower collision +        """ +        fire_hit_list = pygame.sprite.spritecollide(self, firepower, False) +        for fire in fire_hit_list: +            enemy_list.remove(self) + +class Level: +    def ground(lvl, gloc, tx, ty): +        ground_list = pygame.sprite.Group() +        i = 0 +        if lvl == 1: +            while i < len(gloc): +                ground = Platform(gloc[i], worldy - ty, tx, ty, 'tile-ground.png') +                ground_list.add(ground) +                i = i + 1 + +        if lvl == 2: +            print("Level " + str(lvl)) + +        return ground_list + +    def bad(lvl, eloc): +        if lvl == 1: +            enemy = Enemy(eloc[0], eloc[1], 'enemy.png') +            enemy_list = pygame.sprite.Group() +            enemy_list.add(enemy) +        if lvl == 2: +            print("Level " + str(lvl)) + +        return enemy_list + +    # x location, y location, img width, img height, img file +    def platform(lvl, tx, ty): +        plat_list = pygame.sprite.Group() +        ploc = [] +        i = 0 +        if lvl == 1: +            ploc.append((200, worldy - ty - 128, 3)) +            ploc.append((300, worldy - ty - 256, 3)) +            ploc.append((550, worldy - ty - 128, 4)) +            while i < len(ploc): +                j = 0 +                while j <= ploc[i][2]: +                    plat = Platform((ploc[i][0] + (j * tx)), ploc[i][1], tx, ty, 'tile.png') +                    plat_list.add(plat) +                    j = j + 1 +                print('run' + str(i) + str(ploc[i])) +                i = i + 1 + +        if lvl == 2: +            print("Level " + str(lvl)) + +        return plat_list + +    def loot(lvl): +        if lvl == 1: +            loot_list = pygame.sprite.Group() +            loot = Platform(tx*5, ty*5, tx, ty, 'loot_1.png') +            loot_list.add(loot) + +        if lvl == 2: +            print(lvl) + +        return loot_list + +''' +Setup +''' + +backdrop = pygame.image.load(os.path.join('images', 'stage.png')) +clock = pygame.time.Clock() +pygame.init() +backdropbox = world.get_rect() +main = True + +player = Player()  # spawn player +player.rect.x = 0  # go to x +player.rect.y = 30  # go to y +player_list = pygame.sprite.Group() +player_list.add(player) +steps = 10 +fire = Throwable(player.rect.x, player.rect.y, 'fire.png', 0) +firepower = pygame.sprite.Group() + +eloc = [] +eloc = [300, worldy-ty-80] +enemy_list = Level.bad(1, eloc) +gloc = [] + +i = 0 +while i <= (worldx / tx) + tx: +    gloc.append(i * tx) +    i = i + 1 + +ground_list = Level.ground(1, gloc, tx, ty) +plat_list = Level.platform(1, tx, ty) +enemy_list = Level.bad( 1, eloc ) +loot_list = Level.loot(1) + +''' +Main Loop +''' + +while main: +    for event in pygame.event.get(): +        if event.type == pygame.QUIT: +            pygame.quit() +            try: +                sys.exit() +            finally: +                main = False + +        if event.type == pygame.KEYDOWN: +            if event.key == ord('q'): +                pygame.quit() +                try: +                    sys.exit() +                finally: +                    main = False +            if event.key == pygame.K_LEFT or event.key == ord('a'): +                player.control(-steps, 0) +            if event.key == pygame.K_RIGHT or event.key == ord('d'): +                player.control(steps, 0) +            if event.key == pygame.K_UP or event.key == ord('w'): +                player.jump() + +        if event.type == pygame.KEYUP: +            if event.key == pygame.K_LEFT or event.key == ord('a'): +                player.control(steps, 0) +                player.facing_right = False +            if event.key == pygame.K_RIGHT or event.key == ord('d'): +                player.control(-steps, 0) +                player.facing_right = True +            if event.key == pygame.K_SPACE: +                if not fire.firing: +                    fire = Throwable(player.rect.x, player.rect.y, 'fire.png', 1) +                    firepower.add(fire) + +    # scroll the world forward +    if player.rect.x >= forwardx: +        scroll = player.rect.x - forwardx +        player.rect.x = forwardx +        for p in plat_list: +            p.rect.x -= scroll +        for e in enemy_list: +            e.rect.x -= scroll +        for l in loot_list: +            l.rect.x -= scroll + +    # scroll the world backward +    if player.rect.x <= backwardx: +        scroll = backwardx - player.rect.x +        player.rect.x = backwardx +        for p in plat_list: +            p.rect.x += scroll +        for e in enemy_list: +            e.rect.x += scroll +        for l in loot_list: +            l.rect.x += scroll + +    world.blit(backdrop, backdropbox) +    player.update() +    player.gravity() +    player_list.draw(world) +    if fire.firing: +        fire.update(worldy) +        firepower.draw(world) +    enemy_list.draw(world) +    enemy_list.update(firepower, enemy_list) +    loot_list.draw(world) +    ground_list.draw(world) +    plat_list.draw(world) +    for e in enemy_list: +        e.move() +    stats(player.score, player.health) +    pygame.display.flip() +    clock.tick(fps) +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/add-throwing-python-game + +作者:[Seth Kenlon][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://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/game_pawn_grid_linux.png?itok=4gERzRkg (Gaming on a grid with penguin pawns) +[2]: https://www.python.org/ +[3]: https://www.pygame.org/news +[4]: https://opensource.com/article/17/10/python-101 +[5]: https://opensource.com/article/17/12/game-framework-python +[6]: https://opensource.com/article/17/12/game-python-add-a-player +[7]: https://opensource.com/article/17/12/game-python-moving-player +[8]: https://opensource.com/article/18/5/pygame-enemy +[9]: https://opensource.com/article/18/7/put-platforms-python-game +[10]: https://opensource.com/article/19/11/simulate-gravity-python +[11]: https://opensource.com/article/19/12/jumping-python-platformer-game +[12]: https://opensource.com/article/19/12/python-platformer-game-run +[13]: https://opensource.com/article/19/12/loot-python-platformer-game +[14]: https://opensource.com/article/20/1/add-scorekeeping-your-python-game +[15]: https://opensource.com/sites/default/files/uploads/pygame-throw.jpg (Python platformer with throwing capability) +[16]: https://creativecommons.org/licenses/by-sa/4.0/ +[17]: http://www.gnu.org/licenses/\> From d6bd867a8f7ff94bf9a85cecc9328d2c62f1c702 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 19 Sep 2020 23:41:49 +0800 Subject: [PATCH 0164/1156] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @hom 恭喜你,完成了第一篇翻译贡献!不过请注意,翻译应该尽量忠实原文。 --- ... connections with this open source tool.md | 99 +++++++++---------- 1 file changed, 45 insertions(+), 54 deletions(-) diff --git a/translated/tech/20200909 Manage your SSH connections with this open source tool.md b/translated/tech/20200909 Manage your SSH connections with this open source tool.md index 4a8115ee1e..30ef02457b 100644 --- a/translated/tech/20200909 Manage your SSH connections with this open source tool.md +++ b/translated/tech/20200909 Manage your SSH connections with this open source tool.md @@ -1,116 +1,107 @@ [#]: collector: "lujun9972" [#]: translator: "hom" -[#]: reviewer: " " +[#]: reviewer: "wxy" [#]: publisher: " " [#]: url: " " [#]: subject: "Manage your SSH connections with this open source tool" [#]: via: "https://opensource.com/article/20/9/ssh-connection-manager" [#]: author: "Kenneth Aaron https://opensource.com/users/flyingrhino" -使用开源工具 `nccm` 管理 `SSH` 连接 +使用开源工具 nccm 管理 SSH 连接 ====== -使用 `nccm` 让你的终端连接更快,更稳定 -![Penguins][1] -`OpenSSH`很常用,但是仍然有其他的连接工具,因此我开发了 `nccm`来使运行进程更高效。 `nccm` 是一个使用标准终端接口(就像项目所命名的`ncurses`)的建议终端连接工具 +> 使用 nccm 让你的终端连接 SSH 会话更快、更稳、更轻松。 + +![](https://img.linux.net.cn/data/attachment/album/202009/19/233942j6ne6wllnlbnjd36.jpg) + +OpenSSH 很常用,但没有一个知名的连接管理器,因此我开发了 ncurses SSH 连接管理器(`nccm`)来填补这个重要的空白。 `nccm` 是一个简单的 SSH 连接管理器,具有非常便于移植的终端界面(就如项目名称所示,使用 ncurses 编写)。最重要的是,它使用起来非常简单。有了 `nccm`,你可以花费最少的精力和最少的按键连接到你选择的 SSH 会话。 ### 安装 nccm -最简单的方式是从这个 [仓库][2]下载 - +最快的方式是从它的 [Git 仓库][2]克隆该项目: ``` -`$ git clone https://github.com/flyingrhinonz/nccm nccm.git` +$ git clone https://github.com/flyingrhinonz/nccm nccm.git ``` -在`nccm.git/nccm`的文件夹中有两个文件:`nccm`执行文件和`nccm.yml`配置文件 - -首先将执行文件`nccm`拷贝到系统目录`/usr/local/bin/`中并添加执行权限,也可以通过使用`install`命令来完成操作 +在 `nccm.git/nccm` 的文件夹中有两个文件:`nccm` 自身和 `nccm.yml` 配置文件。 +首先将 `nccm` 脚本复制到系统目录 `/usr/local/bin/` 中并添加执行权限,也可以通过使用`install` 命令来完成操作: ``` -$ sudo install -m755 nccm -–target-directory /usr/local/bin +$ sudo install -m755 nccm –target-directory /usr/local/bin ``` -配置文件`nccm.yml`可以拷贝到以下任意一个文件夹中,终端会默认从第一个顺序获取配置。 +文件 `nccm.yml` 可以拷贝到以下任意一个位置,默认从找到的第一个位置获取配置: * `~/.config/nccm/nccm.yml` * `~/.nccm.yml` * `~/nccm.yml` * `/etc/nccm.yml` +`nccm` 需要在 Python 3 的环境中运行,这在大部分的 Linux 环境是没问题的。大多数 Python 库的依赖包已经作为 Python 3 的一部分存在,但是,有一些 YAML 的依赖包和实用程序是你必须安装的。 +如果你没有安装 `pip`,你可以使用包管理器来安装它。在安装的同时,也请安装 `yamllint` 应用程序来帮助你验证 `nccm.yml` 文件。 -`nccm`需要在`Python 3`的环境中运行,因此你的电脑需要事先安装`Python 3`,大部分的环境依赖在`Python 3`中默认安装了。以下是必须要安装的`YAML`依赖 - -如果为暗中`pip`,你需要使用包管理器来安装,然后安装`yamlinit`包来验证安装`nccm.yml` - -在`Debian`或相似系统使用`apt`命令: - +在 Debian 或类似系统使用 `apt` 命令: ``` -`$ sudo apt install python3-pip yamllint` +$ sudo apt install python3-pip yamllint ``` -在`Fedora`或者相似系统使用`dnf`: - +在 Fedora 或者类似系统使用 `dnf` 命令: ``` -`$ sudo dnf install python3-pip yamllint` +$ sudo dnf install python3-pip yamllint ``` -`PyYAML`也是必须安装的,可以通过使用`pip`来安装 - +`PyYAML` 也是必须安装的,可以通过使用 `pip` 来安装: ``` -`$ pip3 install --user PyYAML` +$ pip3 install --user PyYAML ``` -### 使用`nccm` +### 使用 nccm -开始之前需要修改`nccm.yml`文件来添加终端连接配置,可以参照示例文件格式化`YAML`文件。仿照示例文件再开始行添加连接名称,文件使用两个空格缩进。不要忘了`YAML`的语言类型 +开始之前,需要修改 `nccm.yml` 文件来添加 SSH 连接配置,可以参照示例文件格式化 YAML 文件。仿照示例文件在开头添加连接名称,配置项使用两个空格缩进。不要忘了冒号(`:`),这是 YAML 的语言的格式。 -不要担心你的终端登录信息以何顺序排列,`nccm`会提示用户如何排序 - -如果修改完成,可以使用`yamllint`来校验配置 +不要担心你的 SSH 会话信息以何顺序排列,因为 `nccm` 在程序内提供了排序的方式。 +如果修改完成,可以使用 `yamllint` 来校验配置: ``` -`$ yamllint ~/.config/nccm/nccm.yml` +$ yamllint ~/.config/nccm/nccm.yml ``` -如果没有错误信息返回,说明文件的内容格式是正确的,可以进行下面的步骤 +如果没有错误信息返回,说明文件的内容格式是正确的,可以进行下面的步骤。 -如果`nccm`可以从 [环境变量][3] 中找到并且可以执行,由于`nccm`会加载 TUI 来执行界面操作,因此需要查看`Python3`的执行环境,依赖包是否正确安装,缺少任一依赖都会在命令行中展示出来 +如果 `nccm` 可以[从你的路径][3]中找到并且可以执行,那么输入 `nccm` 就可以启动 TUI(文本用户界面)了。如果你看到 Python 3 抛出的异常,请检查依赖包是否正确安装,任何异常都应该提到缺少的依赖包。 -只要你没有在配置文件中更改`ncm_config_control mode`,你可以使用以下的键盘按键来控制 +只要你没有在 YAML 配置文件中更改 `ncm_config_control` 模式,那么你可以使用以下的键盘按键来控制: - * 上/下方向键 - 移动光标 - * Home/End -跳转到文件开始和结尾 - * PgUp/PgDn - 以页为单位查看 - * 左/右 方向键 - 水平滚动 - * TAB - 在字块中移动 - * 回车 - 连接选中的终端 - * Ctrl-h -显示帮助菜单 - * Ctrl-q or Ctrl-c - 退出 - * F1-F5 or !@#$% - 在列(1-5)之间切换 + * `Up`/`Down` 方向键 - 移动光标 + * `Home`/`End` - 跳转到文件开始和结尾 + * `PgUp`/`PgDn` - 以页为单位查看 + * `Left`/`Right` 方向键 - 水平滚动 + * `TAB` - 在文本框之间移动 + * 回车 - 连接选中的 SSH 会话 + * `Ctrl-h` - 显示帮助菜单 + * `Ctrl-q`/`Ctrl-c` - 退出 + * `F1`-`F5` 或 `!` `@` `#` `$` `%` - 按 1-5 列排序 - - -使用`F1`到`F5`来切换列,如果你的设备`Fn`键冲突你可以使用`!@#$%`来替代。默认界面显示 4 列内容,但是可以通过将用户名和服务地址分隔开来显示 5 列。你也可以通过再次使用和第一次过滤相同的按键来切换显示,选中的行会高亮显示 +使用 `F1` 到 `F5` 来按 1-5 列排序,如果你的设备占用了这些 `F1` - `F5` 键,你可以使用`!` `@` `#` `$` `%` 来替代。默认界面显示 4 列内容,但我们将用户名和服务器地址作为单独的列来排序,这样我们就有了 5 个排序方式。你也可以通过再次按下排序的按键来逆转排序。在选中的行上按回车可以建立会话。 ![nccm screenshot terminal view][4] -在过滤条件中输入过滤内容,会将包含的内容过滤显示,过滤的关键词是大小写敏感的,字符中间的空格不是必须的。在`Conn`部分也是同样的输入限制,然后按回车键就可以选中所输入的序号配置 +在 `Filter` 文本框中输入过滤内容,会用输入的内容以“与”的关系来过滤输出内容。这是不区分大小写的,而条目间用空白分隔。在 `Conn` 部分也是如此,但在这里按回车键可以连接到那个特定的条目编号。 -这个工具还有许多功能需要你去发掘,比如专注模式,这些部分留下等待你去探索,也可以查看项目主页或者内置的帮助文档查看更多细节内容 +这个工具还有许多功能需要你去发掘,比如专注模式,这些部分留下等待你去探索,也可以查看项目主页或者内置的帮助文档查看更多细节内容。 -项目的`YAML`配置文件的文档是完善的,所以你可以查阅修改使你的终端工具使用起来更加顺手。`nccm`项目是非常希望得到你的反馈的,所以你可以 fork 该项目然后添加更多新功能,我们欢迎你的合并请求。 +项目的 YAML 配置文件的文档是完善的,所以你可以查阅修改使 `nccm` 使用起来更加顺手。`nccm` 项目是非常希望得到你的反馈的,所以你可以复刻该项目然后添加更多新功能,欢迎大家提出拉取请求。 -### 轻松使用 nccm来连接 SSH +### 使用 nccm 来放松连接 SSH 的压力 -我希望这个工具可以对您有用,感谢能够为开源工作增加自己的贡献,请接收`nccm`作为我对开源项目自由、高效工作所做的贡献 +像我一样,我希望这个工具可以对你有用,感谢能够为开源工作增加自己的贡献,请接受 `nccm` 作为我对开源项目自由、高效工作所做的贡献。 -------------------------------------------------------------------------------- @@ -119,7 +110,7 @@ via: https://opensource.com/article/20/9/ssh-connection-manager 作者:[Kenneth Aaron][a] 选题:[lujun9972][b] 译者:[hom](https://github.com/hom) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From f64048c6cb951223df3fbaf0119646d3d245eb51 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 19 Sep 2020 23:42:53 +0800 Subject: [PATCH 0165/1156] PUB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @hom 本文首发地址:https://linux.cn/article-12632-1.html 你的 LCTT 专页:https://linux.cn/lctt/hom --- ... Manage your SSH connections with this open source tool.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200909 Manage your SSH connections with this open source tool.md (98%) diff --git a/translated/tech/20200909 Manage your SSH connections with this open source tool.md b/published/20200909 Manage your SSH connections with this open source tool.md similarity index 98% rename from translated/tech/20200909 Manage your SSH connections with this open source tool.md rename to published/20200909 Manage your SSH connections with this open source tool.md index 30ef02457b..10e4bd0f0c 100644 --- a/translated/tech/20200909 Manage your SSH connections with this open source tool.md +++ b/published/20200909 Manage your SSH connections with this open source tool.md @@ -1,8 +1,8 @@ [#]: collector: "lujun9972" [#]: translator: "hom" [#]: reviewer: "wxy" -[#]: publisher: " " -[#]: url: " " +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12632-1.html" [#]: subject: "Manage your SSH connections with this open source tool" [#]: via: "https://opensource.com/article/20/9/ssh-connection-manager" [#]: author: "Kenneth Aaron https://opensource.com/users/flyingrhino" From 643d138206ca3daea605ca03aed16e952edf4a92 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 20 Sep 2020 05:01:47 +0800 Subject: [PATCH 0166/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200919?= =?UTF-8?q?=203=20ways=20to=20protect=20yourself=20from=20imposter=20syndr?= =?UTF-8?q?ome?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200919 3 ways to protect yourself from imposter syndrome.md --- ...protect yourself from imposter syndrome.md | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 sources/tech/20200919 3 ways to protect yourself from imposter syndrome.md diff --git a/sources/tech/20200919 3 ways to protect yourself from imposter syndrome.md b/sources/tech/20200919 3 ways to protect yourself from imposter syndrome.md new file mode 100644 index 0000000000..63d511c530 --- /dev/null +++ b/sources/tech/20200919 3 ways to protect yourself from imposter syndrome.md @@ -0,0 +1,59 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 ways to protect yourself from imposter syndrome) +[#]: via: (https://opensource.com/article/20/9/imposter-syndrome) +[#]: author: (Josh Atwell https://opensource.com/users/joshatwell) + +3 ways to protect yourself from imposter syndrome +====== +It can be hard to believe you deserve success, sometimes, but these tips +can help you combat impostor syndrome and accept the accolades you've +earned. +![Brain on a computer screen][1] + +Poet and activist Maya Angelou published many books throughout her storied career, but each time, she feared people would figure out that she'd "run a game on everybody, and they're going to find me out." This seems an odd response from a well-honored writer. What she is describing is her own challenge with imposter syndrome. + +Think for a moment about your own accomplishments. Being hired into a new role. Having your first [open source contribution][2] merged into the project. Receiving an award or recognition. Being invited to participate in a project or event with people you respect and look up to. Did you question whether you belonged there? Did you fear people would "know that you didn't belong?" There is an extremely high likelihood that you have also experienced imposter syndrome. Please check the survey at the end of this article to see that you're not alone. + +Imposter syndrome is a "[psychological term][3] referring to a pattern of behavior where people doubt their accomplishments and have a persistent, often internalized fear of being exposed as a fraud." It's not considered a disorder, but it's persistent and can keep you from trying new things, accepting praise, or enjoying success. It's also important to understand that imposter syndrome is indiscriminate to gender, race, or nationality. Anyone can be impacted. Fortunately, you can be prepared for when imposter syndrome rears its ugly head. + +How do you protect yourself from letting imposter syndrome limit you? Here are three techniques that you can start using right away: + +**1\. Feelings vs. facts**—It's important to understand that imposter syndrome is a feeling and doesn't represent a factual assessment of your value or acceptance. Instead of thinking, "I don't deserve to be here," say to yourself, "I'm here because I earned it," or "I trust the judgment of those who invited me here that I truly deserve to be here." Ask yourself if the negative thoughts are from facts or a story you are telling yourself. This simple shift in focus from feelings to facts can set you back on the right course. + +![3 panels, woman says "I don't deserve to be here." with red X on top, woman says "I should trust the judgment of people who invited me." with green check, woman says "I deserve to be here." with green check][4] + +**2\. "Outsider" does not equal "fraud"**—Simply because your peer group has changed does not mean that you do not belong. Inclusion in higher levels of an organization, accomplished industry peers, or a group of award recipients is almost always a result of meaningful contributions. That first day of school feeling never goes away, even if it's remote school. So, unless you are legitimately a party crasher, keep in mind that you have value to add to the group and share it, even if you are nervous at first. + +**3\. Faking it**—Unfortunately, it's not universally understood that people learn how to do the job AFTER they get the job. There are few better ways to set yourself up for continued success than first believing that additional success is possible. Just be mindful not to fall into the trap of the cognitive bias known as the Dunning-Kruger effect, which leads people to vastly overestimate their capabilities. "Fake it until you make it," but commit to continued learning. + +There are so many ways imposter syndrome can disrupt both our professional and personal lives, but with some awareness and preparation, you can avoid letting it limit your growth and success. These are just a few ways to address imposter syndrome. For more information, you can also visit . + +[In this survey][5], we'd like to ask you to provide some information based on your experiences, which we'll use to help further inform the community about imposter syndrome and how prevalent it is in our industry. + +![Green chalkboard image reading "Take the Survey!"][6] + +This post includes excerpted content from an upcoming community presentation titled "Imposter Syndrome First Aid Kit" by Josh Atwell and Amy Lewis. If you're interested in hearing the full presentation, you can check it out at Splunk .conf20 on October 20-21. Registration is available at . + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/imposter-syndrome + +作者:[Josh Atwell][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://opensource.com/users/joshatwell +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/brain_computer_solve_fix_tool.png?itok=okq8joti (Brain on a computer screen) +[2]: https://opensource.com/article/19/11/my-first-open-source-contribution-impostor-syndrome +[3]: https://www.psychologytoday.com/us/blog/real-women/201809/the-reality-imposter-syndrome +[4]: https://opensource.com/sites/default/files/uploads/impostor_syndrome_1.png (Person progresses through stages of impostor syndrome) +[5]: https://pollev.com/amylewis963?_ga=2.60457517.1623261502.1598557790-809388036.1598557790 +[6]: https://opensource.com/sites/default/files/uploads/impostor_syndrome_survey.png (Green chalkboard image reading "Take the Survey!") From 439382f167eaa41fbe4c0280aeb1900c5f580f08 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 20 Sep 2020 22:59:26 +0800 Subject: [PATCH 0167/1156] PRF @jlztan --- ...s with Portainer.io (GUI tool) - Part-1.md | 99 +++++++++---------- 1 file changed, 48 insertions(+), 51 deletions(-) diff --git a/translated/tech/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md b/translated/tech/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md index 17bf552aff..aff4fc233c 100644 --- a/translated/tech/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md +++ b/translated/tech/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md @@ -1,20 +1,22 @@ [#]: collector: "lujun9972" [#]: translator: "jlztan" -[#]: reviewer: " " +[#]: reviewer: "wxy" [#]: publisher: " " [#]: url: " " [#]: subject: "Monitor and Manage Docker Containers with Portainer.io (GUI tool) – Part-1" [#]: via: "https://www.linuxtechi.com/monitor-manage-docker-containers-portainer-part1/" [#]: author: "Shashidhar Soppin https://www.linuxtechi.com/author/shashidhar/" -用 Portainer.io(图形界面工具)来监控和管理 Docker 容器 – 1 +用 Portainer.io 来监控和管理 Docker 容器(1) ====== -随着 **Docker** 的使用量越来越大,监控 **Docker** 容器正在变得更有挑战性。每天都有大量的 Docker 容器被创建,因此如何监控它们就变得非常重要。已经有一些用于监控容器的构建工具和技术,不过对它们进行配置有一些复杂。随着基于微服务的架构正在变成接下来事实上的标准,学会这种技术将为你的知识库再添一项新技能。 +![](https://img.linux.net.cn/data/attachment/album/202009/20/225425zaepvexqvg7nndqv.jpg) -基于上述场景,对一种轻量、健壮的镜像管理工具的需求日益增加。Portainer.io 解决了这个问题。“**Portainer.io**“(最新版本是 1.20.2)非常轻量(只有 2-3 个可以配置的命令),在 Docker 用户之间很流行。 +随着 Docker 的使用量越来越大,监控 Docker 容器正在变得更有挑战性。每天都有大量的 Docker 容器被创建,因此如何监控它们就变得非常重要。目前已经有一些内置的工具和技术,不过对它们进行配置有一些复杂。随着基于微服务的架构正在变成接下来事实上的标准,学会这种技术将为你的知识库再添一项新技能。 -**比起其他工具,这个工具有很多优势,其中一些如下所示:** +基于上述场景,对一种轻量、健壮的镜像管理工具的需求日益增加。Portainer.io 解决了这个问题。 Portainer.io(最新版本是 1.20.2)非常轻量,只需 2-3 个命令就可以配置好,已经在 Docker 用户中流行起来。 + +比起其他工具,这个工具有很多优势,其中一些如下所示: * 轻量(安装此工具仅需 2 到 3 个命令,与此同时安装镜像的大小在 26 M 到 30 M 之间) * 健壮且易用 @@ -24,13 +26,13 @@ * Portainer 部署方便,仅需一个 Docker 命令(可以在任意地方运行) * 可以对完整的 Docker 容器环境进行监控 -**Portainer 同时具有以下服务:** +Portainer 同时具有以下服务: - 社区支持 - 企业支持 - 与合作伙伴 OEM 服务一起的专业服务 -**Portainer 的功能和特性如下:** +Portainer 的功能和特性如下: 1. 配备了漂亮的仪表盘,易于使用和监控 2. 自带大量内置模板,便于操作和创建 @@ -39,11 +41,11 @@ 5. 包含 Docker 集群监控功能 6. 功能多样的用户管理 -**另请阅读:[如何在 Ubuntu 16.04 / 18.04 LTS 版本中安装 Docker CE][1]** +另请阅读:[如何在 Ubuntu 16.04 / 18.04 LTS 版本中安装 Docker CE][1] ### 如何在 Ubuntu Linux / RHEL / CentOS 系统上安装和配置 Portainer.io -**注意:**下面的安装过程是在 Ubuntu 18.04 上完成的,但是对 RHEL 和 CentOS 同样适用,同时假设你已经在系统上安装了 Docker CE。 +注意:下面的安装过程是在 Ubuntu 18.04 上完成的,但是对 RHEL 和 CentOS 同样适用,同时假设你已经在系统上安装了 Docker CE。 ``` root@linuxtechi:~$ lsb_release -a @@ -55,7 +57,7 @@ Codename: bionic root@linuxtechi:~$ ``` -为 Portainer 创建卷, +为 Portainer 创建卷: ``` root@linuxtechi:~$ sudo docker volume create portainer_data @@ -63,7 +65,7 @@ portainer_data root@linuxtechi:~$ ``` -使用下面的 Docker 命令来运行 Portainer 容器, +使用下面的 Docker 命令来运行 Portainer 容器: ``` root@linuxtechi:~$ sudo docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer @@ -79,31 +81,29 @@ root@linuxtechi:~$ 安装完成之后,通过主机或 Docker 的 IP 加上 Docker 引擎使用的 9000 端口在浏览器中打开 Portainer。 -**注意:**如果 Docker 所在主机的系统防火墙开启,需要确保 9000 端口被放行,否则浏览器页面将无法打开。 +注意:如果 Docker 所在主机的系统防火墙开启,需要确保 9000 端口被放行,否则浏览器页面将无法打开。 -在我这边,我的 Docker 主机/引擎的 IP 是“192.168.1.16”,所以 URL 就是 +在我这边,我的 Docker 主机/引擎的 IP 是 `192.168.1.16`,所以 URL 就是 `http://192.168.1.16:9000` - +![Portainer-Login-User-Name-Password][2] -[![Portainer-Login-User-Name-Password][2]][3] +在创建管理员用户时,请确保密码是 8 个字符,同时用户名为 `admin`,然后点击 “Create User”。 -在创建管理员用户时,请确保密码是 8 个字符,同时用户名为 admin,然后点击“Create User”。 +接下来进入如下所示的页面,选中 “Local” 矩形框。 -接下来进入如下所示的页面,选中“Local”矩形框。 +![Connect-Portainer-Local-Docker][4] -[![Connect-Portainer-Local-Docker][4]][5] - -点击“Connect”, +点击 “Connect”, 可以看到 admin 用户的漂亮首页如下所示, -[![Portainer-io-Docker-Monitor-Dashboard][6]][7] +![Portainer-io-Docker-Monitor-Dashboard][6] 现在 Portainer 已经准备好运行和管理你的 Docker 容器了,同时也可用于容器监控。 ### 在 Portainer 中管理容器镜像 -[![Portainer-Endpoints][8]][9] +![Portainer-Endpoints][8] 检查当前的状态,可以看到有两个容器已经在运行了,如果你创建另一个也会立即显示出来。 @@ -119,31 +119,31 @@ Status: Downloaded newer image for debian:latest root@linuxtechi:/# ``` -然后在 Portainer 页面中点击刷新按钮(会出现一条让你确认的消息,点击上面的“Continue”),就可以像下面高亮显示的一样看到 3 个容器了。 +然后在 Portainer 页面中点击刷新按钮(会出现一条让你确认的消息,点击上面的 “Continue”),就可以像下面高亮显示的一样看到 3 个容器了。 -[![Portainer-io-new-container-image][10]][11] +![Portainer-io-new-container-image][10] -点击上图中红圈圈出来的“containers”,下一个页面会显示“**Dashboard Endpoint summary** ”。 +点击上图中红圈圈出来的 “containers”,下一个页面会显示 “Dashboard Endpoint summary”。 -[![Portainer-io-Docker-Container-Dash][12]][13] +![Portainer-io-Docker-Container-Dash][12] -在这个页面中,点击上图高亮和红圈圈出来的“Containers”,就可以对容器进行监控了。 +在这个页面中,点击上图高亮和红圈圈出来的 “Containers”,就可以对容器进行监控了。 ### 以简单的方式对容器进行监控 -继续上面的步骤,就会出现一个如下所示精致、漂亮的“Container list”页面。 +继续上面的步骤,就会出现一个如下所示精致、漂亮的 “Container list” 页面。 -[![Portainer-Container-List][14]][15] +![Portainer-Container-List][14] -所有的容器都可以在这里进行控制(停止,启动等等)。 +所有的容器都可以在这里进行控制(停止、启动等等)。 -**1)** 在这个页面上,停止我们之前启动的“test”容器(这是一个我们早先启动的 debian 容器) +1、在这个页面上,停止我们之前启动的 “test” 容器(这是一个我们早先启动的 debian 容器)。 选中此容器前面的复选框,然后点击上面的“Stop”按钮来停止。 -[![Stop-Container-Portainer-io-dashboard][16]][17] +![Stop-Container-Portainer-io-dashboard][16] -在命令行中,你也会看到这个容器现在已经停止或退出了。 +在命令行中,你也会看到这个容器现在已经停止或退出了: ``` root@linuxtechi:~$ sudo docker container ls -a @@ -154,46 +154,43 @@ d45902e717c0 debian "bash" 21 minutes ago root@linuxtechi:~$ ``` -**2)** 现在,在 Portainer 页面中启动已经停止的两个容器(test 和 mycontainer2) +2、现在,在 Portainer 页面中启动已经停止的两个容器(test 和 mycontainer2) -选中已停止的这两个容器前面的复选框,然后点击“Start”。 +选中已停止的这两个容器前面的复选框,然后点击 “Start”。 -[![Start-Containers-Portainer-GUI][18]][19] +![Start-Containers-Portainer-GUI][18] 你会立即看到两条窗口提醒,内容是“容器成功启动”,并且两个容器的状态变为正在运行。 -[![Conatiner-Started-successfully-Portainer-GUI][20]][21] +![Conatiner-Started-successfully-Portainer-GUI][20] ### 一步步探索其他多种选项和特性 -**1)** 点击高亮的“Images”,你会看到如下页面 +1、点击高亮的“Images”,你会看到如下页面: -[![Docker-Container-Images-Portainer-GUI][22]][23] +![Docker-Container-Images-Portainer-GUI][22] 这是可用的容器列表,其中一些可能没在运行。这些容器可以被导入、导出或者上传到不同的位置,截图如下所示。 -[![Upload-Docker-Container-Image-Portainer-GUI][24]][25] +![Upload-Docker-Container-Image-Portainer-GUI][24] -**2)** 点击高亮的“Volumes”,显示如下页面 +2、点击高亮的“Volumes”,显示如下页面: -[![Volume-list-Portainer-io-gui][26]][27] +![Volume-list-Portainer-io-gui][26] -**3)** 通过下面的操作,可以很容易的添加卷。点击添加卷按钮,出现如下页面 +3、通过下面的操作,可以很容易的添加卷。点击添加卷按钮,出现如下页面,在名称输入框中输入卷名称,例如 “myvol”,然后点击 “Create the volume” 按钮: -在名称输入框中输入卷名称,例如 “**myvol**”,然后点击 “**Create the volume**” 按钮。 +![Volume-Creation-Portainer-io-gui][28] -[![Volume-Creation-Portainer-io-gui][28]][29] +新创建的卷如下所示(状态为未使用): -新创建的卷如下所示(状态为未使用)。 - -[![Volume-unused-Portainer-io-gui][30]][31] +![Volume-unused-Portainer-io-gui][30] ### 结论 通过上面的安装步骤,你可以到配置和使用 Portainer.io 的多种选项是多么简单和精美,它提供了用于构建和监控 Docker 容器的多种功能和选项。如前所述,这个一个非常轻量的工具,因此不会给主机系统增加任何负担。下一组选项将在本系列的第 2 部分中进行探讨。 -另请阅读: **[用 Portainer.io (图形界面工具) 来监控和管理 Docker 容器 – 2][32]** - +另请阅读: [用 Portainer.io 来监控和管理 Docker 容器(2)][32] -------------------------------------------------------------------------------- @@ -202,7 +199,7 @@ via: https://www.linuxtechi.com/monitor-manage-docker-containers-portainer-part1 作者:[Shashidhar Soppin][a] 选题:[lujun9972][b] 译者:[jlztan](https://github.com/jlztan) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From fe5d54ac3b64ead8342f5d2fa543d18c0ab78861 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 20 Sep 2020 23:00:15 +0800 Subject: [PATCH 0168/1156] PUB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @jlztan https://linux.cn/article-12634-1.html 希望能再接再厉,把这个系列完成。 --- ...Docker Containers with Portainer.io (GUI tool) - Part-1.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md (99%) diff --git a/translated/tech/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md b/published/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md similarity index 99% rename from translated/tech/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md rename to published/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md index aff4fc233c..94bf12cab7 100644 --- a/translated/tech/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md +++ b/published/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md @@ -1,8 +1,8 @@ [#]: collector: "lujun9972" [#]: translator: "jlztan" [#]: reviewer: "wxy" -[#]: publisher: " " -[#]: url: " " +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12634-1.html" [#]: subject: "Monitor and Manage Docker Containers with Portainer.io (GUI tool) – Part-1" [#]: via: "https://www.linuxtechi.com/monitor-manage-docker-containers-portainer-part1/" [#]: author: "Shashidhar Soppin https://www.linuxtechi.com/author/shashidhar/" From d698a0cfe209f7dd3d74dfc7c25f0929bb63e3aa Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 20 Sep 2020 23:39:30 +0800 Subject: [PATCH 0169/1156] PRF @geekpi --- ...ate and Fix Long Shutdown Time in Linux.md | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/translated/tech/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md b/translated/tech/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md index c9bbc18e6b..23ec0afd3b 100644 --- a/translated/tech/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md +++ b/translated/tech/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md @@ -1,22 +1,24 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Shutdown Taking Too Long? Here’s How to Investigate and Fix Long Shutdown Time in Linux) [#]: via: (https://itsfoss.com/long-shutdown-linux/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -关机时间太长?下面是如何调查和解决 Linux 中关机时间过长的问题 +关机时间太长的调查和解决的方法 ====== -_**你的 Linux 系统关机时间太长么?以下是你可以采取的步骤,来找出导致延迟关机的原因并解决这个问题。**_ +![](https://img.linux.net.cn/data/attachment/album/202009/20/233812o1kd114jzq11lq1l.jpg) + +> 你的 Linux 系统关机时间太长么?以下是你可以采取的步骤,来找出导致延迟关机的原因并解决这个问题。 我希望你对 [sigterm 和 sigkill][1] 的概念有一点熟悉。 -当你[关闭 Linux 系统][2]时,它会发送 sigterm,并礼貌地要求正在运行的进程停止。有些进程不符合该行为,它们会忽略 sigterm 并继续运行。 +当你[关闭 Linux 系统][2]时,它会发送终止信号(sigterm),并礼貌地要求正在运行的进程停止。有些进程不符合该行为,它们会忽略终止信号并继续运行。 -这可能会导致关机过程的延迟,因为你的系统会在一个预定义的时间段内等待运行的进程停止。在这个时间段之后,它会发送 kill 信号来强制停止所有剩余的运行进程并关闭系统。 +这可能会导致关机过程的延迟,因为你的系统会在一个预定义的时间段内等待运行的进程停止。在这个时间段之后,它会发送 `kill` 信号来强制停止所有剩余的运行进程并关闭系统。 事实上,在某些情况下,你会在黑屏上看到一个类似 “a stop job is running” 的信息。 @@ -25,9 +27,7 @@ _**你的 Linux 系统关机时间太长么?以下是你可以采取的步骤 * 检查哪个进程/服务耗时过长,以及你是否能删除或重新配置它,使其正常运行。 * 更改系统强制停止运行进程前的默认等待时间。(快速而不优雅的方式) - - -我这里使用的是使用 systemd 的 Ubuntu。这里的命令和步骤适用于任何使用 systemd 的 Linux 发行版(大多数发行版都是这样)。 +我的操作系统是使用 systemd 的 Ubuntu。这里的命令和步骤适用于任何使用 systemd 的 Linux 发行版(大多数发行版都是这样)。 ![][3] @@ -39,23 +39,23 @@ _**你的 Linux 系统关机时间太长么?以下是你可以采取的步骤 journalctl -rb -1 ``` -[journalctl 命令][4]能让你读取系统日志。使用选项 “-b -1” 可以过滤最后一次启动会话的日志。使用选项 “-r” 时,日志将按时间倒序显示。 +[journalctl 命令][4]能让你读取系统日志。使用选项 `-b -1` 可以过滤最后一次启动会话的日志。使用选项 `-r` 时,日志将按时间倒序显示。 -换句话说,“journalctl -rb -1” 命令将显示最后一次关闭 Linux 系统之前的系统日志。这里就是你需要分析 Linux 系统长时间关机问题的地方。 +换句话说,`journalctl -rb -1` 命令将显示最后一次关闭 Linux 系统之前的系统日志。这里就是你需要分析 Linux 系统长时间关机问题的地方。 -没有 journal 日志?下面是你应该做的。 +#### 没有 journal 日志?下面是你应该做的。 如果没有 journal 日志,请确认你的发行版是否使用 systemd。 即使在一些使用 systemd 的 Linux 发行版上,journal 日志也没有被默认激活。 -请确认 /var/log/journal 是否存在。如果不存在,请创建它: +请确认 `/var/log/journal` 是否存在。如果不存在,请创建它: ``` sudo mkdir /var/log/journal ``` -你还应该检查 /etc/systemd/journald.conf 文件的内容,并确保 Storage 的值被设置为自动或持久。 +你还应该检查 `/etc/systemd/journald.conf` 文件的内容,并确保 `Storage` 的值被设置为自动(`auto`)或持久(`persistent`)。 你是否在日志中发现可疑的东西?是否有一个进程/服务拒绝停止?如果是,调查一下是否可以在没有副作用的情况下删除它,或者是否可以重新配置它。请不要在这里盲目地去删除东西。你应该对这个进程有所了解。 @@ -65,7 +65,7 @@ sudo mkdir /var/log/journal 如果你想让你的 Linux 系统快速关闭,你可以改变这个等待时间。 -你可以在位于 /etc/systemd/system.conf 的配置文件中找到所有的 systemd 设置。这个文件中应该有很多以 # 开头的行。它们代表了文件中各条目的默认值。 +你可以在位于 `/etc/systemd/system.conf` 的配置文件中找到所有的 systemd 设置。这个文件中应该有很多以 `#` 开头的行。它们代表了文件中各条目的默认值。 在开始之前,最好先复制一份原始文件。 @@ -73,7 +73,7 @@ sudo mkdir /var/log/journal sudo cp /etc/systemd/system.conf /etc/systemd/system.conf.orig ``` -在这里寻找 DefaultTimeoutStopSec。它可能被设置为 90 秒。 +在这里寻找 `DefaultTimeoutStopSec`。它可能被设置为 90 秒。 ``` #DefaultTimeoutStopSec=90s @@ -93,11 +93,11 @@ sudo xdg-open /etc/systemd/system.conf ![Change Shutdown Time Settings Ubuntu][5] -不要忘记**删除 DefaultTimeoutStopSec 前的 # 号**。保存文件并重启系统。 +不要忘记**删除 DefaultTimeoutStopSec 前的 `#` 号**。保存文件并重启系统。 这将帮助你减少 Linux 系统的关机延迟。 -看门狗问题! +#### 看门狗问题! Linux 有一个名为看门狗的模块,用于监控某些服务是否在运行。它可以被配置为在系统因软件错误而挂起时自动重启系统。 @@ -109,9 +109,9 @@ Linux 有一个名为看门狗的模块,用于监控某些服务是否在运 ps -af | grep watch* ``` -如果你的系统正在运行看门狗,你可以在 systemd 配置文件 /etc/systemd/system.conf 中将 ShutdownWatchdogSec的 值从 10 分钟改为更低的值。 +如果你的系统正在运行看门狗,你可以在 systemd 配置文件 `/etc/systemd/system.conf` 中将 `ShutdownWatchdogSec` 的值从 10 分钟改为更低的值。 -**你能解决关机时间过长的问题吗?** +### 你能解决关机时间过长的问题吗? 希望本教程能帮助你解决系统长时间关机的问题。如果你成功解决了这个问题,请在评论中告诉我。 @@ -122,7 +122,7 @@ via: https://itsfoss.com/long-shutdown-linux/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From f0a662fe931bd1057e80abbfcddaf78ea3e9a3ec Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 20 Sep 2020 23:41:26 +0800 Subject: [PATCH 0170/1156] PUB @geekpi https://linux.cn/article-12635-1.html --- ... How to Investigate and Fix Long Shutdown Time in Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md (98%) diff --git a/translated/tech/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md b/published/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md similarity index 98% rename from translated/tech/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md rename to published/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md index 23ec0afd3b..250d06cd7f 100644 --- a/translated/tech/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md +++ b/published/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12635-1.html) [#]: subject: (Shutdown Taking Too Long? Here’s How to Investigate and Fix Long Shutdown Time in Linux) [#]: via: (https://itsfoss.com/long-shutdown-linux/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From 48c7f2152c01c01127d7c1f5fae44bc6d9c4e1dc Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 21 Sep 2020 05:01:32 +0800 Subject: [PATCH 0171/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200921?= =?UTF-8?q?=20Linux=20Jargon=20Buster:=20What=20is=20a=20Rolling=20Release?= =?UTF-8?q?=20Distribution=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md --- ... What is a Rolling Release Distribution.md | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 sources/tech/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md diff --git a/sources/tech/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md b/sources/tech/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md new file mode 100644 index 0000000000..723a93c083 --- /dev/null +++ b/sources/tech/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux Jargon Buster: What is a Rolling Release Distribution?) +[#]: via: (https://itsfoss.com/rolling-release/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Linux Jargon Buster: What is a Rolling Release Distribution? +====== + +After understanding [what is Linux][1], [what is a Linux distribution][2], when you start using Linux, you might come across the term ‘rolling release’ in Linux forum discussions. + +In this Linux jargon buster, you’ll learn about rolling release model of Linux distributions. + +### What is a rolling release distribution? + +In software development, rolling release is a model where updates to a software are continuously rolled out rather than in batches of versions. This way the software always remains up-to-date. A rolling release distribution follows the same model and it provides the latest Linux kernel and the software version as they are released. + +[Arch Linux][3] is the most popular example of a rolling release distribution however [Gentoo][4] is the oldest rolling release distribution still in development. + +When you use a rolling release distribution, you get small but frequent updates. There are no major XYZ version release here like Ubuntu. You regularly [update Arch][5] or the other rolling release distribution and you’ll always have the latest version of your distribution. + +The rolling release also comes at the cost of testing. You may have surprises when the latest update starts creating problem for your system. + +### Rolling release vs point release distributions + +![][6] + +Many Linux distributions like Debian, Ubuntu, Linux Mint, Fedora etc follow the point release model. They will release a major XYZ version after every few months/years. + +The point release consists of new versions of the Linux kernel, desktop environments and other software. + +When a new major version of a point release distribution is released, you’ll have to do [special efforts to upgrade your system][7]. + +On the contrary, you keep on getting new features updates in a rolling release distribution as it gets released from the developers. This way, you don’t need to do a version upgrade after some months or years. You always have the latest stuff. + +#### Oh.. but my Ubuntu also gets regular updates, almost on a weekly basis. Does it mean Ubuntu is also rolling release? + +![][8] + +No. Ubuntu is not rolling release. You see, the updates you usually get from Ubuntu are security and maintenance updates (except for some software like Mozilla Firefox), not new feature release. + +For example, GNOME 3.38 has been released but Ubuntu LTS release 20.04 won’t give you GNOME 3.38. It will stick to the 3.36 version. If there are security or maintenance update to GNOME 3.36, you’ll get it with your Ubuntu updates. + +Same goes for the LibreOffice release. Ubuntu 20.04 LTS sticks with LibreOffice 6.x series whereas LibreOffice 7 is already out there. Keep in mind that I am talking about software versions available in the official repositories. You are free to download a newer version of LibreOffice from their official website or use a PPA. But you won’t get it from Ubuntu’s repositories. + +When Ubuntu releases the next version Ubuntu 20.10, you’ll get LibreOffice 7 and GNOME 3.38. + +#### Why do some rolling release distributions have ‘version number’ and release names? + +![Arch Linux ISO Refresh][9] + +That’s a fair question. Arch Linux is rolling release which always keeps your system updated and yet you’ll see something like Arch Linux 2020.9.01 version number. + +Now imagine you installed Arch Linux in 2018. You regularly update your Arch Linux system and so you have all the latest kernel and software in September 2020. + +But what happens if you decide to Arch Linux in September 2020 on a new system? If you use the same installation media you used in 2018, you’ll have to install all the system updates released in the last two years or more. That’s inconvinient, isn’t it? + +This is why Arch Linux (and other rolling release distributions) provide a new ISO (OS installer image file) with all the latest software every month or every few months. **This is called ISO refresh**. Thus, new users get a more recent copy of the Linux distribution. + +If you are already using a rolling release distribution, you don’t to worry about the new refreshed ISO. Your system is already at par with it. The ISO refresh is helpful to people who are going to install it on a new system. + +### Pros and cons of rolling release distributions + +The benefit of the rolling release model is that you get small but more frequent updates. You always have the latest kernel and the latest software releases available from your distribution’s repositories. + +However, this could also bring unforeseen problems with the new software. Point release usually test essential components for system integration to avoid inconvenient bugs. This is not the case in rolling release distribution where the software is rolled out as soon it is released by their developers. + +### Should you use rolling release or point release distribution? + +![][10] + +That’s up to you. If you are a new Linux user or if you are not comfortable troubleshooting your Linux system, stick with a point release distribution of your choice. This is also recommended for your production and mission-critical machines. You would want a stable system here. + +If you want the latest and greatest of Linux kernel and software and you are not afraid of spending some time in troubleshooting (happens from time to time) the you may choose a rolling release distribution. + +At this point, I would also like to mention the hybrid rolling releasing model of Manjaro Linux. Manjaro does follow a rolling release model where you don’t have to upgrade your system to a newer version. However, Manjaro also performs testing of the essential software components instead of just blindly rolling it out to the users. This is one the [reasons why so many people use Manjrao Linux][11]. + +**Was it clear enough?** + +I hope you have a slightly better understanding of the term ‘rolling release distribution’ now. If you still have some doubts around it please leave a comment and I’ll try to answer. I might update the article to cover your questions. Enjoy :) + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/rolling-release/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/what-is-linux/ +[2]: https://itsfoss.com/what-is-linux-distribution/ +[3]: https://www.archlinux.org/ +[4]: https://www.gentoo.org/ +[5]: https://itsfoss.com/update-arch-linux/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/what-is-rolling-release-distribution.png?resize=800%2C450&ssl=1 +[7]: https://itsfoss.com/upgrade-ubuntu-version/ +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/updates-available-ubuntu.png?resize=800%2C433&ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/arch-linux-iso-refresh.png?resize=799%2C388&ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/rolling-vs-point-release-distribution.png?resize=800%2C350&ssl=1 +[11]: https://itsfoss.com/why-use-manjaro-linux/ From 330805d509286ef55503dc09f9819a87169daf47 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 21 Sep 2020 08:41:02 +0800 Subject: [PATCH 0172/1156] translated --- ...ource Password Manager -Not Cloud Based.md | 107 ----------------- ...ource Password Manager -Not Cloud Based.md | 109 ++++++++++++++++++ 2 files changed, 109 insertions(+), 107 deletions(-) delete mode 100644 sources/tech/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md create mode 100644 translated/tech/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md diff --git a/sources/tech/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md b/sources/tech/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md deleted file mode 100644 index 0325d1136a..0000000000 --- a/sources/tech/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md +++ /dev/null @@ -1,107 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (KeePassXC is An Amazing Community Driven Open Source Password Manager [Not Cloud Based]) -[#]: via: (https://itsfoss.com/keepassxc/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -KeePassXC is An Amazing Community Driven Open Source Password Manager [Not Cloud Based] -====== - -_**Brief: KeePassXC is a useful open-source cross-platform password manager that doesn’t compromise on features even if it’s not a cloud-based tool. Here, we take a quick look at it.**_ - -### KeePassXC: A Cross-Platform Open Source Password Manager - -![][1] - -KeePassXC is a community fork of [KeePassX][2] which aims to be a cross-platform port for [KeePass Password Safe][3] (available for Windows). It is completely free to use and cross-platform as well (Windows, Linux, and macOS) - -In fact, it is one of the [best password managers for Linux][4] out there. It features options for both newbies and power users who want advanced controls to secure their password database on their system. - -Yes, unlike my [favorite Bitwarden password manager][5], KeePassXC is not cloud-based and the passwords never leave the system. Some users do prefer to not save their passwords and secrets in cloud servers. - -You should find all the essential features you will ever need on a password manager when you start using it. But, here, to give you a head start, I’ll highlight some features offered. - -### Features of KeePassXC - -![][6] - -It is worth noting that the features might prove to be a little overwhelming for a newbie. But, considering that you want to make the most out of it, I think you should actually know what it offers: - - * Password Generator - * Ability to import passwords from 1Password, KeePass 1, and any CSV files - * Easily share databases by exporting and synchronizing with SSL certificate support - * Database Encryption supported (256 bit AES) - * Browser Integration Available (optional) - * Ability to search for your credentials - * Auto-type passwords into applications - * Database reports to check password health and other stats - * Supports exporting to CSV and HTML - * 2-factor authentication token support - * Attach files to passwords - * YubiKey support - * Command line option available - * SSH Agent integration available - * Change encryption algorithms if required - * Ability to use DuckDuckGO to download the website icons - * Database auto-lock timeout - * Ability to clear the clipboard and the search query - * Auto-file save - * Folder/Nested Folder support - * Set expiration of a credential - * Dark theme available - * Cross-platform support - - - -As you can observe, it is a feature-rich password manager indeed. So, I’d advise you to properly explore it if you want to utilize every option present. - -![][7] - -### Installing KeePassXC on Linux - -You should find it listed in your software center of the distribution you’ve installed. - -You can also get the AppImage file from the official website. I’d suggest you to check out our guide on [using AppImage files in Linux][8] if you didn’t know already. - -In either case, you will also find a snap available for it. In addition to that, you also get an Ubuntu PPA, Debian package, Fedora package, and Arch package. - -If you’re curious, you can just explore the [official download page][9] for the available packages and check out their [GitHub page][10] for the source code as well. - -[Get KeePassXC][11] - -### Wrapping Up - -If you’re not a fan of cloud-based open-source password managers like [Bitwarden][5], KeePassXC should be an excellent choice for you. - -The number of options that you get here lets you keep your password secure and easy to maintain across multiple platforms. Even though you don’t have an “official” mobile app from the developer team, you may try some of their [recommended apps][12] which are compatible with the database and offer the same functionalities. - -Have you tried KeePassXC yet? What do you prefer using as your password manager? Let me know your thoughts in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/keepassxc/ - -作者:[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://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/keepassxc-screenshot.jpg?resize=800%2C580&ssl=1 -[2]: https://www.keepassx.org/ -[3]: https://keepass.info -[4]: https://itsfoss.com/password-managers-linux/ -[5]: https://itsfoss.com/bitwarden/ -[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/keepassxc-screenshot-1.jpg?resize=800%2C579&ssl=1 -[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/keepassxc-settings.png?resize=800%2C587&ssl=1 -[8]: https://itsfoss.com/use-appimage-linux/ -[9]: https://keepassxc.org/download/ -[10]: https://github.com/keepassxreboot/keepassxc -[11]: https://keepassxc.org -[12]: https://keepassxc.org/docs/#faq-platform-mobile diff --git a/translated/tech/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md b/translated/tech/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md new file mode 100644 index 0000000000..5589d279ff --- /dev/null +++ b/translated/tech/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md @@ -0,0 +1,109 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (KeePassXC is An Amazing Community Driven Open Source Password Manager [Not Cloud Based]) +[#]: via: (https://itsfoss.com/keepassxc/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +KeePassXC 是一个很好的社区驱动的开源密码管理器(不是基于云) +====== + +_**简介:KeePassXC 是一款有用的开源跨平台密码管理器,它即使不是云端工具,也没有在功能上妥协。下面,我们就来快速了解一下它。**_ + +### KeePassXC:一个跨平台的开源密码管理器 + +![][1] + +KeePassXC 是 [KeePassX][2] 的社区分支,旨在成为 [KeePass Password Safe][3] 的跨平台移植(适用于 Windows)。它是完全免费使用和跨平台的(Windows、Linux 和 macOS)。 + +事实上,它是目前 [Linux 最佳密码管理器][4]之一。它的功能选项既适合新手,也适合那些想要进一步控制以保护系统上的密码数据库的高级用户。 + +是的,与我[最喜欢的 Bitwarden 密码管理器][5]不同,KeePassXC 不是基于云端的,密码永远不会离开系统。有些用户确实喜欢不把密码和秘密保存在云服务器中。 + +当你开始使用密码管理器时,你应该能在它上找到你所需要的所有基本功能。但是,在这里,为了让你初步了解,我会强调一些提供的功能。 + +### KeePassXC 的功能 + +![][6] + +值得注意的是,对于一个新手来说,这些功能可能会让人有点不知所措。但是,考虑到你想充分使用它,我想你应该真正了解它所提供的功能: + + +* 密码生成器 +* 能够从1Password、KeePass 1 和任何 CSV 文件导入密码。 +* 通过导出和同步 SSL 证书支持,轻松共享数据库。 +* 支持数据库加密 (256 位 AES) +* 浏览器集成(可选) +* 能够搜索你的密码 +* 在应用中自动输入密码 +* 数据库报告,以检查密码的健康状况和其他统计数字 +* 支持导出为 CSV 和 HTML +* 支持双因素认证令牌 +* 支持将文件附加到密码中 +* 支持 YubiKey +* 可用命令行选项 +* 集成 SSH Agent +* 必要时改变加密算法 +* 能够使用 DuckDuckGO 下载网站图标。 +* 数据库超时自动锁定 +* 清除剪贴板和搜索查询的能力。 +* 自动保存文件 +* 支持文件夹/嵌套文件夹 +* 设置密码的有效期 +* 提供黑暗主题 +* 跨平台支持 + + + +正如你所看到的,它的确是一款功能丰富的密码管理器。所以,我建议你如果想使用目前的每一个选项,就好好探索它。 + +![][7] + +### 在 Linux 上安装 KeePassXC + +你应该能在你安装的发行版的软件中心找到它。 + +你也可以从官方网站上获得 AppImage 文件。如果你还不知道的话,我建议你去看看我们的[在 Linux 中使用 AppImage 文件][8]的指南。 + +另外,你还会发现有一个 snap 包可以用。除此之外,你还可以得到 Ubuntu PPA、Debian 包、Fedora 包和 Arch 包。 + +如果你好奇,你可以直接探索[官方下载页面][9]的可用包,并查看他们的 [GitHub 页面][10]的源代码。 + + +[Get KeePassXC][11] + +### 总结 + +如果你不是 [Bitwarden][5] 等云端开源密码管理器的粉丝,KeePassXC 应该是你的绝佳选择。 + +在这里你得到的功能数量让你可以在多个平台上保证密码的安全和易于维护。即使没有开发团队的”官方“移动应用,你也可以尝试他们的一些[推荐应用][12],它们与数据库兼容,并提供相同的功能。 + +你尝试过 KeePassXC 吗?你更喜欢使用什么作为你的密码管理器?请在下面的评论中告诉我你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/keepassxc/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者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://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/keepassxc-screenshot.jpg?resize=800%2C580&ssl=1 +[2]: https://www.keepassx.org/ +[3]: https://keepass.info +[4]: https://itsfoss.com/password-managers-linux/ +[5]: https://itsfoss.com/bitwarden/ +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/keepassxc-screenshot-1.jpg?resize=800%2C579&ssl=1 +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/keepassxc-settings.png?resize=800%2C587&ssl=1 +[8]: https://itsfoss.com/use-appimage-linux/ +[9]: https://keepassxc.org/download/ +[10]: https://github.com/keepassxreboot/keepassxc +[11]: https://keepassxc.org +[12]: https://keepassxc.org/docs/#faq-platform-mobile \ No newline at end of file From 0bbaa3b3af34da0b6df19a00fbdea77270cf6e10 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 21 Sep 2020 08:47:43 +0800 Subject: [PATCH 0173/1156] translating --- ...o Fix -Repository is not valid yet- Error in Ubuntu Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md b/sources/tech/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md index 7fba88db3d..6df3e3e26d 100644 --- a/sources/tech/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md +++ b/sources/tech/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From c5ebb57dec51f8f1cd926327a52a0449de82b54c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 21 Sep 2020 16:43:29 +0800 Subject: [PATCH 0174/1156] APL --- ...nux Jargon Buster- What is a Rolling Release Distribution.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md b/sources/tech/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md index 723a93c083..4a9bda5748 100644 --- a/sources/tech/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md +++ b/sources/tech/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 1287d912f45fe98e5595b357ebf3eaf5806c88e6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 21 Sep 2020 18:11:14 +0800 Subject: [PATCH 0175/1156] TSL&PRF --- ... What is a Rolling Release Distribution.md | 108 ------------------ ... What is a Rolling Release Distribution.md | 108 ++++++++++++++++++ 2 files changed, 108 insertions(+), 108 deletions(-) delete mode 100644 sources/tech/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md create mode 100644 translated/tech/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md diff --git a/sources/tech/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md b/sources/tech/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md deleted file mode 100644 index 4a9bda5748..0000000000 --- a/sources/tech/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md +++ /dev/null @@ -1,108 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Linux Jargon Buster: What is a Rolling Release Distribution?) -[#]: via: (https://itsfoss.com/rolling-release/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -Linux Jargon Buster: What is a Rolling Release Distribution? -====== - -After understanding [what is Linux][1], [what is a Linux distribution][2], when you start using Linux, you might come across the term ‘rolling release’ in Linux forum discussions. - -In this Linux jargon buster, you’ll learn about rolling release model of Linux distributions. - -### What is a rolling release distribution? - -In software development, rolling release is a model where updates to a software are continuously rolled out rather than in batches of versions. This way the software always remains up-to-date. A rolling release distribution follows the same model and it provides the latest Linux kernel and the software version as they are released. - -[Arch Linux][3] is the most popular example of a rolling release distribution however [Gentoo][4] is the oldest rolling release distribution still in development. - -When you use a rolling release distribution, you get small but frequent updates. There are no major XYZ version release here like Ubuntu. You regularly [update Arch][5] or the other rolling release distribution and you’ll always have the latest version of your distribution. - -The rolling release also comes at the cost of testing. You may have surprises when the latest update starts creating problem for your system. - -### Rolling release vs point release distributions - -![][6] - -Many Linux distributions like Debian, Ubuntu, Linux Mint, Fedora etc follow the point release model. They will release a major XYZ version after every few months/years. - -The point release consists of new versions of the Linux kernel, desktop environments and other software. - -When a new major version of a point release distribution is released, you’ll have to do [special efforts to upgrade your system][7]. - -On the contrary, you keep on getting new features updates in a rolling release distribution as it gets released from the developers. This way, you don’t need to do a version upgrade after some months or years. You always have the latest stuff. - -#### Oh.. but my Ubuntu also gets regular updates, almost on a weekly basis. Does it mean Ubuntu is also rolling release? - -![][8] - -No. Ubuntu is not rolling release. You see, the updates you usually get from Ubuntu are security and maintenance updates (except for some software like Mozilla Firefox), not new feature release. - -For example, GNOME 3.38 has been released but Ubuntu LTS release 20.04 won’t give you GNOME 3.38. It will stick to the 3.36 version. If there are security or maintenance update to GNOME 3.36, you’ll get it with your Ubuntu updates. - -Same goes for the LibreOffice release. Ubuntu 20.04 LTS sticks with LibreOffice 6.x series whereas LibreOffice 7 is already out there. Keep in mind that I am talking about software versions available in the official repositories. You are free to download a newer version of LibreOffice from their official website or use a PPA. But you won’t get it from Ubuntu’s repositories. - -When Ubuntu releases the next version Ubuntu 20.10, you’ll get LibreOffice 7 and GNOME 3.38. - -#### Why do some rolling release distributions have ‘version number’ and release names? - -![Arch Linux ISO Refresh][9] - -That’s a fair question. Arch Linux is rolling release which always keeps your system updated and yet you’ll see something like Arch Linux 2020.9.01 version number. - -Now imagine you installed Arch Linux in 2018. You regularly update your Arch Linux system and so you have all the latest kernel and software in September 2020. - -But what happens if you decide to Arch Linux in September 2020 on a new system? If you use the same installation media you used in 2018, you’ll have to install all the system updates released in the last two years or more. That’s inconvinient, isn’t it? - -This is why Arch Linux (and other rolling release distributions) provide a new ISO (OS installer image file) with all the latest software every month or every few months. **This is called ISO refresh**. Thus, new users get a more recent copy of the Linux distribution. - -If you are already using a rolling release distribution, you don’t to worry about the new refreshed ISO. Your system is already at par with it. The ISO refresh is helpful to people who are going to install it on a new system. - -### Pros and cons of rolling release distributions - -The benefit of the rolling release model is that you get small but more frequent updates. You always have the latest kernel and the latest software releases available from your distribution’s repositories. - -However, this could also bring unforeseen problems with the new software. Point release usually test essential components for system integration to avoid inconvenient bugs. This is not the case in rolling release distribution where the software is rolled out as soon it is released by their developers. - -### Should you use rolling release or point release distribution? - -![][10] - -That’s up to you. If you are a new Linux user or if you are not comfortable troubleshooting your Linux system, stick with a point release distribution of your choice. This is also recommended for your production and mission-critical machines. You would want a stable system here. - -If you want the latest and greatest of Linux kernel and software and you are not afraid of spending some time in troubleshooting (happens from time to time) the you may choose a rolling release distribution. - -At this point, I would also like to mention the hybrid rolling releasing model of Manjaro Linux. Manjaro does follow a rolling release model where you don’t have to upgrade your system to a newer version. However, Manjaro also performs testing of the essential software components instead of just blindly rolling it out to the users. This is one the [reasons why so many people use Manjrao Linux][11]. - -**Was it clear enough?** - -I hope you have a slightly better understanding of the term ‘rolling release distribution’ now. If you still have some doubts around it please leave a comment and I’ll try to answer. I might update the article to cover your questions. Enjoy :) - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/rolling-release/ - -作者:[Abhishek Prakash][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/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/what-is-linux/ -[2]: https://itsfoss.com/what-is-linux-distribution/ -[3]: https://www.archlinux.org/ -[4]: https://www.gentoo.org/ -[5]: https://itsfoss.com/update-arch-linux/ -[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/what-is-rolling-release-distribution.png?resize=800%2C450&ssl=1 -[7]: https://itsfoss.com/upgrade-ubuntu-version/ -[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/updates-available-ubuntu.png?resize=800%2C433&ssl=1 -[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/arch-linux-iso-refresh.png?resize=799%2C388&ssl=1 -[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/rolling-vs-point-release-distribution.png?resize=800%2C350&ssl=1 -[11]: https://itsfoss.com/why-use-manjaro-linux/ diff --git a/translated/tech/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md b/translated/tech/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md new file mode 100644 index 0000000000..5d4d723409 --- /dev/null +++ b/translated/tech/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux Jargon Buster: What is a Rolling Release Distribution?) +[#]: via: (https://itsfoss.com/rolling-release/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Linux 黑话解释:什么是滚动发行版? +====== + +在了解了[什么是 Linux][1]、[什么是 Linux 发行版][2]之后,当你开始使用 Linux 时,你可能会在 Linux 论坛的讨论中遇到“滚动发布rolling release”这个名词。 + +在这篇 Linux 黑话解释文章中,你将了解到 Linux 发行版的滚动发布模式。 + +### 什么是滚动发布? + +在软件开发中,滚动发布是一种模式,在这种模式下,软件的更新是连续推出的,而不是分批的版本。这样软件就能始终保持更新。滚动发行版rolling release distribution遵循同样的模式,它提供最新的 Linux 内核和软件版本,在它们一发布就提供。 + +[Arch Linux][3] 是滚动发行版中最流行的例子,然而 [Gentoo][4] 是最古老的滚动发行版,目前仍在开发中。 + +当你使用一个滚动发行版时,你会得到小而频繁的更新。这里没有像 Ubuntu 那样的重大 XYZ 版本发布。你会定期[更新 Arch][5]或其他滚动发行版,你将永远拥有最新版本的发行版。 + +滚动发布也是以测试为代价的。当最新的更新开始给你的系统带来问题时,你也许会受到“惊吓”。 + +### 对比滚动式发布与点版本式发布的发行版 + +![][6] + +许多 Linux 发行版,如 Debian、Ubuntu、Linux Mint、Fedora 等都遵循点版本point release模式。他们每隔几个月/年就会发布一个主要的 XYZ 版本。 + +点版本由 Linux 内核、桌面环境和其他软件的新版本组成。 + +当一个新的点版本发行版的主要版本发布时,你必须[专门来升级你的系统][7]。 + +相反,在滚动发行版中,当它从开发者那里发布时,你会不断地获得新的功能更新。这样,你不需要在几个月或几年后进行版本升级。你总是拥有最新的东西。 + +**哦,但我的 Ubuntu 也会定期更新,几乎每周一次。这是否意味着 Ubuntu 也在滚动发布?** + +![][8] + +不,Ubuntu 不是滚动发布。你看,你通常从 Ubuntu 得到的更新是安全和维护更新(除了一些软件,比如 Mozilla Firefox),而不是新功能的发布。 + +例如,GNOME 3.38 已经发布了,但 Ubuntu LTS 20.04 版不会给你 GNOME 3.38。它将坚持使用 3.36 版本。如果 GNOME 3.36 有安全或维护更新,你会在 Ubuntu 的更新中得到它。 + +LibreOffice 版本也是如此。Ubuntu 20.04 LTS 坚持使用 LibreOffice 6.x 系列,而 LibreOffice 7 已经发布了。请记住,我说的是官方软件库中的软件版本。你可以自由地从他们的官方网站上下载一个更新版本的 LibreOffice,或者使用 PPA。但你不会从 Ubuntu 的软件库中得到它。 + +当 Ubuntu 发布下一个版本 Ubuntu 20.10 时,你会得到 LibreOffice 7 和 GNOME 3.38。 + +**为什么一些滚动发行版有“版本号”和发行版名称?** + +![][9] + +这是一个合理的问题。Arch Linux 是滚动发布的,它总是让你的系统保持更新,然而你会看到像 Arch Linux 2020.9.01 这样的版本号。 + +现在想象一下,你在 2018 年安装了 Arch Linux。你定期更新你的 Arch Linux 系统,所以你在 2020 年 9 月拥有所有最新的内核和软件。 + +但是,如果你决定在 2020 年 9 月在一个新系统上安装 Arch Linux 会发生什么?如果你使用 2018 年使用的相同的安装介质,你将不得不安装过去两年或更长时间内发布的所有系统更新。这很不方便,不是吗? + +这就是为什么 Arch Linux(和其他滚动发行版)每个月或每隔几个月都会提供一个新的 ISO(操作系统安装程序镜像文件),其中包含所有最新的软件。**这就是所谓的 ISO 刷新**。这样一来,新用户就会得到一个更新的 Linux 发行版。 + +如果你已经在使用滚动发行版,你就不用担心新的 ISO 刷新了。你的系统已经和它对等了。ISO 刷新对那些要在新系统上安装它的人是有帮助的。 + +### 滚动式发布的利与弊 + +滚动发布模式的好处是,你可以得到小而频繁的更新。你总是可以从你的发行版的仓库中获得最新的内核和最新的软件版本。 + +然而,这也可能带来新软件不可预见的问题。点版本发行版通常会对系统中集成的基本组件进行测试,以避免带来令人不便的错误。而在滚动发行版中,情况就不一样了,在滚动发行版中,软件一经开发者发布就会被推出。 + +### 你应该使用滚动发行版还是点版本发行版? + +![][10] + +这取决于你。如果你是一个新的 Linux 用户,或者如果你不习惯于排除你的 Linux 系统的故障,请坚持使用你选择的点版本发行版。这也建议用于你的生产和关键任务的机器,在这里你会想要一个稳定的系统。 + +如果你想要最新的和最棒的 Linux 内核和软件,并且你不害怕花费一些时间在故障排除上(时常发生),你可以选择滚动发行版。 + +在这一点上,我还想提到 Manjaro Linux 的混合滚动发布模式。Manjaro 确实遵循滚动发布模式,你不必将系统升级到较新的版本。不过,Manjaro 也会对基本的软件组件进行测试,而不是盲目的向用户推出。这也是[为什么这么多人使用 Manjrao Linux][11] 的原因之一。 + +### 我讲清楚了吗? + +希望你现在对“滚动发行版”这个词有了稍微的了解。如果你对它仍有一些疑问,请留言,我会尽力回答。我可能会更新文章以涵盖你的问题。祝你愉快 :) + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/rolling-release/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/what-is-linux/ +[2]: https://linux.cn/article-12609-1.html +[3]: https://www.archlinux.org/ +[4]: https://www.gentoo.org/ +[5]: https://itsfoss.com/update-arch-linux/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/what-is-rolling-release-distribution.png?resize=800%2C450&ssl=1 +[7]: https://itsfoss.com/upgrade-ubuntu-version/ +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/updates-available-ubuntu.png?resize=800%2C433&ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/arch-linux-iso-refresh.png?resize=799%2C388&ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/rolling-vs-point-release-distribution.png?resize=800%2C350&ssl=1 +[11]: https://itsfoss.com/why-use-manjaro-linux/ From b0afee77875f3ebac6055ef1dacbaa8b84a37524 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 21 Sep 2020 20:42:40 +0800 Subject: [PATCH 0176/1156] APL --- sources/tech/20200916 Teach Python with Jupyter Notebooks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200916 Teach Python with Jupyter Notebooks.md b/sources/tech/20200916 Teach Python with Jupyter Notebooks.md index 43e488a6a3..31e9022e85 100644 --- a/sources/tech/20200916 Teach Python with Jupyter Notebooks.md +++ b/sources/tech/20200916 Teach Python with Jupyter Notebooks.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 56992179b927e248e5b5050762fa7367da554ac4 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 21 Sep 2020 21:36:33 +0800 Subject: [PATCH 0177/1156] TSL&PRF --- ...916 Teach Python with Jupyter Notebooks.md | 330 ------------------ ...916 Teach Python with Jupyter Notebooks.md | 322 +++++++++++++++++ 2 files changed, 322 insertions(+), 330 deletions(-) delete mode 100644 sources/tech/20200916 Teach Python with Jupyter Notebooks.md create mode 100644 translated/tech/20200916 Teach Python with Jupyter Notebooks.md diff --git a/sources/tech/20200916 Teach Python with Jupyter Notebooks.md b/sources/tech/20200916 Teach Python with Jupyter Notebooks.md deleted file mode 100644 index 31e9022e85..0000000000 --- a/sources/tech/20200916 Teach Python with Jupyter Notebooks.md +++ /dev/null @@ -1,330 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Teach Python with Jupyter Notebooks) -[#]: via: (https://opensource.com/article/20/9/teach-python-jupyter) -[#]: author: (Moshe Zadka https://opensource.com/users/moshez) - -Teach Python with Jupyter Notebooks -====== -With Jupyter, PyHamcrest, and a little duct tape of a testing harness, -you can teach any Python topic that is amenable to unit testing. -![Person reading a book and digital copy][1] - -Some things about the Ruby community have always impressed me. Two examples are the commitment to testing and the emphasis on making it easy to get started. The best example of both is [Ruby Koans][2], where you learn Ruby by fixing tests. - -With the amazing tools we have for Python, we should be able to do something even better. We can. Using [Jupyter Notebook][3], [PyHamcrest][4], and just a little bit of duct tape-like code, we can make a tutorial that includes teaching, code that works, and code that needs fixing. - -First, some duct tape. Usually, you do your tests using some nice command-line test runner, like [pytest][5] or [virtue][6]. Usually, you do not even run it directly. You use a tool like [tox][7] or [nox][8] to run it. However, for Jupyter, you need to write a little harness that can run the tests directly in the cells. - -Luckily, the harness is short, if not simple: ` ` - - -``` -import unittest - -def run_test(klass): -    suite = unittest.TestLoader().loadTestsFromTestCase(klass) -    unittest.TextTestRunner(verbosity=2).run(suite) -    return klass -``` - -Now that the harness is done, it's time for the first exercise. - -In teaching, it is always a good idea to start small with an easy exercise to build confidence. - -So why not fix a really simple test? - - -``` -@run_test -class TestNumbers(unittest.TestCase): -    -    def test_equality(self): -        expected_value = 3 # Only change this line -        self.assertEqual(1+1, expected_value) - -[/code] [code] - -    test_equality (__main__.TestNumbers) ... FAIL -    -    ====================================================================== -    FAIL: test_equality (__main__.TestNumbers) -    ---------------------------------------------------------------------- -    Traceback (most recent call last): -      File "<ipython-input-7-5ebe25bc00f3>", line 6, in test_equality -        self.assertEqual(1+1, expected_value) -    AssertionError: 2 != 3 -    -    ---------------------------------------------------------------------- -    Ran 1 test in 0.002s -    -    FAILED (failures=1) -``` - -`Only change this line` is a useful marker for students. It shows exactly what needs to be changed. Otherwise, students could fix the test by changing the first line to `return`. - -In this case, the fix is easy: ` ` - - -``` -@run_test -class TestNumbers(unittest.TestCase): -    -    def test_equality(self): -        expected_value = 2 # Fixed this line -        self.assertEqual(1+1, expected_value) - -[/code] [code] - -    test_equality (__main__.TestNumbers) ... ok -    -    ---------------------------------------------------------------------- -    Ran 1 test in 0.002s -    -    OK -``` - -Quickly, however, the `unittest` library's native assertions will prove lacking. In `pytest`, this is fixed with rewriting the bytecode in `assert` to have magical properties and all kinds of heuristics. This would not work easily in a Jupyter notebook. Time to dig out a good assertion library: PyHamcrest: - - -``` -`from hamcrest import *`[/code] [code] - -@run_test -class TestList(unittest.TestCase): -    -    def test_equality(self): -        things = [1, -                  5, # Only change this line -                  3] -        assert_that(things, has_items(1, 2, 3)) - -[/code] [code] - -    test_equality (__main__.TestList) ... FAIL -    -    ====================================================================== -    FAIL: test_equality (__main__.TestList) -    ---------------------------------------------------------------------- -    Traceback (most recent call last): -      File "<ipython-input-11-96c91225ee7d>", line 8, in test_equality -        assert_that(things, has_items(1, 2, 3)) -    AssertionError: -    Expected: (a sequence containing <1> and a sequence containing <2> and a sequence containing <3>) -         but: a sequence containing <2> was <[1, 5, 3]> -    -    -    ---------------------------------------------------------------------- -    Ran 1 test in 0.004s -    -    FAILED (failures=1) -``` - -PyHamcrest is not just good at flexible assertions; it is also good at clear error messages. Because of that, the problem is plain to see: `[1, 5, 3]` does not contain `2`, and it looks ugly besides: - - -``` -@run_test -class TestList(unittest.TestCase): -    -    def test_equality(self): -        things = [1, -                  2, # Fixed this line -                  3] -        assert_that(things, has_items(1, 2, 3)) - -[/code] [code] - -    test_equality (__main__.TestList) ... ok -    -    ---------------------------------------------------------------------- -    Ran 1 test in 0.001s -    -    OK -``` - -With Jupyter, PyHamcrest, and a little duct tape of a testing harness, you can teach any Python topic that is amenable to unit testing. - -For example, the following can help show the differences between the different ways Python can strip whitespace from a string: - - -``` -source_string = "  hello world  " - -@run_test -class TestList(unittest.TestCase): -    -    # This one is a freebie: it already works! -    def test_complete_strip(self): -        result = source_string.strip() -        assert_that(result, -                   all_of(starts_with("hello"), ends_with("world"))) - -    def test_start_strip(self): -        result = source_string # Only change this line -        assert_that(result, -                   all_of(starts_with("hello"), ends_with("world  "))) - -    def test_end_strip(self): -        result = source_string # Only change this line -        assert_that(result, -                   all_of(starts_with("  hello"), ends_with("world"))) - -[/code] [code] - -    test_complete_strip (__main__.TestList) ... ok -    test_end_strip (__main__.TestList) ... FAIL -    test_start_strip (__main__.TestList) ... FAIL -    -    ====================================================================== -    FAIL: test_end_strip (__main__.TestList) -    ---------------------------------------------------------------------- -    Traceback (most recent call last): -      File "<ipython-input-16-3db7465bd5bf>", line 19, in test_end_strip -        assert_that(result, -    AssertionError: -    Expected: (a string starting with '  hello' and a string ending with 'world') -         but: a string ending with 'world' was '  hello world  ' -    -    -    ====================================================================== -    FAIL: test_start_strip (__main__.TestList) -    ---------------------------------------------------------------------- -    Traceback (most recent call last): -      File "<ipython-input-16-3db7465bd5bf>", line 14, in test_start_strip -        assert_that(result, -    AssertionError: -    Expected: (a string starting with 'hello' and a string ending with 'world  ') -         but: a string starting with 'hello' was '  hello world  ' -    -    -    ---------------------------------------------------------------------- -    Ran 3 tests in 0.006s -    -    FAILED (failures=2) -``` - -Ideally, students would realize that the methods `.lstrip()` and `.rstrip()` will do what they need. But if they do not and instead try to use `.strip()` everywhere: - - -``` -source_string = "  hello world  " - -@run_test -class TestList(unittest.TestCase): -    -    # This one is a freebie: it already works! -    def test_complete_strip(self): -        result = source_string.strip() -        assert_that(result, -                   all_of(starts_with("hello"), ends_with("world"))) - -    def test_start_strip(self): -        result = source_string.strip() # Changed this line -        assert_that(result, -                   all_of(starts_with("hello"), ends_with("world  "))) - -    def test_end_strip(self): -        result = source_string.strip() # Changed this line -        assert_that(result, -                   all_of(starts_with("  hello"), ends_with("world"))) - -[/code] [code] - -    test_complete_strip (__main__.TestList) ... ok -    test_end_strip (__main__.TestList) ... FAIL -    test_start_strip (__main__.TestList) ... FAIL -    -    ====================================================================== -    FAIL: test_end_strip (__main__.TestList) -    ---------------------------------------------------------------------- -    Traceback (most recent call last): -      File "<ipython-input-17-6f9cfa1a997f>", line 19, in test_end_strip -        assert_that(result, -    AssertionError: -    Expected: (a string starting with '  hello' and a string ending with 'world') -         but: a string starting with '  hello' was 'hello world' -    -    -    ====================================================================== -    FAIL: test_start_strip (__main__.TestList) -    ---------------------------------------------------------------------- -    Traceback (most recent call last): -      File "<ipython-input-17-6f9cfa1a997f>", line 14, in test_start_strip -        assert_that(result, -    AssertionError: -    Expected: (a string starting with 'hello' and a string ending with 'world  ') -         but: a string ending with 'world  ' was 'hello world' -    -    -    ---------------------------------------------------------------------- -    Ran 3 tests in 0.007s -    -    FAILED (failures=2) -``` - -They would get a different error message that shows too much space has been stripped: - - -``` -source_string = "  hello world  " - -@run_test -class TestList(unittest.TestCase): -    -    # This one is a freebie: it already works! -    def test_complete_strip(self): -        result = source_string.strip() -        assert_that(result, -                   all_of(starts_with("hello"), ends_with("world"))) - -    def test_start_strip(self): -        result = source_string.lstrip() # Fixed this line -        assert_that(result, -                   all_of(starts_with("hello"), ends_with("world  "))) - -    def test_end_strip(self): -        result = source_string.rstrip() # Fixed this line -        assert_that(result, -                   all_of(starts_with("  hello"), ends_with("world"))) - -[/code] [code] - -    test_complete_strip (__main__.TestList) ... ok -    test_end_strip (__main__.TestList) ... ok -    test_start_strip (__main__.TestList) ... ok -    -    ---------------------------------------------------------------------- -    Ran 3 tests in 0.005s -    -    OK -``` - -In a more realistic tutorial, there would be more examples and more explanations. This technique using a notebook with some examples that work and some that need fixing can work for real-time teaching, a video-based class, or even, with a lot more prose, a tutorial the student can complete on their own. - -Now go out there and share your knowledge! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/9/teach-python-jupyter - -作者:[Moshe Zadka][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://opensource.com/users/moshez -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/read_book_guide_tutorial_teacher_student_apaper.png?itok=_GOufk6N (Person reading a book and digital copy) -[2]: https://github.com/edgecase/ruby_koans -[3]: https://jupyter.org/ -[4]: https://github.com/hamcrest/PyHamcrest -[5]: https://docs.pytest.org/en/stable/ -[6]: https://github.com/Julian/Virtue -[7]: https://tox.readthedocs.io/en/latest/ -[8]: https://nox.thea.codes/en/stable/ diff --git a/translated/tech/20200916 Teach Python with Jupyter Notebooks.md b/translated/tech/20200916 Teach Python with Jupyter Notebooks.md new file mode 100644 index 0000000000..d4c9ac5be0 --- /dev/null +++ b/translated/tech/20200916 Teach Python with Jupyter Notebooks.md @@ -0,0 +1,322 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Teach Python with Jupyter Notebooks) +[#]: via: (https://opensource.com/article/20/9/teach-python-jupyter) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +用 Jupyter Notebooks 教 Python +====== + +> 有了 Jupyter、PyHamcrest 和一点测试的代码把它们连在一起,你可以教任何可以进行单元测试的 Python 内容。 + +![Person reading a book and digital copy][1] + +关于 Ruby 社区的一些事情一直让我印象深刻。其中两个例子是对测试的承诺和对易于上手的强调。这两方面最好的例子是 [Ruby Koans][2],在这里你可以通过修复测试来学习 Ruby。 + +要是我们能把这些神奇的工具也用于 Python,我们应该可以做得更好。是的,使用 [Jupyter Notebook][3]、[PyHamcrest][4],再加上一点类似于胶带的粘合代码,我们可以做出一个包括教学、可工作的代码和需要修复的代码的教程。 + +首先,需要一些“胶布”。通常,你会使用一些漂亮的命令行测试器来做测试,比如 [pytest][5] 或 [virtue][6]。通常,你甚至不会直接运行它。你使用像 [tox][7] 或 [nox][8] 这样的工具来运行它。然而,对于 Jupyter 来说,你需要写一小段粘合代码,可以直接在其中运行测试。 + +幸运的是,这个代码又短又简单: + +``` +import unittest + +def run_test(klass): +    suite = unittest.TestLoader().loadTestsFromTestCase(klass) +    unittest.TextTestRunner(verbosity=2).run(suite) +    return klass +``` + +现在,装备已经就绪,可以进行第一次练习了。 + +在教学中,从一个简单的练习开始,建立信心总是一个好主意。 + +那么,让我们来修复一个非常简单的测试: + +``` +@run_test +class TestNumbers(unittest.TestCase): + + def test_equality(self): + expected_value = 3 # 只改这一行 + self.assertEqual(1+1, expected_value) +``` + +``` + test_equality (__main__.TestNumbers) ... FAIL + + ====================================================================== + FAIL: test_equality (__main__.TestNumbers) + ---------------------------------------------------------------------- + Traceback (most recent call last): + File "", line 6, in test_equality + self.assertEqual(1+1, expected_value) + AssertionError: 2 != 3 + + ---------------------------------------------------------------------- + Ran 1 test in 0.002s + + FAILED (failures=1) +``` + +“只改这一行” 对学生来说是一个有用的标记。它准确地表明了需要修改的内容。否则,学生可以通过将第一行改为 `return` 来修正测试。 + +在这种情况下,修复很容易: + +``` +@run_test +class TestNumbers(unittest.TestCase): + + def test_equality(self): + expected_value = 2 # 修复后的代码行 + self.assertEqual(1+1, expected_value) +``` + +``` + test_equality (__main__.TestNumbers) ... ok + + ---------------------------------------------------------------------- + Ran 1 test in 0.002s + + OK +``` + +然而,很快,`unittest` 库的原生断言将被证明是不够的。在 `pytest` 中,通过重写 `assert`中的字节码来解决这个问题,使其具有神奇的属性和各种启发式方法。但这在 Jupyter notebook 中就不容易实现了。是时候挖出一个好的断言库了:PyHamcrest。 + +``` +from hamcrest import * +@run_test +class TestList(unittest.TestCase): + + def test_equality(self): + things = [1, + 5, # 只改这一行 + 3] + assert_that(things, has_items(1, 2, 3)) +``` + +``` + test_equality (__main__.TestList) ... FAIL + + ====================================================================== + FAIL: test_equality (__main__.TestList) + ---------------------------------------------------------------------- + Traceback (most recent call last): + File "", line 8, in test_equality + assert_that(things, has_items(1, 2, 3)) + AssertionError: + Expected: (a sequence containing <1> and a sequence containing <2> and a sequence containing <3>) + but: a sequence containing <2> was <[1, 5, 3]> + + + ---------------------------------------------------------------------- + Ran 1 test in 0.004s + + FAILED (failures=1) +``` + +PyHamcrest 不仅擅长灵活的断言,它还擅长清晰的错误信息。正因为如此,问题就显而易见了。`[1, 5, 3]` 不包含 `2`,而且看起来很丑: + +``` +@run_test +class TestList(unittest.TestCase): + + def test_equality(self): + things = [1, + 2, # 改完的行 + 3] + assert_that(things, has_items(1, 2, 3)) +``` + +``` + test_equality (__main__.TestList) ... ok + + ---------------------------------------------------------------------- + Ran 1 test in 0.001s + + OK +``` + +使用 Jupyter、PyHamcrest 和一点测试的粘合代码,你可以教授任何可以进行单元测试的 Python 主题。 + +例如,下面可以帮助展示 Python 从字符串中去掉空白的不同方法之间的差异。 + +``` +source_string = " hello world " + +@run_test +class TestList(unittest.TestCase): + + # 这是个赠品:它可以工作! + def test_complete_strip(self): + result = source_string.strip() + assert_that(result, + all_of(starts_with("hello"), ends_with("world"))) + + def test_start_strip(self): + result = source_string # 只改这一行 + assert_that(result, + all_of(starts_with("hello"), ends_with("world "))) + + def test_end_strip(self): + result = source_string # 只改这一行 + assert_that(result, + all_of(starts_with(" hello"), ends_with("world"))) +``` + +``` + test_complete_strip (__main__.TestList) ... ok + test_end_strip (__main__.TestList) ... FAIL + test_start_strip (__main__.TestList) ... FAIL + + ====================================================================== + FAIL: test_end_strip (__main__.TestList) + ---------------------------------------------------------------------- + Traceback (most recent call last): + File "", line 19, in test_end_strip + assert_that(result, + AssertionError: + Expected: (a string starting with ' hello' and a string ending with 'world') + but: a string ending with 'world' was ' hello world ' + + + ====================================================================== + FAIL: test_start_strip (__main__.TestList) + ---------------------------------------------------------------------- + Traceback (most recent call last): + File "", line 14, in test_start_strip + assert_that(result, + AssertionError: + Expected: (a string starting with 'hello' and a string ending with 'world ') + but: a string starting with 'hello' was ' hello world ' + + + ---------------------------------------------------------------------- + Ran 3 tests in 0.006s + + FAILED (failures=2) +``` + +理想情况下,学生们会意识到 `.lstrip()` 和 `.rstrip()` 这两个方法可以满足他们的需要。但如果他们不这样做,而是试图到处使用 `.strip()` 的话: + +``` +source_string = " hello world " + +@run_test +class TestList(unittest.TestCase): + + # 这是个赠品:它可以工作! + def test_complete_strip(self): + result = source_string.strip() + assert_that(result, + all_of(starts_with("hello"), ends_with("world"))) + + def test_start_strip(self): + result = source_string.strip() # 改完的行 + assert_that(result, + all_of(starts_with("hello"), ends_with("world "))) + + def test_end_strip(self): + result = source_string.strip() # 改完的行 + assert_that(result, + all_of(starts_with(" hello"), ends_with("world"))) +``` + +``` + test_complete_strip (__main__.TestList) ... ok + test_end_strip (__main__.TestList) ... FAIL + test_start_strip (__main__.TestList) ... FAIL + + ====================================================================== + FAIL: test_end_strip (__main__.TestList) + ---------------------------------------------------------------------- + Traceback (most recent call last): + File "", line 19, in test_end_strip + assert_that(result, + AssertionError: + Expected: (a string starting with ' hello' and a string ending with 'world') + but: a string starting with ' hello' was 'hello world' + + + ====================================================================== + FAIL: test_start_strip (__main__.TestList) + ---------------------------------------------------------------------- + Traceback (most recent call last): + File "", line 14, in test_start_strip + assert_that(result, + AssertionError: + Expected: (a string starting with 'hello' and a string ending with 'world ') + but: a string ending with 'world ' was 'hello world' + + + ---------------------------------------------------------------------- + Ran 3 tests in 0.007s + + FAILED (failures=2) +``` + +他们会得到一个不同的错误信息,显示去除了太多的空白: + +``` +source_string = " hello world " + +@run_test +class TestList(unittest.TestCase): + + # This one is a freebie: it already works! + def test_complete_strip(self): + result = source_string.strip() + assert_that(result, + all_of(starts_with("hello"), ends_with("world"))) + + def test_start_strip(self): + result = source_string.lstrip() # Fixed this line + assert_that(result, + all_of(starts_with("hello"), ends_with("world "))) + + def test_end_strip(self): + result = source_string.rstrip() # Fixed this line + assert_that(result, + all_of(starts_with(" hello"), ends_with("world"))) +``` + +``` + test_complete_strip (__main__.TestList) ... ok + test_end_strip (__main__.TestList) ... ok + test_start_strip (__main__.TestList) ... ok + + ---------------------------------------------------------------------- + Ran 3 tests in 0.005s + + OK +``` + +在一个比较真实的教程中,会有更多的例子和更多的解释。这种使用 Jupyter Notebooks 的技巧,有的例子可以用,有的例子需要修正,可以用于实时教学,可以用于视频课,甚至,可以用更多的其它零散用途,让学生自己完成一个教程。 + +现在就去分享你的知识吧! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/teach-python-jupyter + +作者:[Moshe Zadka][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://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/read_book_guide_tutorial_teacher_student_apaper.png?itok=_GOufk6N (Person reading a book and digital copy) +[2]: https://github.com/edgecase/ruby_koans +[3]: https://jupyter.org/ +[4]: https://github.com/hamcrest/PyHamcrest +[5]: https://docs.pytest.org/en/stable/ +[6]: https://github.com/Julian/Virtue +[7]: https://tox.readthedocs.io/en/latest/ +[8]: https://nox.thea.codes/en/stable/ From 7b4aa538ff2c17f37e9252954ed3d4e7a6435c74 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 21 Sep 2020 22:30:58 +0800 Subject: [PATCH 0178/1156] PRF @geekpi --- ...ommand to create flexible file listings.md | 92 +++++++++---------- 1 file changed, 45 insertions(+), 47 deletions(-) diff --git a/translated/tech/20200909 Using the Linux stat command to create flexible file listings.md b/translated/tech/20200909 Using the Linux stat command to create flexible file listings.md index 99e9d6c5a0..e36fb85f5b 100644 --- a/translated/tech/20200909 Using the Linux stat command to create flexible file listings.md +++ b/translated/tech/20200909 Using the Linux stat command to create flexible file listings.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Using the Linux stat command to create flexible file listings) @@ -10,13 +10,15 @@ 使用 Linux stat 命令创建灵活的文件列表 ====== -**stat** 命令提供了很多关于文件的详细信息。 +![](https://img.linux.net.cn/data/attachment/album/202009/21/223030wi3xfx2eprij13z2.jpg) -它不仅提供了文件最近变化的日期/时间,还显示了最近访问文件的时间和权限变化。它可以同时告诉你文件的字节大小和块的数量。它显示文件使用的 inode 以及文件类型。它包括文件所有者和相关用户组的名称和 UID/GID。它以 “rwx”(被称为 "人类可读 "格式)和数字方式显示文件权限。在某些系统中,它甚至可能包括文件创建的日期和时间(称为"出生")。 +`stat` 命令提供了很多关于文件的详细信息。 -除了提供所有这些信息外,**stat** 命令还可以用来创建文件列表。这些列表非常灵活,你可以选择包含上述任何或全部信息。 +它不仅提供了文件最近变化的日期/时间,还显示了最近访问文件的时间和权限变化。它可以同时告诉你文件的字节大小和块的数量。它可以显示文件使用的 inode 以及文件类型。它包括了文件所有者和相关用户组的名称和 UID/GID。它以 “rwx”(被称为 “人类可读” 格式)和数字方式显示文件权限。在某些系统中,它甚至可能包括文件创建的日期和时间(称为“出生”)。 -要生成一个自定义列表,你只需要使用 **stat** 命令的 **-c**(或 --**format**)选项,并指定你想要包含的字段。例如,要创建一个以两种格式显示文件权限的列表,使用这个命令: +除了提供所有这些信息外,`stat` 命令还可以用来创建文件列表。这些列表非常灵活,你可以选择包含上述任何或全部信息。 + +要生成一个自定义列表,你只需要使用 `stat` 命令的 `-c`(或 `--format`)选项,并指定你想要包含的字段。例如,要创建一个以两种格式显示文件权限的列表,使用这个命令: ``` $ stat -c '%n %a %A' my* @@ -33,15 +35,15 @@ mytwin 50 -rw-r----- mywords 664 -rw-rw-r-- ``` -如上例所示,**%n** 代表文件名,**%a** 代表八进制的权限,**%A** 代表 **rwx** 形式的权限。完整的列表如下所示。 +如上例所示,`%n` 代表文件名,`%a` 代表八进制的权限,`%A` 代表 `rwx` 形式的权限。完整的列表如后面所示。 -要为这个命令创建一个别名,输入这个,或在 **.bashrc** 文件中添加这个定义。 +要为这个命令创建一个别名,输入这个命令,或在 `.bashrc` 文件中添加这个定义。 ``` $ alias ls_perms="stat -c '%n %a %A'" ``` -要创建一个非常接近 **ls -l** 提供的长列表,可以这样做: +要创建一个非常接近 `ls -l` 提供的长列表,可以这样做: ``` $ stat -c '%A %h %U %G %s %y %n' my* @@ -58,9 +60,9 @@ lrwxrwxrwx 1 shs shs 11 2020-05-28 18:49:21.666792608 -0400 myjunk -rw-rw-r-- 1 shs shs 1983 2020-08-10 14:39:57.164842370 -0400 mywords ``` -不同之处包括: 1) 不试图将字段排成可辨认的一列,2) 日期是 _**yy-mm-dd**_ 格式,3) 时间字段更精确,4) 增加了时区(-0400 是 EDT)。 +不同之处包括: 1、不试图将字段排成可辨认的一列,2、日期是 `yy-mm-dd` 格式,3、时间字段更精确,4、增加了时区(-0400 是 EDT)。 -如果你想根据最后一次访问的日期来列出文件(例如,用 **cat** 命令来显示),使用这样的命令: +如果你想根据最后一次访问的日期来列出文件(例如,用 `cat` 命令来显示),使用这样的命令: ``` $ stat -c '%n %x' my* | sort -k2 @@ -77,44 +79,40 @@ my.banner 2020-09-07 13:22:38.105826116 -0400 mydir 2020-09-07 14:53:10.171867194 -0400 ``` -用 **stat** 列出文件细节时,可用的选项包括: +用 `stat` 列出文件细节时,可用的选项包括: - * %a - 八进制的访问权限(注意 “#”和 “0” printf标志)。 - * %A – 人类可读的访问权限; - * %b – 分配的块数(见 %B)。 - * %B – %b 报告的每个块的字节数。 - * %C – SELinux 安全上下文字符串。 - * %d – 十进制的设备编号 - * %D – 十六进制的设备编号 - * %f – 十六进制的原始模式 - * %F – 文件类型 - * %g – 所有者的组 ID - * %G – 所有者的组名 - * %h – 硬链接的数量 - * %i – inode 编号 - * %m – 挂载点 - * %n – 文件名 - * %N – 如果是符号链接,则引用的文件名会解引用。 - * %o – 最佳 I/O 传输大小提示 - * %s – 以字节为单位的总大小。 - * %t – 十六进制的主要设备类型,用于字符/块设备特殊文件。 - * %T – 十六进制的次要设备类型,用于字符/块设备特殊文件。 - * %u – 所有者的用户 ID - * %U – 所有者的用户名 - * %w – 文件创建时间,以人类可读形式; 如果未知,则为 -。 - * %W – 文件创建时间,以纪元以来的秒数形式;如果未知,则为 0。 - * %x – 上次访问时间,以人类可读形式。 - * %X – 上次访问时间,以纪元以来的秒数形式。 - * %y – 上次数据修改时间,以人类可读形式。 - * %Y – 上次数据修改时间,以纪元以来的秒数形式。 - * %z – 上次状态改变的时间,以人类可读形式。 - * %Z – 上次状态改变的时间,以纪元以来的秒数形式。 + * `%a` - 八进制的访问权限(注意 `#` 和 `0` 的 printf 标志) + * `%A` – 人类可读的访问权限 + * `%b` – 分配的块数(见 `%B`) + * `%B` – `%b` 报告的每个块的字节数 + * `%C` – SELinux 安全上下文字符串 + * `%d` – 十进制的设备编号 + * `%D` – 十六进制的设备编号 + * `%f` – 十六进制的原始模式 + * `%F` – 文件类型 + * `%g` – 所有者的组 ID + * `%G` – 所有者的组名 + * `%h` – 硬链接的数量 + * `%i` – inode 编号 + * `%m` – 挂载点 + * `%n` – 文件名 + * `%N` – 如果是符号链接,会解引用为指向的文件名 + * `%o` – 最佳 I/O 传输大小提示 + * `%s` – 以字节为单位的总大小 + * `%t` – 十六进制的主要设备类型,用于字符/块设备特殊文件 + * `%T` – 十六进制的次要设备类型,用于字符/块设备特殊文件 + * `%u` – 所有者的用户 ID + * `%U` – 所有者的用户名 + * `%w` – 文件创建时间,以人类可读形式; 如果未知,则为 `-`。 + * `%W` – 文件创建时间,以 UNIX 纪元以来的秒数形式;如果未知,则为 `0`。 + * `%x` – 上次访问时间,以人类可读形式 + * `%X` – 上次访问时间,以 UNIX 纪元以来的秒数形式 + * `%y` – 上次数据修改时间,以人类可读形式 + * `%Y` – 上次数据修改时间,以 UNIX 纪元以来的秒数形式 + * `%z` – 上次状态改变的时间,以人类可读形式 + * `%Z` – 上次状态改变的时间,以 UNIX 纪元以来的秒数形式 - - -这些字段的选择都列在手册页中,你可以选择任何一个,不过用你喜欢的选项创建一些别名应该可以省去很多麻烦。有些选项,如 SELinux 安全上下文字符串,除非在系统中有使用,它将无法使用。文件创建只有在你的系统保留该信息的情况下才能使用。 - -加入 [Facebook][2] 和 [LinkedIn][3] 上的 Network World 社区,评论热门主题。 +这些字段的选择都列在手册页中,你可以选择任何一个,不过用你喜欢的选项创建一些别名应该可以省去很多麻烦。有些选项,如 SELinux 安全上下文字符串,除非在系统中有使用,它将不可用。文件创建时间只有在你的系统保留该信息的情况下才可用。 -------------------------------------------------------------------------------- @@ -123,7 +121,7 @@ via: https://www.networkworld.com/article/3573802/using-the-linux-stat-command-t 作者:[Sandra Henry-Stocker][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From c0f7703905a7d5a705731ea0cb5cdd57dad26e15 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 21 Sep 2020 22:32:39 +0800 Subject: [PATCH 0179/1156] PUB @geekpi https://linux.cn/article-12637-1.html --- ...the Linux stat command to create flexible file listings.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200909 Using the Linux stat command to create flexible file listings.md (98%) diff --git a/translated/tech/20200909 Using the Linux stat command to create flexible file listings.md b/published/20200909 Using the Linux stat command to create flexible file listings.md similarity index 98% rename from translated/tech/20200909 Using the Linux stat command to create flexible file listings.md rename to published/20200909 Using the Linux stat command to create flexible file listings.md index e36fb85f5b..866f29bba6 100644 --- a/translated/tech/20200909 Using the Linux stat command to create flexible file listings.md +++ b/published/20200909 Using the Linux stat command to create flexible file listings.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12637-1.html) [#]: subject: (Using the Linux stat command to create flexible file listings) [#]: via: (https://www.networkworld.com/article/3573802/using-the-linux-stat-command-to-create-flexible-file-listings.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) From 810aa21f0031cc1493fe0879f281ac8c532b2438 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 22 Sep 2020 05:03:40 +0800 Subject: [PATCH 0180/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200922?= =?UTF-8?q?=20Give=20Your=20GNOME=20Desktop=20a=20Tiling=20Makeover=20With?= =?UTF-8?q?=20Material=20Shell=20GNOME=20Extension?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200922 Give Your GNOME Desktop a Tiling Makeover With Material Shell GNOME Extension.md --- ...ver With Material Shell GNOME Extension.md | 128 ++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 sources/tech/20200922 Give Your GNOME Desktop a Tiling Makeover With Material Shell GNOME Extension.md diff --git a/sources/tech/20200922 Give Your GNOME Desktop a Tiling Makeover With Material Shell GNOME Extension.md b/sources/tech/20200922 Give Your GNOME Desktop a Tiling Makeover With Material Shell GNOME Extension.md new file mode 100644 index 0000000000..b273ef33b3 --- /dev/null +++ b/sources/tech/20200922 Give Your GNOME Desktop a Tiling Makeover With Material Shell GNOME Extension.md @@ -0,0 +1,128 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Give Your GNOME Desktop a Tiling Makeover With Material Shell GNOME Extension) +[#]: via: (https://itsfoss.com/material-shell/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Give Your GNOME Desktop a Tiling Makeover With Material Shell GNOME Extension +====== + +There is something about tiling windows that attracts many people. Perhaps it looks good or perhaps it is time-saving if you are a fan of [keyboard shortcuts in Linux][1]. Or maybe it’s the challenge of using the uncommon tiling windows. + +![Tiling Windows in Linux | Image Source][2] + +From i3 to [Sway][3], there are so many tiling window managers available for Linux desktop. Configuring a tiling window manager itself requires a steep learning curve. + +This is why projects like [Regolith desktop][4] exist to give you preconfigured tiling desktop so that you can get started with tiling windows with less effort. + +Let me introduce you to a similar project named Material Shell that makes using tiling feature even easier than [Regolith][5]. + +### Material Shell GNOME Extension: Convert GNOME desktop into a tiling window manager + +[Material Shell][6] is a GNOME extension and that’s the best thing about it. This means that you don’t have to log out and log in to another desktop environment or window manager. You can enable or disable it from within your current session. + +I’ll list the features of Material Shell but it will be easier to see it in action: + +[Subscribe to our YouTube channel for more Linux videos][7] + +The project is called Material Shell because it follows the [Material Design][8] guideline and thus gives the applications an aesthetically pleasing interface. Here are its main features: + +#### Intuitive interface + +Material Shell adds a left panel for quick access. On this panel, you can find the system tray at the bottom and the search and workspaces on the top. + +All the new apps are added to the current workspace. You can create new workspace and switch to it for organizing your running apps into categories. This is the essential concept of workspace anyway. + +In Material Shell, every workspace can be visualized as a row with several apps rather than a box with several apps in it. + +#### Tiling windows + +In a workspace, you can see all your opened applications on the top all the time. By default, the applications are opened to take the entire screen like you do in GNOME desktop. You can change the layout to split it in half or multiple columns or a grid of apps using the layout changer in the top right corner. + +This video shows all the above features at a glance: + +#### Persistent layout and workspaces + +That’s not it. Material Shell also remembers the workspaces and windows you open so that you don’t have to reorganize your layout again. This is a good feature to have as it saves time if you are particular about which application goes where. + +#### Hotkeys/Keyboard shortcut + +Like any tiling windows manager, you can use keyboard shortcuts to navigate between applications and workspaces. + + * `Super+W` Navigate to the upper workspace. + * `Super+S` Navigate to the lower workspace. + * `Super+A` Focus the window at the left of the current window. + * `Super+D` Focus the window at the right of the current window. + * `Super+1`, `Super+2` … `Super+0` Navigate to specific workspace + * `Super+Q` Kill the current window focused. + * `Super+[MouseDrag]` Move window around. + * `Super+Shift+A` Move the current window to the left. + * `Super+Shift+D` Move the current window to the right. + * `Super+Shift+W` Move the current window to the upper workspace. + * `Super+Shift+S` Move the current window to the lower workspace. + + + +### Installing Material Shell + +Warning! + +Tiling windows could be confusing for many users. You should be familiar with GNOME Extensions to use it. Avoid trying it if you are absolutely new to Linux or if you are easily panicked if anything changes in your system. + +Material Shell is a GNOME extension. So, please [check your desktop environment][9] to make sure you are running _**GNOME 3.34 or higher version**_. + +I would also like to add that tiling windows could be confusing for many users. + +Apart from that, I noticed that after disabling Material Shell it removes the top bar from Firefox and the Ubuntu dock. You can get the dock back by disabling/enabling Ubuntu dock extension from the Extensions app in GNOME. I haven’t tried but I guess these problems should also go away after a system reboot. + +I hope you know [how to use GNOME extensions][10]. The easiest way is to just [open this link in the browser][11], install GNOME extension plugin and then enable the Material Shell extension. + +![][12] + +If you don’t like it, you can disable it from the same extension link you used earlier or use the GNOME Extensions app: + +![][13] + +**To tile or not?** + +I use multiple screens and I found that Material Shell doesn’t work well with multiple monitors. This is something the developer(s) can improve in the future. + +Apart from that, it’s a really easy to get started with tiling windows with Material Shell. If you try Material Shell and like it, appreciate the project by [giving it a star or sponsoring it on GitHub][14]. + +For some reasons, tiling windows are getting popular. Recently released [Pop OS 20.04][15] also added tiling window features. + +But as I mentioned previously, tiling layouts are not for everyone and it could confuse many people. + +How about you? Do you prefer tiling windows or you prefer the classic desktop layout? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/material-shell/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/ubuntu-shortcuts/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/linux-ricing-example-800x450.jpg?resize=800%2C450&ssl=1 +[3]: https://itsfoss.com/sway-window-manager/ +[4]: https://itsfoss.com/regolith-linux-desktop/ +[5]: https://regolith-linux.org/ +[6]: https://material-shell.com +[7]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[8]: https://material.io/ +[9]: https://itsfoss.com/find-desktop-environment/ +[10]: https://itsfoss.com/gnome-shell-extensions/ +[11]: https://extensions.gnome.org/extension/3357/material-shell/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/install-material-shell.png?resize=800%2C307&ssl=1 +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/material-shell-gnome-extension.png?resize=799%2C497&ssl=1 +[14]: https://github.com/material-shell/material-shell +[15]: https://itsfoss.com/pop-os-20-04-review/ From 9a53a521388409091f52ece3bbc8142a1d82a25f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 22 Sep 2020 05:03:57 +0800 Subject: [PATCH 0181/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200921?= =?UTF-8?q?=20Teach=20Python=20with=20the=20Mu=20editor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200921 Teach Python with the Mu editor.md --- ...0200921 Teach Python with the Mu editor.md | 162 ++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 sources/tech/20200921 Teach Python with the Mu editor.md diff --git a/sources/tech/20200921 Teach Python with the Mu editor.md b/sources/tech/20200921 Teach Python with the Mu editor.md new file mode 100644 index 0000000000..1cfecc9304 --- /dev/null +++ b/sources/tech/20200921 Teach Python with the Mu editor.md @@ -0,0 +1,162 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Teach Python with the Mu editor) +[#]: via: (https://opensource.com/article/20/9/teach-python-mu) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +Teach Python with the Mu editor +====== +Mu makes it easy to learn how to write Python code. +![Hands on a keyboard with a Python book ][1] + +Teaching kids to code is very popular in schools. Many years ago, in the days of the Apple II and [Logo][2] programming, I learned about turtle graphics. I enjoyed learning how to program the virtual turtle and later helping students to do the same. + +About five years ago, I learned about [Python's turtle module][3], and it was the segue to my Python journey. Soon, I started using the turtle module to teach students Python programming basics, including using it to create interesting graphics. + +### Get started with Python's turtle module + +On a Linux or macOS computer, you can just open a terminal, enter the word `python`, and you'll see the Python shell. + +If you are using a Windows computer, you will need to install Python first by going to the Python website and [downloading][4] the latest stable version. + +Next, import the turtle module into Python with `import turtle `or `import turtle as t`. Then you can start having some fun creating turtle graphics. + +### Meet Mu + +In the early days of my Python adventure, I used [IDLE][5], Python's integrated development environment. It was much easier than entering commands into the Python shell, plus I could write and save programs for later use. I took some online courses and read many excellent books about Python programming. I taught teachers and students how to create turtle graphics using IDLE. + +IDLE was a big improvement, but at PyConUS 2019 in Cleveland, I saw a presentation by [Nicholas Tollervey][6] that changed the way I learned and taught Python. Nick is an educator who created [Mu][7], a Python editor specifically for young programmers (and even older ones like me). Mu can be installed on Linux, macOS, and Windows. It's easy to use and comes with excellent [documentation][8] and [tutorials][9]. + +On Linux, you can install Mu from the command line. + +On Ubuntu or Debian: + + +``` +`$ sudo apt install mu-editor` +``` + +On Fedora or similar: + + +``` +`$ sudo dnf install mu` +``` + +Or, you can use Python to do the install. First, ensure you have Python 3 installed: + + +``` +`$ python --version` +``` + +If that fails, try: + + +``` +`$ python3 --version` +``` + +Assuming you have Python version 3 or better, install Mu using `pip`, the Python package manager: + + +``` +`$ python -m pip install mu-editor --user` +``` + +Then you can run Mu from the command line or create a shortcut using: + + +``` +`$ python -m pip install shortcut mu-editor --user` +``` + +Mu is installed by default on the [Raspberry Pi][10], which is a great plus. In the past couple of years, I have introduced students to the Raspberry Pi and Python programming using the Mu editor. + +### How to teach Python with Mu + +Mu is a great way to show students how easy it is to get started with Python. Here's how I teach my students to start using it. + + 1. Open the Mu editor. + +![Mu editor][11] + +(Don Watkins, [CC BY-SA 4.0][12]) + + 2. Enter `import turtle` to import the Turtle module, so you can get the turtle moving. My first lesson is drawing a simple square in Python code. + +![Mu editor][13] + +(Don Watkins, [CC BY-SA 4.0][12]) + + 3. Save this program, making sure that the file name ends in .py. + +![Saving program in Mu][14] + +(Don Watkins, [CC BY-SA 4.0][12]) + + 4. Run the program. Running even a simple program like this is energizing—it's fun to see the graphical output of a program you wrote. + +![Running Python program in Mu][15] + +(Don Watkins, [CC BY-SA 4.0][12]) + + + + +### Beyond the basics + +After this simple lesson, I explain that there are some ways to simplify and expand on the basics the students have learned. One is creating a simpler turtle object, `import turtle as t`. Then I introduce a `for` loop as another way to draw a square with the turtle. + +![for loops in Python with Mu][16] + +(Don Watkins, [CC BY-SA 4.0][12]) + +Next, I show how to create a `my_square` function as another way to draw a square. + +![my_square function][17] + +(Don Watkins, [CC BY-SA 4.0][12]) + +Later, I expand on this concept by introducing other turtle module methods, including `penup`, `pendown`, and `pencolor`. Soon, my students are developing more complex programs and iterating on them. + +![Mu editor][18] + +(Don Watkins, [CC BY-SA 4.0][12]) + +I am always eager to learn, and I would love to know how you are teaching Python in school or at home. Please share your experience in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/teach-python-mu + +作者:[Don Watkins][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://opensource.com/users/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python-programming-code-keyboard.png?itok=fxiSpmnd (Hands on a keyboard with a Python book ) +[2]: https://en.wikipedia.org/wiki/Logo_(programming_language) +[3]: https://docs.python.org/3/library/turtle.html +[4]: https://www.python.org/downloads/windows/ +[5]: https://docs.python.org/3/library/idle.html +[6]: https://ntoll.org/ +[7]: https://codewith.mu/en/download +[8]: https://codewith.mu/en/howto/ +[9]: https://codewith.mu/en/tutorials/ +[10]: https://www.raspberrypi.org/blog/mu-python-ide/ +[11]: https://opensource.com/sites/default/files/uploads/mu-1_open.png (Mu editor) +[12]: https://creativecommons.org/licenses/by-sa/4.0/ +[13]: https://opensource.com/sites/default/files/uploads/mu-2_square.png (Mu editor) +[14]: https://opensource.com/sites/default/files/uploads/mu-3_save.png (Saving program in Mu) +[15]: https://opensource.com/sites/default/files/uploads/mu-4_run.png (Running Python program in Mu) +[16]: https://opensource.com/sites/default/files/uploads/mu-5_for-loop.png (for loops in Python with Mu) +[17]: https://opensource.com/sites/default/files/uploads/mu-6_my_square.png (my_square function) +[18]: https://opensource.com/sites/default/files/uploads/mu-7_beyond-basics.png (Mu editor) From 569999c5390e56b7b9a0ee812cbea0a26341debb Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 22 Sep 2020 05:04:10 +0800 Subject: [PATCH 0182/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200921?= =?UTF-8?q?=20Use=20this=20Python=20script=20to=20simulate=20Babbage's=20D?= =?UTF-8?q?ifference=20Engine?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200921 Use this Python script to simulate Babbage-s Difference Engine.md --- ...to simulate Babbage-s Difference Engine.md | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 sources/tech/20200921 Use this Python script to simulate Babbage-s Difference Engine.md diff --git a/sources/tech/20200921 Use this Python script to simulate Babbage-s Difference Engine.md b/sources/tech/20200921 Use this Python script to simulate Babbage-s Difference Engine.md new file mode 100644 index 0000000000..e6550c3b7d --- /dev/null +++ b/sources/tech/20200921 Use this Python script to simulate Babbage-s Difference Engine.md @@ -0,0 +1,91 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use this Python script to simulate Babbage's Difference Engine) +[#]: via: (https://opensource.com/article/20/9/babbages-python) +[#]: author: (Greg Pittman https://opensource.com/users/greg-p) + +Use this Python script to simulate Babbage's Difference Engine +====== +Nineteenth-century mathematician Charles Babbage's serial calculation +machine meets its match with Python code. +![old school calculator][1] + +[Charles Babbage][2] (1791–1871) was an avid mathematician with very wide interests. He is well-known for envisioning the idea of computers and single-handedly developed what he called a [Difference Engine][3] to make serial calculations. It was a mechanical machine with a series of axles and gears to make calculations, with the output being a printed table. I recently began reading his 1864 book, _[Passages from the Life of a Philosopher][4]_, where he explains how the Difference Engines came to be. + +One of the problems his Engine was designed to solve relates to the idea of children playing with marbles and arranging them in a progressive pyramidal shape, with one marble in the top row, two in the second, three in the third, and so on. For small pyramids, you can simply count the marbles to find how many there are. But Babbage wanted to create an automatic list or table with one column showing the number of rows and another column showing the total number of marbles. + +![Pyramids of marbles][5] + +(Greg Pittman, [CC BY-SA 4.0][6]) + +The differences he talks about are first, all the successive differences in the number of rows (equal to one in this example), and second, the difference between the number of marbles added from one row to the next (also one). As I understand it, the Difference Engine successively adds the number of marbles for each new row to the previous total, creating the table in the process. + +And so I began playing with marbles in my head, so to speak. I found myself awake in bed at 5am mentally fiddling with and counting marbles. One thing that struck me was that for six rows, the total was 21, and for seven, it was 28—both evenly divisible by seven. For eight or nine rows, the total was divisible by nine. As I went higher up the number of rows, this pattern recurred. All of this was in my head (meanwhile, I was wishing it would stop so that I could get back to sleep), so it wasn't very systematized. + +When I woke up, I decided to try to figure out why this was and whether I could predict which numbers would show this phenomenon. The answer surprised me: It turns out that _every_ odd number of rows will have a number of marbles evenly divisible by that number. + +But how could I prove this? Here is an example. For the pyramid with seven rows, look first at the pyramid with six rows, with six marbles across the bottom. Create some pairs of rows: the first and the sixth, the second and the fifth, the third and the fourth. For each of these three pairs, the sum is seven; thus, the total of the three sets of pairs is 21, and if you add seven for the next row, it would also remain evenly divisible by seven. + +![Selecting pairs of rows][7] + +(Greg Pittman, [CC BY-SA 4.0][6]) + +You can keep doing this with specific examples, but the goal is to understand this phenomenon generally. Imagine some random even number of rows, _N_. Create your pairs, then add 1 to _N_, 2 to _N_-1, 3 to _N_-2, and so on. In each case, the sum will be _N_+1. The number of these pairs will be _N_/2, so the total number of marbles will be _N_/2*(_N_+1), a number evenly divisible by _N_+1. Adding _N_+1 marbles for the next row is also evenly divisible by _N_+1. + +![Pairs of N rows][8] + +(Greg Pittman, [CC BY-SA 4.0][6]) + +For example, you can say that a pyramid with 128,948 rows will have a total of 8,313,857,826 marbles; a pyramid with 128,949 rows will have 8,313,986,775, and both these totals will be evenly divisible by 128,949. + +I don't know if Babbage considered this, but chances are, even if he did, he would say this just represents mathematical problems of multiplying and dividing six-digit numbers, and he wanted a machine to do that kind of thing. He did envision and begin work on an [Analytical Engine][9], which perhaps could have done this sort of operation. + +Nowadays, this is trivial work for computers, so here's a Python script to count your marbles before you lose them—in just 4 lines of code. + + +``` +#!/usr/bin/env python +# babbage.py +""" +Using Charles Babbage's conception of a marble-counting +operation for a regular pyramid of marbles,starting with +one at the top with each successive row having one more +marble than the row above it. + +Returns total number of marbles in a pyramid of any size. +""" + +MarbRows = input("Enter the number of rows of marbles:  ") +MarbRows = int(MarbRows) + +MarbNum = int((MarbRows)*(MarbRows+1)/2) +print ("The number of marbles is "+ str(MarbNum)) +``` + +And this is how Babbage's Difference Engine meets Python. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/babbages-python + +作者:[Greg Pittman][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://opensource.com/users/greg-p +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/math_money_financial_calculator_colors.jpg?itok=_yEVTST1 (old school calculator) +[2]: https://en.wikipedia.org/wiki/Charles_Babbage +[3]: https://en.wikipedia.org/wiki/Difference_engine +[4]: http://www.gutenberg.org/ebooks/57532 +[5]: https://opensource.com/sites/default/files/images/babbage_marblepyramid.png (Pyramids of marbles) +[6]: https://creativecommons.org/licenses/by-sa/4.0/ +[7]: https://opensource.com/sites/default/files/uploads/babbage_pyramidpairs_0.png (Selecting pairs of rows) +[8]: https://opensource.com/sites/default/files/uploads/babbage_pyramidnpairs.png (Pairs of N rows) +[9]: https://en.wikipedia.org/wiki/Analytical_Engine From c43554227a6d5c5cee001a97bd13e1b7df6b1b91 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 22 Sep 2020 05:04:23 +0800 Subject: [PATCH 0183/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200921?= =?UTF-8?q?=20Solve=20a=20real-world=20problem=20using=20Java?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200921 Solve a real-world problem using Java.md --- ...1 Solve a real-world problem using Java.md | 328 ++++++++++++++++++ 1 file changed, 328 insertions(+) create mode 100644 sources/tech/20200921 Solve a real-world problem using Java.md diff --git a/sources/tech/20200921 Solve a real-world problem using Java.md b/sources/tech/20200921 Solve a real-world problem using Java.md new file mode 100644 index 0000000000..9ee7423818 --- /dev/null +++ b/sources/tech/20200921 Solve a real-world problem using Java.md @@ -0,0 +1,328 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Solve a real-world problem using Java) +[#]: via: (https://opensource.com/article/20/9/problem-solving-java) +[#]: author: (Chris Hermansen https://opensource.com/users/clhermansen) + +Solve a real-world problem using Java +====== +See how Java differs from Python and Groovy as it's used to solve a +charity's real-world problem. +![Coffee beans and a cup of coffee][1] + +As I wrote in the first two articles in this series, I enjoy solving small problems by writing small programs in different languages, so I can compare the different ways they approach the solution. The example I'm using in this series is dividing bulk supplies into hampers of similar value to distribute to struggling neighbors in your community, which you can [read about][2] in the first article in this series. + +In the first article, I solved this problem [using the Groovy programming language][2], which is like Python in many ways, but syntactically it's more like C and Java. In the second article, I [solved it in Python][3] with a very similar design and effort, which demonstrates the resemblance between the languages. + +Now I'll try it in [Java][4]. + +### The Java solution + +When working in Java, I find myself declaring utility classes to hold tuples of data (the new record feature is going to be great for that), rather than using the language support for maps offered in Groovy and Python. This is because Java encourages creating maps that map one specific type to another specific type, but in Groovy or Python, it's cool to have a map with mixed-type keys and mixed-type values. + +The first task is to define these utility classes, and the first is the `Unit` class: + + +``` +class Unit { +    private [String][5] item, brand; +    private int price; + +    public Unit([String][5] item, [String][5] brand, int price) { +        this.item = item; +        this.brand = brand; +        this.price = price; +    } +    public [String][5] getItem() { return this.item; } +    public [String][5] getBrand() { return this.brand; } +    public int getPrice() { return this.price; } + +    @Override +    public [String][5] toString() { return [String][5].format("item: %s brand: %s price: %d",item,brand,price); } +} +``` + +There's nothing too startling here. I effectively created a class whose instances are immutable since there are no setters for fields `item`, `brand`, or `price` and they are declared `private`. As a general rule, I don't see value in creating a mutable data structure unless I'm going to mutate it; and in this application, I don't see any value in mutating the `Unit` class. + +While more effort is required to create these utility classes, creating them encourages a bit more design effort than just using a map, which can be a good thing. In this case, I realized that a bulk package is composed of a number of individual units, so I created the `Pack` class: + + +``` +class Pack { +    private Unit unit; +    private int count; + +    public Pack([String][5] item, [String][5] brand, int unitCount, int packPrice) { +        this.unit = new Unit(item, brand, unitCount > 0 ? packPrice / unitCount : 0); +        this.count = unitCount; +    } + +    public [String][5] getItem() { return unit.getItem(); } +    public [String][5] getBrand() { return unit.getBrand(); } +    public int getUnitPrice() { return unit.getPrice(); } +    public int getUnitCount() { return count; } +    public List<Unit> unpack() { return [Collections][6].nCopies(count, unit); } + +    @Override +    public [String][5] toString() { return [String][5].format("item: %s brand: %s unitCount: %d unitPrice: %d",unit.getItem(),unit.getBrand(),count,unit.getPrice()); } +} +``` + +Similar to the `Unit` class, the `Pack` class is immutable. A couple of things worth mentioning here: + + 1. I could have passed a `Unit` instance into the `Pack` constructor. I chose not to because the bundled, physical nature of a bulk package encouraged me to think of the "unit-ness" as an internal thing not visible from the outside but that requires unpacking to expose the units. Is this an important decision in this case? Probably not, but to me, at least, it's always good to think through this kind of consideration. + 2. Which leads to the `unpack()` method. The `Pack` class creates the list of `Unit` instances only when you call this method—that is, the class is _lazy_. As a general design principle, I've found it's worthwhile to decide whether a class' behavior should be eager or lazy, and when it doesn't seem to matter, I go with lazy. Is this an important decision in this case? Maybe—this lazy design enables a new list of `Unit` instances to be generated on every call of `unpack()`, which could prove to be a good thing down the road. In any case, getting in the habit of always thinking about eager vs. lazy behavior is a good habit. + + + +The sharp-eyed reader will note that, unlike in the Groovy and Python examples where I was mostly focused on compact code and spent way less time thinking about design decisions, here, I separated the definition of a `Pack` from the number of `Pack` instances purchased. Again, from a design perspective, this seemed like a good idea as the `Pack` is conceptually quite independent of the number of `Pack` instances acquired. + +Given this, I need one more utility class: the `Bought` class: + + +``` +class Bought { +    private Pack pack; +    private int count; + +    public Bought(Pack pack, int packCount) { +        this.pack = pack; +        this.count = packCount; +    } + +    public [String][5] getItem() { return pack.getItem(); } +    public [String][5] getBrand() { return pack.getBrand(); } +    public int getUnitPrice() { return pack.getUnitPrice(); } +    public int getUnitCount() { return pack.getUnitCount() * count; } +    public List<Unit> unpack() { return [Collections][6].nCopies(count, pack.unpack()).stream().flatMap([List][7]::stream).collect(Collectors.toList()); } + +    @Override +    public [String][5] toString() { return [String][5].format("item: %s brand: %s bought: %d pack(s) totalUnitCount: %d unitPrice: %d",pack.getItem(),pack.getBrand(),count,pack.getUnitCount() * count,pack.getUnitPrice()); } +} +``` + +Notably: + + 1. I decided to pass a `Pack` into the constructor. Why? Because to my way of thinking, the physical structure of the purchased bulk packages is external, not internal, as in the case of the individual bulk packages. Once again, it may not be important in this application, but I believe it's always good to think about these things. If nothing else, note that I am not married to symmetry! + 2. Once again the `unpack()` method demonstrates the lazy design principle. This goes to more effort to generate a list of `Unit` instances (rather than a _list of lists_ of `Unit` instances, which would be easier but require flattening further out in the code). + + + +OK! Time to move on and solve the problem. First, declare the purchased packs: + + +``` +        var packs = new Bought[] { +            new Bought(new Pack("Rice","Best Family",10,5650),1), +            new Bought(new Pack("Spaghetti","Best Family",1,327),10), +            new Bought(new Pack("Sardines","Fresh Caught",3,2727),3), +            new Bought(new Pack("Chickpeas","Southern Style",2,2600),5), +            new Bought(new Pack("Lentils","Southern Style",2,2378),5), +            new Bought(new Pack("Vegetable oil","Crafco",12,10020),1), +            new Bought(new Pack("UHT milk","Atlantic",6,4560),2), +            new Bought(new Pack("Flour","Neighbor Mills",10,5200),1), +            new Bought(new Pack("Tomato sauce","Best Family",1,190),10), +            new Bought(new Pack("Sugar","Good Price",1,565),10), +            new Bought(new Pack("Tea","Superior",5,2720),2), +            new Bought(new Pack("Coffee","Colombia Select",2,4180),5), +            new Bought(new Pack("Tofu","Gourmet Choice",1,1580),10), +            new Bought(new Pack("Bleach","Blanchite",5,3550),2), +            new Bought(new Pack("Soap","Sunny Day",6,1794),2) +        }; +``` + +This is pretty nice from a readability perspective: there is one pack of Best Family Rice containing 10 units that cost 5,650 (using those crazy monetary units, like in the other examples). It's straightforward to see that in addition to the one bulk pack of 10 bags of rice, the organization acquired 10 bulk packs of one bag each of spaghetti. The utility classes are doing some work under the covers, but that's not important at this point because of the great design job! + +Note the `var` keyword is used here; it's one of the nice features in recent versions of Java that help make the language a bit less verbose (the principle is called _DRY_—don't repeat yourself) by letting the compiler infer the variable's data type from the right-side expression's type. This looks kind of similar to the Groovy `def` keyword, but since Groovy by default is dynamically typed and Java is statically typed, the typing information inferred in Java by `var` persists throughout the lifetime of that variable. + +Finally, it's worth mentioning that `packs` here is an array and not a `List` instance. If you were reading this data from a separate file, you would probably prefer to create it as a list. + +Next, unpack the bulk packages. Because the unpacking of `Pack` instances is delegated into lists of `Unit` instances, you can use that like this: + + +``` +        var units = Stream.of(packs) +            .flatMap(bought -> { +                return bought.unpack().stream(); }) +            .collect(Collectors.toList()); +``` + +This uses some of the nice functional programming features introduced in later Java versions. Convert the array `packs` declared previously to a Java stream, use `flatmap()` with a lambda to flatten the sublists of units generated by the `unpack()` method of the `Bought` class, and collect the resulting stream elements back into a list. + +As in the Groovy and Java solutions, the final step is repacking the units into the hampers for distribution. Here's the code—it's not much wordier than the Groovy version (tiresome semicolons aside) nor really all that different: + + +``` +        var valueIdeal = 5000; +        var valueMax = [Math][8].round(valueIdeal * 1.1); +        var rnd = new [Random][9](); +        var hamperNumber = 0;                         // [1] + +        while (units.size() > 0) {                    // [2] +            hamperNumber++; +            var hamper = new ArrayList<Unit>(); +            var value = 0;                            // [2.1] +            for (boolean canAdd = true; canAdd; ) {   // [2.2] +                var u = rnd.nextInt(units.size());            // [2.2.1] +                canAdd = false;                               // [2.2.2] +                for (int o = 0; o < units.size(); o++) {      // [2.2.3] +                    var uo = (u + o) % units.size(); +                    var unit = units.get(uo);                      // [2.2.3.1] +                    if (units.size() < 3 || +                            !hamper.contains(unit) && +                            (value + unit.getPrice()) < valueMax) { // [2.2.3.2] +                        hamper.add(unit); +                        value += unit.getPrice(); +                        units.remove(uo);                           // [2.2.3.3] +                        canAdd = units.size() > 0; +                        break;                                      // [2.2.3.4] +                    } +                } +            }                                                // [2.2.4] +            [System][10].out.println(); +            [System][10].out.printf("Hamper %d value %d:\n",hamperNumber,value); +            hamper.forEach(unit -> { +                [System][10].out.printf("%-25s%-25s%7d\n", unit.getItem(), unit.getBrand(), +                       unit.getPrice()); +            });                                                      // [2.3] +            [System][10].out.printf("Remaining units %d\n",units.size());  // [2.4] +``` + +Some clarification, with numbers in brackets in the comments above (e.g., _[1]_) corresponding to the clarifications below: + + * 1\. Set up the ideal and maximum values to be loaded into any given hamper, initialize Java's random number generator and the hamper number. + * 2\. This `while {}` loop will redistribute units into hampers as long as there are more available: + * 2.1 Increment the hamper number, get a new empty hamper (a list of `Unit` instances), and set its value to 0. + * 2.2 This `for {}` loop will add as many units to the hamper as possible: + * 2.2.1 Get a random number between zero and the number of remaining units minus 1. + * 2.2.2 Assume you can't find more units to add. + * 2.2.3 This `for {}` loop, starting at the randomly chosen index, will try to find a unit that can be added to the hamper. + * 2.2.3.1 Figure out which unit to look at. + * 2.2.3.2 Add this unit to the hamper if there are only a few left or if the value of the hamper isn't too high once the unit is added _and_ that unit isn't already in the hamper. + * 2.2.3.3 Add the unit to the hamper, increment the hamper value by the unit price, and remove the unit from the available units list. + * 2.2.3.4 As long as there are units left, you can add more, so break out of this loop to keep looking. + * 2.2.4 On exit from this `for {}` loop, if you inspected every remaining unit and could not find one to add to the hamper, the hamper is complete; otherwise, you found one and can continue looking for more. + * 2.3 Print out the contents of the hamper. + * 2.4 Print out the remaining units info. + + + +When you run this code, the output looks quite similar to the output from the Groovy and Python programs: + + +``` +Hamper 1 value 5465: +Tofu                     Gourmet Choice              1580 +Bleach                   Blanchite                    710 +Coffee                   Colombia Select             2090 +Flour                    Neighbor Mills               520 +Sugar                    Good Price                   565 +Remaining units 150 + +Hamper 2 value 5482: +Sardines                 Fresh Caught                 909 +Tomato sauce             Best Family                  190 +Vegetable oil            Crafco                       835 +UHT milk                 Atlantic                     760 +Chickpeas                Southern Style              1300 +Lentils                  Southern Style              1189 +Soap                     Sunny Day                    299 +Remaining units 143 + +Hamper 3 value 5353: +Soap                     Sunny Day                    299 +Rice                     Best Family                  565 +UHT milk                 Atlantic                     760 +Flour                    Neighbor Mills               520 +Vegetable oil            Crafco                       835 +Bleach                   Blanchite                    710 +Tomato sauce             Best Family                  190 +Sardines                 Fresh Caught                 909 +Sugar                    Good Price                   565 +Remaining units 134 + +… + +Hamper 23 value 5125: +Sardines                 Fresh Caught                 909 +Rice                     Best Family                  565 +Spaghetti                Best Family                  327 +Lentils                  Southern Style              1189 +Chickpeas                Southern Style              1300 +Vegetable oil            Crafco                       835 +Remaining units 4 + +Hamper 24 value 2466: +UHT milk                 Atlantic                     760 +Spaghetti                Best Family                  327 +Vegetable oil            Crafco                       835 +Tea                      Superior                     544 +Remaining units 0 +``` + +The last hamper is abbreviated in contents and value. + +### Closing thoughts + +The similarities in the "working code" with the Groovy original are obvious—the close relationship between Groovy and Java is evident. Groovy and Java diverged in a few ways in things that were added to Java after Groovy was released, such as the `var` vs. `def` keywords and the superficial similarities and differences between Groovy closures and Java lambdas. Moreover, the whole Java streams framework adds a great deal of power and expressiveness to the Java platform (full disclosure, in case it's not obvious—I am but a babe in the Java streams woods). + +Java's intent to use maps for mapping instances of a single type to instances of another single type pushes you to use utility classes, or tuples, instead of the more inherently flexible intents in Groovy maps (which are basically just `Map` plus a lot of syntactic sugar to vanish the kinds of casting and `instanceof` hassles that you would create in Java) or in Python. The bonus from this is the opportunity to apply some real design effort to these utility classes, which pays off at least insofar as it instills good habits in the programmer. + +Aside from the utility classes, there isn't a lot of additional ceremony nor boilerplate in the Java code compared to the Groovy code. Well, except that you need to add a bunch of imports and wrap the "working code" in a class definition, which might look like this: + + +``` +import java.lang.*; +import java.util.*; +import java.util.Collections.*; +import java.util.stream.*; +import java.util.stream.Collectors.*; +import java.util.Random.*; + +public class Distribute { + +    static public void main([String][5][] args) { +        // the working code shown above +    } +} +class Unit { … } +class Pack { … } +class Bought { … } +``` + +The same fiddly bits are necessary in Java as they are in Groovy and Python when it comes to grabbing stuff out of the list of `Unit` instances for the hampers, involving random numbers, loops through remaining units, etc. + +Another issue worth mentioning—this isn't a particularly efficient approach. Removing elements from `ArrayLists`, being careless about repeated expressions, and a few other things make this less suitable for a huge redistribution problem. I've been a bit more careful here to stick with integer data. But at least it's quite quick to execute. + +Yes, I'm still using the dreaded `while { … }` and `for { … }`. I still haven't thought of a way to use map and reduce style stream processing in conjunction with a random selection of units for repackaging. Can you? + +Stay tuned for the next articles in this series, with versions in [Julia][11] and [Go][12]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/problem-solving-java + +作者:[Chris Hermansen][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://opensource.com/users/clhermansen +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/java-coffee-mug.jpg?itok=Bj6rQo8r (Coffee beans and a cup of coffee) +[2]: https://opensource.com/article/20/8/solving-problem-groovy +[3]: https://opensource.com/article/20/8/solving-problem-python +[4]: https://www.java.com/en/ +[5]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string +[6]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+collections +[7]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+list +[8]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+math +[9]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+random +[10]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system +[11]: https://julialang.org/ +[12]: https://golang.org/ From 3ab171ff87bc1032a5f1823a7dc01e038a7a9b8d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 22 Sep 2020 08:42:42 +0800 Subject: [PATCH 0184/1156] PUB @wxy https://linux.cn/article-12638-1.html --- ...x Jargon Buster- What is a Rolling Release Distribution.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md (99%) diff --git a/translated/tech/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md b/published/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md similarity index 99% rename from translated/tech/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md rename to published/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md index 5d4d723409..2ad525480a 100644 --- a/translated/tech/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md +++ b/published/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12638-1.html) [#]: subject: (Linux Jargon Buster: What is a Rolling Release Distribution?) [#]: via: (https://itsfoss.com/rolling-release/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From 760ac686dd7f2807fd539abc8faae7deb4a24981 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 22 Sep 2020 08:44:24 +0800 Subject: [PATCH 0185/1156] PRF @wxy https://linux.cn/article-12639-1.html --- ...nux Jargon Buster- What is a Rolling Release Distribution.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md b/published/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md index 2ad525480a..572d1011fc 100644 --- a/published/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md +++ b/published/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md @@ -2,7 +2,7 @@ [#]: translator: (wxy) [#]: reviewer: (wxy) [#]: publisher: (wxy) -[#]: url: (https://linux.cn/article-12638-1.html) +[#]: url: (https://linux.cn/article-12639-1.html) [#]: subject: (Linux Jargon Buster: What is a Rolling Release Distribution?) [#]: via: (https://itsfoss.com/rolling-release/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From 5e4ffb9d442792f4e42859057767aa9670b56745 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 22 Sep 2020 08:47:39 +0800 Subject: [PATCH 0186/1156] translating --- ...the signup process for decentralization.md | 125 ------------------ ...the signup process for decentralization.md | 125 ++++++++++++++++++ 2 files changed, 125 insertions(+), 125 deletions(-) delete mode 100644 sources/tech/20200914 How Nextcloud simplified the signup process for decentralization.md create mode 100644 translated/tech/20200914 How Nextcloud simplified the signup process for decentralization.md diff --git a/sources/tech/20200914 How Nextcloud simplified the signup process for decentralization.md b/sources/tech/20200914 How Nextcloud simplified the signup process for decentralization.md deleted file mode 100644 index d9e2eafd10..0000000000 --- a/sources/tech/20200914 How Nextcloud simplified the signup process for decentralization.md +++ /dev/null @@ -1,125 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How Nextcloud simplified the signup process for decentralization) -[#]: via: (https://opensource.com/article/20/9/decentralization-signup) -[#]: author: (Jan C. Borchardt https://opensource.com/users/jancborchardt) - -How Nextcloud simplified the signup process for decentralization -====== -Nextcloud is open source software and we don’t provide a hosted service, -yet we managed to radically simplify the signup experience. -![clouds in the sky with blue pattern][1] - -We always had a nice list of dozens of Nextcloud providers, yet the most common question I heard, even from technically apt friends of mine, was: - -> "Hi, Jan, umm…so, which Nextcloud provider do you recommend?" - -Which is, of course, understandable. If you have a long list of providers, how do you choose? Hosted nearby? Cute name? Biggest logo? - -Every decentralized open source solution using servers struggles with this: - - * Mastodon has [joinmastodon.org][2] for choosing a community, but clearly a main instance with mastodon.social. - * Diaspora has [joindiaspora.com][3], which is also the main instance. - * Matrix has [matrix.to][4] and an app (for multiple platforms) at [Element.io][5]. - * WordPress has [wordpress.com][6]—and I'm not sure any provider comes close to its popularity. - * PeerTube has a bunch of instances, all with different technical details. - * Pixelfed has an early version of an instance picker at [beta.joinpixelfed.org][7], as well as a large instance at [pixelfed.social][8] - * … lots more examples of decentralized open source apps, which list how you can access it via the terminal, set up the Rust implementation, or make it run on your networked printer. - - - -This leads to problems: - - * 🔮 People don't know which one to pick, have FOMO (Fear Of Missing Out), and then don't pick at all. It's the paradox of choice! - * 🕸 The network is not really decentralized because the majority of people are on a handful of servers, or mainly just a single one. - - - -Nextcloud does not have any of these problems. - -### Our solution: Simple Signup - -How it works: - -When you download the mobile or desktop app, the first thing you see is a choice for "Log in" or "Sign up with a provider." This is what any proprietary app does: - -![Android client][9] - -Choosing "Sign up" opens [the Simple Signup page][10] in the app. - -![Web client][11] - -You put in your email address and click "sign up." - -Enter a password, and you're done! 🎉 - -> "Wait a second; how is this so simple?" - -I know, right? ✨ - -In fact, it's even simpler than lots of centralized apps where you need to put in your full name and phone number and then click on pictures of fire hydrants for Google. - -It basically boils down to this: - -### We choose for you - -Instead of being faced with a list of providers where you could not possibly judge what works for you, we only show you one option. It's as if I'm your friend, and I answer that question about which provider I recommend. - -Neat! 😊 - -Just to clarify: You do have the ability to change the provider, but the default should suit you fine. For now, it's simply the provider geographically closest to you. - -On top of that, we have some requirements for the providers which are listed through Simple Signup to ensure a good user experience no matter which one you get: - - * 🎁 2 GB of free storage minimum, and not only for a trial period. - * 🍱 A core set of apps: Files, Calendar, Contacts, Mail, Talk, Tasks, Notes. Some providers offer even more. - * 🛡 The latest version, so you are always up to date with the latest features, fixes, and security updates. - - - -Beyond that, we came up with a privacy respecting process. When you click "sign up," your email is not sent to us but directly to the provider you chose, which seamlessly transitions you to their setup step where you choose a password. This means no data leaks to us at Nextcloud—we don't even know which provider you picked! - -So, while we offer this service, and while it is super easy to use, we only do the absolute minimum in terms of data handling to connect you with your ideal provider. - -### Decentralized projects need simple signup - -A lot of open source software projects could benefit from an onboarding experience like Simple Signup. We [wrote about it when we initially released it][12], and we hope this post clarifies the design decisions that make it successful so it can be adopted by more projects. - -Decentralization is empowering, but only truly revolutionary when people can simply sign up even if they don't know what a server is. - -Of course, it's not perfect just yet, either. For example, if you already have an account on a Nextcloud instance, the login process in any of the apps asks you to put in a server address, and a lot of people have no idea what that even is. In lots of email apps, for example, there is a list of the most popular providers at this step, with a "custom server" entry on the bottom. This could be a possibility as well, but again brings the risk of centralizing the system too much or leaving people confused as to what to pick. - -So, we constantly try to improve this for any of the Nextcloud desktop and mobile apps, like Nextcloud Talk or all of the great community-developed apps. On Android, we have tight integration with DAVx5 (Calendar and Contact sync on Android), and, for other Android apps, there is a [single sign-on library][13]. On iOS, it is, unfortunately, not so easy, since apps have to be from the same developer to share credentials. - -If you want to collaborate on solving interesting challenges like these, [come join our Nextcloud design team][14]! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/9/decentralization-signup - -作者:[Jan C. Borchardt][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://opensource.com/users/jancborchardt -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003601_05_mech_osyearbook2016_cloud_cc.png?itok=XSV7yR9e (clouds in the sky with blue pattern) -[2]: https://joinmastodon.org/ -[3]: https://joindiaspora.com -[4]: https://matrix.to -[5]: http://Element.io -[6]: https://wordpress.com -[7]: http://beta.joinpixelfed.org -[8]: http://pixelfed.social -[9]: https://opensource.com/sites/default/files/nextcloud-android-small.png (Android client) -[10]: https://nextcloud.com/signup -[11]: https://opensource.com/sites/default/files/nextcloud-web-small.png (Web client) -[12]: https://nextcloud.com/blog/introducing-simple-signup-you-can-now-get-started-with-nextcloud-in-2-steps/ -[13]: https://github.com/nextcloud/Android-SingleSignOn -[14]: https://nextcloud.com/design diff --git a/translated/tech/20200914 How Nextcloud simplified the signup process for decentralization.md b/translated/tech/20200914 How Nextcloud simplified the signup process for decentralization.md new file mode 100644 index 0000000000..236d618572 --- /dev/null +++ b/translated/tech/20200914 How Nextcloud simplified the signup process for decentralization.md @@ -0,0 +1,125 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How Nextcloud simplified the signup process for decentralization) +[#]: via: (https://opensource.com/article/20/9/decentralization-signup) +[#]: author: (Jan C. Borchardt https://opensource.com/users/jancborchardt) + +Nextcloud 如何简化去中心化的注册流程? +====== +Nextcloud 是开源软件,我们不提供托管服务,但我们却能从根本上简化注册体验。 +![clouds in the sky with blue pattern][1] + +我们总是有一个有几十个 Nextcloud 提供商的列表,然而我听到的最常见的问题,即使是我的技术上的朋友,也是: + +> ”嗨,Jan,你推荐哪个 Nextcloud 提供商?” + +当然,这也是可以理解的。如果你有一长串的供应商,你怎么选择?附近的托管?可爱的名字?最大的标志? + +每一个使用服务器的去中心化开源解决方案都在努力解决这些: + + * Mastodon 有 [joinmastodon.org][2] 来选择社区,但很明显是以 mastodon.social 为主的实例。 + * Diaspora 有[ joindiaspora.com][3],也是主实例。 + * Matrix 有 [matrix.to][4],还有一个在 [Element.io][5] 的应用(多平台)。 + * WordPress 有 [wordpress.com][6]。我不确定是否有提供商能接近它的知名度。 + * PeerTube 有一堆实例,都有不同的技术细节。 + * Pixelfed 在[beta.joinpixelfed.org][7] 有一个早期版本的实例选择器,以及在 [pixelfed.social][8] 有一个大型实例。 + * 还有更多的去中心化开源应用的例子,这里列出了如何通过终端访问它、设置 Rust 实现、或使其在网络打印机上运行。 + + + +这就导致了一些问题: + + * 🔮 人们不知道该选哪个,有错失恐惧症(Fear Of Missing Out),然后根本不选。这就是选择的悖论! + * 🕸 网络并不是真正的去中心化,因为大多数人都在少数服务器上,或者主要是只有一台服务器。 + + + +Nextcloud 不存在这些问题。 + +### 我们的解决方案:简单注册 + +这是它是如何工作的: + +当你下载手机或桌面应用时,你首先看到的是”登录“或”使用供应商注册“的选择。这是任何专有应用都会做的事情: + +![Android client][9] + +选择”注册“可打开应用中的[简易注册页面][10]。 + +![Web client][11] + +你输入你的电子邮件地址,然后点击”注册“。 + +输入密码,就可以了! 🎉 + +> ”等一下,这怎么这么简单?“ + +我知道,对吧?✨ + +事实上,它甚至比很多集中式的应用更简单,在那里你需要输入你的全名和电话号码,然后点击谷歌的验证码。 + +基本上归结为: + +### 我们为你选择 + +而不是面对一个无法判断什么适合你供应商的名单,我们只向你展示一个选择。就好像我是你的朋友一样,我回答了那个关于我推荐哪家供应商的问题。 + +很好!😊 + +澄清一下:你可以修改供应商,但默认的应该很适合你。目前,它只是地理位置上离你最近的提供商。 + +除此之外,我们对通过简单注册列出的提供商有一些要求,以确保无论你选择哪一个提供商都能获得良好的用户体验: + + * 🎁 2 GB 的免费存储空间,而且不仅仅是试用期。 + * 🍱 一套核心应用。文件、日历、联系人、邮件、通话、任务、笔记。有些供应商甚至提供更多。 + * 🛡 最新版本,让你始终保持最新的功能、修复和安全更新。 + + + + +除此之外,我们还提出了一个尊重隐私的流程。当你点击”注册“时,你的邮件不会发送给我们,而是直接发送给你选择的供应商,这将无缝过渡到他们的设置步骤,在那里你选择一个密码。这意味着在 Nextcloud 不会有任何数据泄露给我们,我们甚至不知道你选择的是哪家提供商! + +因此,虽然我们提供这项服务,而且它超级容易使用,但我们只做绝对最低限度的数据处理,以连接你与你的理想供应商。 + +### 去中心化项目需要简单的注册方式 + +很多开源软件项目可以从简单注册这样的体验中受益。我们[在最初发布的时候写过它][12],我们希望这篇文章能澄清使它成功的设计决策,以便它能被更多项目采用。 + +去中心化是赋能,但只有当人们即使不知道服务器是什么,也能简单注册时,才是真正的革命。 + +当然,现在也还不完美。比如,如果你已经在 Nextcloud 实例上有了账户,任何一个应用的登录过程都会要求你输入一个服务器地址,而很多人根本不知道那是什么。比如在很多邮件应用中,在这一步会有一个最受欢迎的供应商列表,底部有一个”自定义服务器“的条目。这也可能是一种可能性,但同样带来了系统过于集中的风险,或者让人们对选择什么感到困惑。 + +所以,我们不断尝试为任意一个 Nextcloud 桌面和移动应用改进这一点,比如 Nextcloud Talk 或者所有优秀的社区开发的应用。在 Android 上,我们与 DAVx5(Android 上的日历和联系人同步)紧密集成,而且,对于其他 Android 应用,还有一个[单点登录库][13]。不幸的是,在 iOS 上,就没有那么容易了,因为应用必须来自同一个开发者才能共享凭证。 + +如果你想合作解决类似这些有趣的挑战,[来加入我们的 Nextcloud 设计团队吧][14]! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/decentralization-signup + +作者:[Jan C. Borchardt][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jancborchardt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003601_05_mech_osyearbook2016_cloud_cc.png?itok=XSV7yR9e (clouds in the sky with blue pattern) +[2]: https://joinmastodon.org/ +[3]: https://joindiaspora.com +[4]: https://matrix.to +[5]: http://Element.io +[6]: https://wordpress.com +[7]: http://beta.joinpixelfed.org +[8]: http://pixelfed.social +[9]: https://opensource.com/sites/default/files/nextcloud-android-small.png (Android client) +[10]: https://nextcloud.com/signup +[11]: https://opensource.com/sites/default/files/nextcloud-web-small.png (Web client) +[12]: https://nextcloud.com/blog/introducing-simple-signup-you-can-now-get-started-with-nextcloud-in-2-steps/ +[13]: https://github.com/nextcloud/Android-SingleSignOn +[14]: https://nextcloud.com/design From 2162a061dd4ba164e02e12a3d5bd34b6e0a3a341 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 22 Sep 2020 08:55:46 +0800 Subject: [PATCH 0187/1156] translating --- sources/tech/20200917 What-s new with rdiff-backup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200917 What-s new with rdiff-backup.md b/sources/tech/20200917 What-s new with rdiff-backup.md index bbd4f81962..04c45c8885 100644 --- a/sources/tech/20200917 What-s new with rdiff-backup.md +++ b/sources/tech/20200917 What-s new with rdiff-backup.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 4acda03c00d71f0248dcfd08e99fcfbe3f8750b8 Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Tue, 22 Sep 2020 23:21:29 +0800 Subject: [PATCH 0188/1156] Update 20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md --- ...When it-s coming and what it-s good for.md | 54 ++++++++++--------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/sources/talk/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md b/sources/talk/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md index 0a76dab8db..e4009e28ef 100644 --- a/sources/talk/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md +++ b/sources/talk/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md @@ -7,54 +7,58 @@ [#]: via: (https://www.networkworld.com/article/3563832/wi-fi-6e-when-its-coming-and-what-its-good-for.html) [#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/) -Wi-Fi 6E: When it’s coming and what it’s good for +Wi-Fi 6E:它何时到来,又有何作用? ====== -New wireless spectrum recently dedicated to Wi-Fi allows for more channels and higher density deployments, but gear to support it won’t be widely deployed until 2020, according to an Extreme Networks exec. -Thinkstock +Extreme Networks的一位高管表示,近来专用于Wi-Fi的新无线频谱可以提供更多的信道和更高的密度部署,但是要支持它的设备要到2020年才能得到广泛部署。 +智库 -This spring [the FCC opened up a new swath of unlicensed wireless spectrum][1] in the 6GHz band that’s intended for use with Wi-Fi and can provide lower latency and faster data rates. The new spectrum also has a shorter range and supports more channels than bands that were already dedicated to Wi-Fi, making it suitable for deployment in high-density areas like stadiums. -To further understand what Wi-Fi 6E is and how it differs from Wi-Fi 6, I recently talked with Perry Correll, director of product management for networking solutions vendor Extreme Networks. +今年开春 [FCC在6GHz频段内开辟了一系列新的未经许可的无线频谱][1] ,目的在于使用Wi-Fi的同时可以提供更低的延迟和更快的数据速率。与已经专用于Wi-Fi的频段相比,新频谱的范围更短,支持的频道更多,因此适合在体育场馆等高密度区域部署。 -**Learn more about 5G and WiFi 6** +为了进一步了解什么是Wi-Fi 6E以及它与Wi-Fi 6有何不同,我最近与网络解决方案提供商Extreme Networks的产品管理总监Perry Correll进行了交谈。 - * [What is 5G? How is it better than 4G?][2] - * [How to determine if WiFi 6 is right for you][3] - * [What is MU-MIMO? Why do you need it in your wireless routers?][4] - * [When to use 5G, when to use WiFi 6][5] - * [How enterprises can prep for 5G networks][6] +**了解更多关于5G和WiFi 6的信息** + + * [什么是5G?相较于4G它更好吗?][2] + * [如何确定WiFi 6是否适合你?][3] + * [什么是MU-MIMO?为什么它在你的无线路由器中不可或缺?][4] + * [何时使用5G?何时使用WiFi 6?][5] + * [企业如何为5G网络做准备呢?][6] -**Kerravala:** **Wi-Fi 6 seems to be getting a lot of hype but not Wi-Fi 6E. Why?** +**Kerravala:** **Wi-Fi 6似乎得到了许多炒作而Wi-Fi 6E却没有。为什么?** -**Correll:** There’s so much confusion around all the 666 numbers, it’ll scare you to death. You’ve got Wi-Fi 6, Wi-Fi 6E – and Wi-Fi 6 still has additional enhancements coming after that, with multi-user multiple input, multiple output (multi-user MIMO) functionalities. Then there’s the 6GHz spectrum, but that’s not where Wi-Fi 6 gets its name from: It’s the sixth generation of Wi-Fi. On top of all that, we are just getting a handle 5G and there already talking about 6G – seriously, look it up – it's going to get even more confusing. +**Correll:** 这666个号码中有太多混乱,会吓死您。 Wi-Fi 6,Wi-Fi 6E –之后,Wi-Fi 6仍具有其他增强功能,具有多用户多入多出(多用户MIMO)功能。 之后是6GHz频谱,但这并不是Wi-Fi 6的名称的由来:这是第六代Wi-Fi。 最重要的是,我们刚刚掌握了5G,并且已经在谈论6G-认真研究它将会变得更困惑。 -**Kerravala:** **Why do we need Wi-Fi 6E versus regular Wi-Fi 6?** +**Kerravala:** **为什么我们需要Wi-Fi 6E和常规Wi-Fi 6?** -**Correll:** The last time we got a boost in UNII-2 and UNII-2 Extended was 15 years ago and smartphones hadn’t even taken off yet. Now being able to get 1.2GHz is enormous. With Wi-Fi 6E, we’re not doubling the amount of Wi-Fi space, we're actually quadrupling the amount of usable space. That’s three, four, or five times more spectrum, depending on where you are in the world. Plus you don't have to worry about DFS [dynamic frequency selection], especially indoors. +**Correll:** 上一次我们获得UNII-2和UNII-2 Extended的优势是15年前,而在当时智能手机甚至还没有起飞。 现在能够获得1.2GHz的频率已经非常大了。 使用Wi-Fi 6E,我们不会将Wi-Fi空间增加一倍,事实上,我们是将可用空间增加了三倍。 根据您所处的地点,频谱的数量要多三倍,四倍或五倍。此外,你不必担心DFS [动态频率选择] ,尤其是在室内。 -Wi-Fi 6E is not going to be faster than Wi-Fi 6 and it’s not adding enhanced technology features. The neat thing is operating the 6GHz will require Wi-Fi 6 or above clients. So, we’re not going to have any slow clients and we’re not going to have a lot of noise. We’re going to gain performance in a cleaner environment with faster devices. +Wi-Fi 6E将不会拥有快于Wi-Fi 6的速度,并且不会添加增强的技术功能。 最妙的是运行6GHz需要Wi-Fi - 6或以上的客户端。所以,我们不会有任何速度慢的客户,也不会有很多噪声。我们将在更清洁的环境中使用更快的设备来提高性能。 -**Kerravala:** **Can you also run wider channels?** +**Kerravala:** **你们还会运营更宽的频道吗** **Correll:** Exactly, that's the cool thing about it. If you’re in a typical enterprise environment, 20 and 40MHz is pretty much all you need. In high-density environments like stadiums, trying to do 80 or 160MHz just became tough. Wider channels are really going help things like [virtual reality], which can take advantage of those channels that are eating up the rest of the spectrum. That’s probably the biggest use case. +确切地说,那是一件很酷的事情。如果你处于一个典型的企业环境中,20和40MHz已经在体育馆这种高密度环境中,仅使用80或160MHz资源也会,很紧张。更宽的通道将会真正有助于像虚拟现实这类可以利用这些频谱中剩余的通道。这可能是最大的使用情况了。 +没错,这才是最酷的地方。如果您在一个典型的企业环境中,20和40MHz几乎足够满足你的需求。在像体育场这样的高密度环境中,想要做到80或160MHz就变得很困难了。更宽的频道确实有助于[虚拟现实]这样的事情,它们可以利用那些使用过后剩余部分中的频道。这可能是最大的用例。 -Three or four years down the road, if you want to do digital signage or screen edge at stadiums then you can use 80 of the 160MHz without getting impacted by anything else. There’s already talk of Wi-Fi 7 and it’s going to have 320MHz-wide channels. +在未来的三四年里,如果你想在体育场做频谱的数字标识牌或者屏幕边缘处理,则可以使用160MHz的80%带宽,而不会受到其他任何影响。已经有传言说Wi-Fi 7将会有320MHz宽的频道。 -**Kerravala:** **Will this be primarily an augmentation to most Wi-Fi strategies?** +**Kerravala:** **这将主要是对大多数Wi-Fi策略的增强吗?** -**Correll:** It's definitely going to be at the edges in the short term. The first products are probably going to launch at the end of this year, and they’re going to be consumer-grade. For the enterprise, 6GHz-capable products will start showing up next year. Not before 2022 will you actually start seeing any density – so, not any time soon. For smartphone companies, Wi-Fi is not a big deal and they’d rather focus on other features. +**Correll:** 在短期内边缘上将会非常的明确。第一批产品大概会在今年底发布,并且他们将会是消费级的。对于企业来说,6GHz合格产品将会在下一年开始出现。直到2022年你才会实际的看到任何密度——所以,并不会很快。 +短期内肯定会处于边缘。首批产品大概会在今年底发布,它们将是消费类产品。对于企业来说,支持6GHz的产品将会在明年亮相。在2022年之前,你不会真正看到任何密集信息——所以,短期内不会。对于智能手机公司来说,Wi-Fi并不是什么大事,他们更愿意关注其他功能。 -Still, it’s a huge opportunity. The nicest thing about the 6GHz versus CBRS [Citizens Broadband Radio Service] or 5G is [that many] would rather stick with Wi-Fi than having to move to a different architecture. These are the users that are going to drive the manufacturers of the widgets to IoT devices or robots or whatever requires the 6GHz. It's a clean spectrum and might be cheaper than the regular Wi-Fi 6. There are also some power-saving benefits there, too. +但它仍是一个巨大的机会。6GHz与CBRS [公民宽带无线电服务] 或5G相比,最棒的一点是 [许多人] 宁愿坚持使用Wi-Fi,也不愿迁移到不同的架构。这些用户将推动驱动部件制造商转向物联网设备或机器人或任何需要6GHz的设备。这是一个干净的频谱,可能比普通的Wi-Fi 6还要便宜也更节能。 -**Kerravala:** **There’s talk of 5G replacing Wi-Fi 6. But what’s the practicality of that?** +**Kerravala:** **这是一场5G替代Wi-Fi 6的讨论。它的实用性在哪里?** -**Correll:** Realistically, you can’t put a SIM in every device. But one of the big issues that come up is data ownership because the carrier is going to own your data, not you. If you want to use your data for any kind of business analytics, will the carrier release the data back to you at a certain price? That’s a frightening thought. +**Correll:** 事实上,你不能将SIM插入所有的设备中。 但是出现的主要问题之一是数据所有权,因为运营商将拥有你的数据,而不是你。 如果你想使用你的数据进行任何类型的业务分析,运营商是否会以一定价格将数据返还给你?这是一个可怕的想法。 -There are just too many reasons why Wi-Fi is not going away. When Wi-Fi 6 and 5G-capable devices come out, what will happen to all the other laptops, tablets, and IoT devices that only have Wi-Fi? There will either be Wi-Fi-only or Wi-Fi and 5G devices, but 5G is not going to replace Wi-Fi altogether. If you look at the 5G radio network backbone, Wi-Fi is a component. It's one big happy family. The technologies are designed to coexist. +Wi-Fi未被淘汰有太多的理由。当具备Wi-Fi 6和5g功能的设备问世时,其他只有Wi-Fi功能的笔记本电脑、平板电脑和物联网设备将会发生什么呢?将会有Wi-Fi或Wi-Fi和5G设备,但5G不会完全取代Wi-Fi。如果你看看5G无线网络的主干,Wi-Fi就是其中的一个组成部分。这是一个幸福的大家庭。这些技术是为了共存而设计的。 -Join the Network World communities on [Facebook][7] and [LinkedIn][8] to comment on topics that are top of mind. +加入 [Facebook][7] 和 [LinkedIn][8] 上的网络世界社区,就你最关心的话题发表评论吧。 -------------------------------------------------------------------------------- From 2a8e2b04c8d8d8ef940969660129bc32ebb1767b Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Tue, 22 Sep 2020 23:27:36 +0800 Subject: [PATCH 0189/1156] Rename sources/talk/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md to translated/talk/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md --- .../20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/talk/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md (100%) diff --git a/sources/talk/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md b/translated/talk/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md similarity index 100% rename from sources/talk/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md rename to translated/talk/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md From 0b00180665a4da2a324100832ca98eb51788c2bd Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Tue, 22 Sep 2020 23:35:48 +0800 Subject: [PATCH 0190/1156] Update 20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md --- ...0200625 Wi-Fi 6E- When it-s coming and what it-s good for.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/talk/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md b/translated/talk/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md index e4009e28ef..67a3f023f7 100644 --- a/translated/talk/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md +++ b/translated/talk/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md @@ -66,7 +66,7 @@ via: https://www.networkworld.com/article/3563832/wi-fi-6e-when-its-coming-and-w 作者:[Zeus Kerravala][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[chenmu-kk](https://github.com/chenmu-kk) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 9bec1b6c134688eb809e36afa4f859b1d4e34ba8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 23 Sep 2020 05:05:23 +0800 Subject: [PATCH 0191/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200923?= =?UTF-8?q?=20Meet=20eDEX-UI,=20A=20Sci-Fi=20Inspired=20Linux=20Terminal?= =?UTF-8?q?=20Emulator=20With=20Some=20Cool=20Features?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md --- ...rminal Emulator With Some Cool Features.md | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 sources/tech/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md diff --git a/sources/tech/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md b/sources/tech/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md new file mode 100644 index 0000000000..373608cf06 --- /dev/null +++ b/sources/tech/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md @@ -0,0 +1,111 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features) +[#]: via: (https://itsfoss.com/edex-ui-sci-fi-terminal/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features +====== + +**_Brief: eDEX-UI is a cool sci-fi inspired terminal emulator that looks cool with a bunch of options like system monitoring. Here, we take a quick look at what it offers_.** + +You probably already know [plenty of fun Linux commands][1]. You know what else can be fun when it comes to Linux command line? The terminal itself. + +Yes, the terminal emulator (commonly known as terminal) can be pretty amusing as well. Remember the [Cool Retro Term terminal that gives you a vintage terminal][2] of 80s and early 90s? + +How about an eye candy terminal that is heavily inspired from the [TRON Legacy][3] movie effects? + +In this article, let’s take a look at an amazing cross-platform terminal emulator that can keep you drooling over your terminal! + +### eDEX-UI: A Cool Terminal Emulator + +![][4] + +[eDEX-UI][5] is an open-source cross-platform terminal emulator that presents you with a Sci-Fi inspired look along with useful some features as well. + +It was originally inspired from the [DEX UI][6] project which is no longer maintained. + +Even though eDEX-UI is more about the looks and the futuristic theme for a terminal, it could double up as a [system monitoring tool for Linux][7]. How? Because it shows system stats in the sidebar while you work in the terminal. In fact, the developer mentions that he aims to improve it as a usable sysadmin tool. + +Let’s take a look at what else it offers and how to get it installed on your computer. + +### Features of eDEX-UI + +![][8] + +eDEX-UI is essentially a terminal emulator. You can use it like your regular terminal for running commands and whatever else you do in the terminal. + +It runs in full screen with sidebars and bottom panels to monitor system and networks stats. There is also a virtual keyboard for touch devices. + +I made a short video and I suggest watching this video to see this cool terminal emulator in action. **Play the video with sound** for the complete effect (trust me on this). + +[Subscribe to our YouTube channel for more Linux videos][9] + +eDEX-UI has a directory viewer on the left bottom side. + + * Multiple tabs + * Support for curses + * Directory viewer to show the contents of the current working directory + * Displays system information that includes Motherboard info, Network status, IP, network bandwidth used, CPU usage, temperature of the CPU, RAM usage, and so on + * Customization options to change the theme, keyboard layout, CSS injection + * Optional sound effect to give you a hacking vibe + * Cross-platform support (Windows, macOS, and Linux) + + + +### Installing eDEX on Linux + +![eDEX-UI with Matrix theme][10] + +As mentioned, it supports all the major platforms that includes Windows, macOS, and of course, Linux. + +To install it on any Linux distribution, you can either grab the AppImage file from its [GitHub releases section][11] or find it in one of the [available repositories][12] that include [AUR][13] as well. + +In case you didn’t know, I’d recommend going through our guide on [using AppImage in Linux][14]. + +You can visit the project on its GitHub page and if you like it, feel free to star their repository. + +[eDEX-UI][5] + +### My experience with eDEX-UI + +I liked this terminal emulator because of the sci-fi inspired look. However, I found it pretty heavy on the system resources. I didn’t [check the CPU temperature on my Linux system][15] but the CPU consumption was surely high. + +So, you might have to take care about that if you need it running it in the background or in a separate workspace (like I do). Apart from that, it’s an impressive tool with useful options like directory viewer and system resource monitoring. + +By the way, if you just want to entertain guests and children with a [hacking simulation, try Hollywood tool][16]. + +What do you think about eDEX-UI? Is it something you would like to give a try or is too kiddish/overwhelming for you? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/edex-ui-sci-fi-terminal/ + +作者:[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/funny-linux-commands/ +[2]: https://itsfoss.com/cool-retro-term/ +[3]: https://www.imdb.com/title/tt1104001/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/edex-ui-hacking-terminal.jpg?resize=800%2C450&ssl=1 +[5]: https://github.com/GitSquared/edex-ui +[6]: https://github.com/seenaburns/dex-ui +[7]: https://itsfoss.com/linux-system-monitoring-tools/ +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/edex-ui-screenshot-1.png?resize=800%2C450&ssl=1 +[9]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/edex-ui-screenshot.png?resize=800%2C450&ssl=1 +[11]: https://github.com/GitSquared/edex-ui/releases +[12]: https://repology.org/project/edex-ui/versions +[13]: https://itsfoss.com/aur-arch-linux/ +[14]: https://itsfoss.com/use-appimage-linux/ +[15]: https://itsfoss.com/check-laptop-cpu-temperature-ubuntu/ +[16]: https://itsfoss.com/hollywood-hacker-screen/ From 7497e7d493a858e477695367a6d7c76de9a4a2c9 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 23 Sep 2020 05:05:52 +0800 Subject: [PATCH 0192/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200922?= =?UTF-8?q?=20Run=20Linux=20apps=20on=20your=20Chromebook?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200922 Run Linux apps on your Chromebook.md --- ...00922 Run Linux apps on your Chromebook.md | 187 ++++++++++++++++++ 1 file changed, 187 insertions(+) create mode 100644 sources/tech/20200922 Run Linux apps on your Chromebook.md diff --git a/sources/tech/20200922 Run Linux apps on your Chromebook.md b/sources/tech/20200922 Run Linux apps on your Chromebook.md new file mode 100644 index 0000000000..473d455b3e --- /dev/null +++ b/sources/tech/20200922 Run Linux apps on your Chromebook.md @@ -0,0 +1,187 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Run Linux apps on your Chromebook) +[#]: via: (https://opensource.com/article/20/9/linux-chromebook) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +Run Linux apps on your Chromebook +====== +Run all the Linux apps you want using Crostini on your Chromebook. +![Person drinking a hot drink at the computer][1] + +Chromebooks have been a game-changer for PreK-12 school systems, enabling them to purchase low-cost laptop computers for students, teachers, and administrators to use. While [Chromebooks][2] have always been powered by a Linux-based operating system (Chrome OS), until recently, there was no way to run most Linux apps on one. But that changed when Google released [Crostini][3], a virtual machine that allows Chromebooks to run Linux (Beta). + +Most Chromebooks released after 2019 and some earlier models can run Crostini and Linux (Beta). Check this [list of supported devices][4] to see if your Chromebook is on it. Fortunately, my Acer Chromebook 15 with 2GB RAM and an Intel Celeron processor is supported. + +![Acer Chromebook specs][5] + +(Don Watkins, [CC BY-SA 4.0][6]) + +I recommend using a Chromebook with 4GB RAM and more disk space if you plan to install a lot of Linux applications. + +### Set up Linux (Beta) + +After you sign into your Chromebook, "mouse over" to the lower-right corner of the screen where the clock is displayed, and left-click there. A panel will open with options at the top (from left to right) to sign out, shut down, lock, and open Settings. Choose the **Settings** icon. + +![Chromebook Settings button][7] + +(Don Watkins, [CC BY-SA 4.0][6]) + +Look on the left side of the **Settings** panel, and you will see **Linux (Beta)** listed. + +![Chromebook Settings][8] + +(Don Watkins, [CC BY-SA 4.0][6]) + +Click on **Linux (Beta),** and the main panel will change to present an option to launch it. Click the **Turn on** button. + +![Turn on Linux \(Beta\)][9] + +(Don Watkins, [CC BY-SA 4.0][6]) + +It will start the process of setting up a Linux environment on your Chromebook. + +![Setting up Linux \(Beta\)][10] + +(Don Watkins, [CC BY-SA 4.0][6]) + +Next, you will be prompted to enter a **Username** and the size you want your Linux installation to be. + +![Setting up Linux \(Beta\)][11] + +(Don Watkins, [CC BY-SA 4.0][6]) + +It takes a few minutes to install Linux on your Chromebook. + +![Installing Linux \(Beta\)][12] + +(Don Watkins, [CC BY-SA 4.0][6]) + +After the installation completes, you can use Linux on your Chromebook. The menu bar on the bottom of your Chromebook's display has a shortcut to a **terminal**, a text-based interface you can use to interact with Linux. + +![Linux \(Beta\) terminal][13] + +(Don Watkins, [CC BY-SA 4.0][6]) + +You can use [common Linux commands][14] like `ls`, `lscpu`, and `top` to see more of your environment. You can install applications using `sudo apt install`. + +### Install your first Linux application + +Being able to install and run free and open source software on a Chromebook can be a real winner for financially constrained school districts. + +The first application I recommend installing is the [Mu editor][15] for Python. Install it by entering the following into your terminal: + + +``` +`$ sudo apt install mu-editor` +``` + +It takes a bit over five minutes to install, but in the end, you'll have access to a really good Python editor for students and anyone else who wants to learn Python. + +I've had great success using [Mu and Python as a learning tool][16]. For example, I have taught my students to write code for Python's turtle module and execute it to create graphics. I was disappointed that I wasn't able to use Mu with a [BBC:Microbit][17] open hardware board. Even though the Microbit connects to USB and there is USB support in the Chromebook's Linux virtual environment, I couldn't make it work. + +![Mu editor][18] + +(Don Watkins, [CC BY-SA 4.0][6]) + +Once you've installed an application, it will show up in a special **Linux Apps** menu, which you can see on the lower-right of this screenshot. + +![Linux Apps menu][19] + +(Don Watkins, [CC BY-SA 4.0][6]) + +### Install other applications + +You can install more than just a programming language and code editor. In fact, you can install most of your favorite open source applications. + +For example, you can install the LibreOffice suite with: + + +``` +`$ sudo apt install libreoffice` +``` + +The open source audio software [Audacity][20] is one of my other favorite classroom applications. My Chromebook's microphone works with Audacity, making it easy to create podcasts or edit free sounds from [Wikimedia Commons][21]. It's easy to install Audacity on a Chromebook—with the Crostini virtual environment running, open the terminal and enter: + + +``` +`$ sudo apt install audacity` +``` + +Then launch Audacity from the command line or look for it in the **Linux Apps** section of the Chromebook menu. + +![Audacity][22] + +(Don Watkins, [CC BY-SA 4.0][6]) + +I also easily installed [TuxMath][23] and [TuxType][24], a couple of great applications for education. I was even able to install and run the image editor [GIMP][25]. All the Linux applications come from Debian Linux repositories. + +![GIMP][26] + +(Don Watkins, [CC BY-SA 4.0][6]) + +### Share files + +There is a utility within Linux (Beta) to back up and restore your files. You can also share files between your Linux (Beta) virtual machine and your Chromebook by opening the **Files** app on the Chromebook and right-clicking on the folder you want to share. You can choose to share all of your Chromebook files or create a special folder for shared files. While you are in the Linux virtual machine, you can access this folder by browsing to `/mnt/chromeos`. + +![Sharing files][27] + +(Don Watkins, [CC BY-SA 4.0][6]) + +### Learn more + +The [documentation][28] for Linux (Beta) is very complete, so read it thoroughly to learn more about its capabilities. Some key takeaways from the documentation are: + + * Cameras are not yet supported. + * Android devices are supported over USB. + * Hardware acceleration is not yet supported. + * You can access the microphone. + + + +Are you using Linux applications on your Chromebook? Tell us all about it in the comments! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/linux-chromebook + +作者:[Don Watkins][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://opensource.com/users/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hot drink at the computer) +[2]: https://en.wikipedia.org/wiki/Chromebook +[3]: https://chromium.googlesource.com/chromiumos/docs/+/master/containers_and_vms.md +[4]: https://www.chromium.org/chromium-os/chrome-os-systems-supporting-linux +[5]: https://opensource.com/sites/default/files/uploads/chromebook-specs.png (Acer Chromebook specs) +[6]: https://creativecommons.org/licenses/by-sa/4.0/ +[7]: https://opensource.com/sites/default/files/uploads/chromebook-settings.png (Chromebook Settings button) +[8]: https://opensource.com/sites/default/files/uploads/chromebook-linux-beta.png (Chromebook Settings) +[9]: https://opensource.com/sites/default/files/uploads/chromebook-launch-linux-beta.png (Turn on Linux (Beta)) +[10]: https://opensource.com/sites/default/files/uploads/chromebook-setup-linux-beta_0.png (Setting up Linux (Beta)) +[11]: https://opensource.com/sites/default/files/uploads/chromebook-linux-beta-username.png (Setting up Linux (Beta)) +[12]: https://opensource.com/sites/default/files/uploads/chromebook-linux-beta-install.png (Installing Linux (Beta)) +[13]: https://opensource.com/sites/default/files/uploads/chromebook-linux-terminal.png (Linux (Beta) terminal) +[14]: https://opensource.com/downloads/linux-common-commands-cheat-sheet +[15]: https://codewith.mu +[16]: https://opensource.com/article/20/9/teaching-python-mu +[17]: https://opensource.com/article/19/8/getting-started-bbc-microbit +[18]: https://opensource.com/sites/default/files/uploads/chromebook-mu.png (Mu editor) +[19]: https://opensource.com/sites/default/files/uploads/chromebook-linux-apps.png (Linux Apps menu) +[20]: https://www.audacityteam.org/ +[21]: https://commons.wikimedia.org/wiki/Commons:Free_media_resources/Sound +[22]: https://opensource.com/sites/default/files/uploads/chromebook-audacity.png (Audacity) +[23]: https://sourceforge.net/projects/tuxmath/ +[24]: https://sourceforge.net/projects/tuxtype/ +[25]: https://www.gimp.org/ +[26]: https://opensource.com/sites/default/files/uploads/chromebook-gimp.png (GIMP) +[27]: https://opensource.com/sites/default/files/uploads/chromebook-linux-share-files.png (Sharing files) +[28]: https://support.google.com/chromebook/answer/9145439?p=chromebook_linuxapps&b=banon-signed-mpkeys&visit_id=637346541887671598-1548999339&rd=1 From 91abbc6e1fa4b7742e7c49b7568da1a71cf2233c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 23 Sep 2020 05:06:06 +0800 Subject: [PATCH 0193/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200922?= =?UTF-8?q?=20Easily=20set=20image=20transparency=20using=20GIMP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200922 Easily set image transparency using GIMP.md --- ...asily set image transparency using GIMP.md | 151 ++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 sources/tech/20200922 Easily set image transparency using GIMP.md diff --git a/sources/tech/20200922 Easily set image transparency using GIMP.md b/sources/tech/20200922 Easily set image transparency using GIMP.md new file mode 100644 index 0000000000..54e3e9da76 --- /dev/null +++ b/sources/tech/20200922 Easily set image transparency using GIMP.md @@ -0,0 +1,151 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Easily set image transparency using GIMP) +[#]: via: (https://opensource.com/article/20/9/chroma-key-gimp) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Easily set image transparency using GIMP +====== +Use chroma key or "green screen" techniques to set transparencies on +your video-game graphics. +![Gaming with penguin pawns][1] + +Whether you're programming a game or an app with [Python][2] or [Lua][3], you're probably using PNG graphics for your game assets. An advantage of the PNG format, which is not available in a JPEG, is the ability to store an **alpha channel**. Alpha is, essentially, the "color" of invisibility or transparency. Alpha is the part of an image you _don't_ see. For example, if you were to draw a doughnut, the doughnut hole would be filled with alpha, and you could see whatever was behind it. + +A common problem is how to find the alpha part of an image. Sometimes, your programming framework, whether it's [Python Arcade][4], [Pygame][5], LÖVE, or anything else, detects the alpha channel and treats it (after the appropriate function calls) as transparency. That means it renders no new pixels where there's alpha, leaving that doughnut hole empty. It's 100% transparent or 0% opaque and functionally "invisible." + +Other times, your framework and your graphic asset don't agree on where the alpha channel is located (or that an alpha channel exists at all), and you get pixels where you wanted transparency. + +This article describes the most sure-fire way I know to work around that. + +### Chroma key + +In computer graphics, there are a few values that contribute to how a pixel is rendered. **Chrominance**, or **chroma**, describes the saturation or intensity of a pixel. The **chroma key** technique (also known as **green screening**) was originally developed as a chemical process, in which a specific color (blue at first and later green) was deliberately obscured by a **matte** during the copying of a film negative, allowing another image to be substituted where there once was a blue or green screen. That's a simplified explanation, but it demonstrates the origins of what is known as the alpha channel in computer graphics. + +An alpha channel is information saved in a graphic to identify pixels that are meant to be transparent. RGB graphics, for example, have red, green, and blue channels. RGBA graphics contain red, green, blue, and alpha. The value of alpha can range from 0 to 1, with decimal points being valid entries. + +Because an alpha channel can be expressed in several different ways, relying on an embedded alpha channel can be problematic. Instead, you can pick a color and turn it into an alpha value of 0 in your game framework. For that to work, you must know the colors in your graphic. + +### Prepare your graphic + +To prepare a graphic with an explicit color reserved exclusively for a chroma key, open the graphic in your favorite graphic editor. I recommend [GIMP][6] or [Glimpse][7], but [mtPaint][8] or [Pinta][9] or even [Inkscape][10] can work just as well, depending on the nature of your graphics and your ability to translate these instructions to a different tool. + +Start by opening this graphic of Tux the penguin: + +![Tux the penguin][11] + +(Seth Kenlon, [CC BY-SA 4.0][12]) + +### Select the graphic + +Once the graphic is open, go to the **Windows** menu and select **Dockable Dialogs** and then **Layers**. Right-click on Tux's layer in the **Layer** palette. From the pop-up menu, select **Alpha to Selection**. If your image does not have a built-in alpha channel, then you must create your own selection manually. + +![Alpha to selection][13] + +(Seth Kenlon, [CC BY-SA 4.0][12]) + +To create a selection manually, click the **Paths** tool from the toolbox. + +![GIMP Paths tool][14] + +(Seth Kenlon, [CC BY-SA 4.0][12]) + +Using the **Paths** tool, move your mouse around the graphic, clicking and releasing (do not drag) at each major intersection of its outline. Don't worry about following curves; just find the major intersections and corners. This creates a node at each point, with a straight line drawn between them. You don't need to close your path, so when you reach the final intersection before the one where you started, you're done. + +![Create a path in GIMP][15] + +(Seth Kenlon, [CC BY-SA 4.0][12]) + +Once you've created your outline path, go to the **Windows** menu and select **Dockable Dialogs** and then **Tool Options**. In the **Tool Options** panel, select **Edit (Ctrl)**. With this activated, you can edit the paths you've just drawn by clicking the lines or nodes and adjusting them to fit your graphic better. You can even give the lines curves. + +![Edit path][16] + +(Seth Kenlon, [CC BY-SA 4.0][12]) + +Now select the **Paths** panel from the **Windows > Dockable Dialogs** menu. In the **Paths** panel, click the **Path to Selection** button. Your graphic is now selected. + +### Grow the selection + +If you feel your selection is too tight, you can give yourself a little slack by growing the selection. I sometimes do this when I want to impose or thicken a border around a graphic. + +To grow a selection, click the **Select** menu and choose **Grow**. Enter a pixel value and click **OK**. + +### Invert the selection + +You have your graphic selected, but what you actually want to select is everything _except_ your graphic. That's because you're creating an alpha matte to define what in your graphic will be replaced by something else. In other words, you need to mark the pixels that will be turned invisible. + +To invert the selection, click on the **Select** menu and choose **Invert**. Now everything except your graphic is selected. + +### Fill with alpha + +With everything except your graphic selected, choose the color you want to use to designate your alpha matte. The most common color is green (as you might guess from the term "green screen"). There's nothing magical about the color green or even a particular shade of green. It's used because humans, frequent subjects of graphic manipulation, contain no green pigment, so it's easy to key out green without accidentally keying out part of the central subject. Of course, if your graphic is a green alien or an emerald or something that _does_ contain green, you should use a different color. You can use any color you want, as long as it's solid and consistent. If you're doing this to many graphics, your choice should be consistent across all graphics. + +![Foreground color in toolbox][17] + +(Seth Kenlon, [CC BY-SA 4.0][12]) + +Set your foreground color with the color value you've chosen. To ensure that your choice is exact, use the [HTML][18] or [HSV][19] representation of the color. For example, if you're using pure green, it can be expressed in GIMP (and most open source graphic applications) as `00ff00` (that's 00 red, FF green, and 00 blue, with F being the maximum amount). + +![Setting color values][20] + +(Seth Kenlon, [CC BY-SA 4.0][12]) + +Whatever color you choose, make sure you take note of the HTML or HSV values so you use the exact same color for every graphic. + +To fill in your alpha matte, click the **Edit** menu and choose **Fill with FG Color**. + +### Flatten and export + +If you've left a border around your graphic, set your background color to the color you want to use as the border stroke. This is usually either black or white, but it can be anything that suits your game's aesthetic. + +Once you have set the background color, click on the **Image** menu and select **Flatten Image**. It's safe to do this whether or not you added a border. This process removes the alpha channel from your image, filling in any "transparent" pixels with the background color. + +![Flattening image][21] + +(Seth Kenlon, [CC BY-SA 4.0][12]) + +You now have an image ready for your game engine. Export the image to whatever format your game engine prefers, and then import it into your game using whatever function calls it requires. In your code, set the alpha value to `00ff00` (or whatever color you used), and then use the game engine's graphic transforms to treat that color as an alpha channel. + +### Other methods + +This isn't the only way to get transparency in your game graphics. Check your game engine's documentation to find out how it tries to process alpha channels by default, and when you're not certain, try letting your game engine auto-detect transparency in your graphic before you go about editing it. Sometimes, your game engine's expectations and your graphic's preset values happen to match, and you get transparency without having to do any extra work. + +When that fails, though, try a little chroma key. It's worked for the film industry for nearly 100 years, and it can work for you too. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/chroma-key-gimp + +作者:[Seth Kenlon][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://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/gaming_grid_penguin.png?itok=7Fv83mHR (Gaming with penguin pawns) +[2]: https://opensource.com/article/17/10/python-101 +[3]: https://opensource.com/article/17/4/how-program-games-raspberry-pi +[4]: https://opensource.com/article/18/4/easy-2d-game-creation-python-and-arcade +[5]: https://opensource.com/article/17/12/game-framework-python +[6]: http://gimp.org +[7]: https://glimpse-editor.github.io +[8]: https://opensource.com/article/17/2/mtpaint-pixel-art-animated-gifs +[9]: https://www.pinta-project.com/ +[10]: http://inkscape.org +[11]: https://opensource.com/sites/default/files/uploads/tux.png (Tux the penguin) +[12]: https://creativecommons.org/licenses/by-sa/4.0/ +[13]: https://opensource.com/sites/default/files/uploads/gimp_alpha-to-selection.jpg (Alpha to selection) +[14]: https://opensource.com/sites/default/files/uploads/gimp_path-tool.jpg (GIMP Paths tool) +[15]: https://opensource.com/sites/default/files/uploads/gimp_path-create.jpg (Create a path in GIMP) +[16]: https://opensource.com/sites/default/files/uploads/gimp_path-edit.jpg (Edit path) +[17]: https://opensource.com/sites/default/files/uploads/gimp_foreground-colour.jpg (Foreground color in toolbox) +[18]: https://www.w3schools.com/colors/colors_picker.asp +[19]: https://en.wikipedia.org/wiki/HSL_and_HSV +[20]: https://opensource.com/sites/default/files/uploads/gimp_colour.jpg (Setting color values) +[21]: https://opensource.com/sites/default/files/uploads/gimp_matte.jpg (Flattening image) From db1f9d566ecc812eede16a21c86416a357332670 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 23 Sep 2020 05:43:55 +0800 Subject: [PATCH 0194/1156] PRF @geekpi --- ...ource Password Manager -Not Cloud Based.md | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/translated/tech/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md b/translated/tech/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md index 5589d279ff..a7c9efe372 100644 --- a/translated/tech/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md +++ b/translated/tech/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md @@ -1,28 +1,30 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (KeePassXC is An Amazing Community Driven Open Source Password Manager [Not Cloud Based]) [#]: via: (https://itsfoss.com/keepassxc/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -KeePassXC 是一个很好的社区驱动的开源密码管理器(不是基于云) +KeePassXC:社区驱动的开源密码管理器(不基于云服务) ====== -_**简介:KeePassXC 是一款有用的开源跨平台密码管理器,它即使不是云端工具,也没有在功能上妥协。下面,我们就来快速了解一下它。**_ +![](https://img.linux.net.cn/data/attachment/album/202009/23/054245jxx9pyzk8p3kbxhw.jpg) + +> KeePassXC 是一款有用的开源跨平台密码管理器,即使它不是云端工具,在功能上也毫不逊色。下面,我们就来快速了解一下它。 ### KeePassXC:一个跨平台的开源密码管理器 ![][1] -KeePassXC 是 [KeePassX][2] 的社区分支,旨在成为 [KeePass Password Safe][3] 的跨平台移植(适用于 Windows)。它是完全免费使用和跨平台的(Windows、Linux 和 macOS)。 +KeePassXC 是 [KeePassX][2] 的社区复刻版本,旨在成为 [KeePass Password Safe][3](适用于 Windows)的跨平台移植。它是完全免费使用和跨平台的(Windows、Linux 和 macOS)。 事实上,它是目前 [Linux 最佳密码管理器][4]之一。它的功能选项既适合新手,也适合那些想要进一步控制以保护系统上的密码数据库的高级用户。 是的,与我[最喜欢的 Bitwarden 密码管理器][5]不同,KeePassXC 不是基于云端的,密码永远不会离开系统。有些用户确实喜欢不把密码和秘密保存在云服务器中。 -当你开始使用密码管理器时,你应该能在它上找到你所需要的所有基本功能。但是,在这里,为了让你初步了解,我会强调一些提供的功能。 +当你开始使用密码管理器时,你应该能在它上找到你所需要的所有基本功能。但是,在这里,为了让你初步了解,我会强调提到一些它提供的功能。 ### KeePassXC 的功能 @@ -30,34 +32,31 @@ KeePassXC 是 [KeePassX][2] 的社区分支,旨在成为 [KeePass Password Saf 值得注意的是,对于一个新手来说,这些功能可能会让人有点不知所措。但是,考虑到你想充分使用它,我想你应该真正了解它所提供的功能: - * 密码生成器 -* 能够从1Password、KeePass 1 和任何 CSV 文件导入密码。 +* 能够从 1Password、KeePass 1 和任何 CSV 文件导入密码。 * 通过导出和同步 SSL 证书支持,轻松共享数据库。 * 支持数据库加密 (256 位 AES) -* 浏览器集成(可选) -* 能够搜索你的密码 +* 浏览器集成(可选) +* 能够搜索你的凭证 * 在应用中自动输入密码 * 数据库报告,以检查密码的健康状况和其他统计数字 * 支持导出为 CSV 和 HTML * 支持双因素认证令牌 * 支持将文件附加到密码中 * 支持 YubiKey -* 可用命令行选项 -* 集成 SSH Agent +* 支持命令行 +* 支持集成 SSH 代理 * 必要时改变加密算法 -* 能够使用 DuckDuckGO 下载网站图标。 +* 能够使用 DuckDuckGO 下载网站图标 * 数据库超时自动锁定 -* 清除剪贴板和搜索查询的能力。 +* 清除剪贴板和搜索查询的能力 * 自动保存文件 * 支持文件夹/嵌套文件夹 * 设置密码的有效期 * 提供黑暗主题 * 跨平台支持 - - -正如你所看到的,它的确是一款功能丰富的密码管理器。所以,我建议你如果想使用目前的每一个选项,就好好探索它。 +正如你所看到的,它的确是一款功能丰富的密码管理器。所以,我建议你如果想使用提供的每一个功能,就好好探索它。 ![][7] @@ -71,14 +70,13 @@ KeePassXC 是 [KeePassX][2] 的社区分支,旨在成为 [KeePass Password Saf 如果你好奇,你可以直接探索[官方下载页面][9]的可用包,并查看他们的 [GitHub 页面][10]的源代码。 - -[Get KeePassXC][11] +- [下载 KeePassXC][11] ### 总结 如果你不是 [Bitwarden][5] 等云端开源密码管理器的粉丝,KeePassXC 应该是你的绝佳选择。 -在这里你得到的功能数量让你可以在多个平台上保证密码的安全和易于维护。即使没有开发团队的”官方“移动应用,你也可以尝试他们的一些[推荐应用][12],它们与数据库兼容,并提供相同的功能。 +在这里你得到的功能数量可以让你可以在多个平台上保证密码的安全和易于维护。即使没有开发团队的“官方”移动应用,你也可以尝试他们的一些[推荐应用][12],它们与其数据库兼容,并提供相同的功能。 你尝试过 KeePassXC 吗?你更喜欢使用什么作为你的密码管理器?请在下面的评论中告诉我你的想法。 @@ -89,7 +87,7 @@ via: https://itsfoss.com/keepassxc/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 54f88bd11e73169e60218a3f9cf43f3c298f5440 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 23 Sep 2020 05:44:32 +0800 Subject: [PATCH 0195/1156] PUB @geekpi https://linux.cn/article-12642-1.html --- ...ty Driven Open Source Password Manager -Not Cloud Based.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md (98%) diff --git a/translated/tech/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md b/published/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md similarity index 98% rename from translated/tech/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md rename to published/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md index a7c9efe372..94d5aa5334 100644 --- a/translated/tech/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md +++ b/published/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12642-1.html) [#]: subject: (KeePassXC is An Amazing Community Driven Open Source Password Manager [Not Cloud Based]) [#]: via: (https://itsfoss.com/keepassxc/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From f9a1dfd992c5d15338c6d8fd922521e851bfbdb0 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 23 Sep 2020 08:58:51 +0800 Subject: [PATCH 0196/1156] translated --- ...is not valid yet- Error in Ubuntu Linux.md | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) rename {sources => translated}/tech/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md (62%) diff --git a/sources/tech/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md b/translated/tech/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md similarity index 62% rename from sources/tech/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md rename to translated/tech/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md index 6df3e3e26d..50779b6b9f 100644 --- a/sources/tech/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md +++ b/translated/tech/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md @@ -7,16 +7,16 @@ [#]: via: (https://itsfoss.com/fix-repository-not-valid-yet-error-ubuntu/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -How to Fix “Repository is not valid yet” Error in Ubuntu Linux +如何修复 Ubuntu Linux中 的 ”Repository is not valid yet“ 错误 ====== -I recently [installed Ubuntu server on my Raspberry Pi][1]. I [connected it to the Wi-Fi from Ubuntu terminal][2] and went about doing what I do after installing any Linux system which is to update the system. +我最近[在我的树莓派上安装了 Ubuntu 服务器][1]。我[在 Ubuntu 终端连接上了 Wi-Fi][2],然后做了我在安装任何 Linux 系统后都会做的事情,那就是更新系统。 -When I used the ‘sudo apt update’ command, it gave me an error which was kind of unique to me. It complained that release file for the repository was invalid for a certain time period. +当我使用 ”sudo apt update“ 命令时,它给了一个对我而言特别的错误。它报出仓库的发布文件在某个时间段内无效。 **E: Release file for is not valid yet (invalid for another 159d 15h 20min 52s). Updates for this repository will not be applied.** -Here’s the complete output: +下面是完整输出: ``` [email protected]:~$ sudo apt update @@ -31,13 +31,13 @@ E: Release file for http://ports.ubuntu.com/ubuntu-ports/dists/focal-backports/I E: Release file for http://ports.ubuntu.com/ubuntu-ports/dists/focal-security/InRelease is not valid yet (invalid for another 159d 15h 20min 52s). Updates for this repository will not be applied. ``` -### Fixing “release file is not valid yet” error in Ubuntu and other Linux distributions +### 修复 Ubuntu 和其他 Linux 发行版中 ”release file is not valid yet“ 的错误。 ![][3] -The reason for the error is the difference in the time on the system and the time in real world. +错误的原因是系统上的时间和现实世界的时间不同。 -You see, every repository file is signed on some date and you can see this information by viewing the release file: +你看,每个仓库文件都是在某个日期签名的,你可以通过查看发布文件信息了解: ``` sudo head /var/lib/apt/lists/ports.ubuntu.com_ubuntu_dists_focal_InRelease @@ -53,29 +53,29 @@ Date: Thu, 23 Apr 2020 17:33:17 UTC Architectures: amd64 arm64 armhf i386 ppc64el riscv64 s390x ``` -Now, for some reasons, the time on my Ubuntu server was in the past and this is why Ubuntu complained that the release file is not valid yet for X many days. +现在,由于某些原因,我的 Ubuntu 服务器上的时间是过去时间,这也是为什么 Ubuntu 报出发布文件已经无效 X 天的原因。 -If you are connected to the internet, you may **wait a few minutes for your system to synchronize the time**. +如果你连接到了互联网,你可以**等待几分钟让系统同步时间**。 -If it doesn’t work, you may force the system to use local time as real time clock (hardware clock): +如果不行,你可以强制系统使用本地时间作为实时时钟(硬件时钟): ``` sudo timedatectl set-local-rtc 1 ``` -The timedatectl command enables you to configure time, date and [change timezone on Linux][4]. +timedatectl 命令可以让你在 Linux 上配置时间、日期和[更改时区][4]。 -You shouldn’t need to restart. It works immediately and you can verify it by [updating your Ubuntu system][5] again. +你应该不需要重新启动。它可以立即工作,你可以通过[更新你的 Ubuntu 系统][5]再次验证它。 -If the problem is solved, you may set the [real time clock][6] to use UTC (as recommended by Ubuntu). +如果问题解决了,你可以将[实时时钟][6]设置为使用 UTC(Ubuntu 推荐的)。 ``` sudo timedatectl set-local-rtc 0 ``` -**Did it fix the issue for you?** +**是否为你解决了这个问题?** -I hope this quick tip helped you to fix this error. If you are still facing the issue, let me know in the comment section and I’ll try to help you out. +我希望这个提示能帮助你解决这个错误。如果你仍然遇到这个问题,请在评论栏告诉我,我会尽力帮助你。 -------------------------------------------------------------------------------- @@ -83,7 +83,7 @@ via: https://itsfoss.com/fix-repository-not-valid-yet-error-ubuntu/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[geekpi](https://github.com/geekpi) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From f99c847277d1f46932c2b098266a778a2290f26a Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 23 Sep 2020 09:05:13 +0800 Subject: [PATCH 0197/1156] translating --- sources/tech/20200921 Teach Python with the Mu editor.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200921 Teach Python with the Mu editor.md b/sources/tech/20200921 Teach Python with the Mu editor.md index 1cfecc9304..bf977e766c 100644 --- a/sources/tech/20200921 Teach Python with the Mu editor.md +++ b/sources/tech/20200921 Teach Python with the Mu editor.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 0babfb536eb81f2bb3c88dc40a8f20c4619ce881 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 24 Sep 2020 04:58:09 +0800 Subject: [PATCH 0198/1156] PUB @wxy https://linux.cn/article-12646-1.html --- ...916 Teach Python with Jupyter Notebooks.md | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) rename {translated/tech => published}/20200916 Teach Python with Jupyter Notebooks.md (90%) diff --git a/translated/tech/20200916 Teach Python with Jupyter Notebooks.md b/published/20200916 Teach Python with Jupyter Notebooks.md similarity index 90% rename from translated/tech/20200916 Teach Python with Jupyter Notebooks.md rename to published/20200916 Teach Python with Jupyter Notebooks.md index d4c9ac5be0..423ef5b0a1 100644 --- a/translated/tech/20200916 Teach Python with Jupyter Notebooks.md +++ b/published/20200916 Teach Python with Jupyter Notebooks.md @@ -1,20 +1,20 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12646-1.html) [#]: subject: (Teach Python with Jupyter Notebooks) [#]: via: (https://opensource.com/article/20/9/teach-python-jupyter) [#]: author: (Moshe Zadka https://opensource.com/users/moshez) -用 Jupyter Notebooks 教 Python +用 Jupyter Notebook 教 Python ====== -> 有了 Jupyter、PyHamcrest 和一点测试的代码把它们连在一起,你可以教任何可以进行单元测试的 Python 内容。 +> 有了 Jupyter、PyHamcrest,用一点测试的代码把它们连在一起,你就可以教任何适用于单元测试的 Python 内容。 -![Person reading a book and digital copy][1] +![](https://img.linux.net.cn/data/attachment/album/202009/24/045721mubdfdx1tb11fibi.jpg) -关于 Ruby 社区的一些事情一直让我印象深刻。其中两个例子是对测试的承诺和对易于上手的强调。这两方面最好的例子是 [Ruby Koans][2],在这里你可以通过修复测试来学习 Ruby。 +关于 Ruby 社区的一些事情一直让我印象深刻,其中两个例子是对测试的承诺和对易于上手的强调。这两方面最好的例子是 [Ruby Koans][2],在这里你可以通过修复测试来学习 Ruby。 要是我们能把这些神奇的工具也用于 Python,我们应该可以做得更好。是的,使用 [Jupyter Notebook][3]、[PyHamcrest][4],再加上一点类似于胶带的粘合代码,我们可以做出一个包括教学、可工作的代码和需要修复的代码的教程。 @@ -63,7 +63,7 @@ class TestNumbers(unittest.TestCase): FAILED (failures=1) ``` -“只改这一行” 对学生来说是一个有用的标记。它准确地表明了需要修改的内容。否则,学生可以通过将第一行改为 `return` 来修正测试。 +“只改这一行” 对学生来说是一个有用的标记。它准确地表明了需要修改的内容。否则,学生可以通过将第一行改为 `return` 来修复测试。 在这种情况下,修复很容易: @@ -85,7 +85,7 @@ class TestNumbers(unittest.TestCase): OK ``` -然而,很快,`unittest` 库的原生断言将被证明是不够的。在 `pytest` 中,通过重写 `assert`中的字节码来解决这个问题,使其具有神奇的属性和各种启发式方法。但这在 Jupyter notebook 中就不容易实现了。是时候挖出一个好的断言库了:PyHamcrest。 +然而,很快,`unittest` 库的原生断言将被证明是不够的。在 `pytest` 中,通过重写 `assert` 中的字节码来解决这个问题,使其具有神奇的属性和各种启发式方法。但这在 Jupyter notebook 中就不容易实现了。是时候挖出一个好的断言库了:PyHamcrest。 ``` from hamcrest import * @@ -141,7 +141,7 @@ class TestList(unittest.TestCase): OK ``` -使用 Jupyter、PyHamcrest 和一点测试的粘合代码,你可以教授任何可以进行单元测试的 Python 主题。 +使用 Jupyter、PyHamcrest 和一点测试的粘合代码,你可以教授任何适用于单元测试的 Python 主题。 例如,下面可以帮助展示 Python 从字符串中去掉空白的不同方法之间的差异。 @@ -259,7 +259,7 @@ class TestList(unittest.TestCase): FAILED (failures=2) ``` -他们会得到一个不同的错误信息,显示去除了太多的空白: +他们会得到一个不同的错误信息,显示去除了过多的空白: ``` source_string = " hello world " @@ -267,7 +267,7 @@ source_string = " hello world " @run_test class TestList(unittest.TestCase): - # This one is a freebie: it already works! + # 这是个赠品:它可以工作! def test_complete_strip(self): result = source_string.strip() assert_that(result, @@ -295,7 +295,7 @@ class TestList(unittest.TestCase): OK ``` -在一个比较真实的教程中,会有更多的例子和更多的解释。这种使用 Jupyter Notebooks 的技巧,有的例子可以用,有的例子需要修正,可以用于实时教学,可以用于视频课,甚至,可以用更多的其它零散用途,让学生自己完成一个教程。 +在一个比较真实的教程中,会有更多的例子和更多的解释。这种使用 Jupyter Notebook 的技巧,有的例子可以用,有的例子需要修正,可以用于实时教学,可以用于视频课,甚至,可以用更多的其它零散用途,让学生自己完成一个教程。 现在就去分享你的知识吧! From c1b2ccaf4730083735e2c6488c6909c145ad1234 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 24 Sep 2020 05:01:29 +0800 Subject: [PATCH 0199/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200921?= =?UTF-8?q?=20Installing=20and=20running=20Vagrant=20using=20qemu-kvm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200921 Installing and running Vagrant using qemu-kvm.md --- ...ling and running Vagrant using qemu-kvm.md | 140 ++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 sources/tech/20200921 Installing and running Vagrant using qemu-kvm.md diff --git a/sources/tech/20200921 Installing and running Vagrant using qemu-kvm.md b/sources/tech/20200921 Installing and running Vagrant using qemu-kvm.md new file mode 100644 index 0000000000..54e74b428c --- /dev/null +++ b/sources/tech/20200921 Installing and running Vagrant using qemu-kvm.md @@ -0,0 +1,140 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Installing and running Vagrant using qemu-kvm) +[#]: via: (https://fedoramagazine.org/vagrant-qemukvm-fedora-devops-sysadmin/) +[#]: author: (Andy Mott https://fedoramagazine.org/author/amott/) + +Installing and running Vagrant using qemu-kvm +====== + +![][1] + +Vagrant is a brilliant tool, used by DevOps professionals, coders, sysadmins and regular geeks to stand up repeatable infrastructure for development and testing. From their website: + +> Vagrant is a tool for building and managing virtual machine environments in a single workflow. With an easy-to-use workflow and focus on automation, Vagrant lowers development environment setup time, increases production parity, and makes the “works on my machine” excuse a relic of the past. +> +> If you are already familiar with the basics of Vagrant, the documentation provides a better reference build for all available features and internals. +> +> Vagrant provides easy to configure, reproducible, and portable work environments built on top of industry-standard technology and controlled by a single consistent workflow to help maximize the productivity and flexibility of you and your team. +> +> + +This guide will walk through the steps necessary to get Vagrant working on a Fedora-based machine. + +I started with a minimal install of Fedora Server as this reduces the memory footprint of the host OS, but if you already have a working Fedora machine, either Server or Workstation, then this should still work. + +### Check the machine supports virtualisation: + +``` +$ sudo lscpu | grep Virtualization +Virtualization: VT-x +Virtualization type: full +``` + +### Install qemu-kvm: + +``` +sudo dnf install qemu-kvm libvirt libguestfs-tools virt-install rsync +``` + +### Enable and start the libvirt daemon: + +``` +sudo systemctl enable --now libvirtd +``` + +### Install Vagrant: + +``` +sudo dnf install vagrant +``` + +### Install the Vagrant libvirtd plugin: + +``` +sudo vagrant plugin install vagrant-libvirt +``` + +### Add a box + +``` +vagrant box add fedora/32-cloud-base --provider=libvirt +``` + +### Create a minimal Vagrantfile to test + +``` +$ mkdir vagrant-test +$ cd vagrant-test +$ vi VagrantfileVagrant.configure("2") do |config| + config.vm.box = "fedora/32-cloud-base" +end +``` + +**Note the capitalisation of the file name and in the file itself.** + +### Check the file: + +``` +vagrant statusCurrent machine states: + +default not created (libvirt) + +The Libvirt domain is not created. Run 'vagrant up' to create it. +``` + +### Start the box: + +``` +vagrant up +``` + +### Connect to your new machine: + +``` +vagrant ssh +``` + +That’s it – you now have Vagrant working on your Fedora machine. + +To stop the machine, use _vagrant halt_. This simply halts the machine but leaves the VM and disk in place. +To shut it down and delete it use _vagrant destroy_. This will remove the whole machine and any changes you’ve made in it. + +### Next steps + +You don’t need to download boxes before issuing the _vagrant up_ command – you can specify the box and the provider in the Vagrantfile directly and Vagrant will download it if it’s not already there. Below is an example which also sets the amount memory and number of CPUs: + +``` +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + config.vm.box = "fedora/32-cloud-base" + config.vm.provider :libvirt do |libvirt| + libvirt.cpus = 1 + libvirt.memory = 1024 + end +end +``` + +For more information on using Vagrant, creating your own machines and using different boxes, see the official documentation at + +There is a huge repository of boxes ready to download and use, and the official location for these is Vagrant Cloud – . Some are basic operating systems and some offer complete functionality such as databases, web servers etc. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/vagrant-qemukvm-fedora-devops-sysadmin/ + +作者:[Andy Mott][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/amott/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/09/vagrant-beginner-howto-816x346.png From 2b14d391a95ac13c32287081db0ee4e090701cec Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 24 Sep 2020 05:01:58 +0800 Subject: [PATCH 0200/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200923?= =?UTF-8?q?=20Find=20security=20issues=20in=20Go=20code=20using=20gosec?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200923 Find security issues in Go code using gosec.md --- ... security issues in Go code using gosec.md | 407 ++++++++++++++++++ 1 file changed, 407 insertions(+) create mode 100644 sources/tech/20200923 Find security issues in Go code using gosec.md diff --git a/sources/tech/20200923 Find security issues in Go code using gosec.md b/sources/tech/20200923 Find security issues in Go code using gosec.md new file mode 100644 index 0000000000..b9fc5df16c --- /dev/null +++ b/sources/tech/20200923 Find security issues in Go code using gosec.md @@ -0,0 +1,407 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Find security issues in Go code using gosec) +[#]: via: (https://opensource.com/article/20/9/gosec) +[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe) + +Find security issues in Go code using gosec +====== +Get started with gosec, the Golang security checker. +![A lock on the side of a building][1] + +It's extremely common now to encounter code written in the [Go programming language][2], especially if you are working with containers, Kubernetes, or a cloud ecosystem. Docker was one of the first projects to adopt Golang, Kubernetes followed, and many new projects select Go over other programming languages. + +Like any other language, Go has its share of strengths and weaknesses, which include security flaws. These can arise due to issues in the programming language itself coupled with insecure coding practices, such as memory safety issues in C code, for example. + +Regardless of why they occur, security issues need to be fixed early in development to prevent them from creeping into shipped software. Fortunately, static analysis tools are available to help you tackle these issues in a more repeatable manner. Static analysis tools work by parsing source code written in a programming language and looking for issues. + +Many of these tools are called linters. Traditionally, linters are more focused on finding programming issues, bugs, code style issues, and the like, and they may not find security issues in code. For example, [Coverity][3] is a popular tool that helps find issues in C/C++ code. However, there are tools that specifically seek out security issues in source code. For example, [Bandit][4] looks for security flaws in Python code. And [gosec][5] searches for security flaws in Go source code. Gosec scans the Go abstract syntax tree (AST) to inspect source code for security problems. + +### Get started with gosec + +To play around with gosec and learn how it works, you need a project written in Go. With a wide variety of open source software available, this shouldn't be a problem. You can find one by looking at the [trending Golang repositorties][6] on GitHub. + +For this tutorial, I randomly chose the [Docker CE][7] project, but you can choose any Go project you want. + +#### Install Go and gosec + +If you do not already have Go installed, you can fetch it from your repository. If you use Fedora or another RPM-based Linux distribution: + + +``` +`$ dnf install golang.x86_64` +``` + +Or you can visit the [Golang install][8] page for other options for your operating system. + +Verify that Go is installed on your system using the `version` argument: + + +``` +$ go version +go version go1.14.6 linux/amd64 +$ +``` + +Installing gosec is simply a matter of running the `go get` command: + + +``` +$ go get github.com/securego/gosec/cmd/gosec +$ +``` + +This downloads gosec's source code from GitHub, compiles it, and installs it in a specific location. You can find [other ways of installing the tools][9] in the repo's README. + +Gosec's source code should be downloaded to the location set by `$GOPATH`, and the compiled binary will be installed in the `bin` directory you set for your system. To find out what `$GOPATH` and `$GOBIN` point to, run: + + +``` +$ go env | grep GOBIN +GOBIN="/root/go/gobin" +$ +$ go env | grep GOPATH +GOPATH="/root/go" +$ +``` + +If the `go get` command worked, then the gosec binary should be available: + + +``` +$ +$ ls -l ~/go/bin/ +total 9260 +-rwxr-xr-x. 1 root root 9482175 Aug 20 04:17 gosec +$ +``` + +You can add the `bin` directory in `$GOPATH` to the `$PATH` variable in your shell. This makes the gosec command-line interface (CLI) available just like any other command line on your system: + + +``` +$ which gosec +/root/go/bin/gosec +$ +``` + +Try running the gosec CLI with the `-help` option to see if it is working as expected: + + +``` +$ gosec -help + +gosec - Golang security checker + +gosec analyzes Go source code to look for common programming mistakes that +can lead to security problems. + +VERSION: dev +GIT TAG: +BUILD DATE: + +USAGE: +``` + +Next, create a directory and get the source code for the demo project (Docker CE, in this case) using: + + +``` +$ mkdir gosec-demo +$ +$ cd gosec-demo/ +$ +$ pwd +/root/gosec-demo +$ + +$ git clone +Cloning into 'docker-ce'... +remote: Enumerating objects: 1271, done. +remote: Counting objects: 100% (1271/1271), done. +remote: Compressing objects: 100% (722/722), done. +remote: Total 431003 (delta 384), reused 981 (delta 318), pack-reused 429732 +Receiving objects: 100% (431003/431003), 166.84 MiB | 28.94 MiB/s, done. +Resolving deltas: 100% (221338/221338), done. +Updating files: 100% (10861/10861), done. +$ +``` + +A quick look at the source code shows that most of the project is written in Go—just what you need to tinker with gosec's features: + + +``` +$ ./cloc /root/gosec-demo/docker-ce/ +   10771 text files. +    8724 unique files.                                           +    2560 files ignored. + +\----------------------------------------------------------------------------------- +Language                         files          blank        comment           code +\----------------------------------------------------------------------------------- +Go                                7222         190785         230478        1574580 +YAML                                37           4831            817         156762 +Markdown                           529          21422              0          67893 +Protocol Buffers                   149           5014          16562          10071 +``` + +### Run gosec with the default options + +Run gosec on the Docker CE project using the default options by running `gosec ./...` from within the Git repo you just cloned. A lot of output will be shown on the screen. Towards the end, you should see a short `Summary` showing the number of files scanned, the number of lines in those files, and the issues it found in the source code: + + +``` +$ pwd +/root/gosec-demo/docker-ce +$ +$ time gosec ./... +[gosec] 2020/08/20 04:44:15 Including rules: default +[gosec] 2020/08/20 04:44:15 Excluding rules: default +[gosec] 2020/08/20 04:44:15 Import directory: /root/gosec-demo/docker-ce/components/engine/opts +[gosec] 2020/08/20 04:44:17 Checking package: opts +[gosec] 2020/08/20 04:44:17 Checking file: /root/gosec-demo/docker-ce/components/engine/opts/address_pools.go +[gosec] 2020/08/20 04:44:17 Checking file: /root/gosec-demo/docker-ce/components/engine/opts/env.go +[gosec] 2020/08/20 04:44:17 Checking file: /root/gosec-demo/docker-ce/components/engine/opts/hosts.go + +# End of gosec run + +Summary: +   Files: 1278 +   Lines: 173979 +   Nosec: 4 +  Issues: 644 + +real    0m52.019s +user    0m37.284s +sys     0m12.734s +$ +``` + +If you scroll through the output on the screen, you should see some lines highlighted in various colors: red indicates high-priority issues that need to be looked into first, and yellow indicates medium-priority issues. + +#### About false positives + +Before getting into the findings, I want to share some ground rules. By default, static analysis tools report _everything_ that they find to be an issue based on a set of rules that the tool compares against the code being tested. Does this mean that everything reported by the tool is an issue that needs to be fixed? Well, it depends. The best authorities on this question are the developers who designed and developed the software. They understand the code much better than anybody else, and more importantly, they understand the environment where the software will be deployed and how it will be used. + +This knowledge is critical when deciding whether a piece of code flagged by a tool is actually a security flaw. Over time and with more experience, you will learn to tweak static analysis tools to ignore issues that are not security flaws and make the reports more actionable. So, an experienced developer doing a manual audit of the source code would be in a better position to decide whether an issue reported by gosec warrants attention or not. + +#### High-priority issues + +According to the output, gosec found a high-priority issue that Docker CE is using an old Transport Layer Security (TLS) version. Whenever possible, it's best to use the latest version of a software or library to ensure it is up to date and has no security issues. + + +``` +[/root/gosec-demo/docker-ce/components/engine/daemon/logger/splunk/splunk.go:173] - G402 (CWE-295): TLS MinVersion too low. (Confidence: HIGH, Severity: HIGH) +    172: +  > 173:        tlsConfig := &tls.Config{} +    174: +``` + +It also found a weak random number generator. Depending on how the generated random number is used, you can decide whether or not this is a security flaw. + + +``` +[/root/gosec-demo/docker-ce/components/engine/pkg/namesgenerator/names-generator.go:843] - G404 (CWE-338): Use of weak random number generator (math/rand instead of crypto/rand) (Confidence: MEDIUM, Severity: HIGH) +    842: begin: +  > 843:        name := fmt.Sprintf("%s_%s", left[rand.Intn(len(left))], right[rand.Intn(len(right))]) +    844:        if name == "boring_wozniak" /* Steve Wozniak is not boring */ { +``` + +#### Medium-priority issues + +The tool also found some medium-priority issues. It flagged a potential denial of service (DoS) vulnerability by way of a decompression bomb related to a tar that could possibly be exploited by a malicious actor. + + +``` +[/root/gosec-demo/docker-ce/components/engine/pkg/archive/copy.go:357] - G110 (CWE-409): Potential DoS vulnerability via decompression bomb (Confidence: MEDIUM, Severity: MEDIUM) +    356: +  > 357:                        if _, err = io.Copy(rebasedTar, srcTar); err != nil { +    358:                                w.CloseWithError(err) +``` + +It also found an issue related to a file that is included by way of a variable. If malicious users take control of this variable, they could change its contents to read a different file. + + +``` +[/root/gosec-demo/docker-ce/components/cli/cli/context/tlsdata.go:80] - G304 (CWE-22): Potential file inclusion via variable (Confidence: HIGH, Severity: MEDIUM) +    79:         if caPath != "" { +  > 80:                 if ca, err = ioutil.ReadFile(caPath); err != nil { +    81:                         return nil, err +``` + +File and directory permissions are often the basic building blocks of security on an operating system. Here, gosec identified an issue where you might need to check whether the permissions for a directory are secure or not. + + +``` +[/root/gosec-demo/docker-ce/components/engine/contrib/apparmor/main.go:41] - G301 (CWE-276): Expect directory permissions to be 0750 or less (Confidence: HIGH, Severity: MEDIUM) +    40:         // make sure /etc/apparmor.d exists +  > 41:         if err := os.MkdirAll(path.Dir(apparmorProfilePath), 0755); err != nil { +    42:                 log.Fatal(err) +``` + +Often, you need to launch command-line utilities from source code. Go uses the built-in exec library to do this task. Carefully analyzing the variable used to spawn such utilities can uncover security flaws. + + +``` +[/root/gosec-demo/docker-ce/components/engine/testutil/fakestorage/fixtures.go:59] - G204 (CWE-78): Subprocess launched with variable (Confidence: HIGH, Severity: MEDIUM) +    58: +  > 59:              cmd := exec.Command(goCmd, "build", "-o", filepath.Join(tmp, "httpserver"), "github.com/docker/docker/contrib/httpserver") +    60:                 cmd.Env = append(os.Environ(), []string{ +``` + +#### Low-severity issues + +In this output, gosec identified low-severity issues related to "unsafe" calls, which typically bypass all the memory protections that Go provides. Closely analyze your use of "unsafe" calls to see if they can be exploited in any way possible. + + +``` +[/root/gosec-demo/docker-ce/components/engine/pkg/archive/changes_linux.go:264] - G103 (CWE-242): Use of unsafe calls should be audited (Confidence: HIGH, Severity: LOW) +    263:        for len(buf) > 0 { +  > 264:                dirent := (*unix.Dirent)(unsafe.Pointer(&buf[0])) +    265:                buf = buf[dirent.Reclen:] + +[/root/gosec-demo/docker-ce/components/engine/pkg/devicemapper/devmapper_wrapper.go:88] - G103 (CWE-242): Use of unsafe calls should be audited (Confidence: HIGH, Severity: LOW) +    87: func free(p *C.char) { +  > 88:         C.free(unsafe.Pointer(p)) +    89: } +``` + +It also flagged unhandled errors in the source codebase. You are expected to handle cases where errors could arise in the source code. + + +``` +[/root/gosec-demo/docker-ce/components/cli/cli/command/image/build/context.go:172] - G104 (CWE-703): Errors unhandled. (Confidence: HIGH, Severity: LOW) +    171:                err := tar.Close() +  > 172:                os.RemoveAll(dockerfileDir) +    173:                return err +``` + +### Customize gosec scans + +Using gosec with its defaults brings up many kinds of issues. However, with manual auditing and over time, you learn which issues don't need to be flagged. You can customize gosec to exclude or include certain tests. + +As I mentioned above, gosec uses a set of rules to find problems in Go source code. Here is a complete list of the [rules][10] it uses: + + * G101: Look for hard coded credentials + * G102: Bind to all interfaces + * G103: Audit the use of unsafe block + * G104: Audit errors not checked + * G106: Audit the use of ssh.InsecureIgnoreHostKey + * G107: Url provided to HTTP request as taint input + * G108: Profiling endpoint automatically exposed on /debug/pprof + * G109: Potential Integer overflow made by strconv.Atoi result conversion to int16/32 + * G110: Potential DoS vulnerability via decompression bomb + * G201: SQL query construction using format string + * G202: SQL query construction using string concatenation + * G203: Use of unescaped data in HTML templates + * G204: Audit use of command execution + * G301: Poor file permissions used when creating a directory + * G302: Poor file permissions used with chmod + * G303: Creating tempfile using a predictable path + * G304: File path provided as taint input + * G305: File traversal when extracting zip/tar archive + * G306: Poor file permissions used when writing to a new file + * G307: Deferring a method which returns an error + * G401: Detect the usage of DES, RC4, MD5 or SHA1 + * G402: Look for bad TLS connection settings + * G403: Ensure minimum RSA key length of 2048 bits + * G404: Insecure random number source (rand) + * G501: Import blocklist: crypto/md5 + * G502: Import blocklist: crypto/des + * G503: Import blocklist: crypto/rc4 + * G504: Import blocklist: net/http/cgi + * G505: Import blocklist: crypto/sha1 + * G601: Implicit memory aliasing of items from a range statement + + + +#### Exclude specific tests + +You can customize gosec to prevent it from looking for and reporting on issues that are safe. To ignore specific issues, you can use the `-exclude` flag with the rule codes above. + +For example, if you don't want gosec to find unhandled errors related to hardcoding credentials in source code, you can ignore them by running: + + +``` +$ gosec -exclude=G104 ./... +$ gosec -exclude=G104,G101 ./... +``` + +Sometimes, you know an area of source code is safe, but gosec keeps reporting it as an issue. However, you don't want to exclude that check completely because you want gosec to scan new code added to the codebase. To prevent gosec from scanning the area you know is safe, add a `#nosec` flag to that part of the source code. This ensures gosec continues to scan new code for an issue but ignores the area flagged with `#nosec`. + +#### Run specific checks + +On the other hand, if you need to focus on specific issues, you can use tell gosec to run those checks by using the `-include` option with the rule codes: + + +``` +`$ gosec -include=G201,G202 ./...` +``` + +#### Scan test files + +The Go language has built-in support for testing that uses unit tests to verify whether a component works as expected. In default mode, gosec ignores test files, but if you want them included in the scan, use the `-tests` flag: + + +``` +`gosec -tests ./...` +``` + +#### Change the output format + +Finding issues is only part of the picture; the other part is reporting what it finds in a way that is easy for humans and tools to consume. Fortunately, gosec can output results in a variety of ways. For example, if you want to get reports in JSON format, use the `-fmt` option to specify JSON and save the results in a `results.json` file: + + +``` +$ gosec -fmt=json -out=results.json ./... + +$ ls -l results.json +-rw-r--r--. 1 root root 748098 Aug 20 05:06 results.json +$ + +         { +             "severity": "LOW", +             "confidence": "HIGH", +             "cwe": { +                 "ID": "242", +                 "URL": "" +             }, +             "rule_id": "G103", +             "details": "Use of unsafe calls should be audited", +             "file": "/root/gosec-demo/docker-ce/components/engine/daemon/graphdriver/graphtest/graphtest_unix.go", +             "code": "304: \t// Cast to []byte\n305: \theader := *(*reflect.SliceHeader)(unsafe.Pointer(\u0026buf))\n306: \theader.      Len *= 8\n", +             "line": "305", +             "column": "36" +         }, +``` + +### Find low-hanging fruit with gosec + +A static analysis tool is not a replacement for manual code audits. However, when a codebase is large with many people contributing to it, such a tool often helps find low-hanging fruit in a repeatable way. It is also useful for helping new developers identify and avoid writing code that introduces these security flaws. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/gosec + +作者:[Gaurav Kamathe][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://opensource.com/users/gkamathe +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_3reasons.png?itok=k6F3-BqA (A lock on the side of a building) +[2]: https://golang.org/ +[3]: https://www.synopsys.com/software-integrity/security-testing/static-analysis-sast.html +[4]: https://pypi.org/project/bandit/ +[5]: https://github.com/securego/gosec +[6]: https://github.com/trending/go +[7]: https://github.com/docker/docker-ce +[8]: https://golang.org/doc/install +[9]: https://github.com/securego/gosec#install +[10]: https://github.com/securego/gosec#available-rules From f3682b91fdcbe86a9c9f02a62466c51e1679686b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 24 Sep 2020 05:02:08 +0800 Subject: [PATCH 0201/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200923?= =?UTF-8?q?=20How=20my=20students=20taught=20me=20to=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200923 How my students taught me to code.md --- ...00923 How my students taught me to code.md | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 sources/tech/20200923 How my students taught me to code.md diff --git a/sources/tech/20200923 How my students taught me to code.md b/sources/tech/20200923 How my students taught me to code.md new file mode 100644 index 0000000000..9c2cb8b414 --- /dev/null +++ b/sources/tech/20200923 How my students taught me to code.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How my students taught me to code) +[#]: via: (https://opensource.com/article/20/9/my-students-taught-me-code) +[#]: author: (Jess Weichler https://opensource.com/users/cyanide-cupcake) + +How my students taught me to code +====== +Coding is for everyone—from preschoolers to adults. Here are some ways +to help you and your children learn to code. +![Student desk for open education][1] + +"Hello, I'm Miss Jess, and my students taught me how to code." + +When I say this to new students, they often think I misspoke. But it's true. Coding always interested me, but it seemed inaccessible. Then my students taught me to code a video game during a few lunch breaks. + +Their encouraging advice and suggestions helped me create my first video game using [Scratch][2]. The game was simple. It was about a monkey catching bananas as they fell from the sky. If you caught a ripe banana, you earned points. + +One of my students chimed in with an idea: "Why don't you have bad bananas that take away points?" + +The answer was that I didn't know how to do that yet. But this simple idea was kind of like a puzzle to me. And there's nothing I love more than a good puzzle. So I spent a lunch break working at this new idea until I solved it. + +An accidental side effect of this project was that I was strengthening my math skills. I'd made it through high school and university without ever really understanding what a variable was. But finally having a real-world application I cared about—needing a scoring system for my game—made it all make sense. + +![Scratch game][3] + +(Jess Weichler, [CC BY-SA 4.0][4]) + +### Connecting with kids through coding + +Coding isn't just for kids who dream of becoming computer programmers. It's for everyone. Educators and parents can harness the power of code to engage learners and introduce subjects in a unique way. + +Writing code and seeing it run is a process of discovery, and everyone loves feeling accomplishment. But once you know a little code, it doesn't take long for you to realize that programming can express ideas; foster creativity; teach mathematics, logic, and problem solving; and encourage collaboration. What's not to love? + +Connecting with kids is always important in education, but with more kids learning from home this year, it's vitally important to engage with them. Coding is a great way to do that. + +### Teaching kids to code + +My youngest students are 4 to 7 years old, and I start them with paper "code" activities. These are simple physical games that help young children understand basic programming concepts and mindsets without a digital device. Once my students turn 8, I introduce Scratch, a visual programming language that uses block-based code. I continue this track until they're age 10 to 12. I also teach some paper "code" activities with older children to introduce and reinforce concepts. + +Once students have a clear understanding of visual coding, I move into text-based coding with Python. It's important to help students make the connection between new Python keywords and the Scratch blocks they already know. (Check out my [introduction to Python series][5] for more information.) + +### Just the beginning + +Whether you're an educator, after-school provider, or parent, join me in a series of articles as I explore how you can use coding to supercharge learning opportunities for your child, your students, or even yourself. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/my-students-taught-me-code + +作者:[Jess Weichler][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://opensource.com/users/cyanide-cupcake +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003588_01_rd3os.combacktoschoolseriesgen_rh_032x_0.png?itok=cApG9aB4 (Student desk for open education) +[2]: https://scratch.mit.edu/ +[3]: https://opensource.com/sites/default/files/uploads/codekids1_myfirstgame.png (Scratch game) +[4]: https://creativecommons.org/licenses/by-sa/4.0/ +[5]: https://opensource.com/article/17/10/python-101 From 2848637b72f2bb2497d5ad96f9f0a419429649a3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 24 Sep 2020 05:12:44 +0800 Subject: [PATCH 0202/1156] APL --- ... Inspired Linux Terminal Emulator With Some Cool Features.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md b/sources/tech/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md index 373608cf06..bb74395d71 100644 --- a/sources/tech/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md +++ b/sources/tech/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From a4aed44a489eadeac9d1e1b99f6c5fd7f1329997 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 24 Sep 2020 05:41:47 +0800 Subject: [PATCH 0203/1156] TSL&PRF @wxy --- ...rminal Emulator With Some Cool Features.md | 111 ------------------ ...rminal Emulator With Some Cool Features.md | 107 +++++++++++++++++ 2 files changed, 107 insertions(+), 111 deletions(-) delete mode 100644 sources/tech/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md create mode 100644 translated/tech/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md diff --git a/sources/tech/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md b/sources/tech/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md deleted file mode 100644 index bb74395d71..0000000000 --- a/sources/tech/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md +++ /dev/null @@ -1,111 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features) -[#]: via: (https://itsfoss.com/edex-ui-sci-fi-terminal/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features -====== - -**_Brief: eDEX-UI is a cool sci-fi inspired terminal emulator that looks cool with a bunch of options like system monitoring. Here, we take a quick look at what it offers_.** - -You probably already know [plenty of fun Linux commands][1]. You know what else can be fun when it comes to Linux command line? The terminal itself. - -Yes, the terminal emulator (commonly known as terminal) can be pretty amusing as well. Remember the [Cool Retro Term terminal that gives you a vintage terminal][2] of 80s and early 90s? - -How about an eye candy terminal that is heavily inspired from the [TRON Legacy][3] movie effects? - -In this article, let’s take a look at an amazing cross-platform terminal emulator that can keep you drooling over your terminal! - -### eDEX-UI: A Cool Terminal Emulator - -![][4] - -[eDEX-UI][5] is an open-source cross-platform terminal emulator that presents you with a Sci-Fi inspired look along with useful some features as well. - -It was originally inspired from the [DEX UI][6] project which is no longer maintained. - -Even though eDEX-UI is more about the looks and the futuristic theme for a terminal, it could double up as a [system monitoring tool for Linux][7]. How? Because it shows system stats in the sidebar while you work in the terminal. In fact, the developer mentions that he aims to improve it as a usable sysadmin tool. - -Let’s take a look at what else it offers and how to get it installed on your computer. - -### Features of eDEX-UI - -![][8] - -eDEX-UI is essentially a terminal emulator. You can use it like your regular terminal for running commands and whatever else you do in the terminal. - -It runs in full screen with sidebars and bottom panels to monitor system and networks stats. There is also a virtual keyboard for touch devices. - -I made a short video and I suggest watching this video to see this cool terminal emulator in action. **Play the video with sound** for the complete effect (trust me on this). - -[Subscribe to our YouTube channel for more Linux videos][9] - -eDEX-UI has a directory viewer on the left bottom side. - - * Multiple tabs - * Support for curses - * Directory viewer to show the contents of the current working directory - * Displays system information that includes Motherboard info, Network status, IP, network bandwidth used, CPU usage, temperature of the CPU, RAM usage, and so on - * Customization options to change the theme, keyboard layout, CSS injection - * Optional sound effect to give you a hacking vibe - * Cross-platform support (Windows, macOS, and Linux) - - - -### Installing eDEX on Linux - -![eDEX-UI with Matrix theme][10] - -As mentioned, it supports all the major platforms that includes Windows, macOS, and of course, Linux. - -To install it on any Linux distribution, you can either grab the AppImage file from its [GitHub releases section][11] or find it in one of the [available repositories][12] that include [AUR][13] as well. - -In case you didn’t know, I’d recommend going through our guide on [using AppImage in Linux][14]. - -You can visit the project on its GitHub page and if you like it, feel free to star their repository. - -[eDEX-UI][5] - -### My experience with eDEX-UI - -I liked this terminal emulator because of the sci-fi inspired look. However, I found it pretty heavy on the system resources. I didn’t [check the CPU temperature on my Linux system][15] but the CPU consumption was surely high. - -So, you might have to take care about that if you need it running it in the background or in a separate workspace (like I do). Apart from that, it’s an impressive tool with useful options like directory viewer and system resource monitoring. - -By the way, if you just want to entertain guests and children with a [hacking simulation, try Hollywood tool][16]. - -What do you think about eDEX-UI? Is it something you would like to give a try or is too kiddish/overwhelming for you? - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/edex-ui-sci-fi-terminal/ - -作者:[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/funny-linux-commands/ -[2]: https://itsfoss.com/cool-retro-term/ -[3]: https://www.imdb.com/title/tt1104001/ -[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/edex-ui-hacking-terminal.jpg?resize=800%2C450&ssl=1 -[5]: https://github.com/GitSquared/edex-ui -[6]: https://github.com/seenaburns/dex-ui -[7]: https://itsfoss.com/linux-system-monitoring-tools/ -[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/edex-ui-screenshot-1.png?resize=800%2C450&ssl=1 -[9]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 -[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/edex-ui-screenshot.png?resize=800%2C450&ssl=1 -[11]: https://github.com/GitSquared/edex-ui/releases -[12]: https://repology.org/project/edex-ui/versions -[13]: https://itsfoss.com/aur-arch-linux/ -[14]: https://itsfoss.com/use-appimage-linux/ -[15]: https://itsfoss.com/check-laptop-cpu-temperature-ubuntu/ -[16]: https://itsfoss.com/hollywood-hacker-screen/ diff --git a/translated/tech/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md b/translated/tech/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md new file mode 100644 index 0000000000..b783d4449c --- /dev/null +++ b/translated/tech/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features) +[#]: via: (https://itsfoss.com/edex-ui-sci-fi-terminal/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +eDEX-UI:一款科幻风格的酷炫 Linux 终端仿真器 +====== + +> eDEX-UI 是一个很酷的科幻电影式的终端仿真器,看起来很酷,有大量包括系统监控在内的选项。让我们来快速看看它提供了什么。 + +你可能已经知道了[大量有趣的 Linux 命令][1]。但你知道当谈到 Linux 命令行时,还有什么有趣的东西吗?那就是终端本身。 + +是的,终端仿真器(俗称终端)也可以很有趣。还记得 80 年代和 90 年代初的[酷炫复古的终端,给你一个复古的终端][2]吗? + +那一款深受 《[创:战纪][3]TRON Legacy》 电影特效启发的养眼终端感觉怎么样? + +在本文中,让我们来看看一款神奇的跨平台终端模拟器,注意口水! + +### eDEX-UI: 一个很酷的终端仿真器 + +![][4] + +[eDEX-UI][5] 是一款开源的跨平台终端仿真器,它为你呈现了一个科幻风格的外观和一些有用的功能。 + +它最初的灵感来自于 [DEX UI][6] 项目,但该项目已经不再维护。 + +尽管 eDEX-UI 的重点是外观和未来主义主题的终端,但它也可以作为一个 [Linux 系统监控工具][7]。怎么说呢?因为当你在终端中工作时,它可以在侧边栏中显示系统的统计信息。事实上,其开发者提到,他的目标是将其改进为一个可用的系统管理工具。 + +让我们来看看它还提供了什么,以及如何让它安装到你的电脑上。 + +### eDEX-UI 的特点 + +![][8] + +eDEX-UI 本质上是一个终端仿真器。你可以像普通终端一样使用它来运行命令和其他任何你可以在终端中做的事情。 + +它以全屏方式运行,侧边栏和底部面板可以监控系统和网络的统计信息。此外,还有一个用于触摸设备的虚拟键盘。 + +我做了一个简短的视频,我建议你观看这个视频,看看这个很酷的终端模拟器运行起来是什么样子。**播放视频时要打开声音**(相信我)。 + +- [视频](https://player.vimeo.com/video/460435965) + +eDEX-UI 的特点: + + * 多标签 + * 对 curses 的支持 + * 目录查看器,显示当前工作目录的内容 + * 显示系统信息,包括主板信息、网络状态、IP、网络带宽使用情况、CPU 使用情况、CPU 温度、RAM 使用情况等 + * 自定义选项,以改变主题、键盘布局、CSS 注入 + * 可选的声音效果,让你有一种黑客的感觉 + * 跨平台支持(Windows、macOS 和 Linux) + +### 在 Linux 上安装 eDEX + +![eDEX-UI with Matrix theme][10] + +如前所述,它支持所有主要平台,包括 Windows、macOS,当然还有 Linux。 + +要在 Linux 发行版上安装它,你可以从它的 [GitHub 发布部分][11]中抓取 AppImage 文件,或者在包括 [AUR][13] 在内的[可用资源库][12]中找到它。如果你不知道,我建议你去看一下我们关于[在 Linux 中使用 AppImage][14] 的指南。 + +你可以访问它的 GitHub 页面,如果你喜欢它,可以随时星标他们的仓库。 + +- [eDEX-UI][5] + +### 我对 eDEX-UI 的体验 + +因为它的科幻风格的外观,我喜欢这个终端仿真器。但是,我发现它对系统资源的消耗相当大。我没有[检查我的 Linux 系统的 CPU 温度][15],但 CPU 消耗肯定很高。 + +所以,如果你需要它运行在后台或单独的工作空间中(像我这样),你可能要注意这一点。除此以外,它是一个令人印象深刻的工具,拥有目录查看器和系统资源监控等有用的选项。 + +顺便说一句,如果你想模拟黑客来娱乐一下客人和孩子们,[那么可以试试好莱坞工具][16]。 + +你觉得 eDEX-UI 怎么样?你是想试一试,还是觉得太幼稚/过于复杂? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/edex-ui-sci-fi-terminal/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/funny-linux-commands/ +[2]: https://itsfoss.com/cool-retro-term/ +[3]: https://www.imdb.com/title/tt1104001/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/edex-ui-hacking-terminal.jpg?resize=800%2C450&ssl=1 +[5]: https://github.com/GitSquared/edex-ui +[6]: https://github.com/seenaburns/dex-ui +[7]: https://itsfoss.com/linux-system-monitoring-tools/ +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/edex-ui-screenshot-1.png?resize=800%2C450&ssl=1 +[9]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/edex-ui-screenshot.png?resize=800%2C450&ssl=1 +[11]: https://github.com/GitSquared/edex-ui/releases +[12]: https://repology.org/project/edex-ui/versions +[13]: https://itsfoss.com/aur-arch-linux/ +[14]: https://itsfoss.com/use-appimage-linux/ +[15]: https://itsfoss.com/check-laptop-cpu-temperature-ubuntu/ +[16]: https://itsfoss.com/hollywood-hacker-screen/ From f3befb7918ee65df1ac6109f8a477a29d21fb889 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 24 Sep 2020 08:40:29 +0800 Subject: [PATCH 0204/1156] translating --- .../20200917 What-s new with rdiff-backup.md | 125 ------------------ .../20200917 What-s new with rdiff-backup.md | 124 +++++++++++++++++ 2 files changed, 124 insertions(+), 125 deletions(-) delete mode 100644 sources/tech/20200917 What-s new with rdiff-backup.md create mode 100644 translated/tech/20200917 What-s new with rdiff-backup.md diff --git a/sources/tech/20200917 What-s new with rdiff-backup.md b/sources/tech/20200917 What-s new with rdiff-backup.md deleted file mode 100644 index 04c45c8885..0000000000 --- a/sources/tech/20200917 What-s new with rdiff-backup.md +++ /dev/null @@ -1,125 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (What's new with rdiff-backup?) -[#]: via: (https://opensource.com/article/20/9/rdiff-backup-linux) -[#]: author: (Patrik Dufresne https://opensource.com/users/patrik-dufresne) - -What's new with rdiff-backup? -====== -The longstanding Linux backup solution's migration to Python 3 opens -opportunity to add many new features. -![Hand putting a Linux file folder into a drawer][1] - -In March 2020, [rdiff-backup][2] advanced to version 2, 11 years after the last major release. The deprecation of Python 2 at the beginning of 2020 was the impetus for this update, but it gave the development team the opportunity to incorporate other features and benefits. - -For about two decades, rdiff-backup has helped Linux users maintain full backups of their data locally or remotely without needlessly draining resources. This is because the open source solution does reverse incremental backups—backing up only the files that changed from the previous backup. - -The revamp (or, as some are saying, rebirth) came thanks to the efforts of a new, self-organized development team (led by Eric Zolf and Patrik Dufresne from [IKUS Software][3] and Otto Kekäläinen from [Seravo][4]) that put heads and hands together for the benefit of all rdiff-backup users. - -### New features in rdiff-backup - -Along with the migration to Python 3, spearheaded by Eric, the project was migrated to a new, enterprise-free [repository][5] to welcome contributions. The team also incorporated all of the patches submitted over the years, including sparse file support and a fix for hard links. - -#### Automation with Travis CI - -Another huge improvement is the addition of a continuous integration/continuous delivery (CI/CD) pipeline using open source [Travis CI][6]. This permits rdiff-backup testing in various environments, which ensures that changes do not affect the solution's stability. The CI/CD pipeline includes integration of builds and binary distribution for all major platforms. - -#### Easy installation with yum and apt - -The new rdiff-backup solution runs on all major Linux distributions, including Fedora, Red Hat, Elementary, Debian, and many more. Frank and Otto worked arduously to provide open repositories to facilitate access and installation. You can install rdiff-backup using your package manager or follow the [step-by-step instructions][7] on the GitHub project page. - -#### A new home - -The team migrated the website from Savannah to GitHub Pages and is revamping the official [rdiff-backup.net][2] website to include new content and make the look and feel more on point. - -### How to use rdiff-backup - -If you're new to rdiff-backup, you might be surprised by how easy it is to use. A backup solution needs to be non-intimidating so that you feel comfortable with the backup and restoration processes. - -#### Start a backup - -To initiate a backup to a local drive, such as one attached by USB, enter the `rdiff-backup` command followed by the drive you want to back up and the target directory where you want to store the files. - -For example, to back up to a local drive called `my_backup_drive`, enter: - - -``` -`$ rdiff-backup /home/tux/ /run/media/tux/my_backup_drive/` -``` - -To back up your data to offsite storage, use the remote server's location followed by `::` to point to the backup drive's mount point: - - -``` -`$ rdiff-backup /home/tux/ tux@example.com::/my_backup_drive/` -``` - -You may need to [set up SSH keys][8] to make this process effortless. - -#### Restore files - -The reason to make backups is that sometimes files go missing. To make recovery as simple as possible, you don't even need rdiff-backup to restore files (although using the `rdiff-backup` command provides some conveniences). - -If you need to get a file from your backup drive, you can just copy it over from the backup drive to your local system using `cp` for a local drive or `scp` for a remote drive. - -For a local drive, use: - - -``` -`$ cp _run_media/tux/my_backup_drive/Documents/example.txt \ ~/Documents` -``` - -Or for a remote drive: - - -``` -`$ scp tux@example.com::/my_backup_drive/Documents/example.txt \ ~/Documents` -``` - -However, using the `rdiff-backup` command provides other options, including the `--restore-as-of` option. This allows you to specify which version of your file you want to rescue. - -For example, suppose you want to rescue a file as it appeared four days ago: - - -``` -`$ rdiff-backup --restore-as-of 4D \ /run/media/tux/foo.txt ~/foo_4D.txt` -``` - -You can also use `rdiff-backup` to grab the latest version: - - -``` -`$ rdiff-backup --restore-as-of now \ /run/media/tux/foo.txt ~/foo_4D.txt` -``` - -It's that easy. Also, rdiff-backup has many other options, e.g., you can exclude files from a list, back up from one remote to another remote, and more, which you can learn about in the [documentation][9]. - -### Back it up - -Our development team hopes users will appreciate this revamped open source rdiff-backup solution, which is the culmination of our continuous efforts. We also appreciate our contributors, who truly demonstrate the power of open source. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/9/rdiff-backup-linux - -作者:[Patrik Dufresne][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://opensource.com/users/patrik-dufresne -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer) -[2]: https://rdiff-backup.net/ -[3]: https://www.ikus-soft.com/en/ -[4]: https://seravo.fi/english -[5]: https://github.com/rdiff-backup/rdiff-backup -[6]: https://en.wikipedia.org/wiki/Travis_CI -[7]: https://github.com/rdiff-backup/rdiff-backup#installation -[8]: https://opensource.com/article/20/8/how-ssh -[9]: https://rdiff-backup.net/docs/examples.html diff --git a/translated/tech/20200917 What-s new with rdiff-backup.md b/translated/tech/20200917 What-s new with rdiff-backup.md new file mode 100644 index 0000000000..64c34b5f06 --- /dev/null +++ b/translated/tech/20200917 What-s new with rdiff-backup.md @@ -0,0 +1,124 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What's new with rdiff-backup?) +[#]: via: (https://opensource.com/article/20/9/rdiff-backup-linux) +[#]: author: (Patrik Dufresne https://opensource.com/users/patrik-dufresne) + +rdiff-backup 有什么新功能? +====== +长期的 Linux 备份方案向 Python 3 的迁移为添加许多新功能提供了机会。 +![Hand putting a Linux file folder into a drawer][1] + +2020 年 3 月,[rdiff-backup][2] 升级到了 2.0 版,这距离上一个主要版本已经过去了 11 年。2020 年初 Python 2 的废弃是这次更新的动力,但它为开发团队提供了整合其他功能和优势的机会。 + +大约二十年来,rdiff-backup 帮助 Linux 用户在本地或远程维护他们的数据的完整备份,而无需无谓地消耗资源。这是因为这个开源解决方案可以进行反向增量备份,只备份从上一次备份中改变的文件。 + +改版(或说,重生)得益于一个新的、自组织的开发团队(由来自 [IKUS Software][3] 的 Eric Zolf 和 Patrik Dufresne 领导,以及来自 [Seravo][4]的 Otto Kekäläinen 领导)的努力,为了所有 rdiff-backup 用户的利益,他们齐心协力。 + +### rdiff-backup 的新功能 + +在 Eric 的带领下,随着向 Python 3 的迁移,项目被迁移到了一个新的、不受企业限制的[仓库][5],以欢迎贡献。团队还整合了多年来提交的所有补丁,包括稀疏文件支持和硬链接的修复。 + +#### 用 Travis CI 实现自动化 + +另一个巨大的改进是增加了一个使用开源 [Travis CI][6] 的持续集成/持续交付 (CI/CD) 管道。这允许在各种环境下测试 rdiff-backup,从而确保变化不会影响方案的稳定性。CI/CD 管道包括集成所有主要平台的构建和二进制发布。 + +#### 使用 yum 和 apt 轻松安装 + +新的 rdiff-backup 解决方案可以运行在所有主流的 Linux 发行版上,包括 Fedora、Red Hat、Elementary、Debian 等。Frank 和 Otto 付出了艰辛的努力,提供了开放仓库以方便访问和安装。你可以使用你的软件包管理器安装 rdiff-backup,或者按照 GitHub 项目页面上的[分步说明][7]进行安装。 + +#### 新的主页 + +团队将网站从 Savannah 迁移到了 GitHub Pages,并对 [rdiff-backup.net][2] 官网进行了改版,加入了新的内容,让外观和感觉更加到位。 + +### 如何使用 rdiff-backup + +如果你是 rdiff-backup 的新手,你可能会对它的易用性感到惊讶。一个备份方案需要让你对备份和恢复过程感到舒适,而不是吓人。 + +#### 开始备份 + +要开始备份到本地驱动器,例如通过 USB 连接的驱动器,输入 `rdiff-backup` 命令,然后输入要备份的驱动器和要存储文件的目标目录。 + +例如,要备份到名为 `my_backup_drive` 的本地驱动器,请输入: + + +``` +`$ rdiff-backup /home/tux/ /run/media/tux/my_backup_drive/` +``` + +要将数据备份到异地存储,请使用远程服务器的位置,并在 `::` 后面指向备份驱动器的挂载点: + + +``` +`$ rdiff-backup /home/tux/ tux@example.com::/my_backup_drive/` +``` + +你可能需要[设置 SSH 密钥][8]来使这个过程不费力。 + +#### 还原文件 + +做备份的原因是有时文件会丢失。为了使恢复尽可能简单,你甚至不需要 rdiff-backup 来恢复文件(虽然使用 `rdiff-backup` 命令提供了一些方便)。 + +如果你需要从备份驱动器中获取一个文件,你可以使用 `cp` 将其从备份驱动器复制到本地系统,或者对于远程驱动器使用 `scp` 命令。 + +对于本地驱动器,使用: + + +``` +`$ cp _run_media/tux/my_backup_drive/Documents/example.txt \ ~/Documents` +``` + +或者用于远程驱动器: + + +``` +`$ scp tux@example.com::/my_backup_drive/Documents/example.txt \ ~/Documents` +``` + +然而,使用 `rdiff-backup` 命令提供了其他选项,包括 `--restore-as-of`。这允许你指定你要恢复的文件的哪个版本。 + +例如,假设你想恢复一个文件在四天前的版本: + + +``` +`$ rdiff-backup --restore-as-of 4D \ /run/media/tux/foo.txt ~/foo_4D.txt` +``` + +你也可以用 `rdiff-backup` 来获取最新版本: + + +``` +`$ rdiff-backup --restore-as-of now \ /run/media/tux/foo.txt ~/foo_4D.txt` +``` + +就是这么简单。另外,rdiff-backup 还有很多其他选项,例如,你可以从列表中排除文件,从一个远程备份到另一个远程等等,这些你可以在[文档][9]中了解。 + +### 总结 + +我们的开发团队希望用户能够喜欢这个改版后的开源 rdiff-backup 方案,这是我们不断努力的结晶。我们也感谢我们的贡献者,他们真正展示了开源的力量。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/rdiff-backup-linux + +作者:[Patrik Dufresne][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/patrik-dufresne +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer) +[2]: https://rdiff-backup.net/ +[3]: https://www.ikus-soft.com/en/ +[4]: https://seravo.fi/english +[5]: https://github.com/rdiff-backup/rdiff-backup +[6]: https://en.wikipedia.org/wiki/Travis_CI +[7]: https://github.com/rdiff-backup/rdiff-backup#installation +[8]: https://opensource.com/article/20/8/how-ssh +[9]: https://rdiff-backup.net/docs/examples.html From e7cd702ea35292ab71a8bdada2b1b984bfbf3591 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 24 Sep 2020 08:47:51 +0800 Subject: [PATCH 0205/1156] translating --- ...to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md b/sources/tech/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md index 937dbcc744..210e5196d6 100644 --- a/sources/tech/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md +++ b/sources/tech/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 1cd6c04486ac3e803b640e24477940a40d740348 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 25 Sep 2020 05:01:46 +0800 Subject: [PATCH 0206/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200925?= =?UTF-8?q?=20[email=C2=A0protected]:=20Help=20the=20Fight=20Against=20COV?= =?UTF-8?q?ID-19=20With=20Your=20Linux=20System?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200925 -email-protected-- Help the Fight Against COVID-19 With Your Linux System.md --- ...Against COVID-19 With Your Linux System.md | 231 ++++++++++++++++++ 1 file changed, 231 insertions(+) create mode 100644 sources/tech/20200925 -email-protected-- Help the Fight Against COVID-19 With Your Linux System.md diff --git a/sources/tech/20200925 -email-protected-- Help the Fight Against COVID-19 With Your Linux System.md b/sources/tech/20200925 -email-protected-- Help the Fight Against COVID-19 With Your Linux System.md new file mode 100644 index 0000000000..5f835a5da6 --- /dev/null +++ b/sources/tech/20200925 -email-protected-- Help the Fight Against COVID-19 With Your Linux System.md @@ -0,0 +1,231 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: ([email protected]: Help the Fight Against COVID-19 With Your Linux System) +[#]: via: (https://itsfoss.com/boinc-setup/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +[email protected]: Help the Fight Against COVID-19 With Your Linux System +====== + +Want to contribute to the research on coronavirus? You don’t necessarily have to be a scientist for this. You may contribute with part of your computer’s computing power thanks to [[email protected]][1] project. + +Sounds interesting? Let me share more details on it. + +### What is [[email protected]][1]? + +[[email protected]][1] is a [distributed computing][2] project for protein structure prediction, based at the Baker laboratory at the University of Washington and running on the Berkeley Open Infrastructure for Network Computing (BOINC) open source platform, which was originally developed to support the [[email protected]][3]. + +**Not enough computing power? Utilize the power of distributed computing** + +To predict and design the structures of naturally occurring proteins is very computationally intensive. To speed up the process, [Dr. David Becker][4] had filled the entire lab and the hallway with desktop computers. Then they started getting complaints of heating up the building, but still didn’t have enough computing power to accurately predict and design protein structures. + +**How does [[email protected]][1] work?** + +[[email protected]][1] uses idle computer processing power from volunteers’ computers to perform calculations on individual work units. When a requested task is being completed, the client sends the results to a central project server where they are validated and incorporated into project databases. + +![][5] + +As of 28th March 2020 the computing power of [[email protected]][1] has been increased up to 1.7 PetaFlops, due to the recently joined users looking to participate in the fight against the COVID-19 pandemic. Thanks to that, **On 26th June 2020, [[email protected]][1] researchers announced they had created antiviral proteins that neutralized SARS-CoV-2 in the lab.** + +Is BOINC platform safe? + +After few years of operation on millions of systems, there have been no security incidents reported due to BOINC. This fact doesn’t mean that there is no possibility of a security risks. + +BOINC uses a mechanism called **code signing**, based on _public-key cryptography_, that eliminates the vulnerability, as long as projects use proper practice. Each project has a code-signing key pair consisting of a public key and a private key which is used to create “signatures” for programs. The BOINC client will only run programs with valid signatures. + +Projects are instructed to keep the private key only on a computer that is permanently offline to create signatures. Therefore hackers cannot trick BOINC into running malware. + +Most BOINC projects follow these practices. If you’re concerned about security, you should attach to a project only if you know it follows the code-signing procedure correctly. If in doubt, you may ask project administrators to describe how they do code signing. + +### Contributing to [[email protected]][1] with BOINC platform + +![][6] + +If you are interested in contributing to the scientific research by donating some computing power, you’ll find rest of this article helpful. + +I’ll discuss the following: + + * Prerequisite for joining BOINC platform + * Using BOINC platform to donate computing power to a project of your choice via your desktop Linux + * Using Raspberry Pi to run BOINC all the time + + + +#### System Requirements of the BOINC platform + +The BOINC distributed computing platform with which you can access [[email protected]][1] is available on a 64bit operating system such as Windows, Linux, and macOS and FreeBSD. + +You will need a CPU of at least 500 MHz, 200 megabytes of free disk space, 512 megabytes of RAM, and Internet connectivity. + +**The more CPU cores your system has, the more RAM is required as a work unit will “feed” each core.** + +#### Create a user account on BOINC platform + +Before you configure the BOINC platform, [create an account][7] using your computer. If you will use a Raspberry Pi, you can join the “crunch-on-arm” team. + +**Please note that the same account can be used to multiple machines at a time. All of your machines will appear on your account.** + +#### **Install BOINC platform** on various Linux distributions + +BOINC application has the following element: + + * boinc-client (daemon that runs the platform) + * boinctui: terminal based interface for selecting projects and other settings + * boinc-manager: GUI-based interface for selecting projects and other settings + + + +If you are using a server, you should install boinctui. If you are using Linux desktop, you can opt for boinc-manager. + +I’ll stick with the GUI tool in this part of the tutorial. + +**On Debian/Ubuntu** + +BOINC tools are available in the universe repository in Ubuntu 20.04 so make sure that you have [universe repository enabled on your Ubuntu system][8]. + +Use the following commands to install it: + +``` +sudo apt install boinc-client boinc-manager +``` + +Install BOINC on Fedora + +Open a terminal and enter the following command: + +``` +sudo dnf install boinc-client boinc-manager +``` + +Install BOINC on RedHat/CentOS + +First, make sure that the EPEL repository is enabled, by running following command on a terminal: + +``` +sudo yum install epel-release +``` + +You can now install the necessary packages: + +``` +sudo yum install boinc-client boinc-manager +``` + +#### Open the BOINC manager and add a project + +After installing, open BOINC manager. You will be asked to add a project and to create an account or login to an existing. + +![][9] + +Add your credentials and click finish when prompted. + +![][10] + +After a few minutes, the status will change to running. + +![][11] + +You don’t need to worry if your system resources will be consumed when you want to use your computer. **By default, if the BOINC manager notices that the user needs more than the 25% of CPU resources, the BOINC computation will be suspended.** + +If you want the application to be suspended at a lower or higher CPU usage, you can change your profile settings on the website where you created your account. + +### [[email protected]][1] on a Raspberry Pi 4 + +An ideal device to run 24/7 the [[email protected]][1] application is a Raspberry Pi, which is powerful enough and with very low power consumption. + +To fight COVID-19 using a Raspberry Pi 4, you need a model with 2 GB RAM or more. My personal recommendation is the 4 GB RAM option, because with my 2 GB model one of the cores is idling as it is running out of memory. + +#### **Step 1: Install Ubuntu Server** (Recommended) + +You need to have some [operating system on your Raspberry Pi][12]. [Installing Ubuntu server on Raspberry Pi][13] is one of the most convenient choices. + +#### **Step 2: Install BOINC platform** + +To install the BOINC client and the command line management interface run the following command on server running on the Raspberry Pi. + +``` +sudo apt install boinc-client boinctui +``` + +**Additional steps for Raspberry Pi 2 GB model** + +Your account by default is set to utilize 90% of the memory when the user is idling. The Rosetta work units require 1.9gb of memory to run on the Quad core Raspberry Pi, so there is a possibility for the client not be able to start due to the initial reading. If the Raspberry Pi runs out of memory, it will suspend one of the 4 running tasks as mentioned earlier. To override the 1.9gb threshold add the following lines to the location below: + +``` +sudo nano /var/lib/boinc-client/global_prefs_override.xml +``` + +**Add now these lines** + +``` + + 100.000000 + 100.000000 + 100.000000 + +``` + +![][14] + +This setting will increase the default memory available to Rosetta to the maximum amount of memory on the board. + +#### Step 3: Add [[email protected]][1] project + +On your Raspberry Pi command line type ‘boinctui’ and click enter to load the terminal GUI.  + +``` +boinctui +``` + +Press **F9** on the keyboard, to bring down the menu choices. Use the arrow keys to go to Projects and press Enter. + +You may notice a few available projects to choose from but if you are interested to actively support the fight against COVID-19 choose Rosetta. You will be prompted to either create a user account or to use an existing account. + +Select “Existing User” and the enter the credentials you created on the website at the initial step.  As you can see, I have already selected the Rosetta project. + +![][15] + +It will take a moment to download the work units, and then automatically it will start crunching data on your Raspberry Pi 4! + +#### Conclusion + +_**If you want to stop using BOINC, simply delete the boinc packages you installed earlier. I believe you know how to use your distribution’s package manager for removing software.**_ + +One of the benefits of distributing computing is to allow user’s to donate their system resources for the common good. Despite the grief the pandemic has spread worldwide, it can make us also to realize the necessity of volunteering in one way or the other. + +If you ever wondered about a [good use of your Raspberry Pi][16], [[email protected]][1] can be included to the list. + +Let us know at the comments below if you started “cruching” and which platform you chose. Stay safe! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/boinc-setup/ + +作者:[Dimitrios Savvopoulos][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/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/cdn-cgi/l/email-protection +[2]: https://www.computerhope.com/jargon/d/distribs.htm +[3]: https://en.wikipedia.org/wiki/SETI@home +[4]: https://www.ipd.uw.edu/people/ipd-faculty-staff/david-baker/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/rosetta-sharing-example.jpg?resize=780%2C278&ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/rosetta-home-linux.png?resize=800%2C450&ssl=1 +[7]: http://boinc.bakerlab.org +[8]: https://itsfoss.com/ubuntu-repositories/ +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/boinc-manager.png?resize=800%2C600&ssl=1 +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/boinc-credentials.png?resize=800%2C600&ssl=1 +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/boinc-manager-running.png?resize=800%2C800&ssl=1 +[12]: https://itsfoss.com/raspberry-pi-os/ +[13]: https://itsfoss.com/install-ubuntu-server-raspberry-pi/ +[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/rosetta-settings-local-override.png?resize=800%2C600&ssl=1 +[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/rosetta-add-project.png?resize=800%2C600&ssl=1 +[16]: https://itsfoss.com/raspberry-pi-projects/ From 66db8ef2097ff704b053248c8ddfe68368076cd2 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 25 Sep 2020 05:02:02 +0800 Subject: [PATCH 0207/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200924?= =?UTF-8?q?=20Manage=20knowledge=20with=20BlueSpice,=20an=20open=20source?= =?UTF-8?q?=20alternative=20to=20Confluence?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200924 Manage knowledge with BlueSpice, an open source alternative to Confluence.md --- ...n open source alternative to Confluence.md | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 sources/tech/20200924 Manage knowledge with BlueSpice, an open source alternative to Confluence.md diff --git a/sources/tech/20200924 Manage knowledge with BlueSpice, an open source alternative to Confluence.md b/sources/tech/20200924 Manage knowledge with BlueSpice, an open source alternative to Confluence.md new file mode 100644 index 0000000000..9c5657e4e2 --- /dev/null +++ b/sources/tech/20200924 Manage knowledge with BlueSpice, an open source alternative to Confluence.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Manage knowledge with BlueSpice, an open source alternative to Confluence) +[#]: via: (https://opensource.com/article/20/9/bluespice) +[#]: author: (Martin Loschwitz https://opensource.com/users/martinloschwitzorg) + +Manage knowledge with BlueSpice, an open source alternative to Confluence +====== +BlueSpice is based on Wikipedia's MediaWiki but its features go far +beyond its noble ancestor. +![Digital images of a computer desktop][1] + +Knowledge management is a key to success in modern enterprises—but it is not exactly easy to achieve. Keeping track of all relevant details across all employees is a huge challenge, especially in agile environments, which most companies say they are. + +Most companies resort to buying wiki-like solutions, such as Confluence from Atlassian, which exposes them to the lock-in effect of proprietary software. But many would do well to consider [BlueSpice][2], an open source alternative to Atlassian Confluence that has a noble ancestry: it's based on Wikipedia's [MediaWiki][3]. + +### Basic and advanced features + +![BlueSpice][4] + +(Markus Feilner, [CC BY-SA 4.0][5]) + +For a wiki-like software to become a full-featured knowledge management system in an enterprise environment, it needs a lot of features. The ability to create documents is only one of them; the knowledge in them must be structured in a way that makes it easy for users to find the information they are looking for. + +In addition, most companies have complex compliance rulesets that knowledge-management software must adhere to. Confluence has gained a lot of attention because it is particularly good on these items. But BlueSpice doesn't have anything to hide. + +### Structural differences + +A quick overview reveals that BlueSpice has a fundamentally different way of organizing itself internally than Confluence. Confluence's internal structure is based on Spaces—topic-specific, separate sub-units of a Confluence installation. Typically, individual teams in an organization get their own Spaces. + +![BlueSpice Namespaces][6] + +(Markus Feilner, [CC BY-SA 4.0][5]) + +Instead, BlueSpice follows MediaWiki's principle of Namespaces. A Namespace is specific for a certain kind of file, like images or audio files or blog posts, which are put into a distinct Namespace to separate them from the other content. BlueSpice also allows users to define content categories so that every page in the wiki can belong to multiple different categories. In stark contrast to Confluence, the typical data siloing that happens almost automatically in Confluence (due to its Spaces design) doesn't happen in BlueSpace. Small wiki installation users may not notice major differences. But in large environments, users will certainly notice a difference: Content is likely easier to find in BlueSpice than it would be in a wiki scattered into small spaces. + +[BlueSpice Farm][7] is a subscription-based upgrade to the Free version that offers a nice feature for people migrating away from Confluence to BlueSpice. The Farm version allows multiple BlueSpice wikis to be connected to each other, effectively making them work like Spaces in Confluence. This will dramatically ease the burden of getting used to a new approach. + +### Search engine + +![BlueSpice search][8] + +(Markus Feilner, [CC BY-SA 4.0][5]) + +BlueSpice's search function is powered by [ElasticSearch][9] in the background and, just like Confluence, it displays search results while the user is typing in the search term. ElasticSearch may impose some serious hardware requirements for the machine hosting the wiki, but the user benefits from having a truly open source search engine maintained by a vivid community. Also, just like in Confluence, users can narrow down their results while searching by specifying parameters such as a specific kind of result or author. + +### Compliance + +Confluence comes with a large set of compliance-related functionalities. Core features include connections to existing user directories, revision-proof content storage, and risk-assessment tools. BlueSpice mimics a lot of these features. The way certain features are implemented varies because of the different internal organizational structure BlueSpice uses. + +First things first: BlueSpice not only _supports_ connections to existing user directories, including Active Directory or LDAP, it actually _requires_ using groups from these directories. Once it's connected to a central user directory, all authentication and authorization details must come out of that directory. + +Regular Wikipedia users know about the ability to access every page's history. As a MediaWiki descendant, BlueSpice inherits that page-history feature. At any point in time, you can see the different revisions of a page and also identify the person who made each change to a page. Relevant pages can be monitored for changes, and reports can be generated on the changes over a specific period of time—a feature that helps keep auditors happy. + +### WYSIWYG editor + +![BlueSpice WYSIWYG editor][10] + +(Markus Feilner, [CC BY-SA 4.0][5]) + +Central knowledge-management systems are not used only by geeks who speak markup languages; even non-technical staff must be able to use the system in an easy and concise way. While BlueSpice supports the usual [Wikipedia markup][11] editor, it also offers a WYSIWYG-like experience called VisualEditor. Its buttons and formatting tools will remind many people of familiar interfaces from tools such as LibreOffice. + +### Extensions + +Confluence users love the ability to extend the tool with external plugins. BlueSpice offers a similar capability through access to MediaWiki extensions. While BlueSpice doesn't have its own extension store just yet, it can easily use roughly 150 MediaWiki extensions for graphical highlighting, gaming, analytical functions, and more. + +### Branding + +A lot of companies want their central knowledge-management system to resemble the company's branding since it is a central place for employees. Given that MediaWiki is considered to have a rather conservative look and feel, you might wonder about adapting BlueSpice to corporate identity and corporate design requirements. Like Confluence, BlueSpice can be almost completely adapted to a company's brand standards and design requirements. While both Confluence and BlueSpice maintain a basic page structure, you can adjust central design elements such as headers, fonts, and the like. When it's done right, a BlueSpice theme will hardly remind users of MediaWiki at all. + +### BlueSpice advantages + +There are some areas where BlueSpice is superior to Confluence. For instance, many organizations need revision-proof tracking of changes in their central knowledge system for compliance reasons. This feature is built into BlueSpice, while achieving similar functionality in Confluence requires an extension. BlueSpice also comes with MediaWiki's Semantics extension built-in, effectively allowing users to query wiki pages for certain keywords. And last but not least, BlueSpice's Book extension can natively integrate manuals, product documentation, or other book contents into its contents. + +### Open source license + +Confluence has earned its merits for helping many companies introduce a central knowledge store in the form of wiki software. For open source enthusiasts, the software's proprietary nature might raise a red flag. + +BlueSpice is a functional open source alternative to Confluence based on the well-proven MediaWiki software. It provides similar functionality while maintaining MediaWiki's open license. All features relevant for small and large enterprises are in BlueSpice. Organizations planning to introduce a centralized knowledge-management system might find BlueSpice to be a good alternative to its famous commercial competitor. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/bluespice + +作者:[Martin Loschwitz][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://opensource.com/users/martinloschwitzorg +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_desk_home_laptop_browser.png?itok=Y3UVpY0l (Digital images of a computer desktop) +[2]: https://bluespice.com/products/bluespice-free +[3]: https://www.mediawiki.org/wiki/MediaWiki +[4]: https://opensource.com/sites/default/files/uploads/bluespice_math-formula.jpg (BlueSpice) +[5]: https://creativecommons.org/licenses/by-sa/4.0/ +[6]: https://opensource.com/sites/default/files/uploads/bluespice_organizationchart.jpg (BlueSpice Namespaces) +[7]: https://bluespice.com/products/bluespice-farm/ +[8]: https://opensource.com/sites/default/files/uploads/bluespice_search_fulltext.jpg (BlueSpice search) +[9]: https://www.elastic.co/elasticsearch/ +[10]: https://opensource.com/sites/default/files/uploads/bluespice_editor-2.jpg (BlueSpice WYSIWYG editor) +[11]: https://en.wikipedia.org/wiki/Help:Cheatsheet From 0a5cc61752789b4be9b445e874dfdfef87247af4 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 25 Sep 2020 05:03:15 +0800 Subject: [PATCH 0208/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[talk]:=2020200924?= =?UTF-8?q?=20Still=20not=20dead:=20The=20mainframe=20hangs=20on,=20sustai?= =?UTF-8?q?ned=20by=20Linux=20and=20hybrid=20cloud?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200924 Still not dead- The mainframe hangs on, sustained by Linux and hybrid cloud.md --- ...on, sustained by Linux and hybrid cloud.md | 135 ++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 sources/talk/20200924 Still not dead- The mainframe hangs on, sustained by Linux and hybrid cloud.md diff --git a/sources/talk/20200924 Still not dead- The mainframe hangs on, sustained by Linux and hybrid cloud.md b/sources/talk/20200924 Still not dead- The mainframe hangs on, sustained by Linux and hybrid cloud.md new file mode 100644 index 0000000000..5fef055eba --- /dev/null +++ b/sources/talk/20200924 Still not dead- The mainframe hangs on, sustained by Linux and hybrid cloud.md @@ -0,0 +1,135 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Still not dead: The mainframe hangs on, sustained by Linux and hybrid cloud) +[#]: via: (https://www.networkworld.com/article/3576290/still-not-dead-the-mainframe-hangs-on-sustained-by-linux-and-hybrid-cloud.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +Still not dead: The mainframe hangs on, sustained by Linux and hybrid cloud +====== +The mainframe—Linux alliance turns 20 this month and is proving to be more vital than ever, primarily in the form of Big Iron-based Red Hat OpenShift. +Thinkstock + +The [mainframe][1] has been declared “dead”, “morphed” and “transformed” so many times over the years sometimes it’s sometimes hard to believe the Big Iron still has an identity in the enterprise world. + +But clearly it does and in a major way, too.  + +**[ Lessons on diversity in IT: [10 professional organizations focused on diversity in tech][2] • [Being Black in IT: 3 tech leaders share their stories][3] • [Gender gapped: The state of gender diversity in IT][4] • [Māori participation in IT][5]: diversity insights for CIOs everywhere • [IT snapshot: Ethnic diversity in the tech industry][6] ]** + +Take recent news as an example: According to IBM, 75% of the top 20 global banks are running the newest z15 mainframe, and the IBM Systems Group reported a 68% gain in Q2 IBM Z revenue year-over-year. + +At the heart of its current vitality is Linux—primarily in the form of Big Iron-based Red Hat OpenShift—and a variety of software such as IBM [Cloud Paks][7] and open source applications.  The Linux-mainframe marriage is celebrating 20 years this month, and while the incongruous mashup—certainly at the beginning anyway—has been a boon for the mainframe, by most accounts it still has plenty of good years ahead of it. + +“For the first five or so years we really were just experimenting with what we could do with Linux and the mainframe but then the server-consolidation movement hit, and we knew we had something big,” said [Ross Mauri][8], the general manager for IBM Z. + +“What really got us going was the big Wall Street financial companies who all had these Sun Solaris servers with big databases, and many decided to consolidate on the Z mainframe running Linux, and we were off and running,” he said. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][9] + +Another contributing factor in 2000 was Big Blue’s $1B investment in all things Linux, which was a huge move in getting the operating system and open-source software in general into the mainstream business market. + +Since that time there have been numerous milestones in the mainframe’s Linux journey, including the introduction of a standalone box, the LinuxONE, five years ago, which is now at the heart of some of the world’s largest implementations. + +### Red Hat to the rescue + +The next chapter in the mainframe story began last year when [IBM bought Linux powerhouse Red Hat][10] for $34B, tying the massive transactional capacity, security and reliability of the Big Iron with Red Hat Open Shift and Red Hat Enterprise Linux. + +IBM has also released Red Hat Ansible Certified Content for IBM Z and launched a new cloud-native development offering, [Wazi Workspaces][11], which lets developers apply industry-standard tools from IBM Z to multi-cloud platforms optimized for OpenShift. + +Combine those moves with all of the open-source mainframe software work going on in the [Linux Foundation’s Open Mainframe Project][12] and customers now have a ton of development options for private or public cloud-based workloads. + +“Clients no longer have to develop and work with proprietary tools, and the zOS is being brought completely into the modern application development world,” Mauri said. + +Gartner recently wrote of that trend: “Now developers, testers, and infrastructure and operations staff have the capability to utilize the same tools which exist in the distributed world. Rocket Software, CA Technologies and IBM are supporting the [Open Mainframe Project Zowe][13], which is making adapting of open-source tools much easier.” + +IBM calls Zowe an open source software framework that lets development and operations teams securely, manage, control, script and develop on the mainframe like any other cloud platform. + +“From application development software, to complex DevOps orchestration engines, these traditional platforms are enjoying a resurgence of relevance in the data center that is making them accessible to all developers and testers. This change significantly reduces the issue of limited and old-fashioned development tools that previously contributed to the impetus to leave traditional platforms,” Gartner stated. + +Going forward Mauri said he expects a number of key technologies will continue to make the mainframe a key cloud and compute player. + +### Confidential Computing + +One of those keys is an overarching security model called Confidential Computing which IBM broadly describes as a way to protect data, applications and processes at scale. It has rolled out a number products that adhere to the Confidential Computing mantra. For example, IBM’s Secure Execution for Linux software lets customers isolate and protect  large numbers of workloads from internal and external threats across a hybrid-cloud environment. Other packages let customers bolt-down containerized Kubernetes workloads or Red Hat OpenShift clusters, IBM says. + +There is also a Linux Foundation project, the Confidential Computing Consortium, made up of  Alibaba, Arm, Baidu, IBM/Red Hat, Intel, Google Cloud and Microsoft that is pushing the concept industry wide. + +“The organization aims to address data in use, enabling encrypted data to be processed in memory without exposing it to the rest of the system, reducing exposure to sensitive data and providing greater control and transparency for users,” the Consortium says on its website.  “This is among the very first industry-wide initiatives to address data in use, as current security approaches largely focus on data at rest or data in transit. The focus of the Confidential Computing Consortium is especially important as companies move more of their workloads to span multiple environments, from on premises to public cloud and to the edge.” + +Mauri says IBM is on its fourth generation of Confidential Computing technology which will keep it out in front of other industry cloud players and give the company a strong security weapon for the foreseeable future. + +“The vulnerability landscape is constantly changing, and organizations can be attacked across their IT systems. Add to that concerns around data privacy and regulations and you’ve got a full plate,” said Terri Cobb, lead alliance partner at Deloitte Consulting. Deloitte recently conducted a survey of business and IT decision makers with Forrester Consulting and found 80% of respondents are focused on modernizing mainframe toolsets in an effort to identify and prevent data breaches, and 73% are increasing their security footprint. + +“Data protection and security are so critical, and mainframes remain one of the most secure and powerful platforms available when the right controls are in place,” Cobb said. + +### Pay per use + +Another direction IBM and the mainframe is moving is toward a more cloud-agile, consumption-based licensing model that lets customers pay only for what they consume, Mauri said. The company rolled out its Tailored Fit Pricing model in 2019 and has upwards of 80 customers onboard so far, Mauri said. It offers two consumption-based pricing models that can help customers cope with ever-changing workload and hence software costs. + +Mauri said IBM expects to make hardware more consumption based in the future. + +Predicting demand for IT services can be a major challenge, and in the era of hybrid and multicloud, everything is connected and workload patterns constantly change, Mauri wrote in a [blog][14] about the new pricing and services in 2019. “In this environment, managing demand for IT services can be a major challenge. As more customers shift to an enterprise IT model that incorporates on-premises, private cloud and public we’ve developed a simple cloud pricing model to drive the transformation forward.” + +### ML/AI opportunities + +Others say technologies such as machine learning and artificial intelligence will also drive future mainframe development. + +“Data insights help drive actionable and profitable results—-but the pool of data is growing at astronomical rates. That’s where AI can make a difference, especially when it’s on a mainframe. Consider the amount of data that resides on a mainframe for an organization in the banking, manufacturing, healthcare, or insurance sectors. You’d never be able to make sense of it all without AI,” said Deloitte’s Cobb. As an example, Cobb said core banking operations can do more than simply execute large volumes of transactions. + +“Banks need deep insights about customer needs, preferences, and intentions to compete effectively, along with speed and agility in sharing and acting on those insights. That’s easier said than done when data is constantly changing. Now if you can analyze data directly on the mainframe, you can get near real-time insights and action. That makes the mainframe an important participant in the AI/ML revolution,” Cobb said. + +The mainframe environment isn’t without challenges going forward. + +For example, there is a [growing market for moving mainframe applications off][15] of the Big Iron and onto cloud services. Large cloud players such as Amazon, Google and Microsoft are also involved in modernizing mainframe applications. For example, Google Cloud in February [bought mainframe cloud-migration service firm Cornerstone Technology][16] with an eye toward helping Big Iron customers move workloads to the private and public cloud. An ecosystem of mainframe modernization service providers such as [Astadia][17], [Asysco][18], [GTSoftware][19], LZLabs,  [Micro Focus][20] has also grown up. + +### COBOL coders needed + +Another challenge is finding and developing the right people to cultivate the mainframe environment. + +“It was predicted mainframes would eventually cease to exist so colleges stopped offering courses focused on COBOL and other critical mainframe skills. As Baby Boomers retire, mainframe talent concerns are becoming a reality,” Cobb said.   + +Deloitte’s survey found that 71% of respondents said their teams are understaffed, and 93% said its “moderately” to “extremely challenging” to acquire the right mainframe resources and skills, Cobb said. + +“Many large companies are addressing this issue by hiring and developing college recruits, developing a mentoring program, creating an internship, or turning to third parties for support. Mainframes aren’t going anywhere—the talent pool needs to match the demand,” Cobb said. + +While there are challenges in the future, Cobb said the consultancy’s survey showed customers are looking to _increase_ their investment in the mainframe with 91% of respondents identified as expanding their mainframe footprints as a moderate or critical priority in the next 12 months. + +Join the Network World communities on [Facebook][21] and [LinkedIn][22] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3576290/still-not-dead-the-mainframe-hangs-on-sustained-by-linux-and-hybrid-cloud.html + +作者:[Michael Cooney][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://www.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/2231401/inside-ibm-s-game-changing-mainframe-moments.html +[2]: https://www.cio.com/article/3564791/10-professional-organizations-focused-on-diversity-in-tech.html +[3]: https://www.cio.com/article/3566069/being-black-in-it-3-tech-leaders-share-their-stories.html +[4]: https://www.cio.com/article/3532001/gender-gapped-the-state-of-gender-diversity-in-it.html +[5]: https://www.cio.com/article/3566098/maori-participation-in-it-insights-for-cios.html +[6]: https://www.computerworld.com/article/3567095/it-snapshot-ethnic-diversity-in-the-tech-industry.html +[7]: https://www.networkworld.com/article/3429596/ibm-fuses-its-software-with-red-hats-to-launch-hybrid-cloud-juggernaut.html +[8]: https://newsroom.ibm.com/Bringing-Linux-to-IBM-Z +[9]: https://www.networkworld.com/newsletters/signup.html +[10]: https://www.networkworld.com/article/3407746/will-ibms-acquisition-be-the-end-of-red-hat.html +[11]: https://www.ibm.com/products/wazi-for-red-hat-codeready-workspaces +[12]: https://www.openmainframeproject.org/ +[13]: https://www.openmainframeproject.org/projects/zowe +[14]: https://www.ibm.com/blogs/systems/ibm-z-defines-the-future-of-hybrid-cloud/ +[15]: https://www.networkworld.com/article/3567058/options-grow-for-migrating-mainframe-apps-to-the-cloud.html?utm_source=facebook&utm_content=content&utm_medium=social&utm_campaign=organic&fbclid=IwAR2JPUEItx11TeSqiIvgr3_HA4YQRv_U7imm4Z4WG-wCuir_WrrE2zmst5o +[16]: https://www.networkworld.com/article/3528451/google-cloud-moves-to-aid-mainframe-migration.html +[17]: https://www.astadia.com/blog/mainframe-migration-to-azure-in-5-steps +[18]: https://www.asysco.com/code-transformation/ +[19]: https://www.gtsoftware.com/services/migration-services/ +[20]: https://www.microfocus.com/en-us/home +[21]: https://www.facebook.com/NetworkWorld/ +[22]: https://www.linkedin.com/company/network-world From f1aa96ed2afbfb46e00c327e687096d452fb71c1 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 25 Sep 2020 08:47:42 +0800 Subject: [PATCH 0209/1156] translated --- ...0200921 Teach Python with the Mu editor.md | 162 ------------------ ...0200921 Teach Python with the Mu editor.md | 162 ++++++++++++++++++ 2 files changed, 162 insertions(+), 162 deletions(-) delete mode 100644 sources/tech/20200921 Teach Python with the Mu editor.md create mode 100644 translated/tech/20200921 Teach Python with the Mu editor.md diff --git a/sources/tech/20200921 Teach Python with the Mu editor.md b/sources/tech/20200921 Teach Python with the Mu editor.md deleted file mode 100644 index bf977e766c..0000000000 --- a/sources/tech/20200921 Teach Python with the Mu editor.md +++ /dev/null @@ -1,162 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Teach Python with the Mu editor) -[#]: via: (https://opensource.com/article/20/9/teach-python-mu) -[#]: author: (Don Watkins https://opensource.com/users/don-watkins) - -Teach Python with the Mu editor -====== -Mu makes it easy to learn how to write Python code. -![Hands on a keyboard with a Python book ][1] - -Teaching kids to code is very popular in schools. Many years ago, in the days of the Apple II and [Logo][2] programming, I learned about turtle graphics. I enjoyed learning how to program the virtual turtle and later helping students to do the same. - -About five years ago, I learned about [Python's turtle module][3], and it was the segue to my Python journey. Soon, I started using the turtle module to teach students Python programming basics, including using it to create interesting graphics. - -### Get started with Python's turtle module - -On a Linux or macOS computer, you can just open a terminal, enter the word `python`, and you'll see the Python shell. - -If you are using a Windows computer, you will need to install Python first by going to the Python website and [downloading][4] the latest stable version. - -Next, import the turtle module into Python with `import turtle `or `import turtle as t`. Then you can start having some fun creating turtle graphics. - -### Meet Mu - -In the early days of my Python adventure, I used [IDLE][5], Python's integrated development environment. It was much easier than entering commands into the Python shell, plus I could write and save programs for later use. I took some online courses and read many excellent books about Python programming. I taught teachers and students how to create turtle graphics using IDLE. - -IDLE was a big improvement, but at PyConUS 2019 in Cleveland, I saw a presentation by [Nicholas Tollervey][6] that changed the way I learned and taught Python. Nick is an educator who created [Mu][7], a Python editor specifically for young programmers (and even older ones like me). Mu can be installed on Linux, macOS, and Windows. It's easy to use and comes with excellent [documentation][8] and [tutorials][9]. - -On Linux, you can install Mu from the command line. - -On Ubuntu or Debian: - - -``` -`$ sudo apt install mu-editor` -``` - -On Fedora or similar: - - -``` -`$ sudo dnf install mu` -``` - -Or, you can use Python to do the install. First, ensure you have Python 3 installed: - - -``` -`$ python --version` -``` - -If that fails, try: - - -``` -`$ python3 --version` -``` - -Assuming you have Python version 3 or better, install Mu using `pip`, the Python package manager: - - -``` -`$ python -m pip install mu-editor --user` -``` - -Then you can run Mu from the command line or create a shortcut using: - - -``` -`$ python -m pip install shortcut mu-editor --user` -``` - -Mu is installed by default on the [Raspberry Pi][10], which is a great plus. In the past couple of years, I have introduced students to the Raspberry Pi and Python programming using the Mu editor. - -### How to teach Python with Mu - -Mu is a great way to show students how easy it is to get started with Python. Here's how I teach my students to start using it. - - 1. Open the Mu editor. - -![Mu editor][11] - -(Don Watkins, [CC BY-SA 4.0][12]) - - 2. Enter `import turtle` to import the Turtle module, so you can get the turtle moving. My first lesson is drawing a simple square in Python code. - -![Mu editor][13] - -(Don Watkins, [CC BY-SA 4.0][12]) - - 3. Save this program, making sure that the file name ends in .py. - -![Saving program in Mu][14] - -(Don Watkins, [CC BY-SA 4.0][12]) - - 4. Run the program. Running even a simple program like this is energizing—it's fun to see the graphical output of a program you wrote. - -![Running Python program in Mu][15] - -(Don Watkins, [CC BY-SA 4.0][12]) - - - - -### Beyond the basics - -After this simple lesson, I explain that there are some ways to simplify and expand on the basics the students have learned. One is creating a simpler turtle object, `import turtle as t`. Then I introduce a `for` loop as another way to draw a square with the turtle. - -![for loops in Python with Mu][16] - -(Don Watkins, [CC BY-SA 4.0][12]) - -Next, I show how to create a `my_square` function as another way to draw a square. - -![my_square function][17] - -(Don Watkins, [CC BY-SA 4.0][12]) - -Later, I expand on this concept by introducing other turtle module methods, including `penup`, `pendown`, and `pencolor`. Soon, my students are developing more complex programs and iterating on them. - -![Mu editor][18] - -(Don Watkins, [CC BY-SA 4.0][12]) - -I am always eager to learn, and I would love to know how you are teaching Python in school or at home. Please share your experience in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/9/teach-python-mu - -作者:[Don Watkins][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://opensource.com/users/don-watkins -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python-programming-code-keyboard.png?itok=fxiSpmnd (Hands on a keyboard with a Python book ) -[2]: https://en.wikipedia.org/wiki/Logo_(programming_language) -[3]: https://docs.python.org/3/library/turtle.html -[4]: https://www.python.org/downloads/windows/ -[5]: https://docs.python.org/3/library/idle.html -[6]: https://ntoll.org/ -[7]: https://codewith.mu/en/download -[8]: https://codewith.mu/en/howto/ -[9]: https://codewith.mu/en/tutorials/ -[10]: https://www.raspberrypi.org/blog/mu-python-ide/ -[11]: https://opensource.com/sites/default/files/uploads/mu-1_open.png (Mu editor) -[12]: https://creativecommons.org/licenses/by-sa/4.0/ -[13]: https://opensource.com/sites/default/files/uploads/mu-2_square.png (Mu editor) -[14]: https://opensource.com/sites/default/files/uploads/mu-3_save.png (Saving program in Mu) -[15]: https://opensource.com/sites/default/files/uploads/mu-4_run.png (Running Python program in Mu) -[16]: https://opensource.com/sites/default/files/uploads/mu-5_for-loop.png (for loops in Python with Mu) -[17]: https://opensource.com/sites/default/files/uploads/mu-6_my_square.png (my_square function) -[18]: https://opensource.com/sites/default/files/uploads/mu-7_beyond-basics.png (Mu editor) diff --git a/translated/tech/20200921 Teach Python with the Mu editor.md b/translated/tech/20200921 Teach Python with the Mu editor.md new file mode 100644 index 0000000000..e3f76169e6 --- /dev/null +++ b/translated/tech/20200921 Teach Python with the Mu editor.md @@ -0,0 +1,162 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Teach Python with the Mu editor) +[#]: via: (https://opensource.com/article/20/9/teach-python-mu) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +使用 Mu 编辑器教授 Python +====== +Mu 让你轻松学会如何编写 Python 代码。 +![Hands on a keyboard with a Python book ][1] + +在学校里,教孩子们编程是非常流行的。很多年前,在 Apple II 和 [Logo][2] 编程的年代,我学会了乌龟图案。我很喜欢学习如何对虚拟乌龟进行编程,后来也帮助学生进行编程。 + +大约五年前,我了解了 [Python 的 turtle 模块][3],这是我 Python 之旅的转折点。很快,我开始使用 turtle 模块来教学生 Python 编程基础,包括使用它来创建有趣的图形。 + +### 开始使用 Python 的 turtle 模块 + +在 Linux 或 macOS 电脑上,你只需打开一个终端,输入 `python`,你就会看到 Python shell。 + +如果你使用的是 Windows 电脑,则需要先安装 Python,到 Python 网站上[下载][4]最新的稳定版。 + +接下来,用 `import turtle ` 或 `import turtle as t` 将 turtle 模块导入 Python 中。然后你就可以开始享受创建乌龟图案的乐趣了。 + +### 认识一下 Mu + +在我的 Python 冒险的早期,我使用了 [IDLE][5],它是 Python 的集成开发环境。它比在 Python shell 中输入命令要容易得多,而且我可以编写和保存程序供以后使用。我参加了一些在线课程,阅读了许多关于 Python 编程的优秀书籍。我教老师和学生如何使用 IDLE 创建乌龟图案。 + +IDLE 是一个很大的改进,但在克利夫兰的 PyConUS 2019 上,我看到了 [Nicholas Tollervey][6]的演讲,这改变了我学习和教授 Python 的方式。Nick 是一位教育家,他创建了 [Mu][7],一个专门为年轻程序员(甚至像我这样的老程序员)设计的 Python 编辑器。Mu 可以安装在 Linux、macOS 和 Windows 上。它很容易使用,并且附带了优秀的[文档][8]和[教程][9]。 + +在 Linux 上,你可以通过命令行安装 Mu。 + +在 Ubuntu 或 Debian 上: + + +``` +`$ sudo apt install mu-editor` +``` + +在 Fedora 或类似的地方: + + +``` +`$ sudo dnf install mu` +``` + +或者,你可以使用 Python 来进行安装。首先,确保你已经安装了 Python 3: + + +``` +`$ python --version` +``` + +如果失败了,就试试: + + +``` +`$ python3 --version` +``` + +假设你有 Python 3 或更高版本,使用 Python 包管理器 `pip` 安装 Mu。 + + +``` +`$ python -m pip install mu-editor --user` +``` + +然后你可以从命令行运行 Mu,或者创建一个快捷方式: + + +``` +`$ python -m pip install shortcut mu-editor --user` +``` + +Mu 默认安装在[树莓派][10]上,这是一个很大的优点。在过去的几年里,我已经向学生介绍了树莓派和使用 Mu 编辑器的 Python 编程。 + +### 如何用 Mu 教授 Python + +Mu 是向学生展示 Python 入门的好方法。下面是我如何教学生开始使用它。 + + 1. 打开Mu编辑器。 + +![Mu editor][11] + +(Don Watkins, [CC BY-SA 4.0][12]) + + 2. 输入 `import turtle` 导入 Turtle 模块,就可以让乌龟动起来了。我的第一课是用 Python 代码画一个简单的正方形。 + +![Mu editor][13] + +(Don Watkins, [CC BY-SA 4.0][12]) + + 3. 保存这个程序,确保文件名以 .py 结尾。 + +![Saving program in Mu][14] + +(Don Watkins, [CC BY-SA 4.0][12]) + + 4. 运行程序。哪怕是运行这样一个简单的程序都会让人兴奋,看到你写的程序的图形输出是很有趣的。 + +![Running Python program in Mu][15] + +(Don Watkins, [CC BY-SA 4.0][12]) + + + + +### 超越基础知识 + +在上完这节简单的课后,我讲解了有一些方法可以简化和扩展学生所学的基础知识。一是创建一个更简单的 turtle 对象,`import turtle as t`。然后我介绍了一个 `for` 循环,作为用 turtle 画一个正方形的另一种方法。 + +![for loops in Python with Mu][16] + +(Don Watkins, [CC BY-SA 4.0][12]) + +接下来,我将展示如何创建一个 `my_square` 函数,作为另一种绘制正方形的方法。 + +![my_square function][17] + +(Don Watkins, [CC BY-SA 4.0][12]) + +后来,我通过介绍其他 turtle 模块方法,包括 `penup`、`pendown` 和 `pencolor`来扩展这个概念。很快,我的学生们就开始开发更复杂的程序,并对其进行迭代。 + +![Mu editor][18] + +(Don Watkins, [CC BY-SA 4.0][12]) + +我一直渴望学习,我很想知道你在学校或家里是如何教授 Python 的。请在评论中分享你的经验。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/teach-python-mu + +作者:[Don Watkins][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python-programming-code-keyboard.png?itok=fxiSpmnd (Hands on a keyboard with a Python book ) +[2]: https://en.wikipedia.org/wiki/Logo_(programming_language) +[3]: https://docs.python.org/3/library/turtle.html +[4]: https://www.python.org/downloads/windows/ +[5]: https://docs.python.org/3/library/idle.html +[6]: https://ntoll.org/ +[7]: https://codewith.mu/en/download +[8]: https://codewith.mu/en/howto/ +[9]: https://codewith.mu/en/tutorials/ +[10]: https://www.raspberrypi.org/blog/mu-python-ide/ +[11]: https://opensource.com/sites/default/files/uploads/mu-1_open.png (Mu editor) +[12]: https://creativecommons.org/licenses/by-sa/4.0/ +[13]: https://opensource.com/sites/default/files/uploads/mu-2_square.png (Mu editor) +[14]: https://opensource.com/sites/default/files/uploads/mu-3_save.png (Saving program in Mu) +[15]: https://opensource.com/sites/default/files/uploads/mu-4_run.png (Running Python program in Mu) +[16]: https://opensource.com/sites/default/files/uploads/mu-5_for-loop.png (for loops in Python with Mu) +[17]: https://opensource.com/sites/default/files/uploads/mu-6_my_square.png (my_square function) +[18]: https://opensource.com/sites/default/files/uploads/mu-7_beyond-basics.png (Mu editor) From 293658c44802ea217e8c1ccbd94d32e0d592104c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 25 Sep 2020 08:49:03 +0800 Subject: [PATCH 0210/1156] Update 20200925 -email-protected-- Help the Fight Against COVID-19 With Your Linux System.md --- ...Against COVID-19 With Your Linux System.md | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/sources/tech/20200925 -email-protected-- Help the Fight Against COVID-19 With Your Linux System.md b/sources/tech/20200925 -email-protected-- Help the Fight Against COVID-19 With Your Linux System.md index 5f835a5da6..8a09f63907 100644 --- a/sources/tech/20200925 -email-protected-- Help the Fight Against COVID-19 With Your Linux System.md +++ b/sources/tech/20200925 -email-protected-- Help the Fight Against COVID-19 With Your Linux System.md @@ -3,32 +3,32 @@ [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) -[#]: subject: ([email protected]: Help the Fight Against COVID-19 With Your Linux System) +[#]: subject: (Rosetta@home: Help the Fight Against COVID-19 With Your Linux System) [#]: via: (https://itsfoss.com/boinc-setup/) [#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) -[email protected]: Help the Fight Against COVID-19 With Your Linux System +Rosetta@home: Help the Fight Against COVID-19 With Your Linux System ====== -Want to contribute to the research on coronavirus? You don’t necessarily have to be a scientist for this. You may contribute with part of your computer’s computing power thanks to [[email protected]][1] project. +Want to contribute to the research on coronavirus? You don’t necessarily have to be a scientist for this. You may contribute with part of your computer’s computing power thanks to Rosetta@home project. Sounds interesting? Let me share more details on it. -### What is [[email protected]][1]? +### What is Rosetta@home? -[[email protected]][1] is a [distributed computing][2] project for protein structure prediction, based at the Baker laboratory at the University of Washington and running on the Berkeley Open Infrastructure for Network Computing (BOINC) open source platform, which was originally developed to support the [[email protected]][3]. +Rosetta@home is a [distributed computing][2] project for protein structure prediction, based at the Baker laboratory at the University of Washington and running on the Berkeley Open Infrastructure for Network Computing (BOINC) open source platform, which was originally developed to support the [Rosetta@home][3]. **Not enough computing power? Utilize the power of distributed computing** To predict and design the structures of naturally occurring proteins is very computationally intensive. To speed up the process, [Dr. David Becker][4] had filled the entire lab and the hallway with desktop computers. Then they started getting complaints of heating up the building, but still didn’t have enough computing power to accurately predict and design protein structures. -**How does [[email protected]][1] work?** +**How does Rosetta@home work?** -[[email protected]][1] uses idle computer processing power from volunteers’ computers to perform calculations on individual work units. When a requested task is being completed, the client sends the results to a central project server where they are validated and incorporated into project databases. +Rosetta@home uses idle computer processing power from volunteers’ computers to perform calculations on individual work units. When a requested task is being completed, the client sends the results to a central project server where they are validated and incorporated into project databases. ![][5] -As of 28th March 2020 the computing power of [[email protected]][1] has been increased up to 1.7 PetaFlops, due to the recently joined users looking to participate in the fight against the COVID-19 pandemic. Thanks to that, **On 26th June 2020, [[email protected]][1] researchers announced they had created antiviral proteins that neutralized SARS-CoV-2 in the lab.** +As of 28th March 2020 the computing power of Rosetta@home has been increased up to 1.7 PetaFlops, due to the recently joined users looking to participate in the fight against the COVID-19 pandemic. Thanks to that, **On 26th June 2020, Rosetta@home researchers announced they had created antiviral proteins that neutralized SARS-CoV-2 in the lab.** Is BOINC platform safe? @@ -40,7 +40,7 @@ Projects are instructed to keep the private key only on a computer that is perma Most BOINC projects follow these practices. If you’re concerned about security, you should attach to a project only if you know it follows the code-signing procedure correctly. If in doubt, you may ask project administrators to describe how they do code signing. -### Contributing to [[email protected]][1] with BOINC platform +### Contributing to Rosetta@home with BOINC platform ![][6] @@ -56,7 +56,7 @@ I’ll discuss the following: #### System Requirements of the BOINC platform -The BOINC distributed computing platform with which you can access [[email protected]][1] is available on a 64bit operating system such as Windows, Linux, and macOS and FreeBSD. +The BOINC distributed computing platform with which you can access Rosetta@home is available on a 64bit operating system such as Windows, Linux, and macOS and FreeBSD. You will need a CPU of at least 500 MHz, 200 megabytes of free disk space, 512 megabytes of RAM, and Internet connectivity. @@ -132,9 +132,9 @@ You don’t need to worry if your system resources will be consumed when you wan If you want the application to be suspended at a lower or higher CPU usage, you can change your profile settings on the website where you created your account. -### [[email protected]][1] on a Raspberry Pi 4 +### Rosetta@home on a Raspberry Pi 4 -An ideal device to run 24/7 the [[email protected]][1] application is a Raspberry Pi, which is powerful enough and with very low power consumption. +An ideal device to run 24/7 the Rosetta@home application is a Raspberry Pi, which is powerful enough and with very low power consumption. To fight COVID-19 using a Raspberry Pi 4, you need a model with 2 GB RAM or more. My personal recommendation is the 4 GB RAM option, because with my 2 GB model one of the cores is idling as it is running out of memory. @@ -172,7 +172,7 @@ sudo nano /var/lib/boinc-client/global_prefs_override.xml This setting will increase the default memory available to Rosetta to the maximum amount of memory on the board. -#### Step 3: Add [[email protected]][1] project +#### Step 3: Add Rosetta@home project On your Raspberry Pi command line type ‘boinctui’ and click enter to load the terminal GUI.  @@ -196,7 +196,7 @@ _**If you want to stop using BOINC, simply delete the boinc packages you install One of the benefits of distributing computing is to allow user’s to donate their system resources for the common good. Despite the grief the pandemic has spread worldwide, it can make us also to realize the necessity of volunteering in one way or the other. -If you ever wondered about a [good use of your Raspberry Pi][16], [[email protected]][1] can be included to the list. +If you ever wondered about a [good use of your Raspberry Pi][16], Rosetta@home can be included to the list. Let us know at the comments below if you started “cruching” and which platform you chose. Stay safe! From 86e417db905536f8286e50745e68fcbd68efda5f Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 25 Sep 2020 08:54:28 +0800 Subject: [PATCH 0211/1156] translating --- .../talk/20200916 Huawei ban could complicate 5G deployment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20200916 Huawei ban could complicate 5G deployment.md b/sources/talk/20200916 Huawei ban could complicate 5G deployment.md index 7a9f20f127..4e624eb93a 100644 --- a/sources/talk/20200916 Huawei ban could complicate 5G deployment.md +++ b/sources/talk/20200916 Huawei ban could complicate 5G deployment.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From b953dffda4b5a7b8eb27a31c2737bd895ed1c7b1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 25 Sep 2020 09:50:23 +0800 Subject: [PATCH 0212/1156] PRF @chenmu-kk --- ...When it-s coming and what it-s good for.md | 60 +++++++++---------- 1 file changed, 27 insertions(+), 33 deletions(-) diff --git a/translated/talk/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md b/translated/talk/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md index 67a3f023f7..a6d71db97a 100644 --- a/translated/talk/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md +++ b/translated/talk/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) -[#]: translator: ( chenmu-kk ) -[#]: reviewer: ( ) +[#]: translator: (chenmu-kk) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Wi-Fi 6E: When it’s coming and what it’s good for) @@ -9,56 +9,50 @@ Wi-Fi 6E:它何时到来,又有何作用? ====== -Extreme Networks的一位高管表示,近来专用于Wi-Fi的新无线频谱可以提供更多的信道和更高的密度部署,但是要支持它的设备要到2020年才能得到广泛部署。 -智库 +> Extreme Networks 的一位高管表示,近来专用于 Wi-Fi 的新无线频谱可以提供更多的信道和更高的密度部署,但是要支持它的设备要到 2020 年才能得到广泛部署。 -今年开春 [FCC在6GHz频段内开辟了一系列新的未经许可的无线频谱][1] ,目的在于使用Wi-Fi的同时可以提供更低的延迟和更快的数据速率。与已经专用于Wi-Fi的频段相比,新频谱的范围更短,支持的频道更多,因此适合在体育场馆等高密度区域部署。 +![](https://images.idgesg.net/images/article/2019/09/cso_wireless_network_management_security_alert_iot_internet_of_things_thinkstock_685417850_1200x800-100810374-large.jpg) -为了进一步了解什么是Wi-Fi 6E以及它与Wi-Fi 6有何不同,我最近与网络解决方案提供商Extreme Networks的产品管理总监Perry Correll进行了交谈。 +今年开春 [FCC 在 6GHz 频段内开辟了一系列新的未授权的无线频谱][1],该频谱旨在用于 Wi-Fi,以提供更低的延迟和更快的数据速率。新频谱的范围更短,与已经专用于 Wi-Fi 的频段相比支持的信道也更多,因此适合在体育场馆等高密度区域部署。 -**了解更多关于5G和WiFi 6的信息** +为了进一步了解什么是 Wi-Fi 6E 以及它与 Wi-Fi 6 有何不同,我最近与网络解决方案提供商 Extreme Networks 的产品管理总监 Perry Correll 进行了交谈。 - * [什么是5G?相较于4G它更好吗?][2] - * [如何确定WiFi 6是否适合你?][3] - * [什么是MU-MIMO?为什么它在你的无线路由器中不可或缺?][4] - * [何时使用5G?何时使用WiFi 6?][5] +**了解更多关于 5G 和 WiFi 6 的信息** + + * [什么是 5G?相较于 4G 它更好吗?][2] + * [如何确定 WiFi 6 是否适合你?][3] + * [什么是 MU-MIMO?为什么它在你的无线路由器中不可或缺?][4] + * [何时使用 5G?何时使用 WiFi 6?][5] * [企业如何为5G网络做准备呢?][6] +**Kerravala: Wi-Fi 6 似乎得到了许多热捧,而 Wi-Fi 6E 却没有。为什么?** +**Correll:** 所有这些带 666 的数字会混乱得会吓死你。我们已经有了 Wi-Fi 6、Wi-Fi 6E,之后,Wi-Fi 6 还有其它的增强功能,比如多用户多入多出(多用户 MIMO)功能。还有就是 6GHz 频谱,但这并不是 Wi-Fi 6 的名称的由来:它是第六代 Wi-Fi。最重要的是,我们刚刚掌握了 5G,并且已经在谈论 6G —— 认真的讲,这更容易搞混了。 -**Kerravala:** **Wi-Fi 6似乎得到了许多炒作而Wi-Fi 6E却没有。为什么?** +**Kerravala: 为什么我们需要 Wi-Fi 6E 和普通的 Wi-Fi 6?** -**Correll:** 这666个号码中有太多混乱,会吓死您。 Wi-Fi 6,Wi-Fi 6E –之后,Wi-Fi 6仍具有其他增强功能,具有多用户多入多出(多用户MIMO)功能。 之后是6GHz频谱,但这并不是Wi-Fi 6的名称的由来:这是第六代Wi-Fi。 最重要的是,我们刚刚掌握了5G,并且已经在谈论6G-认真研究它将会变得更困惑。 +**Correll:** 上一次我们在 UNII-2 和 UNII-2 扩展中得到提升是在 15 年前,而在当时智能手机甚至还没有兴起。现在能够获得 1.2GHz 的频谱已经非常大了。使用 Wi-Fi 6E,我们不是将 Wi-Fi 空间增加一倍,事实上,我们将可用空间增加了三倍。根据你所处的地点,频谱的数量要多三倍、四倍或五倍。此外,你不必担心 DFS(动态频率选择dynamic frequency selection),尤其是在室内。 -**Kerravala:** **为什么我们需要Wi-Fi 6E和常规Wi-Fi 6?** +Wi-Fi 6E 不会比 Wi-Fi 6 更快,也不会添加增强的技术功能。最妙的是运行 6GHz 需要 Wi-Fi 6 或以上的客户端。所以,我们不会有任何缓慢的客户端,也不会有很多噪声。我们将在更干净的环境中使用更快的设备来得到高性能。 -**Correll:** 上一次我们获得UNII-2和UNII-2 Extended的优势是15年前,而在当时智能手机甚至还没有起飞。 现在能够获得1.2GHz的频率已经非常大了。 使用Wi-Fi 6E,我们不会将Wi-Fi空间增加一倍,事实上,我们是将可用空间增加了三倍。 根据您所处的地点,频谱的数量要多三倍,四倍或五倍。此外,你不必担心DFS [动态频率选择] ,尤其是在室内。 +**Kerravala: 也能用更宽的信道吗** -Wi-Fi 6E将不会拥有快于Wi-Fi 6的速度,并且不会添加增强的技术功能。 最妙的是运行6GHz需要Wi-Fi - 6或以上的客户端。所以,我们不会有任何速度慢的客户,也不会有很多噪声。我们将在更清洁的环境中使用更快的设备来提高性能。 +**Correll:** 没错,那是一件很酷的事情。如果你处于一个典型的企业环境中,20 和 40MHz 基本上就是你需要的。在体育馆这种高密度环境中,想要使用 80 或 160MHz 的带宽就会变得很困难了。更宽的信道将会真正有助于像虚拟现实这类应用,它可以利用这些信道占用频谱中剩余的部分。这可能是最大的用例了。 -**Kerravala:** **你们还会运营更宽的频道吗** +在未来的三四年里,如果你想在体育场做数字标识牌或者边缘屏幕处理,则可以使用 160MHz 的 80% 带宽,而不会受到其他任何影响。已经有传言说 Wi-Fi 7 将会有 320MHz 宽的频道。 -**Correll:** Exactly, that's the cool thing about it. If you’re in a typical enterprise environment, 20 and 40MHz is pretty much all you need. In high-density environments like stadiums, trying to do 80 or 160MHz just became tough. Wider channels are really going help things like [virtual reality], which can take advantage of those channels that are eating up the rest of the spectrum. That’s probably the biggest use case. -确切地说,那是一件很酷的事情。如果你处于一个典型的企业环境中,20和40MHz已经在体育馆这种高密度环境中,仅使用80或160MHz资源也会,很紧张。更宽的通道将会真正有助于像虚拟现实这类可以利用这些频谱中剩余的通道。这可能是最大的使用情况了。 -没错,这才是最酷的地方。如果您在一个典型的企业环境中,20和40MHz几乎足够满足你的需求。在像体育场这样的高密度环境中,想要做到80或160MHz就变得很困难了。更宽的频道确实有助于[虚拟现实]这样的事情,它们可以利用那些使用过后剩余部分中的频道。这可能是最大的用例。 +**Kerravala: 这将主要是对大多数 Wi-Fi 策略的增强吗?** -在未来的三四年里,如果你想在体育场做频谱的数字标识牌或者屏幕边缘处理,则可以使用160MHz的80%带宽,而不会受到其他任何影响。已经有传言说Wi-Fi 7将会有320MHz宽的频道。 +**Correll:** 短期内肯定会处于先锐领域。首批产品大概会在今年底发布,它们将是消费类产品。对于企业来说,支持 6GHz 的产品将会在明年亮相。在 2022 年之前,你不会真正看到它密集出现——所以,短期内不会。对于智能手机公司来说,Wi-Fi 并不是什么大事,他们更愿意关注其他功能。 -**Kerravala:** **这将主要是对大多数Wi-Fi策略的增强吗?** +但它仍是一个巨大的机会。6GHz 与 CBRS(公民宽带无线电服务)或 5G 相比,最棒的一点是(许多人)宁愿坚持使用 Wi-Fi,也不愿迁移到不同的架构。这些用户将推动驱动部件制造商转向物联网设备或机器人或任何需要 6GHz 的设备。这是一个干净的频谱,可能比普通的 Wi-Fi 6 还要便宜也更节能。 -**Correll:** 在短期内边缘上将会非常的明确。第一批产品大概会在今年底发布,并且他们将会是消费级的。对于企业来说,6GHz合格产品将会在下一年开始出现。直到2022年你才会实际的看到任何密度——所以,并不会很快。 -短期内肯定会处于边缘。首批产品大概会在今年底发布,它们将是消费类产品。对于企业来说,支持6GHz的产品将会在明年亮相。在2022年之前,你不会真正看到任何密集信息——所以,短期内不会。对于智能手机公司来说,Wi-Fi并不是什么大事,他们更愿意关注其他功能。 +**Kerravala: 有人说 5G 会替代 Wi-Fi 6。但这有什么实际意义呢?** -但它仍是一个巨大的机会。6GHz与CBRS [公民宽带无线电服务] 或5G相比,最棒的一点是 [许多人] 宁愿坚持使用Wi-Fi,也不愿迁移到不同的架构。这些用户将推动驱动部件制造商转向物联网设备或机器人或任何需要6GHz的设备。这是一个干净的频谱,可能比普通的Wi-Fi 6还要便宜也更节能。 +**Correll:** 现实中,你不可能在每个设备中插入 SIM 卡。但是其中一个大问题是数据所有权,因为运营商将拥有你的数据,而不是你。如果你想使用你的数据进行任何类型的业务分析,运营商是否会以一定价格将数据返还给你?这是一个可怕的想法。 -**Kerravala:** **这是一场5G替代Wi-Fi 6的讨论。它的实用性在哪里?** - -**Correll:** 事实上,你不能将SIM插入所有的设备中。 但是出现的主要问题之一是数据所有权,因为运营商将拥有你的数据,而不是你。 如果你想使用你的数据进行任何类型的业务分析,运营商是否会以一定价格将数据返还给你?这是一个可怕的想法。 - -Wi-Fi未被淘汰有太多的理由。当具备Wi-Fi 6和5g功能的设备问世时,其他只有Wi-Fi功能的笔记本电脑、平板电脑和物联网设备将会发生什么呢?将会有Wi-Fi或Wi-Fi和5G设备,但5G不会完全取代Wi-Fi。如果你看看5G无线网络的主干,Wi-Fi就是其中的一个组成部分。这是一个幸福的大家庭。这些技术是为了共存而设计的。 - -加入 [Facebook][7] 和 [LinkedIn][8] 上的网络世界社区,就你最关心的话题发表评论吧。 +Wi-Fi 不会消失有太多的理由。当具备 Wi-Fi 6 和 5G 功能的设备问世时,其他只有 Wi-Fi 功能的笔记本电脑、平板电脑和物联网设备将会发生什么呢?要么是只支持 Wi-Fi 的设备,要么是支持 Wi-Fi 和 5G 的设备,但 5G 不会完全取代 Wi-Fi。如果你看看 5G 无线网络的骨干网,Wi-Fi 就是其中的一个组成部分。这是一个幸福的大家庭。这些技术是为了共存而设计的。 -------------------------------------------------------------------------------- @@ -67,7 +61,7 @@ via: https://www.networkworld.com/article/3563832/wi-fi-6e-when-its-coming-and-w 作者:[Zeus Kerravala][a] 选题:[lujun9972][b] 译者:[chenmu-kk](https://github.com/chenmu-kk) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 853ff9ed228f55aafda6d112ddba50c7d5651a8d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 25 Sep 2020 09:50:49 +0800 Subject: [PATCH 0213/1156] PUB @chenmu-kk https://linux.cn/article-12650-1.html --- ...00625 Wi-Fi 6E- When it-s coming and what it-s good for.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md (98%) diff --git a/translated/talk/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md b/published/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md similarity index 98% rename from translated/talk/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md rename to published/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md index a6d71db97a..7fb3d60133 100644 --- a/translated/talk/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md +++ b/published/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (chenmu-kk) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12650-1.html) [#]: subject: (Wi-Fi 6E: When it’s coming and what it’s good for) [#]: via: (https://www.networkworld.com/article/3563832/wi-fi-6e-when-its-coming-and-what-its-good-for.html) [#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/) From 031ca3ed2dd6510d3c6d6da814df94a4525bccc2 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 25 Sep 2020 20:16:05 +0800 Subject: [PATCH 0214/1156] Rename sources/tech/20200923 How my students taught me to code.md to sources/talk/20200923 How my students taught me to code.md --- .../{tech => talk}/20200923 How my students taught me to code.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200923 How my students taught me to code.md (100%) diff --git a/sources/tech/20200923 How my students taught me to code.md b/sources/talk/20200923 How my students taught me to code.md similarity index 100% rename from sources/tech/20200923 How my students taught me to code.md rename to sources/talk/20200923 How my students taught me to code.md From b26f7518668557e5b46b69403272d2f07a5af6f3 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 26 Sep 2020 05:01:57 +0800 Subject: [PATCH 0215/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200926?= =?UTF-8?q?=2010=20Open=20Source=20Static=20Site=20Generators=20to=20Creat?= =?UTF-8?q?e=20Fast=20and=20Resource-Friendly=20Websites?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md --- ...ate Fast and Resource-Friendly Websites.md | 214 ++++++++++++++++++ 1 file changed, 214 insertions(+) create mode 100644 sources/tech/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md diff --git a/sources/tech/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md b/sources/tech/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md new file mode 100644 index 0000000000..2aa7b8531b --- /dev/null +++ b/sources/tech/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md @@ -0,0 +1,214 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites) +[#]: via: (https://itsfoss.com/open-source-static-site-generators/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites +====== + +_**Brief: Looking to deploy a static web-page? No need to fiddle with HTML and CSS. These open source static website generators will help you deploy beautiful, functional static websites in no time.**_ + +### What is a static website? + +Technically, a static website means the webpages are not generated on the server dynamically. The HTML, CSS, JavaScript lie on the server in the version the end user receives it. The raw source code files are already prebuilt, the source code doesn’t change with the next server request. + +It’s FOSS is a dynamic website which depends on several databases and the web pages are generated and served when there’s a request from your browser. Majority of the web is powered by dynamic sites where you interact with the websites and there are plenty of content that often change. + +Static websites give you a few benefits like faster loading times, less server resource requirements, and better security (debatable?). + +Traditionally, static websites are more suitable for creating small websites with only a few pages and where the content doesn’t change too often. + +This, however, is changing thanks to static website generator tools and you can use them to create blogs as well. + +I have compiled a list of open source static site generators that can help you build a beautiful website. + +### Best Open Source Static Site Generators + +It’s worth noting that you will not get complex functionality on a static website. In that case, you might want to check out our list of [best open source CMS][1] for dynamic websites. + +#### 1\. Jekyll + +![][2] + +Jekyll is one of the most popular open source static generator built using [Ruby][3]. In fact, Jekyll is the engine behind [GitHub pages][4] which lets you host websites using GitHub for free. + +Setting up Jekyll is easy across multiple platforms which includes Ubuntu as well. It utilizes [Markdown][5], [Liquid][5] (for template), HTML, and CSS to generate the static site files. It is also a pretty good option if you want to build a blog without advertisements or a product page to promote your tool or service. + +Also, it supports migrating your blog from popular CMSs like Ghost, WordPress, Drupal 7, and more. You get to manage permalinks, categories, pages, posts, and custom layouts, which is nice. So, even if you already have an existing website that you want to convert to a static site, Jekyll should be a perfect solution. You can learn more about it by exploring the [official documentation][6] or its [GitHub page][7]. + +[Jekyll][8] + +#### 2\. Hugo + +![][9] + +Hugo is yet another popular open source framework for building static sites. It’s built using the [Go programming language][10]. + +It is fast, simple, and reliable. You also get some advanced theming support if you need it. It also offers some useful shortcuts to help you get things done easily. No matter whether it’s a portfolio site or a blog, Hugo is capable enough to manage a variety of content types. + +To get started, you can follow its [official documentation][11] or go through its [GitHub page][12] to install it and learn more about its usage. You can also deploy Hugo on GitHub pages or any CDN if required. + +[Hugo][13] + +#### 3\. Hexo + +![][14] + +Hexo is an interesting open-source framework powered by [Node.js][15]. Similar to others, you will end up creating blazing fast websites but you will also get a good collection of themes and plugins. + +You do get a powerful API here to extend functionality as per your requirements as well. If you already have a website, you can simply use its [Migrator][16] extension as well. + +To get started, you can go through the [official documentation][17] or just explore their [GitHub page][18]. + +[Hexo][19] + +#### 4\. Gatsby + +![][20] + +Gatsby is an increasingly open-source popular site generator framework. It utilizes [React.js][21] for creating fast and beautiful websites. + +I was quite interested to give this a try for some experimental projects a few years back and it is impressive to see the availability thousands of new plugins and themes. Unlike other static site generators, you can use Gatsby to generate a site and get the benefits of static sites without losing any features. + +It offers a lot of useful integrations from popular services. Of course, you can keep it simple or use it coupled with a popular CMS of your choice, which should be interesting. You can take a look at their [official documentation][22] and its [GitHub page][23] to find out more on it. + +[Gatsby][24] + +#### 5\. VuePress + +![][25] + +VuePress is a static site generator powered by [Vue.js][26] which happens to be an open-source progressive JavaScript framework. + +If you know HTML, CSS, and JavaScript, you can easily get started using VuePress. You should find several useful plugins and themes to get a head start on building your site. Also, it seems like Vue.js is being actively improved and has the attention of more developers, which is a good thing. + +You can learn more about it through their [official guide][27] and the [GitHub page][28]. + +[VuePress][29] + +#### 6\. Nuxt.js + +![][30] + +Nuxt.js utilizes Vue.js and Node.js but it focuses on providing modularity and has the ability to rely on the server-side instead of the client-side. Not just that, it aims to provide an intuitive experience to the developers with descriptive errors, and detailed documentations among other things. + +As it claims, Nuxt.js should be the best of both world with all of its features and flexibility that you get to build a static website. They also offer a [Nuxt Online sandbox][31] to let you directly test it without a lot of effort. + +You can explore its [GitHub page][32] or visit the [official][33] [][33][site][33] to get more details. + +#### 7\. Docusaurus + +![][34] + +Docusaurus is an interesting open-source static site generator tailored for building documentation websites. It happens to be a part of [Facebook’s open source initiative][35]. + +It is built using React. You get all the essential features like document versioning, document search, and translation mostly pre-configured. If you’re planning to build a documentation website for any of your products/services, this should be a good start. + +You can learn more about it on its [GitHub page][36] and its [official website][37]. + +[Docusaurus][37] + +#### 8\. Eleventy + +![][38] + +Eleventy describes itself as an alternative to Jekyll and aims for a simpler approach to make faster static websites. + +It seems easy to get started and it also offers proper documentation to help you out. If you want a simple static site generator that gets the job done, Eleventy seems to be an interesting choice. + +You can explore more about it on its [GitHub page][39] and visit the [official website][40] for more details. + +[Eleventy][40] + +#### 9\. Publii + +![][41] + +Publii is an impressive open-source CMS that makes it easy to generate a static site. It’s built using [Electron][42] and Vue.js. You can also migrate your posts from a WordPress site if needed. In addition to that, it offers several one-click synchronizations with GitHub Pages, Netlify, and similar services. + +You also get a WYSIWYG editor if you utilize Publii to generate a static site. To get started, visit the [official website][43] to download it or explore its [GitHub page][44] for more information. + +[Publii][43] + +#### 10\. Primo + +![][45] + +An interesting open-source static site generator which is still in active development. Even though it’s not a full-fledged solution with all the features compared to other static generators, it is a unique project. + +Primo aims to help you build and develop a site using a visual builder which can be easily edited and deployed to any host of your choice. + +You can visit the [official website][46] or explore its [GitHub page][47] for more information. + +[Primo][46] + +### Wrapping Up + +There are a lot of other site generators available out there. However, I’ve tried to mention the best static generators that gives you the fastest loading times, the best security, and an impressive flexibility. + +Did I miss any of your favorites? Let me know in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/open-source-static-site-generators/ + +作者:[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/open-source-cms/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/01/jekyll-screenshot.jpg?resize=800%2C450&ssl=1 +[3]: https://www.ruby-lang.org/en/ +[4]: https://pages.github.com/ +[5]: https://github.com/Shopify/liquid/wiki +[6]: https://jekyllrb.com/docs/ +[7]: https://github.com/jekyll/jekyll +[8]: https://jekyllrb.com/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/hugo.jpg?resize=800%2C414&ssl=1 +[10]: https://golang.org/ +[11]: https://gohugo.io/getting-started/ +[12]: https://github.com/gohugoio/hugo +[13]: https://gohugo.io/ +[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/hexo.jpg?resize=800%2C213&ssl=1 +[15]: https://nodejs.org/en/ +[16]: https://hexo.io/api/migrator.html +[17]: https://hexo.io/docs/ +[18]: https://github.com/hexojs/hexo +[19]: https://hexo.io/ +[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/gatsbyjs.png?resize=800%2C388&ssl=1 +[21]: https://reactjs.org/ +[22]: https://www.gatsbyjs.com/docs/ +[23]: https://github.com/gatsbyjs/gatsby +[24]: https://www.gatsbyjs.com/ +[25]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/VuePress.jpg?resize=800%2C498&ssl=1 +[26]: https://vuejs.org/ +[27]: https://vuepress.vuejs.org/guide/ +[28]: https://github.com/vuejs/vuepress +[29]: https://vuepress.vuejs.org/ +[30]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/nuxtjs.jpg?resize=800%2C415&ssl=1 +[31]: https://template.nuxtjs.org/ +[32]: https://github.com/nuxt/nuxt.js +[33]: https://nuxtjs.org/ +[34]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/docusaurus.jpg?resize=800%2C278&ssl=1 +[35]: https://opensource.facebook.com/ +[36]: https://github.com/facebook/docusaurus +[37]: https://docusaurus.io/ +[38]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/eleventy.png?resize=800%2C375&ssl=1 +[39]: https://github.com/11ty/eleventy/ +[40]: https://www.11ty.dev/ +[41]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/publii.jpg?resize=800%2C311&ssl=1 +[42]: https://www.electronjs.org +[43]: https://getpublii.com/ +[44]: https://github.com/GetPublii/Publii +[45]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/primo-af.jpg?resize=800%2C394&ssl=1 +[46]: https://primo.af/ +[47]: https://github.com/primo-app/primo-desktop From ebf6e8330290d737010554c4617d087ecb309171 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 26 Sep 2020 05:02:14 +0800 Subject: [PATCH 0216/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200925?= =?UTF-8?q?=20Code=20your=20first=20algorithm=20in=20Scratch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200925 Code your first algorithm in Scratch.md --- ...25 Code your first algorithm in Scratch.md | 151 ++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 sources/tech/20200925 Code your first algorithm in Scratch.md diff --git a/sources/tech/20200925 Code your first algorithm in Scratch.md b/sources/tech/20200925 Code your first algorithm in Scratch.md new file mode 100644 index 0000000000..b5960d0cbb --- /dev/null +++ b/sources/tech/20200925 Code your first algorithm in Scratch.md @@ -0,0 +1,151 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Code your first algorithm in Scratch) +[#]: via: (https://opensource.com/article/20/9/scratch) +[#]: author: (Jess Weichler https://opensource.com/users/cyanide-cupcake) + +Code your first algorithm in Scratch +====== +Learn how to get started with Scratch in this article in a series about +teaching kids to code. +![The back of a kid head][1] + +With more kids learning from home this year, it's important to engage them with unique learning opportunities. The classroom looks very different than it did before, and it's going to continue to evolve. So should the lessons we teach. + +In the [first article][2] in this series, I shared how my students taught me to code. Over the next few weeks, I will be exploring how educators and parents can harness the power of coding to teach kids a wide variety of skills. + +"But I don't know anything about coding!" you may be shouting at your computer. That's one of the beauties of open source code: everyone is a learner, and everyone is a teacher. Whether you're new to coding or you've been doing it all your life, part of the process is making mistakes. It's all about problem-solving and learning how to find information. The greatest tool an educator has in a coding classroom is the phrase, "I don't know; let's find out together!" + +So, let's begin! + +### What is code? + +Code is how you get a computer to do what you want it to do. Laptops, smartphones, video-game consoles, and even washing machines use code to work. And despite advancements in machine learning and AI, somebody has to write that code. + +Coders (also known as programmers) are the people who write code. But what is code, really? What exactly are programmers writing when they create software or fine-tune hardware? + +Code is made up of _algorithms_: highly structured and ordered lists of instructions, much like a recipe. Because computers aren't actually smart, these instructions are written in _code_ that must be parsed and compiled and transformed into _machine language_. Only then can computers perform the actions that programmers dictate. The key is to learn the syntax of the code so you can write words in the required order so that computers can decipher and process them. + +### What is Scratch? + +[Scratch][3] is a great platform for kids learning to code. It is a visual programming language designed for ages 8 and up. It uses drag-and-drop blocks that snap together to create animations, quizzes, and video games. Traditional coding requires a lot of typing without making any spelling errors, and the visual nature of Scratch makes it easy for young writers to learn to code without getting bogged down with spelling errors. + +Scratch is not just about coding, though. It also encourages an open online community by empowering users to share and remix projects. There's also an offline version available for classrooms and households with limited internet connectivity. + +### Learn the lingo + +Even if a child has used Scratch before, this lesson is important for ensuring they understand coding terminology and logic. + +![Scratch interface][4] + +(Jess Weichler, [CC BY-SA 4.0][5]) + +Using Scratch, you can create video games using **code blocks** that snap together to form a script. A **script** is an ordered list of instructions, like a recipe. Another word for "script" is **algorithm**. + +A **sprite** is a character or object in the game. The **stage** is the background of the game. Scripts can be used to control sprites and the stage. + +Every script starts with a special code block called an **event hat**. These blocks have rounded tops. An event hat waits for something to happen before running all the code blocks underneath it. + +Scratch follows scripts exactly, so you must be specific when telling it what to do. + +### Get coding + +Try the following challenges to get started on your coding journey. + +#### Challenge #1: Create a simple algorithm to move a sprite right when you press the right arrow key. + +Did your algorithm work as you expected? Does your sprite move right when the right arrow is pressed? How did you do it? + +When coding, there are often multiple solutions to a problem. Here are two of the most common ways you may have coded the sprite to move when the right arrow is pressed: + +![Possibility One: When right arrow pressed, move 10 steps . Possibility Two: When right arrow pressed, change x by 10.][6] + +(Jess Weichler, [CC BY-SA 4.0][5]) + +Let's experiment. + + * What happens if you change the number? + * What happens when your sprite reaches the edge of the screen? + * What motion code block could prevent the sprite from disappearing when it reaches the edge? + + + +![Possibility One: When right arrow pressed, move 15 steps, if on edge, bounce. Possibility Two: When right arrow pressed, change x by 15, if on edge, bounce][7] + +(Jess Weichler, [CC BY-SA 4.0][5]) + +Now what happens? How can you solve it? + +To stop the sprite from flipping upside-down after hitting an edge: select the sprite and click **Direction**. Select the **Left/Right** icon or the **Do Not Rotate** icon. + +![Scratch code][8] + +(Jess Weichler, [CC BY-SA 4.0][5]) + +Errors in code, such as this, are called **bugs**. Bugs are a normal part of coding. + +Fixing code is called **debugging**. + +Test your game again. Do you notice any more bugs? + + * If your sprite is bouncing off the right side of the screen, you are ready for the next challenge. + * If, when your sprite touches the right side of the screen, it starts moving left when you press the right arrow, add one more code block to the algorithm. + + + +![Possibility One: When right arrow pressed, point in direction 90, move 15 steps, if on edge, bounce. Possibility Two: No change][9] + +(Jess Weichler, [CC BY-SA 4.0][5]) + +#### Challenge #2: Make the sprite move left when you press the left arrow. + +You have all the skills and knowledge you need to ace this challenge! How will you complete it? + +[Click here for my solution][10]. + +If you're using a screen reader, or you prefer text, select this spoiler text to reveal the answer: + +**Possibility One:** When right arrow pressed, point in direction 90, move 15 steps, if on edge, bounce +When left arrow pressed, point in direction -90, move 15 steps, if on edge, bounce + +**Possibility Two:** When right arrow pressed, change x by 15, if on edge, bounce +When left arrow pressed, change x by -15, if on edge, bounce + +When you're happy with what you've made, name and save your project. Do not select "save as" or "save a copy," as this will create a duplicate project. Just click **Save** or **Save Now**. + +Congratulations, you've created your first two algorithms! + +### Don't stop here + +Coding is all about experimenting and iterating until you get the desired result. This is one of many reasons I love it as a teaching tool. And don't stop with just this introductory lesson. + +Pose a problem and try to solve it with Scratch. For instance, can you make a game in which the Scratch cat finds an object and "eats" it? Look through the available blocks and formulate a plan, then construct a script. + +Most importantly, don't give up, and remember, there's no wrong answer! It's all about creativity, being inventive, and having fun. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/scratch + +作者:[Jess Weichler][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://opensource.com/users/cyanide-cupcake +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/idea_innovation_kid_education.png?itok=3lRp6gFa (The back of a kid head) +[2]: https://opensource.com/article/20/9/how-my-students-taught-me-code +[3]: https://scratch.mit.edu/ +[4]: https://opensource.com/sites/default/files/uploads/codekids2_1_interface.png (Scratch interface) +[5]: https://creativecommons.org/licenses/by-sa/4.0/ +[6]: https://opensource.com/sites/default/files/uploads/codekids2_2_code.png (Scratch code) +[7]: https://opensource.com/sites/default/files/uploads/codekids2_3_code.png (Scratch code) +[8]: https://opensource.com/sites/default/files/uploads/codekids2_4_code.png (Scratch code) +[9]: https://opensource.com/sites/default/files/uploads/codekids2_5_code.png (Scratch code) +[10]: https://opensource.com/sites/default/files/scratch3-left-right_answer.png From 321837eb5b664419834006be0cdd3ef9762b3796 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 26 Sep 2020 05:02:27 +0800 Subject: [PATCH 0217/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200925?= =?UTF-8?q?=205=20questions=20to=20ask=20yourself=20when=20writing=20proje?= =?UTF-8?q?ct=20documentation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200925 5 questions to ask yourself when writing project documentation.md --- ...self when writing project documentation.md | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 sources/tech/20200925 5 questions to ask yourself when writing project documentation.md diff --git a/sources/tech/20200925 5 questions to ask yourself when writing project documentation.md b/sources/tech/20200925 5 questions to ask yourself when writing project documentation.md new file mode 100644 index 0000000000..e7457aa04f --- /dev/null +++ b/sources/tech/20200925 5 questions to ask yourself when writing project documentation.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 questions to ask yourself when writing project documentation) +[#]: via: (https://opensource.com/article/20/9/project-documentation) +[#]: author: (Alexei Leontief https://opensource.com/users/alexeileontief) + +5 questions to ask yourself when writing project documentation +====== +Using some of the basic principles of effective communication can help +you create well-written, informative project documents that align with +your brand. +![A person writing.][1] + +Before getting down to the actual writing part of documenting another one of your open source projects, and even before interviewing the experts, it's a good idea to answer some high-level questions about your new document. + +Renowned communication theorist Harold Lasswell wrote in his 1948 article, _The Structure and Function of Communication in Society_: + +> [A] convenient way to describe an act of communication is to answer the following questions: +> +> * Who +> * Says what +> * In which channel +> * To whom +> * With what effect? +> + + +As a technical communicator, you can apply Lasswell's theory and answer similar questions about your document to communicate your message better and with the desired effect. + +### Who—Who is the document owner? + +Or, what company is behind the document? What brand identity does it want to convey to its audience? The answer to this question will significantly influence your writing style. The company may also have its own style guide or at least a formal mission statement, in which case, you should start there. + +If the company is just starting out, you may ask the questions above to the document's owner. As the writer, it's important to integrate the voice and persona you create for the company with your own worldview and beliefs. This will make your writing sound more natural and less like company jargon. + +### Says what—What is the document type? + +What information do you need to communicate? What type of document is it: a user guide, API reference, release notes, etc.? Many document types will have templates or generally agreed-upon structures that will give you a place to start and help ensure you include all the necessary information. + +### In which channel—What is the format of the document? + +With technical documents, the channel of communication often informs the final format of your doc, i.e., whether it's going to be a PDF, HTML, a text file, etc. This will, most likely, also determine the tools you should use to write your document. + +### To whom—Who is the target audience? + +Who will read this document? What is their level of knowledge? What are their job responsibilities and their main challenges? These questions will help you determine what you should cover, whether or not you should go into details, whether you can use any specific terms, etc. In some cases, the answers to these questions can even influence the complexity of syntax that you should use. + +### With what effect—What is the purpose of the document? + +This is where you should define what problem(s) this document is expected to solve for its prospective readers, or what questions it should answer for them. For example, the purpose of your document can be to teach your customers to work with your product. + +At this point, you may refer to the approach suggested by [Divio][2]. According to this approach, you can assign any document one of four types, depending on the document's general orientation: learning, solving a problem, understanding, or getting information. + +Another good question to ask at this stage is what business problem this document is meant to solve (for example, how to cut down support costs.) With a business problem in mind, you may see an important angle for your writing. + +### Conclusion + +The questions above are designed to help you form the basis for effective communication and ensure your document covers everything it should. You can break them down into your own checklist of questions and keep them around for whenever you have a document to create. This checklist may also come in handy when you become stuck, confronted with a blank page. It will hopefully inspire you and help you generate ideas. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/project-documentation + +作者:[Alexei Leontief][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://opensource.com/users/alexeileontief +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003784_02_os.comcareers_resume_rh1x.png?itok=S3HGxi6E (A person writing.) +[2]: https://documentation.divio.com/ From 88dd1d0d8915e969bd0729d055b225e47b778800 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 26 Sep 2020 05:02:53 +0800 Subject: [PATCH 0218/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[talk]:=2020200926?= =?UTF-8?q?=20Cisco=20turns=20out=20security=20patches=2025=20high-threat?= =?UTF-8?q?=20flaws=20for=20IOS,=20IOS=20XE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200926 Cisco turns out security patches 25 high-threat flaws for IOS, IOS XE.md --- ...es 25 high-threat flaws for IOS, IOS XE.md | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 sources/talk/20200926 Cisco turns out security patches 25 high-threat flaws for IOS, IOS XE.md diff --git a/sources/talk/20200926 Cisco turns out security patches 25 high-threat flaws for IOS, IOS XE.md b/sources/talk/20200926 Cisco turns out security patches 25 high-threat flaws for IOS, IOS XE.md new file mode 100644 index 0000000000..dc08d1ec01 --- /dev/null +++ b/sources/talk/20200926 Cisco turns out security patches 25 high-threat flaws for IOS, IOS XE.md @@ -0,0 +1,68 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Cisco turns out security patches 25 high-threat flaws for IOS, IOS XE) +[#]: via: (https://www.networkworld.com/article/3583654/cisco-turns-out-security-patches-25-high-threat-flaws-for-ios-ios-xe.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +Cisco turns out security patches 25 high-threat flaws for IOS, IOS XE +====== +Cisco this week posted 25 security advisories defining 34 vulnerabilities rated high that should be fixed right away +[Nathan Cowley / Ivanastar / Getty Images][1] + +If you are a security admin with lots of systems running Cisco IOS and IOS XE software today is decidedly not your day. + +Cisco this week posted 25 “High” rated security advisories that stem from 34 vulnerabilities the company suggests should be fixed as soon as possible. The vulnerabilities impact a wide-range of Cisco gear as IOS and IOS XE are the company’s most widely used operating systems. The warnings affect firewalls, wireless access points and switches. + +[Network pros react to new Cisco certification curriculum][2] + +For example, one of the highest rated threats--with an 8.6 out of 10 threat level, are [multiple vulnerabilities][3] in the Zone-Based Firewall feature of Cisco IOS XE Software that could let an remote attacker to cause the device to reload or stop forwarding traffic through the [firewall][4],resulting in a denial of service (DoS). + +Cisco stated that the vulnerabilities are due to incomplete handling of Layer 4 packets through the device. An attacker could exploit these vulnerabilities by sending a certain sequence of traffic patterns through the device.  + +Another 8.6-rated vulnerability involves the [Split DNS feature][5] of Cisco IOS Software and Cisco IOS XE Software could let an unauthenticated, remote attacker cause an affected device to reload, resulting in a DoS condition. + +“The vulnerability occurs because the regular expression (regex) engine that is used with the Split [DNS][6] feature of affected releases may time out when it processes the DNS name list configuration. An attacker could exploit this vulnerability by trying to resolve an address or hostname that the affected device handles,” Cisco stated. + +Still another 8.6-rated security threat involves a vulnerability in the [DHCP][7] message handler of Cisco IOS XE Software for Cisco cBR-8 Converged Broadband Routers.  The vulnerability is due to insufficient error handling when DHCP version 4 (DHCPv4) messages are parsed. An attacker could exploit this vulnerability by sending a malicious DHCPv4 message to or through a WAN interface of an affected device. A successful exploit could allow the attacker to cause a reload of the affected device, Cisco stated. + +Some of the other threat advisories include: + + * A vulnerability in the [WPA2 and WPA3 security implementation][8] of Cisco IOS XE Wireless Controller Software for the Cisco Catalyst 9000 Family could let an unauthenticated, adjacent attacker send a crafted authentication packet to an affected device. A successful exploit could cause it to reload, resulting in a DoS condition. The vulnerability is due to incorrect packet processing during the WPA2 and WPA3 authentication handshake when configured for dot1x or pre-shared key (PSK) authentication key management (AKM) with 802.11r BSS Fast Transition (FT) enabled, Cisco stated. + * A vulnerability in the [Umbrella Connector][9] component of Cisco IOS XE Software for Cisco Catalyst 9200 Series Switches could allow an unauthenticated, remote attacker to trigger a reload, resulting in a DOS condition on an affected device. The vulnerability is due to insufficient error handling when parsing DNS requests. An attacker could exploit this vulnerability by sending a series of malicious DNS requests to an Umbrella Connector client interface of an affected device. + * Multiple vulnerabilities in the [web management framework of Cisco IOS XE][10] Software could allow an authenticated, remote attacker with read-only privileges to elevate them to _Administrator_ on an affected device. For example, a vulnerability in the APIs of the web management framework of Cisco IOS XE Software could lead to such an attack. Another weakness in the authentication controls of the web management framework of Cisco IOS XE Software could allow an authenticated, remote attacker with read-only privileges to elevate privileges to _Administrator_ on an affected device. + + + +Workarounds are not available, but patches or software updates addressing all of the vulnerabilities are [available][11], Cisco stated. + +Join the Network World communities on [Facebook][12] and [LinkedIn][13] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3583654/cisco-turns-out-security-patches-25-high-threat-flaws-for-ios-ios-xe.html + +作者:[Michael Cooney][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://www.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://www.pexels.com/photo/man-in-blue-and-brown-plaid-dress-shirt-touching-his-hair-897817/ +[2]: https://www.networkworld.com/article/3446044/network-pros-react-to-new-cisco-certification-curriculum.html +[3]: https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-zbfw-94ckG4G +[4]: https://www.networkworld.com/article/3230457/what-is-a-firewall-perimeter-stateful-inspection-next-generation.html +[5]: https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-splitdns-SPWqpdGW +[6]: https://www.networkworld.com/article/3268449/what-is-dns-and-how-does-it-work.html +[7]: https://www.networkworld.com/article/3299438/dhcp-defined-and-how-it-works.html +[8]: https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-wpa-dos-cXshjerc +[9]: https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-iosxe-umbrella-dos-t2QMUX37 +[10]: https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-ios-webui-priv-esc-K8zvEWM#d +[11]: https://tools.cisco.com/security/center/home.x +[12]: https://www.facebook.com/NetworkWorld/ +[13]: https://www.linkedin.com/company/network-world From f46e7fe733b55cf806985153f6504985292671a0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 26 Sep 2020 10:30:48 +0800 Subject: [PATCH 0219/1156] Rename sources/talk/20200926 Cisco turns out security patches 25 high-threat flaws for IOS, IOS XE.md to sources/tech/20200926 Cisco turns out security patches 25 high-threat flaws for IOS, IOS XE.md --- ...s out security patches 25 high-threat flaws for IOS, IOS XE.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{talk => tech}/20200926 Cisco turns out security patches 25 high-threat flaws for IOS, IOS XE.md (100%) diff --git a/sources/talk/20200926 Cisco turns out security patches 25 high-threat flaws for IOS, IOS XE.md b/sources/tech/20200926 Cisco turns out security patches 25 high-threat flaws for IOS, IOS XE.md similarity index 100% rename from sources/talk/20200926 Cisco turns out security patches 25 high-threat flaws for IOS, IOS XE.md rename to sources/tech/20200926 Cisco turns out security patches 25 high-threat flaws for IOS, IOS XE.md From 23723ca524ebf58169c703be2da8e6113c5b4324 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 26 Sep 2020 11:26:44 +0800 Subject: [PATCH 0220/1156] PRF @geekpi --- ...ncremental backups with Btrfs snapshots.md | 47 +++++++++++-------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/translated/tech/20200914 Incremental backups with Btrfs snapshots.md b/translated/tech/20200914 Incremental backups with Btrfs snapshots.md index f82ce56526..ef47167f8f 100644 --- a/translated/tech/20200914 Incremental backups with Btrfs snapshots.md +++ b/translated/tech/20200914 Incremental backups with Btrfs snapshots.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Incremental backups with Btrfs snapshots) @@ -10,53 +10,63 @@ 使用 Btrfs 快照进行增量备份 ====== -![][1] +![](https://img.linux.net.cn/data/attachment/album/202009/26/112524cppfppjpvplyjzyx.jpg) -快照是 Btrfs 的一个有趣的功能。快照是一个子卷的副本。生成快照是立即的。然而,生成快照与执行 _rsync_ 或 _cp_ 不同,快照并不是一创建就会占用空间。 +快照snapshot是 Btrfs 的一个有趣的功能。快照是一个子卷的副本。生成快照是立即的。然而,生成快照与执行 `rsync` 或 `cp` 不同,快照并不是一创建就会占用空间。 -编者注:来自 [BTRFS Wiki][2 ]:快照是一个简单的子卷,它使用 Btrfs 的 COW 功能与其他子卷共享其数据(和元数据)。 +> 编者注:来自 [BTRFS Wiki][2]:快照简单的来说就是一个子卷,它使用 Btrfs 的 COW 功能与其他子卷共享其数据(和元数据)。 -如果它是可写的,占用的空间将随着原始子卷或快照本身的数据变化而增加。子卷中已添加/修改的文件和已删除的文件仍然存在于快照中。这是一种方便的备份方式。 +占用的空间将随着原始子卷或快照本身(如果它是可写的)的数据变化而增加。子卷中已添加/修改的文件和已删除的文件仍然存在于快照中。这是一种方便的备份方式。 ### 使用快照进行备份 -快照保存在子卷所在的同一磁盘上。你可以像浏览普通目录一样浏览它,并按照生成快照时的状态恢复文件的副本。顺便说一下,在被快照子卷的同一磁盘上做快照并不是一个理想的备份策略:如果硬盘坏了,快照也会丢失。快照的一个有趣的功能是可以将快照发送到另一个位置。快照可以被发送到外部硬盘或通过 SSH 发送到远程系统(目标文件系统也需要格式化为 Btrfs)。要实现这个,需要使用命令 _btrfs send_ 和 _btrfs receive_。 +快照驻留在子卷所在的同一磁盘上。你可以像浏览普通目录一样浏览它,并按照生成快照时的状态恢复文件的副本。顺便说一下,在快照子卷的同一磁盘上生成快照并不是一个理想的备份策略:如果硬盘坏了,快照也会丢失。快照的一个有趣的功能是可以将快照发送到另一个位置。快照可以被发送到外部硬盘或通过 SSH 发送到远程系统(目标文件系统也需要格式化为 Btrfs)。要实现这个,需要使用命令 `btrfs send` 和 `btrfs receive`。 ### 生成快照 -要使用 _send_ 和 _receive_ 命令,重要的是要将快照创建为只读,而快照默认是可写的。 +要使用 `btrfs send` 和 `btrfs receive` 命令,重要的是要将快照创建为只读,而快照默认是可写的。 -下面的命令将对 _/home_ 子卷进行快照。请注意 _-r_ 标志为只读。 +下面的命令将对 `/home` 子卷进行快照。请注意 `-r` 标志代表只读。 +``` sudo btrfs subvolume snapshot -r /home /.snapshots/home-day1 +``` -快照的名称可以是当前日期,而不是 day1,比如 _home-$(date +%Y%m%d)_。快照看起来像普通的子目录。你可以把它们放在任何你喜欢的地方。目录 _/.snapshots_ 可能是一个不错的选择,以保持它们的整洁和避免混淆。 +快照的名称可以是当前日期,而不是 `day1`,比如 `home-$(date +%Y%m%d)`。快照看起来像普通的子目录。你可以把它们放在任何你喜欢的地方。目录 `/.snapshots` 可能是一个不错的选择,以保持它们的整洁和避免混淆。 -编者注:快照不会对自己进行递归快照。如果你创建了一个子卷的快照,子卷所包含的每一个子卷或快照都会被映射到快照里面的一个同名的空目录。 +> 编者注:快照不会对自己进行递归快照。如果你创建了一个子卷的快照,子卷所包含的每一个子卷或快照都会被映射到快照里面的一个同名的空目录。 ### 使用 btrfs send 进行备份 -在本例中,U 盘中的目标 Btrfs 卷被挂载为 _/run/media/user/mydisk/bk_。发送快照到目标卷的命令是: +在本例中,U 盘中的目标 Btrfs 卷被挂载为 `/run/media/user/mydisk/bk`。发送快照到目标卷的命令是: +``` sudo btrfs send /.snapshots/home-day1 | sudo btrfs receive /run/media/user/mydisk/bk +``` -这被称为初始启动,它相当于一个完整的备份。这个任务需要一些时间,取决于 _/home_ 目录的大小。显然,后续的增量发送只需要更短的时间。 +这被称为初始启动,它相当于一个完整的备份。这个任务需要一些时间,取决于 `/home` 目录的大小。显然,后续的增量发送只需要更短的时间。 ### 增量备份 快照的另一个有用的功能是能够以增量的方式执行发送任务。让我们再来生成一个快照。 +``` sudo btrfs subvolume snapshot -r /home /.snapshots/home-day2 +``` -为了执行增量发送任务,需要指定上一个快照作为基础,并且这个快照必须存在于源文件和目标文件中。请注意 _-p_ 选项。 +为了执行增量发送任务,需要指定上一个快照作为基础,并且这个快照必须存在于源文件和目标文件中。请注意 `-p` 选项。 +``` sudo btrfs send -p /.snapshot/home-day1 /.snapshot/home-day2 | sudo btrfs receive /run/media/user/mydisk/bk +``` -再来一次(之后一天): +再来一次(一天之后): +``` sudo btrfs subvolume snapshot -r /home /.snapshots/home-day3 sudo btrfs send -p /.snapshot/home-day2 /.snapshot/home-day3 | sudo btrfs receive /run/media/user/mydisk/bk +``` ### 清理 @@ -64,15 +74,14 @@ sudo btrfs send -p /.snapshot/home-day2 /.snapshot/home-day3 | sudo btrfs receiv 请记住,为了执行增量发送,你至少需要最后一个快照。这个快照必须存在于源文件和目标文件中。 +``` sudo btrfs subvolume delete /.snapshot/home-day1 - sudo btrfs subvolume delete /.snapshot/home-day2 - sudo btrfs subvolume delete /run/media/user/mydisk/bk/home-day1 - sudo btrfs subvolume delete /run/media/user/mydisk/bk/home-day2 +``` -注意:第 3 天的快照被保存在源文件和目标文件中。这样,明天(第 4 天),你就可以执行新的增量 _btrfs send_。 +注意:第 3 天的快照被保存在源文件和目标文件中。这样,明天(第 4 天),你就可以执行新的增量 `btrfs send`。 最后的建议是,如果 U 盘的空间很大,可以考虑在目标盘中保留多个快照,而在源盘中只保留最后一个快照。 @@ -83,7 +92,7 @@ via: https://fedoramagazine.org/btrfs-snapshots-backup-incremental/ 作者:[Alessio][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ba95e4368d88c6c29631fb4f12727ffcb0a87a20 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 26 Sep 2020 11:27:09 +0800 Subject: [PATCH 0221/1156] PUB @geekpi https://linux.cn/article-12653-1.html --- .../20200914 Incremental backups with Btrfs snapshots.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200914 Incremental backups with Btrfs snapshots.md (98%) diff --git a/translated/tech/20200914 Incremental backups with Btrfs snapshots.md b/published/20200914 Incremental backups with Btrfs snapshots.md similarity index 98% rename from translated/tech/20200914 Incremental backups with Btrfs snapshots.md rename to published/20200914 Incremental backups with Btrfs snapshots.md index ef47167f8f..2feb57cf58 100644 --- a/translated/tech/20200914 Incremental backups with Btrfs snapshots.md +++ b/published/20200914 Incremental backups with Btrfs snapshots.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12653-1.html) [#]: subject: (Incremental backups with Btrfs snapshots) [#]: via: (https://fedoramagazine.org/btrfs-snapshots-backup-incremental/) [#]: author: (Alessio https://fedoramagazine.org/author/alciregi/) From 9e2e4c96a51f44b3882c514f3e94a94693ae03fe Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 26 Sep 2020 11:50:52 +0800 Subject: [PATCH 0222/1156] PRF @geekpi --- ...0200921 Teach Python with the Mu editor.md | 78 +++++++------------ 1 file changed, 27 insertions(+), 51 deletions(-) diff --git a/translated/tech/20200921 Teach Python with the Mu editor.md b/translated/tech/20200921 Teach Python with the Mu editor.md index e3f76169e6..4cd298f942 100644 --- a/translated/tech/20200921 Teach Python with the Mu editor.md +++ b/translated/tech/20200921 Teach Python with the Mu editor.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Teach Python with the Mu editor) @@ -9,12 +9,14 @@ 使用 Mu 编辑器教授 Python ====== -Mu 让你轻松学会如何编写 Python 代码。 -![Hands on a keyboard with a Python book ][1] -在学校里,教孩子们编程是非常流行的。很多年前,在 Apple II 和 [Logo][2] 编程的年代,我学会了乌龟图案。我很喜欢学习如何对虚拟乌龟进行编程,后来也帮助学生进行编程。 +> Mu 让你轻松学会如何编写 Python 代码。 -大约五年前,我了解了 [Python 的 turtle 模块][3],这是我 Python 之旅的转折点。很快,我开始使用 turtle 模块来教学生 Python 编程基础,包括使用它来创建有趣的图形。 +![](https://img.linux.net.cn/data/attachment/album/202009/26/115018dkf3lvfyekifliec.jpg) + +在学校里,教孩子们编程是非常流行的。很多年前,在 Apple II 和 [Logo][2] 编程的年代,我学会了创建乌龟turtle绘图。我很喜欢学习如何对虚拟乌龟进行编程,后来也帮助学生进行编程。 + +大约五年前,我了解了 [Python 的 turtle 模块][3],这是我 Python 之旅的转折点。很快,我开始使用 `turtle` 模块来教学生 Python 编程基础,包括使用它来创建有趣的图形。 ### 开始使用 Python 的 turtle 模块 @@ -22,11 +24,11 @@ Mu 让你轻松学会如何编写 Python 代码。 如果你使用的是 Windows 电脑,则需要先安装 Python,到 Python 网站上[下载][4]最新的稳定版。 -接下来,用 `import turtle ` 或 `import turtle as t` 将 turtle 模块导入 Python 中。然后你就可以开始享受创建乌龟图案的乐趣了。 +接下来,用 `import turtle ` 或 `import turtle as t` 将 `turtle` 模块导入 Python 中。然后你就可以开始享受创建乌龟绘图的乐趣了。 ### 认识一下 Mu -在我的 Python 冒险的早期,我使用了 [IDLE][5],它是 Python 的集成开发环境。它比在 Python shell 中输入命令要容易得多,而且我可以编写和保存程序供以后使用。我参加了一些在线课程,阅读了许多关于 Python 编程的优秀书籍。我教老师和学生如何使用 IDLE 创建乌龟图案。 +在我的 Python 冒险的早期,我使用了 [IDLE][5],它是 Python 的集成开发环境。它比在 Python shell 中输入命令要容易得多,而且我可以编写和保存程序供以后使用。我参加了一些在线课程,阅读了许多关于 Python 编程的优秀书籍。我教老师和学生如何使用 IDLE 创建乌龟绘图。 IDLE 是一个很大的改进,但在克利夫兰的 PyConUS 2019 上,我看到了 [Nicholas Tollervey][6]的演讲,这改变了我学习和教授 Python 的方式。Nick 是一位教育家,他创建了 [Mu][7],一个专门为年轻程序员(甚至像我这样的老程序员)设计的 Python 编辑器。Mu 可以安装在 Linux、macOS 和 Windows 上。它很容易使用,并且附带了优秀的[文档][8]和[教程][9]。 @@ -34,99 +36,73 @@ IDLE 是一个很大的改进,但在克利夫兰的 PyConUS 2019 上,我看 在 Ubuntu 或 Debian 上: - ``` -`$ sudo apt install mu-editor` +$ sudo apt install mu-editor ``` 在 Fedora 或类似的地方: - ``` -`$ sudo dnf install mu` +$ sudo dnf install mu ``` 或者,你可以使用 Python 来进行安装。首先,确保你已经安装了 Python 3: - ``` -`$ python --version` +$ python --version ``` 如果失败了,就试试: - ``` -`$ python3 --version` +$ python3 --version ``` 假设你有 Python 3 或更高版本,使用 Python 包管理器 `pip` 安装 Mu。 - ``` -`$ python -m pip install mu-editor --user` +$ python -m pip install mu-editor --user ``` 然后你可以从命令行运行 Mu,或者创建一个快捷方式: - ``` -`$ python -m pip install shortcut mu-editor --user` +$ python -m pip install shortcut mu-editor --user ``` -Mu 默认安装在[树莓派][10]上,这是一个很大的优点。在过去的几年里,我已经向学生介绍了树莓派和使用 Mu 编辑器的 Python 编程。 +[树莓派][10]上默认安装了 Mu,这是一个很大的优点。在过去的几年里,我已经向学生介绍了使用树莓派和 Mu 编辑器的 Python 编程。 ### 如何用 Mu 教授 Python Mu 是向学生展示 Python 入门的好方法。下面是我如何教学生开始使用它。 - 1. 打开Mu编辑器。 +1. 打开 Mu 编辑器。 -![Mu editor][11] - -(Don Watkins, [CC BY-SA 4.0][12]) - - 2. 输入 `import turtle` 导入 Turtle 模块,就可以让乌龟动起来了。我的第一课是用 Python 代码画一个简单的正方形。 - -![Mu editor][13] - -(Don Watkins, [CC BY-SA 4.0][12]) - - 3. 保存这个程序,确保文件名以 .py 结尾。 - -![Saving program in Mu][14] - -(Don Watkins, [CC BY-SA 4.0][12]) - - 4. 运行程序。哪怕是运行这样一个简单的程序都会让人兴奋,看到你写的程序的图形输出是很有趣的。 - -![Running Python program in Mu][15] - -(Don Watkins, [CC BY-SA 4.0][12]) + ![Mu editor][11] +2. 输入 `import turtle` 导入 `turtle` 模块,就可以让乌龟动起来了。我的第一课是用 Python 代码画一个简单的正方形。 + ![Mu editor][13] +3. 保存这个程序,确保文件名以 .py 结尾。 + ![Saving program in Mu][14] +4. 运行程序。哪怕是运行这样一个简单的程序都会让人兴奋,看到你写的程序的图形输出是很有趣的。 + ![Running Python program in Mu][15] ### 超越基础知识 -在上完这节简单的课后,我讲解了有一些方法可以简化和扩展学生所学的基础知识。一是创建一个更简单的 turtle 对象,`import turtle as t`。然后我介绍了一个 `for` 循环,作为用 turtle 画一个正方形的另一种方法。 +在上完这节简单的课后,我讲解了有一些方法可以简化和扩展学生所学的基础知识。一是创建一个更简单的 `turtle` 对象,`import turtle as t`。然后我介绍了一个 `for` 循环,用另外一种 `turtle` 方法画一个正方形。 ![for loops in Python with Mu][16] -(Don Watkins, [CC BY-SA 4.0][12]) - 接下来,我将展示如何创建一个 `my_square` 函数,作为另一种绘制正方形的方法。 ![my_square function][17] -(Don Watkins, [CC BY-SA 4.0][12]) - -后来,我通过介绍其他 turtle 模块方法,包括 `penup`、`pendown` 和 `pencolor`来扩展这个概念。很快,我的学生们就开始开发更复杂的程序,并对其进行迭代。 +后来,我通过介绍其他 `turtle` 模块方法,包括 `penup`、`pendown` 和 `pencolor` 来扩展这个概念。很快,我的学生们就开始开发更复杂的程序,并对其进行迭代。 ![Mu editor][18] -(Don Watkins, [CC BY-SA 4.0][12]) - 我一直渴望学习,我很想知道你在学校或家里是如何教授 Python 的。请在评论中分享你的经验。 -------------------------------------------------------------------------------- @@ -136,7 +112,7 @@ via: https://opensource.com/article/20/9/teach-python-mu 作者:[Don Watkins][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 80dec5d1e2d2fe373b386f44e01c0f55046eb6f6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 26 Sep 2020 11:51:39 +0800 Subject: [PATCH 0223/1156] PUB @geekpi https://linux.cn/article-12654-1.html --- .../20200921 Teach Python with the Mu editor.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200921 Teach Python with the Mu editor.md (98%) diff --git a/translated/tech/20200921 Teach Python with the Mu editor.md b/published/20200921 Teach Python with the Mu editor.md similarity index 98% rename from translated/tech/20200921 Teach Python with the Mu editor.md rename to published/20200921 Teach Python with the Mu editor.md index 4cd298f942..ba38d69784 100644 --- a/translated/tech/20200921 Teach Python with the Mu editor.md +++ b/published/20200921 Teach Python with the Mu editor.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12654-1.html) [#]: subject: (Teach Python with the Mu editor) [#]: via: (https://opensource.com/article/20/9/teach-python-mu) [#]: author: (Don Watkins https://opensource.com/users/don-watkins) From d245fe18e096a53892da768272d339fcc603d9ab Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 26 Sep 2020 22:20:18 +0800 Subject: [PATCH 0224/1156] PUB @wxy https://linux.cn/article-12655-1.html?wx --- ...pired Linux Terminal Emulator With Some Cool Features.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) rename {translated/tech => published}/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md (98%) diff --git a/translated/tech/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md b/published/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md similarity index 98% rename from translated/tech/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md rename to published/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md index b783d4449c..0e0aabb207 100644 --- a/translated/tech/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md +++ b/published/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12655-1.html) [#]: subject: (Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features) [#]: via: (https://itsfoss.com/edex-ui-sci-fi-terminal/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) @@ -22,8 +22,6 @@ eDEX-UI:一款科幻风格的酷炫 Linux 终端仿真器 ### eDEX-UI: 一个很酷的终端仿真器 -![][4] - [eDEX-UI][5] 是一款开源的跨平台终端仿真器,它为你呈现了一个科幻风格的外观和一些有用的功能。 它最初的灵感来自于 [DEX UI][6] 项目,但该项目已经不再维护。 From a91462b8317c9052d69793b77ea2807035bb5bc2 Mon Sep 17 00:00:00 2001 From: geekpi Date: Sun, 27 Sep 2020 08:39:45 +0800 Subject: [PATCH 0225/1156] translating --- ... LVM-s (Logical Volume Resize) in Linux.md | 73 ++++++++++--------- 1 file changed, 37 insertions(+), 36 deletions(-) rename {sources => translated}/tech/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md (53%) diff --git a/sources/tech/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md b/translated/tech/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md similarity index 53% rename from sources/tech/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md rename to translated/tech/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md index 210e5196d6..6c73ec74d2 100644 --- a/sources/tech/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md +++ b/translated/tech/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md @@ -7,53 +7,54 @@ [#]: via: (https://www.2daygeek.com/extend-increase-resize-lvm-logical-volume-in-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -How to Extend/Increase LVM’s (Logical Volume Resize) in Linux +如何在 Linux 中扩展/增加 LVM 大小(逻辑卷调整)? ====== -Expanding the logical volume is extremely easy, it takes very few steps and can be done online without unmounting a certain logical volume. +扩展逻辑卷非常简单,只需要很少的步骤,而且不需要卸载某个逻辑卷就可以在线完成。 -The main purpose of LVM is flexible disk management, which allows you to easily resize, extend and reduce the logical volume size when you need it. +LVM 的主要目的是灵活的磁盘管理,当你需要的时候,可以很方便地调整、扩展和缩小逻辑卷的大小。 -If you are new to Logical Volume Management (LVM), I suggest you start with our previous article. +如果你是逻辑卷管理 (LVM) 新手,我建议你从我们之前的文章开始学习。 - * **Part-1: [How to Create/Configure LVM (Logical Volume Management) in Linux][1]** + * **第一部分:[如何在 Linux 中创建/配 置LVM(逻辑卷管理)][1]** ![][2] -Expanding the logical volume involves the below steps. +扩展逻辑卷涉及到以下步骤: - * Check if you have sufficient unallocated disk space in the volume group where the LV was residing. - * If yes, you can use that space to extend the logical volume. - * If not, add new disks or LUNs to your system. - * Convert a physical disk as a physical volume (PV). - * Extend the Volume Group - * Increase the logical Volume - * Grow the filesystem - * Check the extended filesystem size + + * 检查 LV 所在的卷组中是否有足够的未分配磁盘空间 + * 如果有,你可以使用这些空间来扩展逻辑卷 + * 如果没有,请向系统中添加新的磁盘或 LUN + * 将物理磁盘转换为物理卷(PV) + * 扩展卷组 + * 增加逻辑卷大小 + * 扩大文件系统 + * 检查扩展的文件系统大小 -### How to Create LVM Physical Volumes +### 如何创建 LVM 物理卷? -Create LVM physical volumes with the pvcreate command. +使用 pvcreate 命令创建 LVM 物理卷。 -Once the disk is detected in the OS, use the pvcreate command to initialize the LVM PV (Physical Volumes). +当在操作系统中检测到磁盘,使用 pvcreate 命令初始化 LVM PV(物理卷)。 ``` # pvcreate /dev/sdc Physical volume "/dev/sdc" successfully created ``` -**Make a note:** +**请注意:** - * The above command erases any data on the given disk /dev/sdc. - * Physical disk can be added directly into the LVM PV instead of the disk partition. + * 上面的命令将删除磁盘 /dev/sdc 上的所有数据。 + * 物理磁盘可以直接添加到 LVM PV 中,而不是磁盘分区。 -Use the pvdisplay command to display the PVs you have created. +使用 pvdisplay 命令来显示你所创建的 PV。 ``` # pvdisplay /dev/sdc @@ -71,16 +72,16 @@ Allocated PE 0 PV UUID 69d9dd18-36be-4631-9ebb-78f05fe3217f ``` -### How to Extend the Volume Group +### 如何扩展卷组 -Use the following command to add a new physical volume to the existing volume group. +使用以下命令在现有的卷组中添加一个新的物理卷。 ``` # vgextend vg01 /dev/sdc Volume group "vg01" successfully extended ``` -Use the vgdisplay command to display the PVs you have created. +使用 vgdisplay 命令来显示你所创建的 PV。 ``` # vgdisplay vg01 @@ -106,17 +107,17 @@ Free PE / Size 2560 / 9.99 GiB VG UUID d17e3c31-e2c9-4f11-809c-94a549bc43b7 ``` -### How to Extend the Logical Volume +### 如何扩展逻辑卷? -Use the following command to increase the existing logical volume. +使用以下命令增加现有逻辑卷大小。 -**Common syntax for logical volume extension (lvextend).** +**逻辑卷扩展 (lvextend) 的常用语法。** ``` -lvextend [Additional space to be added] [Existing Logical Volume Name] +lvextend [要增加的额外空间] [现有逻辑卷名称] ``` -Use the below command to increase the existing logical volume additionally to 10GB. +使用下面的命令将现有的逻辑卷增加 10GB。 ``` # lvextend -L +10G /dev/mapper/vg01-lv002 @@ -125,33 +126,33 @@ Size of logical volume vg01/lv002 changed from 5.00 GiB (1280 extents) to 15.00 Logical volume var successfully resized ``` -To extend logical volume using PE size’s. +使用 PE 大小来扩展逻辑卷。 ``` # lvextend -l +2560 /dev/mapper/vg01-lv002 ``` -To extend the logical volume using percentage (%), use the following command. +要使用百分比 (%) 扩展逻辑卷,请使用以下命令。 ``` # lvextend -l +40%FREE /dev/mapper/vg01-lv002 ``` -Now, the logical volume is extended and you need to resize the file system to extend the space inside the logical volume. +现在,逻辑卷已经扩展,你需要调整文件系统的大小以扩展逻辑卷内的空间。 -For an ext3 and ext4 based file system, run the following command. +对于基于 ext3 和 ext4 的文件系统,运行以下命令。 ``` # resize2fs /dev/mapper/vg01-lv002 ``` -For the xfs file system, use the following command. +对于xfs文件系统,使用以下命令。 ``` # xfs_growfs /dev/mapper/vg01-lv002 ``` -Use the **[df command][3]** to view the file system size. +使用 **[df 命令][3]**查看文件系统大小。 ``` # df -h /lvmtest1 @@ -165,7 +166,7 @@ via: https://www.2daygeek.com/extend-increase-resize-lvm-logical-volume-in-linux 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[geekpi](https://github.com/geekpi) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From f90e6aac8cf186c24ab8c51892bb53a012120b97 Mon Sep 17 00:00:00 2001 From: geekpi Date: Sun, 27 Sep 2020 08:45:41 +0800 Subject: [PATCH 0226/1156] translating --- .../20200921 Installing and running Vagrant using qemu-kvm.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200921 Installing and running Vagrant using qemu-kvm.md b/sources/tech/20200921 Installing and running Vagrant using qemu-kvm.md index 54e74b428c..307c85c599 100644 --- a/sources/tech/20200921 Installing and running Vagrant using qemu-kvm.md +++ b/sources/tech/20200921 Installing and running Vagrant using qemu-kvm.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From efd397346712496a24273b195474d58c31acc04c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 27 Sep 2020 10:04:15 +0800 Subject: [PATCH 0227/1156] PRF @geekpi --- ...the signup process for decentralization.md | 45 +++++++++---------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/translated/tech/20200914 How Nextcloud simplified the signup process for decentralization.md b/translated/tech/20200914 How Nextcloud simplified the signup process for decentralization.md index 236d618572..49af3e2ba5 100644 --- a/translated/tech/20200914 How Nextcloud simplified the signup process for decentralization.md +++ b/translated/tech/20200914 How Nextcloud simplified the signup process for decentralization.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How Nextcloud simplified the signup process for decentralization) @@ -9,49 +9,47 @@ Nextcloud 如何简化去中心化的注册流程? ====== -Nextcloud 是开源软件,我们不提供托管服务,但我们却能从根本上简化注册体验。 -![clouds in the sky with blue pattern][1] -我们总是有一个有几十个 Nextcloud 提供商的列表,然而我听到的最常见的问题,即使是我的技术上的朋友,也是: +> Nextcloud 是开源软件,我们不提供托管服务,但我们却能从根本上简化注册体验。 + +![](https://img.linux.net.cn/data/attachment/album/202009/27/100351eqd88qub0b3ww0tu.jpg) + +我们一直有个列表,上面有几十个 Nextcloud 提供商,然而我听到的最常见的问题,即使是我的技术方面的朋友,也是: > ”嗨,Jan,你推荐哪个 Nextcloud 提供商?” -当然,这也是可以理解的。如果你有一长串的供应商,你怎么选择?附近的托管?可爱的名字?最大的标志? +当然,这也是可以理解的。如果你有一长串的供应商,你怎么选择?托管商在附近?名字可爱?标志最大? 每一个使用服务器的去中心化开源解决方案都在努力解决这些: - * Mastodon 有 [joinmastodon.org][2] 来选择社区,但很明显是以 mastodon.social 为主的实例。 - * Diaspora 有[ joindiaspora.com][3],也是主实例。 + * Mastodon 有 [joinmastodon.org][2] 来选择社区,但很明显主实例是 mastodon.social。 + * Diaspora 有[joindiaspora.com][3],它也是主实例。 * Matrix 有 [matrix.to][4],还有一个在 [Element.io][5] 的应用(多平台)。 * WordPress 有 [wordpress.com][6]。我不确定是否有提供商能接近它的知名度。 * PeerTube 有一堆实例,都有不同的技术细节。 * Pixelfed 在[beta.joinpixelfed.org][7] 有一个早期版本的实例选择器,以及在 [pixelfed.social][8] 有一个大型实例。 * 还有更多的去中心化开源应用的例子,这里列出了如何通过终端访问它、设置 Rust 实现、或使其在网络打印机上运行。 - - 这就导致了一些问题: - * 🔮 人们不知道该选哪个,有错失恐惧症(Fear Of Missing Out),然后根本不选。这就是选择的悖论! + * 🔮 人们不知道该选哪个,有错失恐惧症Fear Of Missing Out(FOMO),然后根本不选。这就是选择的悖论! * 🕸 网络并不是真正的去中心化,因为大多数人都在少数服务器上,或者主要是只有一台服务器。 - - Nextcloud 不存在这些问题。 ### 我们的解决方案:简单注册 这是它是如何工作的: -当你下载手机或桌面应用时,你首先看到的是”登录“或”使用供应商注册“的选择。这是任何专有应用都会做的事情: +当你下载我们的手机或桌面应用时,你首先看到的是“登录”或“使用供应商注册”的选择。这是任何专有应用都会做的事情: ![Android client][9] -选择”注册“可打开应用中的[简易注册页面][10]。 +选择“注册”可打开应用中的[简易注册页面][10]。 ![Web client][11] -你输入你的电子邮件地址,然后点击”注册“。 +你输入你的电子邮件地址,然后点击“注册”。 输入密码,就可以了! 🎉 @@ -61,7 +59,7 @@ Nextcloud 不存在这些问题。 事实上,它甚至比很多集中式的应用更简单,在那里你需要输入你的全名和电话号码,然后点击谷歌的验证码。 -基本上归结为: +这基本上可以归结为: ### 我们为你选择 @@ -77,22 +75,19 @@ Nextcloud 不存在这些问题。 * 🍱 一套核心应用。文件、日历、联系人、邮件、通话、任务、笔记。有些供应商甚至提供更多。 * 🛡 最新版本,让你始终保持最新的功能、修复和安全更新。 - - - -除此之外,我们还提出了一个尊重隐私的流程。当你点击”注册“时,你的邮件不会发送给我们,而是直接发送给你选择的供应商,这将无缝过渡到他们的设置步骤,在那里你选择一个密码。这意味着在 Nextcloud 不会有任何数据泄露给我们,我们甚至不知道你选择的是哪家提供商! +除此之外,我们还提出了一个尊重隐私的流程。当你点击“注册”时,你的邮件不会发送给我们,而是直接发送给你选择的供应商,这将无缝过渡到他们的设置步骤,在那里你选择一个密码。这意味着在 Nextcloud 不会有任何数据泄露给我们,我们甚至不知道你选择的是哪家提供商! 因此,虽然我们提供这项服务,而且它超级容易使用,但我们只做绝对最低限度的数据处理,以连接你与你的理想供应商。 ### 去中心化项目需要简单的注册方式 -很多开源软件项目可以从简单注册这样的体验中受益。我们[在最初发布的时候写过它][12],我们希望这篇文章能澄清使它成功的设计决策,以便它能被更多项目采用。 +很多开源软件项目可以从简单注册这样的体验中受益。我们[在最初发布的时候写过有关它的文章][12],我们希望这篇文章能澄清使它成功的设计决策,以便它能被更多项目采用。 -去中心化是赋能,但只有当人们即使不知道服务器是什么,也能简单注册时,才是真正的革命。 +去中心化是赋能,但只有当人们即使不知道服务器是什么也能简单注册时,才是真正的革命。 -当然,现在也还不完美。比如,如果你已经在 Nextcloud 实例上有了账户,任何一个应用的登录过程都会要求你输入一个服务器地址,而很多人根本不知道那是什么。比如在很多邮件应用中,在这一步会有一个最受欢迎的供应商列表,底部有一个”自定义服务器“的条目。这也可能是一种可能性,但同样带来了系统过于集中的风险,或者让人们对选择什么感到困惑。 +当然,现在也还不完美。比如,如果你已经在 Nextcloud 实例上有了账户,任何一个应用的登录过程都会要求你输入一个服务器地址,而很多人根本不知道那是什么。比如在很多邮件应用中,在这一步会有一个最受欢迎的供应商列表,底部有一个“自定义服务器”的条目。这也可能是一种可能性,但同样带来了系统过于集中的风险,或者让人们对选择什么感到困惑。 -所以,我们不断尝试为任意一个 Nextcloud 桌面和移动应用改进这一点,比如 Nextcloud Talk 或者所有优秀的社区开发的应用。在 Android 上,我们与 DAVx5(Android 上的日历和联系人同步)紧密集成,而且,对于其他 Android 应用,还有一个[单点登录库][13]。不幸的是,在 iOS 上,就没有那么容易了,因为应用必须来自同一个开发者才能共享凭证。 +所以,我们不断尝试为所有 Nextcloud 桌面和移动应用改进这一点,比如 Nextcloud Talk 或者所有优秀的社区开发的应用。在 Android 上,我们与 DAVx5(Android 上的日历和联系人同步)紧密集成,而且,对于其他 Android 应用,还有一个[单点登录库][13]。不幸的是,在 iOS 上,就没有那么容易了,因为应用必须来自同一个开发者才能共享凭证。 如果你想合作解决类似这些有趣的挑战,[来加入我们的 Nextcloud 设计团队吧][14]! @@ -103,7 +98,7 @@ via: https://opensource.com/article/20/9/decentralization-signup 作者:[Jan C. Borchardt][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 17b3590528dcf3b4ef2ccc45d2e18d5129a08006 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 27 Sep 2020 10:04:51 +0800 Subject: [PATCH 0228/1156] PUB @geekpi https://linux.cn/article-12656-1.html --- ...loud simplified the signup process for decentralization.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200914 How Nextcloud simplified the signup process for decentralization.md (98%) diff --git a/translated/tech/20200914 How Nextcloud simplified the signup process for decentralization.md b/published/20200914 How Nextcloud simplified the signup process for decentralization.md similarity index 98% rename from translated/tech/20200914 How Nextcloud simplified the signup process for decentralization.md rename to published/20200914 How Nextcloud simplified the signup process for decentralization.md index 49af3e2ba5..f3475a562f 100644 --- a/translated/tech/20200914 How Nextcloud simplified the signup process for decentralization.md +++ b/published/20200914 How Nextcloud simplified the signup process for decentralization.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12656-1.html) [#]: subject: (How Nextcloud simplified the signup process for decentralization) [#]: via: (https://opensource.com/article/20/9/decentralization-signup) [#]: author: (Jan C. Borchardt https://opensource.com/users/jancborchardt) From ddb160cf0a931dd78bf4fa503c31494c6497d83c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 27 Sep 2020 23:06:37 +0800 Subject: [PATCH 0229/1156] APL --- .../20191031 Advance your awk skills with two easy tutorials.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191031 Advance your awk skills with two easy tutorials.md b/sources/tech/20191031 Advance your awk skills with two easy tutorials.md index f84e4ebe3a..083dbbb011 100644 --- a/sources/tech/20191031 Advance your awk skills with two easy tutorials.md +++ b/sources/tech/20191031 Advance your awk skills with two easy tutorials.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 7a326c87e7701a54abb761aca8d87ba91614271e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 28 Sep 2020 00:03:12 +0800 Subject: [PATCH 0230/1156] TSL --- ...your awk skills with two easy tutorials.md | 287 ------------------ ...your awk skills with two easy tutorials.md | 272 +++++++++++++++++ 2 files changed, 272 insertions(+), 287 deletions(-) delete mode 100644 sources/tech/20191031 Advance your awk skills with two easy tutorials.md create mode 100644 translated/tech/20191031 Advance your awk skills with two easy tutorials.md diff --git a/sources/tech/20191031 Advance your awk skills with two easy tutorials.md b/sources/tech/20191031 Advance your awk skills with two easy tutorials.md deleted file mode 100644 index 083dbbb011..0000000000 --- a/sources/tech/20191031 Advance your awk skills with two easy tutorials.md +++ /dev/null @@ -1,287 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Advance your awk skills with two easy tutorials) -[#]: via: (https://opensource.com/article/19/10/advanced-awk) -[#]: author: (Dave Neary https://opensource.com/users/dneary) - -Advance your awk skills with two easy tutorials -====== -Go beyond one-line awk scripts with mail merge and word counting. -![a checklist for a team][1] - -Awk is one of the oldest tools in the Unix and Linux user's toolbox. Created in the 1970s by Alfred Aho, Peter Weinberger, and Brian Kernighan (the A, W, and K of the tool's name), awk was created for complex processing of text streams. It is a companion tool to sed, the stream editor, which is designed for line-by-line processing of text files. Awk allows more complex structured programs and is a complete programming language. - -This article will explain how to use awk for more structured and complex tasks, including a simple mail merge application. - -### Awk program structure - -An awk script is made up of functional blocks surrounded by **{}** (curly brackets). There are two special function blocks, **BEGIN** and **END**, that execute before processing the first line of the input stream and after the last line is processed. In between, blocks have the format: - - -``` -`pattern { action statements }` -``` - -Each block executes when the line in the input buffer matches the pattern. If no pattern is included, the function block executes on every line of the input stream. - -Also, the following syntax can be used to define functions in awk that can be called from any block: - - -``` -`function name(parameter list) { statements }` -``` - -This combination of pattern-matching blocks and functions allows the developer to structure awk programs for reuse and readability. - -### How awk processes text streams - -Awk reads text from its input file or stream one line at a time and uses a field separator to parse it into a number of fields. In awk terminology, the current buffer is a _record_. There are a number of special variables that affect how awk reads and processes a file: - - * **FS** (field separator): By default, this is any whitespace (spaces or tabs) - * **RS** (record separator): By default, a newline (**\n**) - * **NF** (number of fields): When awk parses a line, this variable is set to the number of fields that have been parsed - * **$0:** The current record - * **$1, $2, $3, etc.:** The first, second, third, etc. field from the current record - * **NR** (number of records): The number of records that have been parsed so far by the awk script - - - -There are many other variables that affect awk's behavior, but this is enough to start with. - -### Awk one-liners - -For a tool so powerful, it's interesting that most of awk's usage is basic one-liners. Perhaps the most common awk program prints selected fields from an input line from a CSV file, a log file, etc. For example, the following one-liner prints a list of usernames from **/etc/passwd**: - - -``` -`awk -F":" '{print $1 }' /etc/passwd` -``` - -As mentioned above, **$1** is the first field in the current record. The **-F** option sets the FS variable to the character **:**. - -The field separator can also be set in a BEGIN function block: - - -``` -`awk 'BEGIN { FS=":" } {print $1 }' /etc/passwd` -``` - -In the following example, every user whose shell is not **/sbin/nologin** can be printed by preceding the block with a pattern match: - - -``` -`awk 'BEGIN { FS=":" } ! /\/sbin\/nologin/ {print $1 }' /etc/passwd` -``` - -### Advanced awk: Mail merge - -Now that you have some of the basics, try delving deeper into awk with a more structured example: creating a mail merge. - -A mail merge uses two files, one (called in this example **email_template.txt**) containing a template for an email you want to send: - - -``` -From: Program committee <[pc@event.org][2]> -To: {firstname} {lastname} <{email}> -Subject: Your presentation proposal - -Dear {firstname}, - -Thank you for your presentation proposal: -  {title} - -We are pleased to inform you that your proposal has been successful! We -will contact you shortly with further information about the event -schedule. - -Thank you, -The Program Committee -``` - -And the other is a CSV file (called **proposals.csv**) with the people you want to send the email to: - - -``` -firstname,lastname,email,title -Harry,Potter,[hpotter@hogwarts.edu][3],"Defeating your nemesis in 3 easy steps" -Jack,Reacher,[reacher@covert.mil][4],"Hand-to-hand combat for beginners" -Mickey,Mouse,[mmouse@disney.com][5],"Surviving public speaking with a squeaky voice" -Santa,Claus,[sclaus@northpole.org][6],"Efficient list-making" -``` - -You want to read the CSV file, replace the relevant fields in the first file (skipping the first line), then write the result to a file called **acceptanceN.txt**, incrementing **N** for each line you parse. - -Write the awk program in a file called **mail_merge.awk**. Statements are separated by **;** in awk scripts. The first task is to set the field separator variable and a couple of other variables the script needs. You also need to read and discard the first line in the CSV, or a file will be created starting with _Dear firstname_. To do this, use the special function **getline** and reset the record counter to 0 after reading it. - - -``` -BEGIN { -  FS=","; -  template="email_template.txt"; -  output="acceptance"; -  getline; -  NR=0; -} -``` - -The main function is very straightforward: for each line processed, a variable is set for the various fields—**firstname**, **lastname**, **email**, and **title**. The template file is read line by line, and the function **sub** is used to substitute any occurrence of the special character sequences with the value of the relevant variable. Then the line, with any substitutions made, is output to the output file. - -Since you are dealing with the template file and a different output file for each line, you need to clean up and close the file handles for these files before processing the next record. - - -``` -{ -        # Read relevant fields from input file -        firstname=$1; -        lastname=$2; -        email=$3; -        title=$4; - -        # Set output filename -        outfile=(output NR ".txt"); - -        # Read a line from template, replace special fields, and -        # print result to output file -        while ( (getline ln < template) > 0 ) -        { -                sub(/{firstname}/,firstname,ln); -                sub(/{lastname}/,lastname,ln); -                sub(/{email}/,email,ln); -                sub(/{title}/,title,ln); -                print(ln) > outfile; -        } - -        # Close template and output file in advance of next record -        close(outfile); -        close(template); -} -``` - -You're done! Run the script on the command line with: - - -``` -`awk -f mail_merge.awk proposals.csv` -``` - -or - - -``` -`awk -f mail_merge.awk < proposals.csv` -``` - -and you will find text files generated in the current directory. - -### Advanced awk: Word frequency count - -One of the most powerful features in awk is the associative array. In most programming languages, array entries are typically indexed by a number, but in awk, arrays are referenced by a key string. You could store an entry from the file _proposals.txt_ from the previous section. For example, in a single associative array, like this: - - -``` -        proposer["firstname"]=$1; -        proposer["lastname"]=$2; -        proposer["email"]=$3; -        proposer["title"]=$4; -``` - -This makes text processing very easy. A simple program that uses this concept is the idea of a word frequency counter. You can parse a file, break out words (ignoring punctuation) in each line, increment the counter for each word in the line, then output the top 20 words that occur in the text. - -First, in a file called **wordcount.awk**, set the field separator to a regular expression that includes whitespace and punctuation: - - -``` -BEGIN { -        # ignore 1 or more consecutive occurrences of the characters -        # in the character group below -        FS="[ .,:;()<>{}@!\"'\t]+"; -} -``` - -Next, the main loop function will iterate over each field, ignoring any empty fields (which happens if there is punctuation at the end of a line), and increment the word count for the words in the line. - - -``` -{ -        for (i = 1; i <= NF; i++) { -                if ($i != "") { -                        words[$i]++; -                } -        } -} -``` - -Finally, after the text is processed, use the END function to print the contents of the array, then use awk's capability of piping output into a shell command to do a numerical sort and print the 20 most frequently occurring words: - - -``` -END { -        sort_head = "sort -k2 -nr | head -n 20"; -        for (word in words) { -                printf "%s\t%d\n", word, words[word] | sort_head; -        } -        close (sort_head); -} -``` - -Running this script on an earlier draft of this article produced this output: - - -``` -[[dneary@dhcp-49-32.bos.redhat.com][7]]$ awk -f wordcount.awk < awk_article.txt -the     79 -awk     41 -a       39 -and     33 -of      32 -in      27 -to      26 -is      25 -line    23 -for     23 -will    22 -file    21 -we      16 -We      15 -with    12 -which   12 -by      12 -this    11 -output  11 -function        11 -``` - -### What's next? - -If you want to learn more about awk programming, I strongly recommend the book [_Sed and awk_][8] by Dale Dougherty and Arnold Robbins. - -One of the keys to progressing in awk programming is mastering "extended regular expressions." Awk offers several powerful additions to the sed [regular expression][9] syntax you may already be familiar with. - -Another great resource for learning awk is the [GNU awk user guide][10]. It has a full reference for awk's built-in function library, as well as lots of examples of simple and complex awk scripts. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/advanced-awk - -作者:[Dave Neary][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://opensource.com/users/dneary -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk (a checklist for a team) -[2]: mailto:pc@event.org -[3]: mailto:hpotter@hogwarts.edu -[4]: mailto:reacher@covert.mil -[5]: mailto:mmouse@disney.com -[6]: mailto:sclaus@northpole.org -[7]: mailto:dneary@dhcp-49-32.bos.redhat.com -[8]: https://www.amazon.com/sed-awk-Dale-Dougherty/dp/1565922255/book -[9]: https://en.wikibooks.org/wiki/Regular_Expressions/POSIX-Extended_Regular_Expressions -[10]: https://www.gnu.org/software/gawk/manual/gawk.html diff --git a/translated/tech/20191031 Advance your awk skills with two easy tutorials.md b/translated/tech/20191031 Advance your awk skills with two easy tutorials.md new file mode 100644 index 0000000000..044c9c9280 --- /dev/null +++ b/translated/tech/20191031 Advance your awk skills with two easy tutorials.md @@ -0,0 +1,272 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Advance your awk skills with two easy tutorials) +[#]: via: (https://opensource.com/article/19/10/advanced-awk) +[#]: author: (Dave Neary https://opensource.com/users/dneary) + + +通过两个简单的教程来提高你的 awk 技能 +====== + +> 超越单行的awk脚本,邮件合并和字数统计。 +!["一个团队的检查表"[1] + +`awk` 是 Unix 和 Linux 用户工具箱中最古老的工具之一。`awk` 由 Alfred Aho、Peter Weinberger 和 Brian Kernighan(工具名称中的 A、W 和 K)在 20 世纪 70 年代创建,用于复杂的文本流处理。它是流编辑器 `sed` 的配套工具,后者是为逐行处理文本文件而设计的。`awk` 支持更复杂的结构化程序,是一种完整的编程语言。 + +本文将介绍如何使用 `awk` 完成更多结构化的复杂任务,包括一个简单的邮件合并程序。 + +### awk 的程序结构 + +`awk` 脚本是由 `{}`(大括号)包围的功能块组成,其中有两个特殊的功能块,`BEGIN` 和 `END`,它们在处理第一行输入流之前和最后一行处理之后执行。在这两者之间,块的格式为: + +``` +模式 { 动作语句 } +``` + +当输入缓冲区中的行与模式匹配时,每个块都会执行。如果没有包含模式,则函数块在输入流的每一行都会执行。 + +另外,以下语法可以用于在 `awk` 中定义可以从任何块中调用的函数。 + +``` +function 函数名(参数列表) { 语句 } +``` + +这种模式匹配块和函数的组合允许开发者结构化 `awk` 程序,以便重用和可读。 + +### awk 如何处理文本流 + +`awk` 每次从输入文件或流中一行一行地读取文本,并使用字段分隔符将其解析成若干字段。在 `awk` 的术语中,当前的缓冲区是一个*记录*。有一些特殊的变量会影响 `awk` 读取和处理文件的方式: + + * `FS`(字段分隔符field separator)。默认情况下,这是任何空格字符(空格或制表符)。 + * `RS`(记录分隔符record separator)。默认情况下是一个新行(`n`)。 + * `NF`(字段数number of fields)。当 `awk` 解析一行时,这个变量被设置为已解析的字段数。 + * `$0:` 当前记录。 + * `$1`、`$2`、`$3` 等:当前记录的第一、第二、第三等字段。 + * `NR`(记录数number of records)。迄今已被 `awk` 脚本解析的记录数。 + +影响 `awk` 行为的变量还有很多,但这已经足够开始了。 + +### 单行 awk 脚本 + +对于一个如此强大的工具来说,有趣的是,`awk` 的大部分用法都是基本的单行脚本。也许最常见的 `awk` 程序是打印 CSV 文件、日志文件等输入行中的选定字段。例如,下面的单行脚本从 `/etc/passwd` 中打印出一个用户名列表: + +``` +awk -F":" '{print $1 }' /etc/passwd +``` + +如上所述,`$1` 是当前记录中的第一个字段。`-F` 选项将 `FS` 变量设置为字符 `:`。 + +字段分隔符也可以在 `BEGIN` 函数块中设置: + +``` +awk 'BEGIN { FS=":" } {print $1 }' /etc/passwd +``` + +在下面的例子中,每一个 shell 不是 `/sbin/nologin` 的用户都可以通过在该块前面加上匹配模式来打印出来: + +``` +awk 'BEGIN { FS=":" } ! /\/sbin\/nologin/ {print $1 }' /etc/passwd +``` + +### awk 进阶:邮件合并 + +现在你已经掌握了一些基础知识,尝试用一个更具有结构化的例子来深入了解 `awk`:创建邮件合并。 + +邮件合并使用两个文件,其中一个文件(在本例中称为 `email_template.txt`)包含了你要发送的电子邮件的模板: + +``` +From: Program committee +To: {firstname} {lastname} <{email}> +Subject: Your presentation proposal + +Dear {firstname}, + +Thank you for your presentation proposal: + {title} + +We are pleased to inform you that your proposal has been successful! We +will contact you shortly with further information about the event +schedule. + +Thank you, +The Program Committee +``` + +而另一个则是一个 CSV 文件(名为 `proposals.csv`),里面有你要发送邮件的人: + +``` +firstname,lastname,email,title +Harry,Potter,hpotter@hogwarts.edu,"Defeating your nemesis in 3 easy steps" +Jack,Reacher,reacher@covert.mil,"Hand-to-hand combat for beginners" +Mickey,Mouse,mmouse@disney.com,"Surviving public speaking with a squeaky voice" +Santa,Claus,sclaus@northpole.org,"Efficient list-making" +``` + +你要读取 CSV 文件,替换第一个文件中的相关字段(跳过第一行),然后把结果写到一个叫 `acceptanceN.txt` 的文件中,每解析一行就递增 `N`。 + +把 `awk` 程序写在一个叫 `mail_merge.awk` 的文件中。在 `awk` 脚本中的语句用 `;` 分隔。第一个任务是设置字段分隔符变量和其他几个脚本需要的变量。你还需要读取并丢弃 CSV 中的第一行,否则会创建一个以 `Dear firstname` 开头的文件。要做到这一点,请使用特殊函数 `getline`,并在读取后将记录计数器重置为 0。 + +``` +BEGIN { +  FS=","; +  template="email_template.txt"; +  output="acceptance"; +  getline; +  NR=0; +} +``` + +主要功能非常简单:每处理一行,就为各种字段设置一个变量 —— `firstname`、`lastname`、`email` 和 `title`。模板文件被逐行读取,并使用函数 `sub` 将任何出现的特殊字符序列替换为相关变量的值。然后将该行以及所做的任何替换输出到输出文件中。 + +由于每行都要处理模板文件和不同的输出文件,所以在处理下一条记录之前,需要清理和关闭这些文件的文件句柄。 + +``` +{ +        # Read relevant fields from input file +        firstname=$1; +        lastname=$2; +        email=$3; +        title=$4; + +        # Set output filename +        outfile=(output NR ".txt"); + +        # Read a line from template, replace special fields, and +        # print result to output file +        while ( (getline ln < template) > 0 ) +        { +                sub(/{firstname}/,firstname,ln); +                sub(/{lastname}/,lastname,ln); +                sub(/{email}/,email,ln); +                sub(/{title}/,title,ln); +                print(ln) > outfile; +        } + +        # Close template and output file in advance of next record +        close(outfile); +        close(template); +} +``` + +你已经完成了! 在命令行上运行该脚本: + + +``` +awk -f mail_merge.awk proposals.csv +``` + +或 + +``` +awk -f mail_merge.awk < proposals.csv +``` + +你会发现在当前目录下生成的文本文件。 + +### awk 进阶:字频计数 + +`awk` 中最强大的功能之一是关联数组,在大多数编程语言中,数组条目通常由数字索引,但在 `awk` 中,数组由一个键字符串进行引用。你可以从上一节的文件 `proposals.txt` 中存储一个条目。例如,在一个单一的关联数组中,像这样: + +``` +        proposer["firstname"]=$1; +        proposer["lastname"]=$2; +        proposer["email"]=$3; +        proposer["title"]=$4; +``` + +这使得文本处理变得非常容易。一个使用了这个概念的简单的程序就是词频计数器。你可以解析一个文件,在每一行中分解出单词(忽略标点符号),对行中的每个单词进行递增计数器,然后输出文本中出现的前 20 个单词。 + +首先,在一个名为 `wordcount.awk` 的文件中,将字段分隔符设置为包含空格和标点符号的正则表达式: + +``` +BEGIN { + # ignore 1 or more consecutive occurrences of the characters + # in the character group below + FS="[ .,:;()<>{}@!\"'\t]+"; +} +``` + +接下来,主循环函数将遍历每个字段,忽略任何空字段(如果行末有标点符号,则会出现这种情况),并递增行中单词数: + +``` +{ +        for (i = 1; i <= NF; i++) { +                if ($i != "") { +                        words[$i]++; +                } +        } +} +``` + +最后,处理完文本后,使用 `END` 函数打印数组的内容,然后利用 `awk` 的能力,将输出的内容用管道输入 shell 命令,进行数字排序,并打印出 20 个最常出现的单词。 + +``` +END { +        sort_head = "sort -k2 -nr | head -n 20"; +        for (word in words) { +                printf "%s\t%d\n", word, words[word] | sort_head; +        } +        close (sort_head); +} +``` + +在这篇文章的早期草稿上运行这个脚本,会产生这样的输出: + +``` +[dneary@dhcp-49-32.bos.redhat.com]$ awk -f wordcount.awk < awk_article.txt +the 79 +awk 41 +a 39 +and 33 +of 32 +in 27 +to 26 +is 25 +line 23 +for 23 +will 22 +file 21 +we 16 +We 15 +with 12 +which 12 +by 12 +this 11 +output 11 +function 11 +``` + +### 下一步是什么? + +如果你想了解更多关于 `awk` 编程的知识,我强烈推荐 Dale Dougherty 和 Arnold Robbins 所著的《[Sed 和 awk][8]》这本书。 + +`awk` 编程进阶的关键之一是掌握“扩展正则表达式”。`awk` 为你可能已经熟悉的 sed [正则表达式][9]语法提供了几个强大的补充。 + +另一个学习 `awk` 的好资源是 [GNU awk 用户指南][10]。它有一个完整的 `awk` 内置函数库的参考资料,以及很多简单和复杂的 `awk` 脚本的例子。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/advanced-awk + +作者:[Dave Neary][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://opensource.com/users/dneary +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk (a checklist for a team) +[2]: mailto:pc@event.org +[3]: mailto:hpotter@hogwarts.edu +[4]: mailto:reacher@covert.mil +[5]: mailto:mmouse@disney.com +[6]: mailto:sclaus@northpole.org +[7]: mailto:dneary@dhcp-49-32.bos.redhat.com +[8]: https://www.amazon.com/sed-awk-Dale-Dougherty/dp/1565922255/book +[9]: https://en.wikibooks.org/wiki/Regular_Expressions/POSIX-Extended_Regular_Expressions +[10]: https://www.gnu.org/software/gawk/manual/gawk.html From 1bf9f2e20fdc034807bb849e479a723236aedec9 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 28 Sep 2020 05:01:36 +0800 Subject: [PATCH 0231/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200928?= =?UTF-8?q?=20How=20to=20Use=20the=20Firefox=20Task=20Manager=20(to=20Find?= =?UTF-8?q?=20and=20Kill=20RAM=20and=20CPU=20Eating=20Tabs=20and=20Extensi?= =?UTF-8?q?ons)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md --- ...RAM and CPU Eating Tabs and Extensions).md | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 sources/tech/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md diff --git a/sources/tech/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md b/sources/tech/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md new file mode 100644 index 0000000000..13f4fc0b28 --- /dev/null +++ b/sources/tech/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions)) +[#]: via: (https://itsfoss.com/firefox-task-manager/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions) +====== + +Firefox is popular among Linux users. It is the default web browser on several Linux distributions. + +Among many other features, Firefox provides a task manager of its own. + +Now, why would you use it when you have [task manager in Linux][1] in the form of [system monitoring tools][2]? There is a good reason for that. + +Suppose your system is taking too much of RAM or CPU. If you use top or some other system [resource monitoring tool like Glances][3], you’ll notice that these tools cannot distinguish the opened tabs or extensions. + +Usually, each Firefox tab is displayed as **Web Content**. You can see that some Firefox process is causing the issue but that’s no way to accurately determine which tab or extension it is. + +This is where you can use the Firefox task manager. Let me show you how! + +### Firefox Task Manager + +With Firefox Task Manager, you will be able to list all the tabs, trackers, and add-ons consuming system resources. + +![][4] + +As you can see in the screenshot above, you get the name of the tab, the type (tab or add-on), the energy impact, and the memory consumed. + +While everything is self-explanatory, the **energy impact refers to the CPU usage** and if you are using a Laptop, it is a good indicator to show you what will drain the battery quicker. + +#### Access Task Manager in Firefox + +Surprisingly, there is no [Firefox keyboard shortcut][5] for the task manager. + +To quickly launch Firefox Task Manager, you can type “**about:performance**” in the address bar as shown in the screenshot below. + +![Quickly access task manager in Firefox][6] + +Alternatively, you can click on the **menu** icon and then head on to “**More**” options as shown in the screenshot below. + +![Accessing task manager in Firefox][7] + +Next, you will find the option to select “**Task Manager**” — so just click on it. + +![][8] + +#### Using Firefox task manager + +Once there, you can check for the resource usage, expand the tabs to see the trackers and its usage, and also choose to close the tabs right there as highlighted in the screenshot below. + +![][9] + +Here’s what you should know: + + * Energy impact means CPU consumption. + * The subframes or the subtasks are usually the trackers/scripts associated with a tab that needs to run in the background. + + + +With this task manager, you can spot a rogue script on a site as well whether it’s causing your browser to slow down. + +This isn’t rocket-science but not many people are aware of Firefox task manager. Now that you know it, this should come in pretty handy, don’t you think? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/firefox-task-manager/ + +作者:[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/task-manager-linux/ +[2]: https://itsfoss.com/linux-system-monitoring-tools/ +[3]: https://itsfoss.com/glances/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/firefox-task-manager-shot.png?resize=800%2C519&ssl=1 +[5]: https://itsfoss.com/firefox-keyboard-shortcuts/ +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/firefox-url-performance.jpg?resize=800%2C357&ssl=1 +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/firefox-task-manager-steps.jpg?resize=800%2C779&ssl=1 +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/firefox-task-manager-menu.jpg?resize=800%2C465&ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/firefox-task-manager-close-tab.png?resize=800%2C496&ssl=1 From efe0a8730a25900702e84957acaf2d7d95dd5cc7 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 28 Sep 2020 05:01:53 +0800 Subject: [PATCH 0232/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200927?= =?UTF-8?q?=20What=20would=20a=20global=20open=20organization=20look=20lik?= =?UTF-8?q?e=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200927 What would a global open organization look like.md --- ...ld a global open organization look like.md | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 sources/tech/20200927 What would a global open organization look like.md diff --git a/sources/tech/20200927 What would a global open organization look like.md b/sources/tech/20200927 What would a global open organization look like.md new file mode 100644 index 0000000000..046c1b5b44 --- /dev/null +++ b/sources/tech/20200927 What would a global open organization look like.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What would a global open organization look like?) +[#]: via: (https://opensource.com/open-organization/20/9/global-open-organization) +[#]: author: (Ron McFarland https://opensource.com/users/ron-mcfarland) + +What would a global open organization look like? +====== +Solving global problems will require global collaboration. Working +openly is the best way forward. +![Pixelated globe][1] + +In the [first article in this series][2], I presented four dimensions of globalization and explained how they relate to [open organization principles][3]. Then, in [the second part][4], I reviewed a history of globalization, one based on [Jeffrey D. Sachs][5]' book [The Ages of Globalization][6]. That piece tracked a history of gradually increasing openness—from the beginning of human civilization up to the start of the industrial revolution, which began around the beginning of the 1800s. + +In this final installment of the series, I will continue my review of Sachs' book by examining two more recent historical settings, the Industrial Age and the Digital Age, to explain how open principles have shaped more recent trends in globalization—and how these principles will be integral to our global future. + +### The Industrial Age (1800‒2000 CE): The urban, city growth, and machine setting + +According to Sachs, around 1820, 85% of the global population was still involved in farming and lived at a subsistence level. Of them, 93% were relatively unconnected, living in rural areas. + +Through the advent of industrial development, that all changed. + +By 2000, about half the global population (46.7%) lived in urban areas, their average incomes soared, and average life expectancy had reached 67 years old (according to 2000‒2005 data). Living in an interconnected world among a web of nonstop data altered the relative isolation of village life—an illustration of the importance of building **communities** that are **inclusive**, **collaborate** deeply, are very open and **transparent** with each other, and support each other when there are unexpected challenges **(adaptable)**. + +The Industrial Revolution began in 1776 with James Watt's invention of the steam engine in Scotland. Railroads and steamships began connecting the world. Large factories began bringing in people from the countryside. As the British economic historian E. A. Wrigley has written, this was a movement from an "organic economy" to an "energy-rich economy" in which we see a shift from a dependence on raw materials from vegetable or animal (including human manual labor) for energy to three main fossil fuels for energy (coal, petroleum and natural gas) that was deployed after 1800 (and then, just 100 years later, nuclear technology). + +[Global GDP per capita][2] hadn't changed much until around 1780‒1830, when the steam engine sparked a wave of increase, according to economist [Nikolai Kondratiev][7]. From then, upward movements in GDP [have come in additional waves][8], Kondratiev says. The second wave arrived around 1830‒1880, with investments in railways and steel. The third (1880‒1930) came from electrification. Automobiles sparked the fourth wave around 1930‒1970. The fifth, information technologies, began around 2010. And now intelligent technology, including robotics and artificial intelligence, stands to spark another from 2010‒2050. All these investments have changed the environment in which we build communities, collaborate, share information and address challenges (they also created income inequality between regions—between Kondratiev's "energy rich" economies and others). + +By the end of World War II (around 1945) many organizations had been established to promote what today we might call greater openness. Organizations like the [United Nations (UN)][9], the [International Monetary Fund (IMF)][10], [the World Bank][11], [the General Agreement on Tariffs and Trade (GATT)][12], [the Food and Agricultural Organization][13] and the [World Health Organization (WHO)][14] continue to promote various forms of global cooperation. The same is true of global philanthropic organizations and private foundations like the [Bill and Melinda Gate Foundation][15], [Greenpeace][16] and others. They will be more needed and must be strengthened in the years ahead. + +### The Digital Age (Twenty-First Century): The connection and sustainability-challenge setting + +We are only one-fifth of the way into the 21st Century. According to Sachs, globalized communities in this period will address different issues than those they've addressed up until now. Economic activity, jobs, lifestyles, and geopolitics will all gradually change. To address these changes, we can apply open organizational principles. + +According to Sachs, these issues will be central to those changes. + +**Drastic economic and financial inequality.** We must address the distribution of global wealth. Workers displaced by machines have seen their earnings stagnate or decline. These workers must be retrained and re-skilled with processes financed through taxation. This is equally true between developed and developing countries. Developed countries must provide some kind of managed support to developing countries as they transition in the years and decades ahead. These are global issues and should be addressed as such, Sachs says, or unmanageable global unrest and continued poverty will result. + +Could we write a mission statement for humankind? If we could, open organization principles should be its backbone. + +**A global environmental crisis.** "The world economy has increased roughly a hundredfold over the past two centuries: roughly ten times the population and ten times the GDP per capita," Sachs writes. "Yet the physical planet has remained constant, and the human impact on that environment has therefore intensified dramatically." Issues like climate change, the burning of fossil fuels, mass destruction of biodiversity, and the dire pollution of air, soils, freshwater and oceans must all be topics of _global_ conversation and collaboration, or we will watch our environment worsen, Sachs says. + +**Increased chance of global war.** In Sachs' outline of historical periods, shifts in geopolitical power are often accompanied by war. That potential is once more a potential concern. This issue will require a great deal of open discussions between these nations. + +### Governance through the ages + +Let's take one more global look at [organizational governance through the ages][4]. According to Sachs, governance has become more global over time. + + * In the Paleolithic Age (70,000-10,000 BCE), there were strong bonds developed between nomadic clans, particularly "bands" of 25‒30 members within those clans. + * In the Neolithic Age (10,000-3,000 BCE), through agricultural advancement, there was village life and local politics. + * In the Equestrian Age (3,000-1,000 BCE), through animal domestication and travel by horses, states were formed and governed. + * In the Classical Age (1,000 BCE-1500 CE), governance expanded to regional multi-ethnic empires through education and further information documentation. + * In the Ocean Age (1500-1800 CE), through long-distance sea travel, larger global empire governance started. + * In the Industrial Age (1800-2000 CE), the United Nations was formed and two dominant powers emerged (namely, the United Kingdom and the United States). + * In the Digital Age (the 21st Century), shifting geopolitical conditions will prompt new developments in global organizational governance, particularly in a globally connected world in which China and the United States will play major roles. + + + +Sachs notes that prosperity and longer life expectancy have resulted from increased global interconnectedness and organizational openness. + +So how might we build the next generation of global, open organizations? + +### An age of truly global collaboration + +According to Professor Sachs, in order to get buy-in to address these issues, currently underrepresented regions will need a more powerful voice in the global community. Nations will not buy into potential changes unless they feel they are fully represented, participating in a true collaborative dialog. Configuring a global community attentive to members' needs is extremely important. Without ideal representation and talent in the room, very little can be achieved. + +For example, to obtain stronger global buy-in, Sachs recommends one representative from each of eight major global regions in the United Nations (North America, South America, European Union, African Union, South Asia, East Asia, Commonwealth of Independent States, and Western Asia). A manageable team of eight people discussing global issues has a higher chance of success. + +Also, Sachs recommends that Brazil, Germany, India, Indonesia, Japan, and Nigeria should be permanent members of the UN Security Council. Then, global issues can be more easily and seriously addressed. As is, he writes, the 193 individual member countries can do very little. + +A successful development agenda (the community's purpose) requires inclusive partnerships at the global, regional, national and local levels. They have to be built upon a shared vision and shared goals with all human beings and the planet at the center. Furthermore, with an increase in urban populations, communities should be getting involved in not only issues within their area but globally as well. Here again, their representation and participation are required to get them to buy-in to anything agreed on. + +In short, a globally viable open organization of member nations would be beneficial. + +Here are two challenges such an organization could help address. + +**Ending world poverty.** Sachs believes that in our generation we should see an end to world poverty—particularly if the global community works on supporting poorer communities, controlling disease globally, increasing school attendance, and improving infrastructure worldwide. Work on these issues have already begun in many places at a _national_ level (consider China's [Belt and Road initiative][17]), but it should be coordinated on a global scale. + +**Promoting Literacy.** In the 1950s, global illiteracy (in any language) had been eliminated in most high-income countries, and yet the global illiteracy rate was still roughly 80% in developing countries. This gap made global collaboration and joint problem-solving difficult. Therefore, even though life expectancy in developed countries was then around 68 years of age, in developing countries it was only around 40 years of age. Open organization principles become very difficult to be adopted globally, or won't work at all worldwide, where such illiteracy is common. Multi-language education must be a priority. While English is the language of choice in most scientific, financial, or diplomatic discussions, it is not the most _spoken_ language (Chinese is). Foreign language learning, foreign language interpreting, and foreign language translation will become more important as well in the years ahead to promote global understanding, cooperation and collaboration. + +### A shared identity + +We all have identities formed in part by the groups in which we participate—sports teams, religious groups, regions, and nationalities. We tend to promote and support those that we identify with. So how might we develop an identity for a new, _global_ organization that welcomes open participation in solving global issues? + +Could we write a mission statement for humankind? + +If we could, [open organization principles][3] should be its backbone. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/9/global-open-organization + +作者:[Ron McFarland][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://opensource.com/users/ron-mcfarland +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/pixelated-world.png?itok=fHjM6m53 (Pixelated globe) +[2]: https://opensource.com/open-organization/20/7/globalization-history-open +[3]: https://theopenorganization.org/definition +[4]: https://opensource.com/open-organization/20/8/global-history-collaboration +[5]: https://en.wikipedia.org/wiki/Jeffrey_Sachs +[6]: https://cup.columbia.edu/book/the-ages-of-globalization/9780231193740 +[7]: https://en.wikipedia.org/wiki/Nikolai_Kondratiev +[8]: https://ourworldindata.org/grapher/world-gdp-over-the-last-two-millennia +[9]: https://www.un.org/en/ +[10]: https://www.imf.org/external/index.htm +[11]: https://www.worldbank.org/ +[12]: https://en.wikipedia.org/wiki/General_Agreement_on_Tariffs_and_Trade#:~:text=The%20General%20Agreement%20on%20Tariffs,such%20as%20tariffs%20or%20quotas. +[13]: https://en.wikipedia.org/wiki/Food_and_Agriculture_Organization +[14]: https://www.who.int/ +[15]: https://www.gatesfoundation.org/ +[16]: https://opensource.com/tags/open-organization-greenpeace +[17]: https://www.beltroad-initiative.com/belt-and-road/ From 3f786f906d77610015754b68de45dc2d496a7376 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 28 Sep 2020 08:42:17 +0800 Subject: [PATCH 0233/1156] translated --- ...awei ban could complicate 5G deployment.md | 83 ------------------- ...awei ban could complicate 5G deployment.md | 79 ++++++++++++++++++ 2 files changed, 79 insertions(+), 83 deletions(-) delete mode 100644 sources/talk/20200916 Huawei ban could complicate 5G deployment.md create mode 100644 translated/talk/20200916 Huawei ban could complicate 5G deployment.md diff --git a/sources/talk/20200916 Huawei ban could complicate 5G deployment.md b/sources/talk/20200916 Huawei ban could complicate 5G deployment.md deleted file mode 100644 index 4e624eb93a..0000000000 --- a/sources/talk/20200916 Huawei ban could complicate 5G deployment.md +++ /dev/null @@ -1,83 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Huawei ban could complicate 5G deployment) -[#]: via: (https://www.networkworld.com/article/3575408/huawei-ban-could-complicate-5g-deployment.html) -[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) - -Huawei ban could complicate 5G deployment -====== -Bans on Huawei, ZTE mean fewer choices for wireless carriers building 5G services -Vertigo3D / Getty Images - -As carriers race to build out their 5G networks, options for buying the gear they need are fewer in the U.S. than in other countries thanks to federal pressure, which could be slowing deployments. - -### 5G resources - - * [What is 5G? Fast wireless technology for enterprises and phones][1] - * [How 5G frequency affects range and speed][2] - * [Private 5G can solve some problems that Wi-Fi can’t][3] - * [Private 5G keeps Whirlpool driverless vehicles rolling][4] - * [5G can make for cost-effective private backhaul][5] - * [CBRS can bring private 5G to enterprises][6] - - - -China-based Huawei and ZTE were both banned from providing equipment to the government itself in the Defense Authorization Act of 2018, and a general import ban followed shortly thereafter. That has changed the competitive landscape considerably, and raises questions about how the shape of 5G in America could change as a consequence. - -Michael Porowski , a Gartner analyst, said it’s possible, though not completely clear, that the restriction on where carriers can buy their 5G equipment is slowing deployment. - -“There’s still an ample number of suppliers – Ericsson, Nokia, Samsung,” he said. Both ZTE and Huawei are more economical options, he said, and “if they were available, you might see a bit faster adoption.” - -[[Get regularly scheduled insights by signing up for Network World newsletters.]][7] - -There’s a sense in the industry that Huawei equipment is both sophisticated and priced to move, according to Christian Renaud, research director at 451 Research, but there’s also no clear alternative that carriers will gravitate to in the absence of Huawei. - -“Here, you’ll have carriers that have standardized on Nokia or Ericsson,” he said. “[And] it’s too soon to tell who’s most sophisticated because deployments are so limited.” - -That contention is borne out by coverage maps from the carriers themselves. While they have been quick to trumpet the presence of 5G service in many U.S. markets, the actual geographic coverage is mostly restricted to public spaces in the urban cores of major cities. The lion’s share of 5G deployment, in short, is yet to come. - -There are good reasons for slow deployment. 5G access points have to be deployed far more densely than earlier generation wireless technology, making the process more involved and time-consuming. There’s also the issue that the number of currently available 5G user devices is vanishingly small. - -“It’s like saying ‘I’ve got this eight-lane superhighway,’ before someone has invented cars,” said Renaud. - -Part of the current goal for equipment vendors is demonstrating the potentials of 5G through private deployments that use the technology for backhaul, supporting [IoT][8] and other link use cases specific to a single enterprise. - -“[The equipment vendors] are all pushing hard on the private piece, and then they can use that to say, ‘Look, I’m working the Brooklyn dockyards or something in a private 5G network, so … if I can do that I can run people’s YouTube connections,’” Renaud said. - -An unfortunate result of the China ban might be a splintering of the specifications that vendors follow to meet 5G requirements. If non-China vendors have to make one version for markets where Huawei and ZTE are allowed and a different version for places they are not, it could create a new headache for them, according to Renaud. - -“That’ll shift the burden of costs to the device makers to try to support the different carrier implementations," he said. “We’ll have created nontechnical barriers.” And those, in turn, could cause customer experience to suffer. - -But 5G has embraced a move toward greater interoperability with [open radio access network technology][9] that standardizes the software interfaces between layers of the 5G stack. The push is embraced by carriers and equipment vendors alike, making interoperability more likely, which could draw in even more players in the future. - -Of course, even with pervasive interoperability, equipment makers will still try to build customer dependency. “There’s always going to be a tug of war between vendors trying to lock in customers and customers trying to stay vendor-neutral,” he said. “That’s not going to change a lot. [But] we’ve obviously seen a move toward trying to be more open.” - -Join the Network World communities on [Facebook][10] and [LinkedIn][11] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3575408/huawei-ban-could-complicate-5g-deployment.html - -作者:[Jon Gold][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://www.networkworld.com/author/Jon-Gold/ -[b]: https://github.com/lujun9972 -[1]: https://www.networkworld.com/article/3203489/what-is-5g-fast-wireless-technology-for-enterprises-and-phones.html -[2]: https://www.networkworld.com/article/3568253/how-5g-frequency-affects-range-and-speed.html -[3]: https://www.networkworld.com/article/3568614/private-5g-can-solve-some-enterprise-problems-that-wi-fi-can-t.html -[4]: https://www.networkworld.com/article/3488799/private-5g-keeps-whirlpool-driverless-vehicles-rolling.html -[5]: https://www.networkworld.com/article/3570724/5g-can-make-for-cost-effective-private-backhaul.html -[6]: https://www.networkworld.com/article/3529291/cbrs-wireless-can-bring-private-5g-to-enterprises.html -[7]: https://www.networkworld.com/newsletters/signup.html -[8]: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html -[9]: https://www.networkworld.com/article/3574977/carriers-vendors-work-to-promote-5g-network-flexibility-with-open-standards.html -[10]: https://www.facebook.com/NetworkWorld/ -[11]: https://www.linkedin.com/company/network-world diff --git a/translated/talk/20200916 Huawei ban could complicate 5G deployment.md b/translated/talk/20200916 Huawei ban could complicate 5G deployment.md new file mode 100644 index 0000000000..02639f3e77 --- /dev/null +++ b/translated/talk/20200916 Huawei ban could complicate 5G deployment.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Huawei ban could complicate 5G deployment) +[#]: via: (https://www.networkworld.com/article/3575408/huawei-ban-could-complicate-5g-deployment.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +华为禁令可能使 5G 部署复杂化 +====== +对华为、中兴的禁令意味着无线运营商建设 5G 服务的选择减少了。 + +随着运营商竞相建设他们的 5G 网络,由于联邦的压力,在美国购买所需设备的选择比其他国家少,这可能会减缓部署。 + +### 5G资源 + + * [什么是 5G? 企业和手机的快速无线技术][1] 。 + * [5G 频率如何影响范围和速度][2] + * [私有 5G 可以解决 Wi-Fi 不能解决的一些问题][3] + * [私有 5G 让惠而浦无人驾驶汽车到来][4] 。 + * [5G 可使私有回传具有成本效益][5] + * [CBRS 可以把私有 5G 带到企业][6] + + + +在 2018 年的《国防授权法案》中,总部位于中国的华为和中兴通讯都被禁止向政府提供设备,随后不久,就是全面禁止进口。这大大改变了竞争格局,并引发了美国 5G 的形态可能因此而改变的问题。 + +Gartner 的分析师 Michael Porowski 表示,虽然还不完全清楚,但有可能运营商在哪里购买 5G 设备的限制正在减缓部署。 + +他说:”仍然有充足的供应商:爱立信、诺基亚、三星。中兴和华为都是更经济的选择。如果它们可用,你可能会看到更快的采用速度。” + +451 Research 的研究总监 Christian Renaud 表示,业界有一种感觉,即华为设备既复杂又价格低廉,但在没有华为的情况下,运营商也没有明确的替代方案。 + +他说:”这里,会有运营商以诺基亚或爱立信为标准。(而且)现在判断谁最复杂还为时过早,因为部署是如此有限。” + +这种争论在运营商本身的覆盖地图上得到证实。虽然他们很快就大肆宣传 5G 服务在美国许多市场的存在,但实际的地理覆盖范围大多局限于大城市核心区的公共场所。简而言之,大部分地区的 5G 部署还没有到来。 + +部署缓慢是有充分理由的。5G 接入点的部署密度要远高于早期一代无线技术,因此过程中涉及的内容更多,也更耗时。还有一个问题是,目前可用的 5G 用户设备数量还很少。 + +Renaud 说:”这就好比说, 在有人发明汽车之前,说”我已经有了这条八车道的超级高速公路“。“ + +设备供应商目前的部分目标是通过私人部署来展示 5G 的潜力,这些部署将该技术用回传,用于支持[物联网][8]和其他针对单个企业的链接场景。 + +Renaud 说:”(设备供应商)都在大力推动私有化这一块,然后他们可以利用这一点说,你看,我在私有化的 5G 这块做着布鲁克林造船厂之类的事情,所以,如果我能实现,我就可以运行人们的 YouTube 连接。“ + +中国禁令的一个不幸结果可能是供应商为满足 5G 要求而遵循的规范的分裂。Renaud 称,如果非中国供应商必须为允许华为和中兴的市场制作一个版本,而为不允许华为和中兴的地方制作不同的版本,这可能会给他们带来新的麻烦。 + +他说:”这将把成本负担转移到设备制造商身上,来试图支持不同的运营商实施。我们会造成非技术性的障碍。” 而这些,又会导致客户体验受到影响。 + +但是,5G 已经接受了一种拥有更高的互操作性的[开放无线接入网技术][9],它将 5G 栈各层之间的软件接口标准化。运营商和设备商都接受了这一推动,使得互操作性更有可能,这可能会在未来吸引更多的玩家。 + +当然,即便是普遍的互操作性,设备制造商仍然会试图建立客户依赖性。他说”在试图锁定客户的供应商和试图保持供应商中立的客户之间,总是会有一场拉锯战。这不会有很大的改变。(但是)我们显然已经看到了试图更加开放的动向。” + +加入 [Facebook][10] 和 [LinkedIn][11] 上的 Network World 社区,对热门话题进行评论。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3575408/huawei-ban-could-complicate-5g-deployment.html + +作者:[Jon Gold][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3203489/what-is-5g-fast-wireless-technology-for-enterprises-and-phones.html +[2]: https://www.networkworld.com/article/3568253/how-5g-frequency-affects-range-and-speed.html +[3]: https://www.networkworld.com/article/3568614/private-5g-can-solve-some-enterprise-problems-that-wi-fi-can-t.html +[4]: https://www.networkworld.com/article/3488799/private-5g-keeps-whirlpool-driverless-vehicles-rolling.html +[5]: https://www.networkworld.com/article/3570724/5g-can-make-for-cost-effective-private-backhaul.html +[6]: https://www.networkworld.com/article/3529291/cbrs-wireless-can-bring-private-5g-to-enterprises.html +[8]: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html +[9]: https://www.networkworld.com/article/3574977/carriers-vendors-work-to-promote-5g-network-flexibility-with-open-standards.html +[10]: https://www.facebook.com/NetworkWorld/ +[11]: https://www.linkedin.com/company/network-world From 418f16e10fa8b4bc1ff48a0b8601c144496633fe Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 28 Sep 2020 08:46:26 +0800 Subject: [PATCH 0234/1156] translating --- ...stions to ask yourself when writing project documentation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200925 5 questions to ask yourself when writing project documentation.md b/sources/tech/20200925 5 questions to ask yourself when writing project documentation.md index e7457aa04f..1b68be7296 100644 --- a/sources/tech/20200925 5 questions to ask yourself when writing project documentation.md +++ b/sources/tech/20200925 5 questions to ask yourself when writing project documentation.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From af8ea30288b2d102d85c5c8a35ebc2aae2406643 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 28 Sep 2020 15:47:01 +0800 Subject: [PATCH 0235/1156] PRF @wxy --- ...your awk skills with two easy tutorials.md | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/translated/tech/20191031 Advance your awk skills with two easy tutorials.md b/translated/tech/20191031 Advance your awk skills with two easy tutorials.md index 044c9c9280..ce46bcf337 100644 --- a/translated/tech/20191031 Advance your awk skills with two easy tutorials.md +++ b/translated/tech/20191031 Advance your awk skills with two easy tutorials.md @@ -1,20 +1,20 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Advance your awk skills with two easy tutorials) [#]: via: (https://opensource.com/article/19/10/advanced-awk) [#]: author: (Dave Neary https://opensource.com/users/dneary) - 通过两个简单的教程来提高你的 awk 技能 ====== -> 超越单行的awk脚本,邮件合并和字数统计。 -!["一个团队的检查表"[1] +> 超越单行的 awk 脚本,学习如何做邮件合并和字数统计。 -`awk` 是 Unix 和 Linux 用户工具箱中最古老的工具之一。`awk` 由 Alfred Aho、Peter Weinberger 和 Brian Kernighan(工具名称中的 A、W 和 K)在 20 世纪 70 年代创建,用于复杂的文本流处理。它是流编辑器 `sed` 的配套工具,后者是为逐行处理文本文件而设计的。`awk` 支持更复杂的结构化程序,是一种完整的编程语言。 +![](https://img.linux.net.cn/data/attachment/album/202009/28/154624jk8w4ez6oujbur8j.jpg) + +`awk` 是 Unix 和 Linux 用户工具箱中最古老的工具之一。`awk` 由 Alfred Aho、Peter Weinberger 和 Brian Kernighan(即工具名称中的 A、W 和 K)在 20 世纪 70 年代创建,用于复杂的文本流处理。它是流编辑器 `sed` 的配套工具,后者是为逐行处理文本文件而设计的。`awk` 支持更复杂的结构化程序,是一门完整的编程语言。 本文将介绍如何使用 `awk` 完成更多结构化的复杂任务,包括一个简单的邮件合并程序。 @@ -34,7 +34,7 @@ function 函数名(参数列表) { 语句 } ``` -这种模式匹配块和函数的组合允许开发者结构化 `awk` 程序,以便重用和可读。 +这种模式匹配块和函数的组合允许开发者结构化的 `awk` 程序,以便重用和提高可读性。 ### awk 如何处理文本流 @@ -42,12 +42,12 @@ function 函数名(参数列表) { 语句 } * `FS`(字段分隔符field separator)。默认情况下,这是任何空格字符(空格或制表符)。 * `RS`(记录分隔符record separator)。默认情况下是一个新行(`n`)。 - * `NF`(字段数number of fields)。当 `awk` 解析一行时,这个变量被设置为已解析的字段数。 + * `NF`(字段数number of fields)。当 `awk` 解析一行时,这个变量被设置为被解析出字段数。 * `$0:` 当前记录。 * `$1`、`$2`、`$3` 等:当前记录的第一、第二、第三等字段。 * `NR`(记录数number of records)。迄今已被 `awk` 脚本解析的记录数。 -影响 `awk` 行为的变量还有很多,但这已经足够开始了。 +影响 `awk` 行为的变量还有很多,但知道这些已经足够开始了。 ### 单行 awk 脚本 @@ -105,7 +105,7 @@ Mickey,Mouse,mmouse@disney.com,"Surviving public speaking with a squeaky voice" Santa,Claus,sclaus@northpole.org,"Efficient list-making" ``` -你要读取 CSV 文件,替换第一个文件中的相关字段(跳过第一行),然后把结果写到一个叫 `acceptanceN.txt` 的文件中,每解析一行就递增 `N`。 +你要读取 CSV 文件,替换第一个文件中的相关字段(跳过第一行),然后把结果写到一个叫 `acceptanceN.txt` 的文件中,每解析一行就递增文件名中的 `N`。 把 `awk` 程序写在一个叫 `mail_merge.awk` 的文件中。在 `awk` 脚本中的语句用 `;` 分隔。第一个任务是设置字段分隔符变量和其他几个脚本需要的变量。你还需要读取并丢弃 CSV 中的第一行,否则会创建一个以 `Dear firstname` 开头的文件。要做到这一点,请使用特殊函数 `getline`,并在读取后将记录计数器重置为 0。 @@ -125,17 +125,17 @@ BEGIN { ``` { -        # Read relevant fields from input file +        # 从输入文件中读取关联字段         firstname=$1;         lastname=$2;         email=$3;         title=$4; -        # Set output filename +        # 设置输出文件名         outfile=(output NR ".txt"); -        # Read a line from template, replace special fields, and -        # print result to output file +        # 从模板中读取一行,替换特定字段, +        # 并打印结果到输出文件。         while ( (getline ln < template) > 0 )         {                 sub(/{firstname}/,firstname,ln); @@ -145,7 +145,7 @@ BEGIN {                 print(ln) > outfile;         } -        # Close template and output file in advance of next record +        # 关闭模板和输出文件,继续下一条记录         close(outfile);         close(template); } @@ -153,7 +153,6 @@ BEGIN { 你已经完成了! 在命令行上运行该脚本: - ``` awk -f mail_merge.awk proposals.csv ``` @@ -164,7 +163,7 @@ awk -f mail_merge.awk proposals.csv awk -f mail_merge.awk < proposals.csv ``` -你会发现在当前目录下生成的文本文件。 +你会在当前目录下发现生成的文本文件。 ### awk 进阶:字频计数 @@ -254,7 +253,7 @@ via: https://opensource.com/article/19/10/advanced-awk 作者:[Dave Neary][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From b638e5df02459c92517f25a4d6943d6bfaf85c19 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 28 Sep 2020 15:47:27 +0800 Subject: [PATCH 0236/1156] PUB @wxy https://linux.cn/article-12658-1.html --- ...0191031 Advance your awk skills with two easy tutorials.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191031 Advance your awk skills with two easy tutorials.md (99%) diff --git a/translated/tech/20191031 Advance your awk skills with two easy tutorials.md b/published/20191031 Advance your awk skills with two easy tutorials.md similarity index 99% rename from translated/tech/20191031 Advance your awk skills with two easy tutorials.md rename to published/20191031 Advance your awk skills with two easy tutorials.md index ce46bcf337..4fa911cfd9 100644 --- a/translated/tech/20191031 Advance your awk skills with two easy tutorials.md +++ b/published/20191031 Advance your awk skills with two easy tutorials.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12658-1.html) [#]: subject: (Advance your awk skills with two easy tutorials) [#]: via: (https://opensource.com/article/19/10/advanced-awk) [#]: author: (Dave Neary https://opensource.com/users/dneary) From c278488c95da6df1375bfcae2e8af66ff7fcfa45 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 28 Sep 2020 15:55:31 +0800 Subject: [PATCH 0237/1156] Rename sources/tech/20200927 What would a global open organization look like.md to sources/talk/20200927 What would a global open organization look like.md --- .../20200927 What would a global open organization look like.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200927 What would a global open organization look like.md (100%) diff --git a/sources/tech/20200927 What would a global open organization look like.md b/sources/talk/20200927 What would a global open organization look like.md similarity index 100% rename from sources/tech/20200927 What would a global open organization look like.md rename to sources/talk/20200927 What would a global open organization look like.md From 8602c526cd4d3091977f0f078070b845cb7e7927 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 28 Sep 2020 16:27:57 +0800 Subject: [PATCH 0238/1156] PRF @geekpi --- ...awei ban could complicate 5G deployment.md | 50 ++++++++----------- 1 file changed, 20 insertions(+), 30 deletions(-) diff --git a/translated/talk/20200916 Huawei ban could complicate 5G deployment.md b/translated/talk/20200916 Huawei ban could complicate 5G deployment.md index 02639f3e77..1a3ff8fe7a 100644 --- a/translated/talk/20200916 Huawei ban could complicate 5G deployment.md +++ b/translated/talk/20200916 Huawei ban could complicate 5G deployment.md @@ -1,58 +1,48 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Huawei ban could complicate 5G deployment) [#]: via: (https://www.networkworld.com/article/3575408/huawei-ban-could-complicate-5g-deployment.html) [#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) -华为禁令可能使 5G 部署复杂化 +对华为的禁令可能使 5G 部署复杂化 ====== -对华为、中兴的禁令意味着无线运营商建设 5G 服务的选择减少了。 -随着运营商竞相建设他们的 5G 网络,由于联邦的压力,在美国购买所需设备的选择比其他国家少,这可能会减缓部署。 +> 对华为、中兴的禁令意味着无线运营商建设 5G 服务的选择减少了。 -### 5G资源 +![](https://images.idgesg.net/images/article/2019/02/5g_wireless_technology_network_connections_by_credit-vertigo3d_gettyimages-1043302218_3x2-100787550-large.jpg) - * [什么是 5G? 企业和手机的快速无线技术][1] 。 - * [5G 频率如何影响范围和速度][2] - * [私有 5G 可以解决 Wi-Fi 不能解决的一些问题][3] - * [私有 5G 让惠而浦无人驾驶汽车到来][4] 。 - * [5G 可使私有回传具有成本效益][5] - * [CBRS 可以把私有 5G 带到企业][6] +随着运营商竞相建设他们的 5G 网络,由于美国联邦政府的压力,在美国购买所需设备的选择比其他国家少,这可能会减缓部署。 +在 2018 年的《国防授权法案》中,总部位于中国的华为和中兴通讯都被禁止向美国政府提供设备,此后不久又全面禁止进口。这极大地改变了竞争格局,并引发了美国 5G 的形态可能因此而改变的问题。 +Gartner 的分析师 Michael Porowski 表示,虽然还不完全清楚,但运营商可以在哪里购买 5G 设备的限制有可能会减缓部署速度。 -在 2018 年的《国防授权法案》中,总部位于中国的华为和中兴通讯都被禁止向政府提供设备,随后不久,就是全面禁止进口。这大大改变了竞争格局,并引发了美国 5G 的形态可能因此而改变的问题。 +他说:”供应商数量仍然很多:爱立信、诺基亚、三星。中兴和华为都是更经济的选择。如果它们可用,你可能会看到更快的采用速度。” -Gartner 的分析师 Michael Porowski 表示,虽然还不完全清楚,但有可能运营商在哪里购买 5G 设备的限制正在减缓部署。 +451 Research 的研究总监 Christian Renaud 表示,业界普遍认为,华为设备既成熟又价格低廉,而在没有华为的情况下,运营商也没有明确的替代方案。 -他说:”仍然有充足的供应商:爱立信、诺基亚、三星。中兴和华为都是更经济的选择。如果它们可用,你可能会看到更快的采用速度。” +他说:“目前,会有采用诺基亚或爱立信标准的运营商。(而且)现在判断谁最成熟还为时过早,因为部署是如此有限。” -451 Research 的研究总监 Christian Renaud 表示,业界有一种感觉,即华为设备既复杂又价格低廉,但在没有华为的情况下,运营商也没有明确的替代方案。 +这种争论在运营商本身的覆盖地图上可以得到证实。虽然他们很快就大肆宣传 5G 服务在美国的许多市场上已经有了,但实际的地理覆盖范围大多局限于大城市核心区的公共场所。简而言之,大部分地区的 5G 部署还没有到来。 -他说:”这里,会有运营商以诺基亚或爱立信为标准。(而且)现在判断谁最复杂还为时过早,因为部署是如此有限。” +部署缓慢是有充分理由的。5G 接入点的部署密度要远高于上一代的无线技术,这使得该过程更加复杂且耗时。还有一个问题是,目前可用的 5G 用户设备数量还很少。 -这种争论在运营商本身的覆盖地图上得到证实。虽然他们很快就大肆宣传 5G 服务在美国许多市场的存在,但实际的地理覆盖范围大多局限于大城市核心区的公共场所。简而言之,大部分地区的 5G 部署还没有到来。 +Renaud 说:“这就好比说,在有人发明汽车之前,说‘我已经有了这条八车道的高速公路’。” -部署缓慢是有充分理由的。5G 接入点的部署密度要远高于早期一代无线技术,因此过程中涉及的内容更多,也更耗时。还有一个问题是,目前可用的 5G 用户设备数量还很少。 +设备供应商目前的部分目标是通过私有部署来展示 5G 的潜力,这些部署将该技术用做信号隧道backhaul,用于支持[物联网][8]和其他针对单个企业的链接场景。 -Renaud 说:”这就好比说, 在有人发明汽车之前,说”我已经有了这条八车道的超级高速公路“。“ +Renaud 说:“(设备供应商)都在大力推动私有部署这一块,然后他们可以利用这一点说:你看,我可以用在布鲁克林造船厂或某个私有部署的 5G 网络中,所以,如果可以的话……,它可以用于支持人们观看 YouTube。” -设备供应商目前的部分目标是通过私人部署来展示 5G 的潜力,这些部署将该技术用回传,用于支持[物联网][8]和其他针对单个企业的链接场景。 +对中国的禁令的一个不幸结果可能是供应商为满足 5G 要求而遵循的规范的分裂。Renaud 称,如果非中国供应商必须为允许华为和中兴的市场制作一个版本,而为不允许华为和中兴的地方制作不同的版本,这可能会给他们带来新的麻烦。 -Renaud 说:”(设备供应商)都在大力推动私有化这一块,然后他们可以利用这一点说,你看,我在私有化的 5G 这块做着布鲁克林造船厂之类的事情,所以,如果我能实现,我就可以运行人们的 YouTube 连接。“ +他说:“这将把成本负担转移到设备制造商身上,来试图支持不同的运营商实施。我们会造成非技术性的壁垒。”而这些,反过来又会导致客户体验受到影响。 -中国禁令的一个不幸结果可能是供应商为满足 5G 要求而遵循的规范的分裂。Renaud 称,如果非中国供应商必须为允许华为和中兴的市场制作一个版本,而为不允许华为和中兴的地方制作不同的版本,这可能会给他们带来新的麻烦。 +但是,5G 已经通过[开放无线接入网技术][9]拥抱了更高的互操作性的趋势,它将 5G 栈各层之间的软件接口标准化。运营商和设备商都接受了这一推动,使得互操作性更有可能,这可能会在未来吸引更多的参与者。 -他说:”这将把成本负担转移到设备制造商身上,来试图支持不同的运营商实施。我们会造成非技术性的障碍。” 而这些,又会导致客户体验受到影响。 - -但是,5G 已经接受了一种拥有更高的互操作性的[开放无线接入网技术][9],它将 5G 栈各层之间的软件接口标准化。运营商和设备商都接受了这一推动,使得互操作性更有可能,这可能会在未来吸引更多的玩家。 - -当然,即便是普遍的互操作性,设备制造商仍然会试图建立客户依赖性。他说”在试图锁定客户的供应商和试图保持供应商中立的客户之间,总是会有一场拉锯战。这不会有很大的改变。(但是)我们显然已经看到了试图更加开放的动向。” - -加入 [Facebook][10] 和 [LinkedIn][11] 上的 Network World 社区,对热门话题进行评论。 +当然,即便是普遍的互操作性,设备制造商仍然会试图建立客户依赖性。他说“在试图锁定客户的供应商和试图保持供应商中立的客户之间,总是会有一场拉锯战。这不会有很大的改变。(但是)我们显然已经看到了试图更加开放的动向。” -------------------------------------------------------------------------------- @@ -61,7 +51,7 @@ via: https://www.networkworld.com/article/3575408/huawei-ban-could-complicate-5g 作者:[Jon Gold][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 89a5a04e8648ac81a9c6b13f45ff4dd5a61eec48 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 28 Sep 2020 16:28:22 +0800 Subject: [PATCH 0239/1156] PUB @geekpi https://linux.cn/article-12659-1.html --- .../20200916 Huawei ban could complicate 5G deployment.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20200916 Huawei ban could complicate 5G deployment.md (98%) diff --git a/translated/talk/20200916 Huawei ban could complicate 5G deployment.md b/published/20200916 Huawei ban could complicate 5G deployment.md similarity index 98% rename from translated/talk/20200916 Huawei ban could complicate 5G deployment.md rename to published/20200916 Huawei ban could complicate 5G deployment.md index 1a3ff8fe7a..64da10ca4b 100644 --- a/translated/talk/20200916 Huawei ban could complicate 5G deployment.md +++ b/published/20200916 Huawei ban could complicate 5G deployment.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12659-1.html) [#]: subject: (Huawei ban could complicate 5G deployment) [#]: via: (https://www.networkworld.com/article/3575408/huawei-ban-could-complicate-5g-deployment.html) [#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) From 857058664b6640db0475a5c600a20661f0617984 Mon Sep 17 00:00:00 2001 From: "Xiaobin.Liu" Date: Mon, 28 Sep 2020 22:54:02 +0800 Subject: [PATCH 0240/1156] APL --- ... Generators to Create Fast and Resource-Friendly Websites.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md b/sources/tech/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md index 2aa7b8531b..5eef590b3a 100644 --- a/sources/tech/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md +++ b/sources/tech/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lxbwolf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From ab58e939b936578cb61e2ab3cbb01b7e628b572f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 28 Sep 2020 23:14:11 +0800 Subject: [PATCH 0241/1156] APL --- ...00810 How to read Lynis reports to improve Linux security.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200810 How to read Lynis reports to improve Linux security.md b/sources/tech/20200810 How to read Lynis reports to improve Linux security.md index de4d0eeb1a..983f328108 100644 --- a/sources/tech/20200810 How to read Lynis reports to improve Linux security.md +++ b/sources/tech/20200810 How to read Lynis reports to improve Linux security.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From a6e55f93a6f04fdea8ea128c1a059f49b62a1f42 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 28 Sep 2020 23:48:15 +0800 Subject: [PATCH 0242/1156] TSL --- ...Lynis reports to improve Linux security.md | 230 ------------------ ...Lynis reports to improve Linux security.md | 216 ++++++++++++++++ 2 files changed, 216 insertions(+), 230 deletions(-) delete mode 100644 sources/tech/20200810 How to read Lynis reports to improve Linux security.md create mode 100644 translated/tech/20200810 How to read Lynis reports to improve Linux security.md diff --git a/sources/tech/20200810 How to read Lynis reports to improve Linux security.md b/sources/tech/20200810 How to read Lynis reports to improve Linux security.md deleted file mode 100644 index 983f328108..0000000000 --- a/sources/tech/20200810 How to read Lynis reports to improve Linux security.md +++ /dev/null @@ -1,230 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to read Lynis reports to improve Linux security) -[#]: via: (https://opensource.com/article/20/8/linux-lynis-security) -[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) - -How to read Lynis reports to improve Linux security -====== -Use Lynis' scans and reports to find and fix Linux security issues. -![Lock][1] - -When I read Gaurav Kamathe's article _[Scan your Linux security with Lynis][2]_, it reminded me of my time as a systems administrator for the US Department of Labor. One of my duties was to keep our Unix servers hardened. Each quarter, an independent verifier came in to review our servers' security status. Each time on the day the verifier was scheduled to arrive, I ran Security Readiness Review (SRR), a scanning tool that used a large set of scripts to identify and report any security findings. SRR was open source, so I could view all the source scripts and their functions. This enabled me to look into the code, determine what specifically was wrong, and quickly fix each problem it found. - -### What is Lynis? - -[Lynis][3] is an open source security-auditing tool that works much like SRR by scanning a Linux system and providing detailed reports on any weaknesses it finds. Also like SRR, it is made up of a large set of scripts, and each script checks for a specific item, e.g., minimum and maximum password age requirements. - -After running Lynis, you can use its report to locate each item's script and learn exactly how Lynis checked for and reported each problem. You can also use the same script code to create new code to automate a resolution. - -### How to read Lynis reports - -Since Gaurav's article covered Lynis' installation and usage, in this article, I'll show some examples of how you can read and use its reports. - -To get started, run an audit: - - -``` -`# lynis audit system --quick` -``` - -After it completes, the full report will be displayed on your screen. Towards the bottom, the **Suggestions** section lists all the items that may need to be triaged to better harden the system, as well as a TEST-ID for each. - -To harden the system and reduce the size of the list, start chasing each item. The description in the **Suggestions** section may be everything you need to know what action to take. If it doesn't, you can use the `show details` command: - - -``` -`# lynis show details TEST-ID` -``` - -For instance, one of the suggestions on my system is: - -> The database required for `locate` could not be found. Run `updatedb` or `locate.updatedb` to create this file. [FILE-6410] - -It looks like I just need to run the command `updatedb`, but if I want to be sure, I can use Lynis' `show details` option: - - -``` -# lynis show details FILE-6410 -2020-06-16 20:54:33 Performing test ID FILE-6410 (Checking Locate database) -2020-06-16 20:54:33 Test: Checking locate database -2020-06-16 20:54:33 Result: file /var/lib/mlocate/mlocate.db not found -2020-06-16 20:54:33 Result: file /var/lib/locate/locatedb not found -2020-06-16 20:54:33 Result: file /var/lib/locatedb not found -2020-06-16 20:54:33 Result: file /var/lib/slocate/slocate.db not found -2020-06-16 20:54:33 Result: file /var/cache/locate/locatedb not found -2020-06-16 20:54:33 Result: file /var/db/locate.database not found -2020-06-16 20:54:33 Result: database not found -2020-06-16 20:54:33 Suggestion: The database required for 'locate' could not be found. Run 'updatedb' or 'locate.updatedb' to create this file. [test:FILE-6410] [details:-] [solution:-] -2020-06-16 20:54:33 ==== -``` - -These details indicate Lynis was unable to find various files. This case is very clear-cut. I can run the `updatedb` command and recheck this test: - - -``` -# updatedb -# lynis --tests FILE-6410 -``` - -Furthermore, rechecking the details shows which file it found that satisfied the test: - - -``` -# lynis show details FILE-6410 -2020-06-16 21:38:40 Performing test ID FILE-6410 (Checking Locate database) -2020-06-16 21:38:40 Test: Checking locate database -2020-06-16 21:38:40 Result: locate database found (/var/lib/mlocate/mlocate.db) -2020-06-16 21:38:40 Result: file /var/lib/locate/locatedb not found -2020-06-16 21:38:40 Result: file /var/lib/locatedb not found -2020-06-16 21:38:40 Result: file /var/lib/slocate/slocate.db not found -2020-06-16 21:38:40 Result: file /var/cache/locate/locatedb not found -2020-06-16 21:38:40 Result: file /var/db/locate.database not found -2020-06-16 21:38:40 ==== -``` - -### Diving deeper - -Many of Lynis' suggestions are not as straightforward as this one. If you aren't sure what a finding or a suggestion refers to, it can be difficult to know how to fix the problem. Suppose you run Lynis against a new Linux server, and there are several items pertaining to the secure shell (SSH) daemon, one of which refers to the `MaxAuthTries` setting: - - -``` -* Consider hardening SSH configuration [SSH-7408] -    - Details  : MaxAuthTries (6 --> 3) -      -``` - -To resolve this, you need to know the location of the SSH configuration files. A seasoned Linux administrator may already know where to find them, but if you don't, there is a way to see where Lynis found them. - -#### Locate Lynis test scripts - -Lynis supports many operating systems; therefore, your installation location might vary. On a Red Hat Enterprise Linux or Fedora Linux system, use `rpm` to find the test files: - - -``` -`# rpm -ql lynis` -``` - -This lists all the test files and reports their location in the `lynis/include` directory. Search this directory for the TEST-ID you want to know about (SSH-7408 in this case): - - -``` -# grep SSH-7408 /usr/share/lynis/include/* -/usr/share/lynis/include/tests_ssh:    # Test        : SSH-7408 -``` - -#### Find SSH issues - -The file named `tests_ssh` contains the TEST-ID, and this is where you can find the scan functions related to SSH. Take a look at this file to see the various functions called by the Lynis scanner. The first section defines a list of directories in a variable called `SSH_DAEMON_CONFIG_LOCS`. The following few sections are responsible for checking the SSH daemon status, locating its configuration file, and identifying its version. I found the code that looks for the configuration file in the section for Test SSH-7404, described as "Determine SSH daemon configuration file location". This code contains a **`for`** loop that searches the items in the list for a file called `sshd_config`. I can use this logic to do my own search: - - -``` -# find /etc /etc/ssh /usr/local/etc/ssh /opt/csw/etc/ssh -name sshd_config -/etc/ssh/sshd_config -/etc/ssh/sshd_config -find: ‘/usr/local/etc/ssh’: No such file or directory -find: ‘/opt/csw/etc/ssh’: No such file or directory -``` - -Further exploring this file reveals the code related to finding SSH-7408. This test covers `MaxAuthTries` and several other settings. Now I can find the variable in the SSH configuration file: - - -``` -# grep MaxAuthTries /etc/ssh/sshd_config -#MaxAuthTries 6 -``` - -#### Fix legal banner problems - -Lynis also reported a finding pertaining to the legal banners shown when you log into a system. On my home desktop system (where I don't expect many other people to log in), I haven't bothered to change the default `issue` files. A corporate or government system is likely required to include a legal banner to warn users that their logins and activity may be recorded and monitored. Lynis reports this with tests BANN-7126 and BANN-7130: - - -``` -* Add a legal banner to /etc/issue, to warn unauthorized users [BANN-7126] -      - -* Add legal banner to /etc/issue.net, to warn unauthorized users [BANN-7130] -      -``` - -I don't find much on my system running Fedora 32 Workstation: - - -``` -# cat /etc/issue /etc/issue.net -\S -Kernel \r on an \m (\l) - -\S -Kernel \r on an \m (\l) -``` - -I could add something like "Keep out" or "Don't break anything," but the test's description doesn't provide enough information to resolve the issue, so I took another look at the Lynis scripts. I noticed that the `include` directory contained a file called `tests_banners`; this seemed like a good place to look. With some help from `grep`, I saw the associated tests: - - -``` -# grep -E 'BANN-7126|BANN-7130' /usr/share/lynis/include/tests_banners -    # Test        : BANN-7126 -    Register --test-no BANN-7126 --preqs-met ${PREQS_MET} --weight L --network NO --category security --description "Check issue banner file contents" -    # Test        : BANN-7130 -    Register --test-no BANN-7130 --preqs-met ${PREQS_MET} --weight L --network NO --category security --description "Check issue.net banner file contents" -``` - -After examining the associated code in the file for the test, I found out that both of these tests are iterating through some predefined legal terms with a `for` loop: - - -``` -`for ITEM in ${LEGAL_BANNER_STRINGS}; do` -``` - -These legal terms are stored in the variable `LEGAL_BANNER_STRINGS` defined at the top of the file. Scrolling back to the top shows the full list: - - -``` -`LEGAL_BANNER_STRINGS="audit access authori condition connect consent continu criminal enforce evidence forbidden intrusion law legal legislat log monitor owner penal policy policies privacy private prohibited record restricted secure subject system terms warning"` -``` - -My initial suggestions ("keep out" and "don't break anything") wouldn't have satisfied the test, because they don't contain any words from this list. - -This banner message contains several of the required words, and therefore, it will satisfy this test and prevent Lynis from reporting it: - -> Attention, by continuing to connect to this system, you consent to the owner storing a log of all activity. Unauthorized access is prohibited. - -Note that this message must be added to both `/etc/issue` and `/etc/issue.net`. - -### Making it repeatable - -You could make these edits manually, but you may instead want to consider automation. For example, there may be many settings that need to be changed, or you might need to do these edits on a regular basis on many servers. Creating a hardening script would be a great way to streamline this process. For SSH configurations, some `sed` commands in your hardening script will resolve those findings. Or, you might use an echo statement to add the legal banners: - - -``` -sed -i '/MaxAuthTries/s/#MaxAuthTries 6/MaxAuthTries 3/' /etc/ssh/sshd_config - -echo "Legal Banner" | tee -a /etc/issue /etc/issue.net -``` - -Automation enables you to create a repeatable script that can be saved and managed across your infrastructure. You could also incorporate this script in your initial server provisioning. - -### Harden your system - -This type of exercise can improve your scripting skills both by following along with existing code and by writing your own scripts. Because it is open source, Lynis makes it easy to see under the hood how your system is checked and what its reports mean. The end result will be a well-hardened system that you can show off anytime those auditors come around. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/8/linux-lynis-security - -作者:[Alan Formy-Duval][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://opensource.com/users/alanfdoss -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security-lock-password.jpg?itok=KJMdkKum (Lock) -[2]: https://opensource.com/article/20/5/linux-security-lynis -[3]: https://github.com/CISOfy/lynis diff --git a/translated/tech/20200810 How to read Lynis reports to improve Linux security.md b/translated/tech/20200810 How to read Lynis reports to improve Linux security.md new file mode 100644 index 0000000000..f6e4aec967 --- /dev/null +++ b/translated/tech/20200810 How to read Lynis reports to improve Linux security.md @@ -0,0 +1,216 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to read Lynis reports to improve Linux security) +[#]: via: (https://opensource.com/article/20/8/linux-lynis-security) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) + +如何阅读 Lynis 报告提高 Linux 安全性 +====== + +> 使用 Lynis 的扫描和报告来发现和修复 Linux 安全问题。 + +![锁定][1] + +当我读到 Gaurav Kamathe 的文章《[用 Lynis 扫描你的 Linux 安全性][2]>时,让我想起了我在美国劳工部担任系统管理员的日子。我的职责之一是保证我们的 Unix 服务器的安全。每个季度,都会有一个独立的核查员来审查我们服务器的安全状态。每次在核查员预定到达的那一天,我都会运行 Security Readiness Review(SRR),这是一个扫描工具,它使用一大套脚本来识别和报告任何安全线索。SRR 是开源的,因此我可以查看所有源码脚本及其功能。这使我能够查看代码,确定具体是什么问题,并迅速修复它发现的每个问题。 + +### 什么是 Lynis? + +[Lynis][3] 是一个开源的安全审计工具,它的工作原理和 SRR 很像,它会扫描 Linux 系统,并提供关于它发现的任何弱点的详细报告。同样和 SRR 一样,它也是由一大套脚本组成的,每个脚本都会检查一个特定的项目,例如,最小和最大密码时间要求。 + +运行 Lynis 后,你可以使用它的报告来定位每个项目的脚本,并了解 Lynis 是如何检查和报告每个问题的。你也可以使用相同的脚本代码来创建新的代码来自动解决。 + +### 如何阅读 Lynis 报告 + +由于 Gaurav 的文章介绍了 Lynis 的安装和使用,在本文中,我将展示一些如何阅读和使用其报告的例子。 + +请从运行一次审计开始: + +``` +# lynis audit system --quick +``` + +完成后,完整的报告将显示在你的屏幕上。在底部,“Suggestions” 部分列出了所有可能需要修复以更好地加固系统的项目,以及每个项目的 TEST-ID。 + +要想加固系统并减少列表的大小,请开始解决每个项目。在 “Suggestions” 部分的描述可能包含了你需要采取的全部行动。如果没有,你可以使用 `show details` 命令。 + +``` +# lynis show details TEST-ID +``` + +例如,在我的系统中,有一条建议是: + +> 找不到 `locate` 所需的数据库,运行 `updatedb` 或 `locate.updatedb` 来创建这个文件。[FILE-6410] + +看起来我只需要运行 `updatedb` 命令就行,但如果我想确定一下,我可以使用 Lynis 的 `show details` 选项。 + +``` +# lynis show details FILE-6410 +2020-06-16 20:54:33 Performing test ID FILE-6410 (Checking Locate database) +2020-06-16 20:54:33 Test: Checking locate database +2020-06-16 20:54:33 Result: file /var/lib/mlocate/mlocate.db not found +2020-06-16 20:54:33 Result: file /var/lib/locate/locatedb not found +2020-06-16 20:54:33 Result: file /var/lib/locatedb not found +2020-06-16 20:54:33 Result: file /var/lib/slocate/slocate.db not found +2020-06-16 20:54:33 Result: file /var/cache/locate/locatedb not found +2020-06-16 20:54:33 Result: file /var/db/locate.database not found +2020-06-16 20:54:33 Result: database not found +2020-06-16 20:54:33 Suggestion: The database required for 'locate' could not be found. Run 'updatedb' or 'locate.updatedb' to create this file. [test:FILE-6410] [details:-] [solution:-] +2020-06-16 20:54:33 ==== +``` + +这些细节表明 Lynis 无法找到各种文件。这个情况非常清楚。我可以运行 `updatedb` 命令,重新检查这个测试。 + +``` +# updatedb +# lynis --tests FILE-6410 +``` + +然后,重新检查细节时,会显示它发现哪个文件满足了测试: + +``` +# lynis show details FILE-6410 +2020-06-16 21:38:40 Performing test ID FILE-6410 (Checking Locate database) +2020-06-16 21:38:40 Test: Checking locate database +2020-06-16 21:38:40 Result: locate database found (/var/lib/mlocate/mlocate.db) +2020-06-16 21:38:40 Result: file /var/lib/locate/locatedb not found +2020-06-16 21:38:40 Result: file /var/lib/locatedb not found +2020-06-16 21:38:40 Result: file /var/lib/slocate/slocate.db not found +2020-06-16 21:38:40 Result: file /var/cache/locate/locatedb not found +2020-06-16 21:38:40 Result: file /var/db/locate.database not found +2020-06-16 21:38:40 ==== +``` + +### 深入挖掘 + +Lynis 的许多建议并不像这个建议那样直接。如果你不确定某个发现或建议指的是什么,就很难知道如何解决问题。假设你在一个新的 Linux 服务器上运行 Lynis,有几项与 SSH 守护进程有关的内容,其中一项是关于 `MaxAuthTries` 的设置: + +``` +* Consider hardening SSH configuration [SSH-7408] +    - Details  : MaxAuthTries (6 --> 3) +      +``` + +要解决这个问题,你需要知道 SSH 配置文件的位置。一个经验丰富的 Linux 管理员可能已经知道在哪里找到它们,但如果你不知道,有一个方法可以看到 Lynis 在哪里找到它们。 + +#### 定位 Lynis 测试脚本 + +Lynis 支持多种操作系统,因此你的安装位置可能有所不同。在 Red Hat Enterprise Linux 或 Fedora Linux 系统中,使用 `rpm` 命令来查找测试文件: + +``` +# rpm -ql lynis +``` + +这将列出所有测试文件,并报告它们在 `lynis/include` 目录下的位置。在这个目录下搜索你想知道的 TEST-ID(本例中为 SSH-7408): + +``` +# grep SSH-7408 /usr/share/lynis/include/* +/usr/share/lynis/include/tests_ssh:    # Test        : SSH-7408 +``` + +#### 查找 SSH 问题 + +名为 `tests_ssh` 的文件中包含了 TEST-ID,在这里可以找到与 SSH 相关的扫描函数。看看这个文件,就可以看到 Lynis 扫描器调用的各种函数。第一部分在一个名为 `SSH_DAEMON_CONFIG_LOCS` 的变量中定义了一个目录列表。下面几节负责检查 SSH 守护进程的状态、定位它的配置文件,并识别它的版本。我在 SSH-7404 测试中找到了查找配置文件的代码,描述为 “确定 SSH 守护进程配置文件位置”。这段代码包含一个 `for` 循环,在列表中的项目中搜索一个名为 `sshd_config` 的文件。我可以用这个逻辑来做自己的搜索: + +``` +# find /etc /etc/ssh /usr/local/etc/ssh /opt/csw/etc/ssh -name sshd_config +/etc/ssh/sshd_config +/etc/ssh/sshd_config +find: ‘/usr/local/etc/ssh’: No such file or directory +find: ‘/opt/csw/etc/ssh’: No such file or directory +``` + +进一步探索这个文件,就会发现寻找 SSH-7408 的相关代码。这个测试涵盖了 `MaxAuthTries` 和其他一些设置。现在我可以在 SSH 配置文件中找到该变量: + +``` +# grep MaxAuthTries /etc/ssh/sshd_config +#MaxAuthTries 6 +``` + +#### 修复法律横幅问题 + +Lynis 还报告了一个与登录系统时显示的法律横幅有关的发现。在我的家庭桌面系统上(我不希望有很多其他人登录),我没有去改变默认的 `issue` 文件。企业或政府的系统很可能被要求包含一个法律横幅,以警告用户他们的登录和活动可能被记录和监控。Lynis 用 BANN-7126 测试和 BANN-7130 测试报告了这一点: + +``` +* Add a legal banner to /etc/issue, to warn unauthorized users [BANN-7126] + https://cisofy.com/lynis/controls/BANN-7126/ + +* Add legal banner to /etc/issue.net, to warn unauthorized users [BANN-7130] + https://cisofy.com/lynis/controls/BANN-7130/ +``` + +我在运行 Fedora 32 工作站的系统上没有发现什么: + +``` +# cat /etc/issue /etc/issue.net +\S +Kernel \r on an \m (\l) + +\S +Kernel \r on an \m (\l) +``` + +我可以添加一些诸如 “keep out” 或 “don't break anything” 之类的内容,但测试的描述并没有提供足够的信息来解决这个问题,所以我又看了看 Lynis 的脚本。我注意到 `include` 目录下有一个叫 `tests_banners` 的文件;这似乎是一个很好的地方。在 `grep` 的帮助下,我看到了相关的测试: + +``` +# grep -E 'BANN-7126|BANN-7130' /usr/share/lynis/include/tests_banners +    # Test        : BANN-7126 +    Register --test-no BANN-7126 --preqs-met ${PREQS_MET} --weight L --network NO --category security --description "Check issue banner file contents" +    # Test        : BANN-7130 +    Register --test-no BANN-7130 --preqs-met ${PREQS_MET} --weight L --network NO --category security --description "Check issue.net banner file contents" +``` + +在检查了测试文件中的相关代码后,我发现这两个测试都是通过一个 `for` 循环来迭代一些预定义的法律术语: + +``` +for ITEM in ${LEGAL_BANNER_STRINGS}; do +``` + +这些法律术语存储在文件顶部定义的变量 `LEGAL_BANNER_STRINGS` 中。向后滚动到顶部可以看到完整的清单:” + +``` +LEGAL_BANNER_STRINGS="audit access authori condition connect consent continu criminal enforce evidence forbidden intrusion law legal legislat log monitor owner penal policy policies privacy private prohibited record restricted secure subject system terms warning" +``` + +我最初的建议(“keep out” 或 “don't break anything”)不会满足这个测试,因为它们不包含这个列表中的任何单词。 + +下面这条横幅信息包含了几个必要的词,因此,它将满足这个测试,并防止 Lynis 报告它: + +> Attention, by continuing to connect to this system, you consent to the owner storing a log of all activity. Unauthorized access is prohibited. + +请注意,这条信息必须被添加到 `/etc/issue` 和 `/etc/issue.net` 中。 + +### 使其可重复 + +你可以手动进行这些编辑,但你可能要考虑自动化。例如,可能有许多设置需要更改,或者你可能需要在许多服务器上定期进行这些编辑。创建一个加固脚本将是简化这个过程的好方法。对于 SSH 配置,在你的加固脚本中的一些 `sed` 命令可以解决这些发现。或者,你可以使用 `echo` 语句来添加合法的横幅。 + +``` +sed -i '/MaxAuthTries/s/#MaxAuthTries 6/MaxAuthTries 3/' /etc/ssh/sshd_config + +echo "Legal Banner" | tee -a /etc/issue /etc/issue.net +``` + +自动化使你能够创建一个可重复的脚本,可以在你的基础设施中保存和管理。你也可以在你的初始服务器配置中加入这个脚本。 + +### 加固你的系统 + +这种类型的练习可以提高你的脚本技能,既可以跟着现有的代码走,也可以写自己的脚本。因为 Lynis 是开源的,所以你可以很容易地看到你的系统是如何被检查的,以及它的报告意味着什么。最终的结果将是一个完善的系统,你可以在审计人员来的时候随时向他们炫耀。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/linux-lynis-security + +作者:[Alan Formy-Duval][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://opensource.com/users/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security-lock-password.jpg?itok=KJMdkKum (Lock) +[2]: https://opensource.com/article/20/5/linux-security-lynis +[3]: https://github.com/CISOfy/lynis From 48831df29ece6d6097d49264ded14e340b703bea Mon Sep 17 00:00:00 2001 From: "Xiaobin.Liu" Date: Mon, 28 Sep 2020 23:49:59 +0800 Subject: [PATCH 0243/1156] TSL --- ...ate Fast and Resource-Friendly Websites.md | 214 ------------------ ...ate Fast and Resource-Friendly Websites.md | 214 ++++++++++++++++++ 2 files changed, 214 insertions(+), 214 deletions(-) delete mode 100644 sources/tech/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md create mode 100644 translated/tech/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md diff --git a/sources/tech/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md b/sources/tech/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md deleted file mode 100644 index 5eef590b3a..0000000000 --- a/sources/tech/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md +++ /dev/null @@ -1,214 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lxbwolf) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites) -[#]: via: (https://itsfoss.com/open-source-static-site-generators/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites -====== - -_**Brief: Looking to deploy a static web-page? No need to fiddle with HTML and CSS. These open source static website generators will help you deploy beautiful, functional static websites in no time.**_ - -### What is a static website? - -Technically, a static website means the webpages are not generated on the server dynamically. The HTML, CSS, JavaScript lie on the server in the version the end user receives it. The raw source code files are already prebuilt, the source code doesn’t change with the next server request. - -It’s FOSS is a dynamic website which depends on several databases and the web pages are generated and served when there’s a request from your browser. Majority of the web is powered by dynamic sites where you interact with the websites and there are plenty of content that often change. - -Static websites give you a few benefits like faster loading times, less server resource requirements, and better security (debatable?). - -Traditionally, static websites are more suitable for creating small websites with only a few pages and where the content doesn’t change too often. - -This, however, is changing thanks to static website generator tools and you can use them to create blogs as well. - -I have compiled a list of open source static site generators that can help you build a beautiful website. - -### Best Open Source Static Site Generators - -It’s worth noting that you will not get complex functionality on a static website. In that case, you might want to check out our list of [best open source CMS][1] for dynamic websites. - -#### 1\. Jekyll - -![][2] - -Jekyll is one of the most popular open source static generator built using [Ruby][3]. In fact, Jekyll is the engine behind [GitHub pages][4] which lets you host websites using GitHub for free. - -Setting up Jekyll is easy across multiple platforms which includes Ubuntu as well. It utilizes [Markdown][5], [Liquid][5] (for template), HTML, and CSS to generate the static site files. It is also a pretty good option if you want to build a blog without advertisements or a product page to promote your tool or service. - -Also, it supports migrating your blog from popular CMSs like Ghost, WordPress, Drupal 7, and more. You get to manage permalinks, categories, pages, posts, and custom layouts, which is nice. So, even if you already have an existing website that you want to convert to a static site, Jekyll should be a perfect solution. You can learn more about it by exploring the [official documentation][6] or its [GitHub page][7]. - -[Jekyll][8] - -#### 2\. Hugo - -![][9] - -Hugo is yet another popular open source framework for building static sites. It’s built using the [Go programming language][10]. - -It is fast, simple, and reliable. You also get some advanced theming support if you need it. It also offers some useful shortcuts to help you get things done easily. No matter whether it’s a portfolio site or a blog, Hugo is capable enough to manage a variety of content types. - -To get started, you can follow its [official documentation][11] or go through its [GitHub page][12] to install it and learn more about its usage. You can also deploy Hugo on GitHub pages or any CDN if required. - -[Hugo][13] - -#### 3\. Hexo - -![][14] - -Hexo is an interesting open-source framework powered by [Node.js][15]. Similar to others, you will end up creating blazing fast websites but you will also get a good collection of themes and plugins. - -You do get a powerful API here to extend functionality as per your requirements as well. If you already have a website, you can simply use its [Migrator][16] extension as well. - -To get started, you can go through the [official documentation][17] or just explore their [GitHub page][18]. - -[Hexo][19] - -#### 4\. Gatsby - -![][20] - -Gatsby is an increasingly open-source popular site generator framework. It utilizes [React.js][21] for creating fast and beautiful websites. - -I was quite interested to give this a try for some experimental projects a few years back and it is impressive to see the availability thousands of new plugins and themes. Unlike other static site generators, you can use Gatsby to generate a site and get the benefits of static sites without losing any features. - -It offers a lot of useful integrations from popular services. Of course, you can keep it simple or use it coupled with a popular CMS of your choice, which should be interesting. You can take a look at their [official documentation][22] and its [GitHub page][23] to find out more on it. - -[Gatsby][24] - -#### 5\. VuePress - -![][25] - -VuePress is a static site generator powered by [Vue.js][26] which happens to be an open-source progressive JavaScript framework. - -If you know HTML, CSS, and JavaScript, you can easily get started using VuePress. You should find several useful plugins and themes to get a head start on building your site. Also, it seems like Vue.js is being actively improved and has the attention of more developers, which is a good thing. - -You can learn more about it through their [official guide][27] and the [GitHub page][28]. - -[VuePress][29] - -#### 6\. Nuxt.js - -![][30] - -Nuxt.js utilizes Vue.js and Node.js but it focuses on providing modularity and has the ability to rely on the server-side instead of the client-side. Not just that, it aims to provide an intuitive experience to the developers with descriptive errors, and detailed documentations among other things. - -As it claims, Nuxt.js should be the best of both world with all of its features and flexibility that you get to build a static website. They also offer a [Nuxt Online sandbox][31] to let you directly test it without a lot of effort. - -You can explore its [GitHub page][32] or visit the [official][33] [][33][site][33] to get more details. - -#### 7\. Docusaurus - -![][34] - -Docusaurus is an interesting open-source static site generator tailored for building documentation websites. It happens to be a part of [Facebook’s open source initiative][35]. - -It is built using React. You get all the essential features like document versioning, document search, and translation mostly pre-configured. If you’re planning to build a documentation website for any of your products/services, this should be a good start. - -You can learn more about it on its [GitHub page][36] and its [official website][37]. - -[Docusaurus][37] - -#### 8\. Eleventy - -![][38] - -Eleventy describes itself as an alternative to Jekyll and aims for a simpler approach to make faster static websites. - -It seems easy to get started and it also offers proper documentation to help you out. If you want a simple static site generator that gets the job done, Eleventy seems to be an interesting choice. - -You can explore more about it on its [GitHub page][39] and visit the [official website][40] for more details. - -[Eleventy][40] - -#### 9\. Publii - -![][41] - -Publii is an impressive open-source CMS that makes it easy to generate a static site. It’s built using [Electron][42] and Vue.js. You can also migrate your posts from a WordPress site if needed. In addition to that, it offers several one-click synchronizations with GitHub Pages, Netlify, and similar services. - -You also get a WYSIWYG editor if you utilize Publii to generate a static site. To get started, visit the [official website][43] to download it or explore its [GitHub page][44] for more information. - -[Publii][43] - -#### 10\. Primo - -![][45] - -An interesting open-source static site generator which is still in active development. Even though it’s not a full-fledged solution with all the features compared to other static generators, it is a unique project. - -Primo aims to help you build and develop a site using a visual builder which can be easily edited and deployed to any host of your choice. - -You can visit the [official website][46] or explore its [GitHub page][47] for more information. - -[Primo][46] - -### Wrapping Up - -There are a lot of other site generators available out there. However, I’ve tried to mention the best static generators that gives you the fastest loading times, the best security, and an impressive flexibility. - -Did I miss any of your favorites? Let me know in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/open-source-static-site-generators/ - -作者:[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/open-source-cms/ -[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/01/jekyll-screenshot.jpg?resize=800%2C450&ssl=1 -[3]: https://www.ruby-lang.org/en/ -[4]: https://pages.github.com/ -[5]: https://github.com/Shopify/liquid/wiki -[6]: https://jekyllrb.com/docs/ -[7]: https://github.com/jekyll/jekyll -[8]: https://jekyllrb.com/ -[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/hugo.jpg?resize=800%2C414&ssl=1 -[10]: https://golang.org/ -[11]: https://gohugo.io/getting-started/ -[12]: https://github.com/gohugoio/hugo -[13]: https://gohugo.io/ -[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/hexo.jpg?resize=800%2C213&ssl=1 -[15]: https://nodejs.org/en/ -[16]: https://hexo.io/api/migrator.html -[17]: https://hexo.io/docs/ -[18]: https://github.com/hexojs/hexo -[19]: https://hexo.io/ -[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/gatsbyjs.png?resize=800%2C388&ssl=1 -[21]: https://reactjs.org/ -[22]: https://www.gatsbyjs.com/docs/ -[23]: https://github.com/gatsbyjs/gatsby -[24]: https://www.gatsbyjs.com/ -[25]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/VuePress.jpg?resize=800%2C498&ssl=1 -[26]: https://vuejs.org/ -[27]: https://vuepress.vuejs.org/guide/ -[28]: https://github.com/vuejs/vuepress -[29]: https://vuepress.vuejs.org/ -[30]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/nuxtjs.jpg?resize=800%2C415&ssl=1 -[31]: https://template.nuxtjs.org/ -[32]: https://github.com/nuxt/nuxt.js -[33]: https://nuxtjs.org/ -[34]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/docusaurus.jpg?resize=800%2C278&ssl=1 -[35]: https://opensource.facebook.com/ -[36]: https://github.com/facebook/docusaurus -[37]: https://docusaurus.io/ -[38]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/eleventy.png?resize=800%2C375&ssl=1 -[39]: https://github.com/11ty/eleventy/ -[40]: https://www.11ty.dev/ -[41]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/publii.jpg?resize=800%2C311&ssl=1 -[42]: https://www.electronjs.org -[43]: https://getpublii.com/ -[44]: https://github.com/GetPublii/Publii -[45]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/primo-af.jpg?resize=800%2C394&ssl=1 -[46]: https://primo.af/ -[47]: https://github.com/primo-app/primo-desktop diff --git a/translated/tech/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md b/translated/tech/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md new file mode 100644 index 0000000000..662ea7beec --- /dev/null +++ b/translated/tech/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md @@ -0,0 +1,214 @@ +[#]: collector: "lujun9972" +[#]: translator: "lxbwolf" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites" +[#]: via: "https://itsfoss.com/open-source-static-site-generators/" +[#]: author: "Ankush Das https://itsfoss.com/author/ankush/" + +10 个用来创建快速和资源友好网站的静态网站生成工具 +====== + +_**摘要:在寻找部署静态网页的方法吗?这几个开源的静态网站生成工具可以帮你迅速部署界面优美、功能强大的静态网站,无需掌握复杂的 HTML 和 CSS 技能。**_ + +### 静态网站是什么? + +技术上来讲,一个静态网站的网页不是由服务器动态生成的。HTML、CSS 和 JavaScript 文件就静静地躺在服务器的某个路径下,它们的内容与终端用户接收到时看到的是一样的。源码文件已经提前编译好了,源码在每次请求后都不会变化。 + +It’s FOSS 是一个依赖多个数据库的动态网站,网页是在你的浏览器发出请求时即时生成和服务的。大部分网站是动态的,你与这些网站互动时,会有大量的内容在变化。 + +静态网站有一些好处,比如加载时间更短,请求的服务器资源更少,更安全(有争议?)。 + +传统意义上,静态网站更适合于创建只有少量网页、内容变化不频繁的小网站。 + +然而,当静态网站生成工具出现后,静态网站的适用范围越来越大。你还可以使用这些工具搭建博客网站。 + +我列出了几个开源的静态网站生成工具,这些工具可以帮你搭建界面优美的网站。 + +### 最好的开源静态网站生成工具 + +请注意,静态网站不会提供很复杂的功能。如果你需要复杂的功能,那么你可以参考适用于动态网站的[最好的开源 CMS][1]列表 + +#### 1\. Jekyll + +![][2] + +Jekyll 是用 [Ruby][3] 写的最受欢迎的开源静态生成工具之一。实际上,Jekyll 是 [GitHub 页面][4] 的引擎,它可以让你免费用 GitHub 维护自己的网站。 + +你可以很轻松地跨平台配置 Jekyll,包括 Ubuntu。它利用 [Markdown][5]、[Liquid][5](模板语言)、HTML 和 CSS 来生成静态的网页文件。如果你要搭建一个没有广告或推广自己工具或服务的产品页的博客网站,它是个不错的选择。 + +它还支持从常见的 CMS(内容管理系统Content management system)如 Ghost、WordPress、Drupal 7 迁移你的博客。你可以管理永久链接、类别、页面、文章,还可以自定义布局,这些功能都很强大。因此,即使你已经有了一个网站,如果你想转成静态网站,Jekyll 会是一个完美的解决方案。你可以参考[官方文档][6]或 [GitHub 页面][7]了解更多内容。 + +[Jekyll][8] + +#### 2\. Hugo + +![][9] + +Hugo 是另一个很受欢迎的用于搭建静态网站的开源框架。它是用 [Go 语言][10]写的。 + +它运行速度快,使用简单,可靠性高。如果你需要,它也可以提供更高级的主题。它还提供了能提高你效率的实用快捷键。无论是组合展示网站还是博客网站,Hogo 都有能力管理大量的内容类型。 + +如果你想使用 Hugo,你可以参照它的[官方文档][11]或它的 [GitHub 页面][12]来安装以及了解更多相关的使用方法。你还可以用 Hugo 在 GitHub 页面或 CDN(如果有需要)部署网站。 + +[Hugo][13] + +#### 3\. Hexo + +![][14] + +Hexo 基于 [Node.js][15] 的一个有趣的开源框架。像其他的工具一样,你可以用它搭建相当快速的网站,不仅如此,它还提供了丰富的主题和插件。 + +它还根据用户的每个需求提供了强大的 API 来扩展功能。如果你已经有一个网站,你可以用它的[迁移][16]扩展轻松完成迁移工作。 + +你可以参照[官方文档][17]或 [GitHub 页面][18] 来使用 Hexo。 + +[Hexo][19] + +#### 4\. Gatsby + +![][20] + +Gatsby 是一个不断发展的流行开源网站生成框架。它使用 [React.js][21] 来生成快速、界面优美的网站。 + +几年前在一个实验性的项目中,我曾经非常想尝试一下这个工具,它提供的成千上万的新插件和主题的能力让我印象深刻。与其他静态网站生成工具不同的是,你可以用 Gatsby 在不损失任何功能的前提下来生成静态网站。 + +它提供了与很多流行的服务的整合功能。当然,你可以不使用它的复杂的功能,或选择一个流行的 CMS 与它配合使用,这也会很有趣。你可以查看他们的[官方文档][22]或它的 [GitHub 页面][23]了解更多内容。 + +[Gatsby][24] + +#### 5\. VuePress + +![][25] + +VuePress 是基于 [Vue.js][26] 的静态网站生成工具,同时也是开源的渐进式 JavaScript 框架。 + +如果你了解 HTML、CSS 和 JavaScript,那么你可以无压力地使用 VuePress。如果你想在搭建网站时抢先别人一步,那么你应该找几个有用的插件和主题。此外,看起来 Vue.js 更新地一直很活跃,很多开发者都在关注 Vue.js,这是一件好事。 + +你可以参照他们的[官方文档][27]和 [GitHub 页面][28]了解更多。 + +[VuePress][29] + +#### 6\. Nuxt.js + +![][30] + +Nuxt.js 使用 Vue.js 和 Node.js,但它致力于模块化,并且有能力依赖服务端而非客户端。不仅如此,它还志在通过描述详尽的错误和其他方面更详细的文档来为开发者提供直观的体验。 + +正如它声称的那样,在你用来搭建静态网站的所有工具中,Nuxt.js 在功能和灵活性两个方面都是佼佼者。他们还提供了一个 [Nuxt 线上沙盒][31]让你直接测试。 + +你可以查看它的 [GitHub 页面][32]和[官方网站][33]了解更多。 + +#### 7\. Docusaurus + +![][34] + +Docusaurus 是一个为搭建文档类网站量身定制的有趣的开源静态网站生成工具。它还是 [Facebook 开源计划][35]的一个项目。 + +Docusaurus 是用 React 构建的。你可以使用所有必要的功能,像文档版本管理、文档搜索,还有大部分已经预先配置好的翻译。如果你想为你的产品或服务搭建一个文档网站,那么可以试试 Docusaurus。 + +你可以从它的 [GitHub 页面][36]和它的[官网][37]获取更多信息。 + +[Docusaurus][37] + +#### 8\. Eleventy + +![][38] + +Eleventy 自称是 Jekyll 的替代品,志在为创建更快的静态网站提供更简单的方式。 + +使用 Eleventy 看起来很简单,它也提供了能解决你的问题的文档。如果你想找一个简单的静态网站生成工具,Eleventy 似乎会是一个有趣的选择。 + +你可以参照它的 [GitHub 页面][39]和[官网][40]来了解更多的细节。 + +[Eleventy][40] + +#### 9\. Publii + +![][41] + +Publii 是一个令人印象深刻的开源 CMS,它能使生成一个静态网站变得很容易。它是用 [Electron][42] 和 Vue.js 构建的。如果有需要,你也可以把你的文章从 WorkPress 网站迁移过来。此外,它还提供了与 GitHub 页面、Netlify 及其它类似服务的一键同步功能。 + +利用 Publii 生成的静态网站,自带所见即所得编辑器。你可以从[官网][43]下载它,或者从它的 [GitHub 页面][44]了解更多信息。 + +[Publii][43] + +#### 10\. Primo + +![][45] + +一个有趣的开源静态网站生成工具,目前开发工作仍很活跃。虽然与其他的静态生成工具相比,它还不是一个成熟的解决方案,有些功能还不完善,但它是一个独一无二的项目。 + +Primo 志在使用可视化的构建器帮你构建和搭建网站,这样你就可以轻松编辑和部署到任意主机上。 + +你可以参照[官网][46]或查看它的 [GitHub 页面][47]了解更多信息。 + +[Primo][46] + +### 结语 + +还有很多文章中没有列出的网站生成工具。然而,我已经尽力写出了能提供最快的加载速度、最好的安全性和令人印象最深刻的灵活性的最好的静态生成工具了。 + +列表中没有你最喜欢的工具?在下面的评论中告诉我。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/open-source-static-site-generators/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[校对者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/open-source-cms/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/01/jekyll-screenshot.jpg?resize=800%2C450&ssl=1 +[3]: https://www.ruby-lang.org/en/ +[4]: https://pages.github.com/ +[5]: https://github.com/Shopify/liquid/wiki +[6]: https://jekyllrb.com/docs/ +[7]: https://github.com/jekyll/jekyll +[8]: https://jekyllrb.com/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/hugo.jpg?resize=800%2C414&ssl=1 +[10]: https://golang.org/ +[11]: https://gohugo.io/getting-started/ +[12]: https://github.com/gohugoio/hugo +[13]: https://gohugo.io/ +[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/hexo.jpg?resize=800%2C213&ssl=1 +[15]: https://nodejs.org/en/ +[16]: https://hexo.io/api/migrator.html +[17]: https://hexo.io/docs/ +[18]: https://github.com/hexojs/hexo +[19]: https://hexo.io/ +[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/gatsbyjs.png?resize=800%2C388&ssl=1 +[21]: https://reactjs.org/ +[22]: https://www.gatsbyjs.com/docs/ +[23]: https://github.com/gatsbyjs/gatsby +[24]: https://www.gatsbyjs.com/ +[25]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/VuePress.jpg?resize=800%2C498&ssl=1 +[26]: https://vuejs.org/ +[27]: https://vuepress.vuejs.org/guide/ +[28]: https://github.com/vuejs/vuepress +[29]: https://vuepress.vuejs.org/ +[30]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/nuxtjs.jpg?resize=800%2C415&ssl=1 +[31]: https://template.nuxtjs.org/ +[32]: https://github.com/nuxt/nuxt.js +[33]: https://nuxtjs.org/ +[34]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/docusaurus.jpg?resize=800%2C278&ssl=1 +[35]: https://opensource.facebook.com/ +[36]: https://github.com/facebook/docusaurus +[37]: https://docusaurus.io/ +[38]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/eleventy.png?resize=800%2C375&ssl=1 +[39]: https://github.com/11ty/eleventy/ +[40]: https://www.11ty.dev/ +[41]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/publii.jpg?resize=800%2C311&ssl=1 +[42]: https://www.electronjs.org +[43]: https://getpublii.com/ +[44]: https://github.com/GetPublii/Publii +[45]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/primo-af.jpg?resize=800%2C394&ssl=1 +[46]: https://primo.af/ +[47]: https://github.com/primo-app/primo-desktop From a5f0e2ce93a174844987f4037c07ab8405c922fc Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 29 Sep 2020 05:01:53 +0800 Subject: [PATCH 0244/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200929?= =?UTF-8?q?=20Drawing=20is=20an=20Open=20Source=20MS-Paint=20Type=20of=20A?= =?UTF-8?q?pp=20for=20Linux=20Desktop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md --- ... MS-Paint Type of App for Linux Desktop.md | 119 ++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 sources/tech/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md diff --git a/sources/tech/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md b/sources/tech/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md new file mode 100644 index 0000000000..32754d3a03 --- /dev/null +++ b/sources/tech/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md @@ -0,0 +1,119 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Drawing is an Open Source MS-Paint Type of App for Linux Desktop) +[#]: via: (https://itsfoss.com/drawing-app/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Drawing is an Open Source MS-Paint Type of App for Linux Desktop +====== + +_**Brief: Drawing is a basic image editor like Microsoft Paint. With this open source application, you can draw arrows, lines, geometrical shapes, add colors and other stuff you expect to do in a regular drawing application.**_ + +### Drawing: A simple drawing application for Linux + +![][1] + +For people introduced to computers with Windows XP (or earlier version), MS Paint was an amusing application from sketching random stuff. In a world dominated with Photoshop and GIMP, the paint applications still hold some relevance. + +There are several [painting applications available for Linux][2], and I am going to add one more to this list. + +The app is unsurprisingly called [Drawing][3] and you can use it on both Linux desktop and Linux smartphones. + +### Features of Drawing app + +![][4] + +Drawing has all the features you expect from a drawing application. You can + + * Create new drawings from scratch + * Edit an existing image in PNG, JPEG or BMP file + * Add geometrical shapes, lines, arrows etc + * Dashed + * Use pencil tool for free-hand drawing + * Use curve and shape tool + * Crop images + * Scale images to different pixel size + * Add text + * Select part of image (rectangle, freehand and color selection) + * Rotate images + * Add images copied to clipboard + * Eraser, Highlighter, Paint, Color Selection, Color Picker tools are available in preferences + * Unlimited undo + * Filters to add blur, pixelisation, transparency etc + + + +### My experience with Drawing + +![][5] + +The application is new and has a decent user interface. It comes with all the basic features you expect to find in a standard paint app. + +It has some additional tools like color selection and color picker but it might be confusing to use them. There is no documentation available to describe the use of these tools to you are on your own here. + +The experience is smooth and I feel that this tool has good potential to replace Shutter as image editing tool (yes, I [use Shutter for editing screenshots][6]). + +The thing that I find most bothersome is that it is not possible to edit/modify an element after adding it. You have the undo and redo options but if you want to modify a text you added 12 steps back, you’ll have to redo all the steps. This is something the developer may look into it in the future releases. + +### Installing Drawing on Linux + +This is a Linux exclusive app. It is also available for Linux-based smartphones like [PinePhone][7]. + +There are various ways you can install Drawing app. It is available in the repositories of many major Linux distributions. + +#### Ubuntu-based distributions + +Drawing is included in the universe repository in Ubuntu. Which means you can install it from the Ubuntu Software Center. + +However, if you want the latest version, there is a [PPA available][8] for easily installing Drawing on Ubuntu. Linux Mint and other Ubuntu-based distributions. + +Use the following command: + +``` +sudo add-apt-repository ppa:cartes/drawing +sudo apt update +sudo apt install drawing +``` + +If you want to remove it, you can use the following commands: + +``` +sudo apt remove drawing +sudo add-apt-repository -r ppa:cartes/drawing +``` + +#### Other Linux distributions + +Check your distribution’s package manager for Drawing and install it from there. If you want the latest version, you may use the Flatpak version of the app. + +[Drawing Flatpak][9] + +**Conclusion** + +Do you still use a paint application? Which one do you use? If you have tried Drawing app already, how is your experience with it? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/drawing-app/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/drawing-app-interface.jpg?resize=789%2C449&ssl=1 +[2]: https://itsfoss.com/open-source-paint-apps/ +[3]: https://maoschanz.github.io/drawing/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/drawing-screenshot.jpg?resize=800%2C489&ssl=1 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/using-drawing-app-linux.png?resize=787%2C473&ssl=1 +[6]: https://itsfoss.com/install-shutter-ubuntu/ +[7]: https://itsfoss.com/pinephone/ +[8]: https://launchpad.net/~cartes/+archive/ubuntu/drawing +[9]: https://flathub.org/apps/details/com.github.maoschanz.drawing From 2b1e6d020ac1f3f6e8458a8f0360856c28435e94 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 29 Sep 2020 05:02:11 +0800 Subject: [PATCH 0245/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200928?= =?UTF-8?q?=20Create=20template=20files=20in=20GNOME?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200928 Create template files in GNOME.md --- ...20200928 Create template files in GNOME.md | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 sources/tech/20200928 Create template files in GNOME.md diff --git a/sources/tech/20200928 Create template files in GNOME.md b/sources/tech/20200928 Create template files in GNOME.md new file mode 100644 index 0000000000..8abc834b88 --- /dev/null +++ b/sources/tech/20200928 Create template files in GNOME.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Create template files in GNOME) +[#]: via: (https://opensource.com/article/20/9/gnome-templates) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) + +Create template files in GNOME +====== +Make boilerplates so you can get started on a new document faster. +![Digital images of a computer desktop][1] + +I just stumbled onto a new (to me) feature of the [GNOME][2] desktop that enables you to create a document template. A template is generally an empty shell of a document with certain things configured and is often referred to as boilerplate. An example might be a letterhead for a law firm, with its corporate title and address at the top. Another might be a bank or insurance carrier letter that contains certain disclaimers in the footer at the bottom of the document. Since this sort of information rarely changes, you can add it to an empty document to use as a template. + +I was browsing through files on my Linux system one day and clicked on the **Templates** directory. I just happened to notice a message at the top of the window that stated, "Put files in this folder to use them as templates for new documents." There was also a link to **Learn more…** that opens the [GNOME help][3] for templates. + +![Message at top of Templates folder in GNOME Desktop][4] + +(Alan Formy-Duval, [CC BY-SA 4.0][5]) + +### Create a template + +Creating a template for the GNOME desktop is quite simple. There are several ways you can place a file into this folder: You can copy or move a file from another location through either the graphical user interface (GUI) or the command-line interface (CLI), or you can create an entirely new file. I chose the latter; actually, I created two files. + +![My first two GNOME templates][6] + +(Alan Formy-Duval, [CC BY-SA 4.0][5]) + +The first template I created is for an Opensource.com article. It provides a place to enter a title and several lines for my name and the license terms under which I am providing the content of the article. I use the Markdown document format for my articles, so I create the template as a new Markdown document—**Opensource.com Article.md**: + + +``` +# Title     +``` +An article for Opensource.com +by: Alan Formy-Duval +Creative Commons BY-SA 4.0 +``` + +``` + +I saved this document as a file in `/home/alan/Templates`. Now GNOME recognizes this file as a template and suggests it whenever I want to create a new document. + +### Use a template + +Whenever I get a spark or epiphany for a new article, I can just right-click in the folder where I plan to organize my content and select the template from the **New Document** list. + +![Select the template by name][7] + +(Alan Formy-Duval, [CC BY-SA 4.0][5]) + +You can make a template for all sorts of documents or files. I am writing this article using a template I created for my Opensource.com articles. Programmers might use templates for software code; perhaps you want a template that just contains `main()`. + +The GNOME desktop environment provides a very useful, feature-rich user interface for users of Linux and related operating systems. What are your favorite GNOME desktop features, and how do you use them? Please share in the comments! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/gnome-templates + +作者:[Alan Formy-Duval][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://opensource.com/users/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_desk_home_laptop_browser.png?itok=Y3UVpY0l (Digital images of a computer desktop) +[2]: https://www.gnome.org/ +[3]: https://help.gnome.org/users/gnome-help/stable/files-templates.html.en +[4]: https://opensource.com/sites/default/files/uploads/gnome-message_at_top_border.png (Message at top of Templates folder in GNOME Desktop) +[5]: https://creativecommons.org/licenses/by-sa/4.0/ +[6]: https://opensource.com/sites/default/files/uploads/gnome-first_two_templates_border.png (My first two GNOME templates) +[7]: https://opensource.com/sites/default/files/uploads/gnome-new_document_menu_border.png (Select the template by name) From 593116a08cb5ac590612374dfb1c9b85af32d4fd Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 29 Sep 2020 05:02:24 +0800 Subject: [PATCH 0246/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200928?= =?UTF-8?q?=20Add=20sound=20to=20your=20Python=20game?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200928 Add sound to your Python game.md --- .../20200928 Add sound to your Python game.md | 166 ++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 sources/tech/20200928 Add sound to your Python game.md diff --git a/sources/tech/20200928 Add sound to your Python game.md b/sources/tech/20200928 Add sound to your Python game.md new file mode 100644 index 0000000000..93a495dd50 --- /dev/null +++ b/sources/tech/20200928 Add sound to your Python game.md @@ -0,0 +1,166 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Add sound to your Python game) +[#]: via: (https://opensource.com/article/20/9/add-sound-python-game) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Add sound to your Python game +====== +Hear what happens when your hero fights, jumps, collects loot, and more +by adding sounds to your game. Learn how in the 13th article in this +series on creating a platformer in Pygame. +![Colorful sound wave graph][1] + +This is part 13 in an ongoing series about creating video games in [Python 3][2] using the [Pygame][3] module. Previous articles are: + + 1. [Learn how to program in Python by building a simple dice game][4] + 2. [Build a game framework with Python using the Pygame module][5] + 3. [How to add a player to your Python game][6] + 4. [Using Pygame to move your game character around][7] + 5. [What's a hero without a villain? How to add one to your Python game][8] + 6. [Add platforms to your game][9] + 7. [Simulate gravity in your Python game][10] + 8. [Add jumping to your Python platformer game][11] + 9. [Enable your Python game player to run forward and backward][12] + 10. [Using Python to set up loot in Pygame][13] + 11. [Add scorekeeping to your Python game][14] + 12. [Add throwing mechanics to your Python game][15] + + + +Pygame provides an easy way to integrate sounds into your Python video game. Pygame's [mixer module][16] can play one or more sounds on command, and by mixing those sounds together, you can have, for instance, background music playing at the same time you hear the sounds of your hero collecting loot or jumping over enemies. + +It is easy to integrate the mixer module into an existing game, so—rather than giving you code samples showing you exactly where to put them—this article explains the four steps required to get sound in your application. + +### Start the mixer + +First, in your code's setup section, start the mixer process. Your code already starts Pygame and Pygame fonts, so grouping it together with these is a good idea: + + +``` +pygame.init() +pygame.font.init() +pygame.mixer.init() # add this line +``` + +### Define the sounds + +Next, you must define the sounds you want to use. This requires that you have the sounds on your computer, just as using fonts requires you to have fonts, and using graphics requires you to have graphics. + +You also must bundle those sounds with your game so that anyone playing your game has the sound files. + +To bundle a sound with your game, first create a new directory in your game folder, right along with the directory you created for your images and fonts. Call it `sound`: + + +``` +`s = 'sound'` +``` + +Even though there are plenty of sounds on the internet, it's not necessarily _legal_ to download them and give them away with your game. It seems strange because so many sounds from famous video games are such a part of popular culture, but that's how the law works. If you want to ship a sound with your game, you must find an open source or [Creative Commons][17] sound that gives you permission to give the sound away with your game. + +There are several sites that specialize in free and legal sounds, including: + + * [Freesound][18] hosts sound effects of all sorts. + * [Incompetech][19] hosts background music. + * [Open Game Art][20] hosts some sound effects and music. + + + +Some sound files are free to use only if you give the composer or sound designer credit. Read the conditions of use carefully before bundling any with your game! Musicians and sound designers work just as hard on their sounds as you work on your code, so it's nice to give them credit even when they don't require it. + +To give your sound sources credit, list the sounds that you use in a text file called `CREDIT`, and place the text file in your game folder. + +You might also try making your own music. The excellent [LMMS][21] audio workstation is easy to use and ships with lots of interesting sounds. It's available on all major platforms and exports to [Ogg Vorbis][22] (OGG) audio format. + +### Add sound to Pygame + +When you find a sound that you like, download it. If it comes in a ZIP or TAR file, extract it and move the sounds into the `sound` folder in your game directory. + +If the sound file has a complicated name with spaces or special characters, rename it. The filename is completely arbitrary, and the simpler it is, the easier it is for you to type into your code. + +Most video games use OGG sound files because the format provides high quality in small file sizes. When you download a sound file, it might be an MP3, WAVE, FLAC, or another audio format. To keep your compatibility high and your download size low, convert these to Ogg Vorbis with a tool like [fre:ac][23] or [Miro][24]. + +For example, assume you have downloaded a sound file called `ouch.ogg`. + +In your code's setup section, create a variable representing the sound file you want to use: + + +``` +`ouch = pygame.mixer.Sound(os.path.join(s, 'ouch.ogg'))` +``` + +### Trigger a sound + +To use a sound, all you have to do is call the variable when you want to trigger it. For instance, to trigger the `OUCH` sound effect when your player hits an enemy: + + +``` +for enemy in enemy_hit_list: +    pygame.mixer.Sound.play(ouch) +    score -= 1 +``` + +You can create sounds for all kinds of actions, such as jumping, collecting loot, throwing, colliding, and whatever else you can imagine. + +### Add background music + +If you have music or atmospheric sound effects you want to play in your game's background, you can use the `music` function of Pygame's mixer module. In your setup section, load the music file: + + +``` +`music = pygame.mixer.music.load(os.path.join(s, 'music.ogg'))` +``` + +And start the music: + + +``` +`pygame.mixer.music.play(-1)` +``` + +The `-1` value tells Pygame to loop the music file infinitely. You can set it to anything from `0` and beyond to define how many times the music should loop before stopping. + +### Enjoy the soundscapes + +Music and sound can add a lot of flavor to your game. Try adding some to your Pygame project! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/add-sound-python-game + +作者:[Seth Kenlon][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://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/colorful_sound_wave.png?itok=jlUJG0bM (Colorful sound wave graph) +[2]: https://www.python.org/ +[3]: https://www.pygame.org/news +[4]: https://opensource.com/article/17/10/python-101 +[5]: https://opensource.com/article/17/12/game-framework-python +[6]: https://opensource.com/article/17/12/game-python-add-a-player +[7]: https://opensource.com/article/17/12/game-python-moving-player +[8]: https://opensource.com/article/18/5/pygame-enemy +[9]: https://opensource.com/article/18/7/put-platforms-python-game +[10]: https://opensource.com/article/19/11/simulate-gravity-python +[11]: https://opensource.com/article/19/12/jumping-python-platformer-game +[12]: https://opensource.com/article/19/12/python-platformer-game-run +[13]: https://opensource.com/article/19/12/loot-python-platformer-game +[14]: https://opensource.com/article/20/1/add-scorekeeping-your-python-game +[15]: https://opensource.com/article/20/9/add-throwing-python-game +[16]: https://www.pygame.org/docs/ref/mixer.html +[17]: https://opensource.com/article/20/1/what-creative-commons +[18]: https://freesound.org +[19]: https://incompetech.filmmusic.io +[20]: https://opengameart.org +[21]: https://opensource.com/life/16/2/linux-multimedia-studio +[22]: https://en.wikipedia.org/wiki/Vorbis +[23]: https://www.freac.org/index.php/en/downloads-mainmenu-330 +[24]: http://getmiro.com From 8ce774201099f710f699906d84be42dff8860445 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 29 Sep 2020 05:02:36 +0800 Subject: [PATCH 0247/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200928?= =?UTF-8?q?=205=20ways=20to=20conduct=20user=20research=20with=20an=20open?= =?UTF-8?q?=20source=20mindset?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200928 5 ways to conduct user research with an open source mindset.md --- ...er research with an open source mindset.md | 117 ++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 sources/tech/20200928 5 ways to conduct user research with an open source mindset.md diff --git a/sources/tech/20200928 5 ways to conduct user research with an open source mindset.md b/sources/tech/20200928 5 ways to conduct user research with an open source mindset.md new file mode 100644 index 0000000000..c2072cccc3 --- /dev/null +++ b/sources/tech/20200928 5 ways to conduct user research with an open source mindset.md @@ -0,0 +1,117 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 ways to conduct user research with an open source mindset) +[#]: via: (https://opensource.com/article/20/9/open-source-user-research) +[#]: author: (Alana Fialkoff https://opensource.com/users/alana) + +5 ways to conduct user research with an open source mindset +====== +See how this team elevates their user research experiences and results +with an open source approach. +![Mobile devices are a big part of our daily lives][1] + +There are common beliefs about user experiences—the best ones are user-centered, iterative, and intuitive. When user experience (UX) research is conducted, user stories about these experiences are collected—but the research methods chosen inform user experiences, too. + +So, what makes for an engaging research experience, and how can methods evolve alongside products to better connect with users? + +[Red Hat's User Experience Design (UXD) research team][2] has the answer: a community-centered, open source mindset.  + +As a UX writer on Red Hat's UXD team, I create new design documentation, empower team voices, and share Red Hat's open source story. My passion lies in using content to connect and inspire others. On our [Twitter][3] and [Medium][4] channels, we share thought leadership about UX writing, research, development, and design, all to amplify and grow our open source community. This community is at the heart of what we do. So when I learned how the research team centers community throughout their user testing, I leaped at the chance to tell their story. + +### Approaching research with an open source mindset + +Red Hat's UXD team creates in the open, and this ideology applies to their research, too. Thinking the open source way involves adopting a community-first and community-driven frame of mind. New ideas can come from anywhere, and an open source mindset embraces these varied voices and perspectives. + +Structuring research with an open source mindset means each research technique should be driven by two angles—we don't just want to learn about our users; we want to learn from them, too. + +To satisfy both of these user-focused objectives, we make research decisions backed by other voices, not just our own. By sourcing input from beyond our team, we design research experiences that are truly tailored to the communities we serve. + +Guiding questions help us streamline this process. Some questions the team's researchers use to develop their methods include: + + * Does this method amplify user voices? + * Are we facilitating open communication with our users? + * Does this method build a meaningful connection with our user base? + * What kind of experience does this technique build? Is it memorable? Engaging? + + + +Notice a trend? Each question hinges on community. + +### Building research experiences like user experiences + +Researchers approach their UX research as a user experience, too. We want our research sessions to have the same qualities as our user interfaces: + + * Memorable + * Engaging + * Intuitive + * User-centered + + + +Research offers in-depth engagement with our user base, so it's important to tailor our techniques to that community. When we conduct user research, we learn more about how our users engage with our products and use that knowledge to improve them. We can use that same process to shape future research sessions. + +Open source, user-centered research—sounds great. But how can we actually achieve it? + +Let's take a look at five collaborative techniques we use to design more immersive user research experiences the open source way. + +### Evolve research methods to build engaging experiences and strong connections + +Tailor research methods to the target audience, with a goal to create a connective experience. The tools at our disposal vary largely depending on our venue (in-person vs. virtual), so this approach lets us get creative. + + * **Add dimension**: Are you conducting a survey? Consider appealing your users' senses offscreen. We've expanded our research to the third dimension using strings, LEGOs, and card diagrams to collect data in more tactile ways. + * **Streamline**: Are your research methods efficient and time-conscious? There's only one way to find out. Follow up with users about their experience post-session. If they say a survey or form was cumbersome, consider condensing your longer questions into smaller, more digestible ones. + * **Simplify**: Use what you know about your user base to customize your techniques. A busy community working in enterprise IT, for example, might only have time to fill out a brief form. Structure your methods so that they're navigable and intuitive for your specific audience. + + + +### Guide research with research + +Contextualize questions around user's needs. Explore their goals. Identify their cares, difficulties, and thoughts on product performance. Use these findings to design more meaningful research sessions, and check in often. As our products evolve with our users, our research methods do, too. + +### Keep an open mind + +Work with the community to disprove our own assumptions. Lean into the spirit of open source by engaging with others across the team, company, user base, and industry. Use these communities like a sounding board for ideas and welcome their feedback. Community-centered conversations take place in environments like: + + * Team meetings and brainstorms + * Company calls and research shares + * Conferences and industry panels + * Internal and external blogging platforms + * Other thought leadership forums + + + +This means speaking at monthly meetings, messaging across team channels, and presenting ideas at annual thought leadership events, where a multitude of voices meet from across the industry to share their experience and expertise. + +### Communicate, communicate, communicate + +With an open source mindset comes open communication. Spark meaningful conversations with users and keep those channels open beyond formal research sessions. Community-driven research techniques start with just that: community. Invest in a strong connection with users to invite deeper insights and facilitate more impactful sessions. + +### Experiment with new research techniques and take a user-centered, UX approach + +Prototype. Test. Iterate. Repeat. The methods will morph as the open source approach takes shape. + +That's the magic of conducting research in the open: dynamic change, driven by a deeper connection to the community. + +Learn more about how Red Hat's UXD team conducts research by checking out [DevConf.US][5], where individuals across the open source community come together to talk all things tech, open source, and UX. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/open-source-user-research + +作者:[Alana Fialkoff][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://opensource.com/users/alana +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/mobile-demo-device-phone.png?itok=y9cHLI_F (Mobile devices are a big part of our daily lives) +[2]: https://medium.com/patternfly/from-interviewers-to-interviewees-meet-red-hats-ux-research-team-af860a65abc5 +[3]: https://twitter.com/RedHatUXD +[4]: https://medium.com/patternfly +[5]: https://www.devconf.info/us/ From 5c53ee0b67cb59c8ee06acfea73ef8996099a430 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 29 Sep 2020 05:03:04 +0800 Subject: [PATCH 0248/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200928?= =?UTF-8?q?=20How=20to=20view=20information=20on=20your=20Linux=20devices?= =?UTF-8?q?=20with=20lshw?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200928 How to view information on your Linux devices with lshw.md --- ...rmation on your Linux devices with lshw.md | 266 ++++++++++++++++++ 1 file changed, 266 insertions(+) create mode 100644 sources/tech/20200928 How to view information on your Linux devices with lshw.md diff --git a/sources/tech/20200928 How to view information on your Linux devices with lshw.md b/sources/tech/20200928 How to view information on your Linux devices with lshw.md new file mode 100644 index 0000000000..33dc95f480 --- /dev/null +++ b/sources/tech/20200928 How to view information on your Linux devices with lshw.md @@ -0,0 +1,266 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to view information on your Linux devices with lshw) +[#]: via: (https://www.networkworld.com/article/3583598/how-to-view-information-on-your-linux-devices-with-lshw.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +How to view information on your Linux devices with lshw +====== +The lshw (list hardware) command on Linux systems provides a lot more information on system devices than most of us might imagine is available. +Kali Linux / nevarpp / Getty Images + +While far from being one of the first 50 Linux commands anyone learns, the **lshw** command (read as “ls hardware”) can provide a lot of useful details on your system’s hardware. + +It extracts details—maybe quite a few more than you knew were available—in a format that is reasonably easy to digest. Given descriptions, logical (device) names, sizes, etc., you are likely to appreciate how much detail you can access. + +This post examines the information that **lshw** provides with a particular focus on disk and related hardware. Here is some sample **lshw** output: + +``` +$ sudo lshw -C disk + *-disk:0 + description: SCSI Disk + product: Card Reader-1 + vendor: JIE LI + physical id: 0.0.0 + bus info: scsi@4:0.0.0 + logical name: /dev/sdc + version: 1.00 + capabilities: removable + configuration: logicalsectorsize=512 sectorsize=512 + *-medium + physical id: 0 + logical name: /dev/sdc +``` + +Note that you should run the **lshw** command with **sudo** to ensure that you get all of the available details. + +While we asked for “disk” in the above command (the output included shows only the first of five entries displayed), this particular output shows not a hard disk, but a card reader—another member of the disk class. Note that the system knows this device as **/dev/sdc**. + +Similar details are provided on the primary disk on the system: + +``` +*-disk + description: ATA Disk + product: SSD2SC120G1CS175 + physical id: 0 + bus info: scsi@0:0.0.0 + logical name: /dev/sda <== + version: 1101 + serial: PNY20150000778410606 + size: 111GiB (120GB) + capabilities: partitioned partitioned:dos + configuration: ansiversion=5 logicalsectorsize=512 sectorsize=512 signature= + f63b5929 +``` + +This disk is **/dev/sda**. The hard disks on this system both show up as **ATA** disks. **ATA** is a disk-drive implementation that integrates the controller on the disk drive itself. + +To get an abbreviated list of devices in the “disk” class, you can run a command like this one. Notice that two of the devices are listed twice, so we are still seeing five disk devices. + +``` +$ sudo lshw -short -C disk +H/W path Device Class Description +============================================================= +/0/100/1d/1/1/0.0.0 /dev/sdc disk Card Reader-1 +/0/100/1d/1/1/0.0.0/0 /dev/sdc disk +/0/100/1d/1/1/0.0.1 /dev/sdd disk 2 +/0/100/1d/1/1/0.0.1/0 /dev/sdd disk +/0/100/1f.2/0 /dev/sda disk 120GB SSD2SC120G1CS175 +/0/100/1f.2/1 /dev/cdrom disk DVD+-RW GSA-H73N +/0/100/1f.5/0.0.0 /dev/sdb disk 500GB SAMSUNG HE502HJ +``` + +Hold onto your seat if you decide you want to see _**all**_ of the devices on a system. You will get a list that includes a lot more things than you probably normally think of as “devices”. Here’s an example—and this is the “short” (few details) list: + +``` +$ sudo lshw -short +[sudo] password for shs: +H/W path Device Class Description +============================================================= + system Inspiron 530s +/0 bus 0RY007 +/0/0 memory 128KiB BIOS +/0/4 processor Intel(R) Core(TM)2 Duo CPU +/0/4/a memory 32KiB L1 cache +/0/4/b memory 6MiB L2 cache +/0/24 memory 6GiB System Memory +/0/24/0 memory 2GiB DIMM DDR2 Synchronous 667 +/0/24/1 memory 1GiB DIMM DDR2 Synchronous 667 +/0/24/2 memory 2GiB DIMM DDR2 Synchronous 667 +/0/24/3 memory 1GiB DIMM DDR2 Synchronous 667 +/0/1 generic +/0/10 generic +/0/11 generic +/0/12 generic +/0/13 generic +/0/14 generic +/0/15 generic +/0/17 generic +/0/18 generic +/0/19 generic +/0/2 generic +/0/20 generic +/0/100 bridge 82G33/G31/P35/P31 Express DRAM +/0/100/1 bridge 82G33/G31/P35/P31 Express PCI +/0/100/1/0 display Caicos [Radeon HD 6450/7450/84 +/0/100/1/0.1 multimedia Caicos HDMI Audio [Radeon HD 6 +/0/100/19 enp0s25 network 82562V-2 10/100 Network Connec +/0/100/1a bus 82801I (ICH9 Family) USB UHCI +/0/100/1a/1 usb3 bus UHCI Host Controller +/0/100/1a.1 bus 82801I (ICH9 Family) USB UHCI +/0/100/1a.1/1 usb4 bus UHCI Host Controller +/0/100/1a.1/1/2 input Rock Candy Wireless Keyboard +/0/100/1a.2 bus 82801I (ICH9 Family) USB UHCI +/0/100/1a.2/1 usb5 bus UHCI Host Controller +/0/100/1a.2/1/2 input USB OPTICAL MOUSE +/0/100/1a.7 bus 82801I (ICH9 Family) USB2 EHCI +/0/100/1a.7/1 usb1 bus EHCI Host Controller +/0/100/1b multimedia 82801I (ICH9 Family) HD Audio +/0/100/1d bus 82801I (ICH9 Family) USB UHCI +/0/100/1d/1 usb6 bus UHCI Host Controller +/0/100/1d/1/1 scsi4 storage CD04 +/0/100/1d/1/1/0.0.0 /dev/sdc disk Card Reader-1 +/0/100/1d/1/1/0.0.0/0 /dev/sdc disk +/0/100/1d/1/1/0.0.1 /dev/sdd disk 2 +/0/100/1d/1/1/0.0.1/0 /dev/sdd disk +/0/100/1d.1 bus 82801I (ICH9 Family) USB UHCI +/0/100/1d.1/1 usb7 bus UHCI Host Controller +/0/100/1d.2 bus 82801I (ICH9 Family) USB UHCI +/0/100/1d.2/1 usb8 bus UHCI Host Controller +/0/100/1d.7 bus 82801I (ICH9 Family) USB2 EHCI +/0/100/1d.7/1 usb2 bus EHCI Host Controller +/0/100/1d.7/1/2 multimedia USB Live camera +/0/100/1e bridge 82801 PCI Bridge +/0/100/1e/1 communication HSF 56k Data/Fax Modem +/0/100/1f bridge 82801IR (ICH9R) LPC Interface +/0/100/1f.2 scsi0 storage 82801IR/IO/IH (ICH9R/DO/DH) 4 +/0/100/1f.2/0 /dev/sda disk 120GB SSD2SC120G1CS175 +/0/100/1f.2/0/1 /dev/sda1 volume 111GiB EXT4 volume +/0/100/1f.2/1 /dev/cdrom disk DVD+-RW GSA-H73N +/0/100/1f.3 bus 82801I (ICH9 Family) SMBus Con +/0/100/1f.5 scsi3 storage 82801I (ICH9 Family) 2 port SA +/0/100/1f.5/0.0.0 /dev/sdb disk 500GB SAMSUNG HE502HJ +/0/100/1f.5/0.0.0/1 /dev/sdb1 volume 433GiB EXT4 volume +/0/3 system PnP device PNP0c02 +/0/5 system PnP device PNP0b00 +/0/6 storage PnP device PNP0700 +/0/7 system PnP device PNP0c02 +/0/8 system PnP device PNP0c02 +/0/9 system PnP device PNP0c01 +``` + +Run a command like this to list device classes and count how many devices are in each class. + +``` +$ sudo lshw -short | awk ‘{print substr($0,36,13)}’ | tail -n +3 | sort | uniq -c + 4 bridge + 18 bus + 1 communication + 7 disk + 1 display + 12 generic + 2 input + 8 memory + 3 multimedia + 1 network + 1 processor + 4 storage + 6 system + 2 volume +``` + +**NOTE:** The **awk** command selects the Class column from the **lshw** output using $0 (complete lines), but taking only the substrings that start in the correct place (column 36). None of the class entries have more than 13 letters so the substring ends there. The **tail -n +3** part of the command drops the heading and the “=====” line beneath it, so only the 14 device classes are included in the final listing. + +One thing you’ll notice is that we get approximately 12 lines of output for each device in the disk class when we don’t use the **-short** option. We see the logical names, such as **/dev/sda**, disk sizes and types, etc. + +``` +$ sudo lshw -C disk +[sudo] password for shs: + *-disk:0 + description: SCSI Disk + product: Card Reader-1  card reader? + vendor: JIE LI + physical id: 0.0.0 + bus info: scsi@4:0.0.0 + logical name: /dev/sdc + version: 1.00 + capabilities: removable + configuration: logicalsectorsize=512 sectorsize=512 + *-medium + physical id: 0 + logical name: /dev/sdc + *-disk:1 + description: SCSI Disk + product: 2 + vendor: AC4100 - + physical id: 0.0.1 + bus info: scsi@4:0.0.1 + logical name: /dev/sdd + capabilities: removable + configuration: logicalsectorsize=512 sectorsize=512 + *-medium + physical id: 0 + logical name: /dev/sdd + *-disk + description: ATA Disk + product: SSD2SC120G1CS175 + physical id: 0 + bus info: scsi@0:0.0.0 + logical name: /dev/sda  main system disk + version: 1101 + serial: PNY20150000778410606 + size: 111GiB (120GB) + capabilities: partitioned partitioned:dos + configuration: ansiversion=5 logicalsectorsize=512 sectorsize=512 signature=f63b5929 + *-cdrom  aka /dev/sr0 + description: DVD writer + product: DVD+-RW GSA-H73N + vendor: HL-DT-ST + physical id: 1 + bus info: scsi@1:0.0.0 + logical name: /dev/cdrom + logical name: /dev/cdrw + logical name: /dev/dvd + logical name: /dev/dvdrw + logical name: /dev/sr0 + version: B103 + serial: [ + capabilities: removable audio cd-r cd-rw dvd dvd-r + configuration: ansiversion=5 status=nodisc + *-disk + description: ATA Disk + product: SAMSUNG HE502HJ + physical id: 0.0.0 + bus info: scsi@3:0.0.0 + logical name: /dev/sdb  secondary disk + version: 0002 + serial: S2B6J90B501053 + size: 465GiB (500GB) + capabilities: partitioned partitioned:dos + configuration: ansiversion=5 logicalsectorsize=512 sectorsize=512 signature=7e67ccf3 +``` + +### Wrap-up + +The **lshw** command provides details that many of us won’t normally deal with. Still, it’s nice to know how much information is available even if you only use a portion of it. + +Join the Network World communities on [Facebook][1] and [LinkedIn][2] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3583598/how-to-view-information-on-your-linux-devices-with-lshw.html + +作者:[Sandra Henry-Stocker][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://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.facebook.com/NetworkWorld/ +[2]: https://www.linkedin.com/company/network-world From 4bf85535f22dac1b194f2bb1e54d46ee33215714 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 29 Sep 2020 08:37:23 +0800 Subject: [PATCH 0249/1156] translated --- ...ling and running Vagrant using qemu-kvm.md | 140 ------------------ ...ling and running Vagrant using qemu-kvm.md | 140 ++++++++++++++++++ 2 files changed, 140 insertions(+), 140 deletions(-) delete mode 100644 sources/tech/20200921 Installing and running Vagrant using qemu-kvm.md create mode 100644 translated/tech/20200921 Installing and running Vagrant using qemu-kvm.md diff --git a/sources/tech/20200921 Installing and running Vagrant using qemu-kvm.md b/sources/tech/20200921 Installing and running Vagrant using qemu-kvm.md deleted file mode 100644 index 307c85c599..0000000000 --- a/sources/tech/20200921 Installing and running Vagrant using qemu-kvm.md +++ /dev/null @@ -1,140 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Installing and running Vagrant using qemu-kvm) -[#]: via: (https://fedoramagazine.org/vagrant-qemukvm-fedora-devops-sysadmin/) -[#]: author: (Andy Mott https://fedoramagazine.org/author/amott/) - -Installing and running Vagrant using qemu-kvm -====== - -![][1] - -Vagrant is a brilliant tool, used by DevOps professionals, coders, sysadmins and regular geeks to stand up repeatable infrastructure for development and testing. From their website: - -> Vagrant is a tool for building and managing virtual machine environments in a single workflow. With an easy-to-use workflow and focus on automation, Vagrant lowers development environment setup time, increases production parity, and makes the “works on my machine” excuse a relic of the past. -> -> If you are already familiar with the basics of Vagrant, the documentation provides a better reference build for all available features and internals. -> -> Vagrant provides easy to configure, reproducible, and portable work environments built on top of industry-standard technology and controlled by a single consistent workflow to help maximize the productivity and flexibility of you and your team. -> -> - -This guide will walk through the steps necessary to get Vagrant working on a Fedora-based machine. - -I started with a minimal install of Fedora Server as this reduces the memory footprint of the host OS, but if you already have a working Fedora machine, either Server or Workstation, then this should still work. - -### Check the machine supports virtualisation: - -``` -$ sudo lscpu | grep Virtualization -Virtualization: VT-x -Virtualization type: full -``` - -### Install qemu-kvm: - -``` -sudo dnf install qemu-kvm libvirt libguestfs-tools virt-install rsync -``` - -### Enable and start the libvirt daemon: - -``` -sudo systemctl enable --now libvirtd -``` - -### Install Vagrant: - -``` -sudo dnf install vagrant -``` - -### Install the Vagrant libvirtd plugin: - -``` -sudo vagrant plugin install vagrant-libvirt -``` - -### Add a box - -``` -vagrant box add fedora/32-cloud-base --provider=libvirt -``` - -### Create a minimal Vagrantfile to test - -``` -$ mkdir vagrant-test -$ cd vagrant-test -$ vi VagrantfileVagrant.configure("2") do |config| - config.vm.box = "fedora/32-cloud-base" -end -``` - -**Note the capitalisation of the file name and in the file itself.** - -### Check the file: - -``` -vagrant statusCurrent machine states: - -default not created (libvirt) - -The Libvirt domain is not created. Run 'vagrant up' to create it. -``` - -### Start the box: - -``` -vagrant up -``` - -### Connect to your new machine: - -``` -vagrant ssh -``` - -That’s it – you now have Vagrant working on your Fedora machine. - -To stop the machine, use _vagrant halt_. This simply halts the machine but leaves the VM and disk in place. -To shut it down and delete it use _vagrant destroy_. This will remove the whole machine and any changes you’ve made in it. - -### Next steps - -You don’t need to download boxes before issuing the _vagrant up_ command – you can specify the box and the provider in the Vagrantfile directly and Vagrant will download it if it’s not already there. Below is an example which also sets the amount memory and number of CPUs: - -``` -# -*- mode: ruby -*- -# vi: set ft=ruby : - -Vagrant.configure("2") do |config| - config.vm.box = "fedora/32-cloud-base" - config.vm.provider :libvirt do |libvirt| - libvirt.cpus = 1 - libvirt.memory = 1024 - end -end -``` - -For more information on using Vagrant, creating your own machines and using different boxes, see the official documentation at - -There is a huge repository of boxes ready to download and use, and the official location for these is Vagrant Cloud – . Some are basic operating systems and some offer complete functionality such as databases, web servers etc. - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/vagrant-qemukvm-fedora-devops-sysadmin/ - -作者:[Andy Mott][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/amott/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2020/09/vagrant-beginner-howto-816x346.png diff --git a/translated/tech/20200921 Installing and running Vagrant using qemu-kvm.md b/translated/tech/20200921 Installing and running Vagrant using qemu-kvm.md new file mode 100644 index 0000000000..8704427db0 --- /dev/null +++ b/translated/tech/20200921 Installing and running Vagrant using qemu-kvm.md @@ -0,0 +1,140 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Installing and running Vagrant using qemu-kvm) +[#]: via: (https://fedoramagazine.org/vagrant-qemukvm-fedora-devops-sysadmin/) +[#]: author: (Andy Mott https://fedoramagazine.org/author/amott/) + +使用 qemu-kvm 安装和运行 Vagrant +====== + +![][1] + +Vagrant 是一个出色的工具,被 DevOps 专业人员、程序员、系统管理员和普通极客来使用它来建立可复制的基础架构来进行开发和测试。来自它们的网站: + +> Vagrant 是用于在单工作流程中构建和管理虚拟机环境的工具。凭借简单易用的工作流程和对自动化的关注,Vagrant 降低了开发环境的设置时间,提高了生产效率,并使”在我的机器上工作“的借口成为过去。 +> +> 如果你已经熟悉 Vagrant 的基础知识,那么文档为所有的功能和内部结构提供了更好的参考。 +> +> Vagrant 提供了易于配置、可复制、可移植的工作环境,它建立在行业标准技术之上,并由一个统一的工作流程控制,帮助你和你的团队最大限度地提高生产力和灵活性。 +> +> + +本指南将通过必要的步骤,让 Vagrant 在基于 Fedora 的机器上工作。 + +我从最小化安装 Fedora Server 开始,因为这样可以减少主机操作系统的内存占用,但如果你已经有一台可以使用的 Fedora 机器,无论是服务器还是工作站,那么也没问题。 + +### 检查机器是否支持虚拟化: + +``` +$ sudo lscpu | grep Virtualization +Virtualization: VT-x +Virtualization type: full +``` + +### 安装 qemu-kvm: + +``` +sudo dnf install qemu-kvm libvirt libguestfs-tools virt-install rsync +``` + +### 启用并启动 libvirt 守护进程: + +``` +sudo systemctl enable --now libvirtd +``` + +### 安装 Vagrant: + +``` +sudo dnf install vagrant +``` + +### 安装 Vagrant libvirtd 插件: + +``` +sudo vagrant plugin install vagrant-libvirt +``` + +### 添加一个 box + +``` +vagrant box add fedora/32-cloud-base --provider=libvirt +``` + +### 创建一个最小的 Vagrantfile 来测试: + +``` +$ mkdir vagrant-test +$ cd vagrant-test +$ vi VagrantfileVagrant.configure("2") do |config| + config.vm.box = "fedora/32-cloud-base" +end +``` + +**注意文件名和文件内容的大写。** + +### 检查文件: + +``` +vagrant statusCurrent machine states: + +default not created (libvirt) + +The Libvirt domain is not created. Run 'vagrant up' to create it. +``` + +### 启动 box: + +``` +vagrant up +``` + +### 连接到你的新机器: + +``` +vagrant ssh +``` + +完成了。现在你的 Fedora 机器上有 Vagrant 在工作。 + +要停止机器,请使用 _vagrant halt_。这只是简单地停止机器,但保留虚拟机和磁盘。 +要关闭并删除它,请使用 _vagrant destroy_。这将删除整个机器和你在其中所做的任何更改。 + +### 接下来的步骤 + +在运行 _vagrant up_ 命令之前,你不需要下载 box。你可以直接在 Vagrantfile 中指定 box 和提供者,如果还没有的话,Vagrant 会下载它。下面是一个例子,它还设置了内存量和 CPU 数量: + +``` +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + config.vm.box = "fedora/32-cloud-base" + config.vm.provider :libvirt do |libvirt| + libvirt.cpus = 1 + libvirt.memory = 1024 + end +end +``` + +关于使用 Vagrant、创建你自己的机器和使用不同 box 的更多信息,请参见官方文档 。 + +有一个庞大的仓库,你可以随时下载使用这些 box,它们的的官方仓库是 Vagrant Cloud - 。这里有些是基本的操作系统,有些提供完整的功能,如数据库、网络服务器等。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/vagrant-qemukvm-fedora-devops-sysadmin/ + +作者:[Andy Mott][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/amott/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/09/vagrant-beginner-howto-816x346.png From e3b53c55c845189c4782b99eb3104f519f9e8dd9 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 29 Sep 2020 08:46:59 +0800 Subject: [PATCH 0250/1156] translating --- ...(to Find and Kill RAM and CPU Eating Tabs and Extensions).md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md b/sources/tech/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md index 13f4fc0b28..53895df57c 100644 --- a/sources/tech/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md +++ b/sources/tech/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From ea89d46c735b0177d431a07a3666c798bbae282d Mon Sep 17 00:00:00 2001 From: "Xiaobin.Liu" Date: Tue, 29 Sep 2020 08:56:30 +0800 Subject: [PATCH 0251/1156] APL --- .../20200923 Find security issues in Go code using gosec.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200923 Find security issues in Go code using gosec.md b/sources/tech/20200923 Find security issues in Go code using gosec.md index b9fc5df16c..cd26a4379d 100644 --- a/sources/tech/20200923 Find security issues in Go code using gosec.md +++ b/sources/tech/20200923 Find security issues in Go code using gosec.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lxbwolf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 6d361229e8dced5090caed8f3f07e23cfc4d5d60 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 29 Sep 2020 09:08:40 +0800 Subject: [PATCH 0252/1156] Rename sources/tech/20200928 5 ways to conduct user research with an open source mindset.md to sources/talk/20200928 5 ways to conduct user research with an open source mindset.md --- ...5 ways to conduct user research with an open source mindset.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200928 5 ways to conduct user research with an open source mindset.md (100%) diff --git a/sources/tech/20200928 5 ways to conduct user research with an open source mindset.md b/sources/talk/20200928 5 ways to conduct user research with an open source mindset.md similarity index 100% rename from sources/tech/20200928 5 ways to conduct user research with an open source mindset.md rename to sources/talk/20200928 5 ways to conduct user research with an open source mindset.md From 5c6e766bb4fd220510de3fd095f1f7285cb12220 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 29 Sep 2020 09:49:38 +0800 Subject: [PATCH 0253/1156] PRF @geekpi --- .../20200917 What-s new with rdiff-backup.md | 50 +++++++++---------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/translated/tech/20200917 What-s new with rdiff-backup.md b/translated/tech/20200917 What-s new with rdiff-backup.md index 64c34b5f06..31b54100f1 100644 --- a/translated/tech/20200917 What-s new with rdiff-backup.md +++ b/translated/tech/20200917 What-s new with rdiff-backup.md @@ -1,34 +1,36 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (What's new with rdiff-backup?) [#]: via: (https://opensource.com/article/20/9/rdiff-backup-linux) [#]: author: (Patrik Dufresne https://opensource.com/users/patrik-dufresne) -rdiff-backup 有什么新功能? +11 年后重新打造的 rdiff-backup 2.0 有什么新功能? ====== -长期的 Linux 备份方案向 Python 3 的迁移为添加许多新功能提供了机会。 -![Hand putting a Linux file folder into a drawer][1] + +> 这个老牌 Linux 备份方案迁移到了 Python 3 提供了添加许多新功能的机会。 + +![](https://img.linux.net.cn/data/attachment/album/202009/29/094858pb9pa3sppsq9x5z1.jpg) 2020 年 3 月,[rdiff-backup][2] 升级到了 2.0 版,这距离上一个主要版本已经过去了 11 年。2020 年初 Python 2 的废弃是这次更新的动力,但它为开发团队提供了整合其他功能和优势的机会。 -大约二十年来,rdiff-backup 帮助 Linux 用户在本地或远程维护他们的数据的完整备份,而无需无谓地消耗资源。这是因为这个开源解决方案可以进行反向增量备份,只备份从上一次备份中改变的文件。 +大约二十年来,`rdiff-backup` 帮助 Linux 用户在本地或远程维护他们的数据的完整备份,而无需无谓地消耗资源。这是因为这个开源解决方案可以进行反向增量备份,只备份从上一次备份中改变的文件。 -改版(或说,重生)得益于一个新的、自组织的开发团队(由来自 [IKUS Software][3] 的 Eric Zolf 和 Patrik Dufresne 领导,以及来自 [Seravo][4]的 Otto Kekäläinen 领导)的努力,为了所有 rdiff-backup 用户的利益,他们齐心协力。 +这次改版(或者说,重生)得益于一个新的、自组织的开发团队(由来自 [IKUS Software][3] 的 Eric Zolf 和 Patrik Dufresne,以及来自 [Seravo][4] 的 Otto Kekäläinen 共同领导)的努力,为了所有 `rdiff-backup` 用户的利益,他们齐心协力。 ### rdiff-backup 的新功能 -在 Eric 的带领下,随着向 Python 3 的迁移,项目被迁移到了一个新的、不受企业限制的[仓库][5],以欢迎贡献。团队还整合了多年来提交的所有补丁,包括稀疏文件支持和硬链接的修复。 +在 Eric 的带领下,随着向 Python 3 的迁移,项目被迁移到了一个新的、不受企业限制的[仓库][5],以欢迎贡献。团队还整合了多年来提交的所有补丁,包括对稀疏文件的支持和对硬链接的修复。 #### 用 Travis CI 实现自动化 -另一个巨大的改进是增加了一个使用开源 [Travis CI][6] 的持续集成/持续交付 (CI/CD) 管道。这允许在各种环境下测试 rdiff-backup,从而确保变化不会影响方案的稳定性。CI/CD 管道包括集成所有主要平台的构建和二进制发布。 +另一个巨大的改进是增加了一个使用开源 [Travis CI][6] 的持续集成/持续交付(CI/CD)管道。这允许在各种环境下测试 `rdiff-backup`,从而确保变化不会影响方案的稳定性。CI/CD 管道包括集成所有主要平台的构建和二进制发布。 #### 使用 yum 和 apt 轻松安装 -新的 rdiff-backup 解决方案可以运行在所有主流的 Linux 发行版上,包括 Fedora、Red Hat、Elementary、Debian 等。Frank 和 Otto 付出了艰辛的努力,提供了开放仓库以方便访问和安装。你可以使用你的软件包管理器安装 rdiff-backup,或者按照 GitHub 项目页面上的[分步说明][7]进行安装。 +新的 `rdiff-backup` 解决方案可以运行在所有主流的 Linux 发行版上,包括 Fedora、Red Hat、Elementary、Debian 等。Frank 和 Otto 付出了艰辛的努力,提供了开放的仓库以方便访问和安装。你可以使用你的软件包管理器安装 `rdiff-backup`,或者按照 GitHub 项目页面上的[分步说明][7]进行安装。 #### 新的主页 @@ -36,7 +38,7 @@ rdiff-backup 有什么新功能? ### 如何使用 rdiff-backup -如果你是 rdiff-backup 的新手,你可能会对它的易用性感到惊讶。一个备份方案需要让你对备份和恢复过程感到舒适,而不是吓人。 +如果你是 `rdiff-backup` 的新手,你可能会对它的易用性感到惊讶。备份方案应该让你对备份和恢复过程感到舒适,而不是吓人。 #### 开始备份 @@ -44,61 +46,55 @@ rdiff-backup 有什么新功能? 例如,要备份到名为 `my_backup_drive` 的本地驱动器,请输入: - ``` -`$ rdiff-backup /home/tux/ /run/media/tux/my_backup_drive/` +$ rdiff-backup /home/tux/ /run/media/tux/my_backup_drive/ ``` 要将数据备份到异地存储,请使用远程服务器的位置,并在 `::` 后面指向备份驱动器的挂载点: - ``` -`$ rdiff-backup /home/tux/ tux@example.com::/my_backup_drive/` +$ rdiff-backup /home/tux/ tux@example.com::/my_backup_drive/ ``` -你可能需要[设置 SSH 密钥][8]来使这个过程不费力。 +你可能需要[设置 SSH 密钥][8]来使这个过程更轻松。 #### 还原文件 -做备份的原因是有时文件会丢失。为了使恢复尽可能简单,你甚至不需要 rdiff-backup 来恢复文件(虽然使用 `rdiff-backup` 命令提供了一些方便)。 +做备份的原因是有时文件会丢失。为了使恢复尽可能简单,你甚至不需要 `rdiff-backup` 来恢复文件(虽然使用 `rdiff-backup` 命令提供了一些方便)。 如果你需要从备份驱动器中获取一个文件,你可以使用 `cp` 将其从备份驱动器复制到本地系统,或者对于远程驱动器使用 `scp` 命令。 对于本地驱动器,使用: - ``` -`$ cp _run_media/tux/my_backup_drive/Documents/example.txt \ ~/Documents` +$ cp _run_media/tux/my_backup_drive/Documents/example.txt ~/Documents ``` 或者用于远程驱动器: - ``` -`$ scp tux@example.com::/my_backup_drive/Documents/example.txt \ ~/Documents` +$ scp tux@example.com::/my_backup_drive/Documents/example.txt ~/Documents ``` 然而,使用 `rdiff-backup` 命令提供了其他选项,包括 `--restore-as-of`。这允许你指定你要恢复的文件的哪个版本。 例如,假设你想恢复一个文件在四天前的版本: - ``` -`$ rdiff-backup --restore-as-of 4D \ /run/media/tux/foo.txt ~/foo_4D.txt` +$ rdiff-backup --restore-as-of 4D /run/media/tux/foo.txt ~/foo_4D.txt ``` 你也可以用 `rdiff-backup` 来获取最新版本: - ``` -`$ rdiff-backup --restore-as-of now \ /run/media/tux/foo.txt ~/foo_4D.txt` +$ rdiff-backup --restore-as-of now /run/media/tux/foo.txt ~/foo_4D.txt` ``` -就是这么简单。另外,rdiff-backup 还有很多其他选项,例如,你可以从列表中排除文件,从一个远程备份到另一个远程等等,这些你可以在[文档][9]中了解。 +就是这么简单。另外,`rdiff-backup` 还有很多其他选项,例如,你可以从列表中排除文件,从一个远程备份到另一个远程等等,这些你可以在[文档][9]中了解。 ### 总结 -我们的开发团队希望用户能够喜欢这个改版后的开源 rdiff-backup 方案,这是我们不断努力的结晶。我们也感谢我们的贡献者,他们真正展示了开源的力量。 +我们的开发团队希望用户能够喜欢这个改版后的开源 `rdiff-backup` 方案,这是我们不断努力的结晶。我们也感谢我们的贡献者,他们真正展示了开源的力量。 -------------------------------------------------------------------------------- @@ -107,7 +103,7 @@ via: https://opensource.com/article/20/9/rdiff-backup-linux 作者:[Patrik Dufresne][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 028dd37e32039b7d7ea9b9967d10330908f9d195 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 29 Sep 2020 09:50:17 +0800 Subject: [PATCH 0254/1156] PUB @geekpi https://linux.cn/article-12663-1.html --- .../20200917 What-s new with rdiff-backup.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200917 What-s new with rdiff-backup.md (98%) diff --git a/translated/tech/20200917 What-s new with rdiff-backup.md b/published/20200917 What-s new with rdiff-backup.md similarity index 98% rename from translated/tech/20200917 What-s new with rdiff-backup.md rename to published/20200917 What-s new with rdiff-backup.md index 31b54100f1..81cdddede3 100644 --- a/translated/tech/20200917 What-s new with rdiff-backup.md +++ b/published/20200917 What-s new with rdiff-backup.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12663-1.html) [#]: subject: (What's new with rdiff-backup?) [#]: via: (https://opensource.com/article/20/9/rdiff-backup-linux) [#]: author: (Patrik Dufresne https://opensource.com/users/patrik-dufresne) From 784655c269531baa08ecc5925d835bd3e660f822 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 29 Sep 2020 19:21:48 +0800 Subject: [PATCH 0255/1156] APL --- .../20200907 Program hardware from the Linux command line.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200907 Program hardware from the Linux command line.md b/sources/tech/20200907 Program hardware from the Linux command line.md index 5076b3025a..da2b79273d 100644 --- a/sources/tech/20200907 Program hardware from the Linux command line.md +++ b/sources/tech/20200907 Program hardware from the Linux command line.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 25638da3a349257f8a8609f5e828a327a708ff22 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 29 Sep 2020 20:29:18 +0800 Subject: [PATCH 0256/1156] TSL&PRF @wxy --- ...am hardware from the Linux command line.md | 239 ------------------ ...am hardware from the Linux command line.md | 217 ++++++++++++++++ 2 files changed, 217 insertions(+), 239 deletions(-) delete mode 100644 sources/tech/20200907 Program hardware from the Linux command line.md create mode 100644 translated/tech/20200907 Program hardware from the Linux command line.md diff --git a/sources/tech/20200907 Program hardware from the Linux command line.md b/sources/tech/20200907 Program hardware from the Linux command line.md deleted file mode 100644 index da2b79273d..0000000000 --- a/sources/tech/20200907 Program hardware from the Linux command line.md +++ /dev/null @@ -1,239 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Program hardware from the Linux command line) -[#]: via: (https://opensource.com/article/20/9/hardware-command-line) -[#]: author: (Alan Smithee https://opensource.com/users/alansmithee) - -Program hardware from the Linux command line -====== -Programming hardware has become more common thanks to the rise of the -Internet of Things (IoT). RT-Thread lets you contact devices from the -Linux command line with FinSH. -![Command line prompt][1] - -RT-Thread is an open source [real-time operating system][2] used for programming Internet of Things (IoT) devices. FinSH is [RT-Thread][3]'s command-line component, and it provides a set of operation interfaces enabling users to contact a device from the command line. It's mainly used to debug or view system information. - -Usually, development debugging is displayed using hardware debuggers and `printf` logs. In some cases, however, these two methods are not very useful because it's abstracted from what's running, and they can be difficult to parse. RT-Thread is a multi-thread system, though, which is helpful when you want to know the state of a running thread, or the current state of a manual control system. Because it's multi-threaded, you're able to have an interactive shell, so you can enter commands, call a function directly on the device to get the information you need, or control the program's behavior. This may seem ordinary to you if you're only used to modern operating systems such as Linux or BSD, but for hardware hackers this is a profound luxury, and a far cry from wiring serial cables directly onto boards to get glimpses of errors. - -FinSH has two modes: - - * A C-language interpreter mode, known as c-style - * A traditional command-line mode, known as `msh` (module shell) - - - -In the C-language interpretation mode, FinSH can parse expressions that execute most of the C language and access functions and global variables on the system using function calls. It can also create variables from the command line. - -In `msh` mode, FinSH operates similarly to traditional shells such as Bash. - -### The GNU command standard - -When we were developing FinSH, we learned that before you can write a command-line application, you need to become familiar with GNU command-line standards. This framework of standard practices helps bring familiarity to an interface, which helps developers feel comfortable and productive when using it. - -A complete GNU command consists of four main parts: - - 1. **Command name (executable):** The name of the command line program - 2. **Sub-command:** The sub-function name of the command program - 3. **Options:** Configuration options for the sub-command function - 4. **Arguments:** The corresponding arguments for the configuration options of the sub-command function - - - -You can see this in action with any command. Taking Git as an example: - - -``` -`git reset --hard HEAD~1` -``` - -Which breaks down as: - -![GNU command line standards][4] - -(Cathy, [CC BY-SA 4.0][5]) - -The executable command is **git**, the sub-command is **reset**, the option used is **\--head**, and the argument is **HEAD~1**. - -Another example: - - -``` -`systemctl enable --now firewalld` -``` - -The executable command is **systemctl**, the sub-command is **enable**, the option is **\--now**, and the argument is **firewalld**. - -Imagine you want to write a command-line program that complies with the GNU standards using RT-Thread. FinSH has everything you need, and will run your code as expected. Better still, you can rely on this compliance so you can confidently port your favorite Linux programs. - -### Write an elegant command-line program - -Here's an example of RT-Thread running a command that RT-Thread developers use every day. - - -``` -usage: env.py package [-h] [--force-update] [--update] [--list] [--wizard] -                      [--upgrade] [--printenv] - -optional arguments: -  -h, --help      show this help message and exit -  --force-update  force update and clean packages, install or remove the -                  packages by your settings in menuconfig -  --update        update packages, install or remove the packages by your -                  settings in menuconfig -  --list          list target packages -  --wizard        create a new package with wizard -  --upgrade       upgrade local packages list and ENV scripts from git repo -  --printenv      print environmental variables to check -``` - -As you can tell, it looks familiar and acts like most POSIX applications that you might already run on Linux or BSD. Help is provided when incorrect or insufficient syntax is used, both long and short options are supported, and the general user interface is familiar to anyone who's used a Unix terminal. - -### Kinds of options - -There are many different kinds of options, and they can be divided into two main categories by length: - - 1. **Short options:** Consist of one hyphen plus a single letter, e.g., the `-h` option in `pkgs -h` - 2. **Long options:** Consist of two hyphens plus words or letters, e.g., the `--target` option in `scons- --target-mdk5` - - - -You can divide these options into three categories, determined by whether they have arguments: - - 1. **No arguments:** The option cannot be followed by arguments - 2. **Arguments must be included:** The option must be followed by arguments - 3. **Arguments optional:** Arguments after the option are allowed but not required - - - -As you'd expect from most Linux commands, FinSH option parsing is pretty flexible. It can distinguish an option from an argument based on a space or equal sign as delimiter, or just by extracting the option itself and assuming that whatever follows is the argument (in other words, no delimiter at all): - - * `wavplay -v 50` - * `wavplay -v50` - * `wavplay --vol=50` - - - -### Using optparse - -If you've ever written a command-line application, you may know there's generally a library or module for your language of choice called optparse. It's provided to programmers so that options (such as **-v** or **\--verbose**) entered as part of a command can be _parsed_ in relation to the rest of the command. It's what helps your code know an option from a sub-command or argument. - -When writing a command for FinSH, the `optparse` package expects this format: - - -``` -`MSH_CMD_EXPORT_ALIAS(pkgs, pkgs, this is test cmd.);` -``` - -You can implement options using the long or short form, or both. For example: - - -``` -static struct optparse_long long_opts[] = -{ -    {"help"        , 'h', OPTPARSE_NONE}, // Long command: help, corresponding to short command h, without arguments. -    {"force-update",  0 , OPTPARSE_NONE}, // Long comman: force-update, without arguments -    {"update"      ,  0 , OPTPARSE_NONE}, -    {"list"        ,  0 , OPTPARSE_NONE}, -    {"wizard"      ,  0 , OPTPARSE_NONE}, -    {"upgrade"     ,  0 , OPTPARSE_NONE}, -    {"printenv"    ,  0 , OPTPARSE_NONE}, -    { NULL         ,  0 , OPTPARSE_NONE} -}; -``` - -After the options are created, write the command and instructions for each option and its arguments: - - -``` -static void usage(void) -{ -    rt_kprintf("usage: env.py package [-h] [--force-update] [--update] [--list] [--wizard]\n"); -    rt_kprintf("                      [--upgrade] [--printenv]\n\n"); -    rt_kprintf("optional arguments:\n"); -    rt_kprintf("  -h, --help      show this help message and exit\n"); -    rt_kprintf("  --force-update  force update and clean packages, install or remove the\n"); -    rt_kprintf("                  packages by your settings in menuconfig\n"); -    rt_kprintf("  --update        update packages, install or remove the packages by your\n"); -    rt_kprintf("                  settings in menuconfig\n"); -    rt_kprintf("  --list          list target packages\n"); -    rt_kprintf("  --wizard        create a new package with wizard\n"); -    rt_kprintf("  --upgrade       upgrade local packages list and ENV scripts from git repo\n"); -    rt_kprintf("  --printenv      print environmental variables to check\n"); -} -``` - -The next step is parsing. While you can't implement its functions yet, the framework of the parsed code is the same: - - -``` -int pkgs(int argc, char **argv) -{ -    int ch; -    int option_index; -    struct optparse options; - -    if(argc == 1) -    { -        usage(); -        return RT_EOK; -    } - -    optparse_init(&options, argv); -    while((ch = optparse_long(&options, long_opts, &option_index)) != -1) -    { -        ch = ch; - -        rt_kprintf("\n"); -        rt_kprintf("optopt = %c\n", options.optopt); -        rt_kprintf("optarg = %s\n", options.optarg); -        rt_kprintf("optind = %d\n", options.optind); -        rt_kprintf("option_index = %d\n", option_index); -    } -    rt_kprintf("\n"); - -    return RT_EOK; -} -``` - -Here is the function head file: - - -``` -#include "optparse.h" -#include "finsh.h" -``` - -Then, compile and download onto a device. - -![Output][6] - -(Cathy, [CC BY-SA 4.0][5]) - -### Hardware hacking - -Programming hardware can seem intimidating, but with IoT it's becoming more and more common. Not everything can or should be run on a Raspberry Pi, but with RT-Thread you can maintain a familiar Linux feel, thanks to FinSH. - -If you're curious about coding on bare metal, give RT-Thread a try. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/9/hardware-command-line - -作者:[Alan Smithee][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://opensource.com/users/alansmithee -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/command_line_prompt.png?itok=wbGiJ_yg (Command line prompt) -[2]: https://opensource.com/article/20/6/open-source-rtos -[3]: https://github.com/RT-Thread/rt-thread -[4]: https://opensource.com/sites/default/files/uploads/command-line-apps_2.png (GNU command line standards) -[5]: https://creativecommons.org/licenses/by-sa/4.0/ -[6]: https://opensource.com/sites/default/files/uploads/command-line-apps_3.png (Output) diff --git a/translated/tech/20200907 Program hardware from the Linux command line.md b/translated/tech/20200907 Program hardware from the Linux command line.md new file mode 100644 index 0000000000..b25e0b1d77 --- /dev/null +++ b/translated/tech/20200907 Program hardware from the Linux command line.md @@ -0,0 +1,217 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Program hardware from the Linux command line) +[#]: via: (https://opensource.com/article/20/9/hardware-command-line) +[#]: author: (Alan Smithee https://opensource.com/users/alansmithee) + +使用 RT-Thread 的 FinSH 对硬件进行编程 +====== + +> 由于物联网(IoT)的兴起,对硬件进行编程变得越来越普遍。RT-Thread 可以让你可以用 FinSH 从 Linux 命令行与设备进行沟通、 + +![命令行提示][1] + +RT-Thread 是一个开源的[实时操作系统][2],用于对物联网(IoT)设备进行编程。FinSH 是 [RT-Thread][3] 的命令行组件,它提供了一套操作界面,使用户可以从命令行与设备进行沟通。它主要用于调试或查看系统信息。 + +通常情况下,开发调试使用硬件调试器和 `printf` 日志来显示。但在某些情况下,这两种方法并不是很有用,因为它是从运行的内容中抽象出来的,而且它们可能很难解析。不过 RT-Thread 是一个多线程系统,当你想知道一个正在运行的线程的状态,或者手动控制系统的当前状态时,这很有帮助。因为它是多线程的,所以你能够拥有一个交互式的 shell,你可以直接在设备上输入命令、调用函数来获取你需要的信息,或者控制程序的行为。如果你只习惯于 Linux 或 BSD 等现代操作系统,这在你看来可能很普通,但对于硬件黑客来说,这是极其奢侈的,远超将串行电缆直接连线到电路板上以获取一丝错误的做法。 + +FinSH 有两种模式。 + + * C 语言解释器模式,称为 c-style。 + * 传统的命令行模式,称为 msh(模块 shell)。 + +在 C 语言解释器模式下,FinSH 可以解析执行大部分 C 语言的表达式,并使用函数调用访问系统上的函数和全局变量。它还可以从命令行创建变量。 + +在 msh 模式下,FinSH 的操作与 Bash 等传统 shell 类似。 + +### GNU 命令标准 + +当我们在开发 FinSH 时,我们了解到,在编写命令行应用程序之前,你需要熟悉 GNU 命令行标准。这个标准实践的框架有助于给界面带入熟悉感,这有助于开发人员在使用时感到舒适和高效。 + +一个完整的 GNU 命令主要由四个部分组成。 + + 1. 命令名(可执行文件):命令行程序的名称; + 2. 子命令:命令程序的子函数名称。 + 3. 选项:子命令函数的配置选项。 + 4. 参数:子命令函数配置选项的相应参数。 + +你可以在任何命令中看到这一点。以 Git 为例: + +``` +git reset --hard HEAD~1 +``` + +这一点可以分解为: + +![GNU command line standards][4] + +可执行的命令是 `git`,子命令是 `reset`,使用的选项是 `--head`,参数是 `HEAD~1`。 + +再举个例子: + +``` +systemctl enable --now firewalld +``` + +可执行的命令是 `systemctl`,子命令是 `enable`,选项是 `--now`,参数是 `firewalld`。 + +想象一下,你想用 RT-Thread 编写一个符合 GNU 标准的命令行程序。FinSH 拥有你所需要的一切,并且会按照预期运行你的代码。更棒的是,你可以依靠这种合规性,让你可以自信地移植你最喜欢的 Linux 程序。 + +### 编写一个优雅的命令行程序 + +下面是一个 RT-Thread 运行命令的例子,RT-Thread 开发人员每天都在使用这个命令: + +``` +usage: env.py package [-h] [--force-update] [--update] [--list] [--wizard] +                      [--upgrade] [--printenv] + +optional arguments: +  -h, --help      show this help message and exit +  --force-update  force update and clean packages, install or remove the +                  packages by your settings in menuconfig +  --update        update packages, install or remove the packages by your +                  settings in menuconfig +  --list          list target packages +  --wizard        create a new package with wizard +  --upgrade       upgrade local packages list and ENV scripts from git repo +  --printenv      print environmental variables to check +``` + +正如你所看到的那样,它看起来很熟悉,行为就像你可能已经在 Linux 或 BSD 上运行的大多数 POSIX 应用程序一样。当使用不正确或不充分的语法时,它会提供帮助,它支持长选项和短选项。这种通用的用户界面对于任何使用过 Unix 终端的人来说都是熟悉的。 + +### 选项种类 + +选项的种类很多,按长短可分为两大类。 + + 1. 短选项:由一个连字符加一个字母组成,如 `pkgs -h` 中的 `-h` 选项。 + 2. 长选项:由两个连字符加上单词或字母组成,例如,`scons- --target-mdk5` 中的 `--target` 选项。 + +你可以把这些选项分为三类,由它们是否有参数来决定。 + + 1. 没有参数:该选项后面不能有参数。 + 2. 参数必选:选项后面必须有参数。 + 3. 参数可选:选项后可以有参数,但不是必需的。 + +正如你对大多数 Linux 命令的期望,FinSH 的选项解析非常灵活。它可以根据空格或等号作为定界符来区分一个选项和一个参数,或者仅仅通过提取选项本身并假设后面的内容是参数(换句话说,完全没有定界符)。 + + * `wavplay -v 50` + * `wavplay -v50` + * `wavplay --vol=50` + +### 使用 optparse + +如果你曾经写过命令行程序,你可能会知道,一般来说,你所选择的语言有一个叫做 optparse 的库或模块。它是提供给程序员的,所以作为命令的一部分输入的选项(比如 `-v` 或 `--verbose`)可以与命令的其他部分进行*解析*。这可以帮助你的代码从一个子命令或参数中获取一个选项。 + +当为 FinSH 编写一个命令时,`optparse` 包希望使用这种格式: + +``` +MSH_CMD_EXPORT_ALIAS(pkgs, pkgs, this is test cmd.); +``` + +你可以使用长形式或短形式,或者同时使用两种形式来实现选项。例如: + +``` +static struct optparse_long long_opts[] = +{ +    {"help"        , 'h', OPTPARSE_NONE}, // Long command: help, corresponding to short command h, without arguments. +    {"force-update",  0 , OPTPARSE_NONE}, // Long comman: force-update, without arguments +    {"update"      ,  0 , OPTPARSE_NONE}, +    {"list"        ,  0 , OPTPARSE_NONE}, +    {"wizard"      ,  0 , OPTPARSE_NONE}, +    {"upgrade"     ,  0 , OPTPARSE_NONE}, +    {"printenv"    ,  0 , OPTPARSE_NONE}, +    { NULL         ,  0 , OPTPARSE_NONE} +}; +``` + +创建完选项后,写出每个选项及其参数的命令和说明: + +``` +static void usage(void) +{ +    rt_kprintf("usage: env.py package [-h] [--force-update] [--update] [--list] [--wizard]\n"); +    rt_kprintf("                      [--upgrade] [--printenv]\n\n"); +    rt_kprintf("optional arguments:\n"); +    rt_kprintf("  -h, --help      show this help message and exit\n"); +    rt_kprintf("  --force-update  force update and clean packages, install or remove the\n"); +    rt_kprintf("                  packages by your settings in menuconfig\n"); +    rt_kprintf("  --update        update packages, install or remove the packages by your\n"); +    rt_kprintf("                  settings in menuconfig\n"); +    rt_kprintf("  --list          list target packages\n"); +    rt_kprintf("  --wizard        create a new package with wizard\n"); +    rt_kprintf("  --upgrade       upgrade local packages list and ENV scripts from git repo\n"); +    rt_kprintf("  --printenv      print environmental variables to check\n"); +} +``` + +下一步是解析。虽然你还没有实现它的功能,但解析后的代码框架是一样的: + +``` +int pkgs(int argc, char **argv) +{ + int ch; + int option_index; + struct optparse options; + + if(argc == 1) + { + usage(); + return RT_EOK; + } + + optparse_init(&options, argv); + while((ch = optparse_long(&options, long_opts, &option_index)) != -1) + { + ch = ch; + + rt_kprintf("\n"); + rt_kprintf("optopt = %c\n", options.optopt); + rt_kprintf("optarg = %s\n", options.optarg); + rt_kprintf("optind = %d\n", options.optind); + rt_kprintf("option_index = %d\n", option_index); + } + rt_kprintf("\n"); + + return RT_EOK; +} +``` + +这里是函数头文件: + +``` +#include "optparse.h" +#include "finsh.h" +``` + +然后,编译并下载到设备上。 + +![Output][6] + +### 硬件黑客 + +对硬件进行编程似乎很吓人,但随着物联网的发展,它变得越来越普遍。并不是所有的东西都可以或者应该在树莓派上运行,但在 RT-Thread,FinSH 可以让你保持熟悉的 Linux 感觉。 + +如果你对在裸机上编码感到好奇,不妨试试 RT-Thread。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/hardware-command-line + +作者:[Alan Smithee][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://opensource.com/users/alansmithee +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/command_line_prompt.png?itok=wbGiJ_yg (Command line prompt) +[2]: https://opensource.com/article/20/6/open-source-rtos +[3]: https://github.com/RT-Thread/rt-thread +[4]: https://opensource.com/sites/default/files/uploads/command-line-apps_2.png (GNU command line standards) +[5]: https://creativecommons.org/licenses/by-sa/4.0/ +[6]: https://opensource.com/sites/default/files/uploads/command-line-apps_3.png (Output) From eaa1e37ac5276f390fa8ea956149548cf53c0d14 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 29 Sep 2020 22:39:56 +0800 Subject: [PATCH 0257/1156] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @geekpi 请把这篇的上一篇也翻译了吧。 --- ... LVM-s (Logical Volume Resize) in Linux.md | 51 ++++++++----------- 1 file changed, 22 insertions(+), 29 deletions(-) diff --git a/translated/tech/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md b/translated/tech/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md index 6c73ec74d2..c9564ddfa4 100644 --- a/translated/tech/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md +++ b/translated/tech/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md @@ -1,31 +1,28 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Extend/Increase LVM’s (Logical Volume Resize) in Linux) [#]: via: (https://www.2daygeek.com/extend-increase-resize-lvm-logical-volume-in-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -如何在 Linux 中扩展/增加 LVM 大小(逻辑卷调整)? +如何在 Linux 中扩展/增加 LVM 大小(逻辑卷调整) ====== 扩展逻辑卷非常简单,只需要很少的步骤,而且不需要卸载某个逻辑卷就可以在线完成。 LVM 的主要目的是灵活的磁盘管理,当你需要的时候,可以很方便地调整、扩展和缩小逻辑卷的大小。 -如果你是逻辑卷管理 (LVM) 新手,我建议你从我们之前的文章开始学习。 +如果你是逻辑卷管理(LVM) 新手,我建议你从我们之前的文章开始学习。 * **第一部分:[如何在 Linux 中创建/配 置LVM(逻辑卷管理)][1]** - - -![][2] + ![][2] 扩展逻辑卷涉及到以下步骤: - - * 检查 LV 所在的卷组中是否有足够的未分配磁盘空间 + * 检查逻辑卷(LV)所在的卷组中是否有足够的未分配磁盘空间 * 如果有,你可以使用这些空间来扩展逻辑卷 * 如果没有,请向系统中添加新的磁盘或 LUN * 将物理磁盘转换为物理卷(PV) @@ -34,13 +31,11 @@ LVM 的主要目的是灵活的磁盘管理,当你需要的时候,可以很 * 扩大文件系统 * 检查扩展的文件系统大小 - - ### 如何创建 LVM 物理卷? -使用 pvcreate 命令创建 LVM 物理卷。 +使用 `pvcreate` 命令创建 LVM 物理卷。 -当在操作系统中检测到磁盘,使用 pvcreate 命令初始化 LVM PV(物理卷)。 +当在操作系统中检测到磁盘,使用 `pvcreate` 命令初始化 LVM 物理卷: ``` # pvcreate /dev/sdc @@ -49,12 +44,10 @@ Physical volume "/dev/sdc" successfully created **请注意:** - * 上面的命令将删除磁盘 /dev/sdc 上的所有数据。 - * 物理磁盘可以直接添加到 LVM PV 中,而不是磁盘分区。 + * 上面的命令将删除磁盘 `/dev/sdc` 上的所有数据。 + * 物理磁盘可以直接添加到 LVM 物理卷中,而不是磁盘分区。 - - -使用 pvdisplay 命令来显示你所创建的 PV。 +使用 `pvdisplay` 命令来显示你所创建的物理卷: ``` # pvdisplay /dev/sdc @@ -74,14 +67,14 @@ PV UUID 69d9dd18-36be-4631-9ebb-78f05fe3217f ### 如何扩展卷组 -使用以下命令在现有的卷组中添加一个新的物理卷。 +使用以下命令在现有的卷组中添加一个新的物理卷: ``` # vgextend vg01 /dev/sdc Volume group "vg01" successfully extended ``` -使用 vgdisplay 命令来显示你所创建的 PV。 +使用 `vgdisplay` 命令来显示你所创建的物理卷: ``` # vgdisplay vg01 @@ -111,13 +104,13 @@ VG UUID d17e3c31-e2c9-4f11-809c-94a549bc43b7 使用以下命令增加现有逻辑卷大小。 -**逻辑卷扩展 (lvextend) 的常用语法。** +逻辑卷扩展(`lvextend`)的常用语法: ``` lvextend [要增加的额外空间] [现有逻辑卷名称] ``` -使用下面的命令将现有的逻辑卷增加 10GB。 +使用下面的命令将现有的逻辑卷增加 10GB: ``` # lvextend -L +10G /dev/mapper/vg01-lv002 @@ -126,33 +119,33 @@ Size of logical volume vg01/lv002 changed from 5.00 GiB (1280 extents) to 15.00 Logical volume var successfully resized ``` -使用 PE 大小来扩展逻辑卷。 +使用 PE 大小来扩展逻辑卷: ``` # lvextend -l +2560 /dev/mapper/vg01-lv002 ``` -要使用百分比 (%) 扩展逻辑卷,请使用以下命令。 +要使用百分比(%)扩展逻辑卷,请使用以下命令: ``` # lvextend -l +40%FREE /dev/mapper/vg01-lv002 ``` -现在,逻辑卷已经扩展,你需要调整文件系统的大小以扩展逻辑卷内的空间。 +现在,逻辑卷已经扩展,你需要调整文件系统的大小以扩展逻辑卷内的空间: -对于基于 ext3 和 ext4 的文件系统,运行以下命令。 +对于基于 ext3 和 ext4 的文件系统,运行以下命令: ``` # resize2fs /dev/mapper/vg01-lv002 ``` -对于xfs文件系统,使用以下命令。 +对于 xfs 文件系统,使用以下命令: ``` # xfs_growfs /dev/mapper/vg01-lv002 ``` -使用 **[df 命令][3]**查看文件系统大小。 +使用 [df 命令][3]查看文件系统大小: ``` # df -h /lvmtest1 @@ -167,12 +160,12 @@ via: https://www.2daygeek.com/extend-increase-resize-lvm-logical-volume-in-linux 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.2daygeek.com/author/magesh/ [b]: https://github.com/lujun9972 [1]: https://www.2daygeek.com/create-lvm-storage-logical-volume-manager-in-linux/ -[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.2daygeek.com/wp-content/uploads/2020/09/extend-increase-resize-lvm-logical-volume-in-linux-3.png [3]: https://www.2daygeek.com/linux-check-disk-space-usage-df-command/ From 2765f1450a77c5a2b9f3bb66faf18042a81b4408 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 29 Sep 2020 22:57:33 +0800 Subject: [PATCH 0258/1156] PRF @geekpi --- ...is not valid yet- Error in Ubuntu Linux.md | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/translated/tech/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md b/translated/tech/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md index 50779b6b9f..e73b884921 100644 --- a/translated/tech/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md +++ b/translated/tech/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md @@ -1,37 +1,38 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Fix “Repository is not valid yet” Error in Ubuntu Linux) [#]: via: (https://itsfoss.com/fix-repository-not-valid-yet-error-ubuntu/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -如何修复 Ubuntu Linux中 的 ”Repository is not valid yet“ 错误 +如何修复 Ubuntu Linux 中的 “Release file is not valid yet” 错误 ====== 我最近[在我的树莓派上安装了 Ubuntu 服务器][1]。我[在 Ubuntu 终端连接上了 Wi-Fi][2],然后做了我在安装任何 Linux 系统后都会做的事情,那就是更新系统。 -当我使用 ”sudo apt update“ 命令时,它给了一个对我而言特别的错误。它报出仓库的发布文件在某个时间段内无效。 +当我使用 `sudo apt update` 命令时,它给了一个对我而言特别的错误。它报出仓库的发布文件在某个时间段内无效。 -**E: Release file for is not valid yet (invalid for another 159d 15h 20min 52s). Updates for this repository will not be applied.** +> E: Release file for is not valid yet (invalid for another 159d 15h 20min 52s). Updates for this repository will not be applied.** 下面是完整输出: ``` -[email protected]:~$ sudo apt update -Hit:1 http://ports.ubuntu.com/ubuntu-ports focal InRelease -Get:2 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease [111 kB] -Get:3 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease [98.3 kB] -Get:4 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease [107 kB] +ubuntu@ubuntu:~$ sudo apt update +Hit:1 http://ports.ubuntu.com/ubuntu-ports focal InRelease +Get:2 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease [111 kB] +Get:3 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease [98.3 kB] +Get:4 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease [107 kB] Reading package lists... Done E: Release file for http://ports.ubuntu.com/ubuntu-ports/dists/focal/InRelease is not valid yet (invalid for another 21d 23h 17min 25s). Updates for this repository will not be applied. E: Release file for http://ports.ubuntu.com/ubuntu-ports/dists/focal-updates/InRelease is not valid yet (invalid for another 159d 15h 21min 2s). Updates for this repository will not be applied. E: Release file for http://ports.ubuntu.com/ubuntu-ports/dists/focal-backports/InRelease is not valid yet (invalid for another 159d 15h 21min 32s). Updates for this repository will not be applied. E: Release file for http://ports.ubuntu.com/ubuntu-ports/dists/focal-security/InRelease is not valid yet (invalid for another 159d 15h 20min 52s). Updates for this repository will not be applied. + ``` -### 修复 Ubuntu 和其他 Linux 发行版中 ”release file is not valid yet“ 的错误。 +### 修复 Ubuntu 和其他 Linux 发行版中 “Release file is not valid yet” 的错误。 ![][3] @@ -63,7 +64,7 @@ Architectures: amd64 arm64 armhf i386 ppc64el riscv64 s390x sudo timedatectl set-local-rtc 1 ``` -timedatectl 命令可以让你在 Linux 上配置时间、日期和[更改时区][4]。 +`timedatectl` 命令可以让你在 Linux 上配置时间、日期和[更改时区][4]。 你应该不需要重新启动。它可以立即工作,你可以通过[更新你的 Ubuntu 系统][5]再次验证它。 @@ -84,7 +85,7 @@ via: https://itsfoss.com/fix-repository-not-valid-yet-error-ubuntu/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From d22a19ef8c376e4b152786b94b1bd597dd8a401d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 29 Sep 2020 22:57:56 +0800 Subject: [PATCH 0259/1156] PUB @geekpi https://linux.cn/article-12666-1.html --- ...Fix -Repository is not valid yet- Error in Ubuntu Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md (98%) diff --git a/translated/tech/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md b/published/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md similarity index 98% rename from translated/tech/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md rename to published/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md index e73b884921..096e922410 100644 --- a/translated/tech/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md +++ b/published/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12666-1.html) [#]: subject: (How to Fix “Repository is not valid yet” Error in Ubuntu Linux) [#]: via: (https://itsfoss.com/fix-repository-not-valid-yet-error-ubuntu/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From ca91f0a7bae98897d72ef375ec946d6c697e83ac Mon Sep 17 00:00:00 2001 From: "Xiaobin.Liu" Date: Tue, 29 Sep 2020 23:18:17 +0800 Subject: [PATCH 0260/1156] TSL --- ... security issues in Go code using gosec.md | 407 ----------------- ... security issues in Go code using gosec.md | 411 ++++++++++++++++++ 2 files changed, 411 insertions(+), 407 deletions(-) delete mode 100644 sources/tech/20200923 Find security issues in Go code using gosec.md create mode 100644 translated/tech/20200923 Find security issues in Go code using gosec.md diff --git a/sources/tech/20200923 Find security issues in Go code using gosec.md b/sources/tech/20200923 Find security issues in Go code using gosec.md deleted file mode 100644 index cd26a4379d..0000000000 --- a/sources/tech/20200923 Find security issues in Go code using gosec.md +++ /dev/null @@ -1,407 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lxbwolf) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Find security issues in Go code using gosec) -[#]: via: (https://opensource.com/article/20/9/gosec) -[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe) - -Find security issues in Go code using gosec -====== -Get started with gosec, the Golang security checker. -![A lock on the side of a building][1] - -It's extremely common now to encounter code written in the [Go programming language][2], especially if you are working with containers, Kubernetes, or a cloud ecosystem. Docker was one of the first projects to adopt Golang, Kubernetes followed, and many new projects select Go over other programming languages. - -Like any other language, Go has its share of strengths and weaknesses, which include security flaws. These can arise due to issues in the programming language itself coupled with insecure coding practices, such as memory safety issues in C code, for example. - -Regardless of why they occur, security issues need to be fixed early in development to prevent them from creeping into shipped software. Fortunately, static analysis tools are available to help you tackle these issues in a more repeatable manner. Static analysis tools work by parsing source code written in a programming language and looking for issues. - -Many of these tools are called linters. Traditionally, linters are more focused on finding programming issues, bugs, code style issues, and the like, and they may not find security issues in code. For example, [Coverity][3] is a popular tool that helps find issues in C/C++ code. However, there are tools that specifically seek out security issues in source code. For example, [Bandit][4] looks for security flaws in Python code. And [gosec][5] searches for security flaws in Go source code. Gosec scans the Go abstract syntax tree (AST) to inspect source code for security problems. - -### Get started with gosec - -To play around with gosec and learn how it works, you need a project written in Go. With a wide variety of open source software available, this shouldn't be a problem. You can find one by looking at the [trending Golang repositorties][6] on GitHub. - -For this tutorial, I randomly chose the [Docker CE][7] project, but you can choose any Go project you want. - -#### Install Go and gosec - -If you do not already have Go installed, you can fetch it from your repository. If you use Fedora or another RPM-based Linux distribution: - - -``` -`$ dnf install golang.x86_64` -``` - -Or you can visit the [Golang install][8] page for other options for your operating system. - -Verify that Go is installed on your system using the `version` argument: - - -``` -$ go version -go version go1.14.6 linux/amd64 -$ -``` - -Installing gosec is simply a matter of running the `go get` command: - - -``` -$ go get github.com/securego/gosec/cmd/gosec -$ -``` - -This downloads gosec's source code from GitHub, compiles it, and installs it in a specific location. You can find [other ways of installing the tools][9] in the repo's README. - -Gosec's source code should be downloaded to the location set by `$GOPATH`, and the compiled binary will be installed in the `bin` directory you set for your system. To find out what `$GOPATH` and `$GOBIN` point to, run: - - -``` -$ go env | grep GOBIN -GOBIN="/root/go/gobin" -$ -$ go env | grep GOPATH -GOPATH="/root/go" -$ -``` - -If the `go get` command worked, then the gosec binary should be available: - - -``` -$ -$ ls -l ~/go/bin/ -total 9260 --rwxr-xr-x. 1 root root 9482175 Aug 20 04:17 gosec -$ -``` - -You can add the `bin` directory in `$GOPATH` to the `$PATH` variable in your shell. This makes the gosec command-line interface (CLI) available just like any other command line on your system: - - -``` -$ which gosec -/root/go/bin/gosec -$ -``` - -Try running the gosec CLI with the `-help` option to see if it is working as expected: - - -``` -$ gosec -help - -gosec - Golang security checker - -gosec analyzes Go source code to look for common programming mistakes that -can lead to security problems. - -VERSION: dev -GIT TAG: -BUILD DATE: - -USAGE: -``` - -Next, create a directory and get the source code for the demo project (Docker CE, in this case) using: - - -``` -$ mkdir gosec-demo -$ -$ cd gosec-demo/ -$ -$ pwd -/root/gosec-demo -$ - -$ git clone -Cloning into 'docker-ce'... -remote: Enumerating objects: 1271, done. -remote: Counting objects: 100% (1271/1271), done. -remote: Compressing objects: 100% (722/722), done. -remote: Total 431003 (delta 384), reused 981 (delta 318), pack-reused 429732 -Receiving objects: 100% (431003/431003), 166.84 MiB | 28.94 MiB/s, done. -Resolving deltas: 100% (221338/221338), done. -Updating files: 100% (10861/10861), done. -$ -``` - -A quick look at the source code shows that most of the project is written in Go—just what you need to tinker with gosec's features: - - -``` -$ ./cloc /root/gosec-demo/docker-ce/ -   10771 text files. -    8724 unique files.                                           -    2560 files ignored. - -\----------------------------------------------------------------------------------- -Language                         files          blank        comment           code -\----------------------------------------------------------------------------------- -Go                                7222         190785         230478        1574580 -YAML                                37           4831            817         156762 -Markdown                           529          21422              0          67893 -Protocol Buffers                   149           5014          16562          10071 -``` - -### Run gosec with the default options - -Run gosec on the Docker CE project using the default options by running `gosec ./...` from within the Git repo you just cloned. A lot of output will be shown on the screen. Towards the end, you should see a short `Summary` showing the number of files scanned, the number of lines in those files, and the issues it found in the source code: - - -``` -$ pwd -/root/gosec-demo/docker-ce -$ -$ time gosec ./... -[gosec] 2020/08/20 04:44:15 Including rules: default -[gosec] 2020/08/20 04:44:15 Excluding rules: default -[gosec] 2020/08/20 04:44:15 Import directory: /root/gosec-demo/docker-ce/components/engine/opts -[gosec] 2020/08/20 04:44:17 Checking package: opts -[gosec] 2020/08/20 04:44:17 Checking file: /root/gosec-demo/docker-ce/components/engine/opts/address_pools.go -[gosec] 2020/08/20 04:44:17 Checking file: /root/gosec-demo/docker-ce/components/engine/opts/env.go -[gosec] 2020/08/20 04:44:17 Checking file: /root/gosec-demo/docker-ce/components/engine/opts/hosts.go - -# End of gosec run - -Summary: -   Files: 1278 -   Lines: 173979 -   Nosec: 4 -  Issues: 644 - -real    0m52.019s -user    0m37.284s -sys     0m12.734s -$ -``` - -If you scroll through the output on the screen, you should see some lines highlighted in various colors: red indicates high-priority issues that need to be looked into first, and yellow indicates medium-priority issues. - -#### About false positives - -Before getting into the findings, I want to share some ground rules. By default, static analysis tools report _everything_ that they find to be an issue based on a set of rules that the tool compares against the code being tested. Does this mean that everything reported by the tool is an issue that needs to be fixed? Well, it depends. The best authorities on this question are the developers who designed and developed the software. They understand the code much better than anybody else, and more importantly, they understand the environment where the software will be deployed and how it will be used. - -This knowledge is critical when deciding whether a piece of code flagged by a tool is actually a security flaw. Over time and with more experience, you will learn to tweak static analysis tools to ignore issues that are not security flaws and make the reports more actionable. So, an experienced developer doing a manual audit of the source code would be in a better position to decide whether an issue reported by gosec warrants attention or not. - -#### High-priority issues - -According to the output, gosec found a high-priority issue that Docker CE is using an old Transport Layer Security (TLS) version. Whenever possible, it's best to use the latest version of a software or library to ensure it is up to date and has no security issues. - - -``` -[/root/gosec-demo/docker-ce/components/engine/daemon/logger/splunk/splunk.go:173] - G402 (CWE-295): TLS MinVersion too low. (Confidence: HIGH, Severity: HIGH) -    172: -  > 173:        tlsConfig := &tls.Config{} -    174: -``` - -It also found a weak random number generator. Depending on how the generated random number is used, you can decide whether or not this is a security flaw. - - -``` -[/root/gosec-demo/docker-ce/components/engine/pkg/namesgenerator/names-generator.go:843] - G404 (CWE-338): Use of weak random number generator (math/rand instead of crypto/rand) (Confidence: MEDIUM, Severity: HIGH) -    842: begin: -  > 843:        name := fmt.Sprintf("%s_%s", left[rand.Intn(len(left))], right[rand.Intn(len(right))]) -    844:        if name == "boring_wozniak" /* Steve Wozniak is not boring */ { -``` - -#### Medium-priority issues - -The tool also found some medium-priority issues. It flagged a potential denial of service (DoS) vulnerability by way of a decompression bomb related to a tar that could possibly be exploited by a malicious actor. - - -``` -[/root/gosec-demo/docker-ce/components/engine/pkg/archive/copy.go:357] - G110 (CWE-409): Potential DoS vulnerability via decompression bomb (Confidence: MEDIUM, Severity: MEDIUM) -    356: -  > 357:                        if _, err = io.Copy(rebasedTar, srcTar); err != nil { -    358:                                w.CloseWithError(err) -``` - -It also found an issue related to a file that is included by way of a variable. If malicious users take control of this variable, they could change its contents to read a different file. - - -``` -[/root/gosec-demo/docker-ce/components/cli/cli/context/tlsdata.go:80] - G304 (CWE-22): Potential file inclusion via variable (Confidence: HIGH, Severity: MEDIUM) -    79:         if caPath != "" { -  > 80:                 if ca, err = ioutil.ReadFile(caPath); err != nil { -    81:                         return nil, err -``` - -File and directory permissions are often the basic building blocks of security on an operating system. Here, gosec identified an issue where you might need to check whether the permissions for a directory are secure or not. - - -``` -[/root/gosec-demo/docker-ce/components/engine/contrib/apparmor/main.go:41] - G301 (CWE-276): Expect directory permissions to be 0750 or less (Confidence: HIGH, Severity: MEDIUM) -    40:         // make sure /etc/apparmor.d exists -  > 41:         if err := os.MkdirAll(path.Dir(apparmorProfilePath), 0755); err != nil { -    42:                 log.Fatal(err) -``` - -Often, you need to launch command-line utilities from source code. Go uses the built-in exec library to do this task. Carefully analyzing the variable used to spawn such utilities can uncover security flaws. - - -``` -[/root/gosec-demo/docker-ce/components/engine/testutil/fakestorage/fixtures.go:59] - G204 (CWE-78): Subprocess launched with variable (Confidence: HIGH, Severity: MEDIUM) -    58: -  > 59:              cmd := exec.Command(goCmd, "build", "-o", filepath.Join(tmp, "httpserver"), "github.com/docker/docker/contrib/httpserver") -    60:                 cmd.Env = append(os.Environ(), []string{ -``` - -#### Low-severity issues - -In this output, gosec identified low-severity issues related to "unsafe" calls, which typically bypass all the memory protections that Go provides. Closely analyze your use of "unsafe" calls to see if they can be exploited in any way possible. - - -``` -[/root/gosec-demo/docker-ce/components/engine/pkg/archive/changes_linux.go:264] - G103 (CWE-242): Use of unsafe calls should be audited (Confidence: HIGH, Severity: LOW) -    263:        for len(buf) > 0 { -  > 264:                dirent := (*unix.Dirent)(unsafe.Pointer(&buf[0])) -    265:                buf = buf[dirent.Reclen:] - -[/root/gosec-demo/docker-ce/components/engine/pkg/devicemapper/devmapper_wrapper.go:88] - G103 (CWE-242): Use of unsafe calls should be audited (Confidence: HIGH, Severity: LOW) -    87: func free(p *C.char) { -  > 88:         C.free(unsafe.Pointer(p)) -    89: } -``` - -It also flagged unhandled errors in the source codebase. You are expected to handle cases where errors could arise in the source code. - - -``` -[/root/gosec-demo/docker-ce/components/cli/cli/command/image/build/context.go:172] - G104 (CWE-703): Errors unhandled. (Confidence: HIGH, Severity: LOW) -    171:                err := tar.Close() -  > 172:                os.RemoveAll(dockerfileDir) -    173:                return err -``` - -### Customize gosec scans - -Using gosec with its defaults brings up many kinds of issues. However, with manual auditing and over time, you learn which issues don't need to be flagged. You can customize gosec to exclude or include certain tests. - -As I mentioned above, gosec uses a set of rules to find problems in Go source code. Here is a complete list of the [rules][10] it uses: - - * G101: Look for hard coded credentials - * G102: Bind to all interfaces - * G103: Audit the use of unsafe block - * G104: Audit errors not checked - * G106: Audit the use of ssh.InsecureIgnoreHostKey - * G107: Url provided to HTTP request as taint input - * G108: Profiling endpoint automatically exposed on /debug/pprof - * G109: Potential Integer overflow made by strconv.Atoi result conversion to int16/32 - * G110: Potential DoS vulnerability via decompression bomb - * G201: SQL query construction using format string - * G202: SQL query construction using string concatenation - * G203: Use of unescaped data in HTML templates - * G204: Audit use of command execution - * G301: Poor file permissions used when creating a directory - * G302: Poor file permissions used with chmod - * G303: Creating tempfile using a predictable path - * G304: File path provided as taint input - * G305: File traversal when extracting zip/tar archive - * G306: Poor file permissions used when writing to a new file - * G307: Deferring a method which returns an error - * G401: Detect the usage of DES, RC4, MD5 or SHA1 - * G402: Look for bad TLS connection settings - * G403: Ensure minimum RSA key length of 2048 bits - * G404: Insecure random number source (rand) - * G501: Import blocklist: crypto/md5 - * G502: Import blocklist: crypto/des - * G503: Import blocklist: crypto/rc4 - * G504: Import blocklist: net/http/cgi - * G505: Import blocklist: crypto/sha1 - * G601: Implicit memory aliasing of items from a range statement - - - -#### Exclude specific tests - -You can customize gosec to prevent it from looking for and reporting on issues that are safe. To ignore specific issues, you can use the `-exclude` flag with the rule codes above. - -For example, if you don't want gosec to find unhandled errors related to hardcoding credentials in source code, you can ignore them by running: - - -``` -$ gosec -exclude=G104 ./... -$ gosec -exclude=G104,G101 ./... -``` - -Sometimes, you know an area of source code is safe, but gosec keeps reporting it as an issue. However, you don't want to exclude that check completely because you want gosec to scan new code added to the codebase. To prevent gosec from scanning the area you know is safe, add a `#nosec` flag to that part of the source code. This ensures gosec continues to scan new code for an issue but ignores the area flagged with `#nosec`. - -#### Run specific checks - -On the other hand, if you need to focus on specific issues, you can use tell gosec to run those checks by using the `-include` option with the rule codes: - - -``` -`$ gosec -include=G201,G202 ./...` -``` - -#### Scan test files - -The Go language has built-in support for testing that uses unit tests to verify whether a component works as expected. In default mode, gosec ignores test files, but if you want them included in the scan, use the `-tests` flag: - - -``` -`gosec -tests ./...` -``` - -#### Change the output format - -Finding issues is only part of the picture; the other part is reporting what it finds in a way that is easy for humans and tools to consume. Fortunately, gosec can output results in a variety of ways. For example, if you want to get reports in JSON format, use the `-fmt` option to specify JSON and save the results in a `results.json` file: - - -``` -$ gosec -fmt=json -out=results.json ./... - -$ ls -l results.json --rw-r--r--. 1 root root 748098 Aug 20 05:06 results.json -$ - -         { -             "severity": "LOW", -             "confidence": "HIGH", -             "cwe": { -                 "ID": "242", -                 "URL": "" -             }, -             "rule_id": "G103", -             "details": "Use of unsafe calls should be audited", -             "file": "/root/gosec-demo/docker-ce/components/engine/daemon/graphdriver/graphtest/graphtest_unix.go", -             "code": "304: \t// Cast to []byte\n305: \theader := *(*reflect.SliceHeader)(unsafe.Pointer(\u0026buf))\n306: \theader.      Len *= 8\n", -             "line": "305", -             "column": "36" -         }, -``` - -### Find low-hanging fruit with gosec - -A static analysis tool is not a replacement for manual code audits. However, when a codebase is large with many people contributing to it, such a tool often helps find low-hanging fruit in a repeatable way. It is also useful for helping new developers identify and avoid writing code that introduces these security flaws. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/9/gosec - -作者:[Gaurav Kamathe][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://opensource.com/users/gkamathe -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_3reasons.png?itok=k6F3-BqA (A lock on the side of a building) -[2]: https://golang.org/ -[3]: https://www.synopsys.com/software-integrity/security-testing/static-analysis-sast.html -[4]: https://pypi.org/project/bandit/ -[5]: https://github.com/securego/gosec -[6]: https://github.com/trending/go -[7]: https://github.com/docker/docker-ce -[8]: https://golang.org/doc/install -[9]: https://github.com/securego/gosec#install -[10]: https://github.com/securego/gosec#available-rules diff --git a/translated/tech/20200923 Find security issues in Go code using gosec.md b/translated/tech/20200923 Find security issues in Go code using gosec.md new file mode 100644 index 0000000000..4427aa7acf --- /dev/null +++ b/translated/tech/20200923 Find security issues in Go code using gosec.md @@ -0,0 +1,411 @@ +[#]: collector: "lujun9972" +[#]: translator: "lxbwolf" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "Find security issues in Go code using gosec" +[#]: via: "https://opensource.com/article/20/9/gosec" +[#]: author: "Gaurav Kamathe https://opensource.com/users/gkamathe" + +使用 gosec 检查 Go 代码中的安全问题 +====== + +来学习下 Golang 的安全检查工具 gosec。 +![A lock on the side of a building][1] + +[Go 语言][2]写的代码越来越常见,尤其是在容器、Kubernetes 或云生态相关的开发中。Docker 是最早采用 Golang 的项目之一,随后是 Kubernetes,之后大量的新项目在众多编程语言中选择了 Go。 + +像其他语言一样,Go 也有它的长处和短处(如安全缺陷)。这些缺陷可能会因为语言本身的限制在程序员编码不当时出现,例如,C 代码中的内存安全问题。 + +无论它们出现的原因是什么,安全问题都应该在开发过程中尽早修复,以免在封装好的软件中出现。幸运的是,静态分析工具可以帮你批量地处理这些问题。静态分析工具通过解析用某种编程语言写的代码来找到问题。 + +这类工具中很多被称为 linter。传统意义上,linter 更注重的是检查代码中编码问题、bug、代码风格之类的问题,不会检查安全问题。例如,[Coverity][3] 是很受欢迎的用来检查 C/C++ 代码问题的工具。然而,有工具专门用来检查源码中的安全问题。例如,[Bandit][4] 用来检查 Python 代码中的安全缺陷。[gosec][5] 用来搜寻 Go 源码中的安全缺陷。gosec 通过扫描 Go 的 AST(抽象语法树abstract syntax tree)来检查源码中的安全问题。 + +### 开始使用 gosec + +在开始学习和使用 gosec 之前,你需要准备一个 Go 语言写的项目。有这么多开源软件,我相信这不是问题。你可以在 GitHub 的 [Golang 库排行榜]][6]中找一个。 + +本文中,我随机选了 [Docker CE][7] 项目,但你可以选择任意的 Go 项目。 + +#### 安装 Go 和 gosec + +如果你还没安装 Go,你可以先从仓库中拉取下来。如果你用的是 Fedora 或其他基于 RPM 的 Linux 发行版本: + + +``` +`$ dnf install golang.x86_64` +``` + +如果你用的是其他操作系统,请参照 [Golang 安装][8]页面。 + +使用 `version` 参数来验证 Go 是否安装成功: + + +``` +$ go version +go version go1.14.6 linux/amd64 +$ +``` + +运行 `go get` 命令就可以轻松地安装 gosec: + + +``` +$ go get github.com/securego/gosec/cmd/gosec +$ +``` + +上面这行命令会从 GitHub 下载 gosec 的源码、编译并安装到指定位置。在仓库的 README 中你还可以看到[安装工具的其他方法][9]。 + +gosec 的源码会被下载到 `$GOPATH` 的位置,编译出的二进制文件会被安装到你系统上设置的 `bin` 目录下。你可以运行下面的命令来查看 `$GOPATH` 和 `$GOBIN` 目录: + + +``` +$ go env | grep GOBIN +GOBIN="/root/go/gobin" +$ +$ go env | grep GOPATH +GOPATH="/root/go" +$ +``` + +如果 `go get` 命令执行成功,那么 gosec 二进制应该就可以使用了: + + +``` +$ +$ ls -l ~/go/bin/ +total 9260 +-rwxr-xr-x. 1 root root 9482175 Aug 20 04:17 gosec +$ +``` + +你可以把 `$GOPATH` 下的 `bin` 目录添加到 `$PATH` 中。这样你就可以像使用系统上的其他命令一样来使用 gosec 命令行工具(CLI)了。 + + +``` +$ which gosec +/root/go/bin/gosec +$ +``` + +使用 gosec 命令行工具的 `-help` 选项来看看运行是否符合预期: + + +``` +$ gosec -help + +gosec - Golang security checker + +gosec analyzes Go source code to look for common programming mistakes that +can lead to security problems. + +VERSION: dev +GIT TAG: +BUILD DATE: + +USAGE: +``` + +之后,创建一个目录,把源码下载到这个目录作为实例项目(本例中,我用的是 Docker CE): + + +``` +$ mkdir gosec-demo +$ +$ cd gosec-demo/ +$ +$ pwd +/root/gosec-demo +$ + +$ git clone +Cloning into 'docker-ce'... +remote: Enumerating objects: 1271, done. +remote: Counting objects: 100% (1271/1271), done. +remote: Compressing objects: 100% (722/722), done. +remote: Total 431003 (delta 384), reused 981 (delta 318), pack-reused 429732 +Receiving objects: 100% (431003/431003), 166.84 MiB | 28.94 MiB/s, done. +Resolving deltas: 100% (221338/221338), done. +Updating files: 100% (10861/10861), done. +$ +``` + +代码统计工具(本例中用的是 cloc)显示这个项目大部分是用 Go 写的,恰好迎合了 gosec 的功能。 + + +``` +$ ./cloc /root/gosec-demo/docker-ce/ + 10771 text files. + 8724 unique files. + 2560 files ignored. + +\----------------------------------------------------------------------------------- +Language files blank comment code +\----------------------------------------------------------------------------------- +Go 7222 190785 230478 1574580 +YAML 37 4831 817 156762 +Markdown 529 21422 0 67893 +Protocol Buffers 149 5014 16562 10071 +``` + +### 使用默认选项运行 gosec + +在 Docker CE 项目中使用默认选项运行 gosec,执行 `gosec ./...` 命令。屏幕上会有很多输出内容。在末尾你会看到一个简短的 `Summary`,列出了浏览的文件数、所有文件的总行数,以及源码中发现的问题数。 + + +``` +$ pwd +/root/gosec-demo/docker-ce +$ +$ time gosec ./... +[gosec] 2020/08/20 04:44:15 Including rules: default +[gosec] 2020/08/20 04:44:15 Excluding rules: default +[gosec] 2020/08/20 04:44:15 Import directory: /root/gosec-demo/docker-ce/components/engine/opts +[gosec] 2020/08/20 04:44:17 Checking package: opts +[gosec] 2020/08/20 04:44:17 Checking file: /root/gosec-demo/docker-ce/components/engine/opts/address_pools.go +[gosec] 2020/08/20 04:44:17 Checking file: /root/gosec-demo/docker-ce/components/engine/opts/env.go +[gosec] 2020/08/20 04:44:17 Checking file: /root/gosec-demo/docker-ce/components/engine/opts/hosts.go + +# End of gosec run + +Summary: + Files: 1278 + Lines: 173979 + Nosec: 4 + Issues: 644 + +real 0m52.019s +user 0m37.284s +sys 0m12.734s +$ +``` + +滚动屏幕你会看到不同颜色高亮的行:红色表示需要尽快查看的高优先级问题,黄色表示中优先级的问题。 + +#### 关于“假阳性” + +在开始检查代码之前,我想先分享几条基本原则。默认情况下,静态检查工具会基于一系列的规则对测试代码进行分析并报告出检查出来的*所有*问题。这表示工具报出来的每一个问题都需要修复吗?非也。这个问题最好的解答者是设计和开发这个软件的人。他们最熟悉代码,更重要的是,他们了解软件会在什么环境下部署以及会被怎样使用。 + +这个知识点对于判定工具标记出来的某段代码到底是不是安全缺陷至关重要。随着工作时间和经验的积累,你会慢慢学会怎样让静态分析工具忽略非安全缺陷,使报告内容的可执行性更高。因此,要判定 gosec 报出来的某个问题是否需要修复,让一名有经验的开发者对源码做人工审计会是比较好的办法。 + +#### 高优先级问题 + +从输出内容看,gosec 发现了 Docker CE 的一个高优先级问题,它使用的是低版本的 TLS(传输层安全Transport Layer Security)。无论什么时候,使用软件和库的最新版本都是确保它更新及时、没有安全问题的最好的方法。 + + +``` +[/root/gosec-demo/docker-ce/components/engine/daemon/logger/splunk/splunk.go:173] - G402 (CWE-295): TLS MinVersion too low. (Confidence: HIGH, Severity: HIGH) + 172: + > 173: tlsConfig := &tls.Config{} + 174: +``` + +它还发现了一个伪随机数生成器。它是不是一个安全缺陷,取决于生成的随机数的使用方式。 + + +``` +[/root/gosec-demo/docker-ce/components/engine/pkg/namesgenerator/names-generator.go:843] - G404 (CWE-338): Use of weak random number generator (math/rand instead of crypto/rand) (Confidence: MEDIUM, Severity: HIGH) + 842: begin: + > 843: name := fmt.Sprintf("%s_%s", left[rand.Intn(len(left))], right[rand.Intn(len(right))]) + 844: if name == "boring_wozniak" /* Steve Wozniak is not boring */ { +``` + +#### 中优先级问题 + +这个工具还发现了一些中优先级问题。它标记了一个通过与 tar 相关的解压炸弹这种方式实现的潜在的 DoS 威胁,这种方式可能会被恶意的攻击者利用。 + + +``` +[/root/gosec-demo/docker-ce/components/engine/pkg/archive/copy.go:357] - G110 (CWE-409): Potential DoS vulnerability via decompression bomb (Confidence: MEDIUM, Severity: MEDIUM) + 356: + > 357: if _, err = io.Copy(rebasedTar, srcTar); err != nil { + 358: w.CloseWithError(err) +``` + +它还发现了一个通过变量访问文件的问题。如果恶意使用者能访问这个变量,那么他们就可以改变变量的值去读其他文件。 + + +``` +[/root/gosec-demo/docker-ce/components/cli/cli/context/tlsdata.go:80] - G304 (CWE-22): Potential file inclusion via variable (Confidence: HIGH, Severity: MEDIUM) + 79: if caPath != "" { + > 80: if ca, err = ioutil.ReadFile(caPath); err != nil { + 81: return nil, err +``` + +文件和目录通常是操作系统安全的最基础的元素。这里,gosec 报出了一个可能需要你检查目录的权限是否安全的问题。 + + +``` +[/root/gosec-demo/docker-ce/components/engine/contrib/apparmor/main.go:41] - G301 (CWE-276): Expect directory permissions to be 0750 or less (Confidence: HIGH, Severity: MEDIUM) + 40: // make sure /etc/apparmor.d exists + > 41: if err := os.MkdirAll(path.Dir(apparmorProfilePath), 0755); err != nil { + 42: log.Fatal(err) +``` + +你经常需要在源码中启动命令行工具。Go 使用内建的 exec 库来实现。仔细地分析用来调用这些工具的变量,就能发现安全缺陷。 + + +``` +[/root/gosec-demo/docker-ce/components/engine/testutil/fakestorage/fixtures.go:59] - G204 (CWE-78): Subprocess launched with variable (Confidence: HIGH, Severity: MEDIUM) + 58: + > 59: cmd := exec.Command(goCmd, "build", "-o", filepath.Join(tmp, "httpserver"), "github.com/docker/docker/contrib/httpserver") + 60: cmd.Env = append(os.Environ(), []string{ +``` + +#### 低优先级问题 + +在这个输出中,gosec 报出了一个 “unsafe” 调用相关的低优先级问题,这个调用会绕开 Go 提供的内存保护。再仔细分析下你调用 “unsafe” 的方式,看看是否有被别人利用的可能性。 + + +``` +[/root/gosec-demo/docker-ce/components/engine/pkg/archive/changes_linux.go:264] - G103 (CWE-242): Use of unsafe calls should be audited (Confidence: HIGH, Severity: LOW) + 263: for len(buf) > 0 { + > 264: dirent := (*unix.Dirent)(unsafe.Pointer(&buf[0])) + 265: buf = buf[dirent.Reclen:] + +[/root/gosec-demo/docker-ce/components/engine/pkg/devicemapper/devmapper_wrapper.go:88] - G103 (CWE-242): Use of unsafe calls should be audited (Confidence: HIGH, Severity: LOW) + 87: func free(p *C.char) { + > 88: C.free(unsafe.Pointer(p)) + 89: } +``` + +它还标记了源码中未处理的错误。源码中出现的错误你都应该处理。 + + +``` +[/root/gosec-demo/docker-ce/components/cli/cli/command/image/build/context.go:172] - G104 (CWE-703): Errors unhandled. (Confidence: HIGH, Severity: LOW) + 171: err := tar.Close() + > 172: os.RemoveAll(dockerfileDir) + 173: return err +``` + +### 自定义 gosec 扫描 + +使用 gosec 的默认选项带来了很多的问题。然而,经过人工审计和随着时间推移,你会掌握哪些问题是不需要标记的。你可以自己指定排除和包含哪些测试。 + +我上面提到过,gosec 是基于一系列的规则从 Go 源码中查找问题的。下面是它使用的完整的[规则][10]列表: + + * G101:查找硬编码凭证 + +- G102:绑定到所有接口 +- G103:审计不安全区块的使用 +- G104:审计未检查的错误 +- G106:审计 ssh.InsecureIgnoreHostKey 的使用 +- G107: 提供给 HTTP 请求的 url 作为污点输入 +- G108: 统计端点自动暴露到 /debug/pprof +- G109: strconv.Atoi 转换到 int16 或 int32 时潜在的整数溢出 +- G110: 潜在的通过解压炸弹实现的 DoS +- G201:SQL 查询构造使用格式字符串 +- G202:SQL 查询构造使用字符串连接 +- G203:在 HTML 模板中使用未转义的数据 +- G203:在HTML模板中使用未转义的数据 +- G204:审计命令执行情况 +- G301:创建目录时文件权限分配不合理 +- G302:chmod 文件权限分配不合理 +- G303:使用可预测的路径创建临时文件 +- G304:作为污点输入提供的文件路径 +- G305:提取 zip/tar 文档时遍历文件 +- G306: 写到新文件时文件权限分配不合理 +- G307: 把返回错误的函数放到 defer 内 +- G401:检测 DES、RC4、MD5 或 SHA1 的使用情况 +- G402:查找错误的 TLS 连接设置 +- G403:确保最小 RSA 密钥长度为 2048 位 +- G404:不安全的随机数源(rand) +- G501:导入黑名单列表:crypto/md5 +- G502:导入黑名单列表:crypto/des +- G503:导入黑名单列表:crypto/rc4 +- G504:导入黑名单列表:net/http/cgi +- G505:导入黑名单列表:crypto/sha1 +- G601: 在 range 语句中使用隐式的元素别名 + + + +#### 排除指定的测试 + +你可以自定义 gosec 来避免对已知为安全的问题进行扫描和报告。你可以使用 `-exclude` 选项和上面的规则编号来忽略指定的问题。 + +例如,如果你不想让 gosec 检查源码中硬编码凭证相关的未处理的错误,那么你可以运行下面的命令来忽略这些错误: + + +``` +$ gosec -exclude=G104 ./... +$ gosec -exclude=G104,G101 ./... +``` + +有时候你知道某段代码是安全的,但是 gosec 还是会报出问题。然而,你又不想完全排除掉整个检查,因为你想让 gosec 检查新增的代码。通过在你已知为安全的代码块添加 `#nosec` 标记可以避免 gosec 扫描。这样 gosec 会继续扫描新增代码,而忽略掉 `#nosec` 标记的代码块。 + +#### 运行指定的检查 + +另一方面,如果你只想检查指定的问题,你可以通过 `-include` 选项和规则编号来告诉 gosec 运行哪些检查: + + +``` +`$ gosec -include=G201,G202 ./...` +``` + +#### 扫描测试文件 + +Go 语言自带对测试的支持,通过单元测试来检验一个元素是否符合预期。在默认模式下,gosec 会忽略测试文件,你可以使用 `-tests` 选项把它们包含进来: + + +``` +`gosec -tests ./...` +``` + +#### 修改输出的格式 + +找出问题只是它的一半功能;另一半功能是把它检查到的问题以用户友好同时又方便工具处理的方式报告出来。幸运的是,gosec 可以用不同的方式输出。例如,如果你想看 JSON 格式的报告,那么就使用 `-fmt` 选项指定 JSON 格式并把结果保存到 `results.json` 文件中: + + +``` +$ gosec -fmt=json -out=results.json ./... + +$ ls -l results.json +-rw-r--r--. 1 root root 748098 Aug 20 05:06 results.json +$ + + { + "severity": "LOW", + "confidence": "HIGH", + "cwe": { + "ID": "242", + "URL": "" + }, + "rule_id": "G103", + "details": "Use of unsafe calls should be audited", + "file": "/root/gosec-demo/docker-ce/components/engine/daemon/graphdriver/graphtest/graphtest_unix.go", + "code": "304: \t// Cast to []byte\n305: \theader := *(*reflect.SliceHeader)(unsafe.Pointer(\u0026buf))\n306: \theader. Len *= 8\n", + "line": "305", + "column": "36" + }, +``` + +### 用 gosec 检查容易暴露出来的问题 + +静态检查工具不能完全代替人工代码审计。然而,当代码量变大、有众多开发者时,这样的工具通常能用批量的方式帮忙找出容易暴露的问题。它对于帮助新开发者识别和在编码时避免引入这些安全缺陷很有用。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/gosec + +作者:[Gaurav Kamathe][a] +选题:[lujun9972][b] +译者:[lxbowlf](https://github.com/lxbwolf) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/gkamathe +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_3reasons.png?itok=k6F3-BqA "A lock on the side of a building" +[2]: https://golang.org/ +[3]: https://www.synopsys.com/software-integrity/security-testing/static-analysis-sast.html +[4]: https://pypi.org/project/bandit/ +[5]: https://github.com/securego/gosec +[6]: https://github.com/trending/go +[7]: https://github.com/docker/docker-ce +[8]: https://golang.org/doc/install +[9]: https://github.com/securego/gosec#install +[10]: https://github.com/securego/gosec#available-rules + From 90941db90bab790e5d304ac37183959d5497002c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 29 Sep 2020 23:32:35 +0800 Subject: [PATCH 0261/1156] PUB @wxy https://linux.cn/article-12667-1.html --- ...20200907 Program hardware from the Linux command line.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20200907 Program hardware from the Linux command line.md (98%) diff --git a/translated/tech/20200907 Program hardware from the Linux command line.md b/published/20200907 Program hardware from the Linux command line.md similarity index 98% rename from translated/tech/20200907 Program hardware from the Linux command line.md rename to published/20200907 Program hardware from the Linux command line.md index b25e0b1d77..7ecd05315d 100644 --- a/translated/tech/20200907 Program hardware from the Linux command line.md +++ b/published/20200907 Program hardware from the Linux command line.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12667-1.html) [#]: subject: (Program hardware from the Linux command line) [#]: via: (https://opensource.com/article/20/9/hardware-command-line) [#]: author: (Alan Smithee https://opensource.com/users/alansmithee) @@ -12,7 +12,7 @@ > 由于物联网(IoT)的兴起,对硬件进行编程变得越来越普遍。RT-Thread 可以让你可以用 FinSH 从 Linux 命令行与设备进行沟通、 -![命令行提示][1] +![](https://img.linux.net.cn/data/attachment/album/202009/29/233059w523g55qzvo53h6i.jpg) RT-Thread 是一个开源的[实时操作系统][2],用于对物联网(IoT)设备进行编程。FinSH 是 [RT-Thread][3] 的命令行组件,它提供了一套操作界面,使用户可以从命令行与设备进行沟通。它主要用于调试或查看系统信息。 From f1a8c552b7c8ef47993d5cd657046bd485b21182 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 30 Sep 2020 05:01:47 +0800 Subject: [PATCH 0262/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200929?= =?UTF-8?q?=20Xen=20on=20Raspberry=20Pi=204=20adventures?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200929 Xen on Raspberry Pi 4 adventures.md --- ...200929 Xen on Raspberry Pi 4 adventures.md | 156 ++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 sources/tech/20200929 Xen on Raspberry Pi 4 adventures.md diff --git a/sources/tech/20200929 Xen on Raspberry Pi 4 adventures.md b/sources/tech/20200929 Xen on Raspberry Pi 4 adventures.md new file mode 100644 index 0000000000..a21b4fca9c --- /dev/null +++ b/sources/tech/20200929 Xen on Raspberry Pi 4 adventures.md @@ -0,0 +1,156 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Xen on Raspberry Pi 4 adventures) +[#]: via: (https://www.linux.com/featured/xen-on-raspberry-pi-4-adventures/) +[#]: author: (Linux.com Editorial Staff https://www.linux.com/author/linuxdotcom/) + +Xen on Raspberry Pi 4 adventures +====== + +Written by [Stefano Stabellini][1] and [Roman Shaposhnik][2] + +![][3] + +Raspberry Pi (RPi) has been a key enabling device for the Arm community for years, given the low price and widespread adoption. According to the RPi Foundation, over 35 million have been sold, with 44% of these sold into industry. We have always been eager to get the Xen hypervisor running on it, but technical differences between RPi and other Arm platforms made it impractical for the longest time. Specifically, a non-standard interrupt controller without virtualization support. + +Then the Raspberry Pi 4 came along, together with a regular GIC-400 interrupt controller that Xen supports out of the box. Finally, we could run Xen on an RPi device. Soon Roman Shaposhnik of Project EVE and a few other community members started asking about it on the **xen-devel** mailing list. _“It should be easy,”_ we answered. _“It might even work out of the box,”_ we wrote in our reply. We were utterly oblivious that we were about to embark on an adventure deep in the belly of the Xen memory allocator and Linux address translation layers. + +The first hurdle was the availability of low memory addresses. RPi4 has devices that can only access the first 1GB of RAM. The amount of memory below 1GB in **Dom0** was not enough. Julien Grall solved this problem with a simple one-line fix to increase the memory allocation below 1GB for **Dom0** on RPi4. The patch is now present in Xen 4.14. + +_“This lower-than-1GB limitation is uncommon, but now that it is fixed, it is just going to work.”_ We were wrong again. The Xen subsystem in Linux uses _virt_to_phys_ to convert virtual addresses to physical addresses, which works for most virtual addresses but not all. It turns out that the RPi4 Linux kernel would sometimes pass virtual addresses that cannot be translated to physical addresses using _virt_to_phys_, and doing so would result in serious errors. The fix was to use a different address translation function when appropriate. The patch is now present in Linux’s master branch. + +We felt confident that we finally reached the end of the line. _“Memory allocations – check. Memory translations — check. We are good to go!”_ No, not yet. It turns out that the most significant issue was yet to be discovered. The Linux kernel has always had the concept of physical addresses and DMA addresses, where DMA addresses are used to program devices and could be different from physical addresses. In practice, none of the x86, ARM, and ARM64 platforms where Xen could run had DMA addresses different from physical addresses. The Xen subsystem in Linux is exploiting the DMA/physical address duality for its own address translations. It uses it to convert physical addresses, as seen by the guest, to physical addresses, as seen by Xen. + +To our surprise and astonishment, the Raspberry Pi 4 was the very first platform to have physical addresses different from DMA addresses, causing the Xen subsystem in Linux to break. It wasn’t easy to narrow down the issue. Once we understood the problem, a dozen patches later, we had full support for handling DMA/physical address conversions in Linux. The Linux patches are in master and will be available in Linux 5.9. + +Solving the address translation issue was the end of our fun hacking adventure. With the Xen and Linux patches applied, Xen and Dom0 work flawlessly. Once Linux 5.9 is out, we will have Xen working on RPi4 out of the box. + +We will show you how to run Xen on RPi4, the real Xen hacker way, and as part of a downstream distribution for a much easier end-user experience. + +## **Hacking Xen on Raspberry Pi 4** + +If you intend to hack on Xen on ARM and would like to use the RPi4 to do it, here is what you need to do to get Xen up and running using UBoot and TFTP. I like to use TFTP because it makes it extremely fast to update any binary during development.  See [this tutorial][4] on how to set up and configure a TFTP server. You also need a UART connection to get early output from Xen and Linux; please refer to [this article][5]. + +Use the [rpi-imager][6] to format an SD card with the regular default Raspberry Pi OS. Mount the first SD card partition and edit **config.txt**. Make sure to add the following: + +``` +kernel=u-boot.bin + +enable_uart=1 + +arm_64bit=1 +``` + +Download a suitable UBoot binary for RPi4 (u-boot.bin) from any distro, for instance [OpenSUSE][7]. Download the JeOS image, then open it and save **u-boot.bin**: + +``` +xz -d openSUSE-Tumbleweed-ARM-JeOS-raspberrypi4.aarch64.raw.xz + +kpartx -a ./openSUSE-Tumbleweed-ARM-JeOS-raspberrypi4.aarch64.raw + +mount /dev/mapper/loop0p1 /mnt + +cp /mnt/u-boot.bin /tmp +``` + +Place u-boot.bin in the first SD card partition together with config.txt. Next time the system boots, you will get a UBoot prompt that allows you to load Xen, the Linux kernel for **Dom0**, the **Dom0 rootfs**, and the device tree from a TFTP server over the network. I automated the loading steps by placing a UBoot **boot.scr** script on the SD card: + +``` +setenv serverip 192.168.0.1 + +setenv ipaddr 192.168.0.2 + +tftpb 0xC00000 boot2.scr + +source 0xC00000 +``` + +Where: + +``` +- serverip is the IP of your TFTP server + +- ipaddr is the IP of the RPi4 +``` + +Use mkimage to generate boot.scr and place it next to config.txt and u-boot.bin: + +``` +mkimage -T script -A arm64 -C none -a 0x2400000 -e 0x2400000 -d boot.source boot.scr +``` + +Where: + +``` +- boot.source is the input + +- boot.scr is the output +``` + +UBoot will automatically execute the provided boot.scr, which sets up the network and fetches a second script (boot2.scr) from the TFTP server. boot2.scr should come with all the instructions to load Xen and the other required binaries. You can generate boot2.scr using [ImageBuilder][8]. + +Make sure to use Xen 4.14 or later. The Linux kernel should be master (or 5.9 when it is out, 5.4-rc4 works.) The Linux ARM64 default config works fine as kernel config. Any 64-bit rootfs should work for Dom0. Use the device tree that comes with upstream Linux for RPi4 (**arch/arm64/boot/dts/broadcom/bcm2711-rpi-4-b.dtb**). RPi4 has two UARTs; the default is **bcm2835-aux-uart** at address **0x7e215040**. It is specified as “serial1” in the device tree instead of serial0. You can tell Xen to use serial1 by specifying on the Xen command line: + +``` +console=dtuart dtuart=serial1 sync_console +``` + + The Xen command line is provided by the **boot2.scr** script generated by ImageBuilder as “**xen,xen-bootargs**“. After editing **boot2.source** you can regenerate **boot2.scr** with **mkimage**: + +``` +mkimage -A arm64 -T script -C none -a 0xC00000 -e 0xC00000 -d boot2.source boot2.scr +``` + +## **Xen on Raspberry Pi 4: an easy button** + +Getting your hands dirty by building and booting Xen on Raspberry Pi 4 from scratch can be not only deeply satisfying but can also give you a lot of insight into how everything fits together on ARM. Sometimes, however, you just want to get a quick taste for what it would feel to have Xen on this board. This is typically not a problem for Xen, since pretty much every Linux distribution provides Xen packages and having a fully functional Xen running on your system is a mere “apt” or “zypper” invocation away. However, given that Raspberry Pi 4 support is only a few months old, the integration work hasn’t been done yet. The only operating system with fully integrated and tested support for Xen on Raspberry Pi 4 is [LF Edge’s Project EVE][9]. + +Project EVE is a secure-by-design operating system that supports running Edge Containers on compute devices deployed in the field. These devices can be IoT gateways, Industrial PCs, or general-purpose ruggedized computers. All applications running on EVE are represented as Edge Containers and are subject to container orchestration policies driven by k3s. Edge containers themselves can encapsulate Virtual Machines, Containers, or Unikernels.  + +You can find more about EVE on the project’s website at and its GitHub repo . The latest instructions for creating a bootable media for Raspberry Pi 4 are also available at:  + + + +Because EVE publishes fully baked downloadable binaries, using it to give Xen on Raspberry Pi 4 a try is as simple as: + +``` +$ docker pull lfedge/eve:5.9.0-rpi-xen-arm64 # you can pick a different 5.x.y release if you like + +$ docker run lfedge/eve:5.9.0-rpi-xen-arm64 live > live.raw +``` + +This is followed by flashing the resulting **live.raw** binary onto an SD card using your favorite tool.  + +Once those steps are done, you can insert the card into your Raspberry Pi 4, connect the keyboard and the monitor and enjoy a minimalistic Linux distribution (based on Alpine Linux and Linuxkit) that is Project EVE running as **Dom0** under Xen. + +As far as Linux distributions go, EVE presents a somewhat novel design for an operating system, but at the same time, it is heavily inspired by ideas from Qubes OS, ChromeOS, Core OS, and Smart OS. If you want to take it beyond simple console tasks and explore how to run user domains on it, we recommend heading over to EVE’s sister project Eden: and following a short tutorial over there. + +If anything goes wrong, you can always find an active community of EVE and Eden users on LF Edge’s Slack channels starting with #eve over at — we’d love to hear your feedback. + +In the meantime – happy hacking! + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/featured/xen-on-raspberry-pi-4-adventures/ + +作者:[Linux.com Editorial Staff][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://www.linux.com/author/linuxdotcom/ +[b]: https://github.com/lujun9972 +[1]: https://twitter.com/stabellinist?lang=en +[2]: https://twitter.com/rhatr?lang=en +[3]: https://www.linux.com/wp-content/uploads/2020/09/xen_project_logo.jpg +[4]: https://help.ubuntu.com/community/TFTP +[5]: https://lancesimms.com/RaspberryPi/HackingRaspberryPi4WithYocto_Part1.html +[6]: https://www.raspberrypi.org/documentation/installation/installing-images/#:~:text=Using%20Raspberry%20Pi%20Imager,Pi%20Imager%20and%20install%20it +[7]: https://en.opensuse.org/HCL:Raspberry_Pi4 +[8]: https://wiki.xenproject.org/wiki/ImageBuilder +[9]: https://www.lfedge.org/projects/eve/ From 089ec736c5be7b7d5d13f56587a6d827049f9449 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 30 Sep 2020 05:02:03 +0800 Subject: [PATCH 0263/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200930?= =?UTF-8?q?=20Present=20Slides=20in=20Linux=20Terminal=20With=20This=20Nif?= =?UTF-8?q?ty=20Python=20Tool?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md --- ...ux Terminal With This Nifty Python Tool.md | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 sources/tech/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md diff --git a/sources/tech/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md b/sources/tech/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md new file mode 100644 index 0000000000..5a100c8d23 --- /dev/null +++ b/sources/tech/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Present Slides in Linux Terminal With This Nifty Python Tool) +[#]: via: (https://itsfoss.com/presentation-linux-terminal/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Present Slides in Linux Terminal With This Nifty Python Tool +====== + +Presentations are often boring. This is why some people add animation or comics/meme to add some humor and style to break the monotony. + +If you have to add some unique style to your college or company presentation, how about using the Linux terminal? Imagine how cool it would be! + +### Present: Do Your Presentation in Linux Terminal + +There are so many amusing and [fun stuff you can do in the terminal][1]. Making and presenting slides is just one of them. + +Python based application named [Present][2] lets you create markdown and YML based slides that you can present in your college or company and amuse people in the true geek style. + +I have made a video showing what it would look like to present something in the Linux terminal with Present. + +[Subscribe to our YouTube channel for more Linux videos][3] + +#### Features of Present + +You can do the following things with Present: + + * Use markdown syntax for adding text to the slides + * Control the slides with arrow or PgUp/Down keys + * Change the foreground and background colors + * Add images to the slides + * Add code blocks + * Play a simulation of code and output with codio YML files + + + +#### Installing Present on Linux + +Present is a Python based tool and you can use PIP to install it. You should make sure to [install Pip on Ubuntu][4] with this command: + +``` +sudo apt install python3-pip +``` + +If you are using some other distributions, please check your package manager to install PIP3. + +Once you have PIP installed, you can install Present system wide in this manner: + +``` +sudo pip3 install present +``` + +You may also install it for only the current user but then you’ll also have to add ~/.local/bin to your PATH. + +#### Using Present to create and present slides in Linux terminal + +![][5] + +Since Present utilizes markdown syntax, you should be aware of it to create your own slides. Using a [markdown editor][6] will be helpful here. + +Present needs a markdown file to read and play the slides. You may [download this sample slide][7] but you need to download the embed image separately and put it inside image folder. + + * Separate slides using — in your markdown file. + * Use markdown syntax for adding text to the slides. + * Add images with this syntax: ![RC] (images/name.png). + * Change slide colors by adding syntax like <!– fg=white bg=red –>. + * Add a slide with effects using syntax like <!– effect=fireworks –>. + * Use [codio syntax][8] to add a code running simulation. + * Quit the presentation using q and control the slides with left/right arrow or PgUp/Down keys. + + + +Keep in mind that resizing the terminal window while running the presentation will mess things up and so does pressing enter key. + +**Conclusion** + +If you are familiar with Markdown and the terminal, using Present won’t be difficult for you. + +You cannot compare it to regular presentation slides made with Impress, MS Office etc but it is a cool tool to occasionally use it. If you are a computer science/networking student or work as a developer or sysadmin, your colleagues will surely find this amusing. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/presentation-linux-terminal/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/funny-linux-commands/ +[2]: https://github.com/vinayak-mehta/present +[3]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[4]: https://itsfoss.com/install-pip-ubuntu/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/presentation-in-linux-terminal.png?resize=800%2C494&ssl=1 +[6]: https://itsfoss.com/best-markdown-editors-linux/ +[7]: https://github.com/vinayak-mehta/present/blob/master/examples/sample.md +[8]: https://present.readthedocs.io/en/latest/codio.html From 98d9b9e2e0b290f57f746f944d86c56a699c202b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 30 Sep 2020 05:02:18 +0800 Subject: [PATCH 0264/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200929?= =?UTF-8?q?=20This=20Python=20script=20mimics=20Babbage's=20Difference=20E?= =?UTF-8?q?ngine?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200929 This Python script mimics Babbage-s Difference Engine.md --- ...ript mimics Babbage-s Difference Engine.md | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 sources/tech/20200929 This Python script mimics Babbage-s Difference Engine.md diff --git a/sources/tech/20200929 This Python script mimics Babbage-s Difference Engine.md b/sources/tech/20200929 This Python script mimics Babbage-s Difference Engine.md new file mode 100644 index 0000000000..e068b55acc --- /dev/null +++ b/sources/tech/20200929 This Python script mimics Babbage-s Difference Engine.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (This Python script mimics Babbage's Difference Engine) +[#]: via: (https://opensource.com/article/20/10/babbages-python) +[#]: author: (Greg Pittman https://opensource.com/users/greg-p) + +This Python script mimics Babbage's Difference Engine +====== +Python once again takes on Charles Babbage's Difference Engine. +![Math formulas in green writing][1] + +In [_Use this Python script to simulate Babbage's Difference Engine_][2], Python offered an alternative solution to Babbage's problem of determining the number of marbles in a two-dimensional pyramid. Babbage's [Difference Engine][3] solved this using a table showing the number of marble rows and the total number of marbles. + +After some contemplation, [Charles Babbage][4]'s ghost replied, "This is all well and good, but here you only take the number of rows and give the number of marbles. With my table, I can also tell you how large a pyramid you might construct given a certain number of marbles; simply look it up in the table." + +Python had to agree that this was indeed the case, yet it knew that surely this must be solvable as well. With little delay, Python came back with another short script. The solution involves thinking through the math in reverse. + + +``` +`MarbNum = (N * (N + 1))/2` +``` + +Which I can begin to solve with: + + +``` +`N * (N + 1) = MarbNum * 2` +``` + +From which an approximate solution might be: + + +``` +`N = int(sqrt(MarbNum * 2))` +``` + +But the integer _N_ that solves this might be too large by one, so I need to test for this. In other words, the correct number of rows will either be _N_ or _N-1_. Here is the final script: + + +``` +#!/usr/bin/env python +# babbage2.py +""" +Using Charles Babbage's conception of a marble-counting operation for a regular +pyramid of marbles, starting with one at the top with each successive row having +one more marble than the row above it. +Will give you the total number of rows possible for a pyramid, given a total number +of marbles available. +As a bonus, you also learn how many are left over. +""" +import math + +MarbNum = input("Enter the number of marbles you have:  ") +MarbNum = int(MarbNum) + +firstguess = int(math.sqrt(MarbNum*2)) + +if (firstguess * (firstguess + 1) > MarbNum*2): +    correctNum = firstguess - 1 +else: +    correctNum = firstguess + +MarbRem = int(MarbNum - (correctNum * (correctNum + 1)/2)) +# some grammatical fixes +if MarbRem == 0: +    MarbRem = "no" +  +if MarbRem == 1: +    marbleword = "marble" +else: +    marbleword = "marbles" +    +print ("You can have",correctNum, "rows, with",MarbRem, marbleword, "remaining.") +``` + +The output will look something like this: + + +``` +Enter the number of marbles you have:  374865 +You can have 865 rows, with 320 marbles remaining. +``` + +And Mr. Babbage's ghost was impressed. "Ah, your Python Engine is impressive indeed! Surely it might rival my [Analytical Engine][5], had I had the time to complete that project." + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/babbages-python + +作者:[Greg Pittman][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://opensource.com/users/greg-p +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/edu_math_formulas.png?itok=B59mYTG3 (Math formulas in green writing) +[2]: https://opensource.com/article/20/9/babbages-python +[3]: https://en.wikipedia.org/wiki/Difference_engine +[4]: https://en.wikipedia.org/wiki/Charles_Babbage +[5]: https://en.wikipedia.org/wiki/Analytical_Engine From a6632c028c8bef1ca44b4090c848ab543fc69815 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 30 Sep 2020 05:03:07 +0800 Subject: [PATCH 0265/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[talk]:=2020200930?= =?UTF-8?q?=20VMware=20plan=20disaggregates=20servers;=20offloads=20networ?= =?UTF-8?q?k=20virtualization=20and=20security?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200930 VMware plan disaggregates servers- offloads network virtualization and security.md --- ...ads network virtualization and security.md | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 sources/talk/20200930 VMware plan disaggregates servers- offloads network virtualization and security.md diff --git a/sources/talk/20200930 VMware plan disaggregates servers- offloads network virtualization and security.md b/sources/talk/20200930 VMware plan disaggregates servers- offloads network virtualization and security.md new file mode 100644 index 0000000000..2f2c1bc343 --- /dev/null +++ b/sources/talk/20200930 VMware plan disaggregates servers- offloads network virtualization and security.md @@ -0,0 +1,71 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (VMware plan disaggregates servers; offloads network virtualization and security) +[#]: via: (https://www.networkworld.com/article/3583990/vmware-plan-disaggregates-servers-offloads-network-virtualization-and-security.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +VMware plan disaggregates servers; offloads network virtualization and security +====== +VMware Project Monterey includes NVIDIA, Intel and goes a long way to meld bare metal servers, graphics processing units +Henrik5000 / Getty Images + +VMware is continuing its effort to remake the data center, cloud and edge to handle the distributed workloads and applications of the future. + +At its virtual VMworld 2020 event the company previewed a new architecture called Project Monterey that goes a long way toward melding bare-metal servers, graphics processing units (GPUs), field programmable gate arrays (FPGAs), network interface cards (NICs) and security into a large-scale virtualized environment. + +Monterey would extend VMware Cloud Foundation (VCF), which today integrates the company’s vShphere virtualization, vSAN storage, NSX networking and vRealize cloud management systems to support GPUs, FPGAs and NICs into a single platform that can be deployed on-premises or in a public cloud. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +The combination of a rearchitected VCF with Project Monterey will disaggregate server functions, add support for bare-metal servers and let an application running on one physical server consume hardware accelerator resources such as FPGAs from other physical servers, said Kit Colbert vice president and chief technology officer of VMware’s Cloud Platform business unit. + +This will also enable physical resources to be dynamically accessed based on policy or via software API, tailored to the needs of the application, Colbert said.  “What we see is that these new apps are using more and more of server CPU cycles. Traditionally, the industry has relied on the CPU for everything--application business logic, processing network packets, specialized work such as 3D modeling, and more,” Colbert wrote in a [blog][2] outlining Project Monterey. + +“But as app requirements for compute have continued to grow, hardware accelerators including GPUs, FPGAs, specialized NICs have been developed for processing workloads that could be offloaded from the CPU.  By leveraging these accelerators, organizations can improve performance for the offloaded activities and free up CPU cycles for core app-processing work.” + +A key component of Monterey is VMware’s SmartNIC which incorporates a general-purpose CPU, out-of-band management, and virtualized device features. As part of Monterey, VMware has enabled its ESXi hypervisor to run on its SmartNICs which will let customers use a single management framework to manage all their compute infrastructure whether it be virtualized or bare metal. + +The idea is that by supporting SmartNICs, VCF will be able to maintain compute virtualization on the server CPU while offloading networking and storage I/O functions to the SmartNIC CPU. Applications can then make use of the available network bandwidth while saving server CPU cycles that will improve application performance, Colbert stated. + +As for security, each SmartNIC can run a stateful firewall and an advanced security suite. + +“Since this will run in the NIC and not in the host, up to thousands of tiny firewalls will be able to be deployed and automatically tuned to protect specific application services that make up the application--wrapping each service with intelligent defenses that can shield any vulnerability of that specific service,” Colbert stated. “Having an ESXi instance on the SmartNIC provides greater defense-in-depth. Even if the x86 ESXi is somehow compromised, the SmartNIC ESXi can still enforce proper network security and other security policies.” + +Part of the Monterey rollout included a broad development agreement between VMware and GPU giant Nvidia to bring its BlueField-2 data-processing unit (DPU) and other technologies into Monterey.  The BlueField-2 offloads network, security, and storage tasks from the CPU. + +Nvidia DPUs can run a number of tasks, including network virtualization, load balancing, data compression, packet switching and encryption today across two ports, each carrying traffic at 100Gbps. “That’s an order of magnitude faster than CPUs geared for enterprise apps. The DPU is taking on these jobs so CPU cores can run more apps, boosting vSphere and data-center efficiency,” according to an Nvidia blog “As a result, data centers can handle more apps, and their networks will run faster, too.” + +In addition to the Monterey agreement, VMware and Nvidia said they would work together to develop an enterprise platform for AI applications.  Specifically, the companies said GPU-optimized AI software available on the [Nvidia NGC hub][3] will be integrated into VMware vSphere, VMware Cloud Foundation and VMware Tanzu. + +[Now see how AI can boost data-center availability and efficiency][4] + +This will help accelerate AI adoption, letting customers extend existing infrastructure to support AI and manage all applications with a single set of operations. + +Intel and Pensando announced SmartNIC technology integration as part of Project Monterey, and  Dell Technologies, HPE and Lenovo said they, too, would support integrated systems based on Project Monterey. + +Project Monterey is a technology preview at this point and VMware did not say when it expects to deliver it. + +Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3583990/vmware-plan-disaggregates-servers-offloads-network-virtualization-and-security.html + +作者:[Michael Cooney][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://www.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://blogs.vmware.com/vsphere/2020/09/announcing-project-monterey-redefining-hybrid-cloud-architecture.html +[3]: https://www.nvidia.com/en-us/gpu-cloud/ +[4]: https://www.networkworld.com/article/3274654/ai-boosts-data-center-availability-efficiency.html +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world From a474f3cf48e9a8826c2b0af935900d28618431eb Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 30 Sep 2020 08:44:22 +0800 Subject: [PATCH 0266/1156] translating --- ...self when writing project documentation.md | 77 ------------------- ...self when writing project documentation.md | 75 ++++++++++++++++++ 2 files changed, 75 insertions(+), 77 deletions(-) delete mode 100644 sources/tech/20200925 5 questions to ask yourself when writing project documentation.md create mode 100644 translated/tech/20200925 5 questions to ask yourself when writing project documentation.md diff --git a/sources/tech/20200925 5 questions to ask yourself when writing project documentation.md b/sources/tech/20200925 5 questions to ask yourself when writing project documentation.md deleted file mode 100644 index 1b68be7296..0000000000 --- a/sources/tech/20200925 5 questions to ask yourself when writing project documentation.md +++ /dev/null @@ -1,77 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (5 questions to ask yourself when writing project documentation) -[#]: via: (https://opensource.com/article/20/9/project-documentation) -[#]: author: (Alexei Leontief https://opensource.com/users/alexeileontief) - -5 questions to ask yourself when writing project documentation -====== -Using some of the basic principles of effective communication can help -you create well-written, informative project documents that align with -your brand. -![A person writing.][1] - -Before getting down to the actual writing part of documenting another one of your open source projects, and even before interviewing the experts, it's a good idea to answer some high-level questions about your new document. - -Renowned communication theorist Harold Lasswell wrote in his 1948 article, _The Structure and Function of Communication in Society_: - -> [A] convenient way to describe an act of communication is to answer the following questions: -> -> * Who -> * Says what -> * In which channel -> * To whom -> * With what effect? -> - - -As a technical communicator, you can apply Lasswell's theory and answer similar questions about your document to communicate your message better and with the desired effect. - -### Who—Who is the document owner? - -Or, what company is behind the document? What brand identity does it want to convey to its audience? The answer to this question will significantly influence your writing style. The company may also have its own style guide or at least a formal mission statement, in which case, you should start there. - -If the company is just starting out, you may ask the questions above to the document's owner. As the writer, it's important to integrate the voice and persona you create for the company with your own worldview and beliefs. This will make your writing sound more natural and less like company jargon. - -### Says what—What is the document type? - -What information do you need to communicate? What type of document is it: a user guide, API reference, release notes, etc.? Many document types will have templates or generally agreed-upon structures that will give you a place to start and help ensure you include all the necessary information. - -### In which channel—What is the format of the document? - -With technical documents, the channel of communication often informs the final format of your doc, i.e., whether it's going to be a PDF, HTML, a text file, etc. This will, most likely, also determine the tools you should use to write your document. - -### To whom—Who is the target audience? - -Who will read this document? What is their level of knowledge? What are their job responsibilities and their main challenges? These questions will help you determine what you should cover, whether or not you should go into details, whether you can use any specific terms, etc. In some cases, the answers to these questions can even influence the complexity of syntax that you should use. - -### With what effect—What is the purpose of the document? - -This is where you should define what problem(s) this document is expected to solve for its prospective readers, or what questions it should answer for them. For example, the purpose of your document can be to teach your customers to work with your product. - -At this point, you may refer to the approach suggested by [Divio][2]. According to this approach, you can assign any document one of four types, depending on the document's general orientation: learning, solving a problem, understanding, or getting information. - -Another good question to ask at this stage is what business problem this document is meant to solve (for example, how to cut down support costs.) With a business problem in mind, you may see an important angle for your writing. - -### Conclusion - -The questions above are designed to help you form the basis for effective communication and ensure your document covers everything it should. You can break them down into your own checklist of questions and keep them around for whenever you have a document to create. This checklist may also come in handy when you become stuck, confronted with a blank page. It will hopefully inspire you and help you generate ideas. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/9/project-documentation - -作者:[Alexei Leontief][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://opensource.com/users/alexeileontief -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003784_02_os.comcareers_resume_rh1x.png?itok=S3HGxi6E (A person writing.) -[2]: https://documentation.divio.com/ diff --git a/translated/tech/20200925 5 questions to ask yourself when writing project documentation.md b/translated/tech/20200925 5 questions to ask yourself when writing project documentation.md new file mode 100644 index 0000000000..bbf3b907cc --- /dev/null +++ b/translated/tech/20200925 5 questions to ask yourself when writing project documentation.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 questions to ask yourself when writing project documentation) +[#]: via: (https://opensource.com/article/20/9/project-documentation) +[#]: author: (Alexei Leontief https://opensource.com/users/alexeileontief) + +编写项目文档时要问自己 5 个问题 +====== +使用一些有效沟通的基本原则可以帮助你创建与你的品牌一致的,编写良好,内容丰富的项目文档。 +![A person writing.][1] + +在开始另一个开源项目文档的实际写作部分之前,甚至在采访专家之前,最好回答一些有关新文档的高级问题。 + +著名的传播理论家 Harold Lasswell 在他 1948 年的文章《社会中的传播结构和功能》(_The Structure and Function of Communication in Society_)中写道: + +> (一个)描述沟通行为的方便方法是回答以下问题: +> +> * 谁 +> * 说什么 +> * 在哪个渠道 +> * 对谁 +> * 有什么效果? +> + + +作为一名技术沟通者,你可以运用 Lasswell 的理论,回答关于你文档的类似问题,以更好地传达你的信息,达到预期的效果。 + +### 谁—谁是文档的所有者? + +或者说,文档背后是什么公司?它想向受众传达什么品牌形象?这个问题的答案将大大影响你的写作风格。公司也可能有自己的风格指南,或者至少有正式的使命声明,在这种情况下,你应该从这开始。 + +如果公司刚刚起步,你可以向文件的主人提出上述问题。作为作者,将你为公司创造的声音和角色与你自己的世界观和信仰结合起来是很重要的。这将使你的写作看起来更自然,而不像公司的行话。 + +### 说什么—文件类型是什么? + +你需要传达什么信息?它是什么类型的文档:用户指南、API 参考、发布说明等?许多文档类型将有模板或普遍认可的结构,它将让你从这开始,并帮助确保包括所有必要的信息。 + +### 在哪个渠道—文档的格式是什么? + +对于技术文档,沟通的渠道通常会告诉你文档的最终格式,也就是 PDF、HTML、文本文件等。这很可能也决定了你应该使用什么工具来编写你的文档。 + +### 对谁—目标受众是谁? + +谁会阅读这份文档?他们的知识水平如何?他们的工作职责和主要挑战是什么?这些问题将帮助你确定你应该覆盖什么,是否应该进入细节,是否可以使用任何特定的术语,等等。在某些情况下,这些问题的答案甚至可以影响你使用的语法的复杂性。 + +### 有什么效果-文档的目的是什么? + +在这里,你应该定义这个文档要为它的潜在读者解决什么问题,或者它应该为他们回答什么问题。例如,你的文档的目的可以是教你的客户如何使用你的产品。 + +这时,你可以参考 [Divio][2] 建议的方法。根据这种方法,你可以根据文档的总体方向,将任何文档分为四种类型之一:学习、解决问题、理解或获取信息。 + +在这个阶段,另一个很好的问题是,这个文档要解决什么业务问题(例如,如何削减支持成本)。带着业务问题,你可能会看到你写作的一个重要角度。 + +### 总结 + +上面的问题旨在帮助你形成有效沟通的基础,并确保你的文件涵盖了所有应该涵盖的内容。你可以把它们分解成你自己的问题清单,并把它们放在身边,以便在你有文件要创建的时候使用。当你面对空白页时,这份清单也可能会派上用场。希望它能激发你的灵感,帮助你产生想法。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/project-documentation + +作者:[Alexei Leontief][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/alexeileontief +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003784_02_os.comcareers_resume_rh1x.png?itok=S3HGxi6E (A person writing.) +[2]: https://documentation.divio.com/ From 09ab1b458811b51dea469b63b866260cdb27b1f6 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 30 Sep 2020 08:50:54 +0800 Subject: [PATCH 0267/1156] translating --- ... is an Open Source MS-Paint Type of App for Linux Desktop.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md b/sources/tech/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md index 32754d3a03..c1c136c5e7 100644 --- a/sources/tech/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md +++ b/sources/tech/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 3584a5fee61d8c00c72e0a98b36f8d67cf45fae6 Mon Sep 17 00:00:00 2001 From: Hilton Chain <26847027+rakino@users.noreply.github.com> Date: Wed, 30 Sep 2020 09:06:35 +0800 Subject: [PATCH 0268/1156] Update 20190521 How to Disable IPv6 on Ubuntu Linux.md --- sources/tech/20190521 How to Disable IPv6 on Ubuntu Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20190521 How to Disable IPv6 on Ubuntu Linux.md b/sources/tech/20190521 How to Disable IPv6 on Ubuntu Linux.md index 4420b034e6..2fb3f17a4a 100644 --- a/sources/tech/20190521 How to Disable IPv6 on Ubuntu Linux.md +++ b/sources/tech/20190521 How to Disable IPv6 on Ubuntu Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (rakino) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -196,7 +196,7 @@ via: https://itsfoss.com/disable-ipv6-ubuntu-linux/ 作者:[Sergiu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[译者ID](https://github.com/rakino) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From e057b72b7016e3d1dc8a5d43bdfa623905f6602e Mon Sep 17 00:00:00 2001 From: Hilton Chain <26847027+rakino@users.noreply.github.com> Date: Wed, 30 Sep 2020 13:32:23 +0800 Subject: [PATCH 0269/1156] translated 20190521 How to Disable IPv6 on Ubuntu Linux.md --- ...521 How to Disable IPv6 on Ubuntu Linux.md | 219 ----------------- ...521 How to Disable IPv6 on Ubuntu Linux.md | 222 ++++++++++++++++++ 2 files changed, 222 insertions(+), 219 deletions(-) delete mode 100644 sources/tech/20190521 How to Disable IPv6 on Ubuntu Linux.md create mode 100644 translated/tech/20190521 How to Disable IPv6 on Ubuntu Linux.md diff --git a/sources/tech/20190521 How to Disable IPv6 on Ubuntu Linux.md b/sources/tech/20190521 How to Disable IPv6 on Ubuntu Linux.md deleted file mode 100644 index 2fb3f17a4a..0000000000 --- a/sources/tech/20190521 How to Disable IPv6 on Ubuntu Linux.md +++ /dev/null @@ -1,219 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (rakino) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Disable IPv6 on Ubuntu Linux) -[#]: via: (https://itsfoss.com/disable-ipv6-ubuntu-linux/) -[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) - -How to Disable IPv6 on Ubuntu Linux -====== - -Are you looking for a way to **disable IPv6** connections on your Ubuntu machine? In this article, I’ll teach you exactly how to do it and why you would consider this option. I’ll also show you how to **enable or re-enable IPv6** in case you change your mind. - -### What is IPv6 and why would you want to disable IPv6 on Ubuntu? - -**[Internet Protocol version 6][1]** [(][1] **[IPv6][1]**[)][1] is the most recent version of the Internet Protocol (IP), the communications protocol that provides an identification and location system for computers on networks and routes traffic across the Internet. It was developed in 1998 to replace the **IPv4** protocol. - -**IPv6** aims to improve security and performance, while also making sure we don’t run out of addresses. It assigns unique addresses globally to every device, storing them in **128-bits** , compared to just 32-bits used by IPv4. - -![Disable IPv6 Ubuntu][2] - -Although the goal is for IPv4 to be replaced by IPv6, there is still a long way to go. Less than **30%** of the sites on the Internet makes IPv6 connectivity available to users (tracked by Google [here][3]). IPv6 can also cause [problems with some applications at time][4]. - -Since **VPNs** provide global services, the fact that IPv6 uses globally routed addresses (uniquely assigned) and that there (still) are ISPs that don’t offer IPv6 support shifts this feature lower down their priority list. This way, they can focus on what matters the most for VPN users: security. - -Another possible reason you might want to disable IPv6 on your system is not wanting to expose yourself to various threats. Although IPv6 itself is safer than IPv4, the risks I am referring to are of another nature. If you aren’t actively using IPv6 and its features, [having IPv6 enabled leaves you vulnerable to various attacks][5], offering the hacker another possible exploitable tool. - -On the same note, configuring basic network rules is not enough. You have to pay the same level of attention to tweaking your IPv6 configuration as you do for IPv4. This can prove to be quite a hassle to do (and also to maintain). With IPv6 comes a suite of problems different to those of IPv4 (many of which can be referenced online, given the age of this protocol), giving your system another layer of complexity. - -[][6] - -Suggested read How To Remove Drive Icons From Unity Launcher In Ubuntu 14.04 [Beginner Tips] - -### Disabling IPv6 on Ubuntu [For Advanced Users Only] - -In this section, I’ll be covering how you can disable IPv6 protocol on your Ubuntu machine. Open up a terminal ( **default:** CTRL+ALT+T) and let’s get to it! - -**Note:** _For most of the commands you are going to input in the terminal_ _you are going to need root privileges ( **sudo** )._ - -Warning! - -If you are a regular desktop Linux user and prefer a stable working system, please avoid this tutorial. This is for advanced users who know what they are doing and why they are doing so. - -#### 1\. Disable IPv6 using Sysctl - -First of all, you can **check** if you have IPv6 enabled with: - -``` -ip a -``` - -You should see an IPv6 address if it is enabled (the name of your internet card might be different): - -![IPv6 Address Ubuntu][7] - -You have see the sysctl command in the tutorial about [restarting network in Ubuntu][8]. We are going to use it here as well. To **disable IPv6** you only have to input 3 commands: - -``` -sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1 -sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1 -sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=1 -``` - -You can check if it worked using: - -``` -ip a -``` - -You should see no IPv6 entry: - -![IPv6 Disabled Ubuntu][9] - -However, this only **temporarily disables IPv6**. The next time your system boots, IPv6 will be enabled again. - -One method to make this option persist is modifying **/etc/sysctl.conf**. I’ll be using vim to edit the file, but you can use any editor you like. Make sure you have **administrator rights** (use **sudo** ): - -![Sysctl Configuration][10] - -Add the following lines to the file: - -``` -net.ipv6.conf.all.disable_ipv6=1 -net.ipv6.conf.default.disable_ipv6=1 -net.ipv6.conf.lo.disable_ipv6=1 -``` - -For the settings to take effect use: - -``` -sudo sysctl -p -``` - -If IPv6 is still enabled after rebooting, you must create (with root privileges) the file **/etc/rc.local** and fill it with: - -``` -#!/bin/bash -# /etc/rc.local - -/etc/sysctl.d -/etc/init.d/procps restart - -exit 0 -``` - -Now use [chmod command][11] to make the file executable: - -``` -sudo chmod 755 /etc/rc.local -``` - -What this will do is manually read (during the boot time) the kernel parameters from your sysctl configuration file. - -[][12] - -Suggested read 3 Ways to Check Linux Kernel Version in Command Line - -#### 2\. Disable IPv6 using GRUB - -An alternative method is to configure **GRUB** to pass kernel parameters at boot time. You’ll have to edit **/etc/default/grub**. Once again, make sure you have administrator privileges: - -![GRUB Configuration][13] - -Now you need to modify **GRUB_CMDLINE_LINUX_DEFAULT** and **GRUB_CMDLINE_LINUX** to disable IPv6 on boot: - -``` -GRUB_CMDLINE_LINUX_DEFAULT="quiet splash ipv6.disable=1" -GRUB_CMDLINE_LINUX="ipv6.disable=1" -``` - -Save the file and run: - -``` -sudo update-grub -``` - -The settings should now persist on reboot. - -### Re-enabling IPv6 on Ubuntu - -To re-enable IPv6, you’ll have to undo the changes you made. To enable IPv6 until reboot, enter: - -``` -sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0 -sudo sysctl -w net.ipv6.conf.default.disable_ipv6=0 -sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0 -``` - -Otherwise, if you modified **/etc/sysctl.conf** you can either remove the lines you added or change them to: - -``` -net.ipv6.conf.all.disable_ipv6=0 -net.ipv6.conf.default.disable_ipv6=0 -net.ipv6.conf.lo.disable_ipv6=0 -``` - -You can optionally reload these values: - -``` -sudo sysctl -p -``` - -You should once again see a IPv6 address: - -![IPv6 Reenabled in Ubuntu][14] - -Optionally, you can remove **/etc/rc.local** : - -``` -sudo rm /etc/rc.local -``` - -If you modified the kernel parameters in **/etc/default/grub** , go ahead and delete the added options: - -``` -GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" -GRUB_CMDLINE_LINUX="" -``` - -Now do: - -``` -sudo update-grub -``` - -**Wrapping Up** - -In this guide I provided you ways in which you can **disable IPv6** on Linux, as well as giving you an idea about what IPv6 is and why you would want to disable it. - -Did you find this article useful? Do you disable IPv6 connectivity? Let us know in the comment section! - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/disable-ipv6-ubuntu-linux/ - -作者:[Sergiu][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/rakino) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/sergiu/ -[b]: https://github.com/lujun9972 -[1]: https://en.wikipedia.org/wiki/IPv6 -[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/05/disable_ipv6_ubuntu.png?fit=800%2C450&ssl=1 -[3]: https://www.google.com/intl/en/ipv6/statistics.html -[4]: https://whatismyipaddress.com/ipv6-issues -[5]: https://www.internetsociety.org/blog/2015/01/ipv6-security-myth-1-im-not-running-ipv6-so-i-dont-have-to-worry/ -[6]: https://itsfoss.com/remove-drive-icons-from-unity-launcher-in-ubuntu/ -[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/05/ipv6_address_ubuntu.png?fit=800%2C517&ssl=1 -[8]: https://itsfoss.com/restart-network-ubuntu/ -[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/05/ipv6_disabled_ubuntu.png?fit=800%2C442&ssl=1 -[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/05/sysctl_configuration.jpg?fit=800%2C554&ssl=1 -[11]: https://linuxhandbook.com/chmod-command/ -[12]: https://itsfoss.com/find-which-kernel-version-is-running-in-ubuntu/ -[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/05/grub_configuration-1.jpg?fit=800%2C565&ssl=1 -[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/05/ipv6_address_ubuntu-1.png?fit=800%2C517&ssl=1 diff --git a/translated/tech/20190521 How to Disable IPv6 on Ubuntu Linux.md b/translated/tech/20190521 How to Disable IPv6 on Ubuntu Linux.md new file mode 100644 index 0000000000..0941286dcb --- /dev/null +++ b/translated/tech/20190521 How to Disable IPv6 on Ubuntu Linux.md @@ -0,0 +1,222 @@ +[#]: collector: (lujun9972) +[#]: translator: (rakino) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Disable IPv6 on Ubuntu Linux) +[#]: via: (https://itsfoss.com/disable-ipv6-ubuntu-linux/) +[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) + +如何在 Ubuntu Linux 上禁用 IPv6 +====== + +想知道怎样在 Ubuntu 上**禁用 IPv6** 吗?我会在这篇文章中介绍一些方法,以及为什么你应该考虑这一选择;以防改变主意,我也会提到如何**启用,或者说重新启用 IPv6**。 + +### 什么是 IPv6?为什么会想要禁用它? + +**[网际协议第6版][1]**Internet Protocol version 6[(][1] **[IPv6][1]**[)][1]是网际协议(IP)的最新版本。网际协议是一种通信协议,它为网络上的计算机提供识别和定位系统,并在互联网上进行通信路由。IPv6 是在 1998 年以取代 **IPv4** 协议为目的被设计出来的。 + +**IPv6** 意在提高安全性与性能的同时保证地址不被用尽;它可以在全球范围内为每台设备分配唯一的以 **128 位元**存储的地址,而 IPv4 只使用了 32 位元。 + +![Disable IPv6 Ubuntu][2] + +尽管 IPv6 的目标是取代 IPv4,但目前还有很长的路要走;互联网上只有少于 **30%** 的网站支持 IPv6([这里][3] 是谷歌的统计),IPv6 有时也会导致 [一些程序出现问题][4]。 + +由于 IPv6 使用全球(唯一分配的)路由地址,以及(仍然)有互联网服务供应商Internet Service Provider(ISP)不提供 IPv6 支持的事实,IPv6 这一功能在提供全球服务的**虚拟私人网络**Virtual Private Network(VPN)供应商的优先级列表中处于较低的位置,这样一来,他们就可以专注于对 VPN 用户最重要的事情:安全。 + +不想让自己暴露在各种威胁之下可能是另一个让你想在系统上禁用 IPv6 的原因。虽然 IPv6 本身比 IPv4 更安全,但我所指的风险是另一种性质上的。如果你不积极使用 IPv6 及其功能,[启用 IPv6 后,你会很容易受到各种攻击][5],因而为黑客提供另一种可能的利用工具。 + +同样,配置基本的网络规则是不够的;就像对 IPv4 一样,你需要密切关注 IPv6 的配置,这可能会是一件相当麻烦的事情(维护也是)。并且随着 IPv6 而来的将会是一套不同于 IPv4 的问题(鉴于这个协议的年龄,许多问题已经可以在网上找到了),这又会使你的系统多了一层复杂性。 + +### 在 Ubuntu 上禁用 IPv6 [高级用户] + +在本节中,我会详述如何在 Ubuntu 上禁用 IPv6 协议,请打开终端(**默认键:** CTRL+ALT+T),让我们开始吧! + +**注意:**_接下来大部分输入终端的命令都需要 root 权限(**sudo**)。_ + +警告! + +如果你是普通 Linux 桌面用户,并且偏好稳定的工作系统,请避开本教程,接下来的部分是为那些知道自己在做什么以及为什么要这么做的用户准备的。 + +#### 1\. 使用 Sysctl 禁用 IPv6 + +首先,可以执行以下命令来**检查** IPv6 是否已经启用: + +``` +ip a +``` + +如果启用了,你应该会看到一个 IPv6 地址(网卡的名字可能会与图中有所不同) + +![IPv6 Address Ubuntu][7] + +在教程 [在 Ubuntu 中重启网络][8] 中,你已经见过 sysctl 命令了,在这里我们也同样会用到它。要**禁用 IPv6**,只需要输入三条命令: + +``` +sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1 +sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1 +sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=1 +``` + +(译注:这篇文章 LCTT 有翻译,在 [这里:《Linux 初学者:如何在 Ubuntu 中重启网络》][patch-1];不过尴尬的是,并没有提到使用 sysctl 的方法……) + +检查命令是否生效: + +``` +ip a +``` + +如果命令生效,你应该会发现 IPv6 的条目消失了: + +![IPv6 Disabled Ubuntu][9] + +然而这种方法只能**临时禁用 IPv6**,因此在下次系统启动的时候, IPv6 仍然会被启用。 + +(译注:这里的临时禁用是指这次所做的改变直到此次关机之前都有效,因为相关的参数是存储在内存中的,可以改变值,但是在内存断电后就会丢失;这种意义上来讲,下文所述的两种方法都是临时的,只不过改变参数值的时机是在系统启动的早期,并且每次系统启动时都有应用而已。那么如何完成这种意义上的永久改变?答案是在编译内核的时候禁用相关功能,然后要后悔就只能重新编译内核了(悲)。) + +一种让选项持续生效的方式是修改文件 **/etc/sysctl.conf**,在这里我用 vim 来编辑文件,不过你可以使用任何你想使用的编辑器,以及请确保你拥有**管理员权限**(用 **sudo**): + +![Sysctl Configuration][10] + +将下面这几行(和之前使用的参数相同)加入到文件中: + +``` +net.ipv6.conf.all.disable_ipv6=1 +net.ipv6.conf.default.disable_ipv6=1 +net.ipv6.conf.lo.disable_ipv6=1 +``` + +执行以下命令应用设置: + +``` +sudo sysctl -p +``` + +如果在重启之后 IPv6 仍然被启用了,而你还想继续这种方法的话,那么你必须(使用 root 权限)创建文件 **/etc/rc.local** 并加入以下内容: + +``` +#!/bin/bash +# /etc/rc.local + +/etc/sysctl.d +/etc/init.d/procps restart + +exit 0 +``` + +接着使用 [chmod 命令][11] 来更改文件权限,使其可执行: + +``` +sudo chmod 755 /etc/rc.local +``` + +这会让系统(在启动的时候)从之前编辑过的 sysctl 配置文件中读取内核参数。 + +#### 2\. 使用 GRUB 禁用 IPv6 + +另外一种方法是配置 **GRUB**,它会在系统启动时向内核传递参数。这样做需要编辑文件 **/etc/default/grub**(请确保拥有管理员权限)。 + +![GRUB Configuration][13] + +现在需要修改文件中分别以 **GRUB_CMDLINE_LINUX_DEFAULT** 和 **GRUB_CMDLINE_LINUX** 开头的两行来在启动时禁用 IPv6: + +``` +GRUB_CMDLINE_LINUX_DEFAULT="quiet splash ipv6.disable=1" +GRUB_CMDLINE_LINUX="ipv6.disable=1" +``` + +(译注:这里是指在上述两行内增加参数 ipv6.disable=1,不同的系统中这两行的默认值可能有所不同。) + +保存文件,然后执行命令: + +``` +sudo update-grub +``` + +(译注:该命令用以更新 GRUB 的配置文件,在没有 update-grub 命令的系统中需要使用 `sudo grub-mkconfig -o /boot/grub/grub.cfg` ) + +设置会在重启后生效。 + +### 在 Ubuntu 上重新启用 IPv6 + +要想重新启用 IPv6,你需要撤销之前的所有修改。不过只是想临时启用 IPv6 的话,可以执行以下命令: + +``` +sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0 +sudo sysctl -w net.ipv6.conf.default.disable_ipv6=0 +sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0 +``` + +否则想要持续启用的话,看看是否修改过 **/etc/sysctl.conf**,可以删除掉之前增加的部分,也可以将它们改为以下值(两种方法等效): + +``` +net.ipv6.conf.all.disable_ipv6=0 +net.ipv6.conf.default.disable_ipv6=0 +net.ipv6.conf.lo.disable_ipv6=0 +``` + +然后应用设置(可选): + +``` +sudo sysctl -p +``` + +(译注:这里可选的意思可能是如果之前临时启用了 IPv6 就没必要再重新加载配置文件了) + +这样应该可以再次看到 IPv6 地址了: + +![IPv6 Reenabled in Ubuntu][14] + +另外,你也可以删除之前创建的文件 **/etc/rc.local**(可选): + +``` +sudo rm /etc/rc.local +``` + +如果修改了文件 **/etc/default/grub** ,回去删掉你所增加的参数: + +``` +GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" +GRUB_CMDLINE_LINUX="" +``` + +然后更新 GRUB 配置文件: + +``` +sudo update-grub +``` + +**尾声** + +在这篇文章中,我介绍了在 Linux 上**禁用 IPv6** 的方法,并简述了什么是 IPv6 以及可能想要禁用掉它的原因。 + +那么,这篇文章对你有用吗?你有禁用掉 IPv6 连接吗?让我们评论区见吧~ + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/disable-ipv6-ubuntu-linux/ + +作者:[Sergiu][a] +选题:[lujun9972][b] +译者:[rakino](https://github.com/rakino) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/sergiu/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/IPv6 +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/05/disable_ipv6_ubuntu.png?fit=800%2C450&ssl=1 +[3]: https://www.google.com/intl/en/ipv6/statistics.html +[4]: https://whatismyipaddress.com/ipv6-issues +[5]: https://www.internetsociety.org/blog/2015/01/ipv6-security-myth-1-im-not-running-ipv6-so-i-dont-have-to-worry/ +[6]: https://itsfoss.com/remove-drive-icons-from-unity-launcher-in-ubuntu/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/05/ipv6_address_ubuntu.png?fit=800%2C517&ssl=1 +[8]: https://itsfoss.com/restart-network-ubuntu/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/05/ipv6_disabled_ubuntu.png?fit=800%2C442&ssl=1 +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/05/sysctl_configuration.jpg?fit=800%2C554&ssl=1 +[11]: https://linuxhandbook.com/chmod-command/ +[12]: https://itsfoss.com/find-which-kernel-version-is-running-in-ubuntu/ +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/05/grub_configuration-1.jpg?fit=800%2C565&ssl=1 +[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/05/ipv6_address_ubuntu-1.png?fit=800%2C517&ssl=1 +[patch-1]: https://github.com/LCTT/TranslateProject/blob/master/published/201905/20190307%20How%20to%20Restart%20a%20Network%20in%20Ubuntu%20-Beginner-s%20Tip.md \ No newline at end of file From 1469177ce1c5e51fe6fc3d333460b55c3a5e904d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 30 Sep 2020 21:29:45 +0800 Subject: [PATCH 0270/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200916?= =?UTF-8?q?=20How=20to=20Create/Configure=20LVM=20(Logical=20Volume=20Mana?= =?UTF-8?q?gement)=20in=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md --- ...VM (Logical Volume Management) in Linux.md | 325 ++++++++++++++++++ 1 file changed, 325 insertions(+) create mode 100644 sources/tech/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md diff --git a/sources/tech/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md b/sources/tech/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md new file mode 100644 index 0000000000..a97bd4a2d5 --- /dev/null +++ b/sources/tech/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md @@ -0,0 +1,325 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Create/Configure LVM (Logical Volume Management) in Linux) +[#]: via: (https://www.2daygeek.com/create-lvm-storage-logical-volume-manager-in-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +How to Create/Configure LVM (Logical Volume Management) in Linux +====== + +Logical Volume Manager (LVM) plays an important role in the Linux operating system by improving the availability, disk I/O, performance and capability of disk management. + +LVM is a widely used technique that is extremely flexible for disk management. + +This adds an extra layer between the physical disks and the file system, allowing you to create a logical volume instead of a physical disk. + +LVM allows you to easily resize, extend and decrease the logical volume when you need it. + +![][1] + +### How to Create LVM Physical Volumes + +You can use any disk, RAID array, SAN disk, or a partition as the LVM physical volume. + +Let’s imagine, you have already added three disks, these disks are /dev/sdb, and /dev/sdc, /dev/sdd. + +Run the following commands to **[discover newly added LUNs or disks in Linux][2]**. + +``` +# ls /sys/class/scsi_host +host0 +``` + +``` +# echo "- - -" > /sys/class/scsi_host/host0/scan +``` + +``` +# fdisk -l +``` + +**General syntax for the creation of a physical volume (pvcreate).** + +``` +pvcreate [Physical Volume Name] +``` + +Once the disk is detected in the OS, use the pvcreate command to initialize the LVM PV (Physical Volumes). + +``` +# pvcreate /dev/sdb /dev/sdc /dev/sdd +Physical volume "/dev/sdb" successfully created +Physical volume "/dev/sdc" successfully created +Physical volume "/dev/sdd" successfully created +``` + +**Make a note:** + + * The above command erases any data on the given disks /dev/sdb, /dev/sdc and /dev/sdd. + * Physical disk can be added directly into the LVM PV instead of the disk partition. + + + +Use the pvdisplay and pvs commands to display the PVs you have created. The pvs command shows summarize output and the pvdisplay shows the detailed output of the PVs. + +``` +# pvs +PV VG Fmt Attr PSize PFree +/dev/sdb lvm2 a-- 15.00g 15.00g +/dev/sdc lvm2 a-- 15.00g 15.00g +/dev/sdd lvm2 a-- 15.00g 15.00g +``` + +``` +# pvdisplay + +"/dev/sdb" is a new physical volume of "15.00 GiB" +--- NEW Physical volume --- +PV Name /dev/sdb +VG Name +PV Size 15.00 GiB +Allocatable NO +PE Size 0 +Total PE 0 +Free PE 0 +Allocated PE 0 +PV UUID 69d9dd18-36be-4631-9ebb-78f05fe3217f + +"/dev/sdc" is a new physical volume of "15.00 GiB" +--- NEW Physical volume --- +PV Name /dev/sdc +VG Name +PV Size 15.00 GiB +Allocatable NO +PE Size 0 +Total PE 0 +Free PE 0 +Allocated PE 0 +PV UUID a2092b92-af29-4760-8e68-7a201922573b + +"/dev/sdd" is a new physical volume of "15.00 GiB" +--- NEW Physical volume --- +PV Name /dev/sdd +VG Name +PV Size 15.00 GiB +Allocatable NO +PE Size 0 +Total PE 0 +Free PE 0 +Allocated PE 0 +PV UUID d92fa769-e00f-4fd7-b6ed-ecf7224af7faS +``` + +### How to Create a Volume Group + +Volume group is the another layer in LVM structure. Basically the volume group consists of the LVM physical volumes you created. You can add physical volume to an existing volume group or create a new volume group for physical volume as needed. + +**General syntax for Volume Group creation (vgcreate).** + +``` +vgcreate [Volume Group Name] [Physical Volume Name] +``` + +Use the following command to add a new physical volume to the new volume group. + +``` +# vgcreate vg01 /dev/sdb /dev/sdc /dev/sdd +Volume group "vg01" successfully created +``` + +**Make a note:** By default, it uses 4MB for physical extent, but you can change it based on your need. + +Use the vgs and vgdisplay commands to display information about the VG you created. + +``` +# vgs vg01 +VG #PV #LV #SN Attr VSize VFree +vg01 3 0 0 wz--n- 44.99g 44.99g +``` + +``` +# vgdisplay vg01 +--- Volume group --- +VG Name vg01 +System ID +Format lvm2 +Metadata Areas 3 +Metadata Sequence No 1 +VG Access read/write +VG Status resizable +MAX LV 0 +Cur LV 0 +Open LV 0 +Max PV 0 +Cur PV 3 +Act PV 3 +VG Size 44.99 GiB +PE Size 4.00 MiB +Total PE 11511 +Alloc PE / Size 0 / 0 +Free PE / Size 11511 / 44.99 GiB +VG UUID d17e3c31-e2c9-4f11-809c-94a549bc43b7 +``` + +### How to Extent Volume Group + +If you do not have space in the VG, Use the following command to add a new physical volume to the existing volume group. + +**Common syntax for Volume Group extension (vgextend).** + +``` +vgextend [Existing Volume Group Name] [Physical Volume Name] +``` + +``` +# vgextend vg01 /dev/sde + Volume group "vg01" successfully extended +``` + +### How to Create Logical Volume Using GB Size’s + +Logical Volume is the top layer in LVM structure. Logical volumes are block devices created from the volume group. It acts as a virtual disk partition and can be easily managed using LVM commands. + +You can use the lvcreate command to create a logical volume. + +**General syntax for creating logical volume (lvcreate)** + +``` +lvcreate –n [Logical Volume Name] –L [Logical Volume Size] [Name of the Volume Group where the LV to be created] +``` + +Run the below command to create a logical volume lv001 of size 10 GB. + +``` +# lvcreate -n lv001 -L 10G vg01 +Logical volume "lv001" created +``` + +Use the lvs and lvdisplay commands to display information about the LVs you have created. + +``` +# lvs /dev/vg01/lvol01 +LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert +lv001 vg01 mwi-a-m-- 10.00g lv001_mlog 100.00 +``` + +``` +# lvdisplay /dev/vg01/lv001 +--- Logical volume --- +LV Path /dev/vg01/lv001 +LV Name lv001 +VG Name vg01 +LV UUID ca307aa4-0866-49b1-8184-004025789e63 +LV Write Access read/write +LV Creation host, time localhost.localdomain, 2020-09-10 11:43:05 -0700 +LV Status available +# open 0 +LV Size 10.00 GiB +Current LE 2560 +Segments 1 +Allocation inherit +Read ahead sectors auto +- currently set to 256 +Block device 253:4 +``` + +### How to Create Logical Volume Using PE Size’s + +Alternatively, you can create Logical Volumes Using Physical Extends (PE) size. + +### How to Calculate PE Value? + +It’s very simple, for example, if you have a volume group of 10 GB, then what is the PE size? + +By default, it uses 4MB for the physical extent, but check the correct PE size by running the vgdisplay command, as this can be changed based on requirements. + +``` +10GB = 10240MB / 4MB (PE Size) = 2560 PEs +``` + +**Common syntax for Logical Volume Creation with PE Size’s (lvcreate).** + +``` +lvcreate –n [Logical Volume Name] –l [Physical Extends (PE) Size] [Name of the Volume Group where the LV to be created] +``` + +To create 10GB of logical volume using the PE size the command would be: + +``` +# lvcreate -n lv001 -l 2560 vg01 +``` + +### How to Create File system + +You cannot use a logical volume until you create a valid file system. + +**General syntax to create a file system.** + +``` +mkfs –t [File System Type] /dev/[Name of the Volume Group where LV resides]/[LV name] +``` + +Use the below command to format the logical volume lv001 with the ext4 file system. + +``` +# mkfs -t ext4 /dev/vg01/lv001 +``` + +For xfs file system. + +``` +# mkfs -t xfs /dev/vg01/lv001 +``` + +### Mounting Logical Volume + +Finally, you need to mount the logical volume to use it. Make sure to add an entry to **/etc/fstab** so that it loads automatically when the system boots. + +Create a directory to mount the logical volume. + +``` +# mkdir /lvmtest +``` + +Use the mount command to **[mount the logical volume][3]**. + +``` +# mount /dev/vg01/lv001 /lvmtest +``` + +Add new logical volume details to the **[/etc/fstab file][4]** to mount automatically when the system starts. + +``` +# vi /etc/fstab +/dev/vg01/lv001 /lvmtest xfs defaults 0 0 +``` + +Check the newly mounted volume using the **[df command][5]**. + +``` +# df -h /lvmtest +Filesystem Size Used Avail Use% Mounted on +/dev/mapper/vg01-lv001 15360M 34M 15326M 4% /lvmtest +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/create-lvm-storage-logical-volume-manager-in-linux/ + +作者:[Magesh Maruthamuthu][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://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.2daygeek.com/scan-detect-luns-scsi-disks-on-redhat-centos-oracle-linux/ +[3]: https://www.2daygeek.com/mount-unmount-file-system-partition-in-linux/ +[4]: https://www.2daygeek.com/understanding-linux-etc-fstab-file/ +[5]: https://www.2daygeek.com/linux-check-disk-space-usage-df-command/ From d5eab00e14d63c41b87f535b4f120566fc3323af Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 1 Oct 2020 05:04:34 +0800 Subject: [PATCH 0271/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200930?= =?UTF-8?q?=20Recovering=20deleted=20files=20on=20Linux=20with=20testdisk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200930 Recovering deleted files on Linux with testdisk.md --- ...ng deleted files on Linux with testdisk.md | 201 ++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 sources/tech/20200930 Recovering deleted files on Linux with testdisk.md diff --git a/sources/tech/20200930 Recovering deleted files on Linux with testdisk.md b/sources/tech/20200930 Recovering deleted files on Linux with testdisk.md new file mode 100644 index 0000000000..815b201add --- /dev/null +++ b/sources/tech/20200930 Recovering deleted files on Linux with testdisk.md @@ -0,0 +1,201 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Recovering deleted files on Linux with testdisk) +[#]: via: (https://www.networkworld.com/article/3575524/recovering-deleted-files-on-linux-with-testdisk.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Recovering deleted files on Linux with testdisk +====== +This post describes testdisk, one of the tools that comes in handy for recovering recently deleted files (along with fixing partitions in other ways). +Thinkstock + +When you delete a file on a Linux system, it isn’t necessarily gone forever, especially if you just recently deleted it. + +Unless you rubbed it out with a tool such as **shred**, the data will still be sitting on your disk—and one of the best tools for recovering deleted files, **testdisk,** can help you rescue it. While **testdisk** has a wide range of functionality including recovering lost or damaged partitions and making non-booting disks bootable again, it’s also frequently used to restore files that were deleted by mistake. + +In this post, we’ll take a look at how you can recover deleted files using **testdisk** and what each step in the process looks like. Since the process requires quite a few steps, you’re likely to feel more comfortable running through them once you’ve done it a few times. + +### Installing testdisk + +Install **testdisk** with commands like **apt install testdisk** or **yum install testdisk**. Interestingly, it’s not just a Linux tool but is also available for MacOS, Solaris and Windows as well. + +Documentation is available at [cgsecurity.org][1]. + +### Recovering files + +First of all, you have to be logged in as **root** or have **sudo** access to use **testdisk**. If you don’t have **sudo** access, you’ll get kicked out early in the process, and your logfile, if you chose to create one, will end up with a message like this in it: + +``` +TestDisk exited normally. +jdoe is not in the sudoers file. This incident will be reported. +``` + +When you recover deleted files with **testdisk**, you’re going to end up with the files being restored within the directory form which you started the tool and the files are going to belong to **root**. For this reason, I like to start in a directory like **/home/recovery**. Once the files are successfully restored and verified, they can be moved back to where they belong and have their ownership restored as well. + +Make sure you can write in the directory you select to start in. + +``` +$ cd /home/recovery +$ testdisk +``` + +The first page of information presented by **testdisk** describes the tool and displays some options. At least initially, it’s a good idea to create the log file as it provides information that might prove useful. Here’s how: + +``` +Use arrow keys to select, then press Enter key: +>[ Create ] Create a new log file + [ Append ] Append information to log file + [ No Log ] Don’t record anything +``` + +The **>** on the left and the reversal of the font and background colors that you will see show the option that will be used once you press **enter**. In this example, we opted to create the log file. + +You will then be prompted for your password (unless you very recently used **sudo**). + +The next step is to select the disk partition in which the deleted file was stored (if not already highlighted). Use the up and down arrow keys as needed to move to it. Then tap the right arrow twice and press **enter** when **Proceed** is highlighted. + +``` +Select a media (use Arrow keys, then press Enter): + Disk /dev/sda - 120 GB / 111 GiB - SSD2SC120G1CS1754D117-551 +>Disk /dev/sdb - 500 GB / 465 GiB - SAMSUNG HE502HJ + Disk /dev/loop0 - 13 MB / 13 MiB (RO) + Disk /dev/loop1 - 101 MB / 96 MiB (RO) + Disk /dev/loop10 - 148 MB / 141 MiB (RO) + Disk /dev/loop11 - 36 MB / 35 MiB (RO) + Disk /dev/loop12 - 52 MB / 49 MiB (RO) + Disk /dev/loop13 - 78 MB / 75 MiB (RO) + Disk /dev/loop14 - 173 MB / 165 MiB (RO) + Disk /dev/loop15 - 169 MB / 161 MiB (RO) +>[Previous] [ Next ] [Proceed ] [ Quit ] +``` + +In this example, the deleted file was in a home directory in **/dev/sdb**. + +At this point, the partition type should already be selected by **testdisk**. + +``` +Disk /dev/sdb - 500 GB / 465 GiB - SAMSUNG HE502HJ + +Please select the partition table type, press Enter when done. + [Intel ] Intel/PC partition +>[EFI GPT] EFI GPT partition map (Mac i386, some x86_64...) + [Humax ] Humax partition table + [Mac ] Apple partition map (legacy) + [None ] Non partitioned media + [Sun ] Sun Solaris partition + [XBox ] XBox partition + [Return ] Return to disk selection +``` + +In the next step, arrow down to “[ Advanced ] Filesystem Utils”. + +``` +[ Analyse ] Analyse current partition structure and search for lost partitions +>[ Advanced ] Filesystem Utils + [ Geometry ] Change disk geometry + [ Options ] Modify options + [ Quit ] Return to disk selection +``` + +Next, view the selected partition. + +``` +Partition Start End Size in sectors +> 1 P Linux filesys. data 2048 910155775 910153728 [drive2] +``` + +Then press the right arrow to select **[ List ]** at the bottom and press enter. + +``` +[ Type ] [Superblock] >[ List ] [Image Creation] [ Quit ] +``` + +Notice that it looks as if we’re starting in **/**, but this is actually the base of the file system that we’re working in. In this example, that’s **/home**. + +``` +Directory / <== starting point + +>drwxr-xr-x 0 0 4096 23-Sep-2020 17:46 . + drwxr-xr-x 0 0 4096 23-Sep-2020 17:46 .. + drwx——— 0 0 16384 22-Sep-2020 11:30 lost+found + drwxr-xr-x 1008 1008 4096 9-Jul-2019 14:10 dorothy + drwxr-xr-x 1001 1001 4096 22-Sep-2020 12:12 nemo + drwxr-xr-x 1005 1005 4096 19-Jan-2020 11:49 eel + drwxrwxrwx 0 0 4096 25-Sep-2020 08:08 recovery +... +``` + +Next, we arrow down to the specific home directory. + +``` +drwxr-xr-x 1016 1016 4096 17-Feb-2020 16:40 gino +>drwxr-xr-x 1000 1000 20480 25-Sep-2020 08:00 shs +``` + +Press enter to move into that directory and then arrow down to a subdirectory as needed. Note that you can choose **..** near the top of the list to back up if you picked the wrong one. + +If you have trouble finding the file, you can press **/** (like when you start a search in **vi**) to be prompted to enter the file name or some portion of it. + +``` +Directory /shs <== current location + Previous +... + -rw-rw-r— 1000 1000 426 8-Apr-2019 19:09 2-min-topics +>-rw-rw-r— 1000 1000 24667 8-Feb-2019 08:57 Up_on_the_Roof.pdf +``` + +Once you’ve located the file that you need to restore, press “**c**” to select it. + +NOTE: You will see helpful instructions at the bottom of your screen: + +``` +Use Left arrow to go back, Right to change directory, h to hide deleted files + q to quit, : to select the current file, a to select all files + C to copy the selected files, c to copy the current file <== +``` + +At this point, you’ll be ready to select where to restore that file within your starting directory (see earlier note about starting in a good place to check out the file before moving it back to its place of origin). In this case, the **/home/recovery** directory has no subdirectories, so this is our recovery spot. + +NOTE: You will see helpful instructions at the bottom of the screen. + +``` +Please select a destination where /shs/Up_on_the_Roof.pdf will be copied. +Keys: Arrow keys to select another directory + C when the destination is correct + Q to quit +Directory /home/recovery <== recovery location +``` + +Once you see “**Copy done! 1 ok, 0 failed**” in green, you’ll know the file has been restored. + +The file in this case was left in **/home/recovery/shs** (starting directory with the selected directory appended). + +You should probably verify that the recovered file looks right before moving it back into its original location. Make sure you also restore the original owner and group since the file will be owned by root at this point. + +**NOTE:** For many points in the file recovery process, you can use quit (**q** or **[ Quit ]**) to back up a step. You can select quit options all the way back to the first step in the process if you like or **^c** to exit immediately. + +#### Recovery training + +Recovering files using **testdisk** is relatively painless, but somewhat complicated. It’s probably a good idea to practice recovering files before panic time sets to give yourself a chance to get comfortable with the process. + +Join the Network World communities on [Facebook][2] and [LinkedIn][3] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3575524/recovering-deleted-files-on-linux-with-testdisk.html + +作者:[Sandra Henry-Stocker][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://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.cgsecurity.org/testdisk.pdf +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world From 2858341f383f7cc02215ea8890d2f0ae7a452dc5 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 1 Oct 2020 05:04:46 +0800 Subject: [PATCH 0272/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[talk]:=2020200930?= =?UTF-8?q?=20FCC=20auctions=20should=20be=20a=20long-term=20boost=20for?= =?UTF-8?q?=205G=20availability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200930 FCC auctions should be a long-term boost for 5G availability.md --- ...e a long-term boost for 5G availability.md | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 sources/talk/20200930 FCC auctions should be a long-term boost for 5G availability.md diff --git a/sources/talk/20200930 FCC auctions should be a long-term boost for 5G availability.md b/sources/talk/20200930 FCC auctions should be a long-term boost for 5G availability.md new file mode 100644 index 0000000000..151561c2e4 --- /dev/null +++ b/sources/talk/20200930 FCC auctions should be a long-term boost for 5G availability.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (FCC auctions should be a long-term boost for 5G availability) +[#]: via: (https://www.networkworld.com/article/3584072/fcc-auctions-should-be-a-long-term-boost-for-5g-availability.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +FCC auctions should be a long-term boost for 5G availability +====== +Federal Communications Commission policymaking targets creation of new services by making more spectrum available +[FCC][1] + +As the march towards 5G progresses, it’s apparent that more spectrum will be needed to fully enable it as a service, and the Federal Communications Commission has clearly taken the message to heart. + +### 5G resources + + * [What is 5G? Fast wireless technology for enterprises and phones][2] + * [How 5G frequency affects range and speed][3] + * [Private 5G can solve some problems that Wi-Fi can’t][4] + * [Private 5G keeps Whirlpool driverless vehicles rolling][5] + * [5G can make for cost-effective private backhaul][6] + * [CBRS can bring private 5G to enterprises][7] + + + +The FCC recently finished [auctioning off priority-access licenses for Citizen’s Broadband Radio Service (CBRS)][8] spectrum for 5G, representing 70MHz swath of new bandwidth within the 3.5GHz band. It took in $4.58 billion and is one of several such auctions in recent  years aimed at freeing up more channels for wireless data. In 2011, 2014 and 2015 the FCC auctioned off 65MHz in the low- to mid-band, between roughly 1.7GHz and 2.2GHz, for example, and the 700MHz band. + +But the operative part of the spectrum now is the sub-6GHz or mid-band spectrum, in the same area as that sold off in the [CBRS][9] auction. A forthcoming C-Band auction will be the big one, according to experts, with a whopping 280MHz of spectrum on the table. + +“The big money’s coming with the C-band auction,” said Jason Leigh, a research manager with IDC. “Mid-band spectrum in the U.S. is scarce— that’s why you’re seeing this great urgency.” + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][10] + +While the major mobile-data providers are still expected to snap up the lion’s share of the available licenses in that auction, some of the most innovative uses of the spectrum will be implemented by the enterprise, which will compete against the carriers for some of the available frequencies. + +Specialist networks for [IoT][11], asset tracking and other private networking applications are already possible via private LTE, but the maturation of 5G substantially broadens their scope, thanks to that technology’s advanced spectrum sharing, low-latency and multi-connectivity features. That, broadly, means a lot of new wire-replacement applications, including industrial automation, facilities management and more. + +## Reallocating spectrum means negotiation + +It hasn’t been a simple matter to shift America’s spectrum priorities around, and few would know that better than former FCC chair Tom Wheeler. Much of the spectrum that the government has been pushing to reallocate to mobile broadband over the past decade was already licensed out to various stakeholders, frequently government agencies and satellite network operators. + +Those stakeholders have to be moved to different parts of the spectrum, often compensated at taxpayer expense, and getting the various players to share and share alike has frequently been a complicated process, Wheeler said. + +“One of the challenges the FCC faces is that the allocation of spectrum was first made from analog assumptions that have been rewritten as a result of digital technology,” he pointed out, citing the transition from analog to digital TV as an example. Where an analog TV signal took up 6MHz of spectrum and required guard bands on either side to avoid interference, four or five digital signals can be fit into that one channel. + +Those assumptions have proved challenging to confront. Incumbents have publicly protested the FCC’s moves in the mid-band, arguing that insufficient precautions have been taken to avoid interference with existing services, and that changing frequency assignments often means they have to buy new equipment. + +“I went through it with the [Department of Defense], with the satellite companies, and the fact of the matter is that one of the big regulatory challenges is that nobody wants to give up the nice secure position that they have based on analog assumptions,” said Wheeler. “I think you also have to pay serious consideration, but I found that claims of interference were the first refuge of people who didn’t like the threat of competition or anything else.” + +## The future: more services + +The broader point of the opening of the mid-band to carrier and enterprise use will be potentially major advantages for U.S. businesses, regardless of the exact manner in which that spectrum is opened, according to Leigh. While the U.S. is sticking to the auction format for allocating wireless spectrum, other countries, like Germany, have set aside mid-band spectrum specifically for enterprise use. + +For a given company trying to roll its own private 5G network, that could push spectrum auction prices higher. But, ultimately, the services are going to be available, whether they’re provisioned in-house or sold by a mobile carrier or vendor, as long as there’s enough spectrum available to them. + +“The things you can do on the enterprise side for 5G are what’s going to drive the really futuristic stuff,” he said. + +Join the Network World communities on [Facebook][12] and [LinkedIn][13] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3584072/fcc-auctions-should-be-a-long-term-boost-for-5g-availability.html + +作者:[Jon Gold][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://www.networkworld.com/author/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://www.flickr.com/photos/fccdotgov/4808818548/ +[2]: https://www.networkworld.com/article/3203489/what-is-5g-fast-wireless-technology-for-enterprises-and-phones.html +[3]: https://www.networkworld.com/article/3568253/how-5g-frequency-affects-range-and-speed.html +[4]: https://www.networkworld.com/article/3568614/private-5g-can-solve-some-enterprise-problems-that-wi-fi-can-t.html +[5]: https://www.networkworld.com/article/3488799/private-5g-keeps-whirlpool-driverless-vehicles-rolling.html +[6]: https://www.networkworld.com/article/3570724/5g-can-make-for-cost-effective-private-backhaul.html +[7]: https://www.networkworld.com/article/3529291/cbrs-wireless-can-bring-private-5g-to-enterprises.html +[8]: https://www.networkworld.com/article/3572564/cbrs-wireless-yields-45b-for-licenses-to-support-5g.html +[9]: https://www.networkworld.com/article/3180615/faq-what-in-the-wireless-world-is-cbrs.html +[10]: https://www.networkworld.com/newsletters/signup.html +[11]: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html +[12]: https://www.facebook.com/NetworkWorld/ +[13]: https://www.linkedin.com/company/network-world From 9a9dd3f909730954ab81f96c5e0bca1567addddc Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 1 Oct 2020 08:32:58 +0800 Subject: [PATCH 0273/1156] translating --- ...Create-Configure LVM (Logical Volume Management) in Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md b/sources/tech/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md index a97bd4a2d5..351295f8d5 100644 --- a/sources/tech/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md +++ b/sources/tech/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From c72a7d39d35c5196d1af9771d75e0ccdff4ce3d7 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 1 Oct 2020 09:09:26 +0800 Subject: [PATCH 0274/1156] translated --- ...VM (Logical Volume Management) in Linux.md | 325 ------------------ 1 file changed, 325 deletions(-) delete mode 100644 sources/tech/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md diff --git a/sources/tech/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md b/sources/tech/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md deleted file mode 100644 index 351295f8d5..0000000000 --- a/sources/tech/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md +++ /dev/null @@ -1,325 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Create/Configure LVM (Logical Volume Management) in Linux) -[#]: via: (https://www.2daygeek.com/create-lvm-storage-logical-volume-manager-in-linux/) -[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) - -How to Create/Configure LVM (Logical Volume Management) in Linux -====== - -Logical Volume Manager (LVM) plays an important role in the Linux operating system by improving the availability, disk I/O, performance and capability of disk management. - -LVM is a widely used technique that is extremely flexible for disk management. - -This adds an extra layer between the physical disks and the file system, allowing you to create a logical volume instead of a physical disk. - -LVM allows you to easily resize, extend and decrease the logical volume when you need it. - -![][1] - -### How to Create LVM Physical Volumes - -You can use any disk, RAID array, SAN disk, or a partition as the LVM physical volume. - -Let’s imagine, you have already added three disks, these disks are /dev/sdb, and /dev/sdc, /dev/sdd. - -Run the following commands to **[discover newly added LUNs or disks in Linux][2]**. - -``` -# ls /sys/class/scsi_host -host0 -``` - -``` -# echo "- - -" > /sys/class/scsi_host/host0/scan -``` - -``` -# fdisk -l -``` - -**General syntax for the creation of a physical volume (pvcreate).** - -``` -pvcreate [Physical Volume Name] -``` - -Once the disk is detected in the OS, use the pvcreate command to initialize the LVM PV (Physical Volumes). - -``` -# pvcreate /dev/sdb /dev/sdc /dev/sdd -Physical volume "/dev/sdb" successfully created -Physical volume "/dev/sdc" successfully created -Physical volume "/dev/sdd" successfully created -``` - -**Make a note:** - - * The above command erases any data on the given disks /dev/sdb, /dev/sdc and /dev/sdd. - * Physical disk can be added directly into the LVM PV instead of the disk partition. - - - -Use the pvdisplay and pvs commands to display the PVs you have created. The pvs command shows summarize output and the pvdisplay shows the detailed output of the PVs. - -``` -# pvs -PV VG Fmt Attr PSize PFree -/dev/sdb lvm2 a-- 15.00g 15.00g -/dev/sdc lvm2 a-- 15.00g 15.00g -/dev/sdd lvm2 a-- 15.00g 15.00g -``` - -``` -# pvdisplay - -"/dev/sdb" is a new physical volume of "15.00 GiB" ---- NEW Physical volume --- -PV Name /dev/sdb -VG Name -PV Size 15.00 GiB -Allocatable NO -PE Size 0 -Total PE 0 -Free PE 0 -Allocated PE 0 -PV UUID 69d9dd18-36be-4631-9ebb-78f05fe3217f - -"/dev/sdc" is a new physical volume of "15.00 GiB" ---- NEW Physical volume --- -PV Name /dev/sdc -VG Name -PV Size 15.00 GiB -Allocatable NO -PE Size 0 -Total PE 0 -Free PE 0 -Allocated PE 0 -PV UUID a2092b92-af29-4760-8e68-7a201922573b - -"/dev/sdd" is a new physical volume of "15.00 GiB" ---- NEW Physical volume --- -PV Name /dev/sdd -VG Name -PV Size 15.00 GiB -Allocatable NO -PE Size 0 -Total PE 0 -Free PE 0 -Allocated PE 0 -PV UUID d92fa769-e00f-4fd7-b6ed-ecf7224af7faS -``` - -### How to Create a Volume Group - -Volume group is the another layer in LVM structure. Basically the volume group consists of the LVM physical volumes you created. You can add physical volume to an existing volume group or create a new volume group for physical volume as needed. - -**General syntax for Volume Group creation (vgcreate).** - -``` -vgcreate [Volume Group Name] [Physical Volume Name] -``` - -Use the following command to add a new physical volume to the new volume group. - -``` -# vgcreate vg01 /dev/sdb /dev/sdc /dev/sdd -Volume group "vg01" successfully created -``` - -**Make a note:** By default, it uses 4MB for physical extent, but you can change it based on your need. - -Use the vgs and vgdisplay commands to display information about the VG you created. - -``` -# vgs vg01 -VG #PV #LV #SN Attr VSize VFree -vg01 3 0 0 wz--n- 44.99g 44.99g -``` - -``` -# vgdisplay vg01 ---- Volume group --- -VG Name vg01 -System ID -Format lvm2 -Metadata Areas 3 -Metadata Sequence No 1 -VG Access read/write -VG Status resizable -MAX LV 0 -Cur LV 0 -Open LV 0 -Max PV 0 -Cur PV 3 -Act PV 3 -VG Size 44.99 GiB -PE Size 4.00 MiB -Total PE 11511 -Alloc PE / Size 0 / 0 -Free PE / Size 11511 / 44.99 GiB -VG UUID d17e3c31-e2c9-4f11-809c-94a549bc43b7 -``` - -### How to Extent Volume Group - -If you do not have space in the VG, Use the following command to add a new physical volume to the existing volume group. - -**Common syntax for Volume Group extension (vgextend).** - -``` -vgextend [Existing Volume Group Name] [Physical Volume Name] -``` - -``` -# vgextend vg01 /dev/sde - Volume group "vg01" successfully extended -``` - -### How to Create Logical Volume Using GB Size’s - -Logical Volume is the top layer in LVM structure. Logical volumes are block devices created from the volume group. It acts as a virtual disk partition and can be easily managed using LVM commands. - -You can use the lvcreate command to create a logical volume. - -**General syntax for creating logical volume (lvcreate)** - -``` -lvcreate –n [Logical Volume Name] –L [Logical Volume Size] [Name of the Volume Group where the LV to be created] -``` - -Run the below command to create a logical volume lv001 of size 10 GB. - -``` -# lvcreate -n lv001 -L 10G vg01 -Logical volume "lv001" created -``` - -Use the lvs and lvdisplay commands to display information about the LVs you have created. - -``` -# lvs /dev/vg01/lvol01 -LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert -lv001 vg01 mwi-a-m-- 10.00g lv001_mlog 100.00 -``` - -``` -# lvdisplay /dev/vg01/lv001 ---- Logical volume --- -LV Path /dev/vg01/lv001 -LV Name lv001 -VG Name vg01 -LV UUID ca307aa4-0866-49b1-8184-004025789e63 -LV Write Access read/write -LV Creation host, time localhost.localdomain, 2020-09-10 11:43:05 -0700 -LV Status available -# open 0 -LV Size 10.00 GiB -Current LE 2560 -Segments 1 -Allocation inherit -Read ahead sectors auto -- currently set to 256 -Block device 253:4 -``` - -### How to Create Logical Volume Using PE Size’s - -Alternatively, you can create Logical Volumes Using Physical Extends (PE) size. - -### How to Calculate PE Value? - -It’s very simple, for example, if you have a volume group of 10 GB, then what is the PE size? - -By default, it uses 4MB for the physical extent, but check the correct PE size by running the vgdisplay command, as this can be changed based on requirements. - -``` -10GB = 10240MB / 4MB (PE Size) = 2560 PEs -``` - -**Common syntax for Logical Volume Creation with PE Size’s (lvcreate).** - -``` -lvcreate –n [Logical Volume Name] –l [Physical Extends (PE) Size] [Name of the Volume Group where the LV to be created] -``` - -To create 10GB of logical volume using the PE size the command would be: - -``` -# lvcreate -n lv001 -l 2560 vg01 -``` - -### How to Create File system - -You cannot use a logical volume until you create a valid file system. - -**General syntax to create a file system.** - -``` -mkfs –t [File System Type] /dev/[Name of the Volume Group where LV resides]/[LV name] -``` - -Use the below command to format the logical volume lv001 with the ext4 file system. - -``` -# mkfs -t ext4 /dev/vg01/lv001 -``` - -For xfs file system. - -``` -# mkfs -t xfs /dev/vg01/lv001 -``` - -### Mounting Logical Volume - -Finally, you need to mount the logical volume to use it. Make sure to add an entry to **/etc/fstab** so that it loads automatically when the system boots. - -Create a directory to mount the logical volume. - -``` -# mkdir /lvmtest -``` - -Use the mount command to **[mount the logical volume][3]**. - -``` -# mount /dev/vg01/lv001 /lvmtest -``` - -Add new logical volume details to the **[/etc/fstab file][4]** to mount automatically when the system starts. - -``` -# vi /etc/fstab -/dev/vg01/lv001 /lvmtest xfs defaults 0 0 -``` - -Check the newly mounted volume using the **[df command][5]**. - -``` -# df -h /lvmtest -Filesystem Size Used Avail Use% Mounted on -/dev/mapper/vg01-lv001 15360M 34M 15326M 4% /lvmtest -``` - --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/create-lvm-storage-logical-volume-manager-in-linux/ - -作者:[Magesh Maruthamuthu][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://www.2daygeek.com/author/magesh/ -[b]: https://github.com/lujun9972 -[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[2]: https://www.2daygeek.com/scan-detect-luns-scsi-disks-on-redhat-centos-oracle-linux/ -[3]: https://www.2daygeek.com/mount-unmount-file-system-partition-in-linux/ -[4]: https://www.2daygeek.com/understanding-linux-etc-fstab-file/ -[5]: https://www.2daygeek.com/linux-check-disk-space-usage-df-command/ From 527b4ec828bd46b3d6912c164600ce9651107116 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 1 Oct 2020 09:12:36 +0800 Subject: [PATCH 0275/1156] translated --- ...VM (Logical Volume Management) in Linux.md | 325 ++++++++++++++++++ 1 file changed, 325 insertions(+) create mode 100644 translated/tech/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md diff --git a/translated/tech/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md b/translated/tech/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md new file mode 100644 index 0000000000..a822280f7a --- /dev/null +++ b/translated/tech/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md @@ -0,0 +1,325 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Create/Configure LVM (Logical Volume Management) in Linux) +[#]: via: (https://www.2daygeek.com/create-lvm-storage-logical-volume-manager-in-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +如何在 Linux 中创建/配置 LVM(逻辑卷管理)? +====== + +逻辑卷管理器 (LVM) 在 Linux 系统中扮演着重要的角色,它可以提高磁盘管理的可用性、磁盘 I/O、性能和能力。 + +LVM 是一种被广泛使用的技术,对于磁盘管理来说,它是非常灵活的。 + +它在物理磁盘和文件系统之间增加了一个额外的层,允许你创建一个逻辑卷而不是物理磁盘。 + +LVM 允许你在需要的时候轻松地调整、扩展和减少逻辑卷的大小。 + +![][1] + +### 如何创建 LVM 物理卷? + +你可以使用任何磁盘、RAID 阵列、SAN 磁盘或分区作为 LVM 物理卷。 + +让我们想象一下,你已经添加了三个磁盘,它们是 /dev/sdb、/dev/sdc 和 /dev/sdd。 + +运行以下命令来**[发现 Linux 中新添加的 LUN 或磁盘][2]**: + +``` +# ls /sys/class/scsi_host +host0 +``` + +``` +# echo "- - -" > /sys/class/scsi_host/host0/scan +``` + +``` +# fdisk -l +``` + +**创建物理卷 (pvcreate) 的一般语法:** + +``` +pvcreate [物理卷名] +``` + +当在系统中检测到磁盘,使用 pvcreate 命令初始化 LVM PV(物理卷): + +``` +# pvcreate /dev/sdb /dev/sdc /dev/sdd +Physical volume "/dev/sdb" successfully created +Physical volume "/dev/sdc" successfully created +Physical volume "/dev/sdd" successfully created +``` + +**请注意:** + + * 上面的命令将删除给定磁盘 /dev/sdb、/dev/sdc 和 /dev/sdd 上的所有数据。 + * 物理磁盘可以直接添加到 LVM PV 中,而不是磁盘分区。 + + + +使用 pvdisplay 和 pvs 命令来显示你创建的 PV。pvs 命令显示的是摘要输出,pvdisplay 显示的是 PV 的详细输出: + +``` +# pvs +PV VG Fmt Attr PSize PFree +/dev/sdb lvm2 a-- 15.00g 15.00g +/dev/sdc lvm2 a-- 15.00g 15.00g +/dev/sdd lvm2 a-- 15.00g 15.00g +``` + +``` +# pvdisplay + +"/dev/sdb" is a new physical volume of "15.00 GiB" +--- NEW Physical volume --- +PV Name /dev/sdb +VG Name +PV Size 15.00 GiB +Allocatable NO +PE Size 0 +Total PE 0 +Free PE 0 +Allocated PE 0 +PV UUID 69d9dd18-36be-4631-9ebb-78f05fe3217f + +"/dev/sdc" is a new physical volume of "15.00 GiB" +--- NEW Physical volume --- +PV Name /dev/sdc +VG Name +PV Size 15.00 GiB +Allocatable NO +PE Size 0 +Total PE 0 +Free PE 0 +Allocated PE 0 +PV UUID a2092b92-af29-4760-8e68-7a201922573b + +"/dev/sdd" is a new physical volume of "15.00 GiB" +--- NEW Physical volume --- +PV Name /dev/sdd +VG Name +PV Size 15.00 GiB +Allocatable NO +PE Size 0 +Total PE 0 +Free PE 0 +Allocated PE 0 +PV UUID d92fa769-e00f-4fd7-b6ed-ecf7224af7faS +``` + +### 如何创建一个卷组 + +卷组是 LVM 结构中的另一层。基本上,卷组由你创建的 LVM 物理卷组成,你可以将物理卷添加到现有的卷组中,或者根据需要为物理卷创建新的卷组。 + +**创建卷组 (vgcreate) 的一般语法:** + +``` +vgcreate [卷组名] [物理卷名] +``` + +使用以下命令将一个新的物理卷添加到新的卷组中: + +``` +# vgcreate vg01 /dev/sdb /dev/sdc /dev/sdd +Volume group "vg01" successfully created +``` + +**请注意:**默认情况下,它使用 4MB 的物理范围,但你可以根据你的需要改变它。 + +使用 vgs 和 vgdisplay 命令来显示你创建的 VG 的信息: + +``` +# vgs vg01 +VG #PV #LV #SN Attr VSize VFree +vg01 3 0 0 wz--n- 44.99g 44.99g +``` + +``` +# vgdisplay vg01 +--- Volume group --- +VG Name vg01 +System ID +Format lvm2 +Metadata Areas 3 +Metadata Sequence No 1 +VG Access read/write +VG Status resizable +MAX LV 0 +Cur LV 0 +Open LV 0 +Max PV 0 +Cur PV 3 +Act PV 3 +VG Size 44.99 GiB +PE Size 4.00 MiB +Total PE 11511 +Alloc PE / Size 0 / 0 +Free PE / Size 11511 / 44.99 GiB +VG UUID d17e3c31-e2c9-4f11-809c-94a549bc43b7 +``` + +### 如何扩展卷组 + +如果 VG 没有空间,请使用以下命令将新的物理卷添加到现有卷组中。 + +**卷组扩展 (vgextend) 的一般语法:** + +``` +vgextend [已有卷组名] [物理卷名] +``` + +``` +# vgextend vg01 /dev/sde + Volume group "vg01" successfully extended +``` + +### 如何以 GB 为单位创建逻辑卷? + +逻辑卷是 LVM 结构中的顶层。逻辑卷是由卷组创建的块设备。它作为一个虚拟磁盘分区,可以使用 LVM 命令轻松管理。 + +你可以使用 lvcreate 命令创建一个新的逻辑卷。 + +**创建逻辑卷 (lvcreate) 的一般语法:** + +``` +lvcreate –n [逻辑卷名] –L [逻辑卷大小] [要创建的 LV 所在的卷组名称] +``` + +运行下面的命令,创建一个大小为 10GB 的逻辑卷 lv001: + +``` +# lvcreate -n lv001 -L 10G vg01 +Logical volume "lv001" created +``` + +使用 lvs 和 lvdisplay 命令来显示你所创建的 LV 的信息: + +``` +# lvs /dev/vg01/lvol01 +LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert +lv001 vg01 mwi-a-m-- 10.00g lv001_mlog 100.00 +``` + +``` +# lvdisplay /dev/vg01/lv001 +--- Logical volume --- +LV Path /dev/vg01/lv001 +LV Name lv001 +VG Name vg01 +LV UUID ca307aa4-0866-49b1-8184-004025789e63 +LV Write Access read/write +LV Creation host, time localhost.localdomain, 2020-09-10 11:43:05 -0700 +LV Status available +# open 0 +LV Size 10.00 GiB +Current LE 2560 +Segments 1 +Allocation inherit +Read ahead sectors auto +- currently set to 256 +Block device 253:4 +``` + +### 如何以 PE 大小创建逻辑卷? + +或者,你可以使用物理扩展 (PE) 大小创建逻辑卷。 + +### 如何计算 PE 值? + +很简单,例如,如果你有一个 10GB 的卷组,那么 PE 大小是多少? + +默认情况下,它使用 4MB 的物理扩展,但通过运行 vgdisplay 命令来检查正确的 PE 大小,因为这可以根据需求进行更改。 + +``` +10GB = 10240MB / 4MB (PE 大小) = 2560 PEs +``` + +**用 PE 大小创建逻辑卷 (lvcreate) 的一般语法:** + +``` +lvcreate –n [逻辑卷名] –l [物理扩展 (PE) 大小] [要创建的 LV 所在的卷组名称] +``` + +要使用 PE 大小创建 10GB 的逻辑卷,命令如下: + +``` +# lvcreate -n lv001 -l 2560 vg01 +``` + +### 如何创建文件系统 + +在创建有效的文件系统之前,你不能使用逻辑卷。 + +**创建文件系统的一般语法:** + +``` +mkfs –t [文件系统类型] /dev/[LV 所在的卷组名称]/[LV 名称] +``` + +使用以下命令将逻辑卷 lv001 格式化为 ext4 文件系统: + +``` +# mkfs -t ext4 /dev/vg01/lv001 +``` + +对于 xfs 文件系统: + +``` +# mkfs -t xfs /dev/vg01/lv001 +``` + +### 挂载逻辑卷 + +最后,你需要挂载逻辑卷来使用它。确保在 **/etc/fstab** 中添加一个条目,以便系统启动时自动加载。 + +创建一个目录来挂载逻辑卷: + +``` +# mkdir /lvmtest +``` + +使用挂载命令 **[挂载逻辑卷][3]**: + +``` +# mount /dev/vg01/lv001 /lvmtest +``` + +在 **[/etc/fstab 文件][4]**中添加新的逻辑卷详细信息,以便系统启动时自动挂载: + +``` +# vi /etc/fstab +/dev/vg01/lv001 /lvmtest xfs defaults 0 0 +``` + +使用 **[df 命令][5]**检查新挂载的卷: + +``` +# df -h /lvmtest +Filesystem Size Used Avail Use% Mounted on +/dev/mapper/vg01-lv001 15360M 34M 15326M 4% /lvmtest +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/create-lvm-storage-logical-volume-manager-in-linux/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.2daygeek.com/scan-detect-luns-scsi-disks-on-redhat-centos-oracle-linux/ +[3]: https://www.2daygeek.com/mount-unmount-file-system-partition-in-linux/ +[4]: https://www.2daygeek.com/understanding-linux-etc-fstab-file/ +[5]: https://www.2daygeek.com/linux-check-disk-space-usage-df-command/ From e33d012606b4efcfc04d11b83b07485aaf7112ef Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 1 Oct 2020 09:23:41 +0800 Subject: [PATCH 0276/1156] =?UTF-8?q?=E5=BD=92=E6=A1=A3=20202009?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- published/{ => 202009}/20190105 Why Sorting is O(N log N).md | 0 .../20190226 Reducing security risks with centralized logging.md | 0 ...age Docker Containers with Portainer.io (GUI tool) - Part-1.md | 0 .../20191031 Advance your awk skills with two easy tutorials.md | 0 ...the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md | 0 published/{ => 202009}/20200415 Tweaking history on Linux.md | 0 .../20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md | 0 .../{ => 202009}/20200708 6 best practices for teams using Git.md | 0 ... network connections from the Linux command line with nmcli.md | 0 .../{ => 202009}/20200722 SCP user-s migration guide to rsync.md | 0 ...o create a documentation site with Docsify and GitHub Pages.md | 0 published/{ => 202009}/20200804 Leaving Google- Five Years On.md | 0 .../{ => 202009}/20200813 How to use printf to format output.md | 0 ...3 Linux Jargon Buster- What is Desktop Environment in Linux.md | 0 ...Recognize more devices on Linux with this USB ID Repository.md | 0 .../20200826 Create and run Python apps on your Android phone.md | 0 .../{ => 202009}/20200826 Customize your GNOME desktop theme.md | 0 ...anage your software repositories with this open source tool.md | 0 .../{ => 202009}/20200826 What is DNS and how does it work.md | 0 ...ion could be half the world-s mass by 2245, says researcher.md | 0 ... this command-line tool to find security flaws in your code.md | 0 ...0828 Use GraphQL as an API gateway to monitor microservices.md | 0 ...Best Free Online Markdown Editors That Are Also Open Source.md | 0 ...ter- What is a Display Server in Linux- What is it Used for.md | 0 ...o ultraviolet networks for secure battlefield communication.md | 0 ...gn a book cover with an open source alternative to InDesign.md | 0 ...s You to Sync Data With Cloud Services in Linux Graphically.md | 0 ... Convert Any Website into Desktop Application in Linux Mint.md | 0 ...emote management console using Python and Jupyter Notebooks.md | 0 ...t is a Linux Distribution- Why is it Called a ‘Distribution.md | 0 .../20200907 Program hardware from the Linux command line.md | 0 ...09 How to Connect to WiFi from the Terminal in Ubuntu Linux.md | 0 ...0909 Manage your SSH connections with this open source tool.md | 0 ...ing the Linux stat command to create flexible file listings.md | 0 ...Lets You Use NFC to Easily Authenticate Your Secure Devices.md | 0 ...re-s How to Investigate and Fix Long Shutdown Time in Linux.md | 0 ...extcloud simplified the signup process for decentralization.md | 0 .../20200914 Incremental backups with Btrfs snapshots.md | 0 ...at is a Long Term Support (LTS) Release- What is Ubuntu LTS.md | 0 ...munity Driven Open Source Password Manager -Not Cloud Based.md | 0 .../20200916 Huawei ban could complicate 5G deployment.md | 0 .../{ => 202009}/20200916 Teach Python with Jupyter Notebooks.md | 0 published/{ => 202009}/20200917 What-s new with rdiff-backup.md | 0 ... to Fix -Repository is not valid yet- Error in Ubuntu Linux.md | 0 ...Linux Jargon Buster- What is a Rolling Release Distribution.md | 0 .../{ => 202009}/20200921 Teach Python with the Mu editor.md | 0 ...Fi Inspired Linux Terminal Emulator With Some Cool Features.md | 0 47 files changed, 0 insertions(+), 0 deletions(-) rename published/{ => 202009}/20190105 Why Sorting is O(N log N).md (100%) rename published/{ => 202009}/20190226 Reducing security risks with centralized logging.md (100%) rename published/{ => 202009}/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md (100%) rename published/{ => 202009}/20191031 Advance your awk skills with two easy tutorials.md (100%) rename published/{ => 202009}/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md (100%) rename published/{ => 202009}/20200415 Tweaking history on Linux.md (100%) rename published/{ => 202009}/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md (100%) rename published/{ => 202009}/20200708 6 best practices for teams using Git.md (100%) rename published/{ => 202009}/20200721 Manage network connections from the Linux command line with nmcli.md (100%) rename published/{ => 202009}/20200722 SCP user-s migration guide to rsync.md (100%) rename published/{ => 202009}/20200728 How to create a documentation site with Docsify and GitHub Pages.md (100%) rename published/{ => 202009}/20200804 Leaving Google- Five Years On.md (100%) rename published/{ => 202009}/20200813 How to use printf to format output.md (100%) rename published/{ => 202009}/20200823 Linux Jargon Buster- What is Desktop Environment in Linux.md (100%) rename published/{ => 202009}/20200824 Recognize more devices on Linux with this USB ID Repository.md (100%) rename published/{ => 202009}/20200826 Create and run Python apps on your Android phone.md (100%) rename published/{ => 202009}/20200826 Customize your GNOME desktop theme.md (100%) rename published/{ => 202009}/20200826 Manage your software repositories with this open source tool.md (100%) rename published/{ => 202009}/20200826 What is DNS and how does it work.md (100%) rename published/{ => 202009}/20200827 Information could be half the world-s mass by 2245, says researcher.md (100%) rename published/{ => 202009}/20200827 Use this command-line tool to find security flaws in your code.md (100%) rename published/{ => 202009}/20200828 Use GraphQL as an API gateway to monitor microservices.md (100%) rename published/{ => 202009}/20200829 Best Free Online Markdown Editors That Are Also Open Source.md (100%) rename published/{ => 202009}/20200830 Linux Jargon Buster- What is a Display Server in Linux- What is it Used for.md (100%) rename published/{ => 202009}/20200831 Military looks to ultraviolet networks for secure battlefield communication.md (100%) rename published/{ => 202009}/20200902 Design a book cover with an open source alternative to InDesign.md (100%) rename published/{ => 202009}/20200903 Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically.md (100%) rename published/{ => 202009}/20200903 Soon You-ll be Able to Convert Any Website into Desktop Application in Linux Mint.md (100%) rename published/{ => 202009}/20200904 Build a remote management console using Python and Jupyter Notebooks.md (100%) rename published/{ => 202009}/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md (100%) rename published/{ => 202009}/20200907 Program hardware from the Linux command line.md (100%) rename published/{ => 202009}/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md (100%) rename published/{ => 202009}/20200909 Manage your SSH connections with this open source tool.md (100%) rename published/{ => 202009}/20200909 Using the Linux stat command to create flexible file listings.md (100%) rename published/{ => 202009}/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md (100%) rename published/{ => 202009}/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md (100%) rename published/{ => 202009}/20200914 How Nextcloud simplified the signup process for decentralization.md (100%) rename published/{ => 202009}/20200914 Incremental backups with Btrfs snapshots.md (100%) rename published/{ => 202009}/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md (100%) rename published/{ => 202009}/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md (100%) rename published/{ => 202009}/20200916 Huawei ban could complicate 5G deployment.md (100%) rename published/{ => 202009}/20200916 Teach Python with Jupyter Notebooks.md (100%) rename published/{ => 202009}/20200917 What-s new with rdiff-backup.md (100%) rename published/{ => 202009}/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md (100%) rename published/{ => 202009}/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md (100%) rename published/{ => 202009}/20200921 Teach Python with the Mu editor.md (100%) rename published/{ => 202009}/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md (100%) diff --git a/published/20190105 Why Sorting is O(N log N).md b/published/202009/20190105 Why Sorting is O(N log N).md similarity index 100% rename from published/20190105 Why Sorting is O(N log N).md rename to published/202009/20190105 Why Sorting is O(N log N).md diff --git a/published/20190226 Reducing security risks with centralized logging.md b/published/202009/20190226 Reducing security risks with centralized logging.md similarity index 100% rename from published/20190226 Reducing security risks with centralized logging.md rename to published/202009/20190226 Reducing security risks with centralized logging.md diff --git a/published/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md b/published/202009/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md similarity index 100% rename from published/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md rename to published/202009/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md diff --git a/published/20191031 Advance your awk skills with two easy tutorials.md b/published/202009/20191031 Advance your awk skills with two easy tutorials.md similarity index 100% rename from published/20191031 Advance your awk skills with two easy tutorials.md rename to published/202009/20191031 Advance your awk skills with two easy tutorials.md diff --git a/published/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md b/published/202009/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md similarity index 100% rename from published/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md rename to published/202009/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md diff --git a/published/20200415 Tweaking history on Linux.md b/published/202009/20200415 Tweaking history on Linux.md similarity index 100% rename from published/20200415 Tweaking history on Linux.md rename to published/202009/20200415 Tweaking history on Linux.md diff --git a/published/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md b/published/202009/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md similarity index 100% rename from published/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md rename to published/202009/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md diff --git a/published/20200708 6 best practices for teams using Git.md b/published/202009/20200708 6 best practices for teams using Git.md similarity index 100% rename from published/20200708 6 best practices for teams using Git.md rename to published/202009/20200708 6 best practices for teams using Git.md diff --git a/published/20200721 Manage network connections from the Linux command line with nmcli.md b/published/202009/20200721 Manage network connections from the Linux command line with nmcli.md similarity index 100% rename from published/20200721 Manage network connections from the Linux command line with nmcli.md rename to published/202009/20200721 Manage network connections from the Linux command line with nmcli.md diff --git a/published/20200722 SCP user-s migration guide to rsync.md b/published/202009/20200722 SCP user-s migration guide to rsync.md similarity index 100% rename from published/20200722 SCP user-s migration guide to rsync.md rename to published/202009/20200722 SCP user-s migration guide to rsync.md diff --git a/published/20200728 How to create a documentation site with Docsify and GitHub Pages.md b/published/202009/20200728 How to create a documentation site with Docsify and GitHub Pages.md similarity index 100% rename from published/20200728 How to create a documentation site with Docsify and GitHub Pages.md rename to published/202009/20200728 How to create a documentation site with Docsify and GitHub Pages.md diff --git a/published/20200804 Leaving Google- Five Years On.md b/published/202009/20200804 Leaving Google- Five Years On.md similarity index 100% rename from published/20200804 Leaving Google- Five Years On.md rename to published/202009/20200804 Leaving Google- Five Years On.md diff --git a/published/20200813 How to use printf to format output.md b/published/202009/20200813 How to use printf to format output.md similarity index 100% rename from published/20200813 How to use printf to format output.md rename to published/202009/20200813 How to use printf to format output.md diff --git a/published/20200823 Linux Jargon Buster- What is Desktop Environment in Linux.md b/published/202009/20200823 Linux Jargon Buster- What is Desktop Environment in Linux.md similarity index 100% rename from published/20200823 Linux Jargon Buster- What is Desktop Environment in Linux.md rename to published/202009/20200823 Linux Jargon Buster- What is Desktop Environment in Linux.md diff --git a/published/20200824 Recognize more devices on Linux with this USB ID Repository.md b/published/202009/20200824 Recognize more devices on Linux with this USB ID Repository.md similarity index 100% rename from published/20200824 Recognize more devices on Linux with this USB ID Repository.md rename to published/202009/20200824 Recognize more devices on Linux with this USB ID Repository.md diff --git a/published/20200826 Create and run Python apps on your Android phone.md b/published/202009/20200826 Create and run Python apps on your Android phone.md similarity index 100% rename from published/20200826 Create and run Python apps on your Android phone.md rename to published/202009/20200826 Create and run Python apps on your Android phone.md diff --git a/published/20200826 Customize your GNOME desktop theme.md b/published/202009/20200826 Customize your GNOME desktop theme.md similarity index 100% rename from published/20200826 Customize your GNOME desktop theme.md rename to published/202009/20200826 Customize your GNOME desktop theme.md diff --git a/published/20200826 Manage your software repositories with this open source tool.md b/published/202009/20200826 Manage your software repositories with this open source tool.md similarity index 100% rename from published/20200826 Manage your software repositories with this open source tool.md rename to published/202009/20200826 Manage your software repositories with this open source tool.md diff --git a/published/20200826 What is DNS and how does it work.md b/published/202009/20200826 What is DNS and how does it work.md similarity index 100% rename from published/20200826 What is DNS and how does it work.md rename to published/202009/20200826 What is DNS and how does it work.md diff --git a/published/20200827 Information could be half the world-s mass by 2245, says researcher.md b/published/202009/20200827 Information could be half the world-s mass by 2245, says researcher.md similarity index 100% rename from published/20200827 Information could be half the world-s mass by 2245, says researcher.md rename to published/202009/20200827 Information could be half the world-s mass by 2245, says researcher.md diff --git a/published/20200827 Use this command-line tool to find security flaws in your code.md b/published/202009/20200827 Use this command-line tool to find security flaws in your code.md similarity index 100% rename from published/20200827 Use this command-line tool to find security flaws in your code.md rename to published/202009/20200827 Use this command-line tool to find security flaws in your code.md diff --git a/published/20200828 Use GraphQL as an API gateway to monitor microservices.md b/published/202009/20200828 Use GraphQL as an API gateway to monitor microservices.md similarity index 100% rename from published/20200828 Use GraphQL as an API gateway to monitor microservices.md rename to published/202009/20200828 Use GraphQL as an API gateway to monitor microservices.md diff --git a/published/20200829 Best Free Online Markdown Editors That Are Also Open Source.md b/published/202009/20200829 Best Free Online Markdown Editors That Are Also Open Source.md similarity index 100% rename from published/20200829 Best Free Online Markdown Editors That Are Also Open Source.md rename to published/202009/20200829 Best Free Online Markdown Editors That Are Also Open Source.md diff --git a/published/20200830 Linux Jargon Buster- What is a Display Server in Linux- What is it Used for.md b/published/202009/20200830 Linux Jargon Buster- What is a Display Server in Linux- What is it Used for.md similarity index 100% rename from published/20200830 Linux Jargon Buster- What is a Display Server in Linux- What is it Used for.md rename to published/202009/20200830 Linux Jargon Buster- What is a Display Server in Linux- What is it Used for.md diff --git a/published/20200831 Military looks to ultraviolet networks for secure battlefield communication.md b/published/202009/20200831 Military looks to ultraviolet networks for secure battlefield communication.md similarity index 100% rename from published/20200831 Military looks to ultraviolet networks for secure battlefield communication.md rename to published/202009/20200831 Military looks to ultraviolet networks for secure battlefield communication.md diff --git a/published/20200902 Design a book cover with an open source alternative to InDesign.md b/published/202009/20200902 Design a book cover with an open source alternative to InDesign.md similarity index 100% rename from published/20200902 Design a book cover with an open source alternative to InDesign.md rename to published/202009/20200902 Design a book cover with an open source alternative to InDesign.md diff --git a/published/20200903 Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically.md b/published/202009/20200903 Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically.md similarity index 100% rename from published/20200903 Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically.md rename to published/202009/20200903 Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically.md diff --git a/published/20200903 Soon You-ll be Able to Convert Any Website into Desktop Application in Linux Mint.md b/published/202009/20200903 Soon You-ll be Able to Convert Any Website into Desktop Application in Linux Mint.md similarity index 100% rename from published/20200903 Soon You-ll be Able to Convert Any Website into Desktop Application in Linux Mint.md rename to published/202009/20200903 Soon You-ll be Able to Convert Any Website into Desktop Application in Linux Mint.md diff --git a/published/20200904 Build a remote management console using Python and Jupyter Notebooks.md b/published/202009/20200904 Build a remote management console using Python and Jupyter Notebooks.md similarity index 100% rename from published/20200904 Build a remote management console using Python and Jupyter Notebooks.md rename to published/202009/20200904 Build a remote management console using Python and Jupyter Notebooks.md diff --git a/published/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md b/published/202009/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md similarity index 100% rename from published/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md rename to published/202009/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md diff --git a/published/20200907 Program hardware from the Linux command line.md b/published/202009/20200907 Program hardware from the Linux command line.md similarity index 100% rename from published/20200907 Program hardware from the Linux command line.md rename to published/202009/20200907 Program hardware from the Linux command line.md diff --git a/published/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md b/published/202009/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md similarity index 100% rename from published/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md rename to published/202009/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md diff --git a/published/20200909 Manage your SSH connections with this open source tool.md b/published/202009/20200909 Manage your SSH connections with this open source tool.md similarity index 100% rename from published/20200909 Manage your SSH connections with this open source tool.md rename to published/202009/20200909 Manage your SSH connections with this open source tool.md diff --git a/published/20200909 Using the Linux stat command to create flexible file listings.md b/published/202009/20200909 Using the Linux stat command to create flexible file listings.md similarity index 100% rename from published/20200909 Using the Linux stat command to create flexible file listings.md rename to published/202009/20200909 Using the Linux stat command to create flexible file listings.md diff --git a/published/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md b/published/202009/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md similarity index 100% rename from published/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md rename to published/202009/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md diff --git a/published/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md b/published/202009/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md similarity index 100% rename from published/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md rename to published/202009/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md diff --git a/published/20200914 How Nextcloud simplified the signup process for decentralization.md b/published/202009/20200914 How Nextcloud simplified the signup process for decentralization.md similarity index 100% rename from published/20200914 How Nextcloud simplified the signup process for decentralization.md rename to published/202009/20200914 How Nextcloud simplified the signup process for decentralization.md diff --git a/published/20200914 Incremental backups with Btrfs snapshots.md b/published/202009/20200914 Incremental backups with Btrfs snapshots.md similarity index 100% rename from published/20200914 Incremental backups with Btrfs snapshots.md rename to published/202009/20200914 Incremental backups with Btrfs snapshots.md diff --git a/published/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md b/published/202009/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md similarity index 100% rename from published/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md rename to published/202009/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md diff --git a/published/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md b/published/202009/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md similarity index 100% rename from published/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md rename to published/202009/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md diff --git a/published/20200916 Huawei ban could complicate 5G deployment.md b/published/202009/20200916 Huawei ban could complicate 5G deployment.md similarity index 100% rename from published/20200916 Huawei ban could complicate 5G deployment.md rename to published/202009/20200916 Huawei ban could complicate 5G deployment.md diff --git a/published/20200916 Teach Python with Jupyter Notebooks.md b/published/202009/20200916 Teach Python with Jupyter Notebooks.md similarity index 100% rename from published/20200916 Teach Python with Jupyter Notebooks.md rename to published/202009/20200916 Teach Python with Jupyter Notebooks.md diff --git a/published/20200917 What-s new with rdiff-backup.md b/published/202009/20200917 What-s new with rdiff-backup.md similarity index 100% rename from published/20200917 What-s new with rdiff-backup.md rename to published/202009/20200917 What-s new with rdiff-backup.md diff --git a/published/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md b/published/202009/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md similarity index 100% rename from published/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md rename to published/202009/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md diff --git a/published/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md b/published/202009/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md similarity index 100% rename from published/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md rename to published/202009/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md diff --git a/published/20200921 Teach Python with the Mu editor.md b/published/202009/20200921 Teach Python with the Mu editor.md similarity index 100% rename from published/20200921 Teach Python with the Mu editor.md rename to published/202009/20200921 Teach Python with the Mu editor.md diff --git a/published/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md b/published/202009/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md similarity index 100% rename from published/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md rename to published/202009/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md From 712b6e4a3f47012aee34d0163a21df1746efbc69 Mon Sep 17 00:00:00 2001 From: zouchong Date: Thu, 1 Oct 2020 10:19:59 +0800 Subject: [PATCH 0277/1156] hankchow translating --- sources/tech/20200903 A practical guide to learning awk.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200903 A practical guide to learning awk.md b/sources/tech/20200903 A practical guide to learning awk.md index b2fa7116c1..181a5d484e 100644 --- a/sources/tech/20200903 A practical guide to learning awk.md +++ b/sources/tech/20200903 A practical guide to learning awk.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (HankChow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f6e4dad843d609055c7c2c46cecb013a97c1695b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 1 Oct 2020 11:14:47 +0800 Subject: [PATCH 0278/1156] PRF @geekpi --- ...VM (Logical Volume Management) in Linux.md | 68 +++++++++---------- 1 file changed, 33 insertions(+), 35 deletions(-) diff --git a/translated/tech/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md b/translated/tech/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md index a822280f7a..3cbbb81ecd 100644 --- a/translated/tech/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md +++ b/translated/tech/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md @@ -1,16 +1,16 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) -[#]: subject: (How to Create/Configure LVM (Logical Volume Management) in Linux) +[#]: subject: (How to Create/Configure LVM in Linux) [#]: via: (https://www.2daygeek.com/create-lvm-storage-logical-volume-manager-in-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -如何在 Linux 中创建/配置 LVM(逻辑卷管理)? +如何在 Linux 中创建/配置 LVM(逻辑卷管理) ====== -逻辑卷管理器 (LVM) 在 Linux 系统中扮演着重要的角色,它可以提高磁盘管理的可用性、磁盘 I/O、性能和能力。 +逻辑卷管理Logical Volume Management(LVM)在 Linux 系统中扮演着重要的角色,它可以提高可用性、磁盘 I/O、性能和磁盘管理的能力。 LVM 是一种被广泛使用的技术,对于磁盘管理来说,它是非常灵活的。 @@ -22,11 +22,11 @@ LVM 允许你在需要的时候轻松地调整、扩展和减少逻辑卷的大 ### 如何创建 LVM 物理卷? -你可以使用任何磁盘、RAID 阵列、SAN 磁盘或分区作为 LVM 物理卷。 +你可以使用任何磁盘、RAID 阵列、SAN 磁盘或分区作为 LVM 物理卷Physical Volume(PV)。 -让我们想象一下,你已经添加了三个磁盘,它们是 /dev/sdb、/dev/sdc 和 /dev/sdd。 +让我们想象一下,你已经添加了三个磁盘,它们是 `/dev/sdb`、`/dev/sdc` 和 `/dev/sdd`。 -运行以下命令来**[发现 Linux 中新添加的 LUN 或磁盘][2]**: +运行以下命令来[发现 Linux 中新添加的 LUN 或磁盘][2]: ``` # ls /sys/class/scsi_host @@ -41,13 +41,13 @@ host0 # fdisk -l ``` -**创建物理卷 (pvcreate) 的一般语法:** +**创建物理卷 (`pvcreate`) 的一般语法:** ``` pvcreate [物理卷名] ``` -当在系统中检测到磁盘,使用 pvcreate 命令初始化 LVM PV(物理卷): +当在系统中检测到磁盘,使用 `pvcreate` 命令初始化 LVM PV: ``` # pvcreate /dev/sdb /dev/sdc /dev/sdd @@ -58,12 +58,10 @@ Physical volume "/dev/sdd" successfully created **请注意:** - * 上面的命令将删除给定磁盘 /dev/sdb、/dev/sdc 和 /dev/sdd 上的所有数据。 - * 物理磁盘可以直接添加到 LVM PV 中,而不是磁盘分区。 + * 上面的命令将删除给定磁盘 `/dev/sdb`、`/dev/sdc` 和 `/dev/sdd` 上的所有数据。 + * 物理磁盘可以直接添加到 LVM PV 中,而不必是磁盘分区。 - - -使用 pvdisplay 和 pvs 命令来显示你创建的 PV。pvs 命令显示的是摘要输出,pvdisplay 显示的是 PV 的详细输出: +使用 `pvdisplay` 和 `pvs` 命令来显示你创建的 PV。`pvs` 命令显示的是摘要输出,`pvdisplay` 显示的是 PV 的详细输出: ``` # pvs @@ -115,9 +113,9 @@ PV UUID d92fa769-e00f-4fd7-b6ed-ecf7224af7faS ### 如何创建一个卷组 -卷组是 LVM 结构中的另一层。基本上,卷组由你创建的 LVM 物理卷组成,你可以将物理卷添加到现有的卷组中,或者根据需要为物理卷创建新的卷组。 +卷组Volume Group(VG)是 LVM 结构中的另一层。基本上,卷组由你创建的 LVM 物理卷组成,你可以将物理卷添加到现有的卷组中,或者根据需要为物理卷创建新的卷组。 -**创建卷组 (vgcreate) 的一般语法:** +**创建卷组 (`vgcreate`) 的一般语法:** ``` vgcreate [卷组名] [物理卷名] @@ -130,9 +128,9 @@ vgcreate [卷组名] [物理卷名] Volume group "vg01" successfully created ``` -**请注意:**默认情况下,它使用 4MB 的物理范围,但你可以根据你的需要改变它。 +**请注意:**默认情况下,它使用 4MB 的物理范围Physical Extent(PE),但你可以根据你的需要改变它。 -使用 vgs 和 vgdisplay 命令来显示你创建的 VG 的信息: +使用 `vgs` 和 `vgdisplay` 命令来显示你创建的 VG 的信息: ``` # vgs vg01 @@ -168,7 +166,7 @@ VG UUID d17e3c31-e2c9-4f11-809c-94a549bc43b7 如果 VG 没有空间,请使用以下命令将新的物理卷添加到现有卷组中。 -**卷组扩展 (vgextend) 的一般语法:** +**卷组扩展 (`vgextend`)的一般语法:** ``` vgextend [已有卷组名] [物理卷名] @@ -181,24 +179,24 @@ vgextend [已有卷组名] [物理卷名] ### 如何以 GB 为单位创建逻辑卷? -逻辑卷是 LVM 结构中的顶层。逻辑卷是由卷组创建的块设备。它作为一个虚拟磁盘分区,可以使用 LVM 命令轻松管理。 +逻辑卷Logical Volume(LV)是 LVM 结构中的顶层。逻辑卷是由卷组创建的块设备。它作为一个虚拟磁盘分区,可以使用 LVM 命令轻松管理。 -你可以使用 lvcreate 命令创建一个新的逻辑卷。 +你可以使用 `lvcreate` 命令创建一个新的逻辑卷。 -**创建逻辑卷 (lvcreate) 的一般语法:** +**创建逻辑卷(`lvcreate`) 的一般语法:** ``` lvcreate –n [逻辑卷名] –L [逻辑卷大小] [要创建的 LV 所在的卷组名称] ``` -运行下面的命令,创建一个大小为 10GB 的逻辑卷 lv001: +运行下面的命令,创建一个大小为 10GB 的逻辑卷 `lv001`: ``` # lvcreate -n lv001 -L 10G vg01 Logical volume "lv001" created ``` -使用 lvs 和 lvdisplay 命令来显示你所创建的 LV 的信息: +使用 `lvs` 和 `lvdisplay` 命令来显示你所创建的 LV 的信息: ``` # lvs /dev/vg01/lvol01 @@ -228,19 +226,19 @@ Block device 253:4 ### 如何以 PE 大小创建逻辑卷? -或者,你可以使用物理扩展 (PE) 大小创建逻辑卷。 +或者,你可以使用物理范围(PE)大小创建逻辑卷。 ### 如何计算 PE 值? 很简单,例如,如果你有一个 10GB 的卷组,那么 PE 大小是多少? -默认情况下,它使用 4MB 的物理扩展,但通过运行 vgdisplay 命令来检查正确的 PE 大小,因为这可以根据需求进行更改。 +默认情况下,它使用 4MB 的物理范围,但可以通过运行 `vgdisplay` 命令来检查正确的 PE 大小,因为这可以根据需求进行更改。 ``` -10GB = 10240MB / 4MB (PE 大小) = 2560 PEs +10GB = 10240MB / 4MB (PE 大小) = 2560 PE ``` -**用 PE 大小创建逻辑卷 (lvcreate) 的一般语法:** +**用 PE 大小创建逻辑卷 (`lvcreate`) 的一般语法:** ``` lvcreate –n [逻辑卷名] –l [物理扩展 (PE) 大小] [要创建的 LV 所在的卷组名称] @@ -262,7 +260,7 @@ lvcreate –n [逻辑卷名] –l [物理扩展 (PE) 大小] [要创建的 L mkfs –t [文件系统类型] /dev/[LV 所在的卷组名称]/[LV 名称] ``` -使用以下命令将逻辑卷 lv001 格式化为 ext4 文件系统: +使用以下命令将逻辑卷 `lv001` 格式化为 ext4 文件系统: ``` # mkfs -t ext4 /dev/vg01/lv001 @@ -276,7 +274,7 @@ mkfs –t [文件系统类型] /dev/[LV 所在的卷组名称]/[LV 名称] ### 挂载逻辑卷 -最后,你需要挂载逻辑卷来使用它。确保在 **/etc/fstab** 中添加一个条目,以便系统启动时自动加载。 +最后,你需要挂载逻辑卷来使用它。确保在 `/etc/fstab` 中添加一个条目,以便系统启动时自动加载。 创建一个目录来挂载逻辑卷: @@ -284,20 +282,20 @@ mkfs –t [文件系统类型] /dev/[LV 所在的卷组名称]/[LV 名称] # mkdir /lvmtest ``` -使用挂载命令 **[挂载逻辑卷][3]**: +使用挂载命令[挂载逻辑卷][3]: ``` # mount /dev/vg01/lv001 /lvmtest ``` -在 **[/etc/fstab 文件][4]**中添加新的逻辑卷详细信息,以便系统启动时自动挂载: +在 [/etc/fstab 文件][4]中添加新的逻辑卷详细信息,以便系统启动时自动挂载: ``` # vi /etc/fstab /dev/vg01/lv001 /lvmtest xfs defaults 0 0 ``` -使用 **[df 命令][5]**检查新挂载的卷: +使用 [df 命令][5]检查新挂载的卷: ``` # df -h /lvmtest @@ -312,13 +310,13 @@ via: https://www.2daygeek.com/create-lvm-storage-logical-volume-manager-in-linux 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.2daygeek.com/author/magesh/ [b]: https://github.com/lujun9972 -[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[1]: https://www.2daygeek.com/wp-content/uploads/2020/09/create-lvm-storage-logical-volume-manager-in-linux-2.png [2]: https://www.2daygeek.com/scan-detect-luns-scsi-disks-on-redhat-centos-oracle-linux/ [3]: https://www.2daygeek.com/mount-unmount-file-system-partition-in-linux/ [4]: https://www.2daygeek.com/understanding-linux-etc-fstab-file/ From df03db08458be86b09fa19c3e2b1115ed3b913c8 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 1 Oct 2020 11:16:14 +0800 Subject: [PATCH 0279/1156] PUB @geekpi https://linux.cn/article-12670-1.html --- ...-Configure LVM (Logical Volume Management) in Linux.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) rename {translated/tech => published}/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md (97%) diff --git a/translated/tech/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md b/published/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md similarity index 97% rename from translated/tech/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md rename to published/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md index 3cbbb81ecd..d89593b28d 100644 --- a/translated/tech/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md +++ b/published/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12670-1.html) [#]: subject: (How to Create/Configure LVM in Linux) [#]: via: (https://www.2daygeek.com/create-lvm-storage-logical-volume-manager-in-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) @@ -10,6 +10,8 @@ 如何在 Linux 中创建/配置 LVM(逻辑卷管理) ====== +![](https://img.linux.net.cn/data/attachment/album/202010/01/111414m2y0mdhgvd9j1bgv.jpg) + 逻辑卷管理Logical Volume Management(LVM)在 Linux 系统中扮演着重要的角色,它可以提高可用性、磁盘 I/O、性能和磁盘管理的能力。 LVM 是一种被广泛使用的技术,对于磁盘管理来说,它是非常灵活的。 @@ -18,7 +20,7 @@ LVM 是一种被广泛使用的技术,对于磁盘管理来说,它是非常 LVM 允许你在需要的时候轻松地调整、扩展和减少逻辑卷的大小。 -![][1] +![](https://img.linux.net.cn/data/attachment/album/202010/01/111230el14fubc4ku55o3k.jpeg) ### 如何创建 LVM 物理卷? From 162348d38b33dbaaca63feee1774fa97707791c3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 1 Oct 2020 12:39:49 +0800 Subject: [PATCH 0280/1156] PRF @lxbwolf --- ...ate Fast and Resource-Friendly Websites.md | 102 +++++++++--------- 1 file changed, 53 insertions(+), 49 deletions(-) diff --git a/translated/tech/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md b/translated/tech/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md index 662ea7beec..3a674b2607 100644 --- a/translated/tech/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md +++ b/translated/tech/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md @@ -1,154 +1,158 @@ [#]: collector: "lujun9972" [#]: translator: "lxbwolf" -[#]: reviewer: " " +[#]: reviewer: "wxy" [#]: publisher: " " [#]: url: " " [#]: subject: "10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites" [#]: via: "https://itsfoss.com/open-source-static-site-generators/" [#]: author: "Ankush Das https://itsfoss.com/author/ankush/" -10 个用来创建快速和资源友好网站的静态网站生成工具 +10 大静态网站生成工具 ====== -_**摘要:在寻找部署静态网页的方法吗?这几个开源的静态网站生成工具可以帮你迅速部署界面优美、功能强大的静态网站,无需掌握复杂的 HTML 和 CSS 技能。**_ +![](https://img.linux.net.cn/data/attachment/album/202010/01/123903lx1q0w2oh1lxx7wh.jpg) + +> 在寻找部署静态网页的方法吗?这几个开源的静态网站生成工具可以帮你迅速部署界面优美、功能强大的静态网站,无需掌握复杂的 HTML 和 CSS 技能。 ### 静态网站是什么? -技术上来讲,一个静态网站的网页不是由服务器动态生成的。HTML、CSS 和 JavaScript 文件就静静地躺在服务器的某个路径下,它们的内容与终端用户接收到时看到的是一样的。源码文件已经提前编译好了,源码在每次请求后都不会变化。 +技术上来讲,静态网站是指网页不是由服务器动态生成的。HTML、CSS 和 JavaScript 文件就静静地躺在服务器的某个路径下,它们的内容与终端用户接收到的版本是一样的。原始的源码文件已经提前编译好了,源码在每次请求后都不会变化。 -It’s FOSS 是一个依赖多个数据库的动态网站,网页是在你的浏览器发出请求时即时生成和服务的。大部分网站是动态的,你与这些网站互动时,会有大量的内容在变化。 +Linux.CN 是一个依赖多个数据库的动态网站,当有浏览器的请求时,网页就会生成并提供服务。大部分网站是动态的,你与这些网站互动时,大量的内容会经常改变。 -静态网站有一些好处,比如加载时间更短,请求的服务器资源更少,更安全(有争议?)。 +静态网站有一些好处,比如加载时间更短,请求的服务器资源更少、更安全(值得商榷)。 -传统意义上,静态网站更适合于创建只有少量网页、内容变化不频繁的小网站。 +传统上,静态网站更适合于创建只有少量网页、内容变化不频繁的小网站。 -然而,当静态网站生成工具出现后,静态网站的适用范围越来越大。你还可以使用这些工具搭建博客网站。 +然而,随着静态网站生成工具出现后,静态网站的适用范围越来越大。你还可以使用这些工具搭建博客网站。 -我列出了几个开源的静态网站生成工具,这些工具可以帮你搭建界面优美的网站。 +我整理了几个开源的静态网站生成工具,这些工具可以帮你搭建界面优美的网站。 ### 最好的开源静态网站生成工具 -请注意,静态网站不会提供很复杂的功能。如果你需要复杂的功能,那么你可以参考适用于动态网站的[最好的开源 CMS][1]列表 +请注意,静态网站不会提供很复杂的功能。如果你需要复杂的功能,那么你可以参考适用于动态网站的[最佳开源 CMS][1]列表。 -#### 1\. Jekyll +#### 1、Jekyll ![][2] -Jekyll 是用 [Ruby][3] 写的最受欢迎的开源静态生成工具之一。实际上,Jekyll 是 [GitHub 页面][4] 的引擎,它可以让你免费用 GitHub 维护自己的网站。 +Jekyll 是用 [Ruby][3] 写的最受欢迎的开源静态生成工具之一。实际上,Jekyll 是 [GitHub 页面][4] 的引擎,它可以让你免费用 GitHub 托管网站。 你可以很轻松地跨平台配置 Jekyll,包括 Ubuntu。它利用 [Markdown][5]、[Liquid][5](模板语言)、HTML 和 CSS 来生成静态的网页文件。如果你要搭建一个没有广告或推广自己工具或服务的产品页的博客网站,它是个不错的选择。 它还支持从常见的 CMS(内容管理系统Content management system)如 Ghost、WordPress、Drupal 7 迁移你的博客。你可以管理永久链接、类别、页面、文章,还可以自定义布局,这些功能都很强大。因此,即使你已经有了一个网站,如果你想转成静态网站,Jekyll 会是一个完美的解决方案。你可以参考[官方文档][6]或 [GitHub 页面][7]了解更多内容。 -[Jekyll][8] +- [Jekyll][8] -#### 2\. Hugo +#### 2、Hugo ![][9] Hugo 是另一个很受欢迎的用于搭建静态网站的开源框架。它是用 [Go 语言][10]写的。 -它运行速度快,使用简单,可靠性高。如果你需要,它也可以提供更高级的主题。它还提供了能提高你效率的实用快捷键。无论是组合展示网站还是博客网站,Hogo 都有能力管理大量的内容类型。 +它运行速度快、使用简单、可靠性高。如果你需要,它也可以提供更高级的主题。它还提供了一些有用的快捷方式来帮助你轻松完成任务。无论是组合展示网站还是博客网站,Hogo 都有能力管理大量的内容类型。 -如果你想使用 Hugo,你可以参照它的[官方文档][11]或它的 [GitHub 页面][12]来安装以及了解更多相关的使用方法。你还可以用 Hugo 在 GitHub 页面或 CDN(如果有需要)部署网站。 +如果你想使用 Hugo,你可以参照它的[官方文档][11]或它的 [GitHub 页面][12]来安装以及了解更多相关的使用方法。如果需要的话,你还可以将 Hugo 部署在 GitHub 页面或任何 CDN 上。 -[Hugo][13] +- [Hugo][13] -#### 3\. Hexo +#### 3、Hexo ![][14] -Hexo 基于 [Node.js][15] 的一个有趣的开源框架。像其他的工具一样,你可以用它搭建相当快速的网站,不仅如此,它还提供了丰富的主题和插件。 +Hexo 是一个有趣的开源框架,基于 [Node.js][15]。像其他的工具一样,你可以用它搭建相当快速的网站,不仅如此,它还提供了丰富的主题和插件。 它还根据用户的每个需求提供了强大的 API 来扩展功能。如果你已经有一个网站,你可以用它的[迁移][16]扩展轻松完成迁移工作。 你可以参照[官方文档][17]或 [GitHub 页面][18] 来使用 Hexo。 -[Hexo][19] +- [Hexo][19] -#### 4\. Gatsby +#### 4、Gatsby ![][20] -Gatsby 是一个不断发展的流行开源网站生成框架。它使用 [React.js][21] 来生成快速、界面优美的网站。 +Gatsby 是一个越来越流行的开源网站生成框架。它使用 [React.js][21] 来生成快速、界面优美的网站。 -几年前在一个实验性的项目中,我曾经非常想尝试一下这个工具,它提供的成千上万的新插件和主题的能力让我印象深刻。与其他静态网站生成工具不同的是,你可以用 Gatsby 在不损失任何功能的前提下来生成静态网站。 +几年前在一个实验性的项目中,我曾经非常想尝试一下这个工具,它提供的成千上万的新插件和主题的能力让我印象深刻。与其他静态网站生成工具不同的是,你可以使用 Gatsby 生成一个网站,并在不损失任何功能的情况下获得静态网站的好处。 -它提供了与很多流行的服务的整合功能。当然,你可以不使用它的复杂的功能,或选择一个流行的 CMS 与它配合使用,这也会很有趣。你可以查看他们的[官方文档][22]或它的 [GitHub 页面][23]了解更多内容。 +它提供了与很多流行的服务的整合功能。当然,你可以不使用它的复杂的功能,或将其与你选择的流行 CMS 配合使用,这也会很有趣。你可以查看他们的[官方文档][22]或它的 [GitHub 页面][23]了解更多内容。 -[Gatsby][24] +- [Gatsby][24] -#### 5\. VuePress +#### 5、VuePress ![][25] -VuePress 是基于 [Vue.js][26] 的静态网站生成工具,同时也是开源的渐进式 JavaScript 框架。 +VuePress 是由 [Vue.js][26] 支持的静态网站生成工具,而 Vue.js 是一个开源的渐进式 JavaScript 框架。 -如果你了解 HTML、CSS 和 JavaScript,那么你可以无压力地使用 VuePress。如果你想在搭建网站时抢先别人一步,那么你应该找几个有用的插件和主题。此外,看起来 Vue.js 更新地一直很活跃,很多开发者都在关注 Vue.js,这是一件好事。 +如果你了解 HTML、CSS 和 JavaScript,那么你可以无压力地使用 VuePress。你应该可以找到几个有用的插件和主题来为你的网站建设开个头。此外,看起来 Vue.js 的更新一直很活跃,很多开发者都在关注 Vue.js,这是一件好事。 你可以参照他们的[官方文档][27]和 [GitHub 页面][28]了解更多。 -[VuePress][29] +- [VuePress][29] -#### 6\. Nuxt.js +#### 6、Nuxt.js ![][30] -Nuxt.js 使用 Vue.js 和 Node.js,但它致力于模块化,并且有能力依赖服务端而非客户端。不仅如此,它还志在通过描述详尽的错误和其他方面更详细的文档来为开发者提供直观的体验。 +Nuxt.js 使用了 Vue.js 和 Node.js,但它致力于模块化,并且有能力依赖服务端而非客户端。不仅如此,它的目标是为开发者提供直观的体验,并提供描述性错误,以及详细的文档等。 -正如它声称的那样,在你用来搭建静态网站的所有工具中,Nuxt.js 在功能和灵活性两个方面都是佼佼者。他们还提供了一个 [Nuxt 线上沙盒][31]让你直接测试。 +正如它声称的那样,在你用来搭建静态网站的所有工具中,Nuxt.js 可以做到功能和灵活性两全其美。他们还提供了一个 [Nuxt 线上沙盒][31],让你不费吹灰之力就能直接测试它。 你可以查看它的 [GitHub 页面][32]和[官方网站][33]了解更多。 -#### 7\. Docusaurus +- [Nuxt.js][33] + +#### 7、Docusaurus ![][34] -Docusaurus 是一个为搭建文档类网站量身定制的有趣的开源静态网站生成工具。它还是 [Facebook 开源计划][35]的一个项目。 +Docusaurus 是一个有趣的开源静态网站生成工具,为搭建文档类网站量身定制。它还是 [Facebook 开源计划][35]的一个项目。 -Docusaurus 是用 React 构建的。你可以使用所有必要的功能,像文档版本管理、文档搜索,还有大部分已经预先配置好的翻译。如果你想为你的产品或服务搭建一个文档网站,那么可以试试 Docusaurus。 +Docusaurus 是用 React 构建的。你可以使用所有的基本功能,像文档版本管理、文档搜索和翻译大多是预先配置的。如果你想为你的产品或服务搭建一个文档网站,那么可以试试 Docusaurus。 你可以从它的 [GitHub 页面][36]和它的[官网][37]获取更多信息。 -[Docusaurus][37] +- [Docusaurus][37] -#### 8\. Eleventy +#### 8、Eleventy ![][38] -Eleventy 自称是 Jekyll 的替代品,志在为创建更快的静态网站提供更简单的方式。 +Eleventy 自称是 Jekyll 的替代品,旨在以更简单的方法来制作更快的静态网站。 -使用 Eleventy 看起来很简单,它也提供了能解决你的问题的文档。如果你想找一个简单的静态网站生成工具,Eleventy 似乎会是一个有趣的选择。 +它似乎很容易上手,而且它还提供了适当的文档来帮助你。如果你想找一个简单的静态网站生成工具,Eleventy 似乎会是一个有趣的选择。 你可以参照它的 [GitHub 页面][39]和[官网][40]来了解更多的细节。 -[Eleventy][40] +- [Eleventy][40] -#### 9\. Publii +#### 9、Publii ![][41] Publii 是一个令人印象深刻的开源 CMS,它能使生成一个静态网站变得很容易。它是用 [Electron][42] 和 Vue.js 构建的。如果有需要,你也可以把你的文章从 WorkPress 网站迁移过来。此外,它还提供了与 GitHub 页面、Netlify 及其它类似服务的一键同步功能。 -利用 Publii 生成的静态网站,自带所见即所得编辑器。你可以从[官网][43]下载它,或者从它的 [GitHub 页面][44]了解更多信息。 +如果你利用 Publii 生成一个静态网站,你还可以得到一个所见即所得的编辑器。你可以从[官网][43]下载它,或者从它的 [GitHub 页面][44]了解更多信息。 -[Publii][43] +- [Publii][43] -#### 10\. Primo +#### 10、Primo ![][45] -一个有趣的开源静态网站生成工具,目前开发工作仍很活跃。虽然与其他的静态生成工具相比,它还不是一个成熟的解决方案,有些功能还不完善,但它是一个独一无二的项目。 +一个有趣的开源静态网站生成工具,目前开发工作仍很活跃。虽然与其他的静态生成工具相比,它还不是一个成熟的解决方案,有些功能还不完善,但它是一个独特的项目。 -Primo 志在使用可视化的构建器帮你构建和搭建网站,这样你就可以轻松编辑和部署到任意主机上。 +Primo 旨在使用可视化的构建器帮你构建和搭建网站,这样你就可以轻松编辑和部署到任意主机上。 你可以参照[官网][46]或查看它的 [GitHub 页面][47]了解更多信息。 -[Primo][46] +- [Primo][46] ### 结语 -还有很多文章中没有列出的网站生成工具。然而,我已经尽力写出了能提供最快的加载速度、最好的安全性和令人印象最深刻的灵活性的最好的静态生成工具了。 +还有很多文章中没有列出的网站生成工具。然而,我试图提到最好的静态生成器,为您提供最快的加载时间,最好的安全性和令人印象深刻的灵活性。 列表中没有你最喜欢的工具?在下面的评论中告诉我。 @@ -159,7 +163,7 @@ via: https://itsfoss.com/open-source-static-site-generators/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[lxbwolf](https://github.com/lxbwolf) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 226e6db8c3b2f7e28ee95a6a761b8b2482462bfc Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 1 Oct 2020 12:42:05 +0800 Subject: [PATCH 0281/1156] PUB @lxbwolf https://linux.cn/article-12671-1.html --- ...enerators to Create Fast and Resource-Friendly Websites.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md (99%) diff --git a/translated/tech/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md b/published/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md similarity index 99% rename from translated/tech/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md rename to published/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md index 3a674b2607..6878aea281 100644 --- a/translated/tech/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md +++ b/published/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md @@ -1,8 +1,8 @@ [#]: collector: "lujun9972" [#]: translator: "lxbwolf" [#]: reviewer: "wxy" -[#]: publisher: " " -[#]: url: " " +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12671-1.html" [#]: subject: "10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites" [#]: via: "https://itsfoss.com/open-source-static-site-generators/" [#]: author: "Ankush Das https://itsfoss.com/author/ankush/" From fc9abeb0a7f48e811c2262c341570fe99725c51f Mon Sep 17 00:00:00 2001 From: zouchong Date: Thu, 1 Oct 2020 15:50:55 +0800 Subject: [PATCH 0282/1156] hankchow translated --- ...00903 A practical guide to learning awk.md | 149 ------------------ ...00903 A practical guide to learning awk.md | 149 ++++++++++++++++++ 2 files changed, 149 insertions(+), 149 deletions(-) delete mode 100644 sources/tech/20200903 A practical guide to learning awk.md create mode 100644 translated/tech/20200903 A practical guide to learning awk.md diff --git a/sources/tech/20200903 A practical guide to learning awk.md b/sources/tech/20200903 A practical guide to learning awk.md deleted file mode 100644 index 181a5d484e..0000000000 --- a/sources/tech/20200903 A practical guide to learning awk.md +++ /dev/null @@ -1,149 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (HankChow) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (A practical guide to learning awk) -[#]: via: (https://opensource.com/article/20/9/awk-ebook) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -A practical guide to learning awk -====== -Get a better handle on the awk command by downloading our free eBook. -![Person programming on a laptop on a building][1] - -Of all the [Linux][2] commands out there (and there are many), the three most quintessential seem to be `sed`, `awk`, and `grep`. Maybe it's the arcane sound of their names, or the breadth of their potential use, or just their age, but when someone's giving an example of a "Linuxy" command, it's usually one of those three. And while `sed` and `grep` have several simple one-line standards, the less prestigious `awk` remains persistently prominent for being particularly puzzling. - -You're likely to use `sed` for a quick string replacement or `grep` to filter for a pattern on a daily basis. You're far less likely to compose an `awk` command. I often wonder why this is, and I attribute it to a few things. First of all, many of us barely use `sed` and `grep` for anything but some variation upon these two commands: - - -``` -$ sed -e 's/foo/bar/g' file.txt -$ grep foo file.txt -``` - -So, even though you might feel more comfortable with `sed` and `grep`, you may not use their full potential. Of course, there's no obligation to learn more about `sed` or `grep`, but I sometimes wonder about the way I "learn" commands. Instead of learning _how_ a command works, I often learn a specific incantation that includes a command. As a result, I often feel a false familiarity with the command. I think I know a command because I can name three or four options off the top of my head, even though I don't know what the options do and can't quite put my finger on the syntax. - -And that's the problem, I believe, that many people face when confronted with the power and flexibility of `awk`. - -### Learning awk to use awk - -The basics of `awk` are surprisingly simple. It's often noted that `awk` is a programming language, and although it's a relatively basic one, it's true. This means you can learn `awk` the same way you learn a new coding language: learn its syntax using some basic commands, learn its vocabulary so you can build up to complex actions, and then practice, practice, practice. - -### How awk parses input - -`Awk` sees input, essentially, as an array. When `awk` scans over a text file, it treats each line, individually and in succession, as a _record_. Each record is broken into _fields_. Of course, `awk` must keep track of this information, and you can see that data using the `NR` (number of records) and `NF` (number of fields) built-in variables. For example, this gives you the line count of a file: - - -``` -$ awk 'END { print NR;}' example.txt -36 -``` - -This also reveals something about `awk` syntax. Whether you're writing `awk` as a one-liner or as a self-contained script, the structure of an `awk` instruction is: - - -``` -`pattern or keyword { actions }` -``` - -In this example, the word `END` is a special, reserved keyword rather than a pattern. A similar keyword is `BEGIN`. With both of these keywords, `awk` just executes the action in braces at the start or end of parsing data. - -You can use a _pattern_ as a filter or qualifier so that `awk` only executes a given action when it is able to match your pattern to the current record. For instance, suppose you want to use `awk`, much as you would `grep`, to find the word _Linux_ in a file of text: - - -``` -$ awk '/Linux/ { print $0; }' os.txt -OS: CentOS Linux (10.1.1.8) -OS: CentOS Linux (10.1.1.9) -OS: Red Hat Enterprise Linux (RHEL) (10.1.1.11) -OS: Elementary Linux (10.1.2.4) -OS: Elementary Linux (10.1.2.5) -OS: Elementary Linux (10.1.2.6) -``` - -For `awk`, each line in the file is a record, and each word in a record is a field. By default, fields are separated by a space. You can change that with the `--field-separator` option, which sets the `FS` (field separator) variable to whatever you want it to be: - - -``` -$ awk --field-separator ':' '/Linux/ { print $2; }' os.txt - CentOS Linux (10.1.1.8) - CentOS Linux (10.1.1.9) - Red Hat Enterprise Linux (RHEL) (10.1.1.11) - Elementary Linux (10.1.2.4) - Elementary Linux (10.1.2.5) - Elementary Linux (10.1.2.6) -``` - -In this sample, there's an empty space before each listing because there's a blank space after each colon (`:`) in the source text. This isn't `cut`, though, so the field separator needn't be limited to one character: - - -``` -$ awk --field-separator ': ' '/Linux/ { print $2; }' os.txt -CentOS Linux (10.1.1.8) -CentOS Linux (10.1.1.9) -Red Hat Enterprise Linux (RHEL) (10.1.1.11) -Elementary Linux (10.1.2.4) -Elementary Linux (10.1.2.5) -Elementary Linux (10.1.2.6) -``` - -### Functions in awk - -You can build your own functions in `awk` using this syntax: - - -``` -`name(parameters) { actions }` -``` - -Functions are important because they allow you to write code once and reuse it throughout your work. When constructing one-liners, custom functions are a little less useful than they are in scripts, but `awk` defines many functions for you already. They work basically the same as any function in any other language or spreadsheet: You learn the order that the function needs information from you, and you can feed it whatever you want to get the results. - -There are functions to perform mathematical operations and string processing. The math ones are often fairly straightforward. You provide a number, and it crunches it: - - -``` -$ awk 'BEGIN { print sqrt(1764); }' -42 -``` - -String functions can be more complex but are well documented in the [GNU awk manual][3]. For example, the `split` function takes an entity that `awk` views as a single field and splits it into different parts. It requires a field, a variable to use as an array containing each part of the split, and the character you want to use as the delimiter. - -Using the output of the previous examples, I know that there's an IP address at the very end of each record. In this case, I can send just the last field of a record to the `split` function by referencing the variable `NF` because it contains the number of fields (and the final field must be the highest number): - - -``` -$ awk --field-separator ': ' '/Linux/ { split($NF, IP, "."); print "subnet: " IP[3]; }' os.txt -subnet: 1 -subnet: 1 -subnet: 1 -subnet: 2 -subnet: 2 -subnet: 2 -``` - -There are many more functions, and there's no reason to limit yourself to one per block of `awk` code. You can construct complex pipelines with `awk` in your terminal, or you can write `awk` scripts to define and utilize your own functions. - -### Download the eBook - -Learning `awk` is mostly a matter of using `awk`. Use it even if it means duplicating functionality you already have with `sed` or `grep` or `cut` or `tr` or any other perfectly valid commands. Once you get comfortable with it, you can write Bash functions that invoke your custom `awk` commands for easier use. And eventually, you'll be able to write scripts to parse complex datasets. - -**[Download our][4]** **[eBook][4] **to learn everything you need to know about `awk`, and start using it today. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/9/awk-ebook - -作者:[Seth Kenlon][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://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_code_programming_laptop.jpg?itok=ormv35tV (Person programming on a laptop on a building) -[2]: https://opensource.com/resources/linux -[3]: https://www.gnu.org/software/gawk/manual/gawk.html -[4]: https://opensource.com/downloads/awk-ebook diff --git a/translated/tech/20200903 A practical guide to learning awk.md b/translated/tech/20200903 A practical guide to learning awk.md new file mode 100644 index 0000000000..50a5f6d1d3 --- /dev/null +++ b/translated/tech/20200903 A practical guide to learning awk.md @@ -0,0 +1,149 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A practical guide to learning awk) +[#]: via: (https://opensource.com/article/20/9/awk-ebook) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +awk 实用学习指南 +====== +下载我们的电子书,学习如何更好地使用 `awk`。 +![Person programming on a laptop on a building][1] + +在众多 [Linux][2] 命令中,`sed`、`awk` 和 `grep` 恐怕是其中最经典的三个命令了。它们引人注目或许是由于名字发音与众不同,也可能是它们无处不在,甚至是因为它们存在已久,但无论如何,如果要问哪些命令很有 Linux 风格,这三个命令是当之无愧的。其中 `sed` 和 `grep` 已经有很多简洁的标准用法了,但 `awk` 的使用难度却相对突出。 + +在日常使用中,通过 `sed` 实现字符串替换、通过 `grep` 实现过滤,这些都是司空见惯的操作了,但 `awk` 命令相对来说是用得比较少的。在我看来,可能的原因是大多数人都只使用 `sed` 或者 `grep` 的一些变体实现某些功能,例如: + + +``` +$ sed -e 's/foo/bar/g' file.txt +$ grep foo file.txt +``` + +因此,尽管你可能会觉得 `sed` 和 `grep` 使用起来更加顺手,但实际上它们还有更多更强大的作用没有发挥出来。当然,我们没有必要在这两个命令上钻研得很深入,但我还是想理解自己是如何学习一个命令的。很多时候我会把一整串命令记住,但不会去了解其中的运行过程,这就让我产生了一种很熟悉命令的错觉,我可以随口说出某个命令的好几个选项参数,但这些参数具体有什么作用,以及它们的相关语法,我都并不明确。 + +这大概就是很多人对 `awk` 缺乏了解的原因了。 + +### 为使用而学习 awk + +`awk` 并不深奥。它是一种相对基础的编程语言,因此你可以把它当成一门新的编程语言来学习:使用一些基本命令来熟悉语法、了解语言中的关键字并实现更复杂的功能,然后再多加练习就可以了。 + +### awk 是如何解析输入内容的 + +`awk` 的本质是将输入的内容看作是一个数组。当 `awk` 扫描一个文本文件时,会把每一行作为一条记录record,每一条记录中又分割为多个字段field。`awk` 记录了各条记录各个字段的信息,并通过内置变量 `NR`(记录数) 和 `NF`(字段数) 来调用相关信息。例如一下这个命令可以查看文件的行数: + + +``` +$ awk 'END { print NR;}' example.txt +36 +``` + +从上面的命令可以看出 `awk` 的基本语法,无论是一个单行命令还是一整个脚本,语法都是这样的: + + +``` +`样式或关键字 { 操作 }` +``` + +在上面的例子中,`END` 是一个关键字而不是样式,与此类似的另一个关键字是 `BEGIN`。使用 `BEGIN` 或 `END` 可以让 `awk` 在解析内容前或解析内容后执行大括号中指定的操作。 + +你可以使用样式pattern作为过滤器或限定符,这样 `awk` 只会对匹配样式的对应记录执行指定的操作。以下这个例子就是使用 `awk` 实现 `grep` 命令在文件中查找“Linux”字符串的功能: + + +``` +$ awk '/Linux/ { print $0; }' os.txt +OS: CentOS Linux (10.1.1.8) +OS: CentOS Linux (10.1.1.9) +OS: Red Hat Enterprise Linux (RHEL) (10.1.1.11) +OS: Elementary Linux (10.1.2.4) +OS: Elementary Linux (10.1.2.5) +OS: Elementary Linux (10.1.2.6) +``` + +`awk` 会将文件中的每一行作为一条记录,将一条记录中的每个单词作为一个字段,默认情况下会按照空格作为分隔符field separator(`FS`)切割出记录中的字段。如果想要使用其它内容作为分隔符,可以使用 `--field-separator` 选项指定分隔符: + + +``` +$ awk --field-separator ':' '/Linux/ { print $2; }' os.txt + CentOS Linux (10.1.1.8) + CentOS Linux (10.1.1.9) + Red Hat Enterprise Linux (RHEL) (10.1.1.11) + Elementary Linux (10.1.2.4) + Elementary Linux (10.1.2.5) + Elementary Linux (10.1.2.6) +``` + +在上面的例子中,可以看到在 `awk` 处理后每一行的行首都有一个空格,那是因为在源文件中每个冒号(`:`)后面都带有一个空格。和 `cut` 有所不同的是,`awk` 可以指定一个字符串作为分隔符,就像这样: + + +``` +$ awk --field-separator ': ' '/Linux/ { print $2; }' os.txt +CentOS Linux (10.1.1.8) +CentOS Linux (10.1.1.9) +Red Hat Enterprise Linux (RHEL) (10.1.1.11) +Elementary Linux (10.1.2.4) +Elementary Linux (10.1.2.5) +Elementary Linux (10.1.2.6) +``` + +### awk 中的函数 + +可以通过这样的语法在 `awk` 中自定义函数: + + +``` +`函数名称(参数) { 操作 }` +``` + +函数的好处在于只需要编写一次就可以多次复用,因此函数在脚本中起到的作用会比在构造单行命令时大。同时 `awk` 自身也带有很多预定义的函数,并且工作原理和其它编程语言或电子表格保持一致。你只需要了解函数需要接受什么参数,就可以放心使用了。 + +`awk` 中提供了数学运算和字符串处理的相关函数。数学运算函数通常比较简单,传入一个数字,它就会传出一个结果: + + +``` +$ awk 'BEGIN { print sqrt(1764); }' +42 +``` + +而字符串处理函数则稍微复杂一点,但 [GNU awk 手册][3]中也有充足的文档。例如 `split()` 函数需要传入一个待分割的单一字段、一个数组用于存放分割结果,以及用于分割的定界符delimiter。 + +例如前面示例中的输出内容,每条记录的末尾都包含了一个 IP 地址。由于变量 `NF` 代表的是每条记录的字段数量,刚好对应的是每条记录中最后一个字段的序号,因此可以通过引用 `NF` 将每条记录的最后一个字段传入 `split()` 函数: + + +``` +$ awk --field-separator ': ' '/Linux/ { split($NF, IP, "."); print "subnet: " IP[3]; }' os.txt +subnet: 1 +subnet: 1 +subnet: 1 +subnet: 2 +subnet: 2 +subnet: 2 +``` + +实际上 `awk` 的功能还远远不止于此,你还可以跳出 `awk` 本身,通过命令管道和脚本来自定义更多功能。 + +### 下载电子书 + +使用 `awk` 本身就是一个学习 `awk` 的过程,即使某些操作使用 `sed`、`grep`、`cut`、`tr` 命令已经完全足够了,也可以尝试使用 `awk` 来实现。只要熟悉了 `awk`,就可以在 Bash 中自定义一些 `awk` 函数,进而解析复杂的数据。 + +[下载我们的电子书][4]学习并开始使用 `awk` 吧! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/awk-ebook + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[HankChow](https://github.com/hankchow) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_code_programming_laptop.jpg?itok=ormv35tV (Person programming on a laptop on a building) +[2]: https://opensource.com/resources/linux +[3]: https://www.gnu.org/software/gawk/manual/gawk.html +[4]: https://opensource.com/downloads/awk-ebook From 059df79183c3a4da95c992eb8cd47920baee1e99 Mon Sep 17 00:00:00 2001 From: Hilton Chain <26847027+rakino@users.noreply.github.com> Date: Thu, 1 Oct 2020 17:37:00 +0800 Subject: [PATCH 0283/1156] translating --- sources/tech/20200928 Create template files in GNOME.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200928 Create template files in GNOME.md b/sources/tech/20200928 Create template files in GNOME.md index 8abc834b88..1745df2241 100644 --- a/sources/tech/20200928 Create template files in GNOME.md +++ b/sources/tech/20200928 Create template files in GNOME.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (rakino) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 55c75226e770d71eeb0e10fbca7c7e6e62393553 Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Thu, 1 Oct 2020 22:18:37 +0800 Subject: [PATCH 0284/1156] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=AF=91=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...TCP window scaling, timestamps and SACK.md | 278 ++++++++---------- 1 file changed, 122 insertions(+), 156 deletions(-) diff --git a/sources/tech/20200811 TCP window scaling, timestamps and SACK.md b/sources/tech/20200811 TCP window scaling, timestamps and SACK.md index 01d10dfb4f..03613c1f61 100644 --- a/sources/tech/20200811 TCP window scaling, timestamps and SACK.md +++ b/sources/tech/20200811 TCP window scaling, timestamps and SACK.md @@ -7,252 +7,225 @@ [#]: via: (https://fedoramagazine.org/tcp-window-scaling-timestamps-and-sack/) [#]: author: (Florian Westphal https://fedoramagazine.org/author/strlen/) -TCP window scaling, timestamps and SACK +TCP 窗口缩放,时间戳和 SACK ====== ![][1] -The Linux TCP stack has a myriad of _sysctl_ knobs that allow to change its behavior.  This includes the amount of memory that can be used for receive or transmit operations, the maximum number of sockets and optional features and protocol extensions. +Linux TCP 协议栈具有无数个 _sysctl_ 旋钮,允许更改其行为。 这包括可用于接收或发送操作的内存量,套接字的最大数量、可选特性和协议扩展。 -There are  multiple articles that recommend to disable TCP extensions, such as timestamps or selective acknowledgments (SACK) for various “performance tuning” or “security” reasons. +有很多文章出于各种“性能调优”或“安全性”原因,建议禁用 TCP 扩展,比如时间戳或选择性确认selective acknowledgments (SACK)。 -This article provides background on what these extensions do, why they -are enabled by default, how they relate to one another and why it is normally a bad idea to turn them off. +本文提供了这些扩展的功能背景,默认情况下处于启用状态的原因,它们之间是如何关联的,以及为什么通常情况下将它们关闭是个坏主意。 -### TCP Window scaling +### TCP 窗口缩放 -The data transmission rate that TCP can sustain is limited by several factors. Some of these are: +TCP 可以维持的数据传输速率受到几个因素的限制。其中包括: - * Round trip time (RTT).  This is the time it takes for a packet to get to the destination and a reply to come back. Lower is better. - * lowest link speed of the network paths involved - * frequency of packet loss - * the speed at which new data can be made available for transmission -For example, the CPU needs to be able to pass data to the network adapter fast enough. If the CPU needs to encrypt the data first, the adapter might have to wait for new data. In similar fashion disk storage can be a bottleneck if it can’t read the data fast enough. - * The maximum possible size of the TCP receive window. The receive window determines how much data (in bytes) TCP can transmit before it has to wait for the receiver to report reception of that data. This is announced by the receiver. The receiver will constantly update this value as it reads and acknowledges reception of the incoming data. The receive windows current value is contained in the [TCP header][2] that is part of every segment sent by TCP. The sender is thus aware of the current receive window whenever it receives an acknowledgment from the peer. This means that the higher the round-trip time, the longer it takes for sender to get receive window updates. +* 往返时间(RTT)。这是数据包到达目的地并返回回复所花费的时间。越低越好。 +* 所涉及的网络路径的最低链路速度 +* 丢包频率 +* 新数据可用于传输的速度。 例如,CPU 需要能够以足够快的速度将数据传递到网络适配器。如果 CPU 需要首先加密数据,则适配器可能必须等待新数据。同样地,如果磁盘存储不能足够快地读取数据,则磁盘存储可能会成为瓶颈。 +* TCP 接收窗口的最大可能大小。接收窗口决定 TCP 在必须等待接收方报告接收到该数据之前可以传输多少数据 (以字节为单位)。这是由接收方宣布的。接收方将在读取并确认接收到传入数据时不断更新此值。接收窗口当前值包含在 [TCP 报头][2] 中,它是 TCP 发送的每个数据段的一部分。因此,只要发送方接收到来自对等方的确认,它就知道当前的接收窗口。这意味着往返时间(RTT)越长,发送方获得接收窗口更新所需的时间就越长。 +TCP 被限制为最多 64KB 的未确认(正在传输)数据。在大多数网络场景中,这甚至还不足以维持一个像样的数据速率。让我们看看一些例子。 -TCP is limited to at most 64 kilobytes of unacknowledged (in-flight) data. This is not even close to what is needed to sustain a decent data rate in most networking scenarios. Let us look at some examples. +##### 理论数据速率 -##### Theoretical data rate +由于往返时间 (RTT) 为 100 毫秒,TCP 每秒最多可以传输 640KB。在延迟 1 秒的情况下,最大理论数据速率降至 64KB/s。 -With a round-trip-time of 100 milliseconds, TCP can transfer at most 640 kilobytes per second. With a 1 second delay, the maximum theoretical data rate drops down to only 64 kilobytes per second. +这是因为接收窗口的原因。一旦发送了 64KB 的数据,接收窗口就已经满了。发送方必须等待,直到对等方通知它应用程序已经读取了至少一部分数据。 -This is because of the receive window. Once 64kbyte of data have been sent the receive window is already full.  The sender must wait until the peer informs it that at least some of the data has been read by the application.  +发送的第一个段会把 TCP 窗口缩减一个自身的大小。在接收窗口值的更新可用之前,需要往返一次。当更新以 1 秒的延迟到达时,即使链路有足够的可用带宽,也会导致 64KB 的限制。 -The first segment sent reduces the TCP window by the size of that segment. It takes one round-trip before an update of the receive window value will become available. When updates arrive with a 1 second delay, this results in a 64 kilobyte limit even if the link has plenty of bandwidth available. +为了充分利用一个具有几毫秒延迟的快速网络,必须有一个比传统 TCP 支持的窗口大的窗口。“64KB 限制”是协议规范的产物:TCP 头只为接收窗口大小保留 16 位。这允许接收窗口高达 64KB。在 TCP 协议最初设计时,这个大小并没有被视为一个限制。 -In order to fully utilize a fast network with several milliseconds of delay, a window size larger than what classic TCP supports is a must. The ’64 kilobyte limit’ is an artifact of the protocols specification: The TCP header reserves only 16bits for the receive window size. This allows receive windows of up to 64KByte. When the TCP protocol was originally designed, this size was not seen as a limit. +不幸的是,想通过仅仅更改 TCP 头来支持更大的最大窗口值是不可能的。如果这样做就意味着 TCP 的所有实现都必须同时更新,否则它们将无法相互理解。为了解决这个问题,需要改变接收窗口值的解释。 -Unfortunately, its not possible to just change the TCP header to support a larger maximum window value. Doing so would mean all implementations of TCP would have to be updated simultaneously or they wouldn’t understand one another anymore. To solve this, the interpretation of the receive window value is changed instead. +“窗口缩放选项”允许这样做,同时保持与现有实现的兼容性。 -The ‘window scaling option’ allows to do this while keeping compatibility to existing implementations. +#### TCP 选项:向后兼容的协议扩展 -#### TCP Options: Backwards-compatible protocol extensions +TCP 支持可选扩展。 这允许使用新特性增强协议,而无需立即更新所有实现。 当 TCP 启动器连接到对等方时,它还会发送一个支持的扩展列表。 所有扩展名都遵循相同的格式:一个唯一的选项号,后跟选项的长度以及选项数据本身。 -TCP supports optional extensions. This allows to enhance the protocol with new features without the need to update all implementations at once. When a TCP initiator connects to the peer, it also send a list of supported extensions. All extensions follow the same format: an unique option number followed by the length of the option and the option data itself. +TCP 响应程序检查连接请求中包含的所有选项号。 如果它遇到一个不能理解的选项号,则会跳过 +该选项号附带的“长度”字节的数据,并检查下一个选项号。 响应者忽略了从答复中无法理解的内容。 这使发送方和接收方都够了解所支持的通用选项集。 -The TCP responder checks all the option numbers contained in the connection request. If it does not understand an option number it skips -‘length’ bytes of data and checks the next option number. The responder omits those it did not understand from the reply. This allows both the sender and receiver to learn the common set of supported options. +使用窗口缩放时,选项数据总是由单个数字组成。 -With window scaling, the option data always consist of a single number. - -### The window scaling option -``` +### 窗口缩放选项 ``` - -Window Scale option (WSopt): Kind: 3, Length: 3 +窗口缩放选项 (WSopt): Kind: 3, Length: 3     +---------+---------+---------+     | Kind=3  |Length=3 |shift.cnt|     +---------+---------+---------+          1         1         1 ``` -``` +[窗口缩放][3] 选项告诉对等点,应该使用给定的数字缩放 TCP 标头中的接收窗口值,以获取实际大小。 -The [window scaling][3] option tells the peer that the receive window value found in the TCP header should be scaled by the given number to get the real size. +例如,一个宣告窗口缩放比例因子为 7 的 TCP 启动器试图指示响应程序,任何将来携带接收窗口值为 512 的数据包实际上都会宣告 65536 字节的窗口。 增加了 128 倍。这将允许最大为 8MB 的 TCP 窗口。 -For example, a TCP initiator that announces a window scaling factor of 7 tries to instruct the responder that any future packets that carry a receive window value of 512 really announce a window of 65536 byte. This is an increase by a factor of 128. This would allow a maximum TCP Window of 8 Megabytes. +不能理解此选项的 TCP 响应程序将会忽略它。 为响应连接请求而发送的 TCP 数据包(SYN-ACK)不包含窗口缩放选项。在这种情况下,双方只能使用 64k 的窗口大小。幸运的是,默认情况下,几乎每个 TCP 堆栈都支持并启用此选项,包括 Linux。 -A TCP responder that does not understand this option ignores it. The TCP packet sent in reply to the connection request (the syn-ack) then does not contain the window scale option. In this case both sides can only use a 64k window size. Fortunately, almost every TCP stack supports and enables this option by default, including Linux. +响应程序包括它自己所需的比例因子。两个对等点可以使用不同的号码。宣布比例因子为 0 也是合法的。这意味着对等点应该逐字处理它接收到的接收窗口值,但它允许应答方向上的缩放值,然后接收方可以使用更大的接收窗口。 -The responder includes its own desired scaling factor. Both peers can use a different number. Its also legitimate to announce a scaling factor of 0. This means the peer should treat the receive window value it receives verbatim, but it allows scaled values in the reply direction — the recipient can then use a larger receive window. +与 SACK 或 TCP 时间戳不同,窗口缩放选项仅出现在 TCP 连接的前两个数据包中,之后无法更改。也不可能通过查看不包含初始连接三次握手的连接的数据包捕获来确定比例因子。 -Unlike SACK or TCP timestamps, the window scaling option only appears in the first two packets of a TCP connection, it cannot be changed afterwards. It is also not possible to determine the scaling factor by looking at a packet capture of a connection that does not contain the initial connection three-way handshake. +支持的最大比例因子为 14。这将允许 TCP 窗口的大小高达 1GB。 -The largest supported scaling factor is 14. This allows TCP window sizes -of up to one Gigabyte. +##### 窗口缩放的缺点 -##### Window scaling downsides +在非常特殊的情况下,它可能导致数据损坏。 在禁用该选项之前——通常情况下是不可能的。 还有一种解决方案可以防止这种情况。不幸的是,有些人在没有意识到与窗口缩放的关系的情况下禁用了该解决方案。 首先,让我们看一下需要解决的实际问题。 想象以下事件序列: -It can cause data corruption in very special cases. Before you disable the option – it is impossible under normal circumstances. There is also a solution in place that prevents this. Unfortunately, some people disable this solution without realizing the relationship with window scaling. First, let’s have a look at the actual problem that needs to be addressed. Imagine the following sequence of events: + 1. 发送方发送段:s_1,s_2,s_3,... s_n + 2. 接收方看到:s_1,s_3,.. s_n,并发送对 s_1 的确认。 + 3. 发送方认为 s_2 丢失,然后再次发送。 它还发送段 s_n+1 中包含的新数据。 + 4. 接收方然后看到:s_2,s_n+1,s_2:数据包 s_2 被接收两次。 - 1. The sender transmits segments: s_1, s_2, s_3, … s_n - 2.  The receiver sees: s_1, s_3, .. s_n and sends an acknowledgment for s_1. - 3.  The sender considers s_2 lost and sends it a second time. It also sends new data contained in segment s_n+1. - 4.  The receiver then sees: s_2, s_n+1, s_2: the packet s_2 is received twice. +例如,当发送方过早触发重新传输时,可能会发生这种情况。 在正常情况下,即使使用窗口缩放,这种错误的重传也绝不会成为问题。 接收方将只丢弃重复项。 +#### 从旧数据到新数据 +TCP 序列号最多可以为 4GB。如果它变得大于此值,则序列会回绕到 0,然后再次增加。这本身不是问题,但是如果这种问题发生得足够快,则上述情况可能会造成歧义。 -This can happen for example when a sender triggers re-transmission too early. Such erroneous re-transmits are never a problem in normal cases, even with window scaling. The receiver will just discard the duplicate. +如果在正确的时刻发生回绕,则序列号 s_2(重新发送的数据包)可能已经大于 s_n+1。 因此,在最后的步骤(4)中,接收器可以将其解释为:s_2,s_n+1,s_n+m,即它可以将 **“旧”** 数据包 s_2 视为包含新数据。 -#### Old data to new data +通常,这不会发生,因为即使在高带宽链接上,“回绕”也只会每隔几秒钟或几分钟发生一次。原始和不需要的重传之间的间隔将小得多。 -The TCP sequence number can be at most 4 Gigabyte. If it becomes larger than this, the sequence wraps back to 0 and then increases again. This is not a problem in itself, but if this occur fast enough then the above scenario can create an ambiguity. +例如,对于 50MB/s 的传输速度,副本要延迟到一分钟以上才会成为问题。序列号的包装速度不够快,小的延迟才会导致这个问题。 -If a wrap-around occurs at the right moment, the sequence number s_2 (the re-transmitted packet) can already be larger than s_n+1. Thus, in the last step (4), the receiver may interpret this as: s_2, s_n+1, s_n+m, i.e. it could view the ‘old’ packet s_2 as containing new data. +一旦 TCP 达到 “GB/s” 的吞吐率,序列号的包装速度就会非常快,以至于即使只有几毫秒的延迟也可能会造成 TCP 无法再检测到的重复项。通过解决接收窗口太小的问题,TCP 现在可以用于以前无法实现的网络速度,这会产生一个新的,尽管很少见的问题。为了在 RTT 非常低的环境中安全使用 GB/s 的速度,接收方必须能够检测到这些旧副本,而不必仅依赖序列号。 -Normally, this won’t happen because a ‘wrap around’ occurs only every couple of seconds or minutes even on high bandwidth links. The interval between the original and a unneeded re-transmit will be a lot smaller. +### TCP 时间戳 -For example,with a transmit speed of 50 Megabytes per second, a -duplicate needs to arrive more than one minute late for this to become a problem. The sequence numbers do not wrap fast enough for small delays to induce this problem. +#### 最佳使用日期。 -Once TCP approaches ‘Gigabyte per second’ throughput rates, the sequence numbers can wrap so fast that even a delay by only a few milliseconds can create duplicates that TCP cannot detect anymore. By solving the problem of the too small receive window, TCP can now be used for network speeds that were impossible before – and that creates a new, albeit rare problem. To safely use Gigabytes/s speed in environments with very low RTT receivers must be able to detect such old duplicates without relying on the sequence number alone. +用最简单的术语来说,[TCP 时间戳][3]只是在数据包上添加时间戳,以解决由非常快速的序列号回绕引起的歧义。 如果一个段看起来包含新数据,但其时间戳早于最后一个在窗口内的数据包,则该序列号已被重新包装,而“新”数据包实际上是一个较旧的副本。 这解决了即使在极端情况下重传的歧义。 -### TCP time stamps +但是,该扩展不仅仅是检测旧数据包。 TCP 时间戳的另一个主要功能是更精确的往返时间测量(RTTm)。 -#### A best-before date +#### 需要准确的 RTT 估算 -In the most simple terms, [TCP timestamps][3] just add a time stamp to the packets to resolve the ambiguity caused by very fast sequence number wrap around. If a segment appears to contain new data, but its timestamp is older than the last in-window packet, then the sequence number has wrapped and the ”new” packet is actually an older duplicate. This resolves the ambiguity of re-transmits even for extreme corner cases. - -But this extension allows for more than just detection of old packets. The other major feature made possible by TCP timestamps are more precise round-trip time measurements (RTTm). - -#### A need for precise round-trip-time estimation - -When both peers support timestamps,  every TCP segment carries two additional numbers: a timestamp value and a timestamp echo. -``` +当两个对等方都支持时间戳时,每个 TCP 段都携带两个附加数字:时间戳值和时间戳回显。 ``` - -TCP Timestamp option (TSopt): Kind: 8, Length: 10 +TCP 时间戳选项 (TSopt): Kind: 8, Length: 10 +-------+----+----------------+-----------------+ |Kind=8 | 10 |TS Value (TSval)|EchoReply (TSecr)| +-------+----+----------------+-----------------+     1      1         4                4 ``` -``` +准确的 RTT 估算对于 TCP 性能至关重要。 TCP 自动重新发送未确认的数据。 重传由计时器触发:如果超时,则 TCP 会将尚未收到确认的一个或多个数据包视为丢失。 然后再发送一次。 -An accurate RTT estimate is crucial for TCP performance. TCP automatically re-sends data that was not acknowledged. Re-transmission is triggered by a timer: If it expires, TCP considers one or more packets that it has not yet received an acknowledgment for to be lost. They are then sent again. +但是,“尚未得到确认” 并不意味着该段已丢失。 也有可能是接收方到目前为止没有发送确认,或者确认仍在传输中。 这就造成了一个两难的困境:TCP 必须等待足够长的时间,才能让这种轻微的延迟变得无关紧要,但它也不能等待太久。 -But “has not been acknowledged” does not mean the segment was lost. It is also possible that the receiver did not send an acknowledgment so far or that the acknowledgment is still in flight. This creates a dilemma: TCP must wait long enough for such slight delays to not matter, but it can’t wait for too long either. +##### 低网络延迟 VS 高网络延迟 -##### Low versus high network delay +在延迟较高的网络中,如果计时器触发过快,TCP 经常会将时间和带宽浪费在不必要的重发上。 -In networks with a high delay, if the timer fires too fast, TCP frequently wastes time and bandwidth with unneeded re-sends. +然而,在延迟较低的网络中,等待太长时间会导致真正发生数据包丢失时吞吐量降低。因此,在低延迟网络中,计时器应该比高延迟网络中更早到期。 所以,TCP 重传超时不能使用固定常量值作为超时。它需要根据其在网络中所经历的延迟来调整该值。 -In networks with a low delay however,  waiting for too long causes reduced throughput when a real packet loss occurs. Therefore, the timer should expire sooner in low-delay networks than in those with a high delay. The tcp retransmit timeout therefore cannot use a fixed constant value as a timeout. It needs to adapt the value based on the delay that it experiences in the network. +##### RTT(往返时间)的测量 -##### Round-trip time measurement +TCP 选择基于预期往返时间(RTT)的重传超时。 RTT 事先是未知的。它是通过测量发送段与 TCP 接收到该段所承载数据的确认之间的增量来估算的。 -TCP picks a retransmit timeout that is based on the expected round-trip time (RTT). The RTT is not known in advance. RTT is estimated by measuring the delta between the time a segment is sent and the time TCP receives an acknowledgment for the data carried by that segment. +由于多种因素使其而变得复杂。 -This is complicated by several factors. + * 出于性能原因,TCP 不会为收到的每个数据包生成新的确认。它等待的时间非常短:如果有更多的数据段到达,则可以通过单个 ACK 数据包确认其接收。这称为“累积确认”cumulative ACK。 + * 往返时间并不恒定。 这是有多种因素造成的。例如,客户端可能是一部移动电话,随其移动而切换到不同的基站。也可能是当链路或 CPU 利用率提高时,数据包交换花费了更长的时间。 + * 必须重新发送的数据包在计算过程中必须被忽略。 + 这是因为发送方无法判断重传数据段的 ACK 是在确认原始传输 (毕竟已到达) 还是在确认重传。 - * For performance reasons, TCP does not generate a new acknowledgment for every packet it receives. It waits  for a very small amount of time: If more segments arrive, their reception can be acknowledged with a single ACK packet. This is called “cumulative ACK”. - *  The round-trip-time is not constant. This is because of a myriad of factors. For example, a client might be a mobile phone switching to different base stations as its moved around. Its also possible that packet switching takes longer when link or CPU utilization increases. - * a packet that had to be re-sent must be ignored during computation. This is because the sender cannot tell if the ACK for the re-transmitted segment is acknowledging the original transmission (that arrived after all) or the re-transmission. +最后一点很重要:当 TCP 忙于从丢失中恢复时,它可能仅接收到重传段的 ACK。这样,它就无法在此恢复阶段测量(更新)RTT。所以,它无法调整重传超时,然后超时将以指数级增长。那是一种非常具体的情况(它假设其他机制,如快速重传或 SACK 不起作用)。但是,使用 TCP 时间戳,即使在这种情况下也会进行 RTT 评估。 +如果使用了扩展,则对等方将从 TCP 段扩展空间中读取时间戳值并将其存储在本地。然后,它将该值放入作为 “时间戳回显” 发回的所有数据段中。 +因此,该选项带有两个时间戳:它的发送方自己的时间戳和它从对等方收到的最新时间戳。原始发送方使用“回显时间戳”来计算 RTT。它是当前时间戳时钟与“时间戳回显”中所反映的值之间的增量。 -This last point is significant: When TCP is busy recovering from a loss, it may only receives ACKs for re-transmitted segments. It then can’t measure (update) the RTT during this recovery phase. As a consequence it can’t adjust the re-transmission timeout, which then keeps growing exponentially. That’s a pretty specific case (it assumes that other mechanisms such as fast retransmit or SACK did not help). Nevertheless, with TCP timestamps, RTT evaluation is done even in this case. +##### 时间戳的其他用用途 -If the extension is used, the peer reads the timestamp value from the TCP segments extension space and stores it locally. It then places this value in all the segments it sends back as the “timestamp echo”. +TCP 时间戳甚至还有除 PAWS 和 RTT 测量以外的其他用途。例如,可以检测是否不需要重发。如果该确认携带较旧的时间戳回显,则该确认针对的是初始数据包,而不是重新发送的数据包。 -Therefore the option carries two timestamps: Its senders own timestamp and the most recent timestamp it received from the peer. The “echo timestamp” is used by the original sender to compute the RTT. Its the delta between its current timestamp clock and what was reflected in the “timestamp echo”. +TCP 时间戳的另一个更晦涩的用例与 TCP [syn cookie][4] 功能有关。 -##### Other timestamp uses +##### 在服务器端建立 TCP 连接 -TCP timestamps even have other uses beyond PAWS and RTT measurements. For example it becomes possible to detect if a retransmission was unnecessary. If the acknowledgment carries an older timestamp echo, the acknowledgment was for the initial packet, not the re-transmitted one. +当连接请求到达的速度快于服务器应用程序可以接受新的传入连接的速度时,连接积压最终将达到其极限。这可能是由于系统配置错误或应用程序中的错误引起的。当一个或多个客户端发送连接请求而不对 “SYN ACK” 响应做出反应时,也会发生这种情况。这将用不完整的连接填充连接队列。这些条目需要几秒钟才会超时。这被称为“同步洪水攻击”syn flood attack。 -Another, more obscure use case for TCP timestamps is related to the TCP [syn cookie][4] feature. +##### TCP 时间戳和 TCP Syn Cookie -##### TCP connection establishment on server side +即使队列已满,某些 TCP 协议栈也允许继续接受新连接。发生这种情况时,Linux 内核将在系统日志中打印一条突出的消息: -When connection requests arrive faster than a server application can accept the new incoming connection, the connection backlog will eventually reach its limit. This can occur because of a mis-configuration of the system or a bug in the application. It also happens when one or more clients send connection requests without reacting to the ‘syn ack’ response. This fills the connection queue with incomplete connections. It takes several seconds for these entries to time out. This is called a “syn flood attack”. +> P 端口上可能发生 SYN 泛洪。正在发送 Cookie。检查 SNMP 计数器。 -##### TCP timestamps and TCP syn cookies +此机制将完全绕过连接队列。通常存储在连接队列中的信息被编码到 SYN/ACK 响应 TCP 序列号中。当 ACK 返回时,可以根据序列号重建队列条目。 -Some TCP stacks allow to accept new connections even if the queue is full. When this happens, the Linux kernel will print a prominent message to the system log: +序列号只有有限的空间来存储信息。 因此,使用 “TCP Syn Cookie” 机制建立的连接不能支持 TCP 选项。 -> Possible SYN flooding on port P. Sending Cookies. Check SNMP counters. +但是,对两个对等点都通用的 TCP 选项可以存储在时间戳中。 ACK 数据包在时间戳回显字段中反映了该值,这也允许恢复已达成共识的 TCP 选项。否则,cookie 连接受标准的 64KB 接收窗口限制。 -This mechanism bypasses the connection queue entirely. The information that is normally stored in the connection queue is encoded into the SYN/ACK responses TCP sequence number. When the ACK comes back, the queue entry can be rebuilt from the sequence number. +##### 常见误区 —— 时间戳不利于性能 -The sequence number only has limited space to store information. Connections established using the ‘TCP syn cookie’ mechanism can not support TCP options for this reason. +不幸的是,一些指南建议禁用 TCP 时间戳,以减少内核访问时间戳时钟来获取当前时间所需的次数。这是不正确的。如前所述,RTT 估算是 TCP 的必要部分。因此,内核在接收/发送数据包时总是采用微秒级的时间戳。 -The TCP options that are common to both peers can be stored in the timestamp, however. The ACK packet reflects the value back in the timestamp echo field which allows to recover the agreed-upon TCP options as well. Else, cookie-connections are restricted by the standard 64 kbyte receive window. +在包处理步骤的其余部分中,Linux 会重用 RTT 估算所需的时钟时间戳。这还避免了将时间戳添加到传出 TCP 数据包的额外时钟访问。 -##### Common myths – timestamps are bad for performance +整个时间戳选项在每个数据包中仅需要 10 个字节的 TCP 选项空间,这并没有显著减少可用于数据包有效负载的空间。 -Unfortunately some guides recommend disabling TCP timestamps to reduce the number of times the kernel needs to access the timestamp clock to get the current time. This is not correct. As explained before, RTT estimation is a necessary part of TCP. For this reason, the kernel always takes a microsecond-resolution time stamp when a packet is received/sent. +##### 常见误区 —— 时间戳是个安全问题 -Linux re-uses the clock timestamp taken for the RTT estimation for the remainder of the packet processing step. This also avoids the extra clock access to add a timestamp to an outgoing TCP packet. +一些安全审计工具和 (较旧的) 博客文章建议禁用 TCP 时间戳,因为据称它们泄露了系统正常运行时间:这样一来,便可以估算系统/内核的补丁级别。这在过去是正确的:时间戳时钟基于不断增加的值,该值在每次系统引导时都以固定值开始。时间戳值可以估计机器已经运行了多长时间 (正常运行时间)。 -The entire timestamp option only requires 10 bytes of TCP option space in each packet, this is not a significant decrease in space available for packet payload. +从 Linux 4.12 开始,TCP 时间戳不再显示正常运行时间。发送的所有时间戳值都使用对等设备特定的偏移量。时间戳值也每 49 天换行一次。 -##### common myths – timestamps are a security problem +换句话说,从地址 “A” 出发,或者终到地址 “A” 的连接看到的时间戳与到远程地址 “B” 的连接看到的时间戳不同。 -Some security audit tools and (older) blog posts recommend to disable TCP -timestamps because they allegedly leak system uptime: This would then allow to estimate the patch level of the system/kernel. This was true in the past: The timestamp clock is based on a constantly increasing value that starts at a fixed value on each system boot. A timestamp value would give a estimate as to how long the machine has been running (uptime). +运行 _sysctl net.ipv4.tcp_timeamp=2_ 以禁用随机化偏移。这使得分析由诸如 _Wireshark_ 或 _tcpdump_ 之类的工具记录的数据包跟踪变得更容易 —— 从主机发送的数据包在其 TCP 选项时间戳中都具有相同的时钟基准。因此,对于正常操作,默认设置应保持不变。 -As of Linux 4.12 TCP timestamps do not reveal the uptime anymore. All timestamp values sent use a peer-specific offset. Timestamp values also wrap every 49 days. +### 选择性确认 -In other words, connections from or to address “A” see a different timestamp than connections to the remote address “B”. +如果丢失同一数据窗口中的多个数据包,TCP 将会出现问题。 这是因为 TCP 确认是累积的,但仅适用于按顺序到达的数据包。例如: -Run _sysctl net.ipv4.tcp_timestamps=2_ to disable the randomization offset. This makes analyzing packet traces recorded by tools like _wireshark_ or _tcpdump_ easier – packets sent from the host then all have the same clock base in their TCP option timestamp.  For normal operation the default setting should be left as-is. + * 发送方发送段 s_1,s_2,s_3,... s_n + * 发送方收到 s_2 的 ACK + * 这意味着 s_1 和 s_2 都已收到,并且发送方不再需要保留这些段。 + * s_3 是否应该重新发送? s_4呢? s_n? -### Selective Acknowledgments +发送方等待 “重传超时” 或 “重复 ACK” 以使 s_2 到达。如果发生重传超时或到达 s_2 的多个重复 ACK,则发送方再次发送 s_3。 -TCP has problems if several packets in the same window of data are lost. This is because TCP Acknowledgments are cumulative, but only for packets -that arrived in-sequence. Example: +如果发送方收到对 s_n 的确认,则 s_3 是唯一丢失的数据包。这是理想的情况。仅发送单个丢失的数据包。 - * Sender transmits segments s_1, s_2, s_3, … s_n - * Sender receives ACK for s_2 - * This means that both s_1 and s_2 were received and the -sender no longer needs to keep these segments around. - * Should s_3 be re-transmitted? What about s_4? s_n? +如果发送方收到的确认段小于 s_n,例如 s_4,则意味着丢失了多个数据包。 +发送方也需要重传下一个数据段。 +##### 重传策略 +可能只是重复相同的序列:重新发送下一个数据包,直到接收方指示它已处理了直至 s_n 的所有数据包为止。这种方法的问题在于,它需要一个 RTT,直到发送方知道接下来必须重新发送的数据包为止。尽管这种策略可以避免不必要的重传,但要等到 TCP 重新发送整个数据窗口后,它可能要花几秒钟甚至更长的时间。 -The sender waits for a “retransmission timeout” or ‘duplicate ACKs’ for s_2 to arrive. If a retransmit timeout occurs or several duplicate ACKs for s_2 arrive, the sender transmits s_3 again. +另一种方法是一次重新发送几个数据包。当丢失了几个数据包时,此方法可使 TCP 恢复更快。在上面的示例中,TCP 重新发送了 s_3,s_4,s_5,...,但是只能确保已丢失 s_3。 -If the sender receives an acknowledgment for s_n, s_3 was the only missing packet. This is the ideal case. Only the single lost packet was re-sent. +从延迟的角度来看,这两种策略都不是最佳的。如果只有一个数据包需要重新发送,第一种策略是快速的,但是当多个数据包丢失时,它花费的时间太长。 -If the sender receives an acknowledged segment that is smaller than s_n, for example s_4, that means that more than one packet was lost. The -sender needs to re-transmit the next segment as well. +即使必须重新发送多个数据包,第二个也是快速的,但是以浪费带宽为代价。此外,这样的 TCP 发送方在进行不必要的重传时可能已经发送了新数据。 -##### Re-transmit strategies +通过可用信息,TCP 无法知道丢失了哪些数据包。这就是 TCP [选择性确认][5](SACK)的用武之地了。就像窗口缩放和时间戳一样,它是另一个可选的但非常有用的 TCP 特性。 -Its possible to just repeat the same sequence: re-send the next packet until the receiver indicates it has processed all packet up to s_n. The problem with this approach is that it requires one RTT until the sender knows which packet it has to re-send next. While such strategy avoids unnecessary re-transmissions, it can take several seconds and more until TCP has re-sent the entire window of data. - -The alternative is to re-send several packets at once. This approach allows TCP to recover more quickly when several packets have been lost. In the above example TCP re-send s_3, s_4, s_5, .. while it can only be sure that s_3 has been lost. - -From a latency point of view, neither strategy is optimal. The first strategy is fast if only a single packet has to be re-sent, but takes too long when multiple packets were lost. - -The second one is fast even if multiple packet have to be re-sent, but at the cost of wasting bandwidth. In addition, such a TCP sender could have transmitted new data already while it was doing the unneeded re-transmissions. - -With the available information TCP cannot know which packets were lost. This is where TCP [Selective Acknowledgments][5] (SACK) come in. Just like window scaling and timestamps, it is another optional, yet very useful TCP feature. - -##### The SACK option -``` +##### SACK 选项 ``` -    TCP Sack-Permitted Option: Kind: 4, Length 2    +---------+---------+    | Kind=4  | Length=2|    +---------+---------+ ``` -``` - -A sender that supports this extension includes the “Sack Permitted” option in the connection request. If both endpoints support the extension, then a peer that detects a packet is missing in the data stream can inform the sender about this. -``` +支持此扩展的发送方在连接请求中包括 “允许 SACK” 选项。如果两个端点都支持扩展,则检测到数据流中丢失数据包的对等点可以将此信息通知发送方。 ``` -    TCP SACK Option: Kind: 5, Length: Variable                      +--------+--------+                      | Kind=5 | Length | @@ -271,10 +244,7 @@ A sender that supports this extension includes the “Sack Permitted” option i    +--------+--------+--------+--------+ ``` -``` - -A receiver that encounters segment_s2 followed by s_5…s_n, it will include a SACK block when it sends the acknowledgment for s_2: -``` +接收方遇到 segment_s2 后跟 s_5 ... s_n,则在发送对 s_2 的确认时将包括一个 SACK 块: ``` @@ -287,35 +257,31 @@ A receiver that encounters segment_s2 followed by s_5…s_n, it will include a S +--------+-------+-------+-------+ ``` -``` +这告诉发送方到 s_2 的段都是按顺序到达的,但也让发送方知道段 s_5 至 s_n 也已收到。 然后,发送方可以重新发送这两个数据包,并继续发送新数据。 -This tells the sender that segments up to s_2 arrived in-sequence, but it also lets the sender know that the segments s_5 to s_n were also received. The sender can then re-transmit these two packets and proceed to send new data. +##### 神话般的无损网络 -##### The mythical lossless network +从理论上讲,如果连接不会丢包,那么 SACK 就没有任何优势。或者连接具有如此低的延迟,甚至等待一个完整的 RTT 都无关紧要。 -In theory SACK provides no advantage if the connection cannot experience packet loss. Or the connection has such a low latency that even waiting one full RTT does not matter. +在实践中,无损行为几乎是不可能保证的。 +即使网络及其所有交换机和路由器具有足够的带宽和缓冲区空间,数据包仍然可能丢失: -In practice lossless behavior is virtually impossible to ensure. -Even if the network and all its switches and routers have ample bandwidth and buffer space packets can still be lost: + * 主机操作系统可能面临内存压力并丢弃数据包。请记住,一台主机可能同时处理数万个数据包流。 + * CPU 可能无法足够快地消耗掉来自网络接口的传入数据包。这会导致网络适配器本身中的数据包丢失。 + * 如果 TCP 时间戳不可用,即使一个非常小的 RTT 的连接也可能在丢失恢复期间暂时停止。 - * The host operating system might be under memory pressure and drop -packets. Remember that a host might be handling tens of thousands of packet streams simultaneously. - * The CPU might not be able to drain incoming packets from the network interface fast enough. This causes packet drops in the network adapter itself. - * If TCP timestamps are not available even a connection with a very small RTT can stall momentarily during loss recovery. +使用 SACK 不会增加 TCP 数据包的大小,除非连接遇到数据包丢失。因此,几乎没有理由禁用此功能。几乎所有的 TCP 协议栈都支持 SACK —— 它通常只在不进行 TCP 批量数据传输的低功耗 IOT 类似设备上才不存在。 +当 Linux 系统接受来自此类设备的连接时,TCP 会自动为受影响的连接禁用 SACK。 +### 总结 -Use of SACK does not increase the size of TCP packets unless a connection experiences packet loss. Because of this, there is hardly a reason to disable this feature. Almost all TCP stacks support SACK – it is typically only absent on low-power IOT-alike devices that are not doing TCP bulk data transfers. +本文中研究的三个 TCP 扩展都与 TCP 性能有关,最好都保留其默认设置:enabled。 -When a Linux system accepts a connection from such a device, TCP automatically disables SACK for the affected connection. +TCP 握手可确保仅使用双方都可以理解的扩展,因此,永远不需因为对等方可能不支持而全局禁用扩展。 -### Summary - -The three TCP extensions examined in this post are all related to TCP performance and should best be left to the default setting: enabled. - -The TCP handshake ensures that only extensions that are understood by both parties are used, so there is never a need to disable an extension globally just because a peer might not support it. - -Turning these extensions off results in severe performance penalties, especially in case of TCP Window Scaling and SACK. TCP timestamps can be disabled without an immediate disadvantage, however there is no compelling reason to do so anymore. Keeping them enabled also makes it possible to support TCP options even when SYN cookies come into effect. +关闭这些扩展会导致严重的性能损失,尤其是在 TCP 窗口缩放和 SACK 的情况下。 可以禁用 TCP 时间戳而不会立即造成不利影响,但是现在没有令人信服的理由这样做了。 +启用它们还可以支持 TCP 选项,即使在 SYN cookie 生效时也是如此。 -------------------------------------------------------------------------------- @@ -323,7 +289,7 @@ via: https://fedoramagazine.org/tcp-window-scaling-timestamps-and-sack/ 作者:[Florian Westphal][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[译者ID](https://github.com/gxlct008) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 14394ad8863331767c02cb7a7e7f3d2a94b2e25c Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Thu, 1 Oct 2020 22:23:19 +0800 Subject: [PATCH 0285/1156] =?UTF-8?q?=E5=B0=86=E8=AF=91=E6=96=87=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E5=88=B0=20translated/tech/=20=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ttech}/20200811 TCP window scaling, timestamps and SACK.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources/tech => translated/ttech}/20200811 TCP window scaling, timestamps and SACK.md (100%) diff --git a/sources/tech/20200811 TCP window scaling, timestamps and SACK.md b/translated/ttech/20200811 TCP window scaling, timestamps and SACK.md similarity index 100% rename from sources/tech/20200811 TCP window scaling, timestamps and SACK.md rename to translated/ttech/20200811 TCP window scaling, timestamps and SACK.md From 6fdc30d2bb5b4e2e7f0a5cbb0e3d07b1b6204a3a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 1 Oct 2020 23:21:21 +0800 Subject: [PATCH 0286/1156] Rename translated/ttech/20200811 TCP window scaling, timestamps and SACK.md to translated/tech/20200811 TCP window scaling, timestamps and SACK.md --- .../20200811 TCP window scaling, timestamps and SACK.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename translated/{ttech => tech}/20200811 TCP window scaling, timestamps and SACK.md (100%) diff --git a/translated/ttech/20200811 TCP window scaling, timestamps and SACK.md b/translated/tech/20200811 TCP window scaling, timestamps and SACK.md similarity index 100% rename from translated/ttech/20200811 TCP window scaling, timestamps and SACK.md rename to translated/tech/20200811 TCP window scaling, timestamps and SACK.md From 084c61d042bb3355cd6bd9b5ad38acf257912a4c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 1 Oct 2020 23:42:31 +0800 Subject: [PATCH 0287/1156] PRF @geekpi --- ...rease LVM-s (Logical Volume Resize) in Linux.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/translated/tech/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md b/translated/tech/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md index c9564ddfa4..d541d51c79 100644 --- a/translated/tech/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md +++ b/translated/tech/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md @@ -3,22 +3,24 @@ [#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) -[#]: subject: (How to Extend/Increase LVM’s (Logical Volume Resize) in Linux) +[#]: subject: (How to Extend/Increase LVM’s in Linux) [#]: via: (https://www.2daygeek.com/extend-increase-resize-lvm-logical-volume-in-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) 如何在 Linux 中扩展/增加 LVM 大小(逻辑卷调整) ====== +![](https://img.linux.net.cn/data/attachment/album/202010/01/234018qgnwilmmzom8xarb.jpg) + 扩展逻辑卷非常简单,只需要很少的步骤,而且不需要卸载某个逻辑卷就可以在线完成。 LVM 的主要目的是灵活的磁盘管理,当你需要的时候,可以很方便地调整、扩展和缩小逻辑卷的大小。 如果你是逻辑卷管理(LVM) 新手,我建议你从我们之前的文章开始学习。 - * **第一部分:[如何在 Linux 中创建/配 置LVM(逻辑卷管理)][1]** + * **第一部分:[如何在 Linux 中创建/配置 LVM(逻辑卷管理)][1]** - ![][2] +![](https://img.linux.net.cn/data/attachment/album/202010/01/233946ybwbnw4zanjbn00e.jpeg) 扩展逻辑卷涉及到以下步骤: @@ -67,7 +69,7 @@ PV UUID 69d9dd18-36be-4631-9ebb-78f05fe3217f ### 如何扩展卷组 -使用以下命令在现有的卷组中添加一个新的物理卷: +使用以下命令在现有的卷组(VG)中添加一个新的物理卷: ``` # vgextend vg01 /dev/sdc @@ -104,7 +106,7 @@ VG UUID d17e3c31-e2c9-4f11-809c-94a549bc43b7 使用以下命令增加现有逻辑卷大小。 -逻辑卷扩展(`lvextend`)的常用语法: +**逻辑卷扩展(`lvextend`)的常用语法:** ``` lvextend [要增加的额外空间] [现有逻辑卷名称] @@ -166,6 +168,6 @@ via: https://www.2daygeek.com/extend-increase-resize-lvm-logical-volume-in-linux [a]: https://www.2daygeek.com/author/magesh/ [b]: https://github.com/lujun9972 -[1]: https://www.2daygeek.com/create-lvm-storage-logical-volume-manager-in-linux/ +[1]: https://linux.cn/article-12670-1.html [2]: https://www.2daygeek.com/wp-content/uploads/2020/09/extend-increase-resize-lvm-logical-volume-in-linux-3.png [3]: https://www.2daygeek.com/linux-check-disk-space-usage-df-command/ From b0670fca7545e4a47943a21f543d2720b9a74158 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 1 Oct 2020 23:42:51 +0800 Subject: [PATCH 0288/1156] PUB @geekpi https://linux.cn/article-12673-1.html --- ... Extend-Increase LVM-s (Logical Volume Resize) in Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md (98%) diff --git a/translated/tech/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md b/published/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md similarity index 98% rename from translated/tech/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md rename to published/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md index d541d51c79..db9b0c9679 100644 --- a/translated/tech/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md +++ b/published/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12673-1.html) [#]: subject: (How to Extend/Increase LVM’s in Linux) [#]: via: (https://www.2daygeek.com/extend-increase-resize-lvm-logical-volume-in-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) From 291757806d91f976d5e2d704d8218fb099c9ab92 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 1 Oct 2020 23:50:35 +0800 Subject: [PATCH 0289/1156] APL --- .../20200930 Recovering deleted files on Linux with testdisk.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200930 Recovering deleted files on Linux with testdisk.md b/sources/tech/20200930 Recovering deleted files on Linux with testdisk.md index 815b201add..a788b77b6a 100644 --- a/sources/tech/20200930 Recovering deleted files on Linux with testdisk.md +++ b/sources/tech/20200930 Recovering deleted files on Linux with testdisk.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From bbebf5f2159741ec732c85db0a59a3cf27491767 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 2 Oct 2020 00:35:05 +0800 Subject: [PATCH 0290/1156] TSL&PRF --- ...ng deleted files on Linux with testdisk.md | 201 ------------------ ...ng deleted files on Linux with testdisk.md | 201 ++++++++++++++++++ 2 files changed, 201 insertions(+), 201 deletions(-) delete mode 100644 sources/tech/20200930 Recovering deleted files on Linux with testdisk.md create mode 100644 translated/tech/20200930 Recovering deleted files on Linux with testdisk.md diff --git a/sources/tech/20200930 Recovering deleted files on Linux with testdisk.md b/sources/tech/20200930 Recovering deleted files on Linux with testdisk.md deleted file mode 100644 index a788b77b6a..0000000000 --- a/sources/tech/20200930 Recovering deleted files on Linux with testdisk.md +++ /dev/null @@ -1,201 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Recovering deleted files on Linux with testdisk) -[#]: via: (https://www.networkworld.com/article/3575524/recovering-deleted-files-on-linux-with-testdisk.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -Recovering deleted files on Linux with testdisk -====== -This post describes testdisk, one of the tools that comes in handy for recovering recently deleted files (along with fixing partitions in other ways). -Thinkstock - -When you delete a file on a Linux system, it isn’t necessarily gone forever, especially if you just recently deleted it. - -Unless you rubbed it out with a tool such as **shred**, the data will still be sitting on your disk—and one of the best tools for recovering deleted files, **testdisk,** can help you rescue it. While **testdisk** has a wide range of functionality including recovering lost or damaged partitions and making non-booting disks bootable again, it’s also frequently used to restore files that were deleted by mistake. - -In this post, we’ll take a look at how you can recover deleted files using **testdisk** and what each step in the process looks like. Since the process requires quite a few steps, you’re likely to feel more comfortable running through them once you’ve done it a few times. - -### Installing testdisk - -Install **testdisk** with commands like **apt install testdisk** or **yum install testdisk**. Interestingly, it’s not just a Linux tool but is also available for MacOS, Solaris and Windows as well. - -Documentation is available at [cgsecurity.org][1]. - -### Recovering files - -First of all, you have to be logged in as **root** or have **sudo** access to use **testdisk**. If you don’t have **sudo** access, you’ll get kicked out early in the process, and your logfile, if you chose to create one, will end up with a message like this in it: - -``` -TestDisk exited normally. -jdoe is not in the sudoers file. This incident will be reported. -``` - -When you recover deleted files with **testdisk**, you’re going to end up with the files being restored within the directory form which you started the tool and the files are going to belong to **root**. For this reason, I like to start in a directory like **/home/recovery**. Once the files are successfully restored and verified, they can be moved back to where they belong and have their ownership restored as well. - -Make sure you can write in the directory you select to start in. - -``` -$ cd /home/recovery -$ testdisk -``` - -The first page of information presented by **testdisk** describes the tool and displays some options. At least initially, it’s a good idea to create the log file as it provides information that might prove useful. Here’s how: - -``` -Use arrow keys to select, then press Enter key: ->[ Create ] Create a new log file - [ Append ] Append information to log file - [ No Log ] Don’t record anything -``` - -The **>** on the left and the reversal of the font and background colors that you will see show the option that will be used once you press **enter**. In this example, we opted to create the log file. - -You will then be prompted for your password (unless you very recently used **sudo**). - -The next step is to select the disk partition in which the deleted file was stored (if not already highlighted). Use the up and down arrow keys as needed to move to it. Then tap the right arrow twice and press **enter** when **Proceed** is highlighted. - -``` -Select a media (use Arrow keys, then press Enter): - Disk /dev/sda - 120 GB / 111 GiB - SSD2SC120G1CS1754D117-551 ->Disk /dev/sdb - 500 GB / 465 GiB - SAMSUNG HE502HJ - Disk /dev/loop0 - 13 MB / 13 MiB (RO) - Disk /dev/loop1 - 101 MB / 96 MiB (RO) - Disk /dev/loop10 - 148 MB / 141 MiB (RO) - Disk /dev/loop11 - 36 MB / 35 MiB (RO) - Disk /dev/loop12 - 52 MB / 49 MiB (RO) - Disk /dev/loop13 - 78 MB / 75 MiB (RO) - Disk /dev/loop14 - 173 MB / 165 MiB (RO) - Disk /dev/loop15 - 169 MB / 161 MiB (RO) ->[Previous] [ Next ] [Proceed ] [ Quit ] -``` - -In this example, the deleted file was in a home directory in **/dev/sdb**. - -At this point, the partition type should already be selected by **testdisk**. - -``` -Disk /dev/sdb - 500 GB / 465 GiB - SAMSUNG HE502HJ - -Please select the partition table type, press Enter when done. - [Intel ] Intel/PC partition ->[EFI GPT] EFI GPT partition map (Mac i386, some x86_64...) - [Humax ] Humax partition table - [Mac ] Apple partition map (legacy) - [None ] Non partitioned media - [Sun ] Sun Solaris partition - [XBox ] XBox partition - [Return ] Return to disk selection -``` - -In the next step, arrow down to “[ Advanced ] Filesystem Utils”. - -``` -[ Analyse ] Analyse current partition structure and search for lost partitions ->[ Advanced ] Filesystem Utils - [ Geometry ] Change disk geometry - [ Options ] Modify options - [ Quit ] Return to disk selection -``` - -Next, view the selected partition. - -``` -Partition Start End Size in sectors -> 1 P Linux filesys. data 2048 910155775 910153728 [drive2] -``` - -Then press the right arrow to select **[ List ]** at the bottom and press enter. - -``` -[ Type ] [Superblock] >[ List ] [Image Creation] [ Quit ] -``` - -Notice that it looks as if we’re starting in **/**, but this is actually the base of the file system that we’re working in. In this example, that’s **/home**. - -``` -Directory / <== starting point - ->drwxr-xr-x 0 0 4096 23-Sep-2020 17:46 . - drwxr-xr-x 0 0 4096 23-Sep-2020 17:46 .. - drwx——— 0 0 16384 22-Sep-2020 11:30 lost+found - drwxr-xr-x 1008 1008 4096 9-Jul-2019 14:10 dorothy - drwxr-xr-x 1001 1001 4096 22-Sep-2020 12:12 nemo - drwxr-xr-x 1005 1005 4096 19-Jan-2020 11:49 eel - drwxrwxrwx 0 0 4096 25-Sep-2020 08:08 recovery -... -``` - -Next, we arrow down to the specific home directory. - -``` -drwxr-xr-x 1016 1016 4096 17-Feb-2020 16:40 gino ->drwxr-xr-x 1000 1000 20480 25-Sep-2020 08:00 shs -``` - -Press enter to move into that directory and then arrow down to a subdirectory as needed. Note that you can choose **..** near the top of the list to back up if you picked the wrong one. - -If you have trouble finding the file, you can press **/** (like when you start a search in **vi**) to be prompted to enter the file name or some portion of it. - -``` -Directory /shs <== current location - Previous -... - -rw-rw-r— 1000 1000 426 8-Apr-2019 19:09 2-min-topics ->-rw-rw-r— 1000 1000 24667 8-Feb-2019 08:57 Up_on_the_Roof.pdf -``` - -Once you’ve located the file that you need to restore, press “**c**” to select it. - -NOTE: You will see helpful instructions at the bottom of your screen: - -``` -Use Left arrow to go back, Right to change directory, h to hide deleted files - q to quit, : to select the current file, a to select all files - C to copy the selected files, c to copy the current file <== -``` - -At this point, you’ll be ready to select where to restore that file within your starting directory (see earlier note about starting in a good place to check out the file before moving it back to its place of origin). In this case, the **/home/recovery** directory has no subdirectories, so this is our recovery spot. - -NOTE: You will see helpful instructions at the bottom of the screen. - -``` -Please select a destination where /shs/Up_on_the_Roof.pdf will be copied. -Keys: Arrow keys to select another directory - C when the destination is correct - Q to quit -Directory /home/recovery <== recovery location -``` - -Once you see “**Copy done! 1 ok, 0 failed**” in green, you’ll know the file has been restored. - -The file in this case was left in **/home/recovery/shs** (starting directory with the selected directory appended). - -You should probably verify that the recovered file looks right before moving it back into its original location. Make sure you also restore the original owner and group since the file will be owned by root at this point. - -**NOTE:** For many points in the file recovery process, you can use quit (**q** or **[ Quit ]**) to back up a step. You can select quit options all the way back to the first step in the process if you like or **^c** to exit immediately. - -#### Recovery training - -Recovering files using **testdisk** is relatively painless, but somewhat complicated. It’s probably a good idea to practice recovering files before panic time sets to give yourself a chance to get comfortable with the process. - -Join the Network World communities on [Facebook][2] and [LinkedIn][3] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3575524/recovering-deleted-files-on-linux-with-testdisk.html - -作者:[Sandra Henry-Stocker][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://www.networkworld.com/author/Sandra-Henry_Stocker/ -[b]: https://github.com/lujun9972 -[1]: https://www.cgsecurity.org/testdisk.pdf -[2]: https://www.facebook.com/NetworkWorld/ -[3]: https://www.linkedin.com/company/network-world diff --git a/translated/tech/20200930 Recovering deleted files on Linux with testdisk.md b/translated/tech/20200930 Recovering deleted files on Linux with testdisk.md new file mode 100644 index 0000000000..4421403252 --- /dev/null +++ b/translated/tech/20200930 Recovering deleted files on Linux with testdisk.md @@ -0,0 +1,201 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Recovering deleted files on Linux with testdisk) +[#]: via: (https://www.networkworld.com/article/3575524/recovering-deleted-files-on-linux-with-testdisk.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +用 testdisk 恢复 Linux 上已删除的文件 +====== + +> 这篇文章介绍了 testdisk,这是恢复最近删除的文件(以及用其他方式修复分区)的工具之一,非常方便。 + +![](https://images.idgesg.net/images/article/2018/01/survival_life-preserver_risk_swimming_rescue-100747102-large.jpg) + +当你在 Linux 系统上删除一个文件时,它不一定会永远消失,特别是当你最近才刚刚删除了它的时候。 + +除非你用 `shred` 等工具把它擦掉,否则数据仍然会放在你的磁盘上 —— 而恢复已删除文件的最佳工具之一 `testdisk` 可以帮助你拯救它。虽然 `testdisk` 具有广泛的功能,包括恢复丢失或损坏的分区和使不能启动磁盘可以重新启动,但它也经常被用来恢复被误删的文件。 + +在本篇文章中,我们就来看看如何使用 `testdisk` 恢复已删除的文件,以及该过程中的每一步是怎样的。由于这个过程需要不少的步骤,所以当你做了几次之后,你可能会觉得操作起来会更加得心应手。 + +### 安装 testdisk + +可以使用 `apt install testdisk` 或 `yum install testdisk` 等命令安装 `testdisk`。有趣的是,它不仅是一个 Linux 工具,而且还适用于 MacOS、Solaris 和 Windows。 + +文档可在 [cgsecurity.org][1] 中找到。 + +### 恢复文件 + +首先,你必须以 `root` 身份登录,或者有 `sudo` 权限才能使用 `testdisk`。如果你没有 `sudo` 访问权限,你会在这个过程一开始就被踢出,而如果你选择创建了一个日志文件的话,最终会有这样的消息: + +``` +TestDisk exited normally. +jdoe is not in the sudoers file. This incident will be reported. +``` + +当你用 `testdisk` 恢复被删除的文件时,你最终会将恢复的文件放在你启动该工具的目录下,而这些文件会属于 `root`。出于这个原因,我喜欢在 `/home/recovery` 这样的目录下启动。一旦文件被成功地还原和验证,就可以将它们移回它们的所属位置,并将它们的所有权也恢复。 + +在你可以写入的选定目录下开始: + +``` +$ cd /home/recovery +$ testdisk +``` + +`testdisk` 提供的第一页信息描述了该工具并显示了一些选项。至少在刚开始,创建个日志文件是个好主意,因为它提供的信息可能会被证明是有用的。下面是如何做的: + +``` +Use arrow keys to select, then press Enter key: +>[ Create ] Create a new log file + [ Append ] Append information to log file + [ No Log ] Don’t record anything +``` + +左边的 `>` 以及你看到的反转的字体和背景颜色指出了你按下回车键后将使用的选项。在这个例子中,我们选择了创建日志文件。 + +然后会提示你输入密码(除非你最近使用过 `sudo`)。 + +下一步是选择被删除文件所存储的磁盘分区(如果没有高亮显示的话)。根据需要使用上下箭头移动到它。然后点两次右箭头,当 “Proceed” 高亮显示时按回车键。 + +``` +Select a media (use Arrow keys, then press Enter): + Disk /dev/sda - 120 GB / 111 GiB - SSD2SC120G1CS1754D117-551 +>Disk /dev/sdb - 500 GB / 465 GiB - SAMSUNG HE502HJ + Disk /dev/loop0 - 13 MB / 13 MiB (RO) + Disk /dev/loop1 - 101 MB / 96 MiB (RO) + Disk /dev/loop10 - 148 MB / 141 MiB (RO) + Disk /dev/loop11 - 36 MB / 35 MiB (RO) + Disk /dev/loop12 - 52 MB / 49 MiB (RO) + Disk /dev/loop13 - 78 MB / 75 MiB (RO) + Disk /dev/loop14 - 173 MB / 165 MiB (RO) + Disk /dev/loop15 - 169 MB / 161 MiB (RO) +>[Previous] [ Next ] [Proceed ] [ Quit ] +``` + +在这个例子中,被删除的文件在 `/dev/sdb` 的主目录下。 + +此时,`testdisk` 应该已经选择了合适的分区类型。 + +``` +Disk /dev/sdb - 500 GB / 465 GiB - SAMSUNG HE502HJ + +Please select the partition table type, press Enter when done. + [Intel ] Intel/PC partition +>[EFI GPT] EFI GPT partition map (Mac i386, some x86_64...) + [Humax ] Humax partition table + [Mac ] Apple partition map (legacy) + [None ] Non partitioned media + [Sun ] Sun Solaris partition + [XBox ] XBox partition + [Return ] Return to disk selection +``` + +在下一步中,按向下箭头指向 “[ Advanced ] Filesystem Utils”。 + +``` +[ Analyse ] Analyse current partition structure and search for lost partitions +>[ Advanced ] Filesystem Utils + [ Geometry ] Change disk geometry + [ Options ] Modify options + [ Quit ] Return to disk selection +``` + +接下来,查看选定的分区。 + +``` +Partition Start End Size in sectors +> 1 P Linux filesys. data 2048 910155775 910153728 [drive2] +``` + +然后按右箭头选择底部的 “[ List ]”,按回车键。 + +``` +[ Type ] [Superblock] >[ List ] [Image Creation] [ Quit ] +``` + +请注意,它看起来就像我们从根目录 `/` 开始,但实际上这是我们正在工作的文件系统的基点。在这个例子中,就是 `/home`。 + +``` +Directory / <== 开始点 + +>drwxr-xr-x 0 0 4096 23-Sep-2020 17:46 . + drwxr-xr-x 0 0 4096 23-Sep-2020 17:46 .. + drwx——— 0 0 16384 22-Sep-2020 11:30 lost+found + drwxr-xr-x 1008 1008 4096 9-Jul-2019 14:10 dorothy + drwxr-xr-x 1001 1001 4096 22-Sep-2020 12:12 nemo + drwxr-xr-x 1005 1005 4096 19-Jan-2020 11:49 eel + drwxrwxrwx 0 0 4096 25-Sep-2020 08:08 recovery +... +``` + +接下来,我们按箭头指向具体的主目录。 + +``` +drwxr-xr-x 1016 1016 4096 17-Feb-2020 16:40 gino +>drwxr-xr-x 1000 1000 20480 25-Sep-2020 08:00 shs +``` + +按回车键移动到该目录,然后根据需要向下箭头移动到子目录。注意,如果选错了,可以选择列表顶部附近的 `..` 返回。 + +如果找不到文件,可以按 `/`(就像在 `vi` 中开始搜索时一样),提示你输入文件名或其中的一部分。 + +``` +Directory /shs <== current location + Previous +... + -rw-rw-r— 1000 1000 426 8-Apr-2019 19:09 2-min-topics +>-rw-rw-r— 1000 1000 24667 8-Feb-2019 08:57 Up_on_the_Roof.pdf +``` + +一旦你找到需要恢复的文件,按 `c` 选择它。 + +注意:你会在屏幕底部看到有用的说明: + +``` +Use Left arrow to go back, Right to change directory, h to hide deleted files + q to quit, : to select the current file, a to select all files + C to copy the selected files, c to copy the current file <== +``` + +这时,你就可以在起始目录内选择恢复该文件的位置了(参见前面的说明,在将文件移回原点之前,先在一个合适的地方进行检查)。在这种情况下,`/home/recovery` 目录没有子目录,所以这就是我们的恢复点。 + +注意:你会在屏幕底部看到有用的说明: + +``` +Please select a destination where /shs/Up_on_the_Roof.pdf will be copied. +Keys: Arrow keys to select another directory + C when the destination is correct + Q to quit +Directory /home/recovery <== 恢复位置 +``` + +一旦你看到 “Copy done! 1 ok, 0 failed” 的绿色字样,你就会知道文件已经恢复了。 + +在这种情况下,文件被留在 `/home/recovery/shs` 下(起始目录,附加所选目录)。 + +在将文件移回原来的位置之前,你可能应该先验证恢复的文件看起来是否正确。确保你也恢复了原来的所有者和组,因为此时文件由 root 拥有。 + +**注意:** 对于文件恢复过程中的很多步骤,你可以使用退出(按 `q` 或“[ Quit ]”)来返回上一步。如果你愿意,可以选择退出选项一直回到该过程中的第一步,也可以选择按下 `^c` 立即退出。 + +#### 恢复训练 + +使用 `testdisk` 恢复文件相对来说没有痛苦,但有些复杂。在恐慌时间到来之前,最好先练习一下恢复文件,让自己有机会熟悉这个过程。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3575524/recovering-deleted-files-on-linux-with-testdisk.html + +作者:[Sandra Henry-Stocker][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://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.cgsecurity.org/testdisk.pdf +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world From b5c7c94af4a663f380caddb7a5c58edc96ed2e58 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 2 Oct 2020 00:43:35 +0800 Subject: [PATCH 0291/1156] PUB @wxy https://linux.cn/article-12674-1.html --- ...0200930 Recovering deleted files on Linux with testdisk.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200930 Recovering deleted files on Linux with testdisk.md (99%) diff --git a/translated/tech/20200930 Recovering deleted files on Linux with testdisk.md b/published/20200930 Recovering deleted files on Linux with testdisk.md similarity index 99% rename from translated/tech/20200930 Recovering deleted files on Linux with testdisk.md rename to published/20200930 Recovering deleted files on Linux with testdisk.md index 4421403252..c8c8e0dac0 100644 --- a/translated/tech/20200930 Recovering deleted files on Linux with testdisk.md +++ b/published/20200930 Recovering deleted files on Linux with testdisk.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12674-1.html) [#]: subject: (Recovering deleted files on Linux with testdisk) [#]: via: (https://www.networkworld.com/article/3575524/recovering-deleted-files-on-linux-with-testdisk.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) From 18c0a95f82013e56b2a5296a076a3d39260aa422 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 2 Oct 2020 05:01:34 +0800 Subject: [PATCH 0292/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201001?= =?UTF-8?q?=20Akraino:=20An=20Open=20Source=20Project=20for=20the=20Edge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201001 Akraino- An Open Source Project for the Edge.md --- ...no- An Open Source Project for the Edge.md | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 sources/tech/20201001 Akraino- An Open Source Project for the Edge.md diff --git a/sources/tech/20201001 Akraino- An Open Source Project for the Edge.md b/sources/tech/20201001 Akraino- An Open Source Project for the Edge.md new file mode 100644 index 0000000000..9fa671bed6 --- /dev/null +++ b/sources/tech/20201001 Akraino- An Open Source Project for the Edge.md @@ -0,0 +1,63 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Akraino: An Open Source Project for the Edge) +[#]: via: (https://www.linux.com/news/akraino-an-open-source-project-for-the-edge/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +Akraino: An Open Source Project for the Edge +====== + +Akraino is an open-source project designed for the Edge community to easily integrate open source components into their stack. It’s a set of open infrastructures and application blueprints spanning a broad variety of use cases, including 5G, AI, Edge IaaS/PaaS, IoT, for both provider and enterprise Edge domains. We sat down with Tina Tsou, TSC Co-Chair of the Akraino project to learn more about it and its community. + +Here is a lightly edited transcript of the interview: + +Swapnil Bhartiya: Today, we have with us Tina Tsou, TSC Co-Chair of the Akraino project. Tell us a bit about the Akraino project. + +Tina Tsou: Yeah, I think Akraino is an Edge Stack project under Linux Foundation Edge. Before Akraino, the developers had to go to the upstream community to download the upstream software components and integrate in-store to test. With the blueprint ideas and concept, the developers can directly do the use-case base to blueprint, do all the integration, and [have it] ready for the end-to-end deployment for Edge. + +Swapnil Bhartiya: The blueprints are the critical piece of it. What are these blueprints and how do they integrate with the whole framework? + +Tina Tsou: Based on the certain use case, we do the community CI/CD ( continuous integration and continuous deployment). We also have proven security requirements. We do the community lab and we also do the life cycle management. And then we do the production quality, which is deployment-ready. + +Swapnil Bhartiya: Can you explain what the Edge computing framework looks like? + +Tina Tsou: We have four segments: Cloud, Telco, IoT, and Enterprise. When we do the framework, it’s like we have a framework of the Edge compute in general, but for each segment, they are slightly different. You will see in the lower level, you have the network, you have the gateway, you have the switches. In the upper of it, you have all kinds of FPGA and then the data plan. Then, you have the controllers and orchestration, like the Kubernetes stuff and all kinds of applications running on bare metal, virtual machines or the containers. By the way, we also have the orchestration on the site. + +Swapnil Bhartiya: And how many blueprints are there? Can you talk about it more specifically? +Tina Tsou: I think we have around 20-ish blueprints, but they are converged into blueprint families. We have a blueprint family for telco appliances, including Radio Edge Cloud, and SEBA that has enabled broadband access. We also have a blueprint for Network Cloud. We have a blueprint for Integrated Edge Cloud. We have a blueprint for Edge Lite IoT. So, in this case, the different blueprints in the same blueprint family can share the same software framework, which saves a lot of time. That means we can deploy it at a large scale. + +Swapnil Bhartiya: The software components, which you already talked about in each blueprint, are they all in the Edge project or there are some components from external projects as well? + +Tina Tsou: We have the philosophy of upstream first. If we can find it from the upstream community, we just directly take it from the upstream community and install and integrate it. If we find something that we need, we go to the upstream community to see whether it can be changed or updated there. + +Swapnil Bhartiya: How challenging or easy it is to integrate these components together, to build the stack? + +Tina Tsou: It depends on which group and family we are talking about. I think most of them at the middle level of middle are not too easy, not too complex. But the reference has to create the installation, like the YAML files configuration and for builds on ISO images, some parts may be more complex and some parts will be easy to download and integrate. + +Swapnil Bhartiya: We have talked about the project. I want to talk about the community. So first of all, tell us what is the role of TSC? + +Tina Tsou: We have a whole bunch of documentation on how TSA runs if you want to read. I think the role for TSC is more tactical steering. We have a chair and co-chair, and there are like 6-7 subcommittees for specific topics like security, technical community, CI and documentation process. + +Swapnil Bhartiya: What kind of community is there around the Akraino project? + +Tina Tsou: I think we have a pretty diverse community. We have the end-users like the telcos and the hyperscalers, the internet companies, and also enterprise companies. Then we have the OEM/ODM vendors, the chip makers or the SoC makers. Then have the IP companies and even some universities. + +Swapnil Bhartiya: Tina, thank you so much for taking the time today to explain the Akraino project and also about the blueprints, the community, and the roadmap for the project. I look forward to seeing you again to get more updates about the project. + +Tina Tsou: Thank you for your time. I appreciate it. +-------------------------------------------------------------------------------- + +via: https://www.linux.com/news/akraino-an-open-source-project-for-the-edge/ + +作者:[Swapnil Bhartiya][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://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 From ec7e68233e9101b078329214f7e96f5dd2de4205 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 2 Oct 2020 05:01:47 +0800 Subject: [PATCH 0293/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201001?= =?UTF-8?q?=20Bringing=20COBOL=20to=20the=20Modern=20World?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201001 Bringing COBOL to the Modern World.md --- ...1001 Bringing COBOL to the Modern World.md | 101 ++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 sources/tech/20201001 Bringing COBOL to the Modern World.md diff --git a/sources/tech/20201001 Bringing COBOL to the Modern World.md b/sources/tech/20201001 Bringing COBOL to the Modern World.md new file mode 100644 index 0000000000..2eeb097f65 --- /dev/null +++ b/sources/tech/20201001 Bringing COBOL to the Modern World.md @@ -0,0 +1,101 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Bringing COBOL to the Modern World) +[#]: via: (https://www.linux.com/news/bringing-cobol-to-the-modern-world/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +Bringing COBOL to the Modern World +====== + +COBOL is powering most of the critical infrastructure that involves any kind of monetary transaction. In this special interview conducted during the recent Open Mainframe Summit, we talked about the relevance of COBOL today and the role of the new COBOL working group that was announced at the summit. Joining us were Cameron Seay, Adjunct Professor at East Carolina University and Derek Lisinski of the Application Modernizing Group at Micro Focus. Micro Focus recently joined the Open Mainframe Project and is now also involved with the working group. + +Here is an edited version of the discussion: + +Swapnil Bhartiya: First of all, Cam and Derek, welcome to the show. If you look at COBOL, it’s very old technology. Who is still using COBOL today? Cam, I would like to hear your insight first. + +Cameron Seay: Every large commercial bank I know of uses COBOL. Every large insurance company, every large federal agency, every large retailer uses COBOL to some degree, and it processes a large percentage of the world’s financial transactions. For example, if you go to Walmart and you make a sale, that transaction is probably recorded using a COBOL program. So, it’s used a lot, a large percentage of the global business is still done in COBOL. + +Swapnil Bhartiya: Micro Focus is I think one of the few companies that offer support around COBOL. Derek, please tell people the importance of COBOL in today’s modern world. + +Derek Lisinski: Well, if we go back in time, there weren’t that many choices on the market. If you wanted robust technology to build your business systems, COBOL was one of the very few choices and so it’s surprising when there are so many choices around today and yet, many of the world’s largest industries, largest organizations still rely on COBOL. If COBOL wasn’t being used, so many of those systems that people trust and rely on — whether you’re moving money around, whether you’re running someone’s payroll, whether you’re getting insurance quotation, shipping a parcel, booking a holiday. All of these things are happening with COVID at the backend and the value you’re getting from that is not just that it’s carried on, but it runs with the same results again and again and again, without fail. + +The importance of COBOL is not just its pervasiveness, which I think is significant and perhaps not that well understood, but also it’s reliability. And because it’s welded very closely to the mainframe environments and to CICS and some other core elements of the mainframe and other platforms as well. It uses and trusts a lot of technology that is unrivaled in terms of its reliability, scalability and its performance. That’s why it remains so important to the global economy and to so many industries. It does what it needs to do, which is business processing, so fantastically well. + +Swapnil Bhartiya: Excellent, thanks for talking about that. Now, you guys recently joined the project and the foundation as well, so talk about why you joined the Open Mainframe Project and what are the projects that you will be involved with, of course. I know you’re involved with the working group, but talk about your involvement with the project. + +Derek Lisinski: Well, our initial interest with the Open Mainframe Project goes back a couple of years. We’re longtime proponents of the mainframe platform, of course, here at Micro Focus. We’ve had a range of technologies that run on z/OS. But our interest in the wider mainframe community—and that would be the Open Mainframe Project—probably comes as a result of the time we’ve spent with the SHARE community and other IBM-sponsored communities, where the discussion was about the best way to embrace this trusted technology in the digital era. This is becoming a very topical conversation and that’s also true for COBOL, which I’m sure we’ll come back to. + +Our interest in the OMP has been going on for the last couple of years and we were finally able to reach an agreement between both organizations to join the group this year, specifically because of a number of initiatives that we have going on at Micro Focus and that a number of our customers have talked to us about specifically in the area of mainframe DevOps. As vital as the mainframe platform is, there’s a growing desire to use it to deliver greater and greater value to the business, which typically means trying to accelerate delivery cycles and get more done. + +Of course, now the mainframe is so inextricably connected with other parts of the IT ecosystem that those points of connection and the number of moving parts have to be handled, integrated with, and managed as part of a delivery process. It’s an important part of our customers’ roadmap and, therefore, our roadmap to ensure that they get the very best of technology in the mainframe world. Whether it’s tried-and-trusted technology, whether it’s new emerging vendor technology, or whether in many cases, it becomes open source technology. We wanted to play our part in those kinds of projects and a number of initiatives around. + +Swapnil Bhartiya: Is there an increase in interest in COBOL that we are seeing there now that there is a dedicated working group? And if you can also talk a bit about what will be the role of this group. + +Cameron Seay: If your question was, is there an increased interest in working in COBOL because of the working group, the working group actually came as a result of a renewed interest in the written new discovery in COBOL. The governor of New Jersey made a comment that their unemployment was not able to be processed because of COBOL’s obsolescence, or inefficiency, or inadequacy to some degree. And that sparked quite a furor in the mainframe world because it wasn’t COBOL at all. COBOL had nothing to do with the inability of New Jersey to deliver the unemployment checks. Further, we’re aware that New Jersey is just typical of every state. Every state that I know of—there may be some exceptions I’m not aware of, I know it’s certainly true for California and New York—is dependent upon COBOL to process their day-to-day business applications. + +So, then Derek and some other people inside the OMP got together and started having some conversations, myself included, and said “We maybe need to form a COBOL working group to renew this interest in COBOL and establish the facts around COBOL.” So that’s kind of what the working group is trying to do, and we’re trying to increase that familiarity, visibility and interest in COBOL. + +Swapnil Bhartiya: Derek, I want to bring the same question to you also. Is there any particular reason that we are seeing an increase in interest in COBOL and what is that reason? + +Derek Lisinski: Yeah, that’s a great question and I think there are a few reasons. First of all, I think a really important milestone for COBOL was actually last year when it turned 60 years old. I think one of your earlier questions is related to COBOL’s age being 60. Of course, COBOL isn’t a 60-year-old language but the idea is 60 years old, for sure. If you drive a 2020 motor car, you’re driving a 2020 motor car, you’re not driving a hundred-year-old idea. No one thinks a modern telephone is an old idea, either. It’s not old technology, sorry. +The idea might’ve been from a long time ago, but the technology has advanced, and the same thing is true in code. But when we celebrated COBOL’s 60th anniversary last year—a few of the vendors did and a number of organizations did, too—there was an outpouring of interest in the technology. A lot of times, COBOL just quietly goes about its business of running the world’s economy without any fuss. Like I said, it’s very, very reliable and it never really breaks. So, it was never anything to talk about. People were sort of pleasantly surprised, I think, to learn of its age, to learn of the age of the idea. Now, of course, Micro Focus and IBM and some of the other vendors continue to update and adapt COBOL so that it continues to evolve and be relevant today. + +It’s actually a 2020 technology rather than a 1960 one, but that was the first one. Secondly, the pandemic caused a lot of businesses to have to change how they process core systems and how they interact with their customers. That put extra strain on certain organizations or certain government agencies and, in a couple of cases, COBOL was incorrectly made the scapegoat for some of the challenges that those organizations face, whether it was a skills issue or whether it was a technology issue. Under the cover, COBOL was working just fine. So the interest has been positive regarding the anniversary, but I think the reports have been inaccurate and perhaps a little unkind about COBOL. Those were the two reasons they came together. + +I remember when I first spoke to Cam and to some of the other people on the working group, you said it was a very good idea once and for all that we told the truth about COBOL, that the industry finally understood how viable it is, how valuable it is, based on the facts behind COBOL’s usage. So one of the things we’re going to do is try to quantify and qualify as best we can, how widely COBOL is used, what do you use it for, who is using, and then present a more factual story about the technology so people can make a more informed decision about technical strategy. Rather than base it on hearsay or some reputation about something being a bit rusty and out-of-date, which is probably the reputation that’s being espoused by someone who would have you replace it with something else, and their motivation might be for different reasons. There’s nothing wrong with COBOL and it’s very, very viable and our job I think really is to tell that truth and make sure people understand it, + +Swapnil Bhartiya: What other projects, efforts, or initiatives are going on there at the Linux Foundation or Open Mainframe Project around COBOL? Can you talk about that? + +Cameron Seay: Well, certainly. There is currently a course being developed by folks in the community who have developed an online course in COBOL. It’s the rudiments of it. It’s for novices, but it’s great for a continuing education program. So, that’s one of the things going on around COBOL. Another thing is there’s a lot going on in mainframe development in the OMP now. There’s an application framework that has been developed called Zoe that will allow you to develop applications for z/OS. It’s interesting that the focus of the Open Mainframe Project when it first began was Linux on the mainframe, but actually the first real project that came out of it was a z/OS-based product, Zoe, and so we’re interested in that, too. Those are just a couple of peripheral projects that the COBOL working group is going to work with. + +There are other things we want to do from a curriculum standpoint down the road, but fundamentally, we just want to be a fact-finding, fact-gathering operation first, and Derek Lisinski has been taking leadership and putting together a substantial reference list so that we can get the facts about COBOL. Then, we’re going to do other things, but that we want to get that right first. + +Swapnil Bhartiya: So there are as you mentioned a couple of projects. Is there any overlap between these projects or how different they are? Do they all serve a different purpose? It looks like when you’re explaining the goal and role of the working group, it sounds like it’s also the training or education group with the same kind of activities. Let me rephrase it properly: what are some of the pressing needs you see for the COBOL community, how are these efforts/groups are trying to help them, and how are they not overlapping or stepping on each other’s toes? + +Cameron Seay: That’s an ongoing thing. Susharshna and I really work hard to make sure that we’re not working at either across purposes or there’s duplication of effort. We’re kind of clear about our roles. For the world at large, for the public at large, the working group—and Derek may have a different view on this because we all don’t think alike, we all don’t see this thing exactly the same—but I see it as information first. We want people to get accurate current information about COBOL. + +Then, we want to provide some vehicle that COBOL can be reintroduced back into the general academic curriculum because it used to be. I studied COBOL at a four-year university. Most people did when they took programming in the ’80s and the ’90s, they took COBOL, but that’s not true anymore. Our COBOL course at East Carolina this semester is the only COBOL course in the entire USC system. That’s got to change. So information, exposure, accurate information exposure, and some kind of return to the general curriculum, those are the three things that we we can provide to the community at large. + +Swapnil Bhartiya: If you look at Micro Focus, you are working in the industry, you are actually solving the problem for your customers. What role do these groups or other efforts that are going on there play for the whole ecosystem? + +Derek Lisinski: Well, I think if we go back to Cam’s answer, I think he’s absolutely right that the industry, if you project forward another generation in 25 years’ time who are going to be managing these core business systems that currently still need to run the world’s largest organizations. I know we’re in a digital era and I know that things are changing at an unprecedented pace, but most of the world’s largest organizations, successful organizations still want to be in those positions in generations to come. So who is it? Who are those practitioners that are coming through the education system right now, who are going to be leaders in those organizations’ IT departments in the future? + +And there is a concern not just for COBOL, but actually, many IT skills across the board. Is there going to be enough talent to actually run the organizations of the future? And that’s true, it’s a true question mark about COBOL. So Micro Focus, which has its own academic initiative and its own training program as does IBM as do many of the other vendors, we all applaud the work of all community groups. The OMP is obviously a fabulous example because it is genuinely an open group. Genuinely, it’s a meritocracy of people with good ideas coming together to try to do the right thing. We applaud the efforts to ensure that there continues to be enough supply of talented IT professionals in the future to meet the growing and growing demand. IT is not going away. It’s going to become strategically more and more important to these organizations. + +Our part to play in Micro Focus is really to work shoulder-to-shoulder with organizations like the OMP because between us, we will create enough groundswell of training and opportunity for that next generation. Many people will tell you there just isn’t enough of that training going on and there aren’t enough of those opportunities available, even though one survey that Micro Focus ran last year on the back of the COBOL’s 60th anniversary suggests that around 92% of all application owners of COBOL systems confirmed that those applications remain strategic to their organization. So, if the applications are not going anywhere, who’s going to be looking after them in the next generation? And that’s the real challenge that I think the industry faces as a whole, which is why Micro Focus is so committed to get behind the wheel of making sure that we can make a difference. + +Swapnil Bhartiya: We discussed that the interest in COBOL is increasing as COBOL is playing a very critical role in the modern economy. What kind of future do you see for COBOL and where do you see it going? I mean, it’s been around for 60 years, so it knows how to survive through times. Still, where do you see it go? Cam, I would love to start with you. + +Cameron Seay: Yeah, absolutely. We are trying to estimate how much COBOL is actually in use. That estimate is running into hundreds of billions of lines of code. I know that, for example, Bank of America admits to at least 50 million lines of COBOL code. That’s a lot of COBOL, and you’re not going to replace it over time, there’s no reason to. So the solution to this problem, and this is what we’re going to do, is we’re going to figure out a way to teach people COBOL. It’s not a complex language to learn. Any organization that sees lack of COBOL skills as an impediment and justification to move to another platform is [employing] a ridiculous solution, that solution is not feasible. If they try to do that, they’re going to fail because there’s too much risk and, most of all, too much expense. + +So, we’re going to figure out a way to begin to teach people COBOL again. I do it, a COBOL class at East Carolina. That is a solution to this problem because the code’s not going anywhere nor is there a reason for it to go anywhere, it works! It’s a simple language, it’s as fast as it needs to be, it’s as secure as it needs to be, and no one that I’ve talked to, computer scientists all over the world, no one can give me any application, that any language is going to work better than COBOL. There may be some that work as good or nearly as good, but you’re going to have to migrate them, but there’s nothing, there’s no improvement that you can make on these applications from a performance standpoint and from a security standpoint. The applications are going to stay where they are, and we’re just going to have to teach people COBOL. That’s the solution, that’s what’s going to happen. How and when, I don’t know, but that’s what’s going to happen. + +Swapnil Bhartiya: If you look at the crisis that we were going through, almost everything, every business is moving online to the cloud. All those transactions that people are already doing in person are all moving online, so it has become critical. From your perspective, what kind of future do you see? + +Derek Lisinski: Well, that’s a great question because the world is a very, very different place to how architecture was designed however long ago. Companies of today are not using that architecture. So there is some question mark there about what’s COBOL’s future. I agree with Cam. Anyone that has COBOL is not necessarily going to be able to throw that away anytime soon because, frankly, it might be difficult. It might be easy, but that’s not really the question, is it? Is it a good business decision? The answer is it’s a terrible business decision to throw it away. + +In addition to that, I would contend that there are a number of modern-day digital use cases where actually the usage of COBOL is going to increase rather than decrease. We see this all the time with our larger organizations who are using it for pretty much the whole of the backend of their core business. So, whether it’s a banking organization or an insurer or a logistics company, what they’re trying to do obviously is find new and exciting business opportunities. + +But, upon which they will be basing their core business systems that already run most of the business today, and then trying to use that to adapt, to enhance, to innovate. There are insurers who are selling the insurance quotation system to other smaller insurances as a service. Now, of course, their insurance quotation system is probably the version that isn’t quite as quick as the one that runs on their mainframe, but they’re making that available as a service to other organizations. Banking organizations are doing much the same thing with a range of banking services, maybe payment systems. These are all services that can be provided to other organizations. + +The same is true in the ISB market where really, really robust COBOL-based financial services, packages, ERP systems, which are COBOL based, and they have been made available as cloud-based as-a-service packages or upon other platforms to meet new market needs. The thing about COBOL that few people understand is not only is it easy to learn, but it’s easy to move to somewhere else. So, if your client is now running Linux and it says, “Well, now I want it to run these core COBOL business systems there, too.” Well, maybe they’ve taken a move to AIX to a Power system, but the same COBOL system can be reused, replicated as necessary, which is a little known secret about the language. + +This goes back to the original design, of course. Back in the day, there was no such thing as the “standard platform” in 1960. There wasn’t a single platform that you could reasonably rely on that would give you a decent answer, not very quickly anyway. So, in order for us to know that COBOL works, we have to have the same results compiled about running on different machines. It needs to be the same result running at the same speed, and from that point, that’s when the portability of the system came to life. That’s what they set out to do, built that way by design. + +Swapnil Bhartiya: Cam, Derek, thank you so much for taking the time out today to talk about COBOL, how important it is in today’s world. I’m pretty sure that when we spend our whole day, some of the activities that we have done online touch COBOL or are powered by COBOL. +-------------------------------------------------------------------------------- + +via: https://www.linux.com/news/bringing-cobol-to-the-modern-world/ + +作者:[Swapnil Bhartiya][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://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 From 9d368d47191f15fc28160511f1a88bf276657b79 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 2 Oct 2020 05:02:03 +0800 Subject: [PATCH 0294/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201002?= =?UTF-8?q?=20How=20to=20Free=20Up=20Space=20in=20/boot=20Partition=20on?= =?UTF-8?q?=20Ubuntu=20Linux=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md --- ...pace in -boot Partition on Ubuntu Linux.md | 173 ++++++++++++++++++ 1 file changed, 173 insertions(+) create mode 100644 sources/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md diff --git a/sources/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md b/sources/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md new file mode 100644 index 0000000000..6b0c1b7810 --- /dev/null +++ b/sources/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md @@ -0,0 +1,173 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Free Up Space in /boot Partition on Ubuntu Linux?) +[#]: via: (https://itsfoss.com/free-boot-partition-ubuntu/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +How to Free Up Space in /boot Partition on Ubuntu Linux? +====== + +The other day, I got a warning that boot partition is almost full or has no space left. Yes, I have a separate boot partition, not many people do that these days, I believe. + +This was the first time I saw such an error and it left me confused. Now, there are several [ways to free up space on Ubuntu][1] (or Ubuntu-based distros) but not all of them are useful in this case. + +This is why I decided to write about the steps I followed to free some space in the /boot partition. + +### Free up space in /boot partition on Ubuntu (if your boot partition is running out of space) + +![][2] + +I’d advise you to carefully read through the solutions and follow the one best suited for your situation. It’s easy but you need to be cautious about performing some of these on your production systems. + +#### Method 1: Using apt autoremove + +You don’t have to be a terminal expert to do this, it’s just one command and you will be removing unused kernels to free up space in the /boot partition. + +All you have to do is, type in: + +``` +sudo apt autoremove +``` + +This will not just remove unused kernels but also get rid of the dependencies that you don’t need or isn’t needed by any of the tools installed. + +Once you enter the command, it will list the things that will be removed and you just have to confirm the action. If you’re curious, you can go through it carefully and see what it actually removes. + +Here’s how it will look like: + +![][3] + +You have to press **Y** to proceed. + +_**It’s worth noting that this method will only work if you’ve a tiny bit of space left and you get the warning. But, if your /boot partition is full, APT may not even work.**_ + +In the next method, I’ll highlight two different ways by which you can remove old kernels to free up space using a GUI and also the terminal. + +#### Method 2: Remove Unused Kernel Manually (if apt autoremove didn’t work) + +Before you try to [remove any older kernels][4] to free up space, you need to identify the current active kernel and make sure that you don’t delete that. + +To [check your kernel version][5], type in the following command in the terminal: + +``` +uname -r +``` + +The [uname command is generally used to get Linux system information][6]. Here, this command displays the current Linux kernel being used. It should look like this: + +![][7] + +Now, that you know what your current Linux Kernel is, you just have to remove the ones that do not match this version. You should note it down somewhere so that you ensure you do not remove it accidentally. + +Next, to remove it, you can either utilize the terminal or the GUI. + +Warning! + +Be extra careful while deleting kernels. Identify and delete old kernels only, not the current one you are using otherwise you’ll have a broken system. + +##### Using a GUI tool to remove old Linux kernels + +You can use the [Synaptic Package Manager][8] or a tool like [Stacer][9] to get started. Personally, when I encountered a full /boot partition with apt broken, I used [Stacer][6] to get rid of older kernels. So, let me show you how that looks. + +First, you need to launch “**Stacer**” and then navigate your way to the package uninstaller as shown in the screenshot below. + +![][10] + +Here, search for “**image**” and you will find the images for the Linux Kernels you have. You just have to delete the old kernel versions and not your current kernel image. + +I’ve pointed out my current kernel and old kernels in my case in the screenshot above, so you have to be careful with your kernel version on your system. + +You don’t have to delete anything else, just the ones that are the older kernel versions. + +Similarly, just search for “**headers**” in the list of packages and delete the old ones as shown below. + +![][11] + +Just to warn you, you **don’t want to remove “linux-headers-generic”**. Only focus on the ones that have version numbers with them. + +And, that’s it, you’ll be done and apt will be working again and you have successfully freed up some space from your /boot partition. Similarly, you can do this using any other package manager you’re comfortable with. + +#### Using the command-line to remove old kernels + +It’s the same thing but just using the terminal. So, if you don’t have the option to use a GUI (if it’s a remote machine/server) or if you’re just comfortable with the terminal, you can follow the steps below. + +First, list all your kernels installed using the command below: + +``` +ls -l /boot +``` + +It should look something like this: + +![][12] + +The ones that are mentioned as “**old**” or the ones that do not match your current kernel version are the unused kernels that you can delete. + +Now, you can use the **rm** command to remove the specific kernels from the boot partition using the command below (a single command for each): + +``` +sudo rm /boot/vmlinuz-5.4.0-7634-generic +``` + +Make sure to check the version for your system — it may be different for your system. + +If you have a lot of unused kernels, this will take time. So, you can also get rid of multiple kernels using the following command: + +``` +sudo rm /boot/*-5.4.0-{7634}-* +``` + +To clarify, you need to write the last part/code of the Kernel versions separated by commas to delete them all at once. + +Suppose, I have two old kernels 5.4.0-7634-generic and 5.4.0-7624, the command will be: + +``` +sudo rm /boot/*-5.4.0-{7634,7624}-* +``` + +If you don’t want to see the old kernel version in the grub boot menu, you can simply [update grub][13] using the following command: + +``` +sudo update-grub +``` + +That’s it. You’re done. You’ve freed up space and also potentially fixed the broken APT if it was an issue after your /boot partition filled up. + +In some cases, you may need to enter these commands to fix the broken apt (as I’ve noticed in the forums): + +``` +sudo dpkg --configure -a +sudo apt install -f +``` + +Do note that you don’t need to enter the above commands unless you find APT broken. Personally, I didn’t need these commands but I found them handy for some on the forums. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/free-boot-partition-ubuntu/ + +作者:[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/free-up-space-ubuntu-linux/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/free-boot-space-ubuntu-linux.jpg?resize=800%2C450&ssl=1 +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/apt-autoremove-screenshot.jpg?resize=800%2C415&ssl=1 +[4]: https://itsfoss.com/remove-old-kernels-ubuntu/ +[5]: https://itsfoss.com/find-which-kernel-version-is-running-in-ubuntu/ +[6]: https://linuxhandbook.com/uname/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/uname-r-screenshot.jpg?resize=800%2C198&ssl=1 +[8]: https://itsfoss.com/synaptic-package-manager/ +[9]: https://itsfoss.com/optimize-ubuntu-stacer/ +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/stacer-remove-kernel.jpg?resize=800%2C562&ssl=1 +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/stacer-remove-kernel-header.png?resize=800%2C576&ssl=1 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/command-kernel-list.png?resize=800%2C432&ssl=1 +[13]: https://itsfoss.com/update-grub/ From fbf876083e864627d9d425c2714e7649d615b808 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 2 Oct 2020 05:02:19 +0800 Subject: [PATCH 0295/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201001?= =?UTF-8?q?=20Level=20up=20your=20shell=20history=20with=20Loki=20and=20fz?= =?UTF-8?q?f?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201001 Level up your shell history with Loki and fzf.md --- ...up your shell history with Loki and fzf.md | 368 ++++++++++++++++++ 1 file changed, 368 insertions(+) create mode 100644 sources/tech/20201001 Level up your shell history with Loki and fzf.md diff --git a/sources/tech/20201001 Level up your shell history with Loki and fzf.md b/sources/tech/20201001 Level up your shell history with Loki and fzf.md new file mode 100644 index 0000000000..cfa39eaf2f --- /dev/null +++ b/sources/tech/20201001 Level up your shell history with Loki and fzf.md @@ -0,0 +1,368 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Level up your shell history with Loki and fzf) +[#]: via: (https://opensource.com/article/20/10/shell-history-loki-fzf) +[#]: author: (Ed Welch https://opensource.com/users/ewelch) + +Level up your shell history with Loki and fzf +====== +Loki expands the model Prometheus uses for metrics for monitoring and +log aggregation. +![Gears above purple clouds][1] + +[Loki][2] is an Apache 2.0-licensed open source log-aggregation framework designed by Grafana Labs and built with tremendous support from a growing community. It is also the project I work on every day. In this article, rather than just talking about how Loki works, I will provide a hands-on introduction to solving real problems with it. + +### The problem: a durable centralized shell history + +I love my shell history and have always been a fanatical CTRL+R user. About a year ago, my terminal life changed forever when my peer Dieter Plaetinck introduced me to the command-line fuzzy finder **[fzf][3]**. + +Suddenly, searching through commands went from this: + +![Before Loki and fzf][4] + +(Ed Welch, [CC BY-SA 4.0][5]) + +To this: + +![After Loki and fzf][6] + +(Ed Welch, [CC BY-SA 4.0][5]) + +While fzf significantly improved my quality of life, there were still some pieces missing around my shell history: + + * Losing shell history when terminals close abruptly, computers crash, computers die, whole disk encryption keys are forgotten + * Having access to my shell history _from_ all my computers _on_ all my computers + + + +I think of my shell history as documentation: it's an important story I don't want to lose. Combining Loki with my shell history helps solve these problems and more. + +### About Loki + +Loki takes the intuitive label model that the open source [Prometheus][7] project uses for metrics and expands it into the world of log aggregation. This enables developers and operators to seamlessly pivot between their metrics and logs using the same set of labels. Even if you're not using Prometheus, there are still plenty of reasons Loki might be a good fit for your log-storage needs: + + * **Low overhead:** Loki does not do full-text log indexing; it only creates an index of the labels you put on your logs. Keeping a small index substantially reduces Loki's operating requirements. I'm running my loki-shell project, which uses Loki to store shell history, on a [Raspberry Pi][8] using just a little over 50MB of memory. + * **Low cost:** The log content is compressed and stored in object stores like Amazon S3, Google Cloud Storage, Azure Blob, or even directly on a filesystem. The goal is to use storage that is inexpensive and durable. + * **Flexibility:** Loki is available in a single binary that can be downloaded and run directly or as a Docker image to run in any container environment. A [Helm chart][9] is available to get started quickly in Kubernetes. If you demand a lot from your logging tools, take a look at the [production setup][10] running at Grafana Labs. It uses open source [Jsonnet][11] and [Tanka][12] to deploy the same Loki image as discrete building blocks to enable massive horizontal scaling, high availability, replication, separate scaling of read and write paths, highly parallelizable querying, and more. + + + +In summary, Loki's approach is to keep a small index of metadata about your logs (labels) and store the unindexed and compressed log content in inexpensive object stores to make operating easier and cheaper. The application is built to run as a single process and easily evolve into a highly available distributed system. You can obtain high query performance on larger logging workloads through parallelization and sharding of queries—a bit like MapReduce for your logs. + +In addition, this functionality is available for anyone to use for free. As with its [Grafana][13] open observability platform, Grafana Labs is committed to making Loki a fully featured, fully open log-aggregation software anyone can use. + +### Get started + +I'm running Loki on a Raspberry Pi on my home network and storing my shell history offsite in an S3 bucket. + +When I hit CTRL+R, Loki's [LogCLI][14] command-line interface makes several batching requests that are streamed into fzf. Here is an example—the top part shows the Loki server logs on the Pi. + +![Logs of the Loki server on Raspberry Pi][15] + +(Ed Welch, [CC BY-SA 4.0][5]) + +Ready to give it a try? The following guide will help you set up and run Loki to be integrated with your shell history. Since this tutorial aims to keep things simple, this setup will run Loki locally on your computer and store all the files on the filesystem. + +You can find all of this, plus information about how to set up a more elaborate installation, in the [loki-shell GitHub repository][16]. + +Note that this tutorial will not change any existing behaviors around your history, so _your existing shell history command and history settings will be untouched._ Instead, this duplicates the command history to Loki with `$PROMPT_COMMAND` in Bash and `precmd` in Zsh. On the CTRL+R side of things, it overloads the function that fzf uses to access the CTRL+R command. Trying this is safe, and if you decide you don't like it, just follow the [uninstall steps][17] in the GitHub repo to remove all traces. Your shell history will be untouched. + +#### Step 1: Install fzf + +There are several ways to install fzf, but I prefer [the Git method][18]: + + +``` +git clone --depth 1 ~/.fzf +~/.fzf/install +``` + +Say yes to all the question prompts. + +If you already have fzf installed, make sure you have the key bindings enabled (i.e., make sure when you type CTRL+R, fzf pops up). You can rerun the fzf installation to enable key bindings if necessary. + +#### Step 2: Install loki-shell + +Like fzf, loki-shell also has a Git repo and install script: + + +``` +git clone --depth 1 ~/.loki-shell +~/.loki-shell/install +``` + +First, the script creates the `~/.loki-shell` directory where all files will be kept (including Loki data). Next, it will download binaries for [Promtail][19], LogCLI, and Loki. + +Then it will ask: + +``` +Do you want to install Loki? ([y]/n) +``` + + + If you already have a centralized Loki running for loki-shell, you could answer n; however, for this tutorial, answer y or press Enter. + + + There are two options available for running Loki locally: as a Docker image or as a single binary (with support for adding a systemd service). I recommend using Docker if it's available, as I think it simplifies operations a bit, but both work just fine. + +``` +#### Running with Docker +``` + + + To run Loki as a Docker image: + + [code] + +``` +[y] to run Loki in Docker, [n] to run Loki as a binary ([y]/n) y +Error: No such object: loki-shell +Error response from daemon: No such container: loki-shell +Error: No such container: loki-shell +54843ff3392f198f5cac51a6a5071036f67842bbc23452de8c3efa392c0c2e1e +``` + + +``` +If this is the first time you're running the installation, you can disregard the error messages. This script will stop and replace a running Loki container if the version does not match, which allows you to rerun this script to upgrade Loki. + + +That's it! Loki is now running as a Docker container. + + +Data from Loki will be stored in ~/.loki-shell/data. + + +The image runs with --restart=unless-stopped, so it will restart at reboot but will stay stopped if you run docker stop loki-shell. + + +(If you're using Docker, you can skip down to Shell integration.) +``` + +##### Running as binary + +``` +There are many ways to run a binary on a Linux system. This script can install a systemd service. If you don't have systemd, you can still use the binary install: + +[code] +``` + +[y] to run Loki in Docker, [n] to run Loki as a binary ([y]/n) n + +Run Loki with systemd? ([y]/n) n + +This is as far as this script can take you +You will need to setup an auto-start for Loki +It can be run with this command: /home/username/.loki-shell/bin/loki -config.file=/home/username/.loki-shell/config/loki-binary-config.yaml + +``` + +``` + + + The script will spit out the command you need to use to run Loki, and you will be on your own to set up an init script or another method of auto-starting it. + + + You can run the command directly, if you want, and run Loki from your current shell. + + + If you do have systemd, you have the option of letting the script install the systemd service or showing you the commands to run it yourself: + + [code] + +``` +Run Loki with systemd? ([y]/n) y + +Installing the systemd service requires root permissions. +[y] to run these commands with sudo [n] to print out the commands and you can run them yourself. ([y]/n) n +sudo cp /home/ed/.loki-shell/config/loki-shell.service /etc/systemd/system/loki-shell.service +sudo systemctl daemon-reload +sudo systemctl enable loki-shell +sudo systemctl start loki-shell +Copy these commands and run them when the script finishes. (press enter to continue) +``` + + +``` + +``` + +##### Shell integration + +``` +Regardless of how you installed Loki, you should now see a prompt: + +[code]Enter the URL for your Loki server or press enter for default (http://localhost:4100) +``` + + + If you had set up a centralized Loki, you would enter that URL here. However, this demo just uses the default, so you can press Enter. + + + A lot of text will spit out explaining all the entries added to your ~.bashrc or ~.zshrc (or both). + + + That's it! + + [code] + +``` +Finished. Restart your shell or reload config file. +   source ~/.bashrc  # bash +   source ~/.zshrc   # zsh +``` + + +``` + +``` + +#### Step 3: Try it out! + +``` +Start using your shell, and use CTRL+R to see your commands. + + +Open multiple terminal windows, type a command in one and CTRL+R in another, and you'll see your commands available immediately. + + +Also, notice that when you switch between terminals and enter commands, they are available immediately with CTRL+R, but the Up arrow's operation is not affected between terminals. (This may not be true if you have Oh My Zsh installed, as it automatically appends all commands to the history.) + + +Use CTRL+R multiple times to toggle between sorting by time and by relevance. + + +Note that this configuration will show only the current hosts' query history, even if you are sending shell data from multiple hosts to Loki. I think by default this makes the most sense. There is a lot you can tweak if you want this behavior to change; see the loki-shell repo to learn more. + + +It also installed an alias called hist: + +[code]alias hist="$HOME/.loki-shell/bin/logcli --addr=$LOKI_URL" +``` + + + LogCLI can be used to query and search your history directly in Loki, including allowing you to search other hosts. Check out the getting started guide for LogCLI to learn more about querying. + + + Loki's log query language (LogQL) provides metric queries that allow you to do some interesting things; for example, I can see how many times I issued the kc command (my alias for kubectl) in the last 30 days: + + +``` +![Counting use of a command][20] + +(Ed Welch, [CC BY-SA 4.0][5]) +``` + +``` +## Extra credit +``` + + + Install Grafana and play around with your shell history: + + [code]docker run -d -p 3000:3000 --name=grafana grafana/grafana +``` +Open a web browser at http://localhost:3000 and log in using the default admin/admin username and password. + + +On the left, navigate to Configuration -> Datasources, click the Add Datasource button, and select Loki. + + +For the URL, you should be able to use http://localhost:4100 (however, on my WSL2 machine, I had to use the computer's actual IP address). + + +Click Save and Test. You should see Data source connected and labels found. + + +Click on the Explore icon on the left, make sure the Loki data source is selected, and try out a query: + +[code]{job="shell"} +``` + + + If you have more hosts sending shell commands, you can limit the results to a certain host using the hostname label: + + [code]{job="shell", hostname="myhost"}. +``` +You can also look for specific commands with filter expressions: + +[code]{job="shell"} |= "docker" +``` + + + Or you can start exploring the world of metrics from logs to see how often you are using your shell: + + [code]rate({job="shell"}[1m]) +``` + +``` + +![Counting use of the shell over previous 20 days][21] + +(Ed Welch, [CC BY-SA 4.0][5]) + +``` +Want to reconstruct a timeline from an incident? You can filter by a specific command and see when it ran. +``` + +![Counting use of a command][22] + +(Ed Welch, [CC BY-SA 4.0][5]) + +``` +To see what else you can do and learn more about Loki's query language, check out the LogQL guide. +``` + +### Final thoughts + +``` +For more ideas, troubleshooting, and updates, follow the GitHub repo. This is still a work in progress, so please report any issues there. + + +To learn more about Loki, check out the documentation, blog posts, and GitHub repo, or try it in Grafana Cloud. +``` + +* * * + +``` +A special thanks to my colleague Jack Baldry for planting the seed for this idea. I had the Loki knowledge to make this happen, but if it weren't for his suggestion, I don't think I ever would have made it here. +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/shell-history-loki-fzf + +作者:[Ed Welch][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://opensource.com/users/ewelch +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/chaos_engineer_monster_scary_devops_gear_kubernetes.png?itok=GPYLvfVh (Gears above purple clouds) +[2]: https://github.com/grafana/loki +[3]: https://github.com/junegunn/fzf +[4]: https://opensource.com/sites/default/files/uploads/before.gif (Before Loki and fzf) +[5]: https://creativecommons.org/licenses/by-sa/4.0/ +[6]: https://opensource.com/sites/default/files/uploads/with_fzf.gif (After Loki and fzf) +[7]: https://prometheus.io/ +[8]: https://www.raspberrypi.org/ +[9]: https://helm.sh/docs/topics/charts/ +[10]: https://grafana.com/docs/loki/latest/installation/tanka/ +[11]: https://jsonnet.org +[12]: https://tanka.dev/ +[13]: https://grafana.com/ +[14]: https://grafana.com/docs/loki/latest/getting-started/logcli/ +[15]: https://opensource.com/sites/default/files/uploads/example_logcli.gif (Logs of the Loki server on Raspberry Pi) +[16]: https://github.com/slim-bean/loki-shell +[17]: https://github.com/slim-bean/loki-shell/blob/master/uninstall +[18]: https://github.com/junegunn/fzf#using-git +[19]: https://grafana.com/docs/loki/latest/clients/promtail/ +[20]: https://opensource.com/sites/default/files/uploads/count_kc.png (Counting use of a command) +[21]: https://opensource.com/sites/default/files/uploads/last_20.png (Counting use of the shell over previous 20 days) +[22]: https://opensource.com/sites/default/files/uploads/command_hist.png (Counting use of a command) From d482d73f4a8535d772df18c56110bffe487cc572 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 2 Oct 2020 05:02:32 +0800 Subject: [PATCH 0296/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201001?= =?UTF-8?q?=20How=20open=20source=20underpins=20blockchain=20technology?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201001 How open source underpins blockchain technology.md --- ... source underpins blockchain technology.md | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 sources/tech/20201001 How open source underpins blockchain technology.md diff --git a/sources/tech/20201001 How open source underpins blockchain technology.md b/sources/tech/20201001 How open source underpins blockchain technology.md new file mode 100644 index 0000000000..976fbf4411 --- /dev/null +++ b/sources/tech/20201001 How open source underpins blockchain technology.md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How open source underpins blockchain technology) +[#]: via: (https://opensource.com/article/20/10/open-source-blockchain) +[#]: author: (Matt Shealy https://opensource.com/users/mshealy) + +How open source underpins blockchain technology +====== +Openness, not regulation, is what creates blockchain's security and +reliability. +![cubes coming together to create a larger cube][1] + +People are often surprised when they find out that blockchain technology, which is known for its security, is built on open source software code. In fact, this openness is what creates its security and reliability. + +One of the core values of building anything as open source is gaining efficiency. Creating a community of developers with different perspectives and skillsets, all working on the same code base, can exponentially increase the number and complexity of applications built. + +### Open source: more common than people think + +One of the more popular operating systems, Linux, is open source. Linux powers the servers for many of the services we feel comfortable sharing personal information on every day. This includes Google, Facebook, and thousands of major websites. When you're interacting with these services, you're doing so on computer networks that are running Linux. Chromebooks are using Linux. Android phones use an operating system based on Linux. + +Linux is not owned by a corporation. It's free to use and created by collaborative efforts. More than 20,000 developers from more than 1,700 companies [have contributed to the code][2] since its origins in 2005.  + +That's how open source software works. Tons of people contribute and constantly add, modify, or build off the open source codebase to create new apps and platforms. Much of the software code for blockchain and cryptocurrency has been developed using open source software. Open source software is built by passionate users that are constantly on guard for bugs, glitches, or flaws. When a problem is discovered, a community of developers works separately and together on the fix. + +### Blockchain and open source + +An entire community of open source blockchain developers is constantly adding to and refining the codebase. + +Here are the fundamental ways blockchain performs: + + * Blockchain platforms have a transactional database that allows peers to transact with each other at any time. + * User-identification labels are attached that facilitate the transactions. + * The platforms must have a secure way to verify transactions before they become approved. + * Transactions that cannot be verified will not take place. + + + +Open source software allows developers to create these platforms in a [decentralized application (Dapp)][3], which is key to the safety, security, and variability of transactions in the blockchain. + +This decentralized approach means there is no central authority to mediate transactions. That means no one person controls what happens. Direct peer-to-peer interactions can happen quickly and securely. As transactions are recorded in the ledger, they are distributed across the ecosystem. + +Blockchain uses cryptography to keep things secure. Each transaction carries information connecting it with previous transactions to verify its authenticity. This prevents threat actors from tampering with the data because once it's added to the public ledger, it can't be changed by other users. + +### Is blockchain open source? + +Although blockchain itself may not technically be open source, blockchain _systems_ are typically implemented with open source software using a concept that embodies an open culture because no government authority regulates it. Proprietary software developed by a private company to handle financial transactions is likely regulated by [government agencies][4]. In the US, that might include the Securities and Exchange Commission (SEC), the Federal Reserve Board, and the Federal Deposit Insurance Corporation (FDIC). Blockchain technology doesn't require government oversight when it's used in an open environment. In effect, the community of users is what verifies transactions. + +You might call it an extreme form of crowdsourcing, both for developing the open source software that's used to build the blockchain platforms and for verifying transactions. That's one of the reasons blockchain has gotten so much attention: It has the potential to disrupt entire industries because it acts as an authoritative intermediary to handle and verify transactions. + +### Bitcoin, Ethereum, and other cryptocurrencies + +As of June 2020, more than [50 million people have blockchain wallets][5]. Most are used for financial transactions, such as trading Bitcoin, Ethereum, and other cryptocurrencies. It's become mainstream for many to [check cryptocurrency prices][6] the same way traders watch stock prices. + +Cryptocurrency platforms also use open source software. The [Ethereum project][7] developed free and open source software that anyone can use, and a large community of developers contributes to the code. The Bitcoin reference client was developed by more than 450 developers and engineers that have made more than 150,000 contributions to the code-writing effort. + +A cryptocurrency blockchain is a continuously growing record. Each record is linked together in a sequence, and the records are called blocks. When linked together, they form a chain. Each block has its own [unique marker called a hash][8]. A block contains its hash and a cryptographic hash from a previous block. In essence, each block is linked to the previous block, forming long chains that are impossible to break, with each containing information about other blocks that are used to verify transactions. + +There's no central bank in financial or cryptocurrency blockchains. The blocks are distributed throughout the internet, creating a robust audit trail that can be tracked. Anyone with access to the chain can verify a transaction but cannot change the records. + +### An unbreakable chain + +While blockchains are not regulated by any government or agency, the distributed network keeps them secure. As chains grow, each transaction makes it more difficult to fake. Blocks are distributed all over the world in networks using trust markers that can't be changed. The chain becomes virtually unbreakable. + +The code behind this decentralized network is open source and is one of the reasons users trust each other in transactions rather than having to use an intermediary such as a bank or broker. The software underpinning cryptocurrency platforms is open to anyone and free to use, created by consortiums of developers that are independent of each other. This has created one of the world's largest check-and-balance systems. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/open-source-blockchain + +作者:[Matt Shealy][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://opensource.com/users/mshealy +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cube_innovation_process_block_container.png?itok=vkPYmSRQ (cubes coming together to create a larger cube) +[2]: https://www.linuxfoundation.org/wp-content/uploads/2020/08/2020_kernel_history_report_082720.pdf +[3]: https://www.freecodecamp.org/news/what-is-a-dapp-a-guide-to-ethereum-dapps/ +[4]: https://www.investopedia.com/ask/answers/063015/what-are-some-major-regulatory-agencies-responsible-overseeing-financial-institutions-us.asp +[5]: https://www.statista.com/statistics/647374/worldwide-blockchain-wallet-users/ +[6]: https://www.okex.com/markets +[7]: https://ethereum.org/en/ +[8]: https://opensource.com/article/18/7/bitcoin-blockchain-and-open-source From c58814ddb6459fd2fd5b2b480cb54cd23d00c1fa Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 2 Oct 2020 05:02:49 +0800 Subject: [PATCH 0297/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[talk]:=2020201002?= =?UTF-8?q?=20VMware=20highlights=20security=20in=20COVID-era=20networking?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20201002 VMware highlights security in COVID-era networking.md --- ...lights security in COVID-era networking.md | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 sources/talk/20201002 VMware highlights security in COVID-era networking.md diff --git a/sources/talk/20201002 VMware highlights security in COVID-era networking.md b/sources/talk/20201002 VMware highlights security in COVID-era networking.md new file mode 100644 index 0000000000..9cc050ddf6 --- /dev/null +++ b/sources/talk/20201002 VMware highlights security in COVID-era networking.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (VMware highlights security in COVID-era networking) +[#]: via: (https://www.networkworld.com/article/3584412/vmware-highlights-security-in-covid-era-networking.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +VMware highlights security in COVID-era networking +====== +VMware is tackling the challenges of securing distributed enterprise resources with product enhancements including the new Carbon Black Cloud Workload software and upgrades to its SD-WAN and SASE products. +ArtyStarty / Getty Images + +As enterprise workloads continue to move off-premises and employees continue to work remotely during the COVID-19 pandemic, securing that environment remains a critical challenge for IT. + +At its virtual VWworld 2020 gathering, VMware detailed products and plans to help customers deal with the challenges of securing distributed enterprise resources. + +**More about SD-WAN**: [How to buy SD-WAN technology: Key questions to consider when selecting a supplier][1] • [What SD-Branch is and why you'll need it][2] • [What are the options for securing SD-WAN?][3] + +"Amid global disruption, the key to survival for many companies has meant an accelerated shift to the cloud and, ultimately, bolting on security products in their data centers," said Sanjay Poonen, VMware's Chief Operating Officer, Customer Operations. "But legacy security systems are no longer sufficient for organizations that are using the cloud as part of their computing infrastructure. It's time to rethink security for the cloud. Organizations need protection at the workload level, not just at the endpoint." + +With that in mind, VMware introduced Carbon Black Cloud Workload software that combines vulnerability reporting with security detection and response capabilities to protect workloads running in virtualized, private and hybrid cloud environments, VMware stated.    + +The new packages – along with [other upgrades to its security software][4] – represent VMware's continued development and integration of the Carbon Black security technology it [acquired a year ago][5] for $2.1 billion.  + +"Tightly integrated with vSphere, VMware Carbon Black Cloud Workload provides agentless security that alleviates installation and management overhead and consolidates the collection of [telemetry][6] for multiple workload security use cases," VMware stated.  + +The idea is to allow security and infrastructure teams to automatically secure new and existing workloads at every point in the security lifecycle, while simplifying operations and consolidating the IT and security stack. With the software, customers can analyze attacker behavior patterns over time to detect and stop never-seen-before attacks, including those manipulating known-good software. If an attacker bypasses perimeter defenses, security teams can shut down the attack before it escalates to a data breach, VMware stated.  + +All current vSphere 6.5 and VMware Cloud Foundation 4.0 customers can give the package a try for free for the next six months, VMware stated. VMware plans to introduce a Carbon Black Cloud module for hardening and better securing Kubernetes workloads as well. + +The company also enhanced its Workspace ONE platform that securely manages end users' mobile devices and cloud-hosted virtual desktops and applications from the cloud or on-premise. + +The company says it blended VMware Workspace ONE Horizon and VMware Carbon Black Cloud to offer behavioral detection to protect against ransomware and file-less malware. On VMware vSphere, the solution is integrated into VMware Tools, removing the need to install and manage additional security agents, according to the company.  + +Bolstering support for Apple Mac and Microsoft Windows 10 remote users, VMware added Workspace Security Remote, which includes the antivirus, audit and remediation, and detection and response capabilities of Carbon Black Cloud. It also includes the analytics, automation, device health, orchestration, and zero-trust access capabilities of the Workspace ONE platform. + +Securing the remote work environment is a common theme among other VMWare announcements, including news around its [SD-WAN and secure access service edge (SASE)][7] products and its overarching Virtual Cloud Network architecture. + +Taken together, the enhancements further VMware's goal of integrating security features within its infrastructure – a concept it calls intrinsic security – in an effort to better protect networked workloads than traditional piecemeal protection systems could. + +The democratization of compute was already underway before the COVID situation pushed it further, faster, said Sanjay Uppal, senior vice president and general manager of the VeloCloud Business Unit at VMware. "So with the remote workforce growing we need to make privacy and security drop-dead simple, and that is the goal." + +A more futuristic goal for the company is to provide a unified approach to security incident detection and response that can leverage multiple domains – from endpoint to workload to user to network. An emerging architecture that promises those capabilities is Extended Detection and Response (XDR), and VMware says it intends to support it.  + +In a recent _[CSO][8]_ [column][8], Enterprise Strategy Group senior principal analyst Jon Oltsik defined XDR as "an integrated suite of security products spanning hybrid IT architectures, designed to interoperate and coordinate on threat prevention, detection and response. In other words, XDR unifies control points, security telemetry, analytics, and operations into one enterprise system." + +ESG research indicates that 84% of organizations are actively integrating security technologies so XDR can act as a turnkey security technology integration solution.  + +"While vendors will offer different XDR bundles, ESG research indicates that large organizations really want XDR to include endpoint/server/cloud workload security, network security, coverage of the most common threat vectors (i.e., email/web), file detonation (i.e., sandboxing), threat intelligence, and analytics," Oltsik stated. + +Gartner said of XDR: "Although XDR tools are similar in function to security incident and event monitoring (SIEM) and security orchestration, automation and response tools, they are primarily differentiated by the level of integration at deployment and the focus on incident response." + +The primary goals of an XDR solution are to increase detection accuracy by correlating threat intelligence and signals across multiple security solutions, and to improve security operations efficiency and productivity. + +For its part, VMware said XDR is the opportunity to do just that: provide a unified approach to security incident detection and response that can leverage multiple domains from endpoint to workload to user to network. + +VMware called XDR "a multi-year effort to build the most advanced and comprehensive security incident detection and response solutions available" and will include cross-platform integration across its portfolio including Workspace ONE, vSphere, Carbon Black Cloud, and NSX Service-defined Firewall. + +Join the Network World communities on [Facebook][9] and [LinkedIn][10] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3584412/vmware-highlights-security-in-covid-era-networking.html + +作者:[Michael Cooney][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://www.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3323407/sd-wan/how-to-buy-sd-wan-technology-key-questions-to-consider-when-selecting-a-supplier.html +[2]: https://www.networkworld.com/article/3250664/lan-wan/sd-branch-what-it-is-and-why-youll-need-it.html +[3]: https://www.networkworld.com/article/3285728/sd-wan/what-are-the-options-for-securing-sd-wan.html +[4]: https://www.networkworld.com/article/3529369/vmware-amps-up-its-cloud-and-data-center-security.html +[5]: https://www.networkworld.com/article/3445383/vmware-builds-security-unit-around-carbon-black-tech.html +[6]: https://www.networkworld.com/article/3575837/streaming-telemetry-gains-interest-as-snmp-reliance-fades.html +[7]: https://www.networkworld.com/article/3583939/vmware-amps-up-security-for-network-sase-sd-wan-products.html +[8]: https://www.csoonline.com/article/3561291/what-is-xdr-10-things-you-should-know-about-this-security-buzz-term.html +[9]: https://www.facebook.com/NetworkWorld/ +[10]: https://www.linkedin.com/company/network-world From 72eb9642a8528007ac56ff779473603ec94e6940 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 2 Oct 2020 05:03:15 +0800 Subject: [PATCH 0298/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201001?= =?UTF-8?q?=20Navigating=20your=20Linux=20files=20with=20ranger?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201001 Navigating your Linux files with ranger.md --- ...Navigating your Linux files with ranger.md | 126 ++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 sources/tech/20201001 Navigating your Linux files with ranger.md diff --git a/sources/tech/20201001 Navigating your Linux files with ranger.md b/sources/tech/20201001 Navigating your Linux files with ranger.md new file mode 100644 index 0000000000..c5d4f8007e --- /dev/null +++ b/sources/tech/20201001 Navigating your Linux files with ranger.md @@ -0,0 +1,126 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Navigating your Linux files with ranger) +[#]: via: (https://www.networkworld.com/article/3583890/navigating-your-linux-files-with-ranger.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Navigating your Linux files with ranger +====== +Ranger is a great tool for providing a multi-level view of your Linux files and allowing you to both browse and make changes using arrow keys and some handy commands. +[Heidi Sandstrom][1] [(CC0)][2] + +Ranger is a unique and very handy file system navigator that allows you to move around in your Linux file system, go in and out of subdirectories, view text-file contents and even make changes to files without leaving the tool. + +It runs in a terminal window and lets you navigate by pressing arrow keys. It provides a multi-level file display that makes it easy to see where you are, move around the file system and select particular files. + +To install ranger, use your standard install command (e.g., **sudo apt install ranger**). To start it, simply type “ranger”. It comes with a lengthy, very detailed man page, but getting started with ranger is very simple. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +### The ranger display + +One of the most important things you need to get used to right away is ranger’s way of displaying files. Once you start ranger, you will see four columns of data. The first column is one level up from wherever you started ranger. If you start from your home directory, for example, ranger will list all of the home directories in column 1. The second column will show the first screenful of directories and files in your home directory (or whatever directory you start it from). + +The key here is moving past any inclination you might have to see the details in each line of the display as related. All the entries in column 2 relate to a single entry in column 1 and content in column 4 relates to the selected file or directory in column 2. + +Unlike your normal command-line view, directories will be listed first (alphanumerically) and files will be listed second (also alphanumerically). Starting in your home directory, the display might look something like this: + +``` +shs@dragonfly /home/shs/backups <== current selection + bugfarm backups 0 empty + dory bin 59 + eel Buttons 15 + nemo Desktop 0 + shark Documents 0 + shs Downloads 1 + ^ ^ ^ ^ + | | | | + homes directories # files listing + in selected in each of files in + home directory selected directory +``` + +The top line in ranger's display tells you where  you are. In the abive example, the current directory is **/home/shs/backups**. We see the highlighted word "empty" because there are no files in this directory. If we press the down arrow key to select **bin** instead, we'll see a list of files: + +``` +shs@dragonfly /home/shs/bin <== current selection + bugfarm backups 0 append + dory bin 59 calcPower + eel Buttons 15 cap + nemo Desktop 0 extract + shark Documents 0 finddups + shs Downloads 1 fix + ^ ^ ^ ^ + | | | | + homes directories # files listing + in selected in each of files in + home directory selected directory +``` + +The highlighted entries in each column show the current selections. Use the right arrow to move into deeper directories or view file content. + +If you continue pressing the down arrow key to move to the file portion of the listing, you will note that the third column will show file sizes (instead of the numbers of files). The "current selection" line will also display the currently selected file name while the rightmost column displays the file content when possible. + +``` +shs@dragonfly /home/shs/busy_wait.c <== current selection + bugfarm BushyRidge.zip 170 K /* + dory busy_wait.c 338 B * program that does a busy wait + eel camper.jpg 5.55 M * it's used to show ASLR, and that's it + nemo check_lockscreen 80 B */ + shark chkrootkit-output 438 B #include + ^ ^ ^ ^ + | | | | + homes files sizes file content +``` + +The bottom line of the display will show some file and directory details: + +``` +-rw-rw-r—- shs shs 338B 2019-01-05 14:44 1.52G, 365G free 67/488 11% +``` + +If you select a directory and press enter, you will move into that directory. The leftmost column in your display will then be a listing of the contents of your home directory, and the second column will be a file listing of the directory contents. You can then examine the contents of subdirectories and the contents of files. + +Press the left arrow key to move back up a level. + +Quit ranger by pressing "q". + +### Making changes + +You can press **?** to bring up a help line at the bottom of your screen. It should look like this: + +``` +View [m]an page, [k]ey bindings, [c]commands or [s]ettings? (press q to abort) +``` + +Press **c** and ranger will provide information on commands that you can use within the tool. For example, you can change permissions on the current file by entering **:chmod** followed by the intended permissions. For example, once a file is selected, you can type **:chmod 700** to set permissions to **rwx------**. + +Typing **:edit** instead would open the file in **nano** and allow you to make changes and then save the file using **nano** commands. + +### Wrap-Up + +There are more ways to use **ranger** than are described in this post. The tool provides a very different way to list and interact with files on a Linux system and is easy to navigate once you get used to its multi-tiered way of listing directories and files and using arrow keys in place of **cd** commands to move around. + +Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3583890/navigating-your-linux-files-with-ranger.html + +作者:[Sandra Henry-Stocker][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://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://unsplash.com/photos/mHC0qJ7l-ls +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world From 7f0fa1a5f2cffa3e8bca5d8f037961ac98fb6e38 Mon Sep 17 00:00:00 2001 From: zouchong Date: Fri, 2 Oct 2020 10:06:13 +0800 Subject: [PATCH 0299/1156] hankchow translating --- sources/tech/20200629 Using Bash traps in your scripts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200629 Using Bash traps in your scripts.md b/sources/tech/20200629 Using Bash traps in your scripts.md index 5b068232d5..480fef9aa3 100644 --- a/sources/tech/20200629 Using Bash traps in your scripts.md +++ b/sources/tech/20200629 Using Bash traps in your scripts.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (HankChow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From dc3bd34ef21aab747e850ea5af5121c9e4240b2c Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Fri, 2 Oct 2020 10:59:18 +0800 Subject: [PATCH 0300/1156] =?UTF-8?q?=E7=94=B3=E9=A2=86=E5=8E=9F=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/tech/20200901 Create a mobile app with Flutter.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200901 Create a mobile app with Flutter.md b/sources/tech/20200901 Create a mobile app with Flutter.md index 6fa0f367bb..0e48ba94d2 100644 --- a/sources/tech/20200901 Create a mobile app with Flutter.md +++ b/sources/tech/20200901 Create a mobile app with Flutter.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (gxlct008) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From dabb4ddb0ec0b6606073e3f366ae9647853cbb10 Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Fri, 2 Oct 2020 14:24:00 +0800 Subject: [PATCH 0301/1156] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=AF=91=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...200901 Create a mobile app with Flutter.md | 155 ++++++++---------- 1 file changed, 70 insertions(+), 85 deletions(-) diff --git a/sources/tech/20200901 Create a mobile app with Flutter.md b/sources/tech/20200901 Create a mobile app with Flutter.md index 0e48ba94d2..170a85e2a3 100644 --- a/sources/tech/20200901 Create a mobile app with Flutter.md +++ b/sources/tech/20200901 Create a mobile app with Flutter.md @@ -7,40 +7,37 @@ [#]: via: (https://opensource.com/article/20/9/mobile-app-flutter) [#]: author: (Vitaly Kuprenko https://opensource.com/users/kooper) -Create a mobile app with Flutter +使用 Flutter 创建 App ====== -Start your journey toward cross-platform development with the popular -Flutter framework. + +使用流行的 Flutter 框架开始您的跨平台开发之旅。 ![A person looking at a phone][1] -[Flutter][2] is a popular project among mobile developers around the world. The framework has a massive, friendly community of enthusiasts, which continues to grow as Flutter helps programmers take their projects into the mobile space. +[Flutter][2] 是一个深受全球移动开发者欢迎的项目。该框架有一个庞大的、友好的发烧友社区,随着 Flutter 帮助程序员将他们的项目带入移动领域,这个社区还在继续增长。 -This tutorial is meant to help you start doing mobile development with Flutter. After reading it, you'll know how to quickly install and set up the framework to start coding for smartphones, tablets, and other platforms. +本教程旨在帮助您开始使用 Flutter 进行移动开发。阅读之后,您将了解如何快速安装和设置框架,以便开始为智能手机、平板电脑和其他平台编码。 -This how-to assumes you have [Android Studio][3] installed on your computer and some experience working with it. +本操作指南假定您已在计算机上安装了 [Android Studio][3],并且具有一定的使用经验。 -### What is Flutter? +### 什么是 Flutter ? -Flutter enables developers to build apps for several platforms, including: +Flutter 使得开发人员能够为多个平台构建应用程序,包括: * Android * iOS - * Web (in beta) - * macOS (in development) - * Linux (in development) + * Web (测试版) + * macOS (正在开发中) + * Linux (正在开发中) +对 macOS 和 Linux 的支持还处于早期开发阶段,而 Web 支持预计很快就会发布。这意味着您可以立即试用其功能(如下所述)。 +### 安装 Flutter -Support for macOS and Linux is in early development, while web support is expected to be released soon. This means that you can try out its capabilities now (as I'll describe below). +我使用的是 Ubuntu18.04,但安装过程与其他 Linux 发行版类似,比如 Arch 或 Mint。 -### Install Flutter - -I'm using Ubuntu 18.04, but the installation process is similar with other Linux distributions, such as Arch or Mint. - -#### Install with snapd - -To install Flutter on Ubuntu or similar distributions using [snapd][4], enter this in a terminal: +#### 使用 snapd 安装 +要使用 [Snapd][4] 在 Ubuntu 或类似发行版上安装 Flutter,请在终端中输入以下内容: ``` $ sudo snap install flutter --classic @@ -49,8 +46,7 @@ $ sudo snap install flutter –classic flutter 0+git.142868f from flutter Team/ installed ``` -Then launch it using the `flutter` command. Upon the first launch, the framework downloads to your computer: - +然后使用 `flutter` 命令启动它。 首次启动时,该框架会下载到您的计算机上: ``` $ flutter @@ -58,195 +54,184 @@ Initializing Flutter Downloading ``` -Once the download is finished, you'll see a message telling you that Flutter is initialized: +下载完成后,您会看到一条消息,告诉您 Flutter 已初始化: ![Flutter initialized][5] (Vitaly Kuprenko, [CC BY-SA 4.0][6]) -#### Install manually +#### 手动安装 -If you don't have snapd or your distribution isn't Ubuntu, the installation process will be a little bit different. In that case, [download][7] the version of Flutter recommended for your operating system. +如果您没有安装 Snapd,或者您的发行版不是 Ubuntu,那么安装过程会略有不同。 在这种情况下,请[下载] [7] 为您的操作系统推荐的 Flutter 版本。 ![Install Flutter manually][8] (Vitaly Kuprenko, [CC BY-SA 4.0][6]) -Then extract it to your home directory. - -Open the `.bashrc` file in your home directory (or `.zshrc` if you use the [Z shell][9]) in your favorite text editor. Because it's a hidden file, you must first enable showing hidden files in your file manager or open it from a terminal with: +然后将其解压缩到您的主目录。 +在您喜欢的文本编辑器中打开主目录中的 `.bashrc` 文件 (如果您使用 [Z shell][9],则打开 `.zshc`)。因为它是隐藏文件,所以您必须首先在文件管理器中启用显示隐藏文件,或者使用以下命令从终端打开它: ``` -`$ gedit ~/.bashrc &` +$ gedit ~/.bashrc & ``` -Add the following line to the end of the file: - +将以下行添加到文件末尾: ``` -`export PATH="$PATH:~/flutter/bin"` +export PATH="$PATH:~/flutter/bin" ``` -Save and close the file. Keep in mind that if you extracted Flutter somewhere other than your home directory, the [path to Flutter SDK][10] will be different. - -Close your terminal and then open it again so that your new configuration loads. Alternatively, you can source the configuration with: +保存并关闭文件。 请记住,如果将 Flutter 提取到您的主目录之外的其他位置,则 [Flutter SDK 的路径][10] 将有所不同。 +关闭您的终端,然后再次打开,以便加载新配置。 或者,您可以通过以下命令使配置立即生效: ``` -`$ . ~/.bashrc` +$ . ~/.bashrc ``` -If you don't see an error, then everything is fine. +如果您没有看到错误,那说明一切都是正常的。 -This installation method is a little bit harder than using the `snap` command, but it's pretty versatile and lets you install the framework on almost any distribution. +这种安装方法比使用 `snap`命令稍微困难一些,但是它非常通用,可以让您在几乎所有的发行版上安装框架。 -#### Check the installation -To check the result, enter the following in the terminal: +#### 检查安装结果 +要检查结果,请在终端中输入以下内容: ``` -`flutter doctor -v` +flutter doctor -v ``` -You'll see information about installed components. Don't worry if you see errors. You haven't installed any IDE plugins for working with Flutter SDK yet. +您将看到有关已安装组件的信息。 如果看到错误,请不要担心。 您尚未安装任何用于 Flutter SDK 的 IDE 插件。 ![Checking Flutter installation with the doctor command][11] (Vitaly Kuprenko, [CC BY-SA 4.0][6]) -### Install IDE plugins +### 安装 IDE 插件 -You should install plugins in your [integrated development environment (IDE)][12] to help it interface with the Flutter SDK, interact with devices, and build code. +您应该在您的 [集成开发环境 (IDE)][12] 中安装插件,以帮助它与 Flutter SDK 接口、与设备交互并构建代码。 -The three main IDE tools that are commonly used for Flutter development are IntelliJ IDEA (Community Edition), Android Studio, and VS Code (or [VSCodium][13]). I'm using Android Studio in this tutorial, but the steps are similar to how they work on IntelliJ IDEA (Community Edition) since they're built on the same platform. +Flutter 开发中常用的三个主要 IDE 工具是 IntelliJ IDEA (社区版)、Android Studio 和 VS Code (或 [VSCodium][13])。我在本教程中使用的是 Android Studio,但步骤与它们在 IntelliJ Idea (社区版)上的工作方式相似,因为它们构建在相同的平台上。 -First, launch **Android Studio**. Open **Settings** and go to the **Plugins** pane, and select the **Marketplace** tab. Enter **Flutter** in the search line and click **Install**. +首先,启动 **Android Studio**。打开 **Settings**,进入 **Plugins** 窗格,选择 **Marketplace** 选项卡。在搜索行中输入 **Flutter**,然后单击 **Install**。 ![Flutter plugins][14] (Vitaly Kuprenko, [CC BY-SA 4.0][6]) -You'll probably see an option to install the **Dart** plugin; agree to it. If you don't see the Dart option, then install it manually by repeating the steps above. I also recommend using the **Rainbow Brackets** plugin, which makes code navigation easier. - -That's it! You've installed all the plugins you need. You can check by entering a familiar command in the terminal: +您可能会看到一个安装 **Dart** 插件的选项;同意它。如果看不到 Dart 选项,请通过重复上述步骤手动安装。我还建议使用 **Rainbow Brackets** 插件,它可以让代码导航更简单。 +就这样!您已经安装了所需的所有插件。您可以在终端中输入一个熟悉的命令进行检查: ``` -`flutter doctor -v` +flutter doctor -v ``` ![Checking Flutter plugins with the doctor command][15] (Vitaly Kuprenko, [CC BY-SA 4.0][6]) -### Build your "Hello World" application +### 构建您的 “Hello World” 应用程序 -To start a new project, create a Flutter project: +要启动新项目,请创建一个 Flutter 项目: - 1. Select **New -> New Flutter project**. + 1. 选择 **New -> New Flutter project**. ![Creating a new Flutter plugin][16] (Vitaly Kuprenko, [CC BY-SA 4.0][6]) - 2. In the window, choose the type of project you want. In this case, you need **Flutter Application**. + 2. 在窗口中,选择所需的项目类型。 在这种情况下,您需要选择 **Flutter Application**。 - 3. Name your project **hello_world**. Note that you should use a merged name, so use an underscore instead of a space. You may also need to specify the path to the SDK. + 3. 命名您的项目 **hello_world**。 请注意,您应该使用合并的名称,因此请使用下划线而不是空格。 您可能还需要指定 SDK 的路径。 ![Naming a new Flutter plugin][17] (Vitaly Kuprenko, [CC BY-SA 4.0][6]) - 4. Enter the package name. + 4. 输入软件包名称。 - - - -You've created a project! Now you can launch it on a device or by using an emulator. +您已经创建了一个项目!现在,您可以在设备上或使用模拟器启动它。 ![Device options in Flutter][18] (Vitaly Kuprenko, [CC BY-SA 4.0][6]) -Select the device you want and press **Run**. In a moment, you will see the result. +选择您想要的设备,然后按 **运行**。稍后,您将看到结果。 ![Flutter demo on mobile device][19] (Vitaly Kuprenko, [CC BY-SA 4.0][6]) -Now you can start working on an [intermediate project][20]. +现在你可以在一个 [中间项目][20] 上开始工作了。 -### Try Flutter for web +### 尝试 Flutter for web -Before you install Flutter components for the web, you should know that Flutter's support for web apps is pretty raw at the moment. So it's not a good idea to use it for complicated projects yet. - -Flutter for web is not active in the basic SDK by default. To switch it on, go to the beta channel. To do this, enter the following command in the terminal: +在安装 Flutter 的 Web 组件之前,您应该知道 Flutter 目前对 Web 应用程序的支持还很原始。 因此,将其用于复杂的项目并不是一个好主意。 +默认情况下,基本 SDK 中不启用 Flutter for web。 要打开它,请转到 beta 频道。 为此,请在终端中输入以下命令: ``` -`flutter channel beta` +flutter channel beta ``` ![flutter channel beta output][21] (Vitaly Kuprenko, [CC BY-SA 4.0][6]) -Next, upgrade Flutter according to the beta branch by using the command: - +接下来,使用以下命令根据 beta 分支升级 Flutter: ``` -`flutter upgrade` +flutter upgrade ``` ![flutter upgrade output][22] (Vitaly Kuprenko, [CC BY-SA 4.0][6]) -To make Flutter for web work, enter: - +要使 Flutter for web 工作,请输入: ``` -`flutter config --enable-web` +flutter config --enable-web ``` -Restart your IDE; this helps Android Studio index the new IDE and reload the list of devices. You should see several new devices: +重新启动 IDE;这有助于 Android Studio 索引新的 IDE 并重新加载设备列表。您应该会看到几个新设备: ![Flutter for web device options][23] (Vitaly Kuprenko, [CC BY-SA 4.0][6]) -Selecting **Chrome** launches an app in the browser, while **Web Server** gives you the link to your web app, which you can open in any browser. - -Still, it's not time to rush into development because your current project doesn't support the web. To improve it, open the terminal in the project's root and enter: +选择 **Chrome** 会在浏览器中启动一个应用程序, **Web Server** 会提供指向您的 Web 应用程序的链接,您可以在任何浏览器中打开它。 +不过,现在还不是急于开发的时候,因为您当前的项目不支持Web。要改进它,请打开项目根目录下的终端,然后输入: ``` -`flutter create` +flutter create ``` -This command recreates the project, adding web support. The existing code won't be deleted. +此命令重新创建项目,并添加 Web 支持。 现有代码不会被删除。 -Note that the tree has changed and now has a "web" directory: +请注意,目录树已更改,现在有了一个 "web" 目录: ![File tree with web directory][24] (Vitaly Kuprenko, [CC BY-SA 4.0][6]) -Now you can get to work. Select **Chrome** and press **Run**. In a moment, you'll see the browser window with your app. +现在您可以开始工作了。 选择 **Chrome**,然后按 **Run**。 稍后,您会看到带有应用程序的浏览器窗口。 ![Flutter web app demo][25] (Vitaly Kuprenko, [CC BY-SA 4.0][6]) -Congratulations! You've just launched a project for the browser and can continue working with it as with any other website. +恭喜你! 您刚刚为浏览器启动了一个项目,并且可以像其他任何网站一样继续使用它。 -All of this comes from the same codebase because Flutter makes it possible to write code for both mobile platforms and the web with little to no changes. +所有这些都来自同一代码库,因为 Flutter 使得几乎无需更改就可以为移动平台和 Web 编写代码。 -### Do more with Flutter +### 用 Flutter 做更多的事情 -Flutter is a powerful tool for mobile development, and moreover, it's an important evolutionary step toward cross-platform development. Learn it, use it, and deliver your apps to all the platforms! +Flutter 是用于移动开发的强大工具,而且它也是迈向跨平台开发的重要一步。 了解它,使用它,并将您的应用程序交付到所有平台! -------------------------------------------------------------------------------- @@ -254,7 +239,7 @@ via: https://opensource.com/article/20/9/mobile-app-flutter 作者:[Vitaly Kuprenko][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[译者ID](https://github.com/gxlct008) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From cf35a20f7906f5102dd84fb070bb3bd5a63bfbbb Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Fri, 2 Oct 2020 14:24:53 +0800 Subject: [PATCH 0302/1156] =?UTF-8?q?=E5=B0=86=E8=AF=91=E6=96=87=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E5=88=B0=20translated/tech/=20=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20200901 Create a mobile app with Flutter.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20200901 Create a mobile app with Flutter.md (100%) diff --git a/sources/tech/20200901 Create a mobile app with Flutter.md b/translated/tech/20200901 Create a mobile app with Flutter.md similarity index 100% rename from sources/tech/20200901 Create a mobile app with Flutter.md rename to translated/tech/20200901 Create a mobile app with Flutter.md From 9009b7aeed80a1d7a3603f322e1076d50edd6897 Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Fri, 2 Oct 2020 15:11:39 +0800 Subject: [PATCH 0303/1156] =?UTF-8?q?=E7=94=B3=E9=A2=86=E5=8E=9F=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/tech/20180710 Building a Messenger App- Messages.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20180710 Building a Messenger App- Messages.md b/sources/tech/20180710 Building a Messenger App- Messages.md index 55e596df64..6ea385e0bd 100644 --- a/sources/tech/20180710 Building a Messenger App- Messages.md +++ b/sources/tech/20180710 Building a Messenger App- Messages.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (gxlct008) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 47c37ce4951e3d0de4de41c7b91ce203bf7f202b Mon Sep 17 00:00:00 2001 From: Hilton Chain <26847027+rakino@users.noreply.github.com> Date: Fri, 2 Oct 2020 15:41:03 +0800 Subject: [PATCH 0304/1156] translated --- ...20200928 Create template files in GNOME.md | 77 ------------------ ...20200928 Create template files in GNOME.md | 78 +++++++++++++++++++ 2 files changed, 78 insertions(+), 77 deletions(-) delete mode 100644 sources/tech/20200928 Create template files in GNOME.md create mode 100644 translated/tech/20200928 Create template files in GNOME.md diff --git a/sources/tech/20200928 Create template files in GNOME.md b/sources/tech/20200928 Create template files in GNOME.md deleted file mode 100644 index 1745df2241..0000000000 --- a/sources/tech/20200928 Create template files in GNOME.md +++ /dev/null @@ -1,77 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (rakino) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Create template files in GNOME) -[#]: via: (https://opensource.com/article/20/9/gnome-templates) -[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) - -Create template files in GNOME -====== -Make boilerplates so you can get started on a new document faster. -![Digital images of a computer desktop][1] - -I just stumbled onto a new (to me) feature of the [GNOME][2] desktop that enables you to create a document template. A template is generally an empty shell of a document with certain things configured and is often referred to as boilerplate. An example might be a letterhead for a law firm, with its corporate title and address at the top. Another might be a bank or insurance carrier letter that contains certain disclaimers in the footer at the bottom of the document. Since this sort of information rarely changes, you can add it to an empty document to use as a template. - -I was browsing through files on my Linux system one day and clicked on the **Templates** directory. I just happened to notice a message at the top of the window that stated, "Put files in this folder to use them as templates for new documents." There was also a link to **Learn more…** that opens the [GNOME help][3] for templates. - -![Message at top of Templates folder in GNOME Desktop][4] - -(Alan Formy-Duval, [CC BY-SA 4.0][5]) - -### Create a template - -Creating a template for the GNOME desktop is quite simple. There are several ways you can place a file into this folder: You can copy or move a file from another location through either the graphical user interface (GUI) or the command-line interface (CLI), or you can create an entirely new file. I chose the latter; actually, I created two files. - -![My first two GNOME templates][6] - -(Alan Formy-Duval, [CC BY-SA 4.0][5]) - -The first template I created is for an Opensource.com article. It provides a place to enter a title and several lines for my name and the license terms under which I am providing the content of the article. I use the Markdown document format for my articles, so I create the template as a new Markdown document—**Opensource.com Article.md**: - - -``` -# Title     -``` -An article for Opensource.com -by: Alan Formy-Duval -Creative Commons BY-SA 4.0 -``` - -``` - -I saved this document as a file in `/home/alan/Templates`. Now GNOME recognizes this file as a template and suggests it whenever I want to create a new document. - -### Use a template - -Whenever I get a spark or epiphany for a new article, I can just right-click in the folder where I plan to organize my content and select the template from the **New Document** list. - -![Select the template by name][7] - -(Alan Formy-Duval, [CC BY-SA 4.0][5]) - -You can make a template for all sorts of documents or files. I am writing this article using a template I created for my Opensource.com articles. Programmers might use templates for software code; perhaps you want a template that just contains `main()`. - -The GNOME desktop environment provides a very useful, feature-rich user interface for users of Linux and related operating systems. What are your favorite GNOME desktop features, and how do you use them? Please share in the comments! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/9/gnome-templates - -作者:[Alan Formy-Duval][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://opensource.com/users/alanfdoss -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_desk_home_laptop_browser.png?itok=Y3UVpY0l (Digital images of a computer desktop) -[2]: https://www.gnome.org/ -[3]: https://help.gnome.org/users/gnome-help/stable/files-templates.html.en -[4]: https://opensource.com/sites/default/files/uploads/gnome-message_at_top_border.png (Message at top of Templates folder in GNOME Desktop) -[5]: https://creativecommons.org/licenses/by-sa/4.0/ -[6]: https://opensource.com/sites/default/files/uploads/gnome-first_two_templates_border.png (My first two GNOME templates) -[7]: https://opensource.com/sites/default/files/uploads/gnome-new_document_menu_border.png (Select the template by name) diff --git a/translated/tech/20200928 Create template files in GNOME.md b/translated/tech/20200928 Create template files in GNOME.md new file mode 100644 index 0000000000..67669bd142 --- /dev/null +++ b/translated/tech/20200928 Create template files in GNOME.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: (rakino) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Create template files in GNOME) +[#]: via: (https://opensource.com/article/20/9/gnome-templates) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) + +在 GNOME 中创建文档模板 +====== + +![Digital images of a computer desktop][1] + +制作模板可以让你更快地开始写作新的文档。 + +我偶然发现了 [GNOME][2] 的一个新功能(对我来说是的):创建文档模版。模版(template)也被称作样版文件(boilerplate),一般是有着特定格式的空文档,例如律师事务所的信笺,在其顶部有着律所的名称和地址;另一个例子是银行以及保险公司的保函,在其底部页脚包含着某些免责声明。由于这类信息很少改变,你可以把它们添加到空文档中作为模板使用。 + +一天,在浏览我的 Linux 系统文件的时候,我点击了**模板**(Templates)文件夹,然后刚好发现窗口的上方有一条消息写着:“将文件放入此文件夹并用作新文档的模板”,以及一个 **获取详情……** 的链接,指向了 [GNOME 指南(GNOME help)][3]中的模板页面。 + +![Message at top of Templates folder in GNOME Desktop][4] + +(Alan Formy-Duval, [CC BY-SA 4.0][5]) + +### 创建模板 + +在 GNOME 中创建模板非常简单。有几种方法可以把文件放进模板文件夹里:你既可以通过图形用户界面(GUI)或是命令行界面(CLI)从另一个位置复制或移动文件,也可以创建一个全新的文件;我选择了后者,实际上我也创建了两个文件。 + +![My first two GNOME templates][6] + +(Alan Formy-Duval, [CC BY-SA 4.0][5]) + +我的第一份模板是为 Opensource.com 的文章准备的,它有一个输入标题的位置以及关于我的名字和文章使用的许可证的几行。我的文章使用 Markdown 格式,所以我将模板创建为了一个新的 Markdown 文档——**Opensource.com Article.md**: + +``` +# Title     +\``` +An article for Opensource.com +by: Alan Formy-Duval +Creative Commons BY-SA 4.0 +\``` + +``` + +我将这份文档保存在了 `/home/alan/Templates` 文件夹内,现在 GNOME 就可以将这个文件识别为模板,并在我要创建新文档的时候提供建议了。 + +### 使用模板 + +每当我有了新文章的灵感的时候,我只需要在我计划用来组织内容的文件夹里单击右键,然后从 **新建文档**(New Document)列表中选择我想要的模板就可以开始了。 + +![Select the template by name][7] + +(Alan Formy-Duval, [CC BY-SA 4.0][5]) + +你可以为各种文档或文件制作模板。我写这篇文章时使用了我为 Opensource.com 的文章创建的模板。程序员可能会把模板用于软件代码,这样的话也许你想要只包含 `main()` 的模板。 + +GNOME 桌面环境为 Linux 及相关操作系统的用户提供了一个非常实用、功能丰富的界面。你最喜欢的 GNOME 功能是什么,你又是怎样使用它们的呢?请在评论中分享~ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/gnome-templates + +作者:[Alan Formy-Duval][a] +选题:[lujun9972][b] +译者:[rakino](https://github.com/rakino) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_desk_home_laptop_browser.png?itok=Y3UVpY0l (Digital images of a computer desktop) +[2]: https://www.gnome.org/ +[3]: https://help.gnome.org/users/gnome-help/stable/files-templates.html.en +[4]: https://opensource.com/sites/default/files/uploads/gnome-message_at_top_border.png (Message at top of Templates folder in GNOME Desktop) +[5]: https://creativecommons.org/licenses/by-sa/4.0/ +[6]: https://opensource.com/sites/default/files/uploads/gnome-first_two_templates_border.png (My first two GNOME templates) +[7]: https://opensource.com/sites/default/files/uploads/gnome-new_document_menu_border.png (Select the template by name) From dd000fbf14318765083367154b571ed6cca71dbb Mon Sep 17 00:00:00 2001 From: Hilton Chain <26847027+rakino@users.noreply.github.com> Date: Fri, 2 Oct 2020 15:55:33 +0800 Subject: [PATCH 0305/1156] Update 20200928 Create template files in GNOME.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 格式 --- .../tech/20200928 Create template files in GNOME.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/translated/tech/20200928 Create template files in GNOME.md b/translated/tech/20200928 Create template files in GNOME.md index 67669bd142..94654089f2 100644 --- a/translated/tech/20200928 Create template files in GNOME.md +++ b/translated/tech/20200928 Create template files in GNOME.md @@ -16,7 +16,7 @@ 我偶然发现了 [GNOME][2] 的一个新功能(对我来说是的):创建文档模版。模版(template)也被称作样版文件(boilerplate),一般是有着特定格式的空文档,例如律师事务所的信笺,在其顶部有着律所的名称和地址;另一个例子是银行以及保险公司的保函,在其底部页脚包含着某些免责声明。由于这类信息很少改变,你可以把它们添加到空文档中作为模板使用。 -一天,在浏览我的 Linux 系统文件的时候,我点击了**模板**(Templates)文件夹,然后刚好发现窗口的上方有一条消息写着:“将文件放入此文件夹并用作新文档的模板”,以及一个 **获取详情……** 的链接,指向了 [GNOME 指南(GNOME help)][3]中的模板页面。 +一天,在浏览我的 Linux 系统文件的时候,我点击了**模板**(Templates)文件夹,然后刚好发现窗口的上方有一条消息写着:“将文件放入此文件夹并用作新文档的模板”,以及一个**获取详情……** 的链接,指向了 [GNOME 指南(GNOME help)][3]中的模板页面。 ![Message at top of Templates folder in GNOME Desktop][4] @@ -32,21 +32,21 @@ 我的第一份模板是为 Opensource.com 的文章准备的,它有一个输入标题的位置以及关于我的名字和文章使用的许可证的几行。我的文章使用 Markdown 格式,所以我将模板创建为了一个新的 Markdown 文档——**Opensource.com Article.md**: -``` +```` # Title     -\``` +``` An article for Opensource.com by: Alan Formy-Duval Creative Commons BY-SA 4.0 -\``` - ``` +```` + 我将这份文档保存在了 `/home/alan/Templates` 文件夹内,现在 GNOME 就可以将这个文件识别为模板,并在我要创建新文档的时候提供建议了。 ### 使用模板 -每当我有了新文章的灵感的时候,我只需要在我计划用来组织内容的文件夹里单击右键,然后从 **新建文档**(New Document)列表中选择我想要的模板就可以开始了。 +每当我有了新文章的灵感的时候,我只需要在我计划用来组织内容的文件夹里单击右键,然后从**新建文档**(New Document)列表中选择我想要的模板就可以开始了。 ![Select the template by name][7] From f1413780dc1508146a59bda4847f0a29a56fed8a Mon Sep 17 00:00:00 2001 From: Hilton Chain <26847027+rakino@users.noreply.github.com> Date: Fri, 2 Oct 2020 18:22:55 +0800 Subject: [PATCH 0306/1156] translating --- .../talk/20190822 Things You Didn-t Know About GNU Readline.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20190822 Things You Didn-t Know About GNU Readline.md b/sources/talk/20190822 Things You Didn-t Know About GNU Readline.md index 189f1152b9..ded9340976 100644 --- a/sources/talk/20190822 Things You Didn-t Know About GNU Readline.md +++ b/sources/talk/20190822 Things You Didn-t Know About GNU Readline.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (rakino) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f6cd9cfd5f338dfc35022fd6c94d9f2ba8cb88c1 Mon Sep 17 00:00:00 2001 From: "Xiaobin.Liu" Date: Fri, 2 Oct 2020 23:00:18 +0800 Subject: [PATCH 0307/1156] APL --- ...Automate testing for website errors with this Python tool.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200723 Automate testing for website errors with this Python tool.md b/sources/tech/20200723 Automate testing for website errors with this Python tool.md index aaf90a1a33..c854b5e342 100644 --- a/sources/tech/20200723 Automate testing for website errors with this Python tool.md +++ b/sources/tech/20200723 Automate testing for website errors with this Python tool.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lxbwolf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f9181b4a376e351ddb33e485fe87fe2bc1e31e6d Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Sat, 3 Oct 2020 09:05:22 +0800 Subject: [PATCH 0308/1156] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=AF=91=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0710 Building a Messenger App- Messages.md | 51 +++++++++---------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/sources/tech/20180710 Building a Messenger App- Messages.md b/sources/tech/20180710 Building a Messenger App- Messages.md index 6ea385e0bd..6b314c2123 100644 --- a/sources/tech/20180710 Building a Messenger App- Messages.md +++ b/sources/tech/20180710 Building a Messenger App- Messages.md @@ -7,18 +7,17 @@ [#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-messages/) [#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) -Building a Messenger App: Messages +构建一个即时消息应用(四):消息 ====== -This post is the 4th on a series: +本文是该系列的第四篇。 - * [Part 1: Schema][1] - * [Part 2: OAuth][2] - * [Part 3: Conversations][3] + * [第一篇: 模式][1] + * [第二篇: OAuth][2] + * [第三篇: 对话Conversations][3] - -In this post we’ll code the endpoints to create a message and list them, also an endpoint to update the last time the participant read messages. Start by adding these routes in the `main()` function. +在这篇文章中,我们将对端点进行编码以创建一条消息并列出它们,同时还将编写一个端点以更新参与者上次阅读消息的时间。 首先在 `main()` 函数中添加这些路由。 ``` router.HandleFunc("POST", "/api/conversations/:conversationID/messages", requireJSON(guard(createMessage))) @@ -26,11 +25,11 @@ router.HandleFunc("GET", "/api/conversations/:conversationID/messages", guard(ge router.HandleFunc("POST", "/api/conversations/:conversationID/read_messages", guard(readMessages)) ``` -Messages goes into conversations so the endpoint includes the conversation ID. +消息进入对话,因此端点包含对话 ID。 -### Create Message +### 创建消息 -This endpoint handles POST requests to `/api/conversations/{conversationID}/messages` with a JSON body with just the message content and return the newly created message. It has two side affects: it updates the conversation `last_message_id` and updates the participant `messages_read_at`. +该端点使用仅包含消息内容的 JSON 主体处理对 `/api/conversations/{conversationID}/messages` 的 POST 请求,并返回新创建的消息。 它有两个副作用:更新对话 `last_message_id` 以及更新参与者 `messages_read_at`。 ``` func createMessage(w http.ResponseWriter, r *http.Request) { @@ -119,7 +118,7 @@ func createMessage(w http.ResponseWriter, r *http.Request) { } ``` -First, it decodes the request body into an struct with the message content. Then, it validates the content is not empty and has less than 480 characters. +首先,它将请求正文解码为具有消息内容的结构。然后,它验证内容不为空并且少于 480 个字符。 ``` var rxSpaces = regexp.MustCompile("\\s+") @@ -141,9 +140,9 @@ func removeSpaces(s string) string { } ``` -This is the function to remove spaces. It iterates over each line, remove more than two consecutives spaces and returns with the non empty lines. +这是删除空格的函数。它迭代每一行,删除两个以上的连续空格,然后回非空行。 -After the validation, it starts an SQL transaction. First, it queries for the participant existance in the conversation. +验证之后,它将启动一个 SQL 事务。首先,它查询对话中的参与者是否存在。 ``` func queryParticipantExistance(ctx context.Context, tx *sql.Tx, userID, conversationID string) (bool, error) { @@ -161,13 +160,13 @@ func queryParticipantExistance(ctx context.Context, tx *sql.Tx, userID, conversa } ``` -I extracted it into a function because it’s reused later. +我将其提取到一个函数中,因为稍后可以重用。 -If the user isn’t participant of the conversation, we return with a `404 Not Found` error. +如果用户不是对话参与者,我们将返回一个 `404 NOT Found` 错误。 -Then, it inserts the message and updates the conversation `last_message_id`. Since this point, `last_message_id` cannot by `NULL` because we don’t allow removing messages. +然后,它插入消息并更新对话 `last_message_id`。从这时起,由于我们不允许删除消息,因此 `last_message_id` 不能为 `NULL`。 -Then it commits the transaction and we update the participant `messages_read_at` in a goroutine. +接下来提交事务,并在 goroutine 中更新参与者 `messages_read_at`。 ``` func updateMessagesReadAt(ctx context.Context, userID, conversationID string) error { @@ -185,11 +184,11 @@ func updateMessagesReadAt(ctx context.Context, userID, conversationID string) er } ``` -Before responding with the new message, we must notify about it. This is for the realtime part we’ll code in the next post so I left a comment there. +在回复这条新消息之前,我们必须通知它。 这是我们将要在下一篇文章中编写的实时部分,因此我在那里留一个注释。 -### Get Messages +### 获取消息 -This endpoint handles GET requests to `/api/conversations/{conversationID}/messages`. It responds with a JSON array with all the messages in the conversation. It also has the same side affect of updating the participant `messages_read_at`. +这个端点处理对 `/api/conversations/{conversationID}/messages` 的 GET 请求。 它用一个包含会话中所有消息的 JSON 数组进行响应。 它还具有更新参与者 `messages_read_at` 的副作用。 ``` func getMessages(w http.ResponseWriter, r *http.Request) { @@ -267,11 +266,11 @@ func getMessages(w http.ResponseWriter, r *http.Request) { } ``` -First, it begins an SQL transaction in readonly mode. Checks for the participant existance and queries all the messages. In each message, we use the current authenticated user ID to know whether the user owns the message (`mine`). Then it commits the transaction, updates the participant `messages_read_at` in a goroutine and respond with the messages. +首先,它以只读模式开始一个 SQL 事务。 检查参与者是否存在并查询所有消息。 在每条消息中,我们使用当前经过身份验证的用户 ID 来了解用户是否拥有该消息(`我的`)。 然后,它提交事务,在 goroutine 中更新参与者 `messages_read_at` 并以消息响应。 -### Read Messages +### 阅读消息 -This endpoint handles POST requests to `/api/conversations/{conversationID}/read_messages`. Without any request or response body. In the frontend we’ll make this request each time a new message arrive in the realtime stream. +该端点处理对 `/api/conversations/{conversationID}/read_messages` 的 POST 请求。 没有任何请求或响应主体。 在前端,每次有新消息到达实时流时,我们都会发出此请求。 ``` func readMessages(w http.ResponseWriter, r *http.Request) { @@ -288,11 +287,11 @@ func readMessages(w http.ResponseWriter, r *http.Request) { } ``` -It uses the same function we’ve been using to update the participant `messages_read_at`. +它使用了与更新参与者 `messages_read_at` 相同的函数。 * * * -That concludes it. Realtime messages is the only part left in the backend. Wait for it in the next post. +到此为止。实时消息是后台仅剩的部分了。请等待下一篇文章。 [Souce Code][4] @@ -302,7 +301,7 @@ via: https://nicolasparada.netlify.com/posts/go-messenger-messages/ 作者:[Nicolás Parada][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[译者ID](https://github.com/gxlct008) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6abc84e93978c559095cb2aa8821488839aeee98 Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Sat, 3 Oct 2020 09:08:00 +0800 Subject: [PATCH 0309/1156] =?UTF-8?q?=E5=B0=86=E8=AF=91=E6=96=87=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E5=88=B0=20translated/tech/=20=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20180710 Building a Messenger App- Messages.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20180710 Building a Messenger App- Messages.md (100%) diff --git a/sources/tech/20180710 Building a Messenger App- Messages.md b/translated/tech/20180710 Building a Messenger App- Messages.md similarity index 100% rename from sources/tech/20180710 Building a Messenger App- Messages.md rename to translated/tech/20180710 Building a Messenger App- Messages.md From 1e83bba35234de220f481c487dd2b644b37d38cc Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Sat, 3 Oct 2020 09:36:54 +0800 Subject: [PATCH 0310/1156] =?UTF-8?q?=E7=94=B3=E9=A2=86=E5=8E=9F=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20180710 Building a Messenger App- Realtime Messages.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20180710 Building a Messenger App- Realtime Messages.md b/sources/tech/20180710 Building a Messenger App- Realtime Messages.md index 71479495b2..3ad1520755 100644 --- a/sources/tech/20180710 Building a Messenger App- Realtime Messages.md +++ b/sources/tech/20180710 Building a Messenger App- Realtime Messages.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (gxlct008) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 5d95779ad98da1748c0c84a10733abf7329e5c89 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 3 Oct 2020 09:49:32 +0800 Subject: [PATCH 0311/1156] PRF --- ...ling and running Vagrant using qemu-kvm.md | 61 +++++++++++-------- 1 file changed, 37 insertions(+), 24 deletions(-) diff --git a/translated/tech/20200921 Installing and running Vagrant using qemu-kvm.md b/translated/tech/20200921 Installing and running Vagrant using qemu-kvm.md index 8704427db0..23bee07795 100644 --- a/translated/tech/20200921 Installing and running Vagrant using qemu-kvm.md +++ b/translated/tech/20200921 Installing and running Vagrant using qemu-kvm.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Installing and running Vagrant using qemu-kvm) @@ -12,47 +12,50 @@ ![][1] -Vagrant 是一个出色的工具,被 DevOps 专业人员、程序员、系统管理员和普通极客来使用它来建立可复制的基础架构来进行开发和测试。来自它们的网站: +Vagrant 是一个出色的工具,DevOps 专业人员、程序员、系统管理员和普通极客来使用它来建立可重复的基础架构来进行开发和测试。引用自它的网站: -> Vagrant 是用于在单工作流程中构建和管理虚拟机环境的工具。凭借简单易用的工作流程和对自动化的关注,Vagrant 降低了开发环境的设置时间,提高了生产效率,并使”在我的机器上工作“的借口成为过去。 +> Vagrant 是用于在单工作流程中构建和管理虚拟机环境的工具。凭借简单易用的工作流程并专注于自动化,Vagrant 降低了开发环境的设置时间,提高了生产效率,并使“在我的机器上可以工作”的借口成为过去。 > -> 如果你已经熟悉 Vagrant 的基础知识,那么文档为所有的功能和内部结构提供了更好的参考。 +> 如果你已经熟悉 Vagrant 的基础知识,那么该文档为所有的功能和内部结构提供了更好的参考。 > -> Vagrant 提供了易于配置、可复制、可移植的工作环境,它建立在行业标准技术之上,并由一个统一的工作流程控制,帮助你和你的团队最大限度地提高生产力和灵活性。 +> Vagrant 提供了基于行业标准技术构建的、易于配置、可复制、可移植的工作环境,并由一个一致的工作流程控制,帮助你和你的团队最大限度地提高生产力和灵活性。 > > -本指南将通过必要的步骤,让 Vagrant 在基于 Fedora 的机器上工作。 +本指南将逐步介绍使 Vagrant 在基于 Fedora 的计算机上工作所需的步骤。 -我从最小化安装 Fedora Server 开始,因为这样可以减少主机操作系统的内存占用,但如果你已经有一台可以使用的 Fedora 机器,无论是服务器还是工作站,那么也没问题。 +我从最小化安装 Fedora 服务器开始,因为这样可以减少宿主机操作系统的内存占用,但如果你已经有一台可以使用的 Fedora 机器,无论是服务器还是工作站版本,那么也没问题。 -### 检查机器是否支持虚拟化: +### 检查机器是否支持虚拟化 ``` $ sudo lscpu | grep Virtualization +``` + +``` Virtualization: VT-x Virtualization type: full ``` -### 安装 qemu-kvm: +### 安装 qemu-kvm ``` sudo dnf install qemu-kvm libvirt libguestfs-tools virt-install rsync ``` -### 启用并启动 libvirt 守护进程: +### 启用并启动 libvirt 守护进程 ``` sudo systemctl enable --now libvirtd ``` -### 安装 Vagrant: +### 安装 Vagrant ``` sudo dnf install vagrant ``` -### 安装 Vagrant libvirtd 插件: +### 安装 Vagrant libvirtd 插件 ``` sudo vagrant plugin install vagrant-libvirt @@ -64,48 +67,58 @@ sudo vagrant plugin install vagrant-libvirt vagrant box add fedora/32-cloud-base --provider=libvirt ``` -### 创建一个最小的 Vagrantfile 来测试: +(LCTT 译注:以防你不知道,box 是 Vagrant 中的一种包格式,Vagrant 支持的任何平台上的任何人都可以使用盒子来建立相同的工作环境。) + +### 创建一个最小化的 Vagrantfile 来测试 ``` $ mkdir vagrant-test $ cd vagrant-test -$ vi VagrantfileVagrant.configure("2") do |config| +$ vi Vagrantfile +``` + +``` +Vagrant.configure("2") do |config| config.vm.box = "fedora/32-cloud-base" end ``` -**注意文件名和文件内容的大写。** +**注意文件名和文件内容的大小写。** -### 检查文件: +### 检查文件 ``` -vagrant statusCurrent machine states: +vagrant status +``` + +``` +Current machine states: default not created (libvirt) The Libvirt domain is not created. Run 'vagrant up' to create it. ``` -### 启动 box: +### 启动 box ``` vagrant up ``` -### 连接到你的新机器: +### 连接到你的新机器 ``` vagrant ssh ``` -完成了。现在你的 Fedora 机器上有 Vagrant 在工作。 +完成了。现在你的 Fedora 机器上 Vagrant 可以工作了。 -要停止机器,请使用 _vagrant halt_。这只是简单地停止机器,但保留虚拟机和磁盘。 -要关闭并删除它,请使用 _vagrant destroy_。这将删除整个机器和你在其中所做的任何更改。 +要停止该机器,请使用 `vagrant halt`。这只是简单地停止机器,但保留虚拟机和磁盘。 +要关闭并删除它,请使用 `vagrant destroy`。这将删除整个机器和你在其中所做的任何更改。 ### 接下来的步骤 -在运行 _vagrant up_ 命令之前,你不需要下载 box。你可以直接在 Vagrantfile 中指定 box 和提供者,如果还没有的话,Vagrant 会下载它。下面是一个例子,它还设置了内存量和 CPU 数量: +在运行 `vagrant up` 命令之前,你不需要下载 box。你可以直接在 Vagrantfile 中指定 box 和提供者,如果还没有的话,Vagrant 会下载它。下面是一个例子,它还设置了内存量和 CPU 数量: ``` # -*- mode: ruby -*- @@ -131,7 +144,7 @@ via: https://fedoramagazine.org/vagrant-qemukvm-fedora-devops-sysadmin/ 作者:[Andy Mott][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From acfdb06f68e410d6360ba43cee7addceba4e1b8e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 3 Oct 2020 09:50:06 +0800 Subject: [PATCH 0312/1156] PUB @geekpi https://linux.cn/article-12676-1.html --- .../20200921 Installing and running Vagrant using qemu-kvm.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200921 Installing and running Vagrant using qemu-kvm.md (98%) diff --git a/translated/tech/20200921 Installing and running Vagrant using qemu-kvm.md b/published/20200921 Installing and running Vagrant using qemu-kvm.md similarity index 98% rename from translated/tech/20200921 Installing and running Vagrant using qemu-kvm.md rename to published/20200921 Installing and running Vagrant using qemu-kvm.md index 23bee07795..336a5bd209 100644 --- a/translated/tech/20200921 Installing and running Vagrant using qemu-kvm.md +++ b/published/20200921 Installing and running Vagrant using qemu-kvm.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12676-1.html) [#]: subject: (Installing and running Vagrant using qemu-kvm) [#]: via: (https://fedoramagazine.org/vagrant-qemukvm-fedora-devops-sysadmin/) [#]: author: (Andy Mott https://fedoramagazine.org/author/amott/) From 888cd183e719881cbf669d8ad46ab8cfe9da704a Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Sat, 3 Oct 2020 11:18:57 +0800 Subject: [PATCH 0313/1156] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=AF=91=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ding a Messenger App- Realtime Messages.md | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/sources/tech/20180710 Building a Messenger App- Realtime Messages.md b/sources/tech/20180710 Building a Messenger App- Realtime Messages.md index 3ad1520755..12454897e5 100644 --- a/sources/tech/20180710 Building a Messenger App- Realtime Messages.md +++ b/sources/tech/20180710 Building a Messenger App- Realtime Messages.md @@ -7,25 +7,24 @@ [#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-realtime-messages/) [#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) -Building a Messenger App: Realtime Messages +构建一个即时消息应用(五):实时消息 ====== -This post is the 5th on a series: +本文是该系列的第五篇。 - * [Part 1: Schema][1] - * [Part 2: OAuth][2] - * [Part 3: Conversations][3] - * [Part 4: Messages][4] + * [第一篇: 模式][1] + * [第二篇: OAuth][2] + * [第三篇: 对话][3] + * [第四篇: 消息][4] +对于实时消息,我们将使用 [服务器发送事件 (Server-Sent Events)][5]。这是一个开放的连接,我们可以在其中传输数据。我们将拥有用户订阅发送给他的所有消息的和端点。 -For realtime messages we’ll use [Server-Sent Events][5]. This is an open connection in which we can stream data. We’ll have and endpoint in which the user subscribes to all the messages sended to him. +### 消息户端 -### Message Clients +在 HTTP 部分之前,让我们先编写一个映射map ,让所有客户端都监听消息。 像这样全局初始化: -Before the HTTP part, let’s code a map to have all the clients listening for messages. Initialize this globally like so: - -``` +```go type MessageClient struct { Messages chan Message UserID string @@ -34,17 +33,17 @@ type MessageClient struct { var messageClients sync.Map ``` -### New Message Created +### 已创建的新消息 -Remember in the [last post][4] when we created the message, we left a “TODO” comment. There we’ll dispatch a goroutine with this function. +还记得在 [上一篇文章][4] 中,当我们创建这条消息时,我们留下了一个 “TODO” 注释。在那里,我们将使用这个函数来调度一个 goroutine。 -``` +```go go messageCreated(message) ``` -Insert that line just where we left the comment. +把这行代码插入到我们留注释的位置。 -``` +```go func messageCreated(message Message) error { if err := db.QueryRow(` SELECT user_id FROM participants @@ -70,19 +69,19 @@ func broadcastMessage(message Message) { } ``` -The function queries for the recipient ID (the other participant ID) and sends the message to all the clients. +该函数查询收件人 ID (其他参与者 ID),并将消息发送给所有客户端。 -### Subscribe to Messages +### 订阅消息 -Lets go to the `main()` function and add this route: +让我们转到 `main()` 函数并添加以下路由: -``` +```go router.HandleFunc("GET", "/api/messages", guard(subscribeToMessages)) ``` -This endpoint handles GET requests on `/api/messages`. The request should be an [EventSource][6] connection. It responds with an event stream in which the data is JSON formatted. +此端点处理 `/api/messages` 上的 GET 请求。请求应该是一个 [EventSource][6] 连接。它用一个事件流响应,其中的数据是 JSON 格式的。 -``` +```go func subscribeToMessages(w http.ResponseWriter, r *http.Request) { if a := r.Header.Get("Accept"); !strings.Contains(a, "text/event-stream") { http.Error(w, "This endpoint requires an EventSource connection", http.StatusNotAcceptable) @@ -127,29 +126,30 @@ func subscribeToMessages(w http.ResponseWriter, r *http.Request) { } ``` -First it checks for the correct request headers and checks the server supports streaming. We create a channel of messages to make a client and store it in the clients map. Each time a new message is created, it will go in this channel, so we can read from it with a `for-select` loop. +首先,它检查请求头是否正确,并检查服务器是否支持流式传输。我们创建一个消息通道,用它来构建一个客户端,并将其存储在客户端 map 中。每当创建新消息时,它都会进入这个通道,因此我们可以通过 `for-select` 循环从中读取。 -Server-Sent Events uses this format to send data: -``` +服务器发送事件Server-Sent Events使用以下格式发送数据: + +```go data: some data here\n\n ``` -We are sending it in JSON format: +我们以 JSON 格式发送: -``` +```json data: {"foo":"bar"}\n\n ``` -We are using `fmt.Fprintf()` to write to the response writter in this format and flushing the data in each iteration of the loop. +我们使用 `fmt.Fprintf()` 以这种格式写入响应写入器,并在循环的每次迭代中刷新数据。 -This will loop until the connection is closed using the request context. We defered the close of the channel and the delete of the client, so when the loop ends, the channel will be closed and the client won’t receive more messages. +这个循环会一直运行,直到使用请求上下文关闭连接为止。我们延迟了通道的关闭和客户端的删除,因此,当循环结束时,频道将被关闭,客户端将不会收到更多的消息。 -Note aside, the JavaScript API to work with Server-Sent Events (EventSource) doesn’t support setting custom headers 😒 So we cannot set `Authorization: Bearer `. And that’s the reason why the `guard()` middleware reads the token from the URL query string also. +注意,服务器发送事件Server-Sent Events (EventSource) 的 JavaScript API 不支持设置自定义头部😒,所以我们不能设置 `Authorization: Bearer `。这就是为什么 `guard()` 中间件也会从 URL 查询字符串中读取令牌的原因。 * * * -That concludes the realtime messages. I’d like to say that’s everything in the backend, but to code the frontend I’ll add one more endpoint to login. A login that will be just for development. +实时消息部分到此结束。我想说的是,这就是后端的全部内容。但是为了编写前端代码,我将再增加一个登录端点。一个仅用于开发的登录。 [Souce Code][7] @@ -159,7 +159,7 @@ via: https://nicolasparada.netlify.com/posts/go-messenger-realtime-messages/ 作者:[Nicolás Parada][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[译者ID](https://github.com/gxlct008) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 1b64a0aa709fb0adb01f6255a351517931afb679 Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Sat, 3 Oct 2020 11:21:26 +0800 Subject: [PATCH 0314/1156] =?UTF-8?q?=E5=B0=86=E8=AF=91=E6=96=87=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E5=88=B0=20translated/tech/=20=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20180710 Building a Messenger App- Realtime Messages.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20180710 Building a Messenger App- Realtime Messages.md (100%) diff --git a/sources/tech/20180710 Building a Messenger App- Realtime Messages.md b/translated/tech/20180710 Building a Messenger App- Realtime Messages.md similarity index 100% rename from sources/tech/20180710 Building a Messenger App- Realtime Messages.md rename to translated/tech/20180710 Building a Messenger App- Realtime Messages.md From 9b88981996fd02a59a4efb5c51328ff8a49df718 Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Sat, 3 Oct 2020 11:27:21 +0800 Subject: [PATCH 0315/1156] =?UTF-8?q?=E7=94=B3=E9=A2=86=E5=8E=9F=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20180712 Building a Messenger App- Development Login.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20180712 Building a Messenger App- Development Login.md b/sources/tech/20180712 Building a Messenger App- Development Login.md index e12fb3c56a..fea6bddcfa 100644 --- a/sources/tech/20180712 Building a Messenger App- Development Login.md +++ b/sources/tech/20180712 Building a Messenger App- Development Login.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (gxlct008) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 3bb56668f807cce0c04c09f7eab3b6e75d0c2912 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 4 Oct 2020 11:46:27 +0800 Subject: [PATCH 0316/1156] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @gxlct008 很好,感谢接上这个系列~ --- ...0710 Building a Messenger App- Messages.md | 381 +++++++++--------- 1 file changed, 190 insertions(+), 191 deletions(-) diff --git a/translated/tech/20180710 Building a Messenger App- Messages.md b/translated/tech/20180710 Building a Messenger App- Messages.md index 6b314c2123..473949a9ee 100644 --- a/translated/tech/20180710 Building a Messenger App- Messages.md +++ b/translated/tech/20180710 Building a Messenger App- Messages.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (gxlct008) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Building a Messenger App: Messages) @@ -14,10 +14,9 @@ * [第一篇: 模式][1] * [第二篇: OAuth][2] - * [第三篇: 对话Conversations][3] + * [第三篇: 对话][3] - -在这篇文章中,我们将对端点进行编码以创建一条消息并列出它们,同时还将编写一个端点以更新参与者上次阅读消息的时间。 首先在 `main()` 函数中添加这些路由。 +在这篇文章中,我们将对端点进行编码,以创建一条消息并列出它们,同时还将编写一个端点以更新参与者上次阅读消息的时间。 首先在 `main()` 函数中添加这些路由。 ``` router.HandleFunc("POST", "/api/conversations/:conversationID/messages", requireJSON(guard(createMessage))) @@ -25,138 +24,138 @@ router.HandleFunc("GET", "/api/conversations/:conversationID/messages", guard(ge router.HandleFunc("POST", "/api/conversations/:conversationID/read_messages", guard(readMessages)) ``` -消息进入对话,因此端点包含对话 ID。 +消息会进入对话,因此端点包含对话 ID。 ### 创建消息 -该端点使用仅包含消息内容的 JSON 主体处理对 `/api/conversations/{conversationID}/messages` 的 POST 请求,并返回新创建的消息。 它有两个副作用:更新对话 `last_message_id` 以及更新参与者 `messages_read_at`。 +该端点处理对 `/api/conversations/{conversationID}/messages` 的 POST 请求,其 JSON 主体仅包含消息内容,并返回新创建的消息。它有两个副作用:更新对话 `last_message_id` 以及更新参与者 `messages_read_at`。 ``` func createMessage(w http.ResponseWriter, r *http.Request) { - var input struct { - Content string `json:"content"` - } - defer r.Body.Close() - if err := json.NewDecoder(r.Body).Decode(&input); err != nil { - http.Error(w, err.Error(), http.StatusBadRequest) - return - } + var input struct { + Content string `json:"content"` + } + defer r.Body.Close() + if err := json.NewDecoder(r.Body).Decode(&input); err != nil { + http.Error(w, err.Error(), http.StatusBadRequest) + return + } - errs := make(map[string]string) - input.Content = removeSpaces(input.Content) - if input.Content == "" { - errs["content"] = "Message content required" - } else if len([]rune(input.Content)) > 480 { - errs["content"] = "Message too long. 480 max" - } - if len(errs) != 0 { - respond(w, Errors{errs}, http.StatusUnprocessableEntity) - return - } + errs := make(map[string]string) + input.Content = removeSpaces(input.Content) + if input.Content == "" { + errs["content"] = "Message content required" + } else if len([]rune(input.Content)) > 480 { + errs["content"] = "Message too long. 480 max" + } + if len(errs) != 0 { + respond(w, Errors{errs}, http.StatusUnprocessableEntity) + return + } - ctx := r.Context() - authUserID := ctx.Value(keyAuthUserID).(string) - conversationID := way.Param(ctx, "conversationID") + ctx := r.Context() + authUserID := ctx.Value(keyAuthUserID).(string) + conversationID := way.Param(ctx, "conversationID") - tx, err := db.BeginTx(ctx, nil) - if err != nil { - respondError(w, fmt.Errorf("could not begin tx: %v", err)) - return - } - defer tx.Rollback() + tx, err := db.BeginTx(ctx, nil) + if err != nil { + respondError(w, fmt.Errorf("could not begin tx: %v", err)) + return + } + defer tx.Rollback() - isParticipant, err := queryParticipantExistance(ctx, tx, authUserID, conversationID) - if err != nil { - respondError(w, fmt.Errorf("could not query participant existance: %v", err)) - return - } + isParticipant, err := queryParticipantExistance(ctx, tx, authUserID, conversationID) + if err != nil { + respondError(w, fmt.Errorf("could not query participant existance: %v", err)) + return + } - if !isParticipant { - http.Error(w, "Conversation not found", http.StatusNotFound) - return - } + if !isParticipant { + http.Error(w, "Conversation not found", http.StatusNotFound) + return + } - var message Message - if err := tx.QueryRowContext(ctx, ` - INSERT INTO messages (content, user_id, conversation_id) VALUES - ($1, $2, $3) - RETURNING id, created_at - `, input.Content, authUserID, conversationID).Scan( - &message.ID, - &message.CreatedAt, - ); err != nil { - respondError(w, fmt.Errorf("could not insert message: %v", err)) - return - } + var message Message + if err := tx.QueryRowContext(ctx, ` + INSERT INTO messages (content, user_id, conversation_id) VALUES + ($1, $2, $3) + RETURNING id, created_at + `, input.Content, authUserID, conversationID).Scan( + &message.ID, + &message.CreatedAt, + ); err != nil { + respondError(w, fmt.Errorf("could not insert message: %v", err)) + return + } - if _, err := tx.ExecContext(ctx, ` - UPDATE conversations SET last_message_id = $1 - WHERE id = $2 - `, message.ID, conversationID); err != nil { - respondError(w, fmt.Errorf("could not update conversation last message ID: %v", err)) - return - } + if _, err := tx.ExecContext(ctx, ` + UPDATE conversations SET last_message_id = $1 + WHERE id = $2 + `, message.ID, conversationID); err != nil { + respondError(w, fmt.Errorf("could not update conversation last message ID: %v", err)) + return + } - if err = tx.Commit(); err != nil { - respondError(w, fmt.Errorf("could not commit tx to create a message: %v", err)) - return - } + if err = tx.Commit(); err != nil { + respondError(w, fmt.Errorf("could not commit tx to create a message: %v", err)) + return + } - go func() { - if err = updateMessagesReadAt(nil, authUserID, conversationID); err != nil { - log.Printf("could not update messages read at: %v\n", err) - } - }() + go func() { + if err = updateMessagesReadAt(nil, authUserID, conversationID); err != nil { + log.Printf("could not update messages read at: %v\n", err) + } + }() - message.Content = input.Content - message.UserID = authUserID - message.ConversationID = conversationID - // TODO: notify about new message. - message.Mine = true + message.Content = input.Content + message.UserID = authUserID + message.ConversationID = conversationID + // TODO: notify about new message. + message.Mine = true - respond(w, message, http.StatusCreated) + respond(w, message, http.StatusCreated) } ``` -首先,它将请求正文解码为具有消息内容的结构。然后,它验证内容不为空并且少于 480 个字符。 +首先,它将请求正文解码为包含消息内容的结构。然后,它验证内容不为空并且少于 480 个字符。 ``` var rxSpaces = regexp.MustCompile("\\s+") func removeSpaces(s string) string { - if s == "" { - return s - } + if s == "" { + return s + } - lines := make([]string, 0) - for _, line := range strings.Split(s, "\n") { - line = rxSpaces.ReplaceAllLiteralString(line, " ") - line = strings.TrimSpace(line) - if line != "" { - lines = append(lines, line) - } - } - return strings.Join(lines, "\n") + lines := make([]string, 0) + for _, line := range strings.Split(s, "\n") { + line = rxSpaces.ReplaceAllLiteralString(line, " ") + line = strings.TrimSpace(line) + if line != "" { + lines = append(lines, line) + } + } + return strings.Join(lines, "\n") } ``` -这是删除空格的函数。它迭代每一行,删除两个以上的连续空格,然后回非空行。 +这是删除空格的函数。它遍历每一行,删除两个以上的连续空格,然后回非空行。 验证之后,它将启动一个 SQL 事务。首先,它查询对话中的参与者是否存在。 ``` func queryParticipantExistance(ctx context.Context, tx *sql.Tx, userID, conversationID string) (bool, error) { - if ctx == nil { - ctx = context.Background() - } - var exists bool - if err := tx.QueryRowContext(ctx, `SELECT EXISTS ( - SELECT 1 FROM participants - WHERE user_id = $1 AND conversation_id = $2 - )`, userID, conversationID).Scan(&exists); err != nil { - return false, err - } - return exists, nil + if ctx == nil { + ctx = context.Background() + } + var exists bool + if err := tx.QueryRowContext(ctx, `SELECT EXISTS ( + SELECT 1 FROM participants + WHERE user_id = $1 AND conversation_id = $2 + )`, userID, conversationID).Scan(&exists); err != nil { + return false, err + } + return exists, nil } ``` @@ -170,120 +169,120 @@ func queryParticipantExistance(ctx context.Context, tx *sql.Tx, userID, conversa ``` func updateMessagesReadAt(ctx context.Context, userID, conversationID string) error { - if ctx == nil { - ctx = context.Background() - } + if ctx == nil { + ctx = context.Background() + } - if _, err := db.ExecContext(ctx, ` - UPDATE participants SET messages_read_at = now() - WHERE user_id = $1 AND conversation_id = $2 - `, userID, conversationID); err != nil { - return err - } - return nil + if _, err := db.ExecContext(ctx, ` + UPDATE participants SET messages_read_at = now() + WHERE user_id = $1 AND conversation_id = $2 + `, userID, conversationID); err != nil { + return err + } + return nil } ``` -在回复这条新消息之前,我们必须通知它。 这是我们将要在下一篇文章中编写的实时部分,因此我在那里留一个注释。 +在回复这条新消息之前,我们必须通知一下。这是我们将要在下一篇文章中编写的实时部分,因此我在那里留一了个注释。 ### 获取消息 -这个端点处理对 `/api/conversations/{conversationID}/messages` 的 GET 请求。 它用一个包含会话中所有消息的 JSON 数组进行响应。 它还具有更新参与者 `messages_read_at` 的副作用。 +这个端点处理对 `/api/conversations/{conversationID}/messages` 的 GET 请求。 它用一个包含会话中所有消息的 JSON 数组进行响应。它还具有更新参与者 `messages_read_at` 的副作用。 ``` func getMessages(w http.ResponseWriter, r *http.Request) { - ctx := r.Context() - authUserID := ctx.Value(keyAuthUserID).(string) - conversationID := way.Param(ctx, "conversationID") + ctx := r.Context() + authUserID := ctx.Value(keyAuthUserID).(string) + conversationID := way.Param(ctx, "conversationID") - tx, err := db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true}) - if err != nil { - respondError(w, fmt.Errorf("could not begin tx: %v", err)) - return - } - defer tx.Rollback() + tx, err := db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true}) + if err != nil { + respondError(w, fmt.Errorf("could not begin tx: %v", err)) + return + } + defer tx.Rollback() - isParticipant, err := queryParticipantExistance(ctx, tx, authUserID, conversationID) - if err != nil { - respondError(w, fmt.Errorf("could not query participant existance: %v", err)) - return - } + isParticipant, err := queryParticipantExistance(ctx, tx, authUserID, conversationID) + if err != nil { + respondError(w, fmt.Errorf("could not query participant existance: %v", err)) + return + } - if !isParticipant { - http.Error(w, "Conversation not found", http.StatusNotFound) - return - } + if !isParticipant { + http.Error(w, "Conversation not found", http.StatusNotFound) + return + } - rows, err := tx.QueryContext(ctx, ` - SELECT - id, - content, - created_at, - user_id = $1 AS mine - FROM messages - WHERE messages.conversation_id = $2 - ORDER BY messages.created_at DESC - `, authUserID, conversationID) - if err != nil { - respondError(w, fmt.Errorf("could not query messages: %v", err)) - return - } - defer rows.Close() + rows, err := tx.QueryContext(ctx, ` + SELECT + id, + content, + created_at, + user_id = $1 AS mine + FROM messages + WHERE messages.conversation_id = $2 + ORDER BY messages.created_at DESC + `, authUserID, conversationID) + if err != nil { + respondError(w, fmt.Errorf("could not query messages: %v", err)) + return + } + defer rows.Close() - messages := make([]Message, 0) - for rows.Next() { - var message Message - if err = rows.Scan( - &message.ID, - &message.Content, - &message.CreatedAt, - &message.Mine, - ); err != nil { - respondError(w, fmt.Errorf("could not scan message: %v", err)) - return - } + messages := make([]Message, 0) + for rows.Next() { + var message Message + if err = rows.Scan( + &message.ID, + &message.Content, + &message.CreatedAt, + &message.Mine, + ); err != nil { + respondError(w, fmt.Errorf("could not scan message: %v", err)) + return + } - messages = append(messages, message) - } + messages = append(messages, message) + } - if err = rows.Err(); err != nil { - respondError(w, fmt.Errorf("could not iterate over messages: %v", err)) - return - } + if err = rows.Err(); err != nil { + respondError(w, fmt.Errorf("could not iterate over messages: %v", err)) + return + } - if err = tx.Commit(); err != nil { - respondError(w, fmt.Errorf("could not commit tx to get messages: %v", err)) - return - } + if err = tx.Commit(); err != nil { + respondError(w, fmt.Errorf("could not commit tx to get messages: %v", err)) + return + } - go func() { - if err = updateMessagesReadAt(nil, authUserID, conversationID); err != nil { - log.Printf("could not update messages read at: %v\n", err) - } - }() + go func() { + if err = updateMessagesReadAt(nil, authUserID, conversationID); err != nil { + log.Printf("could not update messages read at: %v\n", err) + } + }() - respond(w, messages, http.StatusOK) + respond(w, messages, http.StatusOK) } ``` -首先,它以只读模式开始一个 SQL 事务。 检查参与者是否存在并查询所有消息。 在每条消息中,我们使用当前经过身份验证的用户 ID 来了解用户是否拥有该消息(`我的`)。 然后,它提交事务,在 goroutine 中更新参与者 `messages_read_at` 并以消息响应。 +首先,它以只读模式开始一个 SQL 事务。检查参与者是否存在,并查询所有消息。在每条消息中,我们使用当前经过身份验证的用户 ID 来了解用户是否拥有该消息(`mine`)。 然后,它提交事务,在 goroutine 中更新参与者 `messages_read_at` 并以消息响应。 -### 阅读消息 +### 读取消息 该端点处理对 `/api/conversations/{conversationID}/read_messages` 的 POST 请求。 没有任何请求或响应主体。 在前端,每次有新消息到达实时流时,我们都会发出此请求。 ``` func readMessages(w http.ResponseWriter, r *http.Request) { - ctx := r.Context() - authUserID := ctx.Value(keyAuthUserID).(string) - conversationID := way.Param(ctx, "conversationID") + ctx := r.Context() + authUserID := ctx.Value(keyAuthUserID).(string) + conversationID := way.Param(ctx, "conversationID") - if err := updateMessagesReadAt(ctx, authUserID, conversationID); err != nil { - respondError(w, fmt.Errorf("could not update messages read at: %v", err)) - return - } + if err := updateMessagesReadAt(ctx, authUserID, conversationID); err != nil { + respondError(w, fmt.Errorf("could not update messages read at: %v", err)) + return + } - w.WriteHeader(http.StatusNoContent) + w.WriteHeader(http.StatusNoContent) } ``` @@ -293,7 +292,7 @@ func readMessages(w http.ResponseWriter, r *http.Request) { 到此为止。实时消息是后台仅剩的部分了。请等待下一篇文章。 -[Souce Code][4] +- [源代码][4] -------------------------------------------------------------------------------- @@ -301,14 +300,14 @@ via: https://nicolasparada.netlify.com/posts/go-messenger-messages/ 作者:[Nicolás Parada][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/gxlct008) -校对:[校对者ID](https://github.com/校对者ID) +译者:[gxlct008](https://github.com/gxlct008) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://nicolasparada.netlify.com/ [b]: https://github.com/lujun9972 -[1]: https://nicolasparada.netlify.com/posts/go-messenger-schema/ -[2]: https://nicolasparada.netlify.com/posts/go-messenger-oauth/ -[3]: https://nicolasparada.netlify.com/posts/go-messenger-conversations/ +[1]: https://linux.cn/article-11396-1.html +[2]: https://linux.cn/article-11510-1.html +[3]: https://linux.cn/article-12056-1.html [4]: https://github.com/nicolasparada/go-messenger-demo From 0418939eaddef3afe4b6d61dfa0dea32d71a36e3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 4 Oct 2020 11:47:05 +0800 Subject: [PATCH 0317/1156] PUB @gxlct008 https://linux.cn/article-12680-1.html --- .../20180710 Building a Messenger App- Messages.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20180710 Building a Messenger App- Messages.md (99%) diff --git a/translated/tech/20180710 Building a Messenger App- Messages.md b/published/20180710 Building a Messenger App- Messages.md similarity index 99% rename from translated/tech/20180710 Building a Messenger App- Messages.md rename to published/20180710 Building a Messenger App- Messages.md index 473949a9ee..123ada14ba 100644 --- a/translated/tech/20180710 Building a Messenger App- Messages.md +++ b/published/20180710 Building a Messenger App- Messages.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (gxlct008) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12680-1.html) [#]: subject: (Building a Messenger App: Messages) [#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-messages/) [#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) From 36b977e7ac707d3b6b1bc5be242f55479ec7f32d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 4 Oct 2020 11:48:04 +0800 Subject: [PATCH 0318/1156] PRF --- published/20180710 Building a Messenger App- Messages.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/published/20180710 Building a Messenger App- Messages.md b/published/20180710 Building a Messenger App- Messages.md index 123ada14ba..2bd517bca5 100644 --- a/published/20180710 Building a Messenger App- Messages.md +++ b/published/20180710 Building a Messenger App- Messages.md @@ -10,6 +10,8 @@ 构建一个即时消息应用(四):消息 ====== +![](https://img.linux.net.cn/data/attachment/album/202010/04/114458z1p1188epequ686p.jpg) + 本文是该系列的第四篇。 * [第一篇: 模式][1] From 68ad8c5a2c46dcaba9e47a64674702bd72c9e871 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 4 Oct 2020 12:52:20 +0800 Subject: [PATCH 0319/1156] PRF @lxbwolf --- ... security issues in Go code using gosec.md | 171 +++++++----------- 1 file changed, 69 insertions(+), 102 deletions(-) diff --git a/translated/tech/20200923 Find security issues in Go code using gosec.md b/translated/tech/20200923 Find security issues in Go code using gosec.md index 4427aa7acf..7586966cf9 100644 --- a/translated/tech/20200923 Find security issues in Go code using gosec.md +++ b/translated/tech/20200923 Find security issues in Go code using gosec.md @@ -1,6 +1,6 @@ [#]: collector: "lujun9972" [#]: translator: "lxbwolf" -[#]: reviewer: " " +[#]: reviewer: "wxy" [#]: publisher: " " [#]: url: " " [#]: subject: "Find security issues in Go code using gosec" @@ -10,20 +10,21 @@ 使用 gosec 检查 Go 代码中的安全问题 ====== -来学习下 Golang 的安全检查工具 gosec。 -![A lock on the side of a building][1] +> 来学习下 Go 语言的安全检查工具 gosec。 + +![](https://img.linux.net.cn/data/attachment/album/202010/04/125129bh4qxxsyqpvqjtx4.jpg) [Go 语言][2]写的代码越来越常见,尤其是在容器、Kubernetes 或云生态相关的开发中。Docker 是最早采用 Golang 的项目之一,随后是 Kubernetes,之后大量的新项目在众多编程语言中选择了 Go。 -像其他语言一样,Go 也有它的长处和短处(如安全缺陷)。这些缺陷可能会因为语言本身的限制在程序员编码不当时出现,例如,C 代码中的内存安全问题。 +像其他语言一样,Go 也有它的长处和短处(如安全缺陷)。这些缺陷可能会因为语言本身的缺陷加上程序员编码不当而产生,例如,C 代码中的内存安全问题。 -无论它们出现的原因是什么,安全问题都应该在开发过程中尽早修复,以免在封装好的软件中出现。幸运的是,静态分析工具可以帮你批量地处理这些问题。静态分析工具通过解析用某种编程语言写的代码来找到问题。 +无论它们出现的原因是什么,安全问题都应该在开发过程的早期修复,以免在封装好的软件中出现。幸运的是,静态分析工具可以帮你以更可重复的方式处理这些问题。静态分析工具通过解析用某种编程语言写的代码来找到问题。 -这类工具中很多被称为 linter。传统意义上,linter 更注重的是检查代码中编码问题、bug、代码风格之类的问题,不会检查安全问题。例如,[Coverity][3] 是很受欢迎的用来检查 C/C++ 代码问题的工具。然而,有工具专门用来检查源码中的安全问题。例如,[Bandit][4] 用来检查 Python 代码中的安全缺陷。[gosec][5] 用来搜寻 Go 源码中的安全缺陷。gosec 通过扫描 Go 的 AST(抽象语法树abstract syntax tree)来检查源码中的安全问题。 +这类工具中很多被称为 linter。传统意义上,linter 更注重的是检查代码中编码问题、bug、代码风格之类的问题,它们可能不会发现代码中的安全问题。例如,[Coverity][3] 是一个很流行的工具,它可以帮助寻找 C/C++ 代码中的问题。然而,也有一些工具专门用来检查源码中的安全问题。例如,[Bandit][4] 可以检查 Python 代码中的安全缺陷。而 [gosec][5] 则用来搜寻 Go 源码中的安全缺陷。`gosec` 通过扫描 Go 的 AST(抽象语法树abstract syntax tree)来检查源码中的安全问题。 ### 开始使用 gosec -在开始学习和使用 gosec 之前,你需要准备一个 Go 语言写的项目。有这么多开源软件,我相信这不是问题。你可以在 GitHub 的 [Golang 库排行榜]][6]中找一个。 +在开始学习和使用 `gosec` 之前,你需要准备一个 Go 语言写的项目。有这么多开源软件,我相信这不是问题。你可以在 GitHub 的 [热门 Golang 仓库][6]中找一个。 本文中,我随机选了 [Docker CE][7] 项目,但你可以选择任意的 Go 项目。 @@ -31,57 +32,45 @@ 如果你还没安装 Go,你可以先从仓库中拉取下来。如果你用的是 Fedora 或其他基于 RPM 的 Linux 发行版本: - ``` -`$ dnf install golang.x86_64` +$ dnf install golang.x86_64 ``` 如果你用的是其他操作系统,请参照 [Golang 安装][8]页面。 使用 `version` 参数来验证 Go 是否安装成功: - ``` $ go version go version go1.14.6 linux/amd64 -$ ``` -运行 `go get` 命令就可以轻松地安装 gosec: - +运行 `go get` 命令就可以轻松地安装 `gosec`: ``` $ go get github.com/securego/gosec/cmd/gosec -$ ``` -上面这行命令会从 GitHub 下载 gosec 的源码、编译并安装到指定位置。在仓库的 README 中你还可以看到[安装工具的其他方法][9]。 - -gosec 的源码会被下载到 `$GOPATH` 的位置,编译出的二进制文件会被安装到你系统上设置的 `bin` 目录下。你可以运行下面的命令来查看 `$GOPATH` 和 `$GOBIN` 目录: +上面这行命令会从 GitHub 下载 `gosec` 的源码,编译并安装到指定位置。在仓库的 `README` 中你还可以看到[安装该工具的其他方法][9]。 +`gosec` 的源码会被下载到 `$GOPATH` 的位置,编译出的二进制文件会被安装到你系统上设置的 `bin` 目录下。你可以运行下面的命令来查看 `$GOPATH` 和 `$GOBIN` 目录: ``` $ go env | grep GOBIN GOBIN="/root/go/gobin" -$ $ go env | grep GOPATH GOPATH="/root/go" -$ ``` -如果 `go get` 命令执行成功,那么 gosec 二进制应该就可以使用了: - +如果 `go get` 命令执行成功,那么 `gosec` 二进制应该就可以使用了: ``` -$ $ ls -l ~/go/bin/ total 9260 -rwxr-xr-x. 1 root root 9482175 Aug 20 04:17 gosec -$ ``` -你可以把 `$GOPATH` 下的 `bin` 目录添加到 `$PATH` 中。这样你就可以像使用系统上的其他命令一样来使用 gosec 命令行工具(CLI)了。 - +你可以把 `$GOPATH` 下的 `bin` 目录添加到 `$PATH` 中。这样你就可以像使用系统上的其他命令一样来使用 `gosec` 命令行工具(CLI)了。 ``` $ which gosec @@ -89,8 +78,7 @@ $ which gosec $ ``` -使用 gosec 命令行工具的 `-help` 选项来看看运行是否符合预期: - +使用 `gosec` 命令行工具的 `-help` 选项来看看运行是否符合预期: ``` $ gosec -help @@ -109,17 +97,12 @@ USAGE: 之后,创建一个目录,把源码下载到这个目录作为实例项目(本例中,我用的是 Docker CE): - ``` $ mkdir gosec-demo -$ $ cd gosec-demo/ -$ $ pwd /root/gosec-demo -$ - -$ git clone +$ git clone https://github.com/docker/docker-ce.git Cloning into 'docker-ce'... remote: Enumerating objects: 1271, done. remote: Counting objects: 100% (1271/1271), done. @@ -128,10 +111,9 @@ remote: Total 431003 (delta 384), reused 981 (delta 318), pack-reused 429732 Receiving objects: 100% (431003/431003), 166.84 MiB | 28.94 MiB/s, done. Resolving deltas: 100% (221338/221338), done. Updating files: 100% (10861/10861), done. -$ ``` -代码统计工具(本例中用的是 cloc)显示这个项目大部分是用 Go 写的,恰好迎合了 gosec 的功能。 +代码统计工具(本例中用的是 `cloc`)显示这个项目大部分是用 Go 写的,恰好迎合了 `gosec` 的功能。 ``` @@ -140,9 +122,10 @@ $ ./cloc /root/gosec-demo/docker-ce/ 8724 unique files. 2560 files ignored. -\----------------------------------------------------------------------------------- + +----------------------------------------------------------------------------------- Language files blank comment code -\----------------------------------------------------------------------------------- +----------------------------------------------------------------------------------- Go 7222 190785 230478 1574580 YAML 37 4831 817 156762 Markdown 529 21422 0 67893 @@ -151,13 +134,11 @@ Protocol Buffers 149 5014 16562 10 ### 使用默认选项运行 gosec -在 Docker CE 项目中使用默认选项运行 gosec,执行 `gosec ./...` 命令。屏幕上会有很多输出内容。在末尾你会看到一个简短的 `Summary`,列出了浏览的文件数、所有文件的总行数,以及源码中发现的问题数。 - +在 Docker CE 项目中使用默认选项运行 `gosec`,执行 `gosec ./...` 命令。屏幕上会有很多输出内容。在末尾你会看到一个简短的 “Summary”,列出了浏览的文件数、所有文件的总行数,以及源码中发现的问题数。 ``` $ pwd /root/gosec-demo/docker-ce -$ $ time gosec ./... [gosec] 2020/08/20 04:44:15 Including rules: default [gosec] 2020/08/20 04:44:15 Excluding rules: default @@ -183,180 +164,166 @@ $ 滚动屏幕你会看到不同颜色高亮的行:红色表示需要尽快查看的高优先级问题,黄色表示中优先级的问题。 -#### 关于“假阳性” +#### 关于误判 -在开始检查代码之前,我想先分享几条基本原则。默认情况下,静态检查工具会基于一系列的规则对测试代码进行分析并报告出检查出来的*所有*问题。这表示工具报出来的每一个问题都需要修复吗?非也。这个问题最好的解答者是设计和开发这个软件的人。他们最熟悉代码,更重要的是,他们了解软件会在什么环境下部署以及会被怎样使用。 +在开始检查代码之前,我想先分享几条基本原则。默认情况下,静态检查工具会基于一系列的规则对测试代码进行分析,并报告出它们发现的*所有*问题。这是否意味着工具报出来的每一个问题都需要修复?非也。这个问题最好的解答者是设计和开发这个软件的人。他们最熟悉代码,更重要的是,他们了解软件会在什么环境下部署以及会被怎样使用。 -这个知识点对于判定工具标记出来的某段代码到底是不是安全缺陷至关重要。随着工作时间和经验的积累,你会慢慢学会怎样让静态分析工具忽略非安全缺陷,使报告内容的可执行性更高。因此,要判定 gosec 报出来的某个问题是否需要修复,让一名有经验的开发者对源码做人工审计会是比较好的办法。 +这个知识点对于判定工具标记出来的某段代码到底是不是安全缺陷至关重要。随着工作时间和经验的积累,你会慢慢学会怎样让静态分析工具忽略非安全缺陷,使报告内容的可执行性更高。因此,要判定 `gosec` 报出来的某个问题是否需要修复,让一名有经验的开发者对源码做人工审计会是比较好的办法。 #### 高优先级问题 -从输出内容看,gosec 发现了 Docker CE 的一个高优先级问题,它使用的是低版本的 TLS(传输层安全Transport Layer Security)。无论什么时候,使用软件和库的最新版本都是确保它更新及时、没有安全问题的最好的方法。 - +从输出内容看,`gosec` 发现了 Docker CE 的一个高优先级问题,它使用的是低版本的 TLS(传输层安全Transport Layer Security)。无论什么时候,使用软件和库的最新版本都是确保它更新及时、没有安全问题的最好的方法。 ``` [/root/gosec-demo/docker-ce/components/engine/daemon/logger/splunk/splunk.go:173] - G402 (CWE-295): TLS MinVersion too low. (Confidence: HIGH, Severity: HIGH) 172: - > 173: tlsConfig := &tls.Config{} + > 173: tlsConfig := &tls.Config{} 174: ``` -它还发现了一个伪随机数生成器。它是不是一个安全缺陷,取决于生成的随机数的使用方式。 - +它还发现了一个弱随机数生成器。它是不是一个安全缺陷,取决于生成的随机数的使用方式。 ``` [/root/gosec-demo/docker-ce/components/engine/pkg/namesgenerator/names-generator.go:843] - G404 (CWE-338): Use of weak random number generator (math/rand instead of crypto/rand) (Confidence: MEDIUM, Severity: HIGH) 842: begin: - > 843: name := fmt.Sprintf("%s_%s", left[rand.Intn(len(left))], right[rand.Intn(len(right))]) + > 843: name := fmt.Sprintf("%s_%s", left[rand.Intn(len(left))], right[rand.Intn(len(right))]) 844: if name == "boring_wozniak" /* Steve Wozniak is not boring */ { ``` #### 中优先级问题 -这个工具还发现了一些中优先级问题。它标记了一个通过与 tar 相关的解压炸弹这种方式实现的潜在的 DoS 威胁,这种方式可能会被恶意的攻击者利用。 - +这个工具还发现了一些中优先级问题。它标记了一个通过与 `tar` 相关的解压炸弹这种方式实现的潜在的 DoS 威胁,这种方式可能会被恶意的攻击者利用。 ``` [/root/gosec-demo/docker-ce/components/engine/pkg/archive/copy.go:357] - G110 (CWE-409): Potential DoS vulnerability via decompression bomb (Confidence: MEDIUM, Severity: MEDIUM) 356: - > 357: if _, err = io.Copy(rebasedTar, srcTar); err != nil { + > 357: if _, err = io.Copy(rebasedTar, srcTar); err != nil { 358: w.CloseWithError(err) ``` 它还发现了一个通过变量访问文件的问题。如果恶意使用者能访问这个变量,那么他们就可以改变变量的值去读其他文件。 - ``` [/root/gosec-demo/docker-ce/components/cli/cli/context/tlsdata.go:80] - G304 (CWE-22): Potential file inclusion via variable (Confidence: HIGH, Severity: MEDIUM) 79: if caPath != "" { - > 80: if ca, err = ioutil.ReadFile(caPath); err != nil { + > 80: if ca, err = ioutil.ReadFile(caPath); err != nil { 81: return nil, err ``` -文件和目录通常是操作系统安全的最基础的元素。这里,gosec 报出了一个可能需要你检查目录的权限是否安全的问题。 - +文件和目录通常是操作系统安全的最基础的元素。这里,`gosec` 报出了一个可能需要你检查目录的权限是否安全的问题。 ``` [/root/gosec-demo/docker-ce/components/engine/contrib/apparmor/main.go:41] - G301 (CWE-276): Expect directory permissions to be 0750 or less (Confidence: HIGH, Severity: MEDIUM) 40: // make sure /etc/apparmor.d exists - > 41: if err := os.MkdirAll(path.Dir(apparmorProfilePath), 0755); err != nil { + > 41: if err := os.MkdirAll(path.Dir(apparmorProfilePath), 0755); err != nil { 42: log.Fatal(err) ``` 你经常需要在源码中启动命令行工具。Go 使用内建的 exec 库来实现。仔细地分析用来调用这些工具的变量,就能发现安全缺陷。 - ``` [/root/gosec-demo/docker-ce/components/engine/testutil/fakestorage/fixtures.go:59] - G204 (CWE-78): Subprocess launched with variable (Confidence: HIGH, Severity: MEDIUM) 58: - > 59: cmd := exec.Command(goCmd, "build", "-o", filepath.Join(tmp, "httpserver"), "github.com/docker/docker/contrib/httpserver") + > 59: cmd := exec.Command(goCmd, "build", "-o", filepath.Join(tmp, "httpserver"), "github.com/docker/docker/contrib/httpserver") 60: cmd.Env = append(os.Environ(), []string{ ``` #### 低优先级问题 -在这个输出中,gosec 报出了一个 “unsafe” 调用相关的低优先级问题,这个调用会绕开 Go 提供的内存保护。再仔细分析下你调用 “unsafe” 的方式,看看是否有被别人利用的可能性。 - +在这个输出中,gosec 报出了一个 `unsafe` 调用相关的低优先级问题,这个调用会绕开 Go 提供的内存保护。再仔细分析下你调用 `unsafe` 的方式,看看是否有被别人利用的可能性。 ``` [/root/gosec-demo/docker-ce/components/engine/pkg/archive/changes_linux.go:264] - G103 (CWE-242): Use of unsafe calls should be audited (Confidence: HIGH, Severity: LOW) - 263: for len(buf) > 0 { - > 264: dirent := (*unix.Dirent)(unsafe.Pointer(&buf[0])) + 263: for len(buf) > 0 { + > 264: dirent := (*unix.Dirent)(unsafe.Pointer(&buf[0])) 265: buf = buf[dirent.Reclen:] + + [/root/gosec-demo/docker-ce/components/engine/pkg/devicemapper/devmapper_wrapper.go:88] - G103 (CWE-242): Use of unsafe calls should be audited (Confidence: HIGH, Severity: LOW) 87: func free(p *C.char) { - > 88: C.free(unsafe.Pointer(p)) + > 88: C.free(unsafe.Pointer(p)) 89: } ``` 它还标记了源码中未处理的错误。源码中出现的错误你都应该处理。 - ``` [/root/gosec-demo/docker-ce/components/cli/cli/command/image/build/context.go:172] - G104 (CWE-703): Errors unhandled. (Confidence: HIGH, Severity: LOW) 171: err := tar.Close() - > 172: os.RemoveAll(dockerfileDir) + > 172: os.RemoveAll(dockerfileDir) 173: return err ``` ### 自定义 gosec 扫描 -使用 gosec 的默认选项带来了很多的问题。然而,经过人工审计和随着时间推移,你会掌握哪些问题是不需要标记的。你可以自己指定排除和包含哪些测试。 +使用 `gosec` 的默认选项会带来很多的问题。然而,经过人工审计,随着时间推移你会掌握哪些问题是不需要标记的。你可以自己指定排除和包含哪些测试。 -我上面提到过,gosec 是基于一系列的规则从 Go 源码中查找问题的。下面是它使用的完整的[规则][10]列表: - - * G101:查找硬编码凭证 +我上面提到过,`gosec` 是基于一系列的规则从 Go 源码中查找问题的。下面是它使用的完整的[规则][10]列表: +- G101:查找硬编码凭证 - G102:绑定到所有接口 -- G103:审计不安全区块的使用 +- G103:审计 `unsafe` 块的使用 - G104:审计未检查的错误 -- G106:审计 ssh.InsecureIgnoreHostKey 的使用 -- G107: 提供给 HTTP 请求的 url 作为污点输入 -- G108: 统计端点自动暴露到 /debug/pprof -- G109: strconv.Atoi 转换到 int16 或 int32 时潜在的整数溢出 -- G110: 潜在的通过解压炸弹实现的 DoS +- G106:审计 `ssh.InsecureIgnoreHostKey` 的使用 +- G107: 提供给 HTTP 请求的 url 作为污点输入 +- G108: `/debug/pprof` 上自动暴露的剖析端点 +- G109: `strconv.Atoi` 转换到 int16 或 int32 时潜在的整数溢出 +- G110: 潜在的通过解压炸弹实现的 DoS - G201:SQL 查询构造使用格式字符串 - G202:SQL 查询构造使用字符串连接 - G203:在 HTML 模板中使用未转义的数据 -- G203:在HTML模板中使用未转义的数据 - G204:审计命令执行情况 - G301:创建目录时文件权限分配不合理 -- G302:chmod 文件权限分配不合理 +- G302:使用 `chmod` 时文件权限分配不合理 - G303:使用可预测的路径创建临时文件 -- G304:作为污点输入提供的文件路径 +- G304:通过污点输入提供的文件路径 - G305:提取 zip/tar 文档时遍历文件 -- G306: 写到新文件时文件权限分配不合理 -- G307: 把返回错误的函数放到 defer 内 -- G401:检测 DES、RC4、MD5 或 SHA1 的使用情况 +- G306: 写到新文件时文件权限分配不合理 +- G307: 把返回错误的函数放到 `defer` 内 +- G401:检测 DES、RC4、MD5 或 SHA1 的使用 - G402:查找错误的 TLS 连接设置 - G403:确保最小 RSA 密钥长度为 2048 位 -- G404:不安全的随机数源(rand) +- G404:不安全的随机数源(`rand`) - G501:导入黑名单列表:crypto/md5 - G502:导入黑名单列表:crypto/des - G503:导入黑名单列表:crypto/rc4 - G504:导入黑名单列表:net/http/cgi - G505:导入黑名单列表:crypto/sha1 -- G601: 在 range 语句中使用隐式的元素别名 - - +- G601: 在 `range` 语句中使用隐式的元素别名 #### 排除指定的测试 -你可以自定义 gosec 来避免对已知为安全的问题进行扫描和报告。你可以使用 `-exclude` 选项和上面的规则编号来忽略指定的问题。 - -例如,如果你不想让 gosec 检查源码中硬编码凭证相关的未处理的错误,那么你可以运行下面的命令来忽略这些错误: +你可以自定义 `gosec` 来避免对已知为安全的问题进行扫描和报告。你可以使用 `-exclude` 选项和上面的规则编号来忽略指定的问题。 +例如,如果你不想让 `gosec` 检查源码中硬编码凭证相关的未处理的错误,那么你可以运行下面的命令来忽略这些错误: ``` $ gosec -exclude=G104 ./... $ gosec -exclude=G104,G101 ./... ``` -有时候你知道某段代码是安全的,但是 gosec 还是会报出问题。然而,你又不想完全排除掉整个检查,因为你想让 gosec 检查新增的代码。通过在你已知为安全的代码块添加 `#nosec` 标记可以避免 gosec 扫描。这样 gosec 会继续扫描新增代码,而忽略掉 `#nosec` 标记的代码块。 +有时候你知道某段代码是安全的,但是 `gosec` 还是会报出问题。然而,你又不想完全排除掉整个检查,因为你想让 `gosec` 检查新增的代码。通过在你已知为安全的代码块添加 `#nosec` 标记可以避免 `gosec` 扫描。这样 `gosec` 会继续扫描新增代码,而忽略掉 `#nosec` 标记的代码块。 #### 运行指定的检查 -另一方面,如果你只想检查指定的问题,你可以通过 `-include` 选项和规则编号来告诉 gosec 运行哪些检查: - +另一方面,如果你只想检查指定的问题,你可以通过 `-include` 选项和规则编号来告诉 `gosec` 运行哪些检查: ``` -`$ gosec -include=G201,G202 ./...` +$ gosec -include=G201,G202 ./... ``` #### 扫描测试文件 -Go 语言自带对测试的支持,通过单元测试来检验一个元素是否符合预期。在默认模式下,gosec 会忽略测试文件,你可以使用 `-tests` 选项把它们包含进来: - +Go 语言自带对测试的支持,通过单元测试来检验一个元素是否符合预期。在默认模式下,`gosec` 会忽略测试文件,你可以使用 `-tests` 选项把它们包含进来: ``` -`gosec -tests ./...` +gosec -tests ./... ``` #### 修改输出的格式 -找出问题只是它的一半功能;另一半功能是把它检查到的问题以用户友好同时又方便工具处理的方式报告出来。幸运的是,gosec 可以用不同的方式输出。例如,如果你想看 JSON 格式的报告,那么就使用 `-fmt` 选项指定 JSON 格式并把结果保存到 `results.json` 文件中: - +找出问题只是它的一半功能;另一半功能是把它检查到的问题以用户友好同时又方便工具处理的方式报告出来。幸运的是,`gosec` 可以用不同的方式输出。例如,如果你想看 JSON 格式的报告,那么就使用 `-fmt` 选项指定 JSON 格式并把结果保存到 `results.json` 文件中: ``` $ gosec -fmt=json -out=results.json ./... @@ -370,7 +337,7 @@ $ "confidence": "HIGH", "cwe": { "ID": "242", - "URL": "" + "URL": "https://cwe.mitre.org/data/definitions/242.html" }, "rule_id": "G103", "details": "Use of unsafe calls should be audited", @@ -381,9 +348,9 @@ $ }, ``` -### 用 gosec 检查容易暴露出来的问题 +### 用 gosec 检查容易被发现的问题 -静态检查工具不能完全代替人工代码审计。然而,当代码量变大、有众多开发者时,这样的工具通常能用批量的方式帮忙找出容易暴露的问题。它对于帮助新开发者识别和在编码时避免引入这些安全缺陷很有用。 +静态检查工具不能完全代替人工代码审计。然而,当代码量变大、有众多开发者时,这样的工具往往有助于以可重复的方式找出容易被发现的问题。它对于帮助新开发者识别和在编码时避免引入这些安全缺陷很有用。 -------------------------------------------------------------------------------- @@ -392,7 +359,7 @@ via: https://opensource.com/article/20/9/gosec 作者:[Gaurav Kamathe][a] 选题:[lujun9972][b] 译者:[lxbowlf](https://github.com/lxbwolf) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From af6d6aa6f02a6bd2c35536273bd88143b56f9124 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 4 Oct 2020 12:52:53 +0800 Subject: [PATCH 0320/1156] PUB @lxbwolf https://linux.cn/article-12681-1.html --- .../20200923 Find security issues in Go code using gosec.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200923 Find security issues in Go code using gosec.md (99%) diff --git a/translated/tech/20200923 Find security issues in Go code using gosec.md b/published/20200923 Find security issues in Go code using gosec.md similarity index 99% rename from translated/tech/20200923 Find security issues in Go code using gosec.md rename to published/20200923 Find security issues in Go code using gosec.md index 7586966cf9..a18b93ad79 100644 --- a/translated/tech/20200923 Find security issues in Go code using gosec.md +++ b/published/20200923 Find security issues in Go code using gosec.md @@ -1,8 +1,8 @@ [#]: collector: "lujun9972" [#]: translator: "lxbwolf" [#]: reviewer: "wxy" -[#]: publisher: " " -[#]: url: " " +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12681-1.html" [#]: subject: "Find security issues in Go code using gosec" [#]: via: "https://opensource.com/article/20/9/gosec" [#]: author: "Gaurav Kamathe https://opensource.com/users/gkamathe" From 7733217f5f14f5e811eda1810780e3a9eef10f98 Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Sun, 4 Oct 2020 13:05:12 +0800 Subject: [PATCH 0321/1156] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=AF=91=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ding a Messenger App- Development Login.md | 51 +++++++++---------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/sources/tech/20180712 Building a Messenger App- Development Login.md b/sources/tech/20180712 Building a Messenger App- Development Login.md index fea6bddcfa..f534721640 100644 --- a/sources/tech/20180712 Building a Messenger App- Development Login.md +++ b/sources/tech/20180712 Building a Messenger App- Development Login.md @@ -7,32 +7,31 @@ [#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-dev-login/) [#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) -Building a Messenger App: Development Login +构建一个即时消息应用(六):仅用于开发的登录 ====== -This post is the 6th on a series: +本文是该系列的第六篇。 - * [Part 1: Schema][1] - * [Part 2: OAuth][2] - * [Part 3: Conversations][3] - * [Part 4: Messages][4] - * [Part 5: Realtime Messages][5] + * [第一篇: 模式][1] + * [第二篇: OAuth][2] + * [第三篇: 对话][3] + * [第四篇: 消息][4] + * [第五篇: 实时消息][5] +我们已经实现了通过 GitHub 登录,但是如果想把玩一下这个 app,我们需要几个用户来测试它。在这篇文章中,我们将添加一个为任何用户提供登录的端点,只需提供用户名即可。该端点仅用于开发。 -We already implemented login through GitHub, but if we want to play around with the app, we need a couple of users to test it. In this post we’ll add an endpoint to login as any user just giving an username. This endpoint will be just for development. +首先在 `main()` 函数中添加此路由。 -Start by adding this route in the `main()` function. - -``` +```go router.HandleFunc("POST", "/api/login", requireJSON(login)) ``` -### Login +### 登录 -This function handles POST requests to `/api/login` with a JSON body with just an username and returns the authenticated user, a token and expiration date of it in JSON format. +此函数处理对 `/api/login` 的 POST 请求,其中 JSON body 只包含用户名,并以 JSON 格式返回通过认证的用户、令牌和过期日期。 -``` +```go func login(w http.ResponseWriter, r *http.Request) { if origin.Hostname() != "localhost" { http.NotFound(w, r) @@ -81,9 +80,9 @@ func login(w http.ResponseWriter, r *http.Request) { } ``` -First it checks we are on localhost or it responds with `404 Not Found`. It decodes the body skipping validation since this is just for development. Then it queries to the database for a user with the given username, if none is found, it returns with `404 Not Found`. Then it issues a new JSON web token using the user ID as Subject. +首先,它检查我们是否在本地主机上,或者响应为 `404 Not Found`。它解码主体跳过验证,因为这只是为了开发。然后在数据库中查询给定用户名的用户,如果没有,则返回 `404 NOT Found`。然后,它使用用户 ID 作为主题发布一个新的 JSON Web 令牌。 -``` +```go func issueToken(subject string, exp time.Time) (string, error) { token, err := jwtSigner.Encode(jwt.Claims{ Subject: subject, @@ -96,31 +95,31 @@ func issueToken(subject string, exp time.Time) (string, error) { } ``` -The function does the same we did [previously][2]. I just moved it to reuse code. +该函数执行的操作与 [前文][2] 相同。我只是将其移过来以重用代码。 -After creating the token, it responds with the user, token and expiration date. +创建令牌后,它将使用用户、令牌和到期日期进行响应。 -### Seed Users +### 种子用户 -Now you can add users to play with to the database. +现在,您可以将要操作的用户添加到数据库中。 -``` +```sql INSERT INTO users (id, username) VALUES (1, 'john'), (2, 'jane'); ``` -You can save it to a file and pipe it to the Cockroach CLI. +您可以将其保存到文件中,并通过管道将其传送到 Cockroach CLI。 -``` +```bash cat seed_users.sql | cockroach sql --insecure -d messenger ``` * * * -That’s it. Once you deploy the code to production and use your own domain this login function won’t be available. +就是这样。一旦将代码部署到生产环境并使用自己的域后,该登录功能将不可用。 -This post concludes the backend. +本文也结束了所有的后端开发部分。 [Souce Code][6] @@ -130,7 +129,7 @@ via: https://nicolasparada.netlify.com/posts/go-messenger-dev-login/ 作者:[Nicolás Parada][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[译者ID](https://github.com/gxlct008) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From c7460ef66b5d074bfb802c3271b89c81ff7c7a81 Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Sun, 4 Oct 2020 13:06:39 +0800 Subject: [PATCH 0322/1156] =?UTF-8?q?=E5=B0=86=E8=AF=91=E6=96=87=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E5=88=B0=20translated/tech/=20=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20180712 Building a Messenger App- Development Login.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20180712 Building a Messenger App- Development Login.md (100%) diff --git a/sources/tech/20180712 Building a Messenger App- Development Login.md b/translated/tech/20180712 Building a Messenger App- Development Login.md similarity index 100% rename from sources/tech/20180712 Building a Messenger App- Development Login.md rename to translated/tech/20180712 Building a Messenger App- Development Login.md From 6ad37915d5fd624b436d310f2d5658e30ed05236 Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Sun, 4 Oct 2020 13:10:48 +0800 Subject: [PATCH 0323/1156] =?UTF-8?q?=E7=94=B3=E9=A2=86=E5=8E=9F=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/tech/20180716 Building a Messenger App- Access Page.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20180716 Building a Messenger App- Access Page.md b/sources/tech/20180716 Building a Messenger App- Access Page.md index 21671b92f6..22c53dde6d 100644 --- a/sources/tech/20180716 Building a Messenger App- Access Page.md +++ b/sources/tech/20180716 Building a Messenger App- Access Page.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (gxlct008) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From fc0b2e2cd821cac145b26b3ffde4e179c7797380 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 5 Oct 2020 05:01:38 +0800 Subject: [PATCH 0324/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201005?= =?UTF-8?q?=20Linux=20Jargon=20Buster:=20What=20is=20a=20Package=20Manager?= =?UTF-8?q?=20in=20Linux=3F=20How=20Does=20it=20Work=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md --- ...kage Manager in Linux- How Does it Work.md | 110 ++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 sources/tech/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md diff --git a/sources/tech/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md b/sources/tech/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md new file mode 100644 index 0000000000..258848f4e9 --- /dev/null +++ b/sources/tech/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md @@ -0,0 +1,110 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux Jargon Buster: What is a Package Manager in Linux? How Does it Work?) +[#]: via: (https://itsfoss.com/package-manager/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Linux Jargon Buster: What is a Package Manager in Linux? How Does it Work? +====== + +One of the main points [how Linux distributions differ from each other][1] is the package management. In this part of the Linux jargon buster series, you’ll learn about packaging and package managers in Linux. You’ll learn what are packages, what are package managers and how do they work and what kind of package managers available. + +### What is a package manager in Linux? + +In simpler words, a package manager is a tool that allows users to install, remove, upgrade, configure and manage software packages on an operating system. The package manager can be a graphical application like a software center or a command line tool like [apt-get][2] or [pacman][3]. + +You’ll often find me using the term ‘package’ in tutorials and articles on It’s FOSS. To understand package manager, you must understand what a package is. + +### What is a package? + +A package is usually referred to an application but it could be a GUI application, command line tool or a software library (required by other software programs). A package is essentially an archive file containing the binary executable, configuration file and sometimes information about the dependencies. + +In older days, [software used to installed from its source code][4]. You would refer to a file (usually named readme) and see what software components it needs, location of binaries. A configure script or makefile is often included. You will have to compile the software or on your own along with handling all the dependencies (some software require installation of other software) on your own. + +To get rid of this complexity, Linux distributions created their own packaging format to provide the end users ready-to-use binary files (precompiled software) for installing software along with some [metadata][5] (version number, description) and dependencies. + +It is like baking a cake versus buying a cake. + +![][6] + +Around mid 90s, Debian created .deb or DEB packaging format and Red Hat Linux created .rpm or RPM (short for Red Hat Package Manager) packaging system. Compiling source code still exists but it is optional now. + +To interact with or use the packaging systems, you need a package manager. + +### How does the package manager work? + +Please keep in mind that package manager is a generic concept and it’s not exclusive to Linux. You’ll often find package manager for different software or programming languages. There is [PIP package manager just for Python packages][7]. Even [Atom editor has its own package manager][8]. + +Since the focus in this article is on Linux, I’ll take things from Linux’s perspective. However, most of the explanation here could be applied to package manager in general as well. + +I have created this diagram (based on SUSE Wiki) so that you can easily understand how a package manager works. + +![][9] + +Almost all Linux distributions have software repositories which is basically collection of software packages. Yes, there could be more than one repository. The repositories contain software packages of different kind. + +Repositories also have metadata files that contain information about the packages such as the name of the package, version number, description of package and the repository name etc. This is what you see if you use the [apt show command][10] in Ubuntu/Debian. + +Your system’s package manager first interacts with the metadata. The package manager creates a local cache of metadata on your system. When you run the update option of the package manager (for example apt update), it updates this local cache of metadata by referring to metadata from the repository. + +When you run the installation command of your package manager (for example apt install package_name), the package manager refers to this cache. If it finds the package information in the cache, it uses the internet connection to connect to the appropriate repository and downloads the package first before installing on your system. + +A package may have dependencies. Meaning that it may require other packages to be installed. The package manager often takes care of the dependencies and installs it automatically along with the package you are installing. + +![Package Manager Handling Dependencies In Linux][11] + +Similarly, when you remove a package using the package manager, it either automatically removes or informs you that your system has unused packages that can be cleaned. + +Apart from the obvious tasks of installing, removing, you can use the package manager to configure the packages and manage them as per your need. For example, you can [prevent the upgrade of a package version][12] from the regular system updates. There are many more things your package manager might be capable of. + +### Different kinds of package managers + +Package Managers differ based on packaging system but same packaging system may have more than one package manager. + +For example, RPM has [Yum][13] and [DNF][14] package managers. For DEB, you have apt-get, [aptitude][15] command line based package managers. + +![Synaptic package manager][16] + +Package managers are not necessarily command line based. You have graphical package managing tools like [Synaptic][17]. Your distribution’s software center is also a package manager even if it runs apt-get or DNF underneath. + +### Conclusion + +I don’t want to go in further detail on this topic because I can go on and on. But it will deviate from the objective of the topic which is to give you a basic understanding of package manager in Linux. + +I have omitted the new universal packaging formats like Snap and Flatpak for now. + +I do hope that you have a bit better understanding of the package management system in Linux. If you are still confused or if you have some questions on this topic, please use the comment system. I’ll try to answer your questions and if required, update this article with new points. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/package-manager/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/what-is-linux/ +[2]: https://itsfoss.com/apt-vs-apt-get-difference/ +[3]: https://itsfoss.com/pacman-command/ +[4]: https://itsfoss.com/install-software-from-source-code/ +[5]: https://www.computerhope.com/jargon/m/metadata.htm +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/source-code-comilation-vs-packaging.png?resize=800%2C450&ssl=1 +[7]: https://itsfoss.com/install-pip-ubuntu/ +[8]: https://itsfoss.com/install-packages-in-atom/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/linux-package-manager-explanation.png?resize=800%2C450&ssl=1 +[10]: https://itsfoss.com/apt-search-command/ +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/package-manager-handling-dependencies-in-linux.png?resize=800%2C450&ssl=1 +[12]: https://itsfoss.com/prevent-package-update-ubuntu/ +[13]: https://fedoraproject.org/wiki/Yum +[14]: https://fedoraproject.org/wiki/DNF +[15]: https://wiki.debian.org/Aptitude +[16]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/see-packages-by-repositories-synaptic.png?resize=799%2C548&ssl=1 +[17]: https://itsfoss.com/synaptic-package-manager/ From 8b9bbaa7857b7974d5e8c991c5b021a18460b031 Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Mon, 5 Oct 2020 07:53:12 +0800 Subject: [PATCH 0325/1156] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=AF=91=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...6 Building a Messenger App- Access Page.md | 115 +++++++++--------- 1 file changed, 59 insertions(+), 56 deletions(-) diff --git a/sources/tech/20180716 Building a Messenger App- Access Page.md b/sources/tech/20180716 Building a Messenger App- Access Page.md index 22c53dde6d..1e195a4b55 100644 --- a/sources/tech/20180716 Building a Messenger App- Access Page.md +++ b/sources/tech/20180716 Building a Messenger App- Access Page.md @@ -7,25 +7,23 @@ [#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-access-page/) [#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) -Building a Messenger App: Access Page +构建一个即时消息应用(七):Access 页面 ====== -This post is the 7th on a series: +本文是该系列的第七篇。 - * [Part 1: Schema][1] - * [Part 2: OAuth][2] - * [Part 3: Conversations][3] - * [Part 4: Messages][4] - * [Part 5: Realtime Messages][5] - * [Part 6: Development Login][6] + * [第一篇: 模式][1] + * [第二篇: OAuth][2] + * [第三篇: 对话][3] + * [第四篇: 消息][4] + * [第五篇: 实时消息][5] + * [第六篇: 仅用于开发的登录][6] +现在我们已经完成了后端,让我们转到前端。 我将采用单页应用程序方案。 +首先,我们创建一个 `static/index.html` 文件,内容如下。 -Now that we’re done with the backend, lets move to the frontend. I will go with a single-page application. - -Lets start by creating a file `static/index.html` with the following content. - -``` +```html @@ -40,11 +38,11 @@ Lets start by creating a file `static/index.html` with the following content. ``` -This HTML file must be server for every URL and JavaScript will take care of rendering the correct page. +这个 HTML 文件必须为每个 URL 提供服务,并且将使用 JavaScript 负责呈现正确的页面。 -So lets go the the `main.go` for a moment and in the `main()` function add the following route: +因此,让我们将注意力转到 `main.go` 片刻,然后在 `main()` 函数中添加以下路由: -``` +```go router.Handle("GET", "/...", http.FileServer(SPAFileSystem{http.Dir("static")})) type SPAFileSystem struct { @@ -60,15 +58,15 @@ func (spa SPAFileSystem) Open(name string) (http.File, error) { } ``` -We use a custom file system so instead of returning `404 Not Found` for unknown URLs, it serves the `index.html`. +我们使用一个自定义的文件系统,因此它不是为未知的 URL 返回 `404 Not Found`,而是转到 `index.html`。 -### Router +### 路由器 -In the `index.html` we loaded two files: `styles.css` and `main.js`. I leave styling to your taste. +在 `index.html` 中我们加载了两个文件:`styles.css` 和 `main.js`。我把样式留给你自由发挥。 -Lets move to `main.js`. Create a `static/main.js` file with the following content: +让我们移动到 `main.js`。 创建一个包含以下内容的 `static/main.js` 文件: -``` +```javascript import { guard } from './auth.js' import Router from './router.js' @@ -98,19 +96,22 @@ function view(pageName) { } ``` -If you are follower of this blog, you already know how this works. That router is the one showed [here][7]. Just download it from [@nicolasparada/router][8] and save it to `static/router.js`. +如果您是这个博客的关注者,您已经知道它是如何工作的了。 该路由器就是在 [这里][7] 显示的那个。 只需从 [@nicolasparada/router][8] 下载并保存到 `static/router.js` 即可。 We registered four routes. At the root `/` we show the home or access page whether the user is authenticated. At `/callback` we show the callback page. On `/conversations/{conversationID}` we show the conversation or access page whether the user is authenticated and for every other URL, we show a not found page. -We tell the router to render the result to the document body and dispatch a `disconnect` event to each page before leaving. +我们注册了四条路由。 在根路由 `/` 处,我们展示 home 或 access 页面,无论用户是否通过身份验证。 在 `/callback` 中,我们展示 callback 页面。 在 `/conversations/{conversationID}` 上,我们展示对话或 access 页面,无论用户是否通过验证,对于其他 URL,我们展示一个 not found 页面。 -We have each page in a different file and we import them with the new dynamic `import()`. +我们告诉路由器将结果渲染为文档主体,并在离开之前向每个页面调度一个 `disconnect` 事件。 -### Auth +我们将每个页面放在不同的文件中,并使用新的动态 `import()` 函数导入它们。 -`guard()` is a function that given two functions, executes the first one if the user is authenticated, or the sencond one if not. It comes from `auth.js` so lets create a `static/auth.js` file with the following content: +### 身份验证 -``` +`guard()` 是一个函数,给它两个函数作为参数,如果用户通过了身份验证,则执行第一个函数,否则执行第二个。 +它来自 `auth.js`,所以我们创建一个包含以下内容的 `static/auth.js` 文件: + +```javascript export function isAuthenticated() { const token = localStorage.getItem('token') const expiresAtItem = localStorage.getItem('expires_at') @@ -150,17 +151,17 @@ export function getAuthUser() { } ``` -`isAuthenticated()` checks for `token` and `expires_at` from localStorage to tell if the user is authenticated. `getAuthUser()` gets the authenticated user from localStorage. +`isAuthenticated()` 检查 localStorage 中的 `token` 和 `expires_at`,以判断用户是否已通过身份验证。`getAuthUser()` 从 localStorage 中获取经过身份验证的用户。 -When we login, we’ll save all the data to localStorage so it will make sense. +当我们登录时,我们会将所有的数据保存到 localStorage,这样才有意义。 -### Access Page +### Access 页面 ![access page screenshot][9] -Lets start with the access page. Create a file `static/pages/access-page.js` with the following content: +让我们从 access 页面开始。 创建一个包含以下内容的文件 `static/pages/access-page.js`: -``` +```javascript const template = document.createElement('template') template.innerHTML = `

Messenger

@@ -172,15 +173,15 @@ export default function accessPage() { } ``` -Because the router intercepts all the link clicks to do its navigation, we must prevent the event propagation for this link in particular. +因为路由器会拦截所有链接点击来进行导航,所以我们必须特别阻止此链接的事件传播。 -Clicking on that link will redirect us to the backend, then to GitHub, then to the backend and then to the frontend again; to the callback page. +单击该链接会将我们重定向到后端,然后重定向到 GitHub,再重定向到后端,然后再次重定向到前端; 到 callback 页面。 -### Callback Page +### Callback 页面 -Create the file `static/pages/callback-page.js` with the following content: +创建包括以下内容的 `static/pages/callback-page.js` 文件: -``` +```javascript import http from '../http.js' import { navigate } from '../router.js' @@ -211,13 +212,13 @@ function getAuthUser(token) { } ``` -The callback page doesn’t render anything. It’s an async function that does a GET request to `/api/auth_user` using the token from the URL query string and saves all the data to localStorage. Then it redirects to `/`. +callback 页面不呈现任何内容。这是一个异步函数,它使用 URL 查询字符串中的 token 向 `/api/auth_user` 发出 GET 请求,并将所有数据保存到 localStorage。 然后重定向到 `/`。 ### HTTP -There is an HTTP module. Create a `static/http.js` file with the following content: +这里是一个 HTTP 模块。 创建一个包含以下内容的 `static/http.js` 文件: -``` +```javascript import { isAuthenticated } from './auth.js' async function handleResponse(res) { @@ -297,15 +298,15 @@ export default { } ``` -This module is a wrapper around the [fetch][10] and [EventSource][11] APIs. The most important part is that it adds the JSON web token to the requests. +这个模块是 [fetch][10] 和 [EventSource][11] API 的包装器。最重要的部分是它将 JSON web 令牌添加到请求中。 -### Home Page +### Home 页面 ![home page screenshot][12] -So, when the user login, the home page will be shown. Create a `static/pages/home-page.js` file with the following content: +因此,当用户登录时,将显示主页。 创建一个具有以下内容的 `static/pages/home-page.js` 文件: -``` +```javascript import { getAuthUser } from '../auth.js' import { avatar } from '../shared.js' @@ -334,15 +335,15 @@ function onLogoutClick() { } ``` -For this post, this is the only content we render on the home page. We show the current authenticated user and a logout button. +对于这篇文章,这是我们在主页上呈现的唯一内容。我们显示当前经过身份验证的用户和注销按钮。 -When the user clicks to logout, we clear all inside localStorage and do a reload of the page. +当用户单击注销时,我们清除 localStorage 中的所有内容并重新加载页面。 ### Avatar -That `avatar()` function is to show the user’s avatar. Because it’s used in more than one place, I moved it to a `shared.js` file. Create the file `static/shared.js` with the following content: +那个 `avatar()` 函数用于显示用户的头像。 由于已在多个地方使用,因此我将它移到 `shared.js` 文件中。 创建具有以下内容的文件 `static/shared.js`: -``` +```javascript export function avatar(user) { return user.avatarUrl === null ? `
` @@ -351,22 +352,24 @@ export function avatar(user) { ``` We use a small figure with the user’s initial in case the avatar URL is null. +如果头像网址为 null,我们将使用用户的姓名首字母作为初始头像。 +您可以使用 `attr()` 函数显示带有少量 CSS 样式的首字母。 You can show the initial with a little of CSS using the `attr()` function. -``` +```css .avatar[data-initial]::after { content: attr(data-initial); } ``` -### Development Login +### 仅开发使用的登录 ![access page with login form screenshot][13] -In the previous post we coded a login for development. Lets add a form for that in the access page. Go to `static/pages/access-page.js` and modify it a little. +在上一篇文章中,我们为编写了一个登录代码。让我们在 access 页面中为此添加一个表单。 进入 `static/ages/access-page.js`,稍微修改一下。 -``` +```javascript import http from '../http.js' const template = document.createElement('template') @@ -420,13 +423,13 @@ function login(username) { } ``` -I added a login form. When the user submits the form. It does a POST requets to `/api/login` with the username. Saves all the data to localStorage and reloads the page. +我添加了一个登录表单。当用户提交表单时。它使用用户名对 `/api/login` 进行 POST 请求。将所有数据保存到 localStorage 并重新加载页面。 -Remember to remove this form once you are done with the frontend. +记住在前端完成后删除此表单。 * * * -That’s all for this post. In the next one, we’ll continue with the home page to add a form to start conversations and display a list with the latest ones. +这就是这篇文章的全部内容。在下一篇文章中,我们将继续使用主页添加一个表单来开始对话,并显示包含最新对话的列表。 [Souce Code][14] @@ -436,7 +439,7 @@ via: https://nicolasparada.netlify.com/posts/go-messenger-access-page/ 作者:[Nicolás Parada][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[译者ID](https://github.com/gxlct008) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 47fe8b0b351adf7ad35eb3704596ee7a9c7070e9 Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Mon, 5 Oct 2020 07:55:45 +0800 Subject: [PATCH 0326/1156] =?UTF-8?q?=E5=B0=86=E8=AF=91=E6=96=87=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E5=88=B0=20translated/tech/=20=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20180716 Building a Messenger App- Access Page.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20180716 Building a Messenger App- Access Page.md (100%) diff --git a/sources/tech/20180716 Building a Messenger App- Access Page.md b/translated/tech/20180716 Building a Messenger App- Access Page.md similarity index 100% rename from sources/tech/20180716 Building a Messenger App- Access Page.md rename to translated/tech/20180716 Building a Messenger App- Access Page.md From 5cffaf4d7181867c36d9140efcf375fcc9ea62df Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Mon, 5 Oct 2020 07:59:37 +0800 Subject: [PATCH 0327/1156] =?UTF-8?q?=E7=94=B3=E9=A2=86=E5=8E=9F=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/tech/20180719 Building a Messenger App- Home Page.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20180719 Building a Messenger App- Home Page.md b/sources/tech/20180719 Building a Messenger App- Home Page.md index ddec2c180f..991b9ebe35 100644 --- a/sources/tech/20180719 Building a Messenger App- Home Page.md +++ b/sources/tech/20180719 Building a Messenger App- Home Page.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (gxlct008) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From a3cce7c43663a938700e8b345c3c9a3cd21c22a7 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 5 Oct 2020 09:18:32 +0800 Subject: [PATCH 0328/1156] PRF @gxlct008 --- ...ding a Messenger App- Realtime Messages.md | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/translated/tech/20180710 Building a Messenger App- Realtime Messages.md b/translated/tech/20180710 Building a Messenger App- Realtime Messages.md index 12454897e5..4bcbec8b45 100644 --- a/translated/tech/20180710 Building a Messenger App- Realtime Messages.md +++ b/translated/tech/20180710 Building a Messenger App- Realtime Messages.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (gxlct008) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Building a Messenger App: Realtime Messages) @@ -10,6 +10,8 @@ 构建一个即时消息应用(五):实时消息 ====== +![](https://img.linux.net.cn/data/attachment/album/202010/05/091113edbuavorm89looja.jpg) + 本文是该系列的第五篇。 * [第一篇: 模式][1] @@ -17,8 +19,7 @@ * [第三篇: 对话][3] * [第四篇: 消息][4] - -对于实时消息,我们将使用 [服务器发送事件 (Server-Sent Events)][5]。这是一个开放的连接,我们可以在其中传输数据。我们将拥有用户订阅发送给他的所有消息的和端点。 +对于实时消息,我们将使用 [服务器发送事件][5]Server-Sent Events。这是一个打开的连接,我们可以在其中传输数据流。我们会有个端点,用户会在其中订阅发送给他的所有消息。 ### 消息户端 @@ -69,7 +70,7 @@ func broadcastMessage(message Message) { } ``` -该函数查询收件人 ID (其他参与者 ID),并将消息发送给所有客户端。 +该函数查询接收者 ID(其他参与者 ID),并将消息发送给所有客户端。 ### 订阅消息 @@ -126,8 +127,7 @@ func subscribeToMessages(w http.ResponseWriter, r *http.Request) { } ``` -首先,它检查请求头是否正确,并检查服务器是否支持流式传输。我们创建一个消息通道,用它来构建一个客户端,并将其存储在客户端 map 中。每当创建新消息时,它都会进入这个通道,因此我们可以通过 `for-select` 循环从中读取。 - +首先,它检查请求头是否正确,并检查服务器是否支持流式传输。我们创建一个消息通道,用它来构建一个客户端,并将其存储在客户端映射中。每当创建新消息时,它都会进入这个通道,因此我们可以通过 `for-select` 循环从中读取。 服务器发送事件Server-Sent Events使用以下格式发送数据: @@ -141,17 +141,17 @@ data: some data here\n\n data: {"foo":"bar"}\n\n ``` -我们使用 `fmt.Fprintf()` 以这种格式写入响应写入器,并在循环的每次迭代中刷新数据。 +我们使用 `fmt.Fprintf()` 以这种格式写入响应写入器writter,并在循环的每次迭代中刷新数据。 -这个循环会一直运行,直到使用请求上下文关闭连接为止。我们延迟了通道的关闭和客户端的删除,因此,当循环结束时,频道将被关闭,客户端将不会收到更多的消息。 +这个循环会一直运行,直到使用请求上下文关闭连接为止。我们延迟了通道的关闭和客户端的删除,因此,当循环结束时,通道将被关闭,客户端不会收到更多的消息。 -注意,服务器发送事件Server-Sent Events (EventSource) 的 JavaScript API 不支持设置自定义头部😒,所以我们不能设置 `Authorization: Bearer `。这就是为什么 `guard()` 中间件也会从 URL 查询字符串中读取令牌的原因。 +注意,服务器发送事件Server-Sent Events(EventSource)的 JavaScript API 不支持设置自定义请求头😒,所以我们不能设置 `Authorization: Bearer `。这就是为什么 `guard()` 中间件也会从 URL 查询字符串中读取令牌的原因。 * * * -实时消息部分到此结束。我想说的是,这就是后端的全部内容。但是为了编写前端代码,我将再增加一个登录端点。一个仅用于开发的登录。 +实时消息部分到此结束。我想说的是,这就是后端的全部内容。但是为了编写前端代码,我将再增加一个登录端点:一个仅用于开发的登录。 -[Souce Code][7] +- [源代码][7] -------------------------------------------------------------------------------- @@ -159,17 +159,17 @@ via: https://nicolasparada.netlify.com/posts/go-messenger-realtime-messages/ 作者:[Nicolás Parada][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/gxlct008) -校对:[校对者ID](https://github.com/校对者ID) +译者:[gxlct008](https://github.com/gxlct008) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://nicolasparada.netlify.com/ [b]: https://github.com/lujun9972 -[1]: https://nicolasparada.netlify.com/posts/go-messenger-schema/ -[2]: https://nicolasparada.netlify.com/posts/go-messenger-oauth/ -[3]: https://nicolasparada.netlify.com/posts/go-messenger-conversations/ -[4]: https://nicolasparada.netlify.com/posts/go-messenger-messages/ +[1]: https://linux.cn/article-11396-1.html +[2]: https://linux.cn/article-11510-1.html +[3]: https://linux.cn/article-12056-1.html +[4]: https://linux.cn/article-12680-1.html [5]: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events [6]: https://developer.mozilla.org/en-US/docs/Web/API/EventSource [7]: https://github.com/nicolasparada/go-messenger-demo From ae0a360918467333bb5b56463861e933ceb55492 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 5 Oct 2020 09:19:18 +0800 Subject: [PATCH 0329/1156] PUB @gxlct008 https://linux.cn/article-12685-1.html --- .../20180710 Building a Messenger App- Realtime Messages.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20180710 Building a Messenger App- Realtime Messages.md (98%) diff --git a/translated/tech/20180710 Building a Messenger App- Realtime Messages.md b/published/20180710 Building a Messenger App- Realtime Messages.md similarity index 98% rename from translated/tech/20180710 Building a Messenger App- Realtime Messages.md rename to published/20180710 Building a Messenger App- Realtime Messages.md index 4bcbec8b45..3d70445693 100644 --- a/translated/tech/20180710 Building a Messenger App- Realtime Messages.md +++ b/published/20180710 Building a Messenger App- Realtime Messages.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (gxlct008) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12685-1.html) [#]: subject: (Building a Messenger App: Realtime Messages) [#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-realtime-messages/) [#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) From c53511c25028b5ddfc1f7fb8d6e88d92beacbea0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 5 Oct 2020 10:07:33 +0800 Subject: [PATCH 0330/1156] PRF @HankChow --- ...00903 A practical guide to learning awk.md | 41 ++++++++----------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/translated/tech/20200903 A practical guide to learning awk.md b/translated/tech/20200903 A practical guide to learning awk.md index 50a5f6d1d3..2507ecc6d5 100644 --- a/translated/tech/20200903 A practical guide to learning awk.md +++ b/translated/tech/20200903 A practical guide to learning awk.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (A practical guide to learning awk) @@ -9,20 +9,21 @@ awk 实用学习指南 ====== -下载我们的电子书,学习如何更好地使用 `awk`。 -![Person programming on a laptop on a building][1] + +> 下载我们的电子书,学习如何更好地使用 `awk`。 + +![](https://img.linux.net.cn/data/attachment/album/202010/05/100648zcubcpww627627nw.jpg) 在众多 [Linux][2] 命令中,`sed`、`awk` 和 `grep` 恐怕是其中最经典的三个命令了。它们引人注目或许是由于名字发音与众不同,也可能是它们无处不在,甚至是因为它们存在已久,但无论如何,如果要问哪些命令很有 Linux 风格,这三个命令是当之无愧的。其中 `sed` 和 `grep` 已经有很多简洁的标准用法了,但 `awk` 的使用难度却相对突出。 -在日常使用中,通过 `sed` 实现字符串替换、通过 `grep` 实现过滤,这些都是司空见惯的操作了,但 `awk` 命令相对来说是用得比较少的。在我看来,可能的原因是大多数人都只使用 `sed` 或者 `grep` 的一些变体实现某些功能,例如: - +在日常使用中,通过 `sed` 实现字符串替换、通过 `grep` 实现过滤,这些都是司空见惯的操作了,但 `awk` 命令相对来说是用得比较少的。在我看来,可能的原因是大多数人都只使用 `sed` 或者 `grep` 的一些变化实现某些功能,例如: ``` $ sed -e 's/foo/bar/g' file.txt $ grep foo file.txt ``` -因此,尽管你可能会觉得 `sed` 和 `grep` 使用起来更加顺手,但实际上它们还有更多更强大的作用没有发挥出来。当然,我们没有必要在这两个命令上钻研得很深入,但我还是想理解自己是如何学习一个命令的。很多时候我会把一整串命令记住,但不会去了解其中的运行过程,这就让我产生了一种很熟悉命令的错觉,我可以随口说出某个命令的好几个选项参数,但这些参数具体有什么作用,以及它们的相关语法,我都并不明确。 +因此,尽管你可能会觉得 `sed` 和 `grep` 使用起来更加顺手,但实际上它们还有更多更强大的作用没有发挥出来。当然,我们没有必要在这两个命令上钻研得很深入,但我有时会好奇自己“学习”命令的方式。很多时候我会记住一整串命令“咒语”,而不会去了解其中的运作过程,这就让我产生了一种很熟悉命令的错觉,我可以随口说出某个命令的好几个选项参数,但这些参数具体有什么作用,以及它们的相关语法,我都并不明确。 这大概就是很多人对 `awk` 缺乏了解的原因了。 @@ -34,7 +35,6 @@ $ grep foo file.txt `awk` 的本质是将输入的内容看作是一个数组。当 `awk` 扫描一个文本文件时,会把每一行作为一条记录record,每一条记录中又分割为多个字段field。`awk` 记录了各条记录各个字段的信息,并通过内置变量 `NR`(记录数) 和 `NF`(字段数) 来调用相关信息。例如一下这个命令可以查看文件的行数: - ``` $ awk 'END { print NR;}' example.txt 36 @@ -42,15 +42,13 @@ $ awk 'END { print NR;}' example.txt 从上面的命令可以看出 `awk` 的基本语法,无论是一个单行命令还是一整个脚本,语法都是这样的: - ``` -`样式或关键字 { 操作 }` +模式或关键字 { 操作 } ``` -在上面的例子中,`END` 是一个关键字而不是样式,与此类似的另一个关键字是 `BEGIN`。使用 `BEGIN` 或 `END` 可以让 `awk` 在解析内容前或解析内容后执行大括号中指定的操作。 - -你可以使用样式pattern作为过滤器或限定符,这样 `awk` 只会对匹配样式的对应记录执行指定的操作。以下这个例子就是使用 `awk` 实现 `grep` 命令在文件中查找“Linux”字符串的功能: +在上面的例子中,`END` 是一个关键字而不是模式,与此类似的另一个关键字是 `BEGIN`。使用 `BEGIN` 或 `END` 可以让 `awk` 在解析内容前或解析内容后执行大括号中指定的操作。 +你可以使用模式pattern作为过滤器或限定符,这样 `awk` 只会对匹配模式的对应记录执行指定的操作。以下这个例子就是使用 `awk` 实现 `grep` 命令在文件中查找“Linux”字符串的功能: ``` $ awk '/Linux/ { print $0; }' os.txt @@ -62,8 +60,7 @@ OS: Elementary Linux (10.1.2.5) OS: Elementary Linux (10.1.2.6) ``` -`awk` 会将文件中的每一行作为一条记录,将一条记录中的每个单词作为一个字段,默认情况下会按照空格作为分隔符field separator(`FS`)切割出记录中的字段。如果想要使用其它内容作为分隔符,可以使用 `--field-separator` 选项指定分隔符: - +`awk` 会将文件中的每一行作为一条记录,将一条记录中的每个单词作为一个字段,默认情况下会以空格作为字段分隔符field separator(`FS`)切割出记录中的字段。如果想要使用其它内容作为分隔符,可以使用 `--field-separator` 选项指定分隔符: ``` $ awk --field-separator ':' '/Linux/ { print $2; }' os.txt @@ -77,7 +74,6 @@ $ awk --field-separator ':' '/Linux/ { print $2; }' os.txt 在上面的例子中,可以看到在 `awk` 处理后每一行的行首都有一个空格,那是因为在源文件中每个冒号(`:`)后面都带有一个空格。和 `cut` 有所不同的是,`awk` 可以指定一个字符串作为分隔符,就像这样: - ``` $ awk --field-separator ': ' '/Linux/ { print $2; }' os.txt CentOS Linux (10.1.1.8) @@ -92,26 +88,23 @@ Elementary Linux (10.1.2.6) 可以通过这样的语法在 `awk` 中自定义函数: - ``` -`函数名称(参数) { 操作 }` +函数名称(参数) { 操作 } ``` -函数的好处在于只需要编写一次就可以多次复用,因此函数在脚本中起到的作用会比在构造单行命令时大。同时 `awk` 自身也带有很多预定义的函数,并且工作原理和其它编程语言或电子表格保持一致。你只需要了解函数需要接受什么参数,就可以放心使用了。 +函数的好处在于只需要编写一次就可以多次复用,因此函数在脚本中起到的作用会比在构造单行命令时大。同时 `awk` 自身也带有很多预定义的函数,并且工作原理和其它编程语言或电子表格一样。你只需要了解函数需要接受什么参数,就可以放心使用了。 `awk` 中提供了数学运算和字符串处理的相关函数。数学运算函数通常比较简单,传入一个数字,它就会传出一个结果: - ``` $ awk 'BEGIN { print sqrt(1764); }' 42 ``` -而字符串处理函数则稍微复杂一点,但 [GNU awk 手册][3]中也有充足的文档。例如 `split()` 函数需要传入一个待分割的单一字段、一个数组用于存放分割结果,以及用于分割的定界符delimiter。 +而字符串处理函数则稍微复杂一点,但 [GNU awk 手册][3]中也有充足的文档。例如 `split()` 函数需要传入一个待分割的单一字段、一个用于存放分割结果的数组,以及用于分割的定界符delimiter。 例如前面示例中的输出内容,每条记录的末尾都包含了一个 IP 地址。由于变量 `NF` 代表的是每条记录的字段数量,刚好对应的是每条记录中最后一个字段的序号,因此可以通过引用 `NF` 将每条记录的最后一个字段传入 `split()` 函数: - ``` $ awk --field-separator ': ' '/Linux/ { split($NF, IP, "."); print "subnet: " IP[3]; }' os.txt subnet: 1 @@ -122,13 +115,13 @@ subnet: 2 subnet: 2 ``` -实际上 `awk` 的功能还远远不止于此,你还可以跳出 `awk` 本身,通过命令管道和脚本来自定义更多功能。 +还有更多的函数,没有理由将自己限制在每个 `awk` 代码块中。你可以在终端中使用 `awk` 构建复杂的管道,也可以编写 `awk` 脚本来定义和使用你自己的函数。 ### 下载电子书 使用 `awk` 本身就是一个学习 `awk` 的过程,即使某些操作使用 `sed`、`grep`、`cut`、`tr` 命令已经完全足够了,也可以尝试使用 `awk` 来实现。只要熟悉了 `awk`,就可以在 Bash 中自定义一些 `awk` 函数,进而解析复杂的数据。 -[下载我们的电子书][4]学习并开始使用 `awk` 吧! +[下载我们的这本电子书][4](需注册)学习并开始使用 `awk` 吧! -------------------------------------------------------------------------------- @@ -137,7 +130,7 @@ via: https://opensource.com/article/20/9/awk-ebook 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[HankChow](https://github.com/hankchow) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8cec5bb666174a3922fe9c91fe3df65127d93a2e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 5 Oct 2020 10:08:03 +0800 Subject: [PATCH 0331/1156] PUB @HankChow https://linux.cn/article-12686-1.html --- .../20200903 A practical guide to learning awk.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200903 A practical guide to learning awk.md (99%) diff --git a/translated/tech/20200903 A practical guide to learning awk.md b/published/20200903 A practical guide to learning awk.md similarity index 99% rename from translated/tech/20200903 A practical guide to learning awk.md rename to published/20200903 A practical guide to learning awk.md index 2507ecc6d5..66c613a352 100644 --- a/translated/tech/20200903 A practical guide to learning awk.md +++ b/published/20200903 A practical guide to learning awk.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12686-1.html) [#]: subject: (A practical guide to learning awk) [#]: via: (https://opensource.com/article/20/9/awk-ebook) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From 9ce51cf61635349e1701508c5bf06e27ca1a2399 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 5 Oct 2020 17:37:30 +0800 Subject: [PATCH 0332/1156] TSL&PRF --- ...at is IPv6, and why aren-t we there yet.md | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) rename {sources => translated}/talk/20200826 What is IPv6, and why aren-t we there yet.md (63%) diff --git a/sources/talk/20200826 What is IPv6, and why aren-t we there yet.md b/translated/talk/20200826 What is IPv6, and why aren-t we there yet.md similarity index 63% rename from sources/talk/20200826 What is IPv6, and why aren-t we there yet.md rename to translated/talk/20200826 What is IPv6, and why aren-t we there yet.md index 1d46571148..bd6e258e61 100644 --- a/sources/talk/20200826 What is IPv6, and why aren-t we there yet.md +++ b/translated/talk/20200826 What is IPv6, and why aren-t we there yet.md @@ -1,46 +1,44 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (What is IPv6, and why aren’t we there yet?) [#]: via: (https://www.networkworld.com/article/3254575/what-is-ipv6-and-why-aren-t-we-there-yet.html) [#]: author: (Keith Shaw, Josh Fruhlinger ) -什么是 IPv6,为什么我们还普及? +什么是 IPv6,为什么我们还未普及? ====== -自 1998 年以来,IPv6 一直在努力解决 IPv4 可用 IP 地址的不足的问题,然而尽管 IPv6 在效率和安全方面具有优势,但其采用速度仍然缓慢。 +> 自 1998 年以来,IPv6 一直在努力解决 IPv4 可用 IP 地址的不足的问题,然而尽管 IPv6 在效率和安全方面具有优势,但其采用速度仍然缓慢。 ![](https://images.idgesg.net/images/article/2017/11/ipv6newip-100740801-large.jpg) -在大多数情况下,已经没人一再警告互联网地址耗尽的可怕境况,因为,虽然缓慢,但坚定地,从互联网协议版本 4(IPv4)的世界到 IPv6 的迁移已经开始,并且相关软件已经到位,以防止许多人预测的地址耗竭。 +在大多数情况下,已经没有人一再对互联网地址耗尽的可怕境况发出警告,因为,从互联网协议版本 4(IPv4)的世界到 IPv6 的迁移,虽然缓慢,但已经坚定地开始了,并且相关软件已经到位,以防止许多人预测的地址耗竭。 但在我们看到 IPv6 的现状和发展方向之前,让我们先回到互联网寻址的早期。 ### 什么是 IPv6,为什么它很重要? -IPv6 是最新版本的互联网协议Internet Protocol(IP),它可以识别互联网上的设备,从而确定它们的位置。每一个使用互联网的设备都要通过自己的 IP 地址来识别,以便互联网通信工作。在这方面,它就像你需要知道的街道地址和邮政编码一样,以便邮寄信件。 +IPv6 是最新版本的互联网协议Internet Protocol(IP),它可以跨互联网识别设备,从而确定它们的位置。每一个使用互联网的设备都要通过自己的 IP 地址来识别,以便可以通过互联网通信。在这方面,它就像你需要知道街道地址和邮政编码一样,以便邮寄信件。 之前的版本 IPv4 采用 32 位寻址方案,可以支持 43 亿台设备,本以为已经足够。然而,互联网、个人电脑、智能手机以及现在物联网设备的发展证明,这个世界需要更多的地址。 -幸运的是,互联网工程任务组Internet Engineering Task Force(IETF)在 20 年前就认识到了这一点。1998 年,它创建了 IPv6,使用 128 位寻址方式来支持大约 340 亿亿亿trillion trillion(或者 2 的 128 次幂,如果你喜欢的话)。IPv4 的地址可表示为四组一至三位十进制数,IPv6 则使用八组四位十六进制数字,用冒号隔开。 +幸运的是,互联网工程任务组Internet Engineering Task Force(IETF)在 20 年前就认识到了这一点。1998 年,它创建了 IPv6,使用 128 位寻址方式来支持大约 340 亿亿亿trillion trillion(或者 2 的 128 次幂,如果你喜欢用这种表示方式的话)。IPv4 的地址可表示为四组一至三位十进制数,IPv6 则使用八组四位十六进制数字,用冒号隔开。 ### IPv6 的好处是什么? -IETF 在其工作中加入了 IPv6 对 IPv4 增强的功能。IPv6 协议可以更有效地处理数据包,提高性能和增加安全性。它使互联网服务提供商(ISP)能够通过使他们的路由表更有层次性来减少其大小。 +IETF 在其工作中为 IPv6 加入了对 IPv4 增强的功能。IPv6 协议可以更有效地处理数据包,提高性能和增加安全性。它使互联网服务提供商(ISP)能够通过使他们的路由表更有层次性来减少其大小。 ### 网络地址转换(NAT)和 IPv6 -IPv6 的采用被推迟,部分原因是网络地址转换network address translation(NAT)导致的,它将私有 IP 地址转化为公共 IP 地址。这样一来,拥有私也 IP 地址的企业的机器就可以向位于私人网络之外拥有公共 IP 地址的机器发送和接收数据包。 +IPv6 的采用被推迟,部分原因是网络地址转换network address translation(NAT)导致的,NAT 可以将私有 IP 地址转化为公共 IP 地址。这样一来,拥有私有 IP 地址的企业的机器就可以向位于私有网络之外拥有公共 IP 地址的机器发送和接收数据包。 如果没有 NAT,拥有数千台或数万台计算机的大公司如果要与外界通信,就会吞噬大量的公有 IPv4 地址。但是这些 IPv4 地址是有限的,而且接近枯竭,以至于不得不限制分配。 -NAT 有助于缓解这个问题。有了 NAT,成千上万的私有地址计算机可以通过防火墙或路由器等 NAT 机器呈现在公共互联网上。 +NAT 有助于缓解这个问题。有了 NAT,成千上万的私有地址计算机可以通过防火墙或路由器等 NAT 设备呈现在公共互联网上。 -NAT 的工作方式是,当一台拥有私有 IP 地址的企业计算机向企业网络外的公共 IP 地址发送数据包时,首先会进入 NAT 设备。NAT 在翻译表中记下数据包的源地址和目的地址。 - -NAT 将数据包的源地址改为 NAT 设备面向公众的地址,并将数据包一起发送到外部目的地。当数据包回复时,NAT 将目的地址翻译成发起通信的计算机的私有 IP 地址。这样一来,一个公网 IP 地址可以代表多台私有地址的计算机。 +NAT 的工作方式是,当一台拥有私有 IP 地址的企业计算机向企业网络外的公共 IP 地址发送数据包时,首先会进入 NAT 设备。NAT 在翻译表中记下数据包的源地址和目的地址。NAT 将数据包的源地址改为 NAT 设备面向公众的地址,并将数据包一起发送到外部目的地。当数据包回复时,NAT 将目的地址翻译成发起通信的计算机的私有 IP 地址。这样一来,一个公网 IP 地址可以代表多台私有地址的计算机。 ### 谁在部署 IPv6? @@ -48,27 +46,27 @@ NAT 将数据包的源地址改为 NAT 设备面向公众的地址,并将数 主要网站则排在其后 —— World IPv6 Launch 称,目前 Alexa 前 1000 的网站中只有不到 30% 可以通过 IPv6 到达。 -企业在部署方面比较落后,根据互联网协会Internet Society的[《2017年 IPv6 部署状况》报告][4],只有不到四分之一的企业宣传其 IPv6 前缀。复杂性、成本和完成迁移所需时间都是给出的理由。此外,一些项目由于软件兼容性的问题而被推迟。例如,一份 [2017 年 1 月的报告][5]称,Windows 10 中的一个 bug “破坏了微软在其西雅图总部推出纯 IPv6 网络的努力”。 +企业在部署方面比较落后,根据互联网协会Internet Society的[《2017年 IPv6 部署状况》报告][4],只有不到四分之一的企业宣传其 IPv6 前缀。复杂性、成本和完成迁移所需时间都是他们给出的理由。此外,一些项目由于软件兼容性的问题而被推迟。例如,一份 [2017 年 1 月的报告][5]称,Windows 10 中的一个 bug “破坏了微软在其西雅图总部推出纯 IPv6 网络的努力”。 ### 何时会有更多部署? 互联网协会表示,IPv4 地址的价格将在 2018 年达到顶峰,然后在 IPv6 部署通过 50% 大关后,价格会下降。目前,[根据 Google][6],全球的 IPv6 采用率为 20% 到 22%,但在美国约为 32%。 -随着 IPv4 地址的价格开始下降,互联网协会建议企业出售现有的 IPv4 地址,以帮助资助其 IPv6 的部署。根据[一个发布在 GitHub 上的说明][7],麻省理工学院已经这样做了。这所大学得出的结论是,其 800 万个 IPv4 地址是“过剩”的,可以在不影响当前或未来需求的情况下出售,因为它还持有 20 个非亿级nonillion IPv6 地址。(非亿级地址是指数字 1 后面跟着 30 个零)。 +随着 IPv4 地址的价格开始下降,互联网协会建议企业出售现有的 IPv4 地址,以帮助资助其 IPv6 的部署。根据[一个发布在 GitHub 上的说明][7],麻省理工学院已经这样做了。这所大学得出的结论是,其有 800 万个 IPv4 地址是“过剩”的,可以在不影响当前或未来需求的情况下出售,因为它还持有 20 个非亿级nonillion IPv6 地址。(非亿级地址是指数字 1 后面跟着 30 个零)。 此外,随着部署的增多,更多的公司将开始对 IPv4 地址的使用收费,而免费提供 IPv6 服务。[英国的 ISP Mythic Beasts][8] 表示,“IPv6 连接是标配”,而 “IPv4 连接是可选的额外服务”。 ### IPv4 何时会被“关闭”? -在 2011 年至 2018 年期间,世界上大部分地区[“用完”了新的 IPv4 地址][9] —— 但我们不会完全没有了这些地址,因为 IPv4 地址会被出售和重新使用(如前所述),而任何剩余的地址将用于 IPv6 过渡。 +在 2011 年至 2018 年期间,世界上大部分地区[“用完”了新的 IPv4 地址][9] —— 但我们不会完全没有 IPv4 地址,因为 IPv4 地址会被出售和重新使用(如前所述),而剩余的地址将用于 IPv6 过渡。 -目前还没有正式的关闭日期,所以人们不应该担心有一天他们的互联网接入会突然消失。随着越来越多的网络过渡,越来越多的内容网站支持 IPv6,以及越来越多的终端用户为 IPv6 功能升级设备,世界将慢慢远离 IPv4。 +目前还没有正式的 IPv4 关闭日期,所以人们不用担心有一天他们的互联网接入会突然消失。随着越来越多的网络过渡,越来越多的内容网站支持 IPv6,以及越来越多的终端用户为 IPv6 功能升级设备,世界将慢慢远离 IPv4。 ### 为什么没有 IPv5? 曾经有一个 IPv5,也被称为互联网流协议Internet Stream Protocol,简称 ST。它被设计用于跨 IP 网络的面向连接的通信,目的是支持语音和视频。 -它在这个任务上是成功的,并被实验性地使用。它的一个缺点是它的 32 位地址方案 —— 与 IPv4 使用的方案相同,从而影响了它的普及。因此,它存在着与 IPv4 相同的问题 —— 可用的 IP 地址数量有限。这导致了 IPv6 的发展和最终采用。尽管 IPv5 从未被公开采用,但它已经用掉了 IPv5 这个名字。 +它在这个任务上是成功的,并被实验性地使用。它的一个缺点是它的 32 位地址方案 —— 与 IPv4 使用的方案相同,从而影响了它的普及。因此,它存在着与 IPv4 相同的问题 —— 可用的 IP 地址数量有限。这导致了发展出了 IPv6 并和最终得到采用。尽管 IPv5 从未被公开采用,但它已经用掉了 IPv5 这个名字。 -------------------------------------------------------------------------------- @@ -77,7 +75,7 @@ via: https://www.networkworld.com/article/3254575/what-is-ipv6-and-why-aren-t-we 作者:[Keith Shaw][a],[Josh Fruhlinger][c] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From b25942acd0b251e8f8031dbbf05c3dc34763df6f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 5 Oct 2020 17:45:10 +0800 Subject: [PATCH 0333/1156] PUB @wxy https://linux.cn/article-12688-1.html --- .../20200826 What is IPv6, and why aren-t we there yet.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20200826 What is IPv6, and why aren-t we there yet.md (99%) diff --git a/translated/talk/20200826 What is IPv6, and why aren-t we there yet.md b/published/20200826 What is IPv6, and why aren-t we there yet.md similarity index 99% rename from translated/talk/20200826 What is IPv6, and why aren-t we there yet.md rename to published/20200826 What is IPv6, and why aren-t we there yet.md index bd6e258e61..9eb7aef27a 100644 --- a/translated/talk/20200826 What is IPv6, and why aren-t we there yet.md +++ b/published/20200826 What is IPv6, and why aren-t we there yet.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12688-1.html) [#]: subject: (What is IPv6, and why aren’t we there yet?) [#]: via: (https://www.networkworld.com/article/3254575/what-is-ipv6-and-why-aren-t-we-there-yet.html) [#]: author: (Keith Shaw, Josh Fruhlinger ) From ee5ea4df4cc49a1306abbadc16cb140ca3d5fc2a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 5 Oct 2020 20:38:33 +0800 Subject: [PATCH 0334/1156] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @rakino 恭喜您,完成了第一篇翻译贡献,翻译的很用心,点赞! --- ...521 How to Disable IPv6 on Ubuntu Linux.md | 63 +++++++++---------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/translated/tech/20190521 How to Disable IPv6 on Ubuntu Linux.md b/translated/tech/20190521 How to Disable IPv6 on Ubuntu Linux.md index 0941286dcb..2aed6a00c8 100644 --- a/translated/tech/20190521 How to Disable IPv6 on Ubuntu Linux.md +++ b/translated/tech/20190521 How to Disable IPv6 on Ubuntu Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (rakino) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Disable IPv6 on Ubuntu Linux) @@ -14,31 +14,33 @@ ### 什么是 IPv6?为什么会想要禁用它? -**[网际协议第6版][1]**Internet Protocol version 6[(][1] **[IPv6][1]**[)][1]是网际协议(IP)的最新版本。网际协议是一种通信协议,它为网络上的计算机提供识别和定位系统,并在互联网上进行通信路由。IPv6 是在 1998 年以取代 **IPv4** 协议为目的被设计出来的。 +[互联网协议第 6 版][1]Internet Protocol version 6(IPv6)是互联网协议(IP)的最新版本。互联网协议是一种通信协议,它为网络上的计算机提供识别和定位系统,并在互联网上进行通信路由。IPv6 于 1998 年设计,以取代 IPv4 协议。 -**IPv6** 意在提高安全性与性能的同时保证地址不被用尽;它可以在全球范围内为每台设备分配唯一的以 **128 位元**存储的地址,而 IPv4 只使用了 32 位元。 +**IPv6** 意在提高安全性与性能的同时保证地址不被用尽;它可以在全球范围内为每台设备分配唯一的以 **128 位比特**存储的地址,而 IPv4 只使用了 32 位比特。 ![Disable IPv6 Ubuntu][2] -尽管 IPv6 的目标是取代 IPv4,但目前还有很长的路要走;互联网上只有少于 **30%** 的网站支持 IPv6([这里][3] 是谷歌的统计),IPv6 有时也会导致 [一些程序出现问题][4]。 +尽管 IPv6 的目标是取代 IPv4,但目前还有很长的路要走;互联网上只有不到 **30%** 的网站支持 IPv6([这里][3] 是谷歌的统计),IPv6 有时也给 [一些应用带来问题][4]。 由于 IPv6 使用全球(唯一分配的)路由地址,以及(仍然)有互联网服务供应商Internet Service Provider(ISP)不提供 IPv6 支持的事实,IPv6 这一功能在提供全球服务的**虚拟私人网络**Virtual Private Network(VPN)供应商的优先级列表中处于较低的位置,这样一来,他们就可以专注于对 VPN 用户最重要的事情:安全。 -不想让自己暴露在各种威胁之下可能是另一个让你想在系统上禁用 IPv6 的原因。虽然 IPv6 本身比 IPv4 更安全,但我所指的风险是另一种性质上的。如果你不积极使用 IPv6 及其功能,[启用 IPv6 后,你会很容易受到各种攻击][5],因而为黑客提供另一种可能的利用工具。 +不想让自己暴露在各种威胁之下可能是另一个让你想在系统上禁用 IPv6 的原因。虽然 IPv6 本身比 IPv4 更安全,但我所指的风险是另一种性质上的。如果你不实际使用 IPv6 及其功能,那么[启用 IPv6 后,你会很容易受到各种攻击][5],因而为黑客提供另一种可能的利用工具。 -同样,配置基本的网络规则是不够的;就像对 IPv4 一样,你需要密切关注 IPv6 的配置,这可能会是一件相当麻烦的事情(维护也是)。并且随着 IPv6 而来的将会是一套不同于 IPv4 的问题(鉴于这个协议的年龄,许多问题已经可以在网上找到了),这又会使你的系统多了一层复杂性。 +同样,只配置基本的网络规则是不够的;你必须像对 IPv4 一样,对调整 IPv6 的配置给予同样的关注,这可能会是一件相当麻烦的事情(维护也是)。并且随着 IPv6 而来的将会是一套不同于 IPv4 的问题(鉴于这个协议的年龄,许多问题已经可以在网上找到了),这又会使你的系统多了一层复杂性。 + +据观察,在某些情况下,禁用 IPv6 有助于提高 Ubuntu 的 WiFi 速度。 ### 在 Ubuntu 上禁用 IPv6 [高级用户] -在本节中,我会详述如何在 Ubuntu 上禁用 IPv6 协议,请打开终端(**默认键:** CTRL+ALT+T),让我们开始吧! +在本节中,我会详述如何在 Ubuntu 上禁用 IPv6 协议,请打开终端(默认快捷键:`CTRL+ALT+T`),让我们开始吧! -**注意:**_接下来大部分输入终端的命令都需要 root 权限(**sudo**)。_ +**注意:**接下来大部分输入终端的命令都需要 root 权限(`sudo`)。 -警告! +> 警告! +> +> 如果你是一个普通 Linux 桌面用户,并且偏好稳定的工作系统,请避开本教程,接下来的部分是为那些知道自己在做什么以及为什么要这么做的用户准备的。 -如果你是普通 Linux 桌面用户,并且偏好稳定的工作系统,请避开本教程,接下来的部分是为那些知道自己在做什么以及为什么要这么做的用户准备的。 - -#### 1\. 使用 Sysctl 禁用 IPv6 +#### 1、使用 sysctl 禁用 IPv6 首先,可以执行以下命令来**检查** IPv6 是否已经启用: @@ -50,7 +52,7 @@ ip a ![IPv6 Address Ubuntu][7] -在教程 [在 Ubuntu 中重启网络][8] 中,你已经见过 sysctl 命令了,在这里我们也同样会用到它。要**禁用 IPv6**,只需要输入三条命令: +在教程《[在 Ubuntu 中重启网络][8]》(LCTT 译注:其实这篇文章并没有提到使用 sysctl 的方法……)中,你已经见过 `sysctl` 命令了,在这里我们也同样会用到它。要**禁用 IPv6**,只需要输入三条命令: ``` sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1 @@ -58,8 +60,6 @@ sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1 sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=1 ``` -(译注:这篇文章 LCTT 有翻译,在 [这里:《Linux 初学者:如何在 Ubuntu 中重启网络》][patch-1];不过尴尬的是,并没有提到使用 sysctl 的方法……) - 检查命令是否生效: ``` @@ -70,11 +70,11 @@ ip a ![IPv6 Disabled Ubuntu][9] -然而这种方法只能**临时禁用 IPv6**,因此在下次系统启动的时候, IPv6 仍然会被启用。 +然而这种方法只能**临时禁用 IPv6**,因此在下次系统启动的时候,IPv6 仍然会被启用。 -(译注:这里的临时禁用是指这次所做的改变直到此次关机之前都有效,因为相关的参数是存储在内存中的,可以改变值,但是在内存断电后就会丢失;这种意义上来讲,下文所述的两种方法都是临时的,只不过改变参数值的时机是在系统启动的早期,并且每次系统启动时都有应用而已。那么如何完成这种意义上的永久改变?答案是在编译内核的时候禁用相关功能,然后要后悔就只能重新编译内核了(悲)。) +(LCTT 译注:这里的临时禁用是指这次所做的改变直到此次关机之前都有效,因为相关的参数是存储在内存中的,可以改变值,但是在内存断电后就会丢失;这种意义上来讲,下文所述的两种方法都是临时的,只不过改变参数值的时机是在系统启动的早期,并且每次系统启动时都有应用而已。那么如何完成这种意义上的永久改变?答案是在编译内核的时候禁用相关功能,然后要后悔就只能重新编译内核了(悲)。) -一种让选项持续生效的方式是修改文件 **/etc/sysctl.conf**,在这里我用 vim 来编辑文件,不过你可以使用任何你想使用的编辑器,以及请确保你拥有**管理员权限**(用 **sudo**): +一种让选项持续生效的方式是修改文件 `/etc/sysctl.conf`,在这里我用 `vim` 来编辑文件,不过你可以使用任何你想使用的编辑器,以及请确保你拥有**管理员权限**(用 `sudo`): ![Sysctl Configuration][10] @@ -92,7 +92,7 @@ net.ipv6.conf.lo.disable_ipv6=1 sudo sysctl -p ``` -如果在重启之后 IPv6 仍然被启用了,而你还想继续这种方法的话,那么你必须(使用 root 权限)创建文件 **/etc/rc.local** 并加入以下内容: +如果在重启之后 IPv6 仍然被启用了,而你还想继续这种方法的话,那么你必须(使用 root 权限)创建文件 `/etc/rc.local` 并加入以下内容: ``` #!/bin/bash @@ -112,20 +112,20 @@ sudo chmod 755 /etc/rc.local 这会让系统(在启动的时候)从之前编辑过的 sysctl 配置文件中读取内核参数。 -#### 2\. 使用 GRUB 禁用 IPv6 +#### 2、使用 GRUB 禁用 IPv6 -另外一种方法是配置 **GRUB**,它会在系统启动时向内核传递参数。这样做需要编辑文件 **/etc/default/grub**(请确保拥有管理员权限)。 +另外一种方法是配置 **GRUB**,它会在系统启动时向内核传递参数。这样做需要编辑文件 `/etc/default/grub`(请确保拥有管理员权限)。 ![GRUB Configuration][13] -现在需要修改文件中分别以 **GRUB_CMDLINE_LINUX_DEFAULT** 和 **GRUB_CMDLINE_LINUX** 开头的两行来在启动时禁用 IPv6: +现在需要修改文件中分别以 `GRUB_CMDLINE_LINUX_DEFAULT` 和 `GRUB_CMDLINE_LINUX` 开头的两行来在启动时禁用 IPv6: ``` GRUB_CMDLINE_LINUX_DEFAULT="quiet splash ipv6.disable=1" GRUB_CMDLINE_LINUX="ipv6.disable=1" ``` -(译注:这里是指在上述两行内增加参数 ipv6.disable=1,不同的系统中这两行的默认值可能有所不同。) +(LCTT 译注:这里是指在上述两行内增加参数 `ipv6.disable=1`,不同的系统中这两行的默认值可能有所不同。) 保存文件,然后执行命令: @@ -133,7 +133,7 @@ GRUB_CMDLINE_LINUX="ipv6.disable=1" sudo update-grub ``` -(译注:该命令用以更新 GRUB 的配置文件,在没有 update-grub 命令的系统中需要使用 `sudo grub-mkconfig -o /boot/grub/grub.cfg` ) +(LCTT 译注:该命令用以更新 GRUB 的配置文件,在没有 `update-grub` 命令的系统中需要使用 `sudo grub-mkconfig -o /boot/grub/grub.cfg` ) 设置会在重启后生效。 @@ -147,7 +147,7 @@ sudo sysctl -w net.ipv6.conf.default.disable_ipv6=0 sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0 ``` -否则想要持续启用的话,看看是否修改过 **/etc/sysctl.conf**,可以删除掉之前增加的部分,也可以将它们改为以下值(两种方法等效): +否则想要持续启用的话,看看是否修改过 `/etc/sysctl.conf`,可以删除掉之前增加的部分,也可以将它们改为以下值(两种方法等效): ``` net.ipv6.conf.all.disable_ipv6=0 @@ -161,19 +161,19 @@ net.ipv6.conf.lo.disable_ipv6=0 sudo sysctl -p ``` -(译注:这里可选的意思可能是如果之前临时启用了 IPv6 就没必要再重新加载配置文件了) +(LCTT 译注:这里可选的意思可能是如果之前临时启用了 IPv6 就没必要再重新加载配置文件了) 这样应该可以再次看到 IPv6 地址了: ![IPv6 Reenabled in Ubuntu][14] -另外,你也可以删除之前创建的文件 **/etc/rc.local**(可选): +另外,你也可以删除之前创建的文件 `/etc/rc.local`(可选): ``` sudo rm /etc/rc.local ``` -如果修改了文件 **/etc/default/grub** ,回去删掉你所增加的参数: +如果修改了文件 `/etc/default/grub`,回去删掉你所增加的参数: ``` GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" @@ -186,7 +186,7 @@ GRUB_CMDLINE_LINUX="" sudo update-grub ``` -**尾声** +### 尾声 在这篇文章中,我介绍了在 Linux 上**禁用 IPv6** 的方法,并简述了什么是 IPv6 以及可能想要禁用掉它的原因。 @@ -199,7 +199,7 @@ via: https://itsfoss.com/disable-ipv6-ubuntu-linux/ 作者:[Sergiu][a] 选题:[lujun9972][b] 译者:[rakino](https://github.com/rakino) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -212,11 +212,10 @@ via: https://itsfoss.com/disable-ipv6-ubuntu-linux/ [5]: https://www.internetsociety.org/blog/2015/01/ipv6-security-myth-1-im-not-running-ipv6-so-i-dont-have-to-worry/ [6]: https://itsfoss.com/remove-drive-icons-from-unity-launcher-in-ubuntu/ [7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/05/ipv6_address_ubuntu.png?fit=800%2C517&ssl=1 -[8]: https://itsfoss.com/restart-network-ubuntu/ +[8]: https://linux.cn/article-10804-1.html [9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/05/ipv6_disabled_ubuntu.png?fit=800%2C442&ssl=1 [10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/05/sysctl_configuration.jpg?fit=800%2C554&ssl=1 [11]: https://linuxhandbook.com/chmod-command/ [12]: https://itsfoss.com/find-which-kernel-version-is-running-in-ubuntu/ [13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/05/grub_configuration-1.jpg?fit=800%2C565&ssl=1 [14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/05/ipv6_address_ubuntu-1.png?fit=800%2C517&ssl=1 -[patch-1]: https://github.com/LCTT/TranslateProject/blob/master/published/201905/20190307%20How%20to%20Restart%20a%20Network%20in%20Ubuntu%20-Beginner-s%20Tip.md \ No newline at end of file From 53023a518568efb35e6d16b1fa14b1e0c0a034a3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 5 Oct 2020 20:39:40 +0800 Subject: [PATCH 0335/1156] PUB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @rakino 本文首发地址:https://linux.cn/article-12689-1.html 您的 LCTT 专页地址: https://linux.cn/lctt/rakino --- .../20190521 How to Disable IPv6 on Ubuntu Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190521 How to Disable IPv6 on Ubuntu Linux.md (99%) diff --git a/translated/tech/20190521 How to Disable IPv6 on Ubuntu Linux.md b/published/20190521 How to Disable IPv6 on Ubuntu Linux.md similarity index 99% rename from translated/tech/20190521 How to Disable IPv6 on Ubuntu Linux.md rename to published/20190521 How to Disable IPv6 on Ubuntu Linux.md index 2aed6a00c8..3b930b6e68 100644 --- a/translated/tech/20190521 How to Disable IPv6 on Ubuntu Linux.md +++ b/published/20190521 How to Disable IPv6 on Ubuntu Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (rakino) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12689-1.html) [#]: subject: (How to Disable IPv6 on Ubuntu Linux) [#]: via: (https://itsfoss.com/disable-ipv6-ubuntu-linux/) [#]: author: (Sergiu https://itsfoss.com/author/sergiu/) From 543e1790a9a3d6979e3bc6830fa1d757804d34c9 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 5 Oct 2020 20:43:02 +0800 Subject: [PATCH 0336/1156] PRF --- published/20190521 How to Disable IPv6 on Ubuntu Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20190521 How to Disable IPv6 on Ubuntu Linux.md b/published/20190521 How to Disable IPv6 on Ubuntu Linux.md index 3b930b6e68..a187054afd 100644 --- a/published/20190521 How to Disable IPv6 on Ubuntu Linux.md +++ b/published/20190521 How to Disable IPv6 on Ubuntu Linux.md @@ -34,7 +34,7 @@ 在本节中,我会详述如何在 Ubuntu 上禁用 IPv6 协议,请打开终端(默认快捷键:`CTRL+ALT+T`),让我们开始吧! -**注意:**接下来大部分输入终端的命令都需要 root 权限(`sudo`)。 +**注意:** 接下来大部分输入终端的命令都需要 root 权限(`sudo`)。 > 警告! > From bf10f37779615aed6ec32fcc953802328eaa9b57 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 5 Oct 2020 22:18:35 +0800 Subject: [PATCH 0337/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200512?= =?UTF-8?q?=20Scan=20your=20Linux=20security=20with=20Lynis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200512 Scan your Linux security with Lynis.md --- ...512 Scan your Linux security with Lynis.md | 400 ++++++++++++++++++ 1 file changed, 400 insertions(+) create mode 100644 sources/tech/20200512 Scan your Linux security with Lynis.md diff --git a/sources/tech/20200512 Scan your Linux security with Lynis.md b/sources/tech/20200512 Scan your Linux security with Lynis.md new file mode 100644 index 0000000000..37410fa738 --- /dev/null +++ b/sources/tech/20200512 Scan your Linux security with Lynis.md @@ -0,0 +1,400 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Scan your Linux security with Lynis) +[#]: via: (https://opensource.com/article/20/5/linux-security-lynis) +[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe) + +Scan your Linux security with Lynis +====== +Check the security of your Linux box with this comprehensive open source +security auditing tool. +![Hand putting a Linux file folder into a drawer][1] + +Have you ever thought about how secure your Linux machine really is? There are numerous Linux distros, each with its own default settings, on which you run dozens of software packages with different version numbers, and numerous services running in the background, which we hardly know or care about. + +To find the security posture—the overall security status of the software, network, and services running on your Linux machine—you could run a few commands and get bits and pieces of relevant information, but the amount of data you need to parse is huge. + +It would be so much better if you could just run a tool that generates a report on a machine's security posture. And luckily there is one: [Lynis][2]. It is an extremely popular open source security auditing tool that helps with hardening Linux- and Unix-based systems. According to the project: + +> "It performs an in-depth security scan and runs on the system itself. The primary goal is to test security defenses and provide tips for further system hardening. It will also scan for general system information, vulnerable software packages, and possible configuration issues. Lynis [is] commonly used by system administrators and auditors to assess the security defenses of their systems." + +### Install Lynis + +Lynis might be available in your Linux software repository. If so, you can install it using: + + +``` +`dnf install lynis` +``` + +or + + +``` +`apt install lynis` +``` + +However, if the version in your repo isn't the latest one, you are better off installing it from GitHub. (I am using a Red Hat Linux system, but you can run it on any Linux distribution.) As with all tools, it makes sense to try it out on a virtual machine first. To install it from GitHub: + + +``` +$ cat /etc/redhat-release +Red Hat Enterprise Linux Server release 7.8 (Maipo) +$ +$ uname  -r +3.10.0-1127.el7.x86_64 +$ +$ git clone +Cloning into 'lynis'... +remote: Enumerating objects: 30, done. +remote: Counting objects: 100% (30/30), done. +remote: Compressing objects: 100% (30/30), done. +remote: Total 12566 (delta 15), reused 8 (delta 0), pack-reused 12536 +Receiving objects: 100% (12566/12566), 6.36 MiB | 911.00 KiB/s, done. +Resolving deltas: 100% (9264/9264), done. +$ +``` + +Once you have cloned the repository, move into it and see what is available. The main tool is in a file called **lynis**. It's actually a shell script, so you can open it and read what it is doing. In fact, Lynis is mainly implemented using shell scripts: + + +``` +$ cd lynis/ +$ ls +CHANGELOG.md        CONTRIBUTING.md  db           developer.prf  FAQ             include  LICENSE  lynis.8  README     SECURITY.md +CODE_OF_CONDUCT.md  CONTRIBUTORS.md  default.prf  extras         HAPPY_USERS.md  INSTALL  lynis    plugins  README.md +$ +$ file lynis +lynis: POSIX shell script, ASCII text executable, with very long lines +$ +``` + +### Run Lynis + +Take Lynis out for a spin by giving it a **-h** option to see the Help section: + + +``` +`$ ./lynis -h` +``` + +You'll see a short information screen followed by all the commands that Lynis supports. + +Next, try out some test commands to get a feel for things and get comfortable. To see which version of Lynis you are working with, run: + + +``` +$ ./lynis show version +3.0.0 +$ +``` + +To see all the commands available in Lynis: + + +``` +$ ./lynis show commands + +Commands: +lynis audit +lynis configure +lynis generate +lynis show +lynis update +lynis upload-only + +$ +``` + +### Audit a Linux system + +To audit your system's security posture, run the following command: + + +``` +`$ ./lynis audit system` +``` + +This runs quickly and returns a detailed report—the output might seem intimidating at first, but I'll walk you through it below. The command's output is also saved to a log file, so you can always go back later and check anything that might be of interest. + +Lynis saves the logs here: + + +``` +  Files: +  - Test and debug information      : /var/log/lynis.log +  - Report data                     : /var/log/lynis-report.dat +``` + +You can verify whether the log files were created, and indeed they were: + + +``` +$ ls -l /var/log/lynis.log +-rw-r-----. 1 root root 341489 Apr 30 05:52 /var/log/lynis.log +$ +$ ls -l /var/log/lynis-report.dat +-rw-r-----. 1 root root 638 Apr 30 05:55 /var/log/lynis-report.dat +$ +``` + +### Explore the reports + +Lynis provides pretty comprehensive reports, so I will cover some of the important sections. The very first thing that Lynis does as part of initialization is to find out complete information about the operating system running on the machine. This is followed by checks to see what system tools and plugins are installed: + + +``` +[+] Initializing program +\------------------------------------ +  - Detecting OS...                                           [ DONE ] +  - Checking profiles...                                      [ DONE ] + +  --------------------------------------------------- +  Program version:           3.0.0 +  Operating system:          Linux +  Operating system name:     Red Hat Enterprise Linux Server 7.8 (Maipo) +  Operating system version:  7.8 +  Kernel version:            3.10.0 +  Hardware platform:         x86_64 +  Hostname:                  example +  --------------------------------------------------- +<<snip>> + +[+] System Tools +\------------------------------------ +  - Scanning available tools... +  - Checking system binaries... + +[+] Plugins (phase 1) +\------------------------------------ + Note: plugins have more extensive tests and may take several minutes to complete +  +  - Plugin: pam +    [..] +  - Plugin: systemd +    [................] +``` + +Next, the report is divided into various sections, and each section starts with a **[+]** symbol. Some of the sections can be seen below. (Wow, there are so many areas to audit, and Lynis is the right tool for the job!) + + +``` +[+] Boot and services +[+] Kernel +[+] Memory and Processes +[+] Users, Groups and Authentication +[+] Shells +[+] File systems +[+] USB Devices +[+] Storage +[+] NFS +[+] Name services +[+] Ports and packages +[+] Networking +[+] Printers and Spools +[+] Software: e-mail and messaging +[+] Software: firewalls +[+] Software: webserver +[+] SSH Support +[+] SNMP Support +[+] Databases +[+] LDAP Services +[+] PHP +[+] Squid Support +[+] Logging and files +[+] Insecure services +[+] Banners and identification +[+] Scheduled tasks +[+] Accounting +[+] Time and Synchronization +[+] Cryptography +[+] Virtualization +[+] Containers +[+] Security frameworks +[+] Software: file integrity +[+] Software: System tooling +[+] Software: Malware +[+] File Permissions +[+] Home directories +[+] Kernel Hardening +[+] Hardening +[+] Custom tests +``` + +Lynis uses color-coding to make the report easier to parse: + + * Green: All good + * Yellow: Skipped, not found, or it may have a suggestion + * Red: You might need to give this a closer look + + + +In my case, most of the red marks were found in the Kernel Hardening section. The kernel has various tunable settings that define how the kernel functions, and some of these tunables may have a security context. The distro may not be setting these by default for various reasons, but you should examine each and see if you need to change its value based on your security posture: + + +``` +[+] Kernel Hardening +\------------------------------------ +  - Comparing sysctl key pairs with scan profile +    - fs.protected_hardlinks (exp: 1)                         [ OK ] +    - fs.protected_symlinks (exp: 1)                          [ OK ] +    - fs.suid_dumpable (exp: 0)                               [ OK ] +    - kernel.core_uses_pid (exp: 1)                           [ OK ] +    - kernel.ctrl-alt-del (exp: 0)                            [ OK ] +    - kernel.dmesg_restrict (exp: 1)                          [ DIFFERENT ] +    - kernel.kptr_restrict (exp: 2)                           [ DIFFERENT ] +    - kernel.randomize_va_space (exp: 2)                      [ OK ] +    - kernel.sysrq (exp: 0)                                   [ DIFFERENT ] +    - kernel.yama.ptrace_scope (exp: 1 2 3)                   [ DIFFERENT ] +    - net.ipv4.conf.all.accept_redirects (exp: 0)             [ DIFFERENT ] +    - net.ipv4.conf.all.accept_source_route (exp: 0)          [ OK ] +    - net.ipv4.conf.all.bootp_relay (exp: 0)                  [ OK ] +    - net.ipv4.conf.all.forwarding (exp: 0)                   [ OK ] +    - net.ipv4.conf.all.log_martians (exp: 1)                 [ DIFFERENT ] +    - net.ipv4.conf.all.mc_forwarding (exp: 0)                [ OK ] +    - net.ipv4.conf.all.proxy_arp (exp: 0)                    [ OK ] +    - net.ipv4.conf.all.rp_filter (exp: 1)                    [ OK ] +    - net.ipv4.conf.all.send_redirects (exp: 0)               [ DIFFERENT ] +    - net.ipv4.conf.default.accept_redirects (exp: 0)         [ DIFFERENT ] +    - net.ipv4.conf.default.accept_source_route (exp: 0)      [ OK ] +    - net.ipv4.conf.default.log_martians (exp: 1)             [ DIFFERENT ] +    - net.ipv4.icmp_echo_ignore_broadcasts (exp: 1)           [ OK ] +    - net.ipv4.icmp_ignore_bogus_error_responses (exp: 1)     [ OK ] +    - net.ipv4.tcp_syncookies (exp: 1)                        [ OK ] +    - net.ipv4.tcp_timestamps (exp: 0 1)                      [ OK ] +    - net.ipv6.conf.all.accept_redirects (exp: 0)             [ DIFFERENT ] +    - net.ipv6.conf.all.accept_source_route (exp: 0)          [ OK ] +    - net.ipv6.conf.default.accept_redirects (exp: 0)         [ DIFFERENT ] +    - net.ipv6.conf.default.accept_source_route (exp: 0)      [ OK ] +``` + +Look at SSH, an example, since it is a key area and needs to be secured. There's nothing in red here, but Lynis has a lot of suggestions about hardening the SSH service on my setup: + + +``` +[+] SSH Support +\------------------------------------ +  - Checking running SSH daemon                               [ FOUND ] +    - Searching SSH configuration                             [ FOUND ] +    - OpenSSH option: AllowTcpForwarding                      [ SUGGESTION ] +    - OpenSSH option: ClientAliveCountMax                     [ SUGGESTION ] +    - OpenSSH option: ClientAliveInterval                     [ OK ] +    - OpenSSH option: Compression                             [ SUGGESTION ] +    - OpenSSH option: FingerprintHash                         [ OK ] +    - OpenSSH option: GatewayPorts                            [ OK ] +    - OpenSSH option: IgnoreRhosts                            [ OK ] +    - OpenSSH option: LoginGraceTime                          [ OK ] +    - OpenSSH option: LogLevel                                [ SUGGESTION ] +    - OpenSSH option: MaxAuthTries                            [ SUGGESTION ] +    - OpenSSH option: MaxSessions                             [ SUGGESTION ] +    - OpenSSH option: PermitRootLogin                         [ SUGGESTION ] +    - OpenSSH option: PermitUserEnvironment                   [ OK ] +    - OpenSSH option: PermitTunnel                            [ OK ] +    - OpenSSH option: Port                                    [ SUGGESTION ] +    - OpenSSH option: PrintLastLog                            [ OK ] +    - OpenSSH option: StrictModes                             [ OK ] +    - OpenSSH option: TCPKeepAlive                            [ SUGGESTION ] +    - OpenSSH option: UseDNS                                  [ SUGGESTION ] +    - OpenSSH option: X11Forwarding                           [ SUGGESTION ] +    - OpenSSH option: AllowAgentForwarding                    [ SUGGESTION ] +    - OpenSSH option: UsePrivilegeSeparation                  [ OK ] +    - OpenSSH option: AllowUsers                              [ NOT FOUND ] +    - OpenSSH option: AllowGroups                             [ NOT FOUND ] +``` + +I do not have virtual machines or containers running on my system, so they show empty results: + + +``` +[+] Virtualization +\------------------------------------ + +[+] Containers +\------------------------------------ +``` + +Lynis checks file permissions on some files that are important from a security standpoint: + + +``` +[+] File Permissions +\------------------------------------ +  - Starting file permissions check +    File: /boot/grub2/grub.cfg                                [ SUGGESTION ] +    File: /etc/cron.deny                                      [ OK ] +    File: /etc/crontab                                        [ SUGGESTION ] +    File: /etc/group                                          [ OK ] +    File: /etc/group-                                         [ OK ] +    File: /etc/hosts.allow                                    [ OK ] +    File: /etc/hosts.deny                                     [ OK ] +    File: /etc/issue                                          [ OK ] +    File: /etc/issue.net                                      [ OK ] +    File: /etc/motd                                           [ OK ] +    File: /etc/passwd                                         [ OK ] +    File: /etc/passwd-                                        [ OK ] +    File: /etc/ssh/sshd_config                                [ OK ] +    Directory: /root/.ssh                                     [ SUGGESTION ] +    Directory: /etc/cron.d                                    [ SUGGESTION ] +    Directory: /etc/cron.daily                                [ SUGGESTION ] +    Directory: /etc/cron.hourly                               [ SUGGESTION ] +    Directory: /etc/cron.weekly                               [ SUGGESTION ] +    Directory: /etc/cron.monthly                              [ SUGGESTION ] +``` + +Towards the bottom of the report, Lynis offers suggestions based on the report's findings. Each suggestion is followed by a **TEST-ID** (keep this handy for the next part): + + +``` + Suggestions (47): +  ---------------------------- +  * If not required, consider explicit disabling of core dump in /etc/security/limits.conf file [KRNL-5820] +      + +  * Check PAM configuration, add rounds if applicable and expire passwords to encrypt with new values [AUTH-9229] +      +``` + +Lynis provides an option to find more information about each suggestion, which you can access using the **show details** command followed by the test ID number: + + +``` +`./lynis show details TEST-ID` +``` + +This will show additional information about that test. For example, I checked the details of SSH-7408: + + +``` +$ ./lynis show details SSH-7408 +2020-04-30 05:52:23 Performing test ID SSH-7408 (Check SSH specific defined options) +2020-04-30 05:52:23 Test: Checking specific defined options in /tmp/lynis.k8JwazmKc6 +2020-04-30 05:52:23 Result: added additional options for OpenSSH < 7.5 +2020-04-30 05:52:23 Test: Checking AllowTcpForwarding in /tmp/lynis.k8JwazmKc6 +2020-04-30 05:52:23 Result: Option AllowTcpForwarding found +2020-04-30 05:52:23 Result: Option AllowTcpForwarding value is YES +2020-04-30 05:52:23 Result: OpenSSH option AllowTcpForwarding is in a weak configuration state and should be fixed +2020-04-30 05:52:23 Suggestion: Consider hardening SSH configuration [test:SSH-7408] [details:AllowTcpForwarding (set YES to NO)] [solution:-] +``` + +### Give it a try + +If you want to learn more about the security of your Linux machine, check out Lynis. And, if you want to learn how Lynis works, dig into its shell scripts to see how it gathers all this information. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/linux-security-lynis + +作者:[Gaurav Kamathe][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://opensource.com/users/gkamathe +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer) +[2]: https://github.com/CISOfy/lynis From 577e18be22aaf5da5f6ba518f2a28aa7f58a73fc Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 6 Oct 2020 05:02:21 +0800 Subject: [PATCH 0338/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201005?= =?UTF-8?q?=20How=20the=20Linux=20kernel=20handles=20interrupts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201005 How the Linux kernel handles interrupts.md --- ...How the Linux kernel handles interrupts.md | 113 ++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 sources/tech/20201005 How the Linux kernel handles interrupts.md diff --git a/sources/tech/20201005 How the Linux kernel handles interrupts.md b/sources/tech/20201005 How the Linux kernel handles interrupts.md new file mode 100644 index 0000000000..0258791856 --- /dev/null +++ b/sources/tech/20201005 How the Linux kernel handles interrupts.md @@ -0,0 +1,113 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How the Linux kernel handles interrupts) +[#]: via: (https://opensource.com/article/20/10/linux-kernel-interrupts) +[#]: author: (Stephan Avenwedde https://opensource.com/users/hansic99) + +How the Linux kernel handles interrupts +====== +Interrupts are a crucial part of how computers process data. +![Penguin driving a car with a yellow background][1] + +Interrupts are an essential part of how modern CPUs work. For example, every time you press a key on the keyboard, the CPU is interrupted so that the PC can read user input from the keyboard. This happens so quickly that you don't notice any change or impairment in user experience. + +Moreover, the keyboard is not the only component that can cause interrupts. In general, there are three types of events that can cause the CPU to interrupt: _Hardware interrupts_, _software interrupts_, and _exceptions_. Before getting into the different types of interrupts, I'll define some terms. + +### Definitions + +An interrupt request (**IRQ**) is requested by the programmable interrupt controller (**PIC**) with the aim of interrupting the CPU and executing the interrupt service routine (**ISR**). The ISR is a small program that processes certain data depending on the cause of the IRQ. Normal processing is interrupted until the ISR finishes. + +In the past, IRQs were handled by a separate microchip—the PIC—and I/O devices were wired directly to the PIC. The PIC managed the various hardware IRQs and could talk directly to the CPU. When an IRQ occurred, the PIC wrote the data to the CPU and raised the interrupt request (**INTR**) pin. + +Nowadays, IRQs are handled by an advanced programmable interrupt controller (**APIC**), which is part of the CPU. Each core has its own APIC. + +### Types of interrupts + +As I mentioned, interrupts can be separated into three types depending on their source: + +#### Hardware interrupts + +When a hardware device wants to tell the CPU that certain data is ready to process (e.g., a keyboard entry or when a packet arrives at the network interface), it sends an IRQ to signal the CPU that the data is available. This invokes a specific ISR that was registered by the device driver during the kernel's start. + +#### Software interrupts + +When you're playing a video, it is essential to synchronize the music and video playback so that the music's speed doesn't vary. This is accomplished through a software interrupt that is repetitively fired by a precise timer system (known as [jiffies][2]). This timer enables your music player to synchronize. A software interrupt can also be invoked by a special instruction to read or write data to a hardware device. + +Software interrupts are also crucial when real-time capability is required (such as in industrial applications). You can find more information about this in the Linux Foundation's article _[Intro to real-time Linux for embedded developers][3]_. + +#### Exceptions + +Exceptions are the type of interrupt that you probably know about. When the CPU executes a command that would result in division by zero or a page fault, any additional execution is interrupted. In such a case, you will be informed about it by a pop-up window or by seeing **segmentation fault (core dumped)** in the console output. But not every exception is caused by a faulty instruction. + +Exceptions can be further divided into _Faults_, _Traps_, and _Aborts_. + + * **Faults:** Faults are an exception that the system can correct, e.g., when a process tries to access data from a memory page that was swapped to the hard drive. The requested address is within the process address space, and the access rights are correct. If the page is not present in RAM, an IRQ is raised and it starts the **page fault exception handler** to load the desired memory page into RAM. If the operation is successful, execution will continue. + * **Traps:** Traps are mainly used for debugging. If you set a breakpoint in a program, you insert a special instruction that causes it to trigger a trap. A trap can trigger a context switch that allows your debugger to read and display values of local variables. Execution can continue afterward. Traps are also the default way to execute system calls (like killing a process). + * **Aborts:** Aborts are caused by hardware failure or inconsistent values in system tables. An abort does not report the location of the instruction that causes the exception. These are the most critical interrupts. An abort invokes the system's **abort exception handler**, which terminates the process that caused it. + + + +### Get hands-on + +IRQs are ordered by priority in a vector on the APIC (0=highest priority). The first 32 interrupts (0–31) have a fixed sequence that is specified by the CPU. You can find an overview of them on [OsDev's Exceptions][4] page. Subsequent IRQs can be assigned differently. The interrupt descriptor table (**IDT**) contains the assignment between IRQ and ISR. Linux defines an IRQ vector from 0 to 256 for the assignment. + +To print a list of registered interrupts on your system, open a console and type: + + +``` +`cat /proc/interrupts` +``` + +You should see something like this: + +![Registered interrupts list][5] + +Registered interrupts in kernel version 5.6.6 (Stephan Avenwedde, [CC BY-SA 4.0][6]) + +From left to right, the columns are: IRQ vector, interrupt count per CPU (`0 .. n`), the hardware source, the hardware source's channel information, and the name of the device that caused the IRQ. + +On the bottom of the table, there are some non-numeric interrupts. They are the architecture-specific interrupts, like the local timer interrupt (**LOC**) on IRQ 236. Some of them are specified in the [Linux IRQ vector layout][7] in the Linux kernel source tree. + +![Architecture-specific interrupts][8] + +Architecture-specific interrupts (Stephan Avenwedde, [CC BY-SA 4.0][6]) + +To get a live view of this table, run: + + +``` +`watch -n1 "cat /proc/interrupts"` +``` + +### Conclusion + +Proper IRQ handling is essential for the proper interaction of hardware, drivers, and software. Luckily, the Linux kernel does a really good job, and a normal PC user will hardly notice anything about the kernel's entire interrupt handling. + +This can get very complicated, and this article gives only a brief overview of the topic. Good sources of information for a deeper dive into the subject are the _[Linux Inside][9]_ eBook (CC BY-NC-SA 4.0) and the [Linux Kernel Teaching][10] repository. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/linux-kernel-interrupts + +作者:[Stephan Avenwedde][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://opensource.com/users/hansic99 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/car-penguin-drive-linux-yellow.png?itok=twWGlYAc (Penguin driving a car with a yellow background) +[2]: https://elinux.org/Kernel_Timer_Systems +[3]: https://www.linuxfoundation.org/blog/2013/03/intro-to-real-time-linux-for-embedded-developers/ +[4]: https://wiki.osdev.org/Exceptions +[5]: https://opensource.com/sites/default/files/uploads/proc_interrupts_1.png (Registered interrupts list) +[6]: https://creativecommons.org/licenses/by-sa/4.0/ +[7]: https://github.com/torvalds/linux/blob/master/arch/x86/include/asm/irq_vectors.h +[8]: https://opensource.com/sites/default/files/uploads/proc_interrupts_2.png (Architecture-specific interrupts) +[9]: https://0xax.gitbooks.io/linux-insides/content/Interrupts/ +[10]: https://linux-kernel-labs.github.io/refs/heads/master/lectures/interrupts.html# From 7de43b2ce72ec7610fca537f0772cf7d7bad4820 Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Tue, 6 Oct 2020 08:56:30 +0800 Subject: [PATCH 0339/1156] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=AF=91=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...719 Building a Messenger App- Home Page.md | 91 +++++++++---------- 1 file changed, 45 insertions(+), 46 deletions(-) diff --git a/sources/tech/20180719 Building a Messenger App- Home Page.md b/sources/tech/20180719 Building a Messenger App- Home Page.md index 991b9ebe35..ad3cd30125 100644 --- a/sources/tech/20180719 Building a Messenger App- Home Page.md +++ b/sources/tech/20180719 Building a Messenger App- Home Page.md @@ -7,44 +7,43 @@ [#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-home-page/) [#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) -Building a Messenger App: Home Page +构建一个即时消息应用(八):Home 页面 ====== -This post is the 8th on a series: +本文是该系列的第八篇。 - * [Part 1: Schema][1] - * [Part 2: OAuth][2] - * [Part 3: Conversations][3] - * [Part 4: Messages][4] - * [Part 5: Realtime Messages][5] - * [Part 6: Development Login][6] - * [Part 7: Access Page][7] + * [第一篇: 模式][1] + * [第二篇: OAuth][2] + * [第三篇: 对话][3] + * [第四篇: 消息][4] + * [第五篇: 实时消息][5] + * [第六篇: 仅用于开发的登录][6] + * [第七篇: Access 页面][7] +继续前端部分,让我们在本文中完成 Home 页面的开发。 我们将添加一个开始对话的表单和一个包含最新对话的列表。 -Continuing the frontend, let’s finish the home page in this post. We’ll add a form to start conversations and a list with the latest ones. - -### Conversation Form +### 对话表单 ![conversation form screenshot][8] -In the `static/pages/home-page.js` file add some markup in the HTML view. +转到 `static/ages/home-page.js` 文件,在 HTML 视图中添加一些标记。 -``` +```html
``` -Add that form just below the section in which we displayed the auth user and logout button. +将该表单添加到我们显示 auth user 和 logout 按钮部分的下方。 -``` +```js page.getElementById('conversation-form').onsubmit = onConversationSubmit ``` -Now we can listen to the “submit” event to create the conversation. +现在我们可以监听 “submit” 事件来创建对话了。 -``` +```js import http from '../http.js' import { navigate } from '../router.js' @@ -79,15 +78,15 @@ function createConversation(username) { } ``` -On submit we do a POST request to `/api/conversations` with the username and redirect to the conversation page (for the next post). +在提交时,我们使用用户名对 `/api/conversations` 进行 POST 请求,并重定向到 conversation 页面 (用于下一篇文章)。 -### Conversation List +### 对话列表 ![conversation list screenshot][9] -In the same file, we are going to make the `homePage()` function async to load the conversations first. +还是在这个文件中,我们将创建 `homePage()` 函数用来先异步加载对话。 -``` +```js export default async function homePage() { const conversations = await getConversations().catch(err => { console.error(err) @@ -101,24 +100,24 @@ function getConversations() { } ``` -Then, add a list in the markup to render conversations there. +然后,在标记中添加一个列表来渲染对话。 -``` +```html
    ``` -Add it just below the current markup. +将其添加到当前标记的正下方。 -``` +```js const conversationsOList = page.getElementById('conversations') for (const conversation of conversations) { conversationsOList.appendChild(renderConversation(conversation)) } ``` -So we can append each conversation to the list. +因此,我们可以将每个对话添加到这个列表中。 -``` +```js import { avatar, escapeHTML } from '../shared.js' function renderConversation(conversation) { @@ -146,11 +145,11 @@ function renderConversation(conversation) { } ``` -Each conversation item contains a link to the conversation page and displays the other participant info and a preview of the last message. Also, you can use `.hasUnreadMessages` to add a class to the item and do some styling with CSS. Maybe a bolder font or accent the color. +每个对话条目都包含一个指向对话页面的链接,并显示其他参与者信息和最后一条消息的预览。另外,您可以使用 `.hasUnreadMessages` 向该条目添加一个类,并使用 CSS 进行一些样式设置。也许是粗体字体或强调颜色。 -Note that we’re escaping the message content. That function comes from `static/shared.js`: +请注意,我们需要转义信息的内容。该函数来自于 `static/shared.js` 文件: -``` +```js export function escapeHTML(str) { return str .replace(/&/g, '&') @@ -161,35 +160,35 @@ export function escapeHTML(str) { } ``` -That prevents displaying as HTML the message the user wrote. If the user happens to write something like: +这会阻止将用户编写的消息显示为 HTML。如果用户碰巧编写了类似以下内容的代码: -``` +```js ``` -It would be very annoying because that script will be executed 😅 -So yeah, always remember to escape content from untrusted sources. +这将非常烦人,因为该脚本将被执行😅。 +所以,永远记住要转义来自不可信来源的内容。 -### Messages Subscription +### 消息订阅 -Last but not least, I want to subscribe to the message stream here. +最后但并非最不重要的一点,我想在这里订阅消息流。 -``` +```js const unsubscribe = subscribeToMessages(onMessageArrive) page.addEventListener('disconnect', unsubscribe) ``` -Add that line in the `homePage()` function. +在 `homePage()` 函数中添加这一行。 -``` +```js function subscribeToMessages(cb) { return http.subscribe('/api/messages', cb) } ``` -The `subscribe()` function returns a function that once called it closes the underlying connection. That’s why I passed it to the “disconnect” event; so when the user leaves the page, the event stream will be closed. +函数 `subscribe()` 返回一个函数,该函数一旦调用就会关闭底层连接。这就是为什么我把它传递给 “断开连接”disconnect事件的原因;因此,当用户离开页面时,事件流将被关闭。 -``` +```js async function onMessageArrive(message) { const conversationLI = document.querySelector(`li[data-id="${message.conversationID}"]`) if (conversationLI !== null) { @@ -221,12 +220,12 @@ function getConversation(id) { } ``` -Every time a new message arrives, we go and query for the conversation item in the DOM. If found, we add the `has-unread-messages` class to the item, and update the view. If not found, it means the message is from a new conversation created just now. We go and do a GET request to `/api/conversations/{conversationID}` to get the conversation in which the message was created and prepend it to the conversation list. +每次有新消息到达时,我们都会在 DOM 中查询会话条目。如果找到,我们会将 `has-unread-messages` 类添加到该条目中,并更新视图。如果未找到,则表示该消息来自刚刚创建的新对话。我们去做一个对 `/api/conversations/{conversationID}` 的 GET 请求,以获取在其中创建消息的对话,并将其放在对话列表的前面。 * * * -That covers the home page 😊 -On the next post we’ll code the conversation page. +以上这些涵盖了主页的所有内容 😊。 +在下一篇文章中,我们将对 conversation 页面进行编码。 [Souce Code][10] @@ -236,7 +235,7 @@ via: https://nicolasparada.netlify.com/posts/go-messenger-home-page/ 作者:[Nicolás Parada][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[译者ID](https://github.com/gxlct008) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 4319ae6f8d5da85846808979e3da57fed64c4bf3 Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Tue, 6 Oct 2020 08:57:48 +0800 Subject: [PATCH 0340/1156] =?UTF-8?q?=E5=B0=86=E8=AF=91=E6=96=87=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E5=88=B0=20translated/tech/=20=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20180719 Building a Messenger App- Home Page.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20180719 Building a Messenger App- Home Page.md (100%) diff --git a/sources/tech/20180719 Building a Messenger App- Home Page.md b/translated/tech/20180719 Building a Messenger App- Home Page.md similarity index 100% rename from sources/tech/20180719 Building a Messenger App- Home Page.md rename to translated/tech/20180719 Building a Messenger App- Home Page.md From 02bbf2e190c0ced745a2bdfaf42992fbe3a3c577 Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Tue, 6 Oct 2020 09:00:57 +0800 Subject: [PATCH 0341/1156] =?UTF-8?q?=E7=94=B3=E9=A2=86=E5=8E=9F=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20180720 Building a Messenger App- Conversation Page.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20180720 Building a Messenger App- Conversation Page.md b/sources/tech/20180720 Building a Messenger App- Conversation Page.md index c721b48161..811dd3c60e 100644 --- a/sources/tech/20180720 Building a Messenger App- Conversation Page.md +++ b/sources/tech/20180720 Building a Messenger App- Conversation Page.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (gxlct008) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From a35f9fed990bbd9aeb18a5942f437c1be2009c13 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 6 Oct 2020 20:03:16 +0800 Subject: [PATCH 0342/1156] APL --- sources/tech/20200512 Scan your Linux security with Lynis.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200512 Scan your Linux security with Lynis.md b/sources/tech/20200512 Scan your Linux security with Lynis.md index 37410fa738..139beac85d 100644 --- a/sources/tech/20200512 Scan your Linux security with Lynis.md +++ b/sources/tech/20200512 Scan your Linux security with Lynis.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From b2754093683fce8b132552e67fc3159e464c7e8e Mon Sep 17 00:00:00 2001 From: "Xiaobin.Liu" Date: Tue, 6 Oct 2020 20:27:06 +0800 Subject: [PATCH 0343/1156] TSL --- ...or website errors with this Python tool.md | 149 ++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 translated/tech/20200723 Automate testing for website errors with this Python tool.md diff --git a/translated/tech/20200723 Automate testing for website errors with this Python tool.md b/translated/tech/20200723 Automate testing for website errors with this Python tool.md new file mode 100644 index 0000000000..5d69bf3c03 --- /dev/null +++ b/translated/tech/20200723 Automate testing for website errors with this Python tool.md @@ -0,0 +1,149 @@ +[#]: collector: "lujun9972" +[#]: translator: "lxbwolf" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "Automate testing for website errors with this Python tool" +[#]: via: "https://opensource.com/article/20/7/seodeploy" +[#]: author: "JR Oakes https://opensource.com/users/jroakes" + +使用这个 Python 工具对网站错误进行自动化测试 +====== +SEODeploy 可以帮助我们在网站部署之前识别出 SEO 问题。 +![Computer screen with files or windows open][1] + +作为一个有技术的搜索引擎优化开发者,我经常被请来协助做网站迁移、新网站启动、分析实现和一些其他影响网站线上可视性和控制风险的测量方法的工作。很多公司从用户通过搜索引擎查到他们的产品和服务这个途径每月都能获得大量的收入。虽然搜索引擎已经能妥善地处理没有被很好地格式化的代码,但是在开发过程中影响搜索引擎索引和用户展示页的问题还是会发生。 + +我曾经也尝试通过评审各阶段会破坏SEO(搜索引擎优化search engine optimization)的问题来手动降低这种风险。我的团队最终查到的结果,决定该项目是否可以上线。但这个过程通常很低效,只能依靠有限的几个页面,且人工极易出错。 + +长期以来,这个行业一直在寻找可用且值得信赖的方式,在开发者和搜索引擎优化者可以指定必须测试的内容的前提下进行自动化测试。这是非常重要的,因为这些组在开发过程中优先级通常会发生冲突,搜索引擎优化者提交修改的同时,开发者也需要进行回归测试和控制预期之外的情况。 + +### 常见的破坏 SEO 的问题 + +我见过的很多网站有成千上万的页面,甚至上百万。实在令人费解,为什么一个开发过程中的改动能影响这么多页面。在 SEO 的世界中, Google 或其他搜索引擎展示你的页面时,一个非常微小和看起来无关紧要的修改也可能导致全网站范围的变化。在部署到生产环境之前,必须要处理这类错误。 + +下面是我去年见过的几个例子。 + +#### 偶发的 noindex + +我们用的一个专用的第三方 SEO 监控工具,[ContentKing][2],在部署到生产环境之后马上发现了这个问题。这个错误很隐蔽,因为在 HTML 中是不可见的,确切地说,它隐藏在服务器响应头里,但它能很快导致搜索不可见。 + + +``` +HTTP/1.1 200 OK +Date: Tue May 25 2010 21:12:42 GMT +[...] +X-Robots-Tag: noindex +[...] +``` + +#### canonical 小写 + +上线时错误地把整个网站的 [canonical 标签元素][3]全改成小写了。这个改动影响了接近 30000 个 URL。在修改之前,所有的 URL 大小写都正常(例如,`URL-Path`)。这之所以是个问题是因为 canonical 标签元素是用来给 Google 提示一个网页真实的 canonical URL 版本的。这个改动导致很多 URL 被从 Google 的索引中移除并用小写(`/url-path`)重新建立索引。影响范围是流量损失了 10% 到 15%,也污染了未来几个星期的网页监控数据。 + +#### origin 的退化 + +一个有复杂、React 的奇特实现的网站有个神奇的问题,`origin.domain.com` URL 退化为显示原始的内容交付网络服务器。它会间歇性地显示原始的主机而不是网站元数据中的边缘主机(如 canonical 标签元素、URL 和 Open Graph 标签)。这个问题在原始的 HTML 和渲染后的 HTML 中都存在。这个问题影响搜索的可见度和在社交媒体上分享的质量。 + +### SEODeploy 介绍 + +SEO 通常使用差异测试工具来检测渲染后和原始的 HTML 的差异。差异测试是很理想的,因为它避免了肉眼测试的不确定性。你希望检查 Google 对你的页面的渲染过程的不同,而不是检查用户对你页面的渲染。你希望查看下原始的 HTML 是什么样的,而不是渲染后的 HTML,因为 Google 的渲染过程是有独立的两个阶段的。 + +这导致我和我的同事创造了 [SEODeploy][4] 这个“在部署流水线中用于自动化 SEO 测试的 Python 库。”我们的使命是: + +> 开发一个工具,让开发者能通过修改 URL 路径在生产环境和分阶段的主机上进行差异测试,尤其是对 SEO 相关数据的非预期的退化的测试。 + +SEODeploy 的机制很简单:提供一个每行内容都是 URL 路径的文本文件,SEODeploy 对那些路径跑一系列的模块,对比生产环境和保存的 URL,把检测到的所有的错误和改动信息报告出来。 + +![SEODeploy overview][5] + +(SEODeploy, [CC BY-SA 4.0][6]) + +这个工具及其模块可以用一个 YAML 文件来配置,在可预期的范围内可以自定义。 + +![SEODeploy output][7] + +(SEODeploy, [CC BY-SA 4.0][6]) + +最初的发布版本包含下面的的核心功能和概念: + + 1. **开源**:我们坚信分享代码可以被大家评论、改进、扩展、分享和复用。 + 2. **模块化**:Web 开发中有很多边界条件。SEODeploy 工具在概念上很简单,因此模块化用来控制复杂性。我们提供了两个建好的模块和一个实例模块来简述基本结构。 + 3. **URL 抽样:**由于它不是对所有 URL 都是可行和有效的,因此我们引入了一种随机抽取 XML 网站地图 URL 或被 ContentKing 监控的 URL 作为样本的方法。 + 4. **灵活的差异检测**:Web 数据是凌乱的。无论被检测的数据是什么类型(如 延伸文件系统、数组或列表、JSON 对象或字典、整数、浮点数等等),差异检测功能都会尝试将这些数据转换为差异信息。 + 5. **自动化**: 你可以在命令行来调用抽样和运行方法,将 SEODeploy 融合到已有的流水线也很简单。 + + + +### 模块 + +虽然核心功能很简单,但在设计上,SEODeploy 的强大功能和复杂度体现在模块上。模块用来处理获取、清理和组织暂存区和生产服务器上的数据来作对比时难度更大的任务。 + +#### Headless 模块 + +[Headless 模块][8] 是为那些从库里获取数据时不想为第三方服务付费的开发者准备的。它可以在任意版本的 Chrome 上运行,会从每组用来比较的 URL 中提取渲染的数据。 + +headless 模块会提取下面的核心数据用来比较: + + 1. SEO 内容,如 标题、头、标签等等。 + 2. Performance data from the Chrome Timings and Chrome DevTools Protocol (CDP) Performance APIs从Chrome 读写周期和 CDP(Chrome 开发工具协议Chrome DevTools Protocol)性能 API 中提取性能数据 + 3. 经过计算的性能监控,包括 CLS,一项由 Google 最近发布的很受欢迎的 [Web 核心数据][9] + 4. 从 CDP 覆盖率 API 获取的 CSS 和 JavaScript 的覆盖率数据 + + + +这个模块引入了处理暂存区、网络速度预设(为了让对比更规范化)等功能,也引入了一个处理在暂存的对比数据中替换临时主机的方法。开发者也能很容易地扩展这个模块,来获取他们想对任意网页进行对比的数据。 + +#### 其他模块 + +我们为开发者创建了一个[示例模块][10],开发者可以参照它来使用框架创建一个自定义的提取模块。这个示例模块也是与 ContentKing 结合的。ContentKing 模块需要订阅 ContentKing,Headless 可以在所有能运行 Chrome 的机器上运行。 + +### 需要解决的问题 + +我们有扩展和强化工具库的[计划][11],但是我们看到了开发者们对于能满足和不能满足他们需求的[反馈][12]。我们正在解决的问题和条目有: + + 1. 对于某些对比元素(尤其是 schema),动态时间戳产生假阳性。 + 2. 把测试数据保存到数据库,以便查看部署历史以及与上次暂存的推送进行差异测试。 + 3. 借助渲染相关的云基础设施强化提取的精度和速度。 + 4. 把测试覆盖率从现在的 46% 提高到 99% 以上。 + 5. 目前,我们依赖 [Poetry][13] 进行部署管理,但我们希望发布一个 PyPl 库,这样就可以用 `pip install` 轻松安装。 + 6. 我们还在关注更多使用时的问题和相关数据。 + + + +### 开始使用 + +这个项目在 [GitHub][4] 上,我们对大部分功能都提供了 [文档][14]。 + +我们希望你能克隆 SEODeploy 并为其贡献代码。我们的目标是通过这个由技术精湛的搜索引擎优化开发者开发的、经过开发者和工程师们认证的工具来为开源作贡献。我们都见过验证复杂的暂存问题需要多长时间,也都见过大量 URL 的微小改动能有什么样的商业影响。我们认为这个库可以节省时间、为开发团队降低部署过程中的风险。 + +If you have questions, issues, or want to contribute, please see the project's [About page][15].如果你有问题或者想提交代码,请查看项目的[关于][15]。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/seodeploy + +作者:[JR Oakes][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jroakes +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_screen_windows_files.png?itok=kLTeQUbY "Computer screen with files or windows open" +[2]: https://www.contentkingapp.com/ +[3]: https://en.wikipedia.org/wiki/Canonical_link_element +[4]: https://github.com/locomotive-agency/SEODeploy +[5]: https://opensource.com/sites/default/files/uploads/seodeploy.png "SEODeploy overview" +[6]: https://creativecommons.org/licenses/by-sa/4.0/ +[7]: https://opensource.com/sites/default/files/uploads/seodeploy_output.png "SEODeploy output" +[8]: https://locomotive-agency.github.io/SEODeploy/modules/headless/ +[9]: https://web.dev/vitals/ +[10]: https://locomotive-agency.github.io/SEODeploy/modules/creating/ +[11]: https://locomotive-agency.github.io/SEODeploy/todo/ +[12]: https://locomotive-agency.github.io/SEODeploy/about/#contact +[13]: https://python-poetry.org/ +[14]: https://locomotive-agency.github.io/SEODeploy/ +[15]: https://locomotive-agency.github.io/SEODeploy/about/ From 414f0bbc907ff83c69d2e9a7352faa6b60f187d5 Mon Sep 17 00:00:00 2001 From: "Xiaobin.Liu" Date: Tue, 6 Oct 2020 20:28:05 +0800 Subject: [PATCH 0344/1156] TSL --- ...or website errors with this Python tool.md | 150 ------------------ 1 file changed, 150 deletions(-) delete mode 100644 sources/tech/20200723 Automate testing for website errors with this Python tool.md diff --git a/sources/tech/20200723 Automate testing for website errors with this Python tool.md b/sources/tech/20200723 Automate testing for website errors with this Python tool.md deleted file mode 100644 index c854b5e342..0000000000 --- a/sources/tech/20200723 Automate testing for website errors with this Python tool.md +++ /dev/null @@ -1,150 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lxbwolf) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Automate testing for website errors with this Python tool) -[#]: via: (https://opensource.com/article/20/7/seodeploy) -[#]: author: (JR Oakes https://opensource.com/users/jroakes) - -Automate testing for website errors with this Python tool -====== -SEODeploy helps identify SEO problems in a website before they're -deployed. -![Computer screen with files or windows open][1] - -As a technical search-engine optimizer, I'm often called in to coordinate website migrations, new site launches, analytics implementations, and other areas that affect sites' online visibility and measurement to limit risk. Many companies generate a substantial portion of monthly recurring revenue from users finding their products and services through search engines. Although search engines have gotten good at handling poorly formatted code, things can still go wrong in development that adversely affects how search engines index and display pages for users. - -I've been part of manual processes attempting to mitigate this risk by reviewing staged changes for search engine optimization (SEO)-breaking problems. My team's findings determine whether the project gets the green light (or not) to launch. But this process is often inefficient, can be applied to only a limited number of pages, and has a high likelihood of human error. - -The industry has long sought a usable and trustworthy way to automate this process while still giving developers and search-engine optimizers a meaningful say in what must be tested. This is important because these groups often have competing priorities in development sprints, with search-engine optimizers pushing for changes and developers needing to control regressions and unexpected experiences. - -### Common SEO-breaking problems - -Many websites I work with have tens of thousands of pages. Some have millions. It's daunting to understand how a development change might affect so many pages. In the world of SEO, you can see large, sitewide changes in how Google and other search engines show your pages from very minor and seemingly innocuous changes. It's imperative to have processes in place that catch these types of errors before they make it to production. - -Below are a few examples of problems that I have seen in the last year. - -#### Accidental noindex - -A proprietary third-party SEO monitoring tool we use, [ContentKing][2], found this problem immediately after launch to production. This is a sneaky error because it's not visible in the HTML, rather it is hidden from view in the server response header, yet it can very quickly cause the loss of your search visibility. - - -``` -HTTP/1.1 200 OK -Date: Tue May 25 2010 21:12:42 GMT -[...] -X-Robots-Tag: noindex -[...] -``` - -#### Canonical lower-casing - -A change to production mistakenly lower-cased an entire website's [canonical link elements][3]. The change affected nearly 30,000 URLs. Before the update, the URLs were in title case (for instance, `/URL-Path/`). This is a problem because the canonical link element is a hint for Google about a webpage's true canonical URL version. This change caused many URLs to be removed from Google's index and re-indexed at the new uncased location (`/url-path/`). The impact was a loss of 10–15% of traffic and corruption of page metric data over the next few weeks. - -#### Origin server regression - -One website with a complex and novel implementation of React had a mysterious issue with regression of `origin.domain.com` URLs displaying for its origin content-delivery network server. It would intermittently output the origin host instead of the edge host in the site metadata (such as the canonical link element, URLs, and Open Graph links). The problem was found in the raw HTML and the rendered HTML. This impacted search visibility and the quality of shares on social media. - -### Introducing SEODeploy - -SEOs often use diff-testing tools to look at changes between sets of rendered and raw HTML. Diff testing is ideal because it allows certainty that the eye does not. You want to look for differences in how Google renders your page, not how users do. You want to look at what the raw HTML looks like, not the rendered HTML, as these are two separate processing steps for Google. - -This led my colleagues and me to create [SEODeploy][4], a "Python library for automating SEO testing in deployment pipelines." Our mission was: - -> To develop a tool that allowed developers to provide a few to many URL paths, and which allowed those paths to be diff tested on production and staging hosts, looking specifically for unanticipated regressions in SEO-related data. - -SEODeploy's mechanics are simple: Provide a text file containing a newline-delimited set of paths, and the tool runs a series of modules on those paths, comparing production and staging URLs and reporting on any errors or messages (changes) it finds. - -![SEODeploy overview][5] - -(SEODeploy, [CC BY-SA 4.0][6]) - -The configuration for the tool and modules is just one YAML file, which can be customized based on anticipated changes. - -![SEODeploy output][7] - -(SEODeploy, [CC BY-SA 4.0][6]) - -The initial release includes the following core features and concepts: - - 1. **Open source**: We believe deeply in sharing code that can be criticized, improved, extended, shared, and reused. - 2. **Modular**: There are many different stacks and edge cases in development for the web. The SEODeploy tool is conceptually simple, so modularity is used to control the complexity. We provide two built modules and an example module that outline the basic structure. - 3. **URL sampling:** Since it is not always feasible or efficient to test every URL, we included a method to randomly sample XML sitemap URLs or URLs monitored by ContentKing. - 4. **Flexible diff checking**: Web data is messy. The diff checking functionality tries to do a good job of converting this data to messages (changes) no matter the data type it's checking, including ext, arrays (lists), JSON objects (dictionaries), integers, floats, etc. - 5. **Automated**: A simple command-line interface is used to call the sampling and execution methods to make it easy to incorporate SEODeploy into existing pipelines. - - - -### Modules - -While the core functionality is simple, by design, modules are where SEODeploy gains features and complexity. The modules handle the harder task of getting, cleaning, and organizing the data collected from staging and production servers for comparison. - -#### Headless module - -The tool's [Headless module][8] is a nod to anyone who doesn't want to have to pay for a third-party service to get value from the library. It runs any version of Chrome and extracts rendered data from each comparison set of URLs. - -The headless module extracts the following core data for comparison: - - 1. SEO content, e.g., titles, headings, links, etc. - 2. Performance data from the Chrome Timings and Chrome DevTools Protocol (CDP) Performance APIs - 3. Calculated performance metrics including the Cumulative Layout Shift (CLS), a recently popular [Web Vital][9] released by Google - 4. Coverage data for CSS and JavaScript from the CDP Coverage API - - - -The module includes functionality to handle authentication for staging, network speed presets (for better normalization of comparisons), as well as a method for handling staging-host replacement in staging comparative data. It should be fairly easy for developers to extend this module to collect any other data they want to compare per page. - -#### Other modules - -We created an [example module][10] for any developer who wants to use the framework to create a custom extraction module. Another module integrates with ContentKing. Note that the ContentKing module requires a subscription to ContentKing, while Headless can be run on any machine capable of running Chrome. - -### Problems to solve - -We have [plans][11] to extend and enhance the library but are looking for [feedback][12] from developers on what works and what doesn't meet their needs. A few of the issues and items on our list are: - - 1. Dynamic timestamps create false positives for some comparison elements, especially schema. - 2. Saving test data to a database to enable reviewing historical deployment processes and testing changes against the last staging push. - 3. Enhancing the scale and speed of the extraction with a cloud infrastructure for rendering. - 4. Increasing testing coverage from the current 46% to 99%-plus. - 5. Currently, we rely on [Poetry][13] for dependency management, but we want to publish a PyPl library so it can be installed easily with `pip install`. - 6. We are looking for more issues and field data on usage. - - - -### Get started - -The project is [on GitHub][4], and we have [documentation][14] for most features. - -We hope that you will clone SEODeploy and give it a go. Our goal is to support the open source community with a tool developed by technical search-engine optimizers and validated by developers and engineers. We've seen the time it takes to validate complex staging issues and the business impact minor changes can have across many URLs. We think this library can save time and de-risk the deployment process for development teams. - -If you have questions, issues, or want to contribute, please see the project's [About page][15]. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/7/seodeploy - -作者:[JR Oakes][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://opensource.com/users/jroakes -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_screen_windows_files.png?itok=kLTeQUbY (Computer screen with files or windows open) -[2]: https://www.contentkingapp.com/ -[3]: https://en.wikipedia.org/wiki/Canonical_link_element -[4]: https://github.com/locomotive-agency/SEODeploy -[5]: https://opensource.com/sites/default/files/uploads/seodeploy.png (SEODeploy overview) -[6]: https://creativecommons.org/licenses/by-sa/4.0/ -[7]: https://opensource.com/sites/default/files/uploads/seodeploy_output.png (SEODeploy output) -[8]: https://locomotive-agency.github.io/SEODeploy/modules/headless/ -[9]: https://web.dev/vitals/ -[10]: https://locomotive-agency.github.io/SEODeploy/modules/creating/ -[11]: https://locomotive-agency.github.io/SEODeploy/todo/ -[12]: https://locomotive-agency.github.io/SEODeploy/about/#contact -[13]: https://python-poetry.org/ -[14]: https://locomotive-agency.github.io/SEODeploy/ -[15]: https://locomotive-agency.github.io/SEODeploy/about/ From 45088d90c9d203898a7fedefc3edb19c321b0edc Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 6 Oct 2020 21:22:15 +0800 Subject: [PATCH 0345/1156] TSL&PRF --- ...512 Scan your Linux security with Lynis.md | 184 ++++++++---------- 1 file changed, 82 insertions(+), 102 deletions(-) rename {sources => translated}/tech/20200512 Scan your Linux security with Lynis.md (60%) diff --git a/sources/tech/20200512 Scan your Linux security with Lynis.md b/translated/tech/20200512 Scan your Linux security with Lynis.md similarity index 60% rename from sources/tech/20200512 Scan your Linux security with Lynis.md rename to translated/tech/20200512 Scan your Linux security with Lynis.md index 139beac85d..9abfc2984c 100644 --- a/sources/tech/20200512 Scan your Linux security with Lynis.md +++ b/translated/tech/20200512 Scan your Linux security with Lynis.md @@ -1,44 +1,42 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Scan your Linux security with Lynis) [#]: via: (https://opensource.com/article/20/5/linux-security-lynis) [#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe) -Scan your Linux security with Lynis +使用 Lynis 扫描 Linux 安全性 ====== -Check the security of your Linux box with this comprehensive open source -security auditing tool. -![Hand putting a Linux file folder into a drawer][1] -Have you ever thought about how secure your Linux machine really is? There are numerous Linux distros, each with its own default settings, on which you run dozens of software packages with different version numbers, and numerous services running in the background, which we hardly know or care about. +> 使用这个全面的开源安全审计工具检查你的 Linux 机器的安全性。 -To find the security posture—the overall security status of the software, network, and services running on your Linux machine—you could run a few commands and get bits and pieces of relevant information, but the amount of data you need to parse is huge. +!["手把一个Linux文件夹放进抽屉"][1] -It would be so much better if you could just run a tool that generates a report on a machine's security posture. And luckily there is one: [Lynis][2]. It is an extremely popular open source security auditing tool that helps with hardening Linux- and Unix-based systems. According to the project: +你有没有想过你的 Linux 机器到底安全不安全?Linux 发行版众多,每个发行版都有自己的默认设置,你在上面运行着几十个版本各异的软件包,还有众多的服务在后台运行,而我们几乎不知道或不关心这些。 -> "It performs an in-depth security scan and runs on the system itself. The primary goal is to test security defenses and provide tips for further system hardening. It will also scan for general system information, vulnerable software packages, and possible configuration issues. Lynis [is] commonly used by system administrators and auditors to assess the security defenses of their systems." +要想确定安全态势(指你的 Linux 机器上运行的软件、网络和服务的整体安全状态),你可以运行几个命令,得到一些零碎的相关信息,但你需要解析的数据量是巨大的。 -### Install Lynis +如果能运行一个工具,生成一份关于机器安全状况的报告,那就好得多了。而幸运的是,有一个这样的软件:[Lynis][2]。它是一个非常流行的开源安全审计工具,可以帮助强化基于 Linux 和 Unix 的系统。根据该项目的介绍: -Lynis might be available in your Linux software repository. If so, you can install it using: +> “它运行在系统本身,可以进行深入的安全扫描。主要目标是测试安全防御措施,并提供进一步强化系统的提示。它还将扫描一般系统信息、易受攻击的软件包和可能的配置问题。Lynis 常被系统管理员和审计人员用来评估其系统的安全防御。” +### 安装 Lynis + +Lynis 可能在你的 Linux 软件仓库中可用。如果有的话,你可以用以下方法安装它: ``` -`dnf install lynis` +dnf install lynis ``` -or - +或 ``` -`apt install lynis` +apt install lynis ``` -However, if the version in your repo isn't the latest one, you are better off installing it from GitHub. (I am using a Red Hat Linux system, but you can run it on any Linux distribution.) As with all tools, it makes sense to try it out on a virtual machine first. To install it from GitHub: - +然而,如果你的仓库中的版本不是最新的,你最好从 GitHub 上安装它。(我使用的是 Red Hat Linux 系统,但你可以在任何 Linux 发行版上运行它)。就像所有的工具一样,先在虚拟机上试一试是有意义的。要从 GitHub 上安装它: ``` $ cat /etc/redhat-release @@ -47,7 +45,7 @@ $ $ uname  -r 3.10.0-1127.el7.x86_64 $ -$ git clone +$ git clone https://github.com/CISOfy/lynis.git Cloning into 'lynis'... remote: Enumerating objects: 30, done. remote: Counting objects: 100% (30/30), done. @@ -58,8 +56,7 @@ Resolving deltas: 100% (9264/9264), done. $ ``` -Once you have cloned the repository, move into it and see what is available. The main tool is in a file called **lynis**. It's actually a shell script, so you can open it and read what it is doing. In fact, Lynis is mainly implemented using shell scripts: - +一旦你克隆了这个版本库,就进入该目录,看看里面有什么可用的。主要的工具在一个叫 `lynis` 的文件里。它实际上是一个 shell 脚本,所以你可以打开它看看它在做什么。事实上,Lynis 主要是用 shell 脚本来实现的: ``` $ cd lynis/ @@ -72,19 +69,17 @@ lynis: POSIX shell script, ASCII text executable, with very long lines $ ``` -### Run Lynis - -Take Lynis out for a spin by giving it a **-h** option to see the Help section: +### 运行 Lynis +通过给 Lynis 一个 `-h` 选项来查看帮助部分来了解一下: ``` -`$ ./lynis -h` +$ ./lynis -h ``` -You'll see a short information screen followed by all the commands that Lynis supports. - -Next, try out some test commands to get a feel for things and get comfortable. To see which version of Lynis you are working with, run: +你会看到一个简短的信息屏幕,然后是 Lynis 支持的所有子命令。 +接下来,尝试一些测试命令以大致熟悉一下。要查看你正在使用的 Lynis 版本,请运行: ``` $ ./lynis show version @@ -92,8 +87,7 @@ $ ./lynis show version $ ``` -To see all the commands available in Lynis: - +要查看 Lynis 中所有可用的命令: ``` $ ./lynis show commands @@ -109,19 +103,17 @@ lynis upload-only $ ``` -### Audit a Linux system - -To audit your system's security posture, run the following command: +### 审计 Linux 系统 +要审计你的系统的安全态势,运行以下命令: ``` -`$ ./lynis audit system` +$ ./lynis audit system ``` -This runs quickly and returns a detailed report—the output might seem intimidating at first, but I'll walk you through it below. The command's output is also saved to a log file, so you can always go back later and check anything that might be of interest. - -Lynis saves the logs here: +这个命令运行得很快,并会返回一份详细的报告,输出结果可能一开始看起来很吓人,但我将在下面引导你来阅读它。这个命令的输出也会被保存到一个日志文件中,所以你可以随时回过头来检查任何可能感兴趣的东西。 +Lynis 将日志保存在这里: ```   Files: @@ -129,8 +121,7 @@ Lynis saves the logs here:   - Report data                     : /var/log/lynis-report.dat ``` -You can verify whether the log files were created, and indeed they were: - +你可以验证是否创建了日志文件。它确实创建了: ``` $ ls -l /var/log/lynis.log @@ -141,45 +132,43 @@ $ ls -l /var/log/lynis-report.dat $ ``` -### Explore the reports - -Lynis provides pretty comprehensive reports, so I will cover some of the important sections. The very first thing that Lynis does as part of initialization is to find out complete information about the operating system running on the machine. This is followed by checks to see what system tools and plugins are installed: +### 探索报告 +Lynis 提供了相当全面的报告,所以我将介绍一些重要的部分。作为初始化的一部分,Lynis 做的第一件事就是找出机器上运行的操作系统的完整信息。之后是检查是否安装了什么系统工具和插件: ``` [+] Initializing program -\------------------------------------ -  - Detecting OS...                                           [ DONE ] -  - Checking profiles...                                      [ DONE ] +------------------------------------ + - Detecting OS... [ DONE ] + - Checking profiles... [ DONE ] -  --------------------------------------------------- -  Program version:           3.0.0 -  Operating system:          Linux -  Operating system name:     Red Hat Enterprise Linux Server 7.8 (Maipo) -  Operating system version:  7.8 -  Kernel version:            3.10.0 -  Hardware platform:         x86_64 -  Hostname:                  example -  --------------------------------------------------- -<<snip>> + --------------------------------------------------- + Program version: 3.0.0 + Operating system: Linux + Operating system name: Red Hat Enterprise Linux Server 7.8 (Maipo) + Operating system version: 7.8 + Kernel version: 3.10.0 + Hardware platform: x86_64 + Hostname: example + --------------------------------------------------- +<<截断>> [+] System Tools -\------------------------------------ -  - Scanning available tools... -  - Checking system binaries... +------------------------------------ + - Scanning available tools... + - Checking system binaries... [+] Plugins (phase 1) -\------------------------------------ - Note: plugins have more extensive tests and may take several minutes to complete -  -  - Plugin: pam -    [..] -  - Plugin: systemd -    [................] +------------------------------------ + Note: plugins have more extensive tests and may take several minutes to complete + + - Plugin: pam + [..] + - Plugin: systemd + [................] ``` -Next, the report is divided into various sections, and each section starts with a **[+]** symbol. Some of the sections can be seen below. (Wow, there are so many areas to audit, and Lynis is the right tool for the job!) - +接下来,该报告被分为不同的部分,每个部分都以 `[+]` 符号开头。下面可以看到部分章节。(哇,要审核的地方有这么多,Lynis 是最合适的工具!) ``` [+] Boot and services @@ -224,20 +213,17 @@ Next, the report is divided into various sections, and each section starts with [+] Custom tests ``` -Lynis uses color-coding to make the report easier to parse: +Lynis 使用颜色编码使报告更容易解读。 - * Green: All good - * Yellow: Skipped, not found, or it may have a suggestion - * Red: You might need to give this a closer look - - - -In my case, most of the red marks were found in the Kernel Hardening section. The kernel has various tunable settings that define how the kernel functions, and some of these tunables may have a security context. The distro may not be setting these by default for various reasons, but you should examine each and see if you need to change its value based on your security posture: + * 绿色。一切正常 + * 黄色。跳过、未找到,可能有个建议 + * 红色。你可能需要仔细看看这个 +在我的案例中,大部分的红色标记都是在 “Kernel Hardening” 部分找到的。内核有各种可调整的设置,它们定义了内核的功能,其中一些可调整的设置可能有其安全场景。发行版可能因为各种原因没有默认设置这些,但是你应该检查每一项,看看你是否需要根据你的安全态势来改变它的值: ``` [+] Kernel Hardening -\------------------------------------ +------------------------------------   - Comparing sysctl key pairs with scan profile     - fs.protected_hardlinks (exp: 1)                         [ OK ]     - fs.protected_symlinks (exp: 1)                          [ OK ] @@ -271,12 +257,11 @@ In my case, most of the red marks were found in the Kernel Hardening section. Th     - net.ipv6.conf.default.accept_source_route (exp: 0)      [ OK ] ``` -Look at SSH, an example, since it is a key area and needs to be secured. There's nothing in red here, but Lynis has a lot of suggestions about hardening the SSH service on my setup: - +看看 SSH 这个例子,因为它是一个需要保证安全的关键领域。这里没有什么红色的东西,但是 Lynis 对我的环境给出了很多强化 SSH 服务的建议: ``` [+] SSH Support -\------------------------------------ +------------------------------------   - Checking running SSH daemon                               [ FOUND ]     - Searching SSH configuration                             [ FOUND ]     - OpenSSH option: AllowTcpForwarding                      [ SUGGESTION ] @@ -305,23 +290,21 @@ Look at SSH, an example, since it is a key area and needs to be secured. There's     - OpenSSH option: AllowGroups                             [ NOT FOUND ] ``` -I do not have virtual machines or containers running on my system, so they show empty results: - +我的系统上没有运行虚拟机或容器,所以这些显示的结果是空的: ``` [+] Virtualization -\------------------------------------ +------------------------------------ [+] Containers -\------------------------------------ +------------------------------------ ``` -Lynis checks file permissions on some files that are important from a security standpoint: - +Lynis 会检查一些从安全角度看很重要的文件的文件权限: ``` [+] File Permissions -\------------------------------------ +------------------------------------   - Starting file permissions check     File: /boot/grub2/grub.cfg                                [ SUGGESTION ]     File: /etc/cron.deny                                      [ OK ] @@ -344,28 +327,25 @@ Lynis checks file permissions on some files that are important from a security     Directory: /etc/cron.monthly                              [ SUGGESTION ] ``` -Towards the bottom of the report, Lynis offers suggestions based on the report's findings. Each suggestion is followed by a **TEST-ID** (keep this handy for the next part): - +在报告的底部,Lynis 根据报告的发现提出了建议。每项建议后面都有一个 “TEST-ID”(为了下一部分方便,请将其保存起来)。 ``` - Suggestions (47): -  ---------------------------- -  * If not required, consider explicit disabling of core dump in /etc/security/limits.conf file [KRNL-5820] -      + Suggestions (47): + ---------------------------- + * If not required, consider explicit disabling of core dump in /etc/security/limits.conf file [KRNL-5820] + https://cisofy.com/lynis/controls/KRNL-5820/ -  * Check PAM configuration, add rounds if applicable and expire passwords to encrypt with new values [AUTH-9229] -      + * Check PAM configuration, add rounds if applicable and expire passwords to encrypt with new values [AUTH-9229] + https://cisofy.com/lynis/controls/AUTH-9229/ ``` -Lynis provides an option to find more information about each suggestion, which you can access using the **show details** command followed by the test ID number: - +Lynis 提供了一个选项来查找关于每个建议的更多信息,你可以使用 `show details` 命令和 TEST-ID 号来访问: ``` -`./lynis show details TEST-ID` +./lynis show details TEST-ID ``` -This will show additional information about that test. For example, I checked the details of SSH-7408: - +这将显示该测试的其他信息。例如,我检查了 SSH-7408 的详细信息: ``` $ ./lynis show details SSH-7408 @@ -379,9 +359,9 @@ $ ./lynis show details SSH-7408 2020-04-30 05:52:23 Suggestion: Consider hardening SSH configuration [test:SSH-7408] [details:AllowTcpForwarding (set YES to NO)] [solution:-] ``` -### Give it a try +### 试试吧 -If you want to learn more about the security of your Linux machine, check out Lynis. And, if you want to learn how Lynis works, dig into its shell scripts to see how it gathers all this information. +如果你想更多地了解你的 Linux 机器的安全性,请试试 Lynis。如果你想了解 Lynis 是如何工作的,可以研究一下它的 shell 脚本,看看它是如何收集这些信息的。 -------------------------------------------------------------------------------- @@ -389,8 +369,8 @@ via: https://opensource.com/article/20/5/linux-security-lynis 作者:[Gaurav Kamathe][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a2ec8062a0ae9c048f4a30fa8a414b9c2ddf6e8c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 6 Oct 2020 22:24:52 +0800 Subject: [PATCH 0346/1156] PRF @geekpi --- ...self when writing project documentation.md | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/translated/tech/20200925 5 questions to ask yourself when writing project documentation.md b/translated/tech/20200925 5 questions to ask yourself when writing project documentation.md index bbf3b907cc..ee3dccb2db 100644 --- a/translated/tech/20200925 5 questions to ask yourself when writing project documentation.md +++ b/translated/tech/20200925 5 questions to ask yourself when writing project documentation.md @@ -1,52 +1,52 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (5 questions to ask yourself when writing project documentation) [#]: via: (https://opensource.com/article/20/9/project-documentation) [#]: author: (Alexei Leontief https://opensource.com/users/alexeileontief) -编写项目文档时要问自己 5 个问题 +编写项目文档时要问自己的 5 个问题 ====== -使用一些有效沟通的基本原则可以帮助你创建与你的品牌一致的,编写良好,内容丰富的项目文档。 + +> 使用有效沟通的一些基本原则可以帮助你创建与你的品牌一致的、编写良好、内容丰富的项目文档。 + ![A person writing.][1] -在开始另一个开源项目文档的实际写作部分之前,甚至在采访专家之前,最好回答一些有关新文档的高级问题。 +在开始实际撰写又一个开源项目的文档之前,甚至在采访专家之前,最好回答一些有关新文档的高级问题。 -著名的传播理论家 Harold Lasswell 在他 1948 年的文章《社会中的传播结构和功能》(_The Structure and Function of Communication in Society_)中写道: +著名的传播理论家 Harold Lasswell 在他 1948 年的文章《社会中的传播结构和功能The Structure and Function of Communication in Society》中写道: -> (一个)描述沟通行为的方便方法是回答以下问题: +> (一种)描述沟通行为的方便方法是回答以下问题: > > * 谁 > * 说什么 > * 在哪个渠道 > * 对谁 > * 有什么效果? -> +作为一名技术交流者,你可以运用 Lasswell 的理论,回答关于你文档的类似问题,以更好地传达你的信息,达到预期的效果。 -作为一名技术沟通者,你可以运用 Lasswell 的理论,回答关于你文档的类似问题,以更好地传达你的信息,达到预期的效果。 +### 谁:谁是文档的所有者? -### 谁—谁是文档的所有者? +或者说,文档背后是什么公司?它想向受众传达什么品牌形象?这个问题的答案将极大地影响你的写作风格。公司可能有自己的风格指南,或者至少有正式的使命声明,在这种情况下,你应该从这开始。 -或者说,文档背后是什么公司?它想向受众传达什么品牌形象?这个问题的答案将大大影响你的写作风格。公司也可能有自己的风格指南,或者至少有正式的使命声明,在这种情况下,你应该从这开始。 +如果公司刚刚起步,你可以向文件的主人提出上述问题。作为作者,将你为公司创造的声音和角色与你自己的世界观和信念结合起来是很重要的。这将使你的写作看起来更自然,而不像公司的行话。 -如果公司刚刚起步,你可以向文件的主人提出上述问题。作为作者,将你为公司创造的声音和角色与你自己的世界观和信仰结合起来是很重要的。这将使你的写作看起来更自然,而不像公司的行话。 +### 说什么:文件类型是什么? -### 说什么—文件类型是什么? +你需要传达什么信息?它是什么类型的文档:用户指南、API 参考、发布说明等?许多文档类型有模板或普遍认可的结构,这些结构为你提供一个开始的地方,并帮助确保包括所有必要的信息。 -你需要传达什么信息?它是什么类型的文档:用户指南、API 参考、发布说明等?许多文档类型将有模板或普遍认可的结构,它将让你从这开始,并帮助确保包括所有必要的信息。 - -### 在哪个渠道—文档的格式是什么? +### 在哪个渠道:文档的格式是什么? 对于技术文档,沟通的渠道通常会告诉你文档的最终格式,也就是 PDF、HTML、文本文件等。这很可能也决定了你应该使用什么工具来编写你的文档。 -### 对谁—目标受众是谁? +### 对谁:目标受众是谁? -谁会阅读这份文档?他们的知识水平如何?他们的工作职责和主要挑战是什么?这些问题将帮助你确定你应该覆盖什么,是否应该进入细节,是否可以使用任何特定的术语,等等。在某些情况下,这些问题的答案甚至可以影响你使用的语法的复杂性。 +谁会阅读这份文档?他们的知识水平如何?他们的工作职责和主要挑战是什么?这些问题将帮助你确定你应该覆盖什么内容,是否应该应该涉及细节,是否可以使用特定的术语,等等。在某些情况下,这些问题的答案甚至可以影响你使用的语法的复杂性。 -### 有什么效果-文档的目的是什么? +### 有什么效果:文档的目的是什么? 在这里,你应该定义这个文档要为它的潜在读者解决什么问题,或者它应该为他们回答什么问题。例如,你的文档的目的可以是教你的客户如何使用你的产品。 @@ -56,7 +56,7 @@ ### 总结 -上面的问题旨在帮助你形成有效沟通的基础,并确保你的文件涵盖了所有应该涵盖的内容。你可以把它们分解成你自己的问题清单,并把它们放在身边,以便在你有文件要创建的时候使用。当你面对空白页时,这份清单也可能会派上用场。希望它能激发你的灵感,帮助你产生想法。 +上面的问题旨在帮助你形成有效沟通的基础,并确保你的文件涵盖了所有应该涵盖的内容。你可以把它们分解成你自己的问题清单,并把它们放在身边,以便在你有文件要创建的时候使用。当你面对空白页无从着笔时,这份清单也可能会派上用场。希望它能激发你的灵感,帮助你产生想法。 -------------------------------------------------------------------------------- @@ -65,7 +65,7 @@ via: https://opensource.com/article/20/9/project-documentation 作者:[Alexei Leontief][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8bc41121807f689eca3bfb74792099a761a473e9 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 6 Oct 2020 22:32:58 +0800 Subject: [PATCH 0347/1156] PUB @geekpi https://linux.cn/article-12691-1.html --- ...ns to ask yourself when writing project documentation.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20200925 5 questions to ask yourself when writing project documentation.md (96%) diff --git a/translated/tech/20200925 5 questions to ask yourself when writing project documentation.md b/published/20200925 5 questions to ask yourself when writing project documentation.md similarity index 96% rename from translated/tech/20200925 5 questions to ask yourself when writing project documentation.md rename to published/20200925 5 questions to ask yourself when writing project documentation.md index ee3dccb2db..3b59da6ca5 100644 --- a/translated/tech/20200925 5 questions to ask yourself when writing project documentation.md +++ b/published/20200925 5 questions to ask yourself when writing project documentation.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12691-1.html) [#]: subject: (5 questions to ask yourself when writing project documentation) [#]: via: (https://opensource.com/article/20/9/project-documentation) [#]: author: (Alexei Leontief https://opensource.com/users/alexeileontief) @@ -12,7 +12,7 @@ > 使用有效沟通的一些基本原则可以帮助你创建与你的品牌一致的、编写良好、内容丰富的项目文档。 -![A person writing.][1] +![](https://img.linux.net.cn/data/attachment/album/202010/06/223150omjnutjpml8inc9n.jpg) 在开始实际撰写又一个开源项目的文档之前,甚至在采访专家之前,最好回答一些有关新文档的高级问题。 From ea60510e12d04c4a97d31e0464b9fe52a8397d13 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 7 Oct 2020 05:01:45 +0800 Subject: [PATCH 0348/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201007?= =?UTF-8?q?=20How=20to=20Clear=20Apt=20Cache=20and=20Reclaim=20Precious=20?= =?UTF-8?q?Disk=20Space?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md --- ...t Cache and Reclaim Precious Disk Space.md | 123 ++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 sources/tech/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md diff --git a/sources/tech/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md b/sources/tech/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md new file mode 100644 index 0000000000..83a0b2aafd --- /dev/null +++ b/sources/tech/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md @@ -0,0 +1,123 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Clear Apt Cache and Reclaim Precious Disk Space) +[#]: via: (https://itsfoss.com/clear-apt-cache/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +How to Clear Apt Cache and Reclaim Precious Disk Space +====== + +How do you clear the apt cache? You simply use this [apt-get command][1] option: + +``` +sudo apt-get clean +``` + +But there is more to cleaning apt cache than just running the above command. + +In this tutorial, I’ll explain what is apt cache, why is it used, why you would want to clean it and what other things you should know about purging apt cache. + +I am going to use Ubuntu here for reference but since this is about apt, it is applicable to [Debian][2] and other Debian and Ubuntu-based distributions like Linux Mint, Deepin and more. + +### What is apt cache? Why is it used? + +When you install a package using apt-get or [apt command][3] (or DEB packages in the software center), the apt [package manager][4] downloads the package and its dependencies in .deb format and keeps it in /var/cache/apt/archives folder. + +![][5] + +While downloading, apt keeps the deb package in /var/cache/apt/archives/partial directory. When the deb package is downloaded completely, it is moved out to /var/cache/apt/archives directory. + +Once the deb files for the package and its dependencies are downloaded, your system [installs the package from these deb files][6]. + +Now you see the use of cache? The system needs a place to keep the package files somewhere before installing them. If you are aware of the [Linux directory structure][7], you would understand that /var/cache is the appropriate here. + +#### Why keep the cache after installing the package? + +The downloaded deb files are not removed from the directory immediately after the installation is completed. If you remove a package and reinstall it, your system will look for the package in the cache and get it from here instead of downloading it again (as long as the package version in the cache is the same as the version in remote repository). + +This is much quicker. You can try this on your own and see how long a program takes to install the first time, remove it and install it again. You can [use the time command to find out how long does it take to complete a command][8]: _**time sudo apt install package_name**_. + +I couldn’t find anything concrete on the cache retention policy so I cannot say how long does Ubuntu keep the downloaded packages in the cache. + +#### Should you clean apt cache? + +It depends on you. If you are running out of disk space on root, you could clean apt cache and reclaim the disk space. It is one of the [several ways to free up disk space on Ubuntu][9]. + +Check how much space the cache takes with the [du command][10]: + +![][11] + +Sometime this could go in 100s of MB and this space could be crucial if you are running a server. + +#### How to clean apt cache? + +If you want to clear the apt cache, there is a dedicated command to do that. So don’t go about manually deleting the cache directory. Simply use this command: + +``` +sudo apt-get clean +``` + +This will remove the content of the /var/cache/apt/archives directory (except the lock file). Here’s a dry run (simulation) of what the apt-get clean command deletes: + +![][12] + +There is another command that deals with cleaning the apt cache: + +``` +sudo apt-get autoclean +``` + +Unlike clean, autoclean only removes the packages that are not possible to download from the repositories. + +Suppose you installed package xyz. Its deb files remain in the cache. If there is now a new version of xyz package available in the repository, this existing xyz package in the cache is now outdated and useless. The autoclean option will delete such useless packages that cannot be downloaded anymore. + +#### Is it safe to delete apt cache? + +![][13] + +Yes. It is completely safe to clear the cache created by apt. It won’t negatively impact the performance of the system. Maybe if you reinstall the package it will take a bit longer to download but that’s about it. + +Again, use the apt-get clean command. It is quicker and easier than manually deleting cache directory. + +You may also use graphical tools like [Stacer][14] or [Bleachbit][15] for this purpose. + +#### Conclusion + +At the time of writing this article, there is no built-in option with the newer apt command. However, keeping backward compatibility, _**apt clean**_ can still be run (which should be running apt-get clean underneath it). Please refer to this article to [know the difference between apt and apt-get][16]. + +I hope you find this explanation about apt cache interesting. It is not something essential but knowing this little things make you more knowledgeable about your Linux system. + +I welcome your feedback and suggestions in the comment section. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/clear-apt-cache/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/apt-get-linux-guide/ +[2]: https://www.debian.org/ +[3]: https://itsfoss.com/apt-command-guide/ +[4]: https://itsfoss.com/package-manager/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-get-clean-cache.png?resize=800%2C470&ssl=1 +[6]: https://itsfoss.com/install-deb-files-ubuntu/ +[7]: https://linuxhandbook.com/linux-directory-structure/ +[8]: https://linuxhandbook.com/time-command/ +[9]: https://itsfoss.com/free-up-space-ubuntu-linux/ +[10]: https://linuxhandbook.com/find-directory-size-du-command/ +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-archive-size.png?resize=800%2C233&ssl=1 +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-get-clean-ubuntu.png?resize=800%2C339&ssl=1 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/Clear-Apt-Cache.png?resize=800%2C450&ssl=1 +[14]: https://itsfoss.com/optimize-ubuntu-stacer/ +[15]: https://itsfoss.com/use-bleachbit-ubuntu/ +[16]: https://itsfoss.com/apt-vs-apt-get-difference/ From 137f5e0b2b024ba37e4899a17c8d3cab7f83c094 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 7 Oct 2020 05:02:13 +0800 Subject: [PATCH 0349/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201006?= =?UTF-8?q?=20Simplify=20your=20web=20experience=20with=20this=20internet?= =?UTF-8?q?=20protocol=20alternative?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201006 Simplify your web experience with this internet protocol alternative.md --- ...with this internet protocol alternative.md | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 sources/tech/20201006 Simplify your web experience with this internet protocol alternative.md diff --git a/sources/tech/20201006 Simplify your web experience with this internet protocol alternative.md b/sources/tech/20201006 Simplify your web experience with this internet protocol alternative.md new file mode 100644 index 0000000000..6955aa001e --- /dev/null +++ b/sources/tech/20201006 Simplify your web experience with this internet protocol alternative.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Simplify your web experience with this internet protocol alternative) +[#]: via: (https://opensource.com/article/20/10/gemini-internet-protocol) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Simplify your web experience with this internet protocol alternative +====== +Discover new corners of a quieter and simpler internet with the Gemini +Protocol. +![Person typing on a 1980's computer][1] + +If you've been on the internet for a very long time or you're just very resourceful, you might remember an early text-sharing protocol called [Gopher][2]. Gopher was eventually displaced by the HTTP protocol, which of course is the basis for the modern World Wide Web. For many people, the "internet" and the "World Wide Web" are the same thing, because many people don't consciously do anything online that's _not_ on the www subdomain. + +But there have always been a variety of network protocols to share information over an interconnected network: Telnet, FTP, SSH, Torrent, GNUnet, and many more. Recently, there's been an addition to this collection of alternatives, and it's called [Gemini][3]. + +The Gemini protocol, named after the space mission between the rudimentary experiments of Project Mercury and Project Apollo, is meant to sit peacefully between Gopher and HTTP. It doesn't aim to replace the modern web, by any means, but it does try to create both a simplified web and a modernized Gopher. + +This development, young though it may be, is significant for many reasons. People take issue with the modern web, of course, for reasons spanning the technical and the philosophical, but it's also just plain bloated. A million hits from a Google search can feel like overkill when all you really want is one reliable answer to a very specific question. + +Many people use Gopher for this very reason: it's small enough to allow for niche interests that are easy to find. However, Gopher is an old protocol that makes assumptions about programming, networking, and browsing that just aren't applicable anymore. Gemini aims to bring the best of the web to a format that approximates Gopher but is easy to program for. A simple Gemini browser can be written in a few hundred lines of code, and there's a very good one written in about 1,600 lines. That's a powerful feature for programmers, students, and minimalists alike. + +### How to browse Gemini + +Like the early web, Gemini is small enough that there is a list of known servers running Gemini sites. Just as browsing an HTTP site requires a web browser, accessing a Gemini site requires a Gemini browser. There are already several available, listed on the [Gemini website][4]. + +The simplest one to run is the [AV-98][5] client. It's written in Python and runs in a terminal. To try it out, download it: + + +``` +`$ git clone https://tildegit.org/solderpunk/AV-98.git` +``` + +Change directory into the downloaded directory and run AV-98: + + +``` +$ cd AV-98.git +$ python3 ./main.py +``` + +The client is an interactive prompt. It has limited commands, and the main one is simply `go` followed by a Gemini server address. Go to the list of known [Gemini servers][6], select one that seems interesting, and try visiting it: + + +``` +AV-98> go gemini://example.club + +Welcome to the example.club Gemini server! + +Here are some folders of ASCII art: + +[1] Penguins +[2] Wildebeests +[3] Demons +``` + +Navigation is a matter of following numbered links. For instance, to navigate to the Penguins directory, enter `1` and press Enter: + + +``` +AV-98> 1 + +[1] Gentoo +[2] Emperor +[3] Little Blue +``` + +To go back, type `back` and press Enter: + + +``` +`AV-98> back` +``` + +For more commands, just enter `help`. + +### Gemini as your web alternative + +The Gemini protocol is simple enough for beginner-level and intermediate programmers to write clients for, and it's an easy and quick way to share content on the internet. While the World Wide Web's ubiquity is advantageous for widespread distribution, there's always room for alternatives. Check out Gemini and discover new corners of a quieter and simpler internet. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/gemini-internet-protocol + +作者:[Seth Kenlon][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://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer) +[2]: https://en.wikipedia.org/wiki/Gopher_%28protocol%29 +[3]: https://gemini.circumlunar.space/ +[4]: https://gemini.circumlunar.space/clients.html +[5]: https://tildegit.org/solderpunk/AV-98 +[6]: https://portal.mozz.us/gemini/gemini.circumlunar.space/servers From 0f11e1223c89d56b390e9839281b3e7a153183ed Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 7 Oct 2020 05:02:25 +0800 Subject: [PATCH 0350/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201006?= =?UTF-8?q?=205=20Scratch=20code=20blocks=20to=20teach=20kids=20how=20to?= =?UTF-8?q?=20program=20a=20video=20game?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201006 5 Scratch code blocks to teach kids how to program a video game.md --- ... teach kids how to program a video game.md | 165 ++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 sources/tech/20201006 5 Scratch code blocks to teach kids how to program a video game.md diff --git a/sources/tech/20201006 5 Scratch code blocks to teach kids how to program a video game.md b/sources/tech/20201006 5 Scratch code blocks to teach kids how to program a video game.md new file mode 100644 index 0000000000..e8c825d5e7 --- /dev/null +++ b/sources/tech/20201006 5 Scratch code blocks to teach kids how to program a video game.md @@ -0,0 +1,165 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 Scratch code blocks to teach kids how to program a video game) +[#]: via: (https://opensource.com/article/20/10/advanced-scratch) +[#]: author: (Jess Weichler https://opensource.com/users/cyanide-cupcake) + +5 Scratch code blocks to teach kids how to program a video game +====== +Advance your Scratch skills with loops, conditional statements, +collision detection, and more in this article in a series about teaching +kids to code. +![Binary code on a computer screen][1] + +In the second article in this series, you [created your first few video game scripts in Scratch][2]. This article explores ways to expand programming's possibilities to create more advanced code. + +There are multiple ways to introduce these skills to kids, such as: + + 1. Introduce a task or challenge that requires children to use the skill. Use inquiry to help them find the solution, then reinforce their discoveries with a formal explanation. + 2. Encourage free experimentation by having children come up with their own projects. As they work through their code, go over skills as needed. + 3. Introduce the skill, then have children experiment with it. + + + +No matter which one you choose, always remember that the most important part of learning coding is making mistakes. Even skilled programmers don't get it right every time or know every possible line of code. It works best when educators, pupils, and peers are all learning to code together as a team. + +There are [10 categories][3] of code blocks in Scratch; here is how to use some of the most common. + +### Loops + +_This is the code that doesn't end; yes, it goes on and on, my friend!_ **Forever loops** and **repeat blocks** in [Scratch][4] are what you need to repeat lines of code automatically. Any code blocks placed inside a loop block continue to run until the game is stopped or, if you're using a repeat block, the number is reached. + +![Loops in Scratch][5] + +(Jess Weichler, [CC BY-SA 4.0][6]) + +### Conditional statements + +**Conditional statements** run only if certain conditions are met. "If you're cold, then put on a sweater" is a real-world example of a conditional statement: you put a sweater on only if you determine that it's cold. + +There are four conditional statement code blocks in Scratch: + + * if ... then  + * if ... then ... else  + * wait until...  + * repeat until...  + + + +Any code blocks placed inside a conditional statement run only if the condition is met. + +![Conditional statement blocks in Scratch][7] + +(Jess Weichler, [CC BY-SA 4.0][6]) + +Notice the diamond shapes in each conditional statement code block; can you find any code blocks that might fit inside? + +Diamond-shaped code blocks can be used to complete any of the four conditional-statement blocks. You can find diamond-shaped blocks in the [Sensing][8] and [Operators][9] block categories. + +![Diamond-shaped blocks in Scratch][10] + +(Jess Weichler, [CC BY-SA 4.0][6]) + +### Collision-detection loop + +Sometimes you may want to check to see if your sprite is touching another sprite or a specific color. To do so, use a [**collision-detection loop**][11]. + +A collision-detection loop combines loops and conditional statements to constantly check whether the sprite is touching another sprite (for example, a coin sprite). + +![Collision-detection script in Scratch][12] + +(Jess Weichler, [CC BY-SA 4.0][6]) + +Inside the inner `if ... then` block, place the action you want to happen when the condition is met. + +This type of algorithm is a **collision-detection script**. Collision-detection scripts sense when two sprites or objects are touching. A basic collision-detection script uses four main code blocks: + + * Event hat + * Forever loop + * If … then + * Touching + + + +You can place more code blocks inside the `if ... then` block. These blocks will run only if the active sprite is touching the sprite listed in the `touching` block. + +Can you figure out how to make an object "hide" when it collides with another sprite? This is a common technique to indicate that, for instance, a sprite has eaten some food or has picked up an item. + +### Variables and math + +A **variable** is a placeholder for a value, usually a number, that you don't know yet. In math, using a variable might look something like this: `x+12=15`. + +![Variables in Scratch][13] + +(Jess Weichler, [CC BY-SA 4.0][6]) + +If that doesn't make sense to you, that's okay. I didn't understand variables until I started coding as an adult. + +Here is one example of how you might use a variable in code: + +![Variables in Scratch][14] + +(Jess Weichler, [CC BY-SA 4.0][6]) + +### Coordinates + +Scratch uses a coordinate graph to measure the screen. The exact middle of the screen has a value of 0,0. The length of the screen (X-axis) is -240 to 240, the height (Y-axis) is -180 to 180. + +The X and Y **coordinates** control where each sprite is on the screen, and you can code a sprite's X and Y coordinates to set a specific place using **[motion blocks][15]**. + +![Coordinates in Scratch][16] + +(Jess Weichler, [CC BY-SA 4.0][6]) + +### Put it all together + +Think about the basics of any game; what are some elements you usually need? + +Here are some examples: + + * A goal + * A way to win + * A way to lose + * An obstacle + * A scoring system + + + +With the techniques above, you have everything you need to create a playable game with these elements and more. + +There are still heaps of code blocks in Scratch that I haven't mentioned. Keep exploring the possibilities. If you don't know what a code block does, put it in a script to see what happens! + +Coming up with an idea for a game can be difficult. The great thing about the open source community, Scratchers included, is that we love to build upon one another's work. With that in mind, in the next article, I'll look at some of my favorite user-made projects for inspiration. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/advanced-scratch + +作者:[Jess Weichler][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://opensource.com/users/cyanide-cupcake +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/binary_code_computer_screen.png?itok=7IzHK1nn (Binary code on a computer screen) +[2]: https://opensource.com/article/20/9/scratch +[3]: https://en.scratch-wiki.info/wiki/Categories +[4]: https://scratch.mit.edu/ +[5]: https://opensource.com/sites/default/files/uploads/codekids3_1.png (Loops in Scratch) +[6]: https://creativecommons.org/licenses/by-sa/4.0/ +[7]: https://opensource.com/sites/default/files/uploads/codekids3_2.png (Conditional statement blocks in Scratch) +[8]: https://en.scratch-wiki.info/wiki/Blocks#Sensing_blocks +[9]: https://en.scratch-wiki.info/wiki/Blocks#Operators_blocks +[10]: https://opensource.com/sites/default/files/uploads/codekids3_3.png (Diamond-shaped blocks in Scratch) +[11]: https://en.scratch-wiki.info/wiki/Making_Sprites_Detect_and_Sense_Other_Sprites +[12]: https://opensource.com/sites/default/files/uploads/codekids3_4.png (Collision-detection script in Scratch) +[13]: https://opensource.com/sites/default/files/uploads/codekids3_5.png (Variables in Scratch) +[14]: https://opensource.com/sites/default/files/uploads/codekids3_6.png (Variables in Scratch) +[15]: https://en.scratch-wiki.info/wiki/Motion_Blocks +[16]: https://opensource.com/sites/default/files/uploads/codekids3_7.png (Coordinates in Scratch) From 887c64aabe4b02afa34b5c3a399016709540840d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 7 Oct 2020 05:02:38 +0800 Subject: [PATCH 0351/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201006?= =?UTF-8?q?=20Start=20using=20virtual=20tables=20in=20Apache=20Cassandra?= =?UTF-8?q?=204.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201006 Start using virtual tables in Apache Cassandra 4.0.md --- ... virtual tables in Apache Cassandra 4.0.md | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 sources/tech/20201006 Start using virtual tables in Apache Cassandra 4.0.md diff --git a/sources/tech/20201006 Start using virtual tables in Apache Cassandra 4.0.md b/sources/tech/20201006 Start using virtual tables in Apache Cassandra 4.0.md new file mode 100644 index 0000000000..5cd6aa97fa --- /dev/null +++ b/sources/tech/20201006 Start using virtual tables in Apache Cassandra 4.0.md @@ -0,0 +1,63 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Start using virtual tables in Apache Cassandra 4.0) +[#]: via: (https://opensource.com/article/20/10/virtual-tables-apache-cassandra) +[#]: author: (Ben Bromhead https://opensource.com/users/ben-bromhead) + +Start using virtual tables in Apache Cassandra 4.0 +====== +What they are and how to use them. +![Computer laptop in space][1] + +Among the [many additions][2] in the recent [Apache Cassandra 4.0 beta release][3], virtual tables is one that deserves some attention. + +In previous versions of Cassandra, users needed access to Java Management Extensions ([JMX][4]) to examine Cassandra details such as running compactions, clients, metrics, and a variety of configuration settings. Virtual tables removes these challenges. Cassandra 4.0 beta enables users to query those details and data as Cassandra Query Language (CQL) rows from a read-only system table. + +Here is how the JMX-based mechanism in previous Cassandra versions worked. Imagine a user wants to check on the compaction status of a particular node in a cluster. The user first has to establish a JMX connection to run `nodetool compactionstats` on the node. This requirement immediately presents the user with a few complications. Is the user's client configured for JMX access? Are the Cassandra nodes and firewall configured to allow JMX access? Are the proper measures for security and auditing prepared and in place? These are only some of the concerns users had to contend with when dealing with in previous versions of Cassandra. + +With Cassandra 4.0, virtual tables make it possible for users to query the information they need by utilizing their previously configured driver. This change removes all overhead associated with implementing and maintaining JMX access. + +Cassandra 4.0 creates two new keyspaces to help users leverage virtual tables: `system_views` and `system_virtual_schema`. The `system_views` keyspace contains all the valuable information that users seek, usefully stored in a number of tables. The `system_virtual_schema` keyspace, as the name implies, stores all necessary schema information for those virtual tables. + +![system_views and system_virtual_schema keyspaces and tables][5] + +(Ben Bromhead, [CC BY-SA 4.0][6]) + +It's important to understand that the scope of each virtual table is restricted to its node. Any query of virtual tables will return data that is valid only for the node that acts as its coordinator, regardless of consistency. To simplify for this requirement, support has been added to several drivers to specify the coordinator node in these queries (the Python, DataStax Java, and other drivers now offer this support). + +To illustrate, examine this `sstable_tasks` virtual table. This virtual table displays all operations on [SSTables][7], including compactions, cleanups, upgrades, and more. + +![Querying the sstable_tasks virtual table][8] + +(Ben Bromhead, [CC BY-SA 4.0][6]) + +If a user were to run `nodetool compactionstats` in a previous Cassandra version, this is the same type of information that would be displayed. Here, the query finds that the node currently has one active compaction. It also displays its progress and its keyspace and table. Thanks to the virtual table, a user can gather this information quickly, and just as efficiently gain the insight needed to correctly diagnose the cluster's health. + +To be clear, Cassandra 4.0 doesn't eliminate the need for JMX access: JMX is still the only option for querying some metrics. That said, users will welcome the ability to pull key cluster metrics simply by using CQL. Thanks to the convenience afforded by virtual tables, users may be able to reinvest time and resources previously devoted to JMX tools into Cassandra itself. Client-side tooling should also begin to leverage the advantages offered by virtual tables. + +If you are interested in the Cassandra 4.0 beta release and its virtual tables feature, [try it out][3]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/virtual-tables-apache-cassandra + +作者:[Ben Bromhead][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://opensource.com/users/ben-bromhead +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_space_graphic_cosmic.png?itok=wu493YbB (Computer laptop in space) +[2]: https://www.instaclustr.com/apache-cassandra-4-0-beta-released/ +[3]: https://cassandra.apache.org/download/ +[4]: https://en.wikipedia.org/wiki/Java_Management_Extensions +[5]: https://opensource.com/sites/default/files/uploads/cassandra_virtual-tables.png (system_views and system_virtual_schema keyspaces and tables) +[6]: https://creativecommons.org/licenses/by-sa/4.0/ +[7]: https://cassandra.apache.org/doc/latest/architecture/storage_engine.html#sstables +[8]: https://opensource.com/sites/default/files/uploads/cassandra_virtual-tables_sstable_tasks.png (Querying the sstable_tasks virtual table) From 1bfee4721986b57e5aee9a6ffb4c584ab69db61d Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Wed, 7 Oct 2020 09:21:33 +0800 Subject: [PATCH 0352/1156] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=AF=91=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ding a Messenger App- Conversation Page.md | 91 ++++++++++--------- 1 file changed, 46 insertions(+), 45 deletions(-) diff --git a/sources/tech/20180720 Building a Messenger App- Conversation Page.md b/sources/tech/20180720 Building a Messenger App- Conversation Page.md index 811dd3c60e..b249c2dcfb 100644 --- a/sources/tech/20180720 Building a Messenger App- Conversation Page.md +++ b/sources/tech/20180720 Building a Messenger App- Conversation Page.md @@ -7,31 +7,31 @@ [#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-conversation-page/) [#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) -Building a Messenger App: Conversation Page +构建一个即时消息应用(九):Conversation 页面 ====== -This post is the 9th and last in a series: +本文是该系列的第九篇,也是最后一篇。 - * [Part 1: Schema][1] - * [Part 2: OAuth][2] - * [Part 3: Conversations][3] - * [Part 4: Messages][4] - * [Part 5: Realtime Messages][5] - * [Part 6: Development Login][6] - * [Part 7: Access Page][7] - * [Part 8: Home Page][8] + * [第一篇: 模式][1] + * [第二篇: OAuth][2] + * [第三篇: 对话][3] + * [第四篇: 消息][4] + * [第五篇: 实时消息][5] + * [第六篇: 仅用于开发的登录][6] + * [第七篇: Access 页面][7] + * [第八篇: Home 页面][8] -In this post we’ll code the conversation page. This page is the chat between the two users. At the top we’ll show info about the other participant, below, a list of the latest messages and a message form at the bottom. +在这篇文章中,我们将对对话conversation页面进行编码。此页面是两个用户之间的聊天室。在顶部我们将显示其他参与者的信息,下面接着的是最新消息列表,以及底部的消息表单。 -### Chat heading +### 聊天标题 ![chat heading screenshot][9] -Let’s start by creating the file `static/pages/conversation-page.js` with the following content: +让我们从创建 `static/pages/conversation-page.js` 文件开始,它包含以下内容: -``` +```js import http from '../http.js' import { navigate } from '../router.js' import { avatar, escapeHTML } from '../shared.js' @@ -65,17 +65,17 @@ function getConversation(id) { } ``` -This page receives the conversation ID the router extracted from the URL. +此页面接收路由从 URL 中提取的会话 ID。 -First it does a GET request to `/api/conversations/{conversationID}` to get info about the conversation. In case of error, we show it and redirect back to `/`. Then we render info about the other participant. +首先,它向 `/api/ conversations/{conversationID}` 发起一个 GET 请求,以获取有关对话的信息。 如果出现错误,我们会将其显示,并重定向回 `/`。然后我们呈现有关其他参与者的信息。 -### Conversation List +### 对话列表 ![chat heading screenshot][10] -We’ll fetch the latest messages too to display them. +我们也会获取最新的消息并显示它们。 -``` +```js let conversation, messages try { [conversation, messages] = await Promise.all([ @@ -85,32 +85,32 @@ try { } ``` -Update the `conversationPage()` function to fetch the messages too. We use `Promise.all()` to do both request at the same time. +更新 `conversationPage()` 函数以获取消息。我们使用 `Promise.all()` 同时执行这两个请求。 -``` +```js function getMessages(conversationID) { return http.get(`/api/conversations/${conversationID}/messages`) } ``` -A GET request to `/api/conversations/{conversationID}/messages` gets the latest messages of the conversation. +发起对 `/api/conversations/{conversationID}/messages` 的 GET 请求可以获取对话中的最新消息。 -``` +```html
      ``` -Now, add that list to the markup. +现在,将该列表添加到标记中。 -``` +```js const messagesOList = page.getElementById('messages') for (const message of messages.reverse()) { messagesOList.appendChild(renderMessage(message)) } ``` -So we can append messages to the list. We show them in reverse order. +这样我们就可以将消息附加到列表中了。我们以时间倒序来显示它们。 -``` +```js function renderMessage(message) { const messageContent = escapeHTML(message.content) const messageDate = new Date(message.createdAt).toLocaleString() @@ -127,28 +127,28 @@ function renderMessage(message) { } ``` -Each message item displays the message content itself with its timestamp. Using `.mine` we can append a different class to the item so maybe you can show the message to the right. +每个消息条目显示消息内容本身及其时间戳。使用 `.mine`,我们可以将不同的 css 类附加到条目,这样您就可以将消息显示在右侧。 -### Message Form +### 消息表单 ![chat heading screenshot][11] -``` +```html
      ``` -Add that form to the current markup. +将该表单添加到当前标记中。 -``` +```js page.getElementById('message-form').onsubmit = messageSubmitter(conversationID) ``` -Attach an event listener to the “submit” event. +将事件监听器附加到 “submit” 事件。 -``` +```js function messageSubmitter(conversationID) { return async ev => { ev.preventDefault() @@ -191,19 +191,20 @@ function createMessage(content, conversationID) { } ``` -We make use of [partial application][12] to have the conversation ID in the “submit” event handler. It takes the message content from the input and does a POST request to `/api/conversations/{conversationID}/messages` with it. Then prepends the newly created message to the list. -### Messages Subscription +我们利用 [partial application][12] 在 “submit” 事件处理程序中获取对话 ID。它 从输入中获取消息内容,并用它对 `/api/conversations/{conversationID}/messages` 发出 POST 请求。 然后将新创建的消息添加到列表中。 -To make it realtime we’ll subscribe to the message stream in this page also. +### 消息订阅 -``` +为了实现实时,我们还将订阅此页面中的消息流。 + +```js page.addEventListener('disconnect', subscribeToMessages(messageArriver(conversationID))) ``` -Add that line in the `conversationPage()` function. +将该行添加到 `conversationPage()` 函数中。 -``` +```js function subscribeToMessages(cb) { return http.subscribe('/api/messages', cb) } @@ -229,14 +230,14 @@ function readMessages(conversationID) { } ``` -We also make use of partial application to have the conversation ID here. -When a new message arrives, first we check if it’s from this conversation. If it is, we go a prepend a message item to the list and do a POST request to `/api/conversations/{conversationID}/read_messages` to updated the last time the participant read messages. +在这里我们仍然使用 partial application 来获取会话 ID。 +当新消息到达时,我们首先检查它是否来自此对话。如果是,我们会将消息条目预先添加到列表中,并向`/api/conversations/{conversationID}/read_messages`发起 POST 一个请求,以更新参与者上次阅读消息的时间。 * * * -That concludes this series. The messenger app is now functional. +本系列到此结束。 Messenger app 现在可以运行了。 -~~I’ll add pagination on the conversation and message list, also user searching before sharing the source code. I’ll updated once it’s ready along with a hosted demo 👨‍💻~~ +~~我将在对话和消息列表中添加分页功能,并在共享源代码之前添加用户搜索。我会在准备好的时候和托管的演示a hosted demo👨‍💻一起更新它~~ [Souce Code][13] • [Demo][14] @@ -246,7 +247,7 @@ via: https://nicolasparada.netlify.com/posts/go-messenger-conversation-page/ 作者:[Nicolás Parada][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[gxlct008](https://github.com/gxlct008) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 3d3159c59c0a37577c02453b214f17c390365ca2 Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Wed, 7 Oct 2020 09:24:11 +0800 Subject: [PATCH 0353/1156] =?UTF-8?q?=E5=B0=86=E8=AF=91=E6=96=87=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E5=88=B0=20translated/tech/=20=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20180720 Building a Messenger App- Conversation Page.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20180720 Building a Messenger App- Conversation Page.md (100%) diff --git a/sources/tech/20180720 Building a Messenger App- Conversation Page.md b/translated/tech/20180720 Building a Messenger App- Conversation Page.md similarity index 100% rename from sources/tech/20180720 Building a Messenger App- Conversation Page.md rename to translated/tech/20180720 Building a Messenger App- Conversation Page.md From e505ffad86d948e703e05f5783df83daf65a76e8 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 7 Oct 2020 10:17:37 +0800 Subject: [PATCH 0354/1156] PRF&PUB @gxlct008 https://linux.cn/article-12692-1.html --- ...ding a Messenger App- Development Login.md | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) rename {translated/tech => published}/20180712 Building a Messenger App- Development Login.md (85%) diff --git a/translated/tech/20180712 Building a Messenger App- Development Login.md b/published/20180712 Building a Messenger App- Development Login.md similarity index 85% rename from translated/tech/20180712 Building a Messenger App- Development Login.md rename to published/20180712 Building a Messenger App- Development Login.md index f534721640..9a4654f57d 100644 --- a/translated/tech/20180712 Building a Messenger App- Development Login.md +++ b/published/20180712 Building a Messenger App- Development Login.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (gxlct008) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12692-1.html) [#]: subject: (Building a Messenger App: Development Login) [#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-dev-login/) [#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) @@ -10,6 +10,8 @@ 构建一个即时消息应用(六):仅用于开发的登录 ====== +![](https://img.linux.net.cn/data/attachment/album/202010/07/101437garmhgi9aza9f9fz.jpg) + 本文是该系列的第六篇。 * [第一篇: 模式][1] @@ -18,7 +20,6 @@ * [第四篇: 消息][4] * [第五篇: 实时消息][5] - 我们已经实现了通过 GitHub 登录,但是如果想把玩一下这个 app,我们需要几个用户来测试它。在这篇文章中,我们将添加一个为任何用户提供登录的端点,只需提供用户名即可。该端点仅用于开发。 首先在 `main()` 函数中添加此路由。 @@ -101,7 +102,7 @@ func issueToken(subject string, exp time.Time) (string, error) { ### 种子用户 -现在,您可以将要操作的用户添加到数据库中。 +现在,你可以将要操作的用户添加到数据库中。 ```sql INSERT INTO users (id, username) VALUES @@ -109,7 +110,7 @@ INSERT INTO users (id, username) VALUES (2, 'jane'); ``` -您可以将其保存到文件中,并通过管道将其传送到 Cockroach CLI。 +你可以将其保存到文件中,并通过管道将其传送到 Cockroach CLI。 ```bash cat seed_users.sql | cockroach sql --insecure -d messenger @@ -121,7 +122,7 @@ cat seed_users.sql | cockroach sql --insecure -d messenger 本文也结束了所有的后端开发部分。 -[Souce Code][6] +- [源代码][6] -------------------------------------------------------------------------------- @@ -129,16 +130,16 @@ via: https://nicolasparada.netlify.com/posts/go-messenger-dev-login/ 作者:[Nicolás Parada][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/gxlct008) -校对:[校对者ID](https://github.com/校对者ID) +译者:[gxlct008](https://github.com/gxlct008) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://nicolasparada.netlify.com/ [b]: https://github.com/lujun9972 -[1]: https://nicolasparada.netlify.com/posts/go-messenger-schema/ -[2]: https://nicolasparada.netlify.com/posts/go-messenger-oauth/ -[3]: https://nicolasparada.netlify.com/posts/go-messenger-conversations/ -[4]: https://nicolasparada.netlify.com/posts/go-messenger-messages/ -[5]: https://nicolasparada.netlify.com/posts/go-messenger-realtime-messages/ +[1]: https://linux.cn/article-11396-1.html +[2]: https://linux.cn/article-11510-1.html +[3]: https://linux.cn/article-12056-1.html +[4]: https://linux.cn/article-12680-1.html +[5]: https://linux.cn/article-12685-1.html [6]: https://github.com/nicolasparada/go-messenger-demo From 4d54ce8b56354b6199f07d5d006185d60ee357ac Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Wed, 7 Oct 2020 10:33:14 +0800 Subject: [PATCH 0355/1156] =?UTF-8?q?=E7=94=B3=E9=A2=86=E5=8E=9F=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...190102 Using Yarn on Ubuntu and Other Linux Distributions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md b/sources/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md index 71555454f5..4e6fb7986e 100644 --- a/sources/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md +++ b/sources/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (gxlct008) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 0e3976ad9907a8b5c402432d4b49497fe7e43f33 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 7 Oct 2020 11:30:49 +0800 Subject: [PATCH 0356/1156] PRF @gxlct008 --- ...200901 Create a mobile app with Flutter.md | 124 +++++++----------- 1 file changed, 48 insertions(+), 76 deletions(-) diff --git a/translated/tech/20200901 Create a mobile app with Flutter.md b/translated/tech/20200901 Create a mobile app with Flutter.md index 170a85e2a3..5266637c7c 100644 --- a/translated/tech/20200901 Create a mobile app with Flutter.md +++ b/translated/tech/20200901 Create a mobile app with Flutter.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (gxlct008) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Create a mobile app with Flutter) @@ -10,14 +10,15 @@ 使用 Flutter 创建 App ====== -使用流行的 Flutter 框架开始您的跨平台开发之旅。 -![A person looking at a phone][1] +> 使用流行的 Flutter 框架开始你的跨平台开发之旅。 -[Flutter][2] 是一个深受全球移动开发者欢迎的项目。该框架有一个庞大的、友好的发烧友社区,随着 Flutter 帮助程序员将他们的项目带入移动领域,这个社区还在继续增长。 +![](https://img.linux.net.cn/data/attachment/album/202010/07/112953m9g419z1gc2i07z1.jpg) -本教程旨在帮助您开始使用 Flutter 进行移动开发。阅读之后,您将了解如何快速安装和设置框架,以便开始为智能手机、平板电脑和其他平台编码。 +[Flutter][2] 是一个深受全球移动开发者欢迎的项目。该框架有一个庞大的、友好的爱好者社区,随着 Flutter 帮助程序员将他们的项目带入移动领域,这个社区还在继续增长。 -本操作指南假定您已在计算机上安装了 [Android Studio][3],并且具有一定的使用经验。 +本教程旨在帮助你开始使用 Flutter 进行移动开发。阅读之后,你将了解如何快速安装和设置框架,以便开始为智能手机、平板电脑和其他平台开发。 + +本操作指南假定你已在计算机上安装了 [Android Studio][3],并且具有一定的使用经验。 ### 什么是 Flutter ? @@ -25,15 +26,15 @@ Flutter 使得开发人员能够为多个平台构建应用程序,包括: * Android * iOS - * Web (测试版) - * macOS (正在开发中) - * Linux (正在开发中) + * Web(测试版) + * macOS(正在开发中) + * Linux(正在开发中) -对 macOS 和 Linux 的支持还处于早期开发阶段,而 Web 支持预计很快就会发布。这意味着您可以立即试用其功能(如下所述)。 +对 macOS 和 Linux 的支持还处于早期开发阶段,而 Web 支持预计很快就会发布。这意味着你可以立即试用其功能(如下所述)。 ### 安装 Flutter -我使用的是 Ubuntu18.04,但安装过程与其他 Linux 发行版类似,比如 Arch 或 Mint。 +我使用的是 Ubuntu 18.04,但其他 Linux 发行版安装过程与之类似,比如 Arch 或 Mint。 #### 使用 snapd 安装 @@ -46,31 +47,27 @@ $ sudo snap install flutter –classic flutter 0+git.142868f from flutter Team/ installed ``` -然后使用 `flutter` 命令启动它。 首次启动时,该框架会下载到您的计算机上: +然后使用 `flutter` 命令启动它。 首次启动时,该框架会下载到你的计算机上: ``` $ flutter Initializing Flutter -Downloading +Downloading https://storage.googleapis.com/flutter_infra[...] ``` -下载完成后,您会看到一条消息,告诉您 Flutter 已初始化: +下载完成后,你会看到一条消息,告诉你 Flutter 已初始化: ![Flutter initialized][5] -(Vitaly Kuprenko, [CC BY-SA 4.0][6]) - #### 手动安装 -如果您没有安装 Snapd,或者您的发行版不是 Ubuntu,那么安装过程会略有不同。 在这种情况下,请[下载] [7] 为您的操作系统推荐的 Flutter 版本。 +如果你没有安装 Snapd,或者你的发行版不是 Ubuntu,那么安装过程会略有不同。在这种情况下,请[下载][7] 为你的操作系统推荐的 Flutter 版本。 ![Install Flutter manually][8] -(Vitaly Kuprenko, [CC BY-SA 4.0][6]) +然后将其解压缩到你的主目录。 -然后将其解压缩到您的主目录。 - -在您喜欢的文本编辑器中打开主目录中的 `.bashrc` 文件 (如果您使用 [Z shell][9],则打开 `.zshc`)。因为它是隐藏文件,所以您必须首先在文件管理器中启用显示隐藏文件,或者使用以下命令从终端打开它: +在你喜欢的文本编辑器中打开主目录中的 `.bashrc` 文件(如果你使用 [Z shell][9],则打开 `.zshc`)。因为它是隐藏文件,所以你必须首先在文件管理器中启用显示隐藏文件,或者使用以下命令从终端打开它: ``` $ gedit ~/.bashrc & @@ -82,48 +79,43 @@ $ gedit ~/.bashrc & export PATH="$PATH:~/flutter/bin" ``` -保存并关闭文件。 请记住,如果将 Flutter 提取到您的主目录之外的其他位置,则 [Flutter SDK 的路径][10] 将有所不同。 +保存并关闭文件。 请记住,如果在你的主目录之外的其他位置解压 Flutter,则 [Flutter SDK 的路径][10] 将有所不同。 -关闭您的终端,然后再次打开,以便加载新配置。 或者,您可以通过以下命令使配置立即生效: +关闭你的终端,然后再次打开,以便加载新配置。 或者,你可以通过以下命令使配置立即生效: ``` $ . ~/.bashrc ``` -如果您没有看到错误,那说明一切都是正常的。 - -这种安装方法比使用 `snap`命令稍微困难一些,但是它非常通用,可以让您在几乎所有的发行版上安装框架。 +如果你没有看到错误,那说明一切都是正常的。 +这种安装方法比使用 `snap` 命令稍微困难一些,但是它非常通用,可以让你在几乎所有的发行版上安装该框架。 #### 检查安装结果 -要检查结果,请在终端中输入以下内容: +要检查安装结果,请在终端中输入以下内容: ``` flutter doctor -v ``` -您将看到有关已安装组件的信息。 如果看到错误,请不要担心。 您尚未安装任何用于 Flutter SDK 的 IDE 插件。 +你将看到有关已安装组件的信息。 如果看到错误,请不要担心。 你尚未安装任何用于 Flutter SDK 的 IDE 插件。 ![Checking Flutter installation with the doctor command][11] -(Vitaly Kuprenko, [CC BY-SA 4.0][6]) - ### 安装 IDE 插件 -您应该在您的 [集成开发环境 (IDE)][12] 中安装插件,以帮助它与 Flutter SDK 接口、与设备交互并构建代码。 +你应该在你的 [集成开发环境(IDE)][12] 中安装插件,以帮助它与 Flutter SDK 接口、与设备交互并构建代码。 -Flutter 开发中常用的三个主要 IDE 工具是 IntelliJ IDEA (社区版)、Android Studio 和 VS Code (或 [VSCodium][13])。我在本教程中使用的是 Android Studio,但步骤与它们在 IntelliJ Idea (社区版)上的工作方式相似,因为它们构建在相同的平台上。 +Flutter 开发中常用的三个主要 IDE 工具是 IntelliJ IDEA(社区版)、Android Studio 和 VS Code(或 [VSCodium][13])。我在本教程中使用的是 Android Studio,但步骤与它们在 IntelliJ Idea(社区版)上的工作方式相似,因为它们构建在相同的平台上。 -首先,启动 **Android Studio**。打开 **Settings**,进入 **Plugins** 窗格,选择 **Marketplace** 选项卡。在搜索行中输入 **Flutter**,然后单击 **Install**。 +首先,启动 Android Studio。打开 “Settings”,进入 “Plugins” 窗格,选择 “Marketplace” 选项卡。在搜索行中输入 “Flutter”,然后单击 “Install”。 ![Flutter plugins][14] -(Vitaly Kuprenko, [CC BY-SA 4.0][6]) +你可能会看到一个安装 “Dart” 插件的选项;同意它。如果看不到 Dart 选项,请通过重复上述步骤手动安装它。我还建议使用 “Rainbow Brackets” 插件,它可以让代码导航更简单。 -您可能会看到一个安装 **Dart** 插件的选项;同意它。如果看不到 Dart 选项,请通过重复上述步骤手动安装。我还建议使用 **Rainbow Brackets** 插件,它可以让代码导航更简单。 - -就这样!您已经安装了所需的所有插件。您可以在终端中输入一个熟悉的命令进行检查: +就这样!你已经安装了所需的所有插件。你可以在终端中输入一个熟悉的命令进行检查: ``` flutter doctor -v @@ -131,47 +123,37 @@ flutter doctor -v ![Checking Flutter plugins with the doctor command][15] -(Vitaly Kuprenko, [CC BY-SA 4.0][6]) - -### 构建您的 “Hello World” 应用程序 +### 构建你的 “Hello World” 应用程序 要启动新项目,请创建一个 Flutter 项目: - 1. 选择 **New -> New Flutter project**. +1、选择 “New -> New Flutter project”。 ![Creating a new Flutter plugin][16] -(Vitaly Kuprenko, [CC BY-SA 4.0][6]) +2、在窗口中,选择所需的项目类型。 在这种情况下,你需要选择 “Flutter Application”。 - 2. 在窗口中,选择所需的项目类型。 在这种情况下,您需要选择 **Flutter Application**。 - - 3. 命名您的项目 **hello_world**。 请注意,您应该使用合并的名称,因此请使用下划线而不是空格。 您可能还需要指定 SDK 的路径。 +3、命名你的项目为 `hello_world`。 请注意,你应该使用合并的名称,因此请使用下划线而不是空格。 你可能还需要指定 SDK 的路径。 ![Naming a new Flutter plugin][17] -(Vitaly Kuprenko, [CC BY-SA 4.0][6]) +4、输入软件包名称。 - 4. 输入软件包名称。 - -您已经创建了一个项目!现在,您可以在设备上或使用模拟器启动它。 +你已经创建了一个项目!现在,你可以在设备上或使用模拟器启动它。 ![Device options in Flutter][18] -(Vitaly Kuprenko, [CC BY-SA 4.0][6]) - -选择您想要的设备,然后按 **运行**。稍后,您将看到结果。 +选择你想要的设备,然后按 “Run”。稍后,你将看到结果。 ![Flutter demo on mobile device][19] -(Vitaly Kuprenko, [CC BY-SA 4.0][6]) - 现在你可以在一个 [中间项目][20] 上开始工作了。 ### 尝试 Flutter for web -在安装 Flutter 的 Web 组件之前,您应该知道 Flutter 目前对 Web 应用程序的支持还很原始。 因此,将其用于复杂的项目并不是一个好主意。 +在安装 Flutter 的 Web 组件之前,你应该知道 Flutter 目前对 Web 应用程序的支持还很原始。 因此,将其用于复杂的项目并不是一个好主意。 -默认情况下,基本 SDK 中不启用 Flutter for web。 要打开它,请转到 beta 频道。 为此,请在终端中输入以下命令: +默认情况下,基本 SDK 中不启用 “Flutter for web”。 要打开它,请转到 beta 通道。 为此,请在终端中输入以下命令: ``` flutter channel beta @@ -179,8 +161,6 @@ flutter channel beta ![flutter channel beta output][21] -(Vitaly Kuprenko, [CC BY-SA 4.0][6]) - 接下来,使用以下命令根据 beta 分支升级 Flutter: ``` @@ -189,23 +169,19 @@ flutter upgrade ![flutter upgrade output][22] -(Vitaly Kuprenko, [CC BY-SA 4.0][6]) - -要使 Flutter for web 工作,请输入: +要使 “Flutter for web” 工作,请输入: ``` flutter config --enable-web ``` -重新启动 IDE;这有助于 Android Studio 索引新的 IDE 并重新加载设备列表。您应该会看到几个新设备: +重新启动 IDE;这有助于 Android Studio 索引新的 IDE 并重新加载设备列表。你应该会看到几个新设备: ![Flutter for web device options][23] -(Vitaly Kuprenko, [CC BY-SA 4.0][6]) +选择 “Chrome” 会在浏览器中启动一个应用程序, “Web Server” 会提供指向你的 Web 应用程序的链接,你可以在任何浏览器中打开它。 -选择 **Chrome** 会在浏览器中启动一个应用程序, **Web Server** 会提供指向您的 Web 应用程序的链接,您可以在任何浏览器中打开它。 - -不过,现在还不是急于开发的时候,因为您当前的项目不支持Web。要改进它,请打开项目根目录下的终端,然后输入: +不过,现在还不是急于开发的时候,因为你当前的项目不支持 Web。要改进它,请打开项目根目录下的终端,然后输入: ``` flutter create @@ -213,25 +189,21 @@ flutter create 此命令重新创建项目,并添加 Web 支持。 现有代码不会被删除。 -请注意,目录树已更改,现在有了一个 "web" 目录: +请注意,目录树已更改,现在有了一个 `web` 目录: ![File tree with web directory][24] -(Vitaly Kuprenko, [CC BY-SA 4.0][6]) - -现在您可以开始工作了。 选择 **Chrome**,然后按 **Run**。 稍后,您会看到带有应用程序的浏览器窗口。 +现在你可以开始工作了。 选择 “Chrome”,然后按 “Run”。 稍后,你会看到带有应用程序的浏览器窗口。 ![Flutter web app demo][25] -(Vitaly Kuprenko, [CC BY-SA 4.0][6]) - -恭喜你! 您刚刚为浏览器启动了一个项目,并且可以像其他任何网站一样继续使用它。 +恭喜你! 你刚刚为浏览器启动了一个项目,并且可以像其他任何网站一样继续使用它。 所有这些都来自同一代码库,因为 Flutter 使得几乎无需更改就可以为移动平台和 Web 编写代码。 ### 用 Flutter 做更多的事情 -Flutter 是用于移动开发的强大工具,而且它也是迈向跨平台开发的重要一步。 了解它,使用它,并将您的应用程序交付到所有平台! +Flutter 是用于移动开发的强大工具,而且它也是迈向跨平台开发的重要一步。 了解它,使用它,并将你的应用程序交付到所有平台! -------------------------------------------------------------------------------- @@ -239,8 +211,8 @@ via: https://opensource.com/article/20/9/mobile-app-flutter 作者:[Vitaly Kuprenko][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/gxlct008) -校对:[校对者ID](https://github.com/校对者ID) +译者:[gxlct008](https://github.com/gxlct008) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 49ce12a6d90a738185e0518e6a3b594b081526cc Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 7 Oct 2020 11:32:08 +0800 Subject: [PATCH 0357/1156] PUB @gxlct008 https://linux.cn/article-12693-1.html --- .../20200901 Create a mobile app with Flutter.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200901 Create a mobile app with Flutter.md (99%) diff --git a/translated/tech/20200901 Create a mobile app with Flutter.md b/published/20200901 Create a mobile app with Flutter.md similarity index 99% rename from translated/tech/20200901 Create a mobile app with Flutter.md rename to published/20200901 Create a mobile app with Flutter.md index 5266637c7c..3b525da7c6 100644 --- a/translated/tech/20200901 Create a mobile app with Flutter.md +++ b/published/20200901 Create a mobile app with Flutter.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (gxlct008) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12693-1.html) [#]: subject: (Create a mobile app with Flutter) [#]: via: (https://opensource.com/article/20/9/mobile-app-flutter) [#]: author: (Vitaly Kuprenko https://opensource.com/users/kooper) From bcd5b946d828b1b4162e17b00e448bb1884f7005 Mon Sep 17 00:00:00 2001 From: Hilton Chain <26847027+rakino@users.noreply.github.com> Date: Wed, 7 Oct 2020 12:41:35 +0800 Subject: [PATCH 0358/1156] translating --- ...8 How to view information on your Linux devices with lshw.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200928 How to view information on your Linux devices with lshw.md b/sources/tech/20200928 How to view information on your Linux devices with lshw.md index 33dc95f480..5f22c414a6 100644 --- a/sources/tech/20200928 How to view information on your Linux devices with lshw.md +++ b/sources/tech/20200928 How to view information on your Linux devices with lshw.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (rakino) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 2763fc292dd9fb58dda4d15065bb0304e416cf5c Mon Sep 17 00:00:00 2001 From: Hilton Chain <26847027+rakino@users.noreply.github.com> Date: Wed, 7 Oct 2020 16:44:51 +0800 Subject: [PATCH 0359/1156] translated --- ...ings You Didn-t Know About GNU Readline.md | 136 ------------------ ...ings You Didn-t Know About GNU Readline.md | 136 ++++++++++++++++++ 2 files changed, 136 insertions(+), 136 deletions(-) delete mode 100644 sources/talk/20190822 Things You Didn-t Know About GNU Readline.md create mode 100644 translated/talk/20190822 Things You Didn-t Know About GNU Readline.md diff --git a/sources/talk/20190822 Things You Didn-t Know About GNU Readline.md b/sources/talk/20190822 Things You Didn-t Know About GNU Readline.md deleted file mode 100644 index ded9340976..0000000000 --- a/sources/talk/20190822 Things You Didn-t Know About GNU Readline.md +++ /dev/null @@ -1,136 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (rakino) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Things You Didn't Know About GNU Readline) -[#]: via: (https://twobithistory.org/2019/08/22/readline.html) -[#]: author: (Two-Bit History https://twobithistory.org) - -Things You Didn't Know About GNU Readline -====== - -I sometimes think of my computer as a very large house. I visit this house every day and know most of the rooms on the ground floor, but there are bedrooms I’ve never been in, closets I haven’t opened, nooks and crannies that I’ve never explored. I feel compelled to learn more about my computer the same way anyone would feel compelled to see a room they had never visited in their own home. - -GNU Readline is an unassuming little software library that I relied on for years without realizing that it was there. Tens of thousands of people probably use it every day without thinking about it. If you use the Bash shell, every time you auto-complete a filename, or move the cursor around within a single line of input text, or search through the history of your previous commands, you are using GNU Readline. When you do those same things while using the command-line interface to Postgres (`psql`), say, or the Ruby REPL (`irb`), you are again using GNU Readline. Lots of software depends on the GNU Readline library to implement functionality that users expect, but the functionality is so auxiliary and unobtrusive that I imagine few people stop to wonder where it comes from. - -GNU Readline was originally created in the 1980s by the Free Software Foundation. Today, it is an important if invisible part of everyone’s computing infrastructure, maintained by a single volunteer. - -### Feature Replete - -The GNU Readline library exists primarily to augment any command-line interface with a common set of keystrokes that allow you to move around within and edit a single line of input. If you press `Ctrl-A` at a Bash prompt, for example, that will jump your cursor to the very beginning of the line, while pressing `Ctrl-E` will jump it to the end. Another useful command is `Ctrl-U`, which will delete everything in the line before the cursor. - -For an embarrassingly long time, I moved around on the command line by repeatedly tapping arrow keys. For some reason, I never imagined that there was a faster way to do it. Of course, no programmer familiar with a text editor like Vim or Emacs would deign to punch arrow keys for long, so something like Readline was bound to be created. Using Readline, you can do much more than just jump around—you can edit your single line of text as if you were using a text editor. There are commands to delete words, transpose words, upcase words, copy and paste characters, etc. In fact, most of Readline’s keystrokes/shortcuts are based on Emacs. Readline is essentially Emacs for a single line of text. You can even record and replay macros. - -I have never used Emacs, so I find it hard to remember what all the different Readline commands are. But one thing about Readline that is really neat is that you can switch to using a Vim-based mode instead. To do this for Bash, you can use the `set` builtin. The following will tell Readline to use Vim-style commands for the current shell: - -``` -$ set -o vi -``` - -With this option enabled, you can delete words using `dw` and so on. The equivalent to `Ctrl-U` in the Emacs mode would be `d0`. - -I was excited to try this when I first learned about it, but I’ve found that it doesn’t work so well for me. I’m happy that this concession to Vim users exists, and you might have more luck with it than me, particularly if you haven’t already used Readline’s default command keystrokes. My problem is that, by the time I heard about the Vim-based interface, I had already learned several Readline keystrokes. Even with the Vim option enabled, I keep using the default keystrokes by mistake. Also, without some sort of indicator, Vim’s modal design is awkward here—it’s very easy to forget which mode you’re in. So I’m stuck at a local maximum using Vim as my text editor but Emacs-style Readline commands. I suspect a lot of other people are in the same position. - -If you feel, not unreasonably, that both Vim and Emacs’ keyboard command systems are bizarre and arcane, you can customize Readline’s key bindings and make them whatever you like. This is not hard to do. Readline reads a `~/.inputrc` file on startup that can be used to configure various options and key bindings. One thing I’ve done is reconfigured `Ctrl-K`. Normally it deletes from the cursor to the end of the line, but I rarely do that. So I’ve instead bound it so that pressing `Ctrl-K` deletes the whole line, regardless of where the cursor is. I’ve done that by adding the following to `~/.inputrc`: - -``` -Control-k: kill-whole-line -``` - -Each Readline command (the documentation refers to them as _functions_) has a name that you can associate with a key sequence this way. If you edit `~/.inputrc` in Vim, it turns out that Vim knows the filetype and will help you by highlighting valid function names but not invalid ones! - -Another thing you can do with `~/.inputrc` is create canned macros by mapping key sequences to input strings. [The Readline manual][1] gives one example that I think is especially useful. I often find myself wanting to save the output of a program to a file, which means that I often append something like `> output.txt` to Bash commands. To save some time, you could make this a Readline macro: - -``` -Control-o: "> output.txt" -``` - -Now, whenever you press `Ctrl-O`, you’ll see that `> output.txt` gets added after your cursor on the command line. Neat! - -But with macros you can do more than just create shortcuts for strings of text. The following entry in `~/.inputrc` means that, every time I press `Ctrl-J`, any text I already have on the line is surrounded by `$(` and `)`. The macro moves to the beginning of the line with `Ctrl-A`, adds `$(`, then moves to the end of the line with `Ctrl-E` and adds `)`: - -``` -Control-j: "\C-a$(\C-e)" -``` - -This might be useful if you often need the output of one command to use for another, such as in: - -``` -$ cd $(brew --prefix) -``` - -The `~/.inputrc` file also allows you to set different values for what the Readline manual calls _variables_. These enable or disable certain Readline behaviors. You can use these variables to change, for example, how Readline auto-completion works or how the Readline history search works. One variable I’d recommend turning on is the `revert-all-at-newline` variable, which by default is off. When the variable is off, if you pull a line from your command history using the reverse search feature, edit it, but then decide to search instead for another line, the edit you made is preserved in the history. I find this confusing because it leads to lines showing up in your Bash command history that you never actually ran. So add this to your `~/.inputrc`: - -``` -set revert-all-at-newline on -``` - -When you set options or key bindings using `~/.inputrc`, they apply wherever the Readline library is used. This includes Bash most obviously, but you’ll also get the benefit of your changes in other programs like `irb` and `psql` too! A Readline macro that inserts `SELECT * FROM` could be useful if you often use command-line interfaces to relational databases. - -### Chet Ramey - -GNU Readline is today maintained by Chet Ramey, a Senior Technology Architect at Case Western Reserve University. Ramey also maintains the Bash shell. Both projects were first authored by a Free Software Foundation employee named Brian Fox beginning in 1988. But Ramey has been the sole maintainer since around 1994. - -Ramey told me via email that Readline, far from being an original idea, was created to implement functionality prescribed by the POSIX specification, which in the late 1980s had just been created. Many earlier shells, including the Korn shell and at least one version of the Unix System V shell, included line editing functionality. The 1988 version of the Korn shell (`ksh88`) provided both Emacs-style and Vi/Vim-style editing modes. As far as I can tell from [the manual page][2], the Korn shell would decide which mode you wanted to use by looking at the `VISUAL` and `EDITOR` environment variables, which is pretty neat. The parts of POSIX that specified shell functionality were closely modeled on `ksh88`, so GNU Bash was going to have to implement a similarly flexible line-editing system to stay compliant. Hence Readline. - -When Ramey first got involved in Bash development, Readline was a single source file in the Bash project directory. It was really just a part of Bash. Over time, the Readline file slowly moved toward becoming an independent project, though it was not until 1994 (with the 2.0 release of Readline) that Readline became a separate library entirely. - -Readline is closely associated with Bash, and Ramey usually pairs Readline releases with Bash releases. But as I mentioned above, Readline is a library that can be used by any software implementing a command-line interface. And it’s really easy to use. This is a simple example, but here’s how you would you use Readline in your own C program. The string argument to the `readline()` function is the prompt that you want Readline to display to the user: - -``` -#include -#include -#include "readline/readline.h" - -int main(int argc, char** argv) -{ - char* line = readline("my-rl-example> "); - printf("You entered: \"%s\"\n", line); - - free(line); - - return 0; -} -``` - -Your program hands off control to Readline, which is responsible for getting a line of input from the user (in such a way that allows the user to do all the fancy line-editing things). Once the user has actually submitted the line, Readline returns it to you. I was able to compile the above by linking against the Readline library, which I apparently have somewhere in my library search path, by invoking the following: - -``` -$ gcc main.c -lreadline -``` - -The Readline API is much more extensive than that single function of course, and anyone using it can tweak all sorts of things about the library’s behavior. Library users can even add new functions that end users can configure via `~/.inputrc`, meaning that Readline is very easy to extend. But, as far as I can tell, even Bash ultimately calls the simple `readline()` function to get input just as in the example above, though there is a lot of configuration beforehand. (See [this line][3] in the source for GNU Bash, which seems to be where Bash hands off responsibility for getting input to Readline.) - -Ramey has now worked on Bash and Readline for well over a decade. He has never once been compensated for his work—he is and has always been a volunteer. Bash and Readline continue to be actively developed, though Ramey said that Readline changes much more slowly than Bash does. I asked Ramey what it was like being the sole maintainer of software that so many people use. He said that millions of people probably use Bash without realizing it (because every Apple device runs Bash), which makes him worry about how much disruption a breaking change might cause. But he’s slowly gotten used to the idea of all those people out there. He said that he continues to work on Bash and Readline because at this point he is deeply invested and because he simply likes to make useful software available to the world. - -_You can find more information about Chet Ramey at [his website][4]._ - -_If you enjoyed this post, more like it come out every four weeks! Follow [@TwoBitHistory][5] on Twitter or subscribe to the [RSS feed][6] to make sure you know when a new post is out._ - -_Previously on TwoBitHistory…_ - -> Please enjoy my long overdue new post, in which I use the story of the BBC Micro and the Computer Literacy Project as a springboard to complain about Codecademy. -> -> — TwoBitHistory (@TwoBitHistory) [March 31, 2019][7] - --------------------------------------------------------------------------------- - -via: https://twobithistory.org/2019/08/22/readline.html - -作者:[Two-Bit History][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://twobithistory.org -[b]: https://github.com/lujun9972 -[1]: https://tiswww.case.edu/php/chet/readline/readline.html -[2]: https://web.archive.org/web/20151105130220/http://www2.research.att.com/sw/download/man/man1/ksh88.html -[3]: https://github.com/bminor/bash/blob/9f597fd10993313262cab400bf3c46ffb3f6fd1e/parse.y#L1487 -[4]: https://tiswww.case.edu/php/chet/ -[5]: https://twitter.com/TwoBitHistory -[6]: https://twobithistory.org/feed.xml -[7]: https://twitter.com/TwoBitHistory/status/1112492084383092738?ref_src=twsrc%5Etfw diff --git a/translated/talk/20190822 Things You Didn-t Know About GNU Readline.md b/translated/talk/20190822 Things You Didn-t Know About GNU Readline.md new file mode 100644 index 0000000000..a932974147 --- /dev/null +++ b/translated/talk/20190822 Things You Didn-t Know About GNU Readline.md @@ -0,0 +1,136 @@ +[#]: collector: (lujun9972) +[#]: translator: (rakino) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Things You Didn't Know About GNU Readline) +[#]: via: (https://twobithistory.org/2019/08/22/readline.html) +[#]: author: (Two-Bit History https://twobithistory.org) + +你所不知的 GNU Readline +====== + +有时我会觉得自己的计算机是一栋非常大的房子,我每天都会访问这栋房子,也对一楼的大部分房间都了如指掌,但仍然还是有卧室我没有去过,有衣柜我没有打开过,有犄角旮旯我没有探索过。我感到有必要更多地了解我的计算机了,就像任何人都会觉得有必要看看自己家里从未去过的房间一样。 + +GNU Readline 是个不起眼的小软件库,我依赖了它多年却没有意识到它的存在,也许有成千上万的人每天都在不经意间使用它。如果你用 Bash shell 的话,每当你补全一个文件名,或者在一行文本输入中移动光标,以及搜索之前命令的历史记录时,你都在使用 GNU Readline;当你在 Postgres(`psql`)或是 Ruby REPL(`irb`)的命令行界面中进行同样的操作时,你依然在使用 GNU Readline。很多软件都依赖 GNU Readline 库来实现用户所期望的功能,不过这些功能是如此的辅助与不显眼,以至于在我看来很少有人会停下来去想它是从哪里来的。 + +GNU Readline 最初是自由软件基金会在 20 世纪 80 年代创建的,如今作为每个人的基础计算设施的重要组成部分的它,由一位志愿者维护。 + +### 充满特色 + +GNU Readline 库的存在,主要是为了用一组通用的按键来增强任何命令行界面,从而使你可以在一行输入中移动和编辑。例如,在 Bash 提示符中按下 `Ctrl-A`,你的光标会跳到行首,而按下 `Ctrl-E` 则会跳到行末;另一个有用的命令是 `Ctrl-U`,它会删除该行中光标之前的所有内容。 + +有很长一段时间,我通过反复敲击方向键来在命令行上移动,如今看来这十分尴尬,也不知道为什么,当时的我从来没有想过可以有一种更快的方法。当然了,没有一个熟悉 Vim 或 Emacs 这种文本编辑器的程序员愿意长时间地击打方向键,所以像 Readline 这样的东西必然会被创造出来;不过在 Readline 上可以做的绝非仅仅跳来跳去,你可以像使用文本编辑器那样编辑单行文本——这里有删除单词、换位、大写单词、复制和粘贴字符等命令。Readline 的大部分按键/快捷键都是基于 Emacs 的,它基本上就是一个单行文本版的 Emacs 了,甚至还有录制和重放宏的功能。 + +我从来没有用过 Emacs,所以很难记住所有不同的 Readline 命令。不过 Readline 有着很巧妙的一点,那就是能够切换到基于 Vim 的模式,在 Bash 中可以使用内置的 `set` 命令来这样做。下面会让 Readline 在当前的 shell 中使用 Vim 风格的命令: + +``` +$ set -o vi +``` + +该选项启用后,就可以使用 `dw` 等命令来删除单词了,此时相当于 Emacs 模式下的 `Ctrl-U` 的命令是 `d0`。 + +我第一次知道有这个功能的时候很兴奋地想尝试一下,但它对我来说并不是那么好用。我很高兴知道有这种对 Vim 用户的让步,在使用这个功能上你可能会比我更幸运,尤其是你还没有使用 Readline 的默认按键的话;我的问题在于,我听说有基于 Vim 的界面时已经学会了几种默认按键,因此即使启用了 Vim 的选项,也一直在错误地用着默认的按键;另外因为没有某种指示器,所以 Vim 的多模态设计在这里会很尴尬——你很容易就忘记了自己处于哪个模式,就因为这样,我卡在了一种虽然使用 Vim 作为文本编辑器,但却在 Readline 上用着 Emacs 风格的命令的情况里,我猜其他很多人也是这样的。 + +如果你觉得 Vim 和 Emacs 的键盘命令系统诡异而神秘,你可以按照喜欢的方式自定义 Readline 的键绑定,这并不难。Readline 在启动时会读取文件 `~/.inputrc`,它可以用来配置各种选项与键绑定,我做的一件事是重新配置了 `Ctrl-K`:通常情况下该命令会从光标处删除到行末,但我很少这样做,所以我在 `~/.inputrc` 中添加了以下内容,把它绑定为直接删除整行: + +``` +Control-k: kill-whole-line +``` + +每个 Readline 命令(文档中称它们为 _函数_ )都有一个名称,你可以用这种方式将其与一个键序联系起来。如果你在 Vim 中编辑 `~/.inputrc`,就会发现 Vim 知道这种文件类型,还会帮你高亮显示有效的函数名,而不高亮无效的函数名。 + +`~/.inputrc` 可以做的另一件事是通过将键序映射到输入字符串上来创建预制宏。[Readline 手册][1]给出了一个我认为特别有用的例子:我经常想把一个程序的输出保存到文件中,这意味着我得经常在 Bash 命令中追加类似 `> output.txt` 这样的东西,为了节省时间,可以把它做成一个 Readline 宏。 + +``` +Control-o: "> output.txt" +``` + +这样每当你按下 `Ctrl-O` 时,你都会看到 `> output.txt` 被添加到了命令行光标的后面,这样很不错! + +不过你可以用宏做的可不仅仅是为文本串创建快捷方式;在 `~/.inputrc` 中使用以下条目意味着每次按下 `Ctrl-J` 时,行内已有的文本都会被 `$(` 和 `)` 包裹住。该宏先用 `Ctrl-A` 移动到行首,添加 `$(` ,然后再用 `Ctrl-E` 移动到行尾,添加 `)`。 + +``` +Control-j: "\C-a$(\C-e)" +``` + +如果你经常需要像下面这样把一个命令的输出用于另一个命令的话,这个宏可能会对你有帮助。 + +``` +$ cd $(brew --prefix) +``` + +`~/.inputrc` 文件也允许你为 Readline 手册中所谓的 _变量_ 设置不同的值,这些变量会启用或禁用某些 Readline 行为,你也可以使用这些变量来改变 Readline 中像是自动补全或者历史搜索这些行为的工作方式。我建议开启的一个变量是 `revert-all-at-newline`,它是默认关闭的,当这个变量关闭时,如果你使用反向搜索功能从命令历史记录中提取一行并编辑,但随后又决定搜索另一行,那么你所做的编辑会被保存在历史记录中。我觉得这样会很混乱,因为这会导致你的 Bash 命令历史中出现从未运行过的行。所以在你的 `~/.inputrc` 中加入这个: + +``` +set revert-all-at-newline on +``` + +在你用 `~/.inputrc` 设置了选项或键绑定以后,它们会适用于任何使用 Readline 库的地方,显然 Bash 包括在内,不过你也会在其它像是 `irb` 和 `psql` 这样的程序中受益。如果你经常使用关系型数据库的命令行界面,一个用于插入 `SELECT * FROM` 的 Readline 宏可能会很有用。 + +### Chet Ramey + +GNU Readline 如今由凯斯西储大学的高级技术架构师 Chet Ramey 维护,Ramey 同时还负责维护 Bash shell;这两个项目都是由一位名叫 Brian Fox 的自由软件基金会员工在 1988 年开始编写的,但从 1994 年左右开始,Ramey 一直是它们唯一的维护者。 + +Ramey 通过电子邮件告诉我,Readline 远非一个原创的想法,它是为了实现 POSIX 规范所规定的功能而被创建的,而 POSIX 规范又是在 20 世纪 80 年代末被制定的。许多早期的 shell,包括 Korn shell 和至少一个版本的 Unix System V shell,都包含行编辑功能。1988 年版的 Korn shell(`ksh88`)提供了 Emacs 风格和 Vi/Vim 风格的编辑模式。据我从[手册页][2]中得知,Korn shell 会通过查看 `VISUAL` 和 `EDITOR` 环境变量来决定你使用的模式,这一点非常巧妙。POSIX 中指定 shell 功能的部分近似于 `ksh88` 的实现,所以 GNU Bash 也要实现一个类似的灵活的行编辑系统来保持兼容,因此就有了Readline。 + +Ramey 第一次参与 Bash 开发时,Readline 还是 Bash 项目目录下的一个源文件,它真的只是 Bash 的一部分;随着时间的推移,Readline 文件慢慢地成为了独立的项目,不过还要等到 1994 年(Readline 的 2.0 版本)Readline 才完全成为了一个独立的库。 + +Readline 与 Bash 密切相关,Ramey 也通常把 Readline 与 Bash 的发布配对,但正如我上面提到的,Readline 是一个可以被任何有命令行接口的软件使用的库,而且它真的很容易使用。下面是一个例子,虽然简单,但这就是在 C 程序中使用 Readline 的方法。向 `readline()` 函数传递的字符串参数就是你希望 Readline 向用户显示的提示符: + +``` +#include +#include +#include "readline/readline.h" + +int main(int argc, char** argv) +{ + char* line = readline("my-rl-example> "); + printf("You entered: \"%s\"\n", line); + + free(line); + + return 0; +} +``` + +你的程序会把控制权交给 Readline,它会负责从用户那里获得一行输入(以这样的方式让用户可以做所有花哨的行编辑工作),一旦用户真正提交了这一行,Readline 就会把它返回给你。在我的库搜索路径中有 Readline 库,所以我可以通过调用以下内容来链接 Readline 库,从而编译上面的内容: + +``` +$ gcc main.c -lreadline +``` + +当然,Readline 的 API 比起那个单一的函数要丰富得多,任何使用它的人都可以对库的行为进行各种调整,库的用户(开发者)甚至可以添加新的函数,来让最终用户可以通过 `~/.inputrc` 来配置它们,这意味着 Readline 非常容易扩展。但是据我所知,即使是 Bash ,虽然事先有很多配置,最终也会像上面的例子一样调用简单的 `readline()` 函数来获取输入。(参见 GNU Bash 源代码中的[这一行][3],Bash 似乎在这里将获取输入的责任交给了 Readline)。 + +Ramey 现在已经在 Bash 和 Readline 上工作了十多年,但他的工作却从来没有得到过报酬——他一直都是一名志愿者。尽管 Ramey 说 Readline 的变化比 Bash 慢得多,但 Bash 和 Readline 仍然在积极开发中。我问 Ramey 作为这么多人使用的软件唯一的维护者是什么感觉,他说可能有几百万人在不知不觉中使用 Bash(因为每个苹果设备都运行 Bash),这让他担心一个突破性的变化会造成多大的破坏,不过他已经慢慢习惯了所有这些人的想法。他还说他会继续在 Bash 和 Readline 上工作,因为在这一点上他已经深深地投入了,而且他也只是单纯地喜欢把有用的软件提供给世界。 + +_你可以在 [Chet Ramey 的网站][4]上找到更多关于他的信息。_ + +_喜欢这篇文章吗?我会每四周写出一篇像这样的文章。关注推特帐号 [@TwoBitHistory][5] 或者[订阅 RSS][6] 来获取更新吧!_ + +_TwoBitHistory 的上一条消息:_ + +> 请欣赏我拖欠已久的新文章,我在里面以 BBC Micro 和计算机认知计划的故事作为出发点抱怨了一下 Codecademy。 +> +> — TwoBitHistory (@TwoBitHistory) [三月 31,2019][7] + +-------------------------------------------------------------------------------- + +via: https://twobithistory.org/2019/08/22/readline.html + +作者:[Two-Bit History][a] +选题:[lujun9972][b] +译者:[rakino](https://github.com/rakino) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://twobithistory.org +[b]: https://github.com/lujun9972 +[1]: https://tiswww.case.edu/php/chet/readline/readline.html +[2]: https://web.archive.org/web/20151105130220/http://www2.research.att.com/sw/download/man/man1/ksh88.html +[3]: https://github.com/bminor/bash/blob/9f597fd10993313262cab400bf3c46ffb3f6fd1e/parse.y#L1487 +[4]: https://tiswww.case.edu/php/chet/ +[5]: https://twitter.com/TwoBitHistory +[6]: https://twobithistory.org/feed.xml +[7]: https://twitter.com/TwoBitHistory/status/1112492084383092738?ref_src=twsrc%5Etfw From cd91c9eb3b155e5ee27107bf1642211071c8e296 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 8 Oct 2020 09:55:45 +0800 Subject: [PATCH 0360/1156] PRF --- .../tech/20200512 Scan your Linux security with Lynis.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/translated/tech/20200512 Scan your Linux security with Lynis.md b/translated/tech/20200512 Scan your Linux security with Lynis.md index 9abfc2984c..b4e804d19f 100644 --- a/translated/tech/20200512 Scan your Linux security with Lynis.md +++ b/translated/tech/20200512 Scan your Linux security with Lynis.md @@ -12,7 +12,7 @@ > 使用这个全面的开源安全审计工具检查你的 Linux 机器的安全性。 -!["手把一个Linux文件夹放进抽屉"][1] +![](https://img.linux.net.cn/data/attachment/album/202010/08/095516k6bdgeb6jhiajutm.jpg) 你有没有想过你的 Linux 机器到底安全不安全?Linux 发行版众多,每个发行版都有自己的默认设置,你在上面运行着几十个版本各异的软件包,还有众多的服务在后台运行,而我们几乎不知道或不关心这些。 @@ -24,7 +24,7 @@ ### 安装 Lynis -Lynis 可能在你的 Linux 软件仓库中可用。如果有的话,你可以用以下方法安装它: +你的 Linux 软件仓库中可能有 Lynis。如果有的话,你可以用以下方法安装它: ``` dnf install lynis @@ -56,7 +56,7 @@ Resolving deltas: 100% (9264/9264), done. $ ``` -一旦你克隆了这个版本库,就进入该目录,看看里面有什么可用的。主要的工具在一个叫 `lynis` 的文件里。它实际上是一个 shell 脚本,所以你可以打开它看看它在做什么。事实上,Lynis 主要是用 shell 脚本来实现的: +一旦你克隆了这个版本库,那么进入该目录,看看里面有什么可用的。主要的工具在一个叫 `lynis` 的文件里。它实际上是一个 shell 脚本,所以你可以打开它看看它在做什么。事实上,Lynis 主要是用 shell 脚本来实现的: ``` $ cd lynis/ @@ -71,7 +71,7 @@ $ ### 运行 Lynis -通过给 Lynis 一个 `-h` 选项来查看帮助部分来了解一下: +通过给 Lynis 一个 `-h` 选项来查看帮助部分,以便有个大概了解: ``` $ ./lynis -h From 25ae6ee13d2b7261dfb85d0816b4e4fc90259474 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 8 Oct 2020 09:56:59 +0800 Subject: [PATCH 0361/1156] PUB @wxy https://linux.cn/article-12696-1.html --- .../20200512 Scan your Linux security with Lynis.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200512 Scan your Linux security with Lynis.md (99%) diff --git a/translated/tech/20200512 Scan your Linux security with Lynis.md b/published/20200512 Scan your Linux security with Lynis.md similarity index 99% rename from translated/tech/20200512 Scan your Linux security with Lynis.md rename to published/20200512 Scan your Linux security with Lynis.md index b4e804d19f..e945d3b86d 100644 --- a/translated/tech/20200512 Scan your Linux security with Lynis.md +++ b/published/20200512 Scan your Linux security with Lynis.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12696-1.html) [#]: subject: (Scan your Linux security with Lynis) [#]: via: (https://opensource.com/article/20/5/linux-security-lynis) [#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe) From 0c0cd686125924bd9536350de744788db1662d38 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 8 Oct 2020 10:24:35 +0800 Subject: [PATCH 0362/1156] PRF @wxy --- ...Lynis reports to improve Linux security.md | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/translated/tech/20200810 How to read Lynis reports to improve Linux security.md b/translated/tech/20200810 How to read Lynis reports to improve Linux security.md index f6e4aec967..17f531bb4a 100644 --- a/translated/tech/20200810 How to read Lynis reports to improve Linux security.md +++ b/translated/tech/20200810 How to read Lynis reports to improve Linux security.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to read Lynis reports to improve Linux security) @@ -12,13 +12,13 @@ > 使用 Lynis 的扫描和报告来发现和修复 Linux 安全问题。 -![锁定][1] +![](https://img.linux.net.cn/data/attachment/album/202010/08/102355k7jakojhz9x8xamx.jpg) -当我读到 Gaurav Kamathe 的文章《[用 Lynis 扫描你的 Linux 安全性][2]>时,让我想起了我在美国劳工部担任系统管理员的日子。我的职责之一是保证我们的 Unix 服务器的安全。每个季度,都会有一个独立的核查员来审查我们服务器的安全状态。每次在核查员预定到达的那一天,我都会运行 Security Readiness Review(SRR),这是一个扫描工具,它使用一大套脚本来识别和报告任何安全线索。SRR 是开源的,因此我可以查看所有源码脚本及其功能。这使我能够查看代码,确定具体是什么问题,并迅速修复它发现的每个问题。 +当我读到 Gaurav Kamathe 的文章《[使用 Lynis 扫描 Linux 安全性][2]》时,让我想起了我在美国劳工部担任系统管理员的日子。我那时的职责之一是保证我们的 Unix 服务器的安全。每个季度,都会有一个独立的核查员来审查我们服务器的安全状态。每次在核查员预定到达的那一天,我都会运行 Security Readiness Review(SRR),这是一个扫描工具,它使用一大套脚本来识别和报告任何安全线索。SRR 是开源的,因此我可以查看所有源码脚本及其功能。这使我能够查看其代码,确定具体是什么问题,并迅速修复它发现的每个问题。 ### 什么是 Lynis? -[Lynis][3] 是一个开源的安全审计工具,它的工作原理和 SRR 很像,它会扫描 Linux 系统,并提供关于它发现的任何弱点的详细报告。同样和 SRR 一样,它也是由一大套脚本组成的,每个脚本都会检查一个特定的项目,例如,最小和最大密码时间要求。 +[Lynis][3] 是一个开源的安全审计工具,它的工作原理和 SRR 很像,它会扫描 Linux 系统,并提供它发现的任何弱点的详细报告。同样和 SRR 一样,它也是由一大套脚本组成的,每个脚本都会检查一个特定的项目,例如,最小和最大密码时间要求。 运行 Lynis 后,你可以使用它的报告来定位每个项目的脚本,并了解 Lynis 是如何检查和报告每个问题的。你也可以使用相同的脚本代码来创建新的代码来自动解决。 @@ -61,14 +61,14 @@ 2020-06-16 20:54:33 ==== ``` -这些细节表明 Lynis 无法找到各种文件。这个情况非常清楚。我可以运行 `updatedb` 命令,重新检查这个测试。 +这些细节表明 Lynis 无法找到各种文件。这个情况描述的非常清楚。我可以运行 `updatedb` 命令,然后重新检查这个测试。 ``` # updatedb # lynis --tests FILE-6410 ``` -然后,重新检查细节时,会显示它发现哪个文件满足了测试: +重新检查细节时,会显示它发现哪个文件满足了测试: ``` # lynis show details FILE-6410 @@ -89,8 +89,8 @@ Lynis 的许多建议并不像这个建议那样直接。如果你不确定某 ``` * Consider hardening SSH configuration [SSH-7408] -    - Details  : MaxAuthTries (6 --> 3) -      + - Details : MaxAuthTries (6 --> 3) + https://cisofy.com/lynis/controls/SSH-7408/ ``` 要解决这个问题,你需要知道 SSH 配置文件的位置。一个经验丰富的 Linux 管理员可能已经知道在哪里找到它们,但如果你不知道,有一个方法可以看到 Lynis 在哪里找到它们。 @@ -112,7 +112,7 @@ Lynis 支持多种操作系统,因此你的安装位置可能有所不同。 #### 查找 SSH 问题 -名为 `tests_ssh` 的文件中包含了 TEST-ID,在这里可以找到与 SSH 相关的扫描函数。看看这个文件,就可以看到 Lynis 扫描器调用的各种函数。第一部分在一个名为 `SSH_DAEMON_CONFIG_LOCS` 的变量中定义了一个目录列表。下面几节负责检查 SSH 守护进程的状态、定位它的配置文件,并识别它的版本。我在 SSH-7404 测试中找到了查找配置文件的代码,描述为 “确定 SSH 守护进程配置文件位置”。这段代码包含一个 `for` 循环,在列表中的项目中搜索一个名为 `sshd_config` 的文件。我可以用这个逻辑来做自己的搜索: +名为 `tests_ssh` 的文件中包含了 TEST-ID,在这里可以找到与 SSH 相关的扫描函数。看看这个文件,就可以看到 Lynis 扫描器调用的各种函数。第一部分在一个名为 `SSH_DAEMON_CONFIG_LOCS` 的变量中定义了一个目录列表。下面几节负责检查 SSH 守护进程的状态、定位它的配置文件,并识别它的版本。我在 SSH-7404 测试中找到了查找配置文件的代码,描述为 “确定 SSH 守护进程配置文件位置”。这段代码包含一个 `for` 循环,在列表中的项目中搜索一个名为 `sshd_config` 的文件。我可以用这个逻辑来自己进行搜索: ``` # find /etc /etc/ssh /usr/local/etc/ssh /opt/csw/etc/ssh -name sshd_config @@ -122,7 +122,7 @@ find: ‘/usr/local/etc/ssh’: No such file or directory find: ‘/opt/csw/etc/ssh’: No such file or directory ``` -进一步探索这个文件,就会发现寻找 SSH-7408 的相关代码。这个测试涵盖了 `MaxAuthTries` 和其他一些设置。现在我可以在 SSH 配置文件中找到该变量: +进一步探索这个文件,就会看到寻找 SSH-7408 的相关代码。这个测试涵盖了 `MaxAuthTries` 和其他一些设置。现在我可以在 SSH 配置文件中找到该变量: ``` # grep MaxAuthTries /etc/ssh/sshd_config @@ -131,7 +131,7 @@ find: ‘/opt/csw/etc/ssh’: No such file or directory #### 修复法律横幅问题 -Lynis 还报告了一个与登录系统时显示的法律横幅有关的发现。在我的家庭桌面系统上(我不希望有很多其他人登录),我没有去改变默认的 `issue` 文件。企业或政府的系统很可能被要求包含一个法律横幅,以警告用户他们的登录和活动可能被记录和监控。Lynis 用 BANN-7126 测试和 BANN-7130 测试报告了这一点: +Lynis 还报告了一个与登录系统时显示的法律横幅有关的发现。在我的家庭桌面系统上(我并不希望有很多其他人登录),我没有去改变默认的 `issue` 文件。企业或政府的系统很可能被要求包含一个法律横幅,以警告用户他们的登录和活动可能被记录和监控。Lynis 用 BANN-7126 测试和 BANN-7130 测试报告了这一点: ``` * Add a legal banner to /etc/issue, to warn unauthorized users [BANN-7126] @@ -168,7 +168,7 @@ Kernel \r on an \m (\l) for ITEM in ${LEGAL_BANNER_STRINGS}; do ``` -这些法律术语存储在文件顶部定义的变量 `LEGAL_BANNER_STRINGS` 中。向后滚动到顶部可以看到完整的清单:” +这些法律术语存储在文件顶部定义的变量 `LEGAL_BANNER_STRINGS` 中。向后滚动到顶部可以看到完整的清单: ``` LEGAL_BANNER_STRINGS="audit access authori condition connect consent continu criminal enforce evidence forbidden intrusion law legal legislat log monitor owner penal policy policies privacy private prohibited record restricted secure subject system terms warning" @@ -205,12 +205,12 @@ via: https://opensource.com/article/20/8/linux-lynis-security 作者:[Alan Formy-Duval][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://opensource.com/users/alanfdoss [b]: https://github.com/lujun9972 [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security-lock-password.jpg?itok=KJMdkKum (Lock) -[2]: https://opensource.com/article/20/5/linux-security-lynis +[2]: https://linux.cn/article-12696-1.html [3]: https://github.com/CISOfy/lynis From 10bfb1bd1ed70b321a705e2cc66b385af82b4893 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 8 Oct 2020 10:27:32 +0800 Subject: [PATCH 0363/1156] PUB @wxy https://linux.cn/article-12697-1.html --- ...810 How to read Lynis reports to improve Linux security.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200810 How to read Lynis reports to improve Linux security.md (99%) diff --git a/translated/tech/20200810 How to read Lynis reports to improve Linux security.md b/published/20200810 How to read Lynis reports to improve Linux security.md similarity index 99% rename from translated/tech/20200810 How to read Lynis reports to improve Linux security.md rename to published/20200810 How to read Lynis reports to improve Linux security.md index 17f531bb4a..41188a41c1 100644 --- a/translated/tech/20200810 How to read Lynis reports to improve Linux security.md +++ b/published/20200810 How to read Lynis reports to improve Linux security.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12697-1.html) [#]: subject: (How to read Lynis reports to improve Linux security) [#]: via: (https://opensource.com/article/20/8/linux-lynis-security) [#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) From 341766e9f48f01476b133ccbcf5308d349e98588 Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Thu, 8 Oct 2020 11:50:40 +0800 Subject: [PATCH 0364/1156] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=AF=91=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...on Ubuntu and Other Linux Distributions.md | 118 ++++++++++-------- 1 file changed, 63 insertions(+), 55 deletions(-) diff --git a/sources/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md b/sources/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md index 4e6fb7986e..49d99ffff9 100644 --- a/sources/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md +++ b/sources/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md @@ -7,82 +7,82 @@ [#]: via: (https://itsfoss.com/install-yarn-ubuntu) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -Using Yarn on Ubuntu and Other Linux Distributions +在 Ubuntu 和其他 Linux 发行版上使用 Yarn ====== -**This quick tutorial shows you the official way of installing Yarn package manager on Ubuntu and Debian Linux. You’ll also learn some basic Yarn commands and the steps to remove Yarn completely.** +***本速成教程向您展示了在 Ubuntu 和 Debian Linux 上安装 Yarn 包管理器的官方方法。您还将学习到一些基本的 Yarn 命令以及彻底删除 Yarn 的步骤。*** -[Yarn][1] is an open source JavaScript package manager developed by Facebook. It is an alternative or should I say improvement to the popular npm package manager. [Facebook developers’ team][2] created Yarn to overcome the shortcomings of [npm][3]. Facebook claims that Yarn is faster, reliable and more secure than npm. +[Yarn][1] 是 Facebook 开发的开源 JavaScript 包管理器。它是流行的 npm 包管理器的一个替代品,或者应该说是改进。 [Facebook 开发团队][2] 创建 Yarn 是为了克服 [npm][3] 的缺点。 Facebook 声称 Yarn 比 npm 更快、更可靠、更安全。 -Like npm, Yarn provides you a way to automate the process of installing, updating, configuring, and removing packages retrieved from a global registry. +与 npm 一样,Yarn 为您提供一种自动安装、更新、配置和删除从全局注册表中检索到的程序包的方法。 -The advantage of Yarn is that it is faster as it caches every package it downloads so it doesn’t need to download it again. It also parallelizes operations to maximize resource utilization. Yarn also uses [checksums to verify the integrity][4] of every installed package before its code is executed. Yarn also guarantees that an install that worked on one system will work exactly the same way on any other system. +Yarn 的优点是它更快,因为它缓存了已下载的每个包,所以无需再次下载。它还将操作并行化,以最大化资源利用率。在执行每个已安装的包代码之前,Yarn 还使用 [校验和来验证完整性][4]。 Yarn 还保证在一个系统上运行的安装,在任何其他系统上都会以完全相同地方式工作。 -If you are [using nodejs on Ubuntu][5], probably you already have npm installed on your system. In that case, you can use npm to install Yarn globally in the following manner: +如果您正 [在 Ubuntu 上使用 nodejs][5],那么您的系统上可能已经安装了 npm。在这种情况下,您可以通过以下方式使用 npm 全局安装 Yarn: ``` sudo npm install yarn -g ``` -However, I would recommend using the official way to install Yarn on Ubuntu/Debian. +不过,我推荐使用官方方式在 Ubuntu/Debian 上安装 Yarn。 -### Installing Yarn on Ubuntu and Debian [The Official Way] +### 在 Ubuntu 和 Debian 上安装 Yarn [官方方式] ![Yarn JS][6] -The instructions mentioned here should be applicable to all versions of Ubuntu such as Ubuntu 18.04, 16.04 etc. The same set of instructions are also valid for Debian and other Debian based distributions. +这里提到的指令应该适用于所有版本的 Ubuntu,例如 Ubuntu 18.04、16.04 等。同样的指令集也适用于 Debian 和其他基于 Debian 的发行版。 -Since the tutorial uses Curl to add the GPG key of Yarn project, it would be a good idea to verify whether you have Curl installed already or not. +由于本教程使用 curl 来添加 Yarn 项目的 GPG 密钥,所以最好验证一下您是否已经安装了 curl。 ``` sudo apt install curl ``` -The above command will install Curl if it wasn’t installed already. Now that you have curl, you can use it to add the GPG key of Yarn project in the following fashion: +如果 curl 尚未安装,则上面的命令将安装它。既然有了 curl,您就可以使用它以如下方式添加 Yarn 项目的 GPG 密钥: ``` curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - ``` -After that, add the repository to your sources list so that you can easily upgrade the Yarn package in future with the rest of the system updates: +在此之后,将存储库添加到源列表中,以便将来可以轻松地升级 Yarn 包,并进行其余系统更新: ``` sudo sh -c 'echo "deb https://dl.yarnpkg.com/debian/ stable main" >> /etc/apt/sources.list.d/yarn.list' ``` -You are set to go now. [Update Ubuntu][7] or Debian system to refresh the list of available packages and then install yarn: +您现在可以继续了。[更新 Ubuntu][7] 或 Debian 系统,以刷新可用软件包列表,然后安装 Yarn: ``` sudo apt update sudo apt install yarn ``` -This will install Yarn along with nodejs. Once the process completes, verify that Yarn has been installed successfully. You can do that by checking the Yarn version. +这将一起安装 Yarn 和 nodejs。该过程完成后,请验证是否已成功安装 Yarn。 您可以通过检查 Yarn 版本来做到这一点。 ``` yarn --version ``` -For me, it showed an output like this: +对我来说,它显示了这样的输出: ``` yarn --version 1.12.3 ``` -This means that I have Yarn version 1.12.3 installed on my system. +这意味着我的系统上安装了 Yarn 版本 1.12.3。 -### Using Yarn +### 使用 Yarn -I presume that you have some basic understandings of JavaScript programming and how dependencies work. I am not going to go in details here. I’ll show you some of the basic Yarn commands that will help you getting started with it. +我假设您对 JavaScript 编程以及依赖项的工作原理有一些基本的了解。我在这里不做详细介绍。我将向您展示一些基本的 Yarn 命令,这些命令将帮助您入门。 -#### Creating a new project with Yarn +#### 使用 Yarn 创建一个新项目 -Like npm, Yarn also works with a package.json file. This is where you add your dependencies. All the packages of the dependencies are cached in the node_modules directory in the root directory of your project. +与 npm 一样,Yarn 也可以使用 package.json 文件。在这里添加依赖项。所有依赖包都缓存在项目根目录下的 node_modules 目录中。 -In the root directory of your project, run the following command to generate a fresh package.json file: +在项目的根目录中,运行以下命令以生成新的 package.json 文件: -It will ask you a number of questions. You can skip the questions r go with the defaults by pressing enter. +它会问您一些问题。您可以按 Enter 跳过或使用默认值。 ``` yarn init @@ -99,7 +99,7 @@ success Saved package.json Done in 82.42s. ``` -With this, you get a package.json file of this sort: +这样,您就得到了一个如下的 package.json 文件: ``` { @@ -112,17 +112,17 @@ With this, you get a package.json file of this sort: } ``` -Now that you have the package.json, you can either manually edit it to add or remove package dependencies or use Yarn commands (preferred). +现在您有了 package.json,您可以手动编辑它以添加或删除包依赖项,也可以使用 Yarn 命令(首选)。 -#### Adding dependencies with Yarn +#### 使用 Yarn 添加依赖项 -You can add a dependency on a certain package in the following fashion: +您可以通过以下方式添加对特定包的依赖关系: ``` yarn add ``` -For example, if you want to use [Lodash][8] in your project, you can add it using Yarn like this: +例如,如果您想在项目中使用 [Lodash][8],则可以使用 Yarn 添加它,如下所示: ``` yarn add lodash @@ -141,7 +141,7 @@ info All dependencies Done in 2.67s. ``` -And you can see that this dependency has been added automatically in the package.json file: +您可以看到,此依赖项已自动添加到 package.json 文件中: ``` { @@ -157,89 +157,97 @@ And you can see that this dependency has been added automatically in the package } ``` -By default, Yarn will add the latest version of a package in the dependency. If you want to use a specific version, you may specify it while adding. +默认情况下,Yarn 将在依赖项中添加最新版本的包。如果要使用特定版本,可以在添加时指定。 -As always, you can also update the package.json file manually. +``` +yarn add package@version-or-tag +``` -#### Upgrading dependencies with Yarn +像往常一样,您也可以手动更新 package.json 文件。 -You can upgrade a particular dependency to its latest version with the following command: +#### 使用 Yarn 升级依赖项 + +您可以使用以下命令将特定依赖项升级到其最新版本: ``` yarn upgrade ``` -It will see if the package in question has a newer version and will update it accordingly. +它将查看所​​涉及的包是否具有较新的版本,并且会相应地对其进行更新。 -You can also change the version of an already added dependency in the following manner: +您还可以通过以下方式更改已添加的依赖项的版本: -You can also upgrade all the dependencies of your project to their latest version with one single command: +``` +yarn upgrade package_name@version_or_tag +``` + +您还可以使用一个命令将项目的所有依赖项升级到它们的最新版本: ``` yarn upgrade ``` -It will check the versions of all the dependencies and will update them if there are any newer versions. +它将检查所有依赖项的版本,如果有任何较新的版本,则会更新它们。 -#### Removing dependencies with Yarn +#### 使用 Yarn 删除依赖项 -You can remove a package from the dependencies of your project in this way: +您可以通过以下方式从项目的依赖项中删除包: ``` yarn remove ``` -#### Install all project dependencies +#### 安装所有项目依赖项 -If you made any changes to the project.json file, you should run either +如果对您 project.json 文件进行了任何更改,则应该运行 ``` yarn ``` -or +或者 ``` yarn install ``` -to install all the dependencies at once. +一次安装所有依赖项。 -### How to remove Yarn from Ubuntu or Debian +### 如何从 Ubuntu 或 Debian 中删除 Yarn -I’ll complete this tutorial by mentioning the steps to remove Yarn from your system if you used the above steps to install it. If you ever realized that you don’t need Yarn anymore, you will be able to remove it. +我将通过介绍从系统中删除 Yarn 的步骤来完成本教程,如果您使用上述步骤安装 Yarn 的话。如果您意识到不再需要 Yarn 了,则可以将它删除。 -Use the following command to remove Yarn and its dependencies. +使用以下命令删除 Yarn 及其依赖项。 ``` sudo apt purge yarn ``` -You should also remove the Yarn repository from the repository list: +您也应该从源列表中把存储库信息一并删除掉: ``` sudo rm /etc/apt/sources.list.d/yarn.list ``` -The optional next step is to remove the GPG key you had added to the trusted keys. But for that, you need to know the key. You can get that using the apt-key command: - -Warning: apt-key output should not be parsed (stdout is not a terminal) pub rsa4096 2016-10-05 [SC] 72EC F46A 56B4 AD39 C907 BBB7 1646 B01B 86E5 0310 uid [ unknown] Yarn Packaging +下一步删除已添加到受信任密钥的 GPG 密钥是可选的。但要做到这一点,您需要知道密钥。您可以使用 `apt-key` 命令获得它: +``` Warning: apt-key output should not be parsed (stdout is not a terminal) pub rsa4096 2016-10-05 [SC] 72EC F46A 56B4 AD39 C907 BBB7 1646 B01B 86E5 0310 uid [ unknown] Yarn Packaging yarn@dan.cx sub rsa4096 2016-10-05 [E] sub rsa4096 2019-01-02 [S] [expires: 2020-02-02] +``` -The key here is the last 8 characters of the GPG key’s fingerprint in the line starting with pub. +这里的密钥是以 pub 开始的行中 GPG 密钥指纹的最后 8 个字符。 -So, in my case, the key is 86E50310 and I’ll remove it using this command: +因此,对于我来说,密钥是 `86E50310`,我将使用以下命令将其删除: ``` sudo apt-key del 86E50310 ``` -You’ll see an OK in the output and the GPG key of Yarn package will be removed from the list of GPG keys your system trusts. +您会在输出中看到 OK,并且 Yarn 包的 GPG 密钥将从系统信任的 GPG 密钥列表中删除。 -I hope this tutorial helped you to install Yarn on Ubuntu, Debian, Linux Mint, elementary OS etc. I provided some basic Yarn commands to get you started along with complete steps to remove Yarn from your system. +我希望本教程可以帮助您在 Ubuntu、Debian、Linux Mint、 elementary OS 等操作系统上安装 Yarn。 我提供了一些基本的 Yarn 命令,以帮助您入门,并完成了从系统中删除 Yarn 的完整步骤。 -I hope you liked this tutorial and if you have any questions or suggestions, please feel free to leave a comment below. +希望您喜欢本教程,如果有任何疑问或建议,请随时在下面留言。 -------------------------------------------------------------------------------- @@ -248,7 +256,7 @@ via: https://itsfoss.com/install-yarn-ubuntu 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[gxlct008](https://github.com/gxlct008) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 3e54fde7db4d03c62738d42519c366e659771833 Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Thu, 8 Oct 2020 11:54:01 +0800 Subject: [PATCH 0365/1156] =?UTF-8?q?=E5=B0=86=E8=AF=91=E6=96=87=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E5=88=B0=20translated/tech/=20=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...20190102 Using Yarn on Ubuntu and Other Linux Distributions.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md (100%) diff --git a/sources/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md b/translated/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md similarity index 100% rename from sources/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md rename to translated/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md From b13b1365fed4e50ce8798ecd80ccaa4d1b0a8f52 Mon Sep 17 00:00:00 2001 From: Hilton Chain <26847027+rakino@users.noreply.github.com> Date: Thu, 8 Oct 2020 15:57:02 +0800 Subject: [PATCH 0366/1156] translated --- ...rmation on your Linux devices with lshw.md | 57 ++++++++++--------- 1 file changed, 31 insertions(+), 26 deletions(-) rename {sources => translated}/tech/20200928 How to view information on your Linux devices with lshw.md (71%) diff --git a/sources/tech/20200928 How to view information on your Linux devices with lshw.md b/translated/tech/20200928 How to view information on your Linux devices with lshw.md similarity index 71% rename from sources/tech/20200928 How to view information on your Linux devices with lshw.md rename to translated/tech/20200928 How to view information on your Linux devices with lshw.md index 5f22c414a6..1d7ded31e5 100644 --- a/sources/tech/20200928 How to view information on your Linux devices with lshw.md +++ b/translated/tech/20200928 How to view information on your Linux devices with lshw.md @@ -7,16 +7,18 @@ [#]: via: (https://www.networkworld.com/article/3583598/how-to-view-information-on-your-linux-devices-with-lshw.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) -How to view information on your Linux devices with lshw +如何使用 lshw 查看 Linux 设备信息 ====== -The lshw (list hardware) command on Linux systems provides a lot more information on system devices than most of us might imagine is available. -Kali Linux / nevarpp / Getty Images +Linux 系统上的 lshw(列出硬件list hardware)命令提供的系统设备信息比我们大多数人想象的要多得多。 -While far from being one of the first 50 Linux commands anyone learns, the **lshw** command (read as “ls hardware”) can provide a lot of useful details on your system’s hardware. +![Kali Linux logo / gears / binary data][1] +(Kali Linux / nevarpp / Getty Images) -It extracts details—maybe quite a few more than you knew were available—in a format that is reasonably easy to digest. Given descriptions, logical (device) names, sizes, etc., you are likely to appreciate how much detail you can access. +虽然 **lshw** 命令(读作 “ls hardware”)远不是每个人最先学会的 50 个 Linux 命令之一,但它可以提供很多系统硬件的有用信息。 -This post examines the information that **lshw** provides with a particular focus on disk and related hardware. Here is some sample **lshw** output: +它以一种相当易于理解的格式提取出可能比你知道的更多的信息。在看到描述、(设备)逻辑名称、大小等以后,你可能会理解到自己能获得多少信息。 + +这篇文章会研究 **lshw** 给出的信息,但侧重于磁盘及相关硬件。下面是 **lshw** 的输出示例: ``` $ sudo lshw -C disk @@ -35,11 +37,11 @@ $ sudo lshw -C disk logical name: /dev/sdc ``` -Note that you should run the **lshw** command with **sudo** to ensure that you get all of the available details. +请注意,你需要使用 **sudo** 运行 **lshw** 命令以确保能得到所有可用的信息。 -While we asked for “disk” in the above command (the output included shows only the first of five entries displayed), this particular output shows not a hard disk, but a card reader—another member of the disk class. Note that the system knows this device as **/dev/sdc**. +虽然我们在上面的命令中要求了“磁盘(disk)”(上面只包含了原始输出里五个条目中的一个),这里的输出却不是一个硬盘,而是读卡器——磁盘的一种。注意系统将这个设备命名为了 **/dev/sdc**。 -Similar details are provided on the primary disk on the system: +系统的主磁盘上也有相似的信息: ``` *-disk @@ -47,7 +49,7 @@ Similar details are provided on the primary disk on the system: product: SSD2SC120G1CS175 physical id: 0 bus info: scsi@0:0.0.0 - logical name: /dev/sda <== + logical name: /dev/sda <==这里 version: 1101 serial: PNY20150000778410606 size: 111GiB (120GB) @@ -56,9 +58,9 @@ Similar details are provided on the primary disk on the system: f63b5929 ``` -This disk is **/dev/sda**. The hard disks on this system both show up as **ATA** disks. **ATA** is a disk-drive implementation that integrates the controller on the disk drive itself. +这块硬盘是 **/dev/sda**。这个系统上的硬盘都显示为 **ATA** 磁盘,**ATA** 是一种把控制器与盘体集成在一起的磁盘驱动器实现。 -To get an abbreviated list of devices in the “disk” class, you can run a command like this one. Notice that two of the devices are listed twice, so we are still seeing five disk devices. +要获得“磁盘”类设备的简略列表,可以运行下面这条命令。注意其中有两个设备被列出了两次,所以我们看到的仍然是五个磁盘设备。 ``` $ sudo lshw -short -C disk @@ -73,7 +75,7 @@ H/W path Device Class Description /0/100/1f.5/0.0.0 /dev/sdb disk 500GB SAMSUNG HE502HJ ``` -Hold onto your seat if you decide you want to see _**all**_ of the devices on a system. You will get a list that includes a lot more things than you probably normally think of as “devices”. Here’s an example—and this is the “short” (few details) list: +如果你决定要查看系统上的 _**所有**_ 设备,请坐稳了;你会得到一个包含的东西比你通常认为的“设备”要多得多的列表,下面是一个例子,这是一个“简短(short)”(信息很少)的列表: ``` $ sudo lshw -short @@ -152,7 +154,7 @@ H/W path Device Class Description /0/9 system PnP device PNP0c01 ``` -Run a command like this to list device classes and count how many devices are in each class. +运行下面的命令来列出设备类别,并统计每个类别中的设备数量。 ``` $ sudo lshw -short | awk ‘{print substr($0,36,13)}’ | tail -n +3 | sort | uniq -c @@ -172,16 +174,18 @@ $ sudo lshw -short | awk ‘{print substr($0,36,13)}’ | tail -n +3 | sort | un 2 volume ``` -**NOTE:** The **awk** command selects the Class column from the **lshw** output using $0 (complete lines), but taking only the substrings that start in the correct place (column 36). None of the class entries have more than 13 letters so the substring ends there. The **tail -n +3** part of the command drops the heading and the “=====” line beneath it, so only the 14 device classes are included in the final listing. +**注意:** 上面使用 **awk** 命令从 **lshw** 的输出中选择 Class(类别)栏是这样实现的:使用 $0(选取完整行),但只取从正确位置(第 36 个字符)开始的子串,而因为“类别”中并没有条目的长度超过 13 个字符,所以子串就在那里结束。命令中 **tail -n +3** 的部分移除了标题和下面的“=====”,所以最终的列表中只包含了那 14 种设备类型。 -One thing you’ll notice is that we get approximately 12 lines of output for each device in the disk class when we don’t use the **-short** option. We see the logical names, such as **/dev/sda**, disk sizes and types, etc. +(译注:上面的命令中 awk 的部分在选取子串时是从第 36 个字符开始的,这个数字基本上取决于最长的设备逻辑名称的长度,因而在不同的系统环境中可能有所不同,一个例子是,当你的系统上有 NVMe SSD 时,可能需要将其改为 41。) + +你会发现在没有使用 **-short** 选项的时候,每一个磁盘类设备都会有大约 12 行的输出,包括像是 **/dev/sda** 这样的逻辑名称,磁盘大小和种类等等。 ``` $ sudo lshw -C disk [sudo] password for shs: *-disk:0 description: SCSI Disk - product: Card Reader-1  card reader? + product: Card Reader-1  读卡器? vendor: JIE LI physical id: 0.0.0 bus info: scsi@4:0.0.0 @@ -209,13 +213,13 @@ $ sudo lshw -C disk product: SSD2SC120G1CS175 physical id: 0 bus info: scsi@0:0.0.0 - logical name: /dev/sda  main system disk + logical name: /dev/sda  主要磁盘 version: 1101 serial: PNY20150000778410606 size: 111GiB (120GB) capabilities: partitioned partitioned:dos configuration: ansiversion=5 logicalsectorsize=512 sectorsize=512 signature=f63b5929 - *-cdrom  aka /dev/sr0 + *-cdrom  也叫 /dev/sr0 description: DVD writer product: DVD+-RW GSA-H73N vendor: HL-DT-ST @@ -235,7 +239,7 @@ $ sudo lshw -C disk product: SAMSUNG HE502HJ physical id: 0.0.0 bus info: scsi@3:0.0.0 - logical name: /dev/sdb  secondary disk + logical name: /dev/sdb  次要磁盘 version: 0002 serial: S2B6J90B501053 size: 465GiB (500GB) @@ -243,11 +247,11 @@ $ sudo lshw -C disk configuration: ansiversion=5 logicalsectorsize=512 sectorsize=512 signature=7e67ccf3 ``` -### Wrap-up +### 总结 -The **lshw** command provides details that many of us won’t normally deal with. Still, it’s nice to know how much information is available even if you only use a portion of it. +**lshw** 命令提供了一些我们许多人通常不会处理的信息,不过即使你只用了其中的一部分,知道有多少信息可用还是很不错的。 -Join the Network World communities on [Facebook][1] and [LinkedIn][2] to comment on topics that are top of mind. +加入 [Facebook][2] 和 [领英][3] 上的 Network World 社区,对最热门的话题发表评论。 -------------------------------------------------------------------------------- @@ -255,12 +259,13 @@ via: https://www.networkworld.com/article/3583598/how-to-view-information-on-you 作者:[Sandra Henry-Stocker][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[rakino](https://github.com/rakino) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ [b]: https://github.com/lujun9972 -[1]: https://www.facebook.com/NetworkWorld/ -[2]: https://www.linkedin.com/company/network-world +[1]: https://images.idgesg.net/images/article/2020/02/kali_linux_tools_abstract_gears_binary_data_by_nevarpp_gettyimages-688718788_2400x1600-100832674-large.jpg +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world From b850e9d618a83f8556d06caaf2620c3ede273335 Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Thu, 8 Oct 2020 16:25:56 +0800 Subject: [PATCH 0367/1156] =?UTF-8?q?=E7=94=B3=E9=A2=86=E5=8E=9F=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20180414 Go on very small hardware Part 2.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sources/tech/20180414 Go on very small hardware Part 2.md b/sources/tech/20180414 Go on very small hardware Part 2.md index 8ebfb263f1..38344cf427 100644 --- a/sources/tech/20180414 Go on very small hardware Part 2.md +++ b/sources/tech/20180414 Go on very small hardware Part 2.md @@ -1,3 +1,12 @@ +[#]: collector: (oska874) +[#]: translator: (gxlct008) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Go on very small hardware (Part 2)) +[#]: via: (https://ziutek.github.io/2018/04/14/go_on_very_small_hardware2.html) +[#]: author: (Michał Derkacz https://ziutek.github.io/) + Go on very small hardware (Part 2) ============================================================ From 9addc582508b0b843a139cbdc48c92d6e01828ab Mon Sep 17 00:00:00 2001 From: zouchong Date: Thu, 8 Oct 2020 17:30:19 +0800 Subject: [PATCH 0368/1156] hankchow translated --- ...200629 Using Bash traps in your scripts.md | 44 +++++++++---------- 1 file changed, 21 insertions(+), 23 deletions(-) rename {sources => translated}/tech/20200629 Using Bash traps in your scripts.md (50%) diff --git a/sources/tech/20200629 Using Bash traps in your scripts.md b/translated/tech/20200629 Using Bash traps in your scripts.md similarity index 50% rename from sources/tech/20200629 Using Bash traps in your scripts.md rename to translated/tech/20200629 Using Bash traps in your scripts.md index 480fef9aa3..eb41ff7d1a 100644 --- a/sources/tech/20200629 Using Bash traps in your scripts.md +++ b/translated/tech/20200629 Using Bash traps in your scripts.md @@ -7,17 +7,17 @@ [#]: via: (https://opensource.com/article/20/6/bash-trap) [#]: author: (Seth Kenlon https://opensource.com/users/seth) -Using Bash traps in your scripts +在脚本中使用 Bash 信号捕获 ====== -Traps help your scripts end cleanly, whether they run successfully or -not. +> 无论你的脚本是否成功运行,信号捕获trap都能让它平稳结束。 + ![Hands programming][1] -It's easy to detect when a shell script starts, but it's not always easy to know when it stops. A script might end normally, just as its author intends it to end, but it could also fail due to an unexpected fatal error. Sometimes it's beneficial to preserve the remnants of whatever was in progress when a script failed, and other times it's inconvenient. Either way, detecting the end of a script and reacting to it in some pre-calculated manner is why the [Bash][2] `trap` directive exists. +Shell 脚本的启动并不难被检测到,但 Shell 脚本的终止检测却并不容易,因为我们无法确定脚本会按照预期地正常结束,还是由于意外的错误导致失败。当脚本执行失败时,将正在处理的内容记录下来是非常有用的做法,但有时候这样做起来并不方便。而 [Bash][2] 中 `trap` 命令的存在正是为了解决这个问题,它可以捕获到脚本的终止信号,并以某种预设的方式作出应对。 -### Responding to failure +### 响应失败 -Here's an example of how one failure in a script can lead to future failures. Say you have written a program that creates a temporary directory in `/tmp` so that it can unarchive and process files before bundling them back together in a different format: +如果出现了一个错误,可能导致发生一连串错误。下面示例脚本中,首先在 `/tmp` 中创建一个临时目录,这样可以在临时目录中执行解包、文件处理等操作,然后再以另一种压缩格式进行打包: ``` @@ -49,13 +49,13 @@ bzip2 --compress $TMP/"${1%.*}".tar \ /usr/bin/rm -r /tmp/tmpdir ``` -Most of the time, the script works as expected. However, if you accidentally run it on an archive filled with PNG files instead of the expected JPEG files, it fails halfway through. One failure leads to another, and eventually, the script exits without reaching its final directive to remove the temporary directory. As long as you manually remove the directory, you can recover quickly, but if you aren't around to do that, then the next time the script runs, it has to deal with an existing temporary directory full of unpredictable leftover files. +一般情况下,这个脚本都可以按照预期执行。但如果归档文件中的文件是 PNG 文件而不是期望的 JPEG 文件,脚本就会在中途失败,这时候另一个问题就出现了:最后一步删除临时目录的操作没有被正常执行。如果你手动把临时目录删掉,倒是不会造成什么影响,但是如果没有手动把临时目录删掉,在下一次执行这个脚本的时候,就会在一个残留着很多临时文件的临时目录里执行了。 -One way to combat this is to reverse and double-up on the logic by adding a precautionary removal to the start of the script. While valid, that relies on brute force instead of structure. A more elegant solution is `trap`. +其中一个解决方案是在脚本开头增加一个预防性删除逻辑用来处理这种情况。但这种做法显得有些暴力,而我们更应该从结构上解决这个问题。使用 `trap` 是一个优雅的方法。 -### Catching signals with trap +### 使用 `trap` 捕获信号 -The `trap` keyword catches _signals_ that may happen during execution. You've used one of these signals if you've ever used the `kill` or `killall` commands, which call `SIGTERM` by default. There are many other signals that shells respond to, and you can see most of them with `trap -l` (as in "list"): +我们可以通过 `trap` 捕捉程序运行时的信号。如果你使用过 `kill` 或者 `killall` 命令,那你就已经使用过名为 `SIGTERM` 的信号了。除此以外,还可以执行 `trap -l` 或 `trap --list` 命令列出其它更多的信号: ``` @@ -75,24 +75,22 @@ $ trap --list 63) SIGRTMAX-1  64) SIGRTMAX ``` -Any of these signals may be anticipated with `trap`. In addition to these, `trap` recognizes: +可以被 `trap` 识别的信号除了以上这些,还包括: - * `EXIT`: Occurs when a process exits - * `ERR`: Occurs when a process exits with a non-zero status - * `DEBUG`: A Boolean representing debug mode + * `EXIT`:进程退出时发出的信号 + * `ERR`:进程以非 0 状态码退出时发出的信号 + * `DEBUG`:表示调试模式的布尔值 +如果要在 Bash 中实现信号捕获,只需要在 `trap` 后加上需要执行的命令,再加上需要捕获的信号列表就可以了。 - -To set a trap in Bash, use `trap` followed by a list of commands you want to be executed, followed by a list of signals to trigger it. - -For instance, this trap detects a `SIGINT`, the signal sent when a user presses **Ctrl+C** while a process is running: +例如,下面的这行语句可以捕获到在进程运行时用户按下 `Ctrl + C` 组合键发出的 `SIGINT` 信号: ``` `trap "{ echo 'Terminated with Ctrl+C'; }" SIGINT` ``` -The example script with temporary directory problems can be fixed with a trap detecting `SIGINT`, errors, and successful exits: +因此,上文中脚本的缺陷可以通过使用 `trap` 捕获 `SIGINT`、`SIGTERM`、进程错误退出、进程正常退出等信号,并正确处理临时目录的方式来修复: ``` @@ -123,11 +121,11 @@ bzip2 --compress $TMP/"${1%.*}".tar \       --stdout > "${1%.*}".tbz ``` -For complex actions, you can simplify `trap` statements with [Bash functions][3]. +对于更复杂的功能,还可以用 [Bash 函数][3]来简化 `trap` 语句。 -### Traps in Bash +### Bash 中的信号捕获 -Traps are useful to ensure that your scripts end cleanly, whether they run successfully or not. It's never safe to rely completely on automated garbage collection, so this is a good habit to get into in general. Try using them in your scripts, and see what they can do! +信号捕获可以让脚本在无论是否成功执行所有任务的情况下都能够正确完成清理工作,能让你的脚本更加可靠,这是一个很好的习惯。尽管尝试把信号捕获加入到你的脚本里看看能够起到什么作用吧。 -------------------------------------------------------------------------------- @@ -135,7 +133,7 @@ via: https://opensource.com/article/20/6/bash-trap 作者:[Seth Kenlon][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[HankChow](https://github.com/HankChow) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 82258a7245d938cf34a4cc9d3a39db4371fb8040 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 8 Oct 2020 21:27:42 +0800 Subject: [PATCH 0369/1156] PRF PART 1 --- ...TCP window scaling, timestamps and SACK.md | 63 ++++++++++--------- 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/translated/tech/20200811 TCP window scaling, timestamps and SACK.md b/translated/tech/20200811 TCP window scaling, timestamps and SACK.md index 03613c1f61..7bfd8116ab 100644 --- a/translated/tech/20200811 TCP window scaling, timestamps and SACK.md +++ b/translated/tech/20200811 TCP window scaling, timestamps and SACK.md @@ -1,49 +1,54 @@ [#]: collector: (lujun9972) [#]: translator: (gxlct008) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (TCP window scaling, timestamps and SACK) [#]: via: (https://fedoramagazine.org/tcp-window-scaling-timestamps-and-sack/) [#]: author: (Florian Westphal https://fedoramagazine.org/author/strlen/) -TCP 窗口缩放,时间戳和 SACK +TCP 窗口缩放、时间戳和 SACK ====== ![][1] -Linux TCP 协议栈具有无数个 _sysctl_ 旋钮,允许更改其行为。 这包括可用于接收或发送操作的内存量,套接字的最大数量、可选特性和协议扩展。 +Linux TCP 协议栈具有无数个 `sysctl` 旋钮,允许更改其行为。 这包括可用于接收或发送操作的内存量,套接字的最大数量、可选的特性和协议扩展。 -有很多文章出于各种“性能调优”或“安全性”原因,建议禁用 TCP 扩展,比如时间戳或选择性确认selective acknowledgments (SACK)。 +有很多文章出于各种“性能调优”或“安全性”原因,建议禁用 TCP 扩展,比如时间戳或选择性确认selective acknowledgments(SACK)。 -本文提供了这些扩展的功能背景,默认情况下处于启用状态的原因,它们之间是如何关联的,以及为什么通常情况下将它们关闭是个坏主意。 +本文提供了这些扩展的功能背景,为什么会默认启用,它们之间是如何关联的,以及为什么通常情况下将它们关闭是个坏主意。 ### TCP 窗口缩放 -TCP 可以维持的数据传输速率受到几个因素的限制。其中包括: +TCP 可以承受的数据传输速率受到几个因素的限制。其中包括: -* 往返时间(RTT)。这是数据包到达目的地并返回回复所花费的时间。越低越好。 -* 所涉及的网络路径的最低链路速度 -* 丢包频率 -* 新数据可用于传输的速度。 例如,CPU 需要能够以足够快的速度将数据传递到网络适配器。如果 CPU 需要首先加密数据,则适配器可能必须等待新数据。同样地,如果磁盘存储不能足够快地读取数据,则磁盘存储可能会成为瓶颈。 -* TCP 接收窗口的最大可能大小。接收窗口决定 TCP 在必须等待接收方报告接收到该数据之前可以传输多少数据 (以字节为单位)。这是由接收方宣布的。接收方将在读取并确认接收到传入数据时不断更新此值。接收窗口当前值包含在 [TCP 报头][2] 中,它是 TCP 发送的每个数据段的一部分。因此,只要发送方接收到来自对等方的确认,它就知道当前的接收窗口。这意味着往返时间(RTT)越长,发送方获得接收窗口更新所需的时间就越长。 +* 往返时间(RTT)。 + 这是数据包到达目的地并返回回复所花费的时间。越低越好。 +* 所涉及的网络路径的最低链路速度。 +* 丢包频率。 +* 新数据可用于传输的速度。 + + 例如,CPU 需要能够以足够快的速度将数据传递到网络适配器。如果 CPU 需要首先加密数据,则适配器可能必须等待新数据。同样地,如果磁盘存储不能足够快地读取数据,则磁盘存储可能会成为瓶颈。 +* TCP 接收窗口的最大可能大小。 + + 接收窗口决定 TCP 在必须等待接收方报告接收到该数据之前可以传输多少数据(以字节为单位)。这是由接收方宣布的。接收方将在读取并确认接收到传入数据时不断更新此值。接收窗口当前值包含在 [TCP 报头][2] 中,它是 TCP 发送的每个数据段的一部分。因此,只要发送方接收到来自对等方的确认,它就知道当前的接收窗口。这意味着往返时间(RTT)越长,发送方获得接收窗口更新所需的时间就越长。 TCP 被限制为最多 64KB 的未确认(正在传输)数据。在大多数网络场景中,这甚至还不足以维持一个像样的数据速率。让我们看看一些例子。 -##### 理论数据速率 +#### 理论数据速率 -由于往返时间 (RTT) 为 100 毫秒,TCP 每秒最多可以传输 640KB。在延迟 1 秒的情况下,最大理论数据速率降至 64KB/s。 +在往返时间(RTT)为 100 毫秒的情况下,TCP 每秒最多可以传输 640KB。在延迟为 1 秒的情况下,最大理论数据速率降至 64KB/s。 这是因为接收窗口的原因。一旦发送了 64KB 的数据,接收窗口就已经满了。发送方必须等待,直到对等方通知它应用程序已经读取了至少一部分数据。 发送的第一个段会把 TCP 窗口缩减一个自身的大小。在接收窗口值的更新可用之前,需要往返一次。当更新以 1 秒的延迟到达时,即使链路有足够的可用带宽,也会导致 64KB 的限制。 -为了充分利用一个具有几毫秒延迟的快速网络,必须有一个比传统 TCP 支持的窗口大的窗口。“64KB 限制”是协议规范的产物:TCP 头只为接收窗口大小保留 16 位。这允许接收窗口高达 64KB。在 TCP 协议最初设计时,这个大小并没有被视为一个限制。 +为了充分利用一个具有几毫秒延迟的快速网络,必须有一个比传统 TCP 支持的窗口更大的窗口。“64KB 限制”是协议规范的产物:TCP 头只为接收窗口大小保留 16 位。这允许接收窗口高达 64KB。在 TCP 协议最初设计时,这个大小并没有被视为一个限制。 -不幸的是,想通过仅仅更改 TCP 头来支持更大的最大窗口值是不可能的。如果这样做就意味着 TCP 的所有实现都必须同时更新,否则它们将无法相互理解。为了解决这个问题,需要改变接收窗口值的解释。 +不幸的是,想通过仅仅更改 TCP 头来支持更大的最大窗口值是不可能的。如果这样做就意味着 TCP 的所有实现都必须同时更新,否则它们将无法相互理解。为了解决这个问题,我们改变了对接收窗口值的解释。 -“窗口缩放选项”允许这样做,同时保持与现有实现的兼容性。 +“窗口缩放选项”允许你改变这个解释,同时保持与现有实现的兼容性。 #### TCP 选项:向后兼容的协议扩展 @@ -64,44 +69,44 @@ TCP 响应程序检查连接请求中包含的所有选项号。 如果它遇到          1         1         1 ``` -[窗口缩放][3] 选项告诉对等点,应该使用给定的数字缩放 TCP 标头中的接收窗口值,以获取实际大小。 +[窗口缩放][3] 选项告诉对等方,应该使用给定的数字缩放 TCP 标头中的接收窗口值,以获取实际大小。 例如,一个宣告窗口缩放比例因子为 7 的 TCP 启动器试图指示响应程序,任何将来携带接收窗口值为 512 的数据包实际上都会宣告 65536 字节的窗口。 增加了 128 倍。这将允许最大为 8MB 的 TCP 窗口。 不能理解此选项的 TCP 响应程序将会忽略它。 为响应连接请求而发送的 TCP 数据包(SYN-ACK)不包含窗口缩放选项。在这种情况下,双方只能使用 64k 的窗口大小。幸运的是,默认情况下,几乎每个 TCP 堆栈都支持并启用此选项,包括 Linux。 -响应程序包括它自己所需的比例因子。两个对等点可以使用不同的号码。宣布比例因子为 0 也是合法的。这意味着对等点应该逐字处理它接收到的接收窗口值,但它允许应答方向上的缩放值,然后接收方可以使用更大的接收窗口。 +响应程序包括它自己所需的比例因子。两个对等方可以使用不同的号码。宣布比例因子为 0 也是合法的。这意味着对等点应该逐字处理它接收到的接收窗口值,但它允许应答方向上的缩放值,然后接收方可以使用更大的接收窗口。 与 SACK 或 TCP 时间戳不同,窗口缩放选项仅出现在 TCP 连接的前两个数据包中,之后无法更改。也不可能通过查看不包含初始连接三次握手的连接的数据包捕获来确定比例因子。 支持的最大比例因子为 14。这将允许 TCP 窗口的大小高达 1GB。 -##### 窗口缩放的缺点 +#### 窗口缩放的缺点 -在非常特殊的情况下,它可能导致数据损坏。 在禁用该选项之前——通常情况下是不可能的。 还有一种解决方案可以防止这种情况。不幸的是,有些人在没有意识到与窗口缩放的关系的情况下禁用了该解决方案。 首先,让我们看一下需要解决的实际问题。 想象以下事件序列: +在非常特殊的情况下,它可能导致数据损坏。但在你禁用该选项之前,要知道通常情况下是不可能损坏的。 还有一种解决方案可以防止这种情况。不幸的是,有些人在没有意识到与窗口缩放的关系的情况下禁用了该解决方案。 首先,让我们看一下需要解决的实际问题。 想象以下事件序列: - 1. 发送方发送段:s_1,s_2,s_3,... s_n - 2. 接收方看到:s_1,s_3,.. s_n,并发送对 s_1 的确认。 + 1. 发送方发送段:s_1、s_2、s_3、... s_n + 2. 接收方看到:s_1、s_3、... s_n,并发送对 s_1 的确认。 3. 发送方认为 s_2 丢失,然后再次发送。 它还发送段 s_n+1 中包含的新数据。 - 4. 接收方然后看到:s_2,s_n+1,s_2:数据包 s_2 被接收两次。 + 4. 接收方然后看到:s_2、s_n+1,s_2:数据包 s_2 被接收两次。 -例如,当发送方过早触发重新传输时,可能会发生这种情况。 在正常情况下,即使使用窗口缩放,这种错误的重传也绝不会成为问题。 接收方将只丢弃重复项。 +当发送方过早触发重新传输时,可能会发生这种情况。 在正常情况下,即使使用窗口缩放,这种错误的重传也绝不会成为问题。 接收方将只丢弃重复项。 #### 从旧数据到新数据 TCP 序列号最多可以为 4GB。如果它变得大于此值,则序列会回绕到 0,然后再次增加。这本身不是问题,但是如果这种问题发生得足够快,则上述情况可能会造成歧义。 -如果在正确的时刻发生回绕,则序列号 s_2(重新发送的数据包)可能已经大于 s_n+1。 因此,在最后的步骤(4)中,接收器可以将其解释为:s_2,s_n+1,s_n+m,即它可以将 **“旧”** 数据包 s_2 视为包含新数据。 +如果在正确的时刻发生回绕,则序列号 s_2(重新发送的数据包)可能已经大于 s_n+1。 因此,在最后的步骤(4)中,接收器可以将其解释为:s_2、s_n+1、s_n+m,即它可以将 **“旧”** 数据包 s_2 视为包含新数据。 -通常,这不会发生,因为即使在高带宽链接上,“回绕”也只会每隔几秒钟或几分钟发生一次。原始和不需要的重传之间的间隔将小得多。 +通常,这不会发生,因为即使在高带宽链接上,“回绕”也只会每隔几秒钟或几分钟发生一次。原始数据包和不需要的重传的数据包之间的间隔将小得多。 -例如,对于 50MB/s 的传输速度,副本要延迟到一分钟以上才会成为问题。序列号的包装速度不够快,小的延迟才会导致这个问题。 +例如,对于 50MB/s 的传输速度,重复副本要延迟到一分钟以上才会成为问题。序列号的回绕速度没有快到让小的延迟会导致这个问题。 -一旦 TCP 达到 “GB/s” 的吞吐率,序列号的包装速度就会非常快,以至于即使只有几毫秒的延迟也可能会造成 TCP 无法再检测到的重复项。通过解决接收窗口太小的问题,TCP 现在可以用于以前无法实现的网络速度,这会产生一个新的,尽管很少见的问题。为了在 RTT 非常低的环境中安全使用 GB/s 的速度,接收方必须能够检测到这些旧副本,而不必仅依赖序列号。 +一旦 TCP 达到 “GB/s” 的吞吐率,序列号的回绕速度就会非常快,以至于即使只有几毫秒的延迟也可能会造成 TCP 无法再检测到的重复副本。通过解决接收窗口太小的问题,TCP 现在可以用于以前无法实现的网络速度,这会产生一个新的,尽管很少见的问题。为了在 RTT 非常低的环境中安全使用 GB/s 的速度,接收方必须能够检测到这些旧副本,而不必仅依赖序列号。 ### TCP 时间戳 -#### 最佳使用日期。 +#### 最佳使用日期 用最简单的术语来说,[TCP 时间戳][3]只是在数据包上添加时间戳,以解决由非常快速的序列号回绕引起的歧义。 如果一个段看起来包含新数据,但其时间戳早于最后一个在窗口内的数据包,则该序列号已被重新包装,而“新”数据包实际上是一个较旧的副本。 这解决了即使在极端情况下重传的歧义。 From 7c0f7d2b9fed16cfb378e0963ac8e1fd5683034a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 8 Oct 2020 21:55:05 +0800 Subject: [PATCH 0370/1156] PRF @rakino --- ...20200928 Create template files in GNOME.md | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/translated/tech/20200928 Create template files in GNOME.md b/translated/tech/20200928 Create template files in GNOME.md index 94654089f2..1230dcb948 100644 --- a/translated/tech/20200928 Create template files in GNOME.md +++ b/translated/tech/20200928 Create template files in GNOME.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (rakino) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Create template files in GNOME) @@ -10,27 +10,23 @@ 在 GNOME 中创建文档模板 ====== -![Digital images of a computer desktop][1] +> 制作模板可以让你更快地开始写作新的文档。 -制作模板可以让你更快地开始写作新的文档。 +![](https://img.linux.net.cn/data/attachment/album/202010/08/215333mgqpiuqufhgidfpz.jpg) -我偶然发现了 [GNOME][2] 的一个新功能(对我来说是的):创建文档模版。模版(template)也被称作样版文件(boilerplate),一般是有着特定格式的空文档,例如律师事务所的信笺,在其顶部有着律所的名称和地址;另一个例子是银行以及保险公司的保函,在其底部页脚包含着某些免责声明。由于这类信息很少改变,你可以把它们添加到空文档中作为模板使用。 +我只是偶然发现了 [GNOME][2] 的一个新功能(对我来说是的):创建文档模版。模版template也被称作样版文件boilerplate,一般是有着特定格式的空文档,例如律师事务所的信笺,在其顶部有着律所的名称和地址;另一个例子是银行以及保险公司的保函,在其底部页脚包含着某些免责声明。由于这类信息很少改变,你可以把它们添加到空文档中作为模板使用。 -一天,在浏览我的 Linux 系统文件的时候,我点击了**模板**(Templates)文件夹,然后刚好发现窗口的上方有一条消息写着:“将文件放入此文件夹并用作新文档的模板”,以及一个**获取详情……** 的链接,指向了 [GNOME 指南(GNOME help)][3]中的模板页面。 +一天,在浏览我的 Linux 系统文件的时候,我点击了模板Templates文件夹,然后刚好发现窗口的上方有一条消息写着:“将文件放入此文件夹并用作新文档的模板”,以及一个“获取详情……” 的链接,打开了模板的 [GNOME 帮助页面][3]。 ![Message at top of Templates folder in GNOME Desktop][4] -(Alan Formy-Duval, [CC BY-SA 4.0][5]) - ### 创建模板 -在 GNOME 中创建模板非常简单。有几种方法可以把文件放进模板文件夹里:你既可以通过图形用户界面(GUI)或是命令行界面(CLI)从另一个位置复制或移动文件,也可以创建一个全新的文件;我选择了后者,实际上我也创建了两个文件。 +在 GNOME 中创建模板非常简单。有几种方法可以把文件放进模板文件夹里:你既可以通过图形用户界面(GUI)或是命令行界面(CLI)从另一个位置复制或移动文件,也可以创建一个全新的文件;我选择了后者,实际上,我创建了两个文件。 ![My first two GNOME templates][6] -(Alan Formy-Duval, [CC BY-SA 4.0][5]) - -我的第一份模板是为 Opensource.com 的文章准备的,它有一个输入标题的位置以及关于我的名字和文章使用的许可证的几行。我的文章使用 Markdown 格式,所以我将模板创建为了一个新的 Markdown 文档——**Opensource.com Article.md**: +我的第一份模板是为 Opensource.com 的文章准备的,它有一个输入标题的位置以及关于我的名字和文章使用的许可证的几行。我的文章使用 Markdown 格式,所以我将模板创建为了一个新的 Markdown 文档——`Opensource.com Article.md`: ```` # Title     @@ -46,12 +42,10 @@ Creative Commons BY-SA 4.0 ### 使用模板 -每当我有了新文章的灵感的时候,我只需要在我计划用来组织内容的文件夹里单击右键,然后从**新建文档**(New Document)列表中选择我想要的模板就可以开始了。 +每当我有了新文章的灵感的时候,我只需要在我计划用来组织内容的文件夹里单击右键,然后从新建文档New Document列表中选择我想要的模板就可以开始了。 ![Select the template by name][7] -(Alan Formy-Duval, [CC BY-SA 4.0][5]) - 你可以为各种文档或文件制作模板。我写这篇文章时使用了我为 Opensource.com 的文章创建的模板。程序员可能会把模板用于软件代码,这样的话也许你想要只包含 `main()` 的模板。 GNOME 桌面环境为 Linux 及相关操作系统的用户提供了一个非常实用、功能丰富的界面。你最喜欢的 GNOME 功能是什么,你又是怎样使用它们的呢?请在评论中分享~ @@ -63,7 +57,7 @@ via: https://opensource.com/article/20/9/gnome-templates 作者:[Alan Formy-Duval][a] 选题:[lujun9972][b] 译者:[rakino](https://github.com/rakino) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 7574ee72bb015422f6994e6a9b836d43c003e0e0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 8 Oct 2020 21:55:44 +0800 Subject: [PATCH 0371/1156] PUB @rakino https://linux.cn/article-12699-1.html --- .../20200928 Create template files in GNOME.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200928 Create template files in GNOME.md (98%) diff --git a/translated/tech/20200928 Create template files in GNOME.md b/published/20200928 Create template files in GNOME.md similarity index 98% rename from translated/tech/20200928 Create template files in GNOME.md rename to published/20200928 Create template files in GNOME.md index 1230dcb948..932b6d352c 100644 --- a/translated/tech/20200928 Create template files in GNOME.md +++ b/published/20200928 Create template files in GNOME.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (rakino) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12699-1.html) [#]: subject: (Create template files in GNOME) [#]: via: (https://opensource.com/article/20/9/gnome-templates) [#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) From 5c5920aa91c3f7b06ec5efc45acee9e292ccd713 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Thu, 8 Oct 2020 23:41:35 +0800 Subject: [PATCH 0372/1156] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...08 How to install software with Ansible.md | 229 ------------------ ...08 How to install software with Ansible.md | 205 ++++++++++++++++ 2 files changed, 205 insertions(+), 229 deletions(-) delete mode 100644 sources/tech/20200908 How to install software with Ansible.md create mode 100644 translated/tech/20200908 How to install software with Ansible.md diff --git a/sources/tech/20200908 How to install software with Ansible.md b/sources/tech/20200908 How to install software with Ansible.md deleted file mode 100644 index c6a48fd6a2..0000000000 --- a/sources/tech/20200908 How to install software with Ansible.md +++ /dev/null @@ -1,229 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to install software with Ansible) -[#]: via: (https://opensource.com/article/20/9/install-packages-ansible) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -How to install software with Ansible -====== -Automate software installations and updates across your devices with -Ansible playbooks. -![Puzzle pieces coming together to form a computer screen][1] - -Ansible is a popular automation tool used by sysadmins and developers to keep their computer systems in prime condition. As is often the case with extensible frameworks, [Ansible][2] has limited use on its own, with its real power dwelling in its many modules. Ansible modules are, in a way, what commands are to a [Linux][3] computer. They provide solutions to specific problems, and one common task when maintaining computers is keeping all the ones you use updated and consistent. - -I used to use a text list of packages to keep my systems more or less synchronized: I'd list the packages installed on my laptop and then cross-reference that with my desktop, or between one server and another server, making up for any difference manually. Of course, installing and maintaining applications on a Linux machine is a basic task for Ansible, and it means you can list what you want across all computers under your care. - -### Finding the right Ansible module - -The number of Ansible modules can be overwhelming. How do you find the one you need for a given task? In Linux, you might look in your Applications menu or in `/usr/bin` to discover new applications to run. When you're using Ansible, you refer to the [Ansible module index][4]. - -The index is listed primarily by category. With a little searching, you're very likely to find a module for whatever you need. For package management, the [Packaging modules][5] section contains a module for nearly any system with a package manager. - -### Writing an Ansible playbook - -To begin, choose the package manager on your local computer. For instance, if you're going to write your Ansible instructions (a "playbook," as it's called in Ansible) on a laptop running Fedora, start with the `dnf` module. If you're writing on Elementary OS, use the `apt` module, and so on. This gets you started with something you can test and verify as you go, and you can expand your work for your other computers later. - -The first step is to create a directory representing your playbook. This isn't strictly necessary, but it's a good idea to establish the habit. Ansible can run with just a configuration file written in YAML, but if you want to expand your playbook later, you can control Ansible by how you lay out your directories and files. For now, just create a directory called `install_packages` or similar: - - -``` -`$ mkdir ~/install_packages` -``` - -The file that serves as the Ansible playbook can be named anything you like, but it's traditional to name it `site.yml`: - - -``` -`$ touch ~/install_packages/site.yml` -``` - -Open `site.yml` in your favorite text editor, and add this: - - -``` -\--- -\- hosts: localhost -  tasks: -    - name: install packages -      become: true -      become_user: root -      dnf: -        state: present -        name: -         - tcsh -         - htop -``` - -You must adjust the module name you use to match the distribution you're using. In this example, I used `dnf` because I wrote the playbook on Fedora Linux. - -Like with a command in a Linux terminal, knowing _how_ to invoke an Ansible module is half the battle. This playbook example follows the standard playbook format: - - * `hosts` targets a computer or computers. In this case, the computer being targeted is `localhost`, which is the computer you're using right now (as opposed to a remote system you want Ansible to connect with). - * `tasks` opens a list of tasks you want to be performed on the hosts. - * `name` is a human-friendly title for a task. In this case, I'm using `install packages` because that's what this task is doing. - * `become` permits Ansible to change which user is running this task. - * `become_user` permits Ansible to become the `root` user to run this task. This is necessary because only the root user can install new applications using `dnf`. - * `dnf` is the name of the module, which you discovered from the module index on the Ansible website. - - - -The items under the `dnf` item are specific to the `dnf` module. This is where the module documentation is essential. Like a man page for a Linux command, the module documentation tells you what options are available and what kinds of arguments are required. - -![Ansible documentation][6] - -Ansible module documentation (Seth Kenlon, [CC BY-SA 4.0][7]) - -Package installation is a relatively simple task and only requires two elements. The `state` option instructs Ansible to check whether or not _some package_ is present on the system, and the `name` option lists which packages to look for. Ansible deals in machine _state_, so module instructions always imply change. Should Ansible scan a system and find a conflict between how a playbook describes a system (in this case, that the commands `tcsh` and `htop` are present) and what the system state actually is (in this example, `tcsh` and `htop` are not present), then Ansible's task is to make whatever changes are necessary for the system to match the playbook. Ansible can make those changes because of the `dnf` (or `apt` or whatever your package manager is) module. - -Each module is likely to have a different set of options, so when you're writing playbooks, anticipate referring to the module documentation often. Until you're very familiar with a module, it's the only reasonable way to expect a module to do what you need it to do. - -### Verifying YAML - -Playbooks are written in YAML. Because YAML adheres to a strict syntax, it's helpful to install the `yamllint` command to check (or "lint," in computer terminology) your work. Better still, there's a linter specific to Ansible called `ansible-lint` created specifically for playbooks. Install these before continuing. - -On Fedora or CentOS: - - -``` -`$ sudo dnf install yamllint python3-ansible-lint` -``` - -On Debian, Elementary, Ubuntu, or similar: - - -``` -`$ sudo apt install yamllint ansible-lint` -``` - -Verify your playbook with `ansible-lint`. If you don't have access to `ansible-lint`, you can use `yamllint`. - - -``` -`$ ansible-lint ~/install_packages/site.yml` -``` - -Success returns nothing, but if there are errors in your file, you must fix them before continuing. Common errors from copying and pasting include omitting a newline character at the end of the final line and using tabs instead of spaces for indentation. Fix them in a text editor, rerun the linter, and repeat this process until you get no feedback from `ansible-lint` or `yamllint`. - -### Installing an application with Ansible - -Now that you have a verifiably valid playbook, you can finally run it on your local machine. Because you happen to know that the task defined by the playbook requires root permissions, you must use the `--ask-become-pass` option when invoking Ansible, so you will be prompted for your administrative password. - -Start the installation: - - -``` -$ ansible-playbook --ask-become-pass ~/install_packages/site.yml -BECOME password: -PLAY [localhost] ****************************** - -TASK [Gathering Facts] ****************************** -ok: [localhost] - -TASK [install packages] ****************************** -ok: [localhost] - -PLAY RECAP ****************************** -localhost: ok=0 changed=2 unreachable=0 failed=0 [...] -``` - -The commands are installed, leaving the target system in an identical state to the one described by the playbook. - -### Installing an application on remote systems - -Going through all of that to replace one simple command would be counterproductive, but Ansible's advantage is that it can be automated across all of your systems. You can use conditional statements to cause Ansible to use a specific module on different systems, but for now, assume all your computers use the same package manager. - -To connect to a remote system, you must define the remote system in the `/etc/ansible/hosts` file. This file was installed along with Ansible, so it already exists, but it's probably empty, aside from explanatory comments. Use `sudo` to open the file in your favorite text editor. - -You can define a host by its IP address or hostname, as long as the hostname can be resolved. For instance, if you've already defined `liavara` in `/etc/hosts` and can successfully ping it, then you can set `liavara` as a host in `/etc/ansible/hosts`. Alternately, if you're running a domain name server or Avahi server and can ping `liavara`, then you can set it as a host in `/etc/ansible/hosts`. Otherwise, you must use its internet protocol address. - -You also must have set up a successful secure shell (SSH) connection to your target hosts. The easiest way to do that is with the `ssh-copy-id` command, but if you've never set up an SSH connection with a host before, [read my article on how to create an automated SSH connection][8]. - -Once you've entered the hostname or IP address in the `/etc/ansible/hosts` file, change the `hosts` definition in your playbook: - - -``` -\--- -\- hosts: all -  tasks: -    - name: install packages -      become: true -      become_user: root -      dnf: -        state: present -        name: -         - tcsh -         - htop -``` - -Run `ansible-playbook` again: - - -``` -`$ ansible-playbook --ask-become-pass ~/install_packages/site.yml` -``` - -This time, the playbook runs on your remote system. - -Should you add more hosts, there are many ways to filter which host performs which task. For instance, you can create groups of hosts (`webservers` for servers, `workstations` for desktop machines, and so on). - -### Ansible for mixed environments - -The logic used in the solution so far assumes that all hosts being configured by Ansible run the same OS (specifically, one that uses the **dnf** command for package management). So what do you do if you're managing hosts running a different distribution, such as Ubuntu (which uses **apt**) or Arch (using **pacman**), or even different operating systems? - -As long as the targeted OS has a package manager (and these days even [MacOS has Homebrew][9] and [Windows has Chocolatey][10]), Ansible can help. - -This is where Ansible's advantage becomes most apparent. In a shell script, you'd have to check for what package manager is available on the target host, and even with pure Python you'd have to check for the OS. Ansible not only has those checks built in, but it also has mechanisms to use the results in your playbook. Instead of using the **dnf** module, you can use the **action** keyword to perform tasks defined by variables provided by Ansible's fact gathering subsystem. - - -``` -\--- -\- hosts: all -  tasks: -    - name: install packages -      become: true -      become_user: root -      action: > -       {{ ansible_pkg_mgr }} name=htop,transmission state=present update_cache=yes -``` - -The **action** keyword loads action plugins. In this example, it's using the **ansible_pkg_mgr** variable, which is populated by Ansible during the initial **Gathering Facts** task. You don't have to tell Ansible to gather facts about the OS it's running on, so it's easy to overlook it, but when you run a playbook, you see it listed in the default output: - - -``` -TASK [Gathering Facts] ***************************************** -ok: [localhost] -``` - -The **action** plugin uses information from this probe to populate **ansible_pkg_mgr** with the relevant package manager command to install the packages listed after the **name** argument. With 8 lines of code, you can overcome a complex cross-platform quandary that few other scripting options allow. - -### Use Ansible - -It's the 21st century, and we all expect our computing devices to be connected and relatively consistent. Whether you maintain two or 200 computers, you shouldn't have to perform the same maintenance tasks over and over again. Use Ansible to synchronize the computers in your life, then see what else Ansible can do for you. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/9/install-packages-ansible - -作者:[Seth Kenlon][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://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/puzzle_computer_solve_fix_tool.png?itok=U0pH1uwj (Puzzle pieces coming together to form a computer screen) -[2]: https://opensource.com/resources/what-ansible -[3]: https://opensource.com/resources/linux -[4]: https://docs.ansible.com/ansible/latest/modules/modules_by_category.html -[5]: https://docs.ansible.com/ansible/latest/modules/list_of_packaging_modules.html -[6]: https://opensource.com/sites/default/files/uploads/ansible-module.png (Ansible documentation) -[7]: https://creativecommons.org/licenses/by-sa/4.0/ -[8]: https://opensource.com/article/20/8/how-ssh -[9]: https://opensource.com/article/20/6/homebrew-mac -[10]: https://opensource.com/article/20/3/chocolatey diff --git a/translated/tech/20200908 How to install software with Ansible.md b/translated/tech/20200908 How to install software with Ansible.md new file mode 100644 index 0000000000..29fae4b262 --- /dev/null +++ b/translated/tech/20200908 How to install software with Ansible.md @@ -0,0 +1,205 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to install software with Ansible) +[#]: via: (https://opensource.com/article/20/9/install-packages-ansible) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +如何使用 Ansible 安装软件 +====== + +使用 Ansible 剧本自动安装和更新你设备上的软件。 +![Puzzle pieces coming together to form a computer screen][1] + +Ansible 是系统管理员和开发人员用来保持计算机系统处于最佳状态的一种流行的自动化工具。与可扩展框架一样,[Ansible][2] 本身功能有限,它真正的功能体现在许多模块中。在某种程度上,Ansible 模块是 [Linux][3] 系统的命令。它们针对特定问题提供解决方案。维护计算机时的一项常见任务是使所有计算机的更新和一致。 + +我曾经使用软件包的文本列表来保持系统或多或少同步:我会列出笔记本电脑上安装的软件包,然后将其与台式机或另一台服务器之间进行交叉引用,手动弥补差异。当然,在 Linux 机器上安装和维护应用程序是 Ansible 的一项基本功能,这意味着你可以在自己关心的计算机上列出所需的内容。 + +### 寻找正确的 Ansible + +Ansible 模块的数量非常庞大,如何找到能完成你任务的模块?在 Linux 中,你可以在应用程序菜单或 `/usr/bin` 中查找要运行的应用程序。使用 Ansible 时,参考 [Ansible 模块索引][4]。 + +这个索引按照类别列出。稍加搜索,你就很可能找到所需的模块。对于包管理,[Packaging 模块][5]几乎适用于所有带包管理器的系统。 + +### 动手写一个 Ansible 剧本 + +首先,选择本地计算机上的包管理器。例如,如果你打算在运行 Fedora 的笔记本电脑上编写 Ansible 指令(在 Ansible 中称为“剧本”),那么从 dnf 模块开始。如果你在 Elementary OS 上编写,使用 `apt` 模块,以此类推。这样你就可以开始进行测试和验证,并可以在以后扩展到其它计算机。 + +第一步是创建一个代表你剧本的目录。这不是绝对必要的,但这是一个好习惯。Ansible 只需要一个配置文件就可以运行在 YAML 中,但是如果你以后想要扩展剧本,你就可以通过改变目录和文件的方式来控制 Ansible。现在,只需创建一个名为 `install_packages` 或类似的目录: +``` +$ mkdir ~/install_packages +``` + +你可以根据自己的喜好来命名 Ansible 的剧本,但通常将其命名为 `site.yml`: +``` +$ touch ~/install_packages/site.yml +``` + +在你最喜欢的文本编辑器中打开 `site.yml`,添加以下内容: +``` +\--- +\- hosts: localhost +  tasks: +    - name: install packages +      become: true +      become_user: root +      dnf: +        state: present +        name: +         - tcsh +         - htop +``` + +你必须调整使用的模块名称来匹配你使用的发行版。在此示例中,我使用 `dnf` 是因为我在 Fedora Linux 上编写剧本。 + +就像 Linux 终端中的命令一样,知道 _如何_ 来调用 Ansible 模块就已经成功了一半。这个示例剧本遵循标准剧本格式: + + * `hosts` 是一台或多台计算机。在本示例中,目标计算机是 `localhost`,即你当前正在使用的计算机(而不是你希望 Ansible 连接的远程系统)。 + * `tasks` 是你要在主机上执行的任务列表。 + * `name` 是任务的人性化名称。在这种情况下,我使用 `install packages`,因为这就是该任务正在做的事情。 + * `become` 允许 Ansible 更改运行此任务的用户。 + * `become_user` 允许 Ansible 成为 `root` 用户来运行此任务。这是必须的,因为只有 root 用户才能使用 `dnf` 安装应用程序。 + * `dnf` 是模块名称,你可以在 Ansible 网站上的模块索引中找到。 + +`dnf` 下的节点是 `dnf` 模块专用的。这是模块文档的关键所在。就像 Linux 命令的手册页一样,模块文档会告诉你可用的选项和所需的参数。 + +![Ansible 文档][6] +Ansible module documentation (Seth Kenlon, [CC BY-SA 4.0][7]) + +安装软件包是一个相对简单的任务,仅需要两个元素。`state` 选项指示 Ansible 检查系统上是否存在 _软件包_,而 `name` 选项列出要查找的软件包。Ansible 会处理机器 _状态_,因此模块指令始终意味着更改。假如 Ansible 扫描了系统状态,发现剧本里描述的系统(在本例中,`tcsh` 和 `htop` 存在)与实际状态存在冲突,那么 Ansible 的任务是进行必要的更改来使系统与剧本匹配。Ansible 可以通过 dnf(或 apt 或者其它任何包管理器)模块进行更改。 + +每个模块可能都有一组不同的选项,所以在编写剧本时,要经常参考模块文档。除非你对模块非常熟悉,否则这是期望模块完成工作的唯一合理方法。 + +### 验证 YAML + +剧本是用 YAML 编写的。因为 YAML 遵循严格的语法,所以安装 `yamllint` 来检查剧本是很有帮助的。更妙的是,有一个专门针对 Ansible 的检查工具称为 `ansible-lint`,它专门为剧本而生。在继续之前,安装它。 + +在 Fedora 或 CentOs 上: +``` +$ sudo dnf ins tall yamllint python3-ansible-lint +``` + +在 Debian、Elementary 或 Ubuntu 上,同样的: +``` +$ sudo apt install yamllint ansible-lint +``` + +使用 `ansible-link` 来验证你的剧本。如果你无法使用 `ansible-lint`,你可以使用 `yamllint`。 +``` +$ ansible-lint ~/install_packages/site.yml +``` + +成功则不返回任何内容,但如果文件中有错误,则必须先修复它们,然后再继续。复制和粘贴过程中的常见错误包括在最后一行的末尾省略换行符、使用制表符而不是空格来缩进。在文本编辑器中修复它们,重新运行 `ansible-llint`,重复这个过程,直到 `ansible-lint` 或 `yamllint` 没有返回为止。 + +### 使用 Ansible 安装一个应用 + +现在你有了一个可验证的有效剧本,你终于可以在本地计算机上运行它了,因为你碰巧知道该剧本定义的任务需要 root 权限,所以在调用 Ansible 时必须使用 `--ask-become-pass` 选项,因此系统会提示你输入管理员密码。 + +开始安装: +``` +$ ansible-playbook --ask-become-pass ~/install_packages/site.yml +BECOME password: +PLAY [localhost] ****************************** + +TASK [Gathering Facts] ****************************** +ok: [localhost] + +TASK [install packages] ****************************** +ok: [localhost] + +PLAY RECAP ****************************** +localhost: ok=0 changed=2 unreachable=0 failed=0 [...] +``` + +这些命令被执行后,目标系统将处于与剧本中描述的相同的状态。 + +### 在远程系统上安装应用程序 + +通过这么多操作来替换一个简单的命令可能会适得其反,但是 Ansible 的优势是它可以在你的所有系统中实现自动化。你可以使用条件语句使 Ansible 在不同的系统上使用特定的模块,但是现在,假定所有计算机都使用相同的包管理器。 + +要连接到远程系统,你必须在 `/etc/ansible/hosts` 文件中定义远程系统,该文件与 Ansible 是一起安装的,所以它已经存在了,但它可能是空的,除了一些解释性注释之外。使用 `sudo` 在你喜欢的文本编辑器中打开它。 + +只要主机名可以解析,就可以通过其 IP 地址或主机名定义主机。例如,如果你已经在 `/etc/hosts` 中定义了 `liavara` 并可以成功 ping 通,那么你可以在 `/etc/ansible/hosts` 中将 `liavara` 设置为主机。或者,如果你正在运行一个域名服务器或 Avahi 服务器并且可以 ping 通 `liavara`,那么你就可以在 `/etc/ansible/hosts` 中定义它。否则,你必须使用它的 IP 地址。 + +你还必须成功地建立与目标主机的安全 shell(SSH)连接。最简单的方法是使用 `ssh-copy-id` 命令,但是如果你以前从未与主机建立 SSH 连接,[阅读我关于如何创建自动 SSH 连接的文章][8]。 + +一旦你在 `/etc/ansible/hosts` 文件中输入了主机名或 IP 地址后,你就可以在剧本中更改 `hosts` 定义: + +``` +\--- +\- hosts: all +  tasks: +    - name: install packages +      become: true +      become_user: root +      dnf: +        state: present +        name: +         - tcsh +         - htop +``` + +再次运行 `ansible-playbook`: +``` +$ ansible-playbook --ask-become-pass ~/install_packages/site.yml +``` + +这次,剧本会在你的远程系统上运行。 + +如果你添加更多主机,则有许多方法可以过滤哪个主机执行哪个任务。例如,你可以创建主机组(服务器的 `webserves`,台式机的 `workstations`等)。 + +### 适用于混合环境的 Ansible + +到目前为止,我们一直假定 Ansible 配置的所有主机都运行相同的操作系统(都是是使用 **dnf** 命令进行程序包管理的操作系统)。那么,如果你要管理不同发行版的主机,例如 Ubuntu(使用 **apt**)或 Arch(使用 **pacman**),或者其它的操作系统时,该怎么办? + +只要目标操作系统具有程序包管理器([MacOs 有 Homebrew][9],[Windows 有 Chocolatey][10]),Ansible 就能派上用场。 + +这就是 Ansible 优势最明显的地方。在 shell 脚本中,你必须检查目标主机上有哪些可用的包管理器,即使使用纯 Python,也必须检查操作系统。Ansible 不仅内置了这些功能,而且还具有在剧本中使用命令结果的机制。你可以使用 **action** 关键字来执行由 Ansible 事实收集子系统提供的变量定义的任务,而不是使用 **dnf** 模块。 +``` +\--- +\- hosts: all +  tasks: +    - name: install packages +      become: true +      become_user: root +      action: > +       {{ ansible_pkg_mgr }} name=htop,transmission state=present update_cache=yes +``` + +**action** 关键字会加载目标插件。在本例中,它使用了 **ansible_pkg_mgr** 变量,该变量由 Ansible 在初始 **收集信息** 期间填充。你不需要告诉 Ansible 收集有关其运行操作系统的事实,所以很容易忽略这一点,但是当你运行一个剧本时,你会在默认输出中看到它: +``` +TASK [Gathering Facts] ***************************************** +ok: [localhost] +``` + +**action** 插件使用来自这个探针的信息,使用相关的包管理器命令填充 **ansible_pkg_mgr**,以安装在 **name** 参数之后列出的程序包。使用 8 行代码,你可以克服在其它脚本选项中很少允许的复杂跨平台难题。 + +### 使用 Ansible + +现在是 21 世纪,我们都希望我们的计算机设备能够互联并且相对一致。无论你维护的是两台还是 200 台计算机,你都不必一次又一次地执行相同的维护任务。使用 Ansible 来同步生活中的计算机设备,看看 Ansible 还能为你做些什么。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/install-packages-ansible + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[MjSeven](https://github.com/MjSeven) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/puzzle_computer_solve_fix_tool.png?itok=U0pH1uwj (Puzzle pieces coming together to form a computer screen) +[2]: https://opensource.com/resources/what-ansible +[3]: https://opensource.com/resources/linux +[4]: https://docs.ansible.com/ansible/latest/modules/modules_by_category.html +[5]: https://docs.ansible.com/ansible/latest/modules/list_of_packaging_modules.html +[6]: https://opensource.com/sites/default/files/uploads/ansible-module.png (Ansible documentation) +[7]: https://creativecommons.org/licenses/by-sa/4.0/ +[8]: https://opensource.com/article/20/8/how-ssh +[9]: https://opensource.com/article/20/6/homebrew-mac +[10]: https://opensource.com/article/20/3/chocolatey From 758d7ede315472b66b304d2041285ecce7c6870f Mon Sep 17 00:00:00 2001 From: MjSeven Date: Thu, 8 Oct 2020 23:45:34 +0800 Subject: [PATCH 0373/1156] f --- .../tech/20200908 How to install software with Ansible.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20200908 How to install software with Ansible.md b/translated/tech/20200908 How to install software with Ansible.md index 29fae4b262..3074036eb1 100644 --- a/translated/tech/20200908 How to install software with Ansible.md +++ b/translated/tech/20200908 How to install software with Ansible.md @@ -10,7 +10,7 @@ 如何使用 Ansible 安装软件 ====== -使用 Ansible 剧本自动安装和更新你设备上的软件。 +使用 Ansible 剧本自动安装和更新设备上的软件。 ![Puzzle pieces coming together to form a computer screen][1] Ansible 是系统管理员和开发人员用来保持计算机系统处于最佳状态的一种流行的自动化工具。与可扩展框架一样,[Ansible][2] 本身功能有限,它真正的功能体现在许多模块中。在某种程度上,Ansible 模块是 [Linux][3] 系统的命令。它们针对特定问题提供解决方案。维护计算机时的一项常见任务是使所有计算机的更新和一致。 From d97db398e9753d0f09f93e0a1bffc8ee9ff69d39 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 9 Oct 2020 05:01:32 +0800 Subject: [PATCH 0374/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201009?= =?UTF-8?q?=20How=20to=20Remove=20Physical=20Volume=20from=20a=20Volume=20?= =?UTF-8?q?Group=20in=20LVM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201009 How to Remove Physical Volume from a Volume Group in LVM.md --- ...sical Volume from a Volume Group in LVM.md | 185 ++++++++++++++++++ 1 file changed, 185 insertions(+) create mode 100644 sources/tech/20201009 How to Remove Physical Volume from a Volume Group in LVM.md diff --git a/sources/tech/20201009 How to Remove Physical Volume from a Volume Group in LVM.md b/sources/tech/20201009 How to Remove Physical Volume from a Volume Group in LVM.md new file mode 100644 index 0000000000..e20fb2af86 --- /dev/null +++ b/sources/tech/20201009 How to Remove Physical Volume from a Volume Group in LVM.md @@ -0,0 +1,185 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Remove Physical Volume from a Volume Group in LVM) +[#]: via: (https://www.2daygeek.com/linux-remove-delete-physical-volume-pv-from-volume-group-vg-in-lvm/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +How to Remove Physical Volume from a Volume Group in LVM +====== + +If a device is no longer need for use by LVM, you can use the vgreduce command to remove physical volumes from a volume group. + +The Vgreduce command shrinks the capacity of a volume group by removing a physical volume. + +But make sure that the physical volume is not used by any logical volumes using the pvdisplay command. + +If the physical volume is still being used, you must transfer the data to another physical volume using the pvmove command. + +Once the data is moved, it can be removed from the volume group. + +Finally use the pvremove command to remove the LVM label and LVM metadata on the empty physical volume. + + * **Part-1: [How to Create/Configure LVM (Logical Volume Management) in Linux][1]** + * **Part-2: [How to Extend/Increase LVM’s (Logical Volume Resize) in Linux][2]** + * **Part-3: [How to Reduce/Shrink LVM’s (Logical Volume Resize) in Linux][3]** + + + +![][4] + +### 1) Moving Extents to Existing Physical Volumes + +Use the pvs command to check if the desired physical volume (we plan to remove the **“/dev/sdb1”** disk in LVM) is used or not. + +``` +# pvs -o+pv_used + +PV VG Fmt Attr PSize PFree Used +/dev/sda1 myvg lvm2 a- 75.00G 14.00G 61.00G +/dev/sdb1 myvg lvm2 a- 50.00G 45.00G 5.00G +/dev/sdc1 myvg lvm2 a- 17.15G 12.15G 5.00G +``` + +If this is used, check to see if there are enough free extents on the other physics volumes in the volume group. + +If so, you can run the pvmove command on the device you want to remove. Extents will be distributed to other devices. + +``` +# pvmove /dev/sdb1 + +/dev/sdb1: Moved: 2.0% +… +/dev/sdb1: Moved: 79.2% +… +/dev/sdb1: Moved: 100.0% +``` + +When the pvmove command is complete. Re-use the pvs command to check whether the physics volume is free or not. + +``` +# pvs -o+pv_used + +PV VG Fmt Attr PSize PFree Used +/dev/sda1 myvg lvm2 a- 75.00G 9.00G 66.00G +/dev/sdb1 myvg lvm2 a- 50.00G 50.00G 0 +/dev/sdc1 myvg lvm2 a- 17.15G 12.15G 5.00G +``` + +If it’s free, use the vgreduce command to remove the physical volume /dev/sdb1 from the volume group. + +``` +# vgreduce myvg /dev/sdb1 +Removed "/dev/sdb1" from volume group "myvg" +``` + +Finally, run the pvremove command to remove the disk from the LVM configuration. Now, the disk is completely removed from the LVM and can be used for other purposes. + +``` +# pvremove /dev/sdb1 +Labels on physical volume "/dev/sdb1" successfully wiped. +``` + +### 2) Moving Extents to a New Disk + +If you don’t have enough free extents on the other physics volumes in the volume group. Add new physical volume using the steps below. + +Request new LUNs from the storage team. Once this is allocated, run the following commands to **[discover newly added LUNs or disks in Linux][5]**. + +``` +# ls /sys/class/scsi_host +host0 +``` + +``` +# echo "- - -" > /sys/class/scsi_host/host0/scan +``` + +``` +# fdisk -l +``` + +Once the disk is detected in the OS, use the pvcreate command to create the physical volume. + +``` +# pvcreate /dev/sdd1 +Physical volume "/dev/sdd1" successfully created +``` + +Use the following command to add new physical volume /dev/sdd1 to the existing volume group vg01. + +``` +# vgextend vg01 /dev/sdd1 +Volume group "vg01" successfully extended +``` + +Now, use the pvs command to see the new disk **“/dev/sdd1”** that you have added. + +``` +# pvs -o+pv_used + +PV VG Fmt Attr PSize PFree Used +/dev/sda1 myvg lvm2 a- 75.00G 14.00G 61.00G +/dev/sdb1 myvg lvm2 a- 50.00G 0 50.00G +/dev/sdc1 myvg lvm2 a- 17.15G 12.15G 5.00G +/dev/sdd1 myvg lvm2 a- 60.00G 60.00G 0 +``` + +Use the pvmove command to move the data from /dev/sdb1 to /dev/sdd1. + +``` +# pvmove /dev/sdb1 /dev/sdd1 + +/dev/sdb1: Moved: 10.0% +… +/dev/sdb1: Moved: 79.7% +… +/dev/sdb1: Moved: 100.0% +``` + +After the data is moved to the new disk. Re-use the pvs command to check whether the physics volume is free. + +``` +# pvs -o+pv_used + +PV VG Fmt Attr PSize PFree Used +/dev/sda1 myvg lvm2 a- 75.00G 14.00G 61.00G +/dev/sdb1 myvg lvm2 a- 50.00G 50.00G 0 +/dev/sdc1 myvg lvm2 a- 17.15G 12.15G 5.00G +/dev/sdd1 myvg lvm2 a- 60.00G 10.00G 50.00G +``` + +If it’s free, use the vgreduce command to remove the physical volume /dev/sdb1 from the volume group. + +``` +# vgreduce myvg /dev/sdb1 +Removed "/dev/sdb1" from volume group "myvg" +``` + +Finally, run the pvremove command to remove the disk from the LVM configuration. Now, the disk is completely removed from the LVM and can be used for other purposes. + +``` +# pvremove /dev/sdb1 +Labels on physical volume "/dev/sdb1" successfully wiped. +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-remove-delete-physical-volume-pv-from-volume-group-vg-in-lvm/ + +作者:[Magesh Maruthamuthu][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://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/create-lvm-storage-logical-volume-manager-in-linux/ +[2]: https://www.2daygeek.com/extend-increase-resize-lvm-logical-volume-in-linux/ +[3]: https://www.2daygeek.com/reduce-shrink-decrease-resize-lvm-logical-volume-in-linux/ +[4]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[5]: https://www.2daygeek.com/scan-detect-luns-scsi-disks-on-redhat-centos-oracle-linux/ From 2d2248cde933d859bb97fe40ea2f52d66aac2fde Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 9 Oct 2020 05:01:57 +0800 Subject: [PATCH 0375/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201007?= =?UTF-8?q?=20Telcos=20Move=20from=20Black=20boxes=20to=20Open=20Source?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201007 Telcos Move from Black boxes to Open Source.md --- ...os Move from Black boxes to Open Source.md | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 sources/tech/20201007 Telcos Move from Black boxes to Open Source.md diff --git a/sources/tech/20201007 Telcos Move from Black boxes to Open Source.md b/sources/tech/20201007 Telcos Move from Black boxes to Open Source.md new file mode 100644 index 0000000000..d517aa4842 --- /dev/null +++ b/sources/tech/20201007 Telcos Move from Black boxes to Open Source.md @@ -0,0 +1,92 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Telcos Move from Black boxes to Open Source) +[#]: via: (https://www.linux.com/interviews/telcos-move-from-black-boxes-to-open-source/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +Telcos Move from Black boxes to Open Source +====== + +*Linux Foundation Networking (LFN) organized its first virtual event last week and we sat down with Arpit Joshipura, the General Manager of Networking, IoT and Edge at the Linux Foundation, to talk about the key points of the event and how LFN is leading the adoption of open source within the telco space. * + +**Swapnil Bhartiya: Today, we have with us Arpit Joshipura, General Manager of Networking, IoT and Edge, at the Linux Foundation. Arpit, what were some of the highlights of this event? Some big announcements that you can talk about?** + +**Arpit Joshipura:** This was a global event with more than 80 sessions and was attended by attendees from over 75 countries. The sessions were very diverse. A lot of the sessions were end-user driven, operator driven as well as from our vendors and partners. If you take LF Networking and LFH as two umbrellas that are leading the Networking and Edge implementations here, we had a very significant announcement. I would probably group them into 5 main things: + +Number one, we released a white paper at the Linux Foundation level where we had a bunch of vertical industries transformed using open source. These are over 100-year-old industries like telecom, automotive, finance, energy, healthcare, etc. So, that’s kind of one big announcement where vertical industries have taken advantage of open source. + +The second announcement was easy enough: Google Cloud joins Linux Foundation Networking as a partner. That announcement comes on the basis of the telecom market and the cloud market converging together and building on each other. + +The third major announcement was a project under LF Networking. If you remember, two years ago, a project collaboration with GSMA was started. It was called CNTT, which really defined and narrowed the scope of interoperability and compliance. And we have OPNFV under LFN. What we announced at Open Networking and Edge summit is the two projects are going to come together. This would be fantastic to a global community of operators who are simplifying the deployment and interoperability of implementation of NFVI manual VNFs and CNFs. + +The next announcement was around a research study that we released on open source code that was created by Linux Foundation Networking, using LFN analytics and COCOMO estimation. We’re talking $7.2 billion worth of IP investment, right? This is the power of shared technology. + +And finally, we released a survey on the Edge community asking them, “Why are you contributing to open source?” And the answer was fascinating. It was all-around innovation, speed to deployment, market creation. Yes, cost was important, but not initially. + +So those were the 5 big highlights of the show from an LFN and LFH perspective. + +**Swapnil Bhartiya: There are two things that I’m interested in. One is the consolidation that you talk about, and the second is survey. The fact is that everybody is using open source. There is no doubt about it. But the problem that is happening is since everybody’s using it, there seems to be some gap between the awareness of how to be a good open source citizen as well. What have you seen in the telco space?** + +**Arpit Joshipura:** First of all, 5 years ago, they were all using black box and proprietary technologies. Then, we launched a project called OpenDaylight. And of course, OpenDaylight announced its 13th release today, but that’s kind of on their 6-year anniversary from being proprietary to today in one of the more active projects called ONAP. The telcos are 4 of the Top 10 contributors of source code and open source, right? Who would have imagined that an AT&T, Verizon, Amdocs, DT, Vodafone, and a China mobile and a China telecom, you name it are all actively contributing code? So that’s a paradigm shift in terms of not only consuming it, but also contributing towards it. + +**Swapnil Bhartiya: And since you mentioned ONAP, if I’m not wrong, I think AT&T released its own work as E-com. And then the projects within the Foundation were merged to create ONAP. And then you mentioned actually NTD. So, what I want to understand from you is how many projects are there that you see within the Foundation? The problem is that Linux Foundation and all those other foundations are open servers. It’s a very good place for those products to come in. It’s obvious that there will be some projects that will overlap. So what is the situation right now? Where do you see some overlap happening and, at the same time, are there still gaps that you need to fill?** + +**Arpit Joshipura:** So that’s a question of the philosophies of a foundation, right? I’ll start off with the most loose situation, which is GitHub. Millions and millions of projects on GitHub. Any PhD student can throw his code on GitHub and say that’s open source and at the end of the day, if there’s no community around it, that project is dead. Okay. That’s the most extreme scenario. Then, there are foundations like CNCF who have a process of accepting projects that could have competing solutions. May the best project win. + +From an LF Networking and LFH perspective, the process is a little bit more restrictive: there is a formal project life cycle document and a process available on the Wiki that looks at the complementary nature of the project, that looks at the ecosystem, that looks at how it will enable and foster innovation. Then based on that, the governing board and the neutral governance that we have set up under the Linux Foundation, they would approve it. + +Overall, it depends on the philosophy for LFN and LFH. We have 8 projects each in the umbrella, and most of these projects are quite complementary when it comes to solving different use cases in different parts of the network. + +**Swapnil Bhartiya: Awesome. Now, I want to talk about 5G a bit. I did not hear any announcements, but can you talk a bit about what is the word going on to help the further deployment of 5G technologies?** + +**Arpit Joshipura:** Yeah. I’m happy and sad to say that 5G is old news, right? The reality is all of the infrastructure work on 5G already was released earlier this year. So ONAP Frankfurt release, for example, has a blueprint on 5G slicing, right? All the work has been done, lots of blueprint and Akraino using 5G and mech. So, that work is done. The cities are getting lit up by the carriers. You see announcements from global carriers on 5G deployments. I think there are 2 missing pieces of work remaining for 5G. + +One is obviously the O-RAN support, right? The O-RAN software community, which we host at the Linux Foundation also is coming up with a second release. And, all the support for 5G is in there. + +The second part of 5G is really the compliance and verification testing. A lot of work is going into CMTT and OPN and feed. Remember that merge project we talked about where 5G is in context of not just OpenStack, but also Kubernetes? So the cloud-native aspects of 5G are all being worked on this year. I think we’ll see a lot more cloud-native 5G deployments next year primarily because projects like ONAP or cloud native integrate with projects like ONAP and Anthos or Azure stack and things like that. + +**Swapnil Bhartiya: What are some of the biggest challenges that the telco industry is facing? I mean, technically, no externalization and all those things were there, but foundations have solved the problem. Some rough ideas are still there that you’re trying to resolve for them.** + +**Arpit Joshipura:** Yeah. I think the recent pandemic caused a significant change in the telcos’ thinking, right? Fortunately, because they had already started on a virtualization and open-source route, you heard from Android, and you heard from Deutsche Telekom, and you heard from Achronix, all of the operators were able to handle the change in the network traffic, change in the network, traffic direction, SLS workloads, etc., right? All because of the _softwarization_ as we call it on the network. + +Given the pandemic, I think the first challenge for them was, can the network hold up? And the answer is, yes. Right? All the work-from-home and all these video recordings, we have to hang out with the web, that was number one. + +Number two is it’s good to hold up the network, but did I end up spending millions and millions of dollars for operational expenditures? And the answer to that is no, especially for the telcos who have embraced an open-source ecosystem, right? So people who have deployed projects like SDN or ONAP or automation and orchestration or closed-loop controls, they automatically configure and reconfigure based on workloads and services and traffic, right? And that does not require manual labor, right? Tremendous amounts of costs were saved from an opex perspective, right? + +For operators who are still in the old mindset have significantly increased their opex, and what that has caused is a real strain on their budget sheets. + +So those were the 2 big things that we felt were challenges, but have been solved. Going forward, now it’s just a quick rollout/build-out of 5G, expanding 5G to Edge, and then partnering with the public cloud providers, at least, here in the US to bring the cloud-native solutions to market. + +**Swapnil Bhartiya: Awesome. Now, Arpit, if I’m not wrong, LF Edge is I think, going to celebrate its second anniversary in January. What do you feel the product has achieved so far? What are its accomplishments? And what are some challenges that the project still has to tackle?** + +**Arpit Joshipura:** Let me start off with the most important accomplishment as a community and that is terminology. We have a project called State of the Edge and we just issued a white paper, which outlines terminology, terms and definitions of what Edge is because, historically, people use terms like thin edge, thick edge, cloud edge, far edge, near edge and blah, blah, blah. They’re all relative terms. Okay. It’s an edge in relation to who I am. + +Instead of that, the paper now defines absolute terms. If I give you a quick example, there are really 2 kinds of edges. There’s a device edge, and then there is a service provider edge. A device edge is really controlled by the operator, by the end user, I should say. Service provider edge is really shared as a service and the last mile typically separates them. + +Now, if you double click on each of these categories, then you have several incarnations of an edge. You can have an extremely constrained edge, microcontrollers, etc., mostly manufacturing, IIoT type. You could have a smart device edge like gateways, etc. Or you could have an on-prem silver type device edge. Either way, an end user controls that edge versus the other edge. Whether it’s on the radio-based stations or in a smart central office, the operator controls it. So that’s kind of the first accomplishment, right? Standardizing on terminology. + +The second big Edge accomplishment is around 2 projects: Akraino and EdgeX Foundry. These are stage 3 mature projects. They have come out with significant [results]. Akraino, for example, has come out with 20 plus blueprints. These are blueprints that actually can be deployed today, right? Just to refresh, a blueprint is a declarative configuration that has everything from end to end to solve a particular use case. So things like connected classrooms, AR/VR, connected cars, right? Network cloud, smart factories, smart cities, etc. So all these are available today. + +EdgeX is the IoT framework for an industrial setup, and that’s kind of the most downloaded. Those 2 projects, along with Fledge, EVE, Baetyl, Home Edge, Open Horizon, security advanced onboarding, NSoT, right? Very, very strong growth over 200% growth in terms of contributions. Huge growth in membership, huge growth in new projects and the community overall. We’re seeing that Edge is really picking up great. Remember, I told you Edge is 4 times the size of the cloud. So, everybody is in it. + +**Swapnil Bhartiya: Now, the second part of the question was also some of the challenges that are still there. You talked about accomplishment. What are the problems that you see that you still think that the project has to solve for the industry and the community?** + +**Arpit Joshipura:** The fundamental challenge that remains is we’re still working as a community in different markets. I think the vendor ecosystem is trying to figure out who is the customer and who is the provider, right? Think of it this way: a carrier, for example, AT&T, could be a provider to a manufacturing factory, who actually could consume something from a provider, and then ship it to an end user. So, there’s like a value shift, if you may, in the business world, on who gets the cut, if you may. That’s still a challenge. People are trying to figure out, I think people who are going to be quick to define, solve and implement solutions using open technology will probably turn out to be winners. + +People who will just do analysis per analysis will be left behind like any other industry. I think that is kind of fundamentally number one. And number two, I think the speed at which we want to solve things. The pandemic has just accelerated the need for Edge and 5G. I think people are just eager to get gaming with low latency, get manufacturing, predictive maintenance with low latency, home surveillance with low latency, connected cars, autonomous driving, all the classroom use cases. They should have been done next year, but because of the pandemic, it just got accelerated. +-------------------------------------------------------------------------------- + +via: https://www.linux.com/interviews/telcos-move-from-black-boxes-to-open-source/ + +作者:[Swapnil Bhartiya][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://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 From f07d61f04eb4a5bd93964487c1c991c38834de54 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 9 Oct 2020 05:02:12 +0800 Subject: [PATCH 0376/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201009?= =?UTF-8?q?=20How=20to=20Install=20Deepin=20Desktop=20on=20Ubuntu=2020.04?= =?UTF-8?q?=20LTS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md --- ...tall Deepin Desktop on Ubuntu 20.04 LTS.md | 131 ++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 sources/tech/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md diff --git a/sources/tech/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md b/sources/tech/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md new file mode 100644 index 0000000000..e9d910abdf --- /dev/null +++ b/sources/tech/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md @@ -0,0 +1,131 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Install Deepin Desktop on Ubuntu 20.04 LTS) +[#]: via: (https://itsfoss.com/install-deepin-ubuntu/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +How to Install Deepin Desktop on Ubuntu 20.04 LTS +====== + +_**This tutorial shows you the proper steps to install the Deepin desktop environment on Ubuntu. Removal steps are also mentioned.**_ + +Deepin is undoubtedly a [beautiful Linux distribution][1]. The recently released [Deepin version 20][2] makes it even more beautiful. + +Now, [Deepin Linux][3] is based on [Debian][4] and the default repository mirrors are too slow. If you would rather stay with Ubuntu, you have the Deepin variant of Ubuntu in the form [UbuntuDDE Linux distribution][5]. It is not one of the [official Ubuntu flavors][6] yet. + +[Reinstalling a new distribution][7] is a bit of annoyances for you would lose the data and you’ll have to reinstall your applications on the newly installed UbuntuDDE. + +A simpler option is to install Deepin desktop environment on your existing Ubuntu system. After all you can easily install more than one [desktop environment][8] in one system. + +Fret not, it is easy to do it and you can also revert the changes if you do not like it. Let me show you how to do that. + +### Installing Deepin Desktop on Ubuntu 20.04 + +![][9] + +The UbuntuDDE team has created a PPA for their distribution and you can use the same PPA to install Deepin desktop on Ubuntu 20.04. Keep in mind that this PPA is only available for Ubuntu 20.04. Please read about [using PPA in Ubuntu][10]. + +No Deepin version 20 + +The Deepin desktop you’ll be installing using the PPA here is NOT the new Deepin desktop version 20 yet. It will probably be there after Ubuntu 20.10 release but we cannot promise anything. + +Here are the steps that you need to follow: + +**Step 1**: You need to first add the [official PPA by Ubuntu DDE Remix team][11] by typing this on the terminal: + +``` +sudo add-apt-repository ppa:ubuntudde-dev/stable +``` + +**Step 2**: Once you have added the repository, proceed with installing the Deepin desktop. + +``` +sudo apt install ubuntudde-dde +``` + +![][12] + +Now, the installation will start and after a while, you will be asked to choose the display manager. + +![][13] + +You need to select “**lightdm**” if you want Deepin desktop themed lock screen. If not, you can set it as “**gdm3**“. + +In case you don’t see this option, you can get it by typing the following command and then select your preferred display manager: + +``` +sudo dpkg-reconfigure lightdm +``` + +**Step 3:** Once done, you have to log out and log in again by choosing the “**Deepin**” session or just reboot the system. + +![][14] + +And, that is it. Enjoy the Deepin experience on your Ubuntu 20.04 LTS system in no time! + +![][15] + +### Removing Deepin desktop from Ubuntu 20.04 + +In case, you don’t like the experience or of it is buggy for some reason, you can remove it by following the steps below. + +**Step 1:** If you’ve set “lightdm” as your display manager, you need to set the display manager as “gdm3” before uninstalling Deepin. To do that, type in the following command: + +``` +sudo dpkg-reconfigure lightdm +``` + +![Select gdm3 on this screen][13] + +And, select **gdm3** to proceed. + +Once you’re done with that, you can simply enter the following command to remove Deepin completely: + +``` +sudo apt remove startdde ubuntudde-dde +``` + +You can just reboot to get back to your original Ubuntu desktop. In case the icons become unresponsive, you just open the terminal (**CTRL + ALT + T**) and type in: + +``` +reboot +``` + +**Wrapping Up** + +It is good to have different [choices of desktop environments][16]. If you really like Deepin desktop interface, this could be a way to experience Deepin on Ubuntu. + +If you have questions or if you face any issues, please let me know in the comments. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-deepin-ubuntu/ + +作者:[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/beautiful-linux-distributions/ +[2]: https://itsfoss.com/deepin-20-review/ +[3]: https://www.deepin.org/en/ +[4]: https://www.debian.org/ +[5]: https://itsfoss.com/ubuntudde/ +[6]: https://itsfoss.com/which-ubuntu-install/ +[7]: https://itsfoss.com/reinstall-ubuntu/ +[8]: https://itsfoss.com/what-is-desktop-environment/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/ubuntu-20-with-deepin.jpg?resize=800%2C386&ssl=1 +[10]: https://itsfoss.com/ppa-guide/ +[11]: https://launchpad.net/~ubuntudde-dev/+archive/ubuntu/stable +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/deepin-desktop-install.png?resize=800%2C534&ssl=1 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/deepin-display-manager.jpg?resize=800%2C521&ssl=1 +[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/deepin-session-ubuntu.jpg?resize=800%2C414&ssl=1 +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/ubuntu-20-with-deepin-1.png?resize=800%2C589&ssl=1 +[16]: https://itsfoss.com/best-linux-desktop-environments/ From 58f531c542b7ee87bb27450f0c3ca690c5fea3ca Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 9 Oct 2020 05:02:27 +0800 Subject: [PATCH 0377/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201008?= =?UTF-8?q?=20Top=205=20open=20source=20alternatives=20to=20Google=20Analy?= =?UTF-8?q?tics?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201008 Top 5 open source alternatives to Google Analytics.md --- ...source alternatives to Google Analytics.md | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 sources/tech/20201008 Top 5 open source alternatives to Google Analytics.md diff --git a/sources/tech/20201008 Top 5 open source alternatives to Google Analytics.md b/sources/tech/20201008 Top 5 open source alternatives to Google Analytics.md new file mode 100644 index 0000000000..b06206d8ce --- /dev/null +++ b/sources/tech/20201008 Top 5 open source alternatives to Google Analytics.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top 5 open source alternatives to Google Analytics) +[#]: via: (https://opensource.com/article/18/1/top-5-open-source-analytics-tools) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +Top 5 open source alternatives to Google Analytics +====== +These four versatile web analytics tools provide valuable insights on +your customers and site visitors while keeping you in control. +![Analytics: Charts and Graphs][1] + +If you have a website or run an online business, collecting data on where your visitors or customers come from, where they land on your site, and where they leave _is vital._ Why? That information can help you better target your products and services, and beef up the pages that are turning people away. + +To gather that kind of information, you need a web analytics tool. + +Many businesses of all sizes use Google Analytics. But if you want to keep control of your data, you need a tool that _you_ can control. You won’t get that from Google Analytics. Luckily, Google Analytics isn’t the only game on the web. + +Here are four open source alternatives to Google Analytics. + +### Matomo + +Let’s start with the open source application that rivals Google Analytics for functions: [Matomo][2] (formerly known as Piwik). Matomo does most of what Google Analytics does, and chances are it offers the features that you need. + +Those features include metrics on the number of visitors hitting your site, data on where they come from (both on the web and geographically), the pages from which they leave, and the ability to track search engine referrals. Matomo also offers many reports, and you can customize the dashboard to view the metrics that you want to see. + +To make your life easier, Matomo integrates with more than 65 content management, e-commerce, and online forum systems, including WordPress, Magneto, Joomla, and vBulletin, using plugins. For any others, you can simply add a tracking code to a page on your site. + +You can [test-drive][3] Matomo or use a [hosted version][4]. + +### Open Web Analytics + +If there’s a close second to Matomo in the open source web analytics stakes, it’s [Open Web Analytics][5]. In fact, it includes key features that either rival Google Analytics or leave it in the dust. + +In addition to the usual raft of analytics and reporting functions, Open Web Analytics tracks where on a page, and on what elements, visitors click; provides [heat maps][6] that show where on a page visitors interact the most; and even does e-commerce tracking. + +Open Web Analytics has a [WordPress plugin][7] and can [integrate with MediaWiki][8] using a plugin. Or you can add a snippet of [JavaScript][9] or [PHP][10] code to your web pages to enable tracking. + +Before you [download][11] the Open Web Analytics package, you can [give the demo a try][12] to see it it’s right for you. + +### AWStats + +Web server log files provide a rich vein of information about visitors to your site, but tapping into that vein isn't always easy. That's where [AWStats][13] comes to the rescue. While it lacks the most modern look and feel, AWStats more than makes up for that with breadth of data it can present. + +That information includes the number of unique visitors, how long those visitors stay on the site, the operating system and web browsers they use, the size of a visitor's screen, and the search engines and search terms people use to find your site. AWStats can also tell you the number of times your site is bookmarked, track the pages where visitors enter and exit your sites, and keep a tally of the most popular pages on your site. + +These features only scratch the surface of AWStats's capabilities. It also works with FTP and email logs, as well as [syslog][14] files. AWStats can gives you a deep insight into what's happening on your website using data that stays under your control. + +### Countly + +[Countly][15] bills itself as a "secure web analytics" platform. While I can't vouch for its security, Countly does a solid job of collecting and presenting data about your site and its visitors. + +Heavily targeting marketing organizations, Countly tracks data that is important to marketers. That information includes site visitors' transactions, as well as which campaigns and sources led visitors to your site. You can also create metrics that are specific to your business. Countly doesn't forgo basic web analytics; it also keeps track of the number of visitors on your site, where they're from, which pages they visited, and more. + +You can use the hosted version of Countly or [grab the source code][16] from GitHub and self-host the application. And yes, there are [differences between the hosted and self-hosted versions][17] of Countly. + +### Plausible + +[Plausible][18] is a newer kid on the open source analytics tools block. It’s lean, it’s fast, and only collects a small amount of information — that includes numbers of unique visitors and the top pages they visited, the number of page views, the bounce rate, and referrers. Plausible is simple and very focused. + +What sets Plausible apart from its competitors is its heavy focus on privacy. The project creators state that the tool doesn’t collect or store any information about visitors to your website, which is particularly attractive if privacy is important to you. You can read more about that [here][19]. + +There’s a [demo instance][20] that you check out. After that, you can either [self-host][21] Plausible or sign up for a [paid, hosted account][22]. + +**Share your favorite open source web analytics tool with us in the comments.** + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/1/top-5-open-source-analytics-tools + +作者:[Scott Nesbitt][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://opensource.com/users/scottnesbitt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/analytics-graphs-charts.png?itok=sersoqbV (Analytics: Charts and Graphs) +[2]: https://matomo.org/ +[3]: https://demo.matomo.org/index.php?module=CoreHome&action=index&idSite=3&period=day&date=yesterday +[4]: https://www.innocraft.cloud/ +[5]: http://www.openwebanalytics.com/ +[6]: http://en.wikipedia.org/wiki/Heat_map +[7]: https://github.com/padams/Open-Web-Analytics/wiki/WordPress-Integration +[8]: https://github.com/padams/Open-Web-Analytics/wiki/MediaWiki-Integration +[9]: https://github.com/padams/Open-Web-Analytics/wiki/Tracker +[10]: https://github.com/padams/Open-Web-Analytics/wiki/PHP-Invocation +[11]: https://github.com/padams/Open-Web-Analytics +[12]: http://demo.openwebanalytics.com/ +[13]: http://www.awstats.org +[14]: https://en.wikipedia.org/wiki/Syslog +[15]: https://count.ly/web-analytics +[16]: https://github.com/Countly +[17]: https://count.ly/pricing#compare-editions +[18]: https://plausible.io +[19]: https://plausible.io/data-policy +[20]: https://plausible.io/plausible.io +[21]: https://plausible.io/self-hosted-web-analytics +[22]: https://plausible.io/register From 084c457a8fec24c74b301d4bd376543407ed83eb Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 9 Oct 2020 05:02:40 +0800 Subject: [PATCH 0378/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201008?= =?UTF-8?q?=20Integrate=20your=20calendar=20with=20Ansible=20to=20avoid=20?= =?UTF-8?q?schedule=20conflicts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md --- ...ith Ansible to avoid schedule conflicts.md | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 sources/tech/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md diff --git a/sources/tech/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md b/sources/tech/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md new file mode 100644 index 0000000000..6c46e90773 --- /dev/null +++ b/sources/tech/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md @@ -0,0 +1,112 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Integrate your calendar with Ansible to avoid schedule conflicts) +[#]: via: (https://opensource.com/article/20/10/calendar-ansible) +[#]: author: (Nicolas Leiva https://opensource.com/users/nicolas-leiva) + +Integrate your calendar with Ansible to avoid schedule conflicts +====== +Make sure your automation workflow's schedule doesn't conflict with +something else by integrating a calendar app into Ansible. +![Calendar close up snapshot][1] + +Is "anytime" a good time to execute your automation workflow? The answer is probably no, for different reasons. + +If you want to avoid simultaneous changes to minimize the impact on critical business processes and reduce the risk of unintended service disruptions, then no one else should be attempting to make changes at the same time your automation is running. + +In some scenarios, there could be an ongoing scheduled maintenance window. Or maybe there is a big event coming up, a critical business time, or a holiday—or maybe you prefer not to make changes on a Friday night. + +![Street scene with a large calendar and people walking][2] + +([Curtis MacNewton][3], [CC BY-ND 2.0][4]) + +Whatever the reason, you want to signal this information to your automation platform and prevent the execution of periodic or ad-hoc tasks during specific time slots. In change management jargon, I am talking about specifying blackout windows when change activity should not occur. + +### Calendar integration in Ansible + +How can you accomplish this in [Ansible][5]? While it has no calendar function per se, Ansible's extensibility will allow it to integrate with any calendar application that has an API. + +The goal is this: Before you execute any automation or change activity, you execute a `pre-task` that checks whether something is already scheduled in the calendar (now or soon enough) and confirms you are not in the middle of a blocked timeslot. + +Imagine you have a fictitious module named `calendar`, and it can connect to a remote calendar, like Google Calendar, to determine if the time you specify has otherwise been marked as busy. You could write a playbook that looks like this: + + +``` +\- name: Check if timeslot is taken +  calendar: +    time: "{{ ansible_date_time.iso8601 }}" +  register: output +``` + +Ansible facts will give `ansible_date_time`, which is passed to the `calendar` module to verify the time availability so that it can register the response (`output`) to use in subsequent tasks. + +If your calendar looks like this: + +![Google Calendar screenshot][6] + +(Nicolas Leiva, [CC BY-SA 4.0][7]) + +Then the output of this task would highlight the fact this timeslot is taken (`busy: true`): + + +``` +ok: [localhost] => { +   "output": { +       "busy": true, +       "changed": false, +       "failed": false, +       "msg": "The timeslot 2020-09-02T17:53:43Z is busy: true" +   } +} +``` + +### Prevent tasks from running + +Next, [Ansible Conditionals][8] will help prevent the execution of any further tasks. As a simple example, you could use a `when` statement on the next task to enforce that it runs only when the field `busy` in the previous output is not `true`: + + +``` +tasks: +  - shell: echo "Run this only when not busy!" +    when: not output.busy +``` + +### Conclusion + +In a [previous article][9], I said Ansible is a framework to wire things together, interconnecting different building blocks to orchestrate an end-to-end automation workflow. + +This article looked at how playbooks can integrate or talk to a calendar application to check availability. However, I am just scratching the surface! For example, your tasks could also block a timeslot in the calendar… the sky is the limit. + +In my next article, I will dig into how the `calendar` module is built and how other programming languages can be used with Ansible. Stay tuned if you are a [Go][10] fan like me! + +* * * + +_This originally appeared on Medium as [Ansible and Google Calendar integration for change management][11] under a CC BY-SA 4.0 license and is republished with permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/calendar-ansible + +作者:[Nicolas Leiva][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://opensource.com/users/nicolas-leiva +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/calendar.jpg?itok=jEKbhvDT (Calendar close up snapshot) +[2]: https://opensource.com/sites/default/files/uploads/street-calendar.jpg (Street scene with a large calendar and people walking) +[3]: https://www.flickr.com/photos/7841127@N02/4217116202 +[4]: https://creativecommons.org/licenses/by-nd/2.0/ +[5]: https://docs.ansible.com/ansible/latest/index.html +[6]: https://opensource.com/sites/default/files/uploads/googlecalendarexample.png (Google Calendar screenshot) +[7]: https://creativecommons.org/licenses/by-sa/4.0/ +[8]: https://docs.ansible.com/ansible/latest/user_guide/playbooks_conditionals.html +[9]: https://medium.com/swlh/python-and-ansible-to-automate-a-network-security-workflow-28b9a44660c6 +[10]: https://golang.org/ +[11]: https://medium.com/swlh/ansible-and-google-calendar-integration-for-change-management-7c00553b3d5a From 2e9eda6aa8bdc95d6ce6074aa58804f131e93212 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 9 Oct 2020 05:02:53 +0800 Subject: [PATCH 0379/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201008?= =?UTF-8?q?=20Protect=20your=20network=20with=20open=20source=20tools?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201008 Protect your network with open source tools.md --- ...ect your network with open source tools.md | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 sources/tech/20201008 Protect your network with open source tools.md diff --git a/sources/tech/20201008 Protect your network with open source tools.md b/sources/tech/20201008 Protect your network with open source tools.md new file mode 100644 index 0000000000..44ab5e3216 --- /dev/null +++ b/sources/tech/20201008 Protect your network with open source tools.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Protect your network with open source tools) +[#]: via: (https://opensource.com/article/20/10/apache-security-tools) +[#]: author: (Chantale Benoit https://opensource.com/users/chantalebenoit) + +Protect your network with open source tools +====== +Apache Syncope and Metron can help you secure your network against +unauthorized access and data loss. +![A lock on the side of a building][1] + +System integrity is essential, especially when you're charged with safeguarding other people's personal details on your network. It's critical that system administrators are familiar with security tools, whether their purview is a home, a small business, or an organization with hundreds or thousands of employees. + +### How cybersecurity works + +Cybersecurity involves securing networks against unauthorized access. However, there are many attack vectors out there that most people don't consider. The cliché of a lone hacker manually dueling with firewall rules until they gain access to a network is popular—but wildly inaccurate. Security breaches happen through automation, malware, phishing, ransomware, and more. You can't directly fight every attack as it happens, and you can't count on every computer user to exercise common sense. Therefore, you have to design a system that resists intrusion and protects users against outside attacks as much as it protects them from their own mistakes. + +The advantage of open source security tools is that they keep vulnerabilities transparent. They give full visibility into their codebase and are supported by a global community of experts working together to create strong, tried-and-tested code. + +With so many domains needing protection, there's no single cybersecurity solution that fits every situation, but here are two that you should consider. + +### Apache Syncope + +[Apache Syncope][2] is an open source system for managing digital identities in an enterprise environment. From focusing on identity lifecycle management and identity storage to provisioning engines and accessing management capabilities, Apache Syncope is a comprehensive identity management solution. It also provides monitoring and security features for third-party applications. + +Apache Syncope synchronizes users, groups, and other objects. _Users_ represent the buildup of virtual identities and account information fragmented across external resources. _Groups_ are entities on external resources that support the concept of LDAP or Active Directory. _Objects_ are entities such as printers, services, and sensors. It also does full reconciliation and live synchronization from external resources with workflow-based approval. + +#### Third-party applications + +Apache Syncope also exposes a fully compliant [JAX-RS][3] 2.0 [RESTful][4] interface to enable third-party applications written in any programming language. These applications consume identity management services, such as: + + * **Logic:** Syncope implements business logic that can be triggered through REST services and controls additional features such as notifications, reports, and auditing. + * **Provisioning:** It manages the internal and external representation of users, groups, and objects through workflow and specific connectors. + * **Workflow:** Syncope supports Activiti or Flowable [business process management (BPM)][5] workflow engines and allows defining new and custom workflows when needed. + * **Persistence:** It manages all data, such as users, groups, attributes, and resources, at a high level using a standard [JPA 2.0][6] approach. The data is further persisted to an underlying database, such as internal storage. + * **Security:** Syncope defines a fine-grained set of entitlements, which are granted to administrators and enable the implementation of delegated administration scenarios. + + + +#### Syncope extensions + +Apache Syncope's features can be enhanced with [extensions][7], which add a REST endpoint and manage the persistence of additional entities, tweak the provisioning layer, and add features to the user interface. + +Some popular extensions include: + + * **Swagger UI** works as a user interface for Syncope RESTful services. + * **SSO support** provides OpenID Connect and SAML 2.0 access to administrative or end-user web interfaces. + * **Apache Camel provisioning manager** delegates the execution of the provisioning process to a group of Apache Camel routes. It can be dynamically changed at the runtime through the REST interfaces or the administrative console, and modifications are also instantly available for processing. + * **Elasticsearch** provides an alternate internal search engine for users, groups, and objects through an external [Elasticsearch][8] cluster. + + + +### Apache Metron + +Security information and event management ([SIEM][9]) gives admins insights into the activities happening within their IT environment. It combines the concepts of security event management (SEM) with security information management (SIM) into one functionality. SIEM collects security data from network devices, servers, and domain controllers, then aggregates and analyzes the data to detect malicious threats and payloads. + +[Apache Metron][10] is an advanced security analytics framework that detects cyber anomalies, such as phishing activity and malware infections. Further, it enables organizations to take corrective measures to counter the identified anomalies. + +It also interprets and normalizes security events into standard JSON language, which makes it easier to analyze security events, such as: + + * An employee flagging a suspicious email + * An authorized or unauthorized software download by an employee to a company device + * A security lapse due to a server outage + + + +Apache Metron provides security alerts, labeling, and data enrichment. It can also store and index security events. Its four key capabilities are: + + * **Security data lake:** Metron is a cost-effective way to store and combine a wide range of business and security data. The security data lake provides the amount of data required to power discovery analytics. It also provides a mechanism to search and query for operational analytics. + * **Pluggable framework:** It provides a rich set of parsers for common security data sources such as pcap, NetFlow, Zeek (formerly Bro), Snort, FireEye, and Sourcefire. You can also add custom parsers for new data sources, including enrichment services for more contextual information, to the raw streaming data. The pluggable framework provides extensions for threat-intel feeds and lets you customize security dashboards. Machine learning and other models can also be plugged into real-time streams and provide extensibility. + * **Threat detection platform:** It uses machine learning algorithms to detect anomalies in a system. It also helps analysts extract and reconstruct full packets to understand the attacker's identity, what data was leaked, and where the data was sent. + * **Incident response application:** This refers to evolved SIEM capabilities, including alerting, threat intel frameworks, and agents to ingest data sources. Incident response applications include packet replay utilities, evidence storage, and hunting services commonly used by security operations center analysts. + + + +### Security matters + +Incorporating open source security tools into your IT infrastructure is imperative to keep your organization safe and secure. Open source tools, like Syncope and Metron from Apache, can help you identify and counter security threats. Learn to use them well, file bugs as you find them, and help the open source community protect the world's data. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/apache-security-tools + +作者:[Chantale Benoit][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://opensource.com/users/chantalebenoit +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_3reasons.png?itok=k6F3-BqA (A lock on the side of a building) +[2]: https://syncope.apache.org/ +[3]: https://jax-rs.github.io/apidocs/2.0/ +[4]: https://www.redhat.com/en/topics/api/what-is-a-rest-api +[5]: https://www.redhat.com/en/topics/automation/what-is-business-process-management +[6]: http://openjpa.apache.org/openjpa-2.0.0.html +[7]: http://syncope.apache.org/docs/2.1/reference-guide.html#extensions +[8]: https://opensource.com/life/16/6/overview-elastic-stack +[9]: https://en.wikipedia.org/wiki/Security_information_and_event_management +[10]: http://metron.apache.org/ From d3fdac6ae81661910062965eb6dd5f33c1ea8518 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 9 Oct 2020 05:03:18 +0800 Subject: [PATCH 0380/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201007?= =?UTF-8?q?=20Design=20and=20document=20APIs=20using=20an=20open=20source?= =?UTF-8?q?=20cross-platform=20tool?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201007 Design and document APIs using an open source cross-platform tool.md --- ...sing an open source cross-platform tool.md | 199 ++++++++++++++++++ 1 file changed, 199 insertions(+) create mode 100644 sources/tech/20201007 Design and document APIs using an open source cross-platform tool.md diff --git a/sources/tech/20201007 Design and document APIs using an open source cross-platform tool.md b/sources/tech/20201007 Design and document APIs using an open source cross-platform tool.md new file mode 100644 index 0000000000..196df6ac22 --- /dev/null +++ b/sources/tech/20201007 Design and document APIs using an open source cross-platform tool.md @@ -0,0 +1,199 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Design and document APIs using an open source cross-platform tool) +[#]: via: (https://opensource.com/article/20/10/spec-first-development-apis) +[#]: author: (Greg Schier https://opensource.com/users/gregschier) + +Design and document APIs using an open source cross-platform tool +====== +Insomnia Designer makes spec-first development more accessible by +providing collaborative tools to organize, maintain, and validate API +specs. +![Computer laptop in space][1] + +In the world of software-as-a-service (SaaS) and service-based architectures, it's not uncommon for companies to maintain dozens or even hundreds of APIs, often spanning multiple teams, programming languages, and environments. This variability makes it extremely difficult to see what's happening at a high level to prevent changes from having negative impacts. + +It's estimated that 40% of large enterprises struggle with challenges to secure, scale, or ensure performance for APIs. Because of this, more and more companies are choosing to adopt a "spec-first development" approach by defining and documenting APIs in an external format like [OpenAPI][2]. Storing these documents together in a central location makes it much easier to design, discuss, and approve changes _before_ implementation. + +In this tutorial, you'll use the recently released [Insomnia Designer][3] to document an API, explore it, and propose a change using a spec-first approach. Designer is a cross-platform, open source REST client that builds on top of Insomnia Core—a popular app for interacting with HTTP and GraphQL APIs—aiming to make spec-first development more accessible by providing collaborative tools to organize, maintain, and validate API specs. In essence, Core is best for exploring and debugging APIs while Designer is best for designing and documenting them. + +In this how-to, you'll use the [Open Library API][4] as a base to have working examples to play with. You'll create a minimal OpenAPI spec to document the APIs, use Insomnia Designer to test and verify that what you've done is correct, and then make some design changes to the API using a spec-first approach. + +### The spec-first workflow + +Before you begin, you should understand the steps necessary to adopt a spec-first workflow. In spec-first development, a specification can be in one of two states: + + * **Published spec:** A specification that describes a currently published API exactly + * **Proposal spec:** A draft specification that contains changes that need to be implemented + + + +From this information, you can define a workflow for making changes to an API: + + 1. Start with the published specification for the API + 2. Make changes to the specification to add or modify behavior + 3. Review the proposal spec to ensure the design is sufficient + 4. Implement changes in code to match the proposal + 5. Publish the proposal spec along with the API + + + +Now that you understand the workflow for what you are trying to accomplish, open Insomnia Designer and start trying it out. + +### Define the initial specification + +Since you don't yet have a published specification for the Open Library API, you need to define one. + +Start by creating a new blank document from the **Create** menu, give it a name, then click to the document to enter **Design View**. From here, you can start editing your spec. + +![Create a new document][5] + +(Greg Schier, [CC BY-SA 4.0][6]) + +The OpenAPI spec is most commonly written in [YAML][7] format and requires four top-level blocks to get started: `openapi`, `info`, `servers`, and `paths`. The following example defines each of these blocks with helpful comments to describe the purpose of each. Also, the `paths` block defines a route for `GET /recentchanges.json`: + + +``` +# Specify that your document is the OpenAPI 3 format +openapi: 3.0.0 + +# Define high-level metadata for the API +info: +  version: 1.0.0 +  title: Open Library API +  description: Open Library has a RESTful API +  +# Specify the base URL the API can be accessed from +servers: +  - url: + +# Define operations for the API. This will be where most +# of the work is done. The first route you'll be defining +# is `GET /recentchanges.json` +paths: +  /recentchanges.json: +    get: +      summary: Recent Changes +``` + +OpenAPI provides much more than what's visible here, such as the ability to define authentication, response formats, reusable components, and more. + +After copying the specification above into Insomnia Designer, you'll see three columns: + + 1. **Navigation sidebar (left):** Nested menu to make navigating larger documents easier + 2. **Spec editor (middle):** Text editor for editing the YAML document + 3. **Documentation preview:** Generated documentation to preview the specification + + + +![Insomnia Designer UI with three columns][8] + +(Greg Schier, [CC BY-SA 4.0][6]) + +Feel free to modify different parts of the specification to see what happens. As a safeguard, Insomnia Designer alerts you when you've done something wrong. For example, if you accidentally delete the colon on line 18, an error panel will display below the editor. + +![Insomnia Designer UI error message][9] + +(Greg Schier, [CC BY-SA 4.0][6]) + +Now that you have defined a specification, you can verify that your definition is correct by switching to **Debug** mode and sending a real request to the API. In Debug mode, you can see a single route was generated for the `GET /recentchanges.json` endpoint. Click the **Send** button beside the URL to execute the request and render the response in the right panel. + +![Checking response in Insomnia Designer][10] + +(Greg Schier, [CC BY-SA 4.0][6]) + +There you have it! You've successfully verified that the API specification you created matches the production API. Now you can move to the next step in the spec-first development workflow and propose a change. + +### Create a proposal specification + +According to the workflow outlined above, changes made to your API should first be defined in the specification. This has a number of benefits: + + * Specifications can be checked into a central source-code repository + * Changes are easy to review and approve + * APIs are defined in a single, consistent format + * Unnecessary code changes are avoided + + + +Go ahead and propose a change to your API. While in Debug mode, I noticed the API returned hundreds of results. To improve performance and usability, it would be useful to limit the number of results returned to a specific amount. A common way of doing this is to accept a `limit` parameter in the query section of the URL, so go ahead and modify your specification to add a `limit` parameter. + +In OpenAPI, you can define this by adding a `parameters` block to the route**:** + + +``` +# ... +paths: +  /recentchanges.json: +    get: +      summary: Recent Changes +      +      # Add parameter to limit the number of results +      parameters: +        - name: limit +          in: query +          description: Limit number of results +          required: true +          schema: +            type: integer +            example: 1 +``` + +You can verify you defined it correctly by expanding the route within the preview and inspecting the parameters. + +![Verifying spec definition in Insomnia][11] + +(Greg Schier, [CC BY-SA 4.0][6]) + +### Review and implement the proposal + +Now that you have created a proposal spec, you can have your team review and approve the changes. Insomnia Designer provides the ability to [sync API specifications to source control][12], allowing teams to review and approve changes to API specs the same way they do with source code. + +For example, you might commit and push your proposed spec to a new branch in GitHub and create a pull request to await approval. + +Because this is a tutorial on spec-first development, you won't implement the proposal yourself. The parameter you added is already supported by the API, however, so for the purpose of this article, use your imagination and pretend that your team has implemented the change. + +### Verify the updated specification + +Once the proposal has been implemented and deployed, you can switch to Debug mode, which will regenerate the requests based on your changes, and again verify that the spec matches the production API. To ensure the new query param is being sent, click the **Query** tab within Debug mode and observe that the `limit` parameter is set to your example value of `1`. + +Once you send the request, you can verify that it returns only a single result. Change the `limit` to a different value or disable the query parameter (using the checkbox) to further verify things work as expected. + +![Verifying things work as expected in Insomnia Designer][13] + +(Greg Schier, [CC BY-SA 4.0][6]) + +### The power of spec-first development + +This tutorial walked through a simplified example of spec-first development. In it, you created an OpenAPI specification, verified the specification matched the implementation, and simulated what it's like to propose a behavior change. + +For a single API as simple as this demo, it may be difficult to see the full benefit of spec-first development. However, imagine being a product owner in a large organization managing hundreds of production APIs. Having well-documented specifications, accessible from a central location like Insomnia Designer, allows anyone within the organization to quickly get up to speed on any API. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/spec-first-development-apis + +作者:[Greg Schier][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://opensource.com/users/gregschier +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_space_graphic_cosmic.png?itok=wu493YbB (Computer laptop in space) +[2]: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md +[3]: https://insomnia.rest/products/designer +[4]: https://openlibrary.org/developers/api +[5]: https://opensource.com/sites/default/files/uploads/insomnia_newdocument.png (Create a new document) +[6]: https://creativecommons.org/licenses/by-sa/4.0/ +[7]: https://yaml.org/ +[8]: https://opensource.com/sites/default/files/uploads/insomnia_columns.png (Insomnia Designer UI with three columns) +[9]: https://opensource.com/sites/default/files/uploads/insomnia_error.png (Insomnia Designer UI error message) +[10]: https://opensource.com/sites/default/files/uploads/insomnia_response.png (Checking response in Insomnia Designer) +[11]: https://opensource.com/sites/default/files/uploads/insomnia_verifydefinition.png (Verifying spec definition in Insomnia) +[12]: https://support.insomnia.rest/article/96-git-sync +[13]: https://opensource.com/sites/default/files/uploads/insomnia_limit.png (Verifying things work as expected in Insomnia Designer) From 7d83d215efaf7e01d1f5087fcdde177f72af6b9e Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 9 Oct 2020 08:55:24 +0800 Subject: [PATCH 0381/1156] translated --- ...RAM and CPU Eating Tabs and Extensions).md | 89 ------------------- ...RAM and CPU Eating Tabs and Extensions).md | 89 +++++++++++++++++++ 2 files changed, 89 insertions(+), 89 deletions(-) delete mode 100644 sources/tech/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md create mode 100644 translated/tech/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md diff --git a/sources/tech/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md b/sources/tech/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md deleted file mode 100644 index 53895df57c..0000000000 --- a/sources/tech/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md +++ /dev/null @@ -1,89 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions)) -[#]: via: (https://itsfoss.com/firefox-task-manager/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions) -====== - -Firefox is popular among Linux users. It is the default web browser on several Linux distributions. - -Among many other features, Firefox provides a task manager of its own. - -Now, why would you use it when you have [task manager in Linux][1] in the form of [system monitoring tools][2]? There is a good reason for that. - -Suppose your system is taking too much of RAM or CPU. If you use top or some other system [resource monitoring tool like Glances][3], you’ll notice that these tools cannot distinguish the opened tabs or extensions. - -Usually, each Firefox tab is displayed as **Web Content**. You can see that some Firefox process is causing the issue but that’s no way to accurately determine which tab or extension it is. - -This is where you can use the Firefox task manager. Let me show you how! - -### Firefox Task Manager - -With Firefox Task Manager, you will be able to list all the tabs, trackers, and add-ons consuming system resources. - -![][4] - -As you can see in the screenshot above, you get the name of the tab, the type (tab or add-on), the energy impact, and the memory consumed. - -While everything is self-explanatory, the **energy impact refers to the CPU usage** and if you are using a Laptop, it is a good indicator to show you what will drain the battery quicker. - -#### Access Task Manager in Firefox - -Surprisingly, there is no [Firefox keyboard shortcut][5] for the task manager. - -To quickly launch Firefox Task Manager, you can type “**about:performance**” in the address bar as shown in the screenshot below. - -![Quickly access task manager in Firefox][6] - -Alternatively, you can click on the **menu** icon and then head on to “**More**” options as shown in the screenshot below. - -![Accessing task manager in Firefox][7] - -Next, you will find the option to select “**Task Manager**” — so just click on it. - -![][8] - -#### Using Firefox task manager - -Once there, you can check for the resource usage, expand the tabs to see the trackers and its usage, and also choose to close the tabs right there as highlighted in the screenshot below. - -![][9] - -Here’s what you should know: - - * Energy impact means CPU consumption. - * The subframes or the subtasks are usually the trackers/scripts associated with a tab that needs to run in the background. - - - -With this task manager, you can spot a rogue script on a site as well whether it’s causing your browser to slow down. - -This isn’t rocket-science but not many people are aware of Firefox task manager. Now that you know it, this should come in pretty handy, don’t you think? - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/firefox-task-manager/ - -作者:[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/task-manager-linux/ -[2]: https://itsfoss.com/linux-system-monitoring-tools/ -[3]: https://itsfoss.com/glances/ -[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/firefox-task-manager-shot.png?resize=800%2C519&ssl=1 -[5]: https://itsfoss.com/firefox-keyboard-shortcuts/ -[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/firefox-url-performance.jpg?resize=800%2C357&ssl=1 -[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/firefox-task-manager-steps.jpg?resize=800%2C779&ssl=1 -[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/firefox-task-manager-menu.jpg?resize=800%2C465&ssl=1 -[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/firefox-task-manager-close-tab.png?resize=800%2C496&ssl=1 diff --git a/translated/tech/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md b/translated/tech/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md new file mode 100644 index 0000000000..2519c7befc --- /dev/null +++ b/translated/tech/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions)) +[#]: via: (https://itsfoss.com/firefox-task-manager/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +如何使用 Firefox 任务管理器(查找并杀死占用内存和 CPU 的标签页和扩展程序) +====== + +Firefox 在 Linux 用户中很受欢迎。它是几个 Linux 发行版上的默认网络浏览器。 + +在许多其他功能中,Firefox 提供了一个自己的任务管理器。 + +现在,在 Linux 中既然你有[任务管理器][1]这种形式的[系统监控工具][2],为什么还要使用它呢?这是有一个很好的理由。 + +假设你的系统占用了太多的内存或 CPU。如果你使用 top 或其他一些系统[资源监控工具,如 Glances][3],你会发现这些工具无法区分打开的标签或扩展。 + +通常情况下,每个 Firefox 标签页都显示为 **Web 内容**。你可以看到是某个 Firefox 进程导致了这个问题,但这无法准确判断是哪个标签页或扩展。 + +这时你可以使用 Firefox 任务管理器。让我来告诉你怎么做! + +### Firefox 任务管理器 + +有了 Firefox 任务管理器,你就可以列出所有消耗系统资源的标签页、跟踪器和附加组件。 + +![][4] + +正如你在上面的截图中所看到的,你会看到标签页的名称、类型(标签或附加组件)、能源影响和消耗的内存。 + +虽然一切都明了,但**能源影响指的是 CPU 的使用**,如果你使用的是笔记本电脑,它是一个很好的指标,可以告诉你什么东西会更快耗尽电池。 + +#### 在 Firefox 中访问任务管理器 + +令人意外的是,任务管理器没有 [Firefox 键盘快捷键][5]。 + +要快速启动 Firefox 任务管理器,可以在地址栏中输入“**about:performance**”,如下图所示。 + +![Quickly access task manager in Firefox][6] + +另外,你也可以点击**菜单**图标,然后进入“**更多**“选项,如下截图所示。 + +![Accessing task manager in Firefox][7] + +接下来,你会发现选择”**任务管理器**”的选项,只需点击它就行。 + +![][8] + +#### 使用 Firefox 任务管理器 + +到这后,你可以检查资源的使用情况,展开标签页来查看跟踪器和它的使用情况,也可以选择关闭标签,如下截图高亮所示。 + +![][9] + +以下是你应该知道的: + + * 能源影响指的是 CPU 消耗。 + * 子框架或子任务通常是与需要在后台运行的标签相关联的跟踪器/脚本。 + + + +通过这个任务管理器,你可以发现网站上的流氓脚本,以及它是否导致你的浏览器变慢。 + +这并不是什么火箭科学,但并不是很多人都知道 Firefox 任务管理器。现在你知道了,它应该很方便,你觉得呢? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/firefox-task-manager/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者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/task-manager-linux/ +[2]: https://itsfoss.com/linux-system-monitoring-tools/ +[3]: https://itsfoss.com/glances/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/firefox-task-manager-shot.png?resize=800%2C519&ssl=1 +[5]: https://itsfoss.com/firefox-keyboard-shortcuts/ +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/firefox-url-performance.jpg?resize=800%2C357&ssl=1 +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/firefox-task-manager-steps.jpg?resize=800%2C779&ssl=1 +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/firefox-task-manager-menu.jpg?resize=800%2C465&ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/firefox-task-manager-close-tab.png?resize=800%2C496&ssl=1 From 7c8f76a3999ee669566ad0a22935d972044fd6ff Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 9 Oct 2020 09:03:29 +0800 Subject: [PATCH 0382/1156] translating --- ...sent Slides in Linux Terminal With This Nifty Python Tool.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md b/sources/tech/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md index 5a100c8d23..f1a50b278b 100644 --- a/sources/tech/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md +++ b/sources/tech/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From cf85d8a8cba6a7578a8deffc301d57b4a66ee39e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 9 Oct 2020 19:50:18 +0800 Subject: [PATCH 0383/1156] PRF @lxwolf --- ...or website errors with this Python tool.md | 85 +++++++++---------- 1 file changed, 38 insertions(+), 47 deletions(-) diff --git a/translated/tech/20200723 Automate testing for website errors with this Python tool.md b/translated/tech/20200723 Automate testing for website errors with this Python tool.md index 5d69bf3c03..5704c1521f 100644 --- a/translated/tech/20200723 Automate testing for website errors with this Python tool.md +++ b/translated/tech/20200723 Automate testing for website errors with this Python tool.md @@ -1,33 +1,34 @@ [#]: collector: "lujun9972" [#]: translator: "lxbwolf" -[#]: reviewer: " " +[#]: reviewer: "wxy" [#]: publisher: " " [#]: url: " " [#]: subject: "Automate testing for website errors with this Python tool" [#]: via: "https://opensource.com/article/20/7/seodeploy" [#]: author: "JR Oakes https://opensource.com/users/jroakes" -使用这个 Python 工具对网站错误进行自动化测试 +使用这个 Python 工具对网站 SEO 问题进行自动化测试 ====== -SEODeploy 可以帮助我们在网站部署之前识别出 SEO 问题。 -![Computer screen with files or windows open][1] -作为一个有技术的搜索引擎优化开发者,我经常被请来协助做网站迁移、新网站启动、分析实现和一些其他影响网站线上可视性和控制风险的测量方法的工作。很多公司从用户通过搜索引擎查到他们的产品和服务这个途径每月都能获得大量的收入。虽然搜索引擎已经能妥善地处理没有被很好地格式化的代码,但是在开发过程中影响搜索引擎索引和用户展示页的问题还是会发生。 +> SEODeploy 可以帮助我们在网站部署之前识别出 SEO 问题。 -我曾经也尝试通过评审各阶段会破坏SEO(搜索引擎优化search engine optimization)的问题来手动降低这种风险。我的团队最终查到的结果,决定该项目是否可以上线。但这个过程通常很低效,只能依靠有限的几个页面,且人工极易出错。 +![](https://img.linux.net.cn/data/attachment/album/202010/09/194928xbqvdd81amapgdae.jpg) -长期以来,这个行业一直在寻找可用且值得信赖的方式,在开发者和搜索引擎优化者可以指定必须测试的内容的前提下进行自动化测试。这是非常重要的,因为这些组在开发过程中优先级通常会发生冲突,搜索引擎优化者提交修改的同时,开发者也需要进行回归测试和控制预期之外的情况。 +作为一个技术性搜索引擎优化开发者,我经常被请来协助做网站迁移、新网站发布、分析实施和其他一些影响网站在线可见性和测量等领域,以控制风险。许多公司每月经常性收入的很大一部分来自用户通过搜索引擎找到他们的产品和服务。虽然搜索引擎已经能妥善地处理没有被良好格式化的代码,但在开发过程中还是会出问题,对搜索引擎如何索引和为用户显示页面产生不利影响。 + +我曾经也尝试通过评审各阶段会破坏 SEO(搜索引擎优化search engine optimization)的问题来手动降低这种风险。我的团队最终审查到的结果,决定了该项目是否可以上线。但这个过程通常很低效,只能用于有限的页面,而且很有可能出现人为错误。 + +长期以来,这个行业一直在寻找可用且值得信赖的方式来自动化这一过程,同时还能让开发人员和搜索引擎优化人员在必须测试的内容上获得有意义的发言权。这是非常重要的,因为这些团队在开发冲刺中优先级通常会发生冲突,搜索引擎优化者需要推动变化,而开发人员需要控制退化和预期之外的情况。 ### 常见的破坏 SEO 的问题 -我见过的很多网站有成千上万的页面,甚至上百万。实在令人费解,为什么一个开发过程中的改动能影响这么多页面。在 SEO 的世界中, Google 或其他搜索引擎展示你的页面时,一个非常微小和看起来无关紧要的修改也可能导致全网站范围的变化。在部署到生产环境之前,必须要处理这类错误。 +我合作过的很多网站有成千上万的页面,甚至上百万。实在令人费解,为什么一个开发过程中的改动能影响这么多页面。在 SEO 的世界中,Google 或其他搜索引擎展示你的页面时,一个非常微小和看起来无关紧要的修改也可能导致全网站范围的变化。在部署到生产环境之前,必须要处理这类错误。 下面是我去年见过的几个例子。 #### 偶发的 noindex -我们用的一个专用的第三方 SEO 监控工具,[ContentKing][2],在部署到生产环境之后马上发现了这个问题。这个错误很隐蔽,因为在 HTML 中是不可见的,确切地说,它隐藏在服务器响应头里,但它能很快导致搜索不可见。 - +在部署到生产环境之后,我们用的一个专用的第三方 SEO 监控工具 [ContentKing][2] 马上发现了这个问题。这个错误很隐蔽,因为它在 HTML 中是不可见的,确切地说,它隐藏在服务器响应头里,但它能很快导致搜索不可见。 ``` HTTP/1.1 200 OK @@ -39,85 +40,75 @@ X-Robots-Tag: noindex #### canonical 小写 -上线时错误地把整个网站的 [canonical 标签元素][3]全改成小写了。这个改动影响了接近 30000 个 URL。在修改之前,所有的 URL 大小写都正常(例如,`URL-Path`)。这之所以是个问题是因为 canonical 标签元素是用来给 Google 提示一个网页真实的 canonical URL 版本的。这个改动导致很多 URL 被从 Google 的索引中移除并用小写(`/url-path`)重新建立索引。影响范围是流量损失了 10% 到 15%,也污染了未来几个星期的网页监控数据。 +上线时错误地把整个网站的 [canonical 链接元素][3]全改成小写了。这个改动影响了接近 30000 个 URL。在修改之前,所有的 URL 大小写都正常(例如 `URL-Path` 这样)。这之所以是个问题是因为 `canonical` 链接元素是用来给 Google 提示一个网页真实的规范 URL 版本的。这个改动导致很多 URL 被从 Google 的索引中移除并用小写的版本(`/url-path`)重新建立索引。影响范围是流量损失了 10% 到 15%,也污染了未来几个星期的网页监控数据。 -#### origin 的退化 +#### 源站退化 -一个有复杂、React 的奇特实现的网站有个神奇的问题,`origin.domain.com` URL 退化为显示原始的内容交付网络服务器。它会间歇性地显示原始的主机而不是网站元数据中的边缘主机(如 canonical 标签元素、URL 和 Open Graph 标签)。这个问题在原始的 HTML 和渲染后的 HTML 中都存在。这个问题影响搜索的可见度和在社交媒体上分享的质量。 +有个网站的 React 实现复杂而奇特,它有个神奇的问题,`origin.domain.com` URL 退化显示为 CDN 服务器的源站。它会在网站元数据(如 `canonical` 链接元素、URL 和 Open Graph 链接)中间歇性地显示原始的主机而不是 CDN 边缘主机。这个问题在原始的 HTML 和渲染后的 HTML 中都存在。这个问题影响搜索的可见性和在社交媒体上的分享质量。 ### SEODeploy 介绍 -SEO 通常使用差异测试工具来检测渲染后和原始的 HTML 的差异。差异测试是很理想的,因为它避免了肉眼测试的不确定性。你希望检查 Google 对你的页面的渲染过程的不同,而不是检查用户对你页面的渲染。你希望查看下原始的 HTML 是什么样的,而不是渲染后的 HTML,因为 Google 的渲染过程是有独立的两个阶段的。 +SEO 通常使用差异测试工具来检测渲染后和原始的 HTML 的差异。差异测试是很理想的,因为它避免了肉眼测试的不确定性。你希望检查 Google 对你的页面的渲染过程的差异,而不是检查用户对你页面的渲染。你希望查看下原始的 HTML 是什么样的,而不是渲染后的 HTML,因为 Google 的渲染过程是有独立的两个阶段的。 -这导致我和我的同事创造了 [SEODeploy][4] 这个“在部署流水线中用于自动化 SEO 测试的 Python 库。”我们的使命是: +这促使我和我的同事创造了 [SEODeploy][4] 这个“在部署流水线中用于自动化 SEO 测试的 Python 库。”我们的使命是: -> 开发一个工具,让开发者能通过修改 URL 路径在生产环境和分阶段的主机上进行差异测试,尤其是对 SEO 相关数据的非预期的退化的测试。 +> 开发一个工具,让开发者能提供若干 URL 路径,并允许这些 URL 在生产环境和预演环境的主机上进行差异测试,尤其是对 SEO 相关数据的非预期的退化。 -SEODeploy 的机制很简单:提供一个每行内容都是 URL 路径的文本文件,SEODeploy 对那些路径跑一系列的模块,对比生产环境和保存的 URL,把检测到的所有的错误和改动信息报告出来。 +SEODeploy 的机制很简单:提供一个每行内容都是 URL 路径的文本文件,SEODeploy 对那些路径运行一系列模块,对比生产环境production预演环境staging的 URL,把检测到的所有的错误和改动信息报告出来。 ![SEODeploy overview][5] -(SEODeploy, [CC BY-SA 4.0][6]) - -这个工具及其模块可以用一个 YAML 文件来配置,在可预期的范围内可以自定义。 +这个工具及其模块可以用一个 YAML 文件来配置,可以根据预期的变化进行定制。 ![SEODeploy output][7] -(SEODeploy, [CC BY-SA 4.0][6]) - 最初的发布版本包含下面的的核心功能和概念: - 1. **开源**:我们坚信分享代码可以被大家评论、改进、扩展、分享和复用。 - 2. **模块化**:Web 开发中有很多边界条件。SEODeploy 工具在概念上很简单,因此模块化用来控制复杂性。我们提供了两个建好的模块和一个实例模块来简述基本结构。 + 1. **开源**:我们坚信分享代码可以被大家批评、改进、扩展、分享和复用。 + 2. **模块化**:Web 开发中有许多不同的堆栈和边缘案例。SEODeploy 工具在概念上很简单,因此采用模块化用来控制复杂性。我们提供了两个建好的模块和一个实例模块来简述基本结构。 3. **URL 抽样:**由于它不是对所有 URL 都是可行和有效的,因此我们引入了一种随机抽取 XML 网站地图 URL 或被 ContentKing 监控的 URL 作为样本的方法。 - 4. **灵活的差异检测**:Web 数据是凌乱的。无论被检测的数据是什么类型(如 延伸文件系统、数组或列表、JSON 对象或字典、整数、浮点数等等),差异检测功能都会尝试将这些数据转换为差异信息。 + 4. **灵活的差异检测**:Web 数据是凌乱的。无论被检测的数据是什么类型(如 ext、数组或列表、JSON 对象或字典、整数、浮点数等等),差异检测功能都会尝试将这些数据转换为差异信息。 5. **自动化**: 你可以在命令行来调用抽样和运行方法,将 SEODeploy 融合到已有的流水线也很简单。 - - ### 模块 -虽然核心功能很简单,但在设计上,SEODeploy 的强大功能和复杂度体现在模块上。模块用来处理获取、清理和组织暂存区和生产服务器上的数据来作对比时难度更大的任务。 +虽然核心功能很简单,但在设计上,SEODeploy 的强大功能和复杂度体现在模块上。模块用来处理更难的任务:获取、清理和组织预演服务器和生产服务器上的数据来作对比。 #### Headless 模块 -[Headless 模块][8] 是为那些从库里获取数据时不想为第三方服务付费的开发者准备的。它可以在任意版本的 Chrome 上运行,会从每组用来比较的 URL 中提取渲染的数据。 +[Headless 模块][8] 是为那些从库里获取数据时不想为第三方服务付费的开发者准备的。它可以运行任意版本的 Chrome,会从每组用来比较的 URL 中提取渲染的数据。 -headless 模块会提取下面的核心数据用来比较: +Headless 模块会提取下面的核心数据用来比较: - 1. SEO 内容,如 标题、头、标签等等。 - 2. Performance data from the Chrome Timings and Chrome DevTools Protocol (CDP) Performance APIs从Chrome 读写周期和 CDP(Chrome 开发工具协议Chrome DevTools Protocol)性能 API 中提取性能数据 - 3. 经过计算的性能监控,包括 CLS,一项由 Google 最近发布的很受欢迎的 [Web 核心数据][9] - 4. 从 CDP 覆盖率 API 获取的 CSS 和 JavaScript 的覆盖率数据 + 1. SEO 内容,如标题、H1-H6、链接等等。 + 2. 从 Chrome 计时器Timings和 CDP(Chrome 开发工具协议Chrome DevTools Protocol)性能 API 中提取性能数据 + 3. 计算出的性能指标,包括 CLS(累积布局偏移Cumulative Layout Shift),这是 Google 最近发布的一个很受欢迎的 [Web 核心数据][9] + 4. 从上述 CDP 的覆盖率 API 获取的 CSS 和 JavaScript 的覆盖率数据 - - -这个模块引入了处理暂存区、网络速度预设(为了让对比更规范化)等功能,也引入了一个处理在暂存的对比数据中替换临时主机的方法。开发者也能很容易地扩展这个模块,来获取他们想对任意网页进行对比的数据。 +这个模块引入了处理预演环境、网络速度预设(为了让对比更规范化)等功能,也引入了一个处理在预演对比数据中替换预演主机的方法。开发者也能很容易地扩展这个模块,以收集他们想要在每个页面上进行比较的任何其他数据。 #### 其他模块 -我们为开发者创建了一个[示例模块][10],开发者可以参照它来使用框架创建一个自定义的提取模块。这个示例模块也是与 ContentKing 结合的。ContentKing 模块需要订阅 ContentKing,Headless 可以在所有能运行 Chrome 的机器上运行。 +我们为开发者创建了一个[示例模块][10],开发者可以参照它来使用框架创建一个自定义的提取模块。另一个示例模块是与 ContentKing 结合的。ContentKing 模块需要有 ContentKing 订阅,而 Headless 可以在所有能运行 Chrome 的机器上运行。 ### 需要解决的问题 -我们有扩展和强化工具库的[计划][11],但是我们看到了开发者们对于能满足和不能满足他们需求的[反馈][12]。我们正在解决的问题和条目有: +我们有扩展和强化工具库的[计划][11],但正在寻求开发人员的[反馈][12],了解哪些是可行的,哪些是不符合他们的需求。我们正在解决的问题和条目有: - 1. 对于某些对比元素(尤其是 schema),动态时间戳产生假阳性。 - 2. 把测试数据保存到数据库,以便查看部署历史以及与上次暂存的推送进行差异测试。 - 3. 借助渲染相关的云基础设施强化提取的精度和速度。 + 1. 对于某些对比元素(尤其是 schema),动态时间戳会产生误报。 + 2. 把测试数据保存到数据库,以便查看部署历史以及与上次的预演推送进行差异测试。 + 3. 通过云基础设施的渲染,强化提取的规模和速度。 4. 把测试覆盖率从现在的 46% 提高到 99% 以上。 5. 目前,我们依赖 [Poetry][13] 进行部署管理,但我们希望发布一个 PyPl 库,这样就可以用 `pip install` 轻松安装。 6. 我们还在关注更多使用时的问题和相关数据。 - - ### 开始使用 这个项目在 [GitHub][4] 上,我们对大部分功能都提供了 [文档][14]。 -我们希望你能克隆 SEODeploy 并为其贡献代码。我们的目标是通过这个由技术精湛的搜索引擎优化开发者开发的、经过开发者和工程师们认证的工具来为开源作贡献。我们都见过验证复杂的暂存问题需要多长时间,也都见过大量 URL 的微小改动能有什么样的商业影响。我们认为这个库可以节省时间、为开发团队降低部署过程中的风险。 +我们希望你能克隆 SEODeploy 并试试它。我们的目标是通过这个由技术性搜索引擎优化开发者开发的、经过开发者和工程师们验证的工具来支持开源社区。我们都见过验证复杂的预演问题需要多长时间,也都见过大量 URL 的微小改动能有什么样的业务影响。我们认为这个库可以为开发团队节省时间、降低部署过程中的风险。 -If you have questions, issues, or want to contribute, please see the project's [About page][15].如果你有问题或者想提交代码,请查看项目的[关于][15]。 +如果你有问题或者想提交代码,请查看项目的[关于][15]页面。 -------------------------------------------------------------------------------- @@ -126,7 +117,7 @@ via: https://opensource.com/article/20/7/seodeploy 作者:[JR Oakes][a] 选题:[lujun9972][b] 译者:[lxbwolf](https://github.com/lxbwolf) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From aa270883c03f08b6f99a7948c99342f15587c0af Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 9 Oct 2020 19:51:43 +0800 Subject: [PATCH 0384/1156] PUB @lxbwolf https://linux.cn/article-12700-1.html --- ...tomate testing for website errors with this Python tool.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200723 Automate testing for website errors with this Python tool.md (99%) diff --git a/translated/tech/20200723 Automate testing for website errors with this Python tool.md b/published/20200723 Automate testing for website errors with this Python tool.md similarity index 99% rename from translated/tech/20200723 Automate testing for website errors with this Python tool.md rename to published/20200723 Automate testing for website errors with this Python tool.md index 5704c1521f..4f9f38479b 100644 --- a/translated/tech/20200723 Automate testing for website errors with this Python tool.md +++ b/published/20200723 Automate testing for website errors with this Python tool.md @@ -1,8 +1,8 @@ [#]: collector: "lujun9972" [#]: translator: "lxbwolf" [#]: reviewer: "wxy" -[#]: publisher: " " -[#]: url: " " +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12700-1.html" [#]: subject: "Automate testing for website errors with this Python tool" [#]: via: "https://opensource.com/article/20/7/seodeploy" [#]: author: "JR Oakes https://opensource.com/users/jroakes" From c31621d3e2bb55ab7a89cc7e4ce43acd2ac5710e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 9 Oct 2020 19:56:39 +0800 Subject: [PATCH 0385/1156] PRF --- ...Automate testing for website errors with this Python tool.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20200723 Automate testing for website errors with this Python tool.md b/published/20200723 Automate testing for website errors with this Python tool.md index 4f9f38479b..5b0284b231 100644 --- a/published/20200723 Automate testing for website errors with this Python tool.md +++ b/published/20200723 Automate testing for website errors with this Python tool.md @@ -66,7 +66,7 @@ SEODeploy 的机制很简单:提供一个每行内容都是 URL 路径的文 1. **开源**:我们坚信分享代码可以被大家批评、改进、扩展、分享和复用。 2. **模块化**:Web 开发中有许多不同的堆栈和边缘案例。SEODeploy 工具在概念上很简单,因此采用模块化用来控制复杂性。我们提供了两个建好的模块和一个实例模块来简述基本结构。 - 3. **URL 抽样:**由于它不是对所有 URL 都是可行和有效的,因此我们引入了一种随机抽取 XML 网站地图 URL 或被 ContentKing 监控的 URL 作为样本的方法。 + 3. **URL 抽样**:由于它不是对所有 URL 都是可行和有效的,因此我们引入了一种随机抽取 XML 网站地图 URL 或被 ContentKing 监控的 URL 作为样本的方法。 4. **灵活的差异检测**:Web 数据是凌乱的。无论被检测的数据是什么类型(如 ext、数组或列表、JSON 对象或字典、整数、浮点数等等),差异检测功能都会尝试将这些数据转换为差异信息。 5. **自动化**: 你可以在命令行来调用抽样和运行方法,将 SEODeploy 融合到已有的流水线也很简单。 From 5324813a4987c3542015378a0e9480feb904f653 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 9 Oct 2020 21:54:09 +0800 Subject: [PATCH 0386/1156] Rename sources/tech/20201007 Telcos Move from Black boxes to Open Source.md to sources/talk/20201007 Telcos Move from Black boxes to Open Source.md --- .../20201007 Telcos Move from Black boxes to Open Source.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20201007 Telcos Move from Black boxes to Open Source.md (100%) diff --git a/sources/tech/20201007 Telcos Move from Black boxes to Open Source.md b/sources/talk/20201007 Telcos Move from Black boxes to Open Source.md similarity index 100% rename from sources/tech/20201007 Telcos Move from Black boxes to Open Source.md rename to sources/talk/20201007 Telcos Move from Black boxes to Open Source.md From 23153c413e6ffe2f7fb53c9ddfab41aae80ab5de Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 10 Oct 2020 05:01:43 +0800 Subject: [PATCH 0387/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201010?= =?UTF-8?q?=206=20Essential=20Things=20To=20Do=20After=20Installing=20Manj?= =?UTF-8?q?aro=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201010 6 Essential Things To Do After Installing Manjaro Linux.md --- ...gs To Do After Installing Manjaro Linux.md | 134 ++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 sources/tech/20201010 6 Essential Things To Do After Installing Manjaro Linux.md diff --git a/sources/tech/20201010 6 Essential Things To Do After Installing Manjaro Linux.md b/sources/tech/20201010 6 Essential Things To Do After Installing Manjaro Linux.md new file mode 100644 index 0000000000..d5c7b4a38e --- /dev/null +++ b/sources/tech/20201010 6 Essential Things To Do After Installing Manjaro Linux.md @@ -0,0 +1,134 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 Essential Things To Do After Installing Manjaro Linux) +[#]: via: (https://itsfoss.com/things-to-do-after-installing-manjaro/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +6 Essential Things To Do After Installing Manjaro Linux +====== + +So, you just did a [fresh installation of Manjaro Linux][1]. Now what? + +Here are a few essential post installation steps I recommend you to follow. + +Quite honestly, these are the things I prefer to do after installing Manjaro. Yours could differ depending on your need. + +### Recommended Things To Do After Installing Manjaro Linux + +![][2] + +I am using Manjaro Xfce edition but the steps are applicable to other desktop variants of [Manjaro][3] as well. + +#### 1\. Set the fastest mirror + +Before even updating your system, I suggest to sort out your mirror list first. When refreshing the Manjaro system and downloading software from repositories, an optimized mirror list can have noticeable performance impact to the system. + +Open the Terminal emulator and type the following command: + +``` +sudo pacman-mirrors --fasttrack +``` + +![][4] + +#### 2\. Update your system + +Keeping your system up-to-date reduces the chances of security vulnerabilities. Refreshing your system repository is also a recommended thing to do before installing new software. + +You can [update your Manjaro system][5] by running the following command. + +``` +sudo pacman -Syu +``` + +![][6] + +#### 3\. Enable AUR, Snap or Flatpak support + +[Arch User Repository (AUR)][7] is one of the main reasons that a user chooses an [Arch-based system][8]. It gives you access to a huge number of additional software. + +Optionally, you can also enable support for [Snaps][9] and [Flatpaks][10] directly from Pamac GUI package manager. + +![][11] + +#### 4\. Enable TRIM (SSD only) + +If your root partition has been installed on SSD, enabling [TRIM][12] is one thing you need to do after installing Manjaro. TRIM helps to clean blocks in your SSD and extend the lifespan of your SSD. + +To enable TRIM on Manjaro, run the following command in a terminal: + +``` +sudo systemctl enable fstrim.timer +``` + +![][13] + +#### 5\. Installing a kernel of your choice (advanced users) + +One of the topics that I covered in my [Manjaro Linux review][14], is how easily you can switch kernels through a graphical interface. + +Do you prefer to use the command line? You can list the installed kernel(s) on your system and install a kernel using your terminal. + +To list the installed kernels: + +``` +mhwd-kernel -li +``` + +**To install a new kernel** (the latest to date 5.8 kernel for example)**:** + +``` +sudo mhwd-kernel -i linux58 +``` + +![][15] + +#### 6\. Install Microsoft true type fonts (if you need it) + +I have to often edit the work documents on my personal computer and hence I need the Microsoft fonts like Times New Roman or Arial. + +If you also need to use Microsoft fonts, you can access the [package][16] from [AUR][7]. If you want to use the command line for AUR packages, you can install an [AUR helper][17]. + +![][18] + +#### Conclusion + +[Manjaro is a great distribution][19] if you want to use the benefits of Arch Linux on a pre-configured, desktop optimized distribution. Though it comes pre-configured with many essentials, there are a few steps that cannot be done in advance, as everyone has a different setup and different needs. + +Please let us know in the comments below, which step apart from the already mentioned is the essential for you. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/things-to-do-after-installing-manjaro/ + +作者:[Dimitrios Savvopoulos][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/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/install-manjaro-linux/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/things-to-do-after-installing-manjaro.jpg?resize=800%2C450&ssl=1 +[3]: https://manjaro.org +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/manjaro-fasttrack.png?resize=800%2C600&ssl=1 +[5]: https://itsfoss.com/update-arch-linux/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/sudo-pacman-Syu.png?resize=800%2C504&ssl=1 +[7]: https://itsfoss.com/aur-arch-linux/ +[8]: https://itsfoss.com/arch-based-linux-distros/ +[9]: https://itsfoss.com/use-snap-packages-ubuntu-16-04/ +[10]: https://itsfoss.com/flatpak-guide/ +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/pamac-2.png?resize=800%2C600&ssl=1 +[12]: https://en.wikipedia.org/wiki/Trim_(computing) +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/fstrim.timer_.png?resize=800%2C600&ssl=1 +[14]: https://itsfoss.com/manjaro-linux-review/ +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/manjaro-cli-kernels.png?resize=800%2C600&ssl=1 +[16]: https://aur.archlinux.org/packages/ttf-ms-fonts +[17]: https://itsfoss.com/best-aur-helpers/ +[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/08/ttf-ms-fonts.png?resize=800%2C600&ssl=1 +[19]: https://itsfoss.com/why-use-manjaro-linux/ From 0532c9b062612cea73d5152abab3c075c308564a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 10 Oct 2020 05:02:11 +0800 Subject: [PATCH 0388/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201009?= =?UTF-8?q?=20My=20open=20source=20video=20game=20for=20Open=20Jam?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201009 My open source video game for Open Jam.md --- ... My open source video game for Open Jam.md | 235 ++++++++++++++++++ 1 file changed, 235 insertions(+) create mode 100644 sources/tech/20201009 My open source video game for Open Jam.md diff --git a/sources/tech/20201009 My open source video game for Open Jam.md b/sources/tech/20201009 My open source video game for Open Jam.md new file mode 100644 index 0000000000..e4929f98ab --- /dev/null +++ b/sources/tech/20201009 My open source video game for Open Jam.md @@ -0,0 +1,235 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My open source video game for Open Jam) +[#]: via: (https://opensource.com/article/20/10/open-source-game) +[#]: author: (Klaatu https://opensource.com/users/klaatu) + +My open source video game for Open Jam +====== +Step through a game programmed for Open Jam 2020 to get tips for your +own design. +![Gaming with penguin pawns][1] + +This year, I joined in on the [Open Jam][2], a "game jam" in which programmers around the world dedicate a weekend to create open source games. The jam is essentially an excuse to spend a weekend coding, and the majority of the games that come out of the challenge are small distractions rather than something you're likely to play for hours on end. But they're fun, diverse, and open source, and that's a pretty good feature list for a game. + +The game I submitted is [Unveil][3], a calming puzzle game in which the player must first discover the goal, and then work to achieve it with the greatest number of points. Because part of the game is the discovery process, I won't reveal any more about the gameplay than that. + +![Unveil game][4] + +(Klaatu, [CC BY-SA 4.0][5]) + +The whole game is only 338 lines, written in [Python][6] using the [Pygame][6] module. It's, of course, open source, and part of it may serve as a good introduction to a few programming concepts that used to confound me (two-dimensional arrays being the most significant). For simple game design, a two-dimensional array is very useful because so many enduring games are built on them. You can probably think of several, although if you don't know what a two-dimensional array is, you may not realize it. + +### Arrays in gaming + +An array is a collection of data. An array can be listed across a page or an X-axis (in mathematical terms). For instance: + + +``` +`artichoke, lettuce, carrot, aubergine, potato` +``` + +An array may also be represented as a list or a Y-axis: + + +``` +artichoke +lettuce +carrot +aubergine +potato +``` + +This is a one-dimensional array. A two-dimensional array extends on both the X-axis and Y-axis. + +Here's a common two-dimensional array seen in the world of board games: + +![Chess][7] + +(Klaatu, [CC BY-SA 4.0][5]) + +Yes, two-dimensional arrays are used as the board for chess, draughts, noughts and crosses (also called tic-tac-toe), [RPG battle maps][8], [minesweeper][9], Carcassonne, Forbidden Island, and in slightly modified forms, games like Monopoly and even [Ur][10] (literally the oldest game we know of). + +If you can comfortably create a two-dimensional array, you have a great start at programming any number of games. + +### Creating tiles in Pygame + +If you're not familiar with Python, you should take some time to review this [Python (and Pygame) introductory series][11]. If you feel confident enough to translate code to other libraries, though, there's nothing specific to Pygame in the "important" parts of this code (the array constructor), so you can use any library or language. + +For simplicity, I'll call the individual squares in the game board array _tiles_. To construct a two-dimensional array, or game board as the case may be, you must have tiles. In object-oriented programming, you consider each component as a unique object based upon a template (or _class_, in programming terminology). So, before creating the game board, you must first create the infrastructure for the board's building blocks: tiles. + +First, set up a simple Pygame project, creating a display (your window into the game world), a group to represent the game board, and a few standard variables: + + +``` +import pygame + +pygame.init() +game_world = pygame.display.set_mode((960, 720)) +game_board = pygame.sprite.Group() + +running = True +black = (0, 0, 0) +white = (255, 255, 255) +red = (245, 22, 22) +world_x = 960 +world_y = 720 +``` + +Next, create a `Tile` class to establish the template from which each tile gets cast. The first function initializes a new tile when one is created and gives it the necessary basic fields: width, height, an image (actually, I just filled it with the color white), and whether or not it's active. In this case, I use `is_pressed`, as if the tile is a button, because that's what it'll look like when the code is finished: when the user clicks a tile, it changes color as if it were a button being lit up. For other purposes, this state needn't be visible. In chess, for example, you might instead have a field to represent whether a tile is occupied and, if so, by what kind of chess piece. + + +``` +class Tile(pygame.sprite.Sprite): +    def __init__(self, x, y, w, h, c): +        pygame.sprite.Sprite.__init__(self) +        self.image = pygame.Surface((w, h)) +        self.image.fill(c) +        self.rect = self.image.get_rect() +        self.rect.x = x +        self.rect.y = y +        self.is_pressed = False +``` + +The second function is an update function. Specifically, it checks whether a tile has been clicked by the user. This requires mouse coordinates, which you'll get later in the code during the event loop. + +For this demonstration, I'll make this function fill the tile with the color red when it's in the `is_pressed` state and back to white otherwise: + + +``` +    def was_clicked(self, mouse): +        if self.rect.collidepoint(mouse) and not self.is_pressed: +            self.image.fill(red) +            self.is_pressed = True +        elif self.rect.collidepoint(mouse) and self.is_pressed: +            self.image.fill(white) +            self.is_pressed = False +        else: +            return False +``` + +### Main loop + +This demo's main loop is simple. It checks for two kinds of input: a quit signal and a mouse down (click) event. When it detects a mouse click, it calls the `was_clicked` function to react (filling it with red or white, depending on its current state). + +Finally, the screen fills with black, the game board state is updated, and the screen is redrawn: + + +``` +""" +holding place for game board construction +""" + +while running: +    for event in pygame.event.get(): +        if event.type == pygame.QUIT: +            running = False + +        elif event.type == pygame.MOUSEBUTTONDOWN: +            for hitbox in game_board: +                hitbox.was_clicked(event.pos) + +    game_world.fill(black) +    game_board.update() +    game_board.draw(game_world) +    pygame.display.update() + +pygame.quit() +``` + +### Board construction + +To build a two-dimensional array, you must first decide how many tiles you want in both directions. I'll use eight for this example because that's how a chessboard is constructed, but you could use fewer or more. You could even accept arguments at launch to define the array's size depending on options, such as `--row` and `--column:` + + +``` +rows = 8 +columns = 8 +``` + +Because you don't know the size of the board, you must calculate the width of the rows and columns based on the size of your display. I also include one pixel of padding between each tile, because, without a gap, it looks like one big block of color: + + +``` +column_width = world_x / columns +row_height = world_y / rows +pad = 1 +``` + +Laying out tiles across the display is simple. Of course, this isn't the goal, as it only draws along the X-axis, but it's a good start: + + +``` +j = 0 + +while j < rows: +    tile = Tile(j * column_width, row_height, column_width - pad, row_height - pad, white) +    game_board.add(tile) +    j += 1 +``` + +The idea is that the variable `j` starts at 0, so the first tile is placed from 0 to `column_width`, less the value of the padding. Then the variable `j` is incremented to 1, so the next tile is placed at 1 times the value of `column_width`, and so on. + +You can run that code to see the partial success it renders. What this solution obviously lacks is any awareness of further rows. + +Use a second counter variable to track rows: + + +``` +j = 0 +k = 0 + +while j < rows: +    while k < columns: +        tile = Tile(k * column_width, j * row_height, column_width - pad, row_height - pad, white) +        game_board.add(tile) +        k += 1 +    j += 1 +    k = 0 +``` + +In this code block, which achieves the desired result, each tile is positioned in a space determined by the current value of either `j` or `k`. + +The `k` variable is incremented within its loop so that each tile is progressively placed along the X-axis. + +The `j` variable is incremented outside the nested loop so that everything gets moved down one row. + +The `k` variable is then set to 0 so that when the inner loop starts again, everything is shunted back to the far left of the screen. + +![2D array][12] + +(Klaatu, [CC BY-SA 4.0][5]) + +### Easy arrays + +Creating a grid can seem mathematically and syntactically intensive, but with this example plus a little bit of thought about what result you want, you can generate them at will. The only thing left for you to do now is to create a game around it. That's what I did, and you're welcome to play it by downloading it from its home on [Itch.io][3] or from its source repository on [git.nixnet.xyz][13]. Enjoy! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/open-source-game + +作者:[Klaatu][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://opensource.com/users/klaatu +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/gaming_grid_penguin.png?itok=7Fv83mHR (Gaming with penguin pawns) +[2]: http://openjam.io +[3]: https://notklaatu.itch.io/unveil +[4]: https://opensource.com/sites/default/files/uploads/unveil-2.jpg (Unveil game) +[5]: https://creativecommons.org/licenses/by-sa/4.0/ +[6]: https://www.python.org/ +[7]: https://opensource.com/sites/default/files/uploads/chess.jpg (Chess) +[8]: https://opensource.com/article/18/5/maptool +[9]: https://opensource.com/article/19/9/advanced-bash-building-minesweeper +[10]: https://otagomuseum.nz/athome/the-royal-game-of-ur +[11]: https://opensource.com/article/17/10/python-101 +[12]: https://opensource.com/sites/default/files/uploads/2darray.jpg (2D array) +[13]: https://git.nixnet.xyz/klaatu/unveil From c763fabbf3136a0f42ff2ff4174f37a7d5f8a5ea Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 10 Oct 2020 05:02:23 +0800 Subject: [PATCH 0389/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201009?= =?UTF-8?q?=205=20ways=20organizations=20can=20lean=20into=20failure=20and?= =?UTF-8?q?=20transform=20it=20into=20success?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201009 5 ways organizations can lean into failure and transform it into success.md --- ...o failure and transform it into success.md | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 sources/tech/20201009 5 ways organizations can lean into failure and transform it into success.md diff --git a/sources/tech/20201009 5 ways organizations can lean into failure and transform it into success.md b/sources/tech/20201009 5 ways organizations can lean into failure and transform it into success.md new file mode 100644 index 0000000000..5a05391cd3 --- /dev/null +++ b/sources/tech/20201009 5 ways organizations can lean into failure and transform it into success.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 ways organizations can lean into failure and transform it into success) +[#]: via: (https://opensource.com/article/20/10/organizations-can-lean-failure) +[#]: author: (Dawn Parzych https://opensource.com/users/dawnparzych) + +5 ways organizations can lean into failure and transform it into success +====== +Removing the fear of failure fosters innovation and open-mindedness, +turning mistakes into opportunities for growth and improvement. +![failure sign at a party, celebrating failure][1] + +> "If failure is not an option, then neither is success."—Seth Godin + +Success is something we all strive toward, but the road to success has twists and turns, which are also known as our failures. But instead of giving up when things don't go my way, I have learned to look at failures as learning opportunities. In fact, I now proudly admit that I'm a failure: + + * I failed my driving test the first time I took it. + * I have not gotten every job I've ever applied or interviewed for. + * Most of the articles I've written have not gone viral. + + + +As software engineers, our industry may be competitive, but we need to remove the stigma associated with failing. One way of doing that is to talk about our failures. The more we hear and talk about failures, the more acceptable it becomes. We need to think about failures as learning opportunities, not a time to shame and ridicule others (or ourselves). + +When we have failed, or think we have made a mistake, most of us get that pit in the bottom of our stomach, and the negative self-talk can kick in almost instantly. This reaction occurs because there are often consequences for mistakes, which can impact us personally as well as the organizations we work for. + +Let's consider a hypothetical example: A software engineer submits a pull request for a new feature. It gets merged and released to production. Something goes wrong, and the application begins throwing errors. Customers can't log in. Sadly this isn't the first time this has happened. Some customers are fed up with the application breaking and have canceled their contracts. The CTO is furious. They want to know who is responsible for this feature being released. The team is understaffed because several team members have left the company, and those that remain are [burned out][2]. The incident takes way longer than usual to be resolved, and everyone is grumpy at the end. + +This worst-case scenario doesn't mean we should always play it safe and not take risks. We need to balance the risks with the rewards when making technical decisions at work and with the open source projects we work on. I like to visualize success and failure as two opposite banks of a river, connected by a bridge. That bridge is built out of knowledge, learning, and understanding. Failure is when we grow, but only if we're learning from those failures and have a good mixture of success sprinkled in. + +### What is needed to accept failure? + +Embracing failure from a personal and organizational point of view doesn't happen overnight. It takes both time and the right culture. Start with one of the five areas outlined below. + +#### Have a growth mindset + +In the book _Growth_, Carol Dweck describes two types of mindsets: growth and fixed. A person with a fixed mindset believes in innate capabilities—you're either born with it, or you're not. Failure represents a limit on one's abilities. + +A person with a growth mindset believes that individual effort and attitude determine one's abilities and that they can learn and improve as long as they put in the effort. Failure represents an opportunity to grow. + +To encourage growth means to encourage failure. But saying "it's OK to fail" is not the same as creating a culture where it honestly is OK to fail. That requires psychological safety and a blameless culture. + +#### Create a blameless culture + +A blameless culture focuses on _where_ a system or a process failed, not on _who_ is responsible. If you spend time after an incident looking for and attributing root cause to human error, you are assigning blame. Instead, look for how things can be improved. What broke? How did it break? How can you prevent it in the future? + +![Image of swampy area with overlaid quote reading "If a junior engineer asks where outages come from, I think a cute thing to tell them is 'The server is crying.' And if they ask why the server is crying, another cute thing to tell them is 'probably becaus][3] + +Published with permission from Joshua Zimmerman (@TheJewberwocky) + +#### Foster psychological safety + +A blameless culture cannot exist without psychological safety. Psychological safety is the ability to show up to work without fear; you feel included in the whole, that it is safe to learn, safe to contribute, and safe to challenge the status quo without fear of consequences. Employees need to feel empowered to speak up if they see processes that need to be improved if they are concerned with security or lack of security procedures in place. They need to feel they won't be blamed for taking a risk where the end result wasn't quite what was expected. + +One way to create a blameless culture and provide psychological safety is to eliminate the word "why" from your vocabulary. Why is used quite frequently—there are problem-solving techniques called ["The "5 Whys."][4] The problem with "why" is it is subtly coded instead as "explain yourself." Having to answer "why" questions put people on the defensive, and they spend time focusing on what the "right" answer is instead of answering honestly. Instead, switch to using "what" or "how" questions. "How" and "what" questions promote concrete action. + +Consider the difference in these questions: + + * Why did last night's release cause a series of exceptions? +vs. + * How were the exceptions triggered? + + + +> "Recently, I was asked if I was going to fire an employee who made a mistake that cost the company $600,000. 'No,' I replied, 'I just spent $600,000 training him. Why would I want somebody else to hire his experience?'"— Thomas J. Watson, Chairman & CEO of IBM, 1914-1956 + +#### Remember the importance of play + +The final aspect of embracing failure is to make time to play. Play shapes our brains and fosters empathy. From a young age, we learn to play games, play on a sports team, play on our own, etc. Chances are you didn't always play on an undefeated sports team or win every single game you've ever played, but practice helped you get better over time no matter what. These experiences teach us to be comfortable with failure and to take it in stride with growth and improvement. + +#### Experimentation leads to learning + +Now that you're ready to embrace failure in your DevOps or engineering practices, where do you start? One of the first processes to look at is the build process. As you most likely know, builds can sometimes result in failures. Changing your build process to include [progressive delivery][5] techniques helps you release features in a controlled manner as opposed to a big bang. Using ring deployments or a canary launch, you can see how a feature performs for a small group of users. If there is a failure, the blast radius has been minimized. + +Another process that can help you learn about your applications and systems is experimentation. Experiments provide a number of learning opportunities, and they don't always go as expected. Some failures can turn into wild successes; for example—[Post-it Notes][6]. Experiments allow us to test a hypothesis and learn new things. Experimenting with software can look like running an A/B test to see which look and feel leads to greater engagement or collecting page load time metrics to see if adding pagination to search results negatively impacts performance. + +A popular type of experimentation is to run a chaos day or game day. With a game day, you purposely cause a system or application to fail. This combines the notion of play, failure, and learning. During this controlled experiment, you learn how your system behaves during failure scenarios. The knowledge gained during game days can be used to put safety measures in place or define processes for what to do when a specific failure occurs. + +### Lean into failure + +Failure can be scary; it is seen as a negative and something we want to avoid. I call on you to change your perspective on this. If you're not failing, you're not learning. + +I challenge you to normalize failure and help reduce the stigma by sharing a failure of yours. Share your failures in the comments below or tag me on social media. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/organizations-can-lean-failure + +作者:[Dawn Parzych][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://opensource.com/users/dawnparzych +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/fail_failure_celebrate.png?itok=LbvDAEZF (failure sign at a party, celebrating failure) +[2]: https://opensource.com/article/19/11/burnout-open-source-communities +[3]: https://opensource.com/sites/default/files/uploads/quote-failure-opensource_0.png +[4]: https://en.wikipedia.org/wiki/Five_whys +[5]: https://launchdarkly.com/blog/all-the-canaries-lived-its-time-to-adopt-progressive-delivery/ +[6]: https://www.ideatovalue.com/insp/nickskillicorn/2017/04/true-story-post-notes-almost-failed/ From e27a7adc2982929a0fca49208faab85ede9c494d Mon Sep 17 00:00:00 2001 From: geekpi Date: Sat, 10 Oct 2020 08:43:19 +0800 Subject: [PATCH 0390/1156] translated --- ... MS-Paint Type of App for Linux Desktop.md | 119 ------------------ ... MS-Paint Type of App for Linux Desktop.md | 119 ++++++++++++++++++ 2 files changed, 119 insertions(+), 119 deletions(-) delete mode 100644 sources/tech/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md create mode 100644 translated/tech/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md diff --git a/sources/tech/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md b/sources/tech/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md deleted file mode 100644 index c1c136c5e7..0000000000 --- a/sources/tech/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md +++ /dev/null @@ -1,119 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Drawing is an Open Source MS-Paint Type of App for Linux Desktop) -[#]: via: (https://itsfoss.com/drawing-app/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -Drawing is an Open Source MS-Paint Type of App for Linux Desktop -====== - -_**Brief: Drawing is a basic image editor like Microsoft Paint. With this open source application, you can draw arrows, lines, geometrical shapes, add colors and other stuff you expect to do in a regular drawing application.**_ - -### Drawing: A simple drawing application for Linux - -![][1] - -For people introduced to computers with Windows XP (or earlier version), MS Paint was an amusing application from sketching random stuff. In a world dominated with Photoshop and GIMP, the paint applications still hold some relevance. - -There are several [painting applications available for Linux][2], and I am going to add one more to this list. - -The app is unsurprisingly called [Drawing][3] and you can use it on both Linux desktop and Linux smartphones. - -### Features of Drawing app - -![][4] - -Drawing has all the features you expect from a drawing application. You can - - * Create new drawings from scratch - * Edit an existing image in PNG, JPEG or BMP file - * Add geometrical shapes, lines, arrows etc - * Dashed - * Use pencil tool for free-hand drawing - * Use curve and shape tool - * Crop images - * Scale images to different pixel size - * Add text - * Select part of image (rectangle, freehand and color selection) - * Rotate images - * Add images copied to clipboard - * Eraser, Highlighter, Paint, Color Selection, Color Picker tools are available in preferences - * Unlimited undo - * Filters to add blur, pixelisation, transparency etc - - - -### My experience with Drawing - -![][5] - -The application is new and has a decent user interface. It comes with all the basic features you expect to find in a standard paint app. - -It has some additional tools like color selection and color picker but it might be confusing to use them. There is no documentation available to describe the use of these tools to you are on your own here. - -The experience is smooth and I feel that this tool has good potential to replace Shutter as image editing tool (yes, I [use Shutter for editing screenshots][6]). - -The thing that I find most bothersome is that it is not possible to edit/modify an element after adding it. You have the undo and redo options but if you want to modify a text you added 12 steps back, you’ll have to redo all the steps. This is something the developer may look into it in the future releases. - -### Installing Drawing on Linux - -This is a Linux exclusive app. It is also available for Linux-based smartphones like [PinePhone][7]. - -There are various ways you can install Drawing app. It is available in the repositories of many major Linux distributions. - -#### Ubuntu-based distributions - -Drawing is included in the universe repository in Ubuntu. Which means you can install it from the Ubuntu Software Center. - -However, if you want the latest version, there is a [PPA available][8] for easily installing Drawing on Ubuntu. Linux Mint and other Ubuntu-based distributions. - -Use the following command: - -``` -sudo add-apt-repository ppa:cartes/drawing -sudo apt update -sudo apt install drawing -``` - -If you want to remove it, you can use the following commands: - -``` -sudo apt remove drawing -sudo add-apt-repository -r ppa:cartes/drawing -``` - -#### Other Linux distributions - -Check your distribution’s package manager for Drawing and install it from there. If you want the latest version, you may use the Flatpak version of the app. - -[Drawing Flatpak][9] - -**Conclusion** - -Do you still use a paint application? Which one do you use? If you have tried Drawing app already, how is your experience with it? - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/drawing-app/ - -作者:[Abhishek Prakash][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/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/drawing-app-interface.jpg?resize=789%2C449&ssl=1 -[2]: https://itsfoss.com/open-source-paint-apps/ -[3]: https://maoschanz.github.io/drawing/ -[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/drawing-screenshot.jpg?resize=800%2C489&ssl=1 -[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/using-drawing-app-linux.png?resize=787%2C473&ssl=1 -[6]: https://itsfoss.com/install-shutter-ubuntu/ -[7]: https://itsfoss.com/pinephone/ -[8]: https://launchpad.net/~cartes/+archive/ubuntu/drawing -[9]: https://flathub.org/apps/details/com.github.maoschanz.drawing diff --git a/translated/tech/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md b/translated/tech/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md new file mode 100644 index 0000000000..46d1c2d639 --- /dev/null +++ b/translated/tech/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md @@ -0,0 +1,119 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Drawing is an Open Source MS-Paint Type of App for Linux Desktop) +[#]: via: (https://itsfoss.com/drawing-app/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Drawing 是一款开源的类似微软画图的 Linux 桌面应用 +====== + +_**简介:Drawing 是一个基本的图像编辑器,就像微软画图一样。有了这个开源的应用,你可以画箭头、线条、几何图形、添加颜色和其他你期望在普通绘图应用程序中做的事情。**_ + +### Drawing: 一个简单的 Linux 绘图应用 + +![][1] + +对于从 Windows XP (或更早版本)开始使用电脑的人来说,微软画图是一个有趣的随机画一些草图的应用。在这个被 Photoshop 和 GIMP 主导的世界里,画图应用仍然具有一定的现实意义。 + +有几个[可用于 Linux 的绘画应用][2],我打算在这个列表中再添加一个。 + +这款应用不出意外地叫做 [Drawing][3],你可以在 Linux 桌面和 Linux 智能手机上使用它。 + +### Drawing 应用的功能 + +![][4] + +Drawing 拥有你所期待的绘图应用的所有功能。你可以: + + * 从头开始创建新的绘图 + * 编辑现有的 PNG、JPEG 或 BMP 图像文件。 + * 添加几何图形、线条、箭头等。 + * 虚线 + * 使用铅笔工具进行自由手绘。 + * 使用曲线和形状工具 + * 裁剪图像 + * 缩放图像到不同的像素大小 + * 添加文本 + * 选择图像的一部分(矩形、自由选择和颜色选择)。 + * 旋转图像 + * 添加复制到剪贴板的图像 + * 可在偏好中使用橡皮擦、荧光笔、油漆桶、颜色选择、颜色选择器工具 + * 无限撤销 + * 滤镜可以增加模糊、像素化、透明度等。 + + + +### 我使用 Drawing 的经验 + +![][5] + +这个应用是新的,并且有不错的用户界面。它具有你期望在标准绘画应用中找到的所有基本功能。 + +它有一些额外的工具,如颜色选择和颜色选择器,但在使用时可能会混淆。没有可用的文档来描述这些工具的使用,要全靠你自己。 + +它的体验很流畅,我觉得这个工具很有潜力取代 Shutter 作为图像编辑工具(是的,我[用 Shutter 编辑截图][6])。 + +我觉得最麻烦的是,添加元素后无法编辑/修改。你有撤消和重做选项,但如果你想修改一个你在 12 步前添加的文本,你就必须重做所有的步骤。这一点开发者可能会在未来的版本中进行研究。 + +### 在 Linux 上安装 Drawing + +这是一款 Linux 专属应用。它也适用于基于 Linux 的智能手机,如 [PinePhone][7]。 + +有多种方式可以安装 Drawing。它在许多主要的 Linux 发行版的仓库中都有。 + +#### 基于 Ubuntu 的发行版 + +Drawing 包含在 Ubuntu 的 universe 仓库中,这意味着你可以从 Ubuntu 软件中心安装它。 + +但是,如果你想要最新的版本,有一个 [PPA][8] 可以轻松地在 Ubuntu、Linux Mint 和其他基于 Ubuntu 的发行版上安装 Drawing。 + +使用下面的命令: + +``` +sudo add-apt-repository ppa:cartes/drawing +sudo apt update +sudo apt install drawing +``` + +如果你想删除它,你可以使用以下命令: + +``` +sudo apt remove drawing +sudo add-apt-repository -r ppa:cartes/drawing +``` + +#### 其他 Linux 发行版 + +检查你的发行版的包管理器中是否有 Drawing,然后在那里安装。如果你想要最新的版本,你可以使用 Flatpak 版本的应用。 + +[Drawing Flatpak][9] + +**总结** + +你还在用画图应用么?你用的是哪一款?如果你已经尝试过 Drawing,你的体验如何? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/drawing-app/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/drawing-app-interface.jpg?resize=789%2C449&ssl=1 +[2]: https://itsfoss.com/open-source-paint-apps/ +[3]: https://maoschanz.github.io/drawing/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/drawing-screenshot.jpg?resize=800%2C489&ssl=1 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/using-drawing-app-linux.png?resize=787%2C473&ssl=1 +[6]: https://itsfoss.com/install-shutter-ubuntu/ +[7]: https://itsfoss.com/pinephone/ +[8]: https://launchpad.net/~cartes/+archive/ubuntu/drawing +[9]: https://flathub.org/apps/details/com.github.maoschanz.drawing From 047a4ad041fc5e9400f89c935c4da21acfc88f64 Mon Sep 17 00:00:00 2001 From: geekpi Date: Sat, 10 Oct 2020 08:47:04 +0800 Subject: [PATCH 0391/1156] translating --- ...te your calendar with Ansible to avoid schedule conflicts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md b/sources/tech/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md index 6c46e90773..2ca86d4af8 100644 --- a/sources/tech/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md +++ b/sources/tech/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 7fffbab9fe347ba847d9c50e040e82671b5662d0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 10 Oct 2020 08:55:48 +0800 Subject: [PATCH 0392/1156] PRF @rakino --- ...rmation on your Linux devices with lshw.md | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/translated/tech/20200928 How to view information on your Linux devices with lshw.md b/translated/tech/20200928 How to view information on your Linux devices with lshw.md index 1d7ded31e5..e0edbcdd69 100644 --- a/translated/tech/20200928 How to view information on your Linux devices with lshw.md +++ b/translated/tech/20200928 How to view information on your Linux devices with lshw.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (rakino) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to view information on your Linux devices with lshw) @@ -9,16 +9,16 @@ 如何使用 lshw 查看 Linux 设备信息 ====== -Linux 系统上的 lshw(列出硬件list hardware)命令提供的系统设备信息比我们大多数人想象的要多得多。 + +> Linux 系统上的 lshw 命令提供的系统设备信息比我们大多数人想象的要多得多。 ![Kali Linux logo / gears / binary data][1] -(Kali Linux / nevarpp / Getty Images) -虽然 **lshw** 命令(读作 “ls hardware”)远不是每个人最先学会的 50 个 Linux 命令之一,但它可以提供很多系统硬件的有用信息。 +虽然 `lshw` 命令(列出硬件list hardware,读作 “ls hardware”)远不是每个人最先学会的 50 个 Linux 命令之一,但它可以提供很多系统硬件的有用信息。 它以一种相当易于理解的格式提取出可能比你知道的更多的信息。在看到描述、(设备)逻辑名称、大小等以后,你可能会理解到自己能获得多少信息。 -这篇文章会研究 **lshw** 给出的信息,但侧重于磁盘及相关硬件。下面是 **lshw** 的输出示例: +这篇文章会研究 `lshw` 给出的信息,但侧重于磁盘及相关硬件。下面是 `lshw` 的输出示例: ``` $ sudo lshw -C disk @@ -37,9 +37,9 @@ $ sudo lshw -C disk logical name: /dev/sdc ``` -请注意,你需要使用 **sudo** 运行 **lshw** 命令以确保能得到所有可用的信息。 +请注意,你需要使用 `sudo` 运行 `lshw` 命令以确保能得到所有可用的信息。 -虽然我们在上面的命令中要求了“磁盘(disk)”(上面只包含了原始输出里五个条目中的一个),这里的输出却不是一个硬盘,而是读卡器——磁盘的一种。注意系统将这个设备命名为了 **/dev/sdc**。 +虽然我们在上面的命令中要求了输出“磁盘(`disk`)”(上面只包含了原始输出里五个条目中的一个),这里的输出却不是一个硬盘,而是读卡器——磁盘的一种。注意系统将这个设备命名为了 `/dev/sdc`。 系统的主磁盘上也有相似的信息: @@ -58,7 +58,7 @@ $ sudo lshw -C disk f63b5929 ``` -这块硬盘是 **/dev/sda**。这个系统上的硬盘都显示为 **ATA** 磁盘,**ATA** 是一种把控制器与盘体集成在一起的磁盘驱动器实现。 +这块硬盘是 `/dev/sda`。这个系统上的硬盘都显示为 `ATA` 磁盘,`ATA` 是一种把控制器与盘体集成在一起的磁盘驱动器实现。 要获得“磁盘”类设备的简略列表,可以运行下面这条命令。注意其中有两个设备被列出了两次,所以我们看到的仍然是五个磁盘设备。 @@ -75,7 +75,7 @@ H/W path Device Class Description /0/100/1f.5/0.0.0 /dev/sdb disk 500GB SAMSUNG HE502HJ ``` -如果你决定要查看系统上的 _**所有**_ 设备,请坐稳了;你会得到一个包含的东西比你通常认为的“设备”要多得多的列表,下面是一个例子,这是一个“简短(short)”(信息很少)的列表: +如果你决定要查看系统上的 **所有** 设备,请坐稳了;你会得到一个包含的东西比你通常认为的“设备”要多得多的列表,下面是一个例子,这是一个“简短(`short`)”(信息很少)的列表: ``` $ sudo lshw -short @@ -174,18 +174,18 @@ $ sudo lshw -short | awk ‘{print substr($0,36,13)}’ | tail -n +3 | sort | un 2 volume ``` -**注意:** 上面使用 **awk** 命令从 **lshw** 的输出中选择 Class(类别)栏是这样实现的:使用 $0(选取完整行),但只取从正确位置(第 36 个字符)开始的子串,而因为“类别”中并没有条目的长度超过 13 个字符,所以子串就在那里结束。命令中 **tail -n +3** 的部分移除了标题和下面的“=====”,所以最终的列表中只包含了那 14 种设备类型。 +**注意:** 上面使用 `awk` 命令从 `lshw` 的输出中选择 Class(类别)栏是这样实现的:使用 `$0`(选取完整行),但只取从正确位置(第 36 个字符)开始的子串,而因为“类别”中并没有条目的长度超过 13 个字符,所以子串就在那里结束。命令中 `tail -n +3` 的部分移除了标题和下面的`=====`,所以最终的列表中只包含了那 14 种设备类型。 -(译注:上面的命令中 awk 的部分在选取子串时是从第 36 个字符开始的,这个数字基本上取决于最长的设备逻辑名称的长度,因而在不同的系统环境中可能有所不同,一个例子是,当你的系统上有 NVMe SSD 时,可能需要将其改为 41。) +(LCTT 译注:上面的命令中 `awk` 的部分在选取子串时是从第 36 个字符开始的,这个数字基本上取决于最长的设备逻辑名称的长度,因而在不同的系统环境中可能有所不同,一个例子是,当你的系统上有 NVMe SSD 时,可能需要将其改为 41。) -你会发现在没有使用 **-short** 选项的时候,每一个磁盘类设备都会有大约 12 行的输出,包括像是 **/dev/sda** 这样的逻辑名称,磁盘大小和种类等等。 +你会发现在没有使用 `-short` 选项的时候,每一个磁盘类设备都会有大约 12 行的输出,包括像是 `/dev/sda` 这样的逻辑名称,磁盘大小和种类等等。 ``` $ sudo lshw -C disk [sudo] password for shs: *-disk:0 description: SCSI Disk - product: Card Reader-1  读卡器? + product: Card Reader-1 <== 读卡器? vendor: JIE LI physical id: 0.0.0 bus info: scsi@4:0.0.0 @@ -213,13 +213,13 @@ $ sudo lshw -C disk product: SSD2SC120G1CS175 physical id: 0 bus info: scsi@0:0.0.0 - logical name: /dev/sda  主要磁盘 + logical name: /dev/sda <== 主要磁盘 version: 1101 serial: PNY20150000778410606 size: 111GiB (120GB) capabilities: partitioned partitioned:dos configuration: ansiversion=5 logicalsectorsize=512 sectorsize=512 signature=f63b5929 - *-cdrom  也叫 /dev/sr0 + *-cdrom <== 也叫 /dev/sr0 description: DVD writer product: DVD+-RW GSA-H73N vendor: HL-DT-ST @@ -239,7 +239,7 @@ $ sudo lshw -C disk product: SAMSUNG HE502HJ physical id: 0.0.0 bus info: scsi@3:0.0.0 - logical name: /dev/sdb  次要磁盘 + logical name: /dev/sdb <== 次要磁盘 version: 0002 serial: S2B6J90B501053 size: 465GiB (500GB) @@ -249,9 +249,7 @@ $ sudo lshw -C disk ### 总结 -**lshw** 命令提供了一些我们许多人通常不会处理的信息,不过即使你只用了其中的一部分,知道有多少信息可用还是很不错的。 - -加入 [Facebook][2] 和 [领英][3] 上的 Network World 社区,对最热门的话题发表评论。 +`lshw` 命令提供了一些我们许多人通常不会处理的信息,不过即使你只用了其中的一部分,知道有多少信息可用还是很不错的。 -------------------------------------------------------------------------------- @@ -260,7 +258,7 @@ via: https://www.networkworld.com/article/3583598/how-to-view-information-on-you 作者:[Sandra Henry-Stocker][a] 选题:[lujun9972][b] 译者:[rakino](https://github.com/rakino) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From bad3d94621c9480304af8db83e276694db30836e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 10 Oct 2020 09:05:49 +0800 Subject: [PATCH 0393/1156] PUB @rakino https://linux.cn/article-12702-1.html --- ...How to view information on your Linux devices with lshw.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200928 How to view information on your Linux devices with lshw.md (99%) diff --git a/translated/tech/20200928 How to view information on your Linux devices with lshw.md b/published/20200928 How to view information on your Linux devices with lshw.md similarity index 99% rename from translated/tech/20200928 How to view information on your Linux devices with lshw.md rename to published/20200928 How to view information on your Linux devices with lshw.md index e0edbcdd69..b2a76f2661 100644 --- a/translated/tech/20200928 How to view information on your Linux devices with lshw.md +++ b/published/20200928 How to view information on your Linux devices with lshw.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (rakino) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12702-1.html) [#]: subject: (How to view information on your Linux devices with lshw) [#]: via: (https://www.networkworld.com/article/3583598/how-to-view-information-on-your-linux-devices-with-lshw.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) From 9f35cd4fb213c4b9e5be994be692205b69c6e639 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 10 Oct 2020 09:51:48 +0800 Subject: [PATCH 0394/1156] PRF @MjSeven --- ...08 How to install software with Ansible.md | 82 +++++++++++-------- 1 file changed, 46 insertions(+), 36 deletions(-) diff --git a/translated/tech/20200908 How to install software with Ansible.md b/translated/tech/20200908 How to install software with Ansible.md index 3074036eb1..bb806adf17 100644 --- a/translated/tech/20200908 How to install software with Ansible.md +++ b/translated/tech/20200908 How to install software with Ansible.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to install software with Ansible) @@ -10,51 +10,55 @@ 如何使用 Ansible 安装软件 ====== -使用 Ansible 剧本自动安装和更新设备上的软件。 -![Puzzle pieces coming together to form a computer screen][1] +> 使用 Ansible 剧本自动安装和更新设备上的软件。 -Ansible 是系统管理员和开发人员用来保持计算机系统处于最佳状态的一种流行的自动化工具。与可扩展框架一样,[Ansible][2] 本身功能有限,它真正的功能体现在许多模块中。在某种程度上,Ansible 模块是 [Linux][3] 系统的命令。它们针对特定问题提供解决方案。维护计算机时的一项常见任务是使所有计算机的更新和一致。 +![](https://img.linux.net.cn/data/attachment/album/202010/10/095024hh65atkh6cc8ntn9.jpg) -我曾经使用软件包的文本列表来保持系统或多或少同步:我会列出笔记本电脑上安装的软件包,然后将其与台式机或另一台服务器之间进行交叉引用,手动弥补差异。当然,在 Linux 机器上安装和维护应用程序是 Ansible 的一项基本功能,这意味着你可以在自己关心的计算机上列出所需的内容。 +Ansible 是系统管理员和开发人员用来保持计算机系统处于最佳状态的一种流行的自动化工具。与可扩展框架一样,[Ansible][2] 本身功能有限,它真正的功能体现在许多模块中。在某种程度上,Ansible 模块就是 [Linux][3] 系统的命令。它们针对特定问题提供解决方案,而维护计算机时的一项常见任务是使所有计算机的更新和一致。 -### 寻找正确的 Ansible +我曾经使用软件包的文本列表来保持系统或多或少的同步:我会列出笔记本电脑上安装的软件包,然后将其与台式机或另一台服务器之间进行交叉参考,手动弥补差异。当然,在 Linux 机器上安装和维护应用程序是 Ansible 的一项基本功能,这意味着你可以在自己关心的计算机上列出所需的内容。 -Ansible 模块的数量非常庞大,如何找到能完成你任务的模块?在 Linux 中,你可以在应用程序菜单或 `/usr/bin` 中查找要运行的应用程序。使用 Ansible 时,参考 [Ansible 模块索引][4]。 +### 寻找正确的 Ansible 模块 + +Ansible 模块的数量非常庞大,如何找到能完成你任务的模块?在 Linux 中,你可以在应用程序菜单或 `/usr/bin` 中查找要运行的应用程序。使用 Ansible 时,你可以参考 [Ansible 模块索引][4]。 这个索引按照类别列出。稍加搜索,你就很可能找到所需的模块。对于包管理,[Packaging 模块][5]几乎适用于所有带包管理器的系统。 ### 动手写一个 Ansible 剧本 -首先,选择本地计算机上的包管理器。例如,如果你打算在运行 Fedora 的笔记本电脑上编写 Ansible 指令(在 Ansible 中称为“剧本”),那么从 dnf 模块开始。如果你在 Elementary OS 上编写,使用 `apt` 模块,以此类推。这样你就可以开始进行测试和验证,并可以在以后扩展到其它计算机。 +首先,选择本地计算机上的包管理器。例如,如果你打算在运行 Fedora 的笔记本电脑上编写 Ansible 指令(在 Ansible 中称为“剧本playbook”),那么从 `dnf` 模块开始。如果你在 Elementary OS 上编写,使用 `apt` 模块,以此类推。这样你就可以开始进行测试和验证,并可以在以后扩展到其它计算机。 + +第一步是创建一个代表你的剧本的目录。这不是绝对必要的,但这是一个好习惯。Ansible 只需要一个配置文件就可以运行在 YAML 中,但是如果你以后想要扩展剧本,你就可以通过改变目录和文件的方式来控制 Ansible。现在,只需创建一个名为 `install_packages` 或类似的目录: -第一步是创建一个代表你剧本的目录。这不是绝对必要的,但这是一个好习惯。Ansible 只需要一个配置文件就可以运行在 YAML 中,但是如果你以后想要扩展剧本,你就可以通过改变目录和文件的方式来控制 Ansible。现在,只需创建一个名为 `install_packages` 或类似的目录: ``` $ mkdir ~/install_packages ``` 你可以根据自己的喜好来命名 Ansible 的剧本,但通常将其命名为 `site.yml`: + ``` $ touch ~/install_packages/site.yml ``` 在你最喜欢的文本编辑器中打开 `site.yml`,添加以下内容: + ``` -\--- -\- hosts: localhost -  tasks: -    - name: install packages -      become: true -      become_user: root -      dnf: -        state: present -        name: -         - tcsh -         - htop +--- +- hosts: localhost + tasks: + - name: install packages + become: true + become_user: root + dnf: + state: present + name: + - tcsh + - htop ``` -你必须调整使用的模块名称来匹配你使用的发行版。在此示例中,我使用 `dnf` 是因为我在 Fedora Linux 上编写剧本。 +你必须调整使用的模块名称以匹配你使用的发行版。在此示例中,我使用 `dnf` 是因为我在 Fedora Linux 上编写剧本。 -就像 Linux 终端中的命令一样,知道 _如何_ 来调用 Ansible 模块就已经成功了一半。这个示例剧本遵循标准剧本格式: +就像 Linux 终端中的命令一样,知道 **如何** 来调用 Ansible 模块就已经成功了一半。这个示例剧本遵循标准剧本格式: * `hosts` 是一台或多台计算机。在本示例中,目标计算机是 `localhost`,即你当前正在使用的计算机(而不是你希望 Ansible 连接的远程系统)。 * `tasks` 是你要在主机上执行的任务列表。 @@ -66,9 +70,8 @@ $ touch ~/install_packages/site.yml `dnf` 下的节点是 `dnf` 模块专用的。这是模块文档的关键所在。就像 Linux 命令的手册页一样,模块文档会告诉你可用的选项和所需的参数。 ![Ansible 文档][6] -Ansible module documentation (Seth Kenlon, [CC BY-SA 4.0][7]) -安装软件包是一个相对简单的任务,仅需要两个元素。`state` 选项指示 Ansible 检查系统上是否存在 _软件包_,而 `name` 选项列出要查找的软件包。Ansible 会处理机器 _状态_,因此模块指令始终意味着更改。假如 Ansible 扫描了系统状态,发现剧本里描述的系统(在本例中,`tcsh` 和 `htop` 存在)与实际状态存在冲突,那么 Ansible 的任务是进行必要的更改来使系统与剧本匹配。Ansible 可以通过 dnf(或 apt 或者其它任何包管理器)模块进行更改。 +安装软件包是一个相对简单的任务,仅需要两个元素。`state` 选项指示 Ansible 检查系统上是否存在 **软件包**,而 `name` 选项列出要查找的软件包。Ansible 会针对机器的 **状态** 进行调整,因此模块指令始终意味着更改。假如 Ansible 扫描了系统状态,发现剧本里描述的系统(在本例中,`tcsh` 和 `htop` 存在)与实际状态存在冲突,那么 Ansible 的任务是进行必要的更改来使系统与剧本匹配。Ansible 可以通过 `dnf`(或 `apt` 或者其它任何包管理器)模块进行更改。 每个模块可能都有一组不同的选项,所以在编写剧本时,要经常参考模块文档。除非你对模块非常熟悉,否则这是期望模块完成工作的唯一合理方法。 @@ -77,16 +80,19 @@ Ansible module documentation (Seth Kenlon, [CC BY-SA 4.0][7]) 剧本是用 YAML 编写的。因为 YAML 遵循严格的语法,所以安装 `yamllint` 来检查剧本是很有帮助的。更妙的是,有一个专门针对 Ansible 的检查工具称为 `ansible-lint`,它专门为剧本而生。在继续之前,安装它。 在 Fedora 或 CentOs 上: + ``` $ sudo dnf ins tall yamllint python3-ansible-lint ``` 在 Debian、Elementary 或 Ubuntu 上,同样的: + ``` $ sudo apt install yamllint ansible-lint ``` 使用 `ansible-link` 来验证你的剧本。如果你无法使用 `ansible-lint`,你可以使用 `yamllint`。 + ``` $ ansible-lint ~/install_packages/site.yml ``` @@ -98,6 +104,7 @@ $ ansible-lint ~/install_packages/site.yml 现在你有了一个可验证的有效剧本,你终于可以在本地计算机上运行它了,因为你碰巧知道该剧本定义的任务需要 root 权限,所以在调用 Ansible 时必须使用 `--ask-become-pass` 选项,因此系统会提示你输入管理员密码。 开始安装: + ``` $ ansible-playbook --ask-become-pass ~/install_packages/site.yml BECOME password: @@ -121,15 +128,15 @@ localhost: ok=0 changed=2 unreachable=0 failed=0 [...] 要连接到远程系统,你必须在 `/etc/ansible/hosts` 文件中定义远程系统,该文件与 Ansible 是一起安装的,所以它已经存在了,但它可能是空的,除了一些解释性注释之外。使用 `sudo` 在你喜欢的文本编辑器中打开它。 -只要主机名可以解析,就可以通过其 IP 地址或主机名定义主机。例如,如果你已经在 `/etc/hosts` 中定义了 `liavara` 并可以成功 ping 通,那么你可以在 `/etc/ansible/hosts` 中将 `liavara` 设置为主机。或者,如果你正在运行一个域名服务器或 Avahi 服务器并且可以 ping 通 `liavara`,那么你就可以在 `/etc/ansible/hosts` 中定义它。否则,你必须使用它的 IP 地址。 +你可以通过其 IP 地址或主机名(只要主机名可以解析)定义主机。例如,如果你已经在 `/etc/hosts` 中定义了 `liavara` 并可以成功 `ping` 通,那么你可以在 `/etc/ansible/hosts` 中将 `liavara` 设置为主机。或者,如果你正在运行一个域名服务器或 Avahi 服务器并且可以 `ping` 通 `liavara`,那么你就可以在 `/etc/ansible/hosts` 中定义它。否则,你必须使用它的 IP 地址。 你还必须成功地建立与目标主机的安全 shell(SSH)连接。最简单的方法是使用 `ssh-copy-id` 命令,但是如果你以前从未与主机建立 SSH 连接,[阅读我关于如何创建自动 SSH 连接的文章][8]。 一旦你在 `/etc/ansible/hosts` 文件中输入了主机名或 IP 地址后,你就可以在剧本中更改 `hosts` 定义: ``` -\--- -\- hosts: all +--- +- hosts: all   tasks:     - name: install packages       become: true @@ -141,7 +148,8 @@ localhost: ok=0 changed=2 unreachable=0 failed=0 [...]          - htop ``` -再次运行 `ansible-playbook`: +再次运行 `ansible-playbook`: + ``` $ ansible-playbook --ask-become-pass ~/install_packages/site.yml ``` @@ -152,29 +160,31 @@ $ ansible-playbook --ask-become-pass ~/install_packages/site.yml ### 适用于混合环境的 Ansible -到目前为止,我们一直假定 Ansible 配置的所有主机都运行相同的操作系统(都是是使用 **dnf** 命令进行程序包管理的操作系统)。那么,如果你要管理不同发行版的主机,例如 Ubuntu(使用 **apt**)或 Arch(使用 **pacman**),或者其它的操作系统时,该怎么办? +到目前为止,我们一直假定 Ansible 配置的所有主机都运行相同的操作系统(都是是使用 `dnf` 命令进行程序包管理的操作系统)。那么,如果你要管理不同发行版的主机,例如 Ubuntu(使用 `apt`)或 Arch(使用 `pacman`),或者其它的操作系统时,该怎么办? 只要目标操作系统具有程序包管理器([MacOs 有 Homebrew][9],[Windows 有 Chocolatey][10]),Ansible 就能派上用场。 -这就是 Ansible 优势最明显的地方。在 shell 脚本中,你必须检查目标主机上有哪些可用的包管理器,即使使用纯 Python,也必须检查操作系统。Ansible 不仅内置了这些功能,而且还具有在剧本中使用命令结果的机制。你可以使用 **action** 关键字来执行由 Ansible 事实收集子系统提供的变量定义的任务,而不是使用 **dnf** 模块。 +这就是 Ansible 优势最明显的地方。在 shell 脚本中,你必须检查目标主机上有哪些可用的包管理器,即使使用纯 Python,也必须检查操作系统。Ansible 不仅内置了这些功能,而且还具有在剧本中使用命令结果的机制。你可以使用 `action` 关键字来执行由 Ansible 事实收集子系统提供的变量定义的任务,而不是使用 `dnf` 模块。 + ``` -\--- -\- hosts: all +--- +- hosts: all   tasks:     - name: install packages       become: true       become_user: root -      action: > +      action: >        {{ ansible_pkg_mgr }} name=htop,transmission state=present update_cache=yes ``` -**action** 关键字会加载目标插件。在本例中,它使用了 **ansible_pkg_mgr** 变量,该变量由 Ansible 在初始 **收集信息** 期间填充。你不需要告诉 Ansible 收集有关其运行操作系统的事实,所以很容易忽略这一点,但是当你运行一个剧本时,你会在默认输出中看到它: +`action` 关键字会加载目标插件。在本例中,它使用了 `ansible_pkg_mgr` 变量,该变量由 Ansible 在初始 **收集信息** 期间填充。你不需要告诉 Ansible 收集有关其运行操作系统的事实,所以很容易忽略这一点,但是当你运行一个剧本时,你会在默认输出中看到它: + ``` TASK [Gathering Facts] ***************************************** ok: [localhost] ``` -**action** 插件使用来自这个探针的信息,使用相关的包管理器命令填充 **ansible_pkg_mgr**,以安装在 **name** 参数之后列出的程序包。使用 8 行代码,你可以克服在其它脚本选项中很少允许的复杂跨平台难题。 +`action` 插件使用来自这个探针的信息,使用相关的包管理器命令填充 `ansible_pkg_mgr`,以安装在 `name` 参数之后列出的程序包。使用 8 行代码,你可以克服在其它脚本选项中很少允许的复杂跨平台难题。 ### 使用 Ansible @@ -187,7 +197,7 @@ via: https://opensource.com/article/20/9/install-packages-ansible 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[MjSeven](https://github.com/MjSeven) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 99e8b7f3b6e29f45fef82f51b98ec09ce1e8d724 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 10 Oct 2020 09:52:27 +0800 Subject: [PATCH 0395/1156] PUB @MjSeven https://linux.cn/article-12703-1.html --- .../20200908 How to install software with Ansible.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200908 How to install software with Ansible.md (99%) diff --git a/translated/tech/20200908 How to install software with Ansible.md b/published/20200908 How to install software with Ansible.md similarity index 99% rename from translated/tech/20200908 How to install software with Ansible.md rename to published/20200908 How to install software with Ansible.md index bb806adf17..54fb204e83 100644 --- a/translated/tech/20200908 How to install software with Ansible.md +++ b/published/20200908 How to install software with Ansible.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12703-1.html) [#]: subject: (How to install software with Ansible) [#]: via: (https://opensource.com/article/20/9/install-packages-ansible) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From fcf1942e172417102d07265883d8d74f7e55e896 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 10 Oct 2020 09:57:44 +0800 Subject: [PATCH 0396/1156] PRF --- published/20200908 How to install software with Ansible.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20200908 How to install software with Ansible.md b/published/20200908 How to install software with Ansible.md index 54fb204e83..40a7ea77ad 100644 --- a/published/20200908 How to install software with Ansible.md +++ b/published/20200908 How to install software with Ansible.md @@ -97,7 +97,7 @@ $ sudo apt install yamllint ansible-lint $ ansible-lint ~/install_packages/site.yml ``` -成功则不返回任何内容,但如果文件中有错误,则必须先修复它们,然后再继续。复制和粘贴过程中的常见错误包括在最后一行的末尾省略换行符、使用制表符而不是空格来缩进。在文本编辑器中修复它们,重新运行 `ansible-llint`,重复这个过程,直到 `ansible-lint` 或 `yamllint` 没有返回为止。 +成功则不返回任何内容,但如果文件中有错误,则必须先修复它们,然后再继续。复制和粘贴过程中的常见错误包括在最后一行的末尾省略换行符、使用制表符而不是空格来缩进。在文本编辑器中修复它们,重新运行 `ansible-lint`,重复这个过程,直到 `ansible-lint` 或 `yamllint` 没有返回为止。 ### 使用 Ansible 安装一个应用 From 733c4ea3db245139efb69ba0159e374d59dca6ff Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 10 Oct 2020 10:15:57 +0800 Subject: [PATCH 0397/1156] PRF @gxlct008 --- ...6 Building a Messenger App- Access Page.md | 59 +++++++++---------- 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/translated/tech/20180716 Building a Messenger App- Access Page.md b/translated/tech/20180716 Building a Messenger App- Access Page.md index 1e195a4b55..eac7e3e314 100644 --- a/translated/tech/20180716 Building a Messenger App- Access Page.md +++ b/translated/tech/20180716 Building a Messenger App- Access Page.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (gxlct008) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Building a Messenger App: Access Page) @@ -10,6 +10,8 @@ 构建一个即时消息应用(七):Access 页面 ====== +![](https://img.linux.net.cn/data/attachment/album/202010/10/101345zj7gfybyee2g9x9e.jpg) + 本文是该系列的第七篇。 * [第一篇: 模式][1] @@ -38,7 +40,7 @@ ``` -这个 HTML 文件必须为每个 URL 提供服务,并且将使用 JavaScript 负责呈现正确的页面。 +这个 HTML 文件必须为每个 URL 提供服务,并且使用 JavaScript 负责呈现正确的页面。 因此,让我们将注意力转到 `main.go` 片刻,然后在 `main()` 函数中添加以下路由: @@ -96,11 +98,9 @@ function view(pageName) { } ``` -如果您是这个博客的关注者,您已经知道它是如何工作的了。 该路由器就是在 [这里][7] 显示的那个。 只需从 [@nicolasparada/router][8] 下载并保存到 `static/router.js` 即可。 +如果你是这个博客的关注者,你已经知道它是如何工作的了。 该路由器就是在 [这里][7] 显示的那个。 只需从 [@nicolasparada/router][8] 下载并保存到 `static/router.js` 即可。 -We registered four routes. At the root `/` we show the home or access page whether the user is authenticated. At `/callback` we show the callback page. On `/conversations/{conversationID}` we show the conversation or access page whether the user is authenticated and for every other URL, we show a not found page. - -我们注册了四条路由。 在根路由 `/` 处,我们展示 home 或 access 页面,无论用户是否通过身份验证。 在 `/callback` 中,我们展示 callback 页面。 在 `/conversations/{conversationID}` 上,我们展示对话或 access 页面,无论用户是否通过验证,对于其他 URL,我们展示一个 not found 页面。 +我们注册了四条路由。 在根路由 `/` 处,我们展示 `home` 或 `access` 页面,无论用户是否通过身份验证。 在 `/callback` 中,我们展示 `callback` 页面。 在 `/conversations/{conversationID}` 上,我们展示对话或 `access` 页面,无论用户是否通过验证,对于其他 URL,我们展示一个 `not-found` 页面。 我们告诉路由器将结果渲染为文档主体,并在离开之前向每个页面调度一个 `disconnect` 事件。 @@ -108,8 +108,7 @@ We registered four routes. At the root `/` we show the home or access page wheth ### 身份验证 -`guard()` 是一个函数,给它两个函数作为参数,如果用户通过了身份验证,则执行第一个函数,否则执行第二个。 -它来自 `auth.js`,所以我们创建一个包含以下内容的 `static/auth.js` 文件: +`guard()` 是一个函数,给它两个函数作为参数,如果用户通过了身份验证,则执行第一个函数,否则执行第二个。它来自 `auth.js`,所以我们创建一个包含以下内容的 `static/auth.js` 文件: ```javascript export function isAuthenticated() { @@ -151,15 +150,15 @@ export function getAuthUser() { } ``` -`isAuthenticated()` 检查 localStorage 中的 `token` 和 `expires_at`,以判断用户是否已通过身份验证。`getAuthUser()` 从 localStorage 中获取经过身份验证的用户。 +`isAuthenticated()` 检查 `localStorage` 中的 `token` 和 `expires_at`,以判断用户是否已通过身份验证。`getAuthUser()` 从 `localStorage` 中获取经过身份验证的用户。 -当我们登录时,我们会将所有的数据保存到 localStorage,这样才有意义。 +当我们登录时,我们会将所有的数据保存到 `localStorage`,这样才有意义。 ### Access 页面 ![access page screenshot][9] -让我们从 access 页面开始。 创建一个包含以下内容的文件 `static/pages/access-page.js`: +让我们从 `access` 页面开始。 创建一个包含以下内容的文件 `static/pages/access-page.js`: ```javascript const template = document.createElement('template') @@ -175,7 +174,7 @@ export default function accessPage() { 因为路由器会拦截所有链接点击来进行导航,所以我们必须特别阻止此链接的事件传播。 -单击该链接会将我们重定向到后端,然后重定向到 GitHub,再重定向到后端,然后再次重定向到前端; 到 callback 页面。 +单击该链接会将我们重定向到后端,然后重定向到 GitHub,再重定向到后端,然后再次重定向到前端; 到 `callback` 页面。 ### Callback 页面 @@ -212,7 +211,7 @@ function getAuthUser(token) { } ``` -callback 页面不呈现任何内容。这是一个异步函数,它使用 URL 查询字符串中的 token 向 `/api/auth_user` 发出 GET 请求,并将所有数据保存到 localStorage。 然后重定向到 `/`。 +`callback` 页面不呈现任何内容。这是一个异步函数,它使用 URL 查询字符串中的 token 向 `/api/auth_user` 发出 GET 请求,并将所有数据保存到 `localStorage`。 然后重定向到 `/`。 ### HTTP @@ -304,7 +303,7 @@ export default { ![home page screenshot][12] -因此,当用户登录时,将显示主页。 创建一个具有以下内容的 `static/pages/home-page.js` 文件: +因此,当用户登录时,将显示 `home` 页。 创建一个具有以下内容的 `static/pages/home-page.js` 文件: ```javascript import { getAuthUser } from '../auth.js' @@ -335,9 +334,9 @@ function onLogoutClick() { } ``` -对于这篇文章,这是我们在主页上呈现的唯一内容。我们显示当前经过身份验证的用户和注销按钮。 +对于这篇文章,这是我们在 `home` 页上呈现的唯一内容。我们显示当前经过身份验证的用户和注销按钮。 -当用户单击注销时,我们清除 localStorage 中的所有内容并重新加载页面。 +当用户单击注销时,我们清除 `localStorage` 中的所有内容并重新加载页面。 ### Avatar @@ -351,11 +350,9 @@ export function avatar(user) { } ``` -We use a small figure with the user’s initial in case the avatar URL is null. -如果头像网址为 null,我们将使用用户的姓名首字母作为初始头像。 +如果头像网址为 `null`,我们将使用用户的姓名首字母作为初始头像。 -您可以使用 `attr()` 函数显示带有少量 CSS 样式的首字母。 -You can show the initial with a little of CSS using the `attr()` function. +你可以使用 `attr()` 函数显示带有少量 CSS 样式的首字母。 ```css .avatar[data-initial]::after { @@ -367,7 +364,7 @@ You can show the initial with a little of CSS using the `attr()` function. ![access page with login form screenshot][13] -在上一篇文章中,我们为编写了一个登录代码。让我们在 access 页面中为此添加一个表单。 进入 `static/ages/access-page.js`,稍微修改一下。 +在上一篇文章中,我们为编写了一个登录代码。让我们在 `access` 页面中为此添加一个表单。 进入 `static/ages/access-page.js`,稍微修改一下。 ```javascript import http from '../http.js' @@ -423,7 +420,7 @@ function login(username) { } ``` -我添加了一个登录表单。当用户提交表单时。它使用用户名对 `/api/login` 进行 POST 请求。将所有数据保存到 localStorage 并重新加载页面。 +我添加了一个登录表单。当用户提交表单时。它使用用户名对 `/api/login` 进行 POST 请求。将所有数据保存到 `localStorage` 并重新加载页面。 记住在前端完成后删除此表单。 @@ -431,7 +428,7 @@ function login(username) { 这就是这篇文章的全部内容。在下一篇文章中,我们将继续使用主页添加一个表单来开始对话,并显示包含最新对话的列表。 -[Souce Code][14] +- [源代码][14] -------------------------------------------------------------------------------- @@ -439,19 +436,19 @@ via: https://nicolasparada.netlify.com/posts/go-messenger-access-page/ 作者:[Nicolás Parada][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/gxlct008) -校对:[校对者ID](https://github.com/校对者ID) +译者:[gxlct008](https://github.com/gxlct008) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://nicolasparada.netlify.com/ [b]: https://github.com/lujun9972 -[1]: https://nicolasparada.netlify.com/posts/go-messenger-schema/ -[2]: https://nicolasparada.netlify.com/posts/go-messenger-oauth/ -[3]: https://nicolasparada.netlify.com/posts/go-messenger-conversations/ -[4]: https://nicolasparada.netlify.com/posts/go-messenger-messages/ -[5]: https://nicolasparada.netlify.com/posts/go-messenger-realtime-messages/ -[6]: https://nicolasparada.netlify.com/posts/go-messenger-dev-login/ +[1]: https://linux.cn/article-11396-1.html +[2]: https://linux.cn/article-11510-1.html +[3]: https://linux.cn/article-12056-1.html +[4]: https://linux.cn/article-12680-1.html +[5]: https://linux.cn/article-12685-1.html +[6]: https://linux.cn/article-12692-1.html [7]: https://nicolasparada.netlify.com/posts/js-router/ [8]: https://unpkg.com/@nicolasparada/router [9]: https://nicolasparada.netlify.com/img/go-messenger-access-page/access-page.png From 6a69ac51b5d6070090390f41f5f1da5de4da8032 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 10 Oct 2020 10:28:55 +0800 Subject: [PATCH 0398/1156] PUB @gxlct008 https://linux.cn/article-12704-1.html --- .../20180716 Building a Messenger App- Access Page.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20180716 Building a Messenger App- Access Page.md (99%) diff --git a/translated/tech/20180716 Building a Messenger App- Access Page.md b/published/20180716 Building a Messenger App- Access Page.md similarity index 99% rename from translated/tech/20180716 Building a Messenger App- Access Page.md rename to published/20180716 Building a Messenger App- Access Page.md index eac7e3e314..b35c83efdc 100644 --- a/translated/tech/20180716 Building a Messenger App- Access Page.md +++ b/published/20180716 Building a Messenger App- Access Page.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (gxlct008) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12704-1.html) [#]: subject: (Building a Messenger App: Access Page) [#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-access-page/) [#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) From 48f21e2f80890bec1542719d295b98e6cf8ecb46 Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Sat, 10 Oct 2020 12:33:48 +0800 Subject: [PATCH 0399/1156] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=AF=91=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...180414 Go on very small hardware Part 2.md | 697 +++++++++--------- 1 file changed, 333 insertions(+), 364 deletions(-) diff --git a/sources/tech/20180414 Go on very small hardware Part 2.md b/sources/tech/20180414 Go on very small hardware Part 2.md index 38344cf427..ab4f10a9ec 100644 --- a/sources/tech/20180414 Go on very small hardware Part 2.md +++ b/sources/tech/20180414 Go on very small hardware Part 2.md @@ -3,188 +3,186 @@ [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) -[#]: subject: (Go on very small hardware (Part 2)) +[#]: subject: (Go on very small hardware Part 2) [#]: via: (https://ziutek.github.io/2018/04/14/go_on_very_small_hardware2.html) [#]: author: (Michał Derkacz https://ziutek.github.io/) -Go on very small hardware (Part 2) +Go 语言在极小硬件上的运用(二) ============================================================ - [![STM32F030F4P6](https://ziutek.github.io/images/mcu/f030-demo-board/board.jpg)][1] + [![STM32F030F4P6](https://ziutek.github.io/images/mcu/f030-demo-board/board.jpg)][1] -At the end of the [first part][2] of this article I promised to write something about  _interfaces_ . I don’t want to write here a complete or even brief lecture about the interfaces. Instead, I’ll show a simple example how to define and use an interface, and then, how to take advantage of ubiquitous  _io.Writer_  interface. There will also be a few words about  _reflection_  and  _semihosting_ . -Interfaces are a crucial part of Go language. If you want to learn more about them, I suggest to read [Effective Go][3] and [Russ Cox article][4]. +在本文的 [第一部分][2] 的结尾,我承诺要写关于 _interfaces_ 的内容。我不想在这里写有关接口的完整甚至简短的讲义。相反,我将展示一个简单的示例,来说明如何定义和使用接口,以及如何利用无处不在的 _io.Writer_ 接口。还有一些关于 _reflection_ 和 _semihosting_ 的内容。 -### Concurrent Blinky – revisited +接口是 Go 语言的重要组成部分。如果您想了解更多有关它们的信息,我建议您阅读 [Effective Go][3] 和 [Russ Cox 的文章][4]。 -When you read the code of previous examples you probably noticed a counterintuitive way to turn the LED on or off. The  _Set_  method was used to turn the LED off and the  _Clear_  method was used to turn the LED on. This is due to driving the LEDs in open-drain configuration. What we can do to make the code less confusing? Let’s define the  _LED_  type with  _On_  and  _Off_  methods: +### 并发 Blinky – 回顾 + +当您阅读前面示例的代码时,您可能会注意到一个违反直觉的方式来打开或关闭 LED。 _Set_ 方法用于关闭 LED,_Clear_ 方法用于打开 LED。这是由于在 漏极开路配置open-drain configuration 下驱动了 LED。我们可以做些什么来减少代码的混乱? 让我们用 _On_ 和 _Off_ 方法来定义 _LED_ 类型: ``` type LED struct { - pin gpio.Pin + pin gpio.Pin } func (led LED) On() { - led.pin.Clear() + led.pin.Clear() } func (led LED) Off() { - led.pin.Set() + led.pin.Set() } ``` -Now we can simply call `led.On()` and `led.Off()` which no longer raises any doubts. +现在我们可以简单地调用 `led.On()` 和 `led.Off()`,这不会再引起任何疑惑了。 -In all previous examples I tried to use the same open-drain configuration to don’t complicate the code. But in the last example, it would be easier for me to connect the third LED between GND and PA3 pins and configure PA3 in push-pull mode. The next example will use a LED connected this way. -But our new  _LED_  type doesn’t support the push-pull configuration. In fact, we should call it  _OpenDrainLED_  and define another  _PushPullLED_  type: +在前面的所有示例中,我都尝试使用相同的 漏极开路配置open-drain configuration来 避免代码复杂化。但是在最后一个示例中,对于我来说,将第三个 LED 连接到 GND 和 PA3 引脚之间并将 PA3 配置为推挽模式push-pull mode会更容易。下一个示例将使用以此方式连接的 LED。 + +但是我们的新 _LED_ 类型不支持推挽配置。实际上,我们应该将其称为 _OpenDrainLED_,并定义另一个类型 _PushPullLED_: ``` type PushPullLED struct { - pin gpio.Pin + pin gpio.Pin } func (led PushPullLED) On() { - led.pin.Set() + led.pin.Set() } func (led PushPullLED) Off() { - led.pin.Clear() + led.pin.Clear() } ``` -Note, that both types have the same methods that work the same. It would be nice if the code that operates on LEDs could use both types, without paying attention to which one it uses at the moment. The  _interface type_  comes to help: +请注意,这两种类型都具有相同的方法,它们的工作方式也相同。如果在 LED 上运行的代码可以同时使用这两种类型,而不必注意当前使用的是哪种类型,那就太好了。 _interface type_ 可以提供帮助: ``` package main import ( - "delay" + "delay" - "stm32/hal/gpio" - "stm32/hal/system" - "stm32/hal/system/timer/systick" + "stm32/hal/gpio" + "stm32/hal/system" + "stm32/hal/system/timer/systick" ) type LED interface { - On() - Off() + On() + Off() } type PushPullLED struct{ pin gpio.Pin } func (led PushPullLED) On() { - led.pin.Set() + led.pin.Set() } func (led PushPullLED) Off() { - led.pin.Clear() + led.pin.Clear() } func MakePushPullLED(pin gpio.Pin) PushPullLED { - pin.Setup(&gpio.Config{Mode: gpio.Out, Driver: gpio.PushPull}) - return PushPullLED{pin} + pin.Setup(&gpio.Config{Mode: gpio.Out, Driver: gpio.PushPull}) + return PushPullLED{pin} } type OpenDrainLED struct{ pin gpio.Pin } func (led OpenDrainLED) On() { - led.pin.Clear() + led.pin.Clear() } func (led OpenDrainLED) Off() { - led.pin.Set() + led.pin.Set() } func MakeOpenDrainLED(pin gpio.Pin) OpenDrainLED { - pin.Setup(&gpio.Config{Mode: gpio.Out, Driver: gpio.OpenDrain}) - return OpenDrainLED{pin} + pin.Setup(&gpio.Config{Mode: gpio.Out, Driver: gpio.OpenDrain}) + return OpenDrainLED{pin} } var led1, led2 LED func init() { - system.SetupPLL(8, 1, 48/8) - systick.Setup(2e6) + system.SetupPLL(8, 1, 48/8) + systick.Setup(2e6) - gpio.A.EnableClock(false) - led1 = MakeOpenDrainLED(gpio.A.Pin(4)) - led2 = MakePushPullLED(gpio.A.Pin(3)) + gpio.A.EnableClock(false) + led1 = MakeOpenDrainLED(gpio.A.Pin(4)) + led2 = MakePushPullLED(gpio.A.Pin(3)) } func blinky(led LED, period int) { - for { - led.On() - delay.Millisec(100) - led.Off() - delay.Millisec(period - 100) - } + for { + led.On() + delay.Millisec(100) + led.Off() + delay.Millisec(period - 100) + } } func main() { - go blinky(led1, 500) - blinky(led2, 1000) + go blinky(led1, 500) + blinky(led2, 1000) } ``` -We’ve defined  _LED_  interface that has two methods:  _On_  and  _Off_ . The  _PushPullLED_  and  _OpenDrainLED_ types represent two ways of driving LEDs. We also defined two  _Make_ _*LED_  functions which act as constructors. Both types implement the  _LED_  interface, so the values of these types can be assigned to the variables of type  _LED_ : +我们定义了 _LED_ 接口,它有两个方法: _On_ 和 _Off_。 _PushPullLED_ 和 _OpenDrainLED_ 类型代表两种驱动 LED 的方式。我们还定义了两个用作构造函数的 _Make_ _*LED_ 函数。这两种类型都实现了 _LED_ 接口,因此可以将这些类型的值赋给 _LED_ 类型的变量: ``` led1 = MakeOpenDrainLED(gpio.A.Pin(4)) led2 = MakePushPullLED(gpio.A.Pin(3)) - ``` -In this case the assignability is checked at compile time. After the assignment the  _led1_  variable contains `OpenDrainLED{gpio.A.Pin(4)}` and a pointer to the method set of the  _OpenDrainLED_  type. The `led1.On()` call roughly corresponds to the following C code: +在这种情况下,可赋值性在编译时检查。赋值后,_led1_ 变量包含一个 `OpenDrainLED{gpio.A.Pin(4)}`,以及一个指向 _OpenDainLED_ 类型的方法集的指针。 `led1.On()` 调用大致对应于以下 C 代码: ``` led1.methods->On(led1.value) - ``` -As you can see, this is quite inexpensive abstraction if only consider the function call overhead. +如您所见,如果仅考虑函数调用的开销,这是相当便宜的抽象。 -But any assigment to an interface causes to include a lot of information about the assigned type. There can be a lot information in case of complex type which consists of many other types: + +但是,对接口的任何赋值都会导致包含有关已赋值类型的大量信息。对于由许多其他类型组成的复杂类型,可能会有很多信息: ``` $ egc -$ arm-none-eabi-size cortexm0.elf +$ arm-none-eabi-size cortexm0.elf text data bss dec hex filename 10356 196 212 10764 2a0c cortexm0.elf - ``` -If we don’t use [reflection][5] we can save some bytes by avoid to include the names of types and struct fields: +如果我们不使用 [反射][5],可以通过避免包含类型和结构字段的名称来节省一些字节: ``` $ egc -nf -nt -$ arm-none-eabi-size cortexm0.elf +$ arm-none-eabi-size cortexm0.elf text data bss dec hex filename 10312 196 212 10720 29e0 cortexm0.elf - ``` -The resulted binary still contains some necessary information about types and full information about all exported methods (with names). This information is need for checking assignability at runtime, mainly when you assign one value stored in the interface variable to any other variable. +生成的二进制文件仍然包含一些有关类型的必要信息和关于所有导出方法(带有名称)的完整信息。在运行时,主要是当您将存储在接口变量中的一个值赋值给任何其他变量时,需要此信息来检查可赋值性。 -We can also remove type and field names from imported packages by recompiling them all: +我们还可以通过重新编译所导入的包来删除它们的类型和字段名称: ``` $ cd $HOME/emgo $ ./clean.sh $ cd $HOME/firstemgo $ egc -nf -nt -$ arm-none-eabi-size cortexm0.elf +$ arm-none-eabi-size cortexm0.elf text data bss dec hex filename 10272 196 212 10680 29b8 cortexm0.elf - ``` -Let’s load this program to see does it work as expected. This time we’ll use the [st-flash][6] command: +让我们加载这个程序,看看它是否按预期工作。这一次我们将使用 [st-flash][6] 命令: ``` $ arm-none-eabi-objcopy -O binary cortexm0.elf cortexm0.bin @@ -205,106 +203,105 @@ Flash page at addr: 0x08002800 erased ``` -I didn’t connected the NRST signal to the programmer so the  _—reset_  option can’t be used and the reset button have to be pressed to run the program. +我没有将 NRST 信号连接到编程器,因此无法使用 _-reset_ 选项,必须按下 reset 按钮才能运行程序。 ![Interfaces](https://ziutek.github.io/images/mcu/f030-demo-board/interfaces.png) -It seems that the  _st-flash_  works a bit unreliably with this board (often requires reseting the ST-LINK dongle). Additionally, the current version doesn’t issue the reset command over SWD (uses only NRST signal). The software reset isn’t realiable however it usually works and lack of it introduces inconvenience. For this board-programmer pair the  _OpenOCD_  works much better. +看来,_st-flash_ 与此板配合使用有点不可靠 (通常需要重置 ST-LINK 加密狗)。此外,当前版本不会通过 SWD 发出 reset 命令 (仅使用 NRST 信号)。 软件重置是不现实的,但是它通常是有效的,缺少它会将会带来不便。对于电路板-程序员board-programmer 组合 _OpenOCD_ 工作得更好。 ### UART -UART (Universal Aynchronous Receiver-Transmitter) is still one of the most important peripherals of today’s microcontrollers. Its advantage is unique combination of the following properties: +UART(通用异步收发传输器Universal Aynchronous Receiver-Transmitter)仍然是当今微控制器最重要的外设之一。它的优点是以下属性的独特组合: -* relatively high speed, +* 相对较高的速度, -* only two signal lines (even one in case of half-duplex communication), +* 仅两条信号线(在 半双工half-duplex 通信的情况下甚至一条), -* symmetry of roles, +* 角色对称, -* synchronous in-band signaling about new data (start bit), +* 关于新数据的 同步带内信令synchronous in-band signaling(起始位), -* accurate timing inside transmitted word. +* 在传输 words 内的精确计时。 -This causes that UART, originally intedned to transmit asynchronous messages consisting of 7-9 bit words, is also used to efficiently implement various other phisical protocols such as used by [WS28xx LEDs][7] or [1-wire][8] devices. -However, we will use the UART in its usual role: to printing text messages from our program. +这使得最初用于传输由 7-9 位 words 组成的异步消息的 UART,也被用于有效地实现各种其他物理协议,例如被 [WS28xx LEDs][7] 或 [1-wire][8] 设备使用的协议。 + +但是,我们将以其通常的角色使用 UART:从程序中打印文本消息。 ``` package main import ( - "io" - "rtos" + "io" + "rtos" - "stm32/hal/dma" - "stm32/hal/gpio" - "stm32/hal/irq" - "stm32/hal/system" - "stm32/hal/system/timer/systick" - "stm32/hal/usart" + "stm32/hal/dma" + "stm32/hal/gpio" + "stm32/hal/irq" + "stm32/hal/system" + "stm32/hal/system/timer/systick" + "stm32/hal/usart" ) var tts *usart.Driver func init() { - system.SetupPLL(8, 1, 48/8) - systick.Setup(2e6) + system.SetupPLL(8, 1, 48/8) + systick.Setup(2e6) - gpio.A.EnableClock(true) - tx := gpio.A.Pin(9) + gpio.A.EnableClock(true) + tx := gpio.A.Pin(9) - tx.Setup(&gpio.Config{Mode: gpio.Alt}) - tx.SetAltFunc(gpio.USART1_AF1) - d := dma.DMA1 - d.EnableClock(true) - tts = usart.NewDriver(usart.USART1, d.Channel(2, 0), nil, nil) - tts.Periph().EnableClock(true) - tts.Periph().SetBaudRate(115200) - tts.Periph().Enable() - tts.EnableTx() + tx.Setup(&gpio.Config{Mode: gpio.Alt}) + tx.SetAltFunc(gpio.USART1_AF1) + d := dma.DMA1 + d.EnableClock(true) + tts = usart.NewDriver(usart.USART1, d.Channel(2, 0), nil, nil) + tts.Periph().EnableClock(true) + tts.Periph().SetBaudRate(115200) + tts.Periph().Enable() + tts.EnableTx() - rtos.IRQ(irq.USART1).Enable() - rtos.IRQ(irq.DMA1_Channel2_3).Enable() + rtos.IRQ(irq.USART1).Enable() + rtos.IRQ(irq.DMA1_Channel2_3).Enable() } func main() { - io.WriteString(tts, "Hello, World!\r\n") + io.WriteString(tts, "Hello, World!\r\n") } func ttsISR() { - tts.ISR() + tts.ISR() } func ttsDMAISR() { - tts.TxDMAISR() + tts.TxDMAISR() } //c:__attribute__((section(".ISRs"))) var ISRs = [...]func(){ - irq.USART1: ttsISR, - irq.DMA1_Channel2_3: ttsDMAISR, + irq.USART1: ttsISR, + irq.DMA1_Channel2_3: ttsDMAISR, } ``` -You can find this code slightly complicated but for now there is no simpler UART driver in STM32 HAL (simple polling driver will be probably useful in some cases). The  _usart.Driver_  is efficient driver that uses DMA and interrupts to ofload the CPU. +您会发现此代码可能有些复杂,但目前 STM32 HAL 中没有更简单的 UART 驱动程序(在某些情况下,简单的轮询驱动程序可能会很有用)。 _usart.Driver_ 是使用 DMA 和中断来卸载 CPU 的高效驱动程序。 -STM32 USART peripheral provides traditional UART and its synchronous version. To use it as output we have to connect its Tx signal to the right GPIO pin: +STM32 USART 外设提供传统的 UART 及其同步版本。要将其用作输出,我们必须将其 Tx 信号连接到正确的 GPIO 引脚: ``` tx.Setup(&gpio.Config{Mode: gpio.Alt}) tx.SetAltFunc(gpio.USART1_AF1) - ``` -The  _usart.Driver_  is configured in Tx-only mode (rxdma and rxbuf are set to nil): +在 Tx-only 模式下配置 _usart.Driver_ (rxdma 和 rxbuf 设置为 nil): ``` tts = usart.NewDriver(usart.USART1, d.Channel(2, 0), nil, nil) - ``` -We use its  _WriteString_  method to print the famous sentence. Let’s clean everything and compile this program: +我们使用它的 _WriteString_ 方法来打印这句名句。让我们清理所有内容并编译该程序: ``` $ cd $HOME/emgo @@ -312,20 +309,19 @@ $ ./clean.sh $ cd $HOME/firstemgo $ egc $ arm-none-eabi-size cortexm0.elf - text data bss dec hex filename - 12728 236 176 13140 3354 cortexm0.elf - + text data bss dec hex filename + 12728 236 176 13140 3354 cortexm0.elf ``` -To see something you need an UART peripheral in your PC. +要查看某些内容,您需要在 PC 中使用 UART 外设。 -**Do not use RS232 port or USB to RS232 converter!** +**请勿使用 RS232 端口或 USB 转 RS232 转换器!** -The STM32 family uses 3.3 V logic but RS232 can produce from -15 V to +15 V which will probably demage your MCU. You need USB to UART converter that uses 3.3 V logic. Popular converters are based on FT232 or CP2102 chips. +STM32 系列使用 3.3V 逻辑,但是 RS232 可以产生 -15 V ~ +15 V 的电压,这可能会损坏您的 MCU。您需要使用 3.3 V 逻辑的 USB 转 UART 转换器。流行的转换器基于 FT232 或 CP2102 芯片。 ![UART](https://ziutek.github.io/images/mcu/f030-demo-board/uart.jpg) -You also need some terminal emulator program (I prefer [picocom][9]). Flash the new image, run the terminal emulator and press the reset button a few times: +您还需要一些终端仿真程序 (我更喜欢 [picocom][9])。刷新新图像,运行终端仿真器,然后按几次 reset 按钮: ``` $ openocd -d0 -f interface/stlink.cfg -f target/stm32f0x.cfg -c 'init; program cortexm0.elf; reset run; exit' @@ -338,18 +334,18 @@ adapter speed: 1000 kHz adapter_nsrst_delay: 100 none separate adapter speed: 950 kHz -target halted due to debug-request, current mode: Thread +target halted due to debug-request, current mode: Thread xPSR: 0xc1000000 pc: 0x080016f4 msp: 0x20000a20 adapter speed: 4000 kHz ** Programming Started ** auto erase enabled -target halted due to breakpoint, current mode: Thread +target halted due to breakpoint, current mode: Thread xPSR: 0x61000000 pc: 0x2000003a msp: 0x20000a20 wrote 13312 bytes from file cortexm0.elf in 1.020185s (12.743 KiB/s) ** Programming Finished ** adapter speed: 950 kHz $ -$ picocom -b 115200 /dev/ttyUSB0 +$ picocom -b 115200 /dev/ttyUSB0 picocom v3.1 port is : /dev/ttyUSB0 @@ -366,8 +362,8 @@ hangup is : no nolock is : no send_cmd is : sz -vv receive_cmd is : rz -vv -E -imap is : -omap is : +imap is : +omap is : emap is : crcrlf,delbs, logfile is : none initstring : none @@ -379,69 +375,62 @@ Terminal ready Hello, World! Hello, World! Hello, World! - ``` -Every press of the reset button produces new “Hello, World!” line. Everything works as expected. +每次按下 reset 按钮都会产生新的 “Hello,World!”行。一切都在按预期进行。 -To see bi-directional UART code for this MCU check out [this example][10]. +要查看此 MCU 的 双向bi-directional UART 代码,请查看 [此示例][10]。 -### io.Writer +### io.Writer 接口 -The  _io.Writer_  interface is probably the second most commonly used interface type in Go, right after the  _error_  interface. Its definition looks like this: +_io.Writer_ 接口可能是 Go 中第二种最常用的接口类型,紧接在 _error_ 接口之后。其定义如下所示: ``` type Writer interface { - Write(p []byte) (n int, err error) + Write(p []byte) (n int, err error) } - ``` - _usart.Driver_  implements  _io.Writer_  so we can replace: + _usart.Driver_ 实现了 _io.Writer_ ,因此我们可以替换: ``` tts.WriteString("Hello, World!\r\n") - ``` -with +为 ``` io.WriteString(tts, "Hello, World!\r\n") - ``` -Additionally you need to add the  _io_  package to the  _import_  section. +此外,您需要将 _io_ 包添加到 _import_ 部分。 -The declaration of  _io.WriteString_  function looks as follows: +_io.WriteString_ 函数的声明如下所示: ``` func WriteString(w Writer, s string) (n int, err error) - ``` -As you can see, the  _io.WriteString_  allows to write strings using any type that implements  _io.Writer_ interface. Internally it check does the underlying type has  _WriteString_  method and uses it instead of  _Write_  if available. +如您所见,_io.WriteString_ 允许使用实现了 _io.Writer_ 接口的任何类型来编写字符串。在内部,它检查基础类型是否具有 _WriteString_ 方法,并使用该方法代替 _Write_ (如果可用)。 -Let’s compile the modified program: +让我们编译修改后的程序: ``` $ egc -$ arm-none-eabi-size cortexm0.elf +$ arm-none-eabi-size cortexm0.elf text data bss dec hex filename 15456 320 248 16024 3e98 cortexm0.elf - ``` -As you can see,  _io.WriteString_  causes a significant increase in the size of the binary: 15776 - 12964 = 2812 bytes. There isn’t too much space left on the Flash. What caused such a drastic increase in size? +如您所见,_io.WriteString_ 导致二进制文件的大小显着增加:15776-12964 = 2812字节。 Flash 上没有太多空间了。是什么引起了这么大规模的增长? -Using the command: +使用这个命令: ``` arm-none-eabi-nm --print-size --size-sort --radix=d cortexm0.elf - ``` -we can print all symbols ordered by its size for both cases. By filtering and analyzing the obtained data (awk, diff) we can find about 80 new symbols. The ten largest are: +我们可以打印两种情况下按其大小排序的所有符号。通过过滤和分析获得的数据(awk,diff),我们可以找到大约 80 个新符号。最大的十个如下所示: ``` > 00000062 T stm32$hal$usart$Driver$DisableRx @@ -453,46 +442,44 @@ we can print all symbols ordered by its size for both cases. By filtering and an > 00000100 T stm32$hal$usart$Error$Error > 00000360 T io$WriteString > 00000660 T stm32$hal$usart$Driver$Read - ``` -So, even though we don’t use the  _usart.Driver.Read_  method it was compiled in, same as  _DisableRx_ ,  _RxDMAISR_ ,  _EnableRx_  and other not mentioned above. Unfortunately, if you assign something to the interface, its full method set is required (with all dependences). This isn’t a problem for a large programs that use most of the methods anyway. But for our simple one it’s a huge burden. +因此,即使我们不使用 _usart.Driver.Read_ 方法进行编译,也与 _DisableRx_、_RxDMAISR_、_EnableRx_ 以及上面未提及的其他方法相同。不幸的是,如果您为接口赋值了一些内容,那么它的完整方法集是必需的(包含所有依赖项)。对于使用大多数方法的大型程序来说,这不是问题。但是对于我们这种极简的情况而言,这是一个巨大的负担。 -We’re already close to the limits of our MCU but let’s try to print some numbers (you need to replace  _io_ package with  _strconv_  in  _import_  section): +我们已经接近 MCU 的极限,但让我们尝试打印一些数字(您需要在 _import_ 部分中用 _strconv_ 替换 _io_ 包): ``` func main() { - a := 12 - b := -123 + a := 12 + b := -123 - tts.WriteString("a = ") - strconv.WriteInt(tts, a, 10, 0, 0) - tts.WriteString("\r\n") - tts.WriteString("b = ") - strconv.WriteInt(tts, b, 10, 0, 0) - tts.WriteString("\r\n") + tts.WriteString("a = ") + strconv.WriteInt(tts, a, 10, 0, 0) + tts.WriteString("\r\n") + tts.WriteString("b = ") + strconv.WriteInt(tts, b, 10, 0, 0) + tts.WriteString("\r\n") - tts.WriteString("hex(a) = ") - strconv.WriteInt(tts, a, 16, 0, 0) - tts.WriteString("\r\n") - tts.WriteString("hex(b) = ") - strconv.WriteInt(tts, b, 16, 0, 0) - tts.WriteString("\r\n") + tts.WriteString("hex(a) = ") + strconv.WriteInt(tts, a, 16, 0, 0) + tts.WriteString("\r\n") + tts.WriteString("hex(b) = ") + strconv.WriteInt(tts, b, 16, 0, 0) + tts.WriteString("\r\n") } - ``` -As in the case of  _io.WriteString_  function, the first argument of the  _strconv.WriteInt_  is of type  _io.Writer_ . +与使用 _io.WriteString_ 函数的情况一样,_strconv.WriteInt_ 的第一个参数的类型为 _io.Writer_ 。 + ``` $ egc /usr/local/arm/bin/arm-none-eabi-ld: /home/michal/firstemgo/cortexm0.elf section `.rodata' will not fit in region `Flash' /usr/local/arm/bin/arm-none-eabi-ld: region `Flash' overflowed by 692 bytes exit status 1 - ``` -This time we’ve run out of space. Let’s try to slim down the information about types: +这一次我们的空间用完了。让我们试着精简一下有关类型的信息: ``` $ cd $HOME/emgo @@ -502,391 +489,376 @@ $ egc -nf -nt $ arm-none-eabi-size cortexm0.elf text data bss dec hex filename 15876 316 320 16512 4080 cortexm0.elf - ``` -It was close, but we fit. Let’s load and run this code: +很接近,但很合适。让我们加载并运行此代码: ``` a = 12 b = -123 hex(a) = c hex(b) = -7b - ``` -The  _strconv_  package in Emgo is quite different from its archetype in Go. It is intended for direct use to write formatted numbers and in many cases can replace heavy  _fmt_  package. That’s why the function names start with  _Write_  instead of  _Format_  and have additional two parameters. Below is an example of their use: +Emgo 中的 _strconv_ 包与 Go 中的原型有很大的不同。 它旨在直接用于写入格式化的数字,并且在许多情况下可以替换繁重的 _fmt_ 包。 这就是为什么函数名称以 _Write_ 而不是 _Format_ 开头,并具有额外的两个参数的原因。 以下是其用法示例: ``` func main() { - b := -123 - strconv.WriteInt(tts, b, 10, 0, 0) - tts.WriteString("\r\n") - strconv.WriteInt(tts, b, 10, 6, ' ') - tts.WriteString("\r\n") - strconv.WriteInt(tts, b, 10, 6, '0') - tts.WriteString("\r\n") - strconv.WriteInt(tts, b, 10, 6, '.') - tts.WriteString("\r\n") - strconv.WriteInt(tts, b, 10, -6, ' ') - tts.WriteString("\r\n") - strconv.WriteInt(tts, b, 10, -6, '0') - tts.WriteString("\r\n") - strconv.WriteInt(tts, b, 10, -6, '.') - tts.WriteString("\r\n") + b := -123 + strconv.WriteInt(tts, b, 10, 0, 0) + tts.WriteString("\r\n") + strconv.WriteInt(tts, b, 10, 6, ' ') + tts.WriteString("\r\n") + strconv.WriteInt(tts, b, 10, 6, '0') + tts.WriteString("\r\n") + strconv.WriteInt(tts, b, 10, 6, '.') + tts.WriteString("\r\n") + strconv.WriteInt(tts, b, 10, -6, ' ') + tts.WriteString("\r\n") + strconv.WriteInt(tts, b, 10, -6, '0') + tts.WriteString("\r\n") + strconv.WriteInt(tts, b, 10, -6, '.') + tts.WriteString("\r\n") } - ``` -There is its output: +下面是它的输出: ``` -123 -123 -00123 ..-123 --123 --123 +-123 +-123 -123.. - ``` -### Unix streams and Morse code +### Unix 流 和 莫尔斯电码Morse code -Thanks to the fact that most of the functions that write something use  _io.Writer_  instead of concrete type (eg.  _FILE_  in C) we get a functionality similar to  _Unix streams_ . In Unix we can easily combine simple commands to perform larger tasks. For example, we can write text to the file this way: +得益于事实上大多数写入功能的函数都使用 _io.Writer_ 而不是具体类型(例如 C 中的 _FILE_ ),因此我们获得了类似于 _Unix stream_ 的功能。在 Unix 中,我们可以轻松地组合简单的命令来执行更大的任务。例如,我们可以通过以下方式将文本写入文件: ``` echo "Hello, World!" > file.txt - ``` -The `>` operator writes the output stream of the preceding command to the file. There is also `|`operator that connects output and input streams of adjacent commands. +`>` 操作符将前面命令的输出流写入文件。还有 `|` 操作符,用于连接相邻命令的输出流和输入流。 -Thanks to the streams we can easily convert/filter output of any command. For example, to convert all letters to uppercase we can filter the echo’s output through  _tr_  command: +多亏了流,我们可以轻松地转换/过滤任何命令的输出。例如,要将所有字母转换为大写,我们可以通过 _tr_ 命令过滤 echo 的输出: ``` echo "Hello, World!" | tr a-z A-Z > file.txt - ``` -To show the analogy between  _io.Writer_  and Unix streams let’s write our: +为了显示 _io.Writer_ 和 Unix 流之间的类比,让我们编写以下代码: ``` io.WriteString(tts, "Hello, World!\r\n") - ``` -in the following pseudo-unix form: +采用以下伪 unix 形式: ``` io.WriteString "Hello, World!" | usart.Driver usart.USART1 - ``` -The next example will show how to do this: +下一个示例将显示如何执行此操作: ``` io.WriteString "Hello, World!" | MorseWriter | usart.Driver usart.USART1 - ``` -Let’s create a simple encoder that encodes the text written to it using Morse coding: +让我们来创建一个简单的编码器,它使用莫尔斯电码对写入的文本进行编码: ``` type MorseWriter struct { - W io.Writer + W io.Writer } func (w *MorseWriter) Write(s []byte) (int, error) { - var buf [8]byte - for n, c := range s { - switch { - case c == '\n': - c = ' ' // Replace new lines with spaces. - case 'a' <= c && c <= 'z': - c -= 'a' - 'A' // Convert to upper case. - } - if c < ' ' || 'Z' < c { - continue // c is outside ASCII [' ', 'Z'] - } - var symbol morseSymbol - if c == ' ' { - symbol.length = 1 - buf[0] = ' ' - } else { - symbol = morseSymbols[c-'!'] - for i := uint(0); i < uint(symbol.length); i++ { - if (symbol.code>>i)&1 != 0 { - buf[i] = '-' - } else { - buf[i] = '.' - } - } - } - buf[symbol.length] = ' ' - if _, err := w.W.Write(buf[:symbol.length+1]); err != nil { - return n, err - } - } - return len(s), nil + var buf [8]byte + for n, c := range s { + switch { + case c == '\n': + c = ' ' // Replace new lines with spaces. + case 'a' <= c && c <= 'z': + c -= 'a' - 'A' // Convert to upper case. + } + if c < ' ' || 'Z' < c { + continue // c is outside ASCII [' ', 'Z'] + } + var symbol morseSymbol + if c == ' ' { + symbol.length = 1 + buf[0] = ' ' + } else { + symbol = morseSymbols[c-'!'] + for i := uint(0); i < uint(symbol.length); i++ { + if (symbol.code>>i)&1 != 0 { + buf[i] = '-' + } else { + buf[i] = '.' + } + } + } + buf[symbol.length] = ' ' + if _, err := w.W.Write(buf[:symbol.length+1]); err != nil { + return n, err + } + } + return len(s), nil } type morseSymbol struct { - code, length byte + code, length byte } //emgo:const var morseSymbols = [...]morseSymbol{ - {1<<0 | 1<<1 | 1<<2, 4}, // ! ---. - {1<<1 | 1<<4, 6}, // " .-..-. - {}, // # - {1<<3 | 1<<6, 7}, // $ ...-..- + {1<<0 | 1<<1 | 1<<2, 4}, // ! ---. + {1<<1 | 1<<4, 6}, // " .-..-. + {}, // # + {1<<3 | 1<<6, 7}, // $ ...-..- - // Some code omitted... + // Some code omitted... - {1<<0 | 1<<3, 4}, // X -..- - {1<<0 | 1<<2 | 1<<3, 4}, // Y -.-- - {1<<0 | 1<<1, 4}, // Z --.. + {1<<0 | 1<<3, 4}, // X -..- + {1<<0 | 1<<2 | 1<<3, 4}, // Y -.-- + {1<<0 | 1<<1, 4}, // Z --.. } - ``` -You can find the full  _morseSymbols_  array [here][11]. The `//emgo:const` directive ensures that  _morseSymbols_ array won’t be copied to the RAM. +您可以在 [这里][11] 找到完整的 _morseSymbols_ 数组。 `//emgo:const` 指令确保 _morseSymbols_ 数组不会被复制到 RAM 中。 -Now we can print our sentence in two ways: +现在我们可以通过两种方式打印句子: ``` func main() { - s := "Hello, World!\r\n" - mw := &MorseWriter{tts} + s := "Hello, World!\r\n" + mw := &MorseWriter{tts} - io.WriteString(tts, s) - io.WriteString(mw, s) + io.WriteString(tts, s) + io.WriteString(mw, s) } - ``` -We use the pointer to the  _MorseWriter_  `&MorseWriter{tts}` instead os simple `MorseWriter{tts}` value beacuse the  _MorseWriter_  is to big to fit into an interface variable. +我们使用指向 _MorseWriter_ `&MorseWriter{tts}` 的指针而不是简单的 `MorseWriter{tts}` 值,因为 _MorseWriter_ 太大,不适合接口变量。 -Emgo, unlike Go, doesn’t dynamically allocate memory for value stored in interface variable. The interface type has limited size, equal to the size of three pointers (to fit  _slice_ ) or two  _float64_  (to fit  _complex128_ ), what is bigger. It can directly store values of all basic types and small structs/arrays but for bigger values you must use pointers. -Let’s compile this code and see its output: +与 Go 不同,Emgo 不会为存储在接口变量中的值动态分配内存。接口类型的大小受限制,等于三个指针(适合 _slice_ )或两个 _float64_(适合 _complex128_ )的大小,以较大者为准。它可以直接存储所有基本类型和小型 “结构体/数组” 的值,但是对于较大的值,您必须使用指针。 + +让我们编译此代码并查看其输出: ``` $ egc $ arm-none-eabi-size cortexm0.elf text data bss dec hex filename 15152 324 248 15724 3d6c cortexm0.elf - ``` ``` Hello, World! .... . .-.. .-.. --- --..-- .-- --- .-. .-.. -.. ---. - ``` -### The Ultimate Blinky +### 终极 Blinky -The  _Blinky_  is hardware equivalent of  _Hello, World!_  program. Once we have a Morse encoder we can easly combine both to obtain the  _Ultimate Blinky_  program: +_Blinky_ 等效于 _Hello,World!_ 程序的硬件。一旦有了 Morse 编码器,我们就可以轻松地将两者结合起来以获得 _Ultimate Blinky_ 程序: ``` package main import ( - "delay" - "io" + "delay" + "io" - "stm32/hal/gpio" - "stm32/hal/system" - "stm32/hal/system/timer/systick" + "stm32/hal/gpio" + "stm32/hal/system" + "stm32/hal/system/timer/systick" ) var led gpio.Pin func init() { - system.SetupPLL(8, 1, 48/8) - systick.Setup(2e6) + system.SetupPLL(8, 1, 48/8) + systick.Setup(2e6) - gpio.A.EnableClock(false) - led = gpio.A.Pin(4) + gpio.A.EnableClock(false) + led = gpio.A.Pin(4) - cfg := gpio.Config{Mode: gpio.Out, Driver: gpio.OpenDrain, Speed: gpio.Low} - led.Setup(&cfg) + cfg := gpio.Config{Mode: gpio.Out, Driver: gpio.OpenDrain, Speed: gpio.Low} + led.Setup(&cfg) } type Telegraph struct { - Pin gpio.Pin - Dotms int // Dot length [ms] + Pin gpio.Pin + Dotms int // Dot length [ms] } func (t Telegraph) Write(s []byte) (int, error) { - for _, c := range s { - switch c { - case '.': - t.Pin.Clear() - delay.Millisec(t.Dotms) - t.Pin.Set() - delay.Millisec(t.Dotms) - case '-': - t.Pin.Clear() - delay.Millisec(3 * t.Dotms) - t.Pin.Set() - delay.Millisec(t.Dotms) - case ' ': - delay.Millisec(3 * t.Dotms) - } - } - return len(s), nil + for _, c := range s { + switch c { + case '.': + t.Pin.Clear() + delay.Millisec(t.Dotms) + t.Pin.Set() + delay.Millisec(t.Dotms) + case '-': + t.Pin.Clear() + delay.Millisec(3 * t.Dotms) + t.Pin.Set() + delay.Millisec(t.Dotms) + case ' ': + delay.Millisec(3 * t.Dotms) + } + } + return len(s), nil } func main() { - telegraph := &MorseWriter{Telegraph{led, 100}} - for { - io.WriteString(telegraph, "Hello, World! ") - } + telegraph := &MorseWriter{Telegraph{led, 100}} + for { + io.WriteString(telegraph, "Hello, World! ") + } } // Some code omitted... ``` -In the above example I omitted the definition of  _MorseWriter_  type because it was shown earlier. The full version is available [here][12]. Let’s compile it and run: +在上面的示例中,我省略了 _MorseWriter_ 类型的定义,因为它已在前面展示过。完整版可通过 [这里][12] 获取。让我们编译它并运行: ``` $ egc $ arm-none-eabi-size cortexm0.elf text data bss dec hex filename 11772 244 244 12260 2fe4 cortexm0.elf - ``` ![Ultimate Blinky](https://ziutek.github.io/images/mcu/f030-demo-board/morse.png) -### Reflection +### 反射 -Yes, Emgo supports [reflection][13]. The  _reflect_  package isn’t complete yet but that what is done is enough to implement  _fmt.Print_  family of functions. Let’s see what can we do on our small MCU. +是的,Emgo 支持 [反射][13]。 _reflect_ 包尚未完成,但是已完成的部分足以实现 _fmt.Print_ 函数族了。来看看我们可以在小型 MCU 上做什么。 -To reduce memory usage we will use [semihosting][14] as standard output. For convenience, we also write simple  _println_  function which to some extent mimics  _fmt.Println_ . +为了减少内存使用,我们将使用 [semihosting][14] 作为标准输出。为了方便起见,我们还编写了简单的 _println_ 函数,它在某种程度上类似于 _fmt.Println_。 ``` package main import ( - "debug/semihosting" - "reflect" - "strconv" + "debug/semihosting" + "reflect" + "strconv" - "stm32/hal/system" - "stm32/hal/system/timer/systick" + "stm32/hal/system" + "stm32/hal/system/timer/systick" ) var stdout semihosting.File func init() { - system.SetupPLL(8, 1, 48/8) - systick.Setup(2e6) + system.SetupPLL(8, 1, 48/8) + systick.Setup(2e6) - var err error - stdout, err = semihosting.OpenFile(":tt", semihosting.W) - for err != nil { - } + var err error + stdout, err = semihosting.OpenFile(":tt", semihosting.W) + for err != nil { + } } type stringer interface { - String() string + String() string } func println(args ...interface{}) { - for i, a := range args { - if i > 0 { - stdout.WriteString(" ") - } - switch v := a.(type) { - case string: - stdout.WriteString(v) - case int: - strconv.WriteInt(stdout, v, 10, 0, 0) - case bool: - strconv.WriteBool(stdout, v, 't', 0, 0) - case stringer: - stdout.WriteString(v.String()) - default: - stdout.WriteString("%unknown") - } - } - stdout.WriteString("\r\n") + for i, a := range args { + if i > 0 { + stdout.WriteString(" ") + } + switch v := a.(type) { + case string: + stdout.WriteString(v) + case int: + strconv.WriteInt(stdout, v, 10, 0, 0) + case bool: + strconv.WriteBool(stdout, v, 't', 0, 0) + case stringer: + stdout.WriteString(v.String()) + default: + stdout.WriteString("%unknown") + } + } + stdout.WriteString("\r\n") } type S struct { - A int - B bool + A int + B bool } func main() { - p := &S{-123, true} + p := &S{-123, true} - v := reflect.ValueOf(p) + v := reflect.ValueOf(p) - println("kind(p) =", v.Kind()) - println("kind(*p) =", v.Elem().Kind()) - println("type(*p) =", v.Elem().Type()) + println("kind(p) =", v.Kind()) + println("kind(*p) =", v.Elem().Kind()) + println("type(*p) =", v.Elem().Type()) - v = v.Elem() + v = v.Elem() - println("*p = {") - for i := 0; i < v.NumField(); i++ { - ft := v.Type().Field(i) - fv := v.Field(i) - println(" ", ft.Name(), ":", fv.Interface()) - } - println("}") + println("*p = {") + for i := 0; i < v.NumField(); i++ { + ft := v.Type().Field(i) + fv := v.Field(i) + println(" ", ft.Name(), ":", fv.Interface()) + } + println("}") } ``` -The  _semihosting.OpenFile_  function allows to open/create file on the host side. The special path  _:tt_ corresponds to host’s standard output. +_semihosting.OpenFile_ 函数允许在主机端 打开/创建 文件。特殊路径 _:tt_ 对应于主机的标准输出。 -The  _println_  function accepts arbitrary number of arguments, each of arbitrary type: +_println_ 函数接受任意数量的参数,每个参数的类型都是任意的: ``` func println(args ...interface{}) - ``` -It’s possible because any type implements the empty interface  _interface{}_ . The  _println_  uses [type switch][15] to print strings, integers and booleans: +可能是因为任何类型都实现了空接口 _interface{}_。 _println_ 使用 [类型开关][15] 打印字符串,整数和布尔值: ``` switch v := a.(type) { case string: - stdout.WriteString(v) + stdout.WriteString(v) case int: - strconv.WriteInt(stdout, v, 10, 0, 0) + strconv.WriteInt(stdout, v, 10, 0, 0) case bool: - strconv.WriteBool(stdout, v, 't', 0, 0) + strconv.WriteBool(stdout, v, 't', 0, 0) case stringer: - stdout.WriteString(v.String()) + stdout.WriteString(v.String()) default: - stdout.WriteString("%unknown") + stdout.WriteString("%unknown") } - ``` -Additionally it supports any type that implements  _stringer_  interface, that is, any type that has  _String()_ method. In any  _case_  clause the  _v_  variable has the right type, same as listed after  _case_  keyword. +此外,它还支持任何实现了 _stringer_ 接口的类型,即任何具有 _String()_ 方法的类型。在任何 _case_ 子句中,_v_ 变量具有正确的类型,与 _case_ 关键字后列出的类型相同。 -The `reflect.ValueOf(p)` returns  _p_  in the form that allows to analyze its type and content programmatically. As you can see, we can even dereference pointers using `v.Elem()` and print all struct fields with their names. -Let’s try to compile this code. For now let’s see what will come out if compiled without type and field names: +reflect.ValueOf(p) 函数以允许以编程方式分析其类型和内容的形式返回 _p_。如您所见,我们甚至可以使用 `v.Elem()` 取消引用指针,并打印所有结构体及其名称。 + +让我们尝试编译这段代码。现在,让我们看看如果不使用类型和字段名进行编译会产生什么结果: ``` $ egc -nt -nf -$ arm-none-eabi-size cortexm0.elf +$ arm-none-eabi-size cortexm0.elf text data bss dec hex filename 16028 216 312 16556 40ac cortexm0.elf - ``` -Only 140 free bytes left on the Flash. Let’s load it using OpenOCD with semihosting enabled: +闪存上只剩下 140 个可用字节。让我们使用启用了 semihosting 的 OpenOCD 加载它: ``` $ openocd -d0 -f interface/stlink.cfg -f target/stm32f0x.cfg -c 'init; program cortexm0.elf; arm semihosting enable; reset run' @@ -899,12 +871,12 @@ adapter speed: 1000 kHz adapter_nsrst_delay: 100 none separate adapter speed: 950 kHz -target halted due to debug-request, current mode: Thread +target halted due to debug-request, current mode: Thread xPSR: 0xc1000000 pc: 0x08002338 msp: 0x20000a20 adapter speed: 4000 kHz ** Programming Started ** auto erase enabled -target halted due to breakpoint, current mode: Thread +target halted due to breakpoint, current mode: Thread xPSR: 0x61000000 pc: 0x2000003a msp: 0x20000a20 wrote 16384 bytes from file cortexm0.elf in 0.700133s (22.853 KiB/s) ** Programming Finished ** @@ -912,27 +884,25 @@ semihosting is enabled adapter speed: 950 kHz kind(p) = ptr kind(*p) = struct -type(*p) = +type(*p) = *p = { X. : -123 X. : true } - ``` -If you’ve actually run this code, you noticed that semihosting is slow, especially if you write a byte after byte (buffering helps). +如果您实际运行过此代码,则会注意到 semihosting 运行缓慢,尤其是在逐字节写入时(缓冲很有用)。 -As you can see, there is no type name for `*p` and all struct fields have the same  _X._  name. Let’s compile this program again, this time without  _-nt -nf_  options: +如您所见,`*p` 没有类型名称,并且所有结构字段都具有相同的 _X._ 名称。让我们再次编译该程序,这次不带 _-nt -nf_ 选项: ``` $ egc -$ arm-none-eabi-size cortexm0.elf +$ arm-none-eabi-size cortexm0.elf text data bss dec hex filename 16052 216 312 16580 40c4 cortexm0.elf - ``` -Now the type and field names have been included but only these defined in  ~~_main.go_  file~~  _main_  package. The output of our program looks as follows: +现在已经包括了类型和字段名称,但仅在 ~~_main.go_ 文件中~~ _main_ 包中定义了它们。该程序的输出如下所示: ``` kind(p) = ptr @@ -942,12 +912,11 @@ type(*p) = S A : -123 B : true } - ``` -Reflection is a crucial part of any easy to use serialization library and serialization ~~algorithms~~ like [JSON][16]gain in importance in the IOT era. +反射是任何易于使用的序列化库的关键部分,而像 [JSON][16] 这样的序列化 ~~算法~~ 在物联网IoT时代也越来越重要。 -This is where I finish the second part of this article. I think there is a chance for the third part, more entertaining, where we connect to this board various interesting devices. If this board won’t carry them, we replace it with something a little bigger. +这些就是我完成的本文的第二部分。我认为有机会进行第三部分,更具娱乐性的部分,在那里我们将各种有趣的设备连接到这块板上。如果这块板装不下,我们就换一块大一点的。 -------------------------------------------------------------------------------- From 904f96a3cbae77058728befd87fb85776cc3206e Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Sat, 10 Oct 2020 12:37:17 +0800 Subject: [PATCH 0400/1156] =?UTF-8?q?=E5=B0=86=E8=AF=91=E6=96=87=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E5=88=B0=20translated/tech/=20=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20180414 Go on very small hardware Part 2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename {sources => translated}/tech/20180414 Go on very small hardware Part 2.md (99%) diff --git a/sources/tech/20180414 Go on very small hardware Part 2.md b/translated/tech/20180414 Go on very small hardware Part 2.md similarity index 99% rename from sources/tech/20180414 Go on very small hardware Part 2.md rename to translated/tech/20180414 Go on very small hardware Part 2.md index ab4f10a9ec..4eaf203686 100644 --- a/sources/tech/20180414 Go on very small hardware Part 2.md +++ b/translated/tech/20180414 Go on very small hardware Part 2.md @@ -923,7 +923,7 @@ type(*p) = S via: https://ziutek.github.io/2018/04/14/go_on_very_small_hardware2.html 作者:[Michał Derkacz ][a] -译者:[译者ID](https://github.com/译者ID) +译者:[gxlct008](https://github.com/gxlct008) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 575581ff961ebfd93473d0a8a740e4242f163dc8 Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Sat, 10 Oct 2020 16:37:54 +0800 Subject: [PATCH 0401/1156] =?UTF-8?q?=E7=94=B3=E9=A2=86=E5=8E=9F=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md b/sources/tech/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md index e9d910abdf..5ef25c8ef5 100644 --- a/sources/tech/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md +++ b/sources/tech/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (gxlct008) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From b8366f40bc7370dcf330bc82905b323967c1bdd7 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 10 Oct 2020 22:30:19 +0800 Subject: [PATCH 0402/1156] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @rakino 这个网站的文章都很有趣,很有价值,感谢翻译! --- ...ings You Didn-t Know About GNU Readline.md | 48 +++++++++---------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/translated/talk/20190822 Things You Didn-t Know About GNU Readline.md b/translated/talk/20190822 Things You Didn-t Know About GNU Readline.md index a932974147..42bc20f43d 100644 --- a/translated/talk/20190822 Things You Didn-t Know About GNU Readline.md +++ b/translated/talk/20190822 Things You Didn-t Know About GNU Readline.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (rakino) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Things You Didn't Know About GNU Readline) @@ -10,17 +10,19 @@ 你所不知的 GNU Readline ====== -有时我会觉得自己的计算机是一栋非常大的房子,我每天都会访问这栋房子,也对一楼的大部分房间都了如指掌,但仍然还是有卧室我没有去过,有衣柜我没有打开过,有犄角旮旯我没有探索过。我感到有必要更多地了解我的计算机了,就像任何人都会觉得有必要看看自己家里从未去过的房间一样。 +![](https://img.linux.net.cn/data/attachment/album/202010/10/222755etdndudtu97wddz7.jpg) -GNU Readline 是个不起眼的小软件库,我依赖了它多年却没有意识到它的存在,也许有成千上万的人每天都在不经意间使用它。如果你用 Bash shell 的话,每当你补全一个文件名,或者在一行文本输入中移动光标,以及搜索之前命令的历史记录时,你都在使用 GNU Readline;当你在 Postgres(`psql`)或是 Ruby REPL(`irb`)的命令行界面中进行同样的操作时,你依然在使用 GNU Readline。很多软件都依赖 GNU Readline 库来实现用户所期望的功能,不过这些功能是如此的辅助与不显眼,以至于在我看来很少有人会停下来去想它是从哪里来的。 +有时我会觉得自己的计算机是一栋非常大的房子,我每天都会访问这栋房子,也对一楼的大部分房间都了如指掌,但仍然还是有我没有去过的卧室,有我没有打开过的衣柜,有我没有探索过的犄角旮旯。我感到有必要更多地了解我的计算机了,就像任何人都会觉得有必要看看自己家里从未去过的房间一样。 -GNU Readline 最初是自由软件基金会在 20 世纪 80 年代创建的,如今作为每个人的基础计算设施的重要组成部分的它,由一位志愿者维护。 +GNU Readline 是个不起眼的小软件库,我依赖了它多年却没有意识到它的存在,也许有成千上万的人每天都在不经意间使用它。如果你用 Bash shell 的话,每当你自动补全一个文件名,或者在输入的一行文本中移动光标,以及搜索之前命令的历史记录时,你都在使用 GNU Readline;当你在 Postgres(`psql`)或是 Ruby REPL(`irb`)的命令行界面中进行同样的操作时,你依然在使用 GNU Readline。很多软件都依赖 GNU Readline 库来实现用户所期望的功能,不过这些功能是如此的辅助与不显眼,以至于在我看来很少有人会停下来去想它是从哪里来的。 + +GNU Readline 最初是自由软件基金会在 20 世纪 80 年代创建的,如今作为每个人的基础计算设施的重要的、甚至看不见的组成部分的它,由一位志愿者维护。 ### 充满特色 -GNU Readline 库的存在,主要是为了用一组通用的按键来增强任何命令行界面,从而使你可以在一行输入中移动和编辑。例如,在 Bash 提示符中按下 `Ctrl-A`,你的光标会跳到行首,而按下 `Ctrl-E` 则会跳到行末;另一个有用的命令是 `Ctrl-U`,它会删除该行中光标之前的所有内容。 +GNU Readline 库的存在,主要是为了增强各种命令行界面,它提供了一组通用的按键,使你可以在一个单行输入中移动和编辑。例如,在 Bash 提示符中按下 `Ctrl-A`,你的光标会跳到行首,而按下 `Ctrl-E` 则会跳到行末;另一个有用的命令是 `Ctrl-U`,它会删除该行中光标之前的所有内容。 -有很长一段时间,我通过反复敲击方向键来在命令行上移动,如今看来这十分尴尬,也不知道为什么,当时的我从来没有想过可以有一种更快的方法。当然了,没有一个熟悉 Vim 或 Emacs 这种文本编辑器的程序员愿意长时间地击打方向键,所以像 Readline 这样的东西必然会被创造出来;不过在 Readline 上可以做的绝非仅仅跳来跳去,你可以像使用文本编辑器那样编辑单行文本——这里有删除单词、换位、大写单词、复制和粘贴字符等命令。Readline 的大部分按键/快捷键都是基于 Emacs 的,它基本上就是一个单行文本版的 Emacs 了,甚至还有录制和重放宏的功能。 +有很长一段时间,我通过反复敲击方向键来在命令行上移动,如今看来这十分尴尬,也不知道为什么,当时的我从来没有想过可以有一种更快的方法。当然了,没有哪一个熟悉 Vim 或 Emacs 这种文本编辑器的程序员愿意长时间地击打方向键,所以像 Readline 这样的东西必然会被创造出来。在 Readline 上可以做的绝非仅仅跳来跳去,你可以像使用文本编辑器那样编辑单行文本——这里有删除单词、单词换位、大写单词、复制和粘贴字符等命令。Readline 的大部分按键/快捷键都是基于 Emacs 的,它基本上就是一个单行文本版的 Emacs 了,甚至还有录制和重放宏的功能。 我从来没有用过 Emacs,所以很难记住所有不同的 Readline 命令。不过 Readline 有着很巧妙的一点,那就是能够切换到基于 Vim 的模式,在 Bash 中可以使用内置的 `set` 命令来这样做。下面会让 Readline 在当前的 shell 中使用 Vim 风格的命令: @@ -30,17 +32,17 @@ $ set -o vi 该选项启用后,就可以使用 `dw` 等命令来删除单词了,此时相当于 Emacs 模式下的 `Ctrl-U` 的命令是 `d0`。 -我第一次知道有这个功能的时候很兴奋地想尝试一下,但它对我来说并不是那么好用。我很高兴知道有这种对 Vim 用户的让步,在使用这个功能上你可能会比我更幸运,尤其是你还没有使用 Readline 的默认按键的话;我的问题在于,我听说有基于 Vim 的界面时已经学会了几种默认按键,因此即使启用了 Vim 的选项,也一直在错误地用着默认的按键;另外因为没有某种指示器,所以 Vim 的多模态设计在这里会很尴尬——你很容易就忘记了自己处于哪个模式,就因为这样,我卡在了一种虽然使用 Vim 作为文本编辑器,但却在 Readline 上用着 Emacs 风格的命令的情况里,我猜其他很多人也是这样的。 +我第一次知道有这个功能的时候很兴奋地想尝试一下,但它对我来说并不是那么好用。我很高兴知道有这种对 Vim 用户的让步,在使用这个功能上你可能会比我更幸运,尤其是你还没有使用 Readline 的默认按键的话;我的问题在于,我听说有基于 Vim 的界面时已经学会了几种默认按键,因此即使启用了 Vim 的选项,也一直在错误地用着默认的按键;另外因为没有某种指示器,所以 Vim 的模态设计在这里会很尴尬——你很容易就忘记了自己处于哪个模式,就因为这样,我卡在了一种虽然使用 Vim 作为文本编辑器,但却在 Readline 上用着 Emacs 风格的命令的情况里,我猜其他很多人也是这样的。 -如果你觉得 Vim 和 Emacs 的键盘命令系统诡异而神秘,你可以按照喜欢的方式自定义 Readline 的键绑定,这并不难。Readline 在启动时会读取文件 `~/.inputrc`,它可以用来配置各种选项与键绑定,我做的一件事是重新配置了 `Ctrl-K`:通常情况下该命令会从光标处删除到行末,但我很少这样做,所以我在 `~/.inputrc` 中添加了以下内容,把它绑定为直接删除整行: +如果你觉得 Vim 和 Emacs 的键盘命令系统诡异而神秘(这并不是没有道理的),你可以按照喜欢的方式自定义 Readline 的键绑定。Readline 在启动时会读取文件 `~/.inputrc`,它可以用来配置各种选项与键绑定,我做的一件事是重新配置了 `Ctrl-K`:通常情况下该命令会从光标处删除到行末,但我很少这样做,所以我在 `~/.inputrc` 中添加了以下内容,把它绑定为直接删除整行: ``` Control-k: kill-whole-line ``` -每个 Readline 命令(文档中称它们为 _函数_ )都有一个名称,你可以用这种方式将其与一个键序联系起来。如果你在 Vim 中编辑 `~/.inputrc`,就会发现 Vim 知道这种文件类型,还会帮你高亮显示有效的函数名,而不高亮无效的函数名。 +每个 Readline 命令(文档中称它们为 “函数” )都有一个名称,你可以用这种方式将其与一个键序列联系起来。如果你在 Vim 中编辑 `~/.inputrc`,就会发现 Vim 知道这种文件类型,还会帮你高亮显示有效的函数名,而不高亮无效的函数名。 -`~/.inputrc` 可以做的另一件事是通过将键序映射到输入字符串上来创建预制宏。[Readline 手册][1]给出了一个我认为特别有用的例子:我经常想把一个程序的输出保存到文件中,这意味着我得经常在 Bash 命令中追加类似 `> output.txt` 这样的东西,为了节省时间,可以把它做成一个 Readline 宏。 +`~/.inputrc` 可以做的另一件事是通过将键序列映射到输入字符串上来创建预制宏。[Readline 手册][1]给出了一个我认为特别有用的例子:我经常想把一个程序的输出保存到文件中,这意味着我得经常在 Bash 命令中追加类似 `> output.txt` 这样的东西,为了节省时间,可以把它做成一个 Readline 宏: ``` Control-o: "> output.txt" @@ -48,35 +50,35 @@ Control-o: "> output.txt" 这样每当你按下 `Ctrl-O` 时,你都会看到 `> output.txt` 被添加到了命令行光标的后面,这样很不错! -不过你可以用宏做的可不仅仅是为文本串创建快捷方式;在 `~/.inputrc` 中使用以下条目意味着每次按下 `Ctrl-J` 时,行内已有的文本都会被 `$(` 和 `)` 包裹住。该宏先用 `Ctrl-A` 移动到行首,添加 `$(` ,然后再用 `Ctrl-E` 移动到行尾,添加 `)`。 +不过你可以用宏做的可不仅仅是为文本串创建快捷方式;在 `~/.inputrc` 中使用以下条目意味着每次按下 `Ctrl-J` 时,行内已有的文本都会被 `$(` 和 `)` 包裹住。该宏先用 `Ctrl-A` 移动到行首,添加 `$(` ,然后再用 `Ctrl-E` 移动到行尾,添加 `)`: ``` Control-j: "\C-a$(\C-e)" ``` -如果你经常需要像下面这样把一个命令的输出用于另一个命令的话,这个宏可能会对你有帮助。 +如果你经常需要像下面这样把一个命令的输出用于另一个命令的话,这个宏可能会对你有帮助: ``` $ cd $(brew --prefix) ``` -`~/.inputrc` 文件也允许你为 Readline 手册中所谓的 _变量_ 设置不同的值,这些变量会启用或禁用某些 Readline 行为,你也可以使用这些变量来改变 Readline 中像是自动补全或者历史搜索这些行为的工作方式。我建议开启的一个变量是 `revert-all-at-newline`,它是默认关闭的,当这个变量关闭时,如果你使用反向搜索功能从命令历史记录中提取一行并编辑,但随后又决定搜索另一行,那么你所做的编辑会被保存在历史记录中。我觉得这样会很混乱,因为这会导致你的 Bash 命令历史中出现从未运行过的行。所以在你的 `~/.inputrc` 中加入这个: +`~/.inputrc` 文件也允许你为 Readline 手册中所谓的 “变量” 设置不同的值,这些变量会启用或禁用某些 Readline 行为,你也可以使用这些变量来改变 Readline 中像是自动补全或者历史搜索这些行为的工作方式。我建议开启的一个变量是 `revert-all-at-newline`,它是默认关闭的,当这个变量关闭时,如果你使用反向搜索功能从命令历史记录中提取一行并编辑,但随后又决定搜索另一行,那么你所做的编辑会被保存在历史记录中。我觉得这样会很混乱,因为这会导致你的 Bash 命令历史中出现从未运行过的行。所以在你的 `~/.inputrc` 中加入这个: ``` set revert-all-at-newline on ``` -在你用 `~/.inputrc` 设置了选项或键绑定以后,它们会适用于任何使用 Readline 库的地方,显然 Bash 包括在内,不过你也会在其它像是 `irb` 和 `psql` 这样的程序中受益。如果你经常使用关系型数据库的命令行界面,一个用于插入 `SELECT * FROM` 的 Readline 宏可能会很有用。 +在你用 `~/.inputrc` 设置了选项或键绑定以后,它们会适用于任何使用 Readline 库的地方,显然 Bash 也包括在内,不过你也会在其它像是 `irb` 和 `psql` 这样的程序中受益。如果你经常使用关系型数据库的命令行界面,一个用于插入 `SELECT * FROM` 的 Readline 宏可能会很有用。 ### Chet Ramey GNU Readline 如今由凯斯西储大学的高级技术架构师 Chet Ramey 维护,Ramey 同时还负责维护 Bash shell;这两个项目都是由一位名叫 Brian Fox 的自由软件基金会员工在 1988 年开始编写的,但从 1994 年左右开始,Ramey 一直是它们唯一的维护者。 -Ramey 通过电子邮件告诉我,Readline 远非一个原创的想法,它是为了实现 POSIX 规范所规定的功能而被创建的,而 POSIX 规范又是在 20 世纪 80 年代末被制定的。许多早期的 shell,包括 Korn shell 和至少一个版本的 Unix System V shell,都包含行编辑功能。1988 年版的 Korn shell(`ksh88`)提供了 Emacs 风格和 Vi/Vim 风格的编辑模式。据我从[手册页][2]中得知,Korn shell 会通过查看 `VISUAL` 和 `EDITOR` 环境变量来决定你使用的模式,这一点非常巧妙。POSIX 中指定 shell 功能的部分近似于 `ksh88` 的实现,所以 GNU Bash 也要实现一个类似的灵活的行编辑系统来保持兼容,因此就有了Readline。 +Ramey 通过电子邮件告诉我,Readline 远非一个原创的想法,它是为了实现 POSIX 规范所规定的功能而被创建的,而 POSIX 规范又是在 20 世纪 80 年代末被制定的。许多早期的 shell,包括 Korn shell 和至少一个版本的 Unix System V shell,都包含行编辑功能。1988 年版的 Korn shell(`ksh88`)提供了 Emacs 风格和 Vi/Vim 风格的编辑模式。据我从[手册页][2]中得知,Korn shell 会通过查看 `VISUAL` 和 `EDITOR` 环境变量来决定你使用的模式,这一点非常巧妙。POSIX 中指定 shell 功能的部分近似于 `ksh88` 的实现,所以 GNU Bash 也要实现一个类似的灵活的行编辑系统来保持兼容,因此就有了 Readline。 -Ramey 第一次参与 Bash 开发时,Readline 还是 Bash 项目目录下的一个源文件,它真的只是 Bash 的一部分;随着时间的推移,Readline 文件慢慢地成为了独立的项目,不过还要等到 1994 年(Readline 的 2.0 版本)Readline 才完全成为了一个独立的库。 +Ramey 第一次参与 Bash 开发时,Readline 还是 Bash 项目目录下的一个单一的源文件,它其实只是 Bash 的一部分;随着时间的推移,Readline 文件慢慢地成为了独立的项目,不过直到 1994 年(Readline 2.0 版本发布),Readline 才完全成为了一个独立的库。 -Readline 与 Bash 密切相关,Ramey 也通常把 Readline 与 Bash 的发布配对,但正如我上面提到的,Readline 是一个可以被任何有命令行接口的软件使用的库,而且它真的很容易使用。下面是一个例子,虽然简单,但这就是在 C 程序中使用 Readline 的方法。向 `readline()` 函数传递的字符串参数就是你希望 Readline 向用户显示的提示符: +Readline 与 Bash 密切相关,Ramey 也通常把 Readline 与 Bash 的发布配对,但正如我上面提到的,Readline 是一个可以被任何有命令行界面的软件使用的库,而且它真的很容易使用。下面是一个例子,虽然简单,但这就是在 C 程序中使用 Readline 的方法。向 `readline()` 函数传递的字符串参数就是你希望 Readline 向用户显示的提示符: ``` #include @@ -100,20 +102,14 @@ int main(int argc, char** argv) $ gcc main.c -lreadline ``` -当然,Readline 的 API 比起那个单一的函数要丰富得多,任何使用它的人都可以对库的行为进行各种调整,库的用户(开发者)甚至可以添加新的函数,来让最终用户可以通过 `~/.inputrc` 来配置它们,这意味着 Readline 非常容易扩展。但是据我所知,即使是 Bash ,虽然事先有很多配置,最终也会像上面的例子一样调用简单的 `readline()` 函数来获取输入。(参见 GNU Bash 源代码中的[这一行][3],Bash 似乎在这里将获取输入的责任交给了 Readline)。 +当然,Readline 的 API 比起那个单一的函数要丰富得多,任何使用它的人都可以对库的行为进行各种调整,库的用户(开发者)甚至可以添加新的函数,来让最终用户可以通过 `~/.inputrc` 来配置它们,这意味着 Readline 非常容易扩展。但是据我所知,即使是 Bash ,虽然事先有很多配置,最终也会像上面的例子一样调用简单的 `readline()` 函数来获取输入。(参见 GNU Bash 源代码中的[这一行][3],Bash 似乎在这里将获取输入的责任交给了 Readline)。 -Ramey 现在已经在 Bash 和 Readline 上工作了十多年,但他的工作却从来没有得到过报酬——他一直都是一名志愿者。尽管 Ramey 说 Readline 的变化比 Bash 慢得多,但 Bash 和 Readline 仍然在积极开发中。我问 Ramey 作为这么多人使用的软件唯一的维护者是什么感觉,他说可能有几百万人在不知不觉中使用 Bash(因为每个苹果设备都运行 Bash),这让他担心一个突破性的变化会造成多大的破坏,不过他已经慢慢习惯了所有这些人的想法。他还说他会继续在 Bash 和 Readline 上工作,因为在这一点上他已经深深地投入了,而且他也只是单纯地喜欢把有用的软件提供给世界。 +Ramey 现在已经在 Bash 和 Readline 上工作了二十多年,但他的工作却从来没有得到过报酬 —— 他一直都是一名志愿者。Bash 和 Readline 仍然在积极开发中,尽管 Ramey 说 Readline 的变化比 Bash 慢得多。我问 Ramey 作为这么多人使用的软件唯一的维护者是什么感觉,他说可能有几百万人在不知不觉中使用 Bash(因为每个苹果设备都运行 Bash),这让他担心一个破坏性的变化会造成多大的混乱,不过他已经慢慢习惯了所有这些人的想法。他还说他会继续在 Bash 和 Readline 上工作,因为在这一点上他已经深深地投入了,而且他也只是单纯地喜欢把有用的软件提供给世界。 _你可以在 [Chet Ramey 的网站][4]上找到更多关于他的信息。_ _喜欢这篇文章吗?我会每四周写出一篇像这样的文章。关注推特帐号 [@TwoBitHistory][5] 或者[订阅 RSS][6] 来获取更新吧!_ -_TwoBitHistory 的上一条消息:_ - -> 请欣赏我拖欠已久的新文章,我在里面以 BBC Micro 和计算机认知计划的故事作为出发点抱怨了一下 Codecademy。 -> -> — TwoBitHistory (@TwoBitHistory) [三月 31,2019][7] - -------------------------------------------------------------------------------- via: https://twobithistory.org/2019/08/22/readline.html @@ -121,7 +117,7 @@ via: https://twobithistory.org/2019/08/22/readline.html 作者:[Two-Bit History][a] 选题:[lujun9972][b] 译者:[rakino](https://github.com/rakino) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ee7494ef30d14729f250a89f80a0e7fac3483e5e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 10 Oct 2020 22:30:44 +0800 Subject: [PATCH 0403/1156] PUB @rakino https://linux.cn/article-12706-1.html --- .../20190822 Things You Didn-t Know About GNU Readline.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20190822 Things You Didn-t Know About GNU Readline.md (99%) diff --git a/translated/talk/20190822 Things You Didn-t Know About GNU Readline.md b/published/20190822 Things You Didn-t Know About GNU Readline.md similarity index 99% rename from translated/talk/20190822 Things You Didn-t Know About GNU Readline.md rename to published/20190822 Things You Didn-t Know About GNU Readline.md index 42bc20f43d..12dc0a568d 100644 --- a/translated/talk/20190822 Things You Didn-t Know About GNU Readline.md +++ b/published/20190822 Things You Didn-t Know About GNU Readline.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (rakino) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12706-1.html) [#]: subject: (Things You Didn't Know About GNU Readline) [#]: via: (https://twobithistory.org/2019/08/22/readline.html) [#]: author: (Two-Bit History https://twobithistory.org) From 339b9766875a38a89fd2c6ac16835a928cc15212 Mon Sep 17 00:00:00 2001 From: Hilton Chain <26847027+rakino@users.noreply.github.com> Date: Sun, 11 Oct 2020 00:52:20 +0800 Subject: [PATCH 0404/1156] translating --- ...0 6 Essential Things To Do After Installing Manjaro Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201010 6 Essential Things To Do After Installing Manjaro Linux.md b/sources/tech/20201010 6 Essential Things To Do After Installing Manjaro Linux.md index d5c7b4a38e..52fc1937d4 100644 --- a/sources/tech/20201010 6 Essential Things To Do After Installing Manjaro Linux.md +++ b/sources/tech/20201010 6 Essential Things To Do After Installing Manjaro Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (rakino) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From afeaba43ea3638d31a4af84290d9d47efe457168 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 11 Oct 2020 05:01:50 +0800 Subject: [PATCH 0405/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201010?= =?UTF-8?q?=205=20qualities=20of=20great=20open=20source=20developer=20adv?= =?UTF-8?q?ocates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201010 5 qualities of great open source developer advocates.md --- ...f great open source developer advocates.md | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 sources/tech/20201010 5 qualities of great open source developer advocates.md diff --git a/sources/tech/20201010 5 qualities of great open source developer advocates.md b/sources/tech/20201010 5 qualities of great open source developer advocates.md new file mode 100644 index 0000000000..e8c7e8d9f5 --- /dev/null +++ b/sources/tech/20201010 5 qualities of great open source developer advocates.md @@ -0,0 +1,91 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 qualities of great open source developer advocates) +[#]: via: (https://opensource.com/article/20/10/open-source-developer-advocates) +[#]: author: (Jason Blais https://opensource.com/users/jasonblais) + +5 qualities of great open source developer advocates +====== +Whether you're looking to hire a developer advocate or become one, here +are the qualities to aim for. +![Women talking][1] + +The developer relations job category is less than 10 years old, and [the developer advocate role is even newer][2]. In essence, developer advocates represent the voice of the user—in this case, that's usually the developer—internally to the company and the voice of the company externally to the community. + +[Mattermost][3] depends on its developer advocates to be the bridge between the community and the organization. At Mattermost, a developer advocate's three primary areas of responsibility are: + + * Raising awareness among developers about the open source project, including educating users and helping them get the most out of the platform + * Building strong relationships with users across open source and developer communities + * Advocating for users internally with the product team by sharing the community's feedback and challenges + + + +Not everyone is cut out to succeed as an open source developer advocate. With that in mind, here are the top five qualities we've identified in outstanding developer advocates. + +### 1\. A genuine passion for helping others + +Developer advocates often start as developers or in other highly technical roles. They excel at their job but get less pleasure from creating solutions than they do by helping others do the same. + +Over time, they turn this enthusiasm into enabling and empowering other developers to be successful. They naturally evolve into developer advocates by educating and helping users get the most out of the platforms they're working with. + +Passion is one of the most important qualities of a developer advocate. To advocate for the user both internally and externally, they must put the user and the community first. This does not happen without genuine motivation to help others succeed. + +### 2\. An authentic communication style + +An outstanding developer advocate has a passion for writing and talking about technology—whether they're solving technical challenges, providing knowledge about specific frameworks (e.g., Kubernetes), or sharing solutions built on top of a platform. + +But when they share their knowledge, they must be careful not to be perceived as promoting a specific platform or product. If any group is turned off by inauthentic marketing, [it is developers][4]. Developer relations is [not the same as developer marketing][5]. That is why authenticity is critical when connecting with developer communities—particularly in open source. + +Combining these creates an authentic communicator who captures developers' attention and pulls people in. That engagement enables them to raise awareness, educate to help users get the most out of the platform, and build strong relationships with users—the three main areas that developer advocates own. + +### 3\. A natural flair for building relationships + +Developer advocates are typically extroverts. Through their authenticity and passion for helping others, they can build strong relationships with users and members of the community. + +The truly outstanding advocates have a natural flair for creating connections through their superb networking skills. They also know where the communities exist, whether it's Reddit, Twitter, meetup groups, forums, or chat channels. + +Why is having a natural flair for creating relationships so important? + +First, developer advocates bring their existing connections to developers and open source communities when they join a team. Second, they come in knowing the right social media and developer channels to reach developers and open source users. Finally, they create new relationships with community influencers and open source leaders that can give your platform an opportunity to grow rapidly. + +### 4\. A personal investment in the community + +As I mentioned, developer advocates are not only the advocates of users internally; they are also the voice of the company externally to the community. This allows them to develop their own personal brand and "street cred" that they will carry with them after they move on to another company or community. + +When a developer advocate cares about their personal brand and has a personal investment in what they do, they are typically more motivated. Not only are they responsible for cultivating the company's brand, but they are also putting their own reputation on the line. This can be frightening to some. But those who are brave and willing to personally commit have the edge needed to excel as a developer advocate. + +As a side note, developer advocates who are employed by the company they're advocating for should work as part of the community and put the community ahead of themselves. They must be willing to continuously learn from and with the community, be a team player, and never put their own brand ahead of the company or community. + +### 5\. Technical sharpness + +The final key attribute of great developer advocates is their technical sharpness. Are they knowledgeable about cutting-edge technologies, languages, and frameworks? Do they learn technologies and tools easily? Are they self-taught, self-resourced learners? + +Since other developers will look to them for guidance, it is important for developer advocates to be highly technical with several years of relevant experience in software development or DevOps. Without already being a developer (or otherwise highly technical), it would be difficult to really understand the developer mindset and know what tickles their curiosity. + +### Other characteristics + +These five qualities—a genuine passion for helping others, authentic communication capabilities, a natural flair for building relationships, a personal investment, and technical sharpness—are Mattermost's core characteristics in outstanding open source developer advocates. Are there any other must-have qualities I've missed? Let me know in the comments! + +_Thank you to Justin Reynolds for the valuable edits on this article._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/open-source-developer-advocates + +作者:[Jason Blais][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://opensource.com/users/jasonblais +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/conversation-interview-mentor.png?itok=HjoOPcrB (Women talking) +[2]: https://medium.com/@ashleymcnamara/what-is-developer-advocacy-3a92442b627c +[3]: http://mattermost.com/ +[4]: https://hackernoon.com/developer-marketing-allergies-authenticity-622014fdebfb +[5]: https://medium.com/@aspleenic/developer-relations-and-developer-marketing-they-arent-the-same-thing-35b896159825 From 10596fc25aa89c4886f3140d9e7e04588704495c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 11 Oct 2020 05:02:09 +0800 Subject: [PATCH 0406/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201010?= =?UTF-8?q?=20Robust=20and=20Race-free=20Server=20Logging=20using=20Named?= =?UTF-8?q?=20Pipes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201010 Robust and Race-free Server Logging using Named Pipes.md --- ...e-free Server Logging using Named Pipes.md | 114 ++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 sources/tech/20201010 Robust and Race-free Server Logging using Named Pipes.md diff --git a/sources/tech/20201010 Robust and Race-free Server Logging using Named Pipes.md b/sources/tech/20201010 Robust and Race-free Server Logging using Named Pipes.md new file mode 100644 index 0000000000..f969bbac18 --- /dev/null +++ b/sources/tech/20201010 Robust and Race-free Server Logging using Named Pipes.md @@ -0,0 +1,114 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Robust and Race-free Server Logging using Named Pipes) +[#]: via: (https://theartofmachinery.com/2020/10/10/logging_with_named_pipes.html) +[#]: author: (Simon Arneaud https://theartofmachinery.com) + +Robust and Race-free Server Logging using Named Pipes +====== + +If you do any server administration work, you’ll have worked with log files. And if your servers need to be reliable, you’ll know that log files are common source of problems, especially when you need to rotate or ship them (which is practically always). In particular, moving files around causes race conditions. + +Thankfully, there are better ways. With named pipes, you can have a simple and robust logging framework, with no race conditions, and without patching your servers to support some network logging protocol. + +### The problems with rotating log files + +First, let’s talk about the problems. Race conditions are generally a problem with popular file-based logging setups, whether you’re rotating logs into archival storage, or shipping them to a remote log processing stack, or whatever. To keep things concrete, though, let me talk about [logrotate][1], just because it’s a popular tool. + +Say you have a log file at `/var/log/foo`. It gets pretty big, and you want to process the logs periodically and start with a new, empty file. So you (or your distro maintainers) set up logrotate with various rules about when to rotate the file. + +By default, logrotate will rename the file (to something like `/var/log/foo.1`) and create a new `/var/log/foo` to write to. That (mostly) works for software that runs intermittently (such as a package manager that does software updates). But it won’t do any good if the log file is generated by a long-running server. The server only uses the filename when it opens the file; after that it just keeps writing to its open file descriptor. That means it will keep writing to the old file (now named `/var/log/foo.1`), and the new `/var/log/foo` file will stay empty. + +To handle this use-case, logrotate supports another mode: `copytruncate`. In this mode, instead of renaming, logrotate will copy the contents of `/var/log/foo` to an archival file, and then truncate the original file to zero length. As long as the server has the log file open in append mode, it will automatically write new logs to the start of the file, without needing to detect the truncation and do a file seek (the kernel handles that). + +That `copytruncate` mode creates a race condition, though. Any log lines that are written after the copy but before the truncation will get destroyed. Actually, you tend to get the same race condition even with the default move-and-create mode. That’s because there’s not much point just splitting up the logs into multiple files. Most systems are configured to do something like compress the old log file, but ultimately you need to delete the old, uncompressed data, which creates the same race as truncating. (In practice, this race isn’t so likely for occasional log writers, like package managers, and the `delay` flag to logrotate makes it rarer, albeit by making the log handling a bit more complicated.) + +Some servers, like [Nginx][2], support a modification of the default logrotate mode: + + 1. Rename the old file + 2. Create the new file + 3. (New step) notify the server that it needs to reopen its log file. + + + +This works (as long as the logs processor doesn’t delete the old file before the server has finished reopening), but it requires special support from the server, and you’re out of luck with most software. There’s a lot of software out there, and log file handling just isn’t interesting enough to get high on the to-do list. This approach also only works for long-running servers. + +I think this is a good point to stop and take a step back. Having multiple processes juggle log files around on disk without any synchronisation is just an inherently painful way to do things. It causes bugs and makes logging stacks complicated ([here’s just one of many examples][3]). One alternative is to use some network protocol like MQTT or networked syslog, but, realistically, most servers won’t support the one you want. And they shouldn’t have to — log files are a great interface for log writers. + +That’s okay because *nix “everything is a file” lets us easily get a file interface on the writer side, with a streaming interface on the reader side. + +### Named pipes 101 + +Maybe you’ve seen pipes in pipelines like this: + +``` +$ sort user_log.txt | uniq +``` + +The pipe connecting `sort` and `uniq` is a temporary, anonymous communication channel that `sort` writes to and `uniq` reads from. Named pipes are less common, but they’re also communication channels. The only difference is that they persist on the filesystem as if they were files. + +Open up a terminal and `cd` into some temporary working directory. The following creates a named pipe and uses `cat` to open a writer: + +``` +$ mkfifo p +$ # This cat command will sit waiting for input +$ cat > p +``` + +Leave that `cat` command waiting, and open up another terminal in the same directory. In this terminal, start your reader: + +``` +$ # This will sit waiting for data to come over the pipe +$ cat p +``` + +Now as you type things into the writer end, you’ll see them appear in the reader end. `cat` will use line buffering in interactive mode, so data will get transferred every time you start a new line. + +`cat` doesn’t have to know anything about pipes for this to work — the pipe acts like a file as long as you just naïvely read or write to it. But if you check, you’ll see the data isn’t stored anywhere. You can pump gigabytes through a pipe without filling up any disk space. Once the data has been read once, it’s lost. (You can have multiple readers, but only one will receive any buffer-load of data.) + +Another thing that makes pipes useful for communication is their buffering and blocking. You can start writing before any readers open the pipe, and data gets temporarily buffered inside the kernel until a reader comes along. If the reader starts first, its read will block, waiting for data from the writer. (The writer will also block if the pipe buffer gets full.) If you try the two-terminal experiment again with a regular file, you’ll see that the reader `cat` will eagerly read all the data it can and then exit. + +### An annoying problem and a simple solution + +Maybe you’re seeing how named pipes can help with logging: Servers can write to log “files” that are actually named pipes, and a logging stack can read log data directly from the named pipe without letting a single line fall onto the floor. You do whatever you want with the logs, without any racey juggling of files on disk. + +There’s one annoying problem: the writer doesn’t need a reader to start writing, but if a reader opens the pipe and then closes it, the writer gets a `SIGPIPE` (“broken pipe”), which will kill it by default. (Try killing the reader `cat` while typing things into the writer to see what I mean.) Similarly, a reader can read without a writer, but if a writer opens the pipe and then closes it, that will be treated like an end of file. Although the named pipe persists on disk, it isn’t a stable communication channel if log writers and log readers can restart (as they will on a real server). + +There’s a solution that’s a bit weird but very simple. Multiple processes can open the pipe for reading and writing, and the pipe will only close when _all_ readers or _all_ writers close it. All we need for a stable logging pipe is a daemon that holds the named pipe open for both reading and writing, without doing any actual reading or writing. I set this up on my personal server last year, and I wrote [a tiny, zero-config program to act as my pipe-holding daemon][4]. It just opens every file in its current working directory for both reading and writing. I run it from a directory that has symbolic links to every named pipe in my logging stack. The program runs in a loop that ends in a `wait()` for a `SIGHUP`. If I ever update the symlinks in the directory, I give the daemon a `kill -HUP` and it reopens them all. Sure, it could do its own directory watching, but the `SIGHUP` approach is simple and predictable, and the whole thing works reliably. Thanks to the pipe buffer, log writers and log readers can be shut down and restarted independently, any time, without breakage. + +My server uses the [s6 supervision suite][5] to manage daemons, so I have s6-log reading from each logging pipe. The bottom part of the [s6-log documentation page][6] has some good insights into the problems with popular logging systems, and good ideas about better ways to do things. + +### Imagine: a world without log rotation + +Strictly speaking, named pipes aren’t necessary for race-free logs processing. The s6 suite encourages writing logs to some file descriptor (like standard error), and letting the supervision suite make sure those file descriptors point to something useful. However, the named pipe approach adds a few benefits: + + * It doesn’t require any co-ordination between writer and reader + * It integrates nicely with the software we have today + * It gives things meaningful names (rather than `/dev/fd/4`) + + + +I’ve worked with companies that spend about as much on their logging stacks as on their serving infrastructure, and, no, “we do logs processing” isn’t in their business models. Of course, log rotation and log shipping aren’t the only problems to blame, but it feels so wrong that we’ve made logs so complicated. If you work on any logging system, consider if you really need to juggle log files around. You could be helping to make the world a better place. + +-------------------------------------------------------------------------------- + +via: https://theartofmachinery.com/2020/10/10/logging_with_named_pipes.html + +作者:[Simon Arneaud][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://theartofmachinery.com +[b]: https://github.com/lujun9972 +[1]: https://github.com/logrotate/logrotate +[2]: https://www.nginx.com/resources/wiki/start/topics/examples/logrotation/ +[3]: https://community.splunk.com/t5/Getting-Data-In/Why-copytruncate-logrotate-does-not-play-well-with-splunk/td-p/196112 +[4]: https://gitlab.com/sarneaud/fileopenerd +[5]: http://www.skarnet.org/software/s6/index.html +[6]: http://www.skarnet.org/software/s6/s6-log.html From 6c9f526fbcf12585601f73e77d8161cd558f8f57 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 11 Oct 2020 10:32:40 +0800 Subject: [PATCH 0407/1156] PRF @geekpi --- ...RAM and CPU Eating Tabs and Extensions).md | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/translated/tech/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md b/translated/tech/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md index 2519c7befc..a9fe2c7b15 100644 --- a/translated/tech/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md +++ b/translated/tech/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md @@ -1,24 +1,28 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) -[#]: subject: (How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions)) +[#]: subject: (How to Use the Firefox Task Manager \(to Find and Kill RAM and CPU Eating Tabs and Extensions\)) [#]: via: (https://itsfoss.com/firefox-task-manager/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -如何使用 Firefox 任务管理器(查找并杀死占用内存和 CPU 的标签页和扩展程序) +如何使用 Firefox 任务管理器 ====== -Firefox 在 Linux 用户中很受欢迎。它是几个 Linux 发行版上的默认网络浏览器。 +![](https://img.linux.net.cn/data/attachment/album/202010/11/103209cc1l7ktc7asacjhe.jpg) -在许多其他功能中,Firefox 提供了一个自己的任务管理器。 +> 查找并杀死占用内存和 CPU 的标签页和扩展程序 -现在,在 Linux 中既然你有[任务管理器][1]这种形式的[系统监控工具][2],为什么还要使用它呢?这是有一个很好的理由。 +Firefox 在 Linux 用户中很受欢迎。它是几个 Linux 发行版上的默认 Web 浏览器。 -假设你的系统占用了太多的内存或 CPU。如果你使用 top 或其他一些系统[资源监控工具,如 Glances][3],你会发现这些工具无法区分打开的标签或扩展。 +在它所提供的许多功能之中,Firefox 也提供了一个自己的任务管理器。 -通常情况下,每个 Firefox 标签页都显示为 **Web 内容**。你可以看到是某个 Firefox 进程导致了这个问题,但这无法准确判断是哪个标签页或扩展。 +不过,在 Linux 中既然你有[任务管理器][1]这种形式的[系统监控工具][2],为什么还要使用 Firefox 的呢?这里有个很好的理由。 + +假设你的系统占用了太多的内存或 CPU。如果你使用 `top` 或其他一些系统[资源监控工具,如 Glances][3],你会发现这些工具无法区分是哪个打开的标签或扩展占用了资源。 + +通常情况下,每个 Firefox 标签页都显示为 “Web 内容Web Content”。你可以看到是某个 Firefox 进程导致了这个问题,但这无法准确判断是哪个标签页或扩展。 这时你可以使用 Firefox 任务管理器。让我来告诉你怎么做! @@ -30,21 +34,21 @@ Firefox 在 Linux 用户中很受欢迎。它是几个 Linux 发行版上的默 正如你在上面的截图中所看到的,你会看到标签页的名称、类型(标签或附加组件)、能源影响和消耗的内存。 -虽然一切都明了,但**能源影响指的是 CPU 的使用**,如果你使用的是笔记本电脑,它是一个很好的指标,可以告诉你什么东西会更快耗尽电池。 +其它的都不言自明,但**“能源影响”指的是 CPU 的使用**,如果你使用的是笔记本电脑,它是一个很好的指标,可以告诉你什么东西会更快耗尽电池电量。 #### 在 Firefox 中访问任务管理器 令人意外的是,任务管理器没有 [Firefox 键盘快捷键][5]。 -要快速启动 Firefox 任务管理器,可以在地址栏中输入“**about:performance**”,如下图所示。 +要快速启动 Firefox 任务管理器,可以在地址栏中输入 `about:performance`,如下图所示。 ![Quickly access task manager in Firefox][6] -另外,你也可以点击**菜单**图标,然后进入“**更多**“选项,如下截图所示。 +另外,你也可以点击“菜单”图标,然后进入“更多”选项,如下截图所示。 ![Accessing task manager in Firefox][7] -接下来,你会发现选择”**任务管理器**”的选项,只需点击它就行。 +接下来,你会发现选择“任务管理器”的选项,只需点击它就行。 ![][8] @@ -56,14 +60,12 @@ Firefox 在 Linux 用户中很受欢迎。它是几个 Linux 发行版上的默 以下是你应该知道的: - * 能源影响指的是 CPU 消耗。 + * “能源影响”指的是 CPU 消耗。 * 子框架或子任务通常是与需要在后台运行的标签相关联的跟踪器/脚本。 - - 通过这个任务管理器,你可以发现网站上的流氓脚本,以及它是否导致你的浏览器变慢。 -这并不是什么火箭科学,但并不是很多人都知道 Firefox 任务管理器。现在你知道了,它应该很方便,你觉得呢? +这并不是什么 高科技,但并不是所有人都知道 Firefox 任务管理器。现在你知道了,它应该很方便,你觉得呢? -------------------------------------------------------------------------------- @@ -72,7 +74,7 @@ via: https://itsfoss.com/firefox-task-manager/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6246a5e8f4dea75fd8c664f98173767658f0af20 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 11 Oct 2020 10:37:02 +0800 Subject: [PATCH 0408/1156] PUB @geekpi https://linux.cn/article-12708-1.html --- ...o Find and Kill RAM and CPU Eating Tabs and Extensions).md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md (98%) diff --git a/translated/tech/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md b/published/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md similarity index 98% rename from translated/tech/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md rename to published/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md index a9fe2c7b15..7fbd012005 100644 --- a/translated/tech/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md +++ b/published/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12708-1.html) [#]: subject: (How to Use the Firefox Task Manager \(to Find and Kill RAM and CPU Eating Tabs and Extensions\)) [#]: via: (https://itsfoss.com/firefox-task-manager/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From f6d5ea6acce8a4d953ed51978a90d7ab918428a0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 11 Oct 2020 10:44:35 +0800 Subject: [PATCH 0409/1156] Rename sources/tech/20201010 5 qualities of great open source developer advocates.md to sources/talk/20201010 5 qualities of great open source developer advocates.md --- ...201010 5 qualities of great open source developer advocates.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20201010 5 qualities of great open source developer advocates.md (100%) diff --git a/sources/tech/20201010 5 qualities of great open source developer advocates.md b/sources/talk/20201010 5 qualities of great open source developer advocates.md similarity index 100% rename from sources/tech/20201010 5 qualities of great open source developer advocates.md rename to sources/talk/20201010 5 qualities of great open source developer advocates.md From fa32a4035e8552fbc354fad4cc7fdb6de69583a1 Mon Sep 17 00:00:00 2001 From: zouchong Date: Sun, 11 Oct 2020 22:24:22 +0800 Subject: [PATCH 0410/1156] hankchow translating --- ...ntainer orchestration with Ansible modules for Kubernetes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md b/sources/tech/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md index 358304a9a8..c0ad7a2623 100644 --- a/sources/tech/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md +++ b/sources/tech/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (HankChow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 5bb793fdb74d6c1e5364d2ca80c41b2e67c64c58 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 12 Oct 2020 05:01:35 +0800 Subject: [PATCH 0411/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201012?= =?UTF-8?q?=20Linux=20Jargon=20Buster:=20What=20is=20Display=20Manager=20i?= =?UTF-8?q?n=20Linux=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201012 Linux Jargon Buster- What is Display Manager in Linux.md --- ...uster- What is Display Manager in Linux.md | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 sources/tech/20201012 Linux Jargon Buster- What is Display Manager in Linux.md diff --git a/sources/tech/20201012 Linux Jargon Buster- What is Display Manager in Linux.md b/sources/tech/20201012 Linux Jargon Buster- What is Display Manager in Linux.md new file mode 100644 index 0000000000..2e1ecac6b1 --- /dev/null +++ b/sources/tech/20201012 Linux Jargon Buster- What is Display Manager in Linux.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux Jargon Buster: What is Display Manager in Linux?) +[#]: via: (https://itsfoss.com/display-manager/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Linux Jargon Buster: What is Display Manager in Linux? +====== + +_**In this chapter of the Linux Jargon Buster, you’ll learn about display manager in Linux. Is it part of the desktop environment? What does it do?**_ + +### What is display manager in Linux? + +In simple words, a display manager is a program that provides graphical login capabilities for your Linux distribution. It controls the user sessions and manages user authentication. Display manager starts the [display server][1] and loads the [desktop environment][2] right after you enter your username and password. + +The display manager is often synonymous to the login screen. It is the visible part of it after all. However, the visible login screen, also called greeter, is only a part of the display manager. + +![Login screen is the visible part of a display manager][3] + +Like [various desktop environments][4] and display servers, there are various display managers available as well. Let’s have a look at them. + +### Different display managers + +Some people think of the display manager as part of the desktop environment but that’s not true. It is a separate program. + +A desktop environment may recommend a certain display manager but it doesn’t mean that it won’t work with some other display manager. If you ever installed more than one desktop environment in the same system, you would remember that a login screen (i.e. the display manager) allows you to switch the desktop environment. + +![A display manager can be used with various desktop environments][5] + +Though display manager is not part of the desktop environment itself, it is often developed by the same development team as the desktop environment. It also becomes identity of the desktop environment. + +For example, the GNOME desktop environment develops GDM (GNOME Display Manager) and just by looking at the login screen, you would think of GNOME desktop environment. + +![GNOME Login Screen with GDM][6] + +Some popular display managers are: + + * GDM ([GNOME Display Manager][7]): preferred by GNOME + * [SDDM][8] (Simple Desktop Display Manager): preferred by KDE + * LightDM: Developed by Ubuntu for Unity desktop + + + +### Display managers can be customized + +There are so many desktop environments available. Do they all have their own display managers? No. That’s not the case. + +As I mentioned previously, the visible login screen is called greeter. This greeter can be customized to change the looks of the login screen. + +In fact, many distributions and/or desktop environments have written their own greeter to give users a login screen that resembles their brand. + +For example, Mint’s Cinnamon desktop uses LightDM but has its own greeter to give it more Minty (or should I say Cinnamon) looks. + +![Linux Mint login screen based on LightDM][9] + +Take a look at Kali Linux’s login screen: + +![Kali Linux Login Screen][10] + +If you are into coding and tweaking, you may modify or code your own greeter as per your liking. + +### Changing display manager + +You may [change the display manager][11] if you want. You need to install the display manager first. You’ll see the option to switch the display manager while installing. + +![][12] + +If you didn’t do it at that time, then you can change the display manager by manually configuring it later. The method to reconfigure the display manager is slightly different for different distributions and not in the scope of this article. + +**Conclusion** + +I hope you have a slight better understanding of the term display manager in Linux. The aim of this jargon buster series is to explain common Linux colloquial and technical terms in non-technical language without going into too much detail. + +I welcome your comments and suggestion. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/display-manager/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/display-server/ +[2]: https://itsfoss.com/what-is-desktop-environment/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/05/login-screen-opensuse.jpg?resize=800%2C474&ssl=1 +[4]: https://itsfoss.com/best-linux-desktop-environments/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/deepin-session-ubuntu.jpg?resize=800%2C414&ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/Login-screen-1.png?resize=800%2C450&ssl=1 +[7]: https://wiki.gnome.org/Projects/GDM +[8]: https://github.com/sddm +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/linux-mint-login-screen.jpg?resize=800%2C418&ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/kali-linux-login-screen.jpg?resize=799%2C450&ssl=1 +[11]: https://itsfoss.com/switch-gdm-and-lightdm-in-ubuntu-14-04/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2014/06/Switch_between_gdm_and_lightgdm_Ubuntu.jpeg?resize=700%2C448&ssl=1 From 0b2cf5be66ef1313771446864c13736141dfe2d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Mon, 12 Oct 2020 07:39:07 +0800 Subject: [PATCH 0412/1156] Translated --- ... Learn the basics of programming with C.md | 284 ------------------ ... Learn the basics of programming with C.md | 284 ++++++++++++++++++ 2 files changed, 284 insertions(+), 284 deletions(-) delete mode 100644 sources/tech/20200820 Learn the basics of programming with C.md create mode 100644 translated/tech/20200820 Learn the basics of programming with C.md diff --git a/sources/tech/20200820 Learn the basics of programming with C.md b/sources/tech/20200820 Learn the basics of programming with C.md deleted file mode 100644 index 4bcece769f..0000000000 --- a/sources/tech/20200820 Learn the basics of programming with C.md +++ /dev/null @@ -1,284 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (robsean) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Learn the basics of programming with C) -[#]: via: (https://opensource.com/article/20/8/c-programming-cheat-sheet) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Learn the basics of programming with C -====== -Our new cheat sheet puts all the essentials of C syntax on an -easy-to-read handout. -![Cheat Sheet cover image][1] - -In 1972, Dennis Ritchie was at Bell Labs, where a few years earlier, he and his fellow team members invented Unix. After creating an enduring OS (still in use today), he needed a good way to program those Unix computers so that they could perform new tasks. It seems strange now, but at the time, there were relatively few programming languages; Fortran, Lisp, [Algol][2], and B were popular but insufficient for what the Bell Labs researchers wanted to do. Demonstrating a trait that would become known as a primary characteristic of programmers, Dennis Ritchie created his own solution. He called it C, and nearly 50 years later, it's still in widespread use. - -### Why you should learn C - -Today, there are many languages that provide programmers more features than C. The most obvious one is C++, a rather blatantly named language that built upon C to create a nice object-oriented language. There are many others, though, and there's a good reason they exist. Computers are good at consistent repetition, so anything predictable enough to be built into a language means less work for programmers. Why spend two lines recasting an `int` to a `long` in C when one line of C++ (`long x = long(n);`) can do the same? - -And yet C is still useful today. - -First of all, C is a fairly minimal and straightforward language. There aren't very advanced concepts beyond the basics of programming, largely because C is literally one of the foundations of modern programming languages. For instance, C features arrays, but it doesn't offer a dictionary (unless you write it yourself). When you learn C, you learn the building blocks of programming that can help you recognize the improved and elaborate designs of recent languages. - -Because C is a minimal language, your applications are likely to get a boost in performance that they wouldn't see with many other languages. It's easy to get caught up in the race to the bottom when you're thinking about how fast your code executes, so it's important to ask whether you _need_ more speed for a specific task. And with C, you have less to obsess over in each line of code, compared to, say, Python or Java. C is fast. There's a good reason the Linux kernel is written in C. - -Finally, C is easy to get started with, especially if you're running Linux. You can already run C code because Linux systems include the GNU C library (`glibc`). To write and build it, all you need to do is install a compiler, open a text editor, and start coding. - -### Getting started with C - -If you're running Linux, you can install a C compiler using your package manager. On Fedora or RHEL: - - -``` -`$ sudo dnf install gcc` -``` - -On Debian and similar: - - -``` -`$ sudo apt install build-essential` -``` - -On macOS, you can [install Homebrew][3] and use it to install [GCC][4]: - - -``` -`$ brew install gcc` -``` - -On Windows, you can install a minimal set of GNU utilities, GCC included, with [MinGW][5]. - -Verify you've installed GCC on Linux or macOS: - - -``` -$ gcc --version -gcc (GCC) x.y.z -Copyright (C) 20XX Free Software Foundation, Inc. -``` - -On Windows, provide the full path to the EXE file: - - -``` -PS> C:\MinGW\bin\gcc.exe --version -gcc.exe (MinGW.org GCC Build-2) x.y.z -Copyright (C) 20XX Free Software Foundation, Inc. -``` - -### C syntax - -C isn't a scripting language. It's compiled, meaning that it gets processed by a C compiler to produce a binary executable file. This is different from a scripting language like [Bash][6] or a hybrid language like [Python][7]. - -In C, you create _functions_ to carry out your desired task. A function named `main` is executed by default. - -Here's a simple "hello world" program written in C: - - -``` -#include <stdio.h> - -int main() { -  [printf][8]("Hello world"); -  return 0; -} -``` - -The first line includes a _header file_, essentially free and very low-level C code that you can reuse in your own programs, called `stdio.h` (standard input and output). A function called `main` is created and populated with a rudimentary print statement. Save this text to a file called `hello.c`, then compile it with GCC: - - -``` -`$ gcc hello.c --output hello` -``` - -Try running your C program: - - -``` -$ ./hello -Hello world$ -``` - -#### Return values - -It's part of the Unix philosophy that a function "returns" something to you after it executes: nothing upon success and something else (an error message, for example) upon failure. These return codes are often represented with numbers (integers, to be precise): 0 represents nothing, and any number higher than 0 represents some non-successful state. - -There's a good reason Unix and Linux are designed to expect silence upon success. It's so that you can always plan for success by assuming no errors nor warnings will get in your way when executing a series of commands. Similarly, functions in C expect no errors by design. - -You can see this for yourself with one small modification to make your program appear to fail: - - -``` -include <stdio.h> - -int main() { -  [printf][8]("Hello world"); -  return 1; -} -``` - -Compile it: - - -``` -`$ gcc hello.c --output failer` -``` - -Now run it using a built-in Linux test for success. The `&&` operator executes the second half of a command only upon success. For example: - - -``` -$ echo "success" && echo "it worked" -success -it worked -``` - -The `||` test executes the second half of a command upon _failure_. - - -``` -$ ls blah || echo "it did not work" -ls: cannot access 'blah': No such file or directory -it did not work -``` - -Now try your program, which does _not_ return 0 upon success; it returns 1 instead: - - -``` -$ ./failer && echo "it worked" -String is: hello -``` - -The program executed successfully, yet did not trigger the second command. - -#### Variables and types - -In some languages, you can create variables without specifying what _type_ of data they contain. Those languages have been designed such that the interpreter runs some tests against a variable in an attempt to discover what kind of data it contains. For instance, Python knows that `var=1` defines an integer when you create an expression that adds `var` to something that is obviously an integer. It similarly knows that the word `world` is a string when you concatenate `hello` and `world`. - -C doesn't do any of these investigations for you; you must define your variable type. There are several types of variables, including integers (int), characters (char), float, and Boolean. - -You may also notice there's no string type. Unlike Python and Java and Lua and many others, C doesn't have a string type and instead sees strings as an array of characters. - -Here's some simple code that establishes a `char` array variable, and then prints it to your screen using [printf][9] along with a short message: - - -``` -#include <stdio.h> - -int main() { -   char var[6] = "hello"; -   [printf][8]("Your string is: %s\r\n",var); -``` - -You may notice that this code sample allows six characters for a five-letter word. This is because there's a hidden terminator at the end of the string, which takes up one byte in the array. You can run the code by compiling and executing it: - - -``` -$ gcc hello.c --output hello -$ ./hello -hello -``` - -### Functions - -As with other languages, C functions take optional parameters. You can pass parameters from one function to another by defining the type of data you want a function to accept: - - -``` -#include <stdio.h> - -int printmsg(char a[]) { -   [printf][8]("String is: %s\r\n",a); -} - -int main() { -   char a[6] = "hello"; -   printmsg(a); -   return 0; -} -``` - -The way this code sample breaks one function into two isn't very useful, but it demonstrates that `main` runs by default and how to pass data between functions. - -### Conditionals - -In real-world programming, you usually want your code to make decisions based on data. This is done with _conditional_ statements, and the `if` statement is one of the most basic of them. - -To make this example program more dynamic, you can include the `string.h` header file, which contains code to examine (as the name implies) strings. Try testing whether the string passed to the `printmsg` function is greater than 0 by using the `strlen` function from the `string.h` file: - - -``` -#include <stdio.h> -#include <string.h> - -int printmsg(char a[]) { -  size_t len = [strlen][10](a); -  if ( len > 0) { -    [printf][8]("String is: %s\r\n",a); -  } -} - -int main() { -   char a[6] = "hello"; -   printmsg(a); -   return 1; -} -``` - -As implemented in this example, the sample condition will never be untrue because the string provided is always "hello," the length of which is always greater than 0. The final touch to this humble re-implementation of the `echo` command is to accept input from the user. - -### Command arguments - -The `stdio.h` file contains code that provides two arguments each time a program is launched: a count of how many items are contained in the command (`argc`) and an array containing each item (`argv`). For example, suppose you issue this imaginary command: - - -``` -`$ foo -i bar` -``` - -The `argc` is three, and the contents of `argv` are: - - * `argv[0] = foo` - * `argv[1] = -i` - * `argv[2] = bar` - - - -Can you modify the example C program to accept `argv[2]` as the string instead of defaulting to `hello`? - -### Imperative programming - -C is an imperative programming language. It isn't object-oriented, and it has no class structure. Using C can teach you a lot about how data is processed and how to better manage the data you generate as your code runs. Use C enough, and you'll eventually be able to write libraries that other languages, such as Python and Lua, can use. - -To learn more about C, you need to use it. Look in `/usr/include/` for useful C header files, and see what small tasks you can do to make C useful to you. As you learn, use our [C cheat sheet][11] by [Jim Hall][12] of FreeDOS. It's got all the basics on one double-sided sheet, so you can immediately access all the essentials of C syntax while you practice. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/8/c-programming-cheat-sheet - -作者:[Seth Kenlon][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://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coverimage_cheat_sheet.png?itok=lYkNKieP (Cheat Sheet cover image) -[2]: https://opensource.com/article/20/6/algol68 -[3]: https://opensource.com/article/20/6/homebrew-mac -[4]: https://gcc.gnu.org/ -[5]: https://opensource.com/article/20/8/gnu-windows-mingw -[6]: https://opensource.com/resources/what-bash -[7]: https://opensource.com/resources/python -[8]: http://www.opengroup.org/onlinepubs/009695399/functions/printf.html -[9]: https://opensource.com/article/20/8/printf -[10]: http://www.opengroup.org/onlinepubs/009695399/functions/strlen.html -[11]: https://opensource.com/downloads/c-programming-cheat-sheet -[12]: https://opensource.com/users/jim-hall diff --git a/translated/tech/20200820 Learn the basics of programming with C.md b/translated/tech/20200820 Learn the basics of programming with C.md new file mode 100644 index 0000000000..02816c1dfc --- /dev/null +++ b/translated/tech/20200820 Learn the basics of programming with C.md @@ -0,0 +1,284 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Learn the basics of programming with C) +[#]: via: (https://opensource.com/article/20/8/c-programming-cheat-sheet) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +使用 C 语言学习基本的编程 +====== +我们将所有的 C 语言要素放置到一份易读的备忘录上。 +![备忘录封面图片][1] + +在 1972 年,丹尼斯·里奇在贝尔实验室,在几年前,他和他的团队成员发明了 Unix 。在创建了一个经久不衰的操作系统(至今仍在使用)之后,他需要一种好的方法来编程这些 Unix 计算机,以便它们可用执行新的任务。在现在看来,这很奇怪,但在当时,编程语言相对较少;Fortran,Lisp,[Algol][2] 以及 B 语言都很流行,但是,对于贝尔实验室的研究员们想要做的事情来说,它们还是远远不够的。丹尼斯·里奇创造了他自己的解决方案,表现出一种以程序员的主要特征而闻名的特质,他称之为 C 语言,并且在近 50 年后,它仍在广泛的使用。 + +### 为什么你应该学习 C 语言 + +今天,这里有很多语言为程序员提供比 C 语言更多是特性。最明显的一种语言是 C++ 语言,一种相当明显的命名方式的语言,它在 C 语言之上构建,创建了一种很好的面向对象的语言。不过,这里有很多其它的语言,它们都很好的存在理由。计算机擅长始终如一的重复,因此任何可预见的东西都足以构建到一种语言中,对程序员来说这意味着更少的工作量。为什么要在 C++ 语言中一行 (`long x = long(n);`) 可以做到的相同的事时,而要花费两行来改写 C 语言中的一个 `int` 为一个 `long` ? + +然而,C 语言在今天仍然有用。 + +首先,C 语言是一种最小和简单的的语言。这里没有超出编程基础的非常高级的概念,很大程度上是因为 C 语言简直是现代编程语言的基础之一。例如,C 语言的特性数组,但是它不提供字典(除非你自己写)。当你学习 C 语言时,你将学习编程的构建语句块,它可以帮助你辨别出当前语言的改善和精心制作的设计构思。 + +因为 C 语言是一种最小的编程语言,你的应用程序很可能会获得性能上的提升,这在很多其它编程语言中是看不到的。当你考虑你的代码可以执行多快的时候,它很容易被卷入到下面的速度竞赛,因此,询问你是否 _需要_ 更快的速度来完成一项特定的任务是很重要的。与 Python 或 Java 相比,使用 C 语言,你没有必要为每一行的代码所困扰。C 语言程序运行很快。这是 Linux 内核使用 C 语言编写的一个很好的理由。 + +最后,C 语言很容易入门,特别是,如果你正在运行 Linux ,你可能已经在运行 C 语言代码,因为 Linux 系统包含 GNU C 库(`glibc`)。为了编写和构建 C 语言程序, 你需要做的全部工作就是安装一个编译器,打开一个文本编辑器,开始编码。 + +### 开始学习 C 语言 + +如果你正在运行 Linux ,你可以使用你的软件包管理器安装一个 C 编译器。在 Fedora 或 RHEL 上: + + +``` +$ sudo dnf install gcc +``` + +在 Debian 及其衍生系统上: + + +``` +$ sudo apt install build-essential +``` + +在 macOS 上,你可以 [安装 Homebrew][3] ,并使用它来安装 [GCC][4]: + + +``` +`$ brew install gcc` +``` + +在 Windows 上, 你可以使用 [MinGW][5] 安装一套最小的包含 GCC的 GNU 实用程序集。 + +在 Linux 或 macOS 上验证你已经安装的 GCC: + + +``` +$ gcc --version +gcc (GCC) x.y.z +Copyright (C) 20XX Free Software Foundation, Inc. +``` + +在 Windows 上, 提供 EXE 文件的完整路径: + + +``` +PS> C:\MinGW\bin\gcc.exe --version +gcc.exe (MinGW.org GCC Build-2) x.y.z +Copyright (C) 20XX Free Software Foundation, Inc. +``` + +### C 语法 + +C 语言不是一种脚本型的语言。它是一种编译型的语言,这意味着它由 C 编译器处理来产生一个二进制可执行文件。这不同于一种脚本型语言(像:[Bash][6] )或一种混合型语言(像:[Python][7] )。 + +在 C 语言中,你创建 _函数_ 来实施你渴望做到的任务。默认情况下,一个名称为 `main` 的函数将被执行。 + +这里是一个使用 C 语言写的简单的 "hello world" 程序: + + +``` +#include + +int main() { + printf("Hello world"); + return 0; +} +``` + +第一行包含一个被称为 `stdio.h` (标准输入和输出) 的 _头文件_ ,它基本上是自由的、非常初级的 C 语言代码,你可以在你自己的程序中重复使用。创建一个由一个基本的输出语句构成的名称为 `main` 的函数。保存这些文本到一个被称为 `hello.c` 的文件中,然后使用 GCC 编译它: + + +``` +`$ gcc hello.c --output hello` +``` + +尝试运行你的 C 语言程序: + + +``` +$ ./hello +Hello world$ +``` + +#### 返回值 + +一个函数在执行后“返回”一些东西是 Unix 哲学的一部分:在成功时不返回任何东西,在失败使返回其它的一些东西(例如,一个错误信息)。这些返回代码通常使用数字(确切地说是整数)表示: 0 表示没有东西,任何大于 0 的数字都表示一些不成功的状态。 + +Unix 和 Linux 被设计成在运行成功时要求沉默的是很明智的。这样,你可以总是通过假设在执行一系列命令后没有获得任何错误或警告来期待成功。类似地,在 C 语言中的函数在设计上也不希望出现错误。 + +你可以使用一小处使你的出现出现错误的修改来自己看到这些设计: + + +``` +include + +int main() { + printf("Hello world"); + return 1; +} +``` + +编译它: + + +``` +$ gcc hello.c --output failer +``` + +现在使用一个内置的 Linux 测试来运行它。仅在成功时,`&&` 操作符执行一个命令的第二部分。例如: + + +``` +$ echo "success" && echo "it worked" +success +it worked +``` + +在 _失败_ 时,`||`测试执行一个命令的第二部分。 + + +``` +$ ls blah || echo "it did not work" +ls: cannot access 'blah': No such file or directory +it did not work +``` + +现在,尝试你的程序,在成功时,它 _不_ 返回 0 ;而是返回 1 : + + +``` +$ ./failer &&; echo "it worked" +String is: hello +``` + +这个程序成功地执行,但是没有触发第二个命令。 + +#### 变量和类型 + +在一些语言中,你可以在不具体指定变量所包含的数据的 _类型_ 的情况下创建变量。这些语言如此设计使得解释器对一个变量运行一些测试来企图发现变量什么样的数据类型。例如,Python 知道当你创建一个表达式时,`var=1` 定义了一个整型数,将 `var` 添加一些东西上,这显然是一个整型数。它同样知道当你连接 `hello` 和 `world` 时,单词 `world` 是一个字符串。 + +C 语言不会为你做任何这些识别和调查;你必需定义你自己的变量类型。这里有几种变量类型,包括整型(int),字符型(char),浮点型(float),布尔型(Boolean)。 + +你可能也注意到这里没有字符串类型。与 Python 和 Java 和 Lua 以及其它的编程语言不同,C 语言没有字符串类型,而是将字符串看作一个字符数组。 + +这里是一些简单的代码,它建立了一个 `char` 数组变量,然后使用 [printf][9] 将数组变量和一段简单的信息打印到你的屏幕上: + + +``` +#include + +int main() { + char var[6] = "hello"; + printf("Your string is: %s\r\n",var); +} +``` + +你可能会注意到,这个代码示例向一个由五个字母组成的单词提供六个字符的空间。这是因为在字符串的结尾有处一个隐藏的终止符,终止符占用数组中的一个字节。你可以通过编译和执行代码来运行它: + + +``` +$ gcc hello.c --output hello +$ ./hello +hello +``` + +### 函数 + +和其它的编程语言一样,C 函数采取可选函数。你可以通过定义你希望一个函数接受的数据类型来将参数从一个函数传递到另一个函数: + + +``` +#include + +int printmsg(char a[]) { + printf("String is: %s\r\n",a); +} + +int main() { + char a[6] = "hello"; + printmsg(a); + return 0; +} +``` + +使用这种方法简单将一个函数分解为两个函数的方法并不是非常有用,但是它证明 `main` 默认运行以及如何在函数之间传递数据。 + +### 条件语句 + +在真实的编程中,你通常希望你的代码根据数据做出判断。这是使用This is done with _条件_ 语句完成的,并且 `if` 语句是它们中最基础的一个语句。 + +为了使这个示例程序更具动态性,你可以包含 `string.h` 头文件,它包含用于检查(顾名思义)字符串的代码。尝试使用来自 `string.h` 文件中的 `strlen` 函数测试传递给 `printmsg` 函数的字符串是否大于 0 : + + +``` +#include +#include + +int printmsg(char a[]) { + size_t len = strlen(a); + if ( len > 0) { + printf("String is: %s\r\n",a); + } +} + +int main() { + char a[6] = "hello"; + printmsg(a); + return 1; +} +``` + +正如在这个示例中所实现的,示例条件永远都不会是真实的,因为所提供的字符串总是 "hello" ,它的长度总是大于 0 。`echo` 命令的这个不够认真的重新实施的最后接触是接受来自用户的输入。 + +### 命令参数 + +`stdio.h` 文件包含的代码在每次程序启动时提供两个参数: 一个是包含在命令 (`argc`) 中的项目总数,一个是包含每个项目 (`argv`) 的数组。例如, 假设你发出这个虚构的命令: + + +``` +$ foo -i bar +``` + +`argc` 是 3 个,`argv` 的内容是: + + * `argv[0] = foo` + * `argv[1] = -i` + * `argv[2] = bar` + + + +你可以修改示例 C 语言程序来接受 `argv[2]` 作为字符串,而不是默认来接受`hello` 吗? + +### 命令式编程语言 + +C 语言是一种命令式编程语言。它不是面向对象的,它没有类结构。使用 C 语言的经验可以教你很多关于如何处理数据和如何更好地管理你的代码运行时生成的数据。充分地使用 C 语言,你最后能够编写其它语言 (例如 Python 和 Lua) 能够使用的库。 + +为了学习更多关于 C 的知识,你需要使用它。在 `/usr/include/` 中查找有用的 C 语言头文件,并且看看你可以做什么小任务来使其对你学习 C 语言有用。 正如你学习时,使用 [Jim Hall][12] 的 FreeDOS 的 [C 语言忘备录][11]。它在一张双面纸忘备录上放置所有的基本要素,因此在你实施练习时,你可以立即访问 C 语言语法的所有要素。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/c-programming-cheat-sheet + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coverimage_cheat_sheet.png?itok=lYkNKieP (Cheat Sheet cover image) +[2]: https://opensource.com/article/20/6/algol68 +[3]: https://opensource.com/article/20/6/homebrew-mac +[4]: https://gcc.gnu.org/ +[5]: https://opensource.com/article/20/8/gnu-windows-mingw +[6]: https://opensource.com/resources/what-bash +[7]: https://opensource.com/resources/python +[8]: http://www.opengroup.org/onlinepubs/009695399/functions/printf.html +[9]: https://opensource.com/article/20/8/printf +[10]: http://www.opengroup.org/onlinepubs/009695399/functions/strlen.html +[11]: https://opensource.com/downloads/c-programming-cheat-sheet +[12]: https://opensource.com/users/jim-hall From f5623b3207242c75656fa2b5a1d51265256517fd Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 12 Oct 2020 07:50:00 +0800 Subject: [PATCH 0413/1156] translating --- ... How to Remove Physical Volume from a Volume Group in LVM.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201009 How to Remove Physical Volume from a Volume Group in LVM.md b/sources/tech/20201009 How to Remove Physical Volume from a Volume Group in LVM.md index e20fb2af86..b6ca38862b 100644 --- a/sources/tech/20201009 How to Remove Physical Volume from a Volume Group in LVM.md +++ b/sources/tech/20201009 How to Remove Physical Volume from a Volume Group in LVM.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 7f760e2aacb4c4c7024c7944136ec2309f75fab1 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 12 Oct 2020 08:13:29 +0800 Subject: [PATCH 0414/1156] translated --- ...sical Volume from a Volume Group in LVM.md | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) rename {sources => translated}/tech/20201009 How to Remove Physical Volume from a Volume Group in LVM.md (51%) diff --git a/sources/tech/20201009 How to Remove Physical Volume from a Volume Group in LVM.md b/translated/tech/20201009 How to Remove Physical Volume from a Volume Group in LVM.md similarity index 51% rename from sources/tech/20201009 How to Remove Physical Volume from a Volume Group in LVM.md rename to translated/tech/20201009 How to Remove Physical Volume from a Volume Group in LVM.md index b6ca38862b..be4eb25b11 100644 --- a/sources/tech/20201009 How to Remove Physical Volume from a Volume Group in LVM.md +++ b/translated/tech/20201009 How to Remove Physical Volume from a Volume Group in LVM.md @@ -7,32 +7,32 @@ [#]: via: (https://www.2daygeek.com/linux-remove-delete-physical-volume-pv-from-volume-group-vg-in-lvm/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -How to Remove Physical Volume from a Volume Group in LVM +如何从 LVM 的卷组中删除物理卷? ====== -If a device is no longer need for use by LVM, you can use the vgreduce command to remove physical volumes from a volume group. +如果 LVM 不再需要使用某个设备,你可以使用 vgreduce 命令从卷组中删除物理卷。 -The Vgreduce command shrinks the capacity of a volume group by removing a physical volume. +vgreduce 命令通过删除物理卷来缩小卷组的容量。 -But make sure that the physical volume is not used by any logical volumes using the pvdisplay command. +但要确保物理卷没有被任何逻辑卷使用,请使用 pvdisplay 命令。 -If the physical volume is still being used, you must transfer the data to another physical volume using the pvmove command. +如果物理卷仍在使用,你必须使用 pvmove 命令将数据转移到另一个物理卷。 -Once the data is moved, it can be removed from the volume group. +数据转移后,它就可以从卷组中删除。 -Finally use the pvremove command to remove the LVM label and LVM metadata on the empty physical volume. +最后使用 pvremove 命令删除空物理卷上的 LVM 标签和 LVM 元数据。 - * **Part-1: [How to Create/Configure LVM (Logical Volume Management) in Linux][1]** - * **Part-2: [How to Extend/Increase LVM’s (Logical Volume Resize) in Linux][2]** - * **Part-3: [How to Reduce/Shrink LVM’s (Logical Volume Resize) in Linux][3]** + * **第一部分:[如何在 Linux 中创建/配置 LVM(逻辑卷管理)][1]**。 + * **第二部分:[如何在 Linux 中扩展/增加 LVM 大小(逻辑卷调整)][2]**。 + * **第三部分:[如何在 Linux 中减少/缩小 LVM 大小(逻辑卷调整)][3]**。 ![][4] -### 1) Moving Extents to Existing Physical Volumes +### 1) 将扩展移动到现有物理卷上 -Use the pvs command to check if the desired physical volume (we plan to remove the **“/dev/sdb1”** disk in LVM) is used or not. +使用 pvs 命令检查是否使用了所需的物理卷(我们计划删除 LVM 中的 **“/dev/sdb1”** 磁盘)。 ``` # pvs -o+pv_used @@ -43,9 +43,9 @@ PV VG Fmt Attr PSize PFree Used /dev/sdc1 myvg lvm2 a- 17.15G 12.15G 5.00G ``` -If this is used, check to see if there are enough free extents on the other physics volumes in the volume group. +如果使用了,请检查卷组中的其他物理卷是否有足够的空闲空间。 -If so, you can run the pvmove command on the device you want to remove. Extents will be distributed to other devices. +如果有的话,你可以在需要删除的设备上运行 pvmove 命令。扩展将被分配到其他设备上。 ``` # pvmove /dev/sdb1 @@ -57,7 +57,7 @@ If so, you can run the pvmove command on the device you want to remove. Extents /dev/sdb1: Moved: 100.0% ``` -When the pvmove command is complete. Re-use the pvs command to check whether the physics volume is free or not. +当 pvmove 命令完成后。再次使用 pvs 命令检查物理卷是否有空闲。 ``` # pvs -o+pv_used @@ -68,25 +68,25 @@ PV VG Fmt Attr PSize PFree Used /dev/sdc1 myvg lvm2 a- 17.15G 12.15G 5.00G ``` -If it’s free, use the vgreduce command to remove the physical volume /dev/sdb1 from the volume group. +如果它是空闲的,使用 vgreduce 命令从卷组中删除物理卷 /dev/sdb1。 ``` # vgreduce myvg /dev/sdb1 Removed "/dev/sdb1" from volume group "myvg" ``` -Finally, run the pvremove command to remove the disk from the LVM configuration. Now, the disk is completely removed from the LVM and can be used for other purposes. +最后,运行 pvremove 命令从 LVM 配置中删除磁盘。现在,磁盘已经完全从 LVM 中移除,可以用于其他用途。 ``` # pvremove /dev/sdb1 Labels on physical volume "/dev/sdb1" successfully wiped. ``` -### 2) Moving Extents to a New Disk +### 2) 移动扩展到新磁盘 -If you don’t have enough free extents on the other physics volumes in the volume group. Add new physical volume using the steps below. +如果你在卷组中的其他物理卷上没有足够的可用扩展。使用以下步骤添加新的物理卷。 -Request new LUNs from the storage team. Once this is allocated, run the following commands to **[discover newly added LUNs or disks in Linux][5]**. +向存储组申请新的 LUN。分配完毕后,运行以下命令来**[在 Linux 中发现新添加的 LUN 或磁盘][5]**。 ``` # ls /sys/class/scsi_host @@ -101,21 +101,21 @@ host0 # fdisk -l ``` -Once the disk is detected in the OS, use the pvcreate command to create the physical volume. +操作系统中检测到磁盘后,使用 pvcreate 命令创建物理卷。 ``` # pvcreate /dev/sdd1 Physical volume "/dev/sdd1" successfully created ``` -Use the following command to add new physical volume /dev/sdd1 to the existing volume group vg01. +使用以下命令将新的物理卷 /dev/sdd1 添加到现有卷组 vg01 中。 ``` # vgextend vg01 /dev/sdd1 Volume group "vg01" successfully extended ``` -Now, use the pvs command to see the new disk **“/dev/sdd1”** that you have added. +现在,使用 pvs 命令查看你添加的新磁盘 **“/dev/sdd1”**。 ``` # pvs -o+pv_used @@ -127,7 +127,7 @@ PV VG Fmt Attr PSize PFree Used /dev/sdd1 myvg lvm2 a- 60.00G 60.00G 0 ``` -Use the pvmove command to move the data from /dev/sdb1 to /dev/sdd1. +使用 pvmove 命令将数据从 /dev/sdb1 移动到 /dev/sdd1。 ``` # pvmove /dev/sdb1 /dev/sdd1 @@ -139,7 +139,7 @@ Use the pvmove command to move the data from /dev/sdb1 to /dev/sdd1. /dev/sdb1: Moved: 100.0% ``` -After the data is moved to the new disk. Re-use the pvs command to check whether the physics volume is free. +数据移动到新磁盘后。再次使用 pvs 命令检查物理卷是否空闲。 ``` # pvs -o+pv_used @@ -151,14 +151,14 @@ PV VG Fmt Attr PSize PFree Used /dev/sdd1 myvg lvm2 a- 60.00G 10.00G 50.00G ``` -If it’s free, use the vgreduce command to remove the physical volume /dev/sdb1 from the volume group. +如果空闲,使用 vgreduce 命令从卷组中删除物理卷 /dev/sdb1。 ``` # vgreduce myvg /dev/sdb1 Removed "/dev/sdb1" from volume group "myvg" ``` -Finally, run the pvremove command to remove the disk from the LVM configuration. Now, the disk is completely removed from the LVM and can be used for other purposes. +最后,运行 pvremove 命令从 LVM 配置中删除磁盘。现在,磁盘已经完全从 LVM 中移除,可以用于其他用途。 ``` # pvremove /dev/sdb1 @@ -171,7 +171,7 @@ via: https://www.2daygeek.com/linux-remove-delete-physical-volume-pv-from-volume 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[geekpi](https://github.com/geekpi) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ccd28fa505ca89d542b2b185ce728ad627566144 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 12 Oct 2020 11:41:44 +0800 Subject: [PATCH 0415/1156] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @gxlct008 辛苦了,这篇可不好翻译。 --- ...TCP window scaling, timestamps and SACK.md | 158 +++++++++--------- 1 file changed, 77 insertions(+), 81 deletions(-) diff --git a/translated/tech/20200811 TCP window scaling, timestamps and SACK.md b/translated/tech/20200811 TCP window scaling, timestamps and SACK.md index 7bfd8116ab..691bec1b4b 100644 --- a/translated/tech/20200811 TCP window scaling, timestamps and SACK.md +++ b/translated/tech/20200811 TCP window scaling, timestamps and SACK.md @@ -10,19 +10,19 @@ TCP 窗口缩放、时间戳和 SACK ====== -![][1] +![](https://img.linux.net.cn/data/attachment/album/202010/12/114050up4695djpw6n4tu9.jpg) -Linux TCP 协议栈具有无数个 `sysctl` 旋钮,允许更改其行为。 这包括可用于接收或发送操作的内存量,套接字的最大数量、可选的特性和协议扩展。 +Linux TCP 协议栈具有无数个可以更改其行为的 `sysctl` 旋钮。 这包括可用于接收或发送操作的内存量、套接字的最大数量、可选的特性和协议扩展。 -有很多文章出于各种“性能调优”或“安全性”原因,建议禁用 TCP 扩展,比如时间戳或选择性确认selective acknowledgments(SACK)。 +有很多文章出于各种“性能调优”或“安全性”原因,建议禁用 TCP 扩展,比如时间戳或选择性确认Selective ACKnowledgments(SACK)。 -本文提供了这些扩展的功能背景,为什么会默认启用,它们之间是如何关联的,以及为什么通常情况下将它们关闭是个坏主意。 +本文提供了这些扩展功能的背景,为什么会默认启用,它们之间是如何关联的,以及为什么通常情况下将它们关闭是个坏主意。 ### TCP 窗口缩放 TCP 可以承受的数据传输速率受到几个因素的限制。其中包括: -* 往返时间(RTT)。 +* 往返时间Round trip time(RTT)。 这是数据包到达目的地并返回回复所花费的时间。越低越好。 * 所涉及的网络路径的最低链路速度。 @@ -32,19 +32,19 @@ TCP 可以承受的数据传输速率受到几个因素的限制。其中包括 例如,CPU 需要能够以足够快的速度将数据传递到网络适配器。如果 CPU 需要首先加密数据,则适配器可能必须等待新数据。同样地,如果磁盘存储不能足够快地读取数据,则磁盘存储可能会成为瓶颈。 * TCP 接收窗口的最大可能大小。 - 接收窗口决定 TCP 在必须等待接收方报告接收到该数据之前可以传输多少数据(以字节为单位)。这是由接收方宣布的。接收方将在读取并确认接收到传入数据时不断更新此值。接收窗口当前值包含在 [TCP 报头][2] 中,它是 TCP 发送的每个数据段的一部分。因此,只要发送方接收到来自对等方的确认,它就知道当前的接收窗口。这意味着往返时间(RTT)越长,发送方获得接收窗口更新所需的时间就越长。 + 接收窗口决定了 TCP 在必须等待接收方报告接收到该数据之前可以传输多少数据(以字节为单位)。这是由接收方宣布的。接收方将在读取并确认接收到传入数据时不断更新此值。接收窗口的当前值包含在 [TCP 报头][2] 中,它是 TCP 发送的每个数据段的一部分。因此,只要发送方接收到来自对等方的确认,它就知道当前的接收窗口。这意味着往返时间(RTT)越长,发送方获得接收窗口更新所需的时间就越长。 -TCP 被限制为最多 64KB 的未确认(正在传输)数据。在大多数网络场景中,这甚至还不足以维持一个像样的数据速率。让我们看看一些例子。 +TCP 的未确认(正在传输)数据被限制为最多 64KB。在大多数网络场景中,这甚至还不足以维持一个像样的数据速率。让我们看看一些例子。 -#### 理论数据速率 +**理论数据速率** -在往返时间(RTT)为 100 毫秒的情况下,TCP 每秒最多可以传输 640KB。在延迟为 1 秒的情况下,最大理论数据速率降至 64KB/s。 +在往返时间(RTT)为 100 毫秒的情况下,TCP 每秒最多可以传输 640KB。在延迟为 1 秒的情况下,最大理论数据速率降至只有 64KB/s。 这是因为接收窗口的原因。一旦发送了 64KB 的数据,接收窗口就已经满了。发送方必须等待,直到对等方通知它应用程序已经读取了至少一部分数据。 -发送的第一个段会把 TCP 窗口缩减一个自身的大小。在接收窗口值的更新可用之前,需要往返一次。当更新以 1 秒的延迟到达时,即使链路有足够的可用带宽,也会导致 64KB 的限制。 +发送的第一个段会把 TCP 窗口缩减去该段的大小。在接收窗口值的更新信息可用之前,需要往返一次。当更新以 1 秒的延迟到达时,即使链路有足够的可用带宽,也会导致 64KB 的限制。 -为了充分利用一个具有几毫秒延迟的快速网络,必须有一个比传统 TCP 支持的窗口更大的窗口。“64KB 限制”是协议规范的产物:TCP 头只为接收窗口大小保留 16 位。这允许接收窗口高达 64KB。在 TCP 协议最初设计时,这个大小并没有被视为一个限制。 +为了充分利用一个具有几毫秒延迟的快速网络,必须有一个比传统 TCP 支持的窗口更大的窗口。“64KB 限制”是协议规范的产物:TCP 头只为接收窗口大小保留了 16 个位。这允许接收窗口最大为 64KB。在 TCP 协议最初设计时,这个大小并没有被视为一个限制。 不幸的是,想通过仅仅更改 TCP 头来支持更大的最大窗口值是不可能的。如果这样做就意味着 TCP 的所有实现都必须同时更新,否则它们将无法相互理解。为了解决这个问题,我们改变了对接收窗口值的解释。 @@ -52,17 +52,17 @@ TCP 被限制为最多 64KB 的未确认(正在传输)数据。在大多数 #### TCP 选项:向后兼容的协议扩展 -TCP 支持可选扩展。 这允许使用新特性增强协议,而无需立即更新所有实现。 当 TCP 启动器连接到对等方时,它还会发送一个支持的扩展列表。 所有扩展名都遵循相同的格式:一个唯一的选项号,后跟选项的长度以及选项数据本身。 +TCP 支持可选扩展。这允许使用新特性增强协议,而无需立即更新所有实现。当 TCP 发起方连接到对等方时,它还会发送一个支持的扩展列表。所有扩展都遵循相同的格式:一个唯一的选项号,后跟选项的长度以及选项数据本身。 -TCP 响应程序检查连接请求中包含的所有选项号。 如果它遇到一个不能理解的选项号,则会跳过 -该选项号附带的“长度”字节的数据,并检查下一个选项号。 响应者忽略了从答复中无法理解的内容。 这使发送方和接收方都够了解所支持的通用选项集。 +TCP 响应方检查连接请求中包含的所有选项号。如果它遇到一个不能理解的选项号,则会跳过 +该选项号附带的“长度”字节的数据,并检查下一个选项号。响应方忽略了从答复中无法理解的内容。这使发送方和接收方都够理解所支持的公共选项集。 使用窗口缩放时,选项数据总是由单个数字组成。 ### 窗口缩放选项 ``` -窗口缩放选项 (WSopt): Kind: 3, Length: 3 +Window Scale option (WSopt): Kind: 3, Length: 3     +---------+---------+---------+     | Kind=3  |Length=3 |shift.cnt|     +---------+---------+---------+ @@ -71,147 +71,145 @@ TCP 响应程序检查连接请求中包含的所有选项号。 如果它遇到 [窗口缩放][3] 选项告诉对等方,应该使用给定的数字缩放 TCP 标头中的接收窗口值,以获取实际大小。 -例如,一个宣告窗口缩放比例因子为 7 的 TCP 启动器试图指示响应程序,任何将来携带接收窗口值为 512 的数据包实际上都会宣告 65536 字节的窗口。 增加了 128 倍。这将允许最大为 8MB 的 TCP 窗口。 +例如,一个宣告窗口缩放因子为 7 的 TCP 发起方试图指示响应方,任何将来携带接收窗口值为 512 的数据包实际上都会宣告 65536 字节的窗口。增加了 128 倍(2^7)。这将允许最大为 8MB 的 TCP 窗口。 -不能理解此选项的 TCP 响应程序将会忽略它。 为响应连接请求而发送的 TCP 数据包(SYN-ACK)不包含窗口缩放选项。在这种情况下,双方只能使用 64k 的窗口大小。幸运的是,默认情况下,几乎每个 TCP 堆栈都支持并启用此选项,包括 Linux。 +不能理解此选项的 TCP 响应方将会忽略它,为响应连接请求而发送的 TCP 数据包(SYN-ACK)不会包含该窗口缩放选项。在这种情况下,双方只能使用 64k 的窗口大小。幸运的是,默认情况下,几乎每个 TCP 栈都支持并默认启用了此选项,包括 Linux。 -响应程序包括它自己所需的比例因子。两个对等方可以使用不同的号码。宣布比例因子为 0 也是合法的。这意味着对等点应该逐字处理它接收到的接收窗口值,但它允许应答方向上的缩放值,然后接收方可以使用更大的接收窗口。 +响应方包括了它自己所需的缩放因子。两个对等方可以使用不同的因子。宣布缩放因子为 0 也是合法的。这意味着对等方应该如实处理它接收到的接收窗口值,但它允许应答方向上的缩放值,然后接收方可以使用更大的接收窗口。 -与 SACK 或 TCP 时间戳不同,窗口缩放选项仅出现在 TCP 连接的前两个数据包中,之后无法更改。也不可能通过查看不包含初始连接三次握手的连接的数据包捕获来确定比例因子。 +与 SACK 或 TCP 时间戳不同,窗口缩放选项仅出现在 TCP 连接的前两个数据包中,之后无法更改。也不可能通过查看不包含初始连接三次握手的连接的数据包捕获来确定缩放因子。 -支持的最大比例因子为 14。这将允许 TCP 窗口的大小高达 1GB。 +支持的最大缩放因子为 14。这将允许 TCP 窗口的大小高达 1GB。 -#### 窗口缩放的缺点 +**窗口缩放的缺点** -在非常特殊的情况下,它可能导致数据损坏。但在你禁用该选项之前,要知道通常情况下是不可能损坏的。 还有一种解决方案可以防止这种情况。不幸的是,有些人在没有意识到与窗口缩放的关系的情况下禁用了该解决方案。 首先,让我们看一下需要解决的实际问题。 想象以下事件序列: +在非常特殊的情况下,它可能导致数据损坏。但在你禁用该选项之前,要知道通常情况下是不可能损坏的。还有一种解决方案可以防止这种情况。不幸的是,有些人在没有意识到它与窗口缩放的关系的情况下禁用了该解决方案。首先,让我们看一下需要解决的实际问题。想象以下事件序列: - 1. 发送方发送段:s_1、s_2、s_3、... s_n + 1. 发送方发送段:s_1、s_2、s_3、... s_n。 2. 接收方看到:s_1、s_3、... s_n,并发送对 s_1 的确认。 - 3. 发送方认为 s_2 丢失,然后再次发送。 它还发送段 s_n+1 中包含的新数据。 + 3. 发送方认为 s_2 丢失,然后再次发送。它还发送了段 s_n+1 中包含的新数据。 4. 接收方然后看到:s_2、s_n+1,s_2:数据包 s_2 被接收两次。 -当发送方过早触发重新传输时,可能会发生这种情况。 在正常情况下,即使使用窗口缩放,这种错误的重传也绝不会成为问题。 接收方将只丢弃重复项。 +当发送方过早触发重新传输时,可能会发生这种情况。在正常情况下,即使使用窗口缩放,这种错误的重传也绝不会成为问题。接收方将只丢弃重复项。 #### 从旧数据到新数据 -TCP 序列号最多可以为 4GB。如果它变得大于此值,则序列会回绕到 0,然后再次增加。这本身不是问题,但是如果这种问题发生得足够快,则上述情况可能会造成歧义。 +TCP 序列号最多可以为 4GB。如果它变得大于此值,则该序列会回绕到 0,然后再次增加。这本身不是问题,但是如果这种问题发生得足够快,则上述情况可能会造成歧义。 -如果在正确的时刻发生回绕,则序列号 s_2(重新发送的数据包)可能已经大于 s_n+1。 因此,在最后的步骤(4)中,接收器可以将其解释为:s_2、s_n+1、s_n+m,即它可以将 **“旧”** 数据包 s_2 视为包含新数据。 +如果在正确的时刻发生回绕,则序列号 s_2(重新发送的数据包)可能已经大于 s_n+1。因此,在最后的步骤(4)中,接收方可以将其解释为:s_2、s_n+1、s_n+m,即它可以将 “旧” 数据包 s_2 视为包含新数据。 通常,这不会发生,因为即使在高带宽链接上,“回绕”也只会每隔几秒钟或几分钟发生一次。原始数据包和不需要的重传的数据包之间的间隔将小得多。 -例如,对于 50MB/s 的传输速度,重复副本要延迟到一分钟以上才会成为问题。序列号的回绕速度没有快到让小的延迟会导致这个问题。 +例如,对于 50MB/s 的传输速度,重复项要迟到一分钟以上才会成为问题。序列号的回绕速度没有快到让小的延迟会导致这个问题。 -一旦 TCP 达到 “GB/s” 的吞吐率,序列号的回绕速度就会非常快,以至于即使只有几毫秒的延迟也可能会造成 TCP 无法再检测到的重复副本。通过解决接收窗口太小的问题,TCP 现在可以用于以前无法实现的网络速度,这会产生一个新的,尽管很少见的问题。为了在 RTT 非常低的环境中安全使用 GB/s 的速度,接收方必须能够检测到这些旧副本,而不必仅依赖序列号。 +一旦 TCP 达到 “GB/s” 的吞吐率,序列号的回绕速度就会非常快,以至于即使只有几毫秒的延迟也可能会造成 TCP 无法检测出的重复项。通过解决接收窗口太小的问题,TCP 现在可以用于以前无法实现的网络速度,这会产生一个新的,尽管很少见的问题。为了在 RTT 非常低的环境中安全使用 GB/s 的速度,接收方必须能够检测到这些旧的重复项,而不必仅依赖序列号。 ### TCP 时间戳 -#### 最佳使用日期 +#### 最佳截止日期 -用最简单的术语来说,[TCP 时间戳][3]只是在数据包上添加时间戳,以解决由非常快速的序列号回绕引起的歧义。 如果一个段看起来包含新数据,但其时间戳早于最后一个在窗口内的数据包,则该序列号已被重新包装,而“新”数据包实际上是一个较旧的副本。 这解决了即使在极端情况下重传的歧义。 +用最简单的术语来说,[TCP 时间戳][3]只是在数据包上添加时间戳,以解决由非常快速的序列号回绕引起的歧义。如果一个段看起来包含新数据,但其时间戳早于上一个在接收窗口内的数据包,则该序列号已被重新回绕,而“新”数据包实际上是一个较旧的重复项。这解决了即使在极端情况下重传的歧义。 -但是,该扩展不仅仅是检测旧数据包。 TCP 时间戳的另一个主要功能是更精确的往返时间测量(RTTm)。 +但是,该扩展不仅仅是检测旧数据包。TCP 时间戳的另一个主要功能是更精确的往返时间测量(RTTm)。 #### 需要准确的 RTT 估算 -当两个对等方都支持时间戳时,每个 TCP 段都携带两个附加数字:时间戳值和时间戳回显。 +当两个对等方都支持时间戳时,每个 TCP 段都携带两个附加数字:时间戳值和回显时间戳。 ``` -TCP 时间戳选项 (TSopt): Kind: 8, Length: 10 +TCP Timestamp option (TSopt): Kind: 8, Length: 10 +-------+----+----------------+-----------------+ |Kind=8 | 10 |TS Value (TSval)|EchoReply (TSecr)| +-------+----+----------------+-----------------+     1      1         4                4 ``` -准确的 RTT 估算对于 TCP 性能至关重要。 TCP 自动重新发送未确认的数据。 重传由计时器触发:如果超时,则 TCP 会将尚未收到确认的一个或多个数据包视为丢失。 然后再发送一次。 +准确的 RTT 估算对于 TCP 性能至关重要。TCP 会自动重新发送未确认的数据。重传由计时器触发:如果超时,则 TCP 会将尚未收到确认的一个或多个数据包视为丢失。然后再发送一次。 -但是,“尚未得到确认” 并不意味着该段已丢失。 也有可能是接收方到目前为止没有发送确认,或者确认仍在传输中。 这就造成了一个两难的困境:TCP 必须等待足够长的时间,才能让这种轻微的延迟变得无关紧要,但它也不能等待太久。 +但是,“尚未得到确认” 并不意味着该段已丢失。也有可能是接收方到目前为止没有发送确认,或者确认仍在传输中。这就造成了一个两难的困境:TCP 必须等待足够长的时间,才能让这种轻微的延迟变得无关紧要,但它也不能等待太久。 -##### 低网络延迟 VS 高网络延迟 +**低网络延迟 VS 高网络延迟** 在延迟较高的网络中,如果计时器触发过快,TCP 经常会将时间和带宽浪费在不必要的重发上。 -然而,在延迟较低的网络中,等待太长时间会导致真正发生数据包丢失时吞吐量降低。因此,在低延迟网络中,计时器应该比高延迟网络中更早到期。 所以,TCP 重传超时不能使用固定常量值作为超时。它需要根据其在网络中所经历的延迟来调整该值。 +然而,在延迟较低的网络中,等待太长时间会导致真正发生数据包丢失时吞吐量降低。因此,在低延迟网络中,计时器应该比高延迟网络中更早到期。所以,TCP 重传超时不能使用固定常量值作为超时。它需要根据其在网络中所经历的延迟来调整该值。 -##### RTT(往返时间)的测量 +**往返时间的测量** -TCP 选择基于预期往返时间(RTT)的重传超时。 RTT 事先是未知的。它是通过测量发送段与 TCP 接收到该段所承载数据的确认之间的增量来估算的。 +TCP 选择基于预期的往返时间(RTT)的重传超时。RTT 事先是未知的。它是通过测量发送的段与 TCP 接收到该段所承载数据的确认之间的增量来估算的。 由于多种因素使其而变得复杂。 * 出于性能原因,TCP 不会为收到的每个数据包生成新的确认。它等待的时间非常短:如果有更多的数据段到达,则可以通过单个 ACK 数据包确认其接收。这称为“累积确认”cumulative ACK。 - * 往返时间并不恒定。 这是有多种因素造成的。例如,客户端可能是一部移动电话,随其移动而切换到不同的基站。也可能是当链路或 CPU 利用率提高时,数据包交换花费了更长的时间。 - * 必须重新发送的数据包在计算过程中必须被忽略。 - 这是因为发送方无法判断重传数据段的 ACK 是在确认原始传输 (毕竟已到达) 还是在确认重传。 + * 往返时间并不恒定。这是有多种因素造成的。例如,客户端可能是一部移动电话,随其移动而切换到不同的基站。也可能是当链路或 CPU 的利用率提高时,数据包交换花费了更长的时间。 + * 必须重新发送的数据包在计算过程中必须被忽略。这是因为发送方无法判断重传数据段的 ACK 是在确认原来的传输数据(毕竟已到达)还是在确认重传数据。 最后一点很重要:当 TCP 忙于从丢失中恢复时,它可能仅接收到重传段的 ACK。这样,它就无法在此恢复阶段测量(更新)RTT。所以,它无法调整重传超时,然后超时将以指数级增长。那是一种非常具体的情况(它假设其他机制,如快速重传或 SACK 不起作用)。但是,使用 TCP 时间戳,即使在这种情况下也会进行 RTT 评估。 -如果使用了扩展,则对等方将从 TCP 段扩展空间中读取时间戳值并将其存储在本地。然后,它将该值放入作为 “时间戳回显” 发回的所有数据段中。 +如果使用了扩展,则对等方将从 TCP 段的扩展空间中读取时间戳值并将其存储在本地。然后,它将该值作为 “回显时间戳” 放入发回的所有数据段中。 -因此,该选项带有两个时间戳:它的发送方自己的时间戳和它从对等方收到的最新时间戳。原始发送方使用“回显时间戳”来计算 RTT。它是当前时间戳时钟与“时间戳回显”中所反映的值之间的增量。 +因此,该选项带有两个时间戳:它的发送方自己的时间戳和它从对等方收到的最新时间戳。原始发送方使用 “回显时间戳” 来计算 RTT。它是当前时间戳时钟与 “回显时间戳” 中所反映的值之间的增量。 -##### 时间戳的其他用用途 +**时间戳的其他用途** -TCP 时间戳甚至还有除 PAWS 和 RTT 测量以外的其他用途。例如,可以检测是否不需要重发。如果该确认携带较旧的时间戳回显,则该确认针对的是初始数据包,而不是重新发送的数据包。 +TCP 时间戳甚至还有除 PAWS(防止序列号回绕Protection Against Wrapped Sequences) 和 RTT 测量以外的其他用途。例如,可以检测是否不需要重发。如果该确认携带较旧的回显时间戳,则该确认针对的是初始数据包,而不是重新发送的数据包。 TCP 时间戳的另一个更晦涩的用例与 TCP [syn cookie][4] 功能有关。 -##### 在服务器端建立 TCP 连接 +**在服务器端建立 TCP 连接** -当连接请求到达的速度快于服务器应用程序可以接受新的传入连接的速度时,连接积压最终将达到其极限。这可能是由于系统配置错误或应用程序中的错误引起的。当一个或多个客户端发送连接请求而不对 “SYN ACK” 响应做出反应时,也会发生这种情况。这将用不完整的连接填充连接队列。这些条目需要几秒钟才会超时。这被称为“同步洪水攻击”syn flood attack。 +当连接请求到达的速度快于服务器应用程序可以接受新的传入连接的速度时,连接积压最终将达到其极限。这可能是由于系统配置错误或应用程序中的错误引起的。当一个或多个客户端发送连接请求而不对 “SYN ACK” 响应做出反应时,也会发生这种情况。这将用不完整的连接填充连接队列。这些条目需要几秒钟才会超时。这被称为“同步泛洪攻击”syn flood attack。 -##### TCP 时间戳和 TCP Syn Cookie +**TCP 时间戳和 TCP Syn Cookie** 即使队列已满,某些 TCP 协议栈也允许继续接受新连接。发生这种情况时,Linux 内核将在系统日志中打印一条突出的消息: -> P 端口上可能发生 SYN 泛洪。正在发送 Cookie。检查 SNMP 计数器。 +> 端口 P 上可能发生 SYN 泛洪。正在发送 Cookie。检查 SNMP 计数器。 此机制将完全绕过连接队列。通常存储在连接队列中的信息被编码到 SYN/ACK 响应 TCP 序列号中。当 ACK 返回时,可以根据序列号重建队列条目。 -序列号只有有限的空间来存储信息。 因此,使用 “TCP Syn Cookie” 机制建立的连接不能支持 TCP 选项。 +序列号只有有限的空间来存储信息。因此,使用 “TCP Syn Cookie” 机制建立的连接不能支持 TCP 选项。 -但是,对两个对等点都通用的 TCP 选项可以存储在时间戳中。 ACK 数据包在时间戳回显字段中反映了该值,这也允许恢复已达成共识的 TCP 选项。否则,cookie 连接受标准的 64KB 接收窗口限制。 +但是,对两个对等点都通用的 TCP 选项可以存储在时间戳中。ACK 数据包在回显时间戳字段中反映了该值,这也允许恢复已达成共识的 TCP 选项。否则,cookie 连接受标准的 64KB 接收窗口限制。 -##### 常见误区 —— 时间戳不利于性能 +**常见误区 —— 时间戳不利于性能** 不幸的是,一些指南建议禁用 TCP 时间戳,以减少内核访问时间戳时钟来获取当前时间所需的次数。这是不正确的。如前所述,RTT 估算是 TCP 的必要部分。因此,内核在接收/发送数据包时总是采用微秒级的时间戳。 在包处理步骤的其余部分中,Linux 会重用 RTT 估算所需的时钟时间戳。这还避免了将时间戳添加到传出 TCP 数据包的额外时钟访问。 -整个时间戳选项在每个数据包中仅需要 10 个字节的 TCP 选项空间,这并没有显著减少可用于数据包有效负载的空间。 +整个时间戳选项在每个数据包中仅需要 10 个字节的 TCP 选项空间,这不会显著减少可用于数据包有效负载的空间。 -##### 常见误区 —— 时间戳是个安全问题 +**常见误区 —— 时间戳是个安全问题** -一些安全审计工具和 (较旧的) 博客文章建议禁用 TCP 时间戳,因为据称它们泄露了系统正常运行时间:这样一来,便可以估算系统/内核的补丁级别。这在过去是正确的:时间戳时钟基于不断增加的值,该值在每次系统引导时都以固定值开始。时间戳值可以估计机器已经运行了多长时间 (正常运行时间)。 +一些安全审计工具和(较旧的)博客文章建议禁用 TCP 时间戳,因为据称它们泄露了系统正常运行时间:这样一来,便可以估算系统/内核的补丁级别。这在过去是正确的:时间戳时钟基于不断增加的值,该值在每次系统引导时都以固定值开始。时间戳值可以估计机器已经运行了多长时间(正常运行时间 `uptime`)。 -从 Linux 4.12 开始,TCP 时间戳不再显示正常运行时间。发送的所有时间戳值都使用对等设备特定的偏移量。时间戳值也每 49 天换行一次。 +从 Linux 4.12 开始,TCP 时间戳不再显示正常运行时间。发送的所有时间戳值都使用对等设备特定的偏移量。时间戳值也每 49 天回绕一次。 换句话说,从地址 “A” 出发,或者终到地址 “A” 的连接看到的时间戳与到远程地址 “B” 的连接看到的时间戳不同。 -运行 _sysctl net.ipv4.tcp_timeamp=2_ 以禁用随机化偏移。这使得分析由诸如 _Wireshark_ 或 _tcpdump_ 之类的工具记录的数据包跟踪变得更容易 —— 从主机发送的数据包在其 TCP 选项时间戳中都具有相同的时钟基准。因此,对于正常操作,默认设置应保持不变。 +运行 `sysctl net.ipv4.tcp_timeamp=2` 以禁用随机化偏移。这使得分析由诸如 `wireshark` 或 `tcpdump` 之类的工具记录的数据包跟踪变得更容易 —— 从主机发送的数据包在其 TCP 选项时间戳中都具有相同的时钟基准。因此,对于正常操作,默认设置应保持不变。 ### 选择性确认 -如果丢失同一数据窗口中的多个数据包,TCP 将会出现问题。 这是因为 TCP 确认是累积的,但仅适用于按顺序到达的数据包。例如: +如果同一数据窗口中的多个数据包丢失了,TCP 将会出现问题。这是因为 TCP 确认是累积的,但仅适用于按顺序到达的数据包。例如: - * 发送方发送段 s_1,s_2,s_3,... s_n + * 发送方发送段 s_1、s_2、s_3、... s_n * 发送方收到 s_2 的 ACK * 这意味着 s_1 和 s_2 都已收到,并且发送方不再需要保留这些段。 - * s_3 是否应该重新发送? s_4呢? s_n? + * s_3 是否应该重新发送? s_4 呢? s_n? -发送方等待 “重传超时” 或 “重复 ACK” 以使 s_2 到达。如果发生重传超时或到达 s_2 的多个重复 ACK,则发送方再次发送 s_3。 +发送方等待 “重传超时” 或 “重复 ACK” 以使 s_2 到达。如果发生重传超时或到达了 s_2 的多个重复 ACK,则发送方再次发送 s_3。 如果发送方收到对 s_n 的确认,则 s_3 是唯一丢失的数据包。这是理想的情况。仅发送单个丢失的数据包。 -如果发送方收到的确认段小于 s_n,例如 s_4,则意味着丢失了多个数据包。 -发送方也需要重传下一个数据段。 +如果发送方收到的确认段小于 s_n,例如 s_4,则意味着丢失了多个数据包。发送方也需要重传下一个数据段。 -##### 重传策略 +**重传策略** 可能只是重复相同的序列:重新发送下一个数据包,直到接收方指示它已处理了直至 s_n 的所有数据包为止。这种方法的问题在于,它需要一个 RTT,直到发送方知道接下来必须重新发送的数据包为止。尽管这种策略可以避免不必要的重传,但要等到 TCP 重新发送整个数据窗口后,它可能要花几秒钟甚至更长的时间。 -另一种方法是一次重新发送几个数据包。当丢失了几个数据包时,此方法可使 TCP 恢复更快。在上面的示例中,TCP 重新发送了 s_3,s_4,s_5,...,但是只能确保已丢失 s_3。 +另一种方法是一次重新发送几个数据包。当丢失了几个数据包时,此方法可使 TCP 恢复更快。在上面的示例中,TCP 重新发送了 s_3、s_4、s_5、...,但是只能确保已丢失 s_3。 从延迟的角度来看,这两种策略都不是最佳的。如果只有一个数据包需要重新发送,第一种策略是快速的,但是当多个数据包丢失时,它花费的时间太长。 @@ -219,7 +217,7 @@ TCP 时间戳的另一个更晦涩的用例与 TCP [syn cookie][4] 功能有关 通过可用信息,TCP 无法知道丢失了哪些数据包。这就是 TCP [选择性确认][5](SACK)的用武之地了。就像窗口缩放和时间戳一样,它是另一个可选的但非常有用的 TCP 特性。 -##### SACK 选项 +**SACK 选项** ```    TCP Sack-Permitted Option: Kind: 4, Length 2 @@ -228,7 +226,7 @@ TCP 时间戳的另一个更晦涩的用例与 TCP [syn cookie][4] 功能有关    +---------+---------+ ``` -支持此扩展的发送方在连接请求中包括 “允许 SACK” 选项。如果两个端点都支持扩展,则检测到数据流中丢失数据包的对等点可以将此信息通知发送方。 +支持此扩展的发送方在连接请求中包括 “允许 SACK” 选项。如果两个端点都支持该扩展,则检测到数据流中丢失数据包的对等方可以将此信息通知发送方。 ```    TCP SACK Option: Kind: 5, Length: Variable @@ -249,7 +247,7 @@ TCP 时间戳的另一个更晦涩的用例与 TCP [syn cookie][4] 功能有关    +--------+--------+--------+--------+ ``` -接收方遇到 segment_s2 后跟 s_5 ... s_n,则在发送对 s_2 的确认时将包括一个 SACK 块: +接收方遇到 s_2 后跟 s_5 ... s_n,则在发送对 s_2 的确认时将包括一个 SACK 块: ``` @@ -262,31 +260,29 @@ TCP 时间戳的另一个更晦涩的用例与 TCP [syn cookie][4] 功能有关 +--------+-------+-------+-------+ ``` -这告诉发送方到 s_2 的段都是按顺序到达的,但也让发送方知道段 s_5 至 s_n 也已收到。 然后,发送方可以重新发送这两个数据包,并继续发送新数据。 +这告诉发送方到 s_2 的段都是按顺序到达的,但也让发送方知道段 s_5 至 s_n 也已收到。然后,发送方可以重新发送那两个数据包(s_3、s_4),并继续发送新数据。 -##### 神话般的无损网络 +**神话般的无损网络** 从理论上讲,如果连接不会丢包,那么 SACK 就没有任何优势。或者连接具有如此低的延迟,甚至等待一个完整的 RTT 都无关紧要。 -在实践中,无损行为几乎是不可能保证的。 -即使网络及其所有交换机和路由器具有足够的带宽和缓冲区空间,数据包仍然可能丢失: +在实践中,无损行为几乎是不可能保证的。即使网络及其所有交换机和路由器具有足够的带宽和缓冲区空间,数据包仍然可能丢失: * 主机操作系统可能面临内存压力并丢弃数据包。请记住,一台主机可能同时处理数万个数据包流。 * CPU 可能无法足够快地消耗掉来自网络接口的传入数据包。这会导致网络适配器本身中的数据包丢失。 * 如果 TCP 时间戳不可用,即使一个非常小的 RTT 的连接也可能在丢失恢复期间暂时停止。 -使用 SACK 不会增加 TCP 数据包的大小,除非连接遇到数据包丢失。因此,几乎没有理由禁用此功能。几乎所有的 TCP 协议栈都支持 SACK —— 它通常只在不进行 TCP 批量数据传输的低功耗 IOT 类似设备上才不存在。 +使用 SACK 不会增加 TCP 数据包的大小,除非连接遇到数据包丢失。因此,几乎没有理由禁用此功能。几乎所有的 TCP 协议栈都支持 SACK —— 它通常只在不进行 TCP 批量数据传输的低功耗 IOT 类的设备上才不存在。 当 Linux 系统接受来自此类设备的连接时,TCP 会自动为受影响的连接禁用 SACK。 ### 总结 -本文中研究的三个 TCP 扩展都与 TCP 性能有关,最好都保留其默认设置:enabled。 +本文中研究的三个 TCP 扩展都与 TCP 性能有关,最好都保留其默认设置:启用。 -TCP 握手可确保仅使用双方都可以理解的扩展,因此,永远不需因为对等方可能不支持而全局禁用扩展。 +TCP 握手可确保仅使用双方都可以理解的扩展,因此,永远不需因为对等方可能不支持而全局禁用该扩展。 -关闭这些扩展会导致严重的性能损失,尤其是在 TCP 窗口缩放和 SACK 的情况下。 可以禁用 TCP 时间戳而不会立即造成不利影响,但是现在没有令人信服的理由这样做了。 -启用它们还可以支持 TCP 选项,即使在 SYN cookie 生效时也是如此。 +关闭这些扩展会导致严重的性能损失,尤其是 TCP 窗口缩放和 SACK。可以禁用 TCP 时间戳而不会立即造成不利影响,但是现在没有令人信服的理由这样做了。启用它们还可以支持 TCP 选项,即使在 SYN cookie 生效时也是如此。 -------------------------------------------------------------------------------- @@ -294,8 +290,8 @@ via: https://fedoramagazine.org/tcp-window-scaling-timestamps-and-sack/ 作者:[Florian Westphal][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/gxlct008) -校对:[校对者ID](https://github.com/校对者ID) +译者:[gxlct008](https://github.com/gxlct008) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6782990a0bf9f7a8261f2d3bea134d699c416ffb Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 12 Oct 2020 11:42:22 +0800 Subject: [PATCH 0416/1156] PUB @gxlct008 https://linux.cn/article-12710-1.html --- .../20200811 TCP window scaling, timestamps and SACK.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200811 TCP window scaling, timestamps and SACK.md (99%) diff --git a/translated/tech/20200811 TCP window scaling, timestamps and SACK.md b/published/20200811 TCP window scaling, timestamps and SACK.md similarity index 99% rename from translated/tech/20200811 TCP window scaling, timestamps and SACK.md rename to published/20200811 TCP window scaling, timestamps and SACK.md index 691bec1b4b..cd47284eb7 100644 --- a/translated/tech/20200811 TCP window scaling, timestamps and SACK.md +++ b/published/20200811 TCP window scaling, timestamps and SACK.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (gxlct008) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12710-1.html) [#]: subject: (TCP window scaling, timestamps and SACK) [#]: via: (https://fedoramagazine.org/tcp-window-scaling-timestamps-and-sack/) [#]: author: (Florian Westphal https://fedoramagazine.org/author/strlen/) From b54c8047c71e1bdc1e7cf188d908b4c60a435799 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 12 Oct 2020 23:18:15 +0800 Subject: [PATCH 0417/1156] PRF @geekpi --- ... MS-Paint Type of App for Linux Desktop.md | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/translated/tech/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md b/translated/tech/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md index 46d1c2d639..97d58aeaa7 100644 --- a/translated/tech/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md +++ b/translated/tech/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md @@ -1,22 +1,24 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Drawing is an Open Source MS-Paint Type of App for Linux Desktop) [#]: via: (https://itsfoss.com/drawing-app/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -Drawing 是一款开源的类似微软画图的 Linux 桌面应用 +Drawing:一款开源的类似微软画图的 Linux 桌面应用 ====== -_**简介:Drawing 是一个基本的图像编辑器,就像微软画图一样。有了这个开源的应用,你可以画箭头、线条、几何图形、添加颜色和其他你期望在普通绘图应用程序中做的事情。**_ +![](https://img.linux.net.cn/data/attachment/album/202010/12/231731q0pgrkzidsguosps.jpg) + +> Drawing 是一个基本的图像编辑器,就像微软画图一样。有了这个开源的应用,你可以画箭头、线条、几何图形、添加颜色和其他你期望在普通绘图应用程序中做的事情。 ### Drawing: 一个简单的 Linux 绘图应用 ![][1] -对于从 Windows XP (或更早版本)开始使用电脑的人来说,微软画图是一个有趣的随机画一些草图的应用。在这个被 Photoshop 和 GIMP 主导的世界里,画图应用仍然具有一定的现实意义。 +对于从 Windows XP (或更早版本)开始使用电脑的人来说,微软画图Paint是一个有趣的应用,是个可以随便画一些草图的应用。在这个被 Photoshop 和 GIMP 主导的世界里,画图应用仍然具有一定的现实意义。 有几个[可用于 Linux 的绘画应用][2],我打算在这个列表中再添加一个。 @@ -29,34 +31,32 @@ _**简介:Drawing 是一个基本的图像编辑器,就像微软画图一样 Drawing 拥有你所期待的绘图应用的所有功能。你可以: * 从头开始创建新的绘图 - * 编辑现有的 PNG、JPEG 或 BMP 图像文件。 - * 添加几何图形、线条、箭头等。 + * 编辑现有的 PNG、JPEG 或 BMP 图像文件 + * 添加几何图形、线条、箭头等 * 虚线 - * 使用铅笔工具进行自由手绘。 + * 使用铅笔工具进行自由手绘 * 使用曲线和形状工具 * 裁剪图像 * 缩放图像到不同的像素大小 * 添加文本 - * 选择图像的一部分(矩形、自由选择和颜色选择)。 + * 选择图像的一部分(矩形、自由选择和颜色选择) * 旋转图像 * 添加复制到剪贴板的图像 * 可在偏好中使用橡皮擦、荧光笔、油漆桶、颜色选择、颜色选择器工具 * 无限撤销 - * 滤镜可以增加模糊、像素化、透明度等。 - - + * 滤镜可以增加模糊、像素化、透明度等 ### 我使用 Drawing 的经验 ![][5] -这个应用是新的,并且有不错的用户界面。它具有你期望在标准绘画应用中找到的所有基本功能。 +这个应用是新出现的,并且有不错的用户界面。它具有你期望在标准的绘画应用中找到的所有基本功能。 -它有一些额外的工具,如颜色选择和颜色选择器,但在使用时可能会混淆。没有可用的文档来描述这些工具的使用,要全靠你自己。 +它有一些额外的工具,如颜色选择和拾色器,但在使用时可能会混淆。没有什么文档描述这些工具的使用,要全靠你自己摸索。 -它的体验很流畅,我觉得这个工具很有潜力取代 Shutter 作为图像编辑工具(是的,我[用 Shutter 编辑截图][6])。 +它的体验很流畅,作为图像编辑工具,我觉得这个工具很有潜力取代 Shutter (是的,我[用 Shutter 编辑截图][6])。 -我觉得最麻烦的是,添加元素后无法编辑/修改。你有撤消和重做选项,但如果你想修改一个你在 12 步前添加的文本,你就必须重做所有的步骤。这一点开发者可能会在未来的版本中进行研究。 +我觉得最麻烦的是,添加元素后无法编辑/修改。你有撤消和重做选项,但如果你想修改一个你在 12 步前添加的文本,你就必须重做所有的步骤。这是未来的版本中开发者可能要做的一些改进。 ### 在 Linux 上安装 Drawing @@ -89,9 +89,9 @@ sudo add-apt-repository -r ppa:cartes/drawing 检查你的发行版的包管理器中是否有 Drawing,然后在那里安装。如果你想要最新的版本,你可以使用 Flatpak 版本的应用。 -[Drawing Flatpak][9] +- [Drawing Flatpak][9] -**总结** +### 总结 你还在用画图应用么?你用的是哪一款?如果你已经尝试过 Drawing,你的体验如何? @@ -102,7 +102,7 @@ via: https://itsfoss.com/drawing-app/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From efa93647831cd4f8bd1e37f4c699a8e4f2b27428 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 12 Oct 2020 23:21:33 +0800 Subject: [PATCH 0418/1156] PUB @geekpi https://linux.cn/article-12712-1.html --- ...s an Open Source MS-Paint Type of App for Linux Desktop.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md (98%) diff --git a/translated/tech/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md b/published/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md similarity index 98% rename from translated/tech/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md rename to published/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md index 97d58aeaa7..2c998c10ba 100644 --- a/translated/tech/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md +++ b/published/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12712-1.html) [#]: subject: (Drawing is an Open Source MS-Paint Type of App for Linux Desktop) [#]: via: (https://itsfoss.com/drawing-app/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From 870a9e95505578f24001d7fd92fd3b3c68933f99 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 12 Oct 2020 23:33:20 +0800 Subject: [PATCH 0419/1156] APL --- ...ter- What is a Package Manager in Linux- How Does it Work.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md b/sources/tech/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md index 258848f4e9..bb1868dd9e 100644 --- a/sources/tech/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md +++ b/sources/tech/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From a0cead6b3e3b5565c845e21a1b8db86fe274d0f5 Mon Sep 17 00:00:00 2001 From: Hilton Chain <26847027+rakino@users.noreply.github.com> Date: Tue, 13 Oct 2020 00:18:45 +0800 Subject: [PATCH 0420/1156] translated --- ...gs To Do After Installing Manjaro Linux.md | 134 ----------------- ...gs To Do After Installing Manjaro Linux.md | 136 ++++++++++++++++++ 2 files changed, 136 insertions(+), 134 deletions(-) delete mode 100644 sources/tech/20201010 6 Essential Things To Do After Installing Manjaro Linux.md create mode 100644 translated/tech/20201010 6 Essential Things To Do After Installing Manjaro Linux.md diff --git a/sources/tech/20201010 6 Essential Things To Do After Installing Manjaro Linux.md b/sources/tech/20201010 6 Essential Things To Do After Installing Manjaro Linux.md deleted file mode 100644 index 52fc1937d4..0000000000 --- a/sources/tech/20201010 6 Essential Things To Do After Installing Manjaro Linux.md +++ /dev/null @@ -1,134 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (rakino) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (6 Essential Things To Do After Installing Manjaro Linux) -[#]: via: (https://itsfoss.com/things-to-do-after-installing-manjaro/) -[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) - -6 Essential Things To Do After Installing Manjaro Linux -====== - -So, you just did a [fresh installation of Manjaro Linux][1]. Now what? - -Here are a few essential post installation steps I recommend you to follow. - -Quite honestly, these are the things I prefer to do after installing Manjaro. Yours could differ depending on your need. - -### Recommended Things To Do After Installing Manjaro Linux - -![][2] - -I am using Manjaro Xfce edition but the steps are applicable to other desktop variants of [Manjaro][3] as well. - -#### 1\. Set the fastest mirror - -Before even updating your system, I suggest to sort out your mirror list first. When refreshing the Manjaro system and downloading software from repositories, an optimized mirror list can have noticeable performance impact to the system. - -Open the Terminal emulator and type the following command: - -``` -sudo pacman-mirrors --fasttrack -``` - -![][4] - -#### 2\. Update your system - -Keeping your system up-to-date reduces the chances of security vulnerabilities. Refreshing your system repository is also a recommended thing to do before installing new software. - -You can [update your Manjaro system][5] by running the following command. - -``` -sudo pacman -Syu -``` - -![][6] - -#### 3\. Enable AUR, Snap or Flatpak support - -[Arch User Repository (AUR)][7] is one of the main reasons that a user chooses an [Arch-based system][8]. It gives you access to a huge number of additional software. - -Optionally, you can also enable support for [Snaps][9] and [Flatpaks][10] directly from Pamac GUI package manager. - -![][11] - -#### 4\. Enable TRIM (SSD only) - -If your root partition has been installed on SSD, enabling [TRIM][12] is one thing you need to do after installing Manjaro. TRIM helps to clean blocks in your SSD and extend the lifespan of your SSD. - -To enable TRIM on Manjaro, run the following command in a terminal: - -``` -sudo systemctl enable fstrim.timer -``` - -![][13] - -#### 5\. Installing a kernel of your choice (advanced users) - -One of the topics that I covered in my [Manjaro Linux review][14], is how easily you can switch kernels through a graphical interface. - -Do you prefer to use the command line? You can list the installed kernel(s) on your system and install a kernel using your terminal. - -To list the installed kernels: - -``` -mhwd-kernel -li -``` - -**To install a new kernel** (the latest to date 5.8 kernel for example)**:** - -``` -sudo mhwd-kernel -i linux58 -``` - -![][15] - -#### 6\. Install Microsoft true type fonts (if you need it) - -I have to often edit the work documents on my personal computer and hence I need the Microsoft fonts like Times New Roman or Arial. - -If you also need to use Microsoft fonts, you can access the [package][16] from [AUR][7]. If you want to use the command line for AUR packages, you can install an [AUR helper][17]. - -![][18] - -#### Conclusion - -[Manjaro is a great distribution][19] if you want to use the benefits of Arch Linux on a pre-configured, desktop optimized distribution. Though it comes pre-configured with many essentials, there are a few steps that cannot be done in advance, as everyone has a different setup and different needs. - -Please let us know in the comments below, which step apart from the already mentioned is the essential for you. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/things-to-do-after-installing-manjaro/ - -作者:[Dimitrios Savvopoulos][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/dimitrios/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/install-manjaro-linux/ -[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/things-to-do-after-installing-manjaro.jpg?resize=800%2C450&ssl=1 -[3]: https://manjaro.org -[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/manjaro-fasttrack.png?resize=800%2C600&ssl=1 -[5]: https://itsfoss.com/update-arch-linux/ -[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/sudo-pacman-Syu.png?resize=800%2C504&ssl=1 -[7]: https://itsfoss.com/aur-arch-linux/ -[8]: https://itsfoss.com/arch-based-linux-distros/ -[9]: https://itsfoss.com/use-snap-packages-ubuntu-16-04/ -[10]: https://itsfoss.com/flatpak-guide/ -[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/pamac-2.png?resize=800%2C600&ssl=1 -[12]: https://en.wikipedia.org/wiki/Trim_(computing) -[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/fstrim.timer_.png?resize=800%2C600&ssl=1 -[14]: https://itsfoss.com/manjaro-linux-review/ -[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/manjaro-cli-kernels.png?resize=800%2C600&ssl=1 -[16]: https://aur.archlinux.org/packages/ttf-ms-fonts -[17]: https://itsfoss.com/best-aur-helpers/ -[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/08/ttf-ms-fonts.png?resize=800%2C600&ssl=1 -[19]: https://itsfoss.com/why-use-manjaro-linux/ diff --git a/translated/tech/20201010 6 Essential Things To Do After Installing Manjaro Linux.md b/translated/tech/20201010 6 Essential Things To Do After Installing Manjaro Linux.md new file mode 100644 index 0000000000..17a4b6846d --- /dev/null +++ b/translated/tech/20201010 6 Essential Things To Do After Installing Manjaro Linux.md @@ -0,0 +1,136 @@ +[#]: collector: (lujun9972) +[#]: translator: (rakino) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 Essential Things To Do After Installing Manjaro Linux) +[#]: via: (https://itsfoss.com/things-to-do-after-installing-manjaro/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +安装 Manjaro Linux 后要做的 6 件事 +====== + +所以,你刚刚[全新安装了 Manjaro Linux][1],那么现在该做什么呢? + +下面是我推荐你在安装后进行的一些步骤。 + +不过说实话,这些都是我在安装 Manjaro 后喜欢做的事,根据你的需求,步骤可能会有所不同。 + +### 推荐在安装完 Manjaro Linux 后去做的事 + +![][2] + +我使用的是 Xfce 版的 Manjaro,但这些步骤也适用于 [Manjaro][3] 的其它桌面环境版本。 + +#### 1、设置最快的镜像 + + 在更新系统之前,我建议先整理一下镜像列表。在刷新 Manjaro 系统和从软件仓库下载软件包的时候,优化后的镜像列表会对系统的性能产生明显的影响。 + +打开终端模拟器并输入以下命令: + +``` +sudo pacman-mirrors --fasttrack +``` + +![][4] + +#### 2、更新系统 + +保持系统更新可以降低安全漏洞的发生机率,在安装新的软件之前也建议刷新系统的软件仓库。 + +你可以用下面的命令来[更新 Manjaro 系统][5]: + +``` +sudo pacman -Syu +``` + +![][6] + +#### 3、启用 AUR,Snap 以及 Flatpak 支持 + +[Arch 用户仓库Arch User Repository(AUR)][7]是用户选择[基于 Arch Linux 的系统][8]的一个主要理由。你可以在 AUR 中访问到大量的附加软件。 + +(译注:AUR 中的 PKGBUILD 均为用户上传且未经审核,使用者需要自负责任,在构建软件包前请注意检查其中内容是否合理。) + +作为可选项,你可以直接在 Pamac 图形化软件包管理器中启用对 [Snap][9] 以及 [Flatpak][10] 的支持。 + +![][11] + +#### 启用 TRIM(仅 SSD) + +如果你的根分区已经安装在了 SSD 上,启用 [TRIM][12] 会是你在安装 Manjaro 后需要做的一件事。TRIM 会帮助清理 SSD 中的块,从而延长 SSD 的使用寿命。 + +要在 Manjaro 中启用 TRIM,请在终端中输入以下命令: + +``` +sudo systemctl enable fstrim.timer +``` + +![][13] + +#### 5、安装内核(高级用户) + +我在 [Manjaro 评测][14]中提到的一个话题就是,你可以在图形界面中轻易地更换内核。 + +喜欢使用命令行?你也可以在终端中列出系统中已安装的内核以及安装新的内核。 + +列出已安装的内核: + +``` +mhwd-kernel -li +``` + +**安装新内核**(以最新的 5.8 版本内核为例)**:** + +``` +sudo mhwd-kernel -i linux58 +``` + +![][15] + +#### 6、安装微软 TrueType 字体(如果需要) + +我经常在个人电脑上编辑工作文件,因此我需要 Times New Roman 或 Arial 等微软字体。 + +如果你也需要使用微软字体,可以从 [AUR][7] 中取得这个[软件包][16]。如果你想要在命令行中管理 AUR 软件包,可以选择安装一个 [AUR 助手][17]。 + +![][18] + +#### 结论 + +如果你想在一个预配置、为桌面优化的发行版上享受 Arch Linux 的优点,[Manjaro是一个很好的发行版][19]。虽然它预置了很多东西,但由于每个人设置和需求的不同,有几个步骤是不能提前完成的。 + +除开已经提到的步骤,还有哪一步对你来说是必不可少的?请在下面的评论中告诉我们。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/things-to-do-after-installing-manjaro/ + +作者:[Dimitrios Savvopoulos][a] +选题:[lujun9972][b] +译者:[rakino](https://github.com/rakino) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/install-manjaro-linux/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/things-to-do-after-installing-manjaro.jpg?resize=800%2C450&ssl=1 +[3]: https://manjaro.org +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/manjaro-fasttrack.png?resize=800%2C600&ssl=1 +[5]: https://itsfoss.com/update-arch-linux/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/sudo-pacman-Syu.png?resize=800%2C504&ssl=1 +[7]: https://itsfoss.com/aur-arch-linux/ +[8]: https://itsfoss.com/arch-based-linux-distros/ +[9]: https://itsfoss.com/use-snap-packages-ubuntu-16-04/ +[10]: https://itsfoss.com/flatpak-guide/ +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/pamac-2.png?resize=800%2C600&ssl=1 +[12]: https://en.wikipedia.org/wiki/Trim_(computing) +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/fstrim.timer_.png?resize=800%2C600&ssl=1 +[14]: https://itsfoss.com/manjaro-linux-review/ +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/manjaro-cli-kernels.png?resize=800%2C600&ssl=1 +[16]: https://aur.archlinux.org/packages/ttf-ms-fonts +[17]: https://itsfoss.com/best-aur-helpers/ +[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/08/ttf-ms-fonts.png?resize=800%2C600&ssl=1 +[19]: https://itsfoss.com/why-use-manjaro-linux/ From 32b8b1fdbfcdd632a5ddce47d626a5efd215779c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 13 Oct 2020 00:19:29 +0800 Subject: [PATCH 0421/1156] TSL&PRF --- ...kage Manager in Linux- How Does it Work.md | 110 ------------------ ...kage Manager in Linux- How Does it Work.md | 110 ++++++++++++++++++ 2 files changed, 110 insertions(+), 110 deletions(-) delete mode 100644 sources/tech/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md create mode 100644 translated/tech/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md diff --git a/sources/tech/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md b/sources/tech/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md deleted file mode 100644 index bb1868dd9e..0000000000 --- a/sources/tech/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md +++ /dev/null @@ -1,110 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Linux Jargon Buster: What is a Package Manager in Linux? How Does it Work?) -[#]: via: (https://itsfoss.com/package-manager/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -Linux Jargon Buster: What is a Package Manager in Linux? How Does it Work? -====== - -One of the main points [how Linux distributions differ from each other][1] is the package management. In this part of the Linux jargon buster series, you’ll learn about packaging and package managers in Linux. You’ll learn what are packages, what are package managers and how do they work and what kind of package managers available. - -### What is a package manager in Linux? - -In simpler words, a package manager is a tool that allows users to install, remove, upgrade, configure and manage software packages on an operating system. The package manager can be a graphical application like a software center or a command line tool like [apt-get][2] or [pacman][3]. - -You’ll often find me using the term ‘package’ in tutorials and articles on It’s FOSS. To understand package manager, you must understand what a package is. - -### What is a package? - -A package is usually referred to an application but it could be a GUI application, command line tool or a software library (required by other software programs). A package is essentially an archive file containing the binary executable, configuration file and sometimes information about the dependencies. - -In older days, [software used to installed from its source code][4]. You would refer to a file (usually named readme) and see what software components it needs, location of binaries. A configure script or makefile is often included. You will have to compile the software or on your own along with handling all the dependencies (some software require installation of other software) on your own. - -To get rid of this complexity, Linux distributions created their own packaging format to provide the end users ready-to-use binary files (precompiled software) for installing software along with some [metadata][5] (version number, description) and dependencies. - -It is like baking a cake versus buying a cake. - -![][6] - -Around mid 90s, Debian created .deb or DEB packaging format and Red Hat Linux created .rpm or RPM (short for Red Hat Package Manager) packaging system. Compiling source code still exists but it is optional now. - -To interact with or use the packaging systems, you need a package manager. - -### How does the package manager work? - -Please keep in mind that package manager is a generic concept and it’s not exclusive to Linux. You’ll often find package manager for different software or programming languages. There is [PIP package manager just for Python packages][7]. Even [Atom editor has its own package manager][8]. - -Since the focus in this article is on Linux, I’ll take things from Linux’s perspective. However, most of the explanation here could be applied to package manager in general as well. - -I have created this diagram (based on SUSE Wiki) so that you can easily understand how a package manager works. - -![][9] - -Almost all Linux distributions have software repositories which is basically collection of software packages. Yes, there could be more than one repository. The repositories contain software packages of different kind. - -Repositories also have metadata files that contain information about the packages such as the name of the package, version number, description of package and the repository name etc. This is what you see if you use the [apt show command][10] in Ubuntu/Debian. - -Your system’s package manager first interacts with the metadata. The package manager creates a local cache of metadata on your system. When you run the update option of the package manager (for example apt update), it updates this local cache of metadata by referring to metadata from the repository. - -When you run the installation command of your package manager (for example apt install package_name), the package manager refers to this cache. If it finds the package information in the cache, it uses the internet connection to connect to the appropriate repository and downloads the package first before installing on your system. - -A package may have dependencies. Meaning that it may require other packages to be installed. The package manager often takes care of the dependencies and installs it automatically along with the package you are installing. - -![Package Manager Handling Dependencies In Linux][11] - -Similarly, when you remove a package using the package manager, it either automatically removes or informs you that your system has unused packages that can be cleaned. - -Apart from the obvious tasks of installing, removing, you can use the package manager to configure the packages and manage them as per your need. For example, you can [prevent the upgrade of a package version][12] from the regular system updates. There are many more things your package manager might be capable of. - -### Different kinds of package managers - -Package Managers differ based on packaging system but same packaging system may have more than one package manager. - -For example, RPM has [Yum][13] and [DNF][14] package managers. For DEB, you have apt-get, [aptitude][15] command line based package managers. - -![Synaptic package manager][16] - -Package managers are not necessarily command line based. You have graphical package managing tools like [Synaptic][17]. Your distribution’s software center is also a package manager even if it runs apt-get or DNF underneath. - -### Conclusion - -I don’t want to go in further detail on this topic because I can go on and on. But it will deviate from the objective of the topic which is to give you a basic understanding of package manager in Linux. - -I have omitted the new universal packaging formats like Snap and Flatpak for now. - -I do hope that you have a bit better understanding of the package management system in Linux. If you are still confused or if you have some questions on this topic, please use the comment system. I’ll try to answer your questions and if required, update this article with new points. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/package-manager/ - -作者:[Abhishek Prakash][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/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/what-is-linux/ -[2]: https://itsfoss.com/apt-vs-apt-get-difference/ -[3]: https://itsfoss.com/pacman-command/ -[4]: https://itsfoss.com/install-software-from-source-code/ -[5]: https://www.computerhope.com/jargon/m/metadata.htm -[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/source-code-comilation-vs-packaging.png?resize=800%2C450&ssl=1 -[7]: https://itsfoss.com/install-pip-ubuntu/ -[8]: https://itsfoss.com/install-packages-in-atom/ -[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/linux-package-manager-explanation.png?resize=800%2C450&ssl=1 -[10]: https://itsfoss.com/apt-search-command/ -[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/package-manager-handling-dependencies-in-linux.png?resize=800%2C450&ssl=1 -[12]: https://itsfoss.com/prevent-package-update-ubuntu/ -[13]: https://fedoraproject.org/wiki/Yum -[14]: https://fedoraproject.org/wiki/DNF -[15]: https://wiki.debian.org/Aptitude -[16]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/see-packages-by-repositories-synaptic.png?resize=799%2C548&ssl=1 -[17]: https://itsfoss.com/synaptic-package-manager/ diff --git a/translated/tech/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md b/translated/tech/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md new file mode 100644 index 0000000000..0d8b245b55 --- /dev/null +++ b/translated/tech/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md @@ -0,0 +1,110 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux Jargon Buster: What is a Package Manager in Linux? How Does it Work?) +[#]: via: (https://itsfoss.com/package-manager/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Linux 黑话解释:什么是包管理器?它是如何工作的? +====== + +[Linux 发行版之间有什么不同][1]的要点之一是包管理。在这篇 Linux 黑话解释中,你将了解 Linux 中的打包和包管理器。你将了解什么是包,什么是包管理器,它们是如何工作的,以及有什么样的包管理器可用。 + +### 什么是包管理器? + +简单来说,“包管理器package manager”(或“软件包管理器”)是一种工具,它允许用户在操作系统上安装、删除、升级、配置和管理软件包。软件包管理器可以是像“软件中心”这样的图形化应用,也可以是像 [apt-get][2] 或 [pacman][3] 这样的命令行工具。 + +你会发现我经常在教程和文章中使用“包”这个词。要了解包管理器,你必须了解什么是包。 + +### 什么是包? + +一个“package”(或“软件包”)通常指的是一个应用程序,它可以是一个 GUI 应用程序、命令行工具或(其他软件程序需要的)软件库。包本质上是一个存档文件,包含二进制可执行文件、配置文件,有时还包含依赖关系的信息。 + +在旧时代,[软件曾经是从它的源代码安装的][4]。你会参考一个文件(通常命名为 `README`),看看它需要什么软件组件、二进制文件的位置。它通常包括一个配置脚本或 `Makefile`。你必须自己编译该软件或自己处理所有的依赖关系(有些软件需要安装其他软件)。 + +为了摆脱这种复杂性,Linux 发行版创建了自己的打包格式,为终端用户提供随时可用的二进制文件(预编译软件),以便安装软件,同时提供一些[元数据][5](版本号、描述)和依赖关系。 + +这就像烤蛋糕与买蛋糕一样。 + +![][6] + +大约在上世纪 90 年代中期,Debian 创建了 DEB 打包格式(`.deb`),Red Hat Linux 创建了 RPM(Red Hat Package Manager 的缩写)打包系统(`.rpm`)。编译源代码的方式仍然存在,但现在是可选的。 + +要与打包系统交互或使用打包系统,你需要一个包管理器。 + +### 包管理器是如何工作的? + +请记住,包管理器是一个通用的概念,它并不是 Linux 独有的。你会经常发现各种软件或编程语言的包管理器。有[只是针对 Python 包的 PIP 包管理器][7]。甚至 [Atom 编辑器也有自己的包管理器][8]。 + +由于本文的重点是 Linux,所以我会从 Linux 的角度出发。不过,这里的大部分解释也可以应用于一般的包管理器。 + +我创建了这个图(基于 SUSE Wiki),这样你就可以很容易理解包管理器是如何工作的。 + +![][9] + +几乎所有的 Linux 发行版都有“软件仓库software repository”,它基本上是软件包的集合。是的,可以有不止一个软件库。软件库包含不同种类的软件包。 + +软件仓库也有元数据文件,其中包含了软件包的信息,如软件包的名称、版本号、软件包的描述和软件仓库名称等。这就是你在 Ubuntu/Debian 中使用 [apt show 命令][10]所看到的。 + +你的系统上的包管理器首先会与元数据进行交互。包管理器在你的系统上创建了一个元数据的本地缓存。当你运行包管理器的更新选项(例如 `apt update`)时,它会通过引用仓库中的元数据来更新本地元数据缓存。 + +当你运行软件包管理器的安装命令(例如 `apt install package_name`)时,软件包管理器会引用这个缓存。如果它在缓存中找到了包的信息,它就会使用互联网连接到相应的仓库,并在你的系统上安装之前先下载包。 + +一个包可能有依赖关系。意思是说,它可能需要安装其他软件包。软件包管理器通常会处理这些依赖关系,并将其与你正在安装的软件包一起自动安装。 + +![Linux 中包管理器会处理依赖关系][11] + +同样,当你使用包管理器删除一个包时,它要么自动删除,要么通知你系统有未使用的包可以清理。 + +除了安装、删除这些显而易见的任务外,你还可以使用包管理器对包进行配置,并根据自己的需要进行管理。例如,你可以在常规的系统更新中[防止升级某个包的版本][12]。你的包管理器可能还能做很多事情。 + +### 不同种类的包管理器 + +包管理器因打包系统而异,但同一打包系统却可能有多个包管理器。 + +例如,RPM 有 [Yum][13] 和 [DNF][14] 包管理器。对于 DEB,你有 `apt-get`、[aptitude][15] 等基于命令行的包管理器。 + +![Synaptic 包管理器][16] + +软件包管理器不一定是基于命令行的,也有图形化的软件包管理工具,比如 [Synaptic][17]。你的发行版的“软件中心”也是一个软件包管理器,即使它在底层运行的是 `apt-get` 或 DNF。 + +### 结论 + +我不想进一步详细介绍这个话题,虽然我可以继续说下去,但这将偏离本主题的目标 —— 即让你对 Linux 中的包管理器有一个基本的了解。 + +我暂时忽略了新的通用打包格式,比如 Snap 和 Flatpak。 + +我希望你对 Linux 中的包管理系统有更好的理解。如果你还有困惑,或者你对这个主题有一些问题,请发表评论。我会尽量回答你的问题,如果需要的话,我会在本文中更新新的内容。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/package-manager/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/what-is-linux/ +[2]: https://itsfoss.com/apt-vs-apt-get-difference/ +[3]: https://itsfoss.com/pacman-command/ +[4]: https://itsfoss.com/install-software-from-source-code/ +[5]: https://www.computerhope.com/jargon/m/metadata.htm +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/source-code-comilation-vs-packaging.png?resize=800%2C450&ssl=1 +[7]: https://itsfoss.com/install-pip-ubuntu/ +[8]: https://itsfoss.com/install-packages-in-atom/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/linux-package-manager-explanation.png?resize=800%2C450&ssl=1 +[10]: https://itsfoss.com/apt-search-command/ +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/package-manager-handling-dependencies-in-linux.png?resize=800%2C450&ssl=1 +[12]: https://itsfoss.com/prevent-package-update-ubuntu/ +[13]: https://fedoraproject.org/wiki/Yum +[14]: https://fedoraproject.org/wiki/DNF +[15]: https://wiki.debian.org/Aptitude +[16]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/see-packages-by-repositories-synaptic.png?resize=799%2C548&ssl=1 +[17]: https://itsfoss.com/synaptic-package-manager/ From eb8a8ddabbdc670f4f4ed9ad6078fbc36ba60dc4 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 13 Oct 2020 08:45:22 +0800 Subject: [PATCH 0422/1156] translated --- ...ux Terminal With This Nifty Python Tool.md | 104 ------------------ ...ux Terminal With This Nifty Python Tool.md | 101 +++++++++++++++++ 2 files changed, 101 insertions(+), 104 deletions(-) delete mode 100644 sources/tech/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md create mode 100644 translated/tech/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md diff --git a/sources/tech/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md b/sources/tech/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md deleted file mode 100644 index f1a50b278b..0000000000 --- a/sources/tech/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md +++ /dev/null @@ -1,104 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Present Slides in Linux Terminal With This Nifty Python Tool) -[#]: via: (https://itsfoss.com/presentation-linux-terminal/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -Present Slides in Linux Terminal With This Nifty Python Tool -====== - -Presentations are often boring. This is why some people add animation or comics/meme to add some humor and style to break the monotony. - -If you have to add some unique style to your college or company presentation, how about using the Linux terminal? Imagine how cool it would be! - -### Present: Do Your Presentation in Linux Terminal - -There are so many amusing and [fun stuff you can do in the terminal][1]. Making and presenting slides is just one of them. - -Python based application named [Present][2] lets you create markdown and YML based slides that you can present in your college or company and amuse people in the true geek style. - -I have made a video showing what it would look like to present something in the Linux terminal with Present. - -[Subscribe to our YouTube channel for more Linux videos][3] - -#### Features of Present - -You can do the following things with Present: - - * Use markdown syntax for adding text to the slides - * Control the slides with arrow or PgUp/Down keys - * Change the foreground and background colors - * Add images to the slides - * Add code blocks - * Play a simulation of code and output with codio YML files - - - -#### Installing Present on Linux - -Present is a Python based tool and you can use PIP to install it. You should make sure to [install Pip on Ubuntu][4] with this command: - -``` -sudo apt install python3-pip -``` - -If you are using some other distributions, please check your package manager to install PIP3. - -Once you have PIP installed, you can install Present system wide in this manner: - -``` -sudo pip3 install present -``` - -You may also install it for only the current user but then you’ll also have to add ~/.local/bin to your PATH. - -#### Using Present to create and present slides in Linux terminal - -![][5] - -Since Present utilizes markdown syntax, you should be aware of it to create your own slides. Using a [markdown editor][6] will be helpful here. - -Present needs a markdown file to read and play the slides. You may [download this sample slide][7] but you need to download the embed image separately and put it inside image folder. - - * Separate slides using — in your markdown file. - * Use markdown syntax for adding text to the slides. - * Add images with this syntax: ![RC] (images/name.png). - * Change slide colors by adding syntax like <!– fg=white bg=red –>. - * Add a slide with effects using syntax like <!– effect=fireworks –>. - * Use [codio syntax][8] to add a code running simulation. - * Quit the presentation using q and control the slides with left/right arrow or PgUp/Down keys. - - - -Keep in mind that resizing the terminal window while running the presentation will mess things up and so does pressing enter key. - -**Conclusion** - -If you are familiar with Markdown and the terminal, using Present won’t be difficult for you. - -You cannot compare it to regular presentation slides made with Impress, MS Office etc but it is a cool tool to occasionally use it. If you are a computer science/networking student or work as a developer or sysadmin, your colleagues will surely find this amusing. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/presentation-linux-terminal/ - -作者:[Abhishek Prakash][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/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/funny-linux-commands/ -[2]: https://github.com/vinayak-mehta/present -[3]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 -[4]: https://itsfoss.com/install-pip-ubuntu/ -[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/presentation-in-linux-terminal.png?resize=800%2C494&ssl=1 -[6]: https://itsfoss.com/best-markdown-editors-linux/ -[7]: https://github.com/vinayak-mehta/present/blob/master/examples/sample.md -[8]: https://present.readthedocs.io/en/latest/codio.html diff --git a/translated/tech/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md b/translated/tech/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md new file mode 100644 index 0000000000..f7a528fc87 --- /dev/null +++ b/translated/tech/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md @@ -0,0 +1,101 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Present Slides in Linux Terminal With This Nifty Python Tool) +[#]: via: (https://itsfoss.com/presentation-linux-terminal/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +用这个漂亮的 Python 工具在 Linux 终端中展示幻灯片 +====== + +演示往往是枯燥的。这就是为什么有些人添加动画或漫画/meme 来增加一些幽默和风格来打破单调的原因。 + +如果你需要在你的大学或公司的演示中加入一些独特的风格,那么使用 Linux 终端怎么样?想象一下,这将是多么酷的事情啊! + +### Present:Linux 终端中进行演示 + +在终端中可以做很多[有趣好玩的事情][1]。制作和展示幻灯片只是其中之一。 + +基于 Python 的应用名为 [Present][2],它可以让你创建基于 markdown 和 YML 的幻灯片,你可以在你的大学或公司里演讲,并以真正的极客风格取悦人们。 + +我制作了一个视频,展示了在 Linux 终端中用 Present 演示一些东西的样子。 + +#### Present 的功能 + +你可以用 Present 做以下事情: + + * 使用 markdown 语法在幻灯片中添加文本。 + * 用箭头或 PgUp/Down 键控制幻灯片 + * 改变前景和背景颜色 + * 在幻灯片中添加图像 + * 增加代码块 + * 播放模拟代码,并用 codio YML 文件输出。 + + + +#### 在 Linux 上安装 Present + +Present 是一个基于 Python 的工具,你可以使用 PIP 来安装它。你应该确保用这个命令[在 Ubuntu 上安装 Pip][4]: + +``` +sudo apt install python3-pip +``` + +如果你使用的是其他发行版,请检查你的包管理器来安装 PIP3。 + +安装 PIP 后,你就可以以这种方式全局安装 Present: + +``` +sudo pip3 install present +``` + +你也可以只为当前用户安装,但你也必须将 \~/.local/bin 添加到你的 PATH。 + +#### 在 Linux 终端中使用 Present 来创建和展示幻灯片 + +![][5] + +由于 Present 使用了 markdown 语法,你应该用它来创建自己的幻灯片。在这里使用 [markdown 编辑器][6]会有帮助。 + +Present 需要一个 markdown 文件来读取和播放幻灯片。你可以[下载这个示例幻灯片][7],但你需要单独下载嵌入图像,并将它放在图像文件夹内。 + + * 在 markdown 文件中使用 — 来分隔幻灯片。 + * 使用 markdown 语法在幻灯片中添加文本。 + * 使用以下语法添加图片 ![RC] (images/name.png)。 + * 通过添加像 <!– fg=white bg=red –> 这样的语法来改变幻灯片的颜色。 + * 使用像 <!– effect=fireworks –> 这样的语法来添加带有效果的幻灯片。 + * 使用 [codio 语法][8] 添加代码运行模拟。 + * 使用 q 退出演示,并用左/右箭头或 PgUp/Down 键控制幻灯片。 + + + +请记住,在演示时调整终端窗口的大小会把东西搞乱,按回车键也是如此。 + +**总结** + +如果你熟悉 Markdown 和终端,使用 Present 对你来说并不困难。 + +你不能把它和常规的用 Impress、MS Office 等制作的幻灯片相比,但偶尔使用,它是一个很酷的工具。如果你是计算机科学/网络专业的学生,或者是开发人员或系统管理员,你的同事一定会觉得很有趣。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/presentation-linux-terminal/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/funny-linux-commands/ +[2]: https://github.com/vinayak-mehta/present +[4]: https://itsfoss.com/install-pip-ubuntu/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/presentation-in-linux-terminal.png?resize=800%2C494&ssl=1 +[6]: https://itsfoss.com/best-markdown-editors-linux/ +[7]: https://github.com/vinayak-mehta/present/blob/master/examples/sample.md +[8]: https://present.readthedocs.io/en/latest/codio.html From a27999e3a4a7dae11a2406e10f54e9dbfc074ce4 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 13 Oct 2020 08:52:10 +0800 Subject: [PATCH 0423/1156] translating --- ...ur web experience with this internet protocol alternative.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201006 Simplify your web experience with this internet protocol alternative.md b/sources/tech/20201006 Simplify your web experience with this internet protocol alternative.md index 6955aa001e..42237f4cab 100644 --- a/sources/tech/20201006 Simplify your web experience with this internet protocol alternative.md +++ b/sources/tech/20201006 Simplify your web experience with this internet protocol alternative.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 803e1229f53a55b56af3330379c6d0c91dec9650 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 13 Oct 2020 09:01:03 +0800 Subject: [PATCH 0424/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[talk]:=2020200926?= =?UTF-8?q?=20Linux=20Jargon=20Buster:=20What=20is=20FOSS=20(Free=20and=20?= =?UTF-8?q?Open=20Source=20Software)=3F=20What=20is=20Open=20Source=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md --- ...n Source Software)- What is Open Source.md | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 sources/talk/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md diff --git a/sources/talk/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md b/sources/talk/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md new file mode 100644 index 0000000000..8734ab2a69 --- /dev/null +++ b/sources/talk/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md @@ -0,0 +1,133 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux Jargon Buster: What is FOSS (Free and Open Source Software)? What is Open Source?) +[#]: via: (https://itsfoss.com/what-is-foss/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Linux Jargon Buster: What is FOSS (Free and Open Source Software)? What is Open Source? +====== + +What does FOSS in It’s FOSS mean? What is FOSS? + +I have been asked this question numerous time in the past. It was about time that I explained what is FOSS in Linux and the software world. + +The distinction is important because FOSS is a generic world and it could mean different depending on the context. Here, I am discussing the FOSS principle in software. + +### What is FOSS? + +FOSS means Free and Open Source Software. It doesn’t mean software is free of cost. It means that source code of the software is open for all and anyone is free to use, study and modify the code. This principle allows other people to contribute to the development and improvement of a software like a community. + +#### The origin of FOSS + +In the 60s and 70s, computers were hardware focused and the hardware were expensive. They were mainly used by academics in universities or researchers in labs. The limited amount of software used to come for free or with their source code and the users were allowed to modify the source code to suit their need. + +In the late 70s and early 80s, the manufacturer’s stopped distributing source code in an attempt to not let their software run on their competitor’s computers. + +This restrictive licensing led to the inconvenience and dislike of peoplewho were used to and fond of modifying software. In the mid 80s, Richard Stallman started the Free Software Movement. + +[Stallman specified four essential fundamental freedom][1] for a software to be Free and Open Source Software. + +![Free Software Freedoms][2] + +I am rephrasing them for easier understanding: + + * Any user should be able to run the software for any purpose. + * User should be free to see the source code of the software and if need be, user should be allowed to modify the code as well. + * User should be free to distribute the copies of the software to others. + * If a user modified the code, she/he should be free to distribute the modified code to others. The modified code must have the source code open. + + + +If interested, I would advise reading this article on the [history of FOSS][3]. + +### Free in Free and Open Source Software DOES NOT mean free of cost + +![][4] + +As you may have noticed, the ‘free’ in Free and Open Source Software doesn’t mean it is free of cost. It means freedom to run, modify and distribute the software. + +People often wrongly think that FOSS or Open Source software cannot have a price tag. This is not correct. + +Most Free and Open Source Software are available free of cost because of a number of reasons: + + * The source code is already available to public so some developers see no point in putting a price tag on the downloads. + * Some projects are contributed by a number of volunteers for free. So, the main developer(s) find it unethical to charge for something that has been contributed freely by so many people. + * Some projects are supported and/or developed by bigger corporate or non-profit organizations who employ developers to work on their open source projects. + * Some developers create open source projects as hobby or out of their passion for contributing to the world with their code. Things like number of downloads, contributions and words of appreciations matter more than money for them. + + + +To avoid the emphasis on ‘free’ some people use the term FLOSS. FLOSS stands for Free and Libre Open Source Software. The world libre (meaning freedom) is different than gartuit/gratis (free of cost). + +> Free as in free speech, not free as in free beer. + +### How do FOSS projects make money? + +It is a myth that open source projects don’t make money. Red Hat was the first open source company to reach the billion dollars mark. [IBM bought Red Hat for $34 billion][5]. There are many such examples. + +Many open source projects, specially the ones in the enterprise sectors, offer support and enterprise oriented features for a fee. This is main business model for Red Hat, SUSE Linux and more such projects. + +Some open source projects like Discourse, WordPress offer hosted instance of their software for a premium fee. + +Many open source projects, specially the desktop applications, rely on donations. VLC, GIMP, Inkscape and other such open source software fell in this category. There are [ways to fund open-source programs][6] but usually, you’ll find donation links on project websites. + +Making money with open source software may be difficult but it is not entirely impossible. + +### But I am not a programmer. Why should I care if a software is open source or not? + +This is a valid question. You are not a software developer, just a regular computer user. Even if the source code of the software is available, you won’t understand how the program works. + +That’s fine. You won’t understand it but someone with the necessary skill sets will and that’s what matter. + +Think of this way. Perhaps you won’t understand a complicated legal document. But if you have the freedom to look at the document and keep a copy of it, you can consult someone who can check the document for legal pitfalls. + +In other words, open source software has transparency. + +### What is the difference between FOSS and Open Source? + +![][7] + +You’ll often come across terms FOSS and open source. They are often used interchangeably. + +Are they the same thing? It is difficult to answer in yes and no. + +You see, the term ‘free’ in FOSS is confusing for many as people incorrectly assume that it as free of cost. Enterprise executives, higher ups and decision makers tend to focus on ‘free’ in Free and Open Source. Since they are business people focused on making money for their company, the term ‘free’ works as deterrence in adopting the FOSS principles. + +This is why a new organization named [Open Source Initiative][8] was created in the mid 90s. They removed the ‘Free’ from Free and Open Source Software and created their own [definition of open source][9]. and their own set of licenses. + +The term ‘open source’ got quite popular specially in the software industry. The executives are more comfortable with Open Source. The adoption of open source grew rapidly and I believe removal of ‘free’ term did play a role here. + +**Got questions?** + +This As I explained in the article [what is Linux Distribution][10], the FOSS/open source concept played a big role in the development and popularity of Linux. + +I tried to explain the concept of FOSS and open source in simpler terms in this jargon buster article. I have tried to avoid going too much in detail or technical accuracies. + +I do hope you have a better understanding of this topic now. If you have got questions or suggestions, feel free to leave a comment and continue the discussion there. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/what-is-foss/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.gnu.org/philosophy/free-sw.html +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/foss-freedoms.jpg?resize=800%2C671&ssl=1 +[3]: https://itsfoss.com/history-of-foss/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/think-free-speech-not-free-beer.jpg?resize=800%2C800&ssl=1 +[5]: https://itsfoss.com/ibm-red-hat-acquisition/ +[6]: https://itsfoss.com/open-source-funding-platforms/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/what-is-foss.png?resize=800%2C450&ssl=1 +[8]: https://opensource.org/ +[9]: https://opensource.org/osd +[10]: https://itsfoss.com/what-is-linux-distribution/ From 52266883e6b723edd87c16ec7a2d8a33358910d4 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 13 Oct 2020 09:28:44 +0800 Subject: [PATCH 0425/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020180503?= =?UTF-8?q?=20Go=20on=20very=20small=20hardware=20(Part=203)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20180503 Go on very small hardware (Part 3).md --- ...0503 Go on very small hardware (Part 3).md | 430 ++++++++++++++++++ 1 file changed, 430 insertions(+) create mode 100644 sources/tech/20180503 Go on very small hardware (Part 3).md diff --git a/sources/tech/20180503 Go on very small hardware (Part 3).md b/sources/tech/20180503 Go on very small hardware (Part 3).md new file mode 100644 index 0000000000..e2cf0ce13b --- /dev/null +++ b/sources/tech/20180503 Go on very small hardware (Part 3).md @@ -0,0 +1,430 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Go on very small hardware (Part 3)) +[#]: via: (https://ziutek.github.io/2018/05/03/go_on_very_small_hardware3.html) +[#]: author: (Michał Derkacz ) + +Go on very small hardware (Part 3) +====== +[![STM32F030F4P6][1]][2] + +Most of the examples discussed in the [first][3] and [second][4] part of this series are blinking LEDs in one or another way. It may have been interesting at first, but after a while it has become a bit boring. Let’s do something more entertaining… + +…let’s light more LEDs! + +### WS281x LEDs + +The [WS281x][5] RGB LEDs (and their clones) are very popular. You can buy them as single elements, chained into long strips or assembled into matrices, rings or other form-factors. + +![WS2812B][6] + +They can be connected in series and thanks to this fact, you can control a long LED strip with only single pin of your MCU. Unfortunately, the phisical protocol used by their internal controller doesn’t fit straight into any peripheral you can find in a MCU. You have to use bit-banging or use available peripherals in unusual way. + +Which of the available solutions is the most efficient depends on the number of LED strips controlled at the same time. If you have to drive 4 to 16 strips the most efficient way is to [use timers and DMA][7] (don’t overlook the links at the end of Martin’s article). + +If you have to control only one or two strips, use the available SPI or UART peripherals. In case of SPI you can encode only two WS281x bits in one byte sent. UART allows more dense coding thanks to clever use of the start and stop bits: 3 bits per one byte sent. + +The best explanation of how the UART protocol fits into WS281x protocol I found on [this site][8]. If you don’t know Polish, here is the [English translation][9]. + +The WS281x based LEDs are still the most popular but there are also SPI controlled LEDs on the market: [APA102][10], [SK9822][11]. Three interesting articles about them: [1][12], [2][13], [3][14]. + +### LED ring + +There are many WS2812 based rings on the marker. I have this one: + +![WS2812B][15] + +It has 24 individually addressable RGB LEDs (WS2812B) and exposes four terminals: GND, 5V, DI and DO. You can chain more rings or other WS2812 based things by connecting DI (data in) terminal to the DO (data out) terminal of the previous one. + +Let’s connect this ring to our STM32F030 board. We will use the UART based driver so the DI should be connected to the TXD pin on the UART header. The WS2812B LED requires a power supply with at least 3.5V. 24 LEDs can consume quite a lot of current, so during the programming/debuggin it’s best to connect the GND and 5V terminals on the ring directly to the GND and 5V pins available on ST-LINK programmer: + +![WS2812B][16] + +Our STM32F030F4P6 MCU and the whole STM32 F0, F3, F7, L4 families have one important thing that the F1, F4, L1 MCUs don’t have: it allows to invert the UART signals and therefore we can connect the ring directly to the UART TXD pin. If you don’t known that we need such inversion you probably didn’t read the [article][9] I mentioned above. + +So you can’t use the popular [Blue Pill][17] or the [STM32F4-DISCOVERY][18] this way. Use their SPI peripheral or an external inverter. See the [Christmas Tree Lights][19] project as an example of UART+inverter or the [WS2812 example][20] for NUCLEO-F411RE that uses SPI. + +By the way, probably the most of DISCOVERY boards have one more problem: they work with VDD = 3V instead of 3.3V. The WS281x requires at least the supply voltage * 0.7 for DI high. This is 3.5V in case of 5V supply and 3.3V in case of 4.7V you can find on the 5V pins of the DISCOVERY. As you can see, even in our case the first LED works 0.2V below spec. In case of DISCOVERY it will work 0.3V bellow spec if powered 4.7V and 0.5V bellow spec if powered 5V. + +Let’s finish this lengthy introduction and go to the code: + +``` +package main + +import ( + "delay" + "math/rand" + "rtos" + + "led" + "led/ws281x/wsuart" + + "stm32/hal/dma" + "stm32/hal/gpio" + "stm32/hal/irq" + "stm32/hal/system" + "stm32/hal/system/timer/systick" + "stm32/hal/usart" +) + +var tts *usart.Driver + +func init() { + system.SetupPLL(8, 1, 48/8) + systick.Setup(2e6) + + gpio.A.EnableClock(true) + tx := gpio.A.Pin(9) + + tx.Setup(&gpio.Config{Mode: gpio.Alt}) + tx.SetAltFunc(gpio.USART1_AF1) + + d := dma.DMA1 + d.EnableClock(true) + + tts = usart.NewDriver(usart.USART1, d.Channel(2, 0), nil, nil) + tts.Periph().EnableClock(true) + tts.Periph().SetBaudRate(3000000000 / 1390) + tts.Periph().SetConf2(usart.TxInv) + tts.Periph().Enable() + tts.EnableTx() + + rtos.IRQ(irq.USART1).Enable() + rtos.IRQ(irq.DMA1_Channel2_3).Enable() +} + +func main() { + var rnd rand.XorShift64 + rnd.Seed(1) + rgb := wsuart.GRB + strip := wsuart.Make(24) + black := rgb.Pixel(0) + for { + c := led.Color(rnd.Uint32()).Scale(127) + pixel := rgb.Pixel(c) + for i := range strip { + strip[i] = pixel + tts.Write(strip.Bytes()) + delay.Millisec(40) + } + for i := range strip { + strip[i] = black + tts.Write(strip.Bytes()) + delay.Millisec(20) + } + } +} + +func ttsISR() { + tts.ISR() +} + +func ttsDMAISR() { + tts.TxDMAISR() +} + +//c:__attribute__((section(".ISRs"))) +var ISRs = [...]func(){ + irq.USART1: ttsISR, + irq.DMA1_Channel2_3: ttsDMAISR, +} +``` + +##### The import section + +The new things in the import section compared to the previous examples are the rand/math package and led package with its led/ws281x subtree. The led package itself contains definition of Color type. The led/ws281x/wsuart defines the ColorOrder, Pixel and Strip types. + +I was wondering about using the Color or RGBA type from image/color and about defining the Strip in the way that it will implement image.Image interface but because of using a [gamma correction][21] and the big overhead of image/draw package I ended with simple: + +``` +type Color uint32 +type Strip []Pixel +``` + +with a few useful methods. However, this can change in the future. + +##### The init function + +There aren’t so much novelties in the init function. The UART baud rate was changed from 115200 to 3000000000/1390 ≈ 2158273 which corresponds to 1390 nanoseconds per WS2812 bit. The TxInv bit in CR2 register is set to invert TXD signal. + +##### The main function + +The XorShift64 pseudorandom number generator is used to generate random colors. [XORSHIFT][22] is currently the only algorithm implemented by math/rand package. You have to explicitly initialize it using its Seed method with nonzero argument. + +The rgb variable is of type wsuart.ColorOrder and is set to the GRB color order used by WS2812 (WS2811 uses RGB order). It’s then used to translate colors to pixels. + +The `wsuart.Make(24)` creates initialized strip of 24 pixels. It is equivalent of: + +``` +strip := make(wsuart.Strip, 24) +strip.Clear() +``` + +The rest of the code uses random colors to draw something similar to “Please Wait…” spinner. + +The strip slice acts as a framebuffer. The `tts.Write(strip.Bytes())` sends the content of the framebuffer to the ring. + +##### Interrupts + +The program is ened with the code that handles interrupts, the same as in the previous [UART example][23]. + +Let’s compile it and run: + +``` +$ egc +$ arm-none-eabi-size cortexm0.elf + text data bss dec hex filename + 14088 240 204 14532 38c4 cortexm0.elf +$ openocd -d0 -f interface/stlink.cfg -f target/stm32f0x.cfg -c 'init; program cortexm0.elf; reset run; exit' +``` + +I’ve skipped the openocd output. The video bellow shows how this program works: + +Sorry, your browser doesn't support embedded videos. + +### Let’s do something useful… + +At the beginning of the [first part][3] I’ve asked: “How low we can Go and still do something useful?”. Our MCU is actually a low-end device (8-bitters will probably disagree with me) but we haven’t done anything useful so far. + +So… Let’s do something useful… Let’s make a Clock! + +There are many examples of clocks built of RGB LEDs on the Internet. Let’s make our own using our little board and RGB ring. We change the previous code as described below. + +##### The import section + +Remove the math/rand package and add stm32/hal/exti. + +##### Global variables + +Add two new global variables: btn and btnev: + +``` +var ( + tts *usart.Driver + btn gpio.Pin + btnev rtos.EventFlag +) +``` + +They will be used to handle the “button” that will be used to set our clock. Our board has no button except reset, but somehow we can manage without it. + +##### The init function + +Add this code to the init function: + +``` +btn = gpio.A.Pin(4) + +btn.Setup(&gpio.Config{Mode: gpio.In, Pull: gpio.PullUp}) +ei := exti.Lines(btn.Mask()) +ei.Connect(btn.Port()) +ei.EnableFallTrig() +ei.EnableRiseTrig() +ei.EnableIRQ() + +rtos.IRQ(irq.EXTI4_15).Enable() +``` + +The PA4 pin is configured as input with the internal pull-up resistor enabled. It’s connected to the onboard LED but that doesn’t hinder anything. More important is that it’s located next to the GND pin so we can use any metal object to simulate the button and set the clock. As a bonus we have additional feedback from the onboard LED. + +We use the EXTI peripheral to track the PA4 state. It’s configured to generate an interrupt on any change. + +##### The btnWait function + +Define a new auxiliary function: + +``` +func btnWait(state int, deadline int64) bool { + for btn.Load() != state { + if !btnev.Wait(1, deadline) { + return false // timeout + } + btnev.Reset(0) + } + delay.Millisec(50) // debouncing + return true +} +``` + +It waits for the specified state on the “button” pin, but only until the deadline occurs. This is slightly improved polling code: + +``` +for btn.Load() != state { + if rtos.Nanosec() >= deadline { + // timeout + } +} +``` + +Our btnWait function, instead of busy waiting for state or deadline, uses the btnev variable of type rtos.EventFlag to sleep until something will happen. You can of course use a channel instead of rtos.EventFlag but the latter one is much cheaper. + +##### The main function + +We need completly new main function: + +``` +func main() { + rgb := wsuart.GRB + strip := wsuart.Make(24) + ds := 4 * 60 / len(strip) // Interval between LEDs (quarter-seconds). + adjust := 0 + adjspeed := ds + for { + qs := int(rtos.Nanosec() / 25e7) // Quarter-seconds since reset. + qa := qs + adjust + + qa %= 12 * 3600 * 4 // Quarter-seconds since 0:00 or 12:00. + hi := len(strip) * qa / (12 * 3600 * 4) + + qa %= 3600 * 4 // Quarter-seconds in the current hour. + mi := len(strip) * qa / (3600 * 4) + + qa %= 60 * 4 // Quarter-seconds in the current minute. + si := len(strip) * qa / (60 * 4) + + hc := led.Color(0x550000) + mc := led.Color(0x005500) + sc := led.Color(0x000055) + + // Blend the colors if the hands of the clock overlap. + if hi == mi { + hc |= mc + mc = hc + } + if mi == si { + mc |= sc + sc = mc + } + if si == hi { + sc |= hc + hc = sc + } + + // Draw the clock and write to the ring. + strip.Clear() + strip[hi] = rgb.Pixel(hc) + strip[mi] = rgb.Pixel(mc) + strip[si] = rgb.Pixel(sc) + tts.Write(strip.Bytes()) + + // Sleep until the button pressed or the second hand should be moved. + if btnWait(0, int64(qs+ds)*25e7) { + adjust += adjspeed + // Sleep until the button is released or timeout. + if !btnWait(1, rtos.Nanosec()+100e6) { + if adjspeed < 5*60*4 { + adjspeed += 2 * ds + } + continue + } + adjspeed = ds + } + } +} +``` + +We use the rtos.Nanosec function instead of time.Now to obtain the current time. This saves much of Flash but also reduces our clock to antique device that has no idea about days, months and years and worst of all it doesn’t handle daylight saving changes. + +Our ring has 24 LEDs, so the second hand can be presented with the accuracy of 2.5s. To don’t sacrifice this accuracy and get smooth operation we use quarter-second as base interval. Half-second would be enough but quarter-second is more accurate and works also well with 16 and 48 LEDs. + +The red, green and blue colors are used respectively for hour, minute and second hands. This allows us to use simple logical or operation for color blending. We have the Color.Blend method that can blend arbitrary colors but we’re low of Flash so we prefer simplest possible solution. + +We redraw the clock only when the second hand moved. The: + +``` +btnWait(0, int64(qs+ds)*25e7) +``` + +is waiting for exactly that moment or for the press of the button. + +Every press of the button adjust the clock forward. There is an acceleration when the button is held down for some time. + +##### Interrupts + +Define new interrupt handler: + +``` +func exti4_15ISR() { + pending := exti.Pending() & 0xFFF0 + pending.ClearPending() + if pending&exti.Lines(btn.Mask()) != 0 { + btnev.Signal(1) + } +} +``` + +and add `irq.EXTI4_15: exti4_15ISR,` entry to the ISRs array. + +This handler (or Interrupt Service Routine) handles EXTI4_15 IRQ. The Cortex-M0 CPU supports significantly fewer IRQs than its bigger brothers, so you can often see that one IRQ is shared by multiple interrupt sources. In our case one IRQ is shared by 12 EXTI lines. + +The exti4_15ISR reads all pending bits and selects 12 more significant of them. Next it clears the seleced bits in EXTI and starts to handle them. In our case only bit 4 is checked. The `btnev.Signal(1)` causes that the `btnev.Wait(1, deadline)` wakes up and returns true. + +You can find the complete code on [Github][24]. Let’s compile it: + +``` +$ egc +$ arm-none-eabi-size cortexm0.elf + text data bss dec hex filename + 15960 240 216 16416 4020 cortexm0.elf +``` + +There are only 184 bytes for any iprovements. Let’s rebuild everything one more time but this time without any type and field names in typeinfo: + +``` +$ cd $HOME/emgo +$ ./clean.sh +$ cd $HOME/firstemgo +$ egc -nf -nt +$ arm-none-eabi-size cortexm0.elf + text data bss dec hex filename + 15120 240 216 15576 3cd8 cortexm0.elf +``` + +Now, with a kilobyte of free space you can improve something. Let’s see how it works: + +Sorry, your browser doesn't support embedded videos. + +I don’t know how I managed to hit exactly 3:00 !? + +That’s all Folks! In the part 4 (ending this series) we’ll try to display something on a LCD. + +-------------------------------------------------------------------------------- + +via: https://ziutek.github.io/2018/05/03/go_on_very_small_hardware3.html + +作者:[-;Michał Derkacz][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://ziutek.github.io +[b]: https://github.com/lujun9972 +[1]: https://ziutek.github.io/images/mcu/f030-demo-board/board.jpg +[2]: https://ziutek.github.io/2018/05/03/go_on_very_small_hardware3.html +[3]: https://ziutek.github.io/2018/03/30/go_on_very_small_hardware.html +[4]: https://ziutek.github.io/2018/04/14/go_on_very_small_hardware2.html +[5]: http://www.world-semi.com/solution/list-4-1.html +[6]: https://ziutek.github.io/images/led/ws2812b.jpg +[7]: http://www.martinhubacek.cz/arm/improved-stm32-ws2812b-library +[8]: http://mikrokontrolery.blogspot.com/2011/03/Diody-WS2812B-sterowanie-XMega-cz-2.html +[9]: https://translate.google.pl/translate?sl=pl&tl=en&u=http://mikrokontrolery.blogspot.com/2011/03/Diody-WS2812B-sterowanie-XMega-cz-2.html +[10]: http://neon-world.com/en/product.php +[11]: http://www.normandled.com/index.php/Product/view/id/800.html +[12]: https://cpldcpu.wordpress.com/2014/08/27/apa102/ +[13]: https://cpldcpu.wordpress.com/2014/11/30/understanding-the-apa102-superled/ +[14]: https://cpldcpu.wordpress.com/2016/12/13/sk9822-a-clone-of-the-apa102/ +[15]: https://ziutek.github.io/images/led/rgbring.jpg +[16]: https://ziutek.github.io/images/led/ring-stlink-f030.jpg +[17]: https://jeelabs.org/article/1649a/ +[18]: http://www.st.com/en/evaluation-tools/stm32f4discovery.html +[19]: https://github.com/ziutek/emgo/tree/master/egpath/src/stm32/examples/minidev/treelights +[20]: https://github.com/ziutek/emgo/tree/master/egpath/src/stm32/examples/nucleo-f411re/ws2812 +[21]: https://en.wikipedia.org/wiki/Gamma_correction +[22]: https://en.wikipedia.org/wiki/Xorshift +[23]: https://ziutek.github.io/2018/04/14/go_on_very_small_hardware2.html#uart +[24]: https://github.com/ziutek/emgo/tree/master/egpath/src/stm32/examples/f030-demo-board/ws2812-clock From a3c46350f3aea81b698de3a9354fbe86360b9618 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 13 Oct 2020 09:51:09 +0800 Subject: [PATCH 0426/1156] PUB @wxy https://linux.cn/article-12713-1.html --- ...kage Manager in Linux- How Does it Work.md | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 published/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md diff --git a/published/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md b/published/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md new file mode 100644 index 0000000000..ea001d9fd9 --- /dev/null +++ b/published/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md @@ -0,0 +1,112 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12713-1.html) +[#]: subject: (Linux Jargon Buster: What is a Package Manager in Linux? How Does it Work?) +[#]: via: (https://itsfoss.com/package-manager/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Linux 黑话解释:什么是包管理器?它是如何工作的? +====== + +![](https://img.linux.net.cn/data/attachment/album/202010/13/094827peunhns3nn3qceno.jpg) + +[Linux 发行版之间有什么不同][1]的要点之一是包管理。在这篇 Linux 黑话解释中,你将了解 Linux 中的打包和包管理器。你将了解什么是包,什么是包管理器,它们是如何工作的,以及有什么包管理器。 + +### 什么是包管理器? + +简单来说,“包管理器package manager”(或“软件包管理器”)是一种工具,它允许用户在操作系统上安装、删除、升级、配置和管理软件包。软件包管理器可以是像“软件中心”这样的图形化应用,也可以是像 [apt-get][2] 或 [pacman][3] 这样的命令行工具。 + +你会发现我经常在教程和文章中使用“包”这个词。要了解包管理器,你必须了解什么是包。 + +### 什么是包? + +一个“package”(或“软件包”)通常指的是一个应用程序,它可以是一个 GUI 应用程序、命令行工具或(其他软件程序需要的)软件库。包本质上是一个存档文件,包含二进制可执行文件、配置文件,有时还包含依赖关系的信息。 + +在旧时代,[软件曾经是从它的源代码安装的][4]。你会参考一个文件(通常命名为 `README`),看看它需要什么软件组件、二进制文件的位置。它通常包括一个配置脚本或 `Makefile`。你必须自己编译该软件或自己处理所有的依赖关系(有些软件需要安装其他软件)。 + +为了摆脱这种复杂性,Linux 发行版创建了自己的打包格式,为终端用户提供随时可用的二进制文件(预编译软件),以便安装软件,同时提供一些[元数据][5](版本号、描述)和依赖关系。 + +这就像烤蛋糕与买蛋糕一样。 + +![][6] + +大约在上世纪 90 年代中期,Debian 创建了 DEB 打包格式(`.deb`),Red Hat Linux 创建了 RPM(Red Hat Package Manager 的缩写)打包系统(`.rpm`)。编译源代码的方式仍然存在,但现在是可选的。 + +要与打包系统交互或使用打包系统,你需要一个包管理器。 + +### 包管理器是如何工作的? + +请记住,包管理器是一个通用的概念,它并不是 Linux 独有的。你会经常发现各种软件或编程语言的包管理器。有[只是针对 Python 包的 PIP 包管理器][7]。甚至 [Atom 编辑器也有自己的包管理器][8]。 + +由于本文的重点是 Linux,所以我会从 Linux 的角度出发。不过,这里的大部分解释也可以应用于一般的包管理器。 + +我创建了这个图(基于 SUSE Wiki),这样你就可以很容易理解包管理器是如何工作的。 + +![][9] + +几乎所有的 Linux 发行版都有“软件仓库software repository”,它基本上是软件包的集合。是的,可以有不止一个软件库。软件库包含不同种类的软件包。 + +软件仓库也有元数据文件,其中包含了软件包的信息,如软件包的名称、版本号、软件包的描述和软件仓库名称等。这就是你在 Ubuntu/Debian 中使用 [apt show 命令][10]所看到的。 + +你的系统上的包管理器首先会与元数据进行交互。包管理器在你的系统上创建了一个元数据的本地缓存。当你运行包管理器的更新选项(例如 `apt update`)时,它会通过引用仓库中的元数据来更新本地元数据缓存。 + +当你运行软件包管理器的安装命令(例如 `apt install package_name`)时,软件包管理器会引用这个缓存。如果它在缓存中找到了包的信息,它就会使用互联网连接到相应的仓库,并在你的系统上安装之前先下载包。 + +一个包可能有依赖关系。意思是说,它可能需要安装其他软件包。软件包管理器通常会处理这些依赖关系,并将其与你正在安装的软件包一起自动安装。 + +![Linux 中包管理器会处理依赖关系][11] + +同样,当你使用包管理器删除一个包时,它要么自动删除,要么通知你系统有未使用的包可以清理。 + +除了安装、删除这些显而易见的任务外,你还可以使用包管理器对包进行配置,并根据自己的需要进行管理。例如,你可以在常规的系统更新中[防止升级某个包的版本][12]。你的包管理器可能还能做很多事情。 + +### 不同种类的包管理器 + +包管理器因打包系统而异,但同一打包系统却可能有多个包管理器。 + +例如,RPM 有 [Yum][13] 和 [DNF][14] 包管理器。对于 DEB,你有 `apt-get`、[aptitude][15] 等基于命令行的包管理器。 + +![Synaptic 包管理器][16] + +软件包管理器不一定是基于命令行的,也有图形化的软件包管理工具,比如 [Synaptic][17]。你的发行版的“软件中心”也是一个软件包管理器,即使它在底层运行的是 `apt-get` 或 DNF。 + +### 结论 + +我不想进一步详细介绍这个话题,虽然我可以继续说下去,但这将偏离本主题的目标 —— 即让你对 Linux 中的包管理器有一个基本的了解。 + +我暂时忽略了新的通用打包格式,比如 Snap 和 Flatpak。 + +我希望你对 Linux 中的包管理系统有更好的理解。如果你还有困惑,或者你对这个主题有一些问题,请发表评论。我会尽量回答你的问题,如果需要的话,我会在本文中更新新的内容。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/package-manager/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/what-is-linux/ +[2]: https://itsfoss.com/apt-vs-apt-get-difference/ +[3]: https://itsfoss.com/pacman-command/ +[4]: https://itsfoss.com/install-software-from-source-code/ +[5]: https://www.computerhope.com/jargon/m/metadata.htm +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/source-code-comilation-vs-packaging.png?resize=800%2C450&ssl=1 +[7]: https://itsfoss.com/install-pip-ubuntu/ +[8]: https://itsfoss.com/install-packages-in-atom/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/linux-package-manager-explanation.png?resize=800%2C450&ssl=1 +[10]: https://itsfoss.com/apt-search-command/ +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/package-manager-handling-dependencies-in-linux.png?resize=800%2C450&ssl=1 +[12]: https://itsfoss.com/prevent-package-update-ubuntu/ +[13]: https://fedoraproject.org/wiki/Yum +[14]: https://fedoraproject.org/wiki/DNF +[15]: https://wiki.debian.org/Aptitude +[16]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/see-packages-by-repositories-synaptic.png?resize=799%2C548&ssl=1 +[17]: https://itsfoss.com/synaptic-package-manager/ From 7b1005322cc8c5c2f8b37288fa23751e25b34039 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 13 Oct 2020 10:11:06 +0800 Subject: [PATCH 0427/1156] PUB --- ...kage Manager in Linux- How Does it Work.md | 110 ------------------ 1 file changed, 110 deletions(-) delete mode 100644 translated/tech/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md diff --git a/translated/tech/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md b/translated/tech/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md deleted file mode 100644 index 0d8b245b55..0000000000 --- a/translated/tech/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md +++ /dev/null @@ -1,110 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Linux Jargon Buster: What is a Package Manager in Linux? How Does it Work?) -[#]: via: (https://itsfoss.com/package-manager/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -Linux 黑话解释:什么是包管理器?它是如何工作的? -====== - -[Linux 发行版之间有什么不同][1]的要点之一是包管理。在这篇 Linux 黑话解释中,你将了解 Linux 中的打包和包管理器。你将了解什么是包,什么是包管理器,它们是如何工作的,以及有什么样的包管理器可用。 - -### 什么是包管理器? - -简单来说,“包管理器package manager”(或“软件包管理器”)是一种工具,它允许用户在操作系统上安装、删除、升级、配置和管理软件包。软件包管理器可以是像“软件中心”这样的图形化应用,也可以是像 [apt-get][2] 或 [pacman][3] 这样的命令行工具。 - -你会发现我经常在教程和文章中使用“包”这个词。要了解包管理器,你必须了解什么是包。 - -### 什么是包? - -一个“package”(或“软件包”)通常指的是一个应用程序,它可以是一个 GUI 应用程序、命令行工具或(其他软件程序需要的)软件库。包本质上是一个存档文件,包含二进制可执行文件、配置文件,有时还包含依赖关系的信息。 - -在旧时代,[软件曾经是从它的源代码安装的][4]。你会参考一个文件(通常命名为 `README`),看看它需要什么软件组件、二进制文件的位置。它通常包括一个配置脚本或 `Makefile`。你必须自己编译该软件或自己处理所有的依赖关系(有些软件需要安装其他软件)。 - -为了摆脱这种复杂性,Linux 发行版创建了自己的打包格式,为终端用户提供随时可用的二进制文件(预编译软件),以便安装软件,同时提供一些[元数据][5](版本号、描述)和依赖关系。 - -这就像烤蛋糕与买蛋糕一样。 - -![][6] - -大约在上世纪 90 年代中期,Debian 创建了 DEB 打包格式(`.deb`),Red Hat Linux 创建了 RPM(Red Hat Package Manager 的缩写)打包系统(`.rpm`)。编译源代码的方式仍然存在,但现在是可选的。 - -要与打包系统交互或使用打包系统,你需要一个包管理器。 - -### 包管理器是如何工作的? - -请记住,包管理器是一个通用的概念,它并不是 Linux 独有的。你会经常发现各种软件或编程语言的包管理器。有[只是针对 Python 包的 PIP 包管理器][7]。甚至 [Atom 编辑器也有自己的包管理器][8]。 - -由于本文的重点是 Linux,所以我会从 Linux 的角度出发。不过,这里的大部分解释也可以应用于一般的包管理器。 - -我创建了这个图(基于 SUSE Wiki),这样你就可以很容易理解包管理器是如何工作的。 - -![][9] - -几乎所有的 Linux 发行版都有“软件仓库software repository”,它基本上是软件包的集合。是的,可以有不止一个软件库。软件库包含不同种类的软件包。 - -软件仓库也有元数据文件,其中包含了软件包的信息,如软件包的名称、版本号、软件包的描述和软件仓库名称等。这就是你在 Ubuntu/Debian 中使用 [apt show 命令][10]所看到的。 - -你的系统上的包管理器首先会与元数据进行交互。包管理器在你的系统上创建了一个元数据的本地缓存。当你运行包管理器的更新选项(例如 `apt update`)时,它会通过引用仓库中的元数据来更新本地元数据缓存。 - -当你运行软件包管理器的安装命令(例如 `apt install package_name`)时,软件包管理器会引用这个缓存。如果它在缓存中找到了包的信息,它就会使用互联网连接到相应的仓库,并在你的系统上安装之前先下载包。 - -一个包可能有依赖关系。意思是说,它可能需要安装其他软件包。软件包管理器通常会处理这些依赖关系,并将其与你正在安装的软件包一起自动安装。 - -![Linux 中包管理器会处理依赖关系][11] - -同样,当你使用包管理器删除一个包时,它要么自动删除,要么通知你系统有未使用的包可以清理。 - -除了安装、删除这些显而易见的任务外,你还可以使用包管理器对包进行配置,并根据自己的需要进行管理。例如,你可以在常规的系统更新中[防止升级某个包的版本][12]。你的包管理器可能还能做很多事情。 - -### 不同种类的包管理器 - -包管理器因打包系统而异,但同一打包系统却可能有多个包管理器。 - -例如,RPM 有 [Yum][13] 和 [DNF][14] 包管理器。对于 DEB,你有 `apt-get`、[aptitude][15] 等基于命令行的包管理器。 - -![Synaptic 包管理器][16] - -软件包管理器不一定是基于命令行的,也有图形化的软件包管理工具,比如 [Synaptic][17]。你的发行版的“软件中心”也是一个软件包管理器,即使它在底层运行的是 `apt-get` 或 DNF。 - -### 结论 - -我不想进一步详细介绍这个话题,虽然我可以继续说下去,但这将偏离本主题的目标 —— 即让你对 Linux 中的包管理器有一个基本的了解。 - -我暂时忽略了新的通用打包格式,比如 Snap 和 Flatpak。 - -我希望你对 Linux 中的包管理系统有更好的理解。如果你还有困惑,或者你对这个主题有一些问题,请发表评论。我会尽量回答你的问题,如果需要的话,我会在本文中更新新的内容。 - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/package-manager/ - -作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/what-is-linux/ -[2]: https://itsfoss.com/apt-vs-apt-get-difference/ -[3]: https://itsfoss.com/pacman-command/ -[4]: https://itsfoss.com/install-software-from-source-code/ -[5]: https://www.computerhope.com/jargon/m/metadata.htm -[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/source-code-comilation-vs-packaging.png?resize=800%2C450&ssl=1 -[7]: https://itsfoss.com/install-pip-ubuntu/ -[8]: https://itsfoss.com/install-packages-in-atom/ -[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/linux-package-manager-explanation.png?resize=800%2C450&ssl=1 -[10]: https://itsfoss.com/apt-search-command/ -[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/package-manager-handling-dependencies-in-linux.png?resize=800%2C450&ssl=1 -[12]: https://itsfoss.com/prevent-package-update-ubuntu/ -[13]: https://fedoraproject.org/wiki/Yum -[14]: https://fedoraproject.org/wiki/DNF -[15]: https://wiki.debian.org/Aptitude -[16]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/see-packages-by-repositories-synaptic.png?resize=799%2C548&ssl=1 -[17]: https://itsfoss.com/synaptic-package-manager/ From 2025f8f0c5001c5e70153c67d6fdd2e6da16c714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Tue, 13 Oct 2020 16:58:42 +0800 Subject: [PATCH 0428/1156] Translated --- ... Improvements and Tons of Other Changes.md | 119 ------------------ ... Improvements and Tons of Other Changes.md | 119 ++++++++++++++++++ 2 files changed, 119 insertions(+), 119 deletions(-) delete mode 100644 sources/tech/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md create mode 100644 translated/tech/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md diff --git a/sources/tech/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md b/sources/tech/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md deleted file mode 100644 index a0b0100c13..0000000000 --- a/sources/tech/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md +++ /dev/null @@ -1,119 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (tanslating) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes) -[#]: via: (https://itsfoss.com/gnome-3-38-release/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes -====== - -[GNOME 3.36][1] brought some much-needed improvements along with a major performance boost. Now, after 6 months, we’re finally here with GNOME 3.38 with a big set of changes. - -### GNOME 3.38 Key Features - -Here are the main highlight of GNOME 3.38 codenamed Orbis: - -[Subscribe to our YouTube channel for more Linux videos][2] - -#### Customizable App Menu - -The app grid or the app menu will now be customizable as part of a big change in GNOME 3.38. - -Now, you can create folders by dragging application icons over each other and move them to/from folders and set it right back in the app grid. You can also just reposition the icons as you want in the app grid. - -![][3] - -Also, these changes are some basic building blocks for upcoming design changes planned for future updates — so it’ll be exciting to see what we can expect. - -#### Calendar Menu Updates - -![][4] - -The notification area is a lot cleaner with the recent GNOME updates but now with GNOME 3.38, you can finally access calendar events right below the calendar area to make things convenient and easy to access. - -It’s not a major visual overhaul, but there’s a few improvements to it. - -#### Parental Controls Improvement - -You will observe a parental control service as a part of GNOME 3.38. It supports integration with various components of the desktop, the shell, the settings, and others to help you limit what a user can access. - -#### The Restart Button - -Some subtle improvements lead to massive changes and this is exactly one of those changes. It’s always annoying to click on the “Power Off” / “Shut down” button first and then hit the “Restart” button to reboot the system. - -So, with GNOME 3.38, you will finally notice a “Restart” entry as a separate button which will save you click and give you a peace of mind. - -#### Screen Recording Improvements - -[GNOME shell’s built-in screen record][5] is now a separate system service which should potentially make recording the screen a smooth experience. - -Also, window screencasting had several improvements to it along with some bug fixes: - -#### GNOME apps Updates - -The GNOME calculator has received a lot of bug fixes. In addition to that, you will also find some major changes to the [epiphany GNOME browser][6]. - -GNOME Boxes now lets you pick the OS from a list of operating systems and GNOME Maps was updated with some UI changes as well. - -Not just limited to these, you will also find subtle updates and fixes to GNOME control center, Contacts, Photos, Nautilus, and some other packages. - -#### Performance & multi-monitor support improvements - -There’s a bunch of under-the-hood improvements to improve GNOME 3.38 across the board. For instance, there were some serious fixes to [Mutter][7] which now lets two monitors run at different refresh rates. - -![][8] - -Previously, if you had one monitor with a 60 Hz refresh rate and another with 144 Hz, the one with the slower rate will limit the second monitor. But, with the improvements in GNOME 3.38, it will handle multi-monitors without limiting any of them. - -Also, some changes reported by [Phoronix][9] pointed out around 10% lower render time in some cases. So, that’s definitely a great performance optimization. - -#### Miscellaneous other changes - - * Battery percentage indicator - * Restart option in the power menu - * New welcome tour - * Fingerprint login - * QR code scanning for sharing Wi-Fi hotspot - * Privacy and other improvements to GNOME Browser - * GNOME Maps is now responsive and changes its size based on the screen - * Revised icons - - - -You can find a details list of changes in their official [changelog][10]. - -### Wrapping Up - -GNOME 3.38 is indeed an impressive update to improve the GNOME experience. Even though the performance was greatly improved with GNOME 3.36, more optimizations is a very good thing for GNOME 3.38. - -GNOME 3.38 will be available in Ubuntu 20.10 and [Fedora 33][11]. Arch and Manjaro users should be getting it soon. - -I think there are plenty of changes in right direction. What do you think? - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/gnome-3-38-release/ - -作者:[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/gnome-3-36-release/ -[2]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 -[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/gnome-app-arranger.jpg?resize=799%2C450&ssl=1 -[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/gnome-3-38-calendar-menu.png?resize=800%2C721&ssl=1 -[5]: https://itsfoss.com/gnome-screen-recorder/ -[6]: https://en.wikipedia.org/wiki/GNOME_Web -[7]: https://en.wikipedia.org/wiki/Mutter_(software) -[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/gnome-multi-monitor-refresh-rate.jpg?resize=800%2C369&ssl=1 -[9]: https://www.phoronix.com/scan.php?page=news_item&px=GNOME-3.38-Last-Min-Mutter -[10]: https://help.gnome.org/misc/release-notes/3.38 -[11]: https://itsfoss.com/fedora-33/ diff --git a/translated/tech/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md b/translated/tech/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md new file mode 100644 index 0000000000..c708b84ed0 --- /dev/null +++ b/translated/tech/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md @@ -0,0 +1,119 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes) +[#]: via: (https://itsfoss.com/gnome-3-38-release/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +GNOME 3.38 携可定制应用程序网格,性能改善和大量其它的更改而来 +====== + +[GNOME 3.36][1] 带来大量急需改善,同时也带来性能的重大提升。现在,在6个月后,我们终于和具有一系列的更改的 GNOME 3.38 一起到来。 + +### GNOME 3.38 主要特色 + +这里是 GNOME 3.38 (代码名称:Orbis) 的主要亮点: + +[更多 Linux 视频,请订阅我们的 YouTube 频道][2] + +#### 可定制应用程序菜单 + +作为 GNOME 3.38 重大更改中的一部分,应用程序网格或应用程序菜单现在是可以可定制的。 + +现在,你可以通过拖拽每个应用程序图标来创建文件夹,将它们移到/移出文件夹,并且可以在应用程序网格中重新设置回来。你也可以在应用程序网格中如你所想一样的重新定位图标。 + +![][3] + +此外,这些变化是一些即将到来的未来设计更改更新的基本组成部分 — 因此,看到我们可以期待的东西会很令人兴奋。 + +#### 日历菜单更新 + +![][4] + +随着最近一次的 GNOME 更新,通知区整洁了很多,但是现在随着 GNOME 3.38 的到来,你终于可以通过访问日历区正下方的日历事件来更方便地处理事情。 + +它不是一个主要的可见改造,但是它也有不少的改善。 + +#### 家长控制改善 + +你将会注意作为 GNOME 3.38 一部分的家长控制服务。它支持与桌面,shell,设置以及其它各种各样组件的集成来帮助你限制用户可以访问的内容。 + +#### 重新启动按钮 + +一些细微的改善导致了巨大的变化,重新启动按钮正是其中的一个变化。先单击 “关闭电源” / “关机” 按钮,再单击 “重新启动” 按钮的操作来重新启动系统总是让人很烦闷。 + +因此,随着 GNOME 3.38 的到来,你将最终会注意到一个作为单独按钮的 “重新启动” ,这将节省你的单击次数,平复你烦闷的心情。 + +#### 屏幕录制改善 + +[GNOME shell 的内置屏幕录制][5] 现在是一项独立的系统服务,这可能会使录制屏幕成为一种平滑流畅的体验。 + +另外,窗口截屏也有一些改善,并修复了一些错误。 + +#### GNOME 应用程序更新 + +GNOME 计算器也收到很多的错误修复。除此之外,你也将发现 [epiphany GNOME 浏览器][6] 的一些重大改变. + +GNOME Boxes 现在允许你从一个操作系统列表中选择将要运行的操作系统,GNOME 地图也有一些图像用户界面上的更改。 + +当然,不仅限于这些,你页将注意到 GNOME 控制中心,联系人,照片,Nautilus,以及其它一些软件包的细微更新和修复。 + +#### 性能和多显示器支持改善 + +这里有一大堆隐藏改善来全面地改善 GNOME 3.38 。 例如,[Mutter][7] 有一些重要的修复,它现在允许在两个显示器中使用不同的刷新频率。 + +![][8] + +先前,如果一台显示器的刷新频率为 60 Hz,而另一台的刷新频率为 144 Hz ,那么刷新频率较慢的显示器将限制另外一台显示器的刷新频率。但是,随着在 GNOME 3.38 中的改善,它将能够处理多个显示器,而不会使显示器相互限制。 + +另外,[Phoronix][9] 报告的一些更改指出,在一些情况下,缩短大约 10% 的渲染时间。因此,巨大的性能优化是很确定的。 + +#### 各种各样的其它更改 + + * 电池百分比指示器 + * 在电源菜单中的重新启动选项 + * 新的欢迎参观N + * 指纹登录 + * 二维码扫描共享 Wi-Fi 热点 + * GNOME 浏览器的隐私和其它改善 + * GNOME 地图现在反应敏捷并能根据屏幕大小改变其大小 + * 重新修订的图标 + + + +你可以在它们的官方 [更改日志][10] 中找到一个详细的更改列表。 + +### 总结 + +GNOME 3.38 确实是一个令人赞叹的改善 GNOME 用户体验的更新。尽管 GNOME 3.36 带来了性能的很大改善, 但是针对 GNOME 3.38 的更多优化仍然是一件非常好的事. + +GNOME 3.38 将在 Ubuntu 20.10 和 [Fedora 33][11] 中可用。Arch 和 Manjaro 用户应该很快就能获得。 + +我认为在正确的方向上有大量的更改。你觉得呢? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gnome-3-38-release/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[校对者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/gnome-3-36-release/ +[2]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/gnome-app-arranger.jpg?resize=799%2C450&ssl=1 +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/gnome-3-38-calendar-menu.png?resize=800%2C721&ssl=1 +[5]: https://itsfoss.com/gnome-screen-recorder/ +[6]: https://en.wikipedia.org/wiki/GNOME_Web +[7]: https://en.wikipedia.org/wiki/Mutter_(software) +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/gnome-multi-monitor-refresh-rate.jpg?resize=800%2C369&ssl=1 +[9]: https://www.phoronix.com/scan.php?page=news_item&px=GNOME-3.38-Last-Min-Mutter +[10]: https://help.gnome.org/misc/release-notes/3.38 +[11]: https://itsfoss.com/fedora-33/ From d72ff08d7d95705784e74572924bc49fdcbe9cd9 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 13 Oct 2020 18:22:24 +0800 Subject: [PATCH 0429/1156] PRF @HankChow --- ...200629 Using Bash traps in your scripts.md | 45 +++++++++---------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/translated/tech/20200629 Using Bash traps in your scripts.md b/translated/tech/20200629 Using Bash traps in your scripts.md index eb41ff7d1a..0096b28270 100644 --- a/translated/tech/20200629 Using Bash traps in your scripts.md +++ b/translated/tech/20200629 Using Bash traps in your scripts.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Using Bash traps in your scripts) @@ -9,9 +9,10 @@ 在脚本中使用 Bash 信号捕获 ====== + > 无论你的脚本是否成功运行,信号捕获trap都能让它平稳结束。 -![Hands programming][1] +![](https://img.linux.net.cn/data/attachment/album/202010/13/182135f2nktcrnryncisg8.jpg) Shell 脚本的启动并不难被检测到,但 Shell 脚本的终止检测却并不容易,因为我们无法确定脚本会按照预期地正常结束,还是由于意外的错误导致失败。当脚本执行失败时,将正在处理的内容记录下来是非常有用的做法,但有时候这样做起来并不方便。而 [Bash][2] 中 `trap` 命令的存在正是为了解决这个问题,它可以捕获到脚本的终止信号,并以某种预设的方式作出应对。 @@ -19,22 +20,21 @@ Shell 脚本的启动并不难被检测到,但 Shell 脚本的终止检测却 如果出现了一个错误,可能导致发生一连串错误。下面示例脚本中,首先在 `/tmp` 中创建一个临时目录,这样可以在临时目录中执行解包、文件处理等操作,然后再以另一种压缩格式进行打包: - ``` #!/usr/bin/env bash CWD=`pwd` TMP=${TMP:-/tmp/tmpdir} ## create tmp dir -mkdir $TMP +mkdir "${TMP}" ## extract files to tmp -tar xf "${1}" --directory $TMP +tar xf "${1}" --directory "${TMP}" ## move to tmpdir and run commands -pushd $TMP +pushd "${TMP}" for IMG in *.jpg; do -  mogrify -verbose -flip -flop $IMG + mogrify -verbose -flip -flop "${IMG}" done tar --create --file "${1%.*}".tar *.jpg @@ -42,22 +42,21 @@ tar --create --file "${1%.*}".tar *.jpg popd ## bundle with bzip2 -bzip2 --compress $TMP/"${1%.*}".tar \ -      --stdout > "${1%.*}".tbz +bzip2 --compress "${TMP}"/"${1%.*}".tar \ + --stdout > "${1%.*}".tbz ## clean up /usr/bin/rm -r /tmp/tmpdir ``` -一般情况下,这个脚本都可以按照预期执行。但如果归档文件中的文件是 PNG 文件而不是期望的 JPEG 文件,脚本就会在中途失败,这时候另一个问题就出现了:最后一步删除临时目录的操作没有被正常执行。如果你手动把临时目录删掉,倒是不会造成什么影响,但是如果没有手动把临时目录删掉,在下一次执行这个脚本的时候,就会在一个残留着很多临时文件的临时目录里执行了。 +一般情况下,这个脚本都可以按照预期执行。但如果归档文件中的文件是 PNG 文件而不是期望的 JPEG 文件,脚本就会在中途失败,这时候另一个问题就出现了:最后一步删除临时目录的操作没有被正常执行。如果你手动把临时目录删掉,倒是不会造成什么影响,但是如果没有手动把临时目录删掉,在下一次执行这个脚本的时候,它必须处理一个现有的临时目录,里面充满了不可预知的剩余文件。 其中一个解决方案是在脚本开头增加一个预防性删除逻辑用来处理这种情况。但这种做法显得有些暴力,而我们更应该从结构上解决这个问题。使用 `trap` 是一个优雅的方法。 -### 使用 `trap` 捕获信号 +### 使用 trap 捕获信号 我们可以通过 `trap` 捕捉程序运行时的信号。如果你使用过 `kill` 或者 `killall` 命令,那你就已经使用过名为 `SIGTERM` 的信号了。除此以外,还可以执行 `trap -l` 或 `trap --list` 命令列出其它更多的信号: - ``` $ trap --list  1) SIGHUP       2) SIGINT       3) SIGQUIT      4) SIGILL       5) SIGTRAP @@ -85,40 +84,38 @@ $ trap --list 例如,下面的这行语句可以捕获到在进程运行时用户按下 `Ctrl + C` 组合键发出的 `SIGINT` 信号: - ``` -`trap "{ echo 'Terminated with Ctrl+C'; }" SIGINT` +trap "{ echo 'Terminated with Ctrl+C'; }" SIGINT ``` 因此,上文中脚本的缺陷可以通过使用 `trap` 捕获 `SIGINT`、`SIGTERM`、进程错误退出、进程正常退出等信号,并正确处理临时目录的方式来修复: - ``` #!/usr/bin/env bash CWD=`pwd` TMP=${TMP:-/tmp/tmpdir} trap \ - "{ /usr/bin/rm -r $TMP ; exit 255; }" \ - SIGINT SIGTERM ERR EXIT + "{ /usr/bin/rm -r "${TMP}" ; exit 255; }" \ + SIGINT SIGTERM ERR EXIT ## create tmp dir -mkdir $TMP -tar xf "${1}" --directory $TMP +mkdir "${TMP}" +tar xf "${1}" --directory "${TMP}" ## move to tmp and run commands -pushd $TMP +pushd "${TMP}" for IMG in *.jpg; do -  mogrify -verbose -flip -flop $IMG + mogrify -verbose -flip -flop "${IMG}" done -tar --create --file "${1%.*}".tar *.jpgh +tar --create --file "${1%.*}".tar *.jpg ## move back to origin popd ## zip tar bzip2 --compress $TMP/"${1%.*}".tar \ -      --stdout > "${1%.*}".tbz + --stdout > "${1%.*}".tbz ``` 对于更复杂的功能,还可以用 [Bash 函数][3]来简化 `trap` 语句。 @@ -134,7 +131,7 @@ via: https://opensource.com/article/20/6/bash-trap 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[HankChow](https://github.com/HankChow) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ed757a890c88de2618ea80ce18e25fdccef403dc Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 13 Oct 2020 18:23:08 +0800 Subject: [PATCH 0430/1156] PUB @HankChow https://linux.cn/article-12715-1.html --- .../20200629 Using Bash traps in your scripts.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200629 Using Bash traps in your scripts.md (98%) diff --git a/translated/tech/20200629 Using Bash traps in your scripts.md b/published/20200629 Using Bash traps in your scripts.md similarity index 98% rename from translated/tech/20200629 Using Bash traps in your scripts.md rename to published/20200629 Using Bash traps in your scripts.md index 0096b28270..361a1aba6b 100644 --- a/translated/tech/20200629 Using Bash traps in your scripts.md +++ b/published/20200629 Using Bash traps in your scripts.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12715-1.html) [#]: subject: (Using Bash traps in your scripts) [#]: via: (https://opensource.com/article/20/6/bash-trap) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From 24aeb45a2e3f4dde68df17f91f2a82bdbd0f8a1a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 14 Oct 2020 05:02:07 +0800 Subject: [PATCH 0431/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201014?= =?UTF-8?q?=20KDE=20Plasma=205.20=20is=20Here=20With=20Exciting=20Improvem?= =?UTF-8?q?ents?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201014 KDE Plasma 5.20 is Here With Exciting Improvements.md --- ...5.20 is Here With Exciting Improvements.md | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 sources/tech/20201014 KDE Plasma 5.20 is Here With Exciting Improvements.md diff --git a/sources/tech/20201014 KDE Plasma 5.20 is Here With Exciting Improvements.md b/sources/tech/20201014 KDE Plasma 5.20 is Here With Exciting Improvements.md new file mode 100644 index 0000000000..2572d75bba --- /dev/null +++ b/sources/tech/20201014 KDE Plasma 5.20 is Here With Exciting Improvements.md @@ -0,0 +1,122 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (KDE Plasma 5.20 is Here With Exciting Improvements) +[#]: via: (https://itsfoss.com/kde-plasma-5-20/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +KDE Plasma 5.20 is Here With Exciting Improvements +====== + +KDE Plasma 5.20 is finally here and there’s a lot of things to be excited about, including the new wallpaper ‘**Shell’** by Lucas Andrade. + +It is worth noting that is not an LTS release unlike [KDE Plasma 5.18][1] and will be maintained for the next 4 months or so. So, if you want the latest and greatest, you can surely go ahead and give it a try. + +In this article, I shall mention the key highlights of KDE Plasma 5.20 from [my experience with it on KDE Neon][2] (Testing Edition). + +![][3] + +### Plasma 5.20 Features + +If you like to see things in action, we made a feature overview video for you. + +[Subscribe to our YouTube channel for more Linux videos][4] + +#### Icon-only Taskbar + +![][5] + +You must be already comfortable with a taskbar that mentions the title of the window along the icon. However, that takes a lot of space in the taskbar, which looks bad when you want to have a clean look with multiple applications/windows opened. + +Not just limited to that, if you launch several windows of the same application, it will group them together and let you cycle through it from a single icon on the task bar. + +So, with this update, you get an icon-only taskbar by default which makes it look a lot cleaner and you can have more things in the taskbar at a glance. + +#### Digital Clock Applet with Date + +![][6] + +If you’ve used any KDE-powered distro, you must have noticed that the digital clock applet (in the bottom-right corner) displays the time but not the date by default. + +It’s always a good choice to have the date and time as well (at least I prefer that). So, with KDE Plasma 5.20, the applet will have both time and date. + +#### Get Notified When your System almost Runs out of Space + +I know this is not a big addition, but a necessary one. No matter whether your home directory is on a different partition, you will be notified when you’re about to run out of space. + +#### Set the Charge Limit Below 100% + +You are in for a treat if you are a laptop user. To help you preserve the battery health, you can now set a charge limit below 100%. I couldn’t show it to you because I use a desktop. + +#### Workspace Improvements + +Working with the workspaces on KDE desktop was already an impressive experience, now with the latest update, several tweaks have been made to take the user experience up a notch. + +To start with, the system tray has been overhauled with a grid-like layout replacing the list view. + +The default shortcut has been re-assigned with Meta+drag instead of Alt+drag to move/re-size windows to avoid conflicts with some other productivity apps with Alt+drag keybind support. You can also use the key binds like Meta + up/left/down arrow to corner-tile windows. + +![][7] + +It is also easier to list all the disks using the old “**Device Notifier**” applet, which has been renamed to “**Disks & Devices**“. + +If that wasn’t enough, you will also find improvements to [KRunner][8], which is the essential application launcher or search utility for users. It will now remember the search text history and you can also have it centered on the screen instead of having it on top of the screen. + +#### System Settings Improvements + +The look and feel of the system setting is the same but it is more useful now. You will notice a new “**Highlight changed settings**” option which will show you the recent/modified changes when compared to the default values. + +So, in that way, you can monitor any changes that you did accidentally or if someone else did it. + +![][9] + +In addition to that, you also get to utilize S.M.A.R.T monitoring and disk failure notifications. + +#### Wayland Support Improvements + +If you prefer to use a Wayland session, you will be happy to know that it now supports [Klipper][10] and you can also middle-click to paste (on KDE apps only for the time being). + +The much-needed screencasting support has also been added. + +#### Other Improvements + +Of course, you will notice some subtle visual improvements or adjustments for the look and feel. You may notice a smooth transition effect when changing the brightness. Similarly, when changing the brightness or volume, the on-screen display that pops up is now less obtrusive + +Options like controlling the scroll speed of mouse/touchpad have been added to give you finer controls. + +You can find the detailed list of changes in its [official changelog][11], if you’re curious. + +### Wrapping Up + +The changes are definitely impressive and should make the KDE experience better than ever before. + +If you’re running KDE Neon, you should get the update soon. But, if you are on Kubuntu, you will have to try the 20.10 ISO to get your hands on Plasma 5.20. + +What do you like the most among the list of changes? Have you tried it yet? Let me know your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/kde-plasma-5-20/ + +作者:[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/kde-plasma-5-18-release/ +[2]: https://itsfoss.com/kde-neon-review/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/kde-plasma-5-20-feat.png?resize=800%2C394&ssl=1 +[4]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/kde-plasma-5-20-taskbar.jpg?resize=472%2C290&ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/kde-plasma-5-20-clock.jpg?resize=372%2C224&ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/kde-plasma-5-20-notify.jpg?resize=800%2C692&ssl=1 +[8]: https://docs.kde.org/trunk5/en/kde-workspace/plasma-desktop/krunner.html +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/plasma-disks-smart.png?resize=800%2C539&ssl=1 +[10]: https://userbase.kde.org/Klipper +[11]: https://kde.org/announcements/plasma-5.20.0 From 25860ec0d0cd2422073cfad4402a16956a159be9 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 14 Oct 2020 05:02:19 +0800 Subject: [PATCH 0432/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201014?= =?UTF-8?q?=20LibreOffice=20Wants=20Apache=20to=20Drop=20the=20Ailing=20Op?= =?UTF-8?q?enOffice=20and=20Support=20LibreOffice=20Instead?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md --- ...nOffice and Support LibreOffice Instead.md | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 sources/tech/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md diff --git a/sources/tech/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md b/sources/tech/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md new file mode 100644 index 0000000000..7f1b94ebf3 --- /dev/null +++ b/sources/tech/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md @@ -0,0 +1,81 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead) +[#]: via: (https://itsfoss.com/libreoffice-letter-openoffice/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead +====== + +It is a no-brainer that Apache OpenOffice is still a relevant recommendation when we think about [open source alternatives to Microsoft Office][1] for Linux users. However, for the past several years, the development of OpenOffice is pretty much stale. + +Of course, it is not a shocker, considering Abhishek wrote about the [possibility of Apache OpenOffice shutting down][2] back in 2016. + +Now, in an [open letter from The Document Foundation][3], they appeal Apache OpenOffice to recommend users to start using better alternatives like LibreOffice. In this article, I shall mention some highlights from the blog post by The Document Foundation and what it means to Apache OpenOffice. + +![][4] + +### Apache OpenOffice is History, LibreOffice is the Future? + +Even though I didn’t use OpenOffice back in the day, it is safe to say that it is definitely not a modern open-source alternative to Microsoft Office. Not anymore, at least. + +Yes, Apache OpenOffice is still something important for legacy users and was a great alternative a few years back. + +Here’s the timeline of major releases for OpenOffice and LibreOffice: + +![][5] + +Now that there’s no significant development taking place for OpenOffice, what’s the future of Apache OpenOffice? A fairly active project with no major releases by the largest open source foundation? + +It does not sound promising and that is exactly what The Document Foundation highlights in their open letter: + +> OpenOffice(.org) – the “father project” of LibreOffice – was a great office suite, and changed the world. It has a fascinating history, but **since 2014, Apache OpenOffice (its current home) hasn’t had a single major release**. That’s right – no significant new features or major updates have arrived in over six years. Very few minor releases have been made, and there have been issues with timely security updates too. + +For an average user, if they don’t know about [LibreOffice][6], I would definitely want them to know. But, should the Apache Foundation suggest OpenOffice users to try LibreOffice to experience a better or advanced office suite? + +I don’t know, maybe yes, or no? + +> …many users don’t know that LibreOffice exists. The OpenOffice brand is still so strong, even though the software hasn’t had a significant release for over six years, and is barely being developed or supported + +As mentioned in the open letter, The Document Foundation highlights the advantages/improvements of LibreOffice over OpenOffice and appeals to Apache OpenOffice that they start recommending their users to try something better (i.e. LibreOffice): + +> We appeal to Apache OpenOffice to do the right thing. Our goal should be to **get powerful, up-to-date and well-maintained productivity tools into the hands of as many people as possible**. Let’s work together on that! + +### What Should Apache OpenOffice Do? + +If OpenOffice does the work, users may not need the effort to look for alternatives. So, is it a good idea to call out another project about their slow development and suggest them to embrace the future tools and recommend them instead? + +In an argument, one might say it is only fair to promote your competition if you’re done and have no interest in improving OpenOffice. And, there’s nothing wrong in that, the open-source community should always work together to ensure that new users get the best options available. + +On another side, one might say that The Document Foundation is frustrated about OpenOffice still being something relevant in 2020, even without any significant improvements. + +I won’t judge, but I think these conflicting thoughts come to my mind when I take a look at the open letter. + +### Do you think it is time to put OpenOffice to rest and rely on LibreOffice? + +Even though LibreOffice seems to be a superior choice and definitely deserves the limelight, what do you think should be done? Should Apache discontinue OpenOffice and redirect users to LibreOffice? + +Your opinion is welcome. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/libreoffice-letter-openoffice/ + +作者:[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/best-free-open-source-alternatives-microsoft-office/ +[2]: https://itsfoss.com/openoffice-shutdown/ +[3]: https://blog.documentfoundation.org/blog/2020/10/12/open-letter-to-apache-openoffice/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/libre-office-open-office.png?resize=800%2C450&ssl=1 +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/libre-office-open-office-derivatives.jpg?resize=800%2C166&ssl=1 +[6]: https://itsfoss.com/libreoffice-tips/ From 419a099cba83ec729036e9ce37551995add13909 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 14 Oct 2020 05:02:32 +0800 Subject: [PATCH 0433/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201014?= =?UTF-8?q?=202=20Ways=20to=20Download=20Files=20From=20Linux=20Terminal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201014 2 Ways to Download Files From Linux Terminal.md --- ...s to Download Files From Linux Terminal.md | 192 ++++++++++++++++++ 1 file changed, 192 insertions(+) create mode 100644 sources/tech/20201014 2 Ways to Download Files From Linux Terminal.md diff --git a/sources/tech/20201014 2 Ways to Download Files From Linux Terminal.md b/sources/tech/20201014 2 Ways to Download Files From Linux Terminal.md new file mode 100644 index 0000000000..f1ba956e9a --- /dev/null +++ b/sources/tech/20201014 2 Ways to Download Files From Linux Terminal.md @@ -0,0 +1,192 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (2 Ways to Download Files From Linux Terminal) +[#]: via: (https://itsfoss.com/download-files-from-linux-terminal/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +2 Ways to Download Files From Linux Terminal +====== + +If you are stuck to the Linux terminal, say on a server, how do you download a file from the terminal? + +There is no download command in Linux but there are a couple of Linux commands for downloading file. + +In this terminal trick, you’ll learn two ways to download file using command line in Linux. + +I am using Ubuntu here but apart from the installation, rest of the commands are equally valid for all other Linux distributions. + +### Download files from Linux terminal using wget command + +![][1] + +[wget][2] is perhaps the most used command line download manager for Linux and UNIX-like systems. You can download a single file, multiple files, entire directory or even an entire website using wget. + +wget is non-interactive and can easily work in the background. This means you can easily use it in scripts or even build tools like [uGet download manager][3]. + +Let’s see how to use wget to download file from terminal. + +#### Installing wget + +Most Linux distributions come with wget preinstalled. It is also available in the repository of most distributions and you can easily install it using your distribution’s package manager. + +On Ubuntu and Debian based distribution, you can use the [apt package manager][4] command: + +``` +sudo apt install wget +``` + +#### Download a file or webpage using wget + +You just need to provide the URL of the file or webpage. It will download the file with its original name in the directory you are in. + +``` +wget URL +``` + +![][5] + +To download multiple files, you’ll have to save their URLs in a text file and provide that text file as input to wget like this: + +``` +wget -i download_files.txt +``` + +#### Download files with a different name using wget + +You’ll notice that a webpage is almost always saved as index.html with wget. It will be a good idea to provide custom name to downloaded file. + +You can use the -O (uppercase O) option to provide the output filename while downloading. + +``` +wget -O filename URL +``` + +![][6] + +#### Download a folder using wget + +Suppose you are browsing an FTP server and you need to download an entire directory, you can use the recursive option + +``` +wget -r ftp://server-address.com/directory +``` + +#### Download an entire website using wget + +Yes, you can totally do that. You can mirror an entire website with wget. By downloading an entire website I mean the entire public facing website structure. + +While you can use the mirror option -m directly, it will be a good idea add: + + * –convert-links : links are converted so that internal links are pointed to downloaded resource instead of web + * –page-requisites: downloads additional things like style sheets so that the pages look better offline + + + +``` +wget -m --convert-links --page-requisites website_address +``` + +![][7] + +#### Bonus Tip: Resume incomplete downloads + +If you aborted the download by pressing C for some reasons, you can resume the previous download with option -c. + +``` +wget -c +``` + +### Download files from Linux command line using curl + +Like wget, [curl][8] is also one of the most popular commands to download files in Linux terminal. There are so many ways to [use curl extensively][9] but I’ll focus on only the simple downloading here. + +#### Installing curl + +Though curl doesn’t come preinstalled, it is available in the official repositories of most distributions. You can use your distribution’s package manager to install it. + +To [install curl on Ubuntu][10] and other Debian based distributions, use the following command: + +``` +sudo apt install curl +``` + +#### Download files or webpage using curl + +If you use curl without any option with a URL, it will read the file and print it on the terminal screen. + +To download a file using curl command in Linux terminal, you’ll have to use the -O (uppercase O) option: + +``` +curl -O URL +``` + +![][11] + +It is simpler to download multiple files in Linux with curl. You just have to specify multiple URLs: + +``` +curl -O URL1 URL2 URL3 +``` + +Keep in mind that curl is not as simple as wget. While wget saves webpages as index.html, curl will complain of remote file not having a name for webpages. You’ll have to save it with a custom name as described in the next section. + +#### Download files with a different name + +It could be confusing but to provide a custom name for the downloaded file (instead of the original source name), you’ll have to use -o (lowercase O) option: + +``` +curl -o filename URL +``` + +![][12] + +Some times, curl wouldn’t just download the file as you expect it to. You’ll have to use option -L (for location) to download it correctly. This is because some times the links redirect to some other link and with option -L, it follows the final link. + +#### Pause and resume download with curl + +Like wget, you can also resume a paused download using curl with option -c: + +``` +curl -c URL +``` + +**Conclusion** + +As always, there are multiple ways to do the same thing in Linux. Downloading files from the terminal is no different. + +wget and curl are just two of the most popular commands for downloading files in Linux. There are more such command line tools. Terminal based web-browsers like [elinks][13], [w3m][14] etc can also be used for downloading files in command line. + +Personally, for a simple download, I prefer using wget over curl. It is simpler and less confusing because you may have a difficult time figuring out why curl could not download a file in the expected format. + +Your feedback and suggestions are welcome. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/download-files-from-linux-terminal/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/Download-Files-from-Linux-terminal.png?resize=800%2C450&ssl=1 +[2]: https://www.gnu.org/software/wget/ +[3]: https://itsfoss.com/install-latest-uget-ubuntu-linux-mint/ +[4]: https://itsfoss.com/apt-command-guide/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/download-file-in-linux-terminal-using-wget.png?resize=795%2C418&ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/download-file-in-linux-terminal-using-wget-2.png?resize=795%2C418&ssl=1 +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/download-entire-website-using-wget.png?resize=795%2C418&ssl=1 +[8]: https://curl.haxx.se/ +[9]: https://linuxhandbook.com/curl-command-examples/ +[10]: https://itsfoss.com/install-curl-ubuntu/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/download-files-in-linux-using-curl.png?resize=795%2C418&ssl=1 +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/download-files-in-linux-using-curl-1.png?resize=795%2C418&ssl=1 +[13]: http://elinks.or.cz/ +[14]: http://w3m.sourceforge.net/ From 57a6732cab51a6484553b91b97552bf09a52700c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 14 Oct 2020 05:02:45 +0800 Subject: [PATCH 0434/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201014?= =?UTF-8?q?=20MellowPlayer=20is=20a=20Desktop=20App=20for=20Various=20Stre?= =?UTF-8?q?aming=20Music=20Services?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md --- ...pp for Various Streaming Music Services.md | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 sources/tech/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md diff --git a/sources/tech/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md b/sources/tech/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md new file mode 100644 index 0000000000..1f13f78ea5 --- /dev/null +++ b/sources/tech/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md @@ -0,0 +1,94 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (MellowPlayer is a Desktop App for Various Streaming Music Services) +[#]: via: (https://itsfoss.com/mellow-player/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +MellowPlayer is a Desktop App for Various Streaming Music Services +====== + +_**Brief: MellowPlayer is a free and open-source desktop that lets you integrate web-based music streaming services on Linux and Windows.**_ + +Undoubtedly, a lot of users prefer tuning in to streaming services to listen to their favorite music instead of purchasing individual music from stores or downloading them for a collection. + +Of course, streaming services let you explore new music and help artists reach out to a wider audience easily. But, with so much music streaming services available ([Soundcloud][1], [Spotify][2], [YouTube Music][3], [Amazon Music][4], etc) it often becomes annoying to utilize them effectively while using your computer. + +You may [install Spotify on Linux][5] but there is no desktop app for Amazon Music. So, potentially you cannot manage the streaming service from a single portal. + +What if a desktop app lets you integrate streaming services on both Windows and Linux for free? In this article, I will talk about such an app — ‘[MellowPlayer][6]‘. + +### MellowPlayer: Open Source App to Integrate Various Streaming Music Services + +![][7] + +MellowPlayer is a free and open-source cross-platform desktop app that lets you integrate multiple streaming services and manage them all from one interface. + +There are several supported streaming services that you can integrate. You also get a certain level of control to tweak your experience from each individual service. For instance, you can set to automatically skip ads or mute them on YouTube. + +The cross-platform support for both Windows and Linux is definitely a plus point. + +Apart from the ability to manage the streaming services, it also integrates the player with your system tray to easily control the music. This means that you can use media keys on your keyboard to control the music player. + +It is also worth noting that you can add a new service that is not officially supported by just creating a plugin for it yourself within the app. To let you know more about it, let me highlight all the key features below. + +### Features of MellowPlayer + +![][8] + + * Cross-platform (Windows & Linux) + * Free & Open-Source + * Plugin-based Application to let you add new service by creating a plugin + * Integrates the services as a native desktop app with the system tray + * Supports hot keys + * Notifications support + * Listening history + + + +### Installing MellowPlayer on Linux + +![][9] + +MellowPlayer is available as a [Flatpak package][10]. I know it’s disappointing for some but it’s just Flatpak for Linux and an executable file for Windows. In case you didn’t know, follow our guide on [using Flatpak on Linux][11] to get started. + +[Download MellowPlayer][12] + +### Wrapping Up + +MellowPlayer is a handy desktop app for users who often dabble with multiple streaming services for music. Even though it works fine as per my test with SoundCloud, YouTube, and Spotify, I did notice that the app crashed when trying to re-size the window, just a heads up on that. You can explore more about it on its [GitLab page][13]. + +There are two similar applications that allow you to play multiple streaming music services: [Nuvola][14] and [Nuclear Music Player][15]. You may want to check them out. + +Have you tried MellowPlayer? Feel free to share your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/mellow-player/ + +作者:[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://soundcloud.com +[2]: https://www.spotify.com +[3]: https://music.youtube.com +[4]: https://music.amazon.com/home +[5]: https://itsfoss.com/install-spotify-ubuntu-linux/ +[6]: https://colinduquesnoy.gitlab.io/MellowPlayer/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/mellowplayer-screenshot.jpg?resize=800%2C439&ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/mellowplayer.png?resize=800%2C442&ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/mellowplayer-system-integration.jpg?resize=800%2C438&ssl=1 +[10]: https://flathub.org/apps/details/com.gitlab.ColinDuquesnoy.MellowPlayer +[11]: https://itsfoss.com/flatpak-guide/ +[12]: https://colinduquesnoy.gitlab.io/MellowPlayer/#features +[13]: https://gitlab.com/ColinDuquesnoy/MellowPlayer +[14]: https://itsfoss.com/nuvola-music-player/ +[15]: https://itsfoss.com/nuclear-music-player-linux/ From e2cb09788374a3d09ee966c173edfb2dba59abdb Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 14 Oct 2020 05:03:02 +0800 Subject: [PATCH 0435/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201013?= =?UTF-8?q?=20My=20first=20day=20using=20Ansible?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201013 My first day using Ansible.md --- .../20201013 My first day using Ansible.md | 304 ++++++++++++++++++ 1 file changed, 304 insertions(+) create mode 100644 sources/tech/20201013 My first day using Ansible.md diff --git a/sources/tech/20201013 My first day using Ansible.md b/sources/tech/20201013 My first day using Ansible.md new file mode 100644 index 0000000000..3d3453cfa7 --- /dev/null +++ b/sources/tech/20201013 My first day using Ansible.md @@ -0,0 +1,304 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My first day using Ansible) +[#]: via: (https://opensource.com/article/20/10/first-day-ansible) +[#]: author: (David Both https://opensource.com/users/dboth) + +My first day using Ansible +====== +A sysadmin shares information and advice about putting Ansible into +real-world use configuring computers on his network. +![People work on a computer server with devices][1] + +Getting a new computer, whether physical or virtual, up and running is time-consuming and requires a good deal of work—whether it's your first time or the 50th. For many years, I have used a series of scripts and RPMs that I created to install the packages I need and to perform many bits of configuration for my favorite tools. This approach has worked well and simplified my work, as well as reduced the amount of time I spend typing commands. + +I am always looking for better ways of doing things, and, for several years now, I have been hearing and reading about [Ansible][2], which is a powerful tool for automating system configuration and management. Ansible allows a sysadmin to define a specific state for each host in one or more playbooks and then performs whatever tasks are necessary to bring the host to that state. This includes installing or deleting various resources such as RPM or Apt packages, configuration and other files, users, groups, and much more. + +I have delayed learning how to use it for a long time because—stuff. Until recently, when I ran into a problem that I thought Ansible could easily solve. + +This article is not a complete how-to for getting started with Ansible; rather, it is intended to provide insight into some of the issues that I encountered and some information that I found only in some very obscure places. Much of the information I found in various online discussions and Q&A groups about Ansible was incorrect. Errors ranged from information that was really old with no indication of its date or provenance to information that was just wrong. + +The information in this article is known to work—although there might be other ways of accomplishing the same things—and it works with Ansible 2.9.13 and [Python][3] 3.8.5. + +### My problem + +All of my best learning experiences start with a problem I need to solve, and this was no exception. + +I have been working on a little project to modify the configuration files for the [Midnight Commander][4] (mc) file manager and pushing them out to various systems on my network for testing. Although I have a script to automate this, it still requires a bit of fussing with a command-line loop to provide the names of the systems to which I want to push the new code. The large number of changes I was making to the configuration files made it necessary for me to push the new ones frequently. But, just when I thought I had my new configuration just right, I would find a problem and need to do another push after making the fix. + +This environment made it difficult to keep track of which systems had the new files and which did not. I also have a couple of hosts that need to be treated differently. And my little bit of knowledge about Ansible suggested that it would probably be able to do all or most of what I need. + +### Getting started + +I had read a number of good articles and books about Ansible, but never in an "I have to get this working NOW!" kind of situation. And now was—well, NOW! + +In rereading these documents, I discovered that they mostly talk about how to install Ansible from GitHub using—wait for it—Ansible. That is cool, but I really just wanted to get started, so I installed it on my Fedora workstation using DNF and the version in the Fedora repository. Easy. + +But then I started looking for the file locations and trying to determine which configuration files I needed to modify, where to keep my playbooks, what a playbook even looks like, and what it does. I had lots of (so far) unanswered questions running around in my head. + +So, without further descriptions of my tribulations, here are the things I discovered and that got me going. + +### Configuration + +Ansible's configuration files are kept in `/etc/ansible`. Makes sense, right, since `/etc` is where system programs are supposed to keep their configuration files. The two files I needed to work with are `ansible.cfg` and `hosts`. + +#### ansible.cfg + +After getting started with some of the exercises I found in the documents and online, I began receiving warning messages about deprecating certain older Python files. So, I set `deprecation_warnings` to `false` in `ansible.cfg` and those angry red warning messages stopped: + + +``` +`deprecation_warnings = False` +``` + +Those warnings are important, so I will revisit them later and figure out what I need to do. But for now, they no longer clutter the screen and obfuscate the errors I actually need to be concerned about. + +#### The hosts file + +Not the same as the `/etc/hosts` file, the `hosts` file is also known as the inventory file, and it lists the hosts on your network. This file allows grouping hosts together in related sets, such as servers, workstations, and pretty much any designation you need. This file contains its own help and plenty of examples, so I won't go into boring detail here. However, there are some things to know. + +Hosts can be listed outside of any groups, but groups can be helpful in identifying hosts with one or more common characteristics. Groups use the INI format, so a server group looks like this: + + +``` +[servers] +server1 +server2 +...etc. +``` + +A hostname must be present in this file for Ansible to work on it. Even though some subcommands allow you to specify a hostname, the command will fail unless the hostname is in the `hosts` file. A host can also be listed in multiple groups. So `server1` might also be a member of the `[webservers]` group in addition to the `[servers]` group, and a member of the `[ubuntu]` group to differentiate it from Fedora servers. + +Ansible is smart. If the `all` argument is used for the hostname, Ansible scans the file and performs the defined tasks on all hosts listed in the file. Ansible will only attempt to work on each host once, no matter how many groups it appears in. This also means that there does not need to be a defined "all" group because Ansible can determine all hostnames in the file and create its own list of unique hostnames. + +Another little thing to look out for is multiple entries for a single host. I use `CNAME` records in my DNS zone file to create aliased names that point to the [A records][5] for some of my hosts. That way, I can refer to a host as `host1` or `h1` or `myhost`. If you use multiple hostnames for the same host in the `hosts` file, Ansible will try to perform its tasks on all of those hostnames; it has no way of knowing that they refer to the same host. The good news is that this does not affect the overall result; it just takes a bit more time as Ansible works on the secondary hostnames and determines that all of the operations have already been performed. + +### Ansible facts + +Most of the materials I have read on Ansible talk about [Ansible facts][6], which "are data related to your remote systems, including operating systems, IP addresses, attached filesystems, and more." This information is available in other ways, such as `lshw`, `dmidecode`, the `/proc` filesystem, and more, but Ansible generates a JSON file containing this information. Each time Ansible runs, it generates this facts data. There is an amazing amount of information in this data stream, all of which are in `<"variable-name": "value">` pairs. All of these variables are available for use within an Ansible playbook. The best way to understand the huge amount of information available is to display it yourself: + + +``` +`# ansible -m setup | less` +``` + +See what I mean? Everything you ever wanted to know about your host hardware and Linux distribution is there and usable in a playbook. I have not yet gotten to the point where I need to use those variables, but I am certain I will in the next couple of days. + +### Modules + +The `ansible` command above uses the `-m` option to specify the "setup" module. Ansible has many modules already built-in, so you do not need to use the `-m` for those. There are also many downloadable modules that can be installed, but the built-ins do everything I have needed for my current projects so far. + +### Playbooks + +Playbooks can be located almost anywhere. Since I need to run my playbooks as root, I placed mine in `/root/ansible`. As long as this directory is the present working directory (PWD) when I run Ansible, it can find my playbook. Ansible also has a runtime option to specify a different playbook and location. + +Playbooks can contain comments, although I have seen very few articles or books that mention this. As a sysadmin who believes in documenting everything, I find using comments can be very helpful. This is not so much about saying the same things in the comments as I do in the task name; rather, it is about identifying the purpose of groups of tasks and ensuring that I record my reasons for doing certain things in a certain way or order. This can help with debugging problems later when I may have forgotten my original thinking. + +Playbooks are simply collections of tasks that define the desired state of a host. A hostname or inventory group is specified at the beginning of the playbook and defines the hosts on which Ansible will run the playbook. + +Here is a sample of my playbook: + + +``` +################################################################################ +# This Ansible playbook updates Midnight commander configuration files.        # +################################################################################ +\- name: Update midnight commander configuration files +  hosts: all +  +  tasks: +  - name: ensure midnight commander is the latest version +    dnf: +      name: mc +      state: present + +  - name: create ~/.config/mc directory for root +    file: +      path: /root/.config/mc +      state: directory +      mode: 0755 +      owner: root +      group: root + +  - name: create ~/.config/mc directory for dboth +    file: +      path: /home/dboth/.config/mc +      state: directory +      mode: 0755 +      owner: dboth +      group: dboth + +  - name: copy latest personal skin +    copy: +      src: /root/ansible/UpdateMC/files/MidnightCommander/DavidsGoTar.ini +      dest: /usr/share/mc/skins/DavidsGoTar.ini +      mode: 0644 +      owner: root +      group: root + +  - name: copy latest mc ini file +    copy: +      src: /root/ansible/UpdateMC/files/MidnightCommander/ini +      dest: /root/.config/mc/ini +      mode: 0644 +      owner: root +      group: root + +  - name: copy latest mc panels.ini file +    copy: +      src: /root/ansible/UpdateMC/files/MidnightCommander/panels.ini +      dest: /root/.config/mc/panels.ini +      mode: 0644 +      owner: root +      group: root +<SNIP> +``` + +The playbook starts with its own name and the hosts it will act on—in this case, all of the hosts listed in my `hosts` file. The `tasks` section lists the specific tasks required to bring the host into compliance with the desired state. This playbook starts with a task in which Ansible's built-in DNF updates Midnight Commander if it is not the most recent release. The next tasks ensure that the required directories are created if they do not exist, and the remainder of the tasks copy the files to the proper locations. These `file` and `copy` tasks can also set the ownership and file modes for the directories and files. + +The details of my playbook are beyond the scope of this article, but I used a bit of a brute-force attack on the problem. There are other methods for determining which users need to have the files updated rather than using a task for each file for each user. My next objective is to simplify this playbook to use some of the more advanced techniques. + +Running a playbook is easy; just use the `ansible-playbook` command. The .yml extension stands for YAML. I have seen several meanings for that, but my bet is on "Yet Another Markup Language," despite the fact that some claim that YAML is not one. + +This command runs the playbook I created for updating my Midnight Commander files: + + +``` +`# ansible-playbook -f 10 UpdateMC.yml` +``` + +The `-f` option specifies that Ansible should fork up to 10 threads in order to perform operations in parallel. This can greatly speed overall task completion, especially when working on multiple hosts. + +### Output + +The output from a running playbook lists each task and the results. An `ok` means the machine state managed by the task is already defined in the task stanza. Because the state defined in the task is already true, Ansible did not need to perform the actions defined in the task stanza. + +The response `changed` indicates that Ansible performed the task specified in the stanza in order to bring it to the desired state. In this case, the machine state defined in the stanza was not true, so the actions defined were performed to make it true. On a color-capable terminal, the `TASK` lines are shown in color. On my host with my amber-on-black terminal color configuration, the `TASK` lines are shown in amber, `changed` lines are in brown, and `ok` lines are shown in green. Error lines are displayed in red. + +The following output is from the playbook I will eventually use to perform post-install configuration on new hosts: + + +``` +PLAY [Post-installation updates, package installation, and configuration] + +TASK [Gathering Facts] +ok: [testvm2] + +TASK [Ensure we have connectivity] +ok: [testvm2] + +TASK [Install all current updates] +changed: [testvm2] + +TASK [Install a few command line tools] +changed: [testvm2] + +TASK [copy latest personal Midnight Commander skin to /usr/share] +changed: [testvm2] + +TASK [create ~/.config/mc directory for root] +changed: [testvm2] + +TASK [Copy the most current Midnight Commander configuration files to /root/.config/mc] +changed: [testvm2] => (item=/root/ansible/PostInstallMain/files/MidnightCommander/DavidsGoTar.ini) +changed: [testvm2] => (item=/root/ansible/PostInstallMain/files/MidnightCommander/ini) +changed: [testvm2] => (item=/root/ansible/PostInstallMain/files/MidnightCommander/panels.ini) + +TASK [create ~/.config/mc directory in /etc/skel] +changed: [testvm2] + +<SNIP> +``` + +### The cow + +If you have the [cowsay][7] program installed on your computer, you will notice that the `TASK` names appear in the cow's speech bubble: + + +``` + ____________________________________ +< TASK [Ensure we have connectivity] > + ------------------------------------ +        \   ^__^ +         \  (oo)\\_______ +            (__)\       )\/\ +                ||----w | +                ||     || +``` + +If you do not have this fun feature and want it, install the cowsay package using your distribution's package manager. If you have this and don't want it, disable it with by setting `nocows = 1` in the `/etc/ansible/ansible.cfg` file. + +I like the cow and think it is fun, but it reduces the amount of screen space that can be used to display messages. So I disabled it after it started getting in the way. + +### Files + +As with my Midnight Commander task, it is frequently necessary to install and maintain files of various types. There are as many "best practices" for creating a directory tree for storing files used in playbooks as there are sysadmins—or at least as many as the number of authors writing books and articles about Ansible. + +I chose a simple structure that makes sense to me: + + +``` +/root/ansible +└── UpdateMC +    ├── files +    │   └── MidnightCommander +    │       ├── DavidsGoTar.ini +    │       ├── ini +    │       └── panels.ini +    └── UpdateMC.yml +``` + +You should use whatever structure works for you. Just be aware that some other sysadmin will likely need to work with whatever you set up, so there should be some level of logic to it. When I was using RPM and Bash scripts to perform my post-install tasks, my file repository was a bit scattered and definitely not structured with any logic. As I work through creating playbooks for many of my administrative tasks, I will introduce a much more logical structure for managing my files. + +### Multiple playbook runs + +It is safe to run a playbook as many times as needed or desired. Each task will only be executed if the state does not match the one specified in the task stanza. This makes it easy to recover from errors encountered during previous playbook runs. The playbook stops running when it encounters an error. + +While testing my first playbook, I made many mistakes and corrected them. Each additional run of the playbook—assuming my fix is a good one—skips the tasks whose state already matches the specified one and executes those that did not. When my fix works, the previously failed task completes successfully, and any tasks after that one in my playbook also execute—until it encounters another error. + +This also makes testing easy. I can add new tasks and, when I run the playbook, only those new tasks are performed because they are the only ones that do not match the test host's desired state. + +### Some thoughts + +Some tasks are not appropriate for Ansible because there are better methods for achieving a specific machine state. The use case that comes to mind is that of returning a VM to an initial state so that it can be used as many times as necessary to perform testing beginning with that known state. It is much easier to get the VM into the desired state and then to take a snapshot of the then-current machine state. Reverting to that snapshot is usually going to be easier and much faster than using Ansible to return the host to that desired state. This is something I do several times a day when researching articles or testing new code. + +After completing my playbook for updating Midnight Commander, I started a new playbook that I will use to perform post-installation tasks on newly installed Fedora hosts. I have already made good progress, and the playbook is a bit more sophisticated and less brute-force than my first one. + +On my very first day using Ansible, I created a playbook that solves a problem. I also started a second playbook that will solve the very big problem of post-install configuration. And I have learned a lot. + +Although I really like using [Bash][8] scripts for many of my administrative tasks, I am already finding that Ansible can do everything I want—and in a way that can maintain the system in the state I want. After only a single day of use, I am an Ansible fan. + +### Resources + +The most complete and useful document I have found is the [User Guide][9] on the Ansible website. This document is intended as a reference and not a how-to or getting-started document. + +Opensource.com has published many [articles about Ansible][10] over the years, and I have found most of them very helpful for my needs. The Enable Sysadmin website also has a lot of [Ansible articles][11] that I have found to be helpful. You can learn even more by checking out [AnsibleFest][12] happening this week (October 13-14, 2020). The event is completely virtual and free to register. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/first-day-ansible + +作者:[David Both][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://opensource.com/users/dboth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_linux11x_cc.png?itok=XMDOouJR (People work on a computer server with devices) +[2]: https://www.ansible.com/ +[3]: https://www.python.org/ +[4]: https://midnight-commander.org/ +[5]: https://en.wikipedia.org/wiki/List_of_DNS_record_types +[6]: https://docs.ansible.com/ansible/latest/user_guide/playbooks_vars_facts.html#ansible-facts +[7]: https://en.wikipedia.org/wiki/Cowsay +[8]: https://opensource.com/downloads/bash-cheat-sheet +[9]: https://docs.ansible.com/ansible/latest/user_guide/index.html +[10]: https://opensource.com/tags/ansible +[11]: https://www.redhat.com/sysadmin/topics/ansible +[12]: https://www.ansible.com/ansiblefest From 0668d814453a883b3b1e32a3992dc00efb7a09e8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 14 Oct 2020 05:03:15 +0800 Subject: [PATCH 0436/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201013?= =?UTF-8?q?=20What=20measured=20boot=20and=20trusted=20boot=20means=20for?= =?UTF-8?q?=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201013 What measured boot and trusted boot means for Linux.md --- ...d boot and trusted boot means for Linux.md | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 sources/tech/20201013 What measured boot and trusted boot means for Linux.md diff --git a/sources/tech/20201013 What measured boot and trusted boot means for Linux.md b/sources/tech/20201013 What measured boot and trusted boot means for Linux.md new file mode 100644 index 0000000000..a50e57bb25 --- /dev/null +++ b/sources/tech/20201013 What measured boot and trusted boot means for Linux.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What measured boot and trusted boot means for Linux) +[#]: via: (https://opensource.com/article/20/10/measured-trusted-boot) +[#]: author: (Mike Bursell https://opensource.com/users/mikecamel) + +What measured boot and trusted boot means for Linux +====== +When a trusted boot process is performed, the process not only measures +each value but also performs a check against a known (and expected!) +good value at the same time. +![Brain on a computer screen][1] + +Sometimes I'm looking around for a subject to write about, and realise that there's one that I assume that I've covered, but, on searching, discover that I haven't. One of those topics is measured boot and trusted boot—sometimes misleadingly referred to as "secure boot." There are specific procedures that use these terms with capital letters (e.g., Secure Boot), which I'm going to try to avoid discussing in this article. I'm more interested in the generic processes—and a major potential downfall—than in trying to go into the ins and outs of specifics. What follows is a (heavily edited) excerpt from my forthcoming book on trust in computing and the cloud for [Wiley][2]. + +In order to understand what measured boot and trusted boot aim to achieve, look at the Linux virtualisation stack: the components you run if you want to use virtual machines (VMs) on a Linux machine. This description is arguably over-simplified, but (as I noted above) I'm not interested in the specifics but in what I'm trying to achieve. I'll concentrate on the bottom four layers (at a rather simple level of abstraction): CPU/management engine; BIOS/EFI; firmware; and hypervisor, but I'll also consider a layer _just_ above the CPU/management engine, which interposes a Trusted Platform Module (TPM) and some instructions for how to perform one of the two processes (_measured boot_ and _trusted boot_). Once the system starts to boot, the TPM is triggered and starts its work. Alternative roots of trust, such as hardware security modules (HSMs), might also be used, but I will use TPMs, the most common example in this context, in my example. + +In both cases (trusted boot and the measured boot), the basic flow starts with the TPM performing a measurement of the BIOS/EFI layer. This measurement involves checking the binary instructions to be carried out by this layer and creating a cryptographic hash of the binary image. The hash that's produced is then stored in one of several Platform Configuration Register (PCR) "slots" in the TPM. These can be thought of as pieces of memory that can be read later on - either by the TPM for its purposes or by entities external to the TPM - but that cannot be changed once they have been written. These pieces of memory are integrity protected from the time of their initially being written. This provides assurances that once a value is written to a PCR by the TPM, it can be considered constant for the lifetime of the system until power off or reboot. + +After measuring the BIOS/EFI layer, the next layer (firmware) is measured. In this case, the resulting hash is combined with the previous hash (which was stored in the PCR slot) and then also stored in a PCR slot. The process continues until all the layers involved in the process have been measured and the hashes' results have been stored. There are (sometimes quite complex) processes to set up the original TPM values (I've skipped some of the more low-level steps in the process for simplicity) and to allow (hopefully authorised) changes to the layers for upgrading or security patching, for example. This "measured boot" process allows for entities to query the TPM after the process has completed and to check whether the values in the PCR slots correspond to the expected values, pre-calculated with "known good" versions of the various layers—that is, pre-checked versions whose provenance and integrity have already been established. + +Various protocols exist to allow parties _external_ to the system to check the values (e.g., via a network connection) that the TPM attests to be correct: the process of receiving and checking such values from an external system is known as "remote attestation." + +This process—measured boot—allows you to find out whether the underpinnings of your system—the lowest layers—are what you think they are. But what if they're not? Measured boot (unsurprisingly, given the name) measures but doesn't perform any other actions. + +The alternative, "trusted boot," goes a step further. When a trusted boot process is performed, the process not only measures each value but also performs a check against a known (and expected!) good value at the same time. If the check fails, then the process will halt, and the booting of the system will fail. This may sound like a rather extreme approach to take on a system, but sometimes it is absolutely the right one. Where the system under consideration may have been compromised—which is one likely inference you can make from the failure of a trusted boot process—it is better for it to not be available at all than to be running based on flawed expectations. + +This is all very well if I am the owner of the system being measured, have checked all of the various components being measured (and the measurements), and am happy that what's being booted is what I want.[1][3] But what if I'm using a system on the cloud, for instance, or any system owned and managed by someone else? In that case, I'm trusting the cloud provider (or owner/manager) with two things: + + 1. Doing all the measuring correctly and reporting correct results to me + 2. Building something I should trust in the first place + + + +This is the problem with the nomenclature "trusted boot" and, even worse, "secure boot." Both imply that an absolute, objective property of a system has been established—it is "trusted" or "secure"—when this is clearly not the case. Obviously, it would be unfair to expect the designers of such processes to name them after the failure states—"untrusted boot" or "insecure boot"—but, unless I can be very certain that I trust the owner of the system to do step two entirely correctly (and in my best interests as the user of the system, rather than theirs as the owner), then I can make no stronger assertions. + +There is an enormous temptation to take a system that has gone through a trusted boot process and label it a "trusted system" when _the very best_ assertion you can make is that the particular layers measured in the measured and/or trusted boot process have been asserted to be those the process expects to be present. Such a process says nothing at all about the fitness of the layers to provide assurances of behaviour nor about the correctness (or fitness to provide assurances of behaviour) of any subsequent layers on top of those. + +It's important to note that designers of TPMs are quite clear what is being asserted and that assertions about trust should be made carefully and sparingly. Unluckily, however, the complexities of systems, the general low level of understanding of trust, and the complexities of context and transitive trust make it very easy for systems designers and implementors to do the wrong thing and assume that any system that has successfully performed a trusted boot process can be considered "trusted." It is also extremely important to remember that TPMs, as hardware roots of trust, offer one of the best mechanisms available for establishing a chain of trust in systems that you may be designing or implementing, and I plan to write an article about them soon. + +* * * + + 1. Although this turns out to be _much_ harder to do than you might expect! + + + +* * * + +_This article was originally published on [Alice, Eve, and Bob][4] and is reprinted with the author's permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/measured-trusted-boot + +作者:[Mike Bursell][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://opensource.com/users/mikecamel +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/brain_computer_solve_fix_tool.png?itok=okq8joti (Brain on a computer screen) +[2]: https://wiley.com/ +[3]: tmp.HkXCfJwlpF#1 +[4]: https://aliceevebob.com/2020/09/08/measured-and-trusted-boot/ From fc3e290164f50736724d4f00272ada1dcaa103b7 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 14 Oct 2020 05:03:26 +0800 Subject: [PATCH 0437/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201013?= =?UTF-8?q?=20Install=20MariaDB=20or=20MySQL=20on=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201013 Install MariaDB or MySQL on Linux.md --- ...01013 Install MariaDB or MySQL on Linux.md | 118 ++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 sources/tech/20201013 Install MariaDB or MySQL on Linux.md diff --git a/sources/tech/20201013 Install MariaDB or MySQL on Linux.md b/sources/tech/20201013 Install MariaDB or MySQL on Linux.md new file mode 100644 index 0000000000..458b6dc913 --- /dev/null +++ b/sources/tech/20201013 Install MariaDB or MySQL on Linux.md @@ -0,0 +1,118 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Install MariaDB or MySQL on Linux) +[#]: via: (https://opensource.com/article/20/10/mariadb-mysql-linux) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Install MariaDB or MySQL on Linux +====== +Get started using an open source SQL database on your Linux system. +![Person standing in front of a giant computer screen with numbers, data][1] + +Both [MariaDB][2] and [MySQL][3] are open source databases that use SQL and share the same original codebase. MariaDB is a drop-in replacement for MySQL, so much so that you use the same command (`mysql`) to interact with MySQL and MariaDB databases. This article, therefore, applies equally to MariaDB and MySQL. + +### Install MariaDB + +You can install MariaDB using your Linux distribution's package manager. On most distributions, MariaDB is split into a server package and a client package. The server package provides the database "engine," the part of MariaDB that runs (usually on a physical server) in the background, listening for data input or requests for data output. The client package provides the command `mysql`, which you can use to communicate with the server. + +On RHEL, Fedora, CentOS, or similar: + + +``` +`$ sudo dnf install mariadb mariadb-server` +``` + +On Debian, Ubuntu, Elementary, or similar: + + +``` +`$ sudo apt install mariadb-client mariadb-server` +``` + +Other systems may package MariaDB differently systems, so you may need to search your software repository to learn how your distribution's maintainers provide it. + +### Start MariaDB + +Because MariaDB is designed to function, in part, as a database server, it can run on one computer and be administered from another. As long as you have access to the computer running it, you can use the `mysql` command to administer the database. I ran MariaDB on my local computer when writing this article, but it's just as likely that you'll interact with a MariaDB database hosted on a remote system. + +Before starting MariaDB, you must create an initial database. You should define the user you want MariaDB to use when initializing its file structure. By default, MariaDB uses the current user, but you probably want it to use a dedicated user account. Your package manager probably configured a system user and group for you. Use `grep` to find out whether there's a `mysql` group: + + +``` +$ grep mysql /etc/group +mysql❌27: +``` + +You can also look in `/etc/passwd` for a dedicated user, but usually, where there's a group, there's also a user. If there isn't a dedicated `mysql` user and group, look through `/etc/group` for an obvious alternative (such as `mariadb`). Failing that, read your distribution's documentation to learn how MariaDB runs. + +Assuming your install uses `mysql`, initialize the database environment: + + +``` +$ sudo mysql_install_db --user=mysql +Installing MariaDB/MySQL system tables in '/var/lib/mysql'... +OK +[...] +``` + +The result of this step reveals the next tasks you must perform to configure MariaDB: + + +``` +PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER ! +To do so, start the server, then issue the following commands: + +'/usr/bin/mysqladmin' -u root password 'new-password' +'/usr/bin/mysqladmin' -u root -h $(hostname) password 'new-password' + +Alternatively you can run: +'/usr/bin/mysql_secure_installation' + +which will also give you the option of removing the test +databases and anonymous user created by default.  This is +strongly recommended for production servers. +``` + +Start MariaDB using your distribution's init system: + + +``` +`$ sudo systemctl start mariadb` +``` + +To enable the MariaDB server to start upon boot: + + +``` +`$ sudo systemctl enable --now mariadb` +``` + +Now that you have a MariaDB server to communicate with, set a password for it: + + +``` +mysqladmin -u root password 'myreallysecurepassphrase' +mysqladmin -u root -h $(hostname) password 'myreallysecurepassphrase' +``` + +Finally, if you intend to use this installation on a production server, run the `mysql_secure_installation` command before going live. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/mariadb-mysql-linux + +作者:[Seth Kenlon][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://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) +[2]: https://mariadb.org/ +[3]: https://www.mysql.com/ From 2604ce4292c268ee1c564e9777c80566111e7453 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 14 Oct 2020 05:04:04 +0800 Subject: [PATCH 0438/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201012?= =?UTF-8?q?=20Build=20a=20Kubernetes=20Minecraft=20server=20with=20Ansible?= =?UTF-8?q?'s=20Helm=20modules?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201012 Build a Kubernetes Minecraft server with Ansible-s Helm modules.md --- ...raft server with Ansible-s Helm modules.md | 172 ++++++++++++++++++ 1 file changed, 172 insertions(+) create mode 100644 sources/tech/20201012 Build a Kubernetes Minecraft server with Ansible-s Helm modules.md diff --git a/sources/tech/20201012 Build a Kubernetes Minecraft server with Ansible-s Helm modules.md b/sources/tech/20201012 Build a Kubernetes Minecraft server with Ansible-s Helm modules.md new file mode 100644 index 0000000000..08dd088007 --- /dev/null +++ b/sources/tech/20201012 Build a Kubernetes Minecraft server with Ansible-s Helm modules.md @@ -0,0 +1,172 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Build a Kubernetes Minecraft server with Ansible's Helm modules) +[#]: via: (https://opensource.com/article/20/10/kubernetes-minecraft-ansible) +[#]: author: (Jeff Geerling https://opensource.com/users/geerlingguy) + +Build a Kubernetes Minecraft server with Ansible's Helm modules +====== +Deploy a Minecraft server into a Kubernetes cluster with Ansible's new +collections. +![Ship captain sailing the Kubernetes seas][1] + +One of the best outcomes of Ansible's [move towards content collections][2] is it spreads the thousands of modules in [Ansible][3]'s "core" repository into many more independent repositories. This means movement on issues and modules that had long been delayed (often due to the [sheer volume of issues and pull requests][4] in the repo) can progress more rapidly. + +Obviously, not all modules will get the same love and appreciation as others—that's the way open source works: more popular things flourish, as others may languish a bit—but one bright example of the positive impact has been the [Kubernetes][5] collection's ability to incorporate some long-awaited [Helm][6] modules. + +Thanks especially to the work of [LucasBoisserie][7], three new Helm modules were merged into the Kubernetes collection: + + * helm + * helm_info + * helm_repository + + + +Ansible has long had a [helm module][8], but it was fairly broken for a long time, only worked with older versions of Helm, and was slated for deprecation in Ansible 2.14. That version of the module will still work the same in the regular community distribution of Ansible, as it's now been moved to the [community.general][9] collection. + +But if you want to use these new modules to automate your Helm deployments using the Kubernetes container orchestration system, you can do it with the [community.kubernetes][10] collection. + +### What is Helm? + +Helm says it is "the best way to find, share, and use software built for Kubernetes." + +There are currently dozens of ways to deploy software into Kubernetes and [OpenShift][11] clusters (you can even do it using Ansible natively with the [k8s module][12]), but Helm is often the easiest onramp to Kubernetes deployments, especially when you're starting out on your Kubernetes journey. + +The way Helm works is that people maintain "charts," which are templates describing "how to deploy application XYZ" into Kubernetes. Charts can have "values" that override the default settings for a deployment's chart. + +There are thousands of [charts on Helm Hub][13] you can use to install popular software. If your software is not included, you can build and host your own Helm chart repositories. + +### What is Minecraft? + +For a certain generation (or their parents), this question doesn't need an answer: [Minecraft][14] is the [best-selling video game of all time][15], and it appeals to an extremely wide audience because there are so many different ways you can play it. + +I remember spending an hour here or there during my post-college years tending to a farm that I built in my little virtual Minecraft world. Minecraft can now run on almost any computing device with a screen, and networked play has become very popular. To support this, the Minecraft team maintains a [Minecraft server][16] application you can run to play networked games with your friends. + +### Where does Ansible fit in? + +I like to think of Ansible as the "glue" that holds automation together. I previously wrote about [how Ansible is useful in a cloud-native environment][17], so I won't rehash why I use Ansible to manage my Kubernetes infrastructure. + +In this article, I'll show you how to write a short Ansible playbook to manage the setup of Helm's Minecraft chart in a cluster. In a real-world infrastructure, this playbook would be one small part of a set of plays that: + + * Build or configure a Kubernetes cluster + * Deploy monitoring tools into the cluster + * Deploy applications into the cluster + + + +Before you can write the playbook, you have to install Ansible's official [Kubernetes collection][10]. You can do this either by requiring it in a **requirements.yml** file (which could be used by Ansible Tower to install the collection automatically) or by manually installing it: + + +``` +`ansible-galaxy collection install community.kubernetes` +``` + +Once you have the collection, it's time to write the playbook. To make it easy for you to view the code or download the file, I've posted my **[minecraft.yml][18] **playbook as a Gist on GitHub. + +The playbook uses many of the Kubernetes collection's modules: + + 1. The `k8s` module creates a namespace, `minecraft`. + 2. The `helm_repository` module adds the `itzg` Helm repository, which contains the Minecraft Helm chart. + 3. The `helm` module deploys the chart and creates the Minecraft server instance. + 4. The `k8s_info` module retrieves the NodePort where Minecraft is running so that you can connect to it from Minecraft. + + + +The playbook assumes you have a running Kubernetes or OpenShift cluster and a kubeconfig file that points to that cluster already. If not, create a Minikube cluster on your workstation: + + 1. Make sure you have [Minikube][19] installed. + 2. Run `minikube start`, and wait for the cluster to be created. + + + +Make sure you have [Ansible][20] and [Helm][21] installed, then run the playbook: + + +``` +`ansible-playbook minecraft.yml` +``` + +After a few minutes, the Minecraft server will generate a spawn area and be ready for connections! The playbook should provide the Minecraft NodePort at the end of its output (e.g., Minecraft NodePort: 32393). + +Get the IP address of your Minikube cluster with `minikube ip`, add the NodePort to it (in my case, 192.168.64.19:32393), then open up Minecraft and connect to it: + + 1. Click **Multiplayer**. + 2. Click **Direct Connection**. + 3. Enter the server address (the Minikube IP and Minecraft NodePort). + 4. Click **Join Server**. + + + +And voila! You should be able to play around in the little virtual Minecraft world that's running on your very own Kubernetes cluster. + +![Minecraft gameplay][22] + +(Jeff Geerling, [CC BY-SA 4.0][23]) + +View the server logs with: + + +``` +`kubectl logs -f -n minecraft -l app=minecraft-minecraft;` +``` + +In the logs, you can see that I was successful in finding many ways to die inside my little Minecraft world! + +![Minecraft server logs][24] + +(Jeff Geerling, [CC BY-SA 4.0][23]) + +### Take a step beyond + +There are dozens of ways to deploy applications like a Minecraft server into a Kubernetes cluster. Luckily for us, Ansible already supports most of those options through its Kubernetes collection! And if you want to take a step beyond simple deployments and chart updates, you can use Ansible to build a [Kubernetes operator][25] with the Operator SDK—in fact, someone already made a [community operator][26] built with Ansible that runs a Minecraft server! + +I was inspired to write this after using Ansible to manage a seven-node Kubernetes cluster built with Raspberry Pis. You can learn more about that in the [Turing Pi Cluster][27] GitHub repository. + +* * * + +If you want to learn more about Ansible, make sure to register for [AnsibleFest][28], a virtual experience on October 13-14. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/kubernetes-minecraft-ansible + +作者:[Jeff Geerling][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://opensource.com/users/geerlingguy +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/ship_captain_devops_kubernetes_steer.png?itok=LAHfIpek (Ship captain sailing the Kubernetes seas) +[2]: https://github.com/ansible-collections/overview +[3]: https://www.ansible.com/ +[4]: https://emeraldreverie.org/2020/03/02/collections-the-backlog-view/ +[5]: https://kubernetes.io/ +[6]: https://helm.sh/ +[7]: https://github.com/LucasBoisserie +[8]: https://docs.ansible.com/ansible/2.9/modules/helm_module.html +[9]: https://github.com/ansible-collections/community.general/blob/master/plugins/modules/cloud/misc/helm.py +[10]: https://github.com/ansible-collections/community.kubernetes +[11]: https://www.openshift.com/ +[12]: https://docs.ansible.com/ansible/latest/collections/community/kubernetes/k8s_module.html#ansible-collections-community-kubernetes-k8s-module +[13]: https://hub.helm.sh/ +[14]: https://www.minecraft.net/ +[15]: https://en.wikipedia.org/wiki/List_of_best-selling_video_games#List +[16]: https://www.minecraft.net/en-us/download/server/ +[17]: https://www.ansible.com/blog/how-useful-is-ansible-in-a-cloud-native-kubernetes-environment +[18]: https://gist.github.com/geerlingguy/2f4b0c06b4b696c8983b82dda655adf3 +[19]: https://kubernetes.io/docs/tasks/tools/install-minikube/ +[20]: https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html +[21]: https://helm.sh/docs/intro/install/ +[22]: https://opensource.com/sites/default/files/uploads/minecraft.png (Minecraft gameplay) +[23]: https://creativecommons.org/licenses/by-sa/4.0/ +[24]: https://opensource.com/sites/default/files/uploads/serverlogs.png (Minecraft server logs) +[25]: https://www.redhat.com/en/topics/containers/what-is-a-kubernetes-operator +[26]: https://github.com/fabianvf/game-server-operator +[27]: https://github.com/geerlingguy/turing-pi-cluster +[28]: https://www.ansible.com/ansiblefest From b9a1396bc3699429013b750093b4ce15db68f0d9 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 14 Oct 2020 05:04:35 +0800 Subject: [PATCH 0439/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201012?= =?UTF-8?q?=20My=20top=207=20keywords=20in=20Rust?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201012 My top 7 keywords in Rust.md --- .../20201012 My top 7 keywords in Rust.md | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 sources/tech/20201012 My top 7 keywords in Rust.md diff --git a/sources/tech/20201012 My top 7 keywords in Rust.md b/sources/tech/20201012 My top 7 keywords in Rust.md new file mode 100644 index 0000000000..cca2eeefc1 --- /dev/null +++ b/sources/tech/20201012 My top 7 keywords in Rust.md @@ -0,0 +1,55 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My top 7 keywords in Rust) +[#]: via: (https://opensource.com/article/20/10/keywords-rust) +[#]: author: (Mike Bursell https://opensource.com/users/mikecamel) + +My top 7 keywords in Rust +====== +Learn a handful of useful keywords from the Rust standard library. +![Rustacean t-shirt][1] + +I've been using [Rust][2] for a few months now, writing rather more of it than I expected—though quite a lot of that has been thrown away as I've learned, improved what I'm writing, and taken some more complex tasks beyond what I originally intended. + +I still love it and thought it might be good to talk about some of the important keywords that come up again and again in Rust. I'll provide my personal summary of what they do, why you need to think about how you use them, and anything else that's useful, particularly for people who are new to Rust or coming from another language (such as Java; see my article [_Why I'm enjoying learning Rust as a Java programmer_][3]). + +Without further ado, let's get going. A good place for further information is always the official Rust documentation—you'll probably want to start with the [std library][4]. + + 1. **const** – You get to declare constants with const, and you should. This isn't rocket science, but do declare with const, and if you're going to use constants across different modules, then do the right thing and create a `lib.rs` file (the Rust default) into which you can put all of them with a nicely named module. I've had clashes of const variable names (and values!) across different files in different modules simply because I was too lazy to do anything other than cut and paste across files when I could have saved myself lots of work simply by creating a shared module. + 2. **let** – You don't _always_ need to declare a variable with a let statement, but your code will be clearer when you do. What's more, always add the type if you can. Rust will do its very best to guess what it should be, but it may not always be able to do so at runtime (in which case [Cargo][5], the compiler, will tell you), or it may even not do what you expect. In the latter case, it's always simpler for Cargo to complain that the function you're assigning from (for instance) doesn't match the declaration than for Rust to try to help you do the wrong thing, only for you to have to spend ages debugging elsewhere. + 3. **match** – match was new to me, and I love it. It's not dissimilar to "switch" in other languages but is used extensively in Rust. It makes for legible code, and Cargo will have a good go at warning you if you do something foolish (such as miss possible cases). My general rule of thumb, where I'm managing different options or doing branching, is to ask whether I can use match. If I can, I will. + 4. **mut** – When declaring a variable, if it's going to change after its initialisation, then you need to declare it mutable. A common mistake is to declare something mutable when it _isn't_ changed—but the compiler will warn you about that. If you get a warning from Cargo that a mutable variable isn't changed when you think it _is_, then you may wish to check the scope of the variable and make sure that you're using the right version. + 5. **return** – I actually very rarely use return, which is for returning a value from a function, because it's usually simpler and clearer to read if you just provide the value (or the function providing the return value) at the end of the function as the last line. Warning: you _will_ forget to omit the semicolon at the end of this line on many occasions; if you do, the compiler won't be happy. + 6. **unsafe** – This does what it says on the tin: If you want to do things where Rust can't guarantee memory safety, then you're going to need to use this keyword. I have absolutely no intention of declaring any of my Rust code unsafe now or at any point in the future; one of the reasons Rust is so friendly is because it stops this sort of hackery. If you really need to do this, think again, think yet again, and then redesign. Unless you're a seriously low-level systems programmer, _avoid_ unsafe. + 7. **use** – When you want to use an item, e.g., struct, variable, function, etc. from another crate, then you need to declare it at the beginning of the block where you'll be using it. Another common mistake is to do this but fail to add the crate (preferably with a minimum version number) to the `Cargo.toml` file. + + + +This isn't the most complicated article I've ever written, I know, but it's the sort of article I would have appreciated when I was starting to learn Rust. I plan to create similar articles on key functions and other Rust must-knows: let me know if you have any requests! + +* * * + +_This article was originally published on [Alice, Eve, and Bob][6] and is reprinted with the author's permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/keywords-rust + +作者:[Mike Bursell][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://opensource.com/users/mikecamel +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rustacean-tshirt.jpg?itok=u7LBmyaj (Rustacean t-shirt) +[2]: https://www.rust-lang.org/ +[3]: https://opensource.com/article/20/5/rust-java +[4]: https://doc.rust-lang.org/std/ +[5]: https://doc.rust-lang.org/cargo/ +[6]: https://aliceevebob.com/2020/09/01/rust-my-top-7-keywords/ From d6cf5d4d8ec1ff6537ec6383791fb174580ced52 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 14 Oct 2020 05:04:46 +0800 Subject: [PATCH 0440/1156] add done: 20201012 My top 7 keywords in Rust.md --- ...le for integrating your Google Calendar.md | 186 ++++++++++++++++++ 1 file changed, 186 insertions(+) create mode 100644 sources/tech/20201012 Create an Ansible module for integrating your Google Calendar.md diff --git a/sources/tech/20201012 Create an Ansible module for integrating your Google Calendar.md b/sources/tech/20201012 Create an Ansible module for integrating your Google Calendar.md new file mode 100644 index 0000000000..3f7585f5be --- /dev/null +++ b/sources/tech/20201012 Create an Ansible module for integrating your Google Calendar.md @@ -0,0 +1,186 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Create an Ansible module for integrating your Google Calendar) +[#]: via: (https://opensource.com/article/20/10/ansible-module-go) +[#]: author: (Nicolas Leiva https://opensource.com/users/nicolas-leiva) + +Create an Ansible module for integrating your Google Calendar +====== +Learn how to write an Ansible module in Go to integrate Google Calendar +into your automation workflow. +![Business woman on laptop sitting in front of window][1] + +In a [previous article][2], I explored how [Ansible][3] can integrate with Google Calendar for change management, but I didn't get into the details of the [Ansible module][4] that was built for this purpose. In this article, I will cover the nuts and bolts of it. + +While most [Ansible modules][5]** **are written in [Python][6] (see [this example][7]), that's not the only option you have. You can use other programming languages if you prefer. And if you like [Go][8], this post is for you! + +![Gopher illustration][9] + +([Maria Letta's Free Gophers Pack][10], [Free Gophers License v1.0][11], modified with permission) + +If you are new to Go, check out these [pointers to get started][12]. + +## Ansible and Go + +There are at least four different ways that you can run a Go program from Ansible: + + 1. Install Go and run your Go code with the `go run` command from Ansible. + 2. Cross-compile your Go code for different platforms before execution. Then call the proper binary from Ansible, based on the facts you collect from the host. + 3. Run your Go code or compiled binary from a container with the `containers.podman` [collection][13]. Something along the lines of: [code] - name: Run Go container +  podman_container: +    name: go_test_container +    image: golang +    command: go version +    rm: true +    log_options: "path={{ log_file }}" +``` + 4. Create an [RPM][14] package of your Go code with something like [NFPM][15], and install it in the system of the target host. You can then call it with the Ansible modules [shell][16] or [command][17]. + + + +Running an RPM package or container is not Go-specific (cases 3 and 4), so I will focus on the first two options. + +## Google Calendar API + +You will need to interact with the [Google Calendar API][18], which provides code examples for different programming languages. The one for Go will be the base for your Ansible module. + +The tricky part is [enabling the Calendar API][19] and downloading the credentials you generate in the [Google API Console][20] (`Credentials` > `+ CREATE CREDENTIALS` > `OAuth client ID` > `Desktop App`). + +![Downloading credentials from Google API Console][21] + +(Nicolas Leiva, [CC BY-SA 4.0][22]) + +The arrow shows where to download your OAuth 2.0 client credentials (JSON file) once you create them in [API Credentials][23]. + +## Calling the module from Ansible + +The `calendar` module takes the `time` to validate as an argument. The example below provides the current time. You can typically get this from [Ansible facts][24] (`ansible_date_time`). The JSON output of the module is registered in a variable named `output` to be used in a subsequent task: +``` + + +\- name: Check if timeslot is taken +  calendar: +    time: "{{ ansible_date_time.iso8601 }}" +  register: output + +``` +You might wonder where the `calendar` module code lives and how Ansible executes it. Please bear with me for a moment; I'll get to this after I cover other pieces of the puzzle. + +## Employ the time logic + +With the Calendar API nuances out of the way, you can proceed to interact with the API and build a Go function to capture the module logic. The `time` is taken from the input arguments—in the playbook above—as the initial time (`min`) of the time window to validate (I arbitrarily chose a one-hour duration): +``` + + +func isItBusy(min string) (bool, error) { +        ... +        // max -> min.Add(1 * time.Hour) +        max, err := maxTime(min) +        // ... +        srv, err := calendar.New(client) +        // ... +        freebusyRequest := calendar.FreeBusyRequest{ +                TimeMin: min, +                TimeMax: max, +                Items:   []*calendar.FreeBusyRequestItem{&cal}, +        } +        // ... +        freebusyRequestResponse, err := freebusyRequestCall.Do() +        // ... +        if len(freebusyRequestResponse.Calendars[name].Busy) == 0 { +                return false, nil +        } +        return true, nil +} + +``` +It [sends a `FreeBusyRequest`][25] to Google Calendar with the time window's initial and finish time (`min` and `max`). It also creates a calendar [client][26] (`srv`) to authenticate the account correctly using the JSON file with the OAuth 2.0 client credentials. In return, you get a list of events during this time window. + +If you get zero events, the function returns `busy=false`. However, if there is at least one event during this time window, it means `busy=true`. You can check out the [full code][27] in my GitHub repository. + +## Process the input and creating a response + +Now, how does the Go code read the inputs arguments from Ansible and, in turn, generate a response that Ansible can process? The answer to this depends on whether you are running the [Go CLI][28] (command-line interface) or just executing a pre-compiled Go program binary (i.e., options 1 and 2 above). + +Both options have their pros and cons. If you use the Go CLI, you can pass the arguments the way you prefer. However, to make it consistent with how it works for binaries you run from Ansible, both alternatives will read a JSON file in the examples presented here. + +### Reading the arguments + +As shown in the Go code snippet below, an input file is processed, and Ansible provides a path to it when it calls a binary. + +The content of the file is unmarshaled into an instance (`moduleArg`) of a previously defined struct (`ModuleArgs`). This is how you tell the Go code which data you expect to receive. This method enables you to gain access to the `time` specified in the playbook via `moduleArg.time`, which is then passed to the time logic function (`isItBusy`) for processing: +``` + + +// ModuleArgs are the module inputs +type ModuleArgs struct { +        Time string +} + +func main() { +        ... +        argsFile := os.Args[1] +        text, err := ioutil.ReadFile(argsFile) +        ... +        var moduleArgs ModuleArgs +        err = json.Unmarshal(text, &moduleArgs) +        ... +        busy, err := isItBusy(moduleArg.time) +        ... +} + +``` +### Generating a response + +The values to return are assigned to an instance of a `Response` object. Ansible will need this response includes a couple of boolean flags (`Changed` and `Failed`). You can add any other field you need; in this case, a `Busy` boolean value is carried to signal the response of the time logic function. + +The response is marshaled into a message that you print out and Ansible can read: +``` + + +// Response are the values returned from the module +type Response struct { +        Msg     string `json:"msg"` +        Busy    bool   `json:"busy"` +        Changed bool   `json:"changed"` +        Failed  bool   `json:"failed"` +} + +func returnResponse(r Response) { +  ... +        response, err = json.Marshal(r) +        ... +        fmt.Println(string(response)) +        ... +} + +``` +You can check out the [full code][29] on GitHub. + +## Execute a binary or Go code on the fly? + +One of the cool things about Go is that you can cross-compile a Go program to run on different target operating systems and architectures. The binary files you compile can be executed in the target host without installing Go or any dependency. + +This flexibility plays nicely with Ansible, which provides the target host details (`ansible_system` and `ansible_architecture`) via Ansible facts. In this example, the target architecture is fixed when compiling (`x86_64`), but binaries for macOS, Linux, and Windows are generated (via `make compile`). This produces the three files that are included in the [`library` folder][30] of the `go_role` role with the form of: `calendar_$system`: +``` + + +⇨  tree roles/go_role/ +roles/go_role/ +├── library +│   ├── calendar_darwin +│   ├── calendar_linux +│   ├── calendar_windows +│   └── go_run +└── tasks +    ├── Darwin.yml +    ├── Go.yml +    ├── Linux.yml +    ├── main.yml +    └── Win32NT.yml + +``` +The [`go_role` role][31] that packages the `calendar` \ No newline at end of file From e5cc672516b5e1d12b9a36af9ea469c8a55dde82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Wed, 14 Oct 2020 08:01:58 +0800 Subject: [PATCH 0441/1156] Translating --- sources/tech/20200928 Add sound to your Python game.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200928 Add sound to your Python game.md b/sources/tech/20200928 Add sound to your Python game.md index 93a495dd50..d17429da26 100644 --- a/sources/tech/20200928 Add sound to your Python game.md +++ b/sources/tech/20200928 Add sound to your Python game.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (robsean) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 677edfa6fd6bb982e14f762b55b6c36f2fb07958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Wed, 14 Oct 2020 08:04:18 +0800 Subject: [PATCH 0442/1156] Translating --- ...2 How to Free Up Space in -boot Partition on Ubuntu Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md b/sources/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md index 6b0c1b7810..b34715733d 100644 --- a/sources/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md +++ b/sources/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (robsean) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 485e625df8463fbf235f4189c1d25cc25b2c29d6 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 14 Oct 2020 08:53:47 +0800 Subject: [PATCH 0443/1156] translated --- ...ith Ansible to avoid schedule conflicts.md | 112 ------------------ ...ith Ansible to avoid schedule conflicts.md | 111 +++++++++++++++++ 2 files changed, 111 insertions(+), 112 deletions(-) delete mode 100644 sources/tech/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md create mode 100644 translated/tech/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md diff --git a/sources/tech/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md b/sources/tech/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md deleted file mode 100644 index 2ca86d4af8..0000000000 --- a/sources/tech/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md +++ /dev/null @@ -1,112 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Integrate your calendar with Ansible to avoid schedule conflicts) -[#]: via: (https://opensource.com/article/20/10/calendar-ansible) -[#]: author: (Nicolas Leiva https://opensource.com/users/nicolas-leiva) - -Integrate your calendar with Ansible to avoid schedule conflicts -====== -Make sure your automation workflow's schedule doesn't conflict with -something else by integrating a calendar app into Ansible. -![Calendar close up snapshot][1] - -Is "anytime" a good time to execute your automation workflow? The answer is probably no, for different reasons. - -If you want to avoid simultaneous changes to minimize the impact on critical business processes and reduce the risk of unintended service disruptions, then no one else should be attempting to make changes at the same time your automation is running. - -In some scenarios, there could be an ongoing scheduled maintenance window. Or maybe there is a big event coming up, a critical business time, or a holiday—or maybe you prefer not to make changes on a Friday night. - -![Street scene with a large calendar and people walking][2] - -([Curtis MacNewton][3], [CC BY-ND 2.0][4]) - -Whatever the reason, you want to signal this information to your automation platform and prevent the execution of periodic or ad-hoc tasks during specific time slots. In change management jargon, I am talking about specifying blackout windows when change activity should not occur. - -### Calendar integration in Ansible - -How can you accomplish this in [Ansible][5]? While it has no calendar function per se, Ansible's extensibility will allow it to integrate with any calendar application that has an API. - -The goal is this: Before you execute any automation or change activity, you execute a `pre-task` that checks whether something is already scheduled in the calendar (now or soon enough) and confirms you are not in the middle of a blocked timeslot. - -Imagine you have a fictitious module named `calendar`, and it can connect to a remote calendar, like Google Calendar, to determine if the time you specify has otherwise been marked as busy. You could write a playbook that looks like this: - - -``` -\- name: Check if timeslot is taken -  calendar: -    time: "{{ ansible_date_time.iso8601 }}" -  register: output -``` - -Ansible facts will give `ansible_date_time`, which is passed to the `calendar` module to verify the time availability so that it can register the response (`output`) to use in subsequent tasks. - -If your calendar looks like this: - -![Google Calendar screenshot][6] - -(Nicolas Leiva, [CC BY-SA 4.0][7]) - -Then the output of this task would highlight the fact this timeslot is taken (`busy: true`): - - -``` -ok: [localhost] => { -   "output": { -       "busy": true, -       "changed": false, -       "failed": false, -       "msg": "The timeslot 2020-09-02T17:53:43Z is busy: true" -   } -} -``` - -### Prevent tasks from running - -Next, [Ansible Conditionals][8] will help prevent the execution of any further tasks. As a simple example, you could use a `when` statement on the next task to enforce that it runs only when the field `busy` in the previous output is not `true`: - - -``` -tasks: -  - shell: echo "Run this only when not busy!" -    when: not output.busy -``` - -### Conclusion - -In a [previous article][9], I said Ansible is a framework to wire things together, interconnecting different building blocks to orchestrate an end-to-end automation workflow. - -This article looked at how playbooks can integrate or talk to a calendar application to check availability. However, I am just scratching the surface! For example, your tasks could also block a timeslot in the calendar… the sky is the limit. - -In my next article, I will dig into how the `calendar` module is built and how other programming languages can be used with Ansible. Stay tuned if you are a [Go][10] fan like me! - -* * * - -_This originally appeared on Medium as [Ansible and Google Calendar integration for change management][11] under a CC BY-SA 4.0 license and is republished with permission._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/10/calendar-ansible - -作者:[Nicolas Leiva][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://opensource.com/users/nicolas-leiva -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/calendar.jpg?itok=jEKbhvDT (Calendar close up snapshot) -[2]: https://opensource.com/sites/default/files/uploads/street-calendar.jpg (Street scene with a large calendar and people walking) -[3]: https://www.flickr.com/photos/7841127@N02/4217116202 -[4]: https://creativecommons.org/licenses/by-nd/2.0/ -[5]: https://docs.ansible.com/ansible/latest/index.html -[6]: https://opensource.com/sites/default/files/uploads/googlecalendarexample.png (Google Calendar screenshot) -[7]: https://creativecommons.org/licenses/by-sa/4.0/ -[8]: https://docs.ansible.com/ansible/latest/user_guide/playbooks_conditionals.html -[9]: https://medium.com/swlh/python-and-ansible-to-automate-a-network-security-workflow-28b9a44660c6 -[10]: https://golang.org/ -[11]: https://medium.com/swlh/ansible-and-google-calendar-integration-for-change-management-7c00553b3d5a diff --git a/translated/tech/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md b/translated/tech/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md new file mode 100644 index 0000000000..f3d0fde81b --- /dev/null +++ b/translated/tech/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md @@ -0,0 +1,111 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Integrate your calendar with Ansible to avoid schedule conflicts) +[#]: via: (https://opensource.com/article/20/10/calendar-ansible) +[#]: author: (Nicolas Leiva https://opensource.com/users/nicolas-leiva) + +将你的日历与 Ansible 集成,以避免与日程冲突 +====== +通过将一个日历应用集成到 Ansible 中来确保你的自动化工作流计划不会与其他东西冲突。 +![Calendar close up snapshot][1] + +”随时“是执行自动化工作流的好时机吗?答案可能是否定的,原因各不相同。 + +如果你希望避免同时进行更改,以最大限度地减少对关键业务流程的影响,并降低意外服务中断的风险,那么其他人不应该试图在你的自动化运行的同时进行更改。 + +在某些情况下,可能存在一个正在进行的计划维护窗口。 或者,可能有大型事件即将来临、一个关键的业务时间,或者假期,你或许不想在星期五晚上进行更改。 + +![Street scene with a large calendar and people walking][2] + +([Curtis MacNewton][3], [CC BY-ND 2.0][4]) + +无论出于什么原因,你都希望将此信息发送到你的自动化平台,并防止在特定时间段内执行周期或临时任务。在变更管理的行话中,我说的是当变更活动不应该发生时,指定封锁窗口。 + +### Ansible 中的日历集成 + +如何在 [Ansible][5] 中实现这个功能?虽然它本身没有日历功能,但 Ansible 的可扩展性将允许它与任何具有 API 的日历应用集成。 + +目标是这样的:在执行任何自动化或变更活动之前,你要执行一个 `pre-task` ,它会检查日历中是否已经安排了某些事情(目前或最近),并确认你没有在一个阻塞的时间段中。 + +想象一下,你有一个名为 `calendar` 的虚构模块,它可以连接到一个远程日历,比如 Google 日历,以确定你指定的时间是否已经以其他方式被标记为繁忙。你可以写一个类似这样的 playbook: + + +``` +\- name: Check if timeslot is taken +  calendar: +    time: "{{ ansible_date_time.iso8601 }}" +  register: output +``` + +Ansible 实际会给出 `ansible_date_time`,将其传递给 `calendar` 模块,以验证时间的可用性,以便它可以注册响应 (`output`),用于后续任务。 + +如果你的日历是这样的: + +![Google Calendar screenshot][6] + +(Nicolas Leiva, [CC BY-SA 4.0][7]) + +那么这个任务的输出就会高亮这个时间段被占用的事实 (`busy: true`): + + +``` +ok: [localhost] => { +   "output": { +       "busy": true, +       "changed": false, +       "failed": false, +       "msg": "The timeslot 2020-09-02T17:53:43Z is busy: true" +   } +} +``` + +### 阻止任务运行 + +接下来,[Ansible Conditionals][8] 将帮助阻止所有之后任务的执行。一个简单的例子,你可以在下一个任务上使用 `when` 语句来强制它只有当上一个输出中的 `busy` 字段不是 `true` 时,它才会运行: + + +``` +tasks: +  - shell: echo "Run this only when not busy!" +    when: not output.busy +``` + +### 总结 + +在[上一篇文章][9]中,我说过 Ansible 是一个将事物连接在一起的框架,将不同的构建相互连接,以协调端到端自动化工作流。 + +这篇文章探讨了 playbook 如何与日历应用集成以检查可用性。然而,我只做了一些表面工作!例如,你的任务也可以阻止日历中的一个时间段,这里的发挥空间很大。 + +在我的下一篇文章中,我将深入 `calendar` 模块是如何构建的,以及其他编程语言如何与 Ansible 一起使用。如果你和我一样是 [Go][10] 的粉丝,请继续关注! + +* * * + +_这篇文章最初发表在 Medium 上,名为 [Ansible and Google Calendar integration for change management][11],采用 CC BY-SA 4.0 许可,经许可后转载。_ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/calendar-ansible + +作者:[Nicolas Leiva][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/nicolas-leiva +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/calendar.jpg?itok=jEKbhvDT (Calendar close up snapshot) +[2]: https://opensource.com/sites/default/files/uploads/street-calendar.jpg (Street scene with a large calendar and people walking) +[3]: https://www.flickr.com/photos/7841127@N02/4217116202 +[4]: https://creativecommons.org/licenses/by-nd/2.0/ +[5]: https://docs.ansible.com/ansible/latest/index.html +[6]: https://opensource.com/sites/default/files/uploads/googlecalendarexample.png (Google Calendar screenshot) +[7]: https://creativecommons.org/licenses/by-sa/4.0/ +[8]: https://docs.ansible.com/ansible/latest/user_guide/playbooks_conditionals.html +[9]: https://medium.com/swlh/python-and-ansible-to-automate-a-network-security-workflow-28b9a44660c6 +[10]: https://golang.org/ +[11]: https://medium.com/swlh/ansible-and-google-calendar-integration-for-change-management-7c00553b3d5a From 7430d813b052fe7e422e419251144b59cdf6c5c3 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 14 Oct 2020 08:58:56 +0800 Subject: [PATCH 0444/1156] translating --- ...2 How to Free Up Space in -boot Partition on Ubuntu Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md b/sources/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md index 6b0c1b7810..5e839a64a7 100644 --- a/sources/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md +++ b/sources/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From c85fb25a5d05962266d23fc9de80b4d6e51b9875 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 14 Oct 2020 09:00:22 +0800 Subject: [PATCH 0445/1156] Revert "translating" This reverts commit 7430d813b052fe7e422e419251144b59cdf6c5c3. --- ...2 How to Free Up Space in -boot Partition on Ubuntu Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md b/sources/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md index 5e839a64a7..6b0c1b7810 100644 --- a/sources/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md +++ b/sources/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (geekpi) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 44c55a8f6219688ad3a7e0582c78abe60e3ad863 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 14 Oct 2020 09:04:04 +0800 Subject: [PATCH 0446/1156] translating --- sources/tech/20201013 Install MariaDB or MySQL on Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201013 Install MariaDB or MySQL on Linux.md b/sources/tech/20201013 Install MariaDB or MySQL on Linux.md index 458b6dc913..c12bdf214f 100644 --- a/sources/tech/20201013 Install MariaDB or MySQL on Linux.md +++ b/sources/tech/20201013 Install MariaDB or MySQL on Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 790f35a59d5a41e726deb9bd526bd28c0183f8e8 Mon Sep 17 00:00:00 2001 From: beamrolling <33046439+beamrolling@users.noreply.github.com> Date: Wed, 14 Oct 2020 10:32:36 +0800 Subject: [PATCH 0447/1156] Translating --- sources/talk/20181218 The Rise and Demise of RSS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20181218 The Rise and Demise of RSS.md b/sources/talk/20181218 The Rise and Demise of RSS.md index e260070c5c..2dfea2074c 100644 --- a/sources/talk/20181218 The Rise and Demise of RSS.md +++ b/sources/talk/20181218 The Rise and Demise of RSS.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (beamrolling) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 4197bfbe755a5456e7ed2e633483226e475d6a85 Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Wed, 14 Oct 2020 17:38:20 +0800 Subject: [PATCH 0448/1156] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=AF=91=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...tall Deepin Desktop on Ubuntu 20.04 LTS.md | 61 ++++++++++--------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/sources/tech/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md b/sources/tech/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md index 5ef25c8ef5..8d9bd00e6e 100644 --- a/sources/tech/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md +++ b/sources/tech/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md @@ -7,40 +7,41 @@ [#]: via: (https://itsfoss.com/install-deepin-ubuntu/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -How to Install Deepin Desktop on Ubuntu 20.04 LTS +如何在 Ubuntu 20.04 LTS 上安装 Deepin 桌面 ====== -_**This tutorial shows you the proper steps to install the Deepin desktop environment on Ubuntu. Removal steps are also mentioned.**_ +_**本教程向您展示在 Ubuntu 上安装 Deepin 桌面环境的正确步骤。还提到了移除步骤。**_ -Deepin is undoubtedly a [beautiful Linux distribution][1]. The recently released [Deepin version 20][2] makes it even more beautiful. +毫无疑问,Deepin 是一个 [漂亮的 Linux 发行版][1]。最近发布的 [Deepin version 20][2] 让它更加美观了。 -Now, [Deepin Linux][3] is based on [Debian][4] and the default repository mirrors are too slow. If you would rather stay with Ubuntu, you have the Deepin variant of Ubuntu in the form [UbuntuDDE Linux distribution][5]. It is not one of the [official Ubuntu flavors][6] yet. +现在,[Deepin Linux][3] 是基于 [Debian][4] 的,默认的存储库镜像太慢了。如果您更愿意使用 Ubuntu,可以选择 [UbuntuDDE Linux 发行版][5] 形式的 Ubuntu 的 Deepin 变体。它还不是 [官方的 Ubuntu 风格][6] 之一。 -[Reinstalling a new distribution][7] is a bit of annoyances for you would lose the data and you’ll have to reinstall your applications on the newly installed UbuntuDDE. +[重新安装新的发行版][7] 是一个麻烦,因为您会丢失数据,您将不得不在新安装的 UbuntuDDE 上重新安装您的应用程序。 -A simpler option is to install Deepin desktop environment on your existing Ubuntu system. After all you can easily install more than one [desktop environment][8] in one system. +一个更简单的选择是在现有的 Ubuntu 系统上安装 Deepin 桌面环境。毕竟,您可以轻松地在一个系统中安装多个 [桌面环境][8]。 -Fret not, it is easy to do it and you can also revert the changes if you do not like it. Let me show you how to do that. +不要烦恼,这很容易做到,如果您不喜欢,也可以恢复这些更改。让我来告诉你怎么做。 -### Installing Deepin Desktop on Ubuntu 20.04 +### 在 Ubuntu 20.04 上安装 Deepin 桌面 ![][9] -The UbuntuDDE team has created a PPA for their distribution and you can use the same PPA to install Deepin desktop on Ubuntu 20.04. Keep in mind that this PPA is only available for Ubuntu 20.04. Please read about [using PPA in Ubuntu][10]. -No Deepin version 20 +UbuntuDDE 团队已为他们的发行版创建了一个 PPA,您可以使用相同的 PPA 在 Ubuntu 20.04 上安装 Deepin 桌面。请记住,此 PPA 仅适用于 Ubuntu 20.04。请阅读有关 [在 Ubuntu 中使用 PPA][10]。 -The Deepin desktop you’ll be installing using the PPA here is NOT the new Deepin desktop version 20 yet. It will probably be there after Ubuntu 20.10 release but we cannot promise anything. +没有 Deepin 版本 20 -Here are the steps that you need to follow: +您将在此处使用 PPA 安装的 Deepin 桌面还不是新的 Deepin 桌面版本 20。它可能会在 Ubuntu 20.10 发布后出现,但是我们不能保证任何事情。 -**Step 1**: You need to first add the [official PPA by Ubuntu DDE Remix team][11] by typing this on the terminal: +以下是您需要遵循的步骤: + +**步骤 1**:您需要首先在终端上输入以下内容,来添加 [Ubuntu DDE Remix 团队的官方 PPA][11]: ``` sudo add-apt-repository ppa:ubuntudde-dev/stable ``` -**Step 2**: Once you have added the repository, proceed with installing the Deepin desktop. +**步骤 2**:添加存储库以后,继而安装 Deepin 桌面。 ``` sudo apt install ubuntudde-dde @@ -48,31 +49,32 @@ sudo apt install ubuntudde-dde ![][12] -Now, the installation will start and after a while, you will be asked to choose the display manager. +现在,安装将启动,一段时间后,将要求您选择显示管理器display manager。 ![][13] -You need to select “**lightdm**” if you want Deepin desktop themed lock screen. If not, you can set it as “**gdm3**“. +如果需要深度桌面主题的锁屏,则需要选择 “**lightdm**”。如果不需要,您可以将其设置为 “**gdm3**”。 -In case you don’t see this option, you can get it by typing the following command and then select your preferred display manager: +如果您看不到此选项,可以通过键入以下命令来获得它,然后选择您首选的显示管理器: ``` sudo dpkg-reconfigure lightdm ``` -**Step 3:** Once done, you have to log out and log in again by choosing the “**Deepin**” session or just reboot the system. +**步骤 3**: 完成后,您必须退出并通过选择 “**Deepin**” 会话再次登录,或者重新启动系统。 ![][14] -And, that is it. Enjoy the Deepin experience on your Ubuntu 20.04 LTS system in no time! + +就是这样。马上在您的 Ubuntu 20.04 LTS 系统上享受深度体验吧! ![][15] -### Removing Deepin desktop from Ubuntu 20.04 +### 从 Ubuntu 20.04 删除 Deepin 桌面 -In case, you don’t like the experience or of it is buggy for some reason, you can remove it by following the steps below. +如果您不喜欢这种体验,或者由于某些原因它有 bug,可以按照以下步骤将其删除。 -**Step 1:** If you’ve set “lightdm” as your display manager, you need to set the display manager as “gdm3” before uninstalling Deepin. To do that, type in the following command: +**步骤 1**: 如果您已将 “lightdm” 设置为显示管理器,则需要在卸载 Deepin 之前将显示管理器设置为 “gdm3”。为此,请键入以下命令: ``` sudo dpkg-reconfigure lightdm @@ -80,25 +82,26 @@ sudo dpkg-reconfigure lightdm ![Select gdm3 on this screen][13] -And, select **gdm3** to proceed. +然后,选择 **gdm3** 继续。 -Once you’re done with that, you can simply enter the following command to remove Deepin completely: +完成此操作后,您只需输入以下命令即可完全删除 Deepin: ``` sudo apt remove startdde ubuntudde-dde ``` -You can just reboot to get back to your original Ubuntu desktop. In case the icons become unresponsive, you just open the terminal (**CTRL + ALT + T**) and type in: +您只需重启即可回到原来的 Ubuntu 桌面。如果图标没有响应,只需打开终端(**CTRL + ALT + T**)并输入: + ``` reboot ``` -**Wrapping Up** +**总结** -It is good to have different [choices of desktop environments][16]. If you really like Deepin desktop interface, this could be a way to experience Deepin on Ubuntu. +有不同的 [桌面环境选择][16] 是件好事。如果您真的喜欢 Deepin 桌面界面,那么这可能是在 Ubuntu 上体验 Deepin 的一种方式。 -If you have questions or if you face any issues, please let me know in the comments. +如果您有任何疑问或遇到任何问题,请在评论中告诉我。 -------------------------------------------------------------------------------- @@ -106,7 +109,7 @@ via: https://itsfoss.com/install-deepin-ubuntu/ 作者:[Ankush Das][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[gxlct008](https://github.com/gxlct008) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 219d651b59b6fec210951deb1ed7cdefb5504a83 Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Wed, 14 Oct 2020 17:41:26 +0800 Subject: [PATCH 0449/1156] =?UTF-8?q?=E5=B0=86=E8=AF=91=E6=96=87=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E5=88=B0=20translated/tech/=20=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md (100%) diff --git a/sources/tech/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md b/translated/tech/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md similarity index 100% rename from sources/tech/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md rename to translated/tech/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md From 789f94ca5eb3e363174202acafeb13eedb3eeb9c Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Wed, 14 Oct 2020 17:59:48 +0800 Subject: [PATCH 0450/1156] Create 20201012 Could Microsoft be en route to dumping Windows in favor of Linux? --- ...oute to dumping Windows in favor of Linux? | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 sources/tech/20201012 Could Microsoft be en route to dumping Windows in favor of Linux? diff --git a/sources/tech/20201012 Could Microsoft be en route to dumping Windows in favor of Linux? b/sources/tech/20201012 Could Microsoft be en route to dumping Windows in favor of Linux? new file mode 100644 index 0000000000..5d85d6897c --- /dev/null +++ b/sources/tech/20201012 Could Microsoft be en route to dumping Windows in favor of Linux? @@ -0,0 +1,88 @@ +[#]: collector: (wxy) +[#]: translator: (gxlct008) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Could Microsoft be en route to dumping Windows in favor of Linux?) +[#]: via: (https://www.techrepublic.com/article/could-microsoft-be-en-route-to-dumping-windows-in-favor-of-linux/) +[#]: author: (Jack Wallen https://www.techrepublic.com/meet-the-team/us/jack-wallen/) + +微软能否放弃 Windows 转向 Linux? +====== + + +Jack Wallen 认为,Microsoft Linux 是 Microsoft 桌面操作系统的下一个次演进方向。他解释了为什么这将是一个对 Microsoft、IT 专业人士、用户和 Linux 社区的双赢。 + +![](https://tr1.cbsistatic.com/hub/i/r/2014/08/20/123daeb8-d6ce-4f0b-986e-225d55bf12e3/resize/770x/a693d56694587dbe5d025db7b8d79c48/linux-and-windows.jpg) + + +我尊敬的同事 Steven J. Vaughan-Nichols 在姊妹网站 ZDNet 上发表了一篇出色的文章,名为 [《基于 Linux 的 Windows 非常有意义》][1],他在文中讨论了 Eric S. Raymond 的观点,即我们正接近桌面战争的最后阶段。Vaughan-Nichols 假设下一个合乎逻辑的步骤是在 Linux 内核上运行的 Windows 界面。 + + +这是有道理的,尤其是考虑到微软在 [Windows Subsystem for Linux][2] 上的努力。然而,从我过去几年所目睹的一切来看,我认为可以得出一个对微软更有意义的结论。 + +请参阅:[Microsoft Build 2020 亮点][3] (TechRepublic Premium)。 + +## Microsoft Linux: 为什么它是最好的解决方案 +一度,微软的最大摇钱树是软件——确切地说是 Windows 和 Microsoft Office。但是,就像科技行业中的所有事物一样,进化也在发生。拒绝进化的科技公司失败了。 + +微软明白这一点,并且它已经进化了。一个恰当的例子是:[Microsoft Azure][4]。微软的云计算服务,以及 [AWS][5] 和 [Google Cloud][6] 已经成为这个不断变化的行业的巨大推动力。Azure 已成为微软新世界的摇钱树——如此之多,以至于这家在桌面电脑市场上享有垄断地位的公司已经开始意识到,或许还有更好的方式来利用台式机。 + +这种优势很容易通过 Linux 来实现,但不是您可能想到的 Linux。Vaughan-Nichols 所建议的 Linux 对于微软来说可能是一个很好的垫脚石,但我相信该公司需要做出一个更大的飞跃。我说的是登月规模的飞跃——这将使所有参与者的生活变得更加轻松。 + +我说的是深入 Linux 领域。忘掉在 Linux 内核上运行的 [Windows 10][7] 接口的桌面版本吧,最后承认 Microsoft Linux 可能是当今世界的最佳解决方案。 + +微软发布一个完整的 Linux 发行版将对所有参与者来说意味着更少的挫败感。微软可以将其在 Windows 10 桌面系统上的开发工作转移到一个更稳定、更可靠、更灵活、更经考验的桌面系统上来。微软可以从任意数量的桌面系统中选择自己的官方风格:GNOM、KD、Pantheon、Xfce、Mint、Cinnamon... 清单不胜枚举。 微软可以按原样使用桌面,也可以为它们做出贡献,创造一些更符合用户习惯的东西。 + +## 开发:微软并没有摆脱困境 +这并不意味着微软在开发方面将摆脱困境。微软还希望对 Wine 做出重大贡献,以确保其所有产品均可在兼容层上顺畅运行,并且默认集成到操作系统中,这样最终用户就不必为安装 Windows 应用程序做任何额外的工作。 + +## Windows 用户需要 Defender +微软开发团队也希望将 Windows Defender 移植到这个新的发行版中。等一等。什么?我真的是在暗示 MS Linux 需要 Windows Defender 吗? 是的,我确定。为什么? + +最终用户仍然需要防范 [网络钓鱼][8] 诈骗phishing scams、恶意 URL 和其他类型的攻击。普通的 Windows 用户可能没有意识到,Linux 和安全使用实践的结合比 Windows 10 和 Windows Defender 要安全得多。所以,是的,将 Windows Defender 移植到 Microsoft Linux 将是保持用户基础舒适的一个很好的步骤。 + +这些用户将很快了解在台式计算机上工作的感觉,而不必处理 Windows 操作系统带来的日常困扰。更新更流畅、更值得信赖、更安全,桌面更有意义。 + +请参阅:[Linux 管理员需要了解的有关使用命令行工作的所有信息][9](TechRepublic Premium) + +## 微软、用户和 IT 专业人士的双赢 +微软一直在尽其所能将用户从标准的基于客户端的软件迁移到云和其他托管解决方案,并且其软件摇钱树已经变成了以网络为中心和基于订阅的软件。所有这些 Linux 用户仍然可以使用 [Microsoft 365][10] 和它必须提供的任何其他 [软件即服务(SaaS)][11]Software as a Service 解决方案——所有这些都来自于 Linux 操作系统的舒适性和安全性。 + +这对微软和消费者而言是双赢的,因为 Windows 并不是一个让人头疼的问题(通过漏洞搜索和对其专有解决方案进行安全补丁),消费者可以得到一个更可靠的解决方案而不会错过任何东西。 +如果微软打对了牌,他们可以对 KDE 或几乎任何 Linux 桌面重新设置主题,使其与 Windows 10 界面没有太大区别。 + +正确地安排这一点,消费者甚至可能都不知道其中的区别——“Windows 11” 将仅仅是 Microsoft 桌面操作系统的下一个演进版本。 + +说到胜利,IT 专业人员将花费更少的时间来处理病毒、恶意软件和操作系统问题,而把更多的时间用于保持网络(以及为该网络供动力的服务器)的运行和安全上。 + +## 大卖场怎么办? +这是橡胶遇到道路的地方。为了让这个功能真正发挥作用,微软将不得不完全放弃 Windows,转而使用自己风格的 Linux。基于同样的思路,微软需要确保大卖场里的 PC 都安装了 Microsoft Linux 系统。不可能有折中措施的余地——微软必须全力以赴,以确保这种过渡成功。 + +一旦大卖场开始销售安装了 Microsoft Linux 的 PC 和笔记本电脑,我预测这一举措对所有相关人员来说将会是一个巨大的成功。微软最终将被视为最终推出了一款值得消费者信赖的操作系统;消费者将拥有一个这样的桌面操作系统,它不会带来太多令人头疼的事情,而会带来真正的生产力和乐趣; Linux 社区最终将主导桌面。 + +## Microsoft Linux:现在是时候了 +你可能会认为这个想法很疯狂,但如果你真的仔细想想,微软 Windows 的演进就是朝着这个方向发展的。为什么不绕过这个时间线的中途部分,而直接跳到一个为所有参与者带来成功的终极游戏呢? 现在是 Microsoft Linux 的时候了。 + +via: https://www.techrepublic.com/article/could-microsoft-be-en-route-to-dumping-windows-in-favor-of-linux/ + +作者:[jack-wallen][a] +选题:[wxy][b] +译者:[gxlct008](https://github.com/gxlct008) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.techrepublic.com/meet-the-team/us/jack-wallen/ +[b]: https://github.com/wxy +[1]: https://www.zdnet.com/article/linux-based-windows-makes-perfect-sense/ +[2]: https://www.techrepublic.com/article/microsoft-older-windows-10-versions-now-get-to-run-windows-subsystem-for-linux-2/ +[3]: https://www.techrepublic.com/resource-library/whitepapers/microsoft-build-2020-highlights/ +[4]: https://www.techrepublic.com/article/microsoft-azure-the-smart-persons-guide/ +[5]: https://www.techrepublic.com/article/amazon-web-services-the-smart-persons-guide/ +[6]: https://www.techrepublic.com/article/google-cloud-platform-the-smart-persons-guide/ +[7]: https://www.techrepublic.com/article/windows-10-the-smart-persons-guide/ +[8]: https://www.techrepublic.com/article/phishing-and-spearphishing-a-cheat-sheet/ +[9]: https://www.techrepublic.com/article/everything-a-linux-admin-needs-to-know-about-working-from-the-command-line/ +[10]: https://www.techrepublic.com/article/microsoft-365-a-cheat-sheet/ +[11]: https://www.techrepublic.com/article/software-as-a-service-saas-a-cheat-sheet/ From a6ff51dc6bbd0fd0b7883cb64eb59586d9daa241 Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Wed, 14 Oct 2020 18:01:10 +0800 Subject: [PATCH 0451/1156] =?UTF-8?q?=E5=B0=86=E8=AF=91=E6=96=87=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E5=88=B0=20translated/tech/=20=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ld Microsoft be en route to dumping Windows in favor of Linux? | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20201012 Could Microsoft be en route to dumping Windows in favor of Linux? (100%) diff --git a/sources/tech/20201012 Could Microsoft be en route to dumping Windows in favor of Linux? b/translated/tech/20201012 Could Microsoft be en route to dumping Windows in favor of Linux? similarity index 100% rename from sources/tech/20201012 Could Microsoft be en route to dumping Windows in favor of Linux? rename to translated/tech/20201012 Could Microsoft be en route to dumping Windows in favor of Linux? From 62f4df93ee5dba0962e7e255cec6c18ec9576f52 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 14 Oct 2020 21:35:57 +0800 Subject: [PATCH 0452/1156] Rename sources/tech/20201014 KDE Plasma 5.20 is Here With Exciting Improvements.md to sources/news/20201014 KDE Plasma 5.20 is Here With Exciting Improvements.md --- ...20201014 KDE Plasma 5.20 is Here With Exciting Improvements.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20201014 KDE Plasma 5.20 is Here With Exciting Improvements.md (100%) diff --git a/sources/tech/20201014 KDE Plasma 5.20 is Here With Exciting Improvements.md b/sources/news/20201014 KDE Plasma 5.20 is Here With Exciting Improvements.md similarity index 100% rename from sources/tech/20201014 KDE Plasma 5.20 is Here With Exciting Improvements.md rename to sources/news/20201014 KDE Plasma 5.20 is Here With Exciting Improvements.md From 691b813065b5e92103ed411be3fd8f8bdb1cf902 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 14 Oct 2020 23:23:56 +0800 Subject: [PATCH 0453/1156] PRF @gxlct008 --- ... to dumping Windows in favor of Linux?.md} | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) rename translated/tech/{20201012 Could Microsoft be en route to dumping Windows in favor of Linux? => 20201012 Could Microsoft be en route to dumping Windows in favor of Linux?.md} (51%) diff --git a/translated/tech/20201012 Could Microsoft be en route to dumping Windows in favor of Linux? b/translated/tech/20201012 Could Microsoft be en route to dumping Windows in favor of Linux?.md similarity index 51% rename from translated/tech/20201012 Could Microsoft be en route to dumping Windows in favor of Linux? rename to translated/tech/20201012 Could Microsoft be en route to dumping Windows in favor of Linux?.md index 5d85d6897c..e16cff3f75 100644 --- a/translated/tech/20201012 Could Microsoft be en route to dumping Windows in favor of Linux? +++ b/translated/tech/20201012 Could Microsoft be en route to dumping Windows in favor of Linux?.md @@ -1,6 +1,6 @@ [#]: collector: (wxy) [#]: translator: (gxlct008) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Could Microsoft be en route to dumping Windows in favor of Linux?) @@ -10,66 +10,66 @@ 微软能否放弃 Windows 转向 Linux? ====== - -Jack Wallen 认为,Microsoft Linux 是 Microsoft 桌面操作系统的下一个次演进方向。他解释了为什么这将是一个对 Microsoft、IT 专业人士、用户和 Linux 社区的双赢。 +> Jack Wallen 认为,Microsoft Linux 是 Microsoft 桌面操作系统的下一个演进方向。他解释了为什么这将是一个对 Microsoft、IT 专业人士、用户和 Linux 社区的双赢。 ![](https://tr1.cbsistatic.com/hub/i/r/2014/08/20/123daeb8-d6ce-4f0b-986e-225d55bf12e3/resize/770x/a693d56694587dbe5d025db7b8d79c48/linux-and-windows.jpg) +我尊敬的同事 Steven J. Vaughan-Nichols 在姊妹网站 ZDNet 上发表了一篇出色的文章,名为《[基于 Linux 的 Windows 非常有意义][1]》,他在文中讨论了 Eric S. Raymond 的[观点](https://linux.cn/article-12664-1.html),即我们正接近桌面战争的最后阶段。Vaughan-Nichols 猜测,下一个合乎逻辑的步骤是在 Linux 内核上运行的 Windows 界面。 -我尊敬的同事 Steven J. Vaughan-Nichols 在姊妹网站 ZDNet 上发表了一篇出色的文章,名为 [《基于 Linux 的 Windows 非常有意义》][1],他在文中讨论了 Eric S. Raymond 的观点,即我们正接近桌面战争的最后阶段。Vaughan-Nichols 假设下一个合乎逻辑的步骤是在 Linux 内核上运行的 Windows 界面。 +这是有道理的,尤其是考虑到微软在 [Windows 的 Linux 子系统(WSL)][2] 上的努力。然而,从我过去几年所目睹的一切来看,我认为可以得出一个对微软更有意义的结论。 +### Microsoft Linux: 为什么它是最好的解决方案 -这是有道理的,尤其是考虑到微软在 [Windows Subsystem for Linux][2] 上的努力。然而,从我过去几年所目睹的一切来看,我认为可以得出一个对微软更有意义的结论。 +一度,微软的最大摇钱树是软件,确切地说是 Windows 和 Microsoft Office。但是,就像科技行业中的所有事物一样,进化也在发生,而拒绝进化的科技公司失败了。 -请参阅:[Microsoft Build 2020 亮点][3] (TechRepublic Premium)。 +微软明白这一点,并且它已经进化了。一个恰当的例子是:[Microsoft Azure][4]。微软的云计算服务,以及 [AWS][5] 和 [Google Cloud][6] 已经成为这个不断变化的行业的巨大推动力。Azure 已成为微软新世界的摇钱树 —— 多到以至于这家在桌面电脑市场上享有垄断地位的公司已经开始意识到,或许还有更好的方式来利用桌面计算机。 -## Microsoft Linux: 为什么它是最好的解决方案 -一度,微软的最大摇钱树是软件——确切地说是 Windows 和 Microsoft Office。但是,就像科技行业中的所有事物一样,进化也在发生。拒绝进化的科技公司失败了。 +这种优势很容易通过 Linux 来实现,但不是你可能想到的 Linux。Vaughan-Nichols 所建议的 Microsoft Linux 对于微软来说可能是一个很好的垫脚石,但我相信该公司需要做出一个更大的飞跃。我说的是登月规模的飞跃 —— 这将使所有参与者的生活变得更加轻松。 -微软明白这一点,并且它已经进化了。一个恰当的例子是:[Microsoft Azure][4]。微软的云计算服务,以及 [AWS][5] 和 [Google Cloud][6] 已经成为这个不断变化的行业的巨大推动力。Azure 已成为微软新世界的摇钱树——如此之多,以至于这家在桌面电脑市场上享有垄断地位的公司已经开始意识到,或许还有更好的方式来利用台式机。 +我说的是深入 Linux 领域。忘掉在 Linux 内核上运行 [Windows 10][7] 界面的桌面版本吧,最后承认 Microsoft Linux 可能是当今世界的最佳解决方案。 -这种优势很容易通过 Linux 来实现,但不是您可能想到的 Linux。Vaughan-Nichols 所建议的 Linux 对于微软来说可能是一个很好的垫脚石,但我相信该公司需要做出一个更大的飞跃。我说的是登月规模的飞跃——这将使所有参与者的生活变得更加轻松。 +微软发布一个完整的 Linux 发行版将对所有参与者来说意味着更少的挫败感。微软可以将其在 Windows 10 桌面系统上的开发工作转移到一个更稳定、更可靠、更灵活、更经考验的桌面系统上来。微软可以从任意数量的桌面系统中选择自己的官方风格:GNOME、KDE、Pantheon、Xfce、Mint、Cinnamon... 不胜枚举。微软可以按原样使用桌面,也可以为它们做出贡献,创造一些更符合用户习惯的东西。 -我说的是深入 Linux 领域。忘掉在 Linux 内核上运行的 [Windows 10][7] 接口的桌面版本吧,最后承认 Microsoft Linux 可能是当今世界的最佳解决方案。 +### 开发:微软并没有摆脱困境 -微软发布一个完整的 Linux 发行版将对所有参与者来说意味着更少的挫败感。微软可以将其在 Windows 10 桌面系统上的开发工作转移到一个更稳定、更可靠、更灵活、更经考验的桌面系统上来。微软可以从任意数量的桌面系统中选择自己的官方风格:GNOM、KD、Pantheon、Xfce、Mint、Cinnamon... 清单不胜枚举。 微软可以按原样使用桌面,也可以为它们做出贡献,创造一些更符合用户习惯的东西。 +这并不意味着微软在开发方面将摆脱困境。微软也希望对 Wine 做出重大贡献,以确保其所有产品均可在兼容层上顺畅运行,并且默认集成到操作系统中,这样最终用户就不必为安装 Windows 应用程序做任何额外的工作。 -## 开发:微软并没有摆脱困境 -这并不意味着微软在开发方面将摆脱困境。微软还希望对 Wine 做出重大贡献,以确保其所有产品均可在兼容层上顺畅运行,并且默认集成到操作系统中,这样最终用户就不必为安装 Windows 应用程序做任何额外的工作。 +### Windows 用户需要 Defender -## Windows 用户需要 Defender -微软开发团队也希望将 Windows Defender 移植到这个新的发行版中。等一等。什么?我真的是在暗示 MS Linux 需要 Windows Defender 吗? 是的,我确定。为什么? +微软开发团队也希望将 Windows Defender 移植到这个新的发行版中。等一等。什么?我真的是在暗示 Microsoft Linux 需要 Windows Defender 吗?是的,我确定。为什么? -最终用户仍然需要防范 [网络钓鱼][8] 诈骗phishing scams、恶意 URL 和其他类型的攻击。普通的 Windows 用户可能没有意识到,Linux 和安全使用实践的结合比 Windows 10 和 Windows Defender 要安全得多。所以,是的,将 Windows Defender 移植到 Microsoft Linux 将是保持用户基础舒适的一个很好的步骤。 +最终用户仍然需要防范 [网络钓鱼][8] 诈骗phishing scams、恶意 URL 和其他类型的攻击。普通的 Windows 用户可能不会意识到,Linux 和安全使用实践的结合远比 Windows 10 和 Windows Defender 要安全得多。所以,是的,将 Windows Defender 移植到 Microsoft Linux 将是保持用户基础舒适的一个很好的步骤。 这些用户将很快了解在台式计算机上工作的感觉,而不必处理 Windows 操作系统带来的日常困扰。更新更流畅、更值得信赖、更安全,桌面更有意义。 -请参阅:[Linux 管理员需要了解的有关使用命令行工作的所有信息][9](TechRepublic Premium) +### 微软、用户和 IT 专业人士的双赢 -## 微软、用户和 IT 专业人士的双赢 -微软一直在尽其所能将用户从标准的基于客户端的软件迁移到云和其他托管解决方案,并且其软件摇钱树已经变成了以网络为中心和基于订阅的软件。所有这些 Linux 用户仍然可以使用 [Microsoft 365][10] 和它必须提供的任何其他 [软件即服务(SaaS)][11]Software as a Service 解决方案——所有这些都来自于 Linux 操作系统的舒适性和安全性。 +微软一直在尽其所能将用户从标准的基于客户端的软件迁移到云和其他托管解决方案,并且其软件摇钱树已经变成了以网络为中心和基于订阅的软件。所有这些 Linux 用户仍然可以使用 [Microsoft 365][10] 和它必须提供的任何其他 [软件即服务][11]Software as a Service(SaaS)解决方案——所有这些都来自于 Linux 操作系统的舒适性和安全性。 -这对微软和消费者而言是双赢的,因为 Windows 并不是一个让人头疼的问题(通过漏洞搜索和对其专有解决方案进行安全补丁),消费者可以得到一个更可靠的解决方案而不会错过任何东西。 -如果微软打对了牌,他们可以对 KDE 或几乎任何 Linux 桌面重新设置主题,使其与 Windows 10 界面没有太大区别。 +这对微软和消费者而言是双赢的,因为这样 Windows 没有那么多令人头疼的事情要处理(通过捕获漏洞和对其专有解决方案进行安全补丁),消费者可以得到一个更可靠的解决方案而不会错过任何东西。 +如果微软打对了牌,他们可以对 KDE 或几乎任何 Linux 桌面环境重新设置主题,使其与 Windows 10 界面没有太大区别。 -正确地安排这一点,消费者甚至可能都不知道其中的区别——“Windows 11” 将仅仅是 Microsoft 桌面操作系统的下一个演进版本。 +如果布局得当,消费者甚至可能都不知道其中的区别——“Windows 11” 将仅仅是 Microsoft 桌面操作系统的下一个演进版本。 说到胜利,IT 专业人员将花费更少的时间来处理病毒、恶意软件和操作系统问题,而把更多的时间用于保持网络(以及为该网络供动力的服务器)的运行和安全上。 -## 大卖场怎么办? -这是橡胶遇到道路的地方。为了让这个功能真正发挥作用,微软将不得不完全放弃 Windows,转而使用自己风格的 Linux。基于同样的思路,微软需要确保大卖场里的 PC 都安装了 Microsoft Linux 系统。不可能有折中措施的余地——微软必须全力以赴,以确保这种过渡成功。 +### 大卖场怎么办? -一旦大卖场开始销售安装了 Microsoft Linux 的 PC 和笔记本电脑,我预测这一举措对所有相关人员来说将会是一个巨大的成功。微软最终将被视为最终推出了一款值得消费者信赖的操作系统;消费者将拥有一个这样的桌面操作系统,它不会带来太多令人头疼的事情,而会带来真正的生产力和乐趣; Linux 社区最终将主导桌面。 +这是个关键的地方。为了让这一做法真正发挥作用,微软将不得不完全放弃 Windows,转而使用自己风格的 Linux。基于同样的思路,微软需要确保大卖场里的 PC 都安装了 Microsoft Linux 系统。没有半途而废的余地——微软必须全力以赴,以确保这次转型的成功。 -## Microsoft Linux:现在是时候了 -你可能会认为这个想法很疯狂,但如果你真的仔细想想,微软 Windows 的演进就是朝着这个方向发展的。为什么不绕过这个时间线的中途部分,而直接跳到一个为所有参与者带来成功的终极游戏呢? 现在是 Microsoft Linux 的时候了。 +一旦大卖场开始销售安装了 Microsoft Linux 的 PC 和笔记本电脑,我预测这一举措对所有相关人员来说将会是一个巨大的成功。微软会被视为终于推出了一款值得消费者信赖的操作系统;消费者将拥有一个这样的桌面操作系统,它不会带来太多令人头疼的事情,而会带来真正的生产力和乐趣;Linux 社区最终将主导桌面计算机。 +### Microsoft Linux:时机已到 + +你可能会认为这个想法很疯狂,但如果你真的仔细想想,微软 Windows 的演进就是朝着这个方向发展的。为什么不绕过这个时间线的中途部分,而直接跳到一个为所有参与者带来成功的终极游戏呢? Microsoft Linux 正当其时。 + +--- via: https://www.techrepublic.com/article/could-microsoft-be-en-route-to-dumping-windows-in-favor-of-linux/ 作者:[jack-wallen][a] 选题:[wxy][b] 译者:[gxlct008](https://github.com/gxlct008) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 3c367728c278e8283f32c268d08bc9c16984b9d8 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 14 Oct 2020 23:24:36 +0800 Subject: [PATCH 0454/1156] PUB @gxlct008 https://linux.cn/article-12718-1.html --- ...osoft be en route to dumping Windows in favor of Linux?.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201012 Could Microsoft be en route to dumping Windows in favor of Linux?.md (99%) diff --git a/translated/tech/20201012 Could Microsoft be en route to dumping Windows in favor of Linux?.md b/published/20201012 Could Microsoft be en route to dumping Windows in favor of Linux?.md similarity index 99% rename from translated/tech/20201012 Could Microsoft be en route to dumping Windows in favor of Linux?.md rename to published/20201012 Could Microsoft be en route to dumping Windows in favor of Linux?.md index e16cff3f75..db061a927a 100644 --- a/translated/tech/20201012 Could Microsoft be en route to dumping Windows in favor of Linux?.md +++ b/published/20201012 Could Microsoft be en route to dumping Windows in favor of Linux?.md @@ -1,8 +1,8 @@ [#]: collector: (wxy) [#]: translator: (gxlct008) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12718-1.html) [#]: subject: (Could Microsoft be en route to dumping Windows in favor of Linux?) [#]: via: (https://www.techrepublic.com/article/could-microsoft-be-en-route-to-dumping-windows-in-favor-of-linux/) [#]: author: (Jack Wallen https://www.techrepublic.com/meet-the-team/us/jack-wallen/) From 2a1c891a7b37b190446e1597e6d8727dc46d616f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 14 Oct 2020 23:25:02 +0800 Subject: [PATCH 0455/1156] PUB --- ...Microsoft be en route to dumping Windows in favor of Linux.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename published/{20201012 Could Microsoft be en route to dumping Windows in favor of Linux?.md => 20201012 Could Microsoft be en route to dumping Windows in favor of Linux.md} (100%) diff --git a/published/20201012 Could Microsoft be en route to dumping Windows in favor of Linux?.md b/published/20201012 Could Microsoft be en route to dumping Windows in favor of Linux.md similarity index 100% rename from published/20201012 Could Microsoft be en route to dumping Windows in favor of Linux?.md rename to published/20201012 Could Microsoft be en route to dumping Windows in favor of Linux.md From 0ae4f04e9543111c7aab44db1da8af0dbb6a6da4 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 15 Oct 2020 00:03:13 +0800 Subject: [PATCH 0456/1156] PRF @geekpi --- ...ux Terminal With This Nifty Python Tool.md | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/translated/tech/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md b/translated/tech/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md index f7a528fc87..4e1985f8cb 100644 --- a/translated/tech/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md +++ b/translated/tech/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md @@ -1,39 +1,41 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Present Slides in Linux Terminal With This Nifty Python Tool) [#]: via: (https://itsfoss.com/presentation-linux-terminal/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -用这个漂亮的 Python 工具在 Linux 终端中展示幻灯片 +在 Linux 终端中展示幻灯片 ====== -演示往往是枯燥的。这就是为什么有些人添加动画或漫画/meme 来增加一些幽默和风格来打破单调的原因。 +![](https://img.linux.net.cn/data/attachment/album/202010/15/000226j34xnkzzg7z7x9ka.jpg) -如果你需要在你的大学或公司的演示中加入一些独特的风格,那么使用 Linux 终端怎么样?想象一下,这将是多么酷的事情啊! +演示文稿往往是枯燥的。这就是为什么有些人会添加动画或漫画/meme 来增加一些幽默和风格来打破单调。 + +如果你需要在你的大学或公司的演示文稿中加入一些独特的风格,那么使用 Linux 终端怎么样?想象一下,这将是多么酷的事情啊! ### Present:Linux 终端中进行演示 在终端中可以做很多[有趣好玩的事情][1]。制作和展示幻灯片只是其中之一。 -基于 Python 的应用名为 [Present][2],它可以让你创建基于 markdown 和 YML 的幻灯片,你可以在你的大学或公司里演讲,并以真正的极客风格取悦人们。 +这个基于 Python 的应用名为 [Present][2],它可以让你创建基于 Markdown 和 YML 的幻灯片,你可以在你的大学或公司里演讲,并以真正的极客风格取悦人们。 我制作了一个视频,展示了在 Linux 终端中用 Present 演示一些东西的样子。 +- [VIDEO](https://img.linux.net.cn/static/video/Makes%20ASCII%20Based%20Presentation%20Slides%20in%20Linux%20terminal-462902030.mp4) + #### Present 的功能 你可以用 Present 做以下事情: - * 使用 markdown 语法在幻灯片中添加文本。 - * 用箭头或 PgUp/Down 键控制幻灯片 + * 使用 Markdown 语法在幻灯片中添加文本 + * 用箭头或 `PgUp`/`Down` 键控制幻灯片 * 改变前景和背景颜色 * 在幻灯片中添加图像 * 增加代码块 - * 播放模拟代码,并用 codio YML 文件输出。 - - + * 播放模拟代码,并用 codio YML 文件输出 #### 在 Linux 上安装 Present @@ -51,29 +53,27 @@ sudo apt install python3-pip sudo pip3 install present ``` -你也可以只为当前用户安装,但你也必须将 \~/.local/bin 添加到你的 PATH。 +你也可以只为当前用户安装,但你也必须将 `~/.local/bin` 添加到你的 `PATH` 环境变量。 #### 在 Linux 终端中使用 Present 来创建和展示幻灯片 ![][5] -由于 Present 使用了 markdown 语法,你应该用它来创建自己的幻灯片。在这里使用 [markdown 编辑器][6]会有帮助。 +由于 Present 使用了 Markdown 语法,你应该用它来创建自己的幻灯片。在这里使用 [Markdown 编辑器][6]会有帮助。 -Present 需要一个 markdown 文件来读取和播放幻灯片。你可以[下载这个示例幻灯片][7],但你需要单独下载嵌入图像,并将它放在图像文件夹内。 +Present 需要一个 Markdown 文件来读取和播放幻灯片。你可以[下载这个示例幻灯片][7],但你需要单独下载嵌入的图像,并将它放在图像文件夹内。 - * 在 markdown 文件中使用 — 来分隔幻灯片。 - * 使用 markdown 语法在幻灯片中添加文本。 - * 使用以下语法添加图片 ![RC] (images/name.png)。 - * 通过添加像 <!– fg=white bg=red –> 这样的语法来改变幻灯片的颜色。 - * 使用像 <!– effect=fireworks –> 这样的语法来添加带有效果的幻灯片。 + * 在 Markdown 文件中使用 `—` 来分隔幻灯片。 + * 使用 Markdown 语法在幻灯片中添加文本。 + * 使用以下语法添加图片 `![RC] (images/name.png)`。 + * 通过添加像 `` 这样的语法来改变幻灯片的颜色。 + * 使用像 `` 这样的语法来添加带有效果的幻灯片。 * 使用 [codio 语法][8] 添加代码运行模拟。 - * 使用 q 退出演示,并用左/右箭头或 PgUp/Down 键控制幻灯片。 - - + * 使用 `q` 退出演示,并用左/右箭头或 `PgUp`/`Down` 键控制幻灯片。 请记住,在演示时调整终端窗口的大小会把东西搞乱,按回车键也是如此。 -**总结** +### 总结 如果你熟悉 Markdown 和终端,使用 Present 对你来说并不困难。 @@ -86,7 +86,7 @@ via: https://itsfoss.com/presentation-linux-terminal/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 875f576afa5e5382d66998f995862646cb58a1ef Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 15 Oct 2020 00:16:53 +0800 Subject: [PATCH 0457/1156] PUB @geekpi https://linux.cn/article-12719-1.html --- ...nt Slides in Linux Terminal With This Nifty Python Tool.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md (98%) diff --git a/translated/tech/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md b/published/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md similarity index 98% rename from translated/tech/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md rename to published/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md index 4e1985f8cb..d780724635 100644 --- a/translated/tech/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md +++ b/published/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12719-1.html) [#]: subject: (Present Slides in Linux Terminal With This Nifty Python Tool) [#]: via: (https://itsfoss.com/presentation-linux-terminal/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From e2485ab47c17e5ac677029116010ae9f8e84e881 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 15 Oct 2020 05:01:40 +0800 Subject: [PATCH 0458/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201014?= =?UTF-8?q?=20Web=20of=20Trust,=20Part=201:=20Concept?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201014 Web of Trust, Part 1- Concept.md --- .../20201014 Web of Trust, Part 1- Concept.md | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 sources/tech/20201014 Web of Trust, Part 1- Concept.md diff --git a/sources/tech/20201014 Web of Trust, Part 1- Concept.md b/sources/tech/20201014 Web of Trust, Part 1- Concept.md new file mode 100644 index 0000000000..b9eedecb3e --- /dev/null +++ b/sources/tech/20201014 Web of Trust, Part 1- Concept.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Web of Trust, Part 1: Concept) +[#]: via: (https://fedoramagazine.org/web-of-trust-part-1-concept/) +[#]: author: (Kevin "Eonfge" Degeling https://fedoramagazine.org/author/eonfge/) + +Web of Trust, Part 1: Concept +====== + +![][1] + +Every day we rely on technologies who nobody can fully understand. Since well before the industrial revolution, complex and challenging tasks required an approach that broke out the different parts into smaller scale tasks. Each resulting in specialized knowledge used in some parts of our lives, leaving other parts to trust in skills that others had learned. This shared knowledge approach also applies to software. Even the most avid readers of this magazine, will likely not compile and validate every piece of code they run. This is simply because the world of computers is itself also too big for one person to grasp. + +Still, even though it is nearly impossible to understand everything that happens within your PC when you are using it, that does not leave you blind and unprotected. FLOSS software shares trust, giving protection to all users, even if individual users can’t grasp all parts in the system. This multi-part article will discuss how this ‘Web of Trust’ works and how you can get involved. + +But first we’ll have to take a step back and discuss the basic concepts, before we can delve into the details and the web. Also, a note before we start, security is not just about viruses and malware. Security also includes your privacy, your economic stability and your technological independence. + +### One-Way System + +By their design, computers can only work and function in the most rudimentary ways of logic: _True_ or _false_. _And_ or _Or._ This (boolean logic) is not readily accessible to humans, therefore we must do something special. We write applications in a code that we can (reasonably) comprehend (human readable). Once completed, we turn this human readable code into a code that the computer can comprehend (machine code). + +The step of conversion is called compilation and/or building, and it’s a one-way process. Compiled code (machine code) is not really understandable by humans, and it takes special tools to study in detail. You can understand small chunks, but on the whole, an entire application becomes a black box. + +This subtle difference shifts power. Power, in this case being the influence of one person over another person. The person who has written the human-readable version of the application and then releases it as compiled code to use by others, knows all about what the code does, while the end user knows a very limited scope. When using (software) in compiled form, it is impossible to know for certain what an application is intended to do, unless the original human readable code can be viewed. + +### **The Nature of Power** + +Spearheaded by Richard Stallman, this shift of power became a point of concern. This discussion started in the 1980s, for this was the time that computers left the world of academia and research, and entered the world of commerce and consumers. Suddenly, that power became a source of control and exploitation. + +One way to combat this imbalance of power, was with the concept of FLOSS software. FLOSS Software is built on [4-Freedoms][2], which gives you a wide array of other ‘affiliated’ rights and guarantees. In essence, FLOSS software uses copyright-licensing as a form of moral contract, that forces software developers not to leverage the one-way power against their users. The principle way of doing this, is with the the GNU General Public Licenses, which Richard Stallman created and has since been promoting. + +One of those guarantees, is that you can see the code that should be running on your device. When you get a device using FLOSS software, then the manufacturer should provide you the code that the device is using, as well as all instructions that you need to compile that code yourself. Then you can replace the code on the device with the version you can compile yourself. Even better, if you compare the version you have with the version on the device, you can see if the device manufacturer tried to cheat you or other customers. + +This is where the web of Trust comes back into the picture. The Web of Trust implies that even if the vast majority of people can’t validate the workings of a device, that others can do so on their behalf. Journalists, security analysts and hobbyists, can do the work that others might be unable to do. And if they find something, they have the power to share their findings. + +### Security by B**lind** **Trust** + +This is of course, if the application and all components underneath it, are FLOSS. Proprietary software, or even software which is merely Open Source, has compiled versions that nobody can recreate and validate. Thus, you can never truly know if that software is secure. It might have a backdoor, it might sell your personal data, or it might be pushing a closed ecosystem to create a vendor-lock. With closed-source software, your security is as good as the company making the software is trustworthy. + +For companies and developers, this actually creates another snare. While you might still care about your users and their security, you’re a liability: If a criminal can get to your official builds or supply-chain, then there is no way for anybody to discover that afterwards. An increasing number of attacks do not target users directly, but instead try to get in, by exploiting the trust the companies/developers have carefully grown. + +You should also not underestimate pressure from outside: Governments can ask you to ignore a vulnerability, or they might even demand cooperation. Investment firms or shareholders, may also insist that you create a vendor-lock for future use. The blind trust that you demand of your users, can be used against you. + +### Security by a Web of Trust + +If you are a user, FLOSS software is good because others can warn you when they find suspicious elements. You can use any FLOSS device with minimal economic risk, and there are many FLOSS developers who care for your privacy. Even if the details are beyond you, there are rules in place to facilitate trust. + +If you are a tinkerer, FLOSS is good because with a little extra work, you can check the promises of others. You can warn people when something goes wrong, and you can validate the warnings of others. You’re also able to check individual parts in a larger picture. The libraries used by FLOSS applications, are also open for review: It’s “Trust all the way down”. + +For companies and developers, FLOSS is also a great reassurance that your trust can’t be easily subverted. If malicious actors wish to attack your users, then any irregularity can quickly be spotted. Last but not least, since you also stand to defend your customers economic well-being and privacy, you can use that as an important selling point to customers who care about their own security. + +### Fedora’s case + +Fedora embraces the concept of FLOSS and it stands strong to defend it. There are comprehensive [legal guidelines][3], and Fedora’s principles are directly referencing the 4-Freedoms: [Freedom, Friends, Features, and First][4] + +![][5] + +To this end, entire systems have been set up to facilitate this kind of security. Fedora works completely in the open, and any user can check the official servers. [Koji][6] is the name of the Fedora Buildsystem, and you can see every application and it’s build logs there. For added security, there is also [Bohdi][7], which orchestrates the deployment of an application. Multiple people must approve it, before the application can become available. + +This creates the Web of Trust on which you can rely. Every package in the repository goes through the same process, and at every point somebody can intervene. There are also escalation systems in place to report issues, so that issues can quickly be tackled when they occur. Individual contributors also know that they can be reviewed at every time, which itself is already enough of a precaution to dissuade mischievous thoughts. + +You don’t have to trust Fedora (implicitly), you can get something better; trust in users like you. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/web-of-trust-part-1-concept/ + +作者:[Kevin "Eonfge" Degeling][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/eonfge/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/09/weboftrust1-816x345.jpg +[2]: https://fsfe.org/freesoftware/freesoftware.en.html +[3]: https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing +[4]: https://docs.fedoraproject.org/en-US/project/ +[5]: https://fedoramagazine.org/wp-content/uploads/2020/09/foundations_expand_1_freedom.png +[6]: https://koji.fedoraproject.org/koji/index +[7]: https://bodhi.fedoraproject.org/ From a8e5a3b0b7f0232eaddb3267651887cf829d9a63 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 15 Oct 2020 08:42:21 +0800 Subject: [PATCH 0459/1156] translating --- ...with this internet protocol alternative.md | 102 ------------------ ...with this internet protocol alternative.md | 101 +++++++++++++++++ 2 files changed, 101 insertions(+), 102 deletions(-) delete mode 100644 sources/tech/20201006 Simplify your web experience with this internet protocol alternative.md create mode 100644 translated/tech/20201006 Simplify your web experience with this internet protocol alternative.md diff --git a/sources/tech/20201006 Simplify your web experience with this internet protocol alternative.md b/sources/tech/20201006 Simplify your web experience with this internet protocol alternative.md deleted file mode 100644 index 42237f4cab..0000000000 --- a/sources/tech/20201006 Simplify your web experience with this internet protocol alternative.md +++ /dev/null @@ -1,102 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Simplify your web experience with this internet protocol alternative) -[#]: via: (https://opensource.com/article/20/10/gemini-internet-protocol) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Simplify your web experience with this internet protocol alternative -====== -Discover new corners of a quieter and simpler internet with the Gemini -Protocol. -![Person typing on a 1980's computer][1] - -If you've been on the internet for a very long time or you're just very resourceful, you might remember an early text-sharing protocol called [Gopher][2]. Gopher was eventually displaced by the HTTP protocol, which of course is the basis for the modern World Wide Web. For many people, the "internet" and the "World Wide Web" are the same thing, because many people don't consciously do anything online that's _not_ on the www subdomain. - -But there have always been a variety of network protocols to share information over an interconnected network: Telnet, FTP, SSH, Torrent, GNUnet, and many more. Recently, there's been an addition to this collection of alternatives, and it's called [Gemini][3]. - -The Gemini protocol, named after the space mission between the rudimentary experiments of Project Mercury and Project Apollo, is meant to sit peacefully between Gopher and HTTP. It doesn't aim to replace the modern web, by any means, but it does try to create both a simplified web and a modernized Gopher. - -This development, young though it may be, is significant for many reasons. People take issue with the modern web, of course, for reasons spanning the technical and the philosophical, but it's also just plain bloated. A million hits from a Google search can feel like overkill when all you really want is one reliable answer to a very specific question. - -Many people use Gopher for this very reason: it's small enough to allow for niche interests that are easy to find. However, Gopher is an old protocol that makes assumptions about programming, networking, and browsing that just aren't applicable anymore. Gemini aims to bring the best of the web to a format that approximates Gopher but is easy to program for. A simple Gemini browser can be written in a few hundred lines of code, and there's a very good one written in about 1,600 lines. That's a powerful feature for programmers, students, and minimalists alike. - -### How to browse Gemini - -Like the early web, Gemini is small enough that there is a list of known servers running Gemini sites. Just as browsing an HTTP site requires a web browser, accessing a Gemini site requires a Gemini browser. There are already several available, listed on the [Gemini website][4]. - -The simplest one to run is the [AV-98][5] client. It's written in Python and runs in a terminal. To try it out, download it: - - -``` -`$ git clone https://tildegit.org/solderpunk/AV-98.git` -``` - -Change directory into the downloaded directory and run AV-98: - - -``` -$ cd AV-98.git -$ python3 ./main.py -``` - -The client is an interactive prompt. It has limited commands, and the main one is simply `go` followed by a Gemini server address. Go to the list of known [Gemini servers][6], select one that seems interesting, and try visiting it: - - -``` -AV-98> go gemini://example.club - -Welcome to the example.club Gemini server! - -Here are some folders of ASCII art: - -[1] Penguins -[2] Wildebeests -[3] Demons -``` - -Navigation is a matter of following numbered links. For instance, to navigate to the Penguins directory, enter `1` and press Enter: - - -``` -AV-98> 1 - -[1] Gentoo -[2] Emperor -[3] Little Blue -``` - -To go back, type `back` and press Enter: - - -``` -`AV-98> back` -``` - -For more commands, just enter `help`. - -### Gemini as your web alternative - -The Gemini protocol is simple enough for beginner-level and intermediate programmers to write clients for, and it's an easy and quick way to share content on the internet. While the World Wide Web's ubiquity is advantageous for widespread distribution, there's always room for alternatives. Check out Gemini and discover new corners of a quieter and simpler internet. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/10/gemini-internet-protocol - -作者:[Seth Kenlon][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://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer) -[2]: https://en.wikipedia.org/wiki/Gopher_%28protocol%29 -[3]: https://gemini.circumlunar.space/ -[4]: https://gemini.circumlunar.space/clients.html -[5]: https://tildegit.org/solderpunk/AV-98 -[6]: https://portal.mozz.us/gemini/gemini.circumlunar.space/servers diff --git a/translated/tech/20201006 Simplify your web experience with this internet protocol alternative.md b/translated/tech/20201006 Simplify your web experience with this internet protocol alternative.md new file mode 100644 index 0000000000..77cd297944 --- /dev/null +++ b/translated/tech/20201006 Simplify your web experience with this internet protocol alternative.md @@ -0,0 +1,101 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Simplify your web experience with this internet protocol alternative) +[#]: via: (https://opensource.com/article/20/10/gemini-internet-protocol) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +使用此互联网协议替代方案简化你的 Web 体验 +====== +用 Gemini 协议发现更安静、更简单的互联网新角落。 +![Person typing on a 1980's computer][1] + +如果你已经上网了很长时间,或者只是了解很多,你可能还记得一个早期的文本共享协议,叫做 [Gopher][2]。Gopher 最终被 HTTP 协议所取代,当然,HTTP 协议是现代万维网的基础。对于很多人来说,”互联网“和”万维网“是一回事,因为很多人并不会有意识地做_不_在 www 子域下的事情。 + +但一直以来,都有各种网络协议在互联网络上共享信息。Telnet、FTP、SSH、Torrent、GNUnet 等等。最近,在这一系列的替代品中又多了一个,它叫 [Gemini][3]。 + +Gemini 协议,以”水星计划“和”阿波罗计划“的基础实验之间的太空任务命名,旨在和平地处在 Gopher 和 HTTP 之间。无论如何,它的目的并不是要取代现代 Web,但它确实试图创造一个简化的网络和一个现代化的 Gopher。 + +它的发展虽然可能很年轻,但意义重大,原因有很多。当然,人们会因为技术和哲学上的原因而对现代 Web 表示质疑,但它只是一般的臃肿。当你真正想要的是一个非常具体的问题的可靠答案时,那么无数次点击谷歌搜索的结果让人感觉过头了。 + +许多人使用 Gopher 就是因为这个原因:它的规模小到可以让小众的兴趣很容易找到。然而,Gopher 是一个旧的协议,它对编程、网络和浏览做出了一些假设,但这些假设已经不再适用了。 Gemini 的目标是将最好的网络带入一种类似于 Gopher 但易于编程的格式。一个简单的 Gemini 浏览器可以用几百行代码写成,并且有一个非常好的浏览器用 1600 行左右写成。这对于程序员、学生和极简主义者来说都是一个强大的功能。 + +### 如何浏览 Gemini + +就像早期的网络一样,Gemini 的规模很小,有一个运行 Gemini 网站的已知服务器列表。就像浏览 HTTP 站点需要一个网页浏览器一样,访问 Gemini 站点也需要一个 Gemini 浏览器。已经有几个可用的,在 [Gemini 网站][4]上列出。 + +最简单的一个是 [AV-98][5] 客户端。它是用 Python 编写的,在终端中运行。要想试试的话,请下载它: + + +``` +`$ git clone https://tildegit.org/solderpunk/AV-98.git` +``` + +进入下载目录,运行 AV-98: + + +``` +$ cd AV-98.git +$ python3 ./main.py +``` + +客户端是一个交互式的提示。它有有限的几个命令,主要的命令是简单的 `go`,后面跟着一个 Gemini 服务器地址。进入已知的 [Gemini 服务器][6]列表,选择一个看起来很有趣的服务器,然后尝试访问它: + + +``` +AV-98> go gemini://example.club + +Welcome to the example.club Gemini server! + +Here are some folders of ASCII art: + +[1] Penguins +[2] Wildebeests +[3] Demons +``` + +导航是按照编号的链接来进行的。例如,要进入 Penguins 目录,输入 `1` 然后按回车键: + + +``` +AV-98> 1 + +[1] Gentoo +[2] Emperor +[3] Little Blue +``` + +要返回,输入 `back` 并按回车键: + + +``` +`AV-98> back` +``` + +更多命令,请输入 `help`。 + +### Gemini 作为你的 web 替代 + +Gemini 协议非常简单,初级和中级程序员都可以为其编写客户端,而且它是在互联网上分享内容的一种简单快捷的方式。虽然万维网的无处不在对广泛传播是有利的,但总有替代方案的空间。看看 Gemini,发现更安静、更简单的互联网的新角落。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/gemini-internet-protocol + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer) +[2]: https://en.wikipedia.org/wiki/Gopher_%28protocol%29 +[3]: https://gemini.circumlunar.space/ +[4]: https://gemini.circumlunar.space/clients.html +[5]: https://tildegit.org/solderpunk/AV-98 +[6]: https://portal.mozz.us/gemini/gemini.circumlunar.space/servers From f409450b9f51cae789c6c8ae94cd3abf75c2b492 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 15 Oct 2020 08:46:53 +0800 Subject: [PATCH 0460/1156] translating --- ...yer is a Desktop App for Various Streaming Music Services.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md b/sources/tech/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md index 1f13f78ea5..66061e71d5 100644 --- a/sources/tech/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md +++ b/sources/tech/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 85c0484a7bf008db3ad8ef9112db7913050904b1 Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Thu, 15 Oct 2020 18:13:15 +0800 Subject: [PATCH 0461/1156] Update 20180503 Go on very small hardware (Part 3).md --- sources/tech/20180503 Go on very small hardware (Part 3).md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20180503 Go on very small hardware (Part 3).md b/sources/tech/20180503 Go on very small hardware (Part 3).md index e2cf0ce13b..c704867375 100644 --- a/sources/tech/20180503 Go on very small hardware (Part 3).md +++ b/sources/tech/20180503 Go on very small hardware (Part 3).md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (gxlct008) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 8c7b2f7cf62776116b1b36596553990d0bb7667b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 15 Oct 2020 20:50:47 +0800 Subject: [PATCH 0462/1156] PRF @rakino --- ...gs To Do After Installing Manjaro Linux.md | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/translated/tech/20201010 6 Essential Things To Do After Installing Manjaro Linux.md b/translated/tech/20201010 6 Essential Things To Do After Installing Manjaro Linux.md index 17a4b6846d..c3f54cea21 100644 --- a/translated/tech/20201010 6 Essential Things To Do After Installing Manjaro Linux.md +++ b/translated/tech/20201010 6 Essential Things To Do After Installing Manjaro Linux.md @@ -1,18 +1,18 @@ [#]: collector: (lujun9972) [#]: translator: (rakino) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (6 Essential Things To Do After Installing Manjaro Linux) [#]: via: (https://itsfoss.com/things-to-do-after-installing-manjaro/) [#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) -安装 Manjaro Linux 后要做的 6 件事 +安装 Manjaro Linux 后必做的 6 件事 ====== -所以,你刚刚[全新安装了 Manjaro Linux][1],那么现在该做什么呢? +你刚刚[全新安装了 Manjaro Linux][1],那么现在该做什么呢? -下面是我推荐你在安装后进行的一些步骤。 +下面是我推荐你在安装后进行的一些必不可少的步骤。 不过说实话,这些都是我在安装 Manjaro 后喜欢做的事,根据你的需求,步骤可能会有所不同。 @@ -24,7 +24,7 @@ #### 1、设置最快的镜像 - 在更新系统之前,我建议先整理一下镜像列表。在刷新 Manjaro 系统和从软件仓库下载软件包的时候,优化后的镜像列表会对系统的性能产生明显的影响。 +在更新系统之前,我建议先整理一下镜像列表。在刷新 Manjaro 系统和从软件仓库下载软件包的时候,优化后的镜像列表会对系统的性能产生明显的影响。 打开终端模拟器并输入以下命令: @@ -36,7 +36,7 @@ sudo pacman-mirrors --fasttrack #### 2、更新系统 -保持系统更新可以降低安全漏洞的发生机率,在安装新的软件之前也建议刷新系统的软件仓库。 +保持系统更新可以降低安全漏洞的发生机率,在安装新的软件之前也建议刷新一下系统的软件仓库。 你可以用下面的命令来[更新 Manjaro 系统][5]: @@ -46,13 +46,13 @@ sudo pacman -Syu ![][6] -#### 3、启用 AUR,Snap 以及 Flatpak 支持 +#### 3、启用 AUR、Snap 以及 Flatpak 支持 [Arch 用户仓库Arch User Repository(AUR)][7]是用户选择[基于 Arch Linux 的系统][8]的一个主要理由。你可以在 AUR 中访问到大量的附加软件。 -(译注:AUR 中的 PKGBUILD 均为用户上传且未经审核,使用者需要自负责任,在构建软件包前请注意检查其中内容是否合理。) +(LCTT 译注:AUR 中的 PKGBUILD 均为用户上传且未经审核,使用者需要自负责任,在构建软件包前请注意检查其中内容是否合理。) -作为可选项,你可以直接在 Pamac 图形化软件包管理器中启用对 [Snap][9] 以及 [Flatpak][10] 的支持。 +作为可选项,你可以直接在 Pacman 图形化软件包管理器中启用对 [Snap][9] 以及 [Flatpak][10] 的支持。 ![][11] @@ -80,7 +80,7 @@ sudo systemctl enable fstrim.timer mhwd-kernel -li ``` -**安装新内核**(以最新的 5.8 版本内核为例)**:** +**安装新内核**(以最新的 5.8 版本内核为例) ``` sudo mhwd-kernel -i linux58 @@ -96,9 +96,9 @@ sudo mhwd-kernel -i linux58 ![][18] -#### 结论 +### 结论 -如果你想在一个预配置、为桌面优化的发行版上享受 Arch Linux 的优点,[Manjaro是一个很好的发行版][19]。虽然它预置了很多东西,但由于每个人设置和需求的不同,有几个步骤是不能提前完成的。 +如果你想在一个预配置、为桌面优化的发行版上享受 Arch Linux 的优点,[Manjaro 是一个很好的发行版][19]。虽然它预置了很多东西,但由于每个人设置和需求的不同,有几个步骤是不能提前完成的。 除开已经提到的步骤,还有哪一步对你来说是必不可少的?请在下面的评论中告诉我们。 @@ -109,7 +109,7 @@ via: https://itsfoss.com/things-to-do-after-installing-manjaro/ 作者:[Dimitrios Savvopoulos][a] 选题:[lujun9972][b] 译者:[rakino](https://github.com/rakino) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ecc9412cba0506fa5afd4060798c4bc3f6b65f99 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 15 Oct 2020 21:00:16 +0800 Subject: [PATCH 0463/1156] PUB @rakino https://linux.cn/article-12721-1.html --- ...Essential Things To Do After Installing Manjaro Linux.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20201010 6 Essential Things To Do After Installing Manjaro Linux.md (97%) diff --git a/translated/tech/20201010 6 Essential Things To Do After Installing Manjaro Linux.md b/published/20201010 6 Essential Things To Do After Installing Manjaro Linux.md similarity index 97% rename from translated/tech/20201010 6 Essential Things To Do After Installing Manjaro Linux.md rename to published/20201010 6 Essential Things To Do After Installing Manjaro Linux.md index c3f54cea21..9f4147f6c6 100644 --- a/translated/tech/20201010 6 Essential Things To Do After Installing Manjaro Linux.md +++ b/published/20201010 6 Essential Things To Do After Installing Manjaro Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (rakino) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12721-1.html) [#]: subject: (6 Essential Things To Do After Installing Manjaro Linux) [#]: via: (https://itsfoss.com/things-to-do-after-installing-manjaro/) [#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) @@ -80,7 +80,7 @@ sudo systemctl enable fstrim.timer mhwd-kernel -li ``` -**安装新内核**(以最新的 5.8 版本内核为例) +安装新内核(以最新的 5.8 版本内核为例): ``` sudo mhwd-kernel -i linux58 From 0ba4150349e679a0cf938bfd0aed89f7a2e096a9 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 15 Oct 2020 21:32:23 +0800 Subject: [PATCH 0464/1156] PRF @gxlct008 --- ...719 Building a Messenger App- Home Page.md | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/translated/tech/20180719 Building a Messenger App- Home Page.md b/translated/tech/20180719 Building a Messenger App- Home Page.md index ad3cd30125..4c7d5e31d7 100644 --- a/translated/tech/20180719 Building a Messenger App- Home Page.md +++ b/translated/tech/20180719 Building a Messenger App- Home Page.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (gxlct008) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Building a Messenger App: Home Page) @@ -10,6 +10,8 @@ 构建一个即时消息应用(八):Home 页面 ====== +![](https://img.linux.net.cn/data/attachment/album/202010/15/213116evlwzdwwv66kmldj.jpg) + 本文是该系列的第八篇。 * [第一篇: 模式][1] @@ -20,8 +22,7 @@ * [第六篇: 仅用于开发的登录][6] * [第七篇: Access 页面][7] - -继续前端部分,让我们在本文中完成 Home 页面的开发。 我们将添加一个开始对话的表单和一个包含最新对话的列表。 +继续前端部分,让我们在本文中完成 `home` 页面的开发。 我们将添加一个开始对话的表单和一个包含最新对话的列表。 ### 对话表单 @@ -35,7 +36,7 @@ ``` -将该表单添加到我们显示 auth user 和 logout 按钮部分的下方。 +将该表单添加到我们显示 “auth user” 和 “logout” 按钮部分的下方。 ```js page.getElementById('conversation-form').onsubmit = onConversationSubmit @@ -78,7 +79,7 @@ function createConversation(username) { } ``` -在提交时,我们使用用户名对 `/api/conversations` 进行 POST 请求,并重定向到 conversation 页面 (用于下一篇文章)。 +在提交时,我们使用用户名对 `/api/conversations` 进行 POST 请求,并重定向到 `conversation` 页面(用于下一篇文章)。 ### 对话列表 @@ -166,8 +167,7 @@ export function escapeHTML(str) { ``` -这将非常烦人,因为该脚本将被执行😅。 -所以,永远记住要转义来自不可信来源的内容。 +这将非常烦人,因为该脚本将被执行😅。所以,永远记住要转义来自不可信来源的内容。 ### 消息订阅 @@ -227,7 +227,7 @@ function getConversation(id) { 以上这些涵盖了主页的所有内容 😊。 在下一篇文章中,我们将对 conversation 页面进行编码。 -[Souce Code][10] +- [源代码][10] -------------------------------------------------------------------------------- @@ -235,20 +235,20 @@ via: https://nicolasparada.netlify.com/posts/go-messenger-home-page/ 作者:[Nicolás Parada][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/gxlct008) -校对:[校对者ID](https://github.com/校对者ID) +译者:[gxlct008](https://github.com/gxlct008) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://nicolasparada.netlify.com/ [b]: https://github.com/lujun9972 -[1]: https://nicolasparada.netlify.com/posts/go-messenger-schema/ -[2]: https://nicolasparada.netlify.com/posts/go-messenger-oauth/ -[3]: https://nicolasparada.netlify.com/posts/go-messenger-conversations/ -[4]: https://nicolasparada.netlify.com/posts/go-messenger-messages/ -[5]: https://nicolasparada.netlify.com/posts/go-messenger-realtime-messages/ -[6]: https://nicolasparada.netlify.com/posts/go-messenger-dev-login/ -[7]: https://nicolasparada.netlify.com/posts/go-messenger-access-page/ +[1]: https://linux.cn/article-11396-1.html +[2]: https://linux.cn/article-11510-1.html +[3]: https://linux.cn/article-12056-1.html +[4]: https://linux.cn/article-12680-1.html +[5]: https://linux.cn/article-12685-1.html +[6]: https://linux.cn/article-12692-1.html +[7]: https://linux.cn/article-12704-1.html [8]: https://nicolasparada.netlify.com/img/go-messenger-home-page/conversation-form.png [9]: https://nicolasparada.netlify.com/img/go-messenger-home-page/conversation-list.png [10]: https://github.com/nicolasparada/go-messenger-demo From 1768471b463f67bd438ea0a4c0f9556258fa2ae0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 15 Oct 2020 21:38:08 +0800 Subject: [PATCH 0465/1156] PUB @gxlct008 https://linux.cn/article-12722-1.html --- .../20180719 Building a Messenger App- Home Page.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20180719 Building a Messenger App- Home Page.md (99%) diff --git a/translated/tech/20180719 Building a Messenger App- Home Page.md b/published/20180719 Building a Messenger App- Home Page.md similarity index 99% rename from translated/tech/20180719 Building a Messenger App- Home Page.md rename to published/20180719 Building a Messenger App- Home Page.md index 4c7d5e31d7..741206a4a7 100644 --- a/translated/tech/20180719 Building a Messenger App- Home Page.md +++ b/published/20180719 Building a Messenger App- Home Page.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (gxlct008) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12722-1.html) [#]: subject: (Building a Messenger App: Home Page) [#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-home-page/) [#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) From 9c349ee57006482efe54c3922b9469721d994bc8 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 15 Oct 2020 22:03:49 +0800 Subject: [PATCH 0466/1156] PRF @gxlct008 --- ...ding a Messenger App- Conversation Page.md | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/translated/tech/20180720 Building a Messenger App- Conversation Page.md b/translated/tech/20180720 Building a Messenger App- Conversation Page.md index b249c2dcfb..364d5c1868 100644 --- a/translated/tech/20180720 Building a Messenger App- Conversation Page.md +++ b/translated/tech/20180720 Building a Messenger App- Conversation Page.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (gxlct008) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Building a Messenger App: Conversation Page) @@ -10,6 +10,8 @@ 构建一个即时消息应用(九):Conversation 页面 ====== +![](https://img.linux.net.cn/data/attachment/album/202010/15/220239arr978u7t7oulv73.jpg) + 本文是该系列的第九篇,也是最后一篇。 * [第一篇: 模式][1] @@ -21,8 +23,6 @@ * [第七篇: Access 页面][7] * [第八篇: Home 页面][8] - - 在这篇文章中,我们将对对话conversation页面进行编码。此页面是两个用户之间的聊天室。在顶部我们将显示其他参与者的信息,下面接着的是最新消息列表,以及底部的消息表单。 ### 聊天标题 @@ -230,16 +230,15 @@ function readMessages(conversationID) { } ``` -在这里我们仍然使用 partial application 来获取会话 ID。 -当新消息到达时,我们首先检查它是否来自此对话。如果是,我们会将消息条目预先添加到列表中,并向`/api/conversations/{conversationID}/read_messages`发起 POST 一个请求,以更新参与者上次阅读消息的时间。 +在这里我们仍然使用这个应用的部分来获取会话 ID。 +当新消息到达时,我们首先检查它是否来自此对话。如果是,我们会将消息条目预先添加到列表中,并向 `/api/conversations/{conversationID}/read_messages` 发起 POST 一个请求,以更新参与者上次阅读消息的时间。 * * * -本系列到此结束。 Messenger app 现在可以运行了。 +本系列到此结束。 消息应用现在可以运行了。 -~~我将在对话和消息列表中添加分页功能,并在共享源代码之前添加用户搜索。我会在准备好的时候和托管的演示a hosted demo👨‍💻一起更新它~~ - -[Souce Code][13] • [Demo][14] +- [源代码][13] +- [演示][14] -------------------------------------------------------------------------------- @@ -248,20 +247,20 @@ via: https://nicolasparada.netlify.com/posts/go-messenger-conversation-page/ 作者:[Nicolás Parada][a] 选题:[lujun9972][b] 译者:[gxlct008](https://github.com/gxlct008) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://nicolasparada.netlify.com/ [b]: https://github.com/lujun9972 -[1]: https://nicolasparada.netlify.com/posts/go-messenger-schema/ -[2]: https://nicolasparada.netlify.com/posts/go-messenger-oauth/ -[3]: https://nicolasparada.netlify.com/posts/go-messenger-conversations/ -[4]: https://nicolasparada.netlify.com/posts/go-messenger-messages/ -[5]: https://nicolasparada.netlify.com/posts/go-messenger-realtime-messages/ -[6]: https://nicolasparada.netlify.com/posts/go-messenger-dev-login/ -[7]: https://nicolasparada.netlify.com/posts/go-messenger-access-page/ -[8]: https://nicolasparada.netlify.com/posts/go-messenger-home-page/ +[1]: https://linux.cn/article-11396-1.html +[2]: https://linux.cn/article-11510-1.html +[3]: https://linux.cn/article-12056-1.html +[4]: https://linux.cn/article-12680-1.html +[5]: https://linux.cn/article-12685-1.html +[6]: https://linux.cn/article-12692-1.html +[7]: https://linux.cn/article-12704-1.html +[8]: https://linux.cn/article-12722-1.html [9]: https://nicolasparada.netlify.com/img/go-messenger-conversation-page/heading.png [10]: https://nicolasparada.netlify.com/img/go-messenger-conversation-page/list.png [11]: https://nicolasparada.netlify.com/img/go-messenger-conversation-page/form.png From a5e219568a70e95888d1c36dfa57e157c85baec2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 15 Oct 2020 22:05:32 +0800 Subject: [PATCH 0467/1156] PUB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @gxlct008 https://linux.cn/article-12723-1.html 周日发布 --- .../20180720 Building a Messenger App- Conversation Page.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20180720 Building a Messenger App- Conversation Page.md (99%) diff --git a/translated/tech/20180720 Building a Messenger App- Conversation Page.md b/published/20180720 Building a Messenger App- Conversation Page.md similarity index 99% rename from translated/tech/20180720 Building a Messenger App- Conversation Page.md rename to published/20180720 Building a Messenger App- Conversation Page.md index 364d5c1868..95f91cabfa 100644 --- a/translated/tech/20180720 Building a Messenger App- Conversation Page.md +++ b/published/20180720 Building a Messenger App- Conversation Page.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (gxlct008) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12723-1.html) [#]: subject: (Building a Messenger App: Conversation Page) [#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-conversation-page/) [#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) From bf4f23c5bcf5b18c886f500c00c0b74167cbd262 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 15 Oct 2020 22:36:54 +0800 Subject: [PATCH 0468/1156] PRF @gxlct008 --- ...tall Deepin Desktop on Ubuntu 20.04 LTS.md | 65 +++++++++---------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/translated/tech/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md b/translated/tech/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md index 8d9bd00e6e..4342bef733 100644 --- a/translated/tech/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md +++ b/translated/tech/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md @@ -1,47 +1,46 @@ [#]: collector: (lujun9972) [#]: translator: (gxlct008) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Install Deepin Desktop on Ubuntu 20.04 LTS) [#]: via: (https://itsfoss.com/install-deepin-ubuntu/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -如何在 Ubuntu 20.04 LTS 上安装 Deepin 桌面 +如何在 Ubuntu 20.04 LTS 上安装深度(Deepin)桌面环境 ====== -_**本教程向您展示在 Ubuntu 上安装 Deepin 桌面环境的正确步骤。还提到了移除步骤。**_ +![](https://img.linux.net.cn/data/attachment/album/202010/15/223607kqs5zguiq53fkkig.png) -毫无疑问,Deepin 是一个 [漂亮的 Linux 发行版][1]。最近发布的 [Deepin version 20][2] 让它更加美观了。 +> 本教程向你展示在 Ubuntu 上安装深度(Deepin)桌面环境的正确步骤。还提到了移除步骤。 -现在,[Deepin Linux][3] 是基于 [Debian][4] 的,默认的存储库镜像太慢了。如果您更愿意使用 Ubuntu,可以选择 [UbuntuDDE Linux 发行版][5] 形式的 Ubuntu 的 Deepin 变体。它还不是 [官方的 Ubuntu 风格][6] 之一。 +毫无疑问,深度操作系统(Deepin OS)是一个 [漂亮的 Linux 发行版][1]。最近发布的 [深度操作系统 V20][2] 就更加美观了。 -[重新安装新的发行版][7] 是一个麻烦,因为您会丢失数据,您将不得不在新安装的 UbuntuDDE 上重新安装您的应用程序。 +[深度操作系统][3] 是基于 [Debian][4] 的,默认的存储库镜像太慢了。如果你更愿意使用 Ubuntu,可以选择 [UbuntuDDE Linux 发行版][5] 形式的 Ubuntu 的深度操作系统的变体。它还不是 [官方的 Ubuntu 风格][6] 之一。 -一个更简单的选择是在现有的 Ubuntu 系统上安装 Deepin 桌面环境。毕竟,您可以轻松地在一个系统中安装多个 [桌面环境][8]。 +[重新安装新的发行版][7] 是一个麻烦,因为你会丢失数据,你将不得不在新安装的 UbuntuDDE 上重新安装你的应用程序。 -不要烦恼,这很容易做到,如果您不喜欢,也可以恢复这些更改。让我来告诉你怎么做。 +一个更简单的选择是在现有的 Ubuntu 系统上安装深度桌面环境(DDE)。毕竟,你可以轻松地在一个系统中安装多个[桌面环境][8]。 -### 在 Ubuntu 20.04 上安装 Deepin 桌面 +不要烦恼,这很容易做到,如果你不喜欢,也可以恢复这些更改。让我来告诉你怎么做。 -![][9] +### 在 Ubuntu 20.04 上安装深度桌面环境 +UbuntuDDE 团队已为他们的发行版创建了一个 PPA,你可以使用相同的 PPA 在 Ubuntu 20.04 上安装深度桌面环境。请记住,此 PPA 仅适用于 Ubuntu 20.04。请阅读有关 [在 Ubuntu 中使用 PPA][10]。 -UbuntuDDE 团队已为他们的发行版创建了一个 PPA,您可以使用相同的 PPA 在 Ubuntu 20.04 上安装 Deepin 桌面。请记住,此 PPA 仅适用于 Ubuntu 20.04。请阅读有关 [在 Ubuntu 中使用 PPA][10]。 +> 没有深度桌面环境 V20 +> +> 你将在此处使用 PPA 安装的深度桌面环境还不是新的 V20。它可能会在 Ubuntu 20.10 发布后出现,但是我们不能担保。 -没有 Deepin 版本 20 +以下是你需要遵循的步骤: -您将在此处使用 PPA 安装的 Deepin 桌面还不是新的 Deepin 桌面版本 20。它可能会在 Ubuntu 20.10 发布后出现,但是我们不能保证任何事情。 - -以下是您需要遵循的步骤: - -**步骤 1**:您需要首先在终端上输入以下内容,来添加 [Ubuntu DDE Remix 团队的官方 PPA][11]: +**步骤 1**:你需要首先在终端上输入以下内容,来添加 [Ubuntu DDE Remix 团队的官方 PPA][11]: ``` sudo add-apt-repository ppa:ubuntudde-dev/stable ``` -**步骤 2**:添加存储库以后,继而安装 Deepin 桌面。 +**步骤 2**:添加存储库以后,继而安装深度桌面环境。 ``` sudo apt install ubuntudde-dde @@ -49,32 +48,32 @@ sudo apt install ubuntudde-dde ![][12] -现在,安装将启动,一段时间后,将要求您选择显示管理器display manager。 +现在,安装将启动,一段时间后,将要求你选择显示管理器display manager。 ![][13] -如果需要深度桌面主题的锁屏,则需要选择 “**lightdm**”。如果不需要,您可以将其设置为 “**gdm3**”。 +如果需要深度桌面主题的锁屏,则需要选择 “lightdm”。如果不需要,你可以将其设置为 “gdm3”。 -如果您看不到此选项,可以通过键入以下命令来获得它,然后选择您首选的显示管理器: +如果你看不到此选项,可以通过键入以下命令来获得它,然后选择你首选的显示管理器: ``` sudo dpkg-reconfigure lightdm ``` -**步骤 3**: 完成后,您必须退出并通过选择 “**Deepin**” 会话再次登录,或者重新启动系统。 +**步骤 3**: 完成后,你必须退出并通过选择 “Deepin” 会话再次登录,或者重新启动系统。 ![][14] -就是这样。马上在您的 Ubuntu 20.04 LTS 系统上享受深度体验吧! +就是这样。马上在你的 Ubuntu 20.04 LTS 系统上享受深度桌面环境体验吧! ![][15] -### 从 Ubuntu 20.04 删除 Deepin 桌面 +### 从 Ubuntu 20.04 删除深度桌面 -如果您不喜欢这种体验,或者由于某些原因它有 bug,可以按照以下步骤将其删除。 +如果你不喜欢这种体验,或者由于某些原因它有 bug,可以按照以下步骤将其删除。 -**步骤 1**: 如果您已将 “lightdm” 设置为显示管理器,则需要在卸载 Deepin 之前将显示管理器设置为 “gdm3”。为此,请键入以下命令: +**步骤 1**: 如果你已将 “lightdm” 设置为显示管理器,则需要在卸载深度桌面环境之前将显示管理器设置为 “gdm3”。为此,请键入以下命令: ``` sudo dpkg-reconfigure lightdm @@ -82,26 +81,26 @@ sudo dpkg-reconfigure lightdm ![Select gdm3 on this screen][13] -然后,选择 **gdm3** 继续。 +然后,选择 “gdm3” 继续。 -完成此操作后,您只需输入以下命令即可完全删除 Deepin: +完成此操作后,你只需输入以下命令即可完全删除深度桌面环境: ``` sudo apt remove startdde ubuntudde-dde ``` -您只需重启即可回到原来的 Ubuntu 桌面。如果图标没有响应,只需打开终端(**CTRL + ALT + T**)并输入: +你只需重启即可回到原来的 Ubuntu 桌面环境。如果图标没有响应,只需打开终端(`CTRL + ALT + T`)并输入: ``` reboot ``` -**总结** +### 总结 -有不同的 [桌面环境选择][16] 是件好事。如果您真的喜欢 Deepin 桌面界面,那么这可能是在 Ubuntu 上体验 Deepin 的一种方式。 +有不同的 [桌面环境选择][16] 是件好事。如果你真的喜欢深度桌面环境的界面,那么这可能是在 Ubuntu 上体验深度操作系统的一种方式。 -如果您有任何疑问或遇到任何问题,请在评论中告诉我。 +如果你有任何疑问或遇到任何问题,请在评论中告诉我。 -------------------------------------------------------------------------------- @@ -110,7 +109,7 @@ via: https://itsfoss.com/install-deepin-ubuntu/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[gxlct008](https://github.com/gxlct008) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 4d79d1b75b42c8369e578f28758edffbb05a9b8c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 15 Oct 2020 22:37:39 +0800 Subject: [PATCH 0469/1156] PUB @gxlct008 https://linux.cn/article-12724-1.html --- ...01009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md (98%) diff --git a/translated/tech/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md b/published/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md similarity index 98% rename from translated/tech/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md rename to published/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md index 4342bef733..84fc35c76f 100644 --- a/translated/tech/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md +++ b/published/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (gxlct008) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12724-1.html) [#]: subject: (How to Install Deepin Desktop on Ubuntu 20.04 LTS) [#]: via: (https://itsfoss.com/install-deepin-ubuntu/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From 81e93bcc508a645d12a055d923e00240f267aaff Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 15 Oct 2020 22:46:54 +0800 Subject: [PATCH 0470/1156] APL --- ...012 Linux Jargon Buster- What is Display Manager in Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201012 Linux Jargon Buster- What is Display Manager in Linux.md b/sources/tech/20201012 Linux Jargon Buster- What is Display Manager in Linux.md index 2e1ecac6b1..b520340bc6 100644 --- a/sources/tech/20201012 Linux Jargon Buster- What is Display Manager in Linux.md +++ b/sources/tech/20201012 Linux Jargon Buster- What is Display Manager in Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From bbd11d5fb9173f0ea8bf72fa6d64306778da0e3b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 15 Oct 2020 23:12:06 +0800 Subject: [PATCH 0471/1156] TSL --- ...uster- What is Display Manager in Linux.md | 103 ------------------ ...uster- What is Display Manager in Linux.md | 101 +++++++++++++++++ 2 files changed, 101 insertions(+), 103 deletions(-) delete mode 100644 sources/tech/20201012 Linux Jargon Buster- What is Display Manager in Linux.md create mode 100644 translated/tech/20201012 Linux Jargon Buster- What is Display Manager in Linux.md diff --git a/sources/tech/20201012 Linux Jargon Buster- What is Display Manager in Linux.md b/sources/tech/20201012 Linux Jargon Buster- What is Display Manager in Linux.md deleted file mode 100644 index b520340bc6..0000000000 --- a/sources/tech/20201012 Linux Jargon Buster- What is Display Manager in Linux.md +++ /dev/null @@ -1,103 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Linux Jargon Buster: What is Display Manager in Linux?) -[#]: via: (https://itsfoss.com/display-manager/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -Linux Jargon Buster: What is Display Manager in Linux? -====== - -_**In this chapter of the Linux Jargon Buster, you’ll learn about display manager in Linux. Is it part of the desktop environment? What does it do?**_ - -### What is display manager in Linux? - -In simple words, a display manager is a program that provides graphical login capabilities for your Linux distribution. It controls the user sessions and manages user authentication. Display manager starts the [display server][1] and loads the [desktop environment][2] right after you enter your username and password. - -The display manager is often synonymous to the login screen. It is the visible part of it after all. However, the visible login screen, also called greeter, is only a part of the display manager. - -![Login screen is the visible part of a display manager][3] - -Like [various desktop environments][4] and display servers, there are various display managers available as well. Let’s have a look at them. - -### Different display managers - -Some people think of the display manager as part of the desktop environment but that’s not true. It is a separate program. - -A desktop environment may recommend a certain display manager but it doesn’t mean that it won’t work with some other display manager. If you ever installed more than one desktop environment in the same system, you would remember that a login screen (i.e. the display manager) allows you to switch the desktop environment. - -![A display manager can be used with various desktop environments][5] - -Though display manager is not part of the desktop environment itself, it is often developed by the same development team as the desktop environment. It also becomes identity of the desktop environment. - -For example, the GNOME desktop environment develops GDM (GNOME Display Manager) and just by looking at the login screen, you would think of GNOME desktop environment. - -![GNOME Login Screen with GDM][6] - -Some popular display managers are: - - * GDM ([GNOME Display Manager][7]): preferred by GNOME - * [SDDM][8] (Simple Desktop Display Manager): preferred by KDE - * LightDM: Developed by Ubuntu for Unity desktop - - - -### Display managers can be customized - -There are so many desktop environments available. Do they all have their own display managers? No. That’s not the case. - -As I mentioned previously, the visible login screen is called greeter. This greeter can be customized to change the looks of the login screen. - -In fact, many distributions and/or desktop environments have written their own greeter to give users a login screen that resembles their brand. - -For example, Mint’s Cinnamon desktop uses LightDM but has its own greeter to give it more Minty (or should I say Cinnamon) looks. - -![Linux Mint login screen based on LightDM][9] - -Take a look at Kali Linux’s login screen: - -![Kali Linux Login Screen][10] - -If you are into coding and tweaking, you may modify or code your own greeter as per your liking. - -### Changing display manager - -You may [change the display manager][11] if you want. You need to install the display manager first. You’ll see the option to switch the display manager while installing. - -![][12] - -If you didn’t do it at that time, then you can change the display manager by manually configuring it later. The method to reconfigure the display manager is slightly different for different distributions and not in the scope of this article. - -**Conclusion** - -I hope you have a slight better understanding of the term display manager in Linux. The aim of this jargon buster series is to explain common Linux colloquial and technical terms in non-technical language without going into too much detail. - -I welcome your comments and suggestion. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/display-manager/ - -作者:[Abhishek Prakash][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/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/display-server/ -[2]: https://itsfoss.com/what-is-desktop-environment/ -[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/05/login-screen-opensuse.jpg?resize=800%2C474&ssl=1 -[4]: https://itsfoss.com/best-linux-desktop-environments/ -[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/deepin-session-ubuntu.jpg?resize=800%2C414&ssl=1 -[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/Login-screen-1.png?resize=800%2C450&ssl=1 -[7]: https://wiki.gnome.org/Projects/GDM -[8]: https://github.com/sddm -[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/linux-mint-login-screen.jpg?resize=800%2C418&ssl=1 -[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/kali-linux-login-screen.jpg?resize=799%2C450&ssl=1 -[11]: https://itsfoss.com/switch-gdm-and-lightdm-in-ubuntu-14-04/ -[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2014/06/Switch_between_gdm_and_lightgdm_Ubuntu.jpeg?resize=700%2C448&ssl=1 diff --git a/translated/tech/20201012 Linux Jargon Buster- What is Display Manager in Linux.md b/translated/tech/20201012 Linux Jargon Buster- What is Display Manager in Linux.md new file mode 100644 index 0000000000..789d1aebe5 --- /dev/null +++ b/translated/tech/20201012 Linux Jargon Buster- What is Display Manager in Linux.md @@ -0,0 +1,101 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux Jargon Buster: What is Display Manager in Linux?) +[#]: via: (https://itsfoss.com/display-manager/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Linux 黑话解释:什么是显示管理器? +====== + +> 在这篇 Linux 黑话解释中,你将了解 Linux 中的显示管理器。它是桌面环境的一部分吗?它的作用是什么? + +### 在 Linux 中什么是显示管理器? + +简单来说,显示管理器display manager(DM)是一个为你的 Linux 发行版提供图形登录功能的程序。它控制用户会话并管理用户认证。显示管理器会在你输入用户名和密码后,立即启动[显示服务器][1]并加载[桌面环境][2]。 + +显示管理器通常是登录界面的代名词。毕竟它是可见的部分。然而,可见的登录屏幕,也叫欢迎页greeter,只是显示管理器的一部分。 + +![登录屏幕是显示管理器的可见部分][3] + +像[各种桌面环境][4]和显示服务器一样,也有各种显示管理器。我们来看看它们。 + +### 不同的显示管理器 + +有些人认为显示管理器是桌面环境的一部分,但事实并非如此。它是一个独立的程序。 + +桌面环境可能会推荐某个显示管理器,但这并不意味着它不能与其它一些显示管理器一起工作。如果你曾经在同一个系统中安装过不止一个桌面环境,你会记得,登录界面(即显示管理器)允许你切换桌面环境。 + +![显示管理器可以与各种桌面环境配合使用][5] + +虽然显示管理器不是桌面环境本身的一部分,但它往往与桌面环境由同一个开发团队开发。它也成为桌面环境的代表。 + +例如,GNOME 桌面环境开发了 GDM(GNOME Display Manager),光看登录界面就会想到 GNOME 桌面环境。 + +![GNOME登录屏幕与GDM][6] + +一些流行的显示管理器有: + + * [GDM][7](GNOME 显示管理器GNOME Display Manager):GNOME 的首选。 + * [SDDM][8](简单桌面显示管理器Simple Desktop Display Manager):KDE 首选。 + * LightDM:由 Ubuntu 为 Unity 桌面开发。 + +### 显示管理器可以定制 + +有这么多的桌面环境可供选择,它们都有自己的显示管理器吗?不,不是这样的。 + +正如我之前提到的,可见的登录屏幕被称为欢迎页。这个欢迎页可以被自定义来改变登录屏幕的外观。 + +事实上,许多发行版和/或桌面环境都编写了自己的欢迎页,以给用户提供一个类似于他们品牌的登录屏幕。 + +例如,Mint 的 Cinnamon 桌面使用了 LightDM,但有自己的欢迎页来给它更多的 Mint 式(或者我应该说是 Cinnamon)的外观。 + +![基于 LightDM 的 Linux Mint 登录屏幕][9]。 + +来看看 Kali Linux 的登录界面: + +![Kali Linux 登录界面][10] + +如果你喜欢编码和调整,你可以根据自己的喜好修改或编码自己的欢迎页。 + +### 改变显示管理器 + +如果你愿意,可以[更改显示管理器][11]。你需要先安装显示管理器。安装时你会看到切换显示管理器的选项。 + +![][12] + +如果当时没有做切换,那么以后可以通过手动配置来改变显示管理器。不同的发行版重新配置显示管理器的方法略有不同,不在本文讨论范围内。 + +### 结语 + +希望大家对 Linux 中的显示管理器这个术语有一点了解。本黑话解释系列的目的是用非技术性的语言解释常见的 Linux 俗语和技术术语,而不涉及太多的细节。 + +欢迎大家提出意见和建议。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/display-manager/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/display-server/ +[2]: https://itsfoss.com/what-is-desktop-environment/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/05/login-screen-opensuse.jpg?resize=800%2C474&ssl=1 +[4]: https://itsfoss.com/best-linux-desktop-environments/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/deepin-session-ubuntu.jpg?resize=800%2C414&ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/Login-screen-1.png?resize=800%2C450&ssl=1 +[7]: https://wiki.gnome.org/Projects/GDM +[8]: https://github.com/sddm +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/linux-mint-login-screen.jpg?resize=800%2C418&ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/kali-linux-login-screen.jpg?resize=799%2C450&ssl=1 +[11]: https://itsfoss.com/switch-gdm-and-lightdm-in-ubuntu-14-04/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2014/06/Switch_between_gdm_and_lightgdm_Ubuntu.jpeg?resize=700%2C448&ssl=1 From d7b8bef1492154c46415b58a80d9145fd9af599b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 16 Oct 2020 05:02:38 +0800 Subject: [PATCH 0472/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201015?= =?UTF-8?q?=20Learn=20Python=20by=20creating=20a=20video=20game?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201015 Learn Python by creating a video game.md --- ...5 Learn Python by creating a video game.md | 195 ++++++++++++++++++ 1 file changed, 195 insertions(+) create mode 100644 sources/tech/20201015 Learn Python by creating a video game.md diff --git a/sources/tech/20201015 Learn Python by creating a video game.md b/sources/tech/20201015 Learn Python by creating a video game.md new file mode 100644 index 0000000000..2f8b1a355f --- /dev/null +++ b/sources/tech/20201015 Learn Python by creating a video game.md @@ -0,0 +1,195 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Learn Python by creating a video game) +[#]: via: (https://opensource.com/article/20/10/learn-python-ebook) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Learn Python by creating a video game +====== +Get to know Python the fun way using the step-by-step instructions in +our new eBook. +![Arcade games][1] + +Python is one of the most popular programming languages out there. Whether you want to learn it for work or for fun, it's a powerful and useful language for any purpose. You can create applications to help you with daily tasks, fun games you and your friends can play, scripts to process data, applications to generate or parse information, and much more. + +No matter what you intend to do with a programming language, we think it's more fun to learn by creating a game than by crunching numbers or transforming strings. And if you're completely new to programming, it's a lot easier to understand why you have to do something in code when you can see the code working in a familiar setting like a video game. + +You may not select [Python][2] as the best programming language available (everyone has their own answer for that), but it is a relatively non-intimidating one. Python can use a lot of words (such as `is` and `is not`) instead of symbols (such as `=` and `!=`). It also manages many low-level tasks so that you usually don't have to worry about things like data types and garbage collection. This generally means you can get started coding without the upfront frustration that a complex language like [C][3] or [Java][4] presents. + +To help you learn Python, we wrote an eBook showing how to create a platformer video game with it. Step through the lessons to learn Python while building a video game. As an additional benefit, you'll also learn about programming logic, syntax, operators, and more. You can see immediate results as you learn, so everything you learn is promptly reinforced. + +### Python in a minute + +Python is a general-purpose language, meaning it (like most languages) provides functions to do simple "tricks" with numbers and letters. Linux users already have Python installed. Mac users have an old version of Python, but you can [install the latest version][5] from the Python.org website. Windows users can learn to install Python from this [install Python on Windows][6] article. + +Once installed, you can start an interactive Python shell and do math: + + +``` +$ python3 +>>> 5+6 +11 +>>> 11/2 +5.5 +>>> 11//2 +5 +>>> 11%2 +1 +``` + +As you can see from this sample, there's some special notation required, but it's mostly familiar to anyone comfortable with math. Maybe you're not a numbers person and prefer letters: + + +``` +$ python3 +>>> string = "hello world" +>>> print(string) +hello world +>>> print(string.upper()) +HELLO WORLD +>>> print(string[0]) +h +>>> print(string[1]) +e +>>> print(string[2]) +l +>>> print(string[3]) +l +>>> print(string[4]) +o +``` + +Again, there's special notation for relatively basic tasks, but even without an explanation, you probably already detected that the `[0]` and `[1]` notation enables you to "slice" data and `print` presents data on your screen. + +### Pygame in five minutes + +If you want to create a video game or anything beyond a basic calculator with Python alone, it could take a lot of study, work, and time. Luckily, Python's been around for a couple of decades, so people have developed libraries of code to help you perform typical programming feats with (comparatively) very little effort. [Pygame][7] is a set of code modules designed for creating video games. It's [not the only such library][8], but it's the oldest (for better and for worse), so there's a lot of documentation and examples online. + +Start by learning the [recommended Python virtual environment workflow][9]: + + +``` +$ python3 -m venv mycode/venv +$ cd mycode +$ source ./venv/bin/activate +(venv)$ +``` + +Once you're in a virtual environment, you can safely install Pygame into your project folder: + + +``` +(venv)$ echo "pygame" >> requirements.txt +(venv)$ python -m pip install -r requirements.txt +[...] Installing collected packages: pygame +Successfully installed pygame-x.y.z +``` + +Now that you have Pygame installed, you can create a simple demo application. It's easier than you think. Python can do what's called _object-oriented programming_ (OOP), which is a fancy computer science term to describe when code is structured as if you were creating physical objects with code. Programmers aren't deluded, though. They know they're not really making physical objects when they code, but it can help to imagine it that way because then you understand the limits of your programmed world. + +For instance, if you were stranded on a desert island and wanted a coffee cup to appear, you'd have to harvest some clay, fashion a cup, and bake it. If you were very clever, you'll create a mold first so that whenever you want another cup, you can quickly create a new one from your template. Even though each cup came from the same template, they would be physically independent: should one break, you still have others. And you could make each coffee cup appear unique by adding color or etchings. + +In Pygame, and in many programming tasks, you use similar logic. A thing can't appear in your programmed world until you define it. Here's how to make a coffee cup appear in a Python and Pygame program. + +#### Object-oriented programming with Pygame + +Create a new file called `main.py` and enter this code to initiate the Pygame module and to use a Pygame template to create a window: + + +``` +import pygame + +pygame.init() + +screen = pygame.display.set_mode((960,720)) +``` + +Just as you might use a template to create an object in real life, you use a template provided by Pygame to create a _sprite_ (which is Pygame's term for a visual game object). In object-oriented programming, a _class_ represents a template for an object. Type this code into your document: + + +``` +class Cup(pygame.sprite.Sprite): +    def __init__(self): +        pygame.sprite.Sprite.__init__(self) + +        # image +        img = pygame.image.load('coffeecup.png').convert() +        self.image = img + +        # volume +        self.rect = self.image.get_rect() +        self.rect.x = 10 +        self.rect.y = 10 +``` + +This code block uses Pygame's `sprite` template to design a coffee cup sprite. Your coffee cup sprite has an image because of `self.image`, while `self.rect` gives it volume (width and height). These are attributes Pygame expects a sprite to possess, but if you were creating a playable video game, you could give it any other attribute you want, such as health points and a score. + +All you've done so far is create a window and the _template_ for a coffee cup. Your game doesn't actually _make_ a cup yet. + +The last part of your code must use your template to generate a cup and add it to your game world. As you may know, computers are very fast, so technically, the code you've created so far would only run for a millisecond or so. When writing a graphical computer application, you must force the computer to remain open whether or not it thinks it has completed the prescribed tasks. Programmers do this with an _infinite loop_, which in Python is represented by the instruction `while True` (True is always true, so the loop never ends). + +An infinite loop ensures your application stays open long enough for the computer user to see and use the application: + + +``` +cup = Cup() + +while True: +    pygame.display.update() +    screen.blit(cup.image, cup.rect) +``` + +This code sample creates a cup from your template `Cup` and then updates the display using a Pygame function. Finally, it draws the cup's image within its bounding box using Pygame's `blit` function. + +#### Get a graphic + +Before you can run the code successfully, you need a graphic for your coffee cup. You can find lots of [Creative Commons][10] coffee cup graphics on [FreeSVG.org][11]. I used [this one][12]. Save the graphic in your project directory, and call it `coffeecup.png`. + +#### Run the game + +Launch your application: + + +``` +`(venv)$ python ./main.py` +``` + +![Coffee cup in Pygame][13] + +(Seth Kenlon, [CC BY-SA 4.0][14]) + +### [Download the Python gaming eBook][15] + +Pygame is a powerful framework, and there's a lot more you can do with it than just draw coffee cups on your screen. [Download our free eBook][15] to get to know Pygame—and Python itself—better. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/learn-python-ebook + +作者:[Seth Kenlon][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://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/arcade_game_gaming.jpg?itok=84Rjk_32 (Arcade games) +[2]: https://www.python.org/ +[3]: https://opensource.com/article/20/8/c-programming-cheat-sheet +[4]: https://opensource.com/resources/java +[5]: https://www.python.org/downloads/mac-osx +[6]: https://opensource.com/article/19/8/how-install-python-windows +[7]: https://www.pygame.org/news +[8]: https://opensource.com/article/18/4/easy-2d-game-creation-python-and-arcade +[9]: https://opensource.com/article/20/9/venv-python +[10]: https://opensource.com/article/20/1/what-creative-commons +[11]: http://freesvg.org +[12]: https://freesvg.org/1548870028 +[13]: https://opensource.com/sites/default/files/uploads/pygame-cup.jpg (Coffee cup in Pygame) +[14]: https://creativecommons.org/licenses/by-sa/4.0/ +[15]: https://opensource.com/downloads/python-gaming-ebook From 53c7f8988c5feef551b6d7c28e45691ee5b69e80 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 16 Oct 2020 05:02:51 +0800 Subject: [PATCH 0473/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201014?= =?UTF-8?q?=20Try=20Linux=20on=20any=20computer=20with=20this=20bootable?= =?UTF-8?q?=20USB=20tool?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201014 Try Linux on any computer with this bootable USB tool.md --- ...ny computer with this bootable USB tool.md | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 sources/tech/20201014 Try Linux on any computer with this bootable USB tool.md diff --git a/sources/tech/20201014 Try Linux on any computer with this bootable USB tool.md b/sources/tech/20201014 Try Linux on any computer with this bootable USB tool.md new file mode 100644 index 0000000000..57e6b1810b --- /dev/null +++ b/sources/tech/20201014 Try Linux on any computer with this bootable USB tool.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Try Linux on any computer with this bootable USB tool) +[#]: via: (https://opensource.com/article/20/10/fedora-media-writer) +[#]: author: (Sumantro Mukherjee https://opensource.com/users/sumantro) + +Try Linux on any computer with this bootable USB tool +====== +Fedora Media Writer is a hassle-free way to create a live USB to give +Linux a try. +![Multiple USB plugs in different colors][1] + +[Fedora Media Writer][2] is a small, lightweight, comprehensive tool that simplifies the Linux getting-started experience. It downloads and writes Fedora Workstation or Server onto a USB drive that can boot up on any system, making it accessible for you to try Fedora Linux without having to install it to your hard drive. + +The Media Writer tool can be used to create a live, bootable USB. After installing the Fedora Media Writer application on your platform, you can download and flash the latest stable version of Fedora Workstation or Server, or you can choose any other image you've downloaded. And it isn't limited to Intel 64-bit devices. It's also available for ARM devices, [such as the Raspberry Pi][3], which are becoming more powerful and useful every day. + +![Fedora Media Writer main screen][4] + +(Sumantro Mukherjee, [CC BY-SA 4.0][5]) + +### Install Fedora Media Writer + +You have several options for [installing Fedora Media Writer][6]. You can [build it from source][7] on GitHub, download it for macOS or Windows, use an RPM with **dnf** or **yum**, or get it as a Flatpak. + +On Fedora: + + +``` +`$ sudo dnf install mediawriter` +``` + +See the [Releases][8] section of the GitHub repo for the latest version. + +### Prepare your media + +The first thing you need is a USB drive for your Linux OS to be installed onto. This is what Fedora Media Writer will flash. This drive must be either blank or expendable because **all data on the USB drive will be erased.** If there's any data—even just one file—that you don't want to lose, then you must back it up before continuing! + +Once you've got a USB drive that you've confirmed is expendable, plug it into your computer and launch Fedora Media Writer. + +### Use Fedora Media Writer + +When you launch Fedora Media Writer, you're presented with a screen that prompts you to acquire a bootable image from the Internet, or to load a custom image from your hard drive. The first selections are the latest releases of Fedora: Workstation for desktops and laptops, and Server for virtualization, rack servers, or anything you want to run as a server. + +Should you select one of the Fedora images, Media Writer downloads a disc image (usually called an "iso", after its filename extension of **.iso**) and saves it to your `Downloads` folder so you can reuse it to flash another drive if you want. + +![Select your image][9] + +Also available are Fedora Spins, which are images from the Fedora community meant to satisfy niche interests. For instance, if you're a fan of the [MATE desktop][10], then you'll be pleased to find a MATE "spin" available from Media Writer. There are many to choose from, so scroll through to see them all. If you're new to Linux, don't be overwhelmed or confused: the extra options are intended for longtime users who have developed preferences aside from the defaults, so it's safe for you to just use the Workstation or Server option depending on whether you want to run Fedora as a desktop or as a server OS. + +If you need an image for a different CPU than the one you're currently using, select the CPU architecture from the drop-down menu in the upper-right corner of the window. + +If you have an image saved to your hard drive already, select the **Custom Image** option and select the **.iso** file of the distribution you want to flash to USB. + +### Writing to a USB drive + +Once you've downloaded or selected an image, you must confirm that you want to write the image to your drive. + +The drive selection drop-down menu only shows external drives, so there's no chance of you accidentally overwriting your own hard drive. This is an important feature of Fedora Media Writer, and one that makes it much safer than many manual instructions you might see elsewhere online. However, if you have more than one external drive attached to your computer, you should remove them all except the one you want to overwrite, just for added safety. + +Select the drive you want the image to be installed onto, and click the **Write to Disk** button. + +![Media write][11] + +  + +Wait a while for the image to be written to your drive, and then check out Don Watkins' excellent overview of [how to boot to Linux from a USB drive][12] . + +### Get started with Linux + +Fedora Media Writer is a way to flash Fedora Workstation or Server, or any Linux distribution, to a USB drive so you can try it out before you install it on your device. Give it a try, and share your experience and questions in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/fedora-media-writer + +作者:[Sumantro Mukherjee][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://opensource.com/users/sumantro +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/usb-hardware.png?itok=ROPtNZ5V (Multiple USB plugs in different colors) +[2]: https://github.com/FedoraQt/MediaWriter +[3]: https://fedoraproject.org/wiki/Architectures/ARM/Raspberry_Pi +[4]: https://opensource.com/sites/default/files/uploads/fmw_mainscreen.png (Fedora Media Writer main screen) +[5]: https://creativecommons.org/licenses/by-sa/4.0/ +[6]: https://docs.fedoraproject.org/en-US/fedora/f32/install-guide/install/Preparing_for_Installation/#_fedora_media_writer +[7]: https://github.com/FedoraQt/MediaWriter#building +[8]: https://github.com/FedoraQt/MediaWriter/releases +[9]: https://opensource.com/sites/default/files/mediawriter-image.png +[10]: https://opensource.com/article/19/12/mate-linux-desktop +[11]: https://opensource.com/sites/default/files/mediawriter-write.png (Media write) +[12]: https://opensource.com/article/20/4/first-linux-computer From b40b18247a0211313faef503e7d973ee9973f066 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 16 Oct 2020 05:03:03 +0800 Subject: [PATCH 0474/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201014?= =?UTF-8?q?=20Teach=20a=20virtual=20class=20with=20Moodle=20on=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201014 Teach a virtual class with Moodle on Linux.md --- ...ch a virtual class with Moodle on Linux.md | 212 ++++++++++++++++++ 1 file changed, 212 insertions(+) create mode 100644 sources/tech/20201014 Teach a virtual class with Moodle on Linux.md diff --git a/sources/tech/20201014 Teach a virtual class with Moodle on Linux.md b/sources/tech/20201014 Teach a virtual class with Moodle on Linux.md new file mode 100644 index 0000000000..065fdeb69d --- /dev/null +++ b/sources/tech/20201014 Teach a virtual class with Moodle on Linux.md @@ -0,0 +1,212 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Teach a virtual class with Moodle on Linux) +[#]: via: (https://opensource.com/article/20/10/moodle) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +Teach a virtual class with Moodle on Linux +====== +Teach school remotely with the Moodle learning management system on +Linux. +![Digital images of a computer desktop][1] + +The pandemic has created a greater need for remote education than ever before. This makes a learning management system (LMS) like [Moodle][2] more important than ever for ensuring that education stays on track as more and more schooling is delivered virtually. + +Moodle is a free LMS written in PHP and distributed under the open source [GNU Public License][3] (GPL). It was developed by [Martin Dougiamas][4] and has been under continuous development since its release in 2002. Moodle can be used for blended learning, distance learning, flipped classrooms, and other forms of e-learning. There are currently over [190 million users][5] and 145,000 registered Moodle sites worldwide. + +I have used Moodle as an administrator, teacher, and student, and in this article, I'll show you how to set it up and get started using it. + +### Install Moodle on Linux + +Moodle's [system requirements][6] are modest, and there is plenty of documentation to help you. My favorite installation method is by downloading it as an ISO from [Turnkey Linux][7] and installing a Moodle site in VirtualBox. + +First, download the [Moodle ISO][8] and save it to your computer. + +Next, install VirtualBox from the Linux command line with + + +``` +$ sudo apt install virtualbox +``` + +or + + +``` +$ sudo dnf install virtualbox +``` + +Once the download completes, start VirtualBox and select the **New** button on the console. + +![Create a new VirtualBox][9] + +(Don Watkins, [CC BY-SA 4.0][10]) + +Choose a name for your virtual machine, your operating system (Linux), and the type of Linux you're using (e.g., Debian 64-bit). + +![Naming the VirtualBox VM][11] + +(Don Watkins, [CC BY-SA 4.0][10]) + +Next, set your virtual machine (VM) memory size—use the default 1024MB. Then, choose a **dynamically allocated** virtual disk and attach the Moodle.iso to your virtual machine. + +![Attaching Moodle.iso to VM][12] + +(Don Watkins, [CC BY-SA 4.0][10]) + +Change your network settings from NAT to **Bridged adapter**. Then start the machine and install the ISO to create the Moodle virtual machine. During installation, you will be prompted to create passwords for the root account, MySQL, and Moodle. The Moodle password must include at least eight characters, one upper case letter, and one special character. + +Reboot the virtual machine. When the installation finishes, be sure to record your Moodle appliance settings somewhere safe. (After the installation, you can delete the ISO file if you want.) + +![Moodle appliance settings][13] + +(Don Watkins, [CC BY-SA 4.0][10]) + +It's important to note that your Moodle instance isn't visible by anyone on the Internet yet. It only exists in your local network: only people in your building who are connected to the same router or wifi access point as you can access your site right now. The worldwide Internet can't get to it because you're behind a firewall (embedded in your router, and possibly also in your computer). For more information on configuring your network, read Seth Kenlon's article on [opening ports and routing traffic through your firewall.][14] + +### Start using Moodle + +Now you are ready to log into your Moodle machine and get familiar with the software. Log into Moodle using the default login username, **admin**, and the password you set when you created the Moodle VM. + +![Moodle login screen][15] + +(Don Watkins, [CC BY-SA 4.0][10]) + +After logging in for the first time, you'll see your new Moodle site's main Dashboard.  + +![Moodle admin dashboard][16] + +(Don Watkins, [CC BY-SA 4.0][10]) + +The default appliance name is **Turnkey Moodle**, but it's easy to change it to suit your school, classroom, or other needs and preferences. To personalize your Moodle site, in the menu on the left-hand side of the user interface, select **Site home**. Then click on the **Settings** icon on the right side of the display, and choose **Edit settings**. + +![Moodle settings][17] + +(Don Watkins, [CC BY-SA 4.0][10]) + +You can change your site's name and add a short name and site description if you'd like. + +![Name Moodle site][18] + +(Don Watkins, [CC BY-SA 4.0][10]) + +Be sure to scroll to the bottom and save your changes. Now your site is personalized. + +![Moodle changes saved][19] + +(Don Watkins, [CC BY-SA 4.0][10]) + +The default category is Miscellaneous, which won't help people identify your site's purpose. To add a category, return to the main Dashboard and select **Site administration** from the left-hand menu. Under **Courses**, select **Add a category **and enter details about your site. + +![Add category option in Moodle][20] + +(Don Watkins, [CC BY-SA 4.0][10]) + +To add a course, return to **Site administration**, and click **Add a new course**. You will see a series of options, such as naming your course, providing a short name, assigning a category, and setting the course start and end dates. You can also set options for the course's format, such as social, weekly, and topic, as well as its appearance, file upload size, completion tracking, and more. + +![Add course option in Moodle][21] + +(Don Watkins, [CC BY-SA 4.0][10]) + +### Add and manage users + +Now that you have set up a course, you can add users. There are a variety of ways to do this. Manual entry is a good place to start if you are a homeschooler. Moodle supports email-based registration, [LDAP][22], [Shibboleth][23], and many others. School districts and other larger installations can upload users with a comma-delimited file. Passwords can be added in bulk, too, with a forced password change at first login. For more information, be sure to consult Moodle's [documentation][24]. + +Moodle is a very granular, permission-oriented environment. It is easy to assign policies and roles to users and enforce those assignments using Moodle's menus. + +There are many roles within Moodle, and each has specific privileges and permissions. The default roles are manager, course creator, teacher, non-editing teacher, student, guest, and authenticated user, but you can add other ones. + +### Add content to your course + +Once you have your Moodle site and a course set up, you can add content to the course. Moodle has all the tools you need to create great content, and it's built on solid pedagogy that emphasizes a [social constructionist][25] view. + +I created a sample course called Code with [Mu][26]. It is in the **Programming** category and **Python** subcategory. + +![Moodle course list][27] + +(Don Watkins, [CC BY-SA 4.0][10]) + +I chose a weekly format for my course with the default of four weeks. Using the editing tools, I hid all but the first week of the course. This ensures my students stay focused on the material. + +As the teacher or Moodle administrator, I can add activities to each week's instruction by clicking **Add an activity** **or resource**. + +![Add activity in Moodle][28] + +(Don Watkins, [CC BY-SA 4.0][10]) + +I get a pop-up window with a variety of activities I can assign to my students. + +![Moodle activities menu][29] + +(Don Watkins, [CC BY-SA 4.0][10]) + +Moodle's tools and activities make it easy for me to create learning materials and cap off the week with a short quiz. + +![Moodle activities checklist][30] + +(Don Watkins, [CC BY-SA 4.0][10]) + +There are more than 1,600 plugins you can use to extend Moodle with new activities, question types, integrations with other systems, and more. For example, the [BigBlueButton][31] plugin supports slide sharing, a whiteboard, audio and video chat, and breakout rooms. Others to consider include the [Jitsi][32] plugin for videoconferencing, a [plagiarism checker][33], and an [Open Badge Factory][34] for awarding badges. + +### Keep exploring Moodle + +Moodle is a powerful LMS, and I hope this introduction whets your appetite to learn more. There are excellent [tutorials][35] to help you improve your skills, and you can see Moodle in action on its [demonstration site][36] or access [Moodle's source code][37] if you want to see what's under the hood or [contribute][38] to development. Moodle also has a great [mobile app][39] for iOS and Android, if you like to work on the go. Follow Moodle on [Twitter][40], [Facebook][41], and [LinkedIn][42] to stay up to date on what's new. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/moodle + +作者:[Don Watkins][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://opensource.com/users/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_desk_home_laptop_browser.png?itok=Y3UVpY0l (Digital images of a computer desktop) +[2]: https://moodle.org/ +[3]: https://docs.moodle.org/19/en/GNU_General_Public_License +[4]: https://dougiamas.com/about/ +[5]: https://docs.moodle.org/39/en/History +[6]: https://docs.moodle.org/39/en/Installation_quick_guide#Basic_Requirements +[7]: https://www.turnkeylinux.org/ +[8]: https://www.turnkeylinux.org/download?file=turnkey-moodle-16.0-buster-amd64.iso +[9]: https://opensource.com/sites/default/files/uploads/virtualbox_new.png (Create a new VirtualBox) +[10]: https://creativecommons.org/licenses/by-sa/4.0/ +[11]: https://opensource.com/sites/default/files/uploads/virtualbox_namevm.png (Naming the VirtualBox VM) +[12]: https://opensource.com/sites/default/files/uploads/virtualbox_attach-iso.png (Attaching Moodle.iso to VM) +[13]: https://opensource.com/sites/default/files/uploads/moodle_appliance.png (Moodle appliance settings) +[14]: https://opensource.com/article/20/9/firewall +[15]: https://opensource.com/sites/default/files/uploads/moodle_login.png (Moodle login screen) +[16]: https://opensource.com/sites/default/files/uploads/moodle_dashboard.png (Moodle admin dashboard) +[17]: https://opensource.com/sites/default/files/uploads/moodle_settings.png (Moodle settings) +[18]: https://opensource.com/sites/default/files/uploads/moodle_name-site.png (Name Moodle site) +[19]: https://opensource.com/sites/default/files/uploads/moodle_saved.png (Moodle changes saved) +[20]: https://opensource.com/sites/default/files/uploads/moodle_addcategory.png (Add category option in Moodle) +[21]: https://opensource.com/sites/default/files/uploads/moodle_addcourse.png (Add course option in Moodle) +[22]: https://en.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol +[23]: https://www.shibboleth.net/ +[24]: https://docs.moodle.org/39/en/Main_page +[25]: https://docs.moodle.org/39/en/Pedagogy#How_Moodle_tries_to_support_a_Social_Constructionist_view +[26]: https://opensource.com/article/20/9/teach-python-mu +[27]: https://opensource.com/sites/default/files/uploads/moodle_choosecourse.png (Moodle course list) +[28]: https://opensource.com/sites/default/files/uploads/moodle_addactivity_0.png (Add activity in Moodle) +[29]: https://opensource.com/sites/default/files/uploads/moodle_activitiesmenu.png (Moodle activities menu) +[30]: https://opensource.com/sites/default/files/uploads/moodle_activitieschecklist.png (Moodle activities checklist) +[31]: https://moodle.org/plugins/mod_bigbluebuttonbn +[32]: https://moodle.org/plugins/mod_jitsi +[33]: https://moodle.org/plugins/plagiarism_unicheck +[34]: https://moodle.org/plugins/local_obf +[35]: https://learn.moodle.org/ +[36]: https://school.moodledemo.net/ +[37]: https://git.in.moodle.com/moodle/moodle +[38]: https://git.in.moodle.com/moodle/moodle/-/blob/master/CONTRIBUTING.txt +[39]: https://download.moodle.org/mobile/ +[40]: https://twitter.com/moodle +[41]: https://www.facebook.com/moodle +[42]: https://www.linkedin.com/company/moodle/ From 8d405f6c7a8f6767f171d48b4d76c90dec39c162 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 16 Oct 2020 08:43:53 +0800 Subject: [PATCH 0475/1156] translating --- ...01013 Install MariaDB or MySQL on Linux.md | 118 ------------------ ...01013 Install MariaDB or MySQL on Linux.md | 117 +++++++++++++++++ 2 files changed, 117 insertions(+), 118 deletions(-) delete mode 100644 sources/tech/20201013 Install MariaDB or MySQL on Linux.md create mode 100644 translated/tech/20201013 Install MariaDB or MySQL on Linux.md diff --git a/sources/tech/20201013 Install MariaDB or MySQL on Linux.md b/sources/tech/20201013 Install MariaDB or MySQL on Linux.md deleted file mode 100644 index c12bdf214f..0000000000 --- a/sources/tech/20201013 Install MariaDB or MySQL on Linux.md +++ /dev/null @@ -1,118 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Install MariaDB or MySQL on Linux) -[#]: via: (https://opensource.com/article/20/10/mariadb-mysql-linux) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Install MariaDB or MySQL on Linux -====== -Get started using an open source SQL database on your Linux system. -![Person standing in front of a giant computer screen with numbers, data][1] - -Both [MariaDB][2] and [MySQL][3] are open source databases that use SQL and share the same original codebase. MariaDB is a drop-in replacement for MySQL, so much so that you use the same command (`mysql`) to interact with MySQL and MariaDB databases. This article, therefore, applies equally to MariaDB and MySQL. - -### Install MariaDB - -You can install MariaDB using your Linux distribution's package manager. On most distributions, MariaDB is split into a server package and a client package. The server package provides the database "engine," the part of MariaDB that runs (usually on a physical server) in the background, listening for data input or requests for data output. The client package provides the command `mysql`, which you can use to communicate with the server. - -On RHEL, Fedora, CentOS, or similar: - - -``` -`$ sudo dnf install mariadb mariadb-server` -``` - -On Debian, Ubuntu, Elementary, or similar: - - -``` -`$ sudo apt install mariadb-client mariadb-server` -``` - -Other systems may package MariaDB differently systems, so you may need to search your software repository to learn how your distribution's maintainers provide it. - -### Start MariaDB - -Because MariaDB is designed to function, in part, as a database server, it can run on one computer and be administered from another. As long as you have access to the computer running it, you can use the `mysql` command to administer the database. I ran MariaDB on my local computer when writing this article, but it's just as likely that you'll interact with a MariaDB database hosted on a remote system. - -Before starting MariaDB, you must create an initial database. You should define the user you want MariaDB to use when initializing its file structure. By default, MariaDB uses the current user, but you probably want it to use a dedicated user account. Your package manager probably configured a system user and group for you. Use `grep` to find out whether there's a `mysql` group: - - -``` -$ grep mysql /etc/group -mysql❌27: -``` - -You can also look in `/etc/passwd` for a dedicated user, but usually, where there's a group, there's also a user. If there isn't a dedicated `mysql` user and group, look through `/etc/group` for an obvious alternative (such as `mariadb`). Failing that, read your distribution's documentation to learn how MariaDB runs. - -Assuming your install uses `mysql`, initialize the database environment: - - -``` -$ sudo mysql_install_db --user=mysql -Installing MariaDB/MySQL system tables in '/var/lib/mysql'... -OK -[...] -``` - -The result of this step reveals the next tasks you must perform to configure MariaDB: - - -``` -PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER ! -To do so, start the server, then issue the following commands: - -'/usr/bin/mysqladmin' -u root password 'new-password' -'/usr/bin/mysqladmin' -u root -h $(hostname) password 'new-password' - -Alternatively you can run: -'/usr/bin/mysql_secure_installation' - -which will also give you the option of removing the test -databases and anonymous user created by default.  This is -strongly recommended for production servers. -``` - -Start MariaDB using your distribution's init system: - - -``` -`$ sudo systemctl start mariadb` -``` - -To enable the MariaDB server to start upon boot: - - -``` -`$ sudo systemctl enable --now mariadb` -``` - -Now that you have a MariaDB server to communicate with, set a password for it: - - -``` -mysqladmin -u root password 'myreallysecurepassphrase' -mysqladmin -u root -h $(hostname) password 'myreallysecurepassphrase' -``` - -Finally, if you intend to use this installation on a production server, run the `mysql_secure_installation` command before going live. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/10/mariadb-mysql-linux - -作者:[Seth Kenlon][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://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) -[2]: https://mariadb.org/ -[3]: https://www.mysql.com/ diff --git a/translated/tech/20201013 Install MariaDB or MySQL on Linux.md b/translated/tech/20201013 Install MariaDB or MySQL on Linux.md new file mode 100644 index 0000000000..ad5c67ff1c --- /dev/null +++ b/translated/tech/20201013 Install MariaDB or MySQL on Linux.md @@ -0,0 +1,117 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Install MariaDB or MySQL on Linux) +[#]: via: (https://opensource.com/article/20/10/mariadb-mysql-linux) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +在 Linux 上安装 MariaDB 或 MySQL +====== +开始在 Linux 系统上使用开源的 SQL 数据库。 +![Person standing in front of a giant computer screen with numbers, data][1] + +[MariaDB][2] 和 [MySQL][3] 都是使用 SQL 的开源数据库,并且共享相同的原始代码库。MariaDB 是 MySQL 的替代品,因此你可以使用相同的命令 (`mysql`) 与 MySQL 和 MariaDB 数据库进行交互。因此,本文同时适用于 MariaDB 和 MySQL。 + +### 安装 MariaDB + +你可以使用你的 Linux 发行版的包管理器安装 MariaDB。在大多数发行版上,MariaDB 分为服务器包和客户端包。服务器包提供了数据库”引擎“,即 MariaDB 在后台运行(通常在物理服务器上)的部分,它监听数据输入或数据输出请求。客户端包提供了 `mysql` 命令,你可以用它来与服务器通信。 + +在 RHEL、Fedora、CentOS 或类似的发行版上: + + +``` +`$ sudo dnf install mariadb mariadb-server` +``` + +在 Debian、Ubuntu、Elementary 或类似的发行版上: + + +``` +`$ sudo apt install mariadb-client mariadb-server` +``` + +其他系统可能会以不同的系统打包 MariaDB,所以你可能需要搜索你的软件仓库来了解你的发行版的维护者是如何提供它的。 + +### 启动 MariaDB + +因为 MariaDB 被设计成一部分作为数据库服务器的功能,它可以在一台计算机上运行,并从另一台计算机上进行管理。只要你能访问运行它的计算机,你就可以使用 `mysql` 命令来管理数据库。在写这篇文章时,我在本地计算机上运行了 MariaDB,但你同样可能会与远程系统上托管的 MariaDB 数据库进行交互。 + +在启动 MariaDB 之前,你必须创建一个初始数据库。在初始化其文件结构时,你应该定义你希望 MariaDB 使用的用户。默认情况下,MariaDB 使用当前用户,但你可能希望它使用一个专用的用户帐户。你的包管理器可能为你配置了一个系统用户和组。使用 `grep` 查找是否有一个 `mysql` 组: + +``` +$ grep mysql /etc/group +mysql❌27: +``` + +你也可以在 `/etc/passwd` 中寻找这个专门的用户,但通常情况下,有组的地方就有用户。如果没有专门的 `mysql` 用户和组,可以在 `/etc/group` 中寻找一个明显的替代(比如 `mariadb`)。如果没有,请阅读你的发行版文档来了解 MariaDB 是如何运行的。 + +假设你的安装使用 `mysql`,初始化数据库环境: + + +``` +$ sudo mysql_install_db --user=mysql +Installing MariaDB/MySQL system tables in '/var/lib/mysql'... +OK +[...] +``` + +这一步的结果显示了接下来你必须执行的配置 MariaDB 的任务: + + +``` +PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER ! +To do so, start the server, then issue the following commands: + +'/usr/bin/mysqladmin' -u root password 'new-password' +'/usr/bin/mysqladmin' -u root -h $(hostname) password 'new-password' + +Alternatively you can run: +'/usr/bin/mysql_secure_installation' + +which will also give you the option of removing the test +databases and anonymous user created by default.  This is +strongly recommended for production servers. +``` + +使用你的发行版的 init 系统启动 MariaDB: + + +``` +`$ sudo systemctl start mariadb` +``` + +在启动时启用 MariaDB 服务器: + + +``` +`$ sudo systemctl enable --now mariadb` +``` + +现在你已经有了一个 MariaDB 服务器,为它设置一个密码: + + +``` +mysqladmin -u root password 'myreallysecurepassphrase' +mysqladmin -u root -h $(hostname) password 'myreallysecurepassphrase' +``` + +最后,如果你打算在生产服务器上使用它,请在上线前运行 `mysql_secure_installation` 命令。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/mariadb-mysql-linux + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) +[2]: https://mariadb.org/ +[3]: https://www.mysql.com/ From c8f6cb1459be07d099d1bb13c82aaaba91c179f7 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 16 Oct 2020 08:49:36 +0800 Subject: [PATCH 0476/1156] translating --- .../20201014 2 Ways to Download Files From Linux Terminal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201014 2 Ways to Download Files From Linux Terminal.md b/sources/tech/20201014 2 Ways to Download Files From Linux Terminal.md index f1ba956e9a..a0e8d81210 100644 --- a/sources/tech/20201014 2 Ways to Download Files From Linux Terminal.md +++ b/sources/tech/20201014 2 Ways to Download Files From Linux Terminal.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d0d805fd3a6137057705f9276ee94984dea777e5 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 16 Oct 2020 10:05:03 +0800 Subject: [PATCH 0477/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200922?= =?UTF-8?q?=20How=20to=20Reduce/Shrink=20LVM=E2=80=99s=20(Logical=20Volume?= =?UTF-8?q?=20Resize)=20in=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md --- ... LVM-s (Logical Volume Resize) in Linux.md | 171 ++++++++++++++++++ 1 file changed, 171 insertions(+) create mode 100644 sources/tech/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md diff --git a/sources/tech/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md b/sources/tech/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md new file mode 100644 index 0000000000..48107292e8 --- /dev/null +++ b/sources/tech/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md @@ -0,0 +1,171 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Reduce/Shrink LVM’s (Logical Volume Resize) in Linux) +[#]: via: (https://www.2daygeek.com/reduce-shrink-decrease-resize-lvm-logical-volume-in-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +How to Reduce/Shrink LVM’s (Logical Volume Resize) in Linux +====== + +Reducing/Shrinking the logical volume is the highest risk of data corruption. + +So try to avoid this kind of situation if possible, but go ahead if you have no other options. + +It is always recommended to make a backup before shrinking an LVM. + +When you are running out of disk space in LVM, you can make some free space on the volume group by reducing the exsisting LVM that no longer uses the full size, instead of adding a new physical disk. + +**Make a note:** Shrinking is not supported on a `GFS2` or `XFS` file system. + +If you are new to Logical Volume Management (LVM), I suggest you start with our previous article. + + * **Part-1: [How to Create/Configure LVM (Logical Volume Management) in Linux][1]** + * **Part-2: [How to Extend/Increase LVM’s (Logical Volume Resize) in Linux][2]** + + + +![][3] + +Reducing the logical volume involves the below steps. + + * Unmount the file system. + * Check the file system for any errors. + * Shrink the file system size. + * Reduce the logical volume size. + * Re-check the file system for errors (Optional). + * Mount the file system + * Check the reduced file system size + + + +**For instance;** You have a **100GB** LVM that no longer uses the full size, you want to reduce it to **80GB** so **20GB** can be used for other purposes. + +``` +# df -h /testlvm1 + +Filesystem Size Used Avail Use% Mounted on +/dev/mapper/vg01-lv002 100G 15G 85G 12% /testlvm1 +``` + +### 1) Unmount the file system + +Use the umount command to unmount the file system. + +``` +# umount /testlvm1 +``` + +### 2) Check the file system for any Errors + +Check the file system for any errors using the e2fsck command. + +``` +# e2fsck -f /dev/mapper/vg01-lv002 + +e2fsck 1.42.9 (28-Dec-2013) +Pass 1: Checking inodes, blocks, and sizes +Pass 2: Checking directory structure +Pass 3: Checking directory connectivity +Pass 4: Checking reference counts +Pass 5: Checking group summary information +/dev/mapper/vg01-lv002: 13/6553600 files (0.0% non-contiguous), 12231854/26212352 blocks +``` + +### 3) Shrink the file system. + +The below command will reduce the **“testlvm1”** file system from **100GB** to **80GB**. + +**Common syntax for file system resize (resize2fs).** + +``` +resize2fs [Existing Logical Volume Name] [New Size of File System] +``` + +The actual command is as follows. + +``` +# resize2fs /dev/mapper/vg01-lv002 80G + +resize2fs 1.42.9 (28-Dec-2013) +Resizing the filesystem on /dev/mapper/vg01-lv002 to 28321400 (4k) blocks. +The filesystem on /dev/mapper/vg01-lv002 is now 28321400 blocks long. +``` + +### 4) Reduce the Logical Volume (LVM) + +Now reduce the logical volume (LVM) size using the lvreduce command. The below command **“/dev/mapper/vg01-lv002”** will shrink the Logical volume (LVM) from 100GB to 80GB. + +**Common syntax for LVM Reduce (lvreduce)** + +``` +lvreduce [New Size of LVM] [Existing Logical Volume Name] +``` + +The actual command is as follows. + +``` +# lvreduce -L 80G /dev/mapper/vg01-lv002 + +WARNING: Reducing active logical volume to 80.00 GiB +THIS MAY DESTROY YOUR DATA (filesystem etc.) +Do you really want to reduce lv002? [y/n]: y +Reducing logical volume lv002 to 80.00 GiB +Logical volume lv002 successfully resized +``` + +### 5) Optional: Check the file system for any Errors + +Check the file system again if there are any errors after LVM has been reduced. + +``` +# e2fsck -f /dev/mapper/vg01-lv002 + +e2fsck 1.42.9 (28-Dec-2013) +Pass 1: Checking inodes, blocks, and sizes +Pass 2: Checking directory structure +Pass 3: Checking directory connectivity +Pass 4: Checking reference counts +Pass 5: Checking group summary information +/dev/mapper/vg01-lv002: 13/4853600 files (0.0% non-contiguous), 1023185/2021235 blocks +``` + +### 6) Mount the file system and check the reduced size + +Finally mount the file system and check the reduced file system size. + +Use the mount command to **[mount the logical volume][4]**. + +``` +# mount /testlvm1 +``` + +Check the newly mounted volume using the **[df command][5]**. + +``` +# df -h /testlvm1 + +Filesystem Size Used Avail Use% Mounted on +/dev/mapper/vg01-lv002 80G 15G 65G 18% /testlvm1 +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/reduce-shrink-decrease-resize-lvm-logical-volume-in-linux/ + +作者:[Magesh Maruthamuthu][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://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/create-lvm-storage-logical-volume-manager-in-linux/ +[2]: https://www.2daygeek.com/extend-increase-resize-lvm-logical-volume-in-linux/ +[3]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[4]: https://www.2daygeek.com/mount-unmount-file-system-partition-in-linux/ +[5]: https://www.2daygeek.com/linux-check-disk-space-usage-df-command/ From d99abfa2237b520b0155d928cad7cd78b7f389b9 Mon Sep 17 00:00:00 2001 From: LiHongjie <41796335+lihongjie224@users.noreply.github.com> Date: Fri, 16 Oct 2020 12:00:03 +0800 Subject: [PATCH 0478/1156] update translator --- ... A beginner-s guide to SSH for remote connection on Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200907 A beginner-s guide to SSH for remote connection on Linux.md b/sources/tech/20200907 A beginner-s guide to SSH for remote connection on Linux.md index 64c7c297b7..a2da86eb65 100644 --- a/sources/tech/20200907 A beginner-s guide to SSH for remote connection on Linux.md +++ b/sources/tech/20200907 A beginner-s guide to SSH for remote connection on Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lihongjie224) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 650f99fbad35bf15b62b0af6e8f6a18671289f02 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 16 Oct 2020 21:07:50 +0800 Subject: [PATCH 0479/1156] PRF @robsean --- ... Improvements and Tons of Other Changes.md | 52 ++++++++++--------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/translated/tech/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md b/translated/tech/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md index c708b84ed0..04067d837c 100644 --- a/translated/tech/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md +++ b/translated/tech/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md @@ -1,97 +1,99 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes) [#]: via: (https://itsfoss.com/gnome-3-38-release/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -GNOME 3.38 携可定制应用程序网格,性能改善和大量其它的更改而来 +GNOME 3.38:可定制应用程序网格、性能改善 ====== -[GNOME 3.36][1] 带来大量急需改善,同时也带来性能的重大提升。现在,在6个月后,我们终于和具有一系列的更改的 GNOME 3.38 一起到来。 +![](https://img.linux.net.cn/data/attachment/album/202010/16/203906xys0py0nvi1d01ss.jpg) + +[GNOME 3.36][1] 带来大量亟需的改进,同时也带来性能的重大提升。现在,在 6 个月后,我们终于引来了 GNOME 3.38,并带来了一系列重大的变化。 ### GNOME 3.38 主要特色 这里是 GNOME 3.38 (代码名称:Orbis) 的主要亮点: -[更多 Linux 视频,请订阅我们的 YouTube 频道][2] +- [video](https://www.youtube.com/embed/DZ_P5W9r2JY) #### 可定制应用程序菜单 -作为 GNOME 3.38 重大更改中的一部分,应用程序网格或应用程序菜单现在是可以可定制的。 +作为 GNOME 3.38 重大更改中的一部分,应用程序网格(或称应用菜单)现在是可以可定制的。 -现在,你可以通过拖拽每个应用程序图标来创建文件夹,将它们移到/移出文件夹,并且可以在应用程序网格中重新设置回来。你也可以在应用程序网格中如你所想一样的重新定位图标。 +现在,你可以通过拖拽每个应用程序图标来创建文件夹,将它们移到文件夹,或移出文件夹并将其设置回应用网格。你也可以在应用网格中随心所欲地调整图标的位置。 ![][3] -此外,这些变化是一些即将到来的未来设计更改更新的基本组成部分 — 因此,看到我们可以期待的东西会很令人兴奋。 +此外,这些变化是一些即将到来的设计更改的基本组成部分,因此,看到我们可以期待的东西会很令人兴奋。 #### 日历菜单更新 ![][4] -随着最近一次的 GNOME 更新,通知区整洁了很多,但是现在随着 GNOME 3.38 的到来,你终于可以通过访问日历区正下方的日历事件来更方便地处理事情。 +随着最近一次的 GNOME 更新,通知区整洁了很多,但是现在随着 GNOME 3.38 的到来,你终于可以通过日历区域的正下方访问日历事件,使事情变得方便且容易访问。 -它不是一个主要的可见改造,但是它也有不少的改善。 +它不是一个重大的视觉改造,但也是一些改善。 #### 家长控制改善 -你将会注意作为 GNOME 3.38 一部分的家长控制服务。它支持与桌面,shell,设置以及其它各种各样组件的集成来帮助你限制用户可以访问的内容。 +作为 GNOME 3.38 一部分,你将会注意家长控制服务。它支持与桌面、shell、设置以及其它各种各样组件的集成,来帮助你限制用户可以访问的内容。 #### 重新启动按钮 -一些细微的改善导致了巨大的变化,重新启动按钮正是其中的一个变化。先单击 “关闭电源” / “关机” 按钮,再单击 “重新启动” 按钮的操作来重新启动系统总是让人很烦闷。 +一些细微的改善导致了巨大的变化,重新启动按钮正是其中的一个变化。先单击 “关闭电源” / “关机” 按钮,再单击 “重新启动” 按钮的操作来重新启动系统总是让人很烦。 因此,随着 GNOME 3.38 的到来,你将最终会注意到一个作为单独按钮的 “重新启动” ,这将节省你的单击次数,平复你烦闷的心情。 #### 屏幕录制改善 -[GNOME shell 的内置屏幕录制][5] 现在是一项独立的系统服务,这可能会使录制屏幕成为一种平滑流畅的体验。 +[GNOME shell 内置的屏幕录制][5] 现在是一项独立的系统服务,这可能会使录制屏幕成为一种平滑流畅的体验。 -另外,窗口截屏也有一些改善,并修复了一些错误。 +另外,窗口截屏也有一些改善,并修复了一些错误: + +- [video](https://www.youtube.com/embed/c29ge3KwBk8) #### GNOME 应用程序更新 -GNOME 计算器也收到很多的错误修复。除此之外,你也将发现 [epiphany GNOME 浏览器][6] 的一些重大改变. +GNOME 计算器也收到很多的错误修复。除此之外,你也将发现 [epiphany GNOME 浏览器][6] 的一些重大改变。 GNOME Boxes 现在允许你从一个操作系统列表中选择将要运行的操作系统,GNOME 地图也有一些图像用户界面上的更改。 -当然,不仅限于这些,你页将注意到 GNOME 控制中心,联系人,照片,Nautilus,以及其它一些软件包的细微更新和修复。 +当然,不仅限于这些,你页将注意到 GNOME 控制中心、联系人、照片、Nautilus,以及其它一些软件包的细微更新和修复。 #### 性能和多显示器支持改善 -这里有一大堆隐藏改善来全面地改善 GNOME 3.38 。 例如,[Mutter][7] 有一些重要的修复,它现在允许在两个显示器中使用不同的刷新频率。 +这里有一大堆底层的改进来全面地改善 GNOME 3.38 。例如,[Mutter][7] 有一些重要的修正,它现在允许在两个显示器中使用不同的刷新频率。 ![][8] 先前,如果一台显示器的刷新频率为 60 Hz,而另一台的刷新频率为 144 Hz ,那么刷新频率较慢的显示器将限制另外一台显示器的刷新频率。但是,随着在 GNOME 3.38 中的改善,它将能够处理多个显示器,而不会使显示器相互限制。 -另外,[Phoronix][9] 报告的一些更改指出,在一些情况下,缩短大约 10% 的渲染时间。因此,巨大的性能优化是很确定的。 +另外,[Phoronix][9] 报告的一些更改指出,在一些情况下,缩短大约 10% 的渲染时间。因此,这绝对是一个很棒的性能优化。 #### 各种各样的其它更改 * 电池百分比指示器 - * 在电源菜单中的重新启动选项 - * 新的欢迎参观N + * 电源菜单中的重新启动选项 + * 新的欢迎指引 * 指纹登录 - * 二维码扫描共享 Wi-Fi 热点 + * 二维码扫描以共享 Wi-Fi 热点 * GNOME 浏览器的隐私和其它改善 * GNOME 地图现在反应敏捷并能根据屏幕大小改变其大小 * 重新修订的图标 - - 你可以在它们的官方 [更改日志][10] 中找到一个详细的更改列表。 ### 总结 -GNOME 3.38 确实是一个令人赞叹的改善 GNOME 用户体验的更新。尽管 GNOME 3.36 带来了性能的很大改善, 但是针对 GNOME 3.38 的更多优化仍然是一件非常好的事. +GNOME 3.38 确实是一个令人赞叹的更新,它改善了 GNOME 用户体验。尽管 GNOME 3.36 带来了性能的很大改善,但是针对 GNOME 3.38 的更多优化仍然是一件非常好的事. GNOME 3.38 将在 Ubuntu 20.10 和 [Fedora 33][11] 中可用。Arch 和 Manjaro 用户应该很快就能获得。 -我认为在正确的方向上有大量的更改。你觉得呢? +我认为有很多变化是朝着正确的方向发展的。你觉得呢? -------------------------------------------------------------------------------- @@ -100,7 +102,7 @@ via: https://itsfoss.com/gnome-3-38-release/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[robsean](https://github.com/robsean) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From bd96a818a772b3f0f0646000dff1f16b1b69b615 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 16 Oct 2020 21:08:26 +0800 Subject: [PATCH 0480/1156] PUB @robsean https://linux.cn/article-12726-1.html --- ...rid, Performance Improvements and Tons of Other Changes.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md (98%) diff --git a/translated/tech/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md b/published/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md similarity index 98% rename from translated/tech/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md rename to published/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md index 04067d837c..b51f072124 100644 --- a/translated/tech/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md +++ b/published/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12726-1.html) [#]: subject: (GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes) [#]: via: (https://itsfoss.com/gnome-3-38-release/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From f7ad0bb315a24837b8d2cab72bf7cf7f9d0d232b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 17 Oct 2020 05:01:41 +0800 Subject: [PATCH 0481/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201016?= =?UTF-8?q?=20systemd-resolved:=20introduction=20to=20split=20DNS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201016 systemd-resolved- introduction to split DNS.md --- ...emd-resolved- introduction to split DNS.md | 162 ++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 sources/tech/20201016 systemd-resolved- introduction to split DNS.md diff --git a/sources/tech/20201016 systemd-resolved- introduction to split DNS.md b/sources/tech/20201016 systemd-resolved- introduction to split DNS.md new file mode 100644 index 0000000000..0801dd90fa --- /dev/null +++ b/sources/tech/20201016 systemd-resolved- introduction to split DNS.md @@ -0,0 +1,162 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (systemd-resolved: introduction to split DNS) +[#]: via: (https://fedoramagazine.org/systemd-resolved-introduction-to-split-dns/) +[#]: author: (zbyszek https://fedoramagazine.org/author/zbyszek/) + +systemd-resolved: introduction to split DNS +====== + +![][1] + +Photo by [Ruvim Noga][2] on [Unsplash][3] + +Fedora 33 switches the default DNS resolver to [systemd-resolved][4]. In simple terms, this means that systemd-resolved will run as a daemon. All programs wanting to translate domain names to network addresses will talk to it. This replaces the current default lookup mechanism where each program individually talks to remote servers and there is no shared cache. + +If necessary, systemd-resolved will contact remote DNS servers. systemd-resolved is a “stub resolver”—it doesn’t resolve all names itself (by starting at the root of the DNS hierarchy and going down label by label), but forwards the queries to a remote server. + +A single daemon handling name lookups provides significant benefits. The daemon caches answers, which speeds answers for frequently used names. The daemon remembers which servers are non-responsive, while previously each program would have to figure this out on its own after a timeout. Individual programs only talk to the daemon over a local transport and are more isolated from the network. The daemon supports fancy rules which specify which name servers should be used for which domain names—in fact, the rest of this article is about those rules. + +### Split DNS + +Consider the scenario of a machine that is connected to two semi-trusted networks (wifi and ethernet), and also has a VPN connection to your employer. Each of those three connections has its own network interface in the kernel. And there are multiple name servers: one from a DHCP lease from the wifi hotspot, two specified by the VPN and controlled by your employer, plus some additional manually-configured name servers. _Routing_ is the process of deciding which servers to ask for a given domain name. Do not mistake this with the process of deciding where to send network packets, which is called routing too. + +The network interface is king in systemd-resolved. systemd-resolved first picks one or more interfaces which are appropriate for a given name, and then queries one of the name servers attached to that interface. This is known as “split DNS”. + +There are two flavors of domains attached to a network interface: _routing domains_ and _search domains_. They both specify that the given domain and any subdomains are appropriate for that interface. Search domains have the additional function that single-label names are suffixed with that search domain before being resolved. For example, a lookup for “server” is treated as a lookup for “server.example.com” if the search domain is “example.com.” In systemd-resolved config files, routing domains are prefixed with the tilde (~) character. + +#### Specific example + +Now consider a specific example: your VPN interface _tun0_ has a search domain _private.company.com_ and a routing domain _~company.com_. If you ask for _mail.private.company.com_, it is matched by both domains, so this name would be routed to _tun0_. + +A request for _[www.company.com][5]_ is matched by the second domain and would also go to _tun0_. If you ask for _www_, (in other words, if you specify a single-label name without any dots), the difference between routing and search domains comes into play. systemd-resolved attempts to combine the single-label name with the search domain and tries to resolve _[www.private.company.com][6]_ on _tun0_. + +If you have multiple interfaces with search domains, single-label names are suffixed with all search domains and resolved in parallel. For multi-label names, no suffixing is done; search and routing domains are are used to route the name to the appropriate interface. The longest match wins. When there are multiple matches of the same length on different interfaces, they are resolved in parallel. + +A special case is when an interface has a routing domain _~._ (a tilde for a routing domain and a dot for the root DNS label). Such an interface always matches any names, but with the shortest possible length. Any interface with a matching search or routing domain has higher priority, but the interface with _~._ is used for all other names. Finally, if no routing or search domains matched, the name is routed to all interfaces that have at least one name server attached. + +### Lookup routing in systemd-resolved + +#### Domain routing + +This seems fairly complex, partially because of the historic names which are confusing. In actual practice it’s not as complicated as it seems. + +To introspect a running system, use the _resolvectl domain_ command. For example: + +``` +$ resolvectl domain +Global: +Link 4 (wlp4s0): ~. +Link 18 (hub0): +Link 26 (tun0): redhat.com +``` + +You can see that _www_ would resolve as _[www.redhat.com][7]_. over _tun0_. Anything ending with _redhat.com_ resolves over _tun0_. Everything else would resolve over _wlp4s0_ (the wireless interface). In particular, a multi-label name like _[www.foobar][8]_ would resolve over _wlp4s0_, and most likely fail because there is no _foobar_ top-level domain (yet). + +#### Server routing + +Now that you know which _interface_ or interfaces should be queried, the _server_ or servers to query are easy to determine. Each interface has one or more name servers configured. systemd-resolved will send queries to the first of those. If the server is offline and the request times out or if the server sends a syntactically-invalid answer (which shouldn’t happen with “normal” queries, but often becomes an issue when DNSSEC is enabled), systemd-resolved switches to the next server on the list. It will use that second server as long as it keeps responding. All servers are used in a round-robin rotation. + +To introspect a running system, use the _resolvectl dns_ command: + +``` +$ resolvectl dns +Global: +Link 4 (wlp4s0): 192.168.1.1 8.8.4.4 8.8.8.8 +Link 18 (hub0): +Link 26 (tun0): 10.45.248.15 10.38.5.26 +``` + +When combined with the previous listing, you know that for _[www.redhat.com][7]_, systemd-resolved will query 10.45.248.15, and—if it doesn’t respond—10.38.5.26. For _[www.google.com][9]_, systemd-resolved will query 192.168.1.1 or the two Google servers 8.8.4.4 and 8.8.8.8. + +### Differences from nss-dns + +Before going further detail, you may ask how this differs from the previous default implementation (nss-dns). With nss-dns there is just one global list of up to three name servers and a global list of search domains (specified as _nameserver_ and _search_ in _/etc/resolv.conf_). + +Each name to query is sent to the first name server. If it doesn’t respond, the same query is sent to the second name server, and so on. systemd-resolved implements split-DNS and remembers which servers are currently considered active. + +For single-label names, the query is performed with each of the the search domains suffixed. This is the same with systemd-resolved. For multi-label names, a query for the unsuffixed name is performed first, and if that fails, a query for the name suffixed by each of the search domains in turn is performed. systemd-resolved doesn’t do that last step; it only suffixes single-label names. + +A second difference is that with _nss-dns_, this module is loaded into each process. The process itself communicates with remote servers and implements the full DNS stack internally. With systemd-resolved, the _nss-resolve_ module is loaded into the process, but it only forwards the query to systemd-resolved over a local transport (D-Bus) and doesn’t do any work itself. The systemd-resolved process is heavily sandboxed using systemd service features. + +The third difference is that with systemd-resolved all state is dynamic and can be queried and updated using D-Bus calls. This allows very strong integration with other daemons or graphical interfaces. + +### Configuring systemd-resolved + +So far, this article talked about servers and the routing of domains without explaining how to configure them. systemd-resolved has a configuration file (_/etc/systemd/resolv.conf_) where you specify name servers with _DNS=_ and routing or search domains with _Domains=_ (routing domains with _~_, search domains without). This corresponds to the _Global:_ lists in the two listings above. + +In this article’s examples, both lists are empty. Most of the time configuration is attached to specific interfaces, and “global” configuration is not very useful. Interfaces come and go and it isn’t terribly smart to contact servers on an interface which is down. As soon as you create a VPN connection, you want to use the servers configured for that connection to resolve names, and as soon as the connection goes down, you want to stop. + +How does then systemd-resolved acquire the configuration for each interface? This happens dynamically, with the network management service pushing this configuration over D-Bus into systemd-resolved. The default in Fedora is NetworkManager and it has very good integration with systemd-resolved. Alternatives like systemd’s own systemd-networkd implement similar functionality. But the [interface is open][10] and other programs can do the appropriate D-Bus calls. + +Alternatively, _resolvectl_ can be used for this (it is just a wrapper around the D-Bus API). Finally, _resolvconf_ provides similar functionality in a form compatible with a tool in Debian with the same name. + +#### Scenario: Local connection more trusted than VPN + +The important thing is that in the common scenario, systemd-resolved follows the configuration specified by other tools, in particular NetworkManager. So to understand how systemd-resolved names, you need to see what NetworkManager tells it to do. Normally NM will tell systemd-resolved to use the name servers and search domains received in a DHCP lease on some interface. For example, look at the source of configuration for the two listings shown above: + +![][11]![][12] + +There are two connections: “Parkinson” wifi and “Brno (BRQ)” VPN. In the first panel _DNS:Automatic_ is enabled, which means that the DNS server received as part of the DHCP lease (192.168.1.1) is passed to systemd-resolved. Additionally. 8.8.4.4 and 8.8.8.8 are listed as alternative name servers. This configuration is useful if you want to resolve the names of other machines in the local network, which 192.168.1.1 provides. Unfortunately the hotspot DNS server occasionally gets stuck, and the other two servers provide backup when that happens. + +The second panel is similar, but doesn’t provide any special configuration. NetworkManager combines routing domains for a given connection from DHCP, SLAAC RDNSS, and VPN, and finally manual configuration and forward this to systemd-resolved. This is the source of the search domain _redhat.com_ in the listing above. + +There is an important difference between the two interfaces though: in the second panel, “Use this connection only for resources on its network” is **checked**. This tells NetworkManager to tell systemd-resolved to only use this interface for names under the search domain received as part of the lease (_Link 26 (tun0): redhat.com_ in the first listing above). In the first panel, this checkbox is **unchecked**, and NetworkManager tells systemd-resolved to use this interface for all other names (_Link 4 (wlp4s0): ~._). This effectively means that the wireless connection is more trusted. + +#### Scenario: VPN more trusted than local network + +In a different scenario, a VPN would be more trusted than the local network and the domain routing configuration reversed. If a VPN without “Use this connection only for resources on its network” is active, NetworkManager tells systemd-resolved to attach the default routing domain to this interface. After unchecking the checkbox and restarting the VPN connection: + +``` +$ resolvectl domain +Global: +Link 4 (wlp4s0): +Link 18 (hub0): +Link 28 (tun0): ~. redhat.com +$ resolvectl dns +Global: +Link 4 (wlp4s0): +Link 18 (hub0): +Link 28 (tun0): 10.45.248.15 10.38.5.26 +``` + +Now all domain names are routed to the VPN. The network management daemon controls systemd-resolved and the user controls the network management daemon. + +### Additional systemd-resolved functionality + +As mentioned before, systemd-resolved provides a common name lookup mechanism for all programs running on the machine. Right now the effect is limited: shared resolver and cache and split DNS (the lookup routing logic described above). systemd-resolved provides additional resolution mechanisms beyond the traditional unicast DNS. These are the local resolution protocols MulticastDNS and LLMNR, and an additional remote transport DNS-over-TLS. + +Fedora 33 does not enable MulticastDNS and DNS-over-TLS in systemd-resolved. MulticastDNS is implemented by _nss-mdns4_minimal_ and Avahi. Future Fedora releases may enable these as the upstream project improves support. + +Implementing this all in a single daemon which has runtime state allows smart behaviour: DNS-over-TLS may be enabled in opportunistic mode, with automatic fallback to classic DNS if the remote server does not support it. Without the daemon which can contain complex logic and runtime state this would be much harder. When enabled, those additional features will apply to all programs on the system. + +There is more to systemd-resolved: in particular LLMNR and DNSSEC, which only received brief mention here. A future article will explore those subjects. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/systemd-resolved-introduction-to-split-dns/ + +作者:[zbyszek][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/zbyszek/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/10/systemd-resolved2-816x345.jpg +[2]: https://unsplash.com/@ruvimnogaphoto?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[3]: https://unsplash.com/s/photos/colors?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[4]: https://www.freedesktop.org/software/systemd/man/systemd-resolved.service.html +[5]: http://www.company.com +[6]: http://www.private.company.com +[7]: http://www.redhat.com +[8]: http://www.foobar +[9]: http://www.google.com +[10]: https://www.freedesktop.org/software/systemd/man/org.freedesktop.resolve1.html +[11]: https://fedoramagazine.org/wp-content/uploads/2020/10/nm-default-network-with-additional-servers.png +[12]: https://fedoramagazine.org/wp-content/uploads/2020/10/nm-vpn-brno.png From 43443828210d1ec720b53ea2c2336086d2403d11 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 17 Oct 2020 05:02:03 +0800 Subject: [PATCH 0482/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201016?= =?UTF-8?q?=20Set=20up=20ZFS=20on=20Linux=20with=20yum?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201016 Set up ZFS on Linux with yum.md --- .../20201016 Set up ZFS on Linux with yum.md | 132 ++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 sources/tech/20201016 Set up ZFS on Linux with yum.md diff --git a/sources/tech/20201016 Set up ZFS on Linux with yum.md b/sources/tech/20201016 Set up ZFS on Linux with yum.md new file mode 100644 index 0000000000..87adc44ad1 --- /dev/null +++ b/sources/tech/20201016 Set up ZFS on Linux with yum.md @@ -0,0 +1,132 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Set up ZFS on Linux with yum) +[#]: via: (https://opensource.com/article/20/10/zfs-dnf) +[#]: author: (Sheng Mao https://opensource.com/users/ivzhh) + +Set up ZFS on Linux with yum +====== +Use a yum repo to take advantage of the latest ZFS features on Fedora. +![Puzzle pieces coming together to form a computer screen][1] + +I am a Fedora Linux user who runs `yum upgrade` daily. While this habit enables me to run all the latest software (one of [Fedora's four foundations][2] is "first," and it lives up to that), it also highlights any incompatibilities between the [ZFS][3] storage platform and a new kernel. + +As a developer, sometimes I need new features from the latest ZFS branch. For example, ZFS 2.0.0 contains an exciting new feature greatly [improving ZVOL sync performance][4], which is critical to me as a KVM user. But this means that if I want to use the 2.0.0 branch, I have to build ZFS myself. + +At first, I just compiled ZFS manually from its Git repo after every kernel update. If I forgot, ZFS would fail to be recognized on the next boot. Luckily, I quickly learned how to set up dynamic kernel module support ([DKMS][5]) for ZFS. However, this solution isn't perfect. For one thing, it doesn't utilize the powerful [yum][6] system, which can help with resolving dependencies and upgrading. In addition, switching between your own package and an upstream package is pretty easy with yum. + +In this article, I will demonstrate how to set up a yum repo for packaging ZFS. The solution has two steps: + + 1. Create RPM packages from the ZFS Git repository + 2. Set up a yum repo to host the packages + + + +### Create RPM packages + +To create RPM packages, you need to install the RPM toolchain. Yum provides groups to bundle installing the tools: + + +``` +`sudo dnf group install 'C Development Tools and Libraries' 'RPM Development Tools'` +``` + +After these have been installed, you must install all the packages necessary to build ZFS from the ZFS Git repo. The packages belong to three groups: + + 1. [Autotools][7] to generate build files from platform configurations + 2. Libraries for building ZFS kernel and userland tools + 3. Libraries for building RPM packages + + + + +``` +sudo dnf install libtool autoconf automake gettext createrepo \ +    libuuid-devel libblkid-devel openssl-devel libtirpc-devel \ +    lz4-devel libzstd-devel zlib-devel \ +    kernel-devel elfutils-libelf-devel \ +    libaio-devel libattr-devel libudev-devel \ +    python3-devel libffi-devel +``` + +Now you are ready to create your own packages. + +### Build OpenZFS + +[OpenZFS][8] provides excellent infrastructure. To build it: + + 1. Clone the repository with `git` and switch to the branch/tag that you hope to use. + 2. Run Autotools to generate a makefile. + 3. Run `make rpm` and, if everything works, RPM files will be placed in the build folder. + + + + +``` +$ git clone --branch=zfs-2.0.0-rc3 zfs +$ cd zfs +$ ./autogen.sh +$ ./configure +$ make rpm +``` + +### Set up a yum repo + +In yum, a repo is a server or local path that includes metadata and RPM files. A consumer sets up an INI configuration file, and the `yum` command automatically resolves the metadata and downloads the corresponding packages. + +Fedora provides the `createrepo` tool to set up a yum repo. First, create the repo and copy all RPM files from the ZFS folder to the repo. Then run `createrepo --update` to include all packages in the metadata: + + +``` +$ sudo mkdir -p /var/lib/zfs.repo +$ sudo createrepo /var/lib/zfs.repo +$ sudo cp *.rpm /var/lib/zfs.repo/ +$ sudo createrepo --update /var/lib/zfs.repo +``` + +Create a new configuration file in `/etc/yum.repos.d` to include the repo path: + + +``` +$ echo \ +"[zfs-local]\\\nname=ZFS Local\\\nbaseurl=file:///var/lib/zfs.repo\\\nenabled=1\\\ngpgcheck=0" |\ +sudo tee /etc/yum.repos.d/zfs-local.repo + +$ sudo dnf --repo=zfs-local list available --refresh +``` + +Finally, you have reached the end of the journey! You have a working yum repo and ZFS packages. Now you just need to install them: + + +``` +$ sudo dnf install zfs +$ sudo /sbin/modprobe zfs +``` + +Run `sudo zfs version` to see the version of your userland and kernel tools. Congratulations! You have [ZFS for Fedora][9]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/zfs-dnf + +作者:[Sheng Mao][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://opensource.com/users/ivzhh +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/puzzle_computer_solve_fix_tool.png?itok=U0pH1uwj (Puzzle pieces coming together to form a computer screen) +[2]: https://docs.fedoraproject.org/en-US/project/#_what_is_fedora_all_about +[3]: https://zfsonlinux.org/ +[4]: https://www.phoronix.com/scan.php?page=news_item&px=OpenZFS-3x-Boost-Sync-ZVOL +[5]: https://www.linuxjournal.com/article/6896 +[6]: https://en.wikipedia.org/wiki/Yum_%28software%29 +[7]: https://opensource.com/article/19/7/introduction-gnu-autotools +[8]: https://openzfs.org/wiki/Main_Page +[9]: https://openzfs.github.io/openzfs-docs/Getting%20Started/Fedora.html From 36d0172155a4f3dbb50c387aa015c39dc82525d2 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 17 Oct 2020 05:02:15 +0800 Subject: [PATCH 0483/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201016?= =?UTF-8?q?=20Is=20open=20source=20a=20development=20model,=20business=20m?= =?UTF-8?q?odel,=20or=20something=20else=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201016 Is open source a development model, business model, or something else.md --- ...odel, business model, or something else.md | 130 ++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 sources/tech/20201016 Is open source a development model, business model, or something else.md diff --git a/sources/tech/20201016 Is open source a development model, business model, or something else.md b/sources/tech/20201016 Is open source a development model, business model, or something else.md new file mode 100644 index 0000000000..26e8cd7e02 --- /dev/null +++ b/sources/tech/20201016 Is open source a development model, business model, or something else.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Is open source a development model, business model, or something else?) +[#]: via: (https://opensource.com/article/20/10/open-source-supply-chain) +[#]: author: (Scott McCarty https://opensource.com/users/fatherlinux) + +Is open source a development model, business model, or something else? +====== +Instead of asking whether open source is a development model or a +business model, start thinking about it as a supply chain for your +products. +![Net catching 1s and 0s or data in the clouds][1] + +The term "open source" was coined in 1998 at a strategy session held by [Open Source Initiative][2] (OSI). The OSI maintains the [Open Source Definition][3] (OSD), which places mandates on the distribution terms of any software that claims to be open source. The OSI also maintains a curated list of official [open source licenses][4] that meet these guidelines. + +The OSD gives a clear definition of what open source software _is_, but doesn't provide much insight into how the adoption of open source affects a company's ability to build and deliver products or services that people want and need. Stated another way, there's still tremendous debate about the best ways to build a business based on open source. + +In this first of a multi-part series, I will lay the groundwork for understanding what products are, what product managers do, and how open source can be considered a supply chain. In future articles, I will go deeper into each of these topics, but I'll start by dissecting some common, but fundamentally confusing vocabulary. + +### Development model or business model? + +Open source adoption is common in products and solutions, but the verdict is out on what this truly means for product teams. Is open source a software development model or a business model? Even today, there are huge debates in open source circles. + +People who think of open source [as a development model][5] emphasize collaboration, the decentralized nature in which code is written, and the licenses under which that code is released. Those who think of open source [as a business model][6] discuss monetization through support, services, software-as-a-service, paid features, and even in the context of inexpensive marketing or advertising. While there are surely valid arguments on both sides, neither of these models has ever satisfied everyone. Perhaps it's because we've never fully considered open source in the historical context of software products and their practical construction. + +> Instead of thinking about open source as a development model or a business model, perhaps companies should think in terms of a supply chain from which they can purchase technology. + +A [supply chain][7] includes the organizations, people, activities, information, and resources needed to create any product or service. This includes products as simple as a wool coat or as complex as an open source software project with thousands of dependencies. In [_The Wealth of Nations_][8], the father of economics, [Adam Smith][9], describes the supply chain for a wool coat: + +> "The shepherd, the sorter of the wool, the wool-comber or carder, the dyer, the scribbler, the spinner, the weaver, the fuller, the dresser, with many others, must all join their different arts in order to complete even this homely production." + +![Wool coat supply chain][10] + +(Scott McCarty, [CC BY-SA 4.0][11]) + +Most of us probably haven't heard of the roles involved in the supply chain for a wool coat, but one thing is obvious: divisions of labor and collaboration are keys to a healthy supply chain, especially with open source. + +### Product or project? + +If you accept that open source is a supply chain for building solutions, this leads to another misunderstanding around projects and products. Paul Cormier, Red Hat's CEO, makes a pragmatic distinction between [open source _projects_ and open source _products_][12]. While I agree with Paul, I am obliged to confess that most of the world doesn't recognize this crisp distinction. In 20 years of conversations with customers, partners, users, contributors, analysts, journalists, and even my own family, most people use the words _project_ and _product_ interchangeably. + +I'll attempt to bring clarity by proposing a simple definition: Products are things that people buy with currency, while projects are things people participate in, contribute to, or use. That gets part of the way to a better definition, but to truly understand, you need to define what a product _is_ in order to clearly see what a project _isn't_. + +Software products, like any other products or services, have a whole host of activities required to bring them to market. They have business plans, pricing and packaging, positioning and messaging, distribution strategies, sales enablement, portfolio alignment, build/buy/partner decisions, and roadmaps. The teams managing these products conduct focus groups, analyze addressable markets, brief journalists and analysts about how their products fit into the marketplace, walk customers through roadmaps, and, most importantly, define those roadmaps based on the needs of paying customers. Product teams spend a lot of time and money understanding their customers' problems, but this is rarely the work output of community members. + +Product teams have a fundamental choice about which suppliers they use in their products. This could mean using two, three, four, or even 10 different upstream projects in a product. It could also mean switching upstream projects when they no longer meet the needs of the customers buying the product. Finally, it could also mean positioning a partner's solution or different parts of the product portfolio to fill in gaps (i.e., address customer needs with solutions). The product team can also decide to use open source as one part of the supply chain and proprietary software as another part, thereby differentiating the product from the project. They can even make their product available only as a service; this is the power of pricing and packaging. + +Nearly all products are built by adding a layer of differentiated value to a set of commodity components that are provided by suppliers. This is true, whether they're built on open source or proprietary components. Stated another way, upstream suppliers cannot provide the same solution as downstream products. When upstream projects and downstream products tackle the exact same business problem, there is low differentiation, which creates challenges. This is akin to upstream suppliers and the downstream product company both selling tires—the upstream supplier needs to sell tires, and the downstream product company needs to sell vehicles. + +> A lack of differentiation between the supply-chain components and the downstream product is where open source companies run into problems. + +Everyday, product teams have to make pricing, packaging, build, buy, partner, and roadmap decisions driven by paying customers. This is what provides differentiation to a product and makes it fundamentally different from a community-driven, open source project. + +### Buying from the open source supply chain + +Open source technology is free as in speech, not "free as in beer." Anyone can download and use open source software pretty much however they want, but as soon as you sell a product that uses open source, you have a responsibility to the customer. That responsibility includes things like verifying the software is always patched, secure, and runs well. A product team has a commitment to the customers and is responsible for every component chosen in the supply chain. + +![Stephen Walli tweet about open source business models][13] + +(Scott McCarty, [CC BY-SA 4.0][11]) + +Stated another way, building a product on open source software is not free. It costs [either time or money][14], and everyone knows time is money, so these are essentially the same thing. Therefore, it's genuinely correct to use the word "buy" to describe the relationship between product teams and the upstream open source projects that supply technology for those products. + +From the perspective of the product team, each upstream project can be thought of as a supplier. The product team can "buy" from the open source suppliers by contributing the time and energy of engineers, documentation writers, testers, etc. Since time is money, every hour spent on upstream work can be measured in dollars. + +This cost of consuming from the open source supply chain exists whether your organization is selling a _product_ based on open source or building a _solution_ for internal consumption. Building anything on open source comes with an implicit responsibility for the components selected and used. But, unlike a traditional supply chain, a dollar may not be a dollar (fill in your currency of choice). + +Every dollar invested in an open source supply chain purchase might return $2, $3, or even $10 of value in return. The return on investment can be higher because other people and companies are also contributing value, as well as a diversity of ideas. Everyone who consumes from an open source supply chain inherits the total value. If the community is healthy, the value received is far above and beyond the contributions made. + +There's another hidden benefit to purchasing from open source suppliers. Unlike traditional suppliers, community-driven, open source projects are not profit-driven entities with sales, marketing, and go-to-market costs. This is akin to buying from non-profit entities, but, once again, it's not "free as in beer." There's definitely a cost associated with purchasing from an open source supply chain and, in turn, providing a product to your customers. + +### A better metaphor for products + +Perhaps no one has ever taken a product-centric view of open source because it grew up alongside the internet and the dot-com boom. This was a time of throwing money at ideas without having much of a business plan. Attempts to apply traditional business understanding _post facto_ have led to debate over the definition of open source versus [open core][15], as well as the roles and responsibilities of product teams. The software industry, and open source, in particular, has been notoriously confused about aligning product management and upstream engineering. The blurry line between project and product has even led to misunderstandings about what features upstream projects should focus on versus the downstream products. + +Working as a member of the product team driving the roadmap for arguably the largest open source product in the world, Red Hat Enterprise Linux, I'd like to humbly propose a new paradigm within which to think about open source software: + +> **Open source is a supply chain model.** + +It's not a huge intellectual leap, but this has profound implications on discussions, debates, and cognitive load when thinking about products that leverage open source. + +### Capturing value with open source + +In recent years, arguments have been put forth asserting that there [can only ever be one Red Hat][16]; the narrative implies that only one company can grow into a multi-billion dollar business by selling support. This narrative is problematic because Red Hat doesn't make money from support, and it might even be argued that [Red Hat Network][17] was the first SaaS of open source. Second, other companies like SUSE, Cloudera, and Chef have captured quite a bit of value. Finally, many businesses start with a SaaS model and extend into adjacent on-premises businesses, like [CloudBees][18]. + +All of these companies have been able to successfully use open source as a supply chain to create value while simultaneously capturing value by satisfying complex business problems that are not solved by the upstream project alone. Fundamentally, SaaS and hardware/software combinations are no different, although it might be argued that they are easier to monetize. + +Fellow product managers, I urge you to start thinking about open source projects as a supply chain for your products. It will give you new clarity in making product-driven decisions and focusing on business needs instead of technology. With all supply chains, product managers have to treat their suppliers fairly. For example, downstream product teams can't tell upstream suppliers what to do. Downstream product teams also have to pay suppliers enough to keep them in business and continue to supply technology. These are just two examples of the clarity that comes from treating upstream, open source projects as suppliers, and it keeps the relationship much healthier. + +![Linux supply chain][19] + +(Scott McCarty, [CC BY-SA 4.0][11]) + +There's a saying in music: _It's not the notes you play, but the notes you don't play._ Constraints breed creativity. If you know you can't differentiate your product based on the code from your upstream suppliers, your product team has to get creative. You have to identify other value worth purchasing. I'll dig into this later in the series; in the next article, I'll add clarity to the scope of what an open source product is and how to create value with it. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/open-source-supply-chain + +作者:[Scott McCarty][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://opensource.com/users/fatherlinux +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_analytics_cloud.png?itok=eE4uIoaB (Net catching 1s and 0s or data in the clouds) +[2]: https://opensource.org/ +[3]: https://opensource.org/osd +[4]: https://opensource.org/licenses/alphabetical +[5]: https://en.wikipedia.org/wiki/Open-source_model +[6]: https://opensource.com/article/17/12/open-source-business-models +[7]: https://en.wikipedia.org/wiki/Supply_chain +[8]: https://en.wikipedia.org/wiki/The_Wealth_of_Nations +[9]: https://en.wikipedia.org/wiki/Adam_Smith +[10]: https://opensource.com/sites/default/files/uploads/wool_coat_supply_chain.png (Wool coat supply chain) +[11]: https://creativecommons.org/licenses/by-sa/4.0/ +[12]: https://siliconangle.com/2019/05/10/red-hat-talks-project-vs-product-in-enterprise-open-source-rhsummit/ +[13]: https://opensource.com/sites/default/files/uploads/tweet.png (Stephen Walli tweet about open source business models) +[14]: https://twitter.com/stephenrwalli/status/1147205594966663168 +[15]: https://medium.com/open-consensus/2-open-core-definition-examples-tradeoffs-e4d0c044da7c +[16]: https://techcrunch.com/2014/02/13/please-dont-tell-me-you-want-to-be-the-next-red-hat/ +[17]: https://en.wikipedia.org/wiki/Red_Hat_Network +[18]: https://www.cloudbees.com/blog/enhanced-pricing-and-packaging-cloudbees-platform +[19]: https://opensource.com/sites/default/files/uploads/linux_supply_chain.png (Linux supply chain) From 1ebfe69215f314086a74b10a5e26a9f0d1c84c6d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 17 Oct 2020 08:29:02 +0800 Subject: [PATCH 0484/1156] Rename sources/tech/20201016 Is open source a development model, business model, or something else.md to sources/talk/20201016 Is open source a development model, business model, or something else.md --- ...urce a development model, business model, or something else.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20201016 Is open source a development model, business model, or something else.md (100%) diff --git a/sources/tech/20201016 Is open source a development model, business model, or something else.md b/sources/talk/20201016 Is open source a development model, business model, or something else.md similarity index 100% rename from sources/tech/20201016 Is open source a development model, business model, or something else.md rename to sources/talk/20201016 Is open source a development model, business model, or something else.md From 4fad661cf5d2362eb91491c62a33c63bcd8d2539 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sat, 17 Oct 2020 12:35:44 +0800 Subject: [PATCH 0485/1156] translating --- ...n scripts for automating basic community management tasks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200323 5 Python scripts for automating basic community management tasks.md b/sources/tech/20200323 5 Python scripts for automating basic community management tasks.md index 3f8dd00aa1..888c800b0d 100644 --- a/sources/tech/20200323 5 Python scripts for automating basic community management tasks.md +++ b/sources/tech/20200323 5 Python scripts for automating basic community management tasks.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 7c9497a1736037f5285c0efa1714e62194b4ee75 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sat, 17 Oct 2020 12:53:29 +0800 Subject: [PATCH 0486/1156] f --- ...n scripts for automating basic community management tasks.md | 2 +- ...20200521 Use the internet from the command line with curl.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20200323 5 Python scripts for automating basic community management tasks.md b/sources/tech/20200323 5 Python scripts for automating basic community management tasks.md index 888c800b0d..3f8dd00aa1 100644 --- a/sources/tech/20200323 5 Python scripts for automating basic community management tasks.md +++ b/sources/tech/20200323 5 Python scripts for automating basic community management tasks.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (MjSeven) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/tech/20200521 Use the internet from the command line with curl.md b/sources/tech/20200521 Use the internet from the command line with curl.md index c580ea0879..373e5dfc9c 100644 --- a/sources/tech/20200521 Use the internet from the command line with curl.md +++ b/sources/tech/20200521 Use the internet from the command line with curl.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 037862835e3e649fb9ae34792670d5a7b5ffa248 Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Sat, 17 Oct 2020 18:32:45 +0800 Subject: [PATCH 0487/1156] Update 20200914 NFC vs. Bluetooth LE- When to use which.md --- .../talk/20200914 NFC vs. Bluetooth LE- When to use which.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20200914 NFC vs. Bluetooth LE- When to use which.md b/sources/talk/20200914 NFC vs. Bluetooth LE- When to use which.md index 9656a12a99..471a70d36a 100644 --- a/sources/talk/20200914 NFC vs. Bluetooth LE- When to use which.md +++ b/sources/talk/20200914 NFC vs. Bluetooth LE- When to use which.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: ( chenmu-kk ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 44b510de33b12c17ec533d31b6b229c526332bfe Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sat, 17 Oct 2020 22:39:34 +0800 Subject: [PATCH 0488/1156] =?UTF-8?q?=E5=88=9D=E7=A8=BF=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nternet from the command line with curl.md | 66 +++++++++++-------- 1 file changed, 38 insertions(+), 28 deletions(-) diff --git a/sources/tech/20200521 Use the internet from the command line with curl.md b/sources/tech/20200521 Use the internet from the command line with curl.md index 373e5dfc9c..7ef59d9189 100644 --- a/sources/tech/20200521 Use the internet from the command line with curl.md +++ b/sources/tech/20200521 Use the internet from the command line with curl.md @@ -8,23 +8,28 @@ [#]: author: (Seth Kenlon https://opensource.com/users/seth) Use the internet from the command line with curl +从命令行通过 curl 访问互联网 ====== Download our new curl cheat sheet. Curl is a fast and efficient way to pull the information you need from the internet without using a graphical interface. +对于从互联网上获取里所需的信息,在不使用图形界面的情况下,curl 是一种快速有效的方法。 + ![Cheat Sheet cover image][1] Curl is commonly considered a non-interactive web browser. That means it's able to pull information from the internet and display it in your terminal or save it to a file. This is literally what web browsers, such as Firefox or Chromium, do except they _render_ the information by default, while curl downloads and displays raw information. In reality, the curl command does much more and has the ability to transfer data to or from a server using one of many supported protocols, including HTTP, FTP, SFTP, IMAP, POP3, LDAP, SMB, SMTP, and many more. It's a useful tool for the average terminal user, a vital convenience for the sysadmin, and a quality assurance tool for microservices and cloud developers. +Curl 通常被认为是非交互式 Web 浏览器。这意味着它能够从互联网上获取信息并在你的终端中显示或将其保存到文件中。从字面上看,这是 Web 浏览器(例如 Firefox 或 Chromium)所做的工作,除了默认情况下会渲染信息,而 curl 下载并显示原始信息。实际上,curl 命令可以做更多的事情,并且具有使用多种受支持的协议之一向服务器传输数据或从服务器传输数据的能力,这些协议包括 HTTP、FTP、SFTP、IMAP、POP3、LDAP、SMB、SMTP 等。对于普通终端用户来说,这是一个有用的工具,对于系统管理员,这是至关重要的便利,对于微服务和云开发人员,它是质量保证工具。 Curl is designed to work without user interaction, so unlike Firefox, you must think about your interaction with online data from start to finish. For instance, if you want to view a web page in Firefox, you launch a Firefox window. After Firefox is open, you type the website you want to visit into the URL field or a search engine. Then you navigate to the site and click on the page you want to see. +Curl 被设计为在没有用户交互的情况下工作,因此与 Firefox 不同,你必须从头到尾考虑与在线数据的交互。例如,如果想要在 Firefox 中查看网页,你需要启动 Firefox 窗口。打开 Firefox 后,在地址栏或搜索引擎中输入要访问的网站。然后,导航该站点,然后单击要查看的页面。 The same concepts apply to curl, except you do it all at once: you launch curl at the same time you feed it the internet location you want and tell it whether you want to the data to be saved in your terminal or to a file. The complexity increases when you have to interact with a site that requires authentication or with an API, but once you learn the **curl** command syntax, it becomes second nature. To help you get the hang of it, we collected the pertinent syntax information in a handy [cheat sheet][2]. +对于 curl 来说也是如此,不同之处在于你需要一次执行所有操作:在启动 curl 的同时提供需要访问的 Internet 位置,并告诉它是否要将数据保存在终端或文件中。当你必须与需要身份验证的网站或 API 进行交互时,复杂性会增加,但是一旦你学习了 **curl** 命令语法,它便成为了第二本性。为了帮助你掌握它,我们在方便的[备忘单][2]中收集了相关的语法信息。 -### Download a file with curl +### 使用 curl 下载文件 You can download a file with the **curl** command by providing a link to a specific URL. If you provide a URL that defaults to **index.html**, then the index page is downloaded, and the file you downloaded is displayed on your terminal screen. You can pipe the output to less or tail or any other command: - - +你可以通过提供指向特定 URL 的链接来使用 **curl** 命令下载文件。如果你提供的 URL 默认为 **index.html**,那么将下载此页面,并且下载的文件将显示在终端屏幕上。你可以将数据通过管道传递到 less、tail 或任何其它命令: ``` $ curl "" | tail -n 4     <h1>Example Domain</h1> @@ -34,10 +39,10 @@ $ curl "" | tail -n 4 ``` Because some URLs contain special characters that your shell normally interprets, it's safest to surround your URL in quotation marks. +由于某些 URL 包含特殊字符,shell 通常会将其解释,因此用引号将 URL 包起来是最安全的。 Some files don't translate well to being displayed in a terminal. You can use the **\--remote-name** option to cause the file to be saved according to what it's called on the server: - - +某些文件在终端中无法很好的转换显示。你可以使用 **\--remote-name** 选项使文件根据服务器上的调用进行保存: ``` $ curl --remote-name "" $ ls @@ -45,41 +50,44 @@ linux-distro.iso ``` Alternatively, you can use the **\--output** option to name your download whatever you want: - +另外,你可以使用 **\--output** 选项来命名你想要下载的内容: ``` -`curl "http://example.com/foo.html" --output bar.html` +curl "http://example.com/foo.html" --output bar.html ``` ### List contents of a remote directory with curl +### 使用 curl 列出带有远程目录的内容 Because curl is non-interactive, it's difficult to browse a page for downloadable elements. Provided that the remote server you're connecting to allows it, you can use **curl** to list the contents of a directory: - +因为 curl 是非交互式的,所以很难浏览页面上的可下载元素。如果你要连接的远程服务器允许,可以使用 **curl** 来列出目录的内容: ``` -`$ curl --list-only "https://example.com/foo/"` +$ curl --list-only "https://example.com/foo/" ``` ### Continue a partial download +### 继续部分下载 If you're downloading a very large file, you might find that you have to interrupt the download. Curl is intelligent enough to determine where you left off and continue the download. That means the next time you're downloading a 4GB Linux distribution ISO and something goes wrong, you never have to go back to the start. The syntax for **\--continue-at** is a little unusual: if you know the byte count where your download was interrupted, you can provide it; otherwise, you can use a lone dash (**-**) to tell curl to detect it automatically: - +如果要下载很大的文件,可能会发现必须中断下载。Curl 足够智能,可以确定你从何处中断并继续下载。这意味着下一次你下载 4GB 的 Linux 发行版 ISO 出现问题时,你无需重新开始。**\--continue-at** 的语法有点不寻常:如果你知道下载中断的字节数,则可以提供。否则,你可以使用单破折号(**-**)指示 curl 自动检测: ``` -`$ curl --remote-name --continue-at - "https://example.com/linux-distro.iso"` +$ curl --remote-name --continue-at - "https://example.com/linux-distro.iso" ``` ### Download a sequence of files +### 下载文件序列 If you need to download several files—rather than just one big file—curl can help with that. Assuming you know the location and file-name pattern of the files you want to download, you can use curl's sequencing notation: the start and end point between a range of integers, in brackets. For the output filename, use **#1** to indicate the first variable: - +如果你需要下载多个文件而不是一个大文件,curl 可以帮助你解决这个问题。假设你知道要下载的文件的位置和文件名模式,则可以使用 curl 的排序符合:括号中整数范围内的起点和终点。对于输出文件名,使用 **#1** 表示第一个变量: ``` -`$ curl "https://example.com/file_[1-4].webp" --output "file_#1.webp"` +$ curl "https://example.com/file_[1-4].webp" --output "file_#1.webp" ``` If you need to use another variable to represent another sequence, denote each variable in the order it appears in the command. For example, in this command, **#1** refers to the directories **images_000** through **images_009**, while **#2** refers to the files **file_1.webp** through **file_4.webp**: - +如果你需要使用另一个变量来表示另一个序列,按照每个变量在命令中出现的顺序表示每个变量。例如,在此命令中,**#1** 指目录 **images_000** 到 **images_009**,而 **#2** 指目录 **file_1.webp** 至 **file_4.webp**。 ``` $ curl "" \ @@ -87,10 +95,10 @@ $ curl "" \ ``` ### Download all PNG files from a site +### 从站点下载所有 PNG 文件 You can do some rudimentary web scraping to find what you want to download, too, using only **curl** and **grep**. For instance, say you need to download all images associated with a web page you're archiving. First, download the page referencing the images. Pipe the page to grep with a search for the image type you're targeting (PNG in this example). Finally, create a **while** loop to construct a download URL and to save the files to your computer: - - +你也可以仅使用 **curl** 和 **grep** 进行一些基本的 Web 抓取操作,找到想要下载的呢内容。例如,假设你需要下载与要归档的网页关联的所有图像。首先,下载引用图像的页面。搜索所需的图片类型(在此示例中为 PNG),将页面通过管道传递到 grep。最后,创建 **while** 循环以构造下载 URL 并将文件保存到你的计算机: ``` $ curl |\ grep --only-matching 'src="[^"]*.[png]"' |\ @@ -101,11 +109,12 @@ done ``` This is just an example, but it demonstrates how flexible curl can be when combined with a Unix pipe and some clever, but basic, parsing. - +这只是一个例子,但它展示了与 Unix 管道和一些聪明但基本的解析结合使用时,curl 的灵活性。 ### Fetch HTML headers +### 获取 HTML 标头 Protocols used for data exchange have a lot of metadata embedded in the packets that computers send to communicate. HTTP headers are components of the initial portion of data. It can be helpful to view these headers (especially the response code) when troubleshooting your connection to a site: - +用于数据交换的协议在计算机发送进行通信的数据包中嵌入了许多元数据。HTTP 标头是数据初始部分的组成部分。在对站点连接进行故障排除时,查看以下标头(尤其是响应代码)可能会有所帮助: ``` curl --head "" @@ -124,28 +133,28 @@ content-length: 1256 ``` ### Fail quickly +### 快速失败 A 200 response is the usual HTTP indicator of success, so it's what you usually expect when you contact a server. The famous 404 response indicates that a page can't be found, and 500 means there was a server error. +响应 200 通常是 HTTP 成功的指示,因此这是你与服务器联系时通常期望的结果。著名的 404 响应表明找不到页面,而 500 则表明存在服务器错误。 To see what errors are happening during negotiation, add the **\--show-error** flag: - - +要查看协商过程中发生了什么错误,添加 **\--shou-error** 标志: ``` `$ curl --head --show-error "http://opensource.ga"` ``` These can be difficult for you to fix unless you have access to the server you're contacting, but curl generally tries its best to resolve the location you point it to. Sometimes when testing things over a network, seemingly endless retries just waste time, so you can force curl to exit upon failure quickly with the **\--fail-early** option: - - +除非你可以访问要连接的服务器,否则这些问题将很难修复,但是 curl 通常会尽力解决你指向的服务器的位置。有时,当通过网络进行测试时,似乎无休止的重试只会浪费时间,因此你可以使用 **\--fail-early** 选项强制 curl 在出现故障时迅速退出: ``` -`curl --fail-early "http://opensource.ga"` +curl --fail-early "http://opensource.ga" ``` ### Redirect query as specified by a 3xx response +### 由 3xx 响应指定的重定向查询 The 300 series of responses, however, are more flexible. Specifically, the 301 response means that a URL has been moved permanently to a different location. It's a common way for a website admin to relocate content while leaving a "trail" so people visiting the old location can still find it. Curl doesn't follow a 301 redirect by default, but you can make it continue on to a 301 destination by using the **\--location** option: - - +300 这个系列的响应更加灵活。具体而言,301 响应表示该 URL 已被永久移动到其它位置。。这是网站管理员在离开“足迹”的同时重新定位内容的一种常见方法,因此访问旧位置的人们仍然可以找到它。默认情况下,Curl 不遵循 301 重定向,当你可以使用 **\--localtion** 选项使其继续进入 301 指向的目标: ``` $ curl "" | grep title <title>301 Moved Permanently</title> @@ -154,10 +163,10 @@ $ curl --location "" ``` ### Expand a shortened URL +### 扩展缩短的 URL The **\--location** option is useful when you want to look at shortened URLs before visiting them. Shortened URLs can be useful for social networks with character limits (of course, this may not be an issue if you use a [modern and open source social network][4]) or for print media in which users can't just copy and paste a long URL. However, they can also be a little dangerous because their destination is, by nature, concealed. By combining the **\--head** option to view just the HTTP headers and the **\--location** option to unravel the final destination of a URL, you can peek into a shortened URL without loading the full resource: - - +如果要在访问缩短的 URL 之前先查看它们,则 **\--location** 相信很有用。缩短的 URL 对于有字符限制的社交网络很有用(当然,如果使用[现代和开放源代码的社交网络][4],这可能不是问题),或者对于用户不能仅复制和粘贴长地址。但是,它们也可能有点危险,因为其目的地本质上是隐藏的。通过结合使用 **\--head** 选项仅查看 HTTP 标头和 **\--location** 选项以解开 URL 的最终目的地,你可以窥视缩短的 URL 而无需加载完整的资源: ``` $ curl --head --location \ "" @@ -166,6 +175,7 @@ $ curl --head --location \ ### [Download our curl cheat sheet][2] Once you practice thinking about the process of exploring the web as a single command, curl becomes a fast and efficient way to pull the information you need from the internet without bothering with a graphical interface. To help you build it into your usual workflow, we've created a [curl cheat sheet][2] with common curl uses and syntax, including an overview of using it to query an API. +一旦你考虑了一个目录就可以浏览网络的过程,curl 就成为一种快速有效的方式,可以从 Internet 上获取所需的信息,而无需理会图形界面。为了帮助你将其构建到常规工作流程中,我们创建了一个 [curl 备忘单][2],其中包含常见的 curl 使用和语法,包括使用它查询 API 的概述。 -------------------------------------------------------------------------------- @@ -173,7 +183,7 @@ via: https://opensource.com/article/20/5/curl-cheat-sheet 作者:[Seth Kenlon][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[MjSeven](https://github.com/MjSeven) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From af20451c1d5869aa059c7508ac4131aaa2f205bc Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 18 Oct 2020 03:52:21 +0800 Subject: [PATCH 0489/1156] Revert "Update 20191009 Why to choose Rust as your next programming language.md" This reverts commit 6aae41df41ed75a85e6ec5bba93048a36dbba0e8. --- ...1009 Why to choose Rust as your next programming language.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20191009 Why to choose Rust as your next programming language.md b/sources/talk/20191009 Why to choose Rust as your next programming language.md index 871b31abc6..d8cad5c342 100644 --- a/sources/talk/20191009 Why to choose Rust as your next programming language.md +++ b/sources/talk/20191009 Why to choose Rust as your next programming language.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (MATRIXKOO) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 268aafdb43a02ed7c637e184add9c65c568d5779 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 18 Oct 2020 21:37:14 +0800 Subject: [PATCH 0490/1156] PRF @robsean --- ... Learn the basics of programming with C.md | 114 ++++++++---------- 1 file changed, 48 insertions(+), 66 deletions(-) diff --git a/translated/tech/20200820 Learn the basics of programming with C.md b/translated/tech/20200820 Learn the basics of programming with C.md index 02816c1dfc..1698522ad2 100644 --- a/translated/tech/20200820 Learn the basics of programming with C.md +++ b/translated/tech/20200820 Learn the basics of programming with C.md @@ -1,58 +1,56 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Learn the basics of programming with C) [#]: via: (https://opensource.com/article/20/8/c-programming-cheat-sheet) [#]: author: (Seth Kenlon https://opensource.com/users/seth) -使用 C 语言学习基本的编程 +C 语言简单编程速成 ====== -我们将所有的 C 语言要素放置到一份易读的备忘录上。 -![备忘录封面图片][1] -在 1972 年,丹尼斯·里奇在贝尔实验室,在几年前,他和他的团队成员发明了 Unix 。在创建了一个经久不衰的操作系统(至今仍在使用)之后,他需要一种好的方法来编程这些 Unix 计算机,以便它们可用执行新的任务。在现在看来,这很奇怪,但在当时,编程语言相对较少;Fortran,Lisp,[Algol][2] 以及 B 语言都很流行,但是,对于贝尔实验室的研究员们想要做的事情来说,它们还是远远不够的。丹尼斯·里奇创造了他自己的解决方案,表现出一种以程序员的主要特征而闻名的特质,他称之为 C 语言,并且在近 50 年后,它仍在广泛的使用。 +> 我们将所有的 C 语言要素放置到一份易读的备忘录上。 + +![](https://img.linux.net.cn/data/attachment/album/202010/18/213610t3do3u7oev2udoyn.png) + +1972 年,丹尼斯·里奇Dennis Ritchie任职于贝尔实验室Bell Labs,在几年前,他和他的团队成员发明了 Unix 。在创建了一个经久不衰的操作系统(至今仍在使用)之后,他需要一种好的方法来对这些 Unix 计算机编程,以便它们可用执行新的任务。在现在看来,这很奇怪,但在当时,编程语言相对较少,Fortran、Lisp、[Algol][2] 以及 B 语言都很流行,但是,对于贝尔实验室的研究员们想要做的事情来说,它们还是远远不够的。丹尼斯·里奇表现出一种后来被称为程序员的主要特征的特质:创造了他自己的解决方案。他称之为 C 语言,并且在近 50 年后,它仍在广泛的使用。 ### 为什么你应该学习 C 语言 -今天,这里有很多语言为程序员提供比 C 语言更多是特性。最明显的一种语言是 C++ 语言,一种相当明显的命名方式的语言,它在 C 语言之上构建,创建了一种很好的面向对象的语言。不过,这里有很多其它的语言,它们都很好的存在理由。计算机擅长始终如一的重复,因此任何可预见的东西都足以构建到一种语言中,对程序员来说这意味着更少的工作量。为什么要在 C++ 语言中一行 (`long x = long(n);`) 可以做到的相同的事时,而要花费两行来改写 C 语言中的一个 `int` 为一个 `long` ? +今天,有很多语言为程序员提供了比 C 语言更多的特性。最明显的是 C++ 语言,这是一种以相当露骨的方式命名的语言,它构建在 C 语言之上,创建了一种很好的面向对象语言。不过,许多其它语言的存在是有充分理由的。计算机擅长一致的重复,因此任何可预见的东西都可以构建在编程语言中,对程序员来说这意味着更少的工作量。为什么在 C++ 语言中用一行语句就可以将一个 `int` 转换为一个 `long` 时(`long x = long(n);`),还要在 C 语言用两行语句呢? 然而,C 语言在今天仍然有用。 -首先,C 语言是一种最小和简单的的语言。这里没有超出编程基础的非常高级的概念,很大程度上是因为 C 语言简直是现代编程语言的基础之一。例如,C 语言的特性数组,但是它不提供字典(除非你自己写)。当你学习 C 语言时,你将学习编程的构建语句块,它可以帮助你辨别出当前语言的改善和精心制作的设计构思。 +首先,C 语言是一种相当简约和直接的语言。除了编程的基础知识之外,并没有很高级的概念,这很大程度上是因为 C 语言实际上就是现代编程语言的基础之一。例如,C 语言的特性之一是数组,但是它不提供字典(除非你自己写一个)。当你学习 C 语言时,你会学习编程的基础组成部分,它可以帮助你认识到如今的编程语言的改进及其的精心设计。 -因为 C 语言是一种最小的编程语言,你的应用程序很可能会获得性能上的提升,这在很多其它编程语言中是看不到的。当你考虑你的代码可以执行多快的时候,它很容易被卷入到下面的速度竞赛,因此,询问你是否 _需要_ 更快的速度来完成一项特定的任务是很重要的。与 Python 或 Java 相比,使用 C 语言,你没有必要为每一行的代码所困扰。C 语言程序运行很快。这是 Linux 内核使用 C 语言编写的一个很好的理由。 +因为 C 语言是一种最小化的编程语言,你的应用程序很可能会获得性能上的提升,这在其它许多编程语言中是看不到的。当你考虑你的代码可以执行多快的时候,很容易陷入锱铢必较的境地,因此,重要的是要问清楚你是否*需要*为某一特定任务提供更多的速度。与 Python 或 Java 相比,使用 C 语言,你在每行代码中需要纠结的地方更少。C 语言程序运行很快。这是 Linux 内核使用 C 语言编写的一个很好的理由。 -最后,C 语言很容易入门,特别是,如果你正在运行 Linux ,你可能已经在运行 C 语言代码,因为 Linux 系统包含 GNU C 库(`glibc`)。为了编写和构建 C 语言程序, 你需要做的全部工作就是安装一个编译器,打开一个文本编辑器,开始编码。 +最后,C 语言很容易入门,特别是,如果你正在运行 Linux,就已经能运行 C 语言代码了,因为 Linux 系统包含 GNU C 库(`glibc`)。为了编写和构建 C 语言程序,你需要做的全部工作就是安装一个编译器,打开一个文本编辑器,开始编码。 ### 开始学习 C 语言 -如果你正在运行 Linux ,你可以使用你的软件包管理器安装一个 C 编译器。在 Fedora 或 RHEL 上: - +如果你正在运行 Linux ,你可以使用你的软件包管理器安装一个 C 编译器。在 Fedora 或 RHEL 上: ``` $ sudo dnf install gcc ``` -在 Debian 及其衍生系统上: - +在 Debian 及其衍生系统上: ``` $ sudo apt install build-essential ``` -在 macOS 上,你可以 [安装 Homebrew][3] ,并使用它来安装 [GCC][4]: - +在 macOS 上,你可以 [安装 Homebrew][3] ,并使用它来安装 [GCC][4]: ``` -`$ brew install gcc` +$ brew install gcc ``` -在 Windows 上, 你可以使用 [MinGW][5] 安装一套最小的包含 GCC的 GNU 实用程序集。 - -在 Linux 或 macOS 上验证你已经安装的 GCC: +在 Windows 上, 你可以使用 [MinGW][5] 安装一套最小的包含 GCC 的 GNU 实用程序集。 +在 Linux 或 macOS 上验证你已经安装的 GCC: ``` $ gcc --version @@ -60,8 +58,7 @@ gcc (GCC) x.y.z Copyright (C) 20XX Free Software Foundation, Inc. ``` -在 Windows 上, 提供 EXE 文件的完整路径: - +在 Windows 上,提供 EXE 文件的完整路径: ``` PS> C:\MinGW\bin\gcc.exe --version @@ -71,12 +68,11 @@ Copyright (C) 20XX Free Software Foundation, Inc. ### C 语法 -C 语言不是一种脚本型的语言。它是一种编译型的语言,这意味着它由 C 编译器处理来产生一个二进制可执行文件。这不同于一种脚本型语言(像:[Bash][6] )或一种混合型语言(像:[Python][7] )。 +C 语言不是一种脚本语言。它是一种编译型语言,这意味着它由 C 编译器处理来产生一个二进制可执行文件。这不同于脚本语言(如 [Bash][6])或混合型语言(如 [Python][7])。 -在 C 语言中,你创建 _函数_ 来实施你渴望做到的任务。默认情况下,一个名称为 `main` 的函数将被执行。 - -这里是一个使用 C 语言写的简单的 "hello world" 程序: +在 C 语言中,你可以创建*函数*来执行你希望做到的任务。默认情况下,执行的是一个名为 `main` 的函数。 +这里是一个使用 C 语言写的简单的 “hello world” 程序: ``` #include @@ -87,15 +83,13 @@ int main() { } ``` -第一行包含一个被称为 `stdio.h` (标准输入和输出) 的 _头文件_ ,它基本上是自由的、非常初级的 C 语言代码,你可以在你自己的程序中重复使用。创建一个由一个基本的输出语句构成的名称为 `main` 的函数。保存这些文本到一个被称为 `hello.c` 的文件中,然后使用 GCC 编译它: - +第一行包含一个被称为 `stdio.h`(标准输入和输出)的 *头文件*,它基本上是自由使用的、非常初级的 C 语言代码,你可以在你自己的程序中重复使用它。然后创建了一个由一条基本的输出语句构成的名为 `main` 的函数。保存这些文本到一个被称为 `hello.c` 的文件中,然后使用 GCC 编译它: ``` -`$ gcc hello.c --output hello` +$ gcc hello.c --output hello ``` -尝试运行你的 C 语言程序: - +尝试运行你的 C 语言程序: ``` $ ./hello @@ -104,12 +98,11 @@ Hello world$ #### 返回值 -一个函数在执行后“返回”一些东西是 Unix 哲学的一部分:在成功时不返回任何东西,在失败使返回其它的一些东西(例如,一个错误信息)。这些返回代码通常使用数字(确切地说是整数)表示: 0 表示没有东西,任何大于 0 的数字都表示一些不成功的状态。 +这是 Unix 哲学的一部分,一个函数在执行后“返回”一些东西:在成功时不返回任何东西,在失败时返回其它的一些东西(例如,一个错误信息)。这些返回的内容通常使用数字(确切地说是整数)表示:`0` 表示没有错误,任何大于 `0` 的数字都表示一些不成功的状态。 -Unix 和 Linux 被设计成在运行成功时要求沉默的是很明智的。这样,你可以总是通过假设在执行一系列命令后没有获得任何错误或警告来期待成功。类似地,在 C 语言中的函数在设计上也不希望出现错误。 - -你可以使用一小处使你的出现出现错误的修改来自己看到这些设计: +Unix 和 Linux 被设计成在运行成功时保持沉默是很明智的。这是为了让你在执行一系列命令时,假设没有任何错误或警告会妨碍你的工作,从而可以始终为成功执行做准备。类似地,在 C 语言中的函数在设计上也预期不出现错误。 +你可以通过一个小的修改,让你的程序看起来是失败的,就可以看到这一点: ``` include @@ -120,15 +113,13 @@ int main() { } ``` -编译它: - +编译它: ``` $ gcc hello.c --output failer ``` -现在使用一个内置的 Linux 测试来运行它。仅在成功时,`&&` 操作符执行一个命令的第二部分。例如: - +现在使用一个内置的 Linux 测试方式来运行它。仅在*成功*时,`&&` 操作符才会执行一个命令的第二部分。例如: ``` $ echo "success" && echo "it worked" @@ -136,8 +127,7 @@ success it worked ``` -在 _失败_ 时,`||`测试执行一个命令的第二部分。 - +在*失败*时,`||` 测试会执行一个命令的第二部分。 ``` $ ls blah || echo "it did not work" @@ -145,26 +135,24 @@ ls: cannot access 'blah': No such file or directory it did not work ``` -现在,尝试你的程序,在成功时,它 _不_ 返回 0 ;而是返回 1 : - +现在,尝试你的程序,在成功时,它*不*返回 `0`;而是返回 `1`: ``` -$ ./failer &&; echo "it worked" +$ ./failer && echo "it worked" String is: hello ``` -这个程序成功地执行,但是没有触发第二个命令。 +这个程序成功地执行了,但是没有触发第二个命令。 #### 变量和类型 -在一些语言中,你可以在不具体指定变量所包含的数据的 _类型_ 的情况下创建变量。这些语言如此设计使得解释器对一个变量运行一些测试来企图发现变量什么样的数据类型。例如,Python 知道当你创建一个表达式时,`var=1` 定义了一个整型数,将 `var` 添加一些东西上,这显然是一个整型数。它同样知道当你连接 `hello` 和 `world` 时,单词 `world` 是一个字符串。 +在一些语言中,你可以创建变量而不具体指定变量所包含的数据的*类型*。这些语言如此设计使得解释器需要对一个变量运行一些测试来视图发现变量是什么样的数据类型。例如,`var=1` 定义了一个整型数,当你创建一个表达式将 `var` 与某些东西相加时,Python 知道显然它是一个整型数。它同样知道当你连接 `hello` 和 `world` 时,单词 `world` 是一个字符串。 -C 语言不会为你做任何这些识别和调查;你必需定义你自己的变量类型。这里有几种变量类型,包括整型(int),字符型(char),浮点型(float),布尔型(Boolean)。 +C 语言不会为你做任何这些识别和调查;你必须自己定义你的变量类型。这里有几种变量类型,包括整型(`int`),字符型(`char`),浮点型(`float`),布尔型(`boolean`)。 你可能也注意到这里没有字符串类型。与 Python 和 Java 和 Lua 以及其它的编程语言不同,C 语言没有字符串类型,而是将字符串看作一个字符数组。 -这里是一些简单的代码,它建立了一个 `char` 数组变量,然后使用 [printf][9] 将数组变量和一段简单的信息打印到你的屏幕上: - +这里是一些简单的代码,它建立了一个 `char` 数组变量,然后使用 [printf][9] 将数组变量和一段简单的信息打印到你的屏幕上: ``` #include @@ -175,8 +163,7 @@ int main() { } ``` -你可能会注意到,这个代码示例向一个由五个字母组成的单词提供六个字符的空间。这是因为在字符串的结尾有处一个隐藏的终止符,终止符占用数组中的一个字节。你可以通过编译和执行代码来运行它: - +你可能会注意到,这个代码示例向一个由五个字母组成的单词提供了六个字符的空间。这是因为在字符串的结尾有处一个隐藏的终止符,它占用了数组中的一个字节。你可以通过编译和执行代码来运行它: ``` $ gcc hello.c --output hello @@ -186,8 +173,7 @@ hello ### 函数 -和其它的编程语言一样,C 函数采取可选函数。你可以通过定义你希望一个函数接受的数据类型来将参数从一个函数传递到另一个函数: - +和其它的编程语言一样,C 函数也接受可选的参数。你可以通过定义你希望函数接受的数据类型,来将参数从一个函数传递到另一个函数: ``` #include @@ -203,14 +189,13 @@ int main() { } ``` -使用这种方法简单将一个函数分解为两个函数的方法并不是非常有用,但是它证明 `main` 默认运行以及如何在函数之间传递数据。 +简单地将一个函数分解为两个函数的这种方法并不是非常有用,但是它演示了默认运行 `main` 函数以及如何在函数之间传递数据。 ### 条件语句 -在真实的编程中,你通常希望你的代码根据数据做出判断。这是使用This is done with _条件_ 语句完成的,并且 `if` 语句是它们中最基础的一个语句。 - -为了使这个示例程序更具动态性,你可以包含 `string.h` 头文件,它包含用于检查(顾名思义)字符串的代码。尝试使用来自 `string.h` 文件中的 `strlen` 函数测试传递给 `printmsg` 函数的字符串是否大于 0 : +在真实的编程中,你通常希望你的代码根据数据做出判断。这是使用*条件*语句完成的,`if` 语句是其中最基础的一个语句。 +为了使这个示例程序更具动态性,你可以包含 `string.h` 头文件,顾名思义,它包含用于检查字符串的代码。尝试使用来自 `string.h` 文件中的 `strlen` 函数测试传递给 `printmsg` 函数的字符串是否大于 `0`: ``` #include @@ -230,32 +215,29 @@ int main() { } ``` -正如在这个示例中所实现的,示例条件永远都不会是真实的,因为所提供的字符串总是 "hello" ,它的长度总是大于 0 。`echo` 命令的这个不够认真的重新实施的最后接触是接受来自用户的输入。 +正如在这个示例中所实现的,该条件永远都不会是非真的,因为所提供的字符串总是 `hello`,它的长度总是大于 `0`。这个不够认真的重新实现的 `echo` 命令的最后一点要做是接受来自用户的输入。 ### 命令参数 -`stdio.h` 文件包含的代码在每次程序启动时提供两个参数: 一个是包含在命令 (`argc`) 中的项目总数,一个是包含每个项目 (`argv`) 的数组。例如, 假设你发出这个虚构的命令: - +`stdio.h` 文件包含的代码在每次程序启动时提供了两个参数: 一个是命令中包含多少项的计数(`argc`),一个是包含每个项的数组(`argv`)。例如, 假设你发出这个虚构的命令: ``` $ foo -i bar ``` -`argc` 是 3 个,`argv` 的内容是: +`argc` 是 `3`,`argv` 的内容是: * `argv[0] = foo` * `argv[1] = -i` * `argv[2] = bar` - - -你可以修改示例 C 语言程序来接受 `argv[2]` 作为字符串,而不是默认来接受`hello` 吗? +你可以修改示例 C 语言程序来以字符串方式接受 `argv[2]`,而不是默认的 `hello` 吗? ### 命令式编程语言 -C 语言是一种命令式编程语言。它不是面向对象的,它没有类结构。使用 C 语言的经验可以教你很多关于如何处理数据和如何更好地管理你的代码运行时生成的数据。充分地使用 C 语言,你最后能够编写其它语言 (例如 Python 和 Lua) 能够使用的库。 +C 语言是一种命令式编程语言。它不是面向对象的,也没有类结构。使用 C 语言的经验可以教你很多关于如何处理数据,以及如何更好地管理你的代码运行时生成的数据。多使用 C 语言,你最后能够编写出其它语言(例如 Python 和 Lua)可以使用的库。 -为了学习更多关于 C 的知识,你需要使用它。在 `/usr/include/` 中查找有用的 C 语言头文件,并且看看你可以做什么小任务来使其对你学习 C 语言有用。 正如你学习时,使用 [Jim Hall][12] 的 FreeDOS 的 [C 语言忘备录][11]。它在一张双面纸忘备录上放置所有的基本要素,因此在你实施练习时,你可以立即访问 C 语言语法的所有要素。 +想要了解更多关于 C 的知识,你需要使用它。在 `/usr/include/` 中查找有用的 C 语言头文件,并且看看你可以做什么小任务来使 C 语言对你有用。在学习的过程中,使用来自 FreeDOS 的 [Jim Hall][12] 编写的 [C 语言忘备录][11]。它在一张双面纸忘备录上放置了所有的基本要素,所以在你练习时,可以立即访问 C 语言语法的所有要素。 -------------------------------------------------------------------------------- @@ -264,7 +246,7 @@ via: https://opensource.com/article/20/8/c-programming-cheat-sheet 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[robsean](https://github.com/robsean) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 1111dbff7facbb93a86f445e16792fc14d7389c7 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 18 Oct 2020 21:37:37 +0800 Subject: [PATCH 0491/1156] PUB @robsean https://linux.cn/article-12732-1.html --- .../20200820 Learn the basics of programming with C.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200820 Learn the basics of programming with C.md (99%) diff --git a/translated/tech/20200820 Learn the basics of programming with C.md b/published/20200820 Learn the basics of programming with C.md similarity index 99% rename from translated/tech/20200820 Learn the basics of programming with C.md rename to published/20200820 Learn the basics of programming with C.md index 1698522ad2..8e54cdc13d 100644 --- a/translated/tech/20200820 Learn the basics of programming with C.md +++ b/published/20200820 Learn the basics of programming with C.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12732-1.html) [#]: subject: (Learn the basics of programming with C) [#]: via: (https://opensource.com/article/20/8/c-programming-cheat-sheet) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From b17394b64a0ddf919604b0f4c35783c2b5d32f76 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 18 Oct 2020 22:11:31 +0800 Subject: [PATCH 0492/1156] PRF @geekpi --- ...ith Ansible to avoid schedule conflicts.md | 35 ++++++++----------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/translated/tech/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md b/translated/tech/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md index f3d0fde81b..14751f7137 100644 --- a/translated/tech/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md +++ b/translated/tech/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Integrate your calendar with Ansible to avoid schedule conflicts) @@ -9,20 +9,20 @@ 将你的日历与 Ansible 集成,以避免与日程冲突 ====== -通过将一个日历应用集成到 Ansible 中来确保你的自动化工作流计划不会与其他东西冲突。 -![Calendar close up snapshot][1] -”随时“是执行自动化工作流的好时机吗?答案可能是否定的,原因各不相同。 +> 通过将日历应用集成到 Ansible 中,确保你的自动化工作流计划不会与其他东西冲突。 -如果你希望避免同时进行更改,以最大限度地减少对关键业务流程的影响,并降低意外服务中断的风险,那么其他人不应该试图在你的自动化运行的同时进行更改。 +![](https://img.linux.net.cn/data/attachment/album/202010/18/221110wk9kd9ewrde11zxx.jpg) -在某些情况下,可能存在一个正在进行的计划维护窗口。 或者,可能有大型事件即将来临、一个关键的业务时间,或者假期,你或许不想在星期五晚上进行更改。 +“随时”是执行自动化工作流的好时机吗?出于不同的原因,答案可能是否定的。 + +如果要避免同时进行更改,以最大限度地减少对关键业务流程的影响,并降低意外服务中断的风险,则在你的自动化运行的同时,其他任何人都不应该试图进行更改。 + +在某些情况下,可能存在一个正在进行的计划维护窗口。或者,可能有大型事件即将来临、一个关键的业务时间、或者假期(你或许不想在星期五晚上进行更改)。 ![Street scene with a large calendar and people walking][2] -([Curtis MacNewton][3], [CC BY-ND 2.0][4]) - -无论出于什么原因,你都希望将此信息发送到你的自动化平台,并防止在特定时间段内执行周期或临时任务。在变更管理的行话中,我说的是当变更活动不应该发生时,指定封锁窗口。 +无论出于什么原因,你都希望将此信息发送到你的自动化平台,以防止在特定时间段内执行周期性或临时任务。用变更管理的行话,我说的是当变更活动不应该发生时,指定封锁窗口。 ### Ansible 中的日历集成 @@ -30,11 +30,10 @@ 目标是这样的:在执行任何自动化或变更活动之前,你要执行一个 `pre-task` ,它会检查日历中是否已经安排了某些事情(目前或最近),并确认你没有在一个阻塞的时间段中。 -想象一下,你有一个名为 `calendar` 的虚构模块,它可以连接到一个远程日历,比如 Google 日历,以确定你指定的时间是否已经以其他方式被标记为繁忙。你可以写一个类似这样的 playbook: - +想象一下,你有一个名为 `calendar` 的虚构模块,它可以连接到一个远程日历,比如 Google 日历,以确定你指定的时间是否已经以其他方式被标记为繁忙。你可以写一个类似这样的剧本: ``` -\- name: Check if timeslot is taken +- name: Check if timeslot is taken   calendar:     time: "{{ ansible_date_time.iso8601 }}"   register: output @@ -46,10 +45,7 @@ Ansible 实际会给出 `ansible_date_time`,将其传递给 `calendar` 模块 ![Google Calendar screenshot][6] -(Nicolas Leiva, [CC BY-SA 4.0][7]) - -那么这个任务的输出就会高亮这个时间段被占用的事实 (`busy: true`): - +那么这个任务的输出就会指明这个时间段被占用的事实 (`busy: true`): ``` ok: [localhost] => { @@ -66,7 +62,6 @@ ok: [localhost] => { 接下来,[Ansible Conditionals][8] 将帮助阻止所有之后任务的执行。一个简单的例子,你可以在下一个任务上使用 `when` 语句来强制它只有当上一个输出中的 `busy` 字段不是 `true` 时,它才会运行: - ``` tasks:   - shell: echo "Run this only when not busy!" @@ -75,9 +70,9 @@ tasks: ### 总结 -在[上一篇文章][9]中,我说过 Ansible 是一个将事物连接在一起的框架,将不同的构建相互连接,以协调端到端自动化工作流。 +在[上一篇文章][9]中,我说过 Ansible 是一个将事物连接在一起的框架,将不同的组成部分相互连接,以协调端到端自动化工作流。 -这篇文章探讨了 playbook 如何与日历应用集成以检查可用性。然而,我只做了一些表面工作!例如,你的任务也可以阻止日历中的一个时间段,这里的发挥空间很大。 +这篇文章探讨了 Ansible 剧本如何与日历应用集成以检查可用性。然而,我只做了一些表面工作!例如,你的任务也可以阻止日历中的一个时间段,这里的发挥空间很大。 在我的下一篇文章中,我将深入 `calendar` 模块是如何构建的,以及其他编程语言如何与 Ansible 一起使用。如果你和我一样是 [Go][10] 的粉丝,请继续关注! @@ -92,7 +87,7 @@ via: https://opensource.com/article/20/10/calendar-ansible 作者:[Nicolas Leiva][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a8877b17c0e98676e2ebf02a4377639b65d02a8d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 18 Oct 2020 22:12:25 +0800 Subject: [PATCH 0493/1156] PUB @geekpi https://linux.cn/article-12733-1.html --- ... your calendar with Ansible to avoid schedule conflicts.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md (98%) diff --git a/translated/tech/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md b/published/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md similarity index 98% rename from translated/tech/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md rename to published/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md index 14751f7137..a37438c779 100644 --- a/translated/tech/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md +++ b/published/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12733-1.html) [#]: subject: (Integrate your calendar with Ansible to avoid schedule conflicts) [#]: via: (https://opensource.com/article/20/10/calendar-ansible) [#]: author: (Nicolas Leiva https://opensource.com/users/nicolas-leiva) From 96f4e2851f5a02de6a930adbad9e6ccefcd4b509 Mon Sep 17 00:00:00 2001 From: zouchong Date: Sun, 18 Oct 2020 23:34:14 +0800 Subject: [PATCH 0494/1156] hankchow translated --- ...ion with Ansible modules for Kubernetes.md | 266 ----------------- ...ion with Ansible modules for Kubernetes.md | 267 ++++++++++++++++++ 2 files changed, 267 insertions(+), 266 deletions(-) delete mode 100644 sources/tech/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md create mode 100644 translated/tech/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md diff --git a/sources/tech/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md b/sources/tech/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md deleted file mode 100644 index c0ad7a2623..0000000000 --- a/sources/tech/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md +++ /dev/null @@ -1,266 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (HankChow) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Automate your container orchestration with Ansible modules for Kubernetes) -[#]: via: (https://opensource.com/article/20/9/ansible-modules-kubernetes) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Automate your container orchestration with Ansible modules for Kubernetes -====== -Combine Ansible with Kubernetes for cloud automation. Plus, get our -cheat sheet for using the Ansible k8s module. -![Ship captain sailing the Kubernetes seas][1] - -[Ansible][2] is one of the best tools for automating your work. [Kubernetes][3] is one of the best tools for orchestrating containers. What happens when you combine the two? As you might expect, Ansible combined with Kubernetes lets you automate your container orchestration.  - -### Ansible modules - -On its own, Ansible is basically just a framework for interpreting YAML files. Its true power comes from its [many modules][4]. Modules are what enable you to invoke external applications with just a few simple configuration settings in a playbook. - -There are a few modules that deal directly with Kubernetes, and a few that handle related technology like [Docker][5] and [Podman][6]. Learning a new module is often similar to learning a new terminal command or a new API. You get familiar with a module from its documentation, you learn what arguments it accepts, and you equate its options to how you might use the application it interfaces with. - -### Access a Kubernetes cluster - -To try out Kubernetes modules in Ansible, you must have access to a Kubernetes cluster. If you don't have that, then you might try to open a trial account online, but most of those are short term. Instead, you can install [Minikube][7], as described on the Kubernetes website or in Bryant Son's excellent article on [getting started with Minikube][8]. Minikube provides a local instance of a single-node Kubernetes install, allowing you to configure and interact with it as you would a full cluster. - -**[Download the [Ansible k8s cheat sheet][9]]** - -Before installing Minikube, you must ensure that your environment is ready to serve as a virtualization backend. You may need to install `libvirt` and grant yourself permission to the `libvirt` group: - - -``` -$ sudo dnf install libvirt -$ sudo systemctl start libvirtd -$ sudo usermod --append --groups libvirt `whoami` -$ newgrp libvirt -``` - -#### Install Python modules - -To prepare for using Kubernetes-related Ansible modules, you should also install a few helper Python modules: - - -``` -$ pip3.6 install kubernetes --user -$ pip3.6 install openshift --user -``` - -#### Start Kubernetes - -If you're using Minikube instead of a Kubernetes cluster, use the `minikube` command to start up a local, miniaturized Kubernetes instance on your computer: - - -``` -`$ minikube start --driver=kvm2 --kvm-network default` -``` - -Wait for Minikube to initialize. Depending on your internet connection, this could take several minutes. - -### Get information about your cluster - -Once you've started your cluster successfully, you can get information about it with the `cluster-info` option: - - -``` -$ kubectl cluster-info -Kubernetes master is running at -KubeDNS is running at - -To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'. -``` - -### Use the k8s module - -The entry point for using Kubernetes through Ansible is the `k8s` module, which enables you to manage Kubernetes objects from your playbooks. This module describes states resulting from `kubectl` instructions. For instance, here's how you would create a new [namespace][10] with `kubectl`: - - -``` -`$ kubectl create namespace my-namespace` -``` - -It's a simple action, and the YAML representation of the same result is similarly terse: - - -``` -\- hosts: localhost -  tasks: -    - name: create namespace -      k8s: -        name: my-namespace -        api_version: v1 -        kind: Namespace -        state: present -``` - -In this case, the host is defined as `localhost`, under the assumption that you're running this against Minikube. Notice that the module in use defines the syntax of the parameters available (such as `api_version` and `kind`). - -Before using this playbook, verify it with `yamllint`: - - -``` -`$ yamllint example.yaml` -``` - -Correct any errors, and then run the playbook: - - -``` -`$ ansible-playbook ./example.yaml` -``` - -Verify that the new namespace has been created: - - -``` -$ kubectl get namespaces -NAME              STATUS   AGE -default           Active   37h -kube-node-lease   Active   37h -kube-public       Active   37h -kube-system       Active   37h -demo              Active   11h -my-namespace      Active   3s -``` - -### Pull a container image with Podman - -Containers are Linux systems, almost impossibly minimal in scope, that can be managed by Kubernetes. Much of the container specifications have been defined by the [LXC project][11] and Docker. A recent addition to the container toolset is Podman, which is popular because it runs without requiring a daemon. - -With Podman, you can pull a container image from a repository, such as Docker Hub or Quay.io. The Ansible syntax for this is simple, and all you need to know is the location of the container, which is available from the repository's website: - - -``` -   - name: pull an image -      podman_image: -        name: quay.io/jitesoft/nginx -``` - -Verify it with `yamllint`: - - -``` -`$ yamllint example.yaml` -``` - -And then run the playbook: - - -``` -$ ansible-playbook ./example.yaml -[WARNING]: provided hosts list is empty, only localhost is available. -Note that the implicit localhost does not match 'all' - -PLAY [localhost] ************************ - -TASK [Gathering Facts] ************************ -ok: [localhost] - -TASK [create k8s namespace] ************************ -ok: [localhost] - -TASK [pull an image] ************************ -changed: [localhost] - -PLAY RECAP ************************ -localhost: ok=3 changed=1 unreachable=0 failed=0 -           skipped=0 rescued=0 ignored=0 -``` - -### Deploy with Ansible - -You're not limited to small maintenance tasks with Ansible. Your playbook can interact with Ansible in much the same way a configuration file does with `kubectl`. In fact, in many ways, the YAML you know by using Kubernetes translates to your Ansible plays. Here's a configuration you might pass directly to `kubectl` to deploy an image (in this example, a web server): - - -``` -apiVersion: apps/v1 -kind: Deployment -metadata: -  name: my-webserver -spec: -  selector: -    matchLabels: -      run: my-webserver -  replicas: 1 -  template: -    metadata: -      labels: -        run: my-webserver -    spec: -      containers: -      - name: my-webserver -        image: nginx -        ports: -        - containerPort: 80 -``` - -If you know these parameters, then you mostly know the parameters required to accomplish the same with Ansible. You can, with very little modification, move that YAML into a `definition` element in your Ansible playbook: - - -``` -   - name: deploy a web server -      k8s: -        api_version: v1 -        namespace: my-namespace -        definition: -          kind: Deployment -          metadata: -            labels: -              app: nginx -            name: nginx-deploy -          spec: -            replicas: 1 -            selector: -              matchLabels: -                app: nginx -            template: -              metadata: -                labels: -                  app: nginx -              spec: -                containers: -                  - name: my-webserver -                    image: quay.io/jitesoft/nginx -                    ports: -                      - containerPort: 80 -                        protocol: TCP -``` - -After running this, you can see the deployment with `kubectl`, as usual: - - -``` -$ kubectl -n my-namespace get pods -NAME                      READY  STATUS -nginx-deploy-7fdc9-t9wc2  1/1    Running -``` - -### Modules for the cloud - -As more development and deployments move to the cloud, it's important to understand how to automate the important aspects of your cloud. The `k8s` and `podman_image` modules are only two examples of modules related to Kubernetes and a mere fraction of modules developed for the cloud. Take a look at your workflow, find the tasks you want to track and automate, and see how Ansible can help you do more by doing less. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/9/ansible-modules-kubernetes - -作者:[Seth Kenlon][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://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/ship_captain_devops_kubernetes_steer.png?itok=LAHfIpek (Ship captain sailing the Kubernetes seas) -[2]: https://opensource.com/resources/what-ansible -[3]: https://opensource.com/resources/what-is-kubernetes -[4]: https://docs.ansible.com/ansible/latest/modules/modules_by_category.html -[5]: https://opensource.com/resources/what-docker -[6]: http://podman.io -[7]: https://kubernetes.io/docs/tasks/tools/install-minikube -[8]: https://opensource.com/article/18/10/getting-started-minikube -[9]: https://opensource.com/downloads/ansible-k8s-cheat-sheet -[10]: https://opensource.com/article/19/10/namespaces-and-containers-linux -[11]: https://www.redhat.com/sysadmin/exploring-containers-lxc diff --git a/translated/tech/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md b/translated/tech/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md new file mode 100644 index 0000000000..e0566d713c --- /dev/null +++ b/translated/tech/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md @@ -0,0 +1,267 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Automate your container orchestration with Ansible modules for Kubernetes) +[#]: via: (https://opensource.com/article/20/9/ansible-modules-kubernetes) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + + +使用 Ansible Kubernetes 模块实现容器编排自动化 +====== +> 在云上的 Kubernetes 中结合 Ansible 实现自动化的同时,还可以参照我们的速记表熟悉 Ansible 的 k8s 模块。 + +![Ship captain sailing the Kubernetes seas][1] + +[Ansible][2] 是实现自动化工作的优秀工具,而 [Kubernetes][3] 则是容器编排方面的利器,要是把两者结合起来,会有怎样的效果呢?正如你所猜测的,Ansible + Kubernetes 的确可以实现容器编排自动化。 + +### Ansible 模块 + +实际上,Ansible 本身只是一个用于解释 YAML 文件的框架。它真正强大之处在于它[丰富的模块][4],所谓模块module,就是在 Ansible playbook 中让你得以通过简单配置就能调用外部应用程序的一些工具。 + +Ansible 中有模块可以直接操作 Kubernetes,也有对一些相关组件(例如 [Docker][5] 和 [Podman][6])实现操作的模块。学习使用一个新模块的过程和学习新的终端命令、API 一样,可以先从文档中了解这个模块在调用的时候需要接受哪些参数,以及这些参数在外部应用程序中产生的具体作用。 + +### 访问 Kubernetes 集群 + +在使用 Ansible Kubernetes 模块之前,先要有能够访问 Kubernetes 集群的权限。在没有权限的情况下,可以尝试使用一个短期账号,但我们更推荐的是按照 Kubernetes 官网上的指引,或是参考 Braynt Son 《[入门 Kubernetes][8]》的教程安装 [Minikube][7]。Minikube 提供了一个单节点 Kubernetes 实例的安装过程,你可以像使用一个完整集群一样对其进行配置和交互。 + +**[下载 [Ansible k8s 速记表][9]]** + +在安装 Minikube 之前,你需要确保你的环境支持虚拟化并安装 `libvirt`,然后对 `libvirt` 用户组授权: + + +``` +$ sudo dnf install libvirt +$ sudo systemctl start libvirtd +$ sudo usermod --append --groups libvirt `whoami` +$ newgrp libvirt +``` + +#### 安装 Python 模块 + +为了能够在 Ansible 中使用 Kubernetes 相关的模块,你需要安装以下这些 Python 模块: + + +``` +$ pip3.6 install kubernetes --user +$ pip3.6 install openshift --user +``` + +#### 启动 Kubernetes + +如果你使用的是 Minikube 而不是完整的 Kubernetes 集群,请使用 `minikube` 命令在本地创建一个最精简化的 Kubernetes 实例: + + +``` +`$ minikube start --driver=kvm2 --kvm-network default` +``` + +然后等待 Minikube 完成初始化,这个过程所需的时间会因实际情况而异。 + +### 获取集群信息 + +集群启动以后,通过 `cluster-info` 选项就可以获取到集群相关信息了: + + +``` +$ kubectl cluster-info +Kubernetes master is running at +KubeDNS is running at + +To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'. +``` + +### 使用 `k8s` 模块 + +Ansible 使用 `k8s` 这个模块来实现对 Kubernetes 的操作,在 playbook 中使用 `k8s` 模块就可以对 Kuvernetes 对象进行管理。这个模块描述了 `kubectl` 命令的最终状态,例如对于以下这个使用 `kubectl` 创建新的[命名空间][10]的操作: + + +``` +`$ kubectl create namespace my-namespace` +``` + +这是一个很简单的操作,而对这个操作的最终状态用 YAML 文件来描述是这样的: + + +``` +\- hosts: localhost +  tasks: +    - name: create namespace +      k8s: +        name: my-namespace +        api_version: v1 +        kind: Namespace +        state: present +``` + +如果你使用的是 Minikube,那么主机名应该定义为 `localhost`。需要注意的是,模块中对其它可用参数也定义了对应的语法(例如 `api_version` 和 `kind` 参数)。 + +在运行这个 playbook 之前,先通过 `yamllint` 命令验证是否有错误: + + +``` +`$ yamllint example.yaml` +``` + +确保没有错误之后,运行 playbook: + + +``` +`$ ansible-playbook ./example.yaml` +``` + +可以验证新的命名空间是否已经被创建出来: + + +``` +$ kubectl get namespaces +NAME              STATUS   AGE +default           Active   37h +kube-node-lease   Active   37h +kube-public       Active   37h +kube-system       Active   37h +demo              Active   11h +my-namespace      Active   3s +``` + +### 使用 Podman 拉取容器镜像 + +容器是受 Kubernetes 管理的最小单位 Linux 系统,因此 [LXC 项目][11]和 Docker 对容器定义了很多规范。Podman 是一个最新的容器操作工具集,它不需要守护进程就可以运行,为此受到了很多用户的欢迎。 + +通过 Podman 可以从 Docker Hub 或者 Quay.io 拉取到容器镜像。这一操作对应的 Ansible 语法也很简单,只需要将存储库网站提供的镜像路径写在 playbook 中的相应位置就可以了: + + +``` +   - name: pull an image +      podman_image: +        name: quay.io/jitesoft/nginx +``` + +使用 `yamllint` 验证: + + +``` +`$ yamllint example.yaml` +``` + +运行 playbook: + + +``` +$ ansible-playbook ./example.yaml +[WARNING]: provided hosts list is empty, only localhost is available. +Note that the implicit localhost does not match 'all' + +PLAY [localhost] ************************ + +TASK [Gathering Facts] ************************ +ok: [localhost] + +TASK [create k8s namespace] ************************ +ok: [localhost] + +TASK [pull an image] ************************ +changed: [localhost] + +PLAY RECAP ************************ +localhost: ok=3 changed=1 unreachable=0 failed=0 +           skipped=0 rescued=0 ignored=0 +``` + +### 使用 Ansible 实现部署 + +Ansible 除了可以执行小型维护任务以外,还可以通过 playbook 实现其它由 `kubectl` 实现的功能,因为两者的 YAML 文件之间只有少量的差异。 在 Kubernetes 中使用的 YAML 文件只需要稍加改动,就可以在 Ansible playbook 中使用。例如下面这个用于使用 `kubectl` 命令部署 Web 服务器的 YAML 文件: + + +``` +apiVersion: apps/v1 +kind: Deployment +metadata: +  name: my-webserver +spec: +  selector: +    matchLabels: +      run: my-webserver +  replicas: 1 +  template: +    metadata: +      labels: +        run: my-webserver +    spec: +      containers: +      - name: my-webserver +        image: nginx +        ports: +        - containerPort: 80 +``` + +如果你对其中的参数比较熟悉,你只要把 YAML 文件中的大部分内容放到 playbook 中的 `definition` 部分,就可以在 Ansible 中使用了: + + +``` +   - name: deploy a web server +      k8s: +        api_version: v1 +        namespace: my-namespace +        definition: +          kind: Deployment +          metadata: +            labels: +              app: nginx +            name: nginx-deploy +          spec: +            replicas: 1 +            selector: +              matchLabels: +                app: nginx +            template: +              metadata: +                labels: +                  app: nginx +              spec: +                containers: +                  - name: my-webserver +                    image: quay.io/jitesoft/nginx +                    ports: +                      - containerPort: 80 +                        protocol: TCP +``` + +执行完成后,使用 `kubectl` 命令可以看到预期中的的部署deployment: + + +``` +$ kubectl -n my-namespace get pods +NAME                      READY  STATUS +nginx-deploy-7fdc9-t9wc2  1/1    Running +``` + +### 在云上使用模块 + +随着现在越来越多的开发和部署工作往云上转移的趋势,我们必须了解如何在云上实现自动化。其中 `k8s` 和 `podman_image` 这两个模块只是云开发中的其中一小部分。你可以在你的工作流程中寻找一些需要自动化的任务,并学习如何使用 Ansible 让你在这些任务上事半功倍。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/ansible-modules-kubernetes + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[HankChow](https://github.com/HankChow) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/ship_captain_devops_kubernetes_steer.png?itok=LAHfIpek (Ship captain sailing the Kubernetes seas) +[2]: https://opensource.com/resources/what-ansible +[3]: https://opensource.com/resources/what-is-kubernetes +[4]: https://docs.ansible.com/ansible/latest/modules/modules_by_category.html +[5]: https://opensource.com/resources/what-docker +[6]: http://podman.io +[7]: https://kubernetes.io/docs/tasks/tools/install-minikube +[8]: https://opensource.com/article/18/10/getting-started-minikube +[9]: https://opensource.com/downloads/ansible-k8s-cheat-sheet +[10]: https://opensource.com/article/19/10/namespaces-and-containers-linux +[11]: https://www.redhat.com/sysadmin/exploring-containers-lxc From e3621954e50e7f15e72853b7fadb38819c16d4dd Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 19 Oct 2020 08:42:06 +0800 Subject: [PATCH 0495/1156] translated --- ...pp for Various Streaming Music Services.md | 94 ------------------- ...pp for Various Streaming Music Services.md | 94 +++++++++++++++++++ 2 files changed, 94 insertions(+), 94 deletions(-) delete mode 100644 sources/tech/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md create mode 100644 translated/tech/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md diff --git a/sources/tech/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md b/sources/tech/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md deleted file mode 100644 index 66061e71d5..0000000000 --- a/sources/tech/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md +++ /dev/null @@ -1,94 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (MellowPlayer is a Desktop App for Various Streaming Music Services) -[#]: via: (https://itsfoss.com/mellow-player/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -MellowPlayer is a Desktop App for Various Streaming Music Services -====== - -_**Brief: MellowPlayer is a free and open-source desktop that lets you integrate web-based music streaming services on Linux and Windows.**_ - -Undoubtedly, a lot of users prefer tuning in to streaming services to listen to their favorite music instead of purchasing individual music from stores or downloading them for a collection. - -Of course, streaming services let you explore new music and help artists reach out to a wider audience easily. But, with so much music streaming services available ([Soundcloud][1], [Spotify][2], [YouTube Music][3], [Amazon Music][4], etc) it often becomes annoying to utilize them effectively while using your computer. - -You may [install Spotify on Linux][5] but there is no desktop app for Amazon Music. So, potentially you cannot manage the streaming service from a single portal. - -What if a desktop app lets you integrate streaming services on both Windows and Linux for free? In this article, I will talk about such an app — ‘[MellowPlayer][6]‘. - -### MellowPlayer: Open Source App to Integrate Various Streaming Music Services - -![][7] - -MellowPlayer is a free and open-source cross-platform desktop app that lets you integrate multiple streaming services and manage them all from one interface. - -There are several supported streaming services that you can integrate. You also get a certain level of control to tweak your experience from each individual service. For instance, you can set to automatically skip ads or mute them on YouTube. - -The cross-platform support for both Windows and Linux is definitely a plus point. - -Apart from the ability to manage the streaming services, it also integrates the player with your system tray to easily control the music. This means that you can use media keys on your keyboard to control the music player. - -It is also worth noting that you can add a new service that is not officially supported by just creating a plugin for it yourself within the app. To let you know more about it, let me highlight all the key features below. - -### Features of MellowPlayer - -![][8] - - * Cross-platform (Windows & Linux) - * Free & Open-Source - * Plugin-based Application to let you add new service by creating a plugin - * Integrates the services as a native desktop app with the system tray - * Supports hot keys - * Notifications support - * Listening history - - - -### Installing MellowPlayer on Linux - -![][9] - -MellowPlayer is available as a [Flatpak package][10]. I know it’s disappointing for some but it’s just Flatpak for Linux and an executable file for Windows. In case you didn’t know, follow our guide on [using Flatpak on Linux][11] to get started. - -[Download MellowPlayer][12] - -### Wrapping Up - -MellowPlayer is a handy desktop app for users who often dabble with multiple streaming services for music. Even though it works fine as per my test with SoundCloud, YouTube, and Spotify, I did notice that the app crashed when trying to re-size the window, just a heads up on that. You can explore more about it on its [GitLab page][13]. - -There are two similar applications that allow you to play multiple streaming music services: [Nuvola][14] and [Nuclear Music Player][15]. You may want to check them out. - -Have you tried MellowPlayer? Feel free to share your thoughts in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/mellow-player/ - -作者:[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://soundcloud.com -[2]: https://www.spotify.com -[3]: https://music.youtube.com -[4]: https://music.amazon.com/home -[5]: https://itsfoss.com/install-spotify-ubuntu-linux/ -[6]: https://colinduquesnoy.gitlab.io/MellowPlayer/ -[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/mellowplayer-screenshot.jpg?resize=800%2C439&ssl=1 -[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/mellowplayer.png?resize=800%2C442&ssl=1 -[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/mellowplayer-system-integration.jpg?resize=800%2C438&ssl=1 -[10]: https://flathub.org/apps/details/com.gitlab.ColinDuquesnoy.MellowPlayer -[11]: https://itsfoss.com/flatpak-guide/ -[12]: https://colinduquesnoy.gitlab.io/MellowPlayer/#features -[13]: https://gitlab.com/ColinDuquesnoy/MellowPlayer -[14]: https://itsfoss.com/nuvola-music-player/ -[15]: https://itsfoss.com/nuclear-music-player-linux/ diff --git a/translated/tech/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md b/translated/tech/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md new file mode 100644 index 0000000000..52a496be07 --- /dev/null +++ b/translated/tech/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md @@ -0,0 +1,94 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (MellowPlayer is a Desktop App for Various Streaming Music Services) +[#]: via: (https://itsfoss.com/mellow-player/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +MellowPlayer 是一款用于各种流媒体音乐服务的桌面应用 +====== + +_**简介:MellowPlayer 是一个免费开源的桌面应用,可以让你在 Linux 和 Windows 上整合基于网络的音乐流媒体服务。**_ + +毋庸置疑,很多用户都喜欢使用流媒体服务来收听自己喜欢的音乐,而不是从商店购买单首音乐或者下载收藏。 + +当然,流媒体服务可以让你探索新的音乐,帮助艺术家轻松接触到更多的听众。但是,由于有许多的音乐流媒体服务([Soundcloud][1]、[Spotify][2]、[YouTube Music][3]、[Amazon Music][4] 等),因此当在使用电脑时,要有效地使用它们往往会变得很麻烦。 + +你可以[在 Linux 上安装 Spotify][5],但没有 Amazon Music 的桌面应用。所以,有可能你无法从单一门户管理流媒体服务。 + +如果一个桌面应用可以让你同时在 Windows 和 Linux 上免费整合流媒体服务呢?在本文中,我将介绍这样一款应用:“[MellowPlayer][6]”。 + +### MellowPlayer: 集成各种流媒体音乐服务的开源应用 + +![][7] + +MellowPlayer 是一款免费开源的跨平台桌面应用,它可以让你整合多个流媒体服务,并在一个界面上管理它们。 + +你可以整合多个支持的流媒体服务。你还可以从每个单独的服务中获得一定程度的控制权来调整你的体验。例如,你可以设置自动跳过广告或在 YouTube 上静音。 + +对 Windows 和 Linux 的跨平台支持绝对是一个加分项。 + +除了能够管理流媒体服务外,它还将播放器与系统托盘整合在一起来轻松控制音乐。这意味着你可以使用键盘上的媒体键来控制音乐播放器。 + +另外值得一提的是,你只要在应用内自己创建一个插件,就可以添加一个官方不支持的新服务。为了让你对它有更多的了解,下面就让我重点介绍一下所有的主要特点。 + +### MellowPlayer 的特点 + +![][8] + + * 跨平台 (Windows 和 Linux) + * 免费且开源 + * 基于插件的应用,让你通过创建一个插件来添加新的服务 + * 将服务作为本地桌面应用与系统托盘整合 + * 支持热键 + * 支持通知 + * 收听历史 + + + +### 在 Linux 上安装 MellowPlayer + +![][9] + +MellowPlayer 是以 [Flatpak 包][10]的形式提供的。我知道这让一些人很失望,但它在 Linux 中只有 Flaptak,WIndows 中只有一个可执行文件。如果你不知道,请按照我们的[在 Linux 上使用 Flatpak][11] 指南来开始使用。 + +[下载 MellowPlayer][12] + +### 总结 + +MellowPlayer 是一款方便的桌面应用,适合经常涉猎多种流媒体音乐服务的用户使用。尽管根据我的测试,它在 SoundCloud、YouTube 和 Spotify 上都能正常工作,但我确实注意到,当我试图重新调整窗口大小时,应用会崩溃,只是在此提醒一下。你可以在它的 [GitLab 页面][13]上了解更多关于它的内容。 + +还有两个类似的应用,可以让你播放多个流媒体音乐服务。[Nuvola][14] 和 [Nuclear Music Player][15]。你可能会想看看它们。 + +你试过 MellowPlayer 吗?欢迎在下方评论中分享你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/mellow-player/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者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://soundcloud.com +[2]: https://www.spotify.com +[3]: https://music.youtube.com +[4]: https://music.amazon.com/home +[5]: https://itsfoss.com/install-spotify-ubuntu-linux/ +[6]: https://colinduquesnoy.gitlab.io/MellowPlayer/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/mellowplayer-screenshot.jpg?resize=800%2C439&ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/mellowplayer.png?resize=800%2C442&ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/mellowplayer-system-integration.jpg?resize=800%2C438&ssl=1 +[10]: https://flathub.org/apps/details/com.gitlab.ColinDuquesnoy.MellowPlayer +[11]: https://itsfoss.com/flatpak-guide/ +[12]: https://colinduquesnoy.gitlab.io/MellowPlayer/#features +[13]: https://gitlab.com/ColinDuquesnoy/MellowPlayer +[14]: https://itsfoss.com/nuvola-music-player/ +[15]: https://itsfoss.com/nuclear-music-player-linux/ From 84787fb410e7e36df6baec2229da285888e9d56c Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 19 Oct 2020 08:47:24 +0800 Subject: [PATCH 0496/1156] translating --- ...w to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md b/sources/tech/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md index 48107292e8..d772a3e6c9 100644 --- a/sources/tech/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md +++ b/sources/tech/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 29c7980a3eb46278711ece24686128bc2efb535d Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Mon, 19 Oct 2020 09:57:40 +0800 Subject: [PATCH 0497/1156] Update 20200914 NFC vs. Bluetooth LE- When to use which.md --- ...NFC vs. Bluetooth LE- When to use which.md | 43 ++++++++++--------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/sources/talk/20200914 NFC vs. Bluetooth LE- When to use which.md b/sources/talk/20200914 NFC vs. Bluetooth LE- When to use which.md index 471a70d36a..d5efa3afc2 100644 --- a/sources/talk/20200914 NFC vs. Bluetooth LE- When to use which.md +++ b/sources/talk/20200914 NFC vs. Bluetooth LE- When to use which.md @@ -9,44 +9,47 @@ NFC vs. Bluetooth LE: When to use which ====== -Near-field communications and Bluetooth LE are low-power wireless technologies suited for different uses in enterprises. +近场通信和蓝牙LE是适合企业不同用途的低功耗无线技术。 Metamorworks / Getty Images -Among many options for low-power, relatively short-ranged connectivity, two technologies stand out – near-field communication and Bluetooth low energy. Both have relatively low deployment costs and are simple to use. +在低功率、相对短距离连接的众多选择中,两种技术脱颖而出——近场通信和低功耗蓝牙。两者都具有相对低廉的部署成本且易于使用。 -NFC is best known for being the technology behind many modern smart cards. NFC chips need to be very close – within a few centimeters – to a reader for a connection to be made, but that’s an upside in its primary enterprise use case, which is security and access control. -[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] +NFC作为许多现代智能卡片的背后技术而为大众所熟知。NFC芯片必须十分接近(在几厘米内)读卡器来实现连接, 但这是它主要企业用例(安全性和访问控制)的一个优势。 -Bluetooth LE is a low-power derivative of the main Bluetooth standard, offsetting lower potential throughput with substantially reduced energy consumption and the consequent ability to fit into a wider range of potential use cases. +[[通过注册Network World时事通讯定期获取信息。]][1] -Next, we’ll delve into more in-depth descriptions of each technology and their primary use cases. +蓝牙LE是主要蓝牙标准的低功耗衍生产品,通过显著降低能耗来抵消较低的潜在吞吐量,并具备适应更宽广的潜在用例的能力。 -### NFC features +接下来,我们将研究每种技术更深入的细节内容以及它们的主要用例。 -NFC operates at near-contact ranges – devices must be within several centimeters of each other in order to make contact. A readable passive NFC “tag” requires no independent power source at all, drawing energy from the initiator’s signal, which operates at around 13.5MHz and requires between 100 and 700 µA of power when actively reading a tag. +### NFC的未来 -“The short range is actually an advantage,” said Gartner research senior director and analyst Bill Ray. “The big thing about NFC is that it’s not just the radio, there’s a massive security protocol built-in.” That is, a potential bad actor would have to be very close – within a few meters, using specialized equipment – to even be able to detect an NFC connection taking place. NFC implementations can also layer on SSL technology for additional safety. +NFC在近距离接触范围内工作(设备间必须靠近到几厘米范围内来进行连接),一个可读无源的NFC芯片根本不需要任何独立电源,它会从读卡器的信号中汲取能量,工作频率在13.5MHz附近,并且在主动读取芯片时需要100-700µA的电源。 -That’s not a surprise, given NFC’s origins as a contactless payment technology. Its roots in that area create an appeal for retailers, which could use NFC to let customers get additional information about items before they buy, get coupons or ask for assistance from a clerk simply by touching their phones to an NFC hotspot. +Gartner研究高级总监兼分析师说,“事实上短距离是它的优势。” NFC的一大优点是它不仅仅是无线电,还内置了庞大的安全协议。也就是说,潜在的不良因素将会逼近——使用专用设备在几米的范围内才能检测到正在发生的NFC连接。 NFC的施行还可以在SSL技术上分层来提高安全性。 -While the short range involved has limited the number of use cases that make sense for NFC technology, it’s not solely about opening doors and buying lattes. NFC can be used to bootstrap connections for quick and easy pairing between devices, so a user could simply tap their phone on a properly equipped projector in a conference room to create an NFC connection, validate that the smartphone is an approved device to connect to, and give a presentation. The presentation or video data itself wouldn’t be transferred via NFC, but the NFC handshake acts as a validation for a different wireless protocol, eliminating the need to sign into, for example, a Wi-Fi network, or any other higher-bandwidth network that could stream that data. +考虑到NFC本就起源于非接触式支付技术,这不足为奇。它的根源在于对零售商的吸引力,它可以使用NFC让客户在购买商品、获取优惠券或者向店员寻求帮助前,通过简单地使用手机来连接NFC热点就可以获取相关的信息。 -### Bluetooth LE characteristics +尽管NFC只能在一个很短的范围内使用,限制了使用NFC技术用例的数量,但它不仅仅是打开门买一杯拿铁。NFC用于引导连接便于设备间轻松快速的配对,因此用户可以在配备有投影仪的会议室中使用手机即可创建一个NFC连接,并验证智能手机是否是一个可连接的授权设备并显示相关的信息。演示文稿或者视频数据本身不会通过NFC来传输,但是NFC握手可作为不同无线协议间的验证,从而无需用户登录,例如Wi-Fi网络或者任何其他更高带宽可以传输数据的网络。 -Bluetooth LE, by contrast, operates over substantially longer distances – anywhere up to several dozen meters – and has about twice the maximum bandwidth of an NFC connection at 1 Mbit/second. It’s an outgrowth of the well-known Bluetooth technology, optimized for machine-to-machine connectivity, thanks to its lower power usage than the main-line standard. It uses less than 15 mA of power at either end of a connection, and has a practical range of about 10 meters, securing connections with AES encryption. -Yet it’s far from a drop-in replacement for NFC, according to Forrester principal analyst Andre Kindness. +### 蓝牙LE的特点 -“From an information transfer perspective [NFC is] a lot quicker than BLE,” he said. BLE usually takes an appreciable fraction of a second or longer to identify and secure a connection, while that process is more or less instantaneous with NFC. +相较之下,Bluetooth LE可以在更长的距离上运行(长达几十米),在1 Mbit / s的带宽下,其最大带宽约为NFC连接的两倍。它是出名的蓝牙技术的产物,相较于主线标准的更低功耗优化了双机连接。 在双机连接的任何一端电流均小于15 mA,实用范围约为10米,可通过AES加密保护连接。 -Bluetooth LE, however, is considerably more versatile than NFC, thanks to its greater range, according to IDC senior research analyst Patrick Filkins. +根据Forrester首席分析师Andre Kindness的说法,它远非NFC的替代品。 -“I think Bluetooth [LE] is a little better suited for enterprise,” he said. Use cases like asset tracking, indoor navigation, and targeted advertisements are just the tip of the iceberg. +他说:“从信息传递角度来看, [NFC] 比BLE快一点。”BLE通常需要一秒或更长时间的验证并安全连接,而NFC几乎在瞬间完成连接。 -For enterprises, then, the upshot is fairly straightforward – NFC use cases are mostly separate from those for which a company would use Bluetooth, but, for the rare overlap where a choice can be made, the relative advantages and disadvantages are clear. NFC is very short-ranged, cheap, connects instantly and has a lower data transfer rate. Bluetooth LE works over much longer distances and at higher speeds, costs somewhat more and takes a moment to “handshake” its connections. +然而根据IDC高级研究分析师Patrick Filkins的说法,相较于NFC,蓝牙LE由于范围更广而有着更多的通用性。 + +他说:“我认为蓝牙LE比较适合企业”。而类似于资产追踪,室内导航和目标广告的用例只是冰山一角。 + +对于企业,结果是相当直接的——NFC用例大多与公司使用蓝牙的用例是分开的,对于少有的可以选择的重叠,相对的优势和劣势显而易见。NFC有着短距离,廉价,即时连接以及更低数据转换率的优点。蓝牙LE工作的距离更远、传输速率更高,成本也更高,还需要一点时间来进行“握手”连接。 + +加入 [Facebook][2] 和 [LinkedIn][3] 上的Network World社区,在最热门的话题下留下你的评论。 -Join the Network World communities on [Facebook][2] and [LinkedIn][3] to comment on topics that are top of mind. -------------------------------------------------------------------------------- @@ -54,7 +57,7 @@ via: https://www.networkworld.com/article/3574932/nfc-vs-bluetooth-le-when-to-us 作者:[Jon Gold][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[chenmu-kk](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 31aa123a37857c4dcc159490d7f3c43a641dcee7 Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Mon, 19 Oct 2020 09:58:52 +0800 Subject: [PATCH 0498/1156] Update 20200914 NFC vs. Bluetooth LE- When to use which.md --- .../talk/20200914 NFC vs. Bluetooth LE- When to use which.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20200914 NFC vs. Bluetooth LE- When to use which.md b/sources/talk/20200914 NFC vs. Bluetooth LE- When to use which.md index d5efa3afc2..7e5f451bba 100644 --- a/sources/talk/20200914 NFC vs. Bluetooth LE- When to use which.md +++ b/sources/talk/20200914 NFC vs. Bluetooth LE- When to use which.md @@ -7,7 +7,7 @@ [#]: via: (https://www.networkworld.com/article/3574932/nfc-vs-bluetooth-le-when-to-use-which.html) [#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) -NFC vs. Bluetooth LE: When to use which +NFC vs. 蓝牙 LE: 如何抉择 ====== 近场通信和蓝牙LE是适合企业不同用途的低功耗无线技术。 Metamorworks / Getty Images From e9d746011dfe764d929192292bb234937f2cad1b Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Mon, 19 Oct 2020 10:02:32 +0800 Subject: [PATCH 0499/1156] Update and rename sources/talk/20200914 NFC vs. Bluetooth LE- When to use which.md to translated/talk/20200914 NFC vs. Bluetooth LE- When to use which.m --- .../talk/20200914 NFC vs. Bluetooth LE- When to use which.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename sources/talk/20200914 NFC vs. Bluetooth LE- When to use which.md => translated/talk/20200914 NFC vs. Bluetooth LE- When to use which.m (96%) diff --git a/sources/talk/20200914 NFC vs. Bluetooth LE- When to use which.md b/translated/talk/20200914 NFC vs. Bluetooth LE- When to use which.m similarity index 96% rename from sources/talk/20200914 NFC vs. Bluetooth LE- When to use which.md rename to translated/talk/20200914 NFC vs. Bluetooth LE- When to use which.m index 7e5f451bba..e3d957c88b 100644 --- a/sources/talk/20200914 NFC vs. Bluetooth LE- When to use which.md +++ b/translated/talk/20200914 NFC vs. Bluetooth LE- When to use which.m @@ -40,7 +40,7 @@ Gartner研究高级总监兼分析师说,“事实上短距离是它的优势 根据Forrester首席分析师Andre Kindness的说法,它远非NFC的替代品。 -他说:“从信息传递角度来看, [NFC] 比BLE快一点。”BLE通常需要一秒或更长时间的验证并安全连接,而NFC几乎在瞬间完成连接。 +他说:“从信息传递角度来看,[NFC] 比BLE快一点。”BLE通常需要一秒或更长时间的验证并安全连接,而NFC几乎在瞬间完成连接。 然而根据IDC高级研究分析师Patrick Filkins的说法,相较于NFC,蓝牙LE由于范围更广而有着更多的通用性。 From 489a304ea9b448ba08310f7130f66a62e03ea795 Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Mon, 19 Oct 2020 10:03:25 +0800 Subject: [PATCH 0500/1156] Update 20200914 NFC vs. Bluetooth LE- When to use which.m --- .../talk/20200914 NFC vs. Bluetooth LE- When to use which.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/talk/20200914 NFC vs. Bluetooth LE- When to use which.m b/translated/talk/20200914 NFC vs. Bluetooth LE- When to use which.m index e3d957c88b..7e5f451bba 100644 --- a/translated/talk/20200914 NFC vs. Bluetooth LE- When to use which.m +++ b/translated/talk/20200914 NFC vs. Bluetooth LE- When to use which.m @@ -40,7 +40,7 @@ Gartner研究高级总监兼分析师说,“事实上短距离是它的优势 根据Forrester首席分析师Andre Kindness的说法,它远非NFC的替代品。 -他说:“从信息传递角度来看,[NFC] 比BLE快一点。”BLE通常需要一秒或更长时间的验证并安全连接,而NFC几乎在瞬间完成连接。 +他说:“从信息传递角度来看, [NFC] 比BLE快一点。”BLE通常需要一秒或更长时间的验证并安全连接,而NFC几乎在瞬间完成连接。 然而根据IDC高级研究分析师Patrick Filkins的说法,相较于NFC,蓝牙LE由于范围更广而有着更多的通用性。 From 51a8124c51c6aacc46fd52e05db39184edfaf507 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 19 Oct 2020 10:52:14 +0800 Subject: [PATCH 0501/1156] Rename 20200914 NFC vs. Bluetooth LE- When to use which.m to 20200914 NFC vs. Bluetooth LE- When to use which.md --- ...hich.m => 20200914 NFC vs. Bluetooth LE- When to use which.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename translated/talk/{20200914 NFC vs. Bluetooth LE- When to use which.m => 20200914 NFC vs. Bluetooth LE- When to use which.md} (100%) diff --git a/translated/talk/20200914 NFC vs. Bluetooth LE- When to use which.m b/translated/talk/20200914 NFC vs. Bluetooth LE- When to use which.md similarity index 100% rename from translated/talk/20200914 NFC vs. Bluetooth LE- When to use which.m rename to translated/talk/20200914 NFC vs. Bluetooth LE- When to use which.md From 39c610369b794f68ed736c2276384c579ad324a2 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 19 Oct 2020 10:52:55 +0800 Subject: [PATCH 0502/1156] =?UTF-8?q?Revert=20"=E8=B6=85=E6=9C=9F=E5=9B=9E?= =?UTF-8?q?=E6=94=B6:=20sources/talk/20191009=20Why=20to=20choose=20Rust?= =?UTF-8?q?=20as=20your=20next=20programming=20language.md"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...1009 Why to choose Rust as your next programming language.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20191009 Why to choose Rust as your next programming language.md b/sources/talk/20191009 Why to choose Rust as your next programming language.md index d8cad5c342..871b31abc6 100644 --- a/sources/talk/20191009 Why to choose Rust as your next programming language.md +++ b/sources/talk/20191009 Why to choose Rust as your next programming language.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MATRIXKOO) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 9ebd16c9e38420794bd4cbe67d3e83a9755b5cf7 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 19 Oct 2020 20:17:19 +0800 Subject: [PATCH 0503/1156] PRF @chenmu-kk --- ...NFC vs. Bluetooth LE- When to use which.md | 51 +++++++++---------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/translated/talk/20200914 NFC vs. Bluetooth LE- When to use which.md b/translated/talk/20200914 NFC vs. Bluetooth LE- When to use which.md index 7e5f451bba..3deda7040e 100644 --- a/translated/talk/20200914 NFC vs. Bluetooth LE- When to use which.md +++ b/translated/talk/20200914 NFC vs. Bluetooth LE- When to use which.md @@ -1,55 +1,50 @@ [#]: collector: (lujun9972) -[#]: translator: ( chenmu-kk ) -[#]: reviewer: ( ) +[#]: translator: (chenmu-kk) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (NFC vs. Bluetooth LE: When to use which) [#]: via: (https://www.networkworld.com/article/3574932/nfc-vs-bluetooth-le-when-to-use-which.html) [#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) -NFC vs. 蓝牙 LE: 如何抉择 +近场通信 vs. 低功耗蓝牙:如何抉择 ====== -近场通信和蓝牙LE是适合企业不同用途的低功耗无线技术。 -Metamorworks / Getty Images -在低功率、相对短距离连接的众多选择中,两种技术脱颖而出——近场通信和低功耗蓝牙。两者都具有相对低廉的部署成本且易于使用。 +> 近场通信(NFC)和低功耗蓝牙(BLE)是适合企业不同用途的低功耗无线技术。 +![](https://images.idgesg.net/images/article/2020/08/distributed_network_of_wifi_wi-fi_internet_connections_across_cityscape_by_metamorworks_gettyimages-926502948_2400x1600-100855926-large.jpg) -NFC作为许多现代智能卡片的背后技术而为大众所熟知。NFC芯片必须十分接近(在几厘米内)读卡器来实现连接, 但这是它主要企业用例(安全性和访问控制)的一个优势。 +在低功率、相对短距离连接的众多选择中,有两种技术脱颖而出——近场通信(NFC)和低功耗蓝牙(BLE)。两者都具有相对低廉的部署成本且易于使用。 -[[通过注册Network World时事通讯定期获取信息。]][1] +NFC 作为许多现代智能卡片的背后技术而为大众所熟知。NFC 芯片必须十分接近(在几厘米内)读卡器来实现连接,但这是它主要企业用例(安全性和访问控制)的一个优势。 -蓝牙LE是主要蓝牙标准的低功耗衍生产品,通过显著降低能耗来抵消较低的潜在吞吐量,并具备适应更宽广的潜在用例的能力。 +BLE 是主要蓝牙标准的低功耗衍生品,以较低的潜在吞吐量换来了能耗的显著降低,从而能够适应更广泛的潜在用例。 -接下来,我们将研究每种技术更深入的细节内容以及它们的主要用例。 +接下来,我们将对每种技术及其主要用例进行更深入的描述。 -### NFC的未来 +### NFC 的未来 -NFC在近距离接触范围内工作(设备间必须靠近到几厘米范围内来进行连接),一个可读无源的NFC芯片根本不需要任何独立电源,它会从读卡器的信号中汲取能量,工作频率在13.5MHz附近,并且在主动读取芯片时需要100-700µA的电源。 +NFC 在近距离接触范围内工作(设备间必须靠近到几厘米范围内来进行连接),一个可读的无源 NFC “标签”根本不需要任何独立电源,它会从读卡器的信号中汲取能量,工作频率约为 13.5MHz,在主动读取芯片时需要 100-700µA 的电量。 -Gartner研究高级总监兼分析师说,“事实上短距离是它的优势。” NFC的一大优点是它不仅仅是无线电,还内置了庞大的安全协议。也就是说,潜在的不良因素将会逼近——使用专用设备在几米的范围内才能检测到正在发生的NFC连接。 NFC的施行还可以在SSL技术上分层来提高安全性。 +“短距离实际上是它的优势。”Gartner 研究高级总监兼分析师说, “NFC 的一大优点是它不仅仅是无线电,还内置了一个庞大的安全协议。”也就是说,潜在的不良行为者必须非常接近——使用专用设备、在几米的范围内——才能检测到正在发生的 NFC 连接。NFC 还可以施行在 SSL 技术上面一层以提高安全性。 -考虑到NFC本就起源于非接触式支付技术,这不足为奇。它的根源在于对零售商的吸引力,它可以使用NFC让客户在购买商品、获取优惠券或者向店员寻求帮助前,通过简单地使用手机来连接NFC热点就可以获取相关的信息。 +考虑到 NFC 本就起源于非接触式支付技术,这不足为奇。它在这一领域的根基在于对零售商的吸引力,零售商可以利用 NFC 让客户在购买商品前获取相关的信息、获得优惠券或者向店员寻求帮助,只需将手机接触到 NFC 热点即可。 -尽管NFC只能在一个很短的范围内使用,限制了使用NFC技术用例的数量,但它不仅仅是打开门买一杯拿铁。NFC用于引导连接便于设备间轻松快速的配对,因此用户可以在配备有投影仪的会议室中使用手机即可创建一个NFC连接,并验证智能手机是否是一个可连接的授权设备并显示相关的信息。演示文稿或者视频数据本身不会通过NFC来传输,但是NFC握手可作为不同无线协议间的验证,从而无需用户登录,例如Wi-Fi网络或者任何其他更高带宽可以传输数据的网络。 +尽管 NFC 只能在一个很近的范围内使用,这限制了使用 NFC 技术用例场景,但它不仅仅是为了开门和买一杯拿铁。NFC 可以用于引导连接,便于设备间轻松快速的配对,因此用户只需在会议室中将手机贴近配备好的投影仪,即可创建一个 NFC 连接,并验证智能手机是否是一个可连接的授权设备,并进行演示。演示文稿或者视频数据本身不会通过 NFC 来传输,但是 NFC 握手可作为另外的无线协议(例如 Wi-Fi 网络或者任何其他更高带宽可以传输数据的网络)间的验证,从而无需用户登录。 +### BLE 的特点 -### 蓝牙LE的特点 +相较之下,BLE 的工作距离要远的多(长达几十米),其最大带宽 :1 Mbit/s 约为 NFC 连接的两倍。它是著名的蓝牙技术的产物,相较于主线标准的更低功耗,它为机器到机器的连接做了优化。在连接两端的耗电量均小于 15 mA,实用范围约为 10米,可通过 AES 加密保护连接。 -相较之下,Bluetooth LE可以在更长的距离上运行(长达几十米),在1 Mbit / s的带宽下,其最大带宽约为NFC连接的两倍。它是出名的蓝牙技术的产物,相较于主线标准的更低功耗优化了双机连接。 在双机连接的任何一端电流均小于15 mA,实用范围约为10米,可通过AES加密保护连接。 +然而,根据 Forrester 首席分析师 Andre Kindness 的说法,它远非 NFC 的替代品。 -根据Forrester首席分析师Andre Kindness的说法,它远非NFC的替代品。 +他说:“从信息传递角度来看, [NFC] 比 BLE 快得多。”BLE 通常需要几分之一秒或更长时间的验证并安全连接,而 NFC 几乎在瞬间完成连接。 -他说:“从信息传递角度来看, [NFC] 比BLE快一点。”BLE通常需要一秒或更长时间的验证并安全连接,而NFC几乎在瞬间完成连接。 +不过,根据 IDC 高级研究分析师 Patrick Filkins 的说法,相较于 NFC,BLE 由于范围更广而有着更多的通用性。 -然而根据IDC高级研究分析师Patrick Filkins的说法,相较于NFC,蓝牙LE由于范围更广而有着更多的通用性。 - -他说:“我认为蓝牙LE比较适合企业”。而类似于资产追踪,室内导航和目标广告的用例只是冰山一角。 - -对于企业,结果是相当直接的——NFC用例大多与公司使用蓝牙的用例是分开的,对于少有的可以选择的重叠,相对的优势和劣势显而易见。NFC有着短距离,廉价,即时连接以及更低数据转换率的优点。蓝牙LE工作的距离更远、传输速率更高,成本也更高,还需要一点时间来进行“握手”连接。 - -加入 [Facebook][2] 和 [LinkedIn][3] 上的Network World社区,在最热门的话题下留下你的评论。 +他说:“我认为 BLE 比较适合企业”。而类似于资产追踪、室内导航和目标广告的用例只是冰山一角。 +对于企业,结果是相当直接的——NFC 用例大多与公司使用蓝牙的用例是分开的,对于少有的可以选择的重叠,相对的优势和劣势显而易见。NFC 距离很短、价格便宜、可即时连接以及数据转换率较低。BLE 的工作距离更远、传输速率更高,成本也更高,连接时还需要一点时间来进行“握手”。 -------------------------------------------------------------------------------- @@ -57,8 +52,8 @@ via: https://www.networkworld.com/article/3574932/nfc-vs-bluetooth-le-when-to-us 作者:[Jon Gold][a] 选题:[lujun9972][b] -译者:[chenmu-kk](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[chenmu-kk](https://github.com/chenmu-kk) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From f9c1cb22fa1b1289d5f7d8bfa8bd4fb60d857603 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 19 Oct 2020 20:18:02 +0800 Subject: [PATCH 0504/1156] PUY @chenmu-kk https://linux.cn/article-12735-1.html --- .../20200914 NFC vs. Bluetooth LE- When to use which.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20200914 NFC vs. Bluetooth LE- When to use which.md (98%) diff --git a/translated/talk/20200914 NFC vs. Bluetooth LE- When to use which.md b/published/20200914 NFC vs. Bluetooth LE- When to use which.md similarity index 98% rename from translated/talk/20200914 NFC vs. Bluetooth LE- When to use which.md rename to published/20200914 NFC vs. Bluetooth LE- When to use which.md index 3deda7040e..ddac09e47d 100644 --- a/translated/talk/20200914 NFC vs. Bluetooth LE- When to use which.md +++ b/published/20200914 NFC vs. Bluetooth LE- When to use which.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (chenmu-kk) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12735-1.html) [#]: subject: (NFC vs. Bluetooth LE: When to use which) [#]: via: (https://www.networkworld.com/article/3574932/nfc-vs-bluetooth-le-when-to-use-which.html) [#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) From e3f36d83343114374f7f553e42c81ef6e82cc9ee Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 19 Oct 2020 20:42:30 +0800 Subject: [PATCH 0505/1156] APL --- ...FOSS (Free and Open Source Software)- What is Open Source.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md b/sources/talk/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md index 8734ab2a69..7a84ea9d21 100644 --- a/sources/talk/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md +++ b/sources/talk/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 450f474ba51aa352fe1f12016118b509aae5f851 Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Mon, 19 Oct 2020 22:19:31 +0800 Subject: [PATCH 0506/1156] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=AF=91=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0503 Go on very small hardware (Part 3).md | 154 ++++++++++-------- 1 file changed, 82 insertions(+), 72 deletions(-) diff --git a/sources/tech/20180503 Go on very small hardware (Part 3).md b/sources/tech/20180503 Go on very small hardware (Part 3).md index c704867375..28d5817236 100644 --- a/sources/tech/20180503 Go on very small hardware (Part 3).md +++ b/sources/tech/20180503 Go on very small hardware (Part 3).md @@ -3,53 +3,54 @@ [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) -[#]: subject: (Go on very small hardware (Part 3)) +[#]: subject: (Go on very small hardware Part 3) [#]: via: (https://ziutek.github.io/2018/05/03/go_on_very_small_hardware3.html) [#]: author: (Michał Derkacz ) -Go on very small hardware (Part 3) +Go 语言在极小硬件上的运用(三) ====== [![STM32F030F4P6][1]][2] -Most of the examples discussed in the [first][3] and [second][4] part of this series are blinking LEDs in one or another way. It may have been interesting at first, but after a while it has become a bit boring. Let’s do something more entertaining… +在本系列的 [第一][3] 和 [第二][4] 部分中讨论的大多数示例都是以一种或另一种方式闪烁的 LED。起初它可能很有趣,但是一段时间后变得有些无聊。让我们做些更有趣的事情…… -…let’s light more LEDs! +…让我们点亮更多的 LED! ### WS281x LEDs -The [WS281x][5] RGB LEDs (and their clones) are very popular. You can buy them as single elements, chained into long strips or assembled into matrices, rings or other form-factors. +[WS281x][5] RGB LED(及其克隆)非常受欢迎。您可以作为单个元素购买、链成长条或组装成矩阵、环或其他形状因子。 ![WS2812B][6] -They can be connected in series and thanks to this fact, you can control a long LED strip with only single pin of your MCU. Unfortunately, the phisical protocol used by their internal controller doesn’t fit straight into any peripheral you can find in a MCU. You have to use bit-banging or use available peripherals in unusual way. +它们可以串联连接,基于这个事实,您可以只用 MCU 的单个引脚就可以控制一个很长的 LED 灯条。不幸的是,它们的内部控制器使用的物理协议不能直接适用于您在 MCU 中可以找到的任何外围设备。您必须使用 位脉冲bit-banging或以特殊方式使用可用的外设。 -Which of the available solutions is the most efficient depends on the number of LED strips controlled at the same time. If you have to drive 4 to 16 strips the most efficient way is to [use timers and DMA][7] (don’t overlook the links at the end of Martin’s article). +哪种可用的解决方案最有效取决于同时控制的 LED 灯条数量。如果您必须驱动 4 到 16 个条带,那么最有效的方法是 [使用定时器和 DMA][7](请不要忽略 Martin 文章末尾的链接)。 -If you have to control only one or two strips, use the available SPI or UART peripherals. In case of SPI you can encode only two WS281x bits in one byte sent. UART allows more dense coding thanks to clever use of the start and stop bits: 3 bits per one byte sent. +如果只需要控制一个或两个条带,请使用可用的 SPI 或 UART 外设。对于 SPI,您只能在发送的一个字节中编码两个 WS281x 位。由于巧妙地使用了起始位和停止位,UART 允许更密集的编码:每发送一个字节 3 位。 -The best explanation of how the UART protocol fits into WS281x protocol I found on [this site][8]. If you don’t know Polish, here is the [English translation][9]. +我在 [此站点][8] 上找到了有关 UART 协议如何适用于 WS281x 协议的最佳解释。如果您不懂波兰语,这里是 [英文翻译][9]。 -The WS281x based LEDs are still the most popular but there are also SPI controlled LEDs on the market: [APA102][10], [SK9822][11]. Three interesting articles about them: [1][12], [2][13], [3][14]. +基于 WS281x 的 LED 仍然是最受欢迎的,但市场上也有 SPI 控制的 LED:[APA102][10],[SK9822][11]。关于它们的三篇有趣的文章在这里:[1][12],[2][13],[3][14] -### LED ring +### LED 环 -There are many WS2812 based rings on the marker. I have this one: +市场上有许多基于 WS2812 的环。我有一个这样的: ![WS2812B][15] -It has 24 individually addressable RGB LEDs (WS2812B) and exposes four terminals: GND, 5V, DI and DO. You can chain more rings or other WS2812 based things by connecting DI (data in) terminal to the DO (data out) terminal of the previous one. +它具有 24 个可单独寻址的 RGB LED(WS2812B),并暴露出四个端子:GND、5V、DI 和 DO。通过将 DI(数据输入)端子连接到上一个的 DO(数据输出)端子,可以链接更多的环或其他基于 WS2812 的东西。 -Let’s connect this ring to our STM32F030 board. We will use the UART based driver so the DI should be connected to the TXD pin on the UART header. The WS2812B LED requires a power supply with at least 3.5V. 24 LEDs can consume quite a lot of current, so during the programming/debuggin it’s best to connect the GND and 5V terminals on the ring directly to the GND and 5V pins available on ST-LINK programmer: +让我们将这个环连接到我们的 STM32F030 板上。我们将使用基于 UART 的驱动程序,因此 DI 应连接到 UART 接头连接器上的 TXD 引脚。 WS2812B LED 需要至少 3.5V 的电源。 24 个 LED 会消耗大量电流,因此在编程/调试期间,最好将环上的 GND 和 5V 端子直接连接到 ST-LINK 编程器上可用的 GND 和 5V 引脚: ![WS2812B][16] -Our STM32F030F4P6 MCU and the whole STM32 F0, F3, F7, L4 families have one important thing that the F1, F4, L1 MCUs don’t have: it allows to invert the UART signals and therefore we can connect the ring directly to the UART TXD pin. If you don’t known that we need such inversion you probably didn’t read the [article][9] I mentioned above. +我们的 STM32F030F4P6 MCU 和整个 STM32 F0、F3、F7、L4 系列具有 F1、F4、L1 MCU 不具备的一项重要功能:它可以反转 UART 信号,因此我们可以将环直接连接到 UART TXD 引脚。如果您不知道我们需要这种反转,那么您可能没有读过我上面提到的 [文章][9]。 -So you can’t use the popular [Blue Pill][17] or the [STM32F4-DISCOVERY][18] this way. Use their SPI peripheral or an external inverter. See the [Christmas Tree Lights][19] project as an example of UART+inverter or the [WS2812 example][20] for NUCLEO-F411RE that uses SPI. +因此,您不能以这种方式使用流行的 [Blue Pill][17] 或 [STM32F4-DISCOVERY][18]。使用其 SPI 外设或外部反相器。有关使用 SPI 的 NUCLEO-F411RE,请参见 [圣诞树灯][19] 项目作为 UART + 逆变器的示例或 [WS2812示例][20]。 -By the way, probably the most of DISCOVERY boards have one more problem: they work with VDD = 3V instead of 3.3V. The WS281x requires at least the supply voltage * 0.7 for DI high. This is 3.5V in case of 5V supply and 3.3V in case of 4.7V you can find on the 5V pins of the DISCOVERY. As you can see, even in our case the first LED works 0.2V below spec. In case of DISCOVERY it will work 0.3V bellow spec if powered 4.7V and 0.5V bellow spec if powered 5V. -Let’s finish this lengthy introduction and go to the code: +顺便说一下,大多数 DISCOVERY 板可能还有一个问题:它们在 VDD = 3V 而不是 3.3V 的情况下工作。 对于高 DI,WS281x 至少要求电源电压 * 0.7。如果是 5V 电源,则为 3.5V;如果是 4.7V 电源,则为 3.3V;可在 DISCOVERY 的 5V 引脚上找到。如您所见,即使在我们的情况下,第一个 LED 的工作电压也低于规格 0.2V。对于 DISCOVERY 板,如果供电 4.7V,它将工作在低于规格的 0.3V 下;如果供电 5V,它将工作在低于规格 0.5V 下。 + +让我们结束这段冗长的介绍并转到代码: ``` package main @@ -133,45 +134,45 @@ var ISRs = [...]func(){ } ``` -##### The import section +##### 导入部分 -The new things in the import section compared to the previous examples are the rand/math package and led package with its led/ws281x subtree. The led package itself contains definition of Color type. The led/ws281x/wsuart defines the ColorOrder, Pixel and Strip types. +与前面的示例相比,导入部分中的新内容是 `rand/math` 包和带有 `led/ws281x` 子树的 led 包。 led 包本身包含 `Color` 类型的定义。 `led/ws281x/wsuart` 定义了 `ColorOrder`、`Pixel` 和 `Strip` 类型。 -I was wondering about using the Color or RGBA type from image/color and about defining the Strip in the way that it will implement image.Image interface but because of using a [gamma correction][21] and the big overhead of image/draw package I ended with simple: +我想知道如何使用 `image/color` 中的 `Color` 或 `RGBA` 类型,以及如何以它将实现 `image.Image` 接口的方式定义 `Strip`。 但是由于使用了 [gamma 校正][21] 和 大开销的 `color/draw` 包,我以简单的方式结束: ``` type Color uint32 type Strip []Pixel ``` -with a few useful methods. However, this can change in the future. +使用一些有用的方法。然而,这种情况在未来可能会改变。 -##### The init function +##### init 函数 -There aren’t so much novelties in the init function. The UART baud rate was changed from 115200 to 3000000000/1390 ≈ 2158273 which corresponds to 1390 nanoseconds per WS2812 bit. The TxInv bit in CR2 register is set to invert TXD signal. +`init` 函数没有太多新颖之处。 UART 波特率从 115200 更改为 3000000000/1390 ≈ 2158273,相当于每个 WS2812 位 1390 纳秒。 CR2 寄存器中的 TxInv 位设置为反转 TXD 信号。 -##### The main function +##### main 函数 -The XorShift64 pseudorandom number generator is used to generate random colors. [XORSHIFT][22] is currently the only algorithm implemented by math/rand package. You have to explicitly initialize it using its Seed method with nonzero argument. +`XorShift64` 伪随机数生成器用于生成随机颜色。 [XORSHIFT][22] 是目前由 `math/rand` 包实现的唯一算法。您必须使用带有非零参数的 `Seed` 方法显式初始化它。 -The rgb variable is of type wsuart.ColorOrder and is set to the GRB color order used by WS2812 (WS2811 uses RGB order). It’s then used to translate colors to pixels. +`rgb` 变量的类型为 `wsuart.ColorOrder`,并设置为 WS2812 使用的 GRB 颜色顺序(WS2811 使用 RGB 顺序)。然后用于将颜色转换为像素。 -The `wsuart.Make(24)` creates initialized strip of 24 pixels. It is equivalent of: +`wsuart.Make(24)` 创建 24 像素的初始化条带。它等效于: ``` strip := make(wsuart.Strip, 24) strip.Clear() ``` -The rest of the code uses random colors to draw something similar to “Please Wait…” spinner. +其余代码使用随机颜色绘制类似于 “Please Wait…” 微调器的内容。 -The strip slice acts as a framebuffer. The `tts.Write(strip.Bytes())` sends the content of the framebuffer to the ring. +条带切片充当帧缓冲区。 `tts.Write(strip.Bytes()` 将帧缓冲区的内容发送到环。 -##### Interrupts +##### 中断 -The program is ened with the code that handles interrupts, the same as in the previous [UART example][23]. +该程序由处理中断的代码组成,与先前的 [UART 示例][23] 中的代码相同。 -Let’s compile it and run: +让我们编译并运行: ``` $ egc @@ -181,25 +182,29 @@ $ arm-none-eabi-size cortexm0.elf $ openocd -d0 -f interface/stlink.cfg -f target/stm32f0x.cfg -c 'init; program cortexm0.elf; reset run; exit' ``` -I’ve skipped the openocd output. The video bellow shows how this program works: +我跳过了 openocd 输出。下面的视频显示了该程序的工作原理: -Sorry, your browser doesn't support embedded videos. +原文中插入视频的代码: + -### Let’s do something useful… +### 让我们做些有用的事情... -At the beginning of the [first part][3] I’ve asked: “How low we can Go and still do something useful?”. Our MCU is actually a low-end device (8-bitters will probably disagree with me) but we haven’t done anything useful so far. +在 [第一部分][3] 的开头,我曾问过:“我们能降到多低,还能做一些有用的事情?”。 我们的 MCU 实际上是一种低端设备(8 比特的人可能会不同意我的看法),但到目前为止,我们还没有做任何有用的事情。 -So… Let’s do something useful… Let’s make a Clock! +所以... 让我们做些有用的事情... 让我们做个时钟! -There are many examples of clocks built of RGB LEDs on the Internet. Let’s make our own using our little board and RGB ring. We change the previous code as described below. +在互联网上有许多由 RGB LED 构成的时钟示例。让我们用小板子和 RGB 环制作自己的时钟。我们按照下面的描述更改先前的代码。 -##### The import section +##### 导入部分 -Remove the math/rand package and add stm32/hal/exti. +删除 `math/rand` 包,然后添加 `stm32/hal/exti`。 -##### Global variables +##### 全局变量 -Add two new global variables: btn and btnev: +添加两个新的全局变量:`btn` 和 `btnev`: ``` var ( @@ -209,11 +214,11 @@ var ( ) ``` -They will be used to handle the “button” that will be used to set our clock. Our board has no button except reset, but somehow we can manage without it. +它们将用来处理那些用于设置时钟的 “button”。我们的板子除了重置之外没有其他按钮,但是如果没有它,我们仍然可以通过某种方式进行管理。 -##### The init function +##### init 函数 -Add this code to the init function: +将这段代码添加到 `init` 函数: ``` btn = gpio.A.Pin(4) @@ -228,13 +233,13 @@ ei.EnableIRQ() rtos.IRQ(irq.EXTI4_15).Enable() ``` -The PA4 pin is configured as input with the internal pull-up resistor enabled. It’s connected to the onboard LED but that doesn’t hinder anything. More important is that it’s located next to the GND pin so we can use any metal object to simulate the button and set the clock. As a bonus we have additional feedback from the onboard LED. +在内部上拉电阻pull-up resistor启用的情况下,将 PA4 引脚配置为输入。它已连接至板载 LED,但这不会妨碍任何事情。更重要的是它位于 GND 引脚旁边,所以我们可以使用任何金属物体来模拟按钮并设置时钟。作为奖励,我们还有来自板载 LED 的其他反馈。 -We use the EXTI peripheral to track the PA4 state. It’s configured to generate an interrupt on any change. +我们使用 EXTI 外设来跟踪 PA4 状态。它被配置为在发生任何更改时都会产生中断。 -##### The btnWait function +##### btnWait 函数 -Define a new auxiliary function: +定义一个新的辅助功能: ``` func btnWait(state int, deadline int64) bool { @@ -249,7 +254,7 @@ func btnWait(state int, deadline int64) bool { } ``` -It waits for the specified state on the “button” pin, but only until the deadline occurs. This is slightly improved polling code: +它等待 “button” 引脚上的指定状态,但只等到最后期限出现。这是稍微改进的轮询代码: ``` for btn.Load() != state { @@ -259,11 +264,11 @@ for btn.Load() != state { } ``` -Our btnWait function, instead of busy waiting for state or deadline, uses the btnev variable of type rtos.EventFlag to sleep until something will happen. You can of course use a channel instead of rtos.EventFlag but the latter one is much cheaper. +我们的 `btnWait` 函数不是忙于等待状态或截止日期,而是使用 `rtos.EventFlag` 类型的 `btnev` 变量休眠,直到有事情发生。您当然可以使用通道而不是 `rtos.EventFlag`,但是后者便宜得多。 -##### The main function +##### main 函数 -We need completly new main function: +我们需要全新的 `main` 函数: ``` func main() { @@ -326,25 +331,25 @@ func main() { } ``` -We use the rtos.Nanosec function instead of time.Now to obtain the current time. This saves much of Flash but also reduces our clock to antique device that has no idea about days, months and years and worst of all it doesn’t handle daylight saving changes. +我们使用 `rtos.Nanosec` 函数代替 `time.Now` 来获取当前时间。这样可以节省大量的 Flash,但也使我们的时钟变成了不知道日、月、年的老式设备,最糟糕的是它无法处理夏令时的变化。 -Our ring has 24 LEDs, so the second hand can be presented with the accuracy of 2.5s. To don’t sacrifice this accuracy and get smooth operation we use quarter-second as base interval. Half-second would be enough but quarter-second is more accurate and works also well with 16 and 48 LEDs. +我们的环有 24 个 LED,因此秒针的显示精度可以达到 2.5 秒。为了不牺牲这种精度并获得流畅的运行效果,我们使用 1/4 秒作为基准间隔。半秒就足够了,但四分之一秒更准确,而且与 16 和 48 个 LED 配合使用也很好。 -The red, green and blue colors are used respectively for hour, minute and second hands. This allows us to use simple logical or operation for color blending. We have the Color.Blend method that can blend arbitrary colors but we’re low of Flash so we prefer simplest possible solution. +红色、绿色和蓝色分别用于时针、分针和秒针。这允许我们使用简单的 `逻辑或操作` 进行颜色混合。我们 `Color.Blend` 方法可以混合任意颜色,但是我们缺少 Flash,所以我们选择最简单的解决方案。 -We redraw the clock only when the second hand moved. The: +我们只有在秒针移动时才重画时钟。 ``` btnWait(0, int64(qs+ds)*25e7) ``` -is waiting for exactly that moment or for the press of the button. +上面的这行代码等待的正是那一刻,或者是按钮的按下。 -Every press of the button adjust the clock forward. There is an acceleration when the button is held down for some time. +每按一下按钮就会把时钟向前调一调。按住按钮一段时间会产生加速度。 -##### Interrupts +##### 中断 -Define new interrupt handler: +定义新的中断处理程序: ``` func exti4_15ISR() { @@ -356,13 +361,14 @@ func exti4_15ISR() { } ``` -and add `irq.EXTI4_15: exti4_15ISR,` entry to the ISRs array. +并将 `irq.EXTI4_15: exti4_15ISR` 条目添加到 ISR 数组。 -This handler (or Interrupt Service Routine) handles EXTI4_15 IRQ. The Cortex-M0 CPU supports significantly fewer IRQs than its bigger brothers, so you can often see that one IRQ is shared by multiple interrupt sources. In our case one IRQ is shared by 12 EXTI lines. +该处理程序(或中断服务程序)处理 EXTI4_15 IRQ。 Cortex-M0 CPU 支持的 IRQ 明显少于其较大的同类兄弟处理器,因此您经常可以看到一个 IRQ 被多个中断源共享。在我们的例子中,一个 IRQ 由 12 个 EXTI 线共享。 -The exti4_15ISR reads all pending bits and selects 12 more significant of them. Next it clears the seleced bits in EXTI and starts to handle them. In our case only bit 4 is checked. The `btnev.Signal(1)` causes that the `btnev.Wait(1, deadline)` wakes up and returns true. +exti4_15ISR 读取所有挂起的位,并从中选择 12 个更高的有效位。接下来,它清除 EXTI 中选中的位并开始处理它们。在我们的例子中,仅检查第 4 位。 `btnev.Signal(1)` 引发 `btnev.Wait(1, deadline)` 唤醒并返回 true。 -You can find the complete code on [Github][24]. Let’s compile it: + +您可以在 [Github][24] 上找到完整的代码。让我们来编译它: ``` $ egc @@ -371,7 +377,7 @@ $ arm-none-eabi-size cortexm0.elf 15960 240 216 16416 4020 cortexm0.elf ``` -There are only 184 bytes for any iprovements. Let’s rebuild everything one more time but this time without any type and field names in typeinfo: +这里所有的改进只有 184 个字节。让我们再次重新构建所有内容,但这次在 typeinfo 中不使用任何类型和字段名: ``` $ cd $HOME/emgo @@ -383,13 +389,17 @@ $ arm-none-eabi-size cortexm0.elf 15120 240 216 15576 3cd8 cortexm0.elf ``` -Now, with a kilobyte of free space you can improve something. Let’s see how it works: +现在,有了千字节的空闲空间,您可以改进一些东西。让我们看看它是如何工作的: -Sorry, your browser doesn't support embedded videos. +原文中插入视频的代码: + -I don’t know how I managed to hit exactly 3:00 !? +我不知道我是怎么精确打到 3:00 的!? -That’s all Folks! In the part 4 (ending this series) we’ll try to display something on a LCD. +以上就是所有内容!在第 4 部分(本系列的结束)中,我们将尝试在 LCD 上显示一些内容。 -------------------------------------------------------------------------------- @@ -397,7 +407,7 @@ via: https://ziutek.github.io/2018/05/03/go_on_very_small_hardware3.html 作者:[-;Michał Derkacz][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[gxlct008](https://github.com/gxlct008) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From f89cda5bdaf3fdea5abf06f3b3bebcddfceb6062 Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Mon, 19 Oct 2020 22:21:33 +0800 Subject: [PATCH 0507/1156] =?UTF-8?q?=E5=B0=86=E8=AF=91=E6=96=87=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E5=88=B0=20translated/tech/=20=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20180503 Go on very small hardware (Part 3).md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20180503 Go on very small hardware (Part 3).md (100%) diff --git a/sources/tech/20180503 Go on very small hardware (Part 3).md b/translated/tech/20180503 Go on very small hardware (Part 3).md similarity index 100% rename from sources/tech/20180503 Go on very small hardware (Part 3).md rename to translated/tech/20180503 Go on very small hardware (Part 3).md From 173af626477a6a8c0ee9851f231acf27c43130d8 Mon Sep 17 00:00:00 2001 From: XianLei Gao <279483350@qq.com> Date: Mon, 19 Oct 2020 22:31:59 +0800 Subject: [PATCH 0508/1156] =?UTF-8?q?=E7=94=B3=E9=A2=86=E5=8E=9F=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20160302 Go channels are bad and you should feel bad.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20160302 Go channels are bad and you should feel bad.md b/sources/tech/20160302 Go channels are bad and you should feel bad.md index 0ad2a5ed97..78e440c9ea 100644 --- a/sources/tech/20160302 Go channels are bad and you should feel bad.md +++ b/sources/tech/20160302 Go channels are bad and you should feel bad.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (gxlct008) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 0e8bbb14246329cd2dfc589ef9067b578fe16fe5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 20 Oct 2020 08:04:13 +0800 Subject: [PATCH 0509/1156] TSL --- ...n Source Software)- What is Open Source.md | 133 ------------------ ...n Source Software)- What is Open Source.md | 129 +++++++++++++++++ 2 files changed, 129 insertions(+), 133 deletions(-) delete mode 100644 sources/talk/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md create mode 100644 translated/talk/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md diff --git a/sources/talk/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md b/sources/talk/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md deleted file mode 100644 index 7a84ea9d21..0000000000 --- a/sources/talk/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md +++ /dev/null @@ -1,133 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Linux Jargon Buster: What is FOSS (Free and Open Source Software)? What is Open Source?) -[#]: via: (https://itsfoss.com/what-is-foss/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -Linux Jargon Buster: What is FOSS (Free and Open Source Software)? What is Open Source? -====== - -What does FOSS in It’s FOSS mean? What is FOSS? - -I have been asked this question numerous time in the past. It was about time that I explained what is FOSS in Linux and the software world. - -The distinction is important because FOSS is a generic world and it could mean different depending on the context. Here, I am discussing the FOSS principle in software. - -### What is FOSS? - -FOSS means Free and Open Source Software. It doesn’t mean software is free of cost. It means that source code of the software is open for all and anyone is free to use, study and modify the code. This principle allows other people to contribute to the development and improvement of a software like a community. - -#### The origin of FOSS - -In the 60s and 70s, computers were hardware focused and the hardware were expensive. They were mainly used by academics in universities or researchers in labs. The limited amount of software used to come for free or with their source code and the users were allowed to modify the source code to suit their need. - -In the late 70s and early 80s, the manufacturer’s stopped distributing source code in an attempt to not let their software run on their competitor’s computers. - -This restrictive licensing led to the inconvenience and dislike of peoplewho were used to and fond of modifying software. In the mid 80s, Richard Stallman started the Free Software Movement. - -[Stallman specified four essential fundamental freedom][1] for a software to be Free and Open Source Software. - -![Free Software Freedoms][2] - -I am rephrasing them for easier understanding: - - * Any user should be able to run the software for any purpose. - * User should be free to see the source code of the software and if need be, user should be allowed to modify the code as well. - * User should be free to distribute the copies of the software to others. - * If a user modified the code, she/he should be free to distribute the modified code to others. The modified code must have the source code open. - - - -If interested, I would advise reading this article on the [history of FOSS][3]. - -### Free in Free and Open Source Software DOES NOT mean free of cost - -![][4] - -As you may have noticed, the ‘free’ in Free and Open Source Software doesn’t mean it is free of cost. It means freedom to run, modify and distribute the software. - -People often wrongly think that FOSS or Open Source software cannot have a price tag. This is not correct. - -Most Free and Open Source Software are available free of cost because of a number of reasons: - - * The source code is already available to public so some developers see no point in putting a price tag on the downloads. - * Some projects are contributed by a number of volunteers for free. So, the main developer(s) find it unethical to charge for something that has been contributed freely by so many people. - * Some projects are supported and/or developed by bigger corporate or non-profit organizations who employ developers to work on their open source projects. - * Some developers create open source projects as hobby or out of their passion for contributing to the world with their code. Things like number of downloads, contributions and words of appreciations matter more than money for them. - - - -To avoid the emphasis on ‘free’ some people use the term FLOSS. FLOSS stands for Free and Libre Open Source Software. The world libre (meaning freedom) is different than gartuit/gratis (free of cost). - -> Free as in free speech, not free as in free beer. - -### How do FOSS projects make money? - -It is a myth that open source projects don’t make money. Red Hat was the first open source company to reach the billion dollars mark. [IBM bought Red Hat for $34 billion][5]. There are many such examples. - -Many open source projects, specially the ones in the enterprise sectors, offer support and enterprise oriented features for a fee. This is main business model for Red Hat, SUSE Linux and more such projects. - -Some open source projects like Discourse, WordPress offer hosted instance of their software for a premium fee. - -Many open source projects, specially the desktop applications, rely on donations. VLC, GIMP, Inkscape and other such open source software fell in this category. There are [ways to fund open-source programs][6] but usually, you’ll find donation links on project websites. - -Making money with open source software may be difficult but it is not entirely impossible. - -### But I am not a programmer. Why should I care if a software is open source or not? - -This is a valid question. You are not a software developer, just a regular computer user. Even if the source code of the software is available, you won’t understand how the program works. - -That’s fine. You won’t understand it but someone with the necessary skill sets will and that’s what matter. - -Think of this way. Perhaps you won’t understand a complicated legal document. But if you have the freedom to look at the document and keep a copy of it, you can consult someone who can check the document for legal pitfalls. - -In other words, open source software has transparency. - -### What is the difference between FOSS and Open Source? - -![][7] - -You’ll often come across terms FOSS and open source. They are often used interchangeably. - -Are they the same thing? It is difficult to answer in yes and no. - -You see, the term ‘free’ in FOSS is confusing for many as people incorrectly assume that it as free of cost. Enterprise executives, higher ups and decision makers tend to focus on ‘free’ in Free and Open Source. Since they are business people focused on making money for their company, the term ‘free’ works as deterrence in adopting the FOSS principles. - -This is why a new organization named [Open Source Initiative][8] was created in the mid 90s. They removed the ‘Free’ from Free and Open Source Software and created their own [definition of open source][9]. and their own set of licenses. - -The term ‘open source’ got quite popular specially in the software industry. The executives are more comfortable with Open Source. The adoption of open source grew rapidly and I believe removal of ‘free’ term did play a role here. - -**Got questions?** - -This As I explained in the article [what is Linux Distribution][10], the FOSS/open source concept played a big role in the development and popularity of Linux. - -I tried to explain the concept of FOSS and open source in simpler terms in this jargon buster article. I have tried to avoid going too much in detail or technical accuracies. - -I do hope you have a better understanding of this topic now. If you have got questions or suggestions, feel free to leave a comment and continue the discussion there. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/what-is-foss/ - -作者:[Abhishek Prakash][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/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://www.gnu.org/philosophy/free-sw.html -[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/foss-freedoms.jpg?resize=800%2C671&ssl=1 -[3]: https://itsfoss.com/history-of-foss/ -[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/think-free-speech-not-free-beer.jpg?resize=800%2C800&ssl=1 -[5]: https://itsfoss.com/ibm-red-hat-acquisition/ -[6]: https://itsfoss.com/open-source-funding-platforms/ -[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/what-is-foss.png?resize=800%2C450&ssl=1 -[8]: https://opensource.org/ -[9]: https://opensource.org/osd -[10]: https://itsfoss.com/what-is-linux-distribution/ diff --git a/translated/talk/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md b/translated/talk/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md new file mode 100644 index 0000000000..5edf47a6a4 --- /dev/null +++ b/translated/talk/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md @@ -0,0 +1,129 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux Jargon Buster: What is FOSS \(Free and Open Source Software\)? What is Open Source?) +[#]: via: (https://itsfoss.com/what-is-foss/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Linux 黑话解释:什么是 FOSS(自由和开源软件)?什么是开源? +====== + +![][7] + +什么是 FOSS? + +在过去,我曾多次被问到这个问题,现在是时候解释一下什么是 Linux 和软件世界中的 FOSS 了。 + +这个区别很重要,因为 FOSS 是一个通用的词汇,它可以根据上下文的不同而有不同的含义。在这里,我讨论的是软件中的 FOSS 原则。 + +### 什么是 FOSS? + +FOSS 是指自由和开放源码软件Free and Open Source Software。这并不意味着软件是免费的。它意味着软件的源代码是开放的,任何人都可以自由使用、研究和修改代码。这个原则允许人们像一个社区一样为软件的开发和改进做出贡献。 + +#### FOSS 的起源 + +在上世纪 60、70 年代,计算机以硬件为主,硬件价格昂贵。它们主要由大学的学者或实验室的研究人员使用。以前有限的软件都是免费的,或者是带有它们的源代码,用户可以根据自己的需要修改源代码。 + +在上世纪 70 年代末和 80 年代初,制造商为了不让自己的软件在竞争对手的计算机上运行,停止了分发源代码。 + +这种限制性的许可导致了那些习惯和喜欢修改软件的人的不便和不喜。上世纪 80 年代中期,Richard Stallman 发起了自由软件运动Free Software Movement。 + +[Stallman 指明了一个软件要成为 FOSS 的四个基本自由][1]。 + +![自由软件自由][2] + +为了便于理解,我将它们重新表述: + + * 任何用户应能为任何目的运行软件。 + * 用户应能自由查看软件的源代码,如有需要,应允许用户修改代码。 + * 用户应能自由地将软件的副本分发给他人。 + * 如果用户修改了代码,她/他应该可以自由地将修改后的代码发布给他人。修改后的代码必须开放源代码。 + +如果有兴趣,我建议阅读这篇关于 [FOSS 的历史][3]的文章。 + +### FOSS 中的 “Free” 并不意味着免费 + +![][4] + +你可能已经注意到了,自由和开源软件中的 “Free” 并不意味着它是免费的,它意味着运行、修改和分发软件的自由。 + +人们经常错误地认为,FOSS 或开源软件不能有价格标签。这是不正确的。 + +大多数 FOSS 都是免费提供的,原因有很多: + + * 源代码已经向公众开放,所以一些开发者认为没有必要在下载上贴上价格标签。 + * 有些项目是由一些志愿者免费提供的。因此,主要的开发者认为对这么多人免费贡献的东西收费是不道德的。 + * 有些项目是由较大的企业或非营利组织支持和/或开发的,这些组织会雇佣开发人员在他们的开源项目上工作。 + * 有些开发者创建开源项目是出于兴趣,或者出于他们对用代码为世界做贡献的热情。对他们来说,下载量、贡献和感谢的话比金钱更重要。 + +为了避免强调 “免费”,有些人使用了 FLOSS 这个词。FLOSS 是自由和开源软件Free/Libre Open Source Software的缩写。单词 Libre(意为自由)与 gartuit/gratis(免费)不同。 + +> “Free”是言论自由的自由,而不是如免费啤酒的免费。 + +### FOSS 项目如何赚钱? + +开源项目不赚钱是一个神话。红帽是第一个达到 10 亿美元大关的开源公司。[IBM 以 340 亿美元收购了红帽][5]。这样的例子有很多。 + +许多开源项目,特别是企业领域的项目,都会提供收费的支持和面向企业的功能。这是R红帽、SUSE Linux 和更多此类项目的主要商业模式。 + +一些开源项目,如 Discourse、WordPress 等,则提供其软件的托管实例,并收取一定的费用。 + +许多开源项目,特别是桌面应用程序,依靠捐赠。VLC、GIMP、Inkscape 等这类开源软件就属于这一类。有[资助开源项目的方法][6],但通常,你会在项目网站上找到捐赠链接。 + +利用开源软件赚钱可能很难,但也不是完全不可能。 + +### 但我不是程序员,我为什么要关心一个软件是否开源? + +这是一个合理的问题。你不是一个软件开发者,只是一个普通的计算机用户。即使软件的源代码是可用的,你也不会理解程序的工作原理。 + +这很好。你不会明白,但有必要技能的人就会明白,这才是最重要的。 + +你可以这样想。也许你不会理解一份复杂的法律文件。但如果你有看文件的自由,并保留一份副本,你就可以咨询某个人,他可以检查文件中的法律陷阱。 + +换句话说,开源软件具有透明度。 + +### FOSS 与开源之间的区别是什么? + +你会经常遇到 FOSS 和开源的术语。它们经常被互换使用。 + +它们是同一件事吗?这很难用“是”和“不是”来回答。 + +你看,FOSS 中的“Free”一词让很多人感到困惑,因为人们错误地认为它是免费的。企业高管、高层和决策者往往会关注自由和开源中的“免费”。由于他们是商业人士,专注于为他们的公司赚钱,“自由”一词在采用 FOSS 原则时起到了威慑作用。 + +这就是为什么在上世纪 90 年代中期创建出了一个名为[开源促进会][8]Open Source Initiative的新组织。他们从自由和开放源码软件中去掉了“自由”一词,并创建了自己的[开放源码的定义][9],以及自己的一套许可证。 + +“开源Open Source”一词在软件行业特别流行。高管们对开源更加适应。开源软件的采用迅速增长,我相信 “免费”一词的删除确实起到了作用。 + +### 有问题吗? + +这正如我在[什么是 Linux 发行版][10]一文中所解释的那样,FOSS/开源的概念在 Linux 的发展和普及中起到了很大的作用。 + +我试图在这篇黑话解释文章中用更简单的语言解释 FOSS 和开源的概念,而试图避免在细节或技术精度上做过多的阐述。 + +我希望你现在对这个话题有了更好的理解。如果你有问题或建议,欢迎留言并继续讨论。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/what-is-foss/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.gnu.org/philosophy/free-sw.html +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/foss-freedoms.jpg?resize=800%2C671&ssl=1 +[3]: https://itsfoss.com/history-of-foss/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/think-free-speech-not-free-beer.jpg?resize=800%2C800&ssl=1 +[5]: https://itsfoss.com/ibm-red-hat-acquisition/ +[6]: https://itsfoss.com/open-source-funding-platforms/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/what-is-foss.png?resize=800%2C450&ssl=1 +[8]: https://opensource.org/ +[9]: https://opensource.org/osd +[10]: https://itsfoss.com/what-is-linux-distribution/ From bf79689271e088488f344d1b0cb79d2031945a73 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 20 Oct 2020 08:44:07 +0800 Subject: [PATCH 0510/1156] translating --- ...s to Download Files From Linux Terminal.md | 192 ------------------ ...s to Download Files From Linux Terminal.md | 192 ++++++++++++++++++ 2 files changed, 192 insertions(+), 192 deletions(-) delete mode 100644 sources/tech/20201014 2 Ways to Download Files From Linux Terminal.md create mode 100644 translated/tech/20201014 2 Ways to Download Files From Linux Terminal.md diff --git a/sources/tech/20201014 2 Ways to Download Files From Linux Terminal.md b/sources/tech/20201014 2 Ways to Download Files From Linux Terminal.md deleted file mode 100644 index a0e8d81210..0000000000 --- a/sources/tech/20201014 2 Ways to Download Files From Linux Terminal.md +++ /dev/null @@ -1,192 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (2 Ways to Download Files From Linux Terminal) -[#]: via: (https://itsfoss.com/download-files-from-linux-terminal/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -2 Ways to Download Files From Linux Terminal -====== - -If you are stuck to the Linux terminal, say on a server, how do you download a file from the terminal? - -There is no download command in Linux but there are a couple of Linux commands for downloading file. - -In this terminal trick, you’ll learn two ways to download file using command line in Linux. - -I am using Ubuntu here but apart from the installation, rest of the commands are equally valid for all other Linux distributions. - -### Download files from Linux terminal using wget command - -![][1] - -[wget][2] is perhaps the most used command line download manager for Linux and UNIX-like systems. You can download a single file, multiple files, entire directory or even an entire website using wget. - -wget is non-interactive and can easily work in the background. This means you can easily use it in scripts or even build tools like [uGet download manager][3]. - -Let’s see how to use wget to download file from terminal. - -#### Installing wget - -Most Linux distributions come with wget preinstalled. It is also available in the repository of most distributions and you can easily install it using your distribution’s package manager. - -On Ubuntu and Debian based distribution, you can use the [apt package manager][4] command: - -``` -sudo apt install wget -``` - -#### Download a file or webpage using wget - -You just need to provide the URL of the file or webpage. It will download the file with its original name in the directory you are in. - -``` -wget URL -``` - -![][5] - -To download multiple files, you’ll have to save their URLs in a text file and provide that text file as input to wget like this: - -``` -wget -i download_files.txt -``` - -#### Download files with a different name using wget - -You’ll notice that a webpage is almost always saved as index.html with wget. It will be a good idea to provide custom name to downloaded file. - -You can use the -O (uppercase O) option to provide the output filename while downloading. - -``` -wget -O filename URL -``` - -![][6] - -#### Download a folder using wget - -Suppose you are browsing an FTP server and you need to download an entire directory, you can use the recursive option - -``` -wget -r ftp://server-address.com/directory -``` - -#### Download an entire website using wget - -Yes, you can totally do that. You can mirror an entire website with wget. By downloading an entire website I mean the entire public facing website structure. - -While you can use the mirror option -m directly, it will be a good idea add: - - * –convert-links : links are converted so that internal links are pointed to downloaded resource instead of web - * –page-requisites: downloads additional things like style sheets so that the pages look better offline - - - -``` -wget -m --convert-links --page-requisites website_address -``` - -![][7] - -#### Bonus Tip: Resume incomplete downloads - -If you aborted the download by pressing C for some reasons, you can resume the previous download with option -c. - -``` -wget -c -``` - -### Download files from Linux command line using curl - -Like wget, [curl][8] is also one of the most popular commands to download files in Linux terminal. There are so many ways to [use curl extensively][9] but I’ll focus on only the simple downloading here. - -#### Installing curl - -Though curl doesn’t come preinstalled, it is available in the official repositories of most distributions. You can use your distribution’s package manager to install it. - -To [install curl on Ubuntu][10] and other Debian based distributions, use the following command: - -``` -sudo apt install curl -``` - -#### Download files or webpage using curl - -If you use curl without any option with a URL, it will read the file and print it on the terminal screen. - -To download a file using curl command in Linux terminal, you’ll have to use the -O (uppercase O) option: - -``` -curl -O URL -``` - -![][11] - -It is simpler to download multiple files in Linux with curl. You just have to specify multiple URLs: - -``` -curl -O URL1 URL2 URL3 -``` - -Keep in mind that curl is not as simple as wget. While wget saves webpages as index.html, curl will complain of remote file not having a name for webpages. You’ll have to save it with a custom name as described in the next section. - -#### Download files with a different name - -It could be confusing but to provide a custom name for the downloaded file (instead of the original source name), you’ll have to use -o (lowercase O) option: - -``` -curl -o filename URL -``` - -![][12] - -Some times, curl wouldn’t just download the file as you expect it to. You’ll have to use option -L (for location) to download it correctly. This is because some times the links redirect to some other link and with option -L, it follows the final link. - -#### Pause and resume download with curl - -Like wget, you can also resume a paused download using curl with option -c: - -``` -curl -c URL -``` - -**Conclusion** - -As always, there are multiple ways to do the same thing in Linux. Downloading files from the terminal is no different. - -wget and curl are just two of the most popular commands for downloading files in Linux. There are more such command line tools. Terminal based web-browsers like [elinks][13], [w3m][14] etc can also be used for downloading files in command line. - -Personally, for a simple download, I prefer using wget over curl. It is simpler and less confusing because you may have a difficult time figuring out why curl could not download a file in the expected format. - -Your feedback and suggestions are welcome. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/download-files-from-linux-terminal/ - -作者:[Abhishek Prakash][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/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/Download-Files-from-Linux-terminal.png?resize=800%2C450&ssl=1 -[2]: https://www.gnu.org/software/wget/ -[3]: https://itsfoss.com/install-latest-uget-ubuntu-linux-mint/ -[4]: https://itsfoss.com/apt-command-guide/ -[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/download-file-in-linux-terminal-using-wget.png?resize=795%2C418&ssl=1 -[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/download-file-in-linux-terminal-using-wget-2.png?resize=795%2C418&ssl=1 -[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/download-entire-website-using-wget.png?resize=795%2C418&ssl=1 -[8]: https://curl.haxx.se/ -[9]: https://linuxhandbook.com/curl-command-examples/ -[10]: https://itsfoss.com/install-curl-ubuntu/ -[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/download-files-in-linux-using-curl.png?resize=795%2C418&ssl=1 -[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/download-files-in-linux-using-curl-1.png?resize=795%2C418&ssl=1 -[13]: http://elinks.or.cz/ -[14]: http://w3m.sourceforge.net/ diff --git a/translated/tech/20201014 2 Ways to Download Files From Linux Terminal.md b/translated/tech/20201014 2 Ways to Download Files From Linux Terminal.md new file mode 100644 index 0000000000..d1a300bcb1 --- /dev/null +++ b/translated/tech/20201014 2 Ways to Download Files From Linux Terminal.md @@ -0,0 +1,192 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (2 Ways to Download Files From Linux Terminal) +[#]: via: (https://itsfoss.com/download-files-from-linux-terminal/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +2 种从 Linux 终端下载文件的方法 +====== + +如果你被困在 Linux 终端,比如说在服务器上,如何从终端下载文件? + +在 Linux 中是没有下载命令的,但是有几个 Linux 命令可用于下载文件。 + +在这篇终端技巧中,你将学习两种在 Linux 中使用命令行下载文件的方法。 + +我在这里使用的是 Ubuntu,但除了安装,其余的命令同样适用于所有其他 Linux 发行版。 + +### 使用 wget 命令从 Linux 终端下载文件 + +![][1] + +[wget][2] 也许是 Linux 和类 UNIX 系统中使用最多的命令行下载管理器。你可以使用 wget 下载一个文件、多个文件、整个目录甚至整个网站。 + +wget 是非交互式的,可以轻松地在后台工作。这意味着你可以很容易地在脚本中使用它,甚至构建像 [uGet 下载管理器][3]这样的工具。 + +让我们看看如何使用 wget 从终端下载文件。 + +#### 安装 wget + +大多数 Linux 发行版都预装了 wget。它也可以在大多数发行版的仓库中找到,你可以使用发行版的包管理器轻松安装它。 + +在基于 Ubuntu 和 Debian 的发行版上,你可以使用 [apt 包管理器][4]命令: + +``` +sudo apt install wget +``` + +#### 使用 wget 下载文件或网页 + +你只需要提供文件或网页的 URL。它将在你所在的目录下以原始名下载该文件。 + +``` +wget URL +``` + +![][5] + +要下载多个文件,你必须将它们的 URL 保存在一个文本文件中,并将该文件作为输入提供给 wget,就像这样: + +``` +wget -i download_files.txt +``` + +#### 用 wget 下载不同名字的文件 + +你会注意到,一个网页在 wget 中几乎总是以 index.html 的形式保存。为下载的文件提供自定义名称是个好主意。 + +你可以在下载时使用 -O (大写字母 O) 选项来提供输出文件名。 + +``` +wget -O filename URL +``` + +![][6] + +#### 用 wget 下载一个文件夹 + +假设你正在浏览一个 FTP 服务器,你需要下载整个目录,你可以使用递归选项: + +``` +wget -r ftp://server-address.com/directory +``` + +#### 使用 wget 下载整个网站 + +是的,你完全可以做到这一点。你可以用 wget 镜像整个网站。我说的下载整个网站是指整个面向公众的网站结构。 + +虽然你可以直接使用镜像选项 -m,但最好加上: + + * –convert-links :链接将被转换,使内部链接指向下载的资源,而不是网站。 + * –page-requisites:下载额外的东西,如样式表,使页面在离线状态下看起来更好。 + + + +``` +wget -m --convert-links --page-requisites website_address +``` + +![][7] + +#### 额外提示:恢复未完成的下载 + +如果你因为某些原因按 C 键中止了下载,你可以用选项 -c 恢复之前的下载: + +``` +wget -c +``` + +### 使用 curl 在 Linux 命令行中下载文件 + +和 wget 一样,[curl][8] 也是 Linux 终端中最常用的下载文件的命令之一。[使用 curl][9] 的方法有很多,但我在这里只关注简单的下载。 + +#### 安装 curl + +虽然 curl 并不是预装的,但在大多数发行版的官方仓库中都有。你可以使用你的发行版的包管理器来安装它。 + +要[在 Ubuntu][10] 和其他基于 Debian 的发行版上安装 curl,请使用以下命令: + +``` +sudo apt install curl +``` + +#### 使用 curl 下载文件或网页 + +如果你在使用 curl 命令时没有在 URL 中带任何选项,它就会读取文件并打印在终端上。 + +要在 Linux 终端中使用 curl 命令下载文件,你必须使用 -O(大写字母 O)选项: + +``` +curl -O URL +``` + +![][11] + +在 Linux 中,用 curl 下载多个文件是比较简单的。你只需要指定多个 URL 即可: + +``` +curl -O URL1 URL2 URL3 +``` + +请记住,curl 不像 wget 那么简单。当 wget 将网页保存为 index.html 时,curl 会抱怨远程文件没有网页的名字。你必须按照下一节的描述用一个自定义的名字来保存它。 + +#### 用不同的名字下载文件 + +这可能会让人感到困惑,但如果要为下载的文件提供一个自定义的名称(而不是原始名称),你必须使用 -o(小写 O)选项: + +``` +curl -o filename URL +``` + +![][12] + +有些时候,curl 并不能像你期望的那样下载文件,你必须使用选项 -L(代表位置)来正确下载。这是因为有些时候,链接会重定向到其他链接,而使用选项 -L,它就会跟随最终的链接。 + +#### 用 curl 暂停和恢复下载 + +和 wget 一样,你也可以用 curl 的 -c 选项恢复暂停的下载: + +``` +curl -c URL +``` + +**总结** + +和以往一样,在 Linux 中做同一件事有多种方法。从终端下载文件也不例外。 + +wget 和 curl 只是 Linux 中最流行的两个下载文件的命令。还有更多这样的命令行工具。基于终端的网络浏览器,如 [elinks][13]、[w3m][14] 等也可以用于在命令行下载文件。 + +就个人而言,对于一个简单的下载,我更喜欢使用 wget 而不是 curl。它更简单,也不会让你感到困惑,因为你可能很难理解为什么 curl 不能以预期的格式下载文件。 + +欢迎你的反馈和建议。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/download-files-from-linux-terminal/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/Download-Files-from-Linux-terminal.png?resize=800%2C450&ssl=1 +[2]: https://www.gnu.org/software/wget/ +[3]: https://itsfoss.com/install-latest-uget-ubuntu-linux-mint/ +[4]: https://itsfoss.com/apt-command-guide/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/download-file-in-linux-terminal-using-wget.png?resize=795%2C418&ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/download-file-in-linux-terminal-using-wget-2.png?resize=795%2C418&ssl=1 +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/download-entire-website-using-wget.png?resize=795%2C418&ssl=1 +[8]: https://curl.haxx.se/ +[9]: https://linuxhandbook.com/curl-command-examples/ +[10]: https://itsfoss.com/install-curl-ubuntu/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/download-files-in-linux-using-curl.png?resize=795%2C418&ssl=1 +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/download-files-in-linux-using-curl-1.png?resize=795%2C418&ssl=1 +[13]: http://elinks.or.cz/ +[14]: http://w3m.sourceforge.net/ From 921a627eefb2034a18f842391c983e3c4af37017 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 20 Oct 2020 08:48:10 +0800 Subject: [PATCH 0511/1156] translating --- sources/tech/20201016 Set up ZFS on Linux with yum.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201016 Set up ZFS on Linux with yum.md b/sources/tech/20201016 Set up ZFS on Linux with yum.md index 87adc44ad1..694d6137fe 100644 --- a/sources/tech/20201016 Set up ZFS on Linux with yum.md +++ b/sources/tech/20201016 Set up ZFS on Linux with yum.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 9ae2b1e4936c7ffc8ff424e2a360a236bada547e Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Tue, 20 Oct 2020 18:18:57 +0800 Subject: [PATCH 0512/1156] Update 20191105 My first contribution to open source- Making a decision.md --- ...5 My first contribution to open source- Making a decision.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20191105 My first contribution to open source- Making a decision.md b/sources/talk/20191105 My first contribution to open source- Making a decision.md index 0640ff1cf4..60a386d8cf 100644 --- a/sources/talk/20191105 My first contribution to open source- Making a decision.md +++ b/sources/talk/20191105 My first contribution to open source- Making a decision.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: ( chenmu-kk ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 758909f1c02ad0ea172ac7eaab1175dd0cc93f0a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 20 Oct 2020 23:52:57 +0800 Subject: [PATCH 0513/1156] PRF @gxlct008 --- ...on Ubuntu and Other Linux Distributions.md | 76 +++++++++---------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/translated/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md b/translated/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md index 49d99ffff9..e6e1847264 100644 --- a/translated/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md +++ b/translated/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (gxlct008) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Using Yarn on Ubuntu and Other Linux Distributions) @@ -10,15 +10,15 @@ 在 Ubuntu 和其他 Linux 发行版上使用 Yarn ====== -***本速成教程向您展示了在 Ubuntu 和 Debian Linux 上安装 Yarn 包管理器的官方方法。您还将学习到一些基本的 Yarn 命令以及彻底删除 Yarn 的步骤。*** +> 本速成教程向你展示了在 Ubuntu 和 Debian Linux 上安装 Yarn 包管理器的官方方法。你还将学习到一些基本的 Yarn 命令以及彻底删除 Yarn 的步骤。 [Yarn][1] 是 Facebook 开发的开源 JavaScript 包管理器。它是流行的 npm 包管理器的一个替代品,或者应该说是改进。 [Facebook 开发团队][2] 创建 Yarn 是为了克服 [npm][3] 的缺点。 Facebook 声称 Yarn 比 npm 更快、更可靠、更安全。 -与 npm 一样,Yarn 为您提供一种自动安装、更新、配置和删除从全局注册表中检索到的程序包的方法。 +与 npm 一样,Yarn 为你提供一种自动安装、更新、配置和删除从全局注册库中检索到的程序包的方法。 -Yarn 的优点是它更快,因为它缓存了已下载的每个包,所以无需再次下载。它还将操作并行化,以最大化资源利用率。在执行每个已安装的包代码之前,Yarn 还使用 [校验和来验证完整性][4]。 Yarn 还保证在一个系统上运行的安装,在任何其他系统上都会以完全相同地方式工作。 +Yarn 的优点是它更快,因为它可以缓存已下载的每个包,所以无需再次下载。它还将操作并行化,以最大化资源利用率。在执行每个已安装的包代码之前,Yarn 还使用 [校验和来验证完整性][4]。 Yarn 还保证可以在一个系统上运行的安装,在任何其他系统上都会以完全相同地方式工作。 -如果您正 [在 Ubuntu 上使用 nodejs][5],那么您的系统上可能已经安装了 npm。在这种情况下,您可以通过以下方式使用 npm 全局安装 Yarn: +如果你正 [在 Ubuntu 上使用 node.js][5],那么你的系统上可能已经安装了 npm。在这种情况下,你可以使用 npm 通过以下方式全局安装 Yarn: ``` sudo npm install yarn -g @@ -30,15 +30,15 @@ sudo npm install yarn -g ![Yarn JS][6] -这里提到的指令应该适用于所有版本的 Ubuntu,例如 Ubuntu 18.04、16.04 等。同样的指令集也适用于 Debian 和其他基于 Debian 的发行版。 +这里提到的说明应该适用于所有版本的 Ubuntu,例如 Ubuntu 18.04、16.04 等。同样的一组说明也适用于 Debian 和其他基于 Debian 的发行版。 -由于本教程使用 curl 来添加 Yarn 项目的 GPG 密钥,所以最好验证一下您是否已经安装了 curl。 +由于本教程使用 `curl` 来添加 Yarn 项目的 GPG 密钥,所以最好验证一下你是否已经安装了 `curl`。 ``` sudo apt install curl ``` -如果 curl 尚未安装,则上面的命令将安装它。既然有了 curl,您就可以使用它以如下方式添加 Yarn 项目的 GPG 密钥: +如果 `curl` 尚未安装,则上面的命令将安装它。既然有了 `curl`,你就可以使用它以如下方式添加 Yarn 项目的 GPG 密钥: ``` curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - @@ -50,14 +50,14 @@ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - sudo sh -c 'echo "deb https://dl.yarnpkg.com/debian/ stable main" >> /etc/apt/sources.list.d/yarn.list' ``` -您现在可以继续了。[更新 Ubuntu][7] 或 Debian 系统,以刷新可用软件包列表,然后安装 Yarn: +你现在可以继续了。[更新 Ubuntu][7] 或 Debian 系统,以刷新可用软件包列表,然后安装 Yarn: ``` sudo apt update sudo apt install yarn ``` -这将一起安装 Yarn 和 nodejs。该过程完成后,请验证是否已成功安装 Yarn。 您可以通过检查 Yarn 版本来做到这一点。 +这将一起安装 Yarn 和 node.js。该过程完成后,请验证是否已成功安装 Yarn。 你可以通过检查 Yarn 版本来做到这一点。 ``` yarn --version @@ -74,15 +74,15 @@ yarn --version ### 使用 Yarn -我假设您对 JavaScript 编程以及依赖项的工作原理有一些基本的了解。我在这里不做详细介绍。我将向您展示一些基本的 Yarn 命令,这些命令将帮助您入门。 +我假设你对 JavaScript 编程以及依赖项的工作原理有一些基本的了解。我在这里不做详细介绍。我将向你展示一些基本的 Yarn 命令,这些命令将帮助你入门。 #### 使用 Yarn 创建一个新项目 -与 npm 一样,Yarn 也可以使用 package.json 文件。在这里添加依赖项。所有依赖包都缓存在项目根目录下的 node_modules 目录中。 +与 `npm` 一样,Yarn 也可以使用 `package.json` 文件。在这里添加依赖项。所有依赖包都缓存在项目根目录下的 `node_modules` 目录中。 -在项目的根目录中,运行以下命令以生成新的 package.json 文件: +在项目的根目录中,运行以下命令以生成新的 `package.json` 文件: -它会问您一些问题。您可以按 Enter 跳过或使用默认值。 +它会问你一些问题。你可以按回车键跳过或使用默认值。 ``` yarn init @@ -99,7 +99,7 @@ success Saved package.json Done in 82.42s. ``` -这样,您就得到了一个如下的 package.json 文件: +这样,你就得到了一个如下的 `package.json` 文件: ``` { @@ -112,17 +112,17 @@ Done in 82.42s. } ``` -现在您有了 package.json,您可以手动编辑它以添加或删除包依赖项,也可以使用 Yarn 命令(首选)。 +现在你有了 `package.json`,你可以手动编辑它以添加或删除包依赖项,也可以使用 Yarn 命令(首选)。 #### 使用 Yarn 添加依赖项 -您可以通过以下方式添加对特定包的依赖关系: +你可以通过以下方式添加对特定包的依赖关系: ``` -yarn add +yarn add <包名> ``` -例如,如果您想在项目中使用 [Lodash][8],则可以使用 Yarn 添加它,如下所示: +例如,如果你想在项目中使用 [Lodash][8],则可以使用 Yarn 添加它,如下所示: ``` yarn add lodash @@ -141,7 +141,7 @@ info All dependencies Done in 2.67s. ``` -您可以看到,此依赖项已自动添加到 package.json 文件中: +你可以看到,此依赖项已自动添加到 `package.json` 文件中: ``` { @@ -163,25 +163,25 @@ Done in 2.67s. yarn add package@version-or-tag ``` -像往常一样,您也可以手动更新 package.json 文件。 +像往常一样,你也可以手动更新 `package.json` 文件。 #### 使用 Yarn 升级依赖项 -您可以使用以下命令将特定依赖项升级到其最新版本: +你可以使用以下命令将特定依赖项升级到其最新版本: ``` -yarn upgrade +yarn upgrade <包名> ``` 它将查看所​​涉及的包是否具有较新的版本,并且会相应地对其进行更新。 -您还可以通过以下方式更改已添加的依赖项的版本: +你还可以通过以下方式更改已添加的依赖项的版本: ``` yarn upgrade package_name@version_or_tag ``` -您还可以使用一个命令将项目的所有依赖项升级到它们的最新版本: +你还可以使用一个命令将项目的所有依赖项升级到它们的最新版本: ``` yarn upgrade @@ -191,21 +191,21 @@ yarn upgrade #### 使用 Yarn 删除依赖项 -您可以通过以下方式从项目的依赖项中删除包: +你可以通过以下方式从项目的依赖项中删除包: ``` -yarn remove +yarn remove <包名> ``` #### 安装所有项目依赖项 -如果对您 project.json 文件进行了任何更改,则应该运行 +如果对你 `project.json` 文件进行了任何更改,则应该运行: ``` yarn ``` -或者 +或者, ``` yarn install @@ -215,7 +215,7 @@ yarn install ### 如何从 Ubuntu 或 Debian 中删除 Yarn -我将通过介绍从系统中删除 Yarn 的步骤来完成本教程,如果您使用上述步骤安装 Yarn 的话。如果您意识到不再需要 Yarn 了,则可以将它删除。 +我将通过介绍从系统中删除 Yarn 的步骤来完成本教程,如果你使用上述步骤安装 Yarn 的话。如果你意识到不再需要 Yarn 了,则可以将它删除。 使用以下命令删除 Yarn 及其依赖项。 @@ -223,19 +223,19 @@ yarn install sudo apt purge yarn ``` -您也应该从源列表中把存储库信息一并删除掉: +你也应该从源列表中把存储库信息一并删除掉: ``` sudo rm /etc/apt/sources.list.d/yarn.list ``` -下一步删除已添加到受信任密钥的 GPG 密钥是可选的。但要做到这一点,您需要知道密钥。您可以使用 `apt-key` 命令获得它: +下一步删除已添加到受信任密钥的 GPG 密钥是可选的。但要做到这一点,你需要知道密钥。你可以使用 `apt-key` 命令获得它: ``` -Warning: apt-key output should not be parsed (stdout is not a terminal) pub rsa4096 2016-10-05 [SC] 72EC F46A 56B4 AD39 C907 BBB7 1646 B01B 86E5 0310 uid [ unknown] Yarn Packaging yarn@dan.cx sub rsa4096 2016-10-05 [E] sub rsa4096 2019-01-02 [S] [expires: 2020-02-02] +Warning: apt-key output should not be parsed (stdout is not a terminal) pub rsa4096 2016-10-05 [SC] 72EC F46A 56B4 AD39 C907 BBB7 1646 B01B 86E5 0310 uid [ unknown] Yarn Packaging yarn@dan.cx sub rsa4096 2016-10-05 [E] sub rsa4096 2019-01-02 [S] [expires: 2020-02-02] ``` -这里的密钥是以 pub 开始的行中 GPG 密钥指纹的最后 8 个字符。 +这里的密钥是以 `pub` 开始的行中 GPG 密钥指纹的最后 8 个字符。 因此,对于我来说,密钥是 `86E50310`,我将使用以下命令将其删除: @@ -243,11 +243,11 @@ Warning: apt-key output should not be parsed (stdout is not a terminal) pub rsa4 sudo apt-key del 86E50310 ``` -您会在输出中看到 OK,并且 Yarn 包的 GPG 密钥将从系统信任的 GPG 密钥列表中删除。 +你会在输出中看到 `OK`,并且 Yarn 包的 GPG 密钥将从系统信任的 GPG 密钥列表中删除。 -我希望本教程可以帮助您在 Ubuntu、Debian、Linux Mint、 elementary OS 等操作系统上安装 Yarn。 我提供了一些基本的 Yarn 命令,以帮助您入门,并完成了从系统中删除 Yarn 的完整步骤。 +我希望本教程可以帮助你在 Ubuntu、Debian、Linux Mint、 elementary OS 等操作系统上安装 Yarn。 我提供了一些基本的 Yarn 命令,以帮助你入门,并完成了从系统中删除 Yarn 的完整步骤。 -希望您喜欢本教程,如果有任何疑问或建议,请随时在下面留言。 +希望你喜欢本教程,如果有任何疑问或建议,请随时在下面留言。 -------------------------------------------------------------------------------- @@ -257,7 +257,7 @@ via: https://itsfoss.com/install-yarn-ubuntu 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[gxlct008](https://github.com/gxlct008) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From aa346891b3505e521bbd9c8ee27766edf5fb1e22 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 21 Oct 2020 00:02:16 +0800 Subject: [PATCH 0514/1156] PUB @gxlct008 https://linux.cn/article-12737-1.html --- ...0102 Using Yarn on Ubuntu and Other Linux Distributions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md (99%) diff --git a/translated/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md b/published/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md similarity index 99% rename from translated/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md rename to published/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md index e6e1847264..0222a78d37 100644 --- a/translated/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md +++ b/published/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (gxlct008) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12737-1.html) [#]: subject: (Using Yarn on Ubuntu and Other Linux Distributions) [#]: via: (https://itsfoss.com/install-yarn-ubuntu) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From c99b55cb434027ac1abe22d52ee0c89067ed6cfa Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 21 Oct 2020 07:10:08 +0800 Subject: [PATCH 0515/1156] PRF @geekpi --- ...with this internet protocol alternative.md | 40 +++++++++---------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/translated/tech/20201006 Simplify your web experience with this internet protocol alternative.md b/translated/tech/20201006 Simplify your web experience with this internet protocol alternative.md index 77cd297944..4eb84710b6 100644 --- a/translated/tech/20201006 Simplify your web experience with this internet protocol alternative.md +++ b/translated/tech/20201006 Simplify your web experience with this internet protocol alternative.md @@ -1,51 +1,50 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Simplify your web experience with this internet protocol alternative) [#]: via: (https://opensource.com/article/20/10/gemini-internet-protocol) [#]: author: (Seth Kenlon https://opensource.com/users/seth) -使用此互联网协议替代方案简化你的 Web 体验 +使用互联网协议替代方案 Gemini 简化你的 Web 体验 ====== -用 Gemini 协议发现更安静、更简单的互联网新角落。 -![Person typing on a 1980's computer][1] -如果你已经上网了很长时间,或者只是了解很多,你可能还记得一个早期的文本共享协议,叫做 [Gopher][2]。Gopher 最终被 HTTP 协议所取代,当然,HTTP 协议是现代万维网的基础。对于很多人来说,”互联网“和”万维网“是一回事,因为很多人并不会有意识地做_不_在 www 子域下的事情。 +> 用 Gemini 协议发现更安静、更简单的互联网新角落。 -但一直以来,都有各种网络协议在互联网络上共享信息。Telnet、FTP、SSH、Torrent、GNUnet 等等。最近,在这一系列的替代品中又多了一个,它叫 [Gemini][3]。 +![](https://img.linux.net.cn/data/attachment/album/202010/21/070950dzph7mlm0h035h3o.jpg) -Gemini 协议,以”水星计划“和”阿波罗计划“的基础实验之间的太空任务命名,旨在和平地处在 Gopher 和 HTTP 之间。无论如何,它的目的并不是要取代现代 Web,但它确实试图创造一个简化的网络和一个现代化的 Gopher。 +如果你很久以前就已经上网了,或者是知识非常丰富,你可能还记得一个早期的文本共享协议,叫做 [Gopher][2]。Gopher 最终被 HTTP 协议所取代,当然,HTTP 协议是现代万维网的基础。对于很多人来说,“互联网internet”和“万维网World Wide Web”是一回事,因为很多人没有意识到在网上进行了*非* www 子域下的任何操作。 -它的发展虽然可能很年轻,但意义重大,原因有很多。当然,人们会因为技术和哲学上的原因而对现代 Web 表示质疑,但它只是一般的臃肿。当你真正想要的是一个非常具体的问题的可靠答案时,那么无数次点击谷歌搜索的结果让人感觉过头了。 +但一直以来,都有各种网络协议在互联网络上共享信息:Telnet、FTP、SSH、Torrent、GNUnet 等等。最近,在这一系列的替代品中又多了一个,它叫 [Gemini][3]。 + +Gemini(双子座)协议,以“水星计划”和“阿波罗计划”的基础实验之间的太空任务命名,旨在和平地处在 Gopher 和 HTTP 之间。无论如何,它的目的并不是要取代现代 Web,但它确实试图创造一个简化的网络和一个现代化的 Gopher。 + +它的发展历史虽然可能很年轻,但意义重大,原因有很多。当然,人们会因为技术和哲学上的原因而对现代 Web 表示质疑,但它只是一般的臃肿。当你真正想要的是一个非常具体的问题的可靠答案时,那么无数次点击谷歌搜索的结果让人感觉过头了。 许多人使用 Gopher 就是因为这个原因:它的规模小到可以让小众的兴趣很容易找到。然而,Gopher 是一个旧的协议,它对编程、网络和浏览做出了一些假设,但这些假设已经不再适用了。 Gemini 的目标是将最好的网络带入一种类似于 Gopher 但易于编程的格式。一个简单的 Gemini 浏览器可以用几百行代码写成,并且有一个非常好的浏览器用 1600 行左右写成。这对于程序员、学生和极简主义者来说都是一个强大的功能。 ### 如何浏览 Gemini -就像早期的网络一样,Gemini 的规模很小,有一个运行 Gemini 网站的已知服务器列表。就像浏览 HTTP 站点需要一个网页浏览器一样,访问 Gemini 站点也需要一个 Gemini 浏览器。已经有几个可用的,在 [Gemini 网站][4]上列出。 +就像早期的网络一样,Gemini 的规模很小,所以有一个列表列出了运行 Gemini 网站的已知服务器。就像浏览 HTTP 站点需要一个网页浏览器一样,访问 Gemini 站点也需要一个 Gemini 浏览器。在 [Gemini 网站][4]上列出了有几个可用的浏览器。 最简单的一个是 [AV-98][5] 客户端。它是用 Python 编写的,在终端中运行。要想试试的话,请下载它: - ``` -`$ git clone https://tildegit.org/solderpunk/AV-98.git` +$ git clone https://tildegit.org/solderpunk/AV-98.git ``` 进入下载目录,运行 AV-98: - ``` $ cd AV-98.git $ python3 ./main.py ``` -客户端是一个交互式的提示。它有有限的几个命令,主要的命令是简单的 `go`,后面跟着一个 Gemini 服务器地址。进入已知的 [Gemini 服务器][6]列表,选择一个看起来很有趣的服务器,然后尝试访问它: - +客户端是一个交互式的提示符。它有有限的几个命令,主要的命令是简单的 `go`,后面跟着一个 Gemini 服务器地址。在已知的 [Gemini 服务器][6]列表中选择一个看起来很有趣的服务器,然后尝试访问它: ``` -AV-98> go gemini://example.club +AV-98> go gemini://example.club Welcome to the example.club Gemini server! @@ -56,11 +55,11 @@ Here are some folders of ASCII art: [3] Demons ``` -导航是按照编号的链接来进行的。例如,要进入 Penguins 目录,输入 `1` 然后按回车键: +导航是按照编号的链接来进行的。例如,要进入 `Penguins` 目录,输入 `1` 然后按回车键: ``` -AV-98> 1 +AV-98> 1 [1] Gentoo [2] Emperor @@ -69,14 +68,13 @@ AV-98> 1 要返回,输入 `back` 并按回车键: - ``` -`AV-98> back` +AV-98> back ``` 更多命令,请输入 `help`。 -### Gemini 作为你的 web 替代 +### 用 Gemini 作为你的 web 替代 Gemini 协议非常简单,初级和中级程序员都可以为其编写客户端,而且它是在互联网上分享内容的一种简单快捷的方式。虽然万维网的无处不在对广泛传播是有利的,但总有替代方案的空间。看看 Gemini,发现更安静、更简单的互联网的新角落。 @@ -87,7 +85,7 @@ via: https://opensource.com/article/20/10/gemini-internet-protocol 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From bcc2472b87b5c0eabdb878523e80c26154964284 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 21 Oct 2020 07:10:48 +0800 Subject: [PATCH 0516/1156] PUB @geekpi https://linux.cn/article-12738-1.html --- ... web experience with this internet protocol alternative.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201006 Simplify your web experience with this internet protocol alternative.md (98%) diff --git a/translated/tech/20201006 Simplify your web experience with this internet protocol alternative.md b/published/20201006 Simplify your web experience with this internet protocol alternative.md similarity index 98% rename from translated/tech/20201006 Simplify your web experience with this internet protocol alternative.md rename to published/20201006 Simplify your web experience with this internet protocol alternative.md index 4eb84710b6..dd013f7416 100644 --- a/translated/tech/20201006 Simplify your web experience with this internet protocol alternative.md +++ b/published/20201006 Simplify your web experience with this internet protocol alternative.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12738-1.html) [#]: subject: (Simplify your web experience with this internet protocol alternative) [#]: via: (https://opensource.com/article/20/10/gemini-internet-protocol) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From 1f7dd68aea8a91112d8d54d85c96f0afabc3f292 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 21 Oct 2020 08:36:07 +0800 Subject: [PATCH 0517/1156] translating --- ... LVM-s (Logical Volume Resize) in Linux.md | 78 +++++++++---------- 1 file changed, 39 insertions(+), 39 deletions(-) rename {sources => translated}/tech/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md (52%) diff --git a/sources/tech/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md b/translated/tech/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md similarity index 52% rename from sources/tech/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md rename to translated/tech/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md index d772a3e6c9..c83115cf36 100644 --- a/sources/tech/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md +++ b/translated/tech/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md @@ -7,41 +7,41 @@ [#]: via: (https://www.2daygeek.com/reduce-shrink-decrease-resize-lvm-logical-volume-in-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -How to Reduce/Shrink LVM’s (Logical Volume Resize) in Linux +如何在 Linux 中减少/缩 LVM 大小(逻辑卷调整)? ====== -Reducing/Shrinking the logical volume is the highest risk of data corruption. +减少/缩小逻辑卷是数据损坏的最高风险。 -So try to avoid this kind of situation if possible, but go ahead if you have no other options. +所以,如果可能的话,尽量避免这种情况,但如果没有其他选择的话,那就继续。 -It is always recommended to make a backup before shrinking an LVM. +缩减 LVM 之前,建议先做一个备份。 -When you are running out of disk space in LVM, you can make some free space on the volume group by reducing the exsisting LVM that no longer uses the full size, instead of adding a new physical disk. +当你在 LVM 中的磁盘空间耗尽时,你可以通过缩小现有的没有使用全部空间的 LVM,而不是增加一个新的物理磁盘,在卷组上腾出一些空闲空间。 -**Make a note:** Shrinking is not supported on a `GFS2` or `XFS` file system. +**需要注意的是:**在 `GFS2` 或者 `XFS` 文件系统上不支持收缩。 -If you are new to Logical Volume Management (LVM), I suggest you start with our previous article. +如果你是逻辑卷管理 (LVM) 的新手,我建议你从我们之前的文章开始学习。 - * **Part-1: [How to Create/Configure LVM (Logical Volume Management) in Linux][1]** - * **Part-2: [How to Extend/Increase LVM’s (Logical Volume Resize) in Linux][2]** + * **第一部分:[如何在 Linux 中创建/配置 LVM(逻辑卷管理)][1]** + * **第二部分:[如何在 Linux 中扩展/增加 LVM(逻辑卷调整)][2]** ![][3] -Reducing the logical volume involves the below steps. +减少逻辑卷涉及以下步骤。 - * Unmount the file system. - * Check the file system for any errors. - * Shrink the file system size. - * Reduce the logical volume size. - * Re-check the file system for errors (Optional). - * Mount the file system - * Check the reduced file system size + * 卸载文件系统 + * 检查文件系统是否有任何错误 + * 缩小文件系统的大小 + * 缩小逻辑卷的大小 + * 重新检查文件系统是否存在错误(可选) + * 挂载文件系统 + * 检查减少后的文件系统大小 -**For instance;** You have a **100GB** LVM that no longer uses the full size, you want to reduce it to **80GB** so **20GB** can be used for other purposes. +**比如:**你有一个 **100GB** 的不再使用全部空间的 LVM,你想把它减少到 **80GB**,这样 **20GB** 可以用于其他用途。 ``` # df -h /testlvm1 @@ -50,17 +50,17 @@ Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg01-lv002 100G 15G 85G 12% /testlvm1 ``` -### 1) Unmount the file system +### 1)卸载文件系统 -Use the umount command to unmount the file system. +使用 umount 命令卸载文件系统。 ``` # umount /testlvm1 ``` -### 2) Check the file system for any Errors +### 2)检查文件系统是否有任何错误 -Check the file system for any errors using the e2fsck command. +使用 e2fsck 命令检查文件系统是否有错误。 ``` # e2fsck -f /dev/mapper/vg01-lv002 @@ -74,17 +74,17 @@ Pass 5: Checking group summary information /dev/mapper/vg01-lv002: 13/6553600 files (0.0% non-contiguous), 12231854/26212352 blocks ``` -### 3) Shrink the file system. +### 3)缩小文件系统 -The below command will reduce the **“testlvm1”** file system from **100GB** to **80GB**. +下面的命令将把 **“testlvm1”** 文件系统从 **100GB** 缩小到 **80GB**。 -**Common syntax for file system resize (resize2fs).** +**文件系统大小调整的常用语法(resize2fs)**。 ``` -resize2fs [Existing Logical Volume Name] [New Size of File System] +resize2fs [现有逻辑卷名] [新的文件系统大小] ``` -The actual command is as follows. +实际命令如下: ``` # resize2fs /dev/mapper/vg01-lv002 80G @@ -94,17 +94,17 @@ Resizing the filesystem on /dev/mapper/vg01-lv002 to 28321400 (4k) blocks. The filesystem on /dev/mapper/vg01-lv002 is now 28321400 blocks long. ``` -### 4) Reduce the Logical Volume (LVM) +### 4)减少逻辑卷 (LVM) 容量 -Now reduce the logical volume (LVM) size using the lvreduce command. The below command **“/dev/mapper/vg01-lv002”** will shrink the Logical volume (LVM) from 100GB to 80GB. +现在使用 lvreduce 命令缩小逻辑卷 (LVM) 的大小。下面的命令 **”/dev/mapper/vg01-lv002”** 将把逻辑卷 (LVM) 从 100GB 缩小到 80GB。 -**Common syntax for LVM Reduce (lvreduce)** +**LVM 缩减 (lvreduce) 的常用语法**。 ``` -lvreduce [New Size of LVM] [Existing Logical Volume Name] +lvreduce [新的 LVM 大小] [现有逻辑卷名称] ``` -The actual command is as follows. +实际命令如下: ``` # lvreduce -L 80G /dev/mapper/vg01-lv002 @@ -116,9 +116,9 @@ Reducing logical volume lv002 to 80.00 GiB Logical volume lv002 successfully resized ``` -### 5) Optional: Check the file system for any Errors +### 5)可选:检查文件系统是否有错误 -Check the file system again if there are any errors after LVM has been reduced. +缩减 LVM 后再次检查文件系统是否有错误。 ``` # e2fsck -f /dev/mapper/vg01-lv002 @@ -132,17 +132,17 @@ Pass 5: Checking group summary information /dev/mapper/vg01-lv002: 13/4853600 files (0.0% non-contiguous), 1023185/2021235 blocks ``` -### 6) Mount the file system and check the reduced size +### 6)挂载文件系统并检查缩小后的大小 -Finally mount the file system and check the reduced file system size. +最后挂载文件系统,并检查缩小后的文件系统大小。 -Use the mount command to **[mount the logical volume][4]**. +使用挂载命令**[挂载逻辑卷][4]**。 ``` # mount /testlvm1 ``` -Check the newly mounted volume using the **[df command][5]**. +使用 **[df 命令][5]**检查挂载的卷。 ``` # df -h /testlvm1 @@ -157,7 +157,7 @@ via: https://www.2daygeek.com/reduce-shrink-decrease-resize-lvm-logical-volume-i 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[geekpi](https://github.com/geekpi) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6cce2f8c8363f28ddf8101e8fa94e45b40a8cf22 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 21 Oct 2020 08:41:29 +0800 Subject: [PATCH 0518/1156] translating --- ...07 How to Clear Apt Cache and Reclaim Precious Disk Space.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md b/sources/tech/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md index 83a0b2aafd..60496ca88d 100644 --- a/sources/tech/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md +++ b/sources/tech/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 958a9da37695e40ef5f14d8fc7398f3fae2ccf37 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 21 Oct 2020 21:06:37 +0800 Subject: [PATCH 0519/1156] PRF @geekpi --- ... LVM-s (Logical Volume Resize) in Linux.md | 50 +++++++++---------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/translated/tech/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md b/translated/tech/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md index c83115cf36..db646e66a9 100644 --- a/translated/tech/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md +++ b/translated/tech/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md @@ -1,15 +1,17 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) -[#]: subject: (How to Reduce/Shrink LVM’s (Logical Volume Resize) in Linux) +[#]: subject: (How to Reduce/Shrink LVM’s \(Logical Volume Resize\) in Linux) [#]: via: (https://www.2daygeek.com/reduce-shrink-decrease-resize-lvm-logical-volume-in-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -如何在 Linux 中减少/缩 LVM 大小(逻辑卷调整)? +如何在 Linux 中减少/缩小 LVM 大小(逻辑卷调整) ====== +![](https://img.linux.net.cn/data/attachment/album/202010/21/210459ydp5an23nfzgglyy.jpg) + 减少/缩小逻辑卷是数据损坏的最高风险。 所以,如果可能的话,尽量避免这种情况,但如果没有其他选择的话,那就继续。 @@ -18,18 +20,16 @@ 当你在 LVM 中的磁盘空间耗尽时,你可以通过缩小现有的没有使用全部空间的 LVM,而不是增加一个新的物理磁盘,在卷组上腾出一些空闲空间。 -**需要注意的是:**在 `GFS2` 或者 `XFS` 文件系统上不支持收缩。 +**需要注意的是:** 在 GFS2 或者 XFS 文件系统上不支持缩小。 如果你是逻辑卷管理 (LVM) 的新手,我建议你从我们之前的文章开始学习。 - * **第一部分:[如何在 Linux 中创建/配置 LVM(逻辑卷管理)][1]** - * **第二部分:[如何在 Linux 中扩展/增加 LVM(逻辑卷调整)][2]** +* **第一部分:[如何在 Linux 中创建/配置 LVM(逻辑卷管理)][1]** +* **第二部分:[如何在 Linux 中扩展/增加 LVM(逻辑卷调整)][2]** +![](https://img.linux.net.cn/data/attachment/album/202010/21/210610kikq1xynfje7hjaa.jpeg) - -![][3] - -减少逻辑卷涉及以下步骤。 +减少逻辑卷涉及以下步骤: * 卸载文件系统 * 检查文件系统是否有任何错误 @@ -39,9 +39,7 @@ * 挂载文件系统 * 检查减少后的文件系统大小 - - -**比如:**你有一个 **100GB** 的不再使用全部空间的 LVM,你想把它减少到 **80GB**,这样 **20GB** 可以用于其他用途。 +**比如:** 你有一个 **100GB** 的没有使用全部空间的 LVM,你想把它减少到 **80GB**,这样 **20GB** 可以用于其他用途。 ``` # df -h /testlvm1 @@ -52,7 +50,7 @@ Filesystem Size Used Avail Use% Mounted on ### 1)卸载文件系统 -使用 umount 命令卸载文件系统。 +使用 `umount` 命令卸载文件系统: ``` # umount /testlvm1 @@ -60,7 +58,7 @@ Filesystem Size Used Avail Use% Mounted on ### 2)检查文件系统是否有任何错误 -使用 e2fsck 命令检查文件系统是否有错误。 +使用 `e2fsck` 命令检查文件系统是否有错误: ``` # e2fsck -f /dev/mapper/vg01-lv002 @@ -76,9 +74,9 @@ Pass 5: Checking group summary information ### 3)缩小文件系统 -下面的命令将把 **“testlvm1”** 文件系统从 **100GB** 缩小到 **80GB**。 +下面的命令将把 `testlvm1` 文件系统从 **100GB** 缩小到 **80GB**。 -**文件系统大小调整的常用语法(resize2fs)**。 +**文件系统大小调整的常用语法(`resize2fs`)**: ``` resize2fs [现有逻辑卷名] [新的文件系统大小] @@ -96,9 +94,9 @@ The filesystem on /dev/mapper/vg01-lv002 is now 28321400 blocks long. ### 4)减少逻辑卷 (LVM) 容量 -现在使用 lvreduce 命令缩小逻辑卷 (LVM) 的大小。下面的命令 **”/dev/mapper/vg01-lv002”** 将把逻辑卷 (LVM) 从 100GB 缩小到 80GB。 +现在使用 `lvreduce` 命令缩小逻辑卷(LVM) 的大小。通过下面的命令, `/dev/mapper/vg01-lv002` 将把逻辑卷 (LVM) 从 100GB 缩小到 80GB。 -**LVM 缩减 (lvreduce) 的常用语法**。 +**LVM 缩减 (`lvreduce`) 的常用语法**: ``` lvreduce [新的 LVM 大小] [现有逻辑卷名称] @@ -118,7 +116,7 @@ Logical volume lv002 successfully resized ### 5)可选:检查文件系统是否有错误 -缩减 LVM 后再次检查文件系统是否有错误。 +缩减 LVM 后再次检查文件系统是否有错误: ``` # e2fsck -f /dev/mapper/vg01-lv002 @@ -136,13 +134,13 @@ Pass 5: Checking group summary information 最后挂载文件系统,并检查缩小后的文件系统大小。 -使用挂载命令**[挂载逻辑卷][4]**。 +使用 `mount` 命令**[挂载逻辑卷][4]**: ``` # mount /testlvm1 ``` -使用 **[df 命令][5]**检查挂载的卷。 +使用 [df 命令][5]检查挂载的卷。 ``` # df -h /testlvm1 @@ -158,14 +156,14 @@ via: https://www.2daygeek.com/reduce-shrink-decrease-resize-lvm-logical-volume-i 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.2daygeek.com/author/magesh/ [b]: https://github.com/lujun9972 -[1]: https://www.2daygeek.com/create-lvm-storage-logical-volume-manager-in-linux/ -[2]: https://www.2daygeek.com/extend-increase-resize-lvm-logical-volume-in-linux/ -[3]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[1]: https://linux.cn/article-12670-1.html +[2]: https://linux.cn/article-12673-1.html +[3]: https://www.2daygeek.com/wp-content/uploads/2020/09/reduce-shrink-decrease-resize-lvm-logical-volume-in-linux-1.png [4]: https://www.2daygeek.com/mount-unmount-file-system-partition-in-linux/ [5]: https://www.2daygeek.com/linux-check-disk-space-usage-df-command/ From fa30bc8ce9131e01272594700e064702d34c7280 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 21 Oct 2020 21:10:05 +0800 Subject: [PATCH 0520/1156] PUB @geekpi https://linux.cn/article-12740-1.html --- ...ink LVM-s (Logical Volume Resize) in Linux.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) rename {translated/tech => published}/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md (94%) diff --git a/translated/tech/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md b/published/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md similarity index 94% rename from translated/tech/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md rename to published/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md index db646e66a9..3884c5e542 100644 --- a/translated/tech/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md +++ b/published/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12740-1.html) [#]: subject: (How to Reduce/Shrink LVM’s \(Logical Volume Resize\) in Linux) [#]: via: (https://www.2daygeek.com/reduce-shrink-decrease-resize-lvm-logical-volume-in-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) @@ -48,7 +48,7 @@ Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg01-lv002 100G 15G 85G 12% /testlvm1 ``` -### 1)卸载文件系统 +### 卸载文件系统 使用 `umount` 命令卸载文件系统: @@ -56,7 +56,7 @@ Filesystem Size Used Avail Use% Mounted on # umount /testlvm1 ``` -### 2)检查文件系统是否有任何错误 +### 检查文件系统是否有任何错误 使用 `e2fsck` 命令检查文件系统是否有错误: @@ -72,7 +72,7 @@ Pass 5: Checking group summary information /dev/mapper/vg01-lv002: 13/6553600 files (0.0% non-contiguous), 12231854/26212352 blocks ``` -### 3)缩小文件系统 +### 缩小文件系统 下面的命令将把 `testlvm1` 文件系统从 **100GB** 缩小到 **80GB**。 @@ -92,7 +92,7 @@ Resizing the filesystem on /dev/mapper/vg01-lv002 to 28321400 (4k) blocks. The filesystem on /dev/mapper/vg01-lv002 is now 28321400 blocks long. ``` -### 4)减少逻辑卷 (LVM) 容量 +### 减少逻辑卷 (LVM) 容量 现在使用 `lvreduce` 命令缩小逻辑卷(LVM) 的大小。通过下面的命令, `/dev/mapper/vg01-lv002` 将把逻辑卷 (LVM) 从 100GB 缩小到 80GB。 @@ -114,7 +114,7 @@ Reducing logical volume lv002 to 80.00 GiB Logical volume lv002 successfully resized ``` -### 5)可选:检查文件系统是否有错误 +### 可选:检查文件系统是否有错误 缩减 LVM 后再次检查文件系统是否有错误: @@ -130,7 +130,7 @@ Pass 5: Checking group summary information /dev/mapper/vg01-lv002: 13/4853600 files (0.0% non-contiguous), 1023185/2021235 blocks ``` -### 6)挂载文件系统并检查缩小后的大小 +### 挂载文件系统并检查缩小后的大小 最后挂载文件系统,并检查缩小后的文件系统大小。 From 9a5c1d4f6142516e7067ce5b04533f2e88572bb1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 21 Oct 2020 21:14:43 +0800 Subject: [PATCH 0521/1156] PRF --- ...w to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md b/published/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md index 3884c5e542..7d1348c83f 100644 --- a/published/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md +++ b/published/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md @@ -134,7 +134,7 @@ Pass 5: Checking group summary information 最后挂载文件系统,并检查缩小后的文件系统大小。 -使用 `mount` 命令**[挂载逻辑卷][4]**: +使用 `mount` 命令[挂载逻辑卷][4]: ``` # mount /testlvm1 From fb18405e70151eea41ba87e553edf4c688d1a5f5 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 22 Oct 2020 08:40:35 +0800 Subject: [PATCH 0522/1156] translating --- .../20201016 Set up ZFS on Linux with yum.md | 132 ------------------ .../20201016 Set up ZFS on Linux with yum.md | 132 ++++++++++++++++++ 2 files changed, 132 insertions(+), 132 deletions(-) delete mode 100644 sources/tech/20201016 Set up ZFS on Linux with yum.md create mode 100644 translated/tech/20201016 Set up ZFS on Linux with yum.md diff --git a/sources/tech/20201016 Set up ZFS on Linux with yum.md b/sources/tech/20201016 Set up ZFS on Linux with yum.md deleted file mode 100644 index 694d6137fe..0000000000 --- a/sources/tech/20201016 Set up ZFS on Linux with yum.md +++ /dev/null @@ -1,132 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Set up ZFS on Linux with yum) -[#]: via: (https://opensource.com/article/20/10/zfs-dnf) -[#]: author: (Sheng Mao https://opensource.com/users/ivzhh) - -Set up ZFS on Linux with yum -====== -Use a yum repo to take advantage of the latest ZFS features on Fedora. -![Puzzle pieces coming together to form a computer screen][1] - -I am a Fedora Linux user who runs `yum upgrade` daily. While this habit enables me to run all the latest software (one of [Fedora's four foundations][2] is "first," and it lives up to that), it also highlights any incompatibilities between the [ZFS][3] storage platform and a new kernel. - -As a developer, sometimes I need new features from the latest ZFS branch. For example, ZFS 2.0.0 contains an exciting new feature greatly [improving ZVOL sync performance][4], which is critical to me as a KVM user. But this means that if I want to use the 2.0.0 branch, I have to build ZFS myself. - -At first, I just compiled ZFS manually from its Git repo after every kernel update. If I forgot, ZFS would fail to be recognized on the next boot. Luckily, I quickly learned how to set up dynamic kernel module support ([DKMS][5]) for ZFS. However, this solution isn't perfect. For one thing, it doesn't utilize the powerful [yum][6] system, which can help with resolving dependencies and upgrading. In addition, switching between your own package and an upstream package is pretty easy with yum. - -In this article, I will demonstrate how to set up a yum repo for packaging ZFS. The solution has two steps: - - 1. Create RPM packages from the ZFS Git repository - 2. Set up a yum repo to host the packages - - - -### Create RPM packages - -To create RPM packages, you need to install the RPM toolchain. Yum provides groups to bundle installing the tools: - - -``` -`sudo dnf group install 'C Development Tools and Libraries' 'RPM Development Tools'` -``` - -After these have been installed, you must install all the packages necessary to build ZFS from the ZFS Git repo. The packages belong to three groups: - - 1. [Autotools][7] to generate build files from platform configurations - 2. Libraries for building ZFS kernel and userland tools - 3. Libraries for building RPM packages - - - - -``` -sudo dnf install libtool autoconf automake gettext createrepo \ -    libuuid-devel libblkid-devel openssl-devel libtirpc-devel \ -    lz4-devel libzstd-devel zlib-devel \ -    kernel-devel elfutils-libelf-devel \ -    libaio-devel libattr-devel libudev-devel \ -    python3-devel libffi-devel -``` - -Now you are ready to create your own packages. - -### Build OpenZFS - -[OpenZFS][8] provides excellent infrastructure. To build it: - - 1. Clone the repository with `git` and switch to the branch/tag that you hope to use. - 2. Run Autotools to generate a makefile. - 3. Run `make rpm` and, if everything works, RPM files will be placed in the build folder. - - - - -``` -$ git clone --branch=zfs-2.0.0-rc3 zfs -$ cd zfs -$ ./autogen.sh -$ ./configure -$ make rpm -``` - -### Set up a yum repo - -In yum, a repo is a server or local path that includes metadata and RPM files. A consumer sets up an INI configuration file, and the `yum` command automatically resolves the metadata and downloads the corresponding packages. - -Fedora provides the `createrepo` tool to set up a yum repo. First, create the repo and copy all RPM files from the ZFS folder to the repo. Then run `createrepo --update` to include all packages in the metadata: - - -``` -$ sudo mkdir -p /var/lib/zfs.repo -$ sudo createrepo /var/lib/zfs.repo -$ sudo cp *.rpm /var/lib/zfs.repo/ -$ sudo createrepo --update /var/lib/zfs.repo -``` - -Create a new configuration file in `/etc/yum.repos.d` to include the repo path: - - -``` -$ echo \ -"[zfs-local]\\\nname=ZFS Local\\\nbaseurl=file:///var/lib/zfs.repo\\\nenabled=1\\\ngpgcheck=0" |\ -sudo tee /etc/yum.repos.d/zfs-local.repo - -$ sudo dnf --repo=zfs-local list available --refresh -``` - -Finally, you have reached the end of the journey! You have a working yum repo and ZFS packages. Now you just need to install them: - - -``` -$ sudo dnf install zfs -$ sudo /sbin/modprobe zfs -``` - -Run `sudo zfs version` to see the version of your userland and kernel tools. Congratulations! You have [ZFS for Fedora][9]. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/10/zfs-dnf - -作者:[Sheng Mao][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://opensource.com/users/ivzhh -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/puzzle_computer_solve_fix_tool.png?itok=U0pH1uwj (Puzzle pieces coming together to form a computer screen) -[2]: https://docs.fedoraproject.org/en-US/project/#_what_is_fedora_all_about -[3]: https://zfsonlinux.org/ -[4]: https://www.phoronix.com/scan.php?page=news_item&px=OpenZFS-3x-Boost-Sync-ZVOL -[5]: https://www.linuxjournal.com/article/6896 -[6]: https://en.wikipedia.org/wiki/Yum_%28software%29 -[7]: https://opensource.com/article/19/7/introduction-gnu-autotools -[8]: https://openzfs.org/wiki/Main_Page -[9]: https://openzfs.github.io/openzfs-docs/Getting%20Started/Fedora.html diff --git a/translated/tech/20201016 Set up ZFS on Linux with yum.md b/translated/tech/20201016 Set up ZFS on Linux with yum.md new file mode 100644 index 0000000000..cb61d4dc55 --- /dev/null +++ b/translated/tech/20201016 Set up ZFS on Linux with yum.md @@ -0,0 +1,132 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Set up ZFS on Linux with yum) +[#]: via: (https://opensource.com/article/20/10/zfs-dnf) +[#]: author: (Sheng Mao https://opensource.com/users/ivzhh) + +在 Linux 上使用 yum 设置 ZFS +====== +在 Fedora 上使用 yum 仓库里来使用最新的 ZFS 特性。 +![Puzzle pieces coming together to form a computer screen][1] + +我是一名 Fedora Linux 用户,我每天都会运行 `yum upgrade`。虽然这个习惯使我能够运行所有最新的软件([Fedora 的四个基础][2]之一的 “First” (第一),它也做到了),但它也会提醒 [ZFS][3] 存储平台和新内核之间的任何不兼容。 + +作为一名开发者,有时我需要最新的 ZFS 分支的新特性。例如,ZFS 2.0.0 包含了一个令人兴奋的新功能,它大大[提高了 ZVOL 同步性能][4],这对我这个 KVM 用户来说至关重要。但这意味着,如果我想使用 2.0.0 分支,我必须自己构建 ZFS。 + +起初,我只是在每次内核更新后从它的 Git 仓库中手动编译 ZFS。如果我忘记了,ZFS 就会在下次启动时无法被识别。幸运的是,我很快就学会了如何为 ZFS 设置动态内核模块支持 ([DKMS][5])。然而,这个解决方案并不完美。首先,它没有利用强大的 [yum][6] 系统,而这个系统可以帮助解决依赖关系和升级。此外,使用 yum 在你自己的包和上游包之间进行切换是非常容易的。 + +在本文中,我将演示如何设置 yum 仓库来打包 ZFS。这个方案有两个步骤: + + 1. 从 ZFS 的 Git 仓库中创建 RPM 包。 + 2. 建立一个 yum 仓库来托管这些包。 + + + +### 创建 RPM 包 + +要创建 RPM 包,你需要安装 RPM 工具链。yum 提供了组来捆绑安装工具: + + +``` +`sudo dnf group install 'C Development Tools and Libraries' 'RPM Development Tools'` +``` + +安装完这些之后,你必须从 ZFS Git 仓库中安装构建 ZFS 所需的所有包。这些包属于三个组: + + 1. [Autotools][7],用于从平台配置中生成构建文件。 + 2. 用于构建 ZFS 内核和用户态工具的库。 + 3. 构建 RPM 包的库。 + + + + +``` +sudo dnf install libtool autoconf automake gettext createrepo \ +    libuuid-devel libblkid-devel openssl-devel libtirpc-devel \ +    lz4-devel libzstd-devel zlib-devel \ +    kernel-devel elfutils-libelf-devel \ +    libaio-devel libattr-devel libudev-devel \ +    python3-devel libffi-devel +``` + +现在你已经准备好创建你自己的包了。 + +### 构建 OpenZFS + +[OpenZFS][8] 提供了优秀的基础设施。要构建它: + + 1. 用 `git` 克隆仓库,并切换到你希望使用的分支/标签。 + 2. 运行 Autotools 生成一个 makefile。 + 3. 运行 `make rpm`,如果一切正常,RPM 文件将被放置在构建文件夹中。 + + + + +``` +$ git clone --branch=zfs-2.0.0-rc3 zfs +$ cd zfs +$ ./autogen.sh +$ ./configure +$ make rpm +``` + +### 建立一个 yum 仓库 + +在 yum 中,仓库是一个服务器或本地路径,包括元数据和 RPM 文件。用户设置一个 INI 配置文件,`yum` 命令会自动解析元数据并下载相应的软件包。 + +Fedora 提供了 `createrepo` 工具来设置 yum 仓库。首先,创建仓库,并将 ZFS 文件夹中的所有 RPM 文件复制到仓库中。然后运行 `createrepo --update` 将所有的包加入到元数据中。 + + +``` +$ sudo mkdir -p /var/lib/zfs.repo +$ sudo createrepo /var/lib/zfs.repo +$ sudo cp *.rpm /var/lib/zfs.repo/ +$ sudo createrepo --update /var/lib/zfs.repo +``` + +在 `/etc/yum.repos.d` 中创建一个新的配置文件来包含仓库路径: + + +``` +$ echo \ +"[zfs-local]\\\nname=ZFS Local\\\nbaseurl=file:///var/lib/zfs.repo\\\nenabled=1\\\ngpgcheck=0" |\ +sudo tee /etc/yum.repos.d/zfs-local.repo + +$ sudo dnf --repo=zfs-local list available --refresh +``` + +终于完成了!你已经有了一个可以使用的 yum 仓库和 ZFS 包。现在你只需要安装它们。 + + +``` +$ sudo dnf install zfs +$ sudo /sbin/modprobe zfs +``` + +运行 `sudo zfs version` 来查看你的用户态和内核工具的版本。恭喜!你拥有了 [Fedora 中的 ZFS][9]。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/zfs-dnf + +作者:[Sheng Mao][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ivzhh +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/puzzle_computer_solve_fix_tool.png?itok=U0pH1uwj (Puzzle pieces coming together to form a computer screen) +[2]: https://docs.fedoraproject.org/en-US/project/#_what_is_fedora_all_about +[3]: https://zfsonlinux.org/ +[4]: https://www.phoronix.com/scan.php?page=news_item&px=OpenZFS-3x-Boost-Sync-ZVOL +[5]: https://www.linuxjournal.com/article/6896 +[6]: https://en.wikipedia.org/wiki/Yum_%28software%29 +[7]: https://opensource.com/article/19/7/introduction-gnu-autotools +[8]: https://openzfs.org/wiki/Main_Page +[9]: https://openzfs.github.io/openzfs-docs/Getting%20Started/Fedora.html From a1f5cee6070b5ef8d9ef0b7481f7b5b51c0917ef Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 22 Oct 2020 08:51:36 +0800 Subject: [PATCH 0523/1156] translating --- ...014 Try Linux on any computer with this bootable USB tool.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201014 Try Linux on any computer with this bootable USB tool.md b/sources/tech/20201014 Try Linux on any computer with this bootable USB tool.md index 57e6b1810b..dcdc1697ae 100644 --- a/sources/tech/20201014 Try Linux on any computer with this bootable USB tool.md +++ b/sources/tech/20201014 Try Linux on any computer with this bootable USB tool.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f7c9c457ce16e0496de3a5ae0a6213a8d0217601 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 22 Oct 2020 14:42:12 +0800 Subject: [PATCH 0524/1156] PRF @geekpi --- ...01013 Install MariaDB or MySQL on Linux.md | 39 ++++++++----------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/translated/tech/20201013 Install MariaDB or MySQL on Linux.md b/translated/tech/20201013 Install MariaDB or MySQL on Linux.md index ad5c67ff1c..ed5ee0c87e 100644 --- a/translated/tech/20201013 Install MariaDB or MySQL on Linux.md +++ b/translated/tech/20201013 Install MariaDB or MySQL on Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Install MariaDB or MySQL on Linux) @@ -9,47 +9,46 @@ 在 Linux 上安装 MariaDB 或 MySQL ====== -开始在 Linux 系统上使用开源的 SQL 数据库。 -![Person standing in front of a giant computer screen with numbers, data][1] -[MariaDB][2] 和 [MySQL][3] 都是使用 SQL 的开源数据库,并且共享相同的原始代码库。MariaDB 是 MySQL 的替代品,因此你可以使用相同的命令 (`mysql`) 与 MySQL 和 MariaDB 数据库进行交互。因此,本文同时适用于 MariaDB 和 MySQL。 +> 开始在 Linux 系统上使用开源的 SQL 数据库吧。 + +![](https://img.linux.net.cn/data/attachment/album/202010/22/144122hkkqrs2dhi9c7kif.jpg) + +[MariaDB][2] 和 [MySQL][3] 都是使用 SQL 的开源数据库,并且共享相同的初始代码库。MariaDB 是 MySQL 的替代品,你可以使用相同的命令(`mysql`)与 MySQL 和 MariaDB 数据库进行交互。因此,本文同时适用于 MariaDB 和 MySQL。 ### 安装 MariaDB -你可以使用你的 Linux 发行版的包管理器安装 MariaDB。在大多数发行版上,MariaDB 分为服务器包和客户端包。服务器包提供了数据库”引擎“,即 MariaDB 在后台运行(通常在物理服务器上)的部分,它监听数据输入或数据输出请求。客户端包提供了 `mysql` 命令,你可以用它来与服务器通信。 +你可以使用你的 Linux 发行版的包管理器安装 MariaDB。在大多数发行版上,MariaDB 分为服务器包和客户端包。服务器包提供了数据库“引擎”,即 MariaDB 在后台运行(通常在物理服务器上)的部分,它监听数据输入或数据输出请求。客户端包提供了 `mysql` 命令,你可以用它来与服务器通信。 在 RHEL、Fedora、CentOS 或类似的发行版上: - ``` -`$ sudo dnf install mariadb mariadb-server` +$ sudo dnf install mariadb mariadb-server ``` 在 Debian、Ubuntu、Elementary 或类似的发行版上: - ``` -`$ sudo apt install mariadb-client mariadb-server` +$ sudo apt install mariadb-client mariadb-server ``` -其他系统可能会以不同的系统打包 MariaDB,所以你可能需要搜索你的软件仓库来了解你的发行版的维护者是如何提供它的。 +其他操作系统可能会以不同的打包系统封装 MariaDB,所以你可能需要搜索你的软件仓库来了解你的发行版的维护者是如何提供它的。 ### 启动 MariaDB -因为 MariaDB 被设计成一部分作为数据库服务器的功能,它可以在一台计算机上运行,并从另一台计算机上进行管理。只要你能访问运行它的计算机,你就可以使用 `mysql` 命令来管理数据库。在写这篇文章时,我在本地计算机上运行了 MariaDB,但你同样可能会与远程系统上托管的 MariaDB 数据库进行交互。 +因为 MariaDB 被设计为部分作为数据库服务器,它可以在一台计算机上运行,并从另一台计算机上进行管理。只要你能访问运行它的计算机,你就可以使用 `mysql` 命令来管理数据库。在写这篇文章时,我在本地计算机上运行了 MariaDB,但你同样可与远程系统上托管的 MariaDB 数据库进行交互。 在启动 MariaDB 之前,你必须创建一个初始数据库。在初始化其文件结构时,你应该定义你希望 MariaDB 使用的用户。默认情况下,MariaDB 使用当前用户,但你可能希望它使用一个专用的用户帐户。你的包管理器可能为你配置了一个系统用户和组。使用 `grep` 查找是否有一个 `mysql` 组: ``` $ grep mysql /etc/group -mysql❌27: +mysql:x:27: ``` -你也可以在 `/etc/passwd` 中寻找这个专门的用户,但通常情况下,有组的地方就有用户。如果没有专门的 `mysql` 用户和组,可以在 `/etc/group` 中寻找一个明显的替代(比如 `mariadb`)。如果没有,请阅读你的发行版文档来了解 MariaDB 是如何运行的。 +你也可以在 `/etc/passwd` 中寻找这个专门的用户,但通常情况下,有组就会有用户。如果没有专门的 `mysql` 用户和组,可以在 `/etc/group` 中寻找一个明显的替代品(比如 `mariadb`)。如果没有,请阅读你的发行版文档来了解 MariaDB 是如何运行的。 假设你的安装使用 `mysql`,初始化数据库环境: - ``` $ sudo mysql_install_db --user=mysql Installing MariaDB/MySQL system tables in '/var/lib/mysql'... @@ -59,7 +58,6 @@ OK 这一步的结果显示了接下来你必须执行的配置 MariaDB 的任务: - ``` PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER ! To do so, start the server, then issue the following commands: @@ -75,23 +73,20 @@ databases and anonymous user created by default.  This is strongly recommended for production servers. ``` -使用你的发行版的 init 系统启动 MariaDB: - +使用你的发行版的初始化系统启动 MariaDB: ``` -`$ sudo systemctl start mariadb` +$ sudo systemctl start mariadb ``` 在启动时启用 MariaDB 服务器: - ``` -`$ sudo systemctl enable --now mariadb` +$ sudo systemctl enable --now mariadb ``` 现在你已经有了一个 MariaDB 服务器,为它设置一个密码: - ``` mysqladmin -u root password 'myreallysecurepassphrase' mysqladmin -u root -h $(hostname) password 'myreallysecurepassphrase' @@ -106,7 +101,7 @@ via: https://opensource.com/article/20/10/mariadb-mysql-linux 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From bb7405549a49fb91d7cedbc98a92c3058f52ea09 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 22 Oct 2020 14:42:51 +0800 Subject: [PATCH 0525/1156] PUB @geekpi https://linux.cn/article-12743-1.html --- .../20201013 Install MariaDB or MySQL on Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201013 Install MariaDB or MySQL on Linux.md (98%) diff --git a/translated/tech/20201013 Install MariaDB or MySQL on Linux.md b/published/20201013 Install MariaDB or MySQL on Linux.md similarity index 98% rename from translated/tech/20201013 Install MariaDB or MySQL on Linux.md rename to published/20201013 Install MariaDB or MySQL on Linux.md index ed5ee0c87e..62bd23b48e 100644 --- a/translated/tech/20201013 Install MariaDB or MySQL on Linux.md +++ b/published/20201013 Install MariaDB or MySQL on Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12743-1.html) [#]: subject: (Install MariaDB or MySQL on Linux) [#]: via: (https://opensource.com/article/20/10/mariadb-mysql-linux) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From 0c4790183f26cd2bef5edc3adeee0d12d2c18972 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 23 Oct 2020 08:43:54 +0800 Subject: [PATCH 0526/1156] translated --- ...t Cache and Reclaim Precious Disk Space.md | 123 ------------------ ...t Cache and Reclaim Precious Disk Space.md | 123 ++++++++++++++++++ 2 files changed, 123 insertions(+), 123 deletions(-) delete mode 100644 sources/tech/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md create mode 100644 translated/tech/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md diff --git a/sources/tech/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md b/sources/tech/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md deleted file mode 100644 index 60496ca88d..0000000000 --- a/sources/tech/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md +++ /dev/null @@ -1,123 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Clear Apt Cache and Reclaim Precious Disk Space) -[#]: via: (https://itsfoss.com/clear-apt-cache/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -How to Clear Apt Cache and Reclaim Precious Disk Space -====== - -How do you clear the apt cache? You simply use this [apt-get command][1] option: - -``` -sudo apt-get clean -``` - -But there is more to cleaning apt cache than just running the above command. - -In this tutorial, I’ll explain what is apt cache, why is it used, why you would want to clean it and what other things you should know about purging apt cache. - -I am going to use Ubuntu here for reference but since this is about apt, it is applicable to [Debian][2] and other Debian and Ubuntu-based distributions like Linux Mint, Deepin and more. - -### What is apt cache? Why is it used? - -When you install a package using apt-get or [apt command][3] (or DEB packages in the software center), the apt [package manager][4] downloads the package and its dependencies in .deb format and keeps it in /var/cache/apt/archives folder. - -![][5] - -While downloading, apt keeps the deb package in /var/cache/apt/archives/partial directory. When the deb package is downloaded completely, it is moved out to /var/cache/apt/archives directory. - -Once the deb files for the package and its dependencies are downloaded, your system [installs the package from these deb files][6]. - -Now you see the use of cache? The system needs a place to keep the package files somewhere before installing them. If you are aware of the [Linux directory structure][7], you would understand that /var/cache is the appropriate here. - -#### Why keep the cache after installing the package? - -The downloaded deb files are not removed from the directory immediately after the installation is completed. If you remove a package and reinstall it, your system will look for the package in the cache and get it from here instead of downloading it again (as long as the package version in the cache is the same as the version in remote repository). - -This is much quicker. You can try this on your own and see how long a program takes to install the first time, remove it and install it again. You can [use the time command to find out how long does it take to complete a command][8]: _**time sudo apt install package_name**_. - -I couldn’t find anything concrete on the cache retention policy so I cannot say how long does Ubuntu keep the downloaded packages in the cache. - -#### Should you clean apt cache? - -It depends on you. If you are running out of disk space on root, you could clean apt cache and reclaim the disk space. It is one of the [several ways to free up disk space on Ubuntu][9]. - -Check how much space the cache takes with the [du command][10]: - -![][11] - -Sometime this could go in 100s of MB and this space could be crucial if you are running a server. - -#### How to clean apt cache? - -If you want to clear the apt cache, there is a dedicated command to do that. So don’t go about manually deleting the cache directory. Simply use this command: - -``` -sudo apt-get clean -``` - -This will remove the content of the /var/cache/apt/archives directory (except the lock file). Here’s a dry run (simulation) of what the apt-get clean command deletes: - -![][12] - -There is another command that deals with cleaning the apt cache: - -``` -sudo apt-get autoclean -``` - -Unlike clean, autoclean only removes the packages that are not possible to download from the repositories. - -Suppose you installed package xyz. Its deb files remain in the cache. If there is now a new version of xyz package available in the repository, this existing xyz package in the cache is now outdated and useless. The autoclean option will delete such useless packages that cannot be downloaded anymore. - -#### Is it safe to delete apt cache? - -![][13] - -Yes. It is completely safe to clear the cache created by apt. It won’t negatively impact the performance of the system. Maybe if you reinstall the package it will take a bit longer to download but that’s about it. - -Again, use the apt-get clean command. It is quicker and easier than manually deleting cache directory. - -You may also use graphical tools like [Stacer][14] or [Bleachbit][15] for this purpose. - -#### Conclusion - -At the time of writing this article, there is no built-in option with the newer apt command. However, keeping backward compatibility, _**apt clean**_ can still be run (which should be running apt-get clean underneath it). Please refer to this article to [know the difference between apt and apt-get][16]. - -I hope you find this explanation about apt cache interesting. It is not something essential but knowing this little things make you more knowledgeable about your Linux system. - -I welcome your feedback and suggestions in the comment section. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/clear-apt-cache/ - -作者:[Abhishek Prakash][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/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/apt-get-linux-guide/ -[2]: https://www.debian.org/ -[3]: https://itsfoss.com/apt-command-guide/ -[4]: https://itsfoss.com/package-manager/ -[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-get-clean-cache.png?resize=800%2C470&ssl=1 -[6]: https://itsfoss.com/install-deb-files-ubuntu/ -[7]: https://linuxhandbook.com/linux-directory-structure/ -[8]: https://linuxhandbook.com/time-command/ -[9]: https://itsfoss.com/free-up-space-ubuntu-linux/ -[10]: https://linuxhandbook.com/find-directory-size-du-command/ -[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-archive-size.png?resize=800%2C233&ssl=1 -[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-get-clean-ubuntu.png?resize=800%2C339&ssl=1 -[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/Clear-Apt-Cache.png?resize=800%2C450&ssl=1 -[14]: https://itsfoss.com/optimize-ubuntu-stacer/ -[15]: https://itsfoss.com/use-bleachbit-ubuntu/ -[16]: https://itsfoss.com/apt-vs-apt-get-difference/ diff --git a/translated/tech/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md b/translated/tech/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md new file mode 100644 index 0000000000..b1cabdd910 --- /dev/null +++ b/translated/tech/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md @@ -0,0 +1,123 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Clear Apt Cache and Reclaim Precious Disk Space) +[#]: via: (https://itsfoss.com/clear-apt-cache/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何清除 apt 缓存来回收宝贵的磁盘空间 +====== + +如何清除 apt 缓存?你只需使用这个 [apt-get 命令][1]选项: + +``` +sudo apt-get clean +``` + +但是,清理 apt 缓存不仅仅是运行上面的命令。 + +在本教程中,我将解释什么是 apt 缓存、为什么会使用它、为什么你要清理它,以及关于清理 apt 缓存你应该知道的其他事情。 + +我将在这里使用 Ubuntu 作为参考,但由于这是关于 apt 的,因此它也适用于 [Debian][2] 和其他基于 Debian 和 Ubuntu 的发行版,比如 Linux Mint、Deepin 等等。 + +### 什么是 apt 缓存?为什么要使用它? + +当你使用 apt-get 或 [apt 命令][3]安装一个软件包时(或在软件中心安装 DEB 包),apt [包管理器][4]会以 .deb 格式下载软件包及其依赖关系,并将其保存在 /var/cache/apt/archives 文件夹中。 + +![][5] + +下载时,apt 将 deb 包保存在 /var/cache/apt/archives/partial 目录下。当 deb 包完全下载完毕后,它会被移到 /var/cache/apt/archives 目录下。 + +下载完包的 deb 文件及其依赖关系后,你的系统就会[从这些 deb 文件中安装包][6]。 + +现在你明白缓存的用途了吧?系统在安装软件包之前,需要一个地方把软件包文件存放在某个地方。如果你了解 [Linux 目录结构][7],你就会明白,/var/cache 是合适的地方。 + +#### 为什么安装包后要保留缓存? + +下载的 deb 文件在安装完成后并不会立即从目录中删除。如果你删除了一个软件包,然后重新安装,你的系统会在缓存中查找这个软件包,并从这里获取它,而不是重新下载(只要缓存中的软件包版本与远程仓库中的版本相同)。 + +这样就快多了。你可以自己尝试一下,看看一个程序第一次安装,删除后再安装需要多长时间。你可以[使用 time 命令来了解完成一个命令需要多长时间][8]:_**time sudo apt install package_name**_ + +我找不到任何关于缓存保留策略的内容,所以我无法说明 Ubuntu 会在缓存中保留下载的包多长时间。 + +#### 你应该清理 apt 缓存吗? + +这取决于你。如果你的根目录下的磁盘空间用完了,你可以清理 apt cache 来回收磁盘空间。这是 [Ubuntu 上释放磁盘空间的几种方法][9]之一。 + +使用 [du 命令][10]检查缓存占用了多少空间: + +![][11] + +有的时候,这可能会占用几百兆,如果你正在运行一个服务器,这些空间可能是至关重要的。 + +#### 如何清理 apt 缓存? + +如果你想清除 apt 缓存,有一个专门的命令来做。所以不要去手动删除缓存目录。只要使用这个命令就可以了: + +``` +sudo apt-get clean +``` + +这将删除 /var/cache/apt/archives 目录的内容(除了锁文件)。以下是 apt-get clean 命令模拟删除内容: + +![][12] + +还有一个命令是关于清理 apt 缓存的: + +``` +sudo apt-get autoclean +``` + +与 clean 不同的是,autoclean 只删除那些无法从仓库中下载的包。 + +假设你安装了包 xyz。它的 deb 文件仍然保留在缓存中。如果现在仓库中有新的 xyz 包,那么缓存中现有的这个 xyz 包就已经过时了,没有用了。autoclean 选项会删除这种不能再下载的无用包。 + +#### 删除 apt 缓存安全吗? + +![][13] + +是的,清除 apt 创建的缓存是完全安全的。它不会对系统的性能产生负面影响。也许如果你重新安装软件包,下载时间会更长一些,但也仅此而已。 + +再说一次,使用 apt-get clean 命令。它比手动删除缓存目录更快、更简单。 + +你也可以使用像 [Stacer][14] 或 [Bleachbit][15] 这样的图形工具来实现这个目的。 + +#### 总结 + +在写这篇文章的时候,新的 apt 命令没有内置选项。不过,为了保持向后的兼容性,仍然可以运行 _**apt clean**_ (内部应该是运行 apt-get clean)。请参考这篇文章来[了解 apt 和 apt-get 的区别][16]。 + +我希望你觉得这个关于 apt 缓存的解释很有趣。虽然这不是什么必要的东西,但了解这些小东西会让你对你的 Linux 系统更加了解。 + +欢迎你在评论区提出反馈和建议。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/clear-apt-cache/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/apt-get-linux-guide/ +[2]: https://www.debian.org/ +[3]: https://itsfoss.com/apt-command-guide/ +[4]: https://itsfoss.com/package-manager/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-get-clean-cache.png?resize=800%2C470&ssl=1 +[6]: https://itsfoss.com/install-deb-files-ubuntu/ +[7]: https://linuxhandbook.com/linux-directory-structure/ +[8]: https://linuxhandbook.com/time-command/ +[9]: https://itsfoss.com/free-up-space-ubuntu-linux/ +[10]: https://linuxhandbook.com/find-directory-size-du-command/ +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-archive-size.png?resize=800%2C233&ssl=1 +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-get-clean-ubuntu.png?resize=800%2C339&ssl=1 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/Clear-Apt-Cache.png?resize=800%2C450&ssl=1 +[14]: https://itsfoss.com/optimize-ubuntu-stacer/ +[15]: https://itsfoss.com/use-bleachbit-ubuntu/ +[16]: https://itsfoss.com/apt-vs-apt-get-difference/ From fb584659b35bada03f2de724b4760ade8485c67a Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 23 Oct 2020 08:49:46 +0800 Subject: [PATCH 0527/1156] translating --- ...rop the Ailing OpenOffice and Support LibreOffice Instead.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md b/sources/tech/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md index 7f1b94ebf3..f7114ef6b3 100644 --- a/sources/tech/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md +++ b/sources/tech/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 7415c310be34a52b054cf0e8038fb7d2104e456c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 24 Oct 2020 09:01:40 +0800 Subject: [PATCH 0528/1156] PRF @gxlct008 --- ...180414 Go on very small hardware Part 2.md | 130 ++++++++---------- 1 file changed, 59 insertions(+), 71 deletions(-) diff --git a/translated/tech/20180414 Go on very small hardware Part 2.md b/translated/tech/20180414 Go on very small hardware Part 2.md index 4eaf203686..4e7aad4f13 100644 --- a/translated/tech/20180414 Go on very small hardware Part 2.md +++ b/translated/tech/20180414 Go on very small hardware Part 2.md @@ -1,6 +1,6 @@ [#]: collector: (oska874) [#]: translator: (gxlct008) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Go on very small hardware Part 2) @@ -10,17 +10,17 @@ Go 语言在极小硬件上的运用(二) ============================================================ +![](https://img.linux.net.cn/data/attachment/album/201909/24/210256yihkuy8kcigugr2h.png) - [![STM32F030F4P6](https://ziutek.github.io/images/mcu/f030-demo-board/board.jpg)][1] +在本文的 [第一部分][2] 的结尾,我承诺要写关于接口的内容。我不想在这里写有关接口或完整或简短的讲义。相反,我将展示一个简单的示例,来说明如何定义和使用接口,以及如何利用无处不在的 `io.Writer` 接口。还有一些关于反射reflection半主机semihosting的内容。 +![STM32F030F4P6](https://ziutek.github.io/images/mcu/f030-demo-board/board.jpg)] -在本文的 [第一部分][2] 的结尾,我承诺要写关于 _interfaces_ 的内容。我不想在这里写有关接口的完整甚至简短的讲义。相反,我将展示一个简单的示例,来说明如何定义和使用接口,以及如何利用无处不在的 _io.Writer_ 接口。还有一些关于 _reflection_ 和 _semihosting_ 的内容。 - -接口是 Go 语言的重要组成部分。如果您想了解更多有关它们的信息,我建议您阅读 [Effective Go][3] 和 [Russ Cox 的文章][4]。 +接口是 Go 语言的重要组成部分。如果你想了解更多有关它们的信息,我建议你阅读《[高效的 Go 编程][3]》 和 [Russ Cox 的文章][4]。 ### 并发 Blinky – 回顾 -当您阅读前面示例的代码时,您可能会注意到一个违反直觉的方式来打开或关闭 LED。 _Set_ 方法用于关闭 LED,_Clear_ 方法用于打开 LED。这是由于在 漏极开路配置open-drain configuration 下驱动了 LED。我们可以做些什么来减少代码的混乱? 让我们用 _On_ 和 _Off_ 方法来定义 _LED_ 类型: +当你阅读前面示例的代码时,你可能会注意到一中打开或关闭 LED 的反直觉方式。 `Set` 方法用于关闭 LED,`Clear` 方法用于打开 LED。这是由于在 漏极开路配置open-drain configuration 下驱动了 LED。我们可以做些什么来减少代码的混乱?让我们用 `On` 和 `Off` 方法来定义 `LED` 类型: ``` type LED struct { @@ -34,15 +34,13 @@ func (led LED) On() { func (led LED) Off() { led.pin.Set() } - ``` 现在我们可以简单地调用 `led.On()` 和 `led.Off()`,这不会再引起任何疑惑了。 +在前面的所有示例中,我都尝试使用相同的 漏极开路配置open-drain configuration来避免代码复杂化。但是在最后一个示例中,对于我来说,将第三个 LED 连接到 GND 和 PA3 引脚之间并将 PA3 配置为推挽模式push-pull mode会更容易。下一个示例将使用以此方式连接的 LED。 -在前面的所有示例中,我都尝试使用相同的 漏极开路配置open-drain configuration来 避免代码复杂化。但是在最后一个示例中,对于我来说,将第三个 LED 连接到 GND 和 PA3 引脚之间并将 PA3 配置为推挽模式push-pull mode会更容易。下一个示例将使用以此方式连接的 LED。 - -但是我们的新 _LED_ 类型不支持推挽配置。实际上,我们应该将其称为 _OpenDrainLED_,并定义另一个类型 _PushPullLED_: +但是我们的新 `LED` 类型不支持推挽配置,实际上,我们应该将其称为 `OpenDrainLED`,并定义另一个类型 `PushPullLED`: ``` type PushPullLED struct { @@ -56,10 +54,9 @@ func (led PushPullLED) On() { func (led PushPullLED) Off() { led.pin.Clear() } - ``` -请注意,这两种类型都具有相同的方法,它们的工作方式也相同。如果在 LED 上运行的代码可以同时使用这两种类型,而不必注意当前使用的是哪种类型,那就太好了。 _interface type_ 可以提供帮助: +请注意,这两种类型都具有相同的方法,它们的工作方式也相同。如果在 LED 上运行的代码可以同时使用这两种类型,而不必注意当前使用的是哪种类型,那就太好了。 接口类型可以提供帮助: ``` package main @@ -134,21 +131,20 @@ func main() { ``` -我们定义了 _LED_ 接口,它有两个方法: _On_ 和 _Off_。 _PushPullLED_ 和 _OpenDrainLED_ 类型代表两种驱动 LED 的方式。我们还定义了两个用作构造函数的 _Make_ _*LED_ 函数。这两种类型都实现了 _LED_ 接口,因此可以将这些类型的值赋给 _LED_ 类型的变量: +我们定义了 `LED` 接口,它有两个方法: `On` 和 `Off`。 `PushPullLED` 和 `OpenDrainLED` 类型代表两种驱动 LED 的方式。我们还定义了两个用作构造函数的 `Make*LED` 函数。这两种类型都实现了 `LED` 接口,因此可以将这些类型的值赋给 `LED` 类型的变量: ``` led1 = MakeOpenDrainLED(gpio.A.Pin(4)) led2 = MakePushPullLED(gpio.A.Pin(3)) ``` -在这种情况下,可赋值性在编译时检查。赋值后,_led1_ 变量包含一个 `OpenDrainLED{gpio.A.Pin(4)}`,以及一个指向 _OpenDainLED_ 类型的方法集的指针。 `led1.On()` 调用大致对应于以下 C 代码: +在这种情况下,可赋值性assignability在编译时检查。赋值后,`led1` 变量包含一个 `OpenDrainLED{gpio.A.Pin(4)}`,以及一个指向 `OpenDrainLED` 类型的方法集的指针。 `led1.On()` 调用大致对应于以下 C 代码: ``` led1.methods->On(led1.value) ``` -如您所见,如果仅考虑函数调用的开销,这是相当便宜的抽象。 - +如你所见,如果仅考虑函数调用的开销,这是相当廉价的抽象。 但是,对接口的任何赋值都会导致包含有关已赋值类型的大量信息。对于由许多其他类型组成的复杂类型,可能会有很多信息: @@ -168,7 +164,7 @@ $ arm-none-eabi-size cortexm0.elf 10312 196 212 10720 29e0 cortexm0.elf ``` -生成的二进制文件仍然包含一些有关类型的必要信息和关于所有导出方法(带有名称)的完整信息。在运行时,主要是当您将存储在接口变量中的一个值赋值给任何其他变量时,需要此信息来检查可赋值性。 +生成的二进制文件仍然包含一些有关类型的必要信息和关于所有导出方法(带有名称)的完整信息。在运行时,主要是当你将存储在接口变量中的一个值赋值给任何其他变量时,需要此信息来检查可赋值性。 我们还可以通过重新编译所导入的包来删除它们的类型和字段名称: @@ -203,28 +199,23 @@ Flash page at addr: 0x08002800 erased ``` -我没有将 NRST 信号连接到编程器,因此无法使用 _-reset_ 选项,必须按下 reset 按钮才能运行程序。 +我没有将 NRST 信号连接到编程器,因此无法使用 `-reset` 选项,必须按下复位按钮才能运行程序。 ![Interfaces](https://ziutek.github.io/images/mcu/f030-demo-board/interfaces.png) -看来,_st-flash_ 与此板配合使用有点不可靠 (通常需要重置 ST-LINK 加密狗)。此外,当前版本不会通过 SWD 发出 reset 命令 (仅使用 NRST 信号)。 软件重置是不现实的,但是它通常是有效的,缺少它会将会带来不便。对于电路板-程序员board-programmer 组合 _OpenOCD_ 工作得更好。 +看来,`st-flash` 与此板配合使用有点不可靠(通常需要复位 ST-LINK 加密狗)。此外,当前版本不会通过 SWD 发出复位命令(仅使用 NRST 信号)。软件复位是不现实的,但是它通常是有效的,缺少它会将会带来不便。对于板卡程序员board-programmer 来说 OpenOCD 工作得更好。 ### UART UART(通用异步收发传输器Universal Aynchronous Receiver-Transmitter)仍然是当今微控制器最重要的外设之一。它的优点是以下属性的独特组合: * 相对较高的速度, - * 仅两条信号线(在 半双工half-duplex 通信的情况下甚至一条), - * 角色对称, - * 关于新数据的 同步带内信令synchronous in-band signaling(起始位), - * 在传输 words 内的精确计时。 - -这使得最初用于传输由 7-9 位 words 组成的异步消息的 UART,也被用于有效地实现各种其他物理协议,例如被 [WS28xx LEDs][7] 或 [1-wire][8] 设备使用的协议。 +这使得最初用于传输由 7-9 位的字组成的异步消息的 UART,也被用于有效地实现各种其他物理协议,例如被 [WS28xx LEDs][7] 或 [1-wire][8] 设备使用的协议。 但是,我们将以其通常的角色使用 UART:从程序中打印文本消息。 @@ -286,7 +277,7 @@ var ISRs = [...]func(){ ``` -您会发现此代码可能有些复杂,但目前 STM32 HAL 中没有更简单的 UART 驱动程序(在某些情况下,简单的轮询驱动程序可能会很有用)。 _usart.Driver_ 是使用 DMA 和中断来卸载 CPU 的高效驱动程序。 +你会发现此代码可能有些复杂,但目前 STM32 HAL 中没有更简单的 UART 驱动程序(在某些情况下,简单的轮询驱动程序可能会很有用)。 `usart.Driver` 是使用 DMA 和中断来减轻 CPU 负担的高效驱动程序。 STM32 USART 外设提供传统的 UART 及其同步版本。要将其用作输出,我们必须将其 Tx 信号连接到正确的 GPIO 引脚: @@ -295,13 +286,13 @@ tx.Setup(&gpio.Config{Mode: gpio.Alt}) tx.SetAltFunc(gpio.USART1_AF1) ``` -在 Tx-only 模式下配置 _usart.Driver_ (rxdma 和 rxbuf 设置为 nil): +在 Tx-only 模式下配置 `usart.Driver` (rxdma 和 rxbuf 设置为 nil): ``` tts = usart.NewDriver(usart.USART1, d.Channel(2, 0), nil, nil) ``` -我们使用它的 _WriteString_ 方法来打印这句名句。让我们清理所有内容并编译该程序: +我们使用它的 `WriteString` 方法来打印这句名言。让我们清理所有内容并编译该程序: ``` $ cd $HOME/emgo @@ -313,15 +304,15 @@ $ arm-none-eabi-size cortexm0.elf 12728 236 176 13140 3354 cortexm0.elf ``` -要查看某些内容,您需要在 PC 中使用 UART 外设。 +要查看某些内容,你需要在 PC 中使用 UART 外设。 **请勿使用 RS232 端口或 USB 转 RS232 转换器!** -STM32 系列使用 3.3V 逻辑,但是 RS232 可以产生 -15 V ~ +15 V 的电压,这可能会损坏您的 MCU。您需要使用 3.3 V 逻辑的 USB 转 UART 转换器。流行的转换器基于 FT232 或 CP2102 芯片。 +STM32 系列使用 3.3V 逻辑,但是 RS232 可以产生 -15 V ~ +15 V 的电压,这可能会损坏你的 MCU。你需要使用 3.3V 逻辑的 USB 转 UART 转换器。流行的转换器基于 FT232 或 CP2102 芯片。 ![UART](https://ziutek.github.io/images/mcu/f030-demo-board/uart.jpg) -您还需要一些终端仿真程序 (我更喜欢 [picocom][9])。刷新新图像,运行终端仿真器,然后按几次 reset 按钮: +你还需要一些终端仿真程序(我更喜欢 [picocom][9])。刷新新图像,运行终端仿真器,然后按几次复位按钮: ``` $ openocd -d0 -f interface/stlink.cfg -f target/stm32f0x.cfg -c 'init; program cortexm0.elf; reset run; exit' @@ -377,13 +368,13 @@ Hello, World! Hello, World! ``` -每次按下 reset 按钮都会产生新的 “Hello,World!”行。一切都在按预期进行。 +每次按下复位按钮都会产生新的 “Hello,World!”行。一切都在按预期进行。 要查看此 MCU 的 双向bi-directional UART 代码,请查看 [此示例][10]。 ### io.Writer 接口 -_io.Writer_ 接口可能是 Go 中第二种最常用的接口类型,紧接在 _error_ 接口之后。其定义如下所示: +`io.Writer` 接口可能是 Go 中第二种最常用的接口类型,仅次于 `error` 接口。其定义如下所示: ``` type Writer interface { @@ -391,7 +382,7 @@ type Writer interface { } ``` - _usart.Driver_ 实现了 _io.Writer_ ,因此我们可以替换: +`usart.Driver` 实现了 `io.Writer`,因此我们可以替换: ``` tts.WriteString("Hello, World!\r\n") @@ -403,15 +394,15 @@ tts.WriteString("Hello, World!\r\n") io.WriteString(tts, "Hello, World!\r\n") ``` -此外,您需要将 _io_ 包添加到 _import_ 部分。 +此外,你需要将 `io` 包添加到 `import` 部分。 -_io.WriteString_ 函数的声明如下所示: +`io.WriteString` 函数的声明如下所示: ``` func WriteString(w Writer, s string) (n int, err error) ``` -如您所见,_io.WriteString_ 允许使用实现了 _io.Writer_ 接口的任何类型来编写字符串。在内部,它检查基础类型是否具有 _WriteString_ 方法,并使用该方法代替 _Write_ (如果可用)。 +如你所见,`io.WriteString` 允许使用实现了 `io.Writer` 接口的任何类型来编写字符串。在内部,它检查基础类型是否具有 `WriteString` 方法,并使用该方法代替 `Write`(如果可用)。 让我们编译修改后的程序: @@ -422,7 +413,7 @@ $ arm-none-eabi-size cortexm0.elf 15456 320 248 16024 3e98 cortexm0.elf ``` -如您所见,_io.WriteString_ 导致二进制文件的大小显着增加:15776-12964 = 2812字节。 Flash 上没有太多空间了。是什么引起了这么大规模的增长? +如你所见,`io.WriteString` 导致二进制文件的大小显着增加:15776-12964 = 2812 字节。 Flash 上没有太多空间了。是什么引起了这么大规模的增长? 使用这个命令: @@ -430,7 +421,7 @@ $ arm-none-eabi-size cortexm0.elf arm-none-eabi-nm --print-size --size-sort --radix=d cortexm0.elf ``` -我们可以打印两种情况下按其大小排序的所有符号。通过过滤和分析获得的数据(awk,diff),我们可以找到大约 80 个新符号。最大的十个如下所示: +我们可以打印两种情况下按其大小排序的所有符号。通过过滤和分析获得的数据(`awk`,`diff`),我们可以找到大约 80 个新符号。最大的十个如下所示: ``` > 00000062 T stm32$hal$usart$Driver$DisableRx @@ -444,9 +435,9 @@ arm-none-eabi-nm --print-size --size-sort --radix=d cortexm0.elf > 00000660 T stm32$hal$usart$Driver$Read ``` -因此,即使我们不使用 _usart.Driver.Read_ 方法进行编译,也与 _DisableRx_、_RxDMAISR_、_EnableRx_ 以及上面未提及的其他方法相同。不幸的是,如果您为接口赋值了一些内容,那么它的完整方法集是必需的(包含所有依赖项)。对于使用大多数方法的大型程序来说,这不是问题。但是对于我们这种极简的情况而言,这是一个巨大的负担。 +因此,即使我们不使用 `usart.Driver.Read` 方法,但它被编译进来了,与 `DisableRx`、`RxDMAISR`、`EnableRx` 以及上面未提及的其他方法一样。不幸的是,如果你为接口赋值了一些内容,就需要它的完整方法集(包含所有依赖项)。对于使用大多数方法的大型程序来说,这不是问题。但是对于我们这种极简的情况而言,这是一个巨大的负担。 -我们已经接近 MCU 的极限,但让我们尝试打印一些数字(您需要在 _import_ 部分中用 _strconv_ 替换 _io_ 包): +我们已经接近 MCU 的极限,但让我们尝试打印一些数字(你需要在 `import` 部分中用 `strconv` 替换 `io` 包): ``` func main() { @@ -469,8 +460,7 @@ func main() { } ``` -与使用 _io.WriteString_ 函数的情况一样,_strconv.WriteInt_ 的第一个参数的类型为 _io.Writer_ 。 - +与使用 `io.WriteString` 函数的情况一样,`strconv.WriteInt` 的第一个参数的类型为 `io.Writer`。 ``` $ egc @@ -479,7 +469,7 @@ $ egc exit status 1 ``` -这一次我们的空间用完了。让我们试着精简一下有关类型的信息: +这一次我们的空间超出的不多。让我们试着精简一下有关类型的信息: ``` $ cd $HOME/emgo @@ -500,7 +490,7 @@ hex(a) = c hex(b) = -7b ``` -Emgo 中的 _strconv_ 包与 Go 中的原型有很大的不同。 它旨在直接用于写入格式化的数字,并且在许多情况下可以替换繁重的 _fmt_ 包。 这就是为什么函数名称以 _Write_ 而不是 _Format_ 开头,并具有额外的两个参数的原因。 以下是其用法示例: +Emgo 中的 `strconv` 包与 Go 中的原型有很大的不同。它旨在直接用于写入格式化的数字,并且在许多情况下可以替换沉重的 `fmt` 包。 这就是为什么函数名称以 `Write` 而不是 `Format` 开头,并具有额外的两个参数的原因。 以下是其用法示例: ``` func main() { @@ -536,7 +526,7 @@ func main() { ### Unix 流 和 莫尔斯电码Morse code -得益于事实上大多数写入功能的函数都使用 _io.Writer_ 而不是具体类型(例如 C 中的 _FILE_ ),因此我们获得了类似于 _Unix stream_ 的功能。在 Unix 中,我们可以轻松地组合简单的命令来执行更大的任务。例如,我们可以通过以下方式将文本写入文件: +由于大多数写入的函数都使用 `io.Writer` 而不是具体类型(例如 C 中的 `FILE` ),因此我们获得了类似于 Unix stream 的功能。在 Unix 中,我们可以轻松地组合简单的命令来执行更大的任务。例如,我们可以通过以下方式将文本写入文件: ``` echo "Hello, World!" > file.txt @@ -544,13 +534,13 @@ echo "Hello, World!" > file.txt `>` 操作符将前面命令的输出流写入文件。还有 `|` 操作符,用于连接相邻命令的输出流和输入流。 +多亏了流,我们可以轻松地转换/过滤任何命令的输出。例如,要将所有字母转换为大写,我们可以通过 `tr` 命令过滤 `echo` 的输出: -多亏了流,我们可以轻松地转换/过滤任何命令的输出。例如,要将所有字母转换为大写,我们可以通过 _tr_ 命令过滤 echo 的输出: ``` echo "Hello, World!" | tr a-z A-Z > file.txt ``` -为了显示 _io.Writer_ 和 Unix 流之间的类比,让我们编写以下代码: +为了显示 `io.Writer` 和 Unix 流之间的类比,让我们编写以下代码: ``` io.WriteString(tts, "Hello, World!\r\n") @@ -628,7 +618,7 @@ var morseSymbols = [...]morseSymbol{ } ``` -您可以在 [这里][11] 找到完整的 _morseSymbols_ 数组。 `//emgo:const` 指令确保 _morseSymbols_ 数组不会被复制到 RAM 中。 +你可以在 [这里][11] 找到完整的 `morseSymbols` 数组。 `//emgo:const` 指令确保 `morseSymbols` 数组不会被复制到 RAM 中。 现在我们可以通过两种方式打印句子: @@ -642,10 +632,9 @@ func main() { } ``` -我们使用指向 _MorseWriter_ `&MorseWriter{tts}` 的指针而不是简单的 `MorseWriter{tts}` 值,因为 _MorseWriter_ 太大,不适合接口变量。 +我们使用指向 `MorseWriter` `&MorseWriter{tts}` 的指针而不是简单的 `MorseWriter{tts}` 值,因为 `MorseWriter` 太大,不适合接口变量。 - -与 Go 不同,Emgo 不会为存储在接口变量中的值动态分配内存。接口类型的大小受限制,等于三个指针(适合 _slice_ )或两个 _float64_(适合 _complex128_ )的大小,以较大者为准。它可以直接存储所有基本类型和小型 “结构体/数组” 的值,但是对于较大的值,您必须使用指针。 +与 Go 不同,Emgo 不会为存储在接口变量中的值动态分配内存。接口类型的大小受限制,相当于三个指针(适合 `slice` )或两个 `float64`(适合 `complex128`)的大小,以较大者为准。它可以直接存储所有基本类型和小型 “结构体/数组” 的值,但是对于较大的值,你必须使用指针。 让我们编译此代码并查看其输出: @@ -661,9 +650,9 @@ Hello, World! .... . .-.. .-.. --- --..-- .-- --- .-. .-.. -.. ---. ``` -### 终极 Blinky +### 终极闪烁 -_Blinky_ 等效于 _Hello,World!_ 程序的硬件。一旦有了 Morse 编码器,我们就可以轻松地将两者结合起来以获得 _Ultimate Blinky_ 程序: +Blinky 是等效于 “Hello,World!” 程序的硬件。一旦有了摩尔斯编码器,我们就可以轻松地将两者结合起来以获得终极闪烁程序: ``` package main @@ -726,7 +715,7 @@ func main() { ``` -在上面的示例中,我省略了 _MorseWriter_ 类型的定义,因为它已在前面展示过。完整版可通过 [这里][12] 获取。让我们编译它并运行: +在上面的示例中,我省略了 `MorseWriter` 类型的定义,因为它已在前面展示过。完整版可通过 [这里][12] 获取。让我们编译它并运行: ``` $ egc @@ -739,9 +728,9 @@ $ arm-none-eabi-size cortexm0.elf ### 反射 -是的,Emgo 支持 [反射][13]。 _reflect_ 包尚未完成,但是已完成的部分足以实现 _fmt.Print_ 函数族了。来看看我们可以在小型 MCU 上做什么。 +是的,Emgo 支持 [反射][13]。`reflect` 包尚未完成,但是已完成的部分足以实现 `fmt.Print` 函数族了。来看看我们可以在小型 MCU 上做什么。 -为了减少内存使用,我们将使用 [semihosting][14] 作为标准输出。为了方便起见,我们还编写了简单的 _println_ 函数,它在某种程度上类似于 _fmt.Println_。 +为了减少内存使用,我们将使用 [半主机][14]semihosting 作为标准输出。为了方便起见,我们还编写了简单的 `println` 函数,它在某种程度上类似于 `fmt.Println`。 ``` package main @@ -819,15 +808,15 @@ func main() { ``` -_semihosting.OpenFile_ 函数允许在主机端 打开/创建 文件。特殊路径 _:tt_ 对应于主机的标准输出。 +`semihosting.OpenFile` 函数允许在主机端打开/创建文件。特殊路径 `:tt` 对应于主机的标准输出。 -_println_ 函数接受任意数量的参数,每个参数的类型都是任意的: +`println` 函数接受任意数量的参数,每个参数的类型都是任意的: ``` func println(args ...interface{}) ``` -可能是因为任何类型都实现了空接口 _interface{}_。 _println_ 使用 [类型开关][15] 打印字符串,整数和布尔值: +可能是因为任何类型都实现了空接口 `interface{}`。 `println` 使用 [类型开关][15] 打印字符串,整数和布尔值: ``` switch v := a.(type) { @@ -844,12 +833,11 @@ default: } ``` -此外,它还支持任何实现了 _stringer_ 接口的类型,即任何具有 _String()_ 方法的类型。在任何 _case_ 子句中,_v_ 变量具有正确的类型,与 _case_ 关键字后列出的类型相同。 +此外,它还支持任何实现了 `stringer` 接口的类型,即任何具有 `String()` 方法的类型。在任何 `case` 子句中,`v` 变量具有正确的类型,与 `case` 关键字后列出的类型相同。 +`reflect.ValueOf(p)` 函数通过允许以编程的方式分析其类型和内容的形式返回 `p`。如你所见,我们甚至可以使用 `v.Elem()` 取消引用指针,并打印所有结构体及其名称。 -reflect.ValueOf(p) 函数以允许以编程方式分析其类型和内容的形式返回 _p_。如您所见,我们甚至可以使用 `v.Elem()` 取消引用指针,并打印所有结构体及其名称。 - -让我们尝试编译这段代码。现在,让我们看看如果不使用类型和字段名进行编译会产生什么结果: +让我们尝试编译这段代码。现在让我们看看如果编译时没有类型和字段名,会有什么结果: ``` $ egc -nt -nf @@ -858,7 +846,7 @@ $ arm-none-eabi-size cortexm0.elf 16028 216 312 16556 40ac cortexm0.elf ``` -闪存上只剩下 140 个可用字节。让我们使用启用了 semihosting 的 OpenOCD 加载它: +闪存上只剩下 140 个可用字节。让我们使用启用了半主机的 OpenOCD 加载它: ``` $ openocd -d0 -f interface/stlink.cfg -f target/stm32f0x.cfg -c 'init; program cortexm0.elf; arm semihosting enable; reset run' @@ -891,9 +879,9 @@ type(*p) = } ``` -如果您实际运行过此代码,则会注意到 semihosting 运行缓慢,尤其是在逐字节写入时(缓冲很有用)。 +如果你实际运行此代码,则会注意到半主机运行缓慢,尤其是在逐字节写入时(缓冲很有用)。 -如您所见,`*p` 没有类型名称,并且所有结构字段都具有相同的 _X._ 名称。让我们再次编译该程序,这次不带 _-nt -nf_ 选项: +如你所见,`*p` 没有类型名称,并且所有结构字段都具有相同的 `X.` 名称。让我们再次编译该程序,这次不带 `-nt -nf` 选项: ``` $ egc @@ -902,7 +890,7 @@ $ arm-none-eabi-size cortexm0.elf 16052 216 312 16580 40c4 cortexm0.elf ``` -现在已经包括了类型和字段名称,但仅在 ~~_main.go_ 文件中~~ _main_ 包中定义了它们。该程序的输出如下所示: +现在已经包括了类型和字段名称,但仅在 ~~_main.go_ 文件中~~ `main` 包中定义了它们。该程序的输出如下所示: ``` kind(p) = ptr @@ -922,15 +910,15 @@ type(*p) = S via: https://ziutek.github.io/2018/04/14/go_on_very_small_hardware2.html -作者:[Michał Derkacz ][a] +作者:[Michał Derkacz][a] 译者:[gxlct008](https://github.com/gxlct008) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:https://ziutek.github.io/ [1]:https://ziutek.github.io/2018/04/14/go_on_very_small_hardware2.html -[2]:https://ziutek.github.io/2018/03/30/go_on_very_small_hardware.html +[2]:https://linux.cn/article-11383-1.html [3]:https://golang.org/doc/effective_go.html#interfaces [4]:https://research.swtch.com/interfaces [5]:https://blog.golang.org/laws-of-reflection From 119bf8afdb6f89e8cb6eaab4971f568d00ed3488 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 24 Oct 2020 09:06:31 +0800 Subject: [PATCH 0529/1156] PUB @gxlct008 https://linux.cn/article-12747-1.html --- .../20180414 Go on very small hardware Part 2.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20180414 Go on very small hardware Part 2.md (99%) diff --git a/translated/tech/20180414 Go on very small hardware Part 2.md b/published/20180414 Go on very small hardware Part 2.md similarity index 99% rename from translated/tech/20180414 Go on very small hardware Part 2.md rename to published/20180414 Go on very small hardware Part 2.md index 4e7aad4f13..fdce9ab34c 100644 --- a/translated/tech/20180414 Go on very small hardware Part 2.md +++ b/published/20180414 Go on very small hardware Part 2.md @@ -1,8 +1,8 @@ [#]: collector: (oska874) [#]: translator: (gxlct008) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12747-1.html) [#]: subject: (Go on very small hardware Part 2) [#]: via: (https://ziutek.github.io/2018/04/14/go_on_very_small_hardware2.html) [#]: author: (Michał Derkacz https://ziutek.github.io/) @@ -14,7 +14,7 @@ Go 语言在极小硬件上的运用(二) 在本文的 [第一部分][2] 的结尾,我承诺要写关于接口的内容。我不想在这里写有关接口或完整或简短的讲义。相反,我将展示一个简单的示例,来说明如何定义和使用接口,以及如何利用无处不在的 `io.Writer` 接口。还有一些关于反射reflection半主机semihosting的内容。 -![STM32F030F4P6](https://ziutek.github.io/images/mcu/f030-demo-board/board.jpg)] +![STM32F030F4P6](https://ziutek.github.io/images/mcu/f030-demo-board/board.jpg) 接口是 Go 语言的重要组成部分。如果你想了解更多有关它们的信息,我建议你阅读《[高效的 Go 编程][3]》 和 [Russ Cox 的文章][4]。 From de05090923938aeef33021dbd155230761a9cdcb Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 24 Oct 2020 11:43:14 +0800 Subject: [PATCH 0530/1156] PRF @wxy --- ...Open Source Software)- What is Open Source.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/translated/talk/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md b/translated/talk/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md index 5edf47a6a4..a3da9a92a1 100644 --- a/translated/talk/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md +++ b/translated/talk/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md @@ -47,26 +47,26 @@ FOSS 是指自由和开放源码软件Free and Open Source Software自由和开源软件Free/Libre Open Source Software的缩写。单词 Libre(意为自由)与 gartuit/gratis(免费)不同。 +为了避免强调 “免费”,有些人使用了 FLOSS 这个词(LCTT 译注:有时候也写作 F/LOSS)。FLOSS 是自由和开源软件Free/Libre Open Source Software的缩写。单词 Libre(意为自由)与 gartuit/gratis(免费)不同。 -> “Free”是言论自由的自由,而不是如免费啤酒的免费。 +> “Free” 是言论自由的自由,而不是免费啤酒的免费。 ### FOSS 项目如何赚钱? 开源项目不赚钱是一个神话。红帽是第一个达到 10 亿美元大关的开源公司。[IBM 以 340 亿美元收购了红帽][5]。这样的例子有很多。 -许多开源项目,特别是企业领域的项目,都会提供收费的支持和面向企业的功能。这是R红帽、SUSE Linux 和更多此类项目的主要商业模式。 +许多开源项目,特别是企业领域的项目,都会提供收费的支持和面向企业的功能。这是红帽、SUSE Linux 和更多此类项目的主要商业模式。 一些开源项目,如 Discourse、WordPress 等,则提供其软件的托管实例,并收取一定的费用。 @@ -86,13 +86,13 @@ FOSS 是指自由和开放源码软件Free and Open Source Software开源Open Source的术语。它们经常被互换使用。 它们是同一件事吗?这很难用“是”和“不是”来回答。 你看,FOSS 中的“Free”一词让很多人感到困惑,因为人们错误地认为它是免费的。企业高管、高层和决策者往往会关注自由和开源中的“免费”。由于他们是商业人士,专注于为他们的公司赚钱,“自由”一词在采用 FOSS 原则时起到了威慑作用。 -这就是为什么在上世纪 90 年代中期创建出了一个名为[开源促进会][8]Open Source Initiative的新组织。他们从自由和开放源码软件中去掉了“自由”一词,并创建了自己的[开放源码的定义][9],以及自己的一套许可证。 +这就是为什么在上世纪 90 年代中期创立了一个名为[开源促进会][8]Open Source Initiative的新组织。他们从自由和开放源码软件中去掉了“自由”一词,并创建了自己的[开放源码的定义][9],以及自己的一套许可证。 “开源Open Source”一词在软件行业特别流行。高管们对开源更加适应。开源软件的采用迅速增长,我相信 “免费”一词的删除确实起到了作用。 @@ -111,7 +111,7 @@ via: https://itsfoss.com/what-is-foss/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8aa19749a45fe2820e37ba0ed37b8ea897850b81 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 24 Oct 2020 11:43:42 +0800 Subject: [PATCH 0531/1156] PUB @wxy https://linux.cn/article-12748-1.html --- ... (Free and Open Source Software)- What is Open Source.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/talk => published}/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md (98%) diff --git a/translated/talk/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md b/published/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md similarity index 98% rename from translated/talk/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md rename to published/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md index a3da9a92a1..69af9d8b63 100644 --- a/translated/talk/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md +++ b/published/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12748-1.html) [#]: subject: (Linux Jargon Buster: What is FOSS \(Free and Open Source Software\)? What is Open Source?) [#]: via: (https://itsfoss.com/what-is-foss/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From 0f341c7ad75efaa0454fc477a4f3865fc5233c4c Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Sat, 24 Oct 2020 13:23:16 +0800 Subject: [PATCH 0532/1156] Update 20191105 My first contribution to open source- Making a decision.md --- ...ution to open source- Making a decision.md | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/sources/talk/20191105 My first contribution to open source- Making a decision.md b/sources/talk/20191105 My first contribution to open source- Making a decision.md index 60a386d8cf..a5d1b3d449 100644 --- a/sources/talk/20191105 My first contribution to open source- Making a decision.md +++ b/sources/talk/20191105 My first contribution to open source- Making a decision.md @@ -7,37 +7,34 @@ [#]: via: (https://opensource.com/article/19/11/my-first-open-source-contribution-mistake-decisions) [#]: author: (Galen Corey https://opensource.com/users/galenemco) -My first contribution to open source: Making a decision +我的第一次开源贡献:做出决定 ====== -A new open source contributor documents a series of five mistakes she -made starting out in open source. +一位新的开源贡献者记录了她加入到开源项目后开始犯得五个错误。 ![Lightbulb][1] -Previously, I put a lot of [blame on impostor syndrome][2] for delaying my first open source contribution. But there was another factor that I can’t ignore: I can’t make a decision to save my life. And with [millions][3] of open source projects to choose from, choosing one to contribute to is overwhelming. So overwhelming that I would often end up closing my laptop, thinking, "Maybe I’ll just do this another day." +先前,我将大量的责任归咎于[冒充综合症][2]因为这延迟了我的第一个开源贡献。但还有一个我无法忽视的因素:我无法做决定来拯救我的生活。 在[成千上百万][3]的开源项目中抉择时,选择一个要做贡献的项目势不可挡。如此压迫以至于我常常不得不关掉我的笔记本去思考:“或许我可以改天再做一次”。 -Mistake number two was letting my fear of making a decision get in the way of making my first contribution. In an ideal world, perhaps I would have come into my open source journey with a specific project in mind that I genuinely cared about and wanted to work on, but all I had was a vague goal of contributing to open source somehow. For those of you in the same position, here are strategies that helped me pick out the right project (or at least a good one) for my contribution. +错误二是让我对做决定的恐惧妨碍了我做出第一次贡献。在理想世界里,也许我会带着一个我真正关心和想去做的特定项目开始我的开源之旅,但我有的只是总得为开源项目做出的贡献的模糊目标。对于那些处于同一处境的人来说,这儿有一些策略可以为自己的贡献挑选合适的项目(或者至少是一个好的项目)。 -### Tools that I used frequently +### 我经常使用的工具 -At first, I did not think it would be necessary to limit myself to tools or projects with which I was already familiar. There were projects that I had never used before but seemed like appealing candidates because of their active community, or the interesting problems that they solved. +一开始,我不认为有必要将自己局限于已经熟悉的工具或项目。有一些我之前从未使用过,但由于他们活跃的社区,或者他们解决了有趣的问题,因此看起来很有吸引力。 -However, given that I had a limited amount of time to devote to this project, I decided to stick with a tool that I already knew. To understand what a tool needs, you need to be familiar with how it is supposed to work. If you want to contribute to a project that you are unfamiliar with, you need to complete an additional step of getting to know the functionality and goals of the code. This extra load can be fun and rewarding, but it can also double your work time. Since my goal was primarily to contribute, sticking to what I knew was a helpful way to narrow things down. It is also rewarding to give back to a project that you have found useful. +但是,考虑我投入到这个项目中的时间有限,我决定继续使用我了解的工具。要了解工具需求,你需要熟悉它的工作方式。如果您想为自己不熟悉的项目做贡献,则需要完成一个额外的步骤来了解代码的功能和目标。这个额外的工作量是有趣且值得的,但也会使你的工作时间加倍。因为我的目标主要是贡献,坚持我所知道的是缩小范围一个很好的方式。回馈一个你认为有用的项目也是一种回报。 -### An active and friendly community +### 我经常使用的工具 -When choosing my project, I wanted to feel confident that someone would be there to review the code that I wrote. And, of course, I wanted the person who reviewed my code to be a nice person. Putting your work out there for public scrutiny is scary, after all. While I was open to constructive feedback, there were toxic corners of the developer community that I hoped to avoid. +一开始,我不认为有必要将自己局限于已经熟悉的工具或项目。有一些我之前从未使用过,但由于他们活跃的社区,或者他们解决了有趣的问题,因此看起来很有吸引力。 -To evaluate the community that I would be joining, I checked out the _issues_ sections of the repos that I was considering. I looked to see if someone from the core team responded regularly. More importantly, I tried to make sure that no one was talking down to each other in the comments (which is surprisingly common in issues discussions). I also looked out for projects that had a code of conduct, outlining what was appropriate vs. inappropriate behavior for online interaction. +但是,考虑我投入到这个项目中的时间有限,我决定继续使用我了解的工具。要了解工具需求,你需要熟悉它的工作方式。如果您想为自己不熟悉的项目做贡献,则需要完成一个额外的步骤来了解代码的功能和目标。这个额外的工作量是有趣且值得的,但也会使你的工作时间加倍。因为我的目标主要是贡献,坚持我所知道的是缩小范围一个很好的方式。回馈一个你认为有用的项目也是一种回报。 -### Clear contribution guidelines +因为这是我第一次为开源项目做出贡献,在此过程中我有很多问题。一些项目社区非常擅长记录选择问题和提出请求的程序。一些项目社区在记录流程方面很优秀,可以用来挑选其中的项目并提交请求。尽管那时我没有选择它们,因为在此之前我从未使用过该产品,[Gatsby][4]是该实践的一个范例。 -Because this was my first time contributing to open source, I had a lot of questions around the process. Some project communities are excellent about documenting the procedures for choosing an issue and making a pull request. Although I did not select them at the time because I had never worked with the product before, [Gatsby][4] is an exemplar of this practice. +这种细致的文件帮助我们缓解一些不知如何去做的不安全感。它也给了我希望,项目是开放给新的贡献者,并将花时间来查看我的工作。除了贡献准则外,我还查看了问题部分,看看这个项目是否利用了“好的第一个问题”标志。这是该项目对初学者开放的另一个标志(并帮助你学会如何操作)。 -This type of clear documentation helped ease some of my insecurity about not knowing what to do. It also gave me hope that the project was open to new contributors and would take the time to look at my work. In addition to contribution guidelines, I looked in the issues section to see if the project was making use of the "good first issue" flag. This is another indication that the project is open to beginners (and helps you discover what to work on). +### 总结 -### Conclusion - -If you don’t already have a project in mind, choosing the right place to make your first open source contribution can be overwhelming. Coming up with a list of standards helped me narrow down my choices and find a great project for my first pull request. +如果你还没有计划好一个项目,那么选择合适的领域进行您的第一个开源贡献已势不可挡。列出一系列标准可以帮助自己缩减选择范围,并为自己的首次提交找到一个好的项目。 -------------------------------------------------------------------------------- @@ -45,7 +42,7 @@ via: https://opensource.com/article/19/11/my-first-open-source-contribution-mist 作者:[Galen Corey][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[chenmu-kk](https://github.com/chenmu-kk) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 4182420d3c56daa72eb77b012bf370dfa3a27cdb Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Sat, 24 Oct 2020 13:24:18 +0800 Subject: [PATCH 0533/1156] Update 20191105 My first contribution to open source- Making a decision.md --- ...05 My first contribution to open source- Making a decision.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/talk/20191105 My first contribution to open source- Making a decision.md b/sources/talk/20191105 My first contribution to open source- Making a decision.md index a5d1b3d449..38cd62ac87 100644 --- a/sources/talk/20191105 My first contribution to open source- Making a decision.md +++ b/sources/talk/20191105 My first contribution to open source- Making a decision.md @@ -10,6 +10,7 @@ 我的第一次开源贡献:做出决定 ====== 一位新的开源贡献者记录了她加入到开源项目后开始犯得五个错误。 + ![Lightbulb][1] 先前,我将大量的责任归咎于[冒充综合症][2]因为这延迟了我的第一个开源贡献。但还有一个我无法忽视的因素:我无法做决定来拯救我的生活。 在[成千上百万][3]的开源项目中抉择时,选择一个要做贡献的项目势不可挡。如此压迫以至于我常常不得不关掉我的笔记本去思考:“或许我可以改天再做一次”。 From 96dd170b3a400c974129b6a4262fc0ef02f2b2de Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Sat, 24 Oct 2020 13:25:25 +0800 Subject: [PATCH 0534/1156] Rename sources/talk/20191105 My first contribution to open source- Making a decision.md to translated/talk/20191105 My first contribution to open source- Making a decision.md --- ...105 My first contribution to open source- Making a decision.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/talk/20191105 My first contribution to open source- Making a decision.md (100%) diff --git a/sources/talk/20191105 My first contribution to open source- Making a decision.md b/translated/talk/20191105 My first contribution to open source- Making a decision.md similarity index 100% rename from sources/talk/20191105 My first contribution to open source- Making a decision.md rename to translated/talk/20191105 My first contribution to open source- Making a decision.md From 8d530117dd9d23c57729f73a47f50e4902b8eb40 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sun, 25 Oct 2020 00:57:49 +0800 Subject: [PATCH 0535/1156] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nternet from the command line with curl.md | 196 ------------------ ...nternet from the command line with curl.md | 161 ++++++++++++++ 2 files changed, 161 insertions(+), 196 deletions(-) delete mode 100644 sources/tech/20200521 Use the internet from the command line with curl.md create mode 100644 translated/tech/20200521 Use the internet from the command line with curl.md diff --git a/sources/tech/20200521 Use the internet from the command line with curl.md b/sources/tech/20200521 Use the internet from the command line with curl.md deleted file mode 100644 index 7ef59d9189..0000000000 --- a/sources/tech/20200521 Use the internet from the command line with curl.md +++ /dev/null @@ -1,196 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Use the internet from the command line with curl) -[#]: via: (https://opensource.com/article/20/5/curl-cheat-sheet) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Use the internet from the command line with curl -从命令行通过 curl 访问互联网 -====== -Download our new curl cheat sheet. Curl is a fast and efficient way to -pull the information you need from the internet without using a -graphical interface. -对于从互联网上获取里所需的信息,在不使用图形界面的情况下,curl 是一种快速有效的方法。 - -![Cheat Sheet cover image][1] - -Curl is commonly considered a non-interactive web browser. That means it's able to pull information from the internet and display it in your terminal or save it to a file. This is literally what web browsers, such as Firefox or Chromium, do except they _render_ the information by default, while curl downloads and displays raw information. In reality, the curl command does much more and has the ability to transfer data to or from a server using one of many supported protocols, including HTTP, FTP, SFTP, IMAP, POP3, LDAP, SMB, SMTP, and many more. It's a useful tool for the average terminal user, a vital convenience for the sysadmin, and a quality assurance tool for microservices and cloud developers. -Curl 通常被认为是非交互式 Web 浏览器。这意味着它能够从互联网上获取信息并在你的终端中显示或将其保存到文件中。从字面上看,这是 Web 浏览器(例如 Firefox 或 Chromium)所做的工作,除了默认情况下会渲染信息,而 curl 下载并显示原始信息。实际上,curl 命令可以做更多的事情,并且具有使用多种受支持的协议之一向服务器传输数据或从服务器传输数据的能力,这些协议包括 HTTP、FTP、SFTP、IMAP、POP3、LDAP、SMB、SMTP 等。对于普通终端用户来说,这是一个有用的工具,对于系统管理员,这是至关重要的便利,对于微服务和云开发人员,它是质量保证工具。 - -Curl is designed to work without user interaction, so unlike Firefox, you must think about your interaction with online data from start to finish. For instance, if you want to view a web page in Firefox, you launch a Firefox window. After Firefox is open, you type the website you want to visit into the URL field or a search engine. Then you navigate to the site and click on the page you want to see. -Curl 被设计为在没有用户交互的情况下工作,因此与 Firefox 不同,你必须从头到尾考虑与在线数据的交互。例如,如果想要在 Firefox 中查看网页,你需要启动 Firefox 窗口。打开 Firefox 后,在地址栏或搜索引擎中输入要访问的网站。然后,导航该站点,然后单击要查看的页面。 - -The same concepts apply to curl, except you do it all at once: you launch curl at the same time you feed it the internet location you want and tell it whether you want to the data to be saved in your terminal or to a file. The complexity increases when you have to interact with a site that requires authentication or with an API, but once you learn the **curl** command syntax, it becomes second nature. To help you get the hang of it, we collected the pertinent syntax information in a handy [cheat sheet][2]. -对于 curl 来说也是如此,不同之处在于你需要一次执行所有操作:在启动 curl 的同时提供需要访问的 Internet 位置,并告诉它是否要将数据保存在终端或文件中。当你必须与需要身份验证的网站或 API 进行交互时,复杂性会增加,但是一旦你学习了 **curl** 命令语法,它便成为了第二本性。为了帮助你掌握它,我们在方便的[备忘单][2]中收集了相关的语法信息。 - -### 使用 curl 下载文件 - -You can download a file with the **curl** command by providing a link to a specific URL. If you provide a URL that defaults to **index.html**, then the index page is downloaded, and the file you downloaded is displayed on your terminal screen. You can pipe the output to less or tail or any other command: -你可以通过提供指向特定 URL 的链接来使用 **curl** 命令下载文件。如果你提供的 URL 默认为 **index.html**,那么将下载此页面,并且下载的文件将显示在终端屏幕上。你可以将数据通过管道传递到 less、tail 或任何其它命令: -``` -$ curl "" | tail -n 4 -    <h1>Example Domain</h1> -    <p>This domain is for use in illustrative examples in documents. You may use this domain in literature without prior coordination or asking for permission.</p> -    <p><a href="[https://www.iana.org/domains/example"\>More][3] information...</a></p> -</div></body></html> -``` - -Because some URLs contain special characters that your shell normally interprets, it's safest to surround your URL in quotation marks. -由于某些 URL 包含特殊字符,shell 通常会将其解释,因此用引号将 URL 包起来是最安全的。 - -Some files don't translate well to being displayed in a terminal. You can use the **\--remote-name** option to cause the file to be saved according to what it's called on the server: -某些文件在终端中无法很好的转换显示。你可以使用 **\--remote-name** 选项使文件根据服务器上的调用进行保存: -``` -$ curl --remote-name "" -$ ls -linux-distro.iso -``` - -Alternatively, you can use the **\--output** option to name your download whatever you want: -另外,你可以使用 **\--output** 选项来命名你想要下载的内容: - -``` -curl "http://example.com/foo.html" --output bar.html -``` - -### List contents of a remote directory with curl -### 使用 curl 列出带有远程目录的内容 - -Because curl is non-interactive, it's difficult to browse a page for downloadable elements. Provided that the remote server you're connecting to allows it, you can use **curl** to list the contents of a directory: -因为 curl 是非交互式的,所以很难浏览页面上的可下载元素。如果你要连接的远程服务器允许,可以使用 **curl** 来列出目录的内容: - -``` -$ curl --list-only "https://example.com/foo/" -``` - -### Continue a partial download -### 继续部分下载 - -If you're downloading a very large file, you might find that you have to interrupt the download. Curl is intelligent enough to determine where you left off and continue the download. That means the next time you're downloading a 4GB Linux distribution ISO and something goes wrong, you never have to go back to the start. The syntax for **\--continue-at** is a little unusual: if you know the byte count where your download was interrupted, you can provide it; otherwise, you can use a lone dash (**-**) to tell curl to detect it automatically: -如果要下载很大的文件,可能会发现必须中断下载。Curl 足够智能,可以确定你从何处中断并继续下载。这意味着下一次你下载 4GB 的 Linux 发行版 ISO 出现问题时,你无需重新开始。**\--continue-at** 的语法有点不寻常:如果你知道下载中断的字节数,则可以提供。否则,你可以使用单破折号(**-**)指示 curl 自动检测: - -``` -$ curl --remote-name --continue-at - "https://example.com/linux-distro.iso" -``` - -### Download a sequence of files -### 下载文件序列 - -If you need to download several files—rather than just one big file—curl can help with that. Assuming you know the location and file-name pattern of the files you want to download, you can use curl's sequencing notation: the start and end point between a range of integers, in brackets. For the output filename, use **#1** to indicate the first variable: -如果你需要下载多个文件而不是一个大文件,curl 可以帮助你解决这个问题。假设你知道要下载的文件的位置和文件名模式,则可以使用 curl 的排序符合:括号中整数范围内的起点和终点。对于输出文件名,使用 **#1** 表示第一个变量: - -``` -$ curl "https://example.com/file_[1-4].webp" --output "file_#1.webp" -``` - -If you need to use another variable to represent another sequence, denote each variable in the order it appears in the command. For example, in this command, **#1** refers to the directories **images_000** through **images_009**, while **#2** refers to the files **file_1.webp** through **file_4.webp**: -如果你需要使用另一个变量来表示另一个序列,按照每个变量在命令中出现的顺序表示每个变量。例如,在此命令中,**#1** 指目录 **images_000** 到 **images_009**,而 **#2** 指目录 **file_1.webp** 至 **file_4.webp**。 - -``` -$ curl "" \ -\--output "file_#1-#2.webp" -``` - -### Download all PNG files from a site -### 从站点下载所有 PNG 文件 - -You can do some rudimentary web scraping to find what you want to download, too, using only **curl** and **grep**. For instance, say you need to download all images associated with a web page you're archiving. First, download the page referencing the images. Pipe the page to grep with a search for the image type you're targeting (PNG in this example). Finally, create a **while** loop to construct a download URL and to save the files to your computer: -你也可以仅使用 **curl** 和 **grep** 进行一些基本的 Web 抓取操作,找到想要下载的呢内容。例如,假设你需要下载与要归档的网页关联的所有图像。首先,下载引用图像的页面。搜索所需的图片类型(在此示例中为 PNG),将页面通过管道传递到 grep。最后,创建 **while** 循环以构造下载 URL 并将文件保存到你的计算机: -``` -$ curl |\ -grep --only-matching 'src="[^"]*.[png]"' |\ -cut -d\" -f2 |\ -while read i; do \ -curl " -o "${i##*/}"; \ -done -``` - -This is just an example, but it demonstrates how flexible curl can be when combined with a Unix pipe and some clever, but basic, parsing. -这只是一个例子,但它展示了与 Unix 管道和一些聪明但基本的解析结合使用时,curl 的灵活性。 -### Fetch HTML headers -### 获取 HTML 标头 - -Protocols used for data exchange have a lot of metadata embedded in the packets that computers send to communicate. HTTP headers are components of the initial portion of data. It can be helpful to view these headers (especially the response code) when troubleshooting your connection to a site: -用于数据交换的协议在计算机发送进行通信的数据包中嵌入了许多元数据。HTTP 标头是数据初始部分的组成部分。在对站点连接进行故障排除时,查看以下标头(尤其是响应代码)可能会有所帮助: - -``` -curl --head "" -HTTP/2 200 -accept-ranges: bytes -age: 485487 -cache-control: max-age=604800 -content-type: text/html; charset=UTF-8 -date: Sun, 26 Apr 2020 09:02:09 GMT -etag: "3147526947" -expires: Sun, 03 May 2020 09:02:09 GMT -last-modified: Thu, 17 Oct 2019 07:18:26 GMT -server: ECS (sjc/4E76) -x-cache: HIT -content-length: 1256 -``` - -### Fail quickly -### 快速失败 - -A 200 response is the usual HTTP indicator of success, so it's what you usually expect when you contact a server. The famous 404 response indicates that a page can't be found, and 500 means there was a server error. -响应 200 通常是 HTTP 成功的指示,因此这是你与服务器联系时通常期望的结果。著名的 404 响应表明找不到页面,而 500 则表明存在服务器错误。 - -To see what errors are happening during negotiation, add the **\--show-error** flag: -要查看协商过程中发生了什么错误,添加 **\--shou-error** 标志: -``` -`$ curl --head --show-error "http://opensource.ga"` -``` - -These can be difficult for you to fix unless you have access to the server you're contacting, but curl generally tries its best to resolve the location you point it to. Sometimes when testing things over a network, seemingly endless retries just waste time, so you can force curl to exit upon failure quickly with the **\--fail-early** option: -除非你可以访问要连接的服务器,否则这些问题将很难修复,但是 curl 通常会尽力解决你指向的服务器的位置。有时,当通过网络进行测试时,似乎无休止的重试只会浪费时间,因此你可以使用 **\--fail-early** 选项强制 curl 在出现故障时迅速退出: -``` -curl --fail-early "http://opensource.ga" -``` - -### Redirect query as specified by a 3xx response -### 由 3xx 响应指定的重定向查询 - -The 300 series of responses, however, are more flexible. Specifically, the 301 response means that a URL has been moved permanently to a different location. It's a common way for a website admin to relocate content while leaving a "trail" so people visiting the old location can still find it. Curl doesn't follow a 301 redirect by default, but you can make it continue on to a 301 destination by using the **\--location** option: -300 这个系列的响应更加灵活。具体而言,301 响应表示该 URL 已被永久移动到其它位置。。这是网站管理员在离开“足迹”的同时重新定位内容的一种常见方法,因此访问旧位置的人们仍然可以找到它。默认情况下,Curl 不遵循 301 重定向,当你可以使用 **\--localtion** 选项使其继续进入 301 指向的目标: -``` -$ curl "" | grep title -<title>301 Moved Permanently</title> -$ curl --location "" -<title>Internet Assigned Numbers Authority</title> -``` - -### Expand a shortened URL -### 扩展缩短的 URL - -The **\--location** option is useful when you want to look at shortened URLs before visiting them. Shortened URLs can be useful for social networks with character limits (of course, this may not be an issue if you use a [modern and open source social network][4]) or for print media in which users can't just copy and paste a long URL. However, they can also be a little dangerous because their destination is, by nature, concealed. By combining the **\--head** option to view just the HTTP headers and the **\--location** option to unravel the final destination of a URL, you can peek into a shortened URL without loading the full resource: -如果要在访问缩短的 URL 之前先查看它们,则 **\--location** 相信很有用。缩短的 URL 对于有字符限制的社交网络很有用(当然,如果使用[现代和开放源代码的社交网络][4],这可能不是问题),或者对于用户不能仅复制和粘贴长地址。但是,它们也可能有点危险,因为其目的地本质上是隐藏的。通过结合使用 **\--head** 选项仅查看 HTTP 标头和 **\--location** 选项以解开 URL 的最终目的地,你可以窥视缩短的 URL 而无需加载完整的资源: -``` -$ curl --head --location \ -"" -``` - -### [Download our curl cheat sheet][2] - -Once you practice thinking about the process of exploring the web as a single command, curl becomes a fast and efficient way to pull the information you need from the internet without bothering with a graphical interface. To help you build it into your usual workflow, we've created a [curl cheat sheet][2] with common curl uses and syntax, including an overview of using it to query an API. -一旦你考虑了一个目录就可以浏览网络的过程,curl 就成为一种快速有效的方式,可以从 Internet 上获取所需的信息,而无需理会图形界面。为了帮助你将其构建到常规工作流程中,我们创建了一个 [curl 备忘单][2],其中包含常见的 curl 使用和语法,包括使用它查询 API 的概述。 - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/5/curl-cheat-sheet - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[MjSeven](https://github.com/MjSeven) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coverimage_cheat_sheet.png?itok=lYkNKieP (Cheat Sheet cover image) -[2]: https://opensource.com/downloads/curl-command-cheat-sheet -[3]: https://www.iana.org/domains/example"\>More -[4]: https://opensource.com/article/17/4/guide-to-mastodon diff --git a/translated/tech/20200521 Use the internet from the command line with curl.md b/translated/tech/20200521 Use the internet from the command line with curl.md new file mode 100644 index 0000000000..156b195494 --- /dev/null +++ b/translated/tech/20200521 Use the internet from the command line with curl.md @@ -0,0 +1,161 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use the internet from the command line with curl) +[#]: via: (https://opensource.com/article/20/5/curl-cheat-sheet) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +使用 curl 从命令行访问互联网 +====== +下载我们整理的 curl 备忘录。在不使用图形界面的情况下从互联网上获取所需的信息,curl 是一种快速有效的方法。 + +![Cheat Sheet cover image][1] + +Curl 通常被认为是非交互式 Web 浏览器,这意味着它能够从互联网上获取信息并在你的终端中显示或将其保存到文件中。从表面看,这是 Web 浏览器,例如 Firefox 或 Chromium 所做的工作,只是它们默认情况下会 _渲染_ 信息,而 curl 会下载并显示原始信息。实际上,curl 命令可以做更多的事情,并且能够使用多种协议与服务器进行双向传输数据,这些协议包括 HTTP、FTP、SFTP、IMAP、POP3、LDAP、SMB、SMTP 等。对于普通终端用户来说,这是一个有用的工具;而对于系统管理员,这非常便捷;对于微服务和云开发人员来说,它是质量保证的工具。 + +Curl 被设计为在没有用户交互的情况下工作,因此与 Firefox 不同,你必须从头到尾考虑与在线数据的交互。例如,如果想要在 Firefox 中查看网页,你需要启动 Firefox 窗口。打开 Firefox 后,在地址栏或搜索引擎中输入要访问的网站。然后,导航到网站,然后单击要查看的页面。 + +对于 curl 来说也是如此,不同之处在于你需要一次执行所有操作:在启动 curl 的同时提供需要访问的 Internet 位置,并告诉它是否要将数据保存在终端或文件中。当你必须与需要身份验证的网站或 API 进行交互时,会变得有点复杂,但是一旦你学习了 **curl** 命令语法,它就会成为你的第二天性。为了帮助你掌握它,我们在一个方便的[备忘录][2]中收集了相关的语法信息。 + +### 使用 curl 下载文件 + +你可以通过提供指向特定 URL 的链接来使用 **curl** 命令下载文件。如果你提供的 URL 默认为 **index.html**,那么将下载此页面,并将下载的文件显示在终端屏幕上。你可以将数据通过管道传递到 less、tail 或任何其它命令: +``` +$ curl "http://example.com" | tail -n 4 +

      Example Domain

      +

      This domain is for use in illustrative examples in documents. You may use this domain in literature without prior coordination or asking for permission.

      +

      More information...

      + +``` + +由于某些 URL 包含特殊字符,shell 通常会将其解释,因此用引号将 URL 包起来是最安全的。 + +某些文件在终端中无法很好的转换显示。你可以使用 **\--remote-name** 选项使文件根据服务器上的命名进行保存: +``` +$ curl --remote-name "" +$ ls +linux-distro.iso +``` + +或者,你可以使用 **\--output** 选项来命名你想要下载的内容: + +``` +curl "http://example.com/foo.html" --output bar.html +``` + +### 使用 curl 列出带有远程目录的内容 + +因为 curl 不是交互式的,所以很难浏览页面上的可下载元素。如果你要连接的远程服务器允许,可以使用 **curl** 来列出目录的内容: +``` +$ curl --list-only "https://example.com/foo/" +``` + +### 继续中断下载 + +如果你正在下载一个非常大的文件,你可能会发现有时候必须中断下载。Curl 非常智能,可以确定下载从何处中断并继续下载。这意味着,下一次当你下载一个 4GB 的 Linux 发行版 ISO 出现问题时,就不必重新开始了。**\--continue-at** 的语法有点不寻常:如果你知道下载中断时的字节数,你可以提供给 curl;否则,你可以使用单独的一个破折号(**-**)指示 curl 自动检测: +``` +$ curl --remote-name --continue-at - "https://example.com/linux-distro.iso" +``` + +### 下载文件序列 + +如果你需要下载多个文件而不是一个大文件,那么 curl 可以帮助你解决这个问题。假设你知道要下载的文件的位置和文件名模式,则可以使用 curl 的排序标记:中括号中整数范围内的起点和终点。对于输出文件名,使用 **#1** 表示第一个变量: + +``` +$ curl "https://example.com/file_[1-4].webp" --output "file_#1.webp" +``` + +如果你需要使用其它变量来表示另一个序列,按照每个变量在命令中出现的顺序表示它们。例如,在这个命令中,**#1** 指目录 **images_000** 到 **images_009**,而 **#2** 指目录 **file_1.webp** 至 **file_4.webp**。 +``` +$ curl "" \ +\--output "file_#1-#2.webp" +``` + +### 从站点下载所有 PNG 文件 + +你也可以仅使用 **curl** 和 **grep** 进行一些基本的 Web 抓取操作,以找到想要下载的内容。例如,假设你需要下载与正在归档网页关联的所有图像,首先,下载引用图像的页面。将页面内通过管道传输到 grep,搜索所需的图片类型(在此示例中为 PNG)。最后,创建一个 **while** 循环来构造下载 URL,并将文件保存到你的计算机: +``` +$ curl https://example.com |\ +grep --only-matching 'src="[^"]*.[png]"' |\ +cut -d\" -f2 |\ +while read i; do \ +curl https://example.com/"${i}" -o "${i##*/}"; \ +done +``` + +这只是一个示例,但它展示了 curl 与 Unix 管道和一些基本巧妙的解析结合使用时是多么的灵活。 + +### 获取 HTML 头 + +用于数据交换的协议在计算机发送通信的数据包中嵌入了大量元数据。HTTP 头是数据初始部分的组件。在连接一个网站出现问题时,查看这些报文头(尤其是响应码)会有所帮助: +``` +curl --head "" +HTTP/2 200 +accept-ranges: bytes +age: 485487 +cache-control: max-age=604800 +content-type: text/html; charset=UTF-8 +date: Sun, 26 Apr 2020 09:02:09 GMT +etag: "3147526947" +expires: Sun, 03 May 2020 09:02:09 GMT +last-modified: Thu, 17 Oct 2019 07:18:26 GMT +server: ECS (sjc/4E76) +x-cache: HIT +content-length: 1256 +``` + +### 快速失败 + +响应 200 通常是 HTTP 成功指示符,这是你与服务器连接时通常期望的结果。著名的 404 响应表示找不到页面,而 500 则表示服务器在处理请求时出现了错误。 + +要查看协商过程中发生了什么错误,添加 **\--shou-error** 选项: +``` +$ curl --head --show-error "http://opensource.ga" +``` + +除非你可以访问要连接的服务器,否则这些问题将很难解决,但是 curl 通常会尽力连接你指定的地址。有时在网络上进行测试时,无休止的重试似乎只会浪费时间,因此你可以使用 **\--fail-early** 选项来强制 curl 在失败时迅速退出: +``` +curl --fail-early "http://opensource.ga" +``` + +### 由 3xx 响应指定的重定向查询 + +300 这个系列的响应更加灵活。具体来说,301 响应意味着一个 URL 已被永久移动到其它位置。对于网站管理员来说,重新定位内容并留下“痕迹”是一种常见的方式,这样访问老地址的人们仍然可以找到它。默认情况下,Curl 不会进行 301 重定向,但你可以使用 **\--localtion** 选项使其继续进入 301 响应指向的目标: +``` +$ curl "https://iana.org" | grep title +301 Moved Permanently +$ curl --location "https://iana.org" +Internet Assigned Numbers Authority +``` + +### 展开短网址 + +如果你想要在访问短网址之前先查看它们,那么 **\--location** 选项非常有用。短网址对于有字符限制的社交网络(当然,如果你使用[现代和开源的社交网络][4]的话,这可能不是问题),或者对于用户不能复制粘贴长地址的打印媒体来说是有用处的。但是,它们也可能存在风险,因为其目的地址本质上是隐藏的。通过结合使用 **\--head** 选项仅查看 HTTP 头,**\--location** 选项可以查看一个 URL 的最终地址,你可以查看一个短网址而无需加载其完整的资源: +``` +$ curl --head --location \ +"" +``` + +### [下载我们的 curl 备忘录][2] + +一旦你开始考虑了将探索 web 由一条命令来完成,那么 curl 就成为一种快速有效的方式,可以从 Internet 上获取所需的信息,而无需麻烦图形界面。为了帮助你适应到工作流中,我们创建了一个 [curl 备忘录][2],它包含常见的 curl 用法和语法,包括使用它查询 API 的概述。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/curl-cheat-sheet + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[MjSeven](https://github.com/MjSeven) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coverimage_cheat_sheet.png?itok=lYkNKieP (Cheat Sheet cover image) +[2]: https://opensource.com/downloads/curl-command-cheat-sheet +[3]: https://www.iana.org/domains/example"\>More +[4]: https://opensource.com/article/17/4/guide-to-mastodon From b1705487dd6d7782b1049e9368b1a56cd773e51d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 25 Oct 2020 10:15:24 +0800 Subject: [PATCH 0536/1156] PRF @geekpi --- ...sical Volume from a Volume Group in LVM.md | 130 +++++++++--------- 1 file changed, 63 insertions(+), 67 deletions(-) diff --git a/translated/tech/20201009 How to Remove Physical Volume from a Volume Group in LVM.md b/translated/tech/20201009 How to Remove Physical Volume from a Volume Group in LVM.md index be4eb25b11..245dc8eacf 100644 --- a/translated/tech/20201009 How to Remove Physical Volume from a Volume Group in LVM.md +++ b/translated/tech/20201009 How to Remove Physical Volume from a Volume Group in LVM.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Remove Physical Volume from a Volume Group in LVM) @@ -10,83 +10,79 @@ 如何从 LVM 的卷组中删除物理卷? ====== -如果 LVM 不再需要使用某个设备,你可以使用 vgreduce 命令从卷组中删除物理卷。 +![](https://img.linux.net.cn/data/attachment/album/202010/25/101355kav72t5iy5yj55tg.jpg) -vgreduce 命令通过删除物理卷来缩小卷组的容量。 +如果你的 LVM 不再需要使用某个设备,你可以使用 `vgreduce` 命令从卷组中删除物理卷。 -但要确保物理卷没有被任何逻辑卷使用,请使用 pvdisplay 命令。 - -如果物理卷仍在使用,你必须使用 pvmove 命令将数据转移到另一个物理卷。 +`vgreduce` 命令可以通过删除物理卷来缩小卷组的容量。但要确保该物理卷没有被任何逻辑卷使用,请使用 `pvdisplay` 命令查看。如果物理卷仍在使用,你必须使用 `pvmove` 命令将数据转移到另一个物理卷。 数据转移后,它就可以从卷组中删除。 -最后使用 pvremove 命令删除空物理卷上的 LVM 标签和 LVM 元数据。 +最后使用 `pvremove` 命令删除空物理卷上的 LVM 标签和 LVM 元数据。 - * **第一部分:[如何在 Linux 中创建/配置 LVM(逻辑卷管理)][1]**。 - * **第二部分:[如何在 Linux 中扩展/增加 LVM 大小(逻辑卷调整)][2]**。 - * **第三部分:[如何在 Linux 中减少/缩小 LVM 大小(逻辑卷调整)][3]**。 + * **第一部分:[如何在 Linux 中创建/配置 LVM(逻辑卷管理)][1]** + * **第二部分:[如何在 Linux 中扩展/增加 LVM 大小(逻辑卷调整)][2]** + * **第三部分:[如何在 Linux 中减少/缩小 LVM 大小(逻辑卷调整)][3]** +![](https://img.linux.net.cn/data/attachment/album/202010/25/101424vgcio5fooi9uo5gh.jpeg) +### 将扩展块移动到现有物理卷上 -![][4] - -### 1) 将扩展移动到现有物理卷上 - -使用 pvs 命令检查是否使用了所需的物理卷(我们计划删除 LVM 中的 **“/dev/sdb1”** 磁盘)。 +使用 `pvs` 命令检查是否使用了所需的物理卷(我们计划删除 LVM 中的 `/dev/sdc` 磁盘)。 ``` # pvs -o+pv_used PV VG Fmt Attr PSize PFree Used -/dev/sda1 myvg lvm2 a- 75.00G 14.00G 61.00G -/dev/sdb1 myvg lvm2 a- 50.00G 45.00G 5.00G -/dev/sdc1 myvg lvm2 a- 17.15G 12.15G 5.00G +/dev/sda myvg lvm2 a- 75.00G 14.00G 61.00G +/dev/sdb myvg lvm2 a- 50.00G 45.00G 5.00G +/dev/sdc myvg lvm2 a- 17.15G 12.15G 5.00G ``` -如果使用了,请检查卷组中的其他物理卷是否有足够的空闲空间。 +如果使用了,请检查卷组中的其他物理卷是否有足够的空闲扩展块extent。 -如果有的话,你可以在需要删除的设备上运行 pvmove 命令。扩展将被分配到其他设备上。 +如果有的话,你可以在需要删除的设备上运行 `pvmove` 命令。扩展块将被分配到其他设备上。 ``` -# pvmove /dev/sdb1 +# pvmove /dev/sdc -/dev/sdb1: Moved: 2.0% +/dev/sdc: Moved: 2.0% … -/dev/sdb1: Moved: 79.2% +/dev/sdc: Moved: 79.2% … -/dev/sdb1: Moved: 100.0% +/dev/sdc: Moved: 100.0% ``` -当 pvmove 命令完成后。再次使用 pvs 命令检查物理卷是否有空闲。 +当 `pvmove` 命令完成后。再次使用 `pvs` 命令检查物理卷是否有空闲。 ``` # pvs -o+pv_used PV VG Fmt Attr PSize PFree Used -/dev/sda1 myvg lvm2 a- 75.00G 9.00G 66.00G -/dev/sdb1 myvg lvm2 a- 50.00G 50.00G 0 -/dev/sdc1 myvg lvm2 a- 17.15G 12.15G 5.00G +/dev/sda myvg lvm2 a- 75.00G 1.85G 73.15G +/dev/sdb myvg lvm2 a- 50.00G 45.00G 5.00G +/dev/sdc myvg lvm2 a- 17.15G 17.15G 0 ``` -如果它是空闲的,使用 vgreduce 命令从卷组中删除物理卷 /dev/sdb1。 +如果它是空闲的,使用 `vgreduce` 命令从卷组中删除物理卷 `/dev/sdc`。 ``` -# vgreduce myvg /dev/sdb1 -Removed "/dev/sdb1" from volume group "myvg" +# vgreduce myvg /dev/sdc +Removed "/dev/sdc" from volume group "vg01" ``` -最后,运行 pvremove 命令从 LVM 配置中删除磁盘。现在,磁盘已经完全从 LVM 中移除,可以用于其他用途。 +最后,运行 `pvremove` 命令从 LVM 配置中删除磁盘。现在,磁盘已经完全从 LVM 中移除,可以用于其他用途。 ``` -# pvremove /dev/sdb1 -Labels on physical volume "/dev/sdb1" successfully wiped. +# pvremove /dev/sdc +Labels on physical volume "/dev/sdc" successfully wiped. ``` -### 2) 移动扩展到新磁盘 +### 移动扩展块到新磁盘 如果你在卷组中的其他物理卷上没有足够的可用扩展。使用以下步骤添加新的物理卷。 -向存储组申请新的 LUN。分配完毕后,运行以下命令来**[在 Linux 中发现新添加的 LUN 或磁盘][5]**。 +向存储组申请新的 LUN。分配完毕后,运行以下命令来[在 Linux 中发现新添加的 LUN 或磁盘][5]。 ``` # ls /sys/class/scsi_host @@ -101,68 +97,68 @@ host0 # fdisk -l ``` -操作系统中检测到磁盘后,使用 pvcreate 命令创建物理卷。 +操作系统中检测到磁盘后,使用 `pvcreate` 命令创建物理卷。 ``` -# pvcreate /dev/sdd1 -Physical volume "/dev/sdd1" successfully created +# pvcreate /dev/sdd +Physical volume "/dev/sdd" successfully created ``` -使用以下命令将新的物理卷 /dev/sdd1 添加到现有卷组 vg01 中。 +使用以下命令将新的物理卷 `/dev/sdd` 添加到现有卷组 `vg01` 中。 ``` -# vgextend vg01 /dev/sdd1 +# vgextend vg01 /dev/sdd Volume group "vg01" successfully extended ``` -现在,使用 pvs 命令查看你添加的新磁盘 **“/dev/sdd1”**。 +现在,使用 `pvs` 命令查看你添加的新磁盘 `/dev/sdd`。 ``` # pvs -o+pv_used PV VG Fmt Attr PSize PFree Used -/dev/sda1 myvg lvm2 a- 75.00G 14.00G 61.00G -/dev/sdb1 myvg lvm2 a- 50.00G 0 50.00G -/dev/sdc1 myvg lvm2 a- 17.15G 12.15G 5.00G -/dev/sdd1 myvg lvm2 a- 60.00G 60.00G 0 +/dev/sda myvg lvm2 a- 75.00G 14.00G 61.00G +/dev/sdb myvg lvm2 a- 50.00G 45.00G 5.00G +/dev/sdc myvg lvm2 a- 17.15G 12.15G 5.00G +/dev/sdd myvg lvm2 a- 60.00G 60.00G 0 ``` -使用 pvmove 命令将数据从 /dev/sdb1 移动到 /dev/sdd1。 +使用 `pvmove` 命令将数据从 `/dev/sdc` 移动到 `/dev/sdd`。 ``` -# pvmove /dev/sdb1 /dev/sdd1 +# pvmove /dev/sdc /dev/sdd -/dev/sdb1: Moved: 10.0% +/dev/sdc: Moved: 10.0% … -/dev/sdb1: Moved: 79.7% +/dev/sdc: Moved: 79.7% … -/dev/sdb1: Moved: 100.0% +/dev/sdc: Moved: 100.0% ``` -数据移动到新磁盘后。再次使用 pvs 命令检查物理卷是否空闲。 +数据移动到新磁盘后。再次使用 `pvs` 命令检查物理卷是否空闲。 ``` # pvs -o+pv_used PV VG Fmt Attr PSize PFree Used -/dev/sda1 myvg lvm2 a- 75.00G 14.00G 61.00G -/dev/sdb1 myvg lvm2 a- 50.00G 50.00G 0 -/dev/sdc1 myvg lvm2 a- 17.15G 12.15G 5.00G -/dev/sdd1 myvg lvm2 a- 60.00G 10.00G 50.00G +/dev/sda myvg lvm2 a- 75.00G 14.00G 61.00G +/dev/sdb myvg lvm2 a- 50.00G 45.00G 5.00G +/dev/sdc myvg lvm2 a- 17.15G 17.15G 0 +/dev/sdd myvg lvm2 a- 60.00G 47.85G 12.15G ``` -如果空闲,使用 vgreduce 命令从卷组中删除物理卷 /dev/sdb1。 +如果空闲,使用 `vgreduce` 命令从卷组中删除物理卷 `/dev/sdc`。 ``` -# vgreduce myvg /dev/sdb1 -Removed "/dev/sdb1" from volume group "myvg" +# vgreduce myvg /dev/sdc +Removed "/dev/sdc" from volume group "vg01" ``` -最后,运行 pvremove 命令从 LVM 配置中删除磁盘。现在,磁盘已经完全从 LVM 中移除,可以用于其他用途。 +最后,运行 `pvremove` 命令从 LVM 配置中删除磁盘。现在,磁盘已经完全从 LVM 中移除,可以用于其他用途。 ``` -# pvremove /dev/sdb1 -Labels on physical volume "/dev/sdb1" successfully wiped. +# pvremove /dev/sdc +Labels on physical volume "/dev/sdc" successfully wiped. ``` -------------------------------------------------------------------------------- @@ -172,14 +168,14 @@ via: https://www.2daygeek.com/linux-remove-delete-physical-volume-pv-from-volume 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.2daygeek.com/author/magesh/ [b]: https://github.com/lujun9972 -[1]: https://www.2daygeek.com/create-lvm-storage-logical-volume-manager-in-linux/ -[2]: https://www.2daygeek.com/extend-increase-resize-lvm-logical-volume-in-linux/ -[3]: https://www.2daygeek.com/reduce-shrink-decrease-resize-lvm-logical-volume-in-linux/ -[4]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[1]: https://linux.cn/article-12670-1.html +[2]: https://linux.cn/article-12673-1.html +[3]: https://linux.cn/article-12740-1.html +[4]: https://www.2daygeek.com/wp-content/uploads/2020/10/remove-delete-physical-volume-pv-from-volume-group-vg-lvm-linux-2.png [5]: https://www.2daygeek.com/scan-detect-luns-scsi-disks-on-redhat-centos-oracle-linux/ From b4fd481d6eaca95ba0da09ec545b779e69ba01a1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 25 Oct 2020 10:16:40 +0800 Subject: [PATCH 0537/1156] PUB @geekpi https://linux.cn/article-12750-1.html --- ...ow to Remove Physical Volume from a Volume Group in LVM.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201009 How to Remove Physical Volume from a Volume Group in LVM.md (98%) diff --git a/translated/tech/20201009 How to Remove Physical Volume from a Volume Group in LVM.md b/published/20201009 How to Remove Physical Volume from a Volume Group in LVM.md similarity index 98% rename from translated/tech/20201009 How to Remove Physical Volume from a Volume Group in LVM.md rename to published/20201009 How to Remove Physical Volume from a Volume Group in LVM.md index 245dc8eacf..92d4b4c6c1 100644 --- a/translated/tech/20201009 How to Remove Physical Volume from a Volume Group in LVM.md +++ b/published/20201009 How to Remove Physical Volume from a Volume Group in LVM.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12750-1.html) [#]: subject: (How to Remove Physical Volume from a Volume Group in LVM) [#]: via: (https://www.2daygeek.com/linux-remove-delete-physical-volume-pv-from-volume-group-vg-in-lvm/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) From d54a6f9fe23596fef2d7f5a56c53388da30a8b76 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 25 Oct 2020 11:26:33 +0800 Subject: [PATCH 0538/1156] PRF @geekpi --- ...s to Download Files From Linux Terminal.md | 60 +++++++++---------- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/translated/tech/20201014 2 Ways to Download Files From Linux Terminal.md b/translated/tech/20201014 2 Ways to Download Files From Linux Terminal.md index d1a300bcb1..a69331b25b 100644 --- a/translated/tech/20201014 2 Ways to Download Files From Linux Terminal.md +++ b/translated/tech/20201014 2 Ways to Download Files From Linux Terminal.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (2 Ways to Download Files From Linux Terminal) @@ -12,7 +12,7 @@ 如果你被困在 Linux 终端,比如说在服务器上,如何从终端下载文件? -在 Linux 中是没有下载命令的,但是有几个 Linux 命令可用于下载文件。 +在 Linux 中是没有 `download` 命令的,但是有几个 Linux 命令可用于下载文件。 在这篇终端技巧中,你将学习两种在 Linux 中使用命令行下载文件的方法。 @@ -22,15 +22,15 @@ ![][1] -[wget][2] 也许是 Linux 和类 UNIX 系统中使用最多的命令行下载管理器。你可以使用 wget 下载一个文件、多个文件、整个目录甚至整个网站。 +[wget][2] 也许是 Linux 和类 UNIX 系统中使用最多的命令行下载管理器。你可以使用 `wget` 下载一个文件、多个文件、整个目录甚至整个网站。 -wget 是非交互式的,可以轻松地在后台工作。这意味着你可以很容易地在脚本中使用它,甚至构建像 [uGet 下载管理器][3]这样的工具。 +`wget` 是非交互式的,可以轻松地在后台工作。这意味着你可以很容易地在脚本中使用它,甚至构建像 [uGet 下载管理器][3]这样的工具。 -让我们看看如何使用 wget 从终端下载文件。 +让我们看看如何使用 `wget` 从终端下载文件。 #### 安装 wget -大多数 Linux 发行版都预装了 wget。它也可以在大多数发行版的仓库中找到,你可以使用发行版的包管理器轻松安装它。 +大多数 Linux 发行版都预装了 `wget`。它也可以在大多数发行版的仓库中找到,你可以使用发行版的包管理器轻松安装它。 在基于 Ubuntu 和 Debian 的发行版上,你可以使用 [apt 包管理器][4]命令: @@ -48,7 +48,7 @@ wget URL ![][5] -要下载多个文件,你必须将它们的 URL 保存在一个文本文件中,并将该文件作为输入提供给 wget,就像这样: +要下载多个文件,你必须将它们的 URL 保存在一个文本文件中,并将该文件作为输入提供给 `wget`,就像这样: ``` wget -i download_files.txt @@ -56,9 +56,9 @@ wget -i download_files.txt #### 用 wget 下载不同名字的文件 -你会注意到,一个网页在 wget 中几乎总是以 index.html 的形式保存。为下载的文件提供自定义名称是个好主意。 +你会注意到,网页在 `wget` 中几乎总是以 `index.html` 的形式保存。为下载的文件提供自定义名称是个好主意。 -你可以在下载时使用 -O (大写字母 O) 选项来提供输出文件名。 +你可以在下载时使用 `-O` (大写字母 `O`) 选项来提供输出文件名: ``` wget -O filename URL @@ -68,7 +68,7 @@ wget -O filename URL #### 用 wget 下载一个文件夹 -假设你正在浏览一个 FTP 服务器,你需要下载整个目录,你可以使用递归选项: +假设你正在浏览一个 FTP 服务器,你需要下载整个目录,你可以使用递归选项 `-r`: ``` wget -r ftp://server-address.com/directory @@ -76,14 +76,12 @@ wget -r ftp://server-address.com/directory #### 使用 wget 下载整个网站 -是的,你完全可以做到这一点。你可以用 wget 镜像整个网站。我说的下载整个网站是指整个面向公众的网站结构。 - -虽然你可以直接使用镜像选项 -m,但最好加上: - - * –convert-links :链接将被转换,使内部链接指向下载的资源,而不是网站。 - * –page-requisites:下载额外的东西,如样式表,使页面在离线状态下看起来更好。 +是的,你完全可以做到这一点。你可以用 `wget` 镜像整个网站。我说的下载整个网站是指整个面向公众的网站结构。 +虽然你可以直接使用镜像选项 `-m`,但最好加上: + * `–convert-links`:链接将被转换,使内部链接指向下载的资源,而不是网站。 + * `–page-requisites`:下载额外的东西,如样式表,使页面在离线状态下看起来更好。 ``` wget -m --convert-links --page-requisites website_address @@ -93,7 +91,7 @@ wget -m --convert-links --page-requisites website_address #### 额外提示:恢复未完成的下载 -如果你因为某些原因按 C 键中止了下载,你可以用选项 -c 恢复之前的下载: +如果你因为某些原因按 `CTRL-C` 键中止了下载,你可以用选项 `-c` 恢复之前的下载: ``` wget -c @@ -101,13 +99,13 @@ wget -c ### 使用 curl 在 Linux 命令行中下载文件 -和 wget 一样,[curl][8] 也是 Linux 终端中最常用的下载文件的命令之一。[使用 curl][9] 的方法有很多,但我在这里只关注简单的下载。 +和 `wget` 一样,[curl][8] 也是 Linux 终端中最常用的下载文件的命令之一。[使用 curl][9] 的方法有很多,但我在这里只关注简单的下载。 #### 安装 curl -虽然 curl 并不是预装的,但在大多数发行版的官方仓库中都有。你可以使用你的发行版的包管理器来安装它。 +虽然 `curl` 并不是预装的,但在大多数发行版的官方仓库中都有。你可以使用你的发行版的包管理器来安装它。 -要[在 Ubuntu][10] 和其他基于 Debian 的发行版上安装 curl,请使用以下命令: +要[在 Ubuntu][10] 和其他基于 Debian 的发行版上安装 `curl`,请使用以下命令: ``` sudo apt install curl @@ -115,9 +113,9 @@ sudo apt install curl #### 使用 curl 下载文件或网页 -如果你在使用 curl 命令时没有在 URL 中带任何选项,它就会读取文件并打印在终端上。 +如果你在使用 `curl` 命令时没有在 URL 中带任何选项,它就会读取文件并打印在终端上。 -要在 Linux 终端中使用 curl 命令下载文件,你必须使用 -O(大写字母 O)选项: +要在 Linux 终端中使用 `curl` 命令下载文件,你必须使用 `-O`(大写字母 `O`)选项: ``` curl -O URL @@ -125,17 +123,17 @@ curl -O URL ![][11] -在 Linux 中,用 curl 下载多个文件是比较简单的。你只需要指定多个 URL 即可: +在 Linux 中,用 `curl` 下载多个文件是比较简单的。你只需要指定多个 URL 即可: ``` curl -O URL1 URL2 URL3 ``` -请记住,curl 不像 wget 那么简单。当 wget 将网页保存为 index.html 时,curl 会抱怨远程文件没有网页的名字。你必须按照下一节的描述用一个自定义的名字来保存它。 +请记住,`curl` 不像 `wget` 那么简单。`wget` 可以将网页保存为 `index.html`,`curl` 却会抱怨远程文件没有网页的名字。你必须按照下一节的描述用一个自定义的名字来保存它。 #### 用不同的名字下载文件 -这可能会让人感到困惑,但如果要为下载的文件提供一个自定义的名称(而不是原始名称),你必须使用 -o(小写 O)选项: +这可能会让人感到困惑,但如果要为下载的文件提供一个自定义的名称(而不是原始名称),你必须使用 `-o`(小写 `O`)选项: ``` curl -o filename URL @@ -143,23 +141,23 @@ curl -o filename URL ![][12] -有些时候,curl 并不能像你期望的那样下载文件,你必须使用选项 -L(代表位置)来正确下载。这是因为有些时候,链接会重定向到其他链接,而使用选项 -L,它就会跟随最终的链接。 +有些时候,`curl` 并不能像你期望的那样下载文件,你必须使用选项 `-L`(代表位置)来正确下载。这是因为有些时候,链接会重定向到其他链接,而使用选项 `-L`,它就会跟随最终的链接。 #### 用 curl 暂停和恢复下载 -和 wget 一样,你也可以用 curl 的 -c 选项恢复暂停的下载: +和 `wget` 一样,你也可以用 `curl` 的 `-c` 选项恢复暂停的下载: ``` curl -c URL ``` -**总结** +### 总结 和以往一样,在 Linux 中做同一件事有多种方法。从终端下载文件也不例外。 -wget 和 curl 只是 Linux 中最流行的两个下载文件的命令。还有更多这样的命令行工具。基于终端的网络浏览器,如 [elinks][13]、[w3m][14] 等也可以用于在命令行下载文件。 +`wget` 和 `curl` 只是 Linux 中最流行的两个下载文件的命令。还有更多这样的命令行工具。基于终端的网络浏览器,如 [elinks][13]、[w3m][14] 等也可以用于在命令行下载文件。 -就个人而言,对于一个简单的下载,我更喜欢使用 wget 而不是 curl。它更简单,也不会让你感到困惑,因为你可能很难理解为什么 curl 不能以预期的格式下载文件。 +就个人而言,对于一个简单的下载,我更喜欢使用 `wget` 而不是 `curl`。它更简单,也不会让你感到困惑,因为你可能很难理解为什么 `curl` 不能以预期的格式下载文件。 欢迎你的反馈和建议。 @@ -170,7 +168,7 @@ via: https://itsfoss.com/download-files-from-linux-terminal/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 3a99c2fb009edce351ef9fdfdb9f14af1433da0a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 25 Oct 2020 11:31:47 +0800 Subject: [PATCH 0539/1156] PUB @geekpi https://linux.cn/article-12752-1.html --- .../20201014 2 Ways to Download Files From Linux Terminal.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201014 2 Ways to Download Files From Linux Terminal.md (98%) diff --git a/translated/tech/20201014 2 Ways to Download Files From Linux Terminal.md b/published/20201014 2 Ways to Download Files From Linux Terminal.md similarity index 98% rename from translated/tech/20201014 2 Ways to Download Files From Linux Terminal.md rename to published/20201014 2 Ways to Download Files From Linux Terminal.md index a69331b25b..0fa87fe9f0 100644 --- a/translated/tech/20201014 2 Ways to Download Files From Linux Terminal.md +++ b/published/20201014 2 Ways to Download Files From Linux Terminal.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12752-1.html) [#]: subject: (2 Ways to Download Files From Linux Terminal) [#]: via: (https://itsfoss.com/download-files-from-linux-terminal/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From cd9632dd2062d5e334ab73487c8384657b53fd63 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sun, 25 Oct 2020 21:40:05 +0800 Subject: [PATCH 0540/1156] Translating --- .../20200720 An introduction to mutation testing in Python.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200720 An introduction to mutation testing in Python.md b/sources/tech/20200720 An introduction to mutation testing in Python.md index e3f93a79ae..4a946fe59c 100644 --- a/sources/tech/20200720 An introduction to mutation testing in Python.md +++ b/sources/tech/20200720 An introduction to mutation testing in Python.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d1225c5f724a96c98a58cba64f48f0e3d1eb2aaf Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 26 Oct 2020 08:53:54 +0800 Subject: [PATCH 0541/1156] translated --- ...ny computer with this bootable USB tool.md | 99 ------------------- ...ny computer with this bootable USB tool.md | 98 ++++++++++++++++++ 2 files changed, 98 insertions(+), 99 deletions(-) delete mode 100644 sources/tech/20201014 Try Linux on any computer with this bootable USB tool.md create mode 100644 translated/tech/20201014 Try Linux on any computer with this bootable USB tool.md diff --git a/sources/tech/20201014 Try Linux on any computer with this bootable USB tool.md b/sources/tech/20201014 Try Linux on any computer with this bootable USB tool.md deleted file mode 100644 index dcdc1697ae..0000000000 --- a/sources/tech/20201014 Try Linux on any computer with this bootable USB tool.md +++ /dev/null @@ -1,99 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Try Linux on any computer with this bootable USB tool) -[#]: via: (https://opensource.com/article/20/10/fedora-media-writer) -[#]: author: (Sumantro Mukherjee https://opensource.com/users/sumantro) - -Try Linux on any computer with this bootable USB tool -====== -Fedora Media Writer is a hassle-free way to create a live USB to give -Linux a try. -![Multiple USB plugs in different colors][1] - -[Fedora Media Writer][2] is a small, lightweight, comprehensive tool that simplifies the Linux getting-started experience. It downloads and writes Fedora Workstation or Server onto a USB drive that can boot up on any system, making it accessible for you to try Fedora Linux without having to install it to your hard drive. - -The Media Writer tool can be used to create a live, bootable USB. After installing the Fedora Media Writer application on your platform, you can download and flash the latest stable version of Fedora Workstation or Server, or you can choose any other image you've downloaded. And it isn't limited to Intel 64-bit devices. It's also available for ARM devices, [such as the Raspberry Pi][3], which are becoming more powerful and useful every day. - -![Fedora Media Writer main screen][4] - -(Sumantro Mukherjee, [CC BY-SA 4.0][5]) - -### Install Fedora Media Writer - -You have several options for [installing Fedora Media Writer][6]. You can [build it from source][7] on GitHub, download it for macOS or Windows, use an RPM with **dnf** or **yum**, or get it as a Flatpak. - -On Fedora: - - -``` -`$ sudo dnf install mediawriter` -``` - -See the [Releases][8] section of the GitHub repo for the latest version. - -### Prepare your media - -The first thing you need is a USB drive for your Linux OS to be installed onto. This is what Fedora Media Writer will flash. This drive must be either blank or expendable because **all data on the USB drive will be erased.** If there's any data—even just one file—that you don't want to lose, then you must back it up before continuing! - -Once you've got a USB drive that you've confirmed is expendable, plug it into your computer and launch Fedora Media Writer. - -### Use Fedora Media Writer - -When you launch Fedora Media Writer, you're presented with a screen that prompts you to acquire a bootable image from the Internet, or to load a custom image from your hard drive. The first selections are the latest releases of Fedora: Workstation for desktops and laptops, and Server for virtualization, rack servers, or anything you want to run as a server. - -Should you select one of the Fedora images, Media Writer downloads a disc image (usually called an "iso", after its filename extension of **.iso**) and saves it to your `Downloads` folder so you can reuse it to flash another drive if you want. - -![Select your image][9] - -Also available are Fedora Spins, which are images from the Fedora community meant to satisfy niche interests. For instance, if you're a fan of the [MATE desktop][10], then you'll be pleased to find a MATE "spin" available from Media Writer. There are many to choose from, so scroll through to see them all. If you're new to Linux, don't be overwhelmed or confused: the extra options are intended for longtime users who have developed preferences aside from the defaults, so it's safe for you to just use the Workstation or Server option depending on whether you want to run Fedora as a desktop or as a server OS. - -If you need an image for a different CPU than the one you're currently using, select the CPU architecture from the drop-down menu in the upper-right corner of the window. - -If you have an image saved to your hard drive already, select the **Custom Image** option and select the **.iso** file of the distribution you want to flash to USB. - -### Writing to a USB drive - -Once you've downloaded or selected an image, you must confirm that you want to write the image to your drive. - -The drive selection drop-down menu only shows external drives, so there's no chance of you accidentally overwriting your own hard drive. This is an important feature of Fedora Media Writer, and one that makes it much safer than many manual instructions you might see elsewhere online. However, if you have more than one external drive attached to your computer, you should remove them all except the one you want to overwrite, just for added safety. - -Select the drive you want the image to be installed onto, and click the **Write to Disk** button. - -![Media write][11] - -  - -Wait a while for the image to be written to your drive, and then check out Don Watkins' excellent overview of [how to boot to Linux from a USB drive][12] . - -### Get started with Linux - -Fedora Media Writer is a way to flash Fedora Workstation or Server, or any Linux distribution, to a USB drive so you can try it out before you install it on your device. Give it a try, and share your experience and questions in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/10/fedora-media-writer - -作者:[Sumantro Mukherjee][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://opensource.com/users/sumantro -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/usb-hardware.png?itok=ROPtNZ5V (Multiple USB plugs in different colors) -[2]: https://github.com/FedoraQt/MediaWriter -[3]: https://fedoraproject.org/wiki/Architectures/ARM/Raspberry_Pi -[4]: https://opensource.com/sites/default/files/uploads/fmw_mainscreen.png (Fedora Media Writer main screen) -[5]: https://creativecommons.org/licenses/by-sa/4.0/ -[6]: https://docs.fedoraproject.org/en-US/fedora/f32/install-guide/install/Preparing_for_Installation/#_fedora_media_writer -[7]: https://github.com/FedoraQt/MediaWriter#building -[8]: https://github.com/FedoraQt/MediaWriter/releases -[9]: https://opensource.com/sites/default/files/mediawriter-image.png -[10]: https://opensource.com/article/19/12/mate-linux-desktop -[11]: https://opensource.com/sites/default/files/mediawriter-write.png (Media write) -[12]: https://opensource.com/article/20/4/first-linux-computer diff --git a/translated/tech/20201014 Try Linux on any computer with this bootable USB tool.md b/translated/tech/20201014 Try Linux on any computer with this bootable USB tool.md new file mode 100644 index 0000000000..20029022bd --- /dev/null +++ b/translated/tech/20201014 Try Linux on any computer with this bootable USB tool.md @@ -0,0 +1,98 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Try Linux on any computer with this bootable USB tool) +[#]: via: (https://opensource.com/article/20/10/fedora-media-writer) +[#]: author: (Sumantro Mukherjee https://opensource.com/users/sumantro) + +用这个可引导的 USB 工具在任何电脑上尝试 Linux +====== +Fedora Media Writer 是创建 Live USB 以尝试 Linux 的方便的方法。 +![Multiple USB plugs in different colors][1] + +[Fedora Media Writer][2] 是一个小巧、轻量、全面的工具,它简化了 Linux 的入门体验。它将 Fedora Workstation 或 Server 下载并写入一个可以在任何系统上引导的 USB 驱动器,使你无需将其安装到硬盘上就可以试用 Fedora Linux。 + +Media Writer 工具可以用来创建一个实时的、可引导的 USB。在你的平台上安装 Fedora Media Writer 应用后,你可以下载并烧录最新的 Fedora Workstation 或 Server 稳定版,也可以选择你下载的任何其他镜像。而且它并不局限于英特尔 64 位设备。它还可以用于 ARM 设备,[如树莓派][3],它们每天都在变得更加强大和有用。 + +![Fedora Media Writer main screen][4] + +(Sumantro Mukherjee, [CC BY-SA 4.0][5]) + +### 安装 Fedora Media Writer + +你有几种方式来[安装 Fedora Media Writer][6]。你可以在 GitHub 上[从源码编译][7]、下载 MacOS 或 Windows 版本、使用 **dnf** 或 **yum** 安装 RPM 包、或者以 Flatpak 的形式获得。 + +在 Fedora 上: + + +``` +`$ sudo dnf install mediawriter` +``` + +最新版本请参见 GitHub 仓库的[发布][8]部分。 + +### 准备好你的媒体 + +首先,你需要一个 USB 驱动器来安装你的 Linux 操作系统。这就是 Fedora Media Writer 要烧录的东西。这个驱动器必须是空白或可擦除的,因为 **USB 驱动器上的所有数据都会被删除**。如果有任何数据,哪怕只是一个文件,如果你不想丢失,那么你必须在继续之前备份它! + +确认你的 U 盘是可擦除的后,将它插入你的电脑并启动 Fedora Media Writer。 + +### 使用 Fedora Media Writer + +当你启动 Fedora Media Writer 时,你会看到一个页面,提示你从互联网上获取一个可引导的镜像,或者从你的硬盘上加载一个自定义镜像。第一个选择是 Fedora 的最新版本。工作站版适用于台式机和笔记本电脑,服务器版适用于虚拟化、机架服务器或任何你想作为服务器运行的情况。 + +如果你选择了 Fedora 镜像,Media Writer 会下载一个光盘镜像(通常称为 ”iso“,文件扩展名为 **.iso**),并将其保存到你的 `Downloads` 文件夹中,这样你就可以重复使用它来烧录另一个驱动器。 + +![Select your image][9] + +另外还有 Fedora Spins,这是来自 Fedora 社区的镜像,它旨在满足小众的兴趣。例如,如果你是 [MATE 桌面][10]的粉丝,那么你会很高兴地发现 Media Writer 提供的 MATE ”spin“。它有很多选择,所以请滚动查看所有的。如果你是 Linux 的新手,不要被吓到或困惑:额外的选项是为长期用户准备的,这些用户除了默认的选项外,还发展出了自己的偏好,所以对你来说,只使用工作站或服务器选项是安全的,这取决于你是想把 Fedora 作为一个桌面还是作为一个服务器操作系统来运行。 + +如果你需要一个与你当前使用的 CPU 不同的镜像,从窗口右上角的下拉菜单中选择 CPU 架构。 + +如果你已经将镜像保存在硬盘上,请选择**自定义映像**选项,并选择你要烧录到 USB 的发行版的 **.iso** 文件。 + +### 写入 USB 驱动器 + +当你下载或选择了一个镜像,你必须确认你要将该镜像写入驱动器。 + +驱动器选择下拉菜单只显示外部驱动器,所以你不会意外地覆盖自己的硬盘驱动器。这是 Fedora Media Writer 的一个重要功能,它比你在网上看到的许多手动说明要安全得多。然而,如果你的计算机上连接了多个外部驱动器,除了你想覆盖的那个,你应该将它们全部移除,以增加安全性。 + +选择你要安装镜像的驱动器,然后单击**写入磁盘**按钮。 + +![Media write][11] + +  + +等一会儿镜像被写入你的驱动器,然后查看 Don Watkins 对[如何从 USB 驱动器启动到 Linux][12]的出色概述 。 + +### 开始使用 Linux + +Fedora Media Writer 是一种将 Fedora Workstation 或 Server,或任何 Linux 发行版烧录到 USB 驱动器的方法,因此你可以在设备安装它之前试用它。试试吧,并在评论中分享你的经验和问题。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/fedora-media-writer + +作者:[Sumantro Mukherjee][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/sumantro +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/usb-hardware.png?itok=ROPtNZ5V (Multiple USB plugs in different colors) +[2]: https://github.com/FedoraQt/MediaWriter +[3]: https://fedoraproject.org/wiki/Architectures/ARM/Raspberry_Pi +[4]: https://opensource.com/sites/default/files/uploads/fmw_mainscreen.png (Fedora Media Writer main screen) +[5]: https://creativecommons.org/licenses/by-sa/4.0/ +[6]: https://docs.fedoraproject.org/en-US/fedora/f32/install-guide/install/Preparing_for_Installation/#_fedora_media_writer +[7]: https://github.com/FedoraQt/MediaWriter#building +[8]: https://github.com/FedoraQt/MediaWriter/releases +[9]: https://opensource.com/sites/default/files/mediawriter-image.png +[10]: https://opensource.com/article/19/12/mate-linux-desktop +[11]: https://opensource.com/sites/default/files/mediawriter-write.png (Media write) +[12]: https://opensource.com/article/20/4/first-linux-computer From ab61622935f2375ad04b76cd15f212591e3d1bd2 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 26 Oct 2020 09:11:27 +0800 Subject: [PATCH 0542/1156] translting --- ...201006 Start using virtual tables in Apache Cassandra 4.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201006 Start using virtual tables in Apache Cassandra 4.0.md b/sources/tech/20201006 Start using virtual tables in Apache Cassandra 4.0.md index 5cd6aa97fa..8b171df5c4 100644 --- a/sources/tech/20201006 Start using virtual tables in Apache Cassandra 4.0.md +++ b/sources/tech/20201006 Start using virtual tables in Apache Cassandra 4.0.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 0d6942b06c0a822950bb1500f93939bdc37104a0 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 26 Oct 2020 09:29:01 +0800 Subject: [PATCH 0543/1156] transalting --- ...201006 Start using virtual tables in Apache Cassandra 4.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201006 Start using virtual tables in Apache Cassandra 4.0.md b/sources/tech/20201006 Start using virtual tables in Apache Cassandra 4.0.md index 5cd6aa97fa..8b171df5c4 100644 --- a/sources/tech/20201006 Start using virtual tables in Apache Cassandra 4.0.md +++ b/sources/tech/20201006 Start using virtual tables in Apache Cassandra 4.0.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d905cc8887c7cd1c4ae36a2df9650d8dddbc50ba Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 26 Oct 2020 10:30:37 +0800 Subject: [PATCH 0544/1156] PRF @geekpi --- .../20201016 Set up ZFS on Linux with yum.md | 44 +++++++------------ 1 file changed, 17 insertions(+), 27 deletions(-) diff --git a/translated/tech/20201016 Set up ZFS on Linux with yum.md b/translated/tech/20201016 Set up ZFS on Linux with yum.md index cb61d4dc55..860b8c7f0d 100644 --- a/translated/tech/20201016 Set up ZFS on Linux with yum.md +++ b/translated/tech/20201016 Set up ZFS on Linux with yum.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Set up ZFS on Linux with yum) @@ -9,29 +9,28 @@ 在 Linux 上使用 yum 设置 ZFS ====== -在 Fedora 上使用 yum 仓库里来使用最新的 ZFS 特性。 -![Puzzle pieces coming together to form a computer screen][1] -我是一名 Fedora Linux 用户,我每天都会运行 `yum upgrade`。虽然这个习惯使我能够运行所有最新的软件([Fedora 的四个基础][2]之一的 “First” (第一),它也做到了),但它也会提醒 [ZFS][3] 存储平台和新内核之间的任何不兼容。 +> 在 Fedora 上使用 yum 仓库来获取最新的 ZFS 特性。 + +![](https://img.linux.net.cn/data/attachment/album/202010/26/103028g9q3v3e391c9b62v.jpg) + +我是一名 Fedora Linux 用户,我每天都会运行 `yum upgrade`。虽然这个习惯使我能够运行所有最新的软件([Fedora 的四个基础][2]之一的 “First” ,它也做到了),但它也会提醒 [ZFS][3] 存储平台和新内核之间的不兼容性。 作为一名开发者,有时我需要最新的 ZFS 分支的新特性。例如,ZFS 2.0.0 包含了一个令人兴奋的新功能,它大大[提高了 ZVOL 同步性能][4],这对我这个 KVM 用户来说至关重要。但这意味着,如果我想使用 2.0.0 分支,我必须自己构建 ZFS。 -起初,我只是在每次内核更新后从它的 Git 仓库中手动编译 ZFS。如果我忘记了,ZFS 就会在下次启动时无法被识别。幸运的是,我很快就学会了如何为 ZFS 设置动态内核模块支持 ([DKMS][5])。然而,这个解决方案并不完美。首先,它没有利用强大的 [yum][6] 系统,而这个系统可以帮助解决依赖关系和升级。此外,使用 yum 在你自己的包和上游包之间进行切换是非常容易的。 +起初,我只是在每次内核更新后从它的 Git 仓库中手动编译 ZFS。如果我忘记了,ZFS 就会在下次启动时无法被识别。幸运的是,我很快就学会了如何为 ZFS 设置动态内核模块支持 ([DKMS][5])。然而,这个解决方案并不完美。首先,它没有利用强大的 [yum][6] 系统,而这个系统可以帮助解决依赖关系和升级。此外,使用 `yum` 在你自己的包和上游包之间进行切换是非常容易的。 -在本文中,我将演示如何设置 yum 仓库来打包 ZFS。这个方案有两个步骤: +在本文中,我将演示如何设置 `yum` 仓库来打包 ZFS。这个方案有两个步骤: 1. 从 ZFS 的 Git 仓库中创建 RPM 包。 - 2. 建立一个 yum 仓库来托管这些包。 - - + 2. 建立一个 `yum` 仓库来托管这些包。 ### 创建 RPM 包 -要创建 RPM 包,你需要安装 RPM 工具链。yum 提供了组来捆绑安装工具: - +要创建 RPM 包,你需要安装 RPM 工具链。`yum` 提供了一个组来捆绑安装这些工具: ``` -`sudo dnf group install 'C Development Tools and Libraries' 'RPM Development Tools'` +sudo dnf group install 'C Development Tools and Libraries' 'RPM Development Tools' ``` 安装完这些之后,你必须从 ZFS Git 仓库中安装构建 ZFS 所需的所有包。这些包属于三个组: @@ -40,9 +39,6 @@ 2. 用于构建 ZFS 内核和用户态工具的库。 3. 构建 RPM 包的库。 - - - ``` sudo dnf install libtool autoconf automake gettext createrepo \     libuuid-devel libblkid-devel openssl-devel libtirpc-devel \ @@ -60,10 +56,7 @@ sudo dnf install libtool autoconf automake gettext createrepo \ 1. 用 `git` 克隆仓库,并切换到你希望使用的分支/标签。 2. 运行 Autotools 生成一个 makefile。 - 3. 运行 `make rpm`,如果一切正常,RPM 文件将被放置在构建文件夹中。 - - - + 3. 运行 `make rpm`,如果一切正常,RPM 文件将被放置在 `build` 文件夹中。 ``` $ git clone --branch=zfs-2.0.0-rc3 zfs @@ -75,10 +68,9 @@ $ make rpm ### 建立一个 yum 仓库 -在 yum 中,仓库是一个服务器或本地路径,包括元数据和 RPM 文件。用户设置一个 INI 配置文件,`yum` 命令会自动解析元数据并下载相应的软件包。 - -Fedora 提供了 `createrepo` 工具来设置 yum 仓库。首先,创建仓库,并将 ZFS 文件夹中的所有 RPM 文件复制到仓库中。然后运行 `createrepo --update` 将所有的包加入到元数据中。 +在 `yum` 中,仓库是一个服务器或本地路径,包括元数据和 RPM 文件。用户设置一个 INI 配置文件,`yum` 命令会自动解析元数据并下载相应的软件包。 +Fedora 提供了 `createrepo` 工具来设置 `yum` 仓库。首先,创建仓库,并将 ZFS 文件夹中的所有 RPM 文件复制到仓库中。然后运行 `createrepo --update` 将所有的包加入到元数据中。 ``` $ sudo mkdir -p /var/lib/zfs.repo @@ -89,17 +81,15 @@ $ sudo createrepo --update /var/lib/zfs.repo 在 `/etc/yum.repos.d` 中创建一个新的配置文件来包含仓库路径: - ``` $ echo \ -"[zfs-local]\\\nname=ZFS Local\\\nbaseurl=file:///var/lib/zfs.repo\\\nenabled=1\\\ngpgcheck=0" |\ +"[zfs-local]\\nname=ZFS Local\\nbaseurl=file:///var/lib/zfs.repo\\nenabled=1\\ngpgcheck=0" |\ sudo tee /etc/yum.repos.d/zfs-local.repo $ sudo dnf --repo=zfs-local list available --refresh ``` -终于完成了!你已经有了一个可以使用的 yum 仓库和 ZFS 包。现在你只需要安装它们。 - +终于完成了!你已经有了一个可以使用的 `yum` 仓库和 ZFS 包。现在你只需要安装它们。 ``` $ sudo dnf install zfs @@ -115,7 +105,7 @@ via: https://opensource.com/article/20/10/zfs-dnf 作者:[Sheng Mao][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 57622fa6a549c05b6df036b50507368ba0c21797 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 26 Oct 2020 10:31:04 +0800 Subject: [PATCH 0545/1156] PUB @geekpi https://linux.cn/article-12754-1.html --- .../20201016 Set up ZFS on Linux with yum.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201016 Set up ZFS on Linux with yum.md (98%) diff --git a/translated/tech/20201016 Set up ZFS on Linux with yum.md b/published/20201016 Set up ZFS on Linux with yum.md similarity index 98% rename from translated/tech/20201016 Set up ZFS on Linux with yum.md rename to published/20201016 Set up ZFS on Linux with yum.md index 860b8c7f0d..1386118d8b 100644 --- a/translated/tech/20201016 Set up ZFS on Linux with yum.md +++ b/published/20201016 Set up ZFS on Linux with yum.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12754-1.html) [#]: subject: (Set up ZFS on Linux with yum) [#]: via: (https://opensource.com/article/20/10/zfs-dnf) [#]: author: (Sheng Mao https://opensource.com/users/ivzhh) From eaad5fd772388125e9d2afb28ec757b0a7b726e1 Mon Sep 17 00:00:00 2001 From: xiao-song-123 <463020345@qq.com> Date: Mon, 26 Oct 2020 11:29:12 +0800 Subject: [PATCH 0546/1156] Update 20201001 How open source underpins blockchain technology.md --- ...n source underpins blockchain technology.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sources/tech/20201001 How open source underpins blockchain technology.md b/sources/tech/20201001 How open source underpins blockchain technology.md index 976fbf4411..c8c981d90d 100644 --- a/sources/tech/20201001 How open source underpins blockchain technology.md +++ b/sources/tech/20201001 How open source underpins blockchain technology.md @@ -1,11 +1,11 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How open source underpins blockchain technology) -[#]: via: (https://opensource.com/article/20/10/open-source-blockchain) -[#]: author: (Matt Shealy https://opensource.com/users/mshealy) +[#]: collector: "lujun9972" +[#]: translator: "xiao-song-123" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "How open source underpins blockchain technology" +[#]: via: "https://opensource.com/article/20/10/open-source-blockchain" +[#]: author: "Matt Shealy https://opensource.com/users/mshealy" How open source underpins blockchain technology ====== @@ -79,7 +79,7 @@ via: https://opensource.com/article/20/10/open-source-blockchain [a]: https://opensource.com/users/mshealy [b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cube_innovation_process_block_container.png?itok=vkPYmSRQ (cubes coming together to create a larger cube) +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cube_innovation_process_block_container.png?itok=vkPYmSRQ "cubes coming together to create a larger cube" [2]: https://www.linuxfoundation.org/wp-content/uploads/2020/08/2020_kernel_history_report_082720.pdf [3]: https://www.freecodecamp.org/news/what-is-a-dapp-a-guide-to-ethereum-dapps/ [4]: https://www.investopedia.com/ask/answers/063015/what-are-some-major-regulatory-agencies-responsible-overseeing-financial-institutions-us.asp From 48f0548fd77d1dd6e092d8a1c967ec255a60c04c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 26 Oct 2020 23:35:07 +0800 Subject: [PATCH 0547/1156] PRF @geekpi --- ...pp for Various Streaming Music Services.md | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/translated/tech/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md b/translated/tech/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md index 52a496be07..ecf2f46e68 100644 --- a/translated/tech/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md +++ b/translated/tech/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md @@ -1,32 +1,34 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (MellowPlayer is a Desktop App for Various Streaming Music Services) [#]: via: (https://itsfoss.com/mellow-player/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -MellowPlayer 是一款用于各种流媒体音乐服务的桌面应用 +MellowPlayer:一款用于各种流媒体音乐服务的桌面应用 ====== -_**简介:MellowPlayer 是一个免费开源的桌面应用,可以让你在 Linux 和 Windows 上整合基于网络的音乐流媒体服务。**_ +> MellowPlayer 是一个自由开源的桌面应用,可以让你在 Linux 和 Windows 上整合基于网络的音乐流媒体服务。 + +![][8] 毋庸置疑,很多用户都喜欢使用流媒体服务来收听自己喜欢的音乐,而不是从商店购买单首音乐或者下载收藏。 -当然,流媒体服务可以让你探索新的音乐,帮助艺术家轻松接触到更多的听众。但是,由于有许多的音乐流媒体服务([Soundcloud][1]、[Spotify][2]、[YouTube Music][3]、[Amazon Music][4] 等),因此当在使用电脑时,要有效地使用它们往往会变得很麻烦。 +当然,流媒体服务可以让你探索新的音乐,帮助艺术家轻松传播到更多的听众。但是,由于有许多的音乐流媒体服务([Soundcloud][1]、[Spotify][2]、[YouTube Music][3]、[Amazon Music][4] 等),因此当在使用电脑时,要有效地使用它们往往会变得很麻烦。 -你可以[在 Linux 上安装 Spotify][5],但没有 Amazon Music 的桌面应用。所以,有可能你无法从单一门户管理流媒体服务。 +你可以[在 Linux 上安装 Spotify][5],但没有 Amazon Music 的桌面应用,所以,有可能你无法从单一门户管理流媒体服务。 -如果一个桌面应用可以让你同时在 Windows 和 Linux 上免费整合流媒体服务呢?在本文中,我将介绍这样一款应用:“[MellowPlayer][6]”。 +如果一个桌面应用可以让你同时在 Windows 和 Linux 上免费整合流媒体服务呢?在本文中,我将介绍这样一款应用:[MellowPlayer][6]。 ### MellowPlayer: 集成各种流媒体音乐服务的开源应用 ![][7] -MellowPlayer 是一款免费开源的跨平台桌面应用,它可以让你整合多个流媒体服务,并在一个界面上管理它们。 +MellowPlayer 是一款自由开源的跨平台桌面应用,它可以让你整合多个流媒体服务,并在一个界面上管理它们。 -你可以整合多个支持的流媒体服务。你还可以从每个单独的服务中获得一定程度的控制权来调整你的体验。例如,你可以设置自动跳过广告或在 YouTube 上静音。 +你可以整合多个支持的流媒体服务。你还可以从每个服务中获得一定程度的控制权,来调整你的体验。例如,你可以设置在 YouTube 上自动跳过或静音广告。 对 Windows 和 Linux 的跨平台支持绝对是一个加分项。 @@ -36,25 +38,21 @@ MellowPlayer 是一款免费开源的跨平台桌面应用,它可以让你整 ### MellowPlayer 的特点 -![][8] - * 跨平台 (Windows 和 Linux) - * 免费且开源 - * 基于插件的应用,让你通过创建一个插件来添加新的服务 + * 自由且开源 + * 基于插件的应用,让你可以通过创建一个插件来添加新的服务 * 将服务作为本地桌面应用与系统托盘整合 * 支持热键 * 支持通知 * 收听历史 - - ### 在 Linux 上安装 MellowPlayer ![][9] -MellowPlayer 是以 [Flatpak 包][10]的形式提供的。我知道这让一些人很失望,但它在 Linux 中只有 Flaptak,WIndows 中只有一个可执行文件。如果你不知道,请按照我们的[在 Linux 上使用 Flatpak][11] 指南来开始使用。 +MellowPlayer 是以 [Flatpak 包][10]的形式提供的。我知道这让一些人很失望,但它在 Linux 中只有 Flaptak,Windows 中只有一个可执行文件。如果你不知道,请按照我们的[在 Linux 上使用 Flatpak][11] 指南来开始使用。 -[下载 MellowPlayer][12] +- [下载 MellowPlayer][12] ### 总结 @@ -71,7 +69,7 @@ via: https://itsfoss.com/mellow-player/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From d5ca879a272ccc50f2a75072eba535fa6d6245cc Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 26 Oct 2020 23:37:38 +0800 Subject: [PATCH 0548/1156] PUB @geekpi https://linux.cn/article-12759-1.html --- ...r is a Desktop App for Various Streaming Music Services.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md (98%) diff --git a/translated/tech/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md b/published/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md similarity index 98% rename from translated/tech/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md rename to published/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md index ecf2f46e68..b9a67ba724 100644 --- a/translated/tech/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md +++ b/published/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12759-1.html) [#]: subject: (MellowPlayer is a Desktop App for Various Streaming Music Services) [#]: via: (https://itsfoss.com/mellow-player/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From a1794ee4656d877ad345982a8a2b768688dc663d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 27 Oct 2020 05:01:59 +0800 Subject: [PATCH 0549/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201023?= =?UTF-8?q?=20Secure=20NTP=20with=20NTS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201023 Secure NTP with NTS.md --- sources/tech/20201023 Secure NTP with NTS.md | 171 +++++++++++++++++++ 1 file changed, 171 insertions(+) create mode 100644 sources/tech/20201023 Secure NTP with NTS.md diff --git a/sources/tech/20201023 Secure NTP with NTS.md b/sources/tech/20201023 Secure NTP with NTS.md new file mode 100644 index 0000000000..00cfdfd20d --- /dev/null +++ b/sources/tech/20201023 Secure NTP with NTS.md @@ -0,0 +1,171 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Secure NTP with NTS) +[#]: via: (https://fedoramagazine.org/secure-ntp-with-nts/) +[#]: author: (Miroslav Lichvar https://fedoramagazine.org/author/mlichvar/) + +Secure NTP with NTS +====== + +![][1] + +Many computers use the Network Time Protocol (NTP) to synchronize their system clocks over the internet. NTP is one of the few unsecured internet protocols still in common use. An attacker that can observe network traffic between a client and server can feed the client with bogus data and, depending on the client’s implementation and configuration, force it to set its system clock to any time and date. Some programs and services might not work if the client’s system clock is not accurate. For example, a web browser will not work correctly if the web servers’ certificates appear to be expired according to the client’s system clock. Use Network Time Security (NTS) to secure NTP. + +Fedora 33[1][2] is the first Fedora release to support NTS. NTS is a new authentication mechanism for NTP. It enables clients to verify that the packets they receive from the server have not been modified while in transit. The only thing an attacker can do when NTS is enabled is drop or delay packets. See [RFC8915][3] for further details about NTS. + +NTP can be secured well with symmetric keys. Unfortunately, the server has to have a different key for each client and the keys have to be securely distributed. That might be practical with a private server on a local network, but it does not scale to a public server with millions of clients. + +NTS includes a Key Establishment (NTS-KE) protocol that automatically creates the encryption keys used between the server and its clients. It uses Transport Layer Security (TLS) on TCP port 4460. It is designed to scale to very large numbers of clients with a minimal impact on accuracy. The server does not need to keep any client-specific state. It provides clients with cookies, which are encrypted and contain the keys needed to authenticate the NTP packets. Privacy is one of the goals of NTS. The client gets a new cookie with each server response, so it doesn’t have to reuse cookies. This prevents passive observers from tracking clients migrating between networks. + +The default NTP client in Fedora is _chrony_. Chrony added NTS support in version 4.0. The default configuration hasn’t changed. Chrony still uses public servers from the [pool.ntp.org][4] project and NTS is not enabled by default. + +Currently, there are very few public NTP servers that support NTS. The two major providers are Cloudflare and Netnod. The [Cloudflare servers][5] are in various places around the world. They use anycast addresses that should allow most clients to reach a close server. The [Netnod servers][6] are located in Sweden. In the future we will probably see more public NTP servers with NTS support. + +A general recommendation for configuring NTP clients for best reliability is to have at least three working servers. For best accuracy, it is recommended to select close servers to minimize network latency and asymmetry caused by asymmetric network routing. If you are not concerned about fine-grained accuracy, you can ignore this recommendation and use any NTS servers you trust, no matter where they are located. + +If you do want high accuracy, but you don’t have a close NTS server, you can mix distant NTS servers with closer non-NTS servers. However, such a configuration is less secure than a configuration using NTS servers only. The attackers still cannot force the client to accept arbitrary time, but they do have a greater control over the client’s clock and its estimate of accuracy, which may be unacceptable in some environments. + +### Enable client NTS in the installer + +When installing Fedora 33, you can enable NTS in the _Time & Date_ dialog in the _Network Time_ configuration. Enter the name of the server and check the NTS support before clicking the **+** (Add) button. You can add one or more servers or pools with NTS. To remove the default pool of servers (_2.fedora.pool.ntp.org_), uncheck the corresponding mark in the _Use_ column. + +![Network Time configuration in Fedora installer][7] + +### Enable client NTS in the configuration file + +If you upgraded from a previous Fedora release, or you didn’t enable NTS in the installer, you can enable NTS directly in _/etc/chrony.conf_. Specify the server with the _nts_ option in addition to the recommended _iburst_ option. For example: + +``` +server time.cloudflare.com iburst nts +server nts.sth1.ntp.se iburst nts +server nts.sth2.ntp.se iburst nts +``` + +You should also allow the client to save the NTS keys and cookies to disk, so it doesn’t have to repeat the NTS-KE session on each start. Add the following line to _chrony.conf_, if it is not already present: + +``` +ntsdumpdir /var/lib/chrony +``` + +If you don’t want NTP servers provided by DHCP to be mixed with the servers you have specified, remove or comment out the following line in _chrony.conf_: + +``` +sourcedir /run/chrony-dhcp +``` + +After you have finished editing _chrony.conf_, save your changes and restart the _chronyd_ service: + +``` +systemctl restart chronyd +``` + +### Check client status + +Run the following command under the root user to check whether the NTS key establishment was successful: + +``` +# chronyc -N authdata +Name/IP address Mode KeyID Type KLen Last Atmp NAK Cook CLen +========================================================================= +time.cloudflare.com NTS 1 15 256 33m 0 0 8 100 +nts.sth1.ntp.se NTS 1 15 256 33m 0 0 8 100 +nts.sth2.ntp.se NTS 1 15 256 33m 0 0 8 100 +``` + +The _KeyID_, _Type_, and _KLen_ columns should have non-zero values. If they are zero, check the system log for error messages from _chronyd_. One possible cause of failure is a firewall is blocking the client’s connection to the server’s TCP port ( port 4460). + +Another possible cause of failure is a certificate that is failing to verify because the client’s clock is wrong. This is a chicken-or-the-egg type problem with NTS. You may need to manually correct the date or temporarily disable NTS in order to get NTS working. If your computer has a real-time clock, as almost all computers do, and it’s backed up by a good battery, this operation should be needed only once. + +If the computer doesn’t have a real-time clock or battery, as is common with some small ARM computers like the Raspberry Pi, you can add the _-s_ option to _/etc/sysconfig/chronyd_ to restore time saved on the last shutdown or reboot. The clock will be behind the true time, but if the computer wasn’t shut down for too long and the server’s certificates were not renewed too close to their expiration, it should be sufficient for the time checks to succeed. As a last resort, you can disable the time checks with the _nocerttimecheck_ directive. See the _chrony.conf(5)_ man page for details. + +Run the following command to confirm that the client is making NTP measurements: + +``` +# chronyc -N sources +MS Name/IP address Stratum Poll Reach LastRx Last sample +=============================================================================== +^* time.cloudflare.com 3 6 377 45 +355us[ +375us] +/- 11ms +^+ nts.sth1.ntp.se 1 6 377 44 +237us[ +237us] +/- 23ms +^+ nts.sth2.ntp.se 1 6 377 44 -170us[ -170us] +/- 22ms +``` + +The _Reach_ column should have a non-zero value; ideally 377. The value 377 shown above is an octal number. It indicates that the last eight requests all had a valid response. The validation check will include NTS authentication if enabled. If the value only rarely or never gets to 377, it indicates that NTP requests or responses are getting lost in the network. Some major network operators are known to have middleboxes that block or limit rate of large NTP packets as a mitigation for amplification attacks that exploit the monitoring protocol of _ntpd_. Unfortunately, this impacts NTS-protected NTP packets, even though they don’t cause any amplification. The NTP working group is considering an alternative port for NTP as a workaround for this issue. + +### Enable NTS on the server + +If you have your own NTP server running _chronyd_, you can enable server NTS support to allow its clients to be synchronized securely. If the server is a client of other servers, it should use NTS or a symmetric key for its own synchronization. The clients assume the synchronization chain is secured between all servers up to the primary time servers. + +Enabling server NTS is similar to enabling HTTPS on a web server. You just need a private key and certificate. The certificate could be signed by the Let’s Encrypt authority using the _certbot_ tool, for example. When you have the key and certificate file (including intermediate certificates), specify them in _chrony.conf_ with the following directives: + +``` +ntsserverkey /etc/pki/tls/private/foo.example.net.key +ntsservercert /etc/pki/tls/certs/foo.example.net.crt +``` + +Make sure the _ntsdumpdir_ directive mentioned previously in the client configuration is present in _chrony.conf_. It allows the server to save its keys to disk, so the clients of the server don’t have to get new keys and cookies when the server is restarted. + +Restart the _chronyd_ service: + +``` +systemctl restart chronyd +``` + +If there are no error messages in the system log from _chronyd_, it should be accepting client connections. If the server has a firewall, it needs to allow both the UDP 123 and TCP 4460 ports for NTP and NTS-KE respectively. + +You can perform a quick test from a client machine with the following command: + +``` +$ chronyd -Q -t 3 'server foo.example.net iburst nts maxsamples 1' +2020-10-13T12:00:52Z chronyd version 4.0 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +NTS +SECHASH +IPV6 +DEBUG) +2020-10-13T12:00:52Z Disabled control of system clock +2020-10-13T12:00:55Z System clock wrong by -0.001032 seconds (ignored) +2020-10-13T12:00:55Z chronyd exiting +``` + +If you see a _System clock wrong_ message, it’s working correctly. + +On the server, you can use the following command to check how many NTS-KE connections and authenticated NTP packets it has handled: + +``` +# chronyc serverstats +NTP packets received : 2143106240 +NTP packets dropped : 117180834 +Command packets received : 16819527 +Command packets dropped : 0 +Client log records dropped : 574257223 +NTS-KE connections accepted: 104 +NTS-KE connections dropped : 0 +Authenticated NTP packets : 52139 +``` + +If you see non-zero _NTS-KE connections accepted_ and _Authenticated NTP packets_, it means at least some clients were able to connect to the NTS-KE port and send an authenticated NTP request. + +_— Cover photo by Louis. K on Unsplash —_ + +* * * + +1\. The Fedora 33 _Beta_ installer contains an older chrony prerelease which doesn’t work with current NTS servers because the NTS-KE port has changed. Consequently, in the Network Time configuration in the installer, the servers will always appear as not working. After installation, the chrony package needs to be updated before it will work with current servers. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/secure-ntp-with-nts/ + +作者:[Miroslav Lichvar][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/mlichvar/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/10/secure-ntp-with-nts-816x345.jpg +[2]: tmp.rl0XC1HIGm#footnote1 +[3]: https://tools.ietf.org/html/rfc8915 +[4]: https://www.pool.ntp.org +[5]: https://developers.cloudflare.com/time-services/nts/usage +[6]: https://www.netnod.se/time-and-frequency/how-to-use-nts +[7]: https://fedoramagazine.org/wp-content/uploads/2020/10/anaconda-nts.png From 8d447ca112223e6c3f0f1479b7d37341013773fb Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 27 Oct 2020 05:02:12 +0800 Subject: [PATCH 0550/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201021?= =?UTF-8?q?=20Incremental=20backup=20with=20Butterfly=20Backup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201021 Incremental backup with Butterfly Backup.md --- ...ncremental backup with Butterfly Backup.md | 290 ++++++++++++++++++ 1 file changed, 290 insertions(+) create mode 100644 sources/tech/20201021 Incremental backup with Butterfly Backup.md diff --git a/sources/tech/20201021 Incremental backup with Butterfly Backup.md b/sources/tech/20201021 Incremental backup with Butterfly Backup.md new file mode 100644 index 0000000000..5c2b99d950 --- /dev/null +++ b/sources/tech/20201021 Incremental backup with Butterfly Backup.md @@ -0,0 +1,290 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Incremental backup with Butterfly Backup) +[#]: via: (https://fedoramagazine.org/butterfly-backup/) +[#]: author: (Matteo Guadrini https://fedoramagazine.org/author/matteoguadrini/) + +Incremental backup with Butterfly Backup +====== + +![][1] + +### Introduction + +This article explains how to make incremental or differential backups, with a catalog available to restore (or export) at the point you want, with [Butterfly Backup][2]. + +#### Requirements + +Butterfly Backup is a simple wrapper of rsync written in python; the first requirement is **[python3.3][3]** or higher (plus module [cryptography][4] for _init_ action). Other requirements are **[openssh][5]** and **[rsync][6]** (version 2.5 or higher). Ok, let’s go! + +[Editors note: rsync version 3.2.3 is already installed on Fedora 33 systems] + +``` +$ sudo dnf install python3 openssh rsync git +$ sudo pip3 install cryptography +``` + +### Installation + +After that, installing Butterfly Backup is very simple by using the following commands to clone the repository locally, and set up Butterfly Backup for use: + +``` +$ git clone https://github.com/MatteoGuadrini/Butterfly-Backup.git +$ cd Butterfly-Backup +$ sudo python3 setup.py +$ bb --help +$ man bb +``` + +To upgrade, you would use the same commands too. + +### Example + +Butterfly Backup is a server to client tool and is installed on a server (or workstation). The restore process restores the files into the specified client. This process shares some of the options available to the backup process. + +Backups are organized accord to precise catalog; this is an example: + +``` +$ tree destination/of/backup +. +├── destination +│ ├── hostname or ip of the PC under backup +│ │ ├── timestamp folder +│ │ │ ├── backup folders +│ │ │ ├── backup.log +│ │ │ └── restore.log +│ │ ├─── general.log +│ │ └─── symlink of last backup +│ +├── export.log +├── backup.list +└── .catalog.cfg +``` + +Butterfly Backup has six main operations, referred to as **actions**, you can get information about them with the _–help_ command. + +``` +$ bb --help +usage: bb [-h] [--verbose] [--log] [--dry-run] [--version] + {config,backup,restore,archive,list,export} ... + +Butterfly Backup + +optional arguments: + -h, --help show this help message and exit + --verbose, -v Enable verbosity + --log, -l Create a log + --dry-run, -N Dry run mode + --version, -V Print version + +action: + Valid action + + {config,backup,restore,archive,list,export} + Available actions + config Configuration options + backup Backup options + restore Restore options + archive Archive options + list List options + export Export options +``` + +#### Configuration + +Configuration mode is straight forward; If you’re already familiar with the exchange keys and OpenSSH, you probably won’t need it. First, you must create a configuration (rsa keys), for instance: + +``` +$ bb config --new +SUCCESS: New configuration successfully created! +``` + +After creating the configuration, the keys will be installed (copied) on the hosts you want to backup: + +``` +$ bb config --deploy host1 +Copying configuration to host1; write the password: +/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/arthur/.ssh/id_rsa.pub" +/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed +/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys +arthur@host1's password: + +Number of key(s) added: 1 + +Now try logging into the machine, with: "ssh 'arthur@host1'" +and check to make sure that only the key(s) you wanted were added. + +SUCCESS: Configuration copied successfully on host1! +``` + +#### Backup + +There are two backup modes: _single_ and _bulk_. +The most relevant features of the two backup modes are the parallelism and retention of old backups. See the two parameters _–parallel_ and _–retention_ in the [documentation][7]. + +##### Single backup + +The backup of a single machine consists in taking the files and folders indicated in the command line, and putting them into the cataloging structure indicated above. In other words, copy all file and folders of a machine into a path. + +This is an examples: + +``` +$ bb backup --computer host1 --destination /mnt/backup --data User Config --type Unix +Start backup on host1 +SUCCESS: Command rsync -ah --no-links arthur@host1:/home :/etc /mnt/backup/host1/2020_09_19__10_28 +``` + +##### Bulk backup + +Above all, bulk mode backups share the same options as single mode, with the difference that they accept a file containing a list of hostnames or ips. In this mode backups will performed in parallel (by default 5 machines at a time). Above all, if you want to run fewer or more machines in parallel, specify the _–parallel_ parameter. + +Incremental of the previous backup, for instance: + +``` +$ cat /home/arthur/pclist.txt +host1 +host2 +host3 +$ bb backup --list /home/arthur/pclist.txt --destination /mnt/backup --data User Config --type Unix +ERROR: The port 22 on host2 is closed! +ERROR: The port 22 on host3 is closed! +Start backup on host1 +SUCCESS: Command rsync -ahu --no-links --link-dest=/mnt/backup/host1/2020_09_19__10_28 arthur@host1:/home :/etc /mnt/backup/host1/2020_09_19__10_50 +``` + +There are four backup modes, which you specify with the _–mode_ flag: **Full** (backup all files) , **Mirror** (backup all files in mirror mode), **Differential** (is based on the latest _Full_ backup) and **Incremental** (is based on the latest backup). +The default mode is _Incremental_; _Full_ mode is set by default when the flag is not specified. + +#### Listing catalog + +The first time you run backup commands, the catalog is created. The catalog is used for future backups and all the restores that are made through Butterfly Backup. To query this catalog use the list command. +First, let’s query the catalog in our example: + +``` +$ bb list --catalog /mnt/backup + +BUTTERFLY BACKUP CATALOG + +Backup id: aba860b0-9944-11e8-a93f-005056a664e0 +Hostname or ip: host1 +Timestamp: 2020-09-19 10:28:12 + +Backup id: dd6de2f2-9a1e-11e8-82b0-005056a664e0 +Hostname or ip: host1 +Timestamp: 2020-09-19 10:50:59 +``` + +Press _q_ for exit and select a backup-id: + +``` +$ bb list --catalog /mnt/backup --backup-id dd6de2f2-9a1e-11e8-82b0-005056a664e0 +Backup id: dd6de2f2-9a1e-11e8-82b0-005056a664e0 +Hostname or ip: host1 +Type: Incremental +Timestamp: 2020-09-19 10:50:59 +Start: 2020-09-19 10:50:59 +Finish: 2020-09-19 11:43:51 +OS: Unix +ExitCode: 0 +Path: /mnt/backup/host1/2020_09_19__10_50 +List: backup.log +etc +home +``` + +To export the catalog list use it with an external tool like _cat_, include the _–_–_log_ flag: + +``` +$ bb list --catalog /mnt/backup --log +$ cat /mnt/backup/backup.list +``` + +#### Restore + +The restore process is the exact opposite of the backup process. It takes the files from a specific backup and push it to the destination computer. +This command perform a restore on the same machine of the backup, for instance: + +``` +$ bb restore --catalog /mnt/backup --backup-id dd6de2f2-9a1e-11e8-82b0-005056a664e0 --computer host1 --log +Want to do restore path /mnt/backup/host1/2020_09_19__10_50/etc? To continue [Y/N]? y +Want to do restore path /mnt/backup/host1/2020_09_19__10_50/home? To continue [Y/N]? y +SUCCESS: Command rsync -ahu -vP --log-file=/mnt/backup/host1/2020_09_19__10_50/restore.log /mnt/backup/host1/2020_09_19__10_50/etc arthur@host1:/restore_2020_09_19__10_50 +SUCCESS: Command rsync -ahu -vP --log-file=/mnt/backup/host1/2020_09_19__10_50/restore.log /mnt/backup/host1/2020_09_19__10_50/home/* arthur@host1:/home +``` + +> Without specifying the “_type_” flag that indicates the operating system on which the data are being retrieved, Butterfly Backup will select it directly from the catalog via the backup-id. + +#### Archive old backup + +Archive operations are used to store backups by saving disk space. + +``` +$ bb archive --catalog /mnt/backup/ --days 1 --destination /mnt/archive/ --verbose --log +INFO: Check archive this backup f65e5afe-9734-11e8-b0bb-005056a664e0. Folder /mnt/backup/host1/2020_09_18__17_50 +INFO: Check archive this backup 4f2b5f6e-9939-11e8-9ab6-005056a664e0. Folder /mnt/backup/host1/2020_09_15__07_26 +SUCCESS: Delete /mnt/backup/host1/2020_09_15__07_26 successfully. +SUCCESS: Archive /mnt/backup/host1/2020_09_15__07_26 successfully. +$ ls /mnt/archive +host1 +$ ls /mnt/archive/host1 +2020_09_15__07_26.zip +``` + +After that, look in the catalog and see that the backup was actually archived: + +``` +$ bb list --catalog /mnt/backup/ -i 4f2b5f6e-9939-11e8-9ab6-005056a664e0 +Backup id: 4f2b5f6e-9939-11e8-9ab6-005056a664e0 +Hostname or ip: host1 +Type: Incremental +Timestamp: 2020-09-15 07:26:46 +Start: 2020-09-15 07:26:46 +Finish: 2020-09-15 08:43:45 +OS: Unix +ExitCode: 0 +Path: /mnt/backup/host1/2020_09_15__07_26 +Archived: True +``` + +### Conclusion + +Butterfly Backup was born from a very complex need; this tool provides superpowers to rsync, automates the backup and restore process. In addition, the catalog allows you to have a system similar to a “time machine”. + +In conclusion, Butterfly Backup is a lightweight, versatile, simple and scriptable backup tool. + +One more thing; Easter egg: _**bb** -Vv_ + +Thank you for reading my post. + +Full documentation: [https://butterfly-backup.readthedocs.io/][7] +Github: + +* * * + +_Photo by [Manu M][8] on [Unsplash][9]_. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/butterfly-backup/ + +作者:[Matteo Guadrini][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/matteoguadrini/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/09/butterfly-backup-816x345.jpg +[2]: https://matteoguadrini.github.io/Butterfly-Backup/ +[3]: https://fedoramagazine.org/help-port-python-packages-python-3/ +[4]: https://cryptography.io/en/latest/ +[5]: https://fedoramagazine.org/open-source-ssh-clients/ +[6]: https://fedoramagazine.org/scp-users-migration-guide-to-rsync/ +[7]: https://butterfly-backup.readthedocs.io/en/latest/ +[8]: https://unsplash.com/@leocub?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[9]: https://unsplash.com/s/photos/butterfly?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText From a3dc79bfe623f923a4bcbe3a299407f557f799eb Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 27 Oct 2020 05:02:24 +0800 Subject: [PATCH 0551/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201019?= =?UTF-8?q?=20Web=20of=20Trust,=20Part=202:=20Tutorial?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201019 Web of Trust, Part 2- Tutorial.md --- ...20201019 Web of Trust, Part 2- Tutorial.md | 198 ++++++++++++++++++ 1 file changed, 198 insertions(+) create mode 100644 sources/tech/20201019 Web of Trust, Part 2- Tutorial.md diff --git a/sources/tech/20201019 Web of Trust, Part 2- Tutorial.md b/sources/tech/20201019 Web of Trust, Part 2- Tutorial.md new file mode 100644 index 0000000000..b5e17fc7cc --- /dev/null +++ b/sources/tech/20201019 Web of Trust, Part 2- Tutorial.md @@ -0,0 +1,198 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Web of Trust, Part 2: Tutorial) +[#]: via: (https://fedoramagazine.org/web-of-trust-part-2-tutorial/) +[#]: author: (Kevin "Eonfge" Degeling https://fedoramagazine.org/author/eonfge/) + +Web of Trust, Part 2: Tutorial +====== + +![][1] + +["The spider web"][2] by [bluesbby][3] is licensed under [CC BY 2.0][4][][4] + +The [previous article][5] looked at how the Web of Trust works in concept, and how the Web of Trust is implemented at Fedora. In this article, you’ll learn how to do it yourself. The power of this system lies in everybody being able to validate the actions of others—if you know how to validate somebody’s work, you’re contributing to the strength of our shared security. + +### Choosing a project + +[Remmina][6] is a remote desktop client written in GTK+. It aims to be useful for system administrators and travelers who need to work with lots of remote computers in front of either large monitors or tiny netbooks. In the current age, where many people must work remotely or at least manage remote servers, the security of a program like Remmina is critical. Even if you do not use it yourself, you can contribute to the Web of Trust by checking it for others. + +The question is: how do you know that a given version of Remmina is good, and that the original developer—or distribution server—has not been compromised? + +For this tutorial, you’ll use [Flatpak][7] and the [Flathub][8] repository. Flatpak is intentionally well-suited for making verifiable rebuilds, which is one of the tenets of the Web of Trust. It’s easier to work with since it doesn’t require users to download independent development packages. Flatpak also uses techniques to prevent in‑flight tampering, using hashes to validate its read‑only state. As far as the Web of Trust is concerned, Flatpak is the future. + +For this guide, you use Remmina, but this guide generally applies to every application you use. It’s also not exclusive to Flatpak, and the general steps also apply to Fedora’s repositories. In fact, if you’re currently reading this article on Debian or Arch, you can still follow the instructions. If you want to follow along using traditional RPM repositories, make sure to check out [this article][9]. + +### Installing and checking + +To install Remmina, use the Software Center or run the following from a terminal: + +``` +flatpak install flathub org.remmina.Remmina -y +``` + +After installation, you’ll find the files in: + +``` +/var/lib/flatpak/app/org.remmina.Remmina/current/active/files/ +``` + +Open a terminal here and find the following directories using _ls -la_: + +``` +total 44 +drwxr-xr-x. 2 root root 4096 Jan 1 1970 bin +drwxr-xr-x. 3 root root 4096 Jan 1 1970 etc +drwxr-xr-x. 8 root root 4096 Jan 1 1970 lib +drwxr-xr-x. 2 root root 4096 Jan 1 1970 libexec +-rw-r--r--. 2 root root 18644 Aug 25 14:37 manifest.json +drwxr-xr-x. 2 root root 4096 Jan 1 1970 sbin +drwxr-xr-x. 15 root root 4096 Jan 1 1970 share +``` + +#### Getting the hashes + +In the _bin_ directory you will find the main binaries of the application, and in _lib_ you find all dependencies that Remmina uses. Now calculate a hash for _./bin/remmina_: + +``` +sha256sum ./bin/* +``` + +This will give you a list of numbers: checksums. Copy them to a temporary file, as this is the current version of Remmina that Flathub is distributing. These numbers have something special: only an exact copy of Remmina can give you the same numbers. Any change in the code—no matter how minor—will produce different numbers. + +Like Fedora’s Koji and Bodhi build and update services, Flathub has all its build servers in plain view. In the case of Flathub, look at [Buildbot][10] to see who is responsible for the official binaries of a package. Here you will find all of the logs, including all the failed builds and their paper trail. + +![][11] + +#### Getting the source + +The main Flathub project is hosted on GitHub, where the exact compile instructions (“manifest” in Flatpak terms) are visible for all to see. Open a new terminal in your Home folder. Clone the instructions, and possible submodules, using one command: + +``` +git clone --recurse-submodules https://github.com/flathub/org.remmina.Remmina +``` + +#### Developer tools + +Start off by installing the Flatpak Builder: + +``` +sudo dnf install flatpak-builder +``` + +After that, you’ll need to get the right SDK to rebuild Remmina. In the manifest, you’ll find the current SDK is. + +``` +"runtime": "org.gnome.Platform", + "runtime-version": "3.38", + "sdk": "org.gnome.Sdk", + "command": "remmina", +``` + +This indicates that you need the GNOME SDK, which you can install with: + +``` +flatpak install org.gnome.Sdk//3.38 +``` + +This provides the latest versions of the Free Desktop and GNOME SDK. There are also additional SDK’s for additional options, but those are beyond the scope of this tutorial. + +#### Generating your **own hashes** + +Now that everything is set up, compile your version of Remmina by running: + +``` +flatpak-builder build-dir org.remmina.Remmina.json --force-clean +``` + +After this, your terminal will print a lot of text, your fans will start spinning, and you’re compiling Remmina. If things do not go so smoothly, refer to the [Flatpak Documentation][12]; troubleshooting is beyond the scope of this tutorial. + +Once complete, you should have the directory ._/build-dir/files/_, which should contain the same layout as above. Now the moment of truth: it’s time to generate the hashes for the built project: + +``` +sha256sum ./bin/* +``` + +![][13] + +You should get exactly the same numbers. This proves that the version on Flathub is indeed the version that the Remmina developers and maintainers intended for you to run. This is great, because this shows that Flathub has not been compromised. The web of trust is strong, and you just made it a bit better. + +### Going deeper + +But what about the _./lib/_ directory? And what version of Remmina did you actually compile? This is where the Web of Trust starts to branch. First, you can also double-check the hashes of the _./lib/_ directory. Repeat the _sha256sum_ command using a different directory. + +But what version of Remmina did you compile? Well, that’s in the Manifest. In the text file you’ll find (usually at the bottom) the git repository and branch that you just used. At the time of this writing, that is: + +``` +"type": "git", +"url": "https://gitlab.com/Remmina/Remmina.git", +"tag": "v1.4.8", +"commit": "7ebc497062de66881b71bbe7f54dabfda0129ac2" +``` + +Here, you can decide to look at the Remmina code itself: + +``` +git clone --recurse-submodules https://gitlab.com/Remmina/Remmina.git +cd ./Remmina +git checkout tags/v1.4.8 +``` + +The last two commands are important, since they ensure that you are looking at the right version of Remmina. Make sure you use the corresponding tag of the Manifest file. you can see everything that you just built. + +### What if…? + +The question on some minds is: what if the hashes don’t match? Quoting a famous novel: “Don’t Panic.” There are multiple legitimate reasons as to why the hashes do not match. + +It might be that you are not looking at the same version. If you followed this guide to a T, it should give matching results, but minor errors will cause vastly different results. Repeat the process, and ask for help if you’re unsure if you’re making errors. Perhaps Remmina is in the process of updating. + +But if that still doesn’t justify the mismatch in hashes, go to the [maintainers of Remmina][14] on Flathub and open an issue. Assume good intentions, but you might be onto something that isn’t totally right. + +The most obvious upstream issue is that Remmina does not properly support reproducible builds yet. The code of Remmina needs to be written in such a way that repeating the same action twice, gives the same result. For developers, there is an [entire guide][15] on how to do that. If this is the case, there should be an issue on the upstream bug-tracker, and if it is not there, make sure that you create one by explaining your steps and the impact. + +If all else fails, and you’ve informed upstream about the discrepancies and they to don’t know what is happening, then it’s time to send an email to the Administrators of Flathub and the developer in question. + +### Conclusion + +At this point, you’ve gone through the entire process of validating a single piece of a bigger picture. Here, you can branch off in different directions: + + * Try another Flatpak application you like or use regularly + * Try the RPM version of Remmina + * Do a deep dive into the C code of Remmina + * Relax for a day, knowing that the Web of Trust is a collective effort + + + +In the grand scheme of things, we can all carry a small part of responsibility in the Web of Trust. By taking free/libre open source software (FLOSS) concepts and applying them in the real world, you can protect yourself and others. Last but not least, by understanding how the Web of Trust works you can see how FLOSS software provides unique protections. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/web-of-trust-part-2-tutorial/ + +作者:[Kevin "Eonfge" Degeling][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/eonfge/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/09/weboftrust2-816x345.jpg +[2]: https://www.flickr.com/photos/17367470@N05/21329974875 +[3]: https://www.flickr.com/photos/17367470@N05 +[4]: https://creativecommons.org/licenses/by/2.0/?ref=ccsearch&atype=html +[5]: https://fedoramagazine.org/web-of-trust-part-1-concept/ +[6]: https://remmina.org/ +[7]: https://flatpak.org/ +[8]: https://flathub.org/home +[9]: https://fedoramagazine.org/how-rpm-packages-are-made-the-source-rpm/ +[10]: https://flathub.org/builds/#/ +[11]: https://fedoramagazine.org/wp-content/uploads/2020/09/Screenshot_2020-09-24-Flathub-builds-1024x434.png +[12]: https://docs.flatpak.org/en/latest/building.html +[13]: https://fedoramagazine.org/wp-content/uploads/2020/09/Screenshot-from-2020-09-22-21-49-47.png +[14]: https://github.com/flathub/org.remmina.Remmina +[15]: https://reproducible-builds.org/ From 49528742690609ab09df318a3b546dde2ac5f1cc Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 27 Oct 2020 05:03:50 +0800 Subject: [PATCH 0552/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201027?= =?UTF-8?q?=20Map=20Your=20Gamepad=20Buttons=20With=20Keyboard,=20Mouse,?= =?UTF-8?q?=20or=20Macros/Scripts=20Using=20AntiMicroX=20in=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201027 Map Your Gamepad Buttons With Keyboard, Mouse, or Macros-Scripts Using AntiMicroX in Linux.md --- ...acros-Scripts Using AntiMicroX in Linux.md | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 sources/tech/20201027 Map Your Gamepad Buttons With Keyboard, Mouse, or Macros-Scripts Using AntiMicroX in Linux.md diff --git a/sources/tech/20201027 Map Your Gamepad Buttons With Keyboard, Mouse, or Macros-Scripts Using AntiMicroX in Linux.md b/sources/tech/20201027 Map Your Gamepad Buttons With Keyboard, Mouse, or Macros-Scripts Using AntiMicroX in Linux.md new file mode 100644 index 0000000000..2fef431fa4 --- /dev/null +++ b/sources/tech/20201027 Map Your Gamepad Buttons With Keyboard, Mouse, or Macros-Scripts Using AntiMicroX in Linux.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Map Your Gamepad Buttons With Keyboard, Mouse, or Macros/Scripts Using AntiMicroX in Linux) +[#]: via: (https://itsfoss.com/antimicrox/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Map Your Gamepad Buttons With Keyboard, Mouse, or Macros/Scripts Using AntiMicroX in Linux +====== + +_**Brief: AntiMicroX is a GUI tool to map your gamepad with your keyboard, mouse, or custom macros/scripts in Linux. Let’s take a closer look at it.**_ + +Gaming peripherals on Linux do not have a great reputation, but we do have some interesting open source tools that can make things easier for you. For instance, I’ve previously covered a tool [Piper which lets you configure your gaming mouse][1]. + +This time, let me introduce you to an exciting open source tool that lets you utilize your game pad by mapping it to your keyboard, mouse, scripts, or macros. + +![][2] + +In this article, I’ll mention why you might need it and its key features to help you know more about it. + +### AntiMicroX: An open source tool to map your gamepad + +Of course, this isn’t for everyone but an open source GUI tool for something useful, why not? + +Maybe you have a system that you utilize for media consumption (or as a [media server on Linux][3]). Or, maybe you want to use a desktop application using your gamepad. + +Also, you may want to use it to play a game that does not offer gamepad support. + +For such cases, AntiMicroX is a tool that you would want to explore (even if that’s just for fun). + +### Features of AntiMicroX + +![][4] + + * Map with keyboard buttons + * Controller mapping to make sure the host detects the correct triggers + * Multiple controller profile + * Ability to launch an executable using the gamepad + * Map with mouse buttons + * Gamepad calibration option + * Tweak Gamepad poll rate (if needed) + * Auto profile support + + + +### Installing AntiMicroX on Linux + +![][5] + +AntiMicroX offers a wide range of options to get it installed on a Linux distribution. You will find a DEB package, [Flatpak package][6], and an AppImage file. + +It is easy to [install it using the deb package][7]. In addition to that, you may refer to our [Flatpak guide][8] or [AppImage guide][9] to get started installing AntiMicroX as well. + +You can also build it from source if needed. Nevertheless, you should find all the necessary instructions in its [GitHub page][10] along with the packages in its [releases section][11]. + +[AntiMicroX][12] + +**Recommended Read:** + +![][13] + +#### [How to Configure Gaming Mouse on Linux Using Piper GUI Tool][1] + +Love gaming on Linux? Take your gaming to the next level by configuring your gaming mouse in Linux using Piper GUI application. + +### My Thoughts on Using AntiMicroX on Linux + +Surprisingly, mapping the game pad buttons was easier than you would expect. I was able to map the buttons with my keyboard and assign custom macros/scripts as well. + +Mapping the buttons with the mouse isn’t that simple and may not work well if you already have the mouse buttons assigned for different macros (like in my case). For gaming, it would be nice to calibrate and map the gamepad buttons properly before pairing it up with the keyboard buttons. + +It worked just fine with my generic controller. You can definitely try it out. + +Did you know about this? Have you tried it yet? Now that we’re looking for interesting open-source tools, do you know about anything else similar to this for [gaming on Linux][14]? + +Let me know your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/antimicrox/ + +作者:[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/piper-configure-gaming-mouse-linux/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/antimicrox-mapping.png?resize=800%2C557&ssl=1 +[3]: https://itsfoss.com/best-linux-media-server/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/antimicrox-gamepad.jpg?resize=800%2C631&ssl=1 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/antimicrox-calibration.jpg?resize=800%2C637&ssl=1 +[6]: https://itsfoss.com/what-is-flatpak/ +[7]: https://itsfoss.com/install-deb-files-ubuntu/ +[8]: https://itsfoss.com/flatpak-guide/ +[9]: https://itsfoss.com/use-appimage-linux/ +[10]: https://github.com/AntiMicroX/antimicrox +[11]: https://github.com/AntiMicroX/antimicrox/releases +[12]: https://github.com/AntiMicroX/antimicrox/ +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/configuring-gaming-mouse-linux.png?fit=800%2C450&ssl=1 +[14]: https://itsfoss.com/linux-gaming-guide/ From 417fd2e748c3df55fe50bb03602356c72515c5cd Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 27 Oct 2020 05:04:16 +0800 Subject: [PATCH 0553/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201027?= =?UTF-8?q?=20KDE=20Neon=20vs=20Kubuntu:=20What=E2=80=99s=20the=20Differen?= =?UTF-8?q?ce=20Between=20the=20Two=20KDE=20Distribution=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md --- ...erence Between the Two KDE Distribution.md | 125 ++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 sources/tech/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md diff --git a/sources/tech/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md b/sources/tech/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md new file mode 100644 index 0000000000..7c109aa415 --- /dev/null +++ b/sources/tech/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md @@ -0,0 +1,125 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (KDE Neon vs Kubuntu: What’s the Difference Between the Two KDE Distribution?) +[#]: via: (https://itsfoss.com/kde-neon-vs-kubuntu/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +KDE Neon vs Kubuntu: What’s the Difference Between the Two KDE Distribution? +====== + +When you find two Linux distributions based on [Ubuntu][1] and powered up by [KDE][2], which one do you choose? + + * [Kubuntu][3] is the official KDE flavor from Ubuntu. + * [KDE Neon][4] is the Ubuntu-based distribution by KDE itself. + + + +I know it is often confusing especially if you have never used either of them but got them as recommendations for usage. Hence, to help you make a decision, I thought of compiling a list of differences (and similarities) between KDE Neon and Kubuntu. + +Let’s start with getting to know the similarities and then proceed with the differences. + +**Note:** _Depending on your system, your experience with the distributions might differ. So, take this article as a reference and not a “what’s better” comparison._ + +### KDE Neon vs Kubuntu: Feature wise comparison + +![][5] + +It’s always good to compare distribution based on their similarities. So, theoretically, I’ve tried to put down the most important differences. + +However, it is worth noting that the compatibility, performance, and the stability of the distros will vary depending on your hardware and hence, that has not been accounted here. + +#### Ubuntu as the Base + +![][6] + +Yes, both the Linux distributions are based on Ubuntu. However, KDE Neon is based only on the latest Ubuntu LTS release while Kubuntu offers an Ubuntu LTS based edition and a non-LTS edition as well. + +So, with KDE Neon, you would expect to get your hands on the latest Ubuntu features right after a few months of the next Ubuntu LTS release (2 years). But, with Kubuntu, you have got the option to opt for a non-LTS release and try on the latest Ubuntu releases with 6 months of software updates. + +KDE Neon does offer testing editions and developer editions but those are meant to test pre-release KDE software. + +#### KDE Plasma Desktop + +![][7] + +Even though both of the distros feature KDE plasma desktop and you can get the same level of customization, KDE Neon gets the latest KDE Plasma desktop release first. + +If you did not know already, KDE Neon is developed by the official KDE team and was announced by Jonathan Riddell (Founder of Kubuntu) after he was [forced out of Kubuntu by Canonical][8]. + +So, not just limited to the latest Plasma desktop, but if you want the latest and greatest of KDE as soon as possible, KDE Neon is the perfect choice for that. + +Kubuntu will eventually get the update for newer KDE software — but it will take time. If you’re not too sure about the latest KDE software/desktop and all you need is a stable KDE-powered system, you should go with Kubuntu LTS releases. + +#### Pre-installed Software + +Out of the box, you will find Kubuntu to have several essential tools and applications pre-installed. But, with KDE Neon, you would need to find and install several applications and tools. + +To give you some perspective, KDE Neon might turn out to be a lightweight distro when compared to Kubuntu. However, for new Linux users, they might find Kubuntu as an easy-to-use experience with more essential software and tools pre-installed. + +**Recommended Read:** + +![][9] + +#### [KDE Neon: KDE’s Very Own Linux Distribution Provides the Latest and Greatest of KDE With the Simplicity of Ubuntu][10] + +#### Software Updates + +If you are not using a metered connection, this may not matter at all. But, just for the sake of it, I should mention that KDE Neon gets more software updates considering the regular Ubuntu LTS fixes/updates along with KDE software updates. + +With Kubuntu, you just get the Ubuntu LTS updates (unless you’re using the non-LTS edition). So, technically, you can expect less number of updates. + +#### Ubuntu with KDE vs Plasma Experience + +![][11] + +I know if you haven’t tried both of them, you might think of them as pretty similar. But, Kubuntu is an official flavour of Ubuntu that focused more on the experience with Ubuntu on a KDE desktop environment. + +While KDE Neon is technically the same thing, but it is all about getting the best-in-class Plasma desktop experience with the latest stuff on board. + +Even though both the distributions work amazing out of the box, they have a different vision and the development proceeds on both them accordingly. You just have to decide what you want for yourself and choose one of them. + +#### Hardware Compatibility + +![Kubuntu Focus Laptop][12] + +As I mentioned earlier, this is not a fact-based point here. But, as per my quick look on the feedback or experiences shared by the users online, it seems that Kubuntu works with a wide range of old hardware along with new hardware (potentially dating back to 2012) while KDE Neon may not. + +It’s just a thing to keep in mind if you try KDE Neon and it doesn’t work for some reason. You know what to do. + +**Wrapping Up** + +So, what would it be? KDE Neon or Kubuntu? That’s really is your choice. + +Both are good choices for a [beginner-friendly Linux distribution][13] but if you want the latest KDE Plasma desktop, KDE Neon gets the edge here. You can read more about it in our [review of KDE Neon][10]. + +Feel free to let me know your thoughts in the comments down below and what do you find good/bad on either of them. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/kde-neon-vs-kubuntu/ + +作者:[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://ubuntu.com/ +[2]: https://kde.org/ +[3]: https://kubuntu.org +[4]: https://neon.kde.org +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/kde-neon-vs-kubuntu.png?resize=800%2C450&ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/install_ubuntu_8.jpg?resize=796%2C611&ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/kde-plasma-5-20-feat.png?resize=800%2C394&ssl=1 +[8]: https://lwn.net/Articles/645973/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/kde-neon-review.jpg?fit=800%2C450&ssl=1 +[10]: https://itsfoss.com/kde-neon-review/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/kubuntu-kde.jpg?resize=800%2C450&ssl=1 +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/kubuntu-focus-laptop.jpg?resize=800%2C600&ssl=1 +[13]: https://itsfoss.com/best-linux-beginners/ From d44fccb257f72aac1fbc9185aab5835508d7b63d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 27 Oct 2020 05:04:41 +0800 Subject: [PATCH 0554/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201027?= =?UTF-8?q?=20You=20can=20Surf=20Internet=20in=20Linux=20Terminal=20With?= =?UTF-8?q?=20These=20Command=20Line=20Browsers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201027 You can Surf Internet in Linux Terminal With These Command Line Browsers.md --- ...rminal With These Command Line Browsers.md | 170 ++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 sources/tech/20201027 You can Surf Internet in Linux Terminal With These Command Line Browsers.md diff --git a/sources/tech/20201027 You can Surf Internet in Linux Terminal With These Command Line Browsers.md b/sources/tech/20201027 You can Surf Internet in Linux Terminal With These Command Line Browsers.md new file mode 100644 index 0000000000..7c00882a6b --- /dev/null +++ b/sources/tech/20201027 You can Surf Internet in Linux Terminal With These Command Line Browsers.md @@ -0,0 +1,170 @@ +[#]: 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 +====== + +I’m 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 didn’t 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 you’re 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 it’s 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 I’d 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, that’s a good thing. + +On the other hand, the window does not re-size well while using it from the terminal. I haven’t looked for any solutions to that, so if you’re 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 you’re 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 you’d 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 + +It’s no surprise that there aren’t 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/ From 47da5057c8fa0b0e5879c50f399979b09c89887f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 27 Oct 2020 05:05:49 +0800 Subject: [PATCH 0555/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201026?= =?UTF-8?q?=207=20Git=20tricks=20that=20changed=20my=20life?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201026 7 Git tricks that changed my life.md --- ...01026 7 Git tricks that changed my life.md | 203 ++++++++++++++++++ 1 file changed, 203 insertions(+) create mode 100644 sources/tech/20201026 7 Git tricks that changed my life.md diff --git a/sources/tech/20201026 7 Git tricks that changed my life.md b/sources/tech/20201026 7 Git tricks that changed my life.md new file mode 100644 index 0000000000..e2b14241d4 --- /dev/null +++ b/sources/tech/20201026 7 Git tricks that changed my life.md @@ -0,0 +1,203 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 Git tricks that changed my life) +[#]: via: (https://opensource.com/article/20/10/advanced-git-tips) +[#]: author: (Rajeev Bera https://opensource.com/users/acompiler) + +7 Git tricks that changed my life +====== +These helpful tips will change the way you work with the popular version +control system. +![Computer screen with files or windows open][1] + +Git is one of the most common version control systems available, and it's used on private systems and publicly hosted websites for all kinds of development work. Regardless of how proficient with Git I become, it seems there are always features left to discover. Here are seven tricks that have changed the way I work with Git. + +### 1\. Autocorrection in Git + +We all make typos sometimes, but if you have Git's auto-correct feature enabled, you can let Git automatically fix a mistyped subcommand. + +Suppose you want to check the status with `git status` but you type `git stats` by accident. Under normal circumstances, Git tells you that 'stats' is not a valid command: + + +``` +$ git stats +git: ‘stats’ is not a git command. See ‘git --help’. + +The most similar command is +status +``` + +To avoid similar scenarios, enable Git autocorrection in your Git configuration: + + +``` +`$ git config --global help.autocorrect 1` +``` + +If you want this to apply only to your current repository, omit the `--global` option. + +This command enables the autocorrection feature. An in-depth tutorial is available at [Git Docs][2], but trying the same errant command as above gives you a good idea of what this configuration does: + + +``` +$ git stats +git: ‘stats’ is not a git command. See ‘git --help’. +On branch master +Your branch is up to date with ‘origin/master’. + +nothing to commit, working tree clean +``` + +Instead of suggesting an alternative subcommand, Git now just runs the top suggestion, which in this case was **git status**. + +### 2\. Count your commits + +There are many reasons you might need to count your commits. Many developers count the number of commits to judge when to increment the build number, for instance, or just to get a feel for how the project is progressing. + +To count your commits is really easy and straightforward; here is the Git command: + + +``` +`$ git rev-list --count` +``` + +In the above command, the **branch-name** should be a valid branch name in your current repository. + + +``` +$ git rev-list –count master +32 +$ git rev-list –count dev +34 +``` + +### 3\. Optimize your repo + +Your code repository is valuable not only for you but also for your organization. You can keep your repository clean and up to date with a few simple practices. One of the best practices is to [use the .gitignore file][3]. By using this file, you are telling Git not to store many unwanted files like binaries, temporary files, and so on. + +To optimize your repository further, you can use Git garbage collection. + + +``` +`$ git gc --prune=now --aggressive` +``` + +This command helps when you or your team heavily uses **pull** or **push** commands. + +This command is an internal utility that cleans up unreachable or "orphaned" Git objects in your repository. + +### 4\. Take a backup of untracked files + +Most of the time, it's safe to delete all the untracked files. But many times, there is a situation wherein you want to delete, but also to create a backup of your untracked files just in case you need them later. + +Git, along with some Bash command piping, makes it easy to create a zip archive for your untracked files. + + +``` +$ git ls-files --others --exclude-standard -z |\ +xargs -0 tar rvf ~/backup-untracked.zip +``` + +The above command makes an archive (and excludes files listed in .gitignore) with the name backup-untracked.zip + +### 5\. Know your .git folder + +Every repository has a .git folder. It is a special hidden folder. + + +``` +$ ls -a +. … .git +``` + +Git mainly works with two things: + + 1. The working tree (the state of files in your current checkout) + 2. The path of your Git repository (specifically, the location of the .git folder, which contains the versioning information) + + + +This folder stores all references and other important details like configurations, repository data, the state of HEAD, logs, and much more. + +If you delete this folder, the current state of your source code is not deleted, but your remote information, such as your project history, is. Deleting this folder means your project (at least, the local copy) isn't under version control anymore. It means you cannot track your changes; you cannot pull or push from a remote. + +Generally, there's not much you need to do, or should do, in your .git folder. It's managed by Git and is considered mostly off-limits. However, there are some interesting artifacts in this directory, including the current state of HEAD: + + +``` +$ cat .git/HEAD +ref: refs/heads/master +``` + +It also contains, potentially, a description of your repository: + + +``` +`$ cat .git/description` +``` + +This is an unnamed repository; edit this file 'description' to name the repository. + +The Git hooks folder is also here, complete with example hook files. You can read these samples to get an idea of what's possible through Git hooks, and you can also [read this Git hook introduction by Seth Kenlon][4]. + +### 6\. View a file of another branch + +Sometimes you want to view the content of the file from another branch. It's possible with a simple Git command, and without actually switching your branch. + +Suppose you have a file called [README.md][5], and it's in the **main** branch. You're working on a branch called **dev**. + +With the following Git command, you can do it from the terminal. + + +``` +`$ git show main:README.md` +``` + +Once you execute this command, you can view the content of the file in your terminal. + +### 7\. Search in Git + +You can search in Git like a pro with one simple command. Better still, you can search in Git even if you aren't sure which commit—or even branch—you made your changes. + + +``` +`$ git rev-list --all | xargs git grep -F ‘’` +``` + +For example, suppose you want to search for the string "font-size: 52 px;" in your repository: + + +``` +$ git rev-list –all | xargs git grep -F ‘font-size: 52 px;’ +F3022…9e12:HtmlTemplate/style.css: font-size: 52 px; +E9211…8244:RR.Web/Content/style/style.css: font-size: 52 px; +``` + +### Try these tips + +I hope these advanced tips are useful and boost your productivity, saving you lots of time. + +Do you have [Git tips][6] you love? Share them in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/advanced-git-tips + +作者:[Rajeev Bera][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://opensource.com/users/acompiler +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_screen_windows_files.png?itok=kLTeQUbY (Computer screen with files or windows open) +[2]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_code_help_autocorrect_code +[3]: https://opensource.com/article/20/8/dont-ignore-gitignore +[4]: https://opensource.com/life/16/8/how-construct-your-own-git-server-part-6 +[5]: http://README.md +[6]: https://acompiler.com/git-tips/ From 9e109be39bcf2f7cfc846aacb6a8da70fcc86d20 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 27 Oct 2020 05:05:59 +0800 Subject: [PATCH 0556/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201026?= =?UTF-8?q?=20Manage=20content=20using=20Pulp=20Debian?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201026 Manage content using Pulp Debian.md --- ...201026 Manage content using Pulp Debian.md | 173 ++++++++++++++++++ 1 file changed, 173 insertions(+) create mode 100644 sources/tech/20201026 Manage content using Pulp Debian.md diff --git a/sources/tech/20201026 Manage content using Pulp Debian.md b/sources/tech/20201026 Manage content using Pulp Debian.md new file mode 100644 index 0000000000..3000b0f2f8 --- /dev/null +++ b/sources/tech/20201026 Manage content using Pulp Debian.md @@ -0,0 +1,173 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Manage content using Pulp Debian) +[#]: via: (https://opensource.com/article/20/10/pulp-debian) +[#]: author: (Maximilian Kolb https://opensource.com/users/kolb) + +Manage content using Pulp Debian +====== +Mirror, sync, upload, and publish Debian software packages with the +pulp_deb plugin. +![Gift box opens with colors coming out][1] + +Pulp is an open source repository management tool that helps you fetch, mirror, upload, and publish content within your organization. It can be used to [manage various types of content][2] such as software packages (from RPM packages to Ruby gems), as well as Ansible collections, container images, and even arbitrary files. + +A typical workflow starts with fetching software packages from an existing repository (for example, ) or adding packages manually (for private packages built within your organization). Then Pulp helps you make arbitrary collections of software packages that are consumable by clients. With it, you: + + * Gain control over what content is available for consumers + * Can use version control + * Reduce bandwidth and storage needs by providing a local, deduplicated source + + + +If you're new to Pulp, read Melanie Corr's introductory article on [how to manage your software repositories with Pulp][3]. + +### Manage Debian packages with Pulp + +Pulp relies on plugins to adequately handle different types of content. For example, the [Pulp RPM][4] plugin enables you to manage .rpm packages. With the [Pulp Debian][5] plugin, you can mirror, sync, upload, and publish .deb packages within APT repositories. The pulp_deb plugin is essential if you want to manage and provide consumable software packages for Linux distributions such as Debian and Ubuntu, and it's free and open source software provided and maintained by the Pulp community. + +With the Pulp Debian plugin, you can manage Debian content by synchronizing remote repositories, providing an interface to upload your own content, and publishing content to repositories. + +Pulp supports several different [Debian content types][6], including packages, package indices, Release Files, and more. "Content type" refers to either a specific artifact or metadata. For example, a content unit of type `package` refers to a .deb package. + +Synchronizing a remote repository is one of Pulp Debian plugin's main features, and it's one of the ways to obtain content. The synchronization process uses a [remote][7] definition that contains a URL, [distribution][8], components, and architectures: + + * The **URL** is the path to the remote APT repository. + * The **distribution** is the path between the `dists/` directory of the APT repository and the relevant `Release` file. This is usually (but not always) the codename or suite of the Debian-based Linux distribution (`buster` for Debian 10, `stretch` for Debian 9, `focal` for Ubuntu 20.04, and so on). Running `lsb_release -cs` on any Debian or Ubuntu host shows the distribution's codename. + * **Components** describe arbitrary subsets of repositories (`main`, `contrib`, or `non-free` for Debian, or `main`, `restricted`, `universe`, and `multiverse` for Ubuntu). You can use this to filter and categorize packages within an APT repository. + * The **architecture** refers to the processor architecture a software package can run on, most commonly `i386`, `amd64`, or `arm64`. If a software package does not depend on a specific processor architecture, the architecture may be set to `all`. + + + +Specifying a distribution is mandatory, whereas defining components and architectures is optional. If undefined, Pulp automatically syncs all packages without filtering for components or architectures. Pulp automatically verifies the [GNU Privacy Guard][9] signature of the `Release` File, should the corresponding GPG public key be assigned to the remote. + +### An example workflow + +It's easy to go from a remote repository to a verbatim publication with Pulp's [REST API][10]. The following API calls assume you're using [HTTPie][11]. + +Imagine you want to provide .deb packages to hosts within your organization. The following basic workflow guides your first steps in using Pulp and the Pulp Debian plugin. + +![Pulp Debian workflow][12] + +Image by Maximilian Kolb + +#### 1\. Create a local repository + +Start by creating a local repository in Pulp with a single API call. You can do this with HTTPie or the [curl command][13]: + + +``` +`http post http://:24817/pulp/api/v3/repositories/deb/apt/ name=` +``` + +#### 2\. Create a remote + +Next, create a remote. This API call requires a URL and an arbitrary `name` value. Defining a distribution and architecture is optional: + + +``` +`http post http://:24817/pulp/api/v3/remotes/deb/apt/ name="nginx.org" url="http://nginx.org/packages/debian" distributions="buster"` +``` + +Whether you define only one or multiple distributions, Pulp will later sync packages for all architectures, as they are undefined for this remote. + +#### 3\. Synchronize + +The third and final step to fetch remote content to Pulp is to sync the remote to your local repository. You do this by making a call to the sync API endpoint of your repository: + + +``` +`http post http://:24817/pulp/api/v3/repositories/deb/apt//sync/ remote=http://:24817/pulp/api/v3/remotes/deb/apt//` +``` + +In this sample command, each of the UUIDs refers to Pulp's internal references, displayed as `pulp_href` by the API. This step may take some time, depending on your environment, the size of the repository, and the available bandwidth. + +### Make your Pulp content consumable + +After acquiring content for Pulp through synchronization, it becomes consumable by clients. + +#### 1\. Create a publication + +Publications are always based on a Pulp repository. They contain extra settings on how to publish content. You can use the `APT` publisher on any repository of the APT type containing .deb packages. + +The following API call creates a publication in verbatim mode. That is, it provides the exact same structure and content of the remote repository: + + +``` +`http post http://:24817/pulp/api/v3/publications/deb/verbatim/ repository=/pulp/api/v3/repositories/deb/apt//` +``` + +Replace the UUID with the repository you want to publish. This step may take some time, depending on the size of the repository. + +#### 2\. Create a distribution + +A distribution takes the finished publication and serves it through the Pulp content app, which makes it available (or "consumable") by your users. In the context of a Debian system, this means that the repository can be added to `/etc/apt/sources.list` and used as a way to install software. + +The following API call requires the UUID of the publication created in the first step: + + +``` +`http post http://:24817/pulp/api/v3/distributions/deb/apt/ name="name_of_the_distribution" base_path="base_path_of_the_distribution" publication=http://:24817/pulp/api/v3/publications/deb/verbatim//` +``` + +The `base_path` value is part of the URL used by clients when referring to the APT repository, and the name can be arbitrary. Calling the distribution's API endpoint on a specific published distribution returns the URL of the Pulp repository: + + +``` +`http get http://:24817/pulp/api/v3/distributions/deb/apt//` +``` + +This URL is directly consumable by APT clients. It can now be added to `/etc/apt/sources.list` as a valid repository. + +### Pulp API + +Using these API calls lets you sync an APT repository to your own Pulp instance and republish it verbatim, without touching the packages, any metadata, or signatures. Refer to the [API documentation][6] and [feature overview][14] for further information and other modes of publication. + +### Open source flexibility + +One important aspect of Pulp and its plugin structure is that it's extremely flexible, in no small part due to its open source nature. You can run Pulp as a standalone service, but you don't have to. It can be integrated into something bigger. + +I work at [ATIX][15], where we've started using Pulp and the Pulp Debian plugin in a project called [orcharhino][16]. It's based on [Foreman][17] and includes the powerful [Katello][18] plugin for additional content-management capabilities, which itself relies on Pulp for repository management. With this, we've been able to manage our data center with automated system deployment, configuration management, and patch management. + +In other words, ATIX develops the Pulp Debian plugin primarily with a Katello use case in mind. Whether you need Katello or Pulp or just a specific Pulp plugin, you can rest assured that this modularity is by design. + +Using Pulp, you can mirror remote software repositories, host private software packages, and manage different types of content on one platform. + +Try [Pulp][19] and the [Pulp Debian][5] plugin today, and don't be afraid to join and ask the [community][20] for help. We welcome any and all feedback. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/pulp-debian + +作者:[Maximilian Kolb][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://opensource.com/users/kolb +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_gift_giveaway_box_520x292.png?itok=w1YQhNH1 (Gift box opens with colors coming out) +[2]: https://pulpproject.org/content-plugins/#pulp-3-content-plugins-information +[3]: https://opensource.com/article/20/8/manage-repositories-pulp +[4]: https://github.com/pulp/pulp_rpm +[5]: https://github.com/pulp/pulp_deb +[6]: https://pulp-deb.readthedocs.io/en/latest/restapi.html +[7]: https://docs.pulpproject.org/pulpcore/glossary.html#term-Remote +[8]: https://docs.pulpproject.org/pulpcore/glossary.html#term-Distribution +[9]: https://gnupg.org/ +[10]: https://docs.pulpproject.org/pulpcore/restapi.html +[11]: https://httpie.org/ +[12]: https://opensource.com/sites/default/files/pulp-debian-workflow_0.jpg (Pulp Debian workflow) +[13]: https://www.redhat.com/sysadmin/use-curl-api +[14]: https://pulp-deb.readthedocs.io/en/latest/feature_overview.html +[15]: https://atix.de/en/ +[16]: https://orcharhino.com/ +[17]: https://theforeman.org/ +[18]: https://theforeman.org/plugins/katello +[19]: https://pulpproject.org/ +[20]: https://pulpproject.org/get_involved/ From 24695126e13aa4b85873073ed4e094e742073982 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 27 Oct 2020 05:06:22 +0800 Subject: [PATCH 0557/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201023?= =?UTF-8?q?=20Why=20it's=20important=20to=20keep=20the=20cloud=20open?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201023 Why it-s important to keep the cloud open.md --- ...y it-s important to keep the cloud open.md | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 sources/tech/20201023 Why it-s important to keep the cloud open.md diff --git a/sources/tech/20201023 Why it-s important to keep the cloud open.md b/sources/tech/20201023 Why it-s important to keep the cloud open.md new file mode 100644 index 0000000000..446eceb61b --- /dev/null +++ b/sources/tech/20201023 Why it-s important to keep the cloud open.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why it's important to keep the cloud open) +[#]: via: (https://opensource.com/article/20/10/keep-cloud-open) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Why it's important to keep the cloud open +====== +An open cloud helps developers maintain autonomy and security while +taking advantage of the power and reach of the cloud. +![Sky with clouds and grass][1] + +There's a famous sticker featured on many laptop lids; it goes something like this: "the 'cloud' is just somebody else's computer." + +There's a lot of truth to that sentiment, but it's not exactly technically accurate. In fact, cloud computing isn't just somebody else's computer; it's somebody else's _hundreds and thousands_ of computers. + +Years ago, "the cloud" did indeed just refer to the simplified graphic in a flowchart, so the illustrator didn't have to try to accurately depict the multiple networks that comprise the World Wide Web. Now, however, the cloud isn't just describing traffic or small-time remote file storage offers. The cloud of today is a _platform_ of interconnected computational nodes working together to keep containerized Linux images, each running a distinct service (or "microservice" in developer lingo), functioning as applications distributed over the whole world. + +The cloud is a computer, no different in theory than the device you're reading this article on, but very different in construction. For instance, you don't own the cloud. You might wonder how such a concept can possibly be compatible with the idea of open source and free software, methods of computing in which the user famously owns the software they run. Surely you can't own software when you don't even own the device it's installed on? + +### Open source and the cloud + +For several years now, the Internet has been something of a software neutral zone. The model of the Internet isn't the same as "traditional" software in which there's a one-to-one, or maybe a one-per-family, relationship between the app and the user. The Internet is built of servers, which run services intended for multiple users. You sign up for an account on a site, and, in the best-case scenario, you more or less "own" your user account and data, but you don't own the site. You can't stop your Internet service and bring up the website on your computer. The software "lives" on a server somewhere. Even when the software is open source, such as WordPress or Drupal, and even if you download it and install it locally on your own computer, you still don't possess the instance you created an account on. + +For this reason, even users very conscious of the threat of non-open software tend to overlook the question of software on the Internet. It can be increasingly difficult to recognize the importance of open source when even popular open source projects are hosted on Github (which uses a non-open web stack), Slack, or Discord instead of [Mattermost][2] or [Matrix][3] for chat; Google Docs instead of [Etherpad][4] for collaboration; Trello instead of [Phabricator][5] for [project management][6]; Jira for bug tracking; Gmail for communication, and so on. For as much as open source has won within software development and server hosting, it seems to willingly lock itself inside proprietary infrastructure. + +### Why the cloud is so powerful + +The problem doesn't end with infrastructure. The reason open source projects are locking themselves into proprietary systems for support is that the cloud itself is the computer, and the computer powered by the cloud is a lot more powerful than any developer's workstation. Not only does it have more processing power, but it also has a greater reach. An application you develop to run on the cloud can serve millions of users without even one of them having to figure out how to download and install anything. Your users just launch a browser and use your app, on any device, without even worrying about whether their device is powerful enough for the task they need to be done. + +The cloud just makes sense, for computation, for delivery, and even for marketing. The problem is, it doesn't make any sense for open source. And that's why the cloud is no longer enough. The cloud needs to be upgraded to an open hybrid cloud. + +### What is an open hybrid cloud? + +When people talked about "the cloud" many years ago, it referred to the network serving as the computer. It was even then an old idea, but it was only just being realized. But because the network was the computer, the natural and correct assumption was that most users wouldn't own the computer; they'd only log in with client machines. And that's exactly the form it has taken—you own a device that browses to a cloud owned by Google, Microsoft, or Amazon. + +This came to be known as the public cloud because the infrastructure running the cloud is available to the general public. You can buy time on several public clouds, interact with it through Kubernetes, and develop apps for Linux containers. + +It didn't take long for individual companies to build private clouds—an infrastructure available only to their employees and clients. This ensured that important data remained under their control, and it often cost less than buying time on someone else's infrastructure. + +A hybrid cloud combines these two concepts—you maintain a private cloud for your own use, and you use a public cloud to provide services you can't run only privately. An open hybrid cloud is a hybrid cloud built on open source, whether it's OKD, OpenShift, Kubernetes, RHEL, Debian, Alpine, Podman, Docker, Ansible, or custom scripts. + +### Getting an open hybrid cloud + +The cloud is powerful, so it stands to reason that it can actually help solve a little problem like ensuring user independence. It doesn't happen overnight, though, and the proprietary cloud is already entrenched in services used by millions. So, as an open source enthusiast, what can you do to promote the open hybrid cloud? + +### Don't settle for closed clouds + +If you're a developer, seek out an open hybrid cloud when you're looking for a platform to build upon. If you can't find one within your price range and you can't build a small one, then support open stacks. Look at the services your project relies upon and make sure you can reimplement the stack, should you need to. + +### Use open source online + +As a user, look for [federated systems][7] for social media, and look for open source platforms like WordPress, Drupal, Nextcloud, Etherpad, EtherCalc, and others, for online collaboration. You're not running the instance you're using, but at least you know that the code is auditable and that you're not supporting an environment that forces developers to contribute to proprietary software. + +### Data liberation + +Whether or not the environment is open source, ensure that important data is secure and can be exported. We're well into the 21st century, so there's no excuse for a website to gather data about without proper encryption and no excuse to withhold your data from you. You should be able to export anything you put _into_ a site for your own backups. + +### Be open + +In an open hybrid cloud, you own your development environment and your data, and you maintain your autonomy the same way you do with a laptop running [Linux][8] or [BSD][9]. Cloud computing is the future. Let's work together to make sure the future is open. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/keep-cloud-open + +作者:[Seth Kenlon][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://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus-cloud.png?itok=vz0PIDDS (Sky with clouds and grass) +[2]: http://mattermost.com +[3]: http://matrix.org +[4]: http://etherpad.org +[5]: https://www.phacility.com/phabricator/ +[6]: https://opensource.com/alternatives/trello +[7]: https://opensource.com/article/17/4/guide-to-mastodon +[8]: https://opensource.com/resources/linux +[9]: https://opensource.com/article/20/5/furybsd-linux From 0f3ec29cc137c23f0387bf76f15004181bca236e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 27 Oct 2020 05:06:33 +0800 Subject: [PATCH 0558/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201023?= =?UTF-8?q?=20New=20open=20source=20project=20crowdsources=20internet=20se?= =?UTF-8?q?curity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201023 New open source project crowdsources internet security.md --- ... project crowdsources internet security.md | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 sources/tech/20201023 New open source project crowdsources internet security.md diff --git a/sources/tech/20201023 New open source project crowdsources internet security.md b/sources/tech/20201023 New open source project crowdsources internet security.md new file mode 100644 index 0000000000..ae1fad82ff --- /dev/null +++ b/sources/tech/20201023 New open source project crowdsources internet security.md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (New open source project crowdsources internet security) +[#]: via: (https://opensource.com/article/20/10/crowdsec) +[#]: author: (Philippe Humeau https://opensource.com/users/philippe-humeau) + +New open source project crowdsources internet security +====== +CrowdSec aims to leverage the power of the crowd to create a very +accurate IP reputation database +![Lots of people in a crowd.][1] + +[CrowdSec][2] is a new security project designed to protect servers, services, containers, or virtual machines exposed on the internet with a server-side agent. It was inspired by [Fail2Ban][3] and aims to be a modernized, collaborative version of that intrusion-prevention framework. + +CrowdSec is free and open source (under an MIT License), with the source code available on [GitHub][4]. It is currently is available for Linux, with ports to macOS and Windows on the roadmap. + +### How CrowdSec works + +CrowdSec is written in Golang and was designed to run on modern, complex architectures such as clouds, lambdas, and containers. To achieve this, it's "decoupled," meaning you can "detect here" (e.g., in your database logs) and "remedy there" (e.g., in your firewall or rproxy). + +The tool uses [leaky buckets][5] internally to allow for tight event control. Scenarios are written in YAML to make them as simple and readable as possible without sacrificing granularity. The inference engine lets you get insights from chain buckets or meta-buckets, meaning if several buckets (e.g., web scan, port scan, and login attempt failed) overflow into a "meta-bucket," you can trigger a "targeted attack" remediation. + +Aggressive Internet Protocols (IPs) are dealt with using bouncers. The [CrowdSec Hub][6] offers ready-to-use data connectors, bouncers (e.g., Nginx, PHP, Cloudflare, Netfilter), and scenarios to deter various attack classes. Bouncers can remedy threats in various ways. + +It works on bouncers such as Captcha, limiting applicative rights, multi-factor authentication, throttling queries, or activating Cloudflare attack mode just when needed. You can get a sense of what's happening locally (and where it's occurring) with a lightweight visualization interface and strong [Prometheus][7] observability. + +![CrowdSec's operation][8] + +(CrowdSec, [CC BY-SA 4.0][9]) + +### Crowdsourcing security + +While the software currently looks like a spruced up Fail2Ban, the goal is to leverage the power of the crowd to create a very accurate IP reputation database. When CrowdSec bounces a specific IP, the triggered scenario and the timestamp are sent to our API to be checked and integrated into the global consensus of bad IPs. + +While we are already redistributing a blocklist to our community (you can see it by entering `cscli ban list --api` on the command line), we plan to really improve this part as soon as we have dealt with other prerequisite code lines. The network already has sightings of 100,000+ IPs (refreshed daily) and is able to redistribute ~10% (10,000) of those to our community members. The project has also been designed to be [GDPR][10] compliant and privacy respectful, both in technical and legal terms. + +Our vision is that once the CrowdSec community is large enough, we will all generate, in real time, the most accurate IP reputation database available. This global reputation engine, coupled with local behavior assessment and remediation, should allow many businesses to achieve tighter security at a very low cost. + +### Case studies + +Here are two examples of what CrowdSec does. + +> A company protecting its customers from DDoS attacks set up a DDoS mitigation strategy relying on Fail2Ban. When one of its customers was attacked by a 7,000-machine botnet, CrowdSec was able to ingest all the logs and successfully banned more than 95% of the botnet, efficiently mitigating the attack, in less than five minutes. For the sake of comparison, Fail2Ban would have needed to process several thousand logs per minute, which is quite challenging and would have taken nearly 50 minutes to deal with this attack. + +> An e-commerce business was going through a massive credit card stuffing attack. The attacker was spamming the payment gateway, testing thousands of different credit card details using a sole IP address. Instead of having to amend all of its apps to try to detect the attack, by installing CrowdSec, the company could scan all the logs and block the intrusion within minutes. + +### Business model + +A common stress in open source projects is setting up a viable monetization model. So, in full transparency, we'll offer premium subscriptions to businesses that want to leverage the IP reputation database without contributing to it or sharing their banned IP data. This will allow anyone to query the IP reputation database upon receiving the first packet from an unknown IP before accepting it. + +### Getting started and getting involved + +CrowdSec's setup is quick and easy (taking just five minutes, tops). It's heavily assisted by a wizard to allow as many people and organizations as possible to use it. The project is production-grade and already runs in many places, including hosting companies, although it's still in beta. + +Currently, our community members come from 28 countries across five different continents. We are looking for more users, contributors, and ambassadors to take the project to the next level. + +![User map][11] + +We would love to hear your feedback and engage in further discussions, so please don't hesitate to comment, reach out through our [website][2], [GitHub][4], or [Discourse][12], or give us a shout on [Gitter][13]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/crowdsec + +作者:[Philippe Humeau][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://opensource.com/users/philippe-humeau +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_community_1.png?itok=rT7EdN2m (Lots of people in a crowd.) +[2]: https://crowdsec.net/ +[3]: https://www.fail2ban.org/ +[4]: https://github.com/CrowdSecurity/crowdsec +[5]: https://en.wikipedia.org/wiki/Leaky_bucket +[6]: https://hub.crowdsec.net/ +[7]: https://opensource.com/article/19/11/introduction-monitoring-prometheus +[8]: https://opensource.com/sites/default/files/uploads/crowdsec_operation.jpg (CrowdSec's operation) +[9]: https://creativecommons.org/licenses/by-sa/4.0/ +[10]: https://en.wikipedia.org/wiki/General_Data_Protection_Regulation +[11]: https://opensource.com/sites/default/files/cs_user_map.png (User map) +[12]: https://discourse.crowdsec.net/ +[13]: https://gitter.im/crowdsec-project/community From d667fda5ce9ea17e02a4e3decd19a41824bb134a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 27 Oct 2020 05:06:45 +0800 Subject: [PATCH 0559/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201022?= =?UTF-8?q?=20How=20to=20influence=20people=20to=20join=20open=20source?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201022 How to influence people to join open source.md --- ...to influence people to join open source.md | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 sources/tech/20201022 How to influence people to join open source.md diff --git a/sources/tech/20201022 How to influence people to join open source.md b/sources/tech/20201022 How to influence people to join open source.md new file mode 100644 index 0000000000..4aa7eb6031 --- /dev/null +++ b/sources/tech/20201022 How to influence people to join open source.md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to influence people to join open source) +[#]: via: (https://opensource.com/article/20/10/influence-open-source) +[#]: author: (Joshua Pearce https://opensource.com/users/jmpearce) + +How to influence people to join open source +====== +Giving people what they want is the most effective way to introduce +people to open source. +![pipe in a building][1] + +If you are reading Opensource.com, you might be able to code, and you are probably reading this on an open source browser on some elusive [Linux distro][2]. You probably have not seen a browser ad in years because you are running an [open source ad blocker][3]. You feel warm and fuzzy when you think about penguins. + +Simply, you know the power of the force of open source and have made it part of your life. Sadly, not everyone has found the open source way yet. Their computers are painfully slow; they see more ads than content when they surf the web; they spend their money on patented and copyrighted junk. Some of these people may even be related to you—take your nieces and nephews, for example. + +### Knowledge is wealth + +So, how do you introduce your nieces and nephews (and everyone else) to open source? + +I tried to answer this question and being a professor, a profession well known for being long-winded, I ended up with a book: [_Create, Share, and Save Money Using Open Source Projects_][4], published by McGraw-Hill + +The trick, I think, is finding something that your niece or nephew wants but doesn't have the money to buy, then showing them how open source knowledge can get them what they want. + +![Lift Standing Desk][5] + +[Lift Standing Desk][6] (Joni Steiner and Nick Ierodiaconou, [CC-BY-SA-NC][7]) + +Knowledge has a unique property among commodities. Unlike gold or wheat, it not only retains value when it is shared, but it can rapidly increase in value. The internet enables unlimited scaling of this process, as the price of information-sharing approaches zero. Everyone with internet access has historically unprecedented access to this wealth. For example, I provide [free links to repositories][4] with books, education, movies, how-tos, maps, music, photographs, art, software, and recipes. + +### Don't buy it, make it + +Free and open source is expanding further into the physical world, and we all have the opportunity to radically reduce the cost of just about everything you can buy at Walmart or Amazon, including [toys][8], [electronics][9], [household goods][10], and clothing. The combination of open source sharing and digital manufacturing—using 3D printers and similar tools—enables individuals to make their own complex, valuable products. + +![3D printed household items][11] + +[3D-printed household items][12] (Joshua M. Pearce, [CC BY-SA 3.0][13]) + +For years, scientists have been doing this [in their labs][14]. But now, anyone can easily customize products to fit their exact needs. There are already millions of free designs available. + +![Recyclebot][15] + +[Recyclebot][16] (Joshua M. Pearce, [GPLv3][17]) + +The way to really knock the bottom out of a product's price is to [source the raw materials from trash][18]. This is possible for a dizzying array of products because of recent improvements in small-scale recycling processes (like [Recyclebots][19], which I use in my lab) that enable people to make valuable products from waste. Best of all, anyone can get these green, custom creations for a small fraction of the cost of a proprietary system. We can normally produce a custom product for [less than the sales tax][20] on a conventional product—with the same functionality, a better, customized form, and almost no cost. + +### Learn more + +In _[Create, Share, and Save Money Using Open Source Projects][4],_ I share the potential in at-home manufacturing and recycling and even how to score free big-ticket items, including housing and electricity, with open source. You can also learn more about this on a webinar I recorded with Megan Krieger and Janet Callahan for Michigan Tech's [Husky Bites][21]. + +Hopefully, this knowledge is motivating enough to pull in a niece or nephew or two over to the open source way! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/influence-open-source + +作者:[Joshua Pearce][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://opensource.com/users/jmpearce +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/open_pipe_red_hat_tower_building.png?itok=8ho3yi7L (pipe in a building) +[2]: https://distrowatch.com/ +[3]: https://opensource.com/article/20/4/ad-blockers +[4]: https://www.appropedia.org/Create,_Share,_and_Save_Money_Using_Open-Source_Projects +[5]: https://opensource.com/sites/default/files/uploads/opendesk_furniture_lift-standing-desk.jpg (Lift Standing Desk) +[6]: https://www.appropedia.org/File:Opendesk_furniture_lift-standing-desk.jpg +[7]: https://creativecommons.org/licenses/by-nc-sa/2.0/ +[8]: http://www.mdpi.com/2227-7080/5/3/45 +[9]: https://doi.org/10.3390/inventions3030064 +[10]: https://www.mdpi.com/2227-7080/5/1/7 +[11]: https://opensource.com/sites/default/files/uploads/3dprinted_household.jpg (3D printed household items) +[12]: https://www.appropedia.org/File:3dprinted_household.JPG +[13]: https://creativecommons.org/licenses/by-sa/3.0/ +[14]: https://opensource.com/article/20/10/open-source-hardware-savings +[15]: https://opensource.com/sites/default/files/uploads/recyclebotrep.png (Recyclebot) +[16]: https://www.appropedia.org/File:Recyclebotrep.png +[17]: https://www.gnu.org/licenses/gpl-3.0.html +[18]: https://www.academia.edu/34738483/Tightening_the_Loop_on_the_Circular_Economy_Coupled_Distributed_Recycling_and_Manufacturing_with_Recyclebot_and_RepRap_3-D_Printing +[19]: https://www.appropedia.org/Recyclebot +[20]: https://opensource.com/article/17/3/how-to-create-consumer-goods-open-hardware +[21]: https://www.facebook.com/Michigan-Tech-College-of-Engineering-109353424030003/videos/husky-bites-presents-special-guest-joshua-m-pearce/2669023713361207/ From 7ef382378fbbe7deb00607bf211ad81b396f1dd4 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 27 Oct 2020 05:06:58 +0800 Subject: [PATCH 0560/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201022?= =?UTF-8?q?=205=20steps=20to=20learn=20any=20programming=20language?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201022 5 steps to learn any programming language.md --- ...steps to learn any programming language.md | 199 ++++++++++++++++++ 1 file changed, 199 insertions(+) create mode 100644 sources/tech/20201022 5 steps to learn any programming language.md diff --git a/sources/tech/20201022 5 steps to learn any programming language.md b/sources/tech/20201022 5 steps to learn any programming language.md new file mode 100644 index 0000000000..d0df23d4c0 --- /dev/null +++ b/sources/tech/20201022 5 steps to learn any programming language.md @@ -0,0 +1,199 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 steps to learn any programming language) +[#]: via: (https://opensource.com/article/20/10/learn-any-programming-language) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +5 steps to learn any programming language +====== +With just a little programming experience, you can learn a new language +in just a few days (sometimes less). +![Learning to program][1] + +Some people love learning new programming languages. Other people can't imagine having to learn even one. In this article, I'm going to show you how to think like a coder so that you can confidently learn any programming language you want. + +The truth is, once you've learned how to program, the language you use becomes less of a hurdle and more of a formality. In fact, that's just one of the many reasons educators say to [teach kids to code early][2]. Regardless of how simple their introductory language may be, the logic remains the same across everything else children (or adult learners) are likely to encounter later. + +With just a little programming experience, which you can gain from any one of several introductory articles here on Opensource.com, you can go on to learn _any_ programming language in just a few days (sometimes less). Now, this isn't magic, and you do have to put some effort into it. And admittedly, it takes a lot longer than just a few days to learn every library available to a language or to learn the nuances of packaging your code for delivery. But getting started is easier than you might think, and the rest comes naturally with practice. + +When experienced programmers sit down to learn a new language, they're looking for five things. Once you know those five things, you're ready to start coding. + +### 1\. Syntax + +![Syntax][3] + +(Seth Kenlon, [CC BY-SA 4.0][4]) + +The syntax of a language describes the structure of code. This encompasses both how the code is written on a line-by-line basis as well as the actual words used to construct code statements. + +[Python][5], for instance, is known for using indentation to indicate where one block ends and another one starts: + + +``` +while j < rows: +    while k < columns: +        tile = Tile(k * w) +        board.add(tile) +        k += 1 +    j += 1 +    k = 0 +``` + +[Lua][6] just uses the keyword `end`: + + +``` +for i,obj in ipairs(hit) do +  if obj.moving == 1 then +     obj.x,obj.y = v.mouse.getPosition() +  end +end +``` + +[Java][7], [C][8], C++, and similar languages use braces: + + +``` +while (std::getline(e,r)) { +  wc++; +  } +``` + +A language's syntax also involves things like including libraries, setting variables, and terminating lines. With practice, you'll learn to recognize syntactical requirements (and conventions) almost subliminally as you read sample code. + +#### Take action + +When learning a new programming language, strive to understand its syntax. You don't have to memorize it, just know where to look, should you forget. It also helps to use a good [IDE][9], because many of them alert you of syntax errors as they occur. + +### 2\. Built-ins and conditionals + +![built-in words][10] + +(Seth Kenlon, [CC BY-SA 4.0][4]) + +A programming language, just like a natural language, has a finite number of words it recognizes as valid. This vocabulary can be expanded with additional libraries, but the core language knows a specific set of keywords. Most languages don't have as many keywords as you probably think. Even in a very low-level language like C, there are only 32 words, such as `for`, `do`, `while`, `int`, `float`, `char`, `break`, and so on. + +Knowing these keywords gives you the ability to write basic expressions, the building blocks of a program. Many of the built-in words help you construct conditional statements, which influence the flow of your program. For instance, if you want to write a program that lets you click and drag an icon, then your code must detect when the user's mouse cursor is positioned over an icon. The code that causes the mouse to grab the icon must execute only _if_ the mouse cursor is within the same coordinates as the icon's outer edges. That's a classic if/then statement, but different languages can express that differently. + +Python uses a combination of `if`, `elif`, and `else` but doesn't explicitly close the statement: + + +``` +if var == 1: +    # action +elif var == 2: +    # some action +else: +    # some other action +``` + +[Bash][11] uses `if`, `elif`, `else`, and uses `fi` to end the statement: + + +``` +if [ "$var" = "foo" ]; then +   # action +elif [ "$var" = "bar" ]; then +   # some action +else +   # some other action +fi +``` + +C and Java, however, use `if`, `else`, and `else if`, enclosed by braces: + + +``` +if (boolean) { +   // action +} else if (boolean) { +   // some action +} else { +   // some other action +} +``` + +While there are small variations in word choice and syntax, the basics are always the same. Learn the ways to define conditions in the programming language you're learning, including `if/then`, `do...while`, and `case` statements. + +#### Take action + +Get familiar with the core set of keywords a programming language understands. In practice, your code will contain more than just a language's core words, because there are almost certainly libraries containing lots of simple functions to help you do things like print output to the screen or display a window. The logic that drives those libraries, however, starts with a language's built-in keywords. + +### 3\. Data types + +![Data types][12] + +(Seth Kenlon, [CC BY-SA 4.0][4]) + +Code deals with data, so you must learn how a programming language recognizes different kinds of data. All languages understand integers and most understand decimals and individual characters (a, b, c, and so on). These are often denoted as `int`, `float` and `double`, and `char`, but of course, the language's built-in vocabulary informs you of how to refer to these entities. + +Sometimes a language has extra data types built into it, and other times complex data types are enabled with libraries. For instance, Python recognizes a string of characters with the keyword `str`, but C code must include the `string.h` header file for string features. + +#### Take action + +Libraries can unlock all manner of data types for your code, but learning the basic ones included with a language is a sensible starting point. + +### 4\. Operators and parsers + +![Operators][13] + +(Seth Kenlon, [CC BY-SA 4.0][4]) + +Once you understand the types of data a programming language deals in, you can learn how to analyze that data. Luckily, the discipline of mathematics is pretty stable, so math operators are often the same (or at least very similar) across many languages. For instance, adding two integers is usually done with a `+` symbol, and testing whether one integer is greater than another is usually done with the `>` symbol. Testing for equality is usually done with `==` (yes, that's two equal symbols, because a single equal symbol is usually reserved to _set_ a value). + +There are notable exceptions to the obvious in languages like Lisp and Bash, but as with everything else, it's just a matter of mental transliteration. Once you know _how_ the expression is different, it's trivial for you to adapt. A quick review of a language's math operators is usually enough to get a feel for how math is done. + +You also need to know how to compare and operate on non-numerical data, such as characters and strings. These are often done with a language's core libraries. For instance, Python features the `split()` method, while C requires `string.h` to provide the `strtok()` function. + +#### Take action + +Learn the basic functions and keywords for manipulating basic data types, and look for core libraries that help you accomplish complex actions. + +### 5\. Functions + +![Class][14] + +(Seth Kenlon, [CC BY-SA 4.0][4]) + +Code usually isn't just a to-do list for a computer. Typically when you write code, you're looking to present a computer with a set of theoretical conditions and a set of instructions for actions that must be taken when each condition is met. While flow control with conditional statements and math and logic operators can do a lot, code is a lot more efficient once functions and classes are introduced because they let you define subroutines. For instance, should an application require a confirmation dialogue box very frequently, it's a lot easier to write that box _once_ as an instance of a class rather than re-writing it each time you need it to appear throughout your code. + +You need to learn how classes and functions are defined in the programming language you're learning. More precisely, first, you need to learn whether classes and functions are available in the programming language. Most modern languages do support functions, but classes are specialized constructs common to object-oriented languages. + +#### Take action + +Learn the constructs available in a language that help you write and use code efficiently. + +### You can learn anything + +Learning a programming language is, in itself, a sort of subroutine of the coding process. Once you understand the theory behind how code works, the language you use is just a medium for delivering logic. The process of learning a new language is almost always the same: learn syntax through simple exercises, learn vocabulary so you can build up to performing complex actions, and then practice, practice, practice. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/learn-any-programming-language + +作者:[Seth Kenlon][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://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/learn-programming-code-keyboard.png?itok=xaLyptT4 (Learning to program) +[2]: https://opensource.com/article/20/9/scratch +[3]: https://opensource.com/sites/default/files/uploads/syntax_0.png (Syntax) +[4]: https://creativecommons.org/licenses/by-sa/4.0/ +[5]: https://opensource.com/downloads/cheat-sheet-python-37-beginners +[6]: https://opensource.com/article/20/2/lua-cheat-sheet +[7]: https://opensource.com/downloads/java-cheat-sheet +[8]: https://opensource.com/downloads/c-programming-cheat-sheet +[9]: https://opensource.com/resources/what-ide +[10]: https://opensource.com/sites/default/files/uploads/builtin.png (built-in words) +[11]: https://opensource.com/downloads/bash-cheat-sheet +[12]: https://opensource.com/sites/default/files/uploads/type.png (Data types) +[13]: https://opensource.com/sites/default/files/uploads/operator.png (Operators) +[14]: https://opensource.com/sites/default/files/uploads/class.png (Class) From 36e0349d465a66d9eb28639a07d7bd4b0a39eda6 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 27 Oct 2020 05:07:09 +0800 Subject: [PATCH 0561/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201021?= =?UTF-8?q?=205=20open=20source=20tools=20I=20can't=20live=20without?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201021 5 open source tools I can-t live without.md --- ... open source tools I can-t live without.md | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 sources/tech/20201021 5 open source tools I can-t live without.md diff --git a/sources/tech/20201021 5 open source tools I can-t live without.md b/sources/tech/20201021 5 open source tools I can-t live without.md new file mode 100644 index 0000000000..2d5220c471 --- /dev/null +++ b/sources/tech/20201021 5 open source tools I can-t live without.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 open source tools I can't live without) +[#]: via: (https://opensource.com/article/20/10/open-source-tools) +[#]: author: (Victoria Martinez de la Cruz https://opensource.com/users/vkmc) + +5 open source tools I can't live without +====== +Increase your productivity inside and outside the terminal by keeping +these tools in your own bag of tricks. +![woman on laptop sitting at the window][1] + +Some time ago, I engaged with a Twitter thread that went viral among techies. The challenge? Pick only five tools that you cannot live without. I started to think about this in relation to my everyday life, and picking just five tools was not easy. I use many tools that I consider essential, such as my [IRC][2] client to connect with my colleagues and friends (yes, I still use IRC), a good text editor to hack on things, a calendar app to keep organized, and a videoconferencing platform when more direct interaction is needed. + +So let me put a twist on this challenge: Pick just five open source tools that boost your productivity. Here's my list; please share yours in the comments. + +### tmate + +![tmate screenshot][3] + +(Victoria Marinez de la Cruz, [CC BY-SA 4.0][4]) + +Oh, I love this tool. tmate is a fork of the well-known [tmux][5] terminal multiplexer that allows you to start a tmux session and share it over SSH. You can use it for [pair programming][6] (which is my primary use case) or for remote control. + +If you collaborate often with your team members, and you want an easy, distro-agnostic, open source way to program with them (and sharing terminal access is enough for you), this is definitely a must-add to your list. + +Get more info on [tmate's website][7], or check out the code on [GitHub][8]. + +### ix + +ix is a command-line pastebin. You don't need to install anything; you can create new pastes just by `curl`ing to the [ix.io][9] site. For example, `echo Hello world. | curl -F 'f:1=<-' ix.io` will give you a link to ix.io where the message "Hello world" is pasted. This is very convenient when you want to share logs for debugging purposes or to save config files in servers where you don't have a desktop environment. + +One downside is that the source code is not yet published, even though it is intended to be free and open source. If you are the author and are reading this post, please post the code so that we can contribute to the polishing process. + +### asciinema + +Yes, this is another terminal tool. asciinema allows you to record your terminal. There are many ways to use it, but I generally use it to make demos for presentations. It's very easy to use, and there are packages available for many Linux distributions and other platforms. + +To see how it works, check out this [cool demo][10]. Isn't it great? + +Get more information on [asciinema's website][11] and access its source code on [GitHub][12]. + +### GNOME Pomodoro + +![pomodoro timer gnome][13] + +(Victoria Martinez de la Cruz, [CC BY-SA 4.0][4]) + +OK, that's enough with the terminal tools. Now I want to share this simple gem for getting and staying organized. Have you heard about the [Pomodoro Technique][14]? Pomodoro is basically a time-management tool. It uses a tomato-shaped timer that helps you split your time into work chunks and breaks (by default, 25 minutes of work followed by five-minute breaks). And, after every four pomodoros, you take a longer break (15 minutes by default). The idea is that you stay focused during the work time, and you stretch and relax on the breaks. + +This sounds very, very simple, and you might be hesitant to allow a tomato-shaped clock to control your life, but it definitely helped me get better organized and avoid exhaustion when trying to focus on many things at the same time. + +Whatever your role, I highly recommend this practice. And among the many different tools that implement it, I recommend the GNOME Pomodoro app. It's available for major GNU/Linux distros, so it requires that you use the GNOME desktop environment (this might be its downside). + +Check out more information on [GNOME Pomodoro's website][15], and access its [GitHub][16] repo to get the source code and learn how you can contribute. + +### Jitsi + +Last but not least is Jitsi. When you're working on a remote, globally distributed team, you need a way to connect with people. Instant messaging is good, but sometimes it's better to have a quick meeting to discuss things face to face (well, seeing each other faces). There are a lot of [videoconferencing tools][17] available, but I like Jitsi a lot. Not only because it's free and open source, but also because it provides a clean, functional interface. You can set up your own Jitsi server (for business purposes), but you can also try out a public Jitsi instance by going to the [Jitsi Meet][18] website. + +A good practice for setting up this kind of meeting: use it only when you have a clear agenda in mind. And always ask yourself, can this meeting be an email instead? Follow these guidelines and use Jitsi with caution, and your workday will be extremely productive! + +Learn more on [Jitsi's website][19] and start contributing by accessing its [GitHub][20] repository. + +* * * + +I hope my list helps you reach the next level in productivity. What are your five, can't-do-without-them, open source productivity tools? Let me know in the comments! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/open-source-tools + +作者:[Victoria Martinez de la Cruz][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://opensource.com/users/vkmc +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-window-focus.png?itok=g0xPm2kD (young woman working on a laptop) +[2]: https://en.wikipedia.org/wiki/Internet_Relay_Chat +[3]: https://opensource.com/sites/default/files/pictures/tmate-opensource.jpg (tmate screenshot) +[4]: https://creativecommons.org/licenses/by-sa/4.0/ +[5]: https://opensource.com/article/20/7/tmux-cheat-sheet +[6]: https://en.wikipedia.org/wiki/Pair_programming +[7]: https://tmate.io/ +[8]: https://github.com/tmate-io/tmate +[9]: http://ix.io/ +[10]: https://asciinema.org/a/239367 +[11]: https://asciinema.org/ +[12]: https://github.com/asciinema/asciinema +[13]: https://opensource.com/sites/default/files/pictures/pomodoro_timer_gnome.jpg (pomodoro timer gnome) +[14]: https://en.wikipedia.org/wiki/Pomodoro_Technique +[15]: https://gnomepomodoro.org/ +[16]: https://github.com/codito/gnome-pomodoro +[17]: https://opensource.com/article/20/5/open-source-video-conferencing +[18]: https://meet.jit.si/ +[19]: https://jitsi.org/ +[20]: https://github.com/jitsi From ad412db9755aad9e6db67d98b5a8f50a0946c5da Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 27 Oct 2020 05:07:21 +0800 Subject: [PATCH 0562/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201021?= =?UTF-8?q?=20How=20anyone=20can=20contribute=20to=20open=20source=20softw?= =?UTF-8?q?are=20in=20their=20job?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201021 How anyone can contribute to open source software in their job.md --- ...te to open source software in their job.md | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 sources/tech/20201021 How anyone can contribute to open source software in their job.md diff --git a/sources/tech/20201021 How anyone can contribute to open source software in their job.md b/sources/tech/20201021 How anyone can contribute to open source software in their job.md new file mode 100644 index 0000000000..3ae4fbf8ca --- /dev/null +++ b/sources/tech/20201021 How anyone can contribute to open source software in their job.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How anyone can contribute to open source software in their job) +[#]: via: (https://opensource.com/article/20/10/open-your-job) +[#]: author: (Catherine Robson https://opensource.com/users/crobson) + +How anyone can contribute to open source software in their job +====== +Open your job, and you'll open opportunities for software developers to +build applications that meet your needs. +![Active listening in a meeting is a skill][1] + +Imagine a world where your software works perfectly for you. It meets your needs, does things your way, and is the ideal tool to achieve great things toward your goals. + +Open source software stems from these roots. Many projects are built by engineers that have a problem and build a solution to solve it. Then they openly share their solution with others to use and improve. + +Unfortunately, building software is hard. Not everyone has the expertise to build software that works perfectly for their needs. And if the software developers building applications don't fully understand users' needs and how they do their job, the solutions they build may not meet the users' needs and may accidentally create a lot of gaps. + +I recently encountered an example of this at my dentist's office. As I was waiting in the chair, I couldn't help but notice how long the dental hygienist was taking to punch around in the software to get ready for the dentist's examination. So I asked her, "Do you feel like this software meets your needs?" She replied, "No! It's so complex, and what I actually need is never where I need it!" + +Part of the problem is that the people who built this software are probably not dentists, dental hygienists, or have any experience with a dentist other than as a patient in the chair. Many software companies have roles to help fill those gaps—product managers, product and market analysts, researchers, and others are meant to help gather requirements that tell development teams what to build. + +But we all know about learning a new domain. There's learning it from the outside, casually understanding it; then there's learning it from the inside, living it day-to-day, and really knowing it as an expert. The closer the development team can get to the real, "living it" experience, the better decisions they will make when they build software for specific users and domains. + +Open source has an ethos of sharing the work being done. Now I think it is time to evolve open source to the next level: sharing work that _needs to be_ done. Domain experts (i.e., the eventual users) need to share information about what they need to do their job so that open source developers can build software to meet their needs. + +This might sound overwhelming if you're not a software developer. Contributing to open source means that you need to write code, understand [Git][2], or cross other technical hurdles, right? Not necessarily; contributing your domain expertise is an important part of open source development. + +And you can use the tools you already have. You're already on social media. You probably have access to a word processor of some kind. And you have a work environment that can be shared openly (even in COVID times, thanks to technology). + +### Three steps to opening your job + +The following steps can help you open your job so software developers can learn your domain, understand your job and pain points, and build software that works better for you. + +#### 1\. Invite software builders into your work environment + +An ethnographic study is where parts of the software team shadow you in your job. You'll be asked to do everything you normally do on a workday, just as you always do it. Like a "fly on the wall," the software team is there to observe and understand how you do what you do. They might debrief with you throughout the day to get more insights into why you did certain things. Overall, this is meant to be non-invasive for you but very informative for the team. + +#### 2\. Share writeups about your job with software builders + +Far too often in the software industry, we focus on the software, not its use. As an example, a software requirement may come in as: "Show the history of dental work done to a tooth." This assumes that the software is required to do this job and that this history is useful no matter where it's shown in the software. + +Instead, developers need to back up and make sure they understand the job functions thoroughly. For example, a requirement could say: "A patient has a tooth with a cavity that was found during routine cleaning. While the patient is still there, the dentist needs to know what else has been done to the tooth to be able to prescribe a solution to the patient." By knowing the job that needs to be done, the software developer can build software that enables easy selection of the tooth in question, mid-exam, with gloves on. Therefore, this information should be available while in the "routine cleaning" view. + +Writing up your intent and context while you're using the software, rather than the tasks you do, can help software developers build to meet your true needs. + +If you want to go deeper, look at the [Jobs To Be Done][3] (JTBD) framework as a way to convey your expertise to software teams. + +#### 3\. Use social media to share videos, explanations, and more about your job + +Use the social media platform of your choice (e.g., YouTube, Reddit, etc.) to share information about your job. Recording and sharing a "day in the life" video openly could greatly help development teams really understand what you do and how you do it so that they can create software that serves your needs. + +### Open opportunities + +Open your job, and you'll open opportunities for software developers to build better software! Let's bring open source to the next level together by sharing more about what you need. + +You don't need to be a master coder to contribute to open source. Jade Wang shares 8 ways you can... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/open-your-job + +作者:[Catherine Robson][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://opensource.com/users/crobson +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/team-discussion-mac-laptop-stickers.png?itok=AThobsFH (Active listening in a meeting is a skill) +[2]: https://opensource.com/resources/what-is-git +[3]: https://www.google.com/books/edition/The_Jobs_To_Be_Done_Playbook/1vHRDwAAQBAJ?hl=en&gbpv=1&printsec=frontcover From 0691b1f914872bfdff6343cabc23a5209cf2ede5 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 27 Oct 2020 05:07:34 +0800 Subject: [PATCH 0563/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201026?= =?UTF-8?q?=20ninja:=20a=20simple=20way=20to=20do=20builds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201026 ninja- a simple way to do builds.md --- ...201026 ninja- a simple way to do builds.md | 117 ++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 sources/tech/20201026 ninja- a simple way to do builds.md diff --git a/sources/tech/20201026 ninja- a simple way to do builds.md b/sources/tech/20201026 ninja- a simple way to do builds.md new file mode 100644 index 0000000000..2b2c3d8985 --- /dev/null +++ b/sources/tech/20201026 ninja- a simple way to do builds.md @@ -0,0 +1,117 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (ninja: a simple way to do builds) +[#]: via: (https://jvns.ca/blog/2020/10/26/ninja--a-simple-way-to-do-builds/) +[#]: author: (Julia Evans https://jvns.ca/) + +ninja: a simple way to do builds +====== + +Hello! Every so often I find a new piece of software I really like, and today I want to talk about one of my recent favourites: [ninja][1]! + +### incremental builds are useful + +I do a lot of small projects where I want to set up incremental builds – for example, right now I’m writing a zine about bash, and I have one `.svg` file for each page of the zine. I need to convert the SVGs to PDFs, and I’d been doing it something like this: + +``` +for i in *.svg +do + svg2pdf $i $i.pdf # or ${i/.svg/.pdf} if you want to get really fancy +done +``` + +This works fine, but my `svg2pdf` script is a little slow (it uses Inkscape), and it’s annoying to have to wait 90 seconds or whatever to rebuild all the PDFs when I’ve just updated 1 page. + +### build systems are confusing + +In the past I’ve been pretty put off by using a Build System like make or bazel for my small projects because bazel is this Big Complicated Thing and `make` feels a little arcane to me. I don’t really know how to use either of them. + +So for a long time I’ve just written a bash script or something for my builds and resigned myself to just waiting for a minute sometimes. + +### ninja is an EXTREMELY SIMPLE build system + +But ninja is not complicated! Here is literally everything I know about ninja build file syntax: how to create a `rule` and a `build`: + +a `rule` has a command and description (the description is just for humans to read so you can tell what it’s doing when it’s building your code) + +``` +rule svg2pdf + command = inkscape $in --export-text-to-path --export-pdf=$out + description = svg2pdf $in $out +``` + +the syntax for `build` is `build output_file: rule_name input_files`. Here’s one using the `svg2pdf` rule. The output goes in `$out` in the rule and the input goes in `$in`. + +``` +build pdfs/variables.pdf: svg2pdf variables.svg +``` + +That’s it! If you put those two things in a file called `build.ninja` and then run `ninja`, ninja will run `inkscape variables.svg --export-text-to-path --export-pdf=pdfs/variables.pdf`. And then if you run it again, it won’t run anything (because it can tell that you’ve already built `pdfs/variables.pdf` and you’re up to date) + +Ninja has a few more features than this (see [the manual][2]), but I haven’t used them yet. It was originally built [for Chromium][3], so even with a small feature set it can support large builds. + +### ninja files are usually automatically generated + +The magic of ninja is that instead of having to use some confusing Build Language that’s hard to remember because you use it so infrequently (like make), instead the ninja language is SUPER simple, and if you want to do something complicated then you just generate the build file you want using any programming language you want. + +I like to make a `build.py` file or that looks something like this, that creates the ninja build file and then runs `ninja`: + +``` +with open('build.ninja', 'w') as ninja_file: + # write some rules + ninja_file.write(""" +rule svg2pdf + command = inkscape $in --export-text-to-path --export-pdf=$out + description = svg2pdf $in $out +""") + + # some for loop with every file I need to build + for filename in things_to_convert: + ninja_file.write(f""" +build {filename.replace('svg', 'pdf')}: svg2pdf {filename} +""") + +# run ninja +import subprocess +subprocess.check_call(['ninja']) +``` + +I’m sure there are a bunch of ninja best practices, but I don’t know them and for my small projects I find this works well. + +### meson is a build system that generates ninja files + +I don’t know too much about [Meson][4] yet, but recently I was building a C program ([plocate][5], a faster alternative to `locate`) and I noticed that instead of the usual `./configure; make; make install`, there were different build instructions: + +``` +meson builddir +cd builddir +ninja +``` + +It seems like Meson is a build system for C/C++/Java/Rust/Fortran that can use ninja as a backend. + +### that’s all! + +I’ve been using ninja for a few months now. I really like it and it’s caused me approximately 0 build-related headaches which feels pretty magical to me. + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/10/26/ninja--a-simple-way-to-do-builds/ + +作者:[Julia Evans][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://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://ninja-build.org/ +[2]: https://ninja-build.org/manual.html +[3]: http://neugierig.org/software/chromium/notes/2011/02/ninja.html +[4]: https://mesonbuild.com/Tutorial.html +[5]: https://blog.sesse.net/blog/tech/2020-09-28-00-37_introducing_plocate From 4d4fb56c131292e820f6a37091b7f1cab1d7b36a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 27 Oct 2020 05:07:51 +0800 Subject: [PATCH 0564/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201026?= =?UTF-8?q?=20Pi=20from=20High=20School=20Maths?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201026 Pi from High School Maths.md --- .../20201026 Pi from High School Maths.md | 155 ++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 sources/tech/20201026 Pi from High School Maths.md diff --git a/sources/tech/20201026 Pi from High School Maths.md b/sources/tech/20201026 Pi from High School Maths.md new file mode 100644 index 0000000000..10e972ca01 --- /dev/null +++ b/sources/tech/20201026 Pi from High School Maths.md @@ -0,0 +1,155 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Pi from High School Maths) +[#]: via: (https://theartofmachinery.com/2020/10/26/pi_from_high_school_maths.html) +[#]: author: (Simon Arneaud https://theartofmachinery.com) + +Pi from High School Maths +====== + +Warning: I don’t think the stuff in this post has any direct practical application by itself (unless you’re a nuclear war survivor and need to reconstruct maths from scratch or something). Sometimes I like to go back to basics, though. Here’s a look at (\pi) and areas of curved shapes without any calculus or transcendental functions. + +### A simple algorithm for calculating (\pi) + +This algorithm starts with simple number theoretic musing. Some whole numbers form neat Pythagorean triples ((x,y,z)) where (x^{2} + y^{2} = z^{2}). E.g., (3^{2} + 4^{2} = 5^{2}). It’s easy to find all the solutions to (x^{2} + y^{2} = 5^{2}) through brute-force search because we know that (x) and (y) can’t be bigger than (5). Here they are: + +[\begin{matrix} {0^{2} + 5^{2}} & {= 5^{2}} \ {3^{2} + 4^{2}} & {= 5^{2}} \ {4^{2} + 3^{2}} & {= 5^{2}} \ {5^{2} + 0^{2}} & {= 5^{2}} \ \end{matrix}] + +(Plus all the negative-number combinations, but let’s stick with non-negative integers and just count 4 solutions.) If we relax the equation, and count solutions to (x^{2} + y^{2} \leq 5^{2}), the answer turns out to be 26. Why care? Well, if (t) is the total number of solutions to (x^{2} + y^{2} \leq n^{2}), then + +[\lim\limits_{n\rightarrow\infty}\frac{4t}{(n + 1)^{2}} = \pi] + +Or, in code, here’s a simple program that estimates (\pi), getting more accurate for bigger values of the `n` variable: + +``` +import std; + +ulong sq(ulong x) pure +{ + return x * x; +} + +void main(string[] args) +{ + const n = args.length > 1 ? args[1].to!ulong : 20; + + ulong total; + foreach (x; 0..n+1) + { + foreach (y; 0..n+1) + { + if (sq(x) + sq(y) <= sq(n)) total++; + } + } + + /* + // Alternatively, for functional programming fans: + const total = + cartesianProduct(iota(n+1), iota(n+1)) + .filter!(p => sq(p[0]) + sq(p[1]) <= sq(n)) + .walkLength; + */ + + writef("%.12f\n", 4.0 * total / sq(n+1)); +} + +$ ./pi_calc +3.038548752834 +$ ./pi_calc 10000 +3.141362256135 +``` + +Okay, that’s a little bit more accurate than (\frac{22}{7}). Unlike most formulae for (\pi), though, there’s a simple diagram that shows how it works. Imagine we lay out the ((x,y)) integer pairs (where (x) and (y) range from (0) to (n)) on a 2D grid the obvious way. The figure below shows an example for (n = 10), with the arrow (r) pointing from the origin to ((6,8)). (r) and the (x) and (y) components make a right-angled triangle, so [Pythagoras’s theorem][1] says that (x^{2} + y^{2} = r^{2}). For ((6,8)), (r = 10 = n), so ((6,8)) is on the boundary as a solution to (x^{2} + y^{2} \leq 10^{2}). That boundary (the set of real-valued points a constant distance (n = 10) from the origin) makes a quarter circle. + +![][2] + +A circle is a simple, convex shape, and the grid points are evenly spaced, so the number of points inside the quarter circle will be roughly proportional to the area. More specifically, the fraction of all the grid points inside the quarter circle will be roughly the area of the quarter circle divided by the area of square around all points. The quarter circle area is (\pi r^{2} \div 4), inside the square of area (r^{2}) (remember, (n = r)), so (\frac{\pi}{4}) of all points represent solutions. The (x) and (y) values count from (0) to (n), so there are ((n + 1)^{2}) grid points. Rearrange the equations and you get a formula for estimating (\pi) from a solution count. The grid points keep drawing an arbitrarily more accurate circle as (n) gets bigger (just like a higher-resolution computer monitor does) so the estimate is exact in the limit. + +### A faster implementation + +The code above is simple but slow because it brute-force scans over all ((n + 1) \times (n + 1))possible (x) and (y) values. But we obviously don’t need to scan _all_ values. If we know that (x^{2} + y^{2} \leq n^{2}), then making (x) or (y) smaller will only give us another solution. We don’t need to keep testing smaller values after we find a solution. Ultimately, we only need to find the integral points around the boundary. Here’s a faster algorithm based on that idea. + +Imagine we scan along the integral (x) values and find the maximum integral (y) value that still gives us a solution. This gives us a border line marked in red in the figure below. If (y = 8) for a given (x) value, we instantly know there are (8 + 1 = 9) solutions with that given (x) value ((+ 1) to count the (y = 0) solution). + +![][3] + +Note that as (x) scans from (0) to (n), (y) starts at (n) and decreases to (0). Importantly, it _only_ decreases — it’s monotonic. So if we scan (x) from (0) to (n), we can find the next boundary (y) point by starting from the previous boundary point and searching downwards. Here’s some code: + +``` +ulong y = n, total; +foreach (x; 0..n+1) +{ + while (sq(x) + sq(y) > sq(n)) y--; + total += y + 1; +} +``` + +This version still has nested loops, so it might look like it’s still (O(n^{2})). However, the inner `while` loop executes a varying number of times for each (x) value. Often the `y--` doesn’t trigger at all. In fact, because `y` starts from `n` and monotonically decreases to 0, we know the `y--` will be executed exactly `n` times in total. There’s no instruction in that code that executes more than (O(n)) times, total, so the whole algorithm is (O(n)). + +With 64b `ulong` integers, the largest value of `n` that works before overflow is 4294967294: + +``` +$ ./pi_calc 4294967294 +3.141592653058 +``` + +There are ways to get faster convergence using numerical integration tricks, but I like the way this algorithm only uses integer arithmetic (up until the final division), and can be understood directly from simple diagrams. + +### Area of a circle without calculus + +Perhaps you feel a bit cheated because that algorithm assumes the (\pi r^{2}) formula for the area of a circle. Sure, that’s arguably included in “high school maths”, but it’s something students just get told to remember, unless they study integral calculus and derive it that way. But if we’re going to assume (\pi r^{2}), why not assume the theory of trigonometric functions as well, and just use (\pi = 4\operatorname{atan}(1))? + +The great ancient Greek mathematician Archimedes figured out the circle area over two thousand years ago without integral calculus (or trigonometric functions for that matter). He started with an elegant insight about regular (i.e., equal-sided) polygons. + +The famous [“half base times height” formula for the area of a triangle already had a well-known proof in the first book of Euclid’s Elements of Geometry][4] (easily derived from [a theorem about parallelograms][5]). Conveniently, any regular polygon can be split into equal triangles joined to the centre. For example, a regular hexagon splits into six triangles, as in the figure below. We can take any one of the triangles (they’re all the same) and call the “base” the side that’s also a side of the polygon. Then the “height” is the line from the centre of the base to the centre of the polygon. + +![][6] + +Now here’s Archimedes’s neat insight: The ratio of the triangle area to the base is (\frac{h}{2}). If you add up all the areas, you get the area of the polygon. Likewise, if you add up all the bases, you get the perimeter of the polygon. Because the triangle area/base ratio is a constant (\frac{h}{2}) for all triangles, the area/perimeter ratio for the whole polygon is the same (\frac{h}{2}). As a formula, the area of _any_ regular polygon is (P \times \frac{h}{2}) (where (P) is the perimeter). + +If you think of a circle as a regular polygon with infinitely many sides (so that (h) becomes the radius of the circle), and use the circle circumference ((2\pi r)) as your basic definition of (\pi), then that implies the area of a circle is (2\pi r \times \frac{r}{2} = \pi r^{2}). + +Of course, Archimedes was a respected mathematician who couldn’t get away with just assuming that anything true of a polygon is true of a circle (counterexample: all polygons have bumpy corners, but circles don’t). He used the kind of geometric proof by contradiction that was popular in his day. (He even took it further and analysed spheres, cylinders, parabolas and other curved objects, almost inventing something like modern real analysis a couple of millenia early.) Sadly, not all of his mathemetical work has survived, but [the key part of his Measurement of a Circle][7] has. + +Here’s the high-level version. Archimedes claimed that the area of a circle is (2\pi r \times \frac{r}{2}). Suppose you think his value is too small, and the circle is really bigger than (2\pi r \times \frac{r}{2}). That means there’s enough room inside the circle to fit a regular polygon that’s also bigger than (2\pi r \times \frac{r}{2}). But Archimedes said that’s contradictory because for any such polygon, (h < r), and (P < 2\pi r) (because each side of the polygon is a straight line that’s shorter than the circle arc that connects the same points), so the area (A = P \times \frac{h}{2} < 2\pi r \times \frac{r}{2}). The polygon’s area can’t be both bigger and smaller than (2\pi r \times \frac{r}{2}). + +![][8] + +Archimedes argued that there’s a similar contradiction if you think (2\pi r \times \frac{r}{2}) is too big, and the circle area is smaller than that. In that case he could make a polygon that’s also smaller than (2\pi r \times \frac{r}{2}), yet still wraps around the circle. For this polygon, (h = r), but he said the perimeter of the polygon must be greater than (2\pi r)[1][9], so that the polygon’s area must be bigger than (2\pi r \times \frac{r}{2}), even though it’s also meant to be smaller. + +![][10] + +If both of those cases lead to contradiction, we’re left with the only alternative that the circle area is (\pi r^{2}). + + 1. I don’t actually know how he argued this. [↩︎][11] + + + + +-------------------------------------------------------------------------------- + +via: https://theartofmachinery.com/2020/10/26/pi_from_high_school_maths.html + +作者:[Simon Arneaud][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://theartofmachinery.com +[b]: https://github.com/lujun9972 +[1]: https://www.cut-the-knot.org/pythagoras/ +[2]: https://theartofmachinery.com/images/pi_from_high_school_maths/pi_calc_grid.svg +[3]: https://theartofmachinery.com/images/pi_from_high_school_maths/pi_fast_calc_grid.svg +[4]: https://mathcs.clarku.edu/~djoyce/java/elements/bookI/propI37.html +[5]: https://mathcs.clarku.edu/~djoyce/java/elements/bookI/propI35.html +[6]: https://theartofmachinery.com/images/pi_from_high_school_maths/polygon.svg +[7]: https://flashman.neocities.org/ARCHCI1set.htm +[8]: https://theartofmachinery.com/images/pi_from_high_school_maths/polygon_inner.svg +[9]: tmp.gJlezpSbZb#fn:1 +[10]: https://theartofmachinery.com/images/pi_from_high_school_maths/polygon_outer.svg +[11]: tmp.gJlezpSbZb#fnref:1 From 55a3146d17592a2ec9d67ab134b37ce8e934f7ed Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 27 Oct 2020 08:45:09 +0800 Subject: [PATCH 0565/1156] translating --- ...nOffice and Support LibreOffice Instead.md | 81 ------------------- ...nOffice and Support LibreOffice Instead.md | 81 +++++++++++++++++++ 2 files changed, 81 insertions(+), 81 deletions(-) delete mode 100644 sources/tech/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md create mode 100644 translated/tech/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md diff --git a/sources/tech/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md b/sources/tech/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md deleted file mode 100644 index f7114ef6b3..0000000000 --- a/sources/tech/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md +++ /dev/null @@ -1,81 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead) -[#]: via: (https://itsfoss.com/libreoffice-letter-openoffice/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead -====== - -It is a no-brainer that Apache OpenOffice is still a relevant recommendation when we think about [open source alternatives to Microsoft Office][1] for Linux users. However, for the past several years, the development of OpenOffice is pretty much stale. - -Of course, it is not a shocker, considering Abhishek wrote about the [possibility of Apache OpenOffice shutting down][2] back in 2016. - -Now, in an [open letter from The Document Foundation][3], they appeal Apache OpenOffice to recommend users to start using better alternatives like LibreOffice. In this article, I shall mention some highlights from the blog post by The Document Foundation and what it means to Apache OpenOffice. - -![][4] - -### Apache OpenOffice is History, LibreOffice is the Future? - -Even though I didn’t use OpenOffice back in the day, it is safe to say that it is definitely not a modern open-source alternative to Microsoft Office. Not anymore, at least. - -Yes, Apache OpenOffice is still something important for legacy users and was a great alternative a few years back. - -Here’s the timeline of major releases for OpenOffice and LibreOffice: - -![][5] - -Now that there’s no significant development taking place for OpenOffice, what’s the future of Apache OpenOffice? A fairly active project with no major releases by the largest open source foundation? - -It does not sound promising and that is exactly what The Document Foundation highlights in their open letter: - -> OpenOffice(.org) – the “father project” of LibreOffice – was a great office suite, and changed the world. It has a fascinating history, but **since 2014, Apache OpenOffice (its current home) hasn’t had a single major release**. That’s right – no significant new features or major updates have arrived in over six years. Very few minor releases have been made, and there have been issues with timely security updates too. - -For an average user, if they don’t know about [LibreOffice][6], I would definitely want them to know. But, should the Apache Foundation suggest OpenOffice users to try LibreOffice to experience a better or advanced office suite? - -I don’t know, maybe yes, or no? - -> …many users don’t know that LibreOffice exists. The OpenOffice brand is still so strong, even though the software hasn’t had a significant release for over six years, and is barely being developed or supported - -As mentioned in the open letter, The Document Foundation highlights the advantages/improvements of LibreOffice over OpenOffice and appeals to Apache OpenOffice that they start recommending their users to try something better (i.e. LibreOffice): - -> We appeal to Apache OpenOffice to do the right thing. Our goal should be to **get powerful, up-to-date and well-maintained productivity tools into the hands of as many people as possible**. Let’s work together on that! - -### What Should Apache OpenOffice Do? - -If OpenOffice does the work, users may not need the effort to look for alternatives. So, is it a good idea to call out another project about their slow development and suggest them to embrace the future tools and recommend them instead? - -In an argument, one might say it is only fair to promote your competition if you’re done and have no interest in improving OpenOffice. And, there’s nothing wrong in that, the open-source community should always work together to ensure that new users get the best options available. - -On another side, one might say that The Document Foundation is frustrated about OpenOffice still being something relevant in 2020, even without any significant improvements. - -I won’t judge, but I think these conflicting thoughts come to my mind when I take a look at the open letter. - -### Do you think it is time to put OpenOffice to rest and rely on LibreOffice? - -Even though LibreOffice seems to be a superior choice and definitely deserves the limelight, what do you think should be done? Should Apache discontinue OpenOffice and redirect users to LibreOffice? - -Your opinion is welcome. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/libreoffice-letter-openoffice/ - -作者:[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/best-free-open-source-alternatives-microsoft-office/ -[2]: https://itsfoss.com/openoffice-shutdown/ -[3]: https://blog.documentfoundation.org/blog/2020/10/12/open-letter-to-apache-openoffice/ -[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/libre-office-open-office.png?resize=800%2C450&ssl=1 -[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/libre-office-open-office-derivatives.jpg?resize=800%2C166&ssl=1 -[6]: https://itsfoss.com/libreoffice-tips/ diff --git a/translated/tech/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md b/translated/tech/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md new file mode 100644 index 0000000000..5620f99321 --- /dev/null +++ b/translated/tech/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md @@ -0,0 +1,81 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead) +[#]: via: (https://itsfoss.com/libreoffice-letter-openoffice/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +LibreOffice 希望 Apache 放弃陷入困境的 OpenOffice,转而支持 LibreOffice +====== + +对于 Linux 用户来说,当我们想到[微软 Office 的开源替代品][1]时,Apache OpenOffice 仍然是一个相关的推荐,这是不言而喻的。然而,在过去的几年里,OpenOffice 的发展几乎是停滞的。 + +当然,考虑到 Abhishek 早在 2016年 就写过 [Apache OpenOffice 关闭的可能性][2],这并不令人震惊。 + +现在,在[文档基金会的公开信][3]中,他们呼吁 Apache OpenOffice 推荐用户开始使用更好的替代品,比如 LibreOffice。在本文中,我将提到文档基金会的博文中的一些重点,以及它对 Apache OpenOffice 的意义。 + +![][4] + +### Apache OpenOffice 是历史,LibreOffice 是未来? + +尽管我当年没有使用过 OpenOffice,但可以肯定地说,它绝对不是微软 Office 的现代开源替代品。至少现在不是了。 + +是的,Apache OpenOffice 对于传统用户来说仍然是很重要的东西,在几年前是一个很好的替代品。 + +以下是 OpenOffice 和 LibreOffice 的主要发布时间线: + +![][5] + +现在 OpenOffice 已经没有重大的开发了,Apache OpenOffice 的未来是什么?最大开源基金会一个有些活跃的项目没有重大发布? + +这听起来并不乐观,而这正是文档基金会在他们的公开信中所强调的: + +> OpenOffice(.org),LibreOffice 的”父项目“,是一个伟大的办公套件,它改变了世界。它有着引人入胜的历史,但**自从 2014 年以来,Apache OpenOffice (它现在的家)还没有一个重大的版本**。没错,六年多来,没有重大的新功能或重大更新到来。很少有次要的发布,而且在及时的安全更新方面也存在问题。 + +对于一个普通用户来说,如果他们不知道 [LibreOffice][6],我肯定希望他们知道。但是,Apache 基金会是否应该建议 OpenOffice 用户尝试使用 LibreOffice 来体验更好或更高级的办公套件呢? + +我不知道,也许是,或者不是? + +> ...很多用户不知道 LibreOffice 的存在。OpenOffice 的品牌仍然如此强大,尽管该软件已经有六年多没有重大的版本发布,而且几乎没有人开发或支持它。 + +正如在公开信中提到的,文档基金会强调了 LibreOffice 相对于 OpenOffice的 优势/改进,并呼吁 Apache OpenOffice 开始推荐他们的用户尝试更好的东西(即 LibreOffice): + +> 我们呼吁 Apache OpenOffice 做正确的事情。我们的目标应该是**把强大的、最新的、维护良好的生产力工具送到尽可能多的人手中**。让我们一起努力吧! + +### Apache OpenOffice 应该做什么? + +如果 OpenOffice 能完成工作,用户可能不需要努力寻找替代品。那么,因为他们的缓慢开发而呼唤另一个项目,建议用户采用未来工具并推荐它是一个好主意么? + +在争论中,有人可能会说,如果你已经完成了,并且对改进 OpenOffice 没有兴趣,那么推广你的竞争对手才是公平的。而且,这并没有错,开源社区应该一直合作,以确保新用户得到最好的选择。 + +从另一个侧面来看,我们可以说,文档基金会对于 OpenOffice 在 2020 年即使没有任何重大改进却仍然有重要意义感到沮丧。 + +我不会去评判,但当我看了这封公开信时,这些矛盾的想法就浮现在我的脑海里。 + +### 你认为是时候把 OpenOffice 搁置起来,依靠 LibreOffice 了吗? + +即使 LibreOffice 似乎是一个更优越的选择,并且绝对值得关注,你认为应该怎么做?Apache 是否应该停止 OpenOffice,并将用户重定向到 LibreOffice? + +欢迎你的意见。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/libreoffice-letter-openoffice/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者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/best-free-open-source-alternatives-microsoft-office/ +[2]: https://itsfoss.com/openoffice-shutdown/ +[3]: https://blog.documentfoundation.org/blog/2020/10/12/open-letter-to-apache-openoffice/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/libre-office-open-office.png?resize=800%2C450&ssl=1 +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/libre-office-open-office-derivatives.jpg?resize=800%2C166&ssl=1 +[6]: https://itsfoss.com/libreoffice-tips/ From 56a1c6c096bceaa7751c20573450a58d4c6b5d8f Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 27 Oct 2020 08:55:20 +0800 Subject: [PATCH 0566/1156] translating --- .../20200909 How to Install Ubuntu Server on a Raspberry Pi.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200909 How to Install Ubuntu Server on a Raspberry Pi.md b/sources/tech/20200909 How to Install Ubuntu Server on a Raspberry Pi.md index 075091a91b..ac2fa3d489 100644 --- a/sources/tech/20200909 How to Install Ubuntu Server on a Raspberry Pi.md +++ b/sources/tech/20200909 How to Install Ubuntu Server on a Raspberry Pi.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 28800baa87eb7ac96fdfd8075d2bc76e6f45ed2d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 27 Oct 2020 17:13:48 +0800 Subject: [PATCH 0567/1156] Rename sources/tech/20201021 How anyone can contribute to open source software in their job.md to sources/talk/20201021 How anyone can contribute to open source software in their job.md --- ... anyone can contribute to open source software in their job.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20201021 How anyone can contribute to open source software in their job.md (100%) diff --git a/sources/tech/20201021 How anyone can contribute to open source software in their job.md b/sources/talk/20201021 How anyone can contribute to open source software in their job.md similarity index 100% rename from sources/tech/20201021 How anyone can contribute to open source software in their job.md rename to sources/talk/20201021 How anyone can contribute to open source software in their job.md From 0459f9e11f9fed7fd6d12df34c8069b9830add8b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 27 Oct 2020 17:16:32 +0800 Subject: [PATCH 0568/1156] Rename sources/tech/20201022 How to influence people to join open source.md to sources/talk/20201022 How to influence people to join open source.md --- .../20201022 How to influence people to join open source.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20201022 How to influence people to join open source.md (100%) diff --git a/sources/tech/20201022 How to influence people to join open source.md b/sources/talk/20201022 How to influence people to join open source.md similarity index 100% rename from sources/tech/20201022 How to influence people to join open source.md rename to sources/talk/20201022 How to influence people to join open source.md From 293fcc85fb352b60ff54f3d72dea3e603a888c52 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 27 Oct 2020 17:19:41 +0800 Subject: [PATCH 0569/1156] Rename sources/tech/20201023 Why it-s important to keep the cloud open.md to sources/talk/20201023 Why it-s important to keep the cloud open.md --- .../20201023 Why it-s important to keep the cloud open.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20201023 Why it-s important to keep the cloud open.md (100%) diff --git a/sources/tech/20201023 Why it-s important to keep the cloud open.md b/sources/talk/20201023 Why it-s important to keep the cloud open.md similarity index 100% rename from sources/tech/20201023 Why it-s important to keep the cloud open.md rename to sources/talk/20201023 Why it-s important to keep the cloud open.md From 1791a8cc010649e36562bc742c892c817eff2c71 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 28 Oct 2020 05:01:36 +0800 Subject: [PATCH 0570/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201027?= =?UTF-8?q?=20Fedora=2033=20is=20officially=20here!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201027 Fedora 33 is officially here.md --- .../20201027 Fedora 33 is officially here.md | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 sources/tech/20201027 Fedora 33 is officially here.md diff --git a/sources/tech/20201027 Fedora 33 is officially here.md b/sources/tech/20201027 Fedora 33 is officially here.md new file mode 100644 index 0000000000..b4eb274903 --- /dev/null +++ b/sources/tech/20201027 Fedora 33 is officially here.md @@ -0,0 +1,90 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fedora 33 is officially here!) +[#]: via: (https://fedoramagazine.org/announcing-fedora-33/) +[#]: author: (Matthew Miller https://fedoramagazine.org/author/mattdm/) + +Fedora 33 is officially here! +====== + +![][1] + +Today, I’m excited to share the results of the hard work of thousands of contributors to the Fedora Project: our latest release, Fedora 33, is here! This is a big release with a lot of change, but I believe all that work will also make it a comfortable one, fulfilling our goal of bringing you the latest stable, powerful, and robust free and open source software in many easy to use offerings.  + +If you just want to get to the bits without delay, head over to right now. For details, read on! + +### **Find the Fedora flavor that’s right for you!** + +Fedora Editions are targeted outputs geared toward specific “showcase” uses on the desktop, in server and cloud environments—and now for Internet of Things as well. + +Fedora Workstation focuses on the desktop, and in particular, it’s geared toward software developers who want a “just works” Linux operating system experience. This release features [GNOME 3.38][2], which has plenty of great improvements as usual. The addition of the Tour application helps new users learn their way around. And like all of our other desktop-oriented variants, Fedora Workstation now uses [BTRFS as the default filesystem][3]. This advanced filesystem lays the foundation for bringing a lot of great enhancements in upcoming releases. For your visual enjoyment, Fedora 33 Workstation now features an animated background (based on time of day) by default. + +Fedora CoreOS is an emerging Fedora Edition. It’s an automatically-updating, minimal operating system for running containerized workloads securely and at scale. It offers several [update streams][4] that can be followed for automatic updates that occur roughly every two weeks. Currently the **next** stream is based on Fedora 33, with the **testing** and **stable** streams to follow. You can find information about released artifacts that follow the **next** stream from [the download page][5] and information about how to use those artifacts in the [Fedora CoreOS Documentation][6]. + +[Fedora IoT][7], newly promoted to Edition status, provides a strong foundation for IoT ecosystems and edge computing use cases. Among many other features, Fedora 33 IoT introduces the Platform AbstRaction for SECurity (PARSEC), an open-source initiative to provide a common API to hardware security and cryptographic services in a platform-agnostic way. + +Of course, we produce more than just the Editions. [Fedora Spins][8] and [Labs][9] target a variety of audiences and use cases, including [Fedora CompNeuro][10], which brings a plethora of open source computational modelling tools for neuroscience, and desktop environments like [KDE Plasma][11] and [Xfce][12].  + +And, don’t forget our alternate architectures: [ARM AArch64, Power, and S390x][13]. New in Fedora 33, AArch64 users can use the .NET Core language for cross-platform development. We have improved support for Pine64 devices, NVidia Jetson 64 bit platforms, and the Rockchip system-on-a-chip devices including the Rock960, RockPro64, and Rock64. (However, a late-breaking note: there may be problems booting on some of these devices. Upgrading from existing Fedora 32 will be fine. More info will be on the [Common Bugs][14] page as we have it.) + +We’re also excited to announce that the Fedora Cloud Base Image and Fedora CoreOS will be available in Amazon’s [AWS Marketplace][15] for the first time with Fedora 33. Fedora cloud images have been available in the Amazon cloud for over a decade, and you can launch our official images by AMI ID or [with a click][16]. The Marketplace provides an alternate way to get the same thing, with significantly wider visibility for Fedora. This will also make our cloud images available in new AWS regions more quickly. Thank you especially to David Duncan for making this happen! + +### General improvements + +No matter what variant of Fedora you use, you’re getting the latest the open source world has to offer. Following our “[First][17]” foundation, we’ve updated key programming language and system library packages, including Python 3.9, Ruby on Rails 6.0, and Perl 5.32. In Fedora KDE, we’ve followed the work in Fedora 32 Workstation and enabled the EarlyOOM service by default to improve the user experience in low-memory situations. + +To make the default Fedora experience better, we’ve set nano as the default editor. nano is a friendly editor for new users. Those of you who want the power of editors like vi can, of course, set your own default. + +We’re excited for you to try out the new release! Go to and download it now. Or if you’re already running a Fedora operating system, follow the easy [upgrade instructions][18]. For more information on the new features in Fedora 33, see the [release notes][19]. + +### **A note on Secure Boot** + +Secure Boot is a security standard which ensures that only officially-signed operating system software can load on your computer. This is important for preventing persistent malware which could hide itself in your computer’s firmware and survive even an operating system reinstallation. However, in the wake of the [Boot Hole][20] vulnerability, the cryptographic certificate used to sign Fedora bootloader software will be revoked and replaced with a new one. Because this will have a broad impact, revocation should not happen widely until the second quarter of 2021 or later. + +However, some users may have received this revocation from other operating systems or firmware updates already. In that case, Fedora installations will not boot with Secure Boot enabled. To be clear, this will not affect most users. If it does affect you, you can boot with Secure Boot disabled for the time being. We will release an update signed with the new certificate to be available on all supported releases well before broad-scale certificate revocation takes place, and at that point Secure Boot should be reenabled. + +### **In the unlikely event of a problem….** + +If you run into a problem, check out the [Fedora 33 Common Bugs][14] page, and if you have questions, visit our [Ask Fedora][21] user-support platform. + +### **Thank you everyone** + +Thanks to the thousands of people who contributed to the Fedora Project in this release cycle, and especially to those of you who worked extra hard to make this another on-time release during a pandemic. Fedora is a community, and it’s great to see how much we’ve supported each other. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/announcing-fedora-33/ + +作者:[Matthew Miller][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/mattdm/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/10/f33-final-816x345.jpg +[2]: https://www.gnome.org/news/2020/09/gnome-3-38-released/ +[3]: https://fedoramagazine.org/btrfs-coming-to-fedora-33/ +[4]: https://docs.fedoraproject.org/en-US/fedora-coreos/update-streams/ +[5]: https://getfedora.org/en/coreos/download?stream=next +[6]: https://docs.fedoraproject.org/en-US/fedora-coreos/getting-started/ +[7]: https://getfedora.org/iot +[8]: https://spins.fedoraproject.org/ +[9]: https://labs.fedoraproject.org/ +[10]: https://labs.fedoraproject.org/en/comp-neuro/ +[11]: https://spins.fedoraproject.org/en/kde/ +[12]: https://spins.fedoraproject.org/en/xfce/ +[13]: https://alt.fedoraproject.org/alt/ +[14]: https://fedoraproject.org/wiki/Common_F33_bugs +[15]: https://aws.amazon.com/marketplace +[16]: https://getfedora.org/en/coreos/download?tab=cloud_launchable&stream=stable +[17]: https://docs.fedoraproject.org/en-US/project/#_first +[18]: https://docs.fedoraproject.org/en-US/quick-docs/upgrading/ +[19]: https://docs.fedoraproject.org/en-US/fedora/f33/release-notes/ +[20]: https://access.redhat.com/security/vulnerabilities/grub2bootloader +[21]: http://ask.fedoraproject.org From 46a92614ef5dcee5e1758b624acfef4e376d7d2c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 28 Oct 2020 05:01:56 +0800 Subject: [PATCH 0571/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201028?= =?UTF-8?q?=20How=20to=20Clear=20Terminal=20Screen=20in=20Ubuntu=20and=20O?= =?UTF-8?q?ther=20Linux=20Distributions=20[Beginner=E2=80=99s=20Tip]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md --- ...her Linux Distributions -Beginner-s Tip.md | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 sources/tech/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md diff --git a/sources/tech/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md b/sources/tech/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md new file mode 100644 index 0000000000..0925e8703e --- /dev/null +++ b/sources/tech/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Clear Terminal Screen in Ubuntu and Other Linux Distributions [Beginner’s Tip]) +[#]: via: (https://itsfoss.com/clear-terminal-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +How to Clear Terminal Screen in Ubuntu and Other Linux Distributions [Beginner’s Tip] +====== + +When you are working in the terminal, often you’ll find that your terminal screen is filled up with too many commands and their outputs. + +You may want to clear the terminal to declutter the screen and focus on the next task you are going to perform. Clearing the Linux terminal screen helps a lot, trust me. + +### Clear Linux terminal with clear command + +So, how do you clear terminal in Linux? The simplest and the most common way is to use the clear command: + +``` +clear +``` + +You need no option with the clear command. It’s that simple but there are some additional things you need to know about it. + +![][1] + +_**The clear command and other methods of clearing screen may depend on the terminal emulator you are using.**_ Terminal emulator is the terminal application that you use for accessing the Linux shell (command line). + +If you use clear command on Ubuntu with GNOME Terminal, it will clear the screen and you won’t be able to see what else you had on the screen previously. + +In many other terminal emulators or Putty, it may just clear the screen for one page. If you scroll with mouse or PageUp and PageDown keys, you can still access the old screen outputs. + +Frankly, it depends on your need. If you suddenly realize that you need to refer to the output of a previously run command, perhaps having that option available will be helpful. + +### Other ways to clear terminal screen in Linux + +![][2] + +Clear command is not the only way to clear the terminal screen. + +You can use Ctrl+L [keyboard shortcut in Linux][3] to clear the screen. It works in most terminal emulators. + +``` +Ctrl+L +``` + +If you use Ctrl+L and clear command in GNOME terminal (default in Ubuntu), you’ll notice the difference between their impact. Ctrl+L moves the screen one page down giving the illusion of a clean screen but you can still access the command output history by scrolling up. + +**Some other terminal emulators have this keyboard shortcut set at Ctrl+Shift+K.** + +You can also use reset command for clearing the terminal screen. Actually, this command performs a complete terminal re-initialization. It could take a bit longer than clear command, though. + +``` +reset +``` + +There are a couple of other complicated ways to clear the screen when you want to clear the screen completely. But since the command is a bit complicated, it’s better to use it as [alias in Linux][4]: + +``` +alias cls='printf "\033c"' +``` + +You can add this alias to your bash profile so that it is available as command. + +I know this was a pretty basic topic and most Linux users probably already knew it but it doesn’t harm in covering the elementary topics for the new Linux users. Isn’t it? + +Got some secretive tip on clearing terminal screen? Why not share it with us? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/clear-terminal-ubuntu/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/clear-command-linux.gif?resize=800%2C432&ssl=1 +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/clear-terminal-screen-linux.png?resize=800%2C450&ssl=1 +[3]: https://linuxhandbook.com/linux-shortcuts/ +[4]: https://linuxhandbook.com/linux-alias-command/ From 0fa5afd0b92383ec866ad4243c1fe517f0a7ca6c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 28 Oct 2020 05:02:11 +0800 Subject: [PATCH 0572/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201027?= =?UTF-8?q?=20How=20to=20define=20a=20product=20in=20the=20open=20source?= =?UTF-8?q?=20software=20supply=20chain?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201027 How to define a product in the open source software supply chain.md --- ...n the open source software supply chain.md | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 sources/tech/20201027 How to define a product in the open source software supply chain.md diff --git a/sources/tech/20201027 How to define a product in the open source software supply chain.md b/sources/tech/20201027 How to define a product in the open source software supply chain.md new file mode 100644 index 0000000000..8a13a06eeb --- /dev/null +++ b/sources/tech/20201027 How to define a product in the open source software supply chain.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to define a product in the open source software supply chain) +[#]: via: (https://opensource.com/article/20/10/defining-product-open-source) +[#]: author: (Scott McCarty https://opensource.com/users/fatherlinux) + +How to define a product in the open source software supply chain +====== +Differentiation is what makes a product successful. Learn more in part +two of this series on open source in the software supply chain. +![Gift box opens with colors coming out][1] + +In the first article in this series, "[Is open source a development model, business model, or something else?][2]" I introduced the concept that open source is part of the supply chain for software products. But to truly understand open source as a supply chain, you must have a decent understanding of what a product is. A product can be thought of as a business, and as legendary business guru [Peter Drucker][3] said, "The purpose of business is to create and keep a customer." Drucker's statement means a business or product must be useful enough to pay for, or it will fail. Product differentiation is the thing that creates and retains customers. + +### What's in a software product? + +Even in the stone age of 1999, when I started my career, the concept of software products existed—you could go to a store and purchase boxed copies of Red Hat Linux on compact discs (though floppies were still very much in use). The idea of software products existing might sound like a joke, and it is, but in the 1940s and 1950s (when computers, as we know them, were created), software was not a component of value that was bought and sold. There was no market for software. You couldn't buy it, sell it, or access it online. + +Instead of buying software, the choice was to build or buy a physical computer; with either option, you wrote the software yourself for that specific computer. + +> _That… specific… computer…_ + +No joke. In the early days of computers, software couldn't run anywhere except for the computer you wrote it on. In fact, in the early days, you couldn't even use the same programming language on two different computers. But, as computers evolved, system software, such as operating systems, assemblers, and compilers, were created. And with the advent of this system software, application code became more reusable and portable. + +In the 1960s, cross-platform compilers and operating systems led to the concept of reusable code, such as macros and eventually libraries. At the beginning of every project, you built your own reusable functions and libraries. (Computer science courses still force you to do this so that you learn what's going on behind the scenes.) Concurrently, processors and operating systems standardized, enabling portability between computers. + +In the early days, these components were used within single organizations (e.g., a government, university, company, etc.), but the desire to share software among organizations emerged quickly. If you're interested in understanding the history of code portability from the first computers to containers, see "Fatherlinux's" [Container portability][4] series or the [History of compiler construction][5] Wikipedia page. Suffice to say, code had to be portable before anyone could have software products, open source or even containers. + +### Reusable and portable software + +Once code became portable and shareable between organizations, the next logical step was to sell it. In these early days, having software that did _something useful_ was differentiating in the marketplace. This was a breakthrough because if you needed a calculator, a compiler, or a piece of word processing software, it became cheaper and easier to buy it than to write it. So software products were born. + +This model really only worked to tackle general-purpose problems that a lot of people share—things like calculating numbers, writing documents, or compiling software; these are business problems. General-purpose software is great, but it doesn't elegantly solve specific problems related to business rules within a single industry or organization, although you can abuse Excel or Google Sheets pretty hard. For specific business problems, it's more efficient to write custom code. This need led to the rise of middleware, things like Java, service buses, and databases. Middleware was bought and sold to assist with custom software development. + +Code portability led to a marketplace for software applications and middleware. Software companies began to provide competing solutions with differentiated value. You picked the compiler or the calculator that you wanted based on features. The existence of competing solutions was great for consumers because it drove software companies to create more specialized solutions, each with unique value. Whether a product is built on open source or not, it must provide unique value in the marketplace. + +### Understanding differentiated value + +To explain differentiated value, I'll use an analogy about automobiles. Families need cars, sport utility vehicles (SUVs), or minivans. They might want comfortable seats, infotainment systems, or safety features. They often have a preference on color. Each family is different and has specific needs, so the perfect automobile would be one that the family built together as a project. + +Most families don't have the time, desire, money, or credit to buy all of the components necessary to build the perfect car from scratch, much less the time to maintain it over a given lifecycle. It wouldn't be an economical investment of time or money for a family. It would cost them way more, and take a long time to build. Instead, families buy automobiles from existing vendors, as a built solution to their transportation problem. Although the bought car will be imperfect, it will approximately meet their needs with much less time and money invested. + +Automobile vendors put a solution together with undifferentiated and differentiated components. This includes everything from the motor, fuel injectors, tires, and seats in the car, to the buying experience at the dealership, the financing, and the service program while the car is owned. All of these features and experiences are a component of the solution that families buy when looking for an automobile. The combination of all these things is what produces something that is different and, hopefully, better in the marketplace. We call this _differentiation_. The more competing solutions, the more differentiation in the marketplace, and the better the chance that a family can find a car that matches their needs more approximately. + +### Differentiation in open source + +In a traditional manufactured product or service, there is a distinction between the value provided by the supplier and the value provided by the company selling directly to the consumer. You could make a further distinction between business-to-consumer (B2C) or business-to-business (B2B) products and services, but that's beyond the scope of this series. + +The astute reader may already be thinking, "yeah, but with traditional products, the suppliers are also companies selling products with differentiation." This is completely true, and in this way, open source projects are no different. Community-driven, open source projects don't have the advantage of expensive marketing campaigns, focus groups, and sales teams to educate customers, but they must also differentiate themselves in the marketplace. + +Differentiation is an important concept for product managers, developers, and even systems administrators. Even in a broader context, the output of any sort of knowledge work—code, writing, music, or art—differentiation is what brings value and meaning to our work. Differentiation is what creates value, whether it's a software product or service, labor, or even music. + +In the next article, I'll dive deeper into how software product teams differentiate their solutions from the open source components provided by their suppliers. We'll even cover software as a service (SaaS). + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/defining-product-open-source + +作者:[Scott McCarty][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://opensource.com/users/fatherlinux +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_gift_giveaway_box_520x292.png?itok=w1YQhNH1 (Gift box opens with colors coming out) +[2]: https://opensource.com/article/20/10/open-source-supply-chain +[3]: https://en.wikipedia.org/wiki/Peter_Drucker +[4]: http://crunchtools.com/container-portability-part-1/ +[5]: https://en.wikipedia.org/wiki/History_of_compiler_construction From 82666f3d8816ce3f6d4aac04b5154a6af1b0b01c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Wed, 28 Oct 2020 07:35:28 +0800 Subject: [PATCH 0573/1156] Translated --- ...pace in -boot Partition on Ubuntu Linux.md | 173 ------------------ ...pace in -boot Partition on Ubuntu Linux.md | 173 ++++++++++++++++++ 2 files changed, 173 insertions(+), 173 deletions(-) delete mode 100644 sources/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md create mode 100644 translated/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md diff --git a/sources/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md b/sources/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md deleted file mode 100644 index b34715733d..0000000000 --- a/sources/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md +++ /dev/null @@ -1,173 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (robsean) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Free Up Space in /boot Partition on Ubuntu Linux?) -[#]: via: (https://itsfoss.com/free-boot-partition-ubuntu/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -How to Free Up Space in /boot Partition on Ubuntu Linux? -====== - -The other day, I got a warning that boot partition is almost full or has no space left. Yes, I have a separate boot partition, not many people do that these days, I believe. - -This was the first time I saw such an error and it left me confused. Now, there are several [ways to free up space on Ubuntu][1] (or Ubuntu-based distros) but not all of them are useful in this case. - -This is why I decided to write about the steps I followed to free some space in the /boot partition. - -### Free up space in /boot partition on Ubuntu (if your boot partition is running out of space) - -![][2] - -I’d advise you to carefully read through the solutions and follow the one best suited for your situation. It’s easy but you need to be cautious about performing some of these on your production systems. - -#### Method 1: Using apt autoremove - -You don’t have to be a terminal expert to do this, it’s just one command and you will be removing unused kernels to free up space in the /boot partition. - -All you have to do is, type in: - -``` -sudo apt autoremove -``` - -This will not just remove unused kernels but also get rid of the dependencies that you don’t need or isn’t needed by any of the tools installed. - -Once you enter the command, it will list the things that will be removed and you just have to confirm the action. If you’re curious, you can go through it carefully and see what it actually removes. - -Here’s how it will look like: - -![][3] - -You have to press **Y** to proceed. - -_**It’s worth noting that this method will only work if you’ve a tiny bit of space left and you get the warning. But, if your /boot partition is full, APT may not even work.**_ - -In the next method, I’ll highlight two different ways by which you can remove old kernels to free up space using a GUI and also the terminal. - -#### Method 2: Remove Unused Kernel Manually (if apt autoremove didn’t work) - -Before you try to [remove any older kernels][4] to free up space, you need to identify the current active kernel and make sure that you don’t delete that. - -To [check your kernel version][5], type in the following command in the terminal: - -``` -uname -r -``` - -The [uname command is generally used to get Linux system information][6]. Here, this command displays the current Linux kernel being used. It should look like this: - -![][7] - -Now, that you know what your current Linux Kernel is, you just have to remove the ones that do not match this version. You should note it down somewhere so that you ensure you do not remove it accidentally. - -Next, to remove it, you can either utilize the terminal or the GUI. - -Warning! - -Be extra careful while deleting kernels. Identify and delete old kernels only, not the current one you are using otherwise you’ll have a broken system. - -##### Using a GUI tool to remove old Linux kernels - -You can use the [Synaptic Package Manager][8] or a tool like [Stacer][9] to get started. Personally, when I encountered a full /boot partition with apt broken, I used [Stacer][6] to get rid of older kernels. So, let me show you how that looks. - -First, you need to launch “**Stacer**” and then navigate your way to the package uninstaller as shown in the screenshot below. - -![][10] - -Here, search for “**image**” and you will find the images for the Linux Kernels you have. You just have to delete the old kernel versions and not your current kernel image. - -I’ve pointed out my current kernel and old kernels in my case in the screenshot above, so you have to be careful with your kernel version on your system. - -You don’t have to delete anything else, just the ones that are the older kernel versions. - -Similarly, just search for “**headers**” in the list of packages and delete the old ones as shown below. - -![][11] - -Just to warn you, you **don’t want to remove “linux-headers-generic”**. Only focus on the ones that have version numbers with them. - -And, that’s it, you’ll be done and apt will be working again and you have successfully freed up some space from your /boot partition. Similarly, you can do this using any other package manager you’re comfortable with. - -#### Using the command-line to remove old kernels - -It’s the same thing but just using the terminal. So, if you don’t have the option to use a GUI (if it’s a remote machine/server) or if you’re just comfortable with the terminal, you can follow the steps below. - -First, list all your kernels installed using the command below: - -``` -ls -l /boot -``` - -It should look something like this: - -![][12] - -The ones that are mentioned as “**old**” or the ones that do not match your current kernel version are the unused kernels that you can delete. - -Now, you can use the **rm** command to remove the specific kernels from the boot partition using the command below (a single command for each): - -``` -sudo rm /boot/vmlinuz-5.4.0-7634-generic -``` - -Make sure to check the version for your system — it may be different for your system. - -If you have a lot of unused kernels, this will take time. So, you can also get rid of multiple kernels using the following command: - -``` -sudo rm /boot/*-5.4.0-{7634}-* -``` - -To clarify, you need to write the last part/code of the Kernel versions separated by commas to delete them all at once. - -Suppose, I have two old kernels 5.4.0-7634-generic and 5.4.0-7624, the command will be: - -``` -sudo rm /boot/*-5.4.0-{7634,7624}-* -``` - -If you don’t want to see the old kernel version in the grub boot menu, you can simply [update grub][13] using the following command: - -``` -sudo update-grub -``` - -That’s it. You’re done. You’ve freed up space and also potentially fixed the broken APT if it was an issue after your /boot partition filled up. - -In some cases, you may need to enter these commands to fix the broken apt (as I’ve noticed in the forums): - -``` -sudo dpkg --configure -a -sudo apt install -f -``` - -Do note that you don’t need to enter the above commands unless you find APT broken. Personally, I didn’t need these commands but I found them handy for some on the forums. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/free-boot-partition-ubuntu/ - -作者:[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/free-up-space-ubuntu-linux/ -[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/free-boot-space-ubuntu-linux.jpg?resize=800%2C450&ssl=1 -[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/apt-autoremove-screenshot.jpg?resize=800%2C415&ssl=1 -[4]: https://itsfoss.com/remove-old-kernels-ubuntu/ -[5]: https://itsfoss.com/find-which-kernel-version-is-running-in-ubuntu/ -[6]: https://linuxhandbook.com/uname/ -[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/uname-r-screenshot.jpg?resize=800%2C198&ssl=1 -[8]: https://itsfoss.com/synaptic-package-manager/ -[9]: https://itsfoss.com/optimize-ubuntu-stacer/ -[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/stacer-remove-kernel.jpg?resize=800%2C562&ssl=1 -[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/stacer-remove-kernel-header.png?resize=800%2C576&ssl=1 -[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/command-kernel-list.png?resize=800%2C432&ssl=1 -[13]: https://itsfoss.com/update-grub/ diff --git a/translated/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md b/translated/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md new file mode 100644 index 0000000000..6179dc28d4 --- /dev/null +++ b/translated/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md @@ -0,0 +1,173 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Free Up Space in /boot Partition on Ubuntu Linux?) +[#]: via: (https://itsfoss.com/free-boot-partition-ubuntu/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +如何在 Ubuntu Linux 上释放 /boot 分区的空间? +====== + +前几天,我收到一个警告,/boot 分区已经几乎满了或者已经没有剩余空间了。是的,我有一个独立的 /boot 分区,我相信现在很少有人这样做了。 + +这是我第一次看到这样一个错误,它让我很迷惑。现在,这里有一些 [方法来释放在 Ubuntu 上的分区][1] (或者基于 Ubuntu 的发行版) ,但是在这种情况下并不是所有的方法都能用。 + +这就是为什么我决定写这些我释放 /boot 分区空间的步骤的原因。 + +### 如何在 Ubuntu 上释放 /boot 分区的空间(如果你的 /boot 分区空间不足) + +![][2] + +我建议你仔细阅读这些解决方案,并由此得出最适合你情况的解决方案。解决方案的操作很容易,但是你需要在你的生产力系统上小心的执行这些解决方案。 + +#### 方法 1: 使用 apt autoremove + +你不必是一名终端专家来做这件事,它只需要一个命令,你将移除未使用的内核来释放 /boot 分区中是空间。 + +你所有要做的事情是,输入: + +``` +sudo apt autoremove +``` + +这个命令不仅仅可以移除未使用的内核,而且也将摆脱你不需要的或工具安装后所不需要的依赖项。 + +在你输入命令后,它将列出将被移除的东西,你只需要确认操作即可。如果你很好奇它将移除什么,你可以仔细检查一下看看它实际移除了什么。 + +这里是它应该看起来的样子: + +![][3] + +你必需按 **Y** 按键来继续。 + +_**值得注意的是,这种方法只在你仅剩余一点点空间并并且得到警告的情况下才有效。但是,如果你的 /boot 分区已经满了,APT 甚至可能不会工作。**_ + +在接下来的方法中,我将重点介绍两种不同的方法,通过这些方法你可以使用 GUI 和终端来移除旧内核来释放空间。 + +#### 方法 2: 手动移除未使用的内核(如果 apt autoremove 不工作的话) + +在你尝试 [移除一些旧内核][4] 来释放空间前,你需要识别当前活动的内核,并且确保你不会删除它。 + +为 [检查你的内核的版本][5] ,在终端中输入下面的命令: + +``` +uname -r +``` + +[uname 命令通常用于获取 Linux 系统信息][6] 。在这里,这个命令显示当前正在被使用的 Linux 内核。它看起来应该是这样: + +![][7] + +现在,你已经知道你当前的 Linux 内核是什么,你必需移除一个不同于这个版本内核的内核。你应该把它记录在某些地方,以便你不会不知不觉地移除它。 + +接下来,要移除它,你可以使用终端或 GUI . + +警告! + +在删除内核时一定要额外的小心。只识别和删除旧内核,而不是当前你正在使用的内核,否则你将会拥有一个残缺的系统。 + +##### 使用一个 GUI 工具来移除旧的 Linux 内核 + +你可以使用 [Synaptic 软件包管理器][8] 或一个类似 [Stacer][9] 的工具来开始。就我个人而言,当我遇到一个满满的 /boot 分区且 apt 损坏是,我使用 [Stacer][6] 来丢弃旧内核。因此,让我向你展示一下它看起的样子。 + +首先,你需要启动 “**Stacer**” ,然后导航到软件包卸载器,如下面屏幕截图所示。 + +![][10] + +在这里,搜索 “**image**” ,你将找到你所拥有的 Linux 内核。你只需要删除旧内核版本的镜像,而不是当前内核的镜像。 + +在上面的屏幕截图中,我已经指出了我系统上的当前内核和旧内核,因此你必需注意你系统上的内核。 + +你没有必要删除任何其它东西,只需要删除旧的内核版本。 + +同样的,只需要在软件包列表中搜索 “**headers**” ,并删除如下显示的旧的 “**headers**” 版本。 + +![][11] + +只是提醒你,你 **不希望移除 “linux-headers-generic”** 。只是关注那些与其相关的有版本号的。 + +然后,就这样,你完成了所有的工作,apt 将会再次工作,并且你将成功地释放来自 /boot 分区的一些空间。同样地,你也可以使用任意其它的软件包管理器来完成这些工作。 + +#### 使用命令行来移除旧内核 + +使用命令行来移除旧内核与使用 GUI 来移除旧内核是一样的。因此,如果你没有选择使用一款 GUI 软件 (如果它是一台远程机器/一项远程服务) 的权利,或者如果你只是对终端情有独钟,你可以仿效下面的步骤。 + +首先,使用下面的命令列出所有已安装的内核: + +``` +ls -l /boot +``` + +它应该看起来像这样: + +![][12] + +写为 “**old**” 的内核,或者不匹配你当前内核版本,都是未使用的内核,你可以删除它们。 + +现在,你可以使用 **rm** 命令来移除具体指定来自 /boot 分区中的内核,使用下面的命令(一个命令对应一个内核): + +``` +sudo rm /boot/vmlinuz-5.4.0-7634-generic +``` + +务必检查你发系统的版本 — 它可能与你的系统的版本不同。 + +如果你有很多未使用的内核,这将需要一些时间。因此,你也可以下面的命令丢弃多个内核: + +``` +sudo rm /boot/*-5.4.0-{7634}-* +``` + +为了澄清这一点,你需要用逗号分隔内核版本号的最后一部分/编码,以便同时删除它们。 + +假设,我有两个旧的内核 5.4.0-7634-generic 和 5.4.0-7624 ,那么命令将是: + +``` +sudo rm /boot/*-5.4.0-{7634,7624}-* +``` + +如果你不希望在 grub 启动菜单中再看到这些旧的内核版本,你可以使用下面的命令简单地 [更新 grub][13] : + +``` +sudo update-grub +``` + +就这样,你完成了所有的工作。你已经释放了空间,还修复了可能潜在的破损的 APT 问题,如果它是一个在你的 /boot 分区填满后出现的重要的问题的话。 + +在一些情况下,你需要输入这些命令来修复破损的 (正如我在论坛中注意到的): + +``` +sudo dpkg --configure -a +sudo apt install -f +``` + +注意,除非你发现 APT 已破损,否则你不需要输入上面的命令。就我个人而言,我不需要这些命令,但是我发现这些命令对论坛上的一些人很有用。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/free-boot-partition-ubuntu/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[校对者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/free-up-space-ubuntu-linux/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/free-boot-space-ubuntu-linux.jpg?resize=800%2C450&ssl=1 +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/apt-autoremove-screenshot.jpg?resize=800%2C415&ssl=1 +[4]: https://itsfoss.com/remove-old-kernels-ubuntu/ +[5]: https://itsfoss.com/find-which-kernel-version-is-running-in-ubuntu/ +[6]: https://linuxhandbook.com/uname/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/uname-r-screenshot.jpg?resize=800%2C198&ssl=1 +[8]: https://itsfoss.com/synaptic-package-manager/ +[9]: https://itsfoss.com/optimize-ubuntu-stacer/ +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/stacer-remove-kernel.jpg?resize=800%2C562&ssl=1 +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/stacer-remove-kernel-header.png?resize=800%2C576&ssl=1 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/command-kernel-list.png?resize=800%2C432&ssl=1 +[13]: https://itsfoss.com/update-grub/ From 7388dc2c242162368fb089e832a0bbadb44937aa Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 28 Oct 2020 08:16:08 +0800 Subject: [PATCH 0574/1156] Rename sources/tech/20201027 How to define a product in the open source software supply chain.md to sources/talk/20201027 How to define a product in the open source software supply chain.md --- ...o define a product in the open source software supply chain.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20201027 How to define a product in the open source software supply chain.md (100%) diff --git a/sources/tech/20201027 How to define a product in the open source software supply chain.md b/sources/talk/20201027 How to define a product in the open source software supply chain.md similarity index 100% rename from sources/tech/20201027 How to define a product in the open source software supply chain.md rename to sources/talk/20201027 How to define a product in the open source software supply chain.md From 42082d6d22c7664290fd913c14db1c94a5f736fe Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 28 Oct 2020 08:17:31 +0800 Subject: [PATCH 0575/1156] Rename sources/tech/20201027 Fedora 33 is officially here.md to sources/news/20201027 Fedora 33 is officially here.md --- sources/{tech => news}/20201027 Fedora 33 is officially here.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20201027 Fedora 33 is officially here.md (100%) diff --git a/sources/tech/20201027 Fedora 33 is officially here.md b/sources/news/20201027 Fedora 33 is officially here.md similarity index 100% rename from sources/tech/20201027 Fedora 33 is officially here.md rename to sources/news/20201027 Fedora 33 is officially here.md From 114e717599ed6df64a2cd6e9a1b6c5706d6be5f7 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 28 Oct 2020 08:41:34 +0800 Subject: [PATCH 0576/1156] translated --- ... virtual tables in Apache Cassandra 4.0.md | 63 ------------------- ... virtual tables in Apache Cassandra 4.0.md | 63 +++++++++++++++++++ 2 files changed, 63 insertions(+), 63 deletions(-) delete mode 100644 sources/tech/20201006 Start using virtual tables in Apache Cassandra 4.0.md create mode 100644 translated/tech/20201006 Start using virtual tables in Apache Cassandra 4.0.md diff --git a/sources/tech/20201006 Start using virtual tables in Apache Cassandra 4.0.md b/sources/tech/20201006 Start using virtual tables in Apache Cassandra 4.0.md deleted file mode 100644 index 8b171df5c4..0000000000 --- a/sources/tech/20201006 Start using virtual tables in Apache Cassandra 4.0.md +++ /dev/null @@ -1,63 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Start using virtual tables in Apache Cassandra 4.0) -[#]: via: (https://opensource.com/article/20/10/virtual-tables-apache-cassandra) -[#]: author: (Ben Bromhead https://opensource.com/users/ben-bromhead) - -Start using virtual tables in Apache Cassandra 4.0 -====== -What they are and how to use them. -![Computer laptop in space][1] - -Among the [many additions][2] in the recent [Apache Cassandra 4.0 beta release][3], virtual tables is one that deserves some attention. - -In previous versions of Cassandra, users needed access to Java Management Extensions ([JMX][4]) to examine Cassandra details such as running compactions, clients, metrics, and a variety of configuration settings. Virtual tables removes these challenges. Cassandra 4.0 beta enables users to query those details and data as Cassandra Query Language (CQL) rows from a read-only system table. - -Here is how the JMX-based mechanism in previous Cassandra versions worked. Imagine a user wants to check on the compaction status of a particular node in a cluster. The user first has to establish a JMX connection to run `nodetool compactionstats` on the node. This requirement immediately presents the user with a few complications. Is the user's client configured for JMX access? Are the Cassandra nodes and firewall configured to allow JMX access? Are the proper measures for security and auditing prepared and in place? These are only some of the concerns users had to contend with when dealing with in previous versions of Cassandra. - -With Cassandra 4.0, virtual tables make it possible for users to query the information they need by utilizing their previously configured driver. This change removes all overhead associated with implementing and maintaining JMX access. - -Cassandra 4.0 creates two new keyspaces to help users leverage virtual tables: `system_views` and `system_virtual_schema`. The `system_views` keyspace contains all the valuable information that users seek, usefully stored in a number of tables. The `system_virtual_schema` keyspace, as the name implies, stores all necessary schema information for those virtual tables. - -![system_views and system_virtual_schema keyspaces and tables][5] - -(Ben Bromhead, [CC BY-SA 4.0][6]) - -It's important to understand that the scope of each virtual table is restricted to its node. Any query of virtual tables will return data that is valid only for the node that acts as its coordinator, regardless of consistency. To simplify for this requirement, support has been added to several drivers to specify the coordinator node in these queries (the Python, DataStax Java, and other drivers now offer this support). - -To illustrate, examine this `sstable_tasks` virtual table. This virtual table displays all operations on [SSTables][7], including compactions, cleanups, upgrades, and more. - -![Querying the sstable_tasks virtual table][8] - -(Ben Bromhead, [CC BY-SA 4.0][6]) - -If a user were to run `nodetool compactionstats` in a previous Cassandra version, this is the same type of information that would be displayed. Here, the query finds that the node currently has one active compaction. It also displays its progress and its keyspace and table. Thanks to the virtual table, a user can gather this information quickly, and just as efficiently gain the insight needed to correctly diagnose the cluster's health. - -To be clear, Cassandra 4.0 doesn't eliminate the need for JMX access: JMX is still the only option for querying some metrics. That said, users will welcome the ability to pull key cluster metrics simply by using CQL. Thanks to the convenience afforded by virtual tables, users may be able to reinvest time and resources previously devoted to JMX tools into Cassandra itself. Client-side tooling should also begin to leverage the advantages offered by virtual tables. - -If you are interested in the Cassandra 4.0 beta release and its virtual tables feature, [try it out][3]. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/10/virtual-tables-apache-cassandra - -作者:[Ben Bromhead][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://opensource.com/users/ben-bromhead -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_space_graphic_cosmic.png?itok=wu493YbB (Computer laptop in space) -[2]: https://www.instaclustr.com/apache-cassandra-4-0-beta-released/ -[3]: https://cassandra.apache.org/download/ -[4]: https://en.wikipedia.org/wiki/Java_Management_Extensions -[5]: https://opensource.com/sites/default/files/uploads/cassandra_virtual-tables.png (system_views and system_virtual_schema keyspaces and tables) -[6]: https://creativecommons.org/licenses/by-sa/4.0/ -[7]: https://cassandra.apache.org/doc/latest/architecture/storage_engine.html#sstables -[8]: https://opensource.com/sites/default/files/uploads/cassandra_virtual-tables_sstable_tasks.png (Querying the sstable_tasks virtual table) diff --git a/translated/tech/20201006 Start using virtual tables in Apache Cassandra 4.0.md b/translated/tech/20201006 Start using virtual tables in Apache Cassandra 4.0.md new file mode 100644 index 0000000000..d4f20db68c --- /dev/null +++ b/translated/tech/20201006 Start using virtual tables in Apache Cassandra 4.0.md @@ -0,0 +1,63 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Start using virtual tables in Apache Cassandra 4.0) +[#]: via: (https://opensource.com/article/20/10/virtual-tables-apache-cassandra) +[#]: author: (Ben Bromhead https://opensource.com/users/ben-bromhead) + +开始在 Apache Cassandra 4.0 中使用虚拟表 +====== +它们是什么以及如何使用它们。 +![Computer laptop in space][1] + +在最近的 [Apache Cassandra 4.0 测试版][3]中的[众多新增功能][2]中,虚拟表是一个值得关注的功能。 + +在以前的 Cassandra 版本中,用户需要访问 Java 管理扩展 ([JMX][4]) 来检查 Cassandra 的细节,如运行中的压缩、客户端、度量和各种配置设置。虚拟表消除了这些挑战。Cassandra 4.0 测试版使用户能够从一个只读的系统表中以 Cassandra 查询语言 (CQL) 行的形式查询这些细节和数据。 + +以下是之前 Cassandra 版本中基于 JMX 的机制是如何工作的。想象一下,一个用户想要检查集群中某个节点的压缩状态。用户首先要建立一个 JMX 连接,在节点上运行 `nodetool compactionstats`。这个要求给用户带来了一些复杂的问题。用户的客户端是否配置了 JMX 访问?Cassandra 节点和防火墙是否配置为允许 JMX 访问?是否准备好了适当的安全和审计措施,并落实到位?这些只是用户在处理 Cassandra 以前版本时不得不面对的一些问题。 + +在 Cassandra 4.0 中,虚拟表使得用户可以利用之前配置的驱动来查询所需信息。这一变化消除了与实现和维护 JMX 访问相关的所有开销。 + +Cassandra 4.0 创建了两个新的键空间来帮助用户利用虚拟表:`system_views` 和 `system_virtual_schema`。`system_views` 键空间包含了用户查询的所有有价值的信息,有用地存储在一些表中。`system_virtual_schema` 键空间,顾名思义,存储了这些虚拟表的所有必要的模式信息。 + +![system_views and system_virtual_schema keyspaces and tables][5] + +(Ben Bromhead, [CC BY-SA 4.0][6]) + +重要的是要明白,每个虚拟表的范围仅限于其节点。任何虚拟表查询都将返回只对作为其协调器的节点有效的数据,而不管一致性如何。为了简化这一要求,已经在几个驱动中添加了支持,以便在这些查询中指定协调器节点 (Python、DataStax Java 和其他驱动现在提供了这种支持)。 + +为了说明这一点,请检查这个 `sstable_tasks` 虚拟表。这个虚拟表显示了对 [SSTables][7] 的所有操作,包括压缩、清理、升级等。 + +![Querying the sstable_tasks virtual table][8] + +(Ben Bromhead, [CC BY-SA 4.0][6]) + +如果用户在以前的 Cassandra 版本中运行 `nodetool compactionstats`,则会显示相同类型的信息。 在这里,查询发现该节点当前有一个活动的压缩。它还显示了它的进度以及它的键空间和表。得益于虚拟表,用户可以快速收集这些信息,并同样有效地获得正确诊断集群健康状况所需的能力。 + +需要说明的是,Cassandra 4.0 并没有去除对 JMX 访问的需求。JMX 仍然是查询某些指标的唯一选择。尽管如此,用户会欢迎简单地使用 CQL 来获取关键集群指标的能力。由于虚拟表提供的便利,用户可能会将之前投入到 JMX 工具的时间和资源重新投入到 Cassandra 本身。客户端工具也应该开始利用虚拟表提供的优势。 + +如果你对 Cassandra 4.0 测试版及其虚拟表功能感兴趣,请[试试试它][3]。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/virtual-tables-apache-cassandra + +作者:[Ben Bromhead][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ben-bromhead +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_space_graphic_cosmic.png?itok=wu493YbB (Computer laptop in space) +[2]: https://www.instaclustr.com/apache-cassandra-4-0-beta-released/ +[3]: https://cassandra.apache.org/download/ +[4]: https://en.wikipedia.org/wiki/Java_Management_Extensions +[5]: https://opensource.com/sites/default/files/uploads/cassandra_virtual-tables.png (system_views and system_virtual_schema keyspaces and tables) +[6]: https://creativecommons.org/licenses/by-sa/4.0/ +[7]: https://cassandra.apache.org/doc/latest/architecture/storage_engine.html#sstables +[8]: https://opensource.com/sites/default/files/uploads/cassandra_virtual-tables_sstable_tasks.png (Querying the sstable_tasks virtual table) From d1259eb1e242095076b2e66a51a2df2ef30fe43f Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 28 Oct 2020 08:45:12 +0800 Subject: [PATCH 0577/1156] translating --- sources/tech/20201026 ninja- a simple way to do builds.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201026 ninja- a simple way to do builds.md b/sources/tech/20201026 ninja- a simple way to do builds.md index 2b2c3d8985..b56fbaf7e4 100644 --- a/sources/tech/20201026 ninja- a simple way to do builds.md +++ b/sources/tech/20201026 ninja- a simple way to do builds.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 6a775f23cd8fd706f6c792cedf72d2696e1fd876 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 28 Oct 2020 08:53:43 +0800 Subject: [PATCH 0578/1156] APL --- sources/news/20201027 Fedora 33 is officially here.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/news/20201027 Fedora 33 is officially here.md b/sources/news/20201027 Fedora 33 is officially here.md index b4eb274903..08dde0272b 100644 --- a/sources/news/20201027 Fedora 33 is officially here.md +++ b/sources/news/20201027 Fedora 33 is officially here.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 7fbf85ccff892e440dd77551e2a4908cdcd1d723 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 28 Oct 2020 09:40:50 +0800 Subject: [PATCH 0579/1156] TSL&PRF --- .../20201027 Fedora 33 is officially here.md | 90 ------------------ .../20201027 Fedora 33 is officially here.md | 93 +++++++++++++++++++ 2 files changed, 93 insertions(+), 90 deletions(-) delete mode 100644 sources/news/20201027 Fedora 33 is officially here.md create mode 100644 translated/news/20201027 Fedora 33 is officially here.md diff --git a/sources/news/20201027 Fedora 33 is officially here.md b/sources/news/20201027 Fedora 33 is officially here.md deleted file mode 100644 index 08dde0272b..0000000000 --- a/sources/news/20201027 Fedora 33 is officially here.md +++ /dev/null @@ -1,90 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Fedora 33 is officially here!) -[#]: via: (https://fedoramagazine.org/announcing-fedora-33/) -[#]: author: (Matthew Miller https://fedoramagazine.org/author/mattdm/) - -Fedora 33 is officially here! -====== - -![][1] - -Today, I’m excited to share the results of the hard work of thousands of contributors to the Fedora Project: our latest release, Fedora 33, is here! This is a big release with a lot of change, but I believe all that work will also make it a comfortable one, fulfilling our goal of bringing you the latest stable, powerful, and robust free and open source software in many easy to use offerings.  - -If you just want to get to the bits without delay, head over to right now. For details, read on! - -### **Find the Fedora flavor that’s right for you!** - -Fedora Editions are targeted outputs geared toward specific “showcase” uses on the desktop, in server and cloud environments—and now for Internet of Things as well. - -Fedora Workstation focuses on the desktop, and in particular, it’s geared toward software developers who want a “just works” Linux operating system experience. This release features [GNOME 3.38][2], which has plenty of great improvements as usual. The addition of the Tour application helps new users learn their way around. And like all of our other desktop-oriented variants, Fedora Workstation now uses [BTRFS as the default filesystem][3]. This advanced filesystem lays the foundation for bringing a lot of great enhancements in upcoming releases. For your visual enjoyment, Fedora 33 Workstation now features an animated background (based on time of day) by default. - -Fedora CoreOS is an emerging Fedora Edition. It’s an automatically-updating, minimal operating system for running containerized workloads securely and at scale. It offers several [update streams][4] that can be followed for automatic updates that occur roughly every two weeks. Currently the **next** stream is based on Fedora 33, with the **testing** and **stable** streams to follow. You can find information about released artifacts that follow the **next** stream from [the download page][5] and information about how to use those artifacts in the [Fedora CoreOS Documentation][6]. - -[Fedora IoT][7], newly promoted to Edition status, provides a strong foundation for IoT ecosystems and edge computing use cases. Among many other features, Fedora 33 IoT introduces the Platform AbstRaction for SECurity (PARSEC), an open-source initiative to provide a common API to hardware security and cryptographic services in a platform-agnostic way. - -Of course, we produce more than just the Editions. [Fedora Spins][8] and [Labs][9] target a variety of audiences and use cases, including [Fedora CompNeuro][10], which brings a plethora of open source computational modelling tools for neuroscience, and desktop environments like [KDE Plasma][11] and [Xfce][12].  - -And, don’t forget our alternate architectures: [ARM AArch64, Power, and S390x][13]. New in Fedora 33, AArch64 users can use the .NET Core language for cross-platform development. We have improved support for Pine64 devices, NVidia Jetson 64 bit platforms, and the Rockchip system-on-a-chip devices including the Rock960, RockPro64, and Rock64. (However, a late-breaking note: there may be problems booting on some of these devices. Upgrading from existing Fedora 32 will be fine. More info will be on the [Common Bugs][14] page as we have it.) - -We’re also excited to announce that the Fedora Cloud Base Image and Fedora CoreOS will be available in Amazon’s [AWS Marketplace][15] for the first time with Fedora 33. Fedora cloud images have been available in the Amazon cloud for over a decade, and you can launch our official images by AMI ID or [with a click][16]. The Marketplace provides an alternate way to get the same thing, with significantly wider visibility for Fedora. This will also make our cloud images available in new AWS regions more quickly. Thank you especially to David Duncan for making this happen! - -### General improvements - -No matter what variant of Fedora you use, you’re getting the latest the open source world has to offer. Following our “[First][17]” foundation, we’ve updated key programming language and system library packages, including Python 3.9, Ruby on Rails 6.0, and Perl 5.32. In Fedora KDE, we’ve followed the work in Fedora 32 Workstation and enabled the EarlyOOM service by default to improve the user experience in low-memory situations. - -To make the default Fedora experience better, we’ve set nano as the default editor. nano is a friendly editor for new users. Those of you who want the power of editors like vi can, of course, set your own default. - -We’re excited for you to try out the new release! Go to and download it now. Or if you’re already running a Fedora operating system, follow the easy [upgrade instructions][18]. For more information on the new features in Fedora 33, see the [release notes][19]. - -### **A note on Secure Boot** - -Secure Boot is a security standard which ensures that only officially-signed operating system software can load on your computer. This is important for preventing persistent malware which could hide itself in your computer’s firmware and survive even an operating system reinstallation. However, in the wake of the [Boot Hole][20] vulnerability, the cryptographic certificate used to sign Fedora bootloader software will be revoked and replaced with a new one. Because this will have a broad impact, revocation should not happen widely until the second quarter of 2021 or later. - -However, some users may have received this revocation from other operating systems or firmware updates already. In that case, Fedora installations will not boot with Secure Boot enabled. To be clear, this will not affect most users. If it does affect you, you can boot with Secure Boot disabled for the time being. We will release an update signed with the new certificate to be available on all supported releases well before broad-scale certificate revocation takes place, and at that point Secure Boot should be reenabled. - -### **In the unlikely event of a problem….** - -If you run into a problem, check out the [Fedora 33 Common Bugs][14] page, and if you have questions, visit our [Ask Fedora][21] user-support platform. - -### **Thank you everyone** - -Thanks to the thousands of people who contributed to the Fedora Project in this release cycle, and especially to those of you who worked extra hard to make this another on-time release during a pandemic. Fedora is a community, and it’s great to see how much we’ve supported each other. - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/announcing-fedora-33/ - -作者:[Matthew Miller][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/mattdm/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2020/10/f33-final-816x345.jpg -[2]: https://www.gnome.org/news/2020/09/gnome-3-38-released/ -[3]: https://fedoramagazine.org/btrfs-coming-to-fedora-33/ -[4]: https://docs.fedoraproject.org/en-US/fedora-coreos/update-streams/ -[5]: https://getfedora.org/en/coreos/download?stream=next -[6]: https://docs.fedoraproject.org/en-US/fedora-coreos/getting-started/ -[7]: https://getfedora.org/iot -[8]: https://spins.fedoraproject.org/ -[9]: https://labs.fedoraproject.org/ -[10]: https://labs.fedoraproject.org/en/comp-neuro/ -[11]: https://spins.fedoraproject.org/en/kde/ -[12]: https://spins.fedoraproject.org/en/xfce/ -[13]: https://alt.fedoraproject.org/alt/ -[14]: https://fedoraproject.org/wiki/Common_F33_bugs -[15]: https://aws.amazon.com/marketplace -[16]: https://getfedora.org/en/coreos/download?tab=cloud_launchable&stream=stable -[17]: https://docs.fedoraproject.org/en-US/project/#_first -[18]: https://docs.fedoraproject.org/en-US/quick-docs/upgrading/ -[19]: https://docs.fedoraproject.org/en-US/fedora/f33/release-notes/ -[20]: https://access.redhat.com/security/vulnerabilities/grub2bootloader -[21]: http://ask.fedoraproject.org diff --git a/translated/news/20201027 Fedora 33 is officially here.md b/translated/news/20201027 Fedora 33 is officially here.md new file mode 100644 index 0000000000..ad8fe96322 --- /dev/null +++ b/translated/news/20201027 Fedora 33 is officially here.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fedora 33 is officially here!) +[#]: via: (https://fedoramagazine.org/announcing-fedora-33/) +[#]: author: (Matthew Miller https://fedoramagazine.org/author/mattdm/) + +Fedora 33 正式发布了 +====== + +![][1] + +> 本文译自 Fedora 官方发布公告。 + +今天,我很兴奋地与大家分享数千名 Fedora 项目贡献者辛勤工作的成果:我们的最新版本 Fedora 33 来了! 这是一个有着很多变化的大版本,但我相信所有这些工作也会让您感到舒适,实现我们的目标:即为您带来最新的稳定、强大、健壮的自由和开源软件,并提供许多易于使用的产品。  + +如果您不想耽误时间,直接体验,现在就去 下载吧,欲了解详情请继续阅读! + +### 找到适合您的 Fedora 风味! + +Fedora Edition 是针对桌面、服务器和云环境中各种“体现”特定用途的目标产品,现在它也适用于物联网。 + +Fedora Workstation 专注于桌面,尤其是面向那些想要“只管去用”的 Linux 操作系统体验的软件开发者。这个版本的特点是 [GNOME 3.38][2],它一如既往地有很多很棒的改进。新增的 Tour 应用可以帮助新用户学习它们的操作方式。和我们所有其他面向桌面的变体一样,Fedora Workstation 现在使用 [BTRFS 作为默认文件系统][3]。这些发布的版本中带来了很多伟大的增强功能,这个先进的文件系统为之奠定了基础。为了您的视觉享受,Fedora 33 Workstation 现在默认提供了一个动画背景(它会基于一天中的时间变化)。 + +Fedora CoreOS 是一个新兴的 Fedora 版本。它是一个自动更新的、最小化的操作系统,用于安全地、大规模地运行容器化工作负载。它提供了几个[更新流][4],可以遵循大致每两周一次的自动更新。目前 **next** 流是基于 Fedora 33 的,**testing** 和 **stable** 流后继也会跟进。您可以从[下载页面][5]中找到关于跟随 **next** 流发布的工件的信息,并在 [Fedora CoreOS 文档][6]中找到关于如何使用这些工件的信息。 + +新晋升为 Edition 状态的 [Fedora IoT][7],为物联网生态系统和边缘计算用例提供了坚实的基础。在许多功能之外,Fedora 33 IoT 还引入了平台抽象安全Platform AbstRaction for SECurity(PARSEC),这是一个开源倡议,以平台无关的方式为硬件安全和加密服务提供了通用 API。 + +当然,我们制作的不仅仅是“官方版本”,还有 [Fedora Spin][8]和 [Lab][9]。[Fedora Spin][8] 和 [Lab][9] 针对不同的受众和用例,包括 [Fedora CompNeuro][10],它为神经科学带来了大量的开源计算建模工具,以及 [KDE Plasma][11] 和 [Xfce][12]等桌面环境。  + +此外,别忘了我们还有备用架构:[ARM AArch64、Power 和 S390x][13]。在 Fedora 33 中提供的新功能,AArch64 用户可以使用 .NET Core 语言进行跨平台开发。我们改进了对 Pine64 设备、NVidia Jetson 64 位平台以及 Rockchip 片上系统(SoC)设备的支持,包括 Rock960、RockPro64 和 Rock64。(不过,有个最新的说明:在其中一些设备上可能会出现启动问题。从现有的 Fedora 32 升级是没问题的。更多信息将在[常见错误][14]页面上公布。) + +我们也很高兴地宣布,Fedora 云镜像和 Fedora CoreOS 将首次与 Fedora 33 一起在亚马逊的 [AWS 市场][15] 中提供。Fedora 云镜像在亚马逊云中已经存在了十多年,您可以通过 AMI ID 或[点击一下][16]来启动我们的官方镜像。该市场提供了获得同样东西的另一种方式,显著扩大了 Fedora 的知名度。这也将使我们的云镜像可以更快地在新的 AWS 区域中可用。特别感谢 David Duncan 让这一切成为现实! + +### 常规改进 + +无论您使用的是哪种版本的 Fedora,您都会得到开源世界提供的最新版本。遵循我们的 [First][17] 原则,我们更新了关键的编程语言和系统库包,包括 Python 3.9、Ruby on Rails 6.0 和 Perl 5.32。在 Fedora KDE 中,我们沿用了 Fedora 32 Workstation 中的工作,默认启用了 EarlyOOM 服务,以改善低内存情况下的用户体验。 + +为了让 Fedora 的默认体验更好,我们将 nano 设置为默认编辑器。nano 是一个对新用户友好的编辑器。当然,那些想要像 vi 这样强大的编辑器的用户可以自己设置默认编辑器。 + +我们很高兴您能试用新版本! 前往 并立即下载它。或者如果您已经在运行 Fedora 操作系统,请按照这个简单的[升级说明][18]进行升级。关于 Fedora 33 新特性的更多信息,请参见[发布说明][19]。 + +### 关于安全启动的说明 + +安全启动Secure Boot是一种安全标准,它确保只有官方签署的操作系统软件才能加载到您的计算机上。这对于防止持久恶意软件非常重要,因为这些恶意软件可能会隐藏在您的计算机固件中,甚至在重新安装操作系统时也能存活。然而,在 [Boot Hole][20] 漏洞发生后,用于签署 Fedora 引导加载器Bootloader软件的加密证书将被撤销,并被新的证书取代。由于这将产生大范围的影响,撤销应该要到 2021 年第二季度或更晚才会广泛推行。 + +然而,一些用户可能已经从其他操作系统或固件更新中收到了这种撤销。在这种情况下,Fedora 将不能在启用了安全启动时进行安装。要说明的是,这不会影响大多数用户。如果它确实影响到了您,您可以暂时禁用安全启动。我们会在大范围的证书撤销之前发布一个用新证书签署的更新,在所有支持的版本上都可以使用,到那时,安全启动应该可以重新启用。 + +### 万一出现问题时…… + +如果您遇到问题,请查看 [Fedora 33 常见错误][14]页面;如果您有疑问,请访问我们的 [Ask Fedora][21] 用户支持平台。 + +### 谢谢大家 + +感谢在这个发布周期中为 Fedora 项目做出贡献的成千上万的人,尤其是那些在疫情大流行期间为使这个版本准时发布而付出额外努力的人。Fedora 是一个社区,很高兴看到我们如此互相支持。 + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/announcing-fedora-33/ + +作者:[Matthew Miller][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/mattdm/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/10/f33-final-816x345.jpg +[2]: https://www.gnome.org/news/2020/09/gnome-3-38-released/ +[3]: https://fedoramagazine.org/btrfs-coming-to-fedora-33/ +[4]: https://docs.fedoraproject.org/en-US/fedora-coreos/update-streams/ +[5]: https://getfedora.org/en/coreos/download?stream=next +[6]: https://docs.fedoraproject.org/en-US/fedora-coreos/getting-started/ +[7]: https://getfedora.org/iot +[8]: https://spins.fedoraproject.org/ +[9]: https://labs.fedoraproject.org/ +[10]: https://labs.fedoraproject.org/en/comp-neuro/ +[11]: https://spins.fedoraproject.org/en/kde/ +[12]: https://spins.fedoraproject.org/en/xfce/ +[13]: https://alt.fedoraproject.org/alt/ +[14]: https://fedoraproject.org/wiki/Common_F33_bugs +[15]: https://aws.amazon.com/marketplace +[16]: https://getfedora.org/en/coreos/download?tab=cloud_launchable&stream=stable +[17]: https://docs.fedoraproject.org/en-US/project/#_first +[18]: https://docs.fedoraproject.org/en-US/quick-docs/upgrading/ +[19]: https://docs.fedoraproject.org/en-US/fedora/f33/release-notes/ +[20]: https://access.redhat.com/security/vulnerabilities/grub2bootloader +[21]: http://ask.fedoraproject.org From 1d6514fa8a660d2ec82faf26d2e57a003ad2ba9b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 28 Oct 2020 15:51:24 +0800 Subject: [PATCH 0580/1156] PUB @wxy https://linux.cn/article-12764-1.html --- .../20201027 Fedora 33 is officially here.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/news => published}/20201027 Fedora 33 is officially here.md (99%) diff --git a/translated/news/20201027 Fedora 33 is officially here.md b/published/20201027 Fedora 33 is officially here.md similarity index 99% rename from translated/news/20201027 Fedora 33 is officially here.md rename to published/20201027 Fedora 33 is officially here.md index ad8fe96322..f1fa986952 100644 --- a/translated/news/20201027 Fedora 33 is officially here.md +++ b/published/20201027 Fedora 33 is officially here.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12764-1.html) [#]: subject: (Fedora 33 is officially here!) [#]: via: (https://fedoramagazine.org/announcing-fedora-33/) [#]: author: (Matthew Miller https://fedoramagazine.org/author/mattdm/) From f8bf05e3a716d986fd7aebd4d885a98f044c6c94 Mon Sep 17 00:00:00 2001 From: xiao-song-123 <463020345@qq.com> Date: Wed, 28 Oct 2020 15:57:43 +0800 Subject: [PATCH 0581/1156] translated translated --- ... source underpins blockchain technology.md | 89 ------------------ ... source underpins blockchain technology.md | 90 +++++++++++++++++++ 2 files changed, 90 insertions(+), 89 deletions(-) delete mode 100644 sources/tech/20201001 How open source underpins blockchain technology.md create mode 100644 translated/tech/20201001 How open source underpins blockchain technology.md diff --git a/sources/tech/20201001 How open source underpins blockchain technology.md b/sources/tech/20201001 How open source underpins blockchain technology.md deleted file mode 100644 index c8c981d90d..0000000000 --- a/sources/tech/20201001 How open source underpins blockchain technology.md +++ /dev/null @@ -1,89 +0,0 @@ -[#]: collector: "lujun9972" -[#]: translator: "xiao-song-123" -[#]: reviewer: " " -[#]: publisher: " " -[#]: url: " " -[#]: subject: "How open source underpins blockchain technology" -[#]: via: "https://opensource.com/article/20/10/open-source-blockchain" -[#]: author: "Matt Shealy https://opensource.com/users/mshealy" - -How open source underpins blockchain technology -====== -Openness, not regulation, is what creates blockchain's security and -reliability. -![cubes coming together to create a larger cube][1] - -People are often surprised when they find out that blockchain technology, which is known for its security, is built on open source software code. In fact, this openness is what creates its security and reliability. - -One of the core values of building anything as open source is gaining efficiency. Creating a community of developers with different perspectives and skillsets, all working on the same code base, can exponentially increase the number and complexity of applications built. - -### Open source: more common than people think - -One of the more popular operating systems, Linux, is open source. Linux powers the servers for many of the services we feel comfortable sharing personal information on every day. This includes Google, Facebook, and thousands of major websites. When you're interacting with these services, you're doing so on computer networks that are running Linux. Chromebooks are using Linux. Android phones use an operating system based on Linux. - -Linux is not owned by a corporation. It's free to use and created by collaborative efforts. More than 20,000 developers from more than 1,700 companies [have contributed to the code][2] since its origins in 2005.  - -That's how open source software works. Tons of people contribute and constantly add, modify, or build off the open source codebase to create new apps and platforms. Much of the software code for blockchain and cryptocurrency has been developed using open source software. Open source software is built by passionate users that are constantly on guard for bugs, glitches, or flaws. When a problem is discovered, a community of developers works separately and together on the fix. - -### Blockchain and open source - -An entire community of open source blockchain developers is constantly adding to and refining the codebase. - -Here are the fundamental ways blockchain performs: - - * Blockchain platforms have a transactional database that allows peers to transact with each other at any time. - * User-identification labels are attached that facilitate the transactions. - * The platforms must have a secure way to verify transactions before they become approved. - * Transactions that cannot be verified will not take place. - - - -Open source software allows developers to create these platforms in a [decentralized application (Dapp)][3], which is key to the safety, security, and variability of transactions in the blockchain. - -This decentralized approach means there is no central authority to mediate transactions. That means no one person controls what happens. Direct peer-to-peer interactions can happen quickly and securely. As transactions are recorded in the ledger, they are distributed across the ecosystem. - -Blockchain uses cryptography to keep things secure. Each transaction carries information connecting it with previous transactions to verify its authenticity. This prevents threat actors from tampering with the data because once it's added to the public ledger, it can't be changed by other users. - -### Is blockchain open source? - -Although blockchain itself may not technically be open source, blockchain _systems_ are typically implemented with open source software using a concept that embodies an open culture because no government authority regulates it. Proprietary software developed by a private company to handle financial transactions is likely regulated by [government agencies][4]. In the US, that might include the Securities and Exchange Commission (SEC), the Federal Reserve Board, and the Federal Deposit Insurance Corporation (FDIC). Blockchain technology doesn't require government oversight when it's used in an open environment. In effect, the community of users is what verifies transactions. - -You might call it an extreme form of crowdsourcing, both for developing the open source software that's used to build the blockchain platforms and for verifying transactions. That's one of the reasons blockchain has gotten so much attention: It has the potential to disrupt entire industries because it acts as an authoritative intermediary to handle and verify transactions. - -### Bitcoin, Ethereum, and other cryptocurrencies - -As of June 2020, more than [50 million people have blockchain wallets][5]. Most are used for financial transactions, such as trading Bitcoin, Ethereum, and other cryptocurrencies. It's become mainstream for many to [check cryptocurrency prices][6] the same way traders watch stock prices. - -Cryptocurrency platforms also use open source software. The [Ethereum project][7] developed free and open source software that anyone can use, and a large community of developers contributes to the code. The Bitcoin reference client was developed by more than 450 developers and engineers that have made more than 150,000 contributions to the code-writing effort. - -A cryptocurrency blockchain is a continuously growing record. Each record is linked together in a sequence, and the records are called blocks. When linked together, they form a chain. Each block has its own [unique marker called a hash][8]. A block contains its hash and a cryptographic hash from a previous block. In essence, each block is linked to the previous block, forming long chains that are impossible to break, with each containing information about other blocks that are used to verify transactions. - -There's no central bank in financial or cryptocurrency blockchains. The blocks are distributed throughout the internet, creating a robust audit trail that can be tracked. Anyone with access to the chain can verify a transaction but cannot change the records. - -### An unbreakable chain - -While blockchains are not regulated by any government or agency, the distributed network keeps them secure. As chains grow, each transaction makes it more difficult to fake. Blocks are distributed all over the world in networks using trust markers that can't be changed. The chain becomes virtually unbreakable. - -The code behind this decentralized network is open source and is one of the reasons users trust each other in transactions rather than having to use an intermediary such as a bank or broker. The software underpinning cryptocurrency platforms is open to anyone and free to use, created by consortiums of developers that are independent of each other. This has created one of the world's largest check-and-balance systems. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/10/open-source-blockchain - -作者:[Matt Shealy][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://opensource.com/users/mshealy -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cube_innovation_process_block_container.png?itok=vkPYmSRQ "cubes coming together to create a larger cube" -[2]: https://www.linuxfoundation.org/wp-content/uploads/2020/08/2020_kernel_history_report_082720.pdf -[3]: https://www.freecodecamp.org/news/what-is-a-dapp-a-guide-to-ethereum-dapps/ -[4]: https://www.investopedia.com/ask/answers/063015/what-are-some-major-regulatory-agencies-responsible-overseeing-financial-institutions-us.asp -[5]: https://www.statista.com/statistics/647374/worldwide-blockchain-wallet-users/ -[6]: https://www.okex.com/markets -[7]: https://ethereum.org/en/ -[8]: https://opensource.com/article/18/7/bitcoin-blockchain-and-open-source diff --git a/translated/tech/20201001 How open source underpins blockchain technology.md b/translated/tech/20201001 How open source underpins blockchain technology.md new file mode 100644 index 0000000000..64a3bd17fd --- /dev/null +++ b/translated/tech/20201001 How open source underpins blockchain technology.md @@ -0,0 +1,90 @@ +[#]: collector: "lujun9972" +[#]: translator: "xiao-song-123" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "How open source underpins blockchain technology" +[#]: via: "https://opensource.com/article/20/10/open-source-blockchain" +[#]: author: "Matt Shealy https://opensource.com/users/mshealy" + +开源是如何支撑区块链技术发展的 +====== +创造出区块链安全性和可靠性的原因:是开放,而非监管。 +![cubes coming together to create a larger cube][1] + +People are often surprised when they find out that blockchain technology, which is known for its security, is built on open source software code. In fact, this openness is what creates its security and reliability. + +当人们发现以安全性而闻名的区块链技术居然是建立在开源软件代码之上时,通常会感到非常惊讶。事实上,正是这种开放性才赋予了区块链技术的安全性和可靠性。 + +把任何事物构建成开源的,其核心价值之一就是提高效率。建立起一个有着不同观点和技能的开发人员社区,这些开发人员工作在同一个代码库的时候,可以成倍增加构建出来的应用程序数量以及复杂性。 + +### 开源比人们想象中的要更加普遍 + +开源的 Linux,就是一种比较流行的操作系统。Linux 为服务器提供了许多服务,这些服务让我们可以轻松地共享个人信息。其中包括 Google,Facebook 和数千个主要网站。当我们使用这些服务时,就是在和这些在网络上运行着 Linux 系统的计算机进行交互。Chromebook 也使用 Linux,Android 手机使用的操作系统也是基于 Linux 的。 + +Linux 不属于任何一家公司,人们可以免费使用并且可以共同协作来完善创造它。自 2005 年推出以来,已经有来自 1,700 多家公司的 20,000 多名开发人员 [为其中的代码做出了贡献][2] 。 + +这就是开源软件的工作原理。大量的人为此贡献,并不断添加、修改或构建开源代码库来创建新的应用程序和平台。区块链和加密货币的大部分代码都是使用开源软件开发的。开源软件是由热情的用户构建的,这些用户对错误、故障或缺陷时刻保持警惕。当发现问题时,开源社区中的开发人员将一起努力来解决问题。 + +### 区块链和开源 + +整个开源区块链开发者社区都在不断地添加和完善代码库。 + +以下是区块链执行的基本方式: + + * 区块链平台具有一个交易数据库,该交易数据库允许对等方在任何时候彼此进行交易。 + * 附有用户识别标签,以方便交易。 + * 平台一定有一种安全的方式来在交易批准前对交易进行验证。 + * 无法被验证的交易不会进行。 + + + +开源软件允许开发者在 [去中心化应用程序(Dapp)][3]中创建这些平台,这是区块链中交易的安全性、安全性和可变性的关键。 + +这种去中心化的方式意味着没有中央权威机构来调解交易,没有人能控制发生的事情。直接点对点的交易可以更快速、安全的进行。随着交易记录在分类账簿中,这条交易记录也会分发到系统各处。 + +区块链使用密码学来保证安全。每一笔交易都携带着与前一笔交易相关联的信息,以验证其真实性。这可以防止威胁者篡改数据,因为一旦数据被添加到公共分类账中,其他用户就不能更改。 + +### 区块链是开源的吗? + +虽然区块链本身在技术上可能不是开源的,但区块链系统通常是使用开源软件实现的,因为没有政府机构对其进行监管,所以这些开源软件使用的概念体现了一种开放文化。私人公司开发的用于处理金融交易的专有软件很可能受到 [政府机构 ][4] 的监管。在美国,这可能包括美国证券交易委员会 (SEC)、联邦储备委员会和联邦存款保险公司 (FDIC)。区块链技术在开放环境下使用不需要政府监管,实际上,用来验证交易的是用户社区。 + +你可以称它为众包的一种极端形式,既用于开发构建区块链平台的开源软件,也用于验证交易。这就是区块链得到如此多关注的原因之一:它有可能颠覆整个行业,因为它可以作为处理和验证交易的权威中介。 + +### 比特币,以太坊和其他加密货币 + +截至2020年6月,超过 [5000万人拥有区块链钱包][5] 。他们大多数用于金融交易,例如交易比特币,以太坊和其他加密货币。 与交易员观察股票价格一样,[检查加密货币价格][6] 已成为许多人的主流。 + +加密货币平台也使用开源软件。[以太坊项目][7] 开发出了任何人都可以免费使用的开源软件,社区中大量的开发者都为此贡献了代码。比特币客户端的参考实现版是由 450 多个开发人员和工程师进行开发的,他们已经贡献了超过 150,000 行代码。 + +加密货币区块链是一个持续增长的记录。每个被称作为块的记录按顺序链接在一起,它们互相链接形成一条链。每个块都有其自己的唯一标记,这个标记称为 [哈希][8] 。一个块包含自身的哈希值和前一个块密码的哈希值。从本质上讲,每个块都链接到前一个块,形成了无法中断的长链,每个长链都包含有关用于验证交易的其他块的信息。 + +在金融或是加密货币的区块链中没有中央银行。这些分布在整个互联网中的区块,建立了一个性能强大的审计跟踪系统。任何人都能够通过区块链来验证交易,但却不能更改上面的记录。 + +### 牢不可破的区块链 + +尽管区块链不受任何政府或机构的监管,但分布式的网络保证了它们的安全。随着区块链的发展,每一笔交易都会增加伪造的难度。区块分布在世界各地的网络中,它们使用的信任标记不可被改变,这条链条变得牢不可破。 + +这种去中心化的网络,其背后的代码是开源的,也是用户在交易中不必使用诸如银行或经纪人之类的中介就可以相互信任的原因之一。支撑加密货币平台的软件是由相互独立的开发者组建的联盟创建的,并且任何人都可以免费使用。这创造了世界上最大的制衡体系之一。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/open-source-blockchain + +作者:[Matt Shealy][a] +选题:[lujun9972][b] +译者:[xiao-song-123](https://github.com/xiao-song-123) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mshealy +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cube_innovation_process_block_container.png?itok=vkPYmSRQ "cubes coming together to create a larger cube" +[2]: https://www.linuxfoundation.org/wp-content/uploads/2020/08/2020_kernel_history_report_082720.pdf +[3]: https://www.freecodecamp.org/news/what-is-a-dapp-a-guide-to-ethereum-dapps/ +[4]: https://www.investopedia.com/ask/answers/063015/what-are-some-major-regulatory-agencies-responsible-overseeing-financial-institutions-us.asp +[5]: https://www.statista.com/statistics/647374/worldwide-blockchain-wallet-users/ +[6]: https://www.okex.com/markets +[7]: https://ethereum.org/en/ +[8]: https://opensource.com/article/18/7/bitcoin-blockchain-and-open-source From 59a25b704fca71305a86826cb29f2c4427891a97 Mon Sep 17 00:00:00 2001 From: xiao-song-123 <463020345@qq.com> Date: Wed, 28 Oct 2020 16:12:25 +0800 Subject: [PATCH 0582/1156] Update 20201001 How open source underpins blockchain technology.md --- .../20201001 How open source underpins blockchain technology.md | 1 + 1 file changed, 1 insertion(+) diff --git a/translated/tech/20201001 How open source underpins blockchain technology.md b/translated/tech/20201001 How open source underpins blockchain technology.md index 64a3bd17fd..a8a593b9a8 100644 --- a/translated/tech/20201001 How open source underpins blockchain technology.md +++ b/translated/tech/20201001 How open source underpins blockchain technology.md @@ -10,6 +10,7 @@ 开源是如何支撑区块链技术发展的 ====== 创造出区块链安全性和可靠性的原因:是开放,而非监管。 + ![cubes coming together to create a larger cube][1] People are often surprised when they find out that blockchain technology, which is known for its security, is built on open source software code. In fact, this openness is what creates its security and reliability. From 385b4ee072eaf46abdabaad7c5c720c5a7b048af Mon Sep 17 00:00:00 2001 From: xiao-song-123 <59152623+xiao-song-123@users.noreply.github.com> Date: Wed, 28 Oct 2020 16:50:44 +0800 Subject: [PATCH 0583/1156] translated --- .../20201001 How open source underpins blockchain technology.md | 1 - 1 file changed, 1 deletion(-) diff --git a/translated/tech/20201001 How open source underpins blockchain technology.md b/translated/tech/20201001 How open source underpins blockchain technology.md index a8a593b9a8..da4141388c 100644 --- a/translated/tech/20201001 How open source underpins blockchain technology.md +++ b/translated/tech/20201001 How open source underpins blockchain technology.md @@ -13,7 +13,6 @@ ![cubes coming together to create a larger cube][1] -People are often surprised when they find out that blockchain technology, which is known for its security, is built on open source software code. In fact, this openness is what creates its security and reliability. 当人们发现以安全性而闻名的区块链技术居然是建立在开源软件代码之上时,通常会感到非常惊讶。事实上,正是这种开放性才赋予了区块链技术的安全性和可靠性。 From 032f63376336f9783a165a64edfb383f3469106b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 28 Oct 2020 21:18:39 +0800 Subject: [PATCH 0584/1156] PRF @HankChow --- ...ion with Ansible modules for Kubernetes.md | 69 ++++++++----------- 1 file changed, 27 insertions(+), 42 deletions(-) diff --git a/translated/tech/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md b/translated/tech/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md index e0566d713c..6183972de4 100644 --- a/translated/tech/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md +++ b/translated/tech/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md @@ -1,36 +1,35 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Automate your container orchestration with Ansible modules for Kubernetes) [#]: via: (https://opensource.com/article/20/9/ansible-modules-kubernetes) [#]: author: (Seth Kenlon https://opensource.com/users/seth) - -使用 Ansible Kubernetes 模块实现容器编排自动化 +使用 Ansible 的 Kubernetes 模块实现容器编排自动化 ====== -> 在云上的 Kubernetes 中结合 Ansible 实现自动化的同时,还可以参照我们的速记表熟悉 Ansible 的 k8s 模块。 -![Ship captain sailing the Kubernetes seas][1] +> 将 Kubernetes 与 Ansible 结合实现云端自动化。此外,还可以参照我们的 Ansible 的 k8s 模块速查表。 + +![](https://img.linux.net.cn/data/attachment/album/202010/28/211747jhlttlf3f81xrffi.jpg) [Ansible][2] 是实现自动化工作的优秀工具,而 [Kubernetes][3] 则是容器编排方面的利器,要是把两者结合起来,会有怎样的效果呢?正如你所猜测的,Ansible + Kubernetes 的确可以实现容器编排自动化。 ### Ansible 模块 -实际上,Ansible 本身只是一个用于解释 YAML 文件的框架。它真正强大之处在于它[丰富的模块][4],所谓模块module,就是在 Ansible playbook 中让你得以通过简单配置就能调用外部应用程序的一些工具。 +实际上,Ansible 本身只是一个用于解释 YAML 文件的框架。它真正强大之处在于它[丰富的模块][4],所谓模块module,就是在 Ansible 剧本playbook 中让你得以通过简单配置就能调用外部应用程序的一些工具。 Ansible 中有模块可以直接操作 Kubernetes,也有对一些相关组件(例如 [Docker][5] 和 [Podman][6])实现操作的模块。学习使用一个新模块的过程和学习新的终端命令、API 一样,可以先从文档中了解这个模块在调用的时候需要接受哪些参数,以及这些参数在外部应用程序中产生的具体作用。 ### 访问 Kubernetes 集群 -在使用 Ansible Kubernetes 模块之前,先要有能够访问 Kubernetes 集群的权限。在没有权限的情况下,可以尝试使用一个短期账号,但我们更推荐的是按照 Kubernetes 官网上的指引,或是参考 Braynt Son 《[入门 Kubernetes][8]》的教程安装 [Minikube][7]。Minikube 提供了一个单节点 Kubernetes 实例的安装过程,你可以像使用一个完整集群一样对其进行配置和交互。 +在使用 Ansible Kubernetes 模块之前,先要有能够访问 Kubernetes 集群的权限。在没有权限的情况下,可以尝试使用一个短期在线试用账号,但我们更推荐的是按照 Kubernetes 官网上的指引,或是参考 Braynt Son 《[入门 Kubernetes][8]》的教程安装 [Minikube][7]。Minikube 提供了一个单节点 Kubernetes 实例的安装过程,你可以像使用一个完整集群一样对其进行配置和交互。 -**[下载 [Ansible k8s 速记表][9]]** +- 下载 [Ansible k8s 速记表][9](需注册) 在安装 Minikube 之前,你需要确保你的环境支持虚拟化并安装 `libvirt`,然后对 `libvirt` 用户组授权: - ``` $ sudo dnf install libvirt $ sudo systemctl start libvirtd @@ -42,7 +41,6 @@ $ newgrp libvirt 为了能够在 Ansible 中使用 Kubernetes 相关的模块,你需要安装以下这些 Python 模块: - ``` $ pip3.6 install kubernetes --user $ pip3.6 install openshift --user @@ -52,9 +50,8 @@ $ pip3.6 install openshift --user 如果你使用的是 Minikube 而不是完整的 Kubernetes 集群,请使用 `minikube` 命令在本地创建一个最精简化的 Kubernetes 实例: - ``` -`$ minikube start --driver=kvm2 --kvm-network default` +$ minikube start --driver=kvm2 --kvm-network default ``` 然后等待 Minikube 完成初始化,这个过程所需的时间会因实际情况而异。 @@ -63,29 +60,26 @@ $ pip3.6 install openshift --user 集群启动以后,通过 `cluster-info` 选项就可以获取到集群相关信息了: - ``` $ kubectl cluster-info -Kubernetes master is running at -KubeDNS is running at +Kubernetes master is running at https://192.168.39.190:8443 +KubeDNS is running at https://192.168.39.190:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'. ``` -### 使用 `k8s` 模块 - -Ansible 使用 `k8s` 这个模块来实现对 Kubernetes 的操作,在 playbook 中使用 `k8s` 模块就可以对 Kuvernetes 对象进行管理。这个模块描述了 `kubectl` 命令的最终状态,例如对于以下这个使用 `kubectl` 创建新的[命名空间][10]的操作: +### 使用 k8s 模块 +Ansible 使用 `k8s` 这个模块来实现对 Kubernetes 的操作,在剧本中使用 `k8s` 模块就可以对 Kuvernetes 对象进行管理。这个模块描述了 `kubectl` 命令的最终状态,例如对于以下这个使用 `kubectl` 创建新的[命名空间][10]的操作: ``` -`$ kubectl create namespace my-namespace` +$ kubectl create namespace my-namespace ``` 这是一个很简单的操作,而对这个操作的最终状态用 YAML 文件来描述是这样的: - ``` -\- hosts: localhost +- hosts: localhost   tasks:     - name: create namespace       k8s: @@ -95,25 +89,22 @@ Ansible 使用 `k8s` 这个模块来实现对 Kubernetes 的操作,在 playboo         state: present ``` -如果你使用的是 Minikube,那么主机名应该定义为 `localhost`。需要注意的是,模块中对其它可用参数也定义了对应的语法(例如 `api_version` 和 `kind` 参数)。 - -在运行这个 playbook 之前,先通过 `yamllint` 命令验证是否有错误: +如果你使用的是 Minikube,那么主机名(`hosts`)应该定义为 `localhost`。需要注意的是,所使用的模块也定义了可用参数的语法(例如 `api_version` 和 `kind` 参数)。 +在运行这个剧本之前,先通过 `yamllint` 命令验证是否有错误: ``` -`$ yamllint example.yaml` +$ yamllint example.yaml ``` -确保没有错误之后,运行 playbook: - +确保没有错误之后,运行剧本: ``` -`$ ansible-playbook ./example.yaml` +$ ansible-playbook ./example.yaml ``` 可以验证新的命名空间是否已经被创建出来: - ``` $ kubectl get namespaces NAME              STATUS   AGE @@ -127,10 +118,9 @@ my-namespace      Active   3s ### 使用 Podman 拉取容器镜像 -容器是受 Kubernetes 管理的最小单位 Linux 系统,因此 [LXC 项目][11]和 Docker 对容器定义了很多规范。Podman 是一个最新的容器操作工具集,它不需要守护进程就可以运行,为此受到了很多用户的欢迎。 - -通过 Podman 可以从 Docker Hub 或者 Quay.io 拉取到容器镜像。这一操作对应的 Ansible 语法也很简单,只需要将存储库网站提供的镜像路径写在 playbook 中的相应位置就可以了: +容器是个 Linux 系统,几乎是最小化的,可以由 Kubernetes 管理。[LXC 项目][11]和 Docker 定义了大部分的容器规范。最近加入容器工具集的是 Podman,它不需要守护进程就可以运行,为此受到了很多用户的欢迎。 +通过 Podman 可以从 Docker Hub 或者 Quay.io 等存储库拉取容器镜像。这一操作对应的 Ansible 语法也很简单,只需要将存储库网站提供的镜像路径写在剧本中的相应位置就可以了: ```    - name: pull an image @@ -140,13 +130,11 @@ my-namespace      Active   3s 使用 `yamllint` 验证: - ``` -`$ yamllint example.yaml` +$ yamllint example.yaml ``` -运行 playbook: - +运行剧本: ``` $ ansible-playbook ./example.yaml @@ -171,8 +159,7 @@ localhost: ok=3 changed=1 unreachable=0 failed=0 ### 使用 Ansible 实现部署 -Ansible 除了可以执行小型维护任务以外,还可以通过 playbook 实现其它由 `kubectl` 实现的功能,因为两者的 YAML 文件之间只有少量的差异。 在 Kubernetes 中使用的 YAML 文件只需要稍加改动,就可以在 Ansible playbook 中使用。例如下面这个用于使用 `kubectl` 命令部署 Web 服务器的 YAML 文件: - +Ansible 除了可以执行小型维护任务以外,还可以通过剧本实现其它由 `kubectl` 实现的功能,因为两者的 YAML 文件之间只有少量的差异。在 Kubernetes 中使用的 YAML 文件只需要稍加改动,就可以在 Ansible 剧本中使用。例如下面这个用于使用 `kubectl` 命令部署 Web 服务器的 YAML 文件: ``` apiVersion: apps/v1 @@ -196,8 +183,7 @@ spec:         - containerPort: 80 ``` -如果你对其中的参数比较熟悉,你只要把 YAML 文件中的大部分内容放到 playbook 中的 `definition` 部分,就可以在 Ansible 中使用了: - +如果你对其中的参数比较熟悉,你只要把 YAML 文件中的大部分内容放到剧本中的 `definition` 部分,就可以在 Ansible 中使用了: ```    - name: deploy a web server @@ -230,7 +216,6 @@ spec: 执行完成后,使用 `kubectl` 命令可以看到预期中的的部署deployment: - ``` $ kubectl -n my-namespace get pods NAME                      READY  STATUS @@ -248,7 +233,7 @@ via: https://opensource.com/article/20/9/ansible-modules-kubernetes 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[HankChow](https://github.com/HankChow) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 15ba2faf71234253e65aeef35bca57726eb07689 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 28 Oct 2020 21:19:20 +0800 Subject: [PATCH 0585/1156] PUB @HankChow https://linux.cn/article-12766-1.html --- ...ainer orchestration with Ansible modules for Kubernetes.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md (99%) diff --git a/translated/tech/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md b/published/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md similarity index 99% rename from translated/tech/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md rename to published/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md index 6183972de4..c30f1e28d9 100644 --- a/translated/tech/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md +++ b/published/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12766-1.html) [#]: subject: (Automate your container orchestration with Ansible modules for Kubernetes) [#]: via: (https://opensource.com/article/20/9/ansible-modules-kubernetes) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From cd52557e342fc4ec43be04ae9bbdf6dc4cdc0bc3 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 29 Oct 2020 05:01:36 +0800 Subject: [PATCH 0586/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201028?= =?UTF-8?q?=20What=E2=80=99s=20new=20in=20Fedora=2033=20Workstation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201028 What-s new in Fedora 33 Workstation.md --- ...028 What-s new in Fedora 33 Workstation.md | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 sources/tech/20201028 What-s new in Fedora 33 Workstation.md diff --git a/sources/tech/20201028 What-s new in Fedora 33 Workstation.md b/sources/tech/20201028 What-s new in Fedora 33 Workstation.md new file mode 100644 index 0000000000..853af7ed6a --- /dev/null +++ b/sources/tech/20201028 What-s new in Fedora 33 Workstation.md @@ -0,0 +1,81 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What’s new in Fedora 33 Workstation) +[#]: via: (https://fedoramagazine.org/whats-new-fedora-33-workstation/) +[#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) + +What’s new in Fedora 33 Workstation +====== + +![][1] + +Fedora 33 Workstation is the [latest release][2] of our free, leading-edge operating system. You can download it from [the official website here][3] right now. There are several new and noteworthy changes in Fedora 33 Workstation. Read more details below. + +### GNOME 3.38 + +Fedora 33 Workstation includes the latest release of GNOME Desktop Environment for users of all types. GNOME 3.38 in Fedora 33 Workstation includes many updates and improvements, including: + +#### A new GNOME Tour app + +New users are now greeted by “a new _Tour_ application, highlighting the main functionality of the desktop and providing first time users a nice welcome to GNOME.” + +![The new GNOME Tour application in Fedora 33][4] + +#### Drag to reorder apps + +GNOME 3.38 replaces the previously split Frequent and All apps views with a single customizable and consistent view that allows you to reorder apps and organize them into custom folders. Simply click and drag to move apps around. + +![GNOME 3.38 Drag to Reorder][5] + +#### Improved screen recording + +The screen recording infrastructure in GNOME Shell has been improved to take advantage of PipeWire and kernel APIs. This will help reduce resource consumption and improve responsiveness. + +GNOME 3.38 also provides many additional features and enhancements. Check out the [GNOME 3.38 Release Notes][6] for further information. + +* * * + +### B-tree file system + +As [announced previously][7], new installations of Fedora 33 will default to using [Btrfs][8]. Features and enhancements are added to Btrfs with each new kernel release. The [change log][9] has a complete summary of the features that each new kernel version brings to Btrfs. + +* * * + +### Swap on ZRAM + +Anaconda and Fedora IoT have been using swap-on-zram by default for years. With Fedora 33, swap-on-zram will be enabled by default instead of a swap partition. Check out [the Fedora wiki page][10] for more details about swap-on-zram. + +* * * + +### Nano by default + +Fresh Fedora 33 installations will set the EDITOR environment variable to [_nano_ by default][11]. This change affects several command line tools that spawn a text editor when they require user input. With earlier releases, this environment variable default was unspecified, leaving it up to the individual application to pick a default editor. Typically, applications would use _[vi][12]_ as their default editor due to it being a small application that is traditionally available on the base installation of most Unix/Linux operating systems. Since Fedora 33 includes nano in its base installation, and since nano is more intuitive for a beginning user to use, Fedora 33 will use nano by default. Users who want vi can, of course, override the value of the EDITOR variable in their own environment. See [the Fedora change request][11] for more details. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/whats-new-fedora-33-workstation/ + +作者:[Gregory Bartholomew][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/glb/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/10/f33workstation-816x345.jpg +[2]: https://fedoramagazine.org/announcing-fedora-33/ +[3]: https://getfedora.org/workstation +[4]: https://fedoramagazine.org/wp-content/uploads/2020/10/fedora-33-gnome-tour-1.png +[5]: https://fedoramagazine.org/wp-content/uploads/2020/10/drag-to-reorder-1.gif +[6]: https://help.gnome.org/misc/release-notes/3.38/ +[7]: https://fedoramagazine.org/btrfs-coming-to-fedora-33/ +[8]: https://en.wikipedia.org/wiki/Btrfs +[9]: https://btrfs.wiki.kernel.org/index.php/Changelog#By_feature +[10]: https://fedoraproject.org/wiki/Changes/SwapOnZRAM +[11]: https://fedoraproject.org/wiki/Changes/UseNanoByDefault +[12]: https://en.wikipedia.org/wiki/Vi From 0ffc10cb3654e74469e944f87f37afe0e38a9ca5 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 29 Oct 2020 05:01:46 +0800 Subject: [PATCH 0587/1156] add done: 20201028 What-s new in Fedora 33 Workstation.md --- ... old hardware back to life with OpenBSD.md | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 sources/tech/20201027 Bring old hardware back to life with OpenBSD.md diff --git a/sources/tech/20201027 Bring old hardware back to life with OpenBSD.md b/sources/tech/20201027 Bring old hardware back to life with OpenBSD.md new file mode 100644 index 0000000000..e2043c0f54 --- /dev/null +++ b/sources/tech/20201027 Bring old hardware back to life with OpenBSD.md @@ -0,0 +1,73 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Bring old hardware back to life with OpenBSD) +[#]: via: (https://opensource.com/article/20/10/old-hardware-openbsd) +[#]: author: (Jonathan Garrido https://opensource.com/users/jgarrido) + +Bring old hardware back to life with OpenBSD +====== +Install OpenBSD and the Xfce desktop to give a new spin to an old +machine—for free. +![Old UNIX computer][1] + +Almost everyone has (or knows someone who has) old hardware sitting around gathering dust because they believe that no modern operating system (OS) supports such a relic. I know this is wrong because I am one of those geeks who likes to use every piece of equipment as long as it is possibly functional. + +Although most modern OSes do run better on modern hardware, it is also true that there are alternatives for up-to-date 32-bit OSes to run all types of machines, including very old ones. Thanks to a bunch of people with enough determination and skills, there are different types of Linux and BSD distros that you can use, free of charge, to give a new spin to an old machine. + +## What can you do with a new OS on old hardware? + +Besides the obvious benefit of bringing back a piece of equipment that has been idle for a price that is equal to nothing, using an open source 32-bit distro to revive "antique" hardware has several benefits and purposes, including: + + * **Create single-purpose equipment:** Today's networks are complex, and there are a lot of services that interact with one another. After bringing an old machine back to life, you can set it up to fulfill one of those unique services within your infrastructure, such as DHCP, DNS, or SFTP. + * **Learn how the OS works:** I always want to know how things work under the hood. Tinkering with old hardware and tiny OSes gives you the chance to understand the interactions between hardware and software, learn how to tune the installation's default settings to make the most of a system, and much, much more. + * **Teach others about open source:** Finally, 32-bit OSes and old hardware can teach the next generation about OSes and the open source world. One of the main features of these types of OSes is their simplicity of use with fewer options to overwhelm the user. This makes them an excellent tool to teach and explore the essential components of any operating system. + + + +## Distributions to try + +To encourage you, here is a list of distros that I have tried on old hardware with very good results. These are not the only options available, but these are the ones I have used the most: + + * [Linux Lite][2] + * [FreeBSD][3] + * [OpenBSD][4] + * [Lubuntu][5] + * [Debian][6] + * [Tiny Core Linux][7] + * [Slax Linux][8] + + + +## Give it a try with OpenBSD + +OpenBSD is one of the main [BSD][9] distros. It is well-known because it is made with security in mind, with almost no security bugs in the default installation and a lot of cryptography tools available to users. Another cool feature, at least for me, is the fact that you can run it on a huge variety of hardware, from new computers to very old machines. + +For this installation, my hardware was a 2005 MacBook with the following specs: + + * A 32-bit, dual-core processor + * 2GB of RAM (with no possibility of expansion) + * A 32GB hard drive + * Two network cards + * A CD-ROM (reads only CDs) + * A few USB ports + + + +### Install OpenBSD + +The installation was very straightforward. I [downloaded][10] the most recent version of OpenBSD and created a boot CD (because there is no other way to boot my old laptop besides the internal drive). The installation went flawlessly. It recognized my hardware, network (including my access point), and time zone; let me choose the layout of my hard drive and manage my users; and asked some questions about the system's security setup. Also, even though the installation has a very small footprint, OpenBSD let me choose what to install and from where. + +I ended up with a brand-new, up-to-date operating system and a screen like this. + +![OpenBSD][11] + +(Jonathan Garrido, [CC BY-SA 4.0][12]) + +### Add a graphical desktop + +If you want your desktop to use graphical applications, a black terminal with white letters is not enough. So follow these steps to install the [Xfce desktop][13]: + + 1. As root, run: [code]`pkg_add xcfe xfce-extras slim slim-themes consolekit2 polkit`[/code] to install the Xfce environment and the login greeter. In the above, `pkg_add` is the utility to use when you want to d \ No newline at end of file From 43d74056fba344f6633381e222f132fc9c17827f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 29 Oct 2020 05:02:02 +0800 Subject: [PATCH 0588/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201029?= =?UTF-8?q?=20Linux=20Kernel=205.10=20Will=20be=20the=20Next=20LTS=20Relea?= =?UTF-8?q?se=20and=20it=20has=20Some=20Exciting=20Improvements=20Lined=20?= =?UTF-8?q?Up?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md --- ...has Some Exciting Improvements Lined Up.md | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 sources/tech/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md diff --git a/sources/tech/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md b/sources/tech/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md new file mode 100644 index 0000000000..ccb6a1c284 --- /dev/null +++ b/sources/tech/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up) +[#]: via: (https://itsfoss.com/kernel-5-10/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up +====== + +_**Development for Linux Kernel 5.10 is in progress. It’s been confirmed to be a long term support release and it will be bringing newer hardware support among other promised features.**_ + +### Linux Kernel 5.10 will be Long Term Support Release + +**Greg Kroah-Hartman**, the key stable kernel maintainer, addressed an “Ask the Expert” session at Linux Foundation’s Open-Source Summit Europe and confirmed that Linux 5.10 will be the next LTS release. + +Even though there were some early speculations of 5.9 being the LTS release, Greg clarified that the last kernel release of the year will always be an LTS release. + +As of now, [Linux Kernel 5.4][1] series happens to be the latest LTS version out there which added a lot of improvements and hardware support. Also, considering the development progress with Linux [Kernel 5.8][2] being the biggest release so far and Linux 5.10’s first release candidate being close to it, there’s a lot of things going on under the hood. + +> Because people keep asking me… +> +> — Greg K-H (@gregkh) [October 26, 2020][3] + +Let’s take a look at some of the features and improvements that you can expect with Linux Kernel 5.10. + +### Linux kernel 5.10 features + +![][4] + +**Note:** _Linux Kernel 5.10 is still in early development. So, we will be updating the article regularly for the latest additions/feature updates._ + +#### AMD Zen 3 Processor Support + +The new [Ryzen 5000][5] lineup is one of the biggest buzzes of 2020. So, with Linux Kernel 5.10 release candidate version, various additions are being made for Zen 3 processors. + +#### Intel Rocket Lake Support + +I do not hope for a lot with Intel’s Rocket Lake chipsets arriving Q1 next year (2021). But, considering that Intel’s constantly squeezing everything out of that 14 nm process, it is definitely a good thing to see work done for Intel Rocket Lake on Linux Kernel 5.10 + +#### Open Source Driver for Radeon RX 6000 series + +Even though we’re covering this a day before the Big Navi reveal, the Radeon RX 6000 series is definitely going to be something impressive to compete with NVIDIA RTX 3000 series. + +Of course, unless it suffers from the same issues the Vega series or the 5000 series met with. + +It’s good to see work being already done for an open source driver to support the next-gen Radeon GPUs on Linux Kernel 5.10. + +#### File System Optimizations and Storage Improvements + +[Phoronix][6] reports on file-system optimizations and storage improvements with 5.10 as well. So, judging by that, we should see some performance improvements. + +#### Other Improvements + +Undoubtedly, you should expect a great deal of driver updates and hardware supports with the new kernel. + +For now, the support for SoundBlaster AE-7, early support for NVIDIA Orin (AI processor), and Tiger Lake GPU improvements seem to be the key highlights. + +A stable release for Linux Kernel 5.10 should be expected around the mid-December timeline. It will be supported for at least 2 years but you could end up with security/bug fix updates till 2026. So, we will have to stay tuned to the development for anything exciting on the next Linux Kernel 5.10 LTS release. + +**Recommended Read:** + +![][7] + +#### [Explained! Why Your Distribution Still Using an ‘Outdated’ Linux Kernel?][8] + +A new stable kernel is released every 2-3 months yet your distribution might still be using an old, outdated Linux kernel. But you don’t need to worry and here’s why! + +What do you think about the upcoming Linux Kernel 5.10 release? Let us know your thoughts in the comments. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/kernel-5-10/ + +作者:[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/linux-kernel-5-4/ +[2]: https://itsfoss.com/kernel-5-8-release/ +[3]: https://twitter.com/gregkh/status/1320745076566433793?ref_src=twsrc%5Etfw +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/kernel-5-10-release.png?resize=800%2C450&ssl=1 +[5]: https://www.tomsguide.com/news/amd-ryzen-5000-revealed-what-it-means-for-pc-gaming +[6]: https://www.phoronix.com/scan.php?page=article&item=linux-510-features&num=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/12/why_Linux_distro_use_outdated_kernel.jpg?fit=800%2C450&ssl=1 +[8]: https://itsfoss.com/why-distros-use-old-kernel/ From 89a9a5cc307657315d57907616b976aab9dded3c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 29 Oct 2020 05:02:20 +0800 Subject: [PATCH 0589/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201028?= =?UTF-8?q?=20How=20JavaScript=20became=20a=20serious=20programming=20lang?= =?UTF-8?q?uage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201028 How JavaScript became a serious programming language.md --- ...t became a serious programming language.md | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 sources/tech/20201028 How JavaScript became a serious programming language.md diff --git a/sources/tech/20201028 How JavaScript became a serious programming language.md b/sources/tech/20201028 How JavaScript became a serious programming language.md new file mode 100644 index 0000000000..7818764717 --- /dev/null +++ b/sources/tech/20201028 How JavaScript became a serious programming language.md @@ -0,0 +1,81 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How JavaScript became a serious programming language) +[#]: via: (https://opensource.com/article/20/10/history-javascript) +[#]: author: (Nimisha Mukherjee https://opensource.com/users/nimisha) + +How JavaScript became a serious programming language +====== +From humble beginnings as a way to make websites pretty, JavaScript has +been transformed into a serious programming language. +![Javascript code close-up with neon graphic overlay][1] + +JavaScript's humble start began in 1995, when it was [created in just 10 days][2] by Brendan Eich, then an employee with Netscape Communications Corporation. JavaScript has come a long way since then, from a tool to make websites pretty to a serious programming language. + +In its early days, JavaScript was considered a visual tool that made websites a little more fun and attractive. Languages like [Jakarta Server Pages][3] (JSP; formerly JavaServer Pages) used to do all the heavy lifting on rendered web pages, and JavaScript was used to create basic interactions, visual enhancements, and animations. + +For a long time, the demarcations between HTML, CSS, and JavaScript were not clear. Frontend development primarily consists of HTML, CSS, and JavaScript, forming a "[layer cake][4]" of standard web technologies. + +![Layer cake of standard web technologies][5] + +The "[layer cake][4]" of standard web technologies (Mozilla Developers Network, [CC BY-SA 4.0][6]) + +HTML and CSS provide structure, format, and style to content. JavaScript comes into play once a web page does something beyond displaying static content. Ecma International develops JavaScript specifications, and the World Wide Web Consortium (W3C) develops HTML and CSS specifications. + +### How JavaScript gained prominence + +There is a long [history][7] behind how JavaScript came to be the [most popular][8] programming language. Back in the 1990s, Java was king, and comparisons to it were inevitable. Many engineers thought JavaScript was not a good programming language due to lack of support for object-oriented programming. Even though it was not evident, JavaScript's object-model and functional features were already present in its first version. + +After JavaScript's rushed release in 1995, Netscape submitted it to the European Computer Manufacturers Association (ECMA) International for standardization. This led to [ECMAScript][9], a JavaScript standard meant to ensure interoperability of web pages across different web browsers. ECMAScript 1 came out in June 1997 and helped to advance the standardization of JavaScript. + +During this time, PHP and JSP became popular server-side language choices. JSP had gained prominence as the preferred alternative to Common Gateway Interface ([CGI][10]) because it enabled embedding Java code in HTML. While it was popular, developers found it unnatural to have Java inside HTML. In addition, even for the simplest text change on HTML, JSP had to undergo a time-consuming lifecycle. In today's microservice world, JSP-oriented pages are considered technical debt.  + +[PHP][11] works similarly to JSP but the PHP code is processed as a Common Gateway Interface ([CGI][10]) executable. PHP-based web applications are easier to deploy than those based on JSP. Overall, it is easier to get up and running with PHP. Today, PHP and JavaScript are one of the most popular combinations for creating dynamic websites. PHP serves as the server-side scripting and JavaScript as the client-side scripting. + +JavaScript's adoption grew with the release of [jQuery][12], a multi-purpose JavaScript library that simplifies tedious Document Object Model (DOM) management, event handling, and [Ajax][13], in 2006.  + +The turning point for JavaScript came in 2009 when [Node.js][14] was released. Developers could now write server-side scripting with JavaScript. Closely following were frameworks like [Backbone.js][15] and [AngularJS][16], both released in 2010. This led to the concept of full-stack development using a single language. + +In 2015, Ecma International released ECMAScript 6 (ES6), which added significant new syntax for writing complex applications, including class declarations. Other new features included iterators, arrow function expressions, let and const keywords, typed arrays, new collections (maps, sets, and WeakMap), promises, template literals for strings, and many other cool features. Later editions have gone on to add more features that have made JavaScript more robust, streamlined, and reliable. + +### Conclusion + +JavaScript has advanced significantly over the past two decades. Most browsers now compete to meet compliance, so the latest specifications are rolled out faster. + +There are a host of stable JavaScript frameworks to choose from, depending on your project requirements, including the most popular ones: [React][17], [Angular][18], and [Vue.js][19]. In the next article in this series, I'll dive into why JavaScript is so popular. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/history-javascript + +作者:[Nimisha Mukherjee][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://opensource.com/users/nimisha +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_javascript.jpg?itok=60evKmGl (Javascript code close-up with neon graphic overlay) +[2]: https://en.wikipedia.org/wiki/JavaScript +[3]: https://en.wikipedia.org/wiki/Jakarta_Server_Pages +[4]: https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps/What_is_JavaScript +[5]: https://opensource.com/sites/default/files/uploads/layercakewebtech.png (Layer cake of standard web technologies) +[6]: https://creativecommons.org/licenses/by-sa/4.0/ +[7]: https://blog.logrocket.com/history-of-frontend-frameworks/ +[8]: https://octoverse.github.com/ +[9]: https://en.wikipedia.org/wiki/ECMAScript +[10]: https://en.wikipedia.org/wiki/Common_Gateway_Interface +[11]: https://en.wikipedia.org/wiki/PHP#:~:text=PHP%20development%20began%20in%201994,Interpreter%22%20or%20PHP%2FFI. +[12]: https://en.wikipedia.org/wiki/JQuery +[13]: https://en.wikipedia.org/wiki/Ajax_(programming) +[14]: https://en.wikipedia.org/wiki/Node.js +[15]: https://en.wikipedia.org/wiki/Backbone.js +[16]: https://en.wikipedia.org/wiki/AngularJS +[17]: https://reactjs.org/ +[18]: https://angular.io/ +[19]: https://vuejs.org/ From 775894f1b51a6413eb0cb34c7dff6a096bf6da28 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 29 Oct 2020 05:02:33 +0800 Subject: [PATCH 0590/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201028?= =?UTF-8?q?=20Program=20in=20Arm6=20assembly=20language=20on=20a=20Raspber?= =?UTF-8?q?ry=20Pi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201028 Program in Arm6 assembly language on a Raspberry Pi.md --- ...rm6 assembly language on a Raspberry Pi.md | 629 ++++++++++++++++++ 1 file changed, 629 insertions(+) create mode 100644 sources/tech/20201028 Program in Arm6 assembly language on a Raspberry Pi.md diff --git a/sources/tech/20201028 Program in Arm6 assembly language on a Raspberry Pi.md b/sources/tech/20201028 Program in Arm6 assembly language on a Raspberry Pi.md new file mode 100644 index 0000000000..b986e4d6e5 --- /dev/null +++ b/sources/tech/20201028 Program in Arm6 assembly language on a Raspberry Pi.md @@ -0,0 +1,629 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Program in Arm6 assembly language on a Raspberry Pi) +[#]: via: (https://opensource.com/article/20/10/arm6-assembly-language) +[#]: author: (Marty Kalin https://opensource.com/users/mkalindepauledu) + +Program in Arm6 assembly language on a Raspberry Pi +====== +Assembly language offers special insights into how machines work and how +they can be programmed. +![An intersection of pipes.][1] + +The [Arm website][2] touts the processor's underlying architecture as "the keystone of the world's largest compute ecosystem," which is plausible given the number of handheld and embedded devices with Arm processors. Arm processors are prevalent in the Internet of Things (IoT), but they are also used in desktop machines, servers, and even high-performance computers, such as the Fugaku HPC. But why look at Arm machines through the lens of assembly language? + +Assembly language is the symbolic language immediately above machine code and thereby offers special insights into how machines work and how they can be programmed efficiently. In this article, I hope to illustrate this point with the Arm6 architecture using a Raspberry Pi 4 mini-desktop machine running Debian. + +The Arm6 family of processors supports two instruction sets: + + * The Arm set, with 32-bit instructions throughout. + * The Thumb set, with a mix of 16-bit and 32-bit instructions. + + + +The examples in this article use the Arm instruction set. The Arm assembly code is in lowercase, and, for contrast, pseudo-assembly code is in uppercase. + +### Load-store machines + +The RISC/CISC distinction is often seen when comparing the Arm family and the Intel x86 family of processors, both of which are commercial products competing on the market. The terms RISC (reduced instruction set computer) and CISC (complex instruction set computer) date from the middle 1980s. Even then the terms were misleading, in that both RISC (e.g., MIPS) and CISC (e.g., Intel) processors had about 300 instructions in their instruction sets; today the counts for core instructions in Arm and Intel machines are close, although both types of machines have extended their instruction sets. A sharper distinction between Arm and Intel machines draws on an architectural feature other than instruction count. + +An instruction set architecture (ISA) is an abstract model of a computing machine. Processors from Arm and Intel implement different ISAs: Arm processors implement a load-store ISA, whereas their Intel counterparts implement a register-memory ISA. The difference in ISAs can be described as: + + * In a load-store machine, only two instructions move data between a CPU and the memory subsystem: + * A load instruction copies bits from memory into a CPU register. + * A store instruction copies bits from a CPU register into memory. + * Other instructions—in particular, the ones for arithmetic-logic operations—use only CPU registers as source and destination operands. For example, here is pseudo-assembly code on a load-store machine to add two numbers originally in memory, storing their sum back in memory (comments start with `##`): [code] ## R0 is a CPU register, RAM[32] is a memory location +LOAD R0, RAM[32]   ## R0 = RAM[32] +LOAD R1, RAM[64]   ## R1 = RAM[64] +ADD R2, R0, R1     ## R2 = R0 + R1 +STORE R2, RAM[32]  ## RAM[32] = R2 [/code] The task requires four instructions: two LOADs, one ADD, and one STORE. + * By contrast, a register-memory machine allows the operands for arithmetic-logic instructions to be registers or memory locations, usually in any combination. For example, here is pseudo-assembly code on a register-memory machine to add two numbers in memory: [code]`ADD RAM[32], RAM[32], RAM[64] ## RAM[32] += RAM[64]`[/code] The task can be accomplished with a single instruction, although the bits to be added must still be fetched from memory to a CPU, and the sum then must be copied back to memory location RAM[32]. + + + +Any ISA comes with tradeoffs. As the example above illustrates, a load-store ISA has what architects call "low instruction density": relatively many instructions may be required to perform a task. A register-memory machine has high instruction density, which is an upside. There are upsides, as well, to the load-store ISA. + +Load-store design is an effort to simplify an architecture. For instance, consider the case in which a register-memory machine has an instruction with mixed operands: + + +``` +COPY R2, RAM[64]          ## R2 = RAM[64] +ADD RAM[32], RAM[32], R2  ## RAM[32] = RAM[32] + R2 +``` + +Executing the ADD instruction is tricky in that the access times for the numbers to be added differs—perhaps significantly if the memory operand happens to be only in main memory rather than also in a cache thereof. Load-store machines avoid the problem of mixed access times in arithmetic-logic operations: all operands, as registers, have the same access time. + +Furthermore, load-store architectures emphasize fixed-sized instructions (e.g., 32-bits apiece), limited formats (e.g., one, two, or three fields per instruction), and relatively few addressing modes. These design constraints mean that the processor's control unit (CU) and arithmetic-logic unit (ALU) can be simplified: fewer transistors and wires, less required power and generated heat, and so on. Load-store machines are designed to be architecturally sparse. + +My aim is not to step into the debate over load-store versus register-memory machines but rather to set up a code example in the load-store Arm6 architecture. This first look at load-store helps to explain the code that follows. The two programs (one in C, one in Arm6 assembly) are available on [my website][3]. + +### The hstone program in C + +Among my favorite short code examples is the hailstone function, which takes a positive integer as an argument. (I used this example in an [earlier article on WebAssembly][4].) This function is rich enough to highlight important assembly-language details. The function is defined as: + + +``` +             3N+1 if N is odd +hstone(N) = +             N/2 if N is even +``` + +For example, hstone(12) evaluates to 6, whereas hstone(11) evaluates to 34. If N is odd, then 3N+1 is even; but if N is even, then N/2 could be either even (e.g., 4/2 = 2) or odd (e.g., 6/2 = 3). + +The hstone function can be used iteratively by passing the returned value as the next argument. The result is a _hailstone sequence_, such as this one, which starts with 24 as the original argument, the returned value 12 as the next argument, and so on: + + +``` +`24,12,6,3,10,5,16,8,4,2,1,4,2,1,...` +``` + +It takes 10 steps for the sequence to converge to 1, at which point the sequence of 4,2,1 repeats indefinitely: (3x1)+1 is 4, which is halved to yield 2, which is halved to yield 1, and so on. For an explanation of why "hailstone" seems an appropriate name for such sequences, see "[Mathematical mysteries: Hailstone sequences][5]." + +Note that powers of 2 converge quickly: 2N requires just N divisions by 2 to reach 1. For example, 32 = 25 has a convergence length of 5, and 512 = 29 has a convergence length of 9. If the hailstone function returns any power of 2, then the sequence converges to 1. Of interest here is the sequence length from the initial argument to the first occurrence of 1. + +The [Collatz conjecture][6] is that a hailstone sequence converges to 1 no matter what the initial argument N > 0 happens to be. Neither a counterexample nor a proof has been found. The conjecture, simple as it is to illustrate with a program, remains a profoundly challenging problem in number theory. + +Below is the C source code for the hstoneC program, which computes the length of the hailstone sequence whose starting value is given as user input. The assembly-language version of the program (hstoneS) is provided after an overview of Arm6 basics. For clarity, the two programs are structurally similar. + +Here is the C source code: + + +``` +#include <stdio.h> + +/* Compute steps from n to 1. +   -- update an odd n to (3 * n) + 1 +   -- update an even n to (n / 2) */ +unsigned hstone(unsigned n) { +  unsigned len = 0; /* counter */ +  while (1) { +    if (1 == n) break;           +    n = (0 == (n & 1)) ? n / 2 : (3 * n) + 1; +    len++;                       +  } +  return len; +} + +int main() { +  [printf][7]("Integer > 0: "); +  unsigned num; +  [scanf][8]("%u", &num); +  [printf][7]("Steps from %u to 1: %u\n", num, hstone(num)); +  return 0; +} +``` + +When the program is run with an input of 9, the output is: + + +``` +`Steps from 9 to 1: 19` +``` + +The hstoneC program has a simple structure. The `main` function prompts the user for an input N (an integer > 0) and then calls the `hstone` function with this input as an argument. The `hstone` function loops until the sequence from N reaches the first 1, returning the number of steps required. + +The most complicated statement in the program involves C's conditional operator, which is used to update N: + + +``` +`n = (0 == (n & 1)) ? n / 2 : (3 * n) + 1;` +``` + +This is a terse form of an if-then construct. The test `(0 == (n & 1))` checks whether the C variable `n` (representing N) is even or odd depending on whether the bitwise AND of N and 1 is zero: an integer value is even just in case its least-significant (rightmost) bit is zero. If N is even, N/2 becomes the new value; otherwise, 3N+1 becomes the new value. The assembly-language version of the program (hstoneS) likewise avoids an explicit if-else construct in updating its implementation of N. + +My Arm6 mini-desktop machine includes the GNU C toolset, which can generate the corresponding code in assembly language. With `%` as the command-line prompt, the command is: + + +``` +`% gcc -S hstoneC.c ## -S flag produces and saves assembly code` +``` + +This produces the file hstoneC.s, which is about 120 lines of assembly-language source code, including a `nop` ("no operation") instruction. Compiler-generated assembly tends to be hard to read and may have inefficiencies such as the `nop`. A hand-crafted version, such as `hstoneS.s` (below), can be easier to follow and even significantly shorter (e.g., `hstoneS.s` has about 50 lines of code). + +### Assembly language basics + +Arm6, like most modern architectures, is byte-addressable: a memory address is of a byte, even if the addressed item (e.g., a 32-bit instruction) consists of multiple bytes. Instructions are addressed in little-[endian][9] fashion: the address is of the low-order byte. Data items are addressed in little-endian fashion by default, but this can be changed to big-endian so that the address of a multi-byte data item points to the high-order byte. By tradition, the low-order byte is depicted as the rightmost one and the high-order byte as the leftmost one:  + + +``` +high-order    low-order +    /             / ++----+----+----+----+ +| b1 | b2 | b3 | b4 | ## 4 bytes = 32 bits ++----+----+----+----+ +``` + +Addresses are 32-bits in size, and data items come in three standard sizes: + + * A _byte_ is 8 bits in size. + * A _halfword_ is 16 bits in size. + * A _word_ is 32 bits in size. + + + +Aggregates of bytes, halfwords, and words (e.g., arrays and structures) are supported. CPU registers are 32-bits in size. + +Assembly languages, in general, have three key features with a syntax that is close and, at times, identical: + + * Directives in both Arm6 and Intel assembly start with a period. Here are two Arm6 examples, which happen to work in Intel as well: + + +``` +.data       +.align 4 +``` + +The first directive indicates that the following section holds data items rather than code. The `.align 4` directive specifies that data items should be laid out, in memory, on 4-byte boundaries, which is common in modern architectures. As the name suggests, a directive gives direction to the translator (the "assembler") as this does its work. + +By contrast, this directive indicates a code rather than a data section: + + +``` +`.text` +``` + +The term "text" is traditional, and its meaning, in this context, is "read-only": during program execution, code is read-only, whereas data can be read and written. + + * Labels in both recent Arm and Intel assembly end with colons. A label is a memory address for either data items (e.g., variables) or code blocks (e.g., functions). Assembly languages, in general, rely heavily on addresses, which means that manipulating pointers—in particular, dereferencing them to get the values to which they point—takes front stage in assembly-language programming. Here are two labels in the hstoneS program: + + +``` +collatz:         /* label */ +     mov r0, #0  /* instruction */   +loop_start:      /* label */ +     ... +``` + +The first label marks the start of the `collatz` function, whose first instruction copies the value zero (`#0`) into the register `r0`. (The `mov` for "move" opcode occurs across assembly languages but really means "copy.") The second label, `loop_start:`, is the address of the loop that computes the length of the hailstone sequence. The register `r0` serves as the sequence counter. + + * Instructions, which assembly-sensitive editors usually indent along with directives, specify the operations to be performed (e.g., `mov`) together with operands (in this case, `r0` and `#0`). There are instructions with no operands and others with several. + + + + +The `mov` instruction above does not violate the load-store principle about memory access. In general, a load instruction (`ldr` in Arm6) loads memory contents into a register. By contrast, a `mov` instruction can be used to copy an "immediate value," such as an integer constant, into a register: + + +``` +`mov r0, #0 /* copy zero into r0 */` +``` + +A `mov` instruction also can be used to copy the contents of one register into another: + + +``` +`mov r1, r0 /* r1 = r0 */` +``` + +The load opcode `ldr` would be inappropriate in both cases because a memory location is not in play. Examples of Arm6 `ldr` ("load register") and `str` ("store register") instructions are forthcoming. + +The Arm6 architecture has 16 primary CPU registers (each 32-bits in size), a mix of general-purpose and special-purpose. Table 1 gives a summary, listing special features and uses beyond scratchpad: + +#### Table 1. Primary CPU registers + +Register | Special features +---|--- +r0 | 1st arg to library function, retval +r1 | 2nd arg to library function +r2 | 3rd arg to library function +r3 | 4th arg to library function +r4 | callee-saved +r5 | callee-saved +r6 | callee-saved +r7 | callee-saved, system calls +r8 | callee-saved +r9 | callee-saved +r10 | callee-saved +r11 | callee-saved, frame pointer +r12 | intra-procedure +r13 | stack pointer +r14 | link register +r15 | program counter + +In general, CPU registers serve as a backup for the stack, the area of main memory that provides reusable scratchpad storage for the arguments passed to functions and the local variables used in functions and other code blocks (e.g., the body of a loop). Given that CPU registers reside on the same chip as the CPU, access time is fast. Access to the stack is significantly slower, with the details depending on the particularities of a system. However, registers are scarce. In the case of Arm6, there are only 16 primary CPU registers, and some of these have special uses beyond scratchpad. + +The first four registers, `r0` through `r3`, are used for scratchpad but also to pass arguments along to library functions. For example, calling a library function such as `printf` (used in both the hstoneC and hstoneS programs) requires that the expected arguments be in the expected registers. The `printf` function takes at least one argument (a format string) but usually takes others, as well (the values to be formatted). The address of the format string has to be in register `r0` for the call to succeed. A programmer-defined function can implement its own register strategy, of course, but using the first four registers for function arguments is common in Arm6 programming. + +Register `r0` also has special uses. For example, it typically holds the value returned from a function, as in the `collatz` function of the hstoneS program. If a program calls the `syscall` function, which is used to invoke system functions such as `read` and `write`, register `r0` holds the integer identifier of the system function to be called (e.g., function `write` has 4 as its identifier). In this respect, register `r0` is similar in purpose to register `r7`, which holds such an identifier when function `svc` ("supervisor call") is used instead of `syscall`. + +Registers `r4` through `r11` are general-purpose and "callee saved" (aka "non-volatile" or "call-preserved"). Consider the case in which function F1 calls function F2 using registers to pass arguments to F2. The registers `r0` through `r3` are "caller saved" (aka "volatile" or "call-clobbered") in that, for example, the called function F2 might call some other function F3 by using the very same registers that F1 did—but with new values therein: + + +``` +  27  13    191  437 +   \   \      \   \ +   r0, r1     r0, r1 +F1-------->F2-------->F3 +``` + +After F1 calls F2, the contents of registers `r0` and `r1` get changed for F2's call to F3. Accordingly, F1 must not assume that its values in `r0` and `r1` (27 and 13, respectively) have been preserved; instead, these values have been overwritten—clobbered by the new values 191 and 437. Because the first four registers are not "callee saved," called function F2 is not responsible for preserving and later restoring the values in the registers set by F1. + +Callee-saved registers bring responsibility to a called function. For example, if F1 used callee-saved registers `r4` and `r5` in its call to F2, then F2 would be responsible for saving the contents of these registers (typically on the stack) and then restoring the values before returning to F1. F2's code then might start and end as follows: + + +``` +push {r4, r5}  /* save r4 and r5 values on the stack */ +...            /* reuse r4 and r5 for some other task */ +pop {r4, r5}   /* restore r4 and r5 values */ +``` + +The `push` operation saves the values in `r4` and `r5` to the stack. The matching `pop` operation then recovers these values from the stack and puts them into `r4` and `r5`. + +Other registers in Table 1 can be used as scratchpad, but some have a special use, as well. As noted earlier, register `r7` can be used to make system calls (e.g., to function `write`), which a later example shows in detail. In an `svc` instruction, the integer identifier for a particular system function must be in register `r7` (e.g., 4 to identify the `write` function). + +Register `r11` is aliased as `fp` for "frame pointer," which points to the start of the current call frame. When one function calls another, the called function gets its own area of the stack (a call frame) for use as scratchpad. A frame pointer, unlike the stack pointer described below, typically remains fixed until a called function returns. + +Register `r12`, also known as `ip` ("intra-procedure"), is used by the dynamic linker. Between calls to dynamically linked library functions, however, a program can use this register as scratchpad. + +Register `r13`, which has `sp` ("stack pointer") as an alias, points to the top of the stack and is updated automatically through `push` and `pop` operations. The stack pointer also can be used as a base address with an offset; for example, `sp - #4` points 4 bytes below where the `sp` points. The Arm6 stack, like its Intel counterpart, grows from high to low addresses. (Some authors accordingly describe the stack pointer as pointing to the bottom rather than the top of the stack.) + +Register `r14`, with `lr` as an alias, serves as the "link register" that holds a return address for a function. However, a called function can call another with a `bl` ("branch with link") or `bx` ("branch with exchange") instruction, thereby clobbering the contents of the `lr` register. For example, in the hstoneS program, the function `main` calls four others. Accordingly, function `main` saves the `lr` of its caller on the stack and later restores this value. The pattern occurs regularly in Arm6 assembly language: + + +``` +push {lr} /* save caller's lr */ +...       /* call some functions */ +pop {lr}  /* restore caller's lr */ +``` + +Register `r15` is also the `pc` ("program counter"). In most architectures, the program counter points to the "next" instruction to be executed. For historical reasons, the Arm6 `pc` points to _two_ instructions beyond the current one. The `pc` can be manipulated directly (for example, to call a function), but the recommended approach is to use instructions such as `bl` that manipulate the link register. + +Arm6 has the usual assortment of instructions for arithmetic (e.g., add, subtract, multiply, divide), logic (e.g., compare, shift), control (e.g., branch, exit), and input/output (e.g., read, write). The results of comparisons and other operations are saved in the special-purpose register `cpsr` ("current processor status register"). For example, this register records whether an addition caused an overflow or whether two compared integer values are equal. + +It is worth repeating that the Arm6 has exactly two basic data movement instructions: `ldr` to load memory contents into a register and `str` to store register contents in memory. Arm6 includes variations of the basic `ldr` and `str` instructions, but the load-store pattern of moving data between registers and memory remains the same. + +A code example brings these architectural details to life. The next section introduces the hailstone program in assembly language. + +### The hstone program in Arm6 assembly + +The above overview of Arm6 assembly is enough to introduce the full code example for hstoneS. For clarity, the assembly-language program hstoneS has essentially the same structure as the C program hstoneC: two functions, `main` and `collatz`, and mostly straight-line code execution in each function. The behavior of the two programs is the same. + +Here is the source code for hstoneS: + + +``` +        .data        /* data versus code */ +        .balign 4    /* alignment on 4-byte boundaries */ + +/* labels (addresses) for user input, formatters, etc. */ +num:    .int    0               /* 4-byte integer */ +steps:  .int    0               /* another for the result */ +prompt: .asciz  "Integer > 0: " /* zero-terminated ASCII string */ +format: .asciz  "%u"            /* %u for "unsigned" */ +report: .asciz  "From %u to 1 takes %u steps.\n" +        +        .text          /* code: 'text' in the sense of 'read only' */ +        .global main   /* program's entry point must be global */ +        .extern [printf][7] /* library function */ +        .extern [scanf][8]  /* ditto */ + +collatz:                 /** collatz function **/ +        mov r0, #0       /* r0 is the step counter */ +loop_start:              /** collatz loop **/ +        cmp r1, #1       /* are we done? (num == 1?) */ +        beq collatz_end  /* if so, return to main */     +        +        and r2, r1, #1            /* odd-even test for r1 (num) */ +        cmp r2, #0                /* even? */ +        moveq r1, r1, LSR #1      /* even: divide by 2 via a 1-bit right shift */ +        addne r1, r1, r1, LSL #1  /* odd: multiply by adding and 1-bit left shift */ +        addne r1, #1              /* odd: add the 1 for (3 * num) + 1 */ + +        add r0, r0, #1            /* increment counter by 1 */ +        b loop_start              /* loop again */ +collatz_end: +        bx lr                     /* return to caller (main) */ + +main:   +        push {lr}              /* save link register to stack */ + +        /* prompt for and read user input */ +        ldr r0, =prompt        /* format string's address into r0 */ +        bl  [printf][7]             /* call printf, with r0 as only argument */ + +        ldr r0, =format        /* format string for scanf */ +        ldr r1, =num           /* address of num into r1 */ +        bl  [scanf][8]              /* call scanf */ + +        ldr r1, =num           /* address of num into r1 */ +        ldr r1, [r1]           /* value at the address into r1 */ +        bl  collatz            /* call collatz with r1 as the argument */ + +        /* demo a store */ +        ldr r3, =steps         /* load memory address into r3 */ +        str r0, [r3]           /* store hailstone steps at mem[r3] */ + +        /* setup report */ +        mov r2, r0             /* r0 holds hailstone steps: copy into r2 */ +        ldr r1, =num           /* get user's input again */ +        ldr r1, [r1]           /* dereference address to get value */ +        ldr r0, =report        /* format string for report into r0 */ +        bl  [printf][7]             /* print report */ + +        pop {lr}               /* return to caller */ +``` + +Arm6 assembly supports documentation in either C style (the slash-star and star-slash syntax used here) or one-line comments introduced by the @ sign. The hstoneS program, like its C counterpart, has two functions: + + * The program's entry point is the `main` function, which is identified by the label `main:`; this label marks where the function's first instruction is found. In Arm6 assembly, the entry point must be declared as global: + + +``` +`.global main` +``` + +In C, a function's _name_ is the address of the code block that makes up the function's body, and a C function is `extern` (global) by default. It is unsurprising how much C and assembly language resemble one another; indeed, C is portable assembly language. + + * The `collatz` function expects one argument, which is implemented by the register `r1` to hold the user's input of an unsigned integer value (e.g., 9). This function updates register `r1` until it equals 1, keeping count of the steps involved with register `r0`, which thereby serves as the function's return value. + + + + +An early and interesting code segment in `main` involves the call to the library function `scanf`, a high-level input function that scans a value from the standard input (by default, the keyboard) and converts this value to the desired data type, in this case, a 4-byte unsigned integer. Here is the code segment in full: + + +``` +ldr r0, =format  /* address of format string into r0 */ +ldr r1, =num     /* address of num into r1 */ +bl  [scanf][8]        /* call scanf (bl = branch with link) */ + +ldr r1, =num     /* address of num into r1 */ +ldr r1, [r1]     /* value at the address into r1 */ +bl  collatz      /* call collatz with r1 as the argument */ +``` + +Two labels (addresses) are in play: `format` and `num`, both of which are defined in the `.data` section at the top of the program: + + +``` +num:    .int    0       +format: .asciz  "%u"     +``` + +The label `num:` is the memory address of a 4-byte integer value, initialized to zero; the label `format:` points to a null-terminated (the "z" in "asciz" for zero) string `"%u"`, which specifies that the scanned input should be converted to an unsigned integer. Accordingly, the first two instructions in the code segment load the address of the format string (`=format`) into register `r0` and the address for the scanned number (`=num`) into register `r1`. Note that each label now starts with an equals sign ("assign address") and that the colon is dropped at the end of each label. The library function `scanf` can take an arbitrary number of arguments, but the first (which `scanf` expects in register `r0`) should be the "address" of a format string. In this example, the second argument to `scanf` is the "address" at which to save the scanned integer. + +The last three instructions in the code segment highlight important assembly details. The first `ldr` instruction loads the _address_ of the memory-based integer (`=num`) into register `r1`. However, the `collatz` function expects the _value_ stored at this address, not the address itself; hence, the address is dereferenced to get the value: + + +``` +ldr r1, =num /* load address into r1 */ +ldr r1, [r1] /* dereference to get value */ +``` + +The square brackets specify memory and `r1` holds a memory address. The expression `[r1]` thus evaluates to the _value_ stored in memory at address `r1`. The example underscores that registers can hold addresses and values stored at addresses: register `r1` first holds an address and then the value stored at this address. + +When the `collatz` function returns to `main`, this function first performs a store operation: + + +``` +ldr r3, =steps /* steps is a memory address */ +str r0, [r3]   /* store r0 value at mem[r3] */ +``` + +The label `steps:` is from the `.data` section and register `r0` holds the steps computed in the `collatz` function. The `str` instruction thus saves to memory the length of the hailstone sequence. In a `ldr` instruction, the first operand (a register) is the _target_ for the load; but in a `str` operation, the first operand (also a register) is the _source_ for the store. In both cases, the second operand is a memory location. + +Some additional work in `main` sets up the final report: + + +``` +mov r2, r0      /* save count in r2 */ +ldr r1, =num    /* recover user input */ +ldr r1, [r1]    /* dereference r1 */   +ldr r0, =report /* r0 points to format string */ +bl  [printf][7]      /* print report */ +``` + +In the `collatz` function, register `r0` tracks how many steps are needed to reach 1 from the user's input, but the library function `printf` expects its first argument (the address of a format string) to be stored in register `r0`. The return value in register `r0` is therefore copied into register `r2` with the `mov` instruction. The address of the format string for `printf` is then stored in register `r0`. + +The argument to the `collatz` function is the scanned input, which is stored in register `r1`; but this register is updated in the `collatz` loop unless the value happens to be 1 at the start. Accordingly, the address `num:` is again copied into `r1` and then dereferenced to get the user's original input. This value becomes the second argument to `printf`, the starting value of the hailstone sequence. With this setup in place, `main` calls `printf` with the `bl` ("branch with link") instruction. + +At the very start of the `collatz` loop, the program checks whether the sequence has hit a 1: + + +``` +cmp r1, #1       +beq collatz_end   +``` + +If register `r1` has 1 as its value, there is a branch (`beq` for "branch if equal") to the end of the `collatz` function, which means a return to its caller `main` with register `r0` as the return value—the number of steps in the hailstone sequence. + +The `collatz` function introduces new features and opcodes, which illustrate how efficient assembly code can be. The assembly code, like the C code, checks for N's parity, with register `r1` as N: + + +``` +and r2, r1, #1 /* r2 = r1 & 1 */           +cmp r2, #0     /* is the result even? */ +``` + +The result of the bitwise AND operation on register `r1` and 1 is stored in register `r2`. If the least-significant (rightmost) bit of register `r2` is a 1, then N (register `r1`) is odd, and otherwise, it is even. The result of this comparison (saved in the special-purpose register `cpsr`) is used automatically in forthcoming instructions such as `moveq` ("move if equal") and `addne` ("add if not equal"). + +The assembly code, like the C code, now avoids an explicit if-else construct. This code segment has the same effect as an if-else test, but the code is more efficient in that no branching is involved—the code executes in straight-line fashion because the conditional tests are built into the instruction opcodes: + + +``` +moveq r1, r1, LSR #1     /* right-shift 1 bit if even */ +addne r1, r1, r1, LSL #1 /* left-shift 1 bit and add otherwise */ +addne r1, #1             /* add 1 for the + 1 in N = 3N + 1 */ +``` + +The `moveq` (`eq` for "if equal") instruction checks the outcome of the earlier `cmp` test, which determines whether the current value of register `r1` (N) is even or odd. If the value in register `r1` is even, this value must be updated to its half, which is done by a 1-bit right-shift (`LSR #1`). In general, right-shifting an integer is more efficient than explicitly dividing it by two. For example, suppose that register `r1` currently holds 4, whose least significant four bits are: + + +``` +`...0100 ## 4 in binary` +``` + +Shifting right by 1 bit yields: + + +``` +`...0010 ## 2 in binary` +``` + +The `LSR` stands for "logical shift right" and contrasts with `ASR` for "arithmetic shift right." An arithmetic shift is sign-preserving (most significant bit of 1 for negative and 0 for non-negative), whereas a logical shift is not, but the hailstone programs deal exclusively with _unsigned_ (hence, non-negative) values. In a logical shift, the shifted bits are replaced by zeros. + +If register `r1` holds a value with odd parity, similar straight-line code occurs: + + +``` +addne r1, r1, r1, LSL #1  /* r1 = r1 * 3 */ +addne r1, #1              /* r1 = r1 + 1 */ +``` + +The two `addne` instructions (`ne` for "if not equal") execute only if the earlier check for parity indicates an odd value. The first `addne` instruction does multiplication through a 1-bit left-shift and addition. In general, shifting and adding are more efficient than explicitly multiplying. The second `addne` then adds 1 to register `r1` so that the update is from N to 3N+1. + +### Assembling the hstoneS program + +The assembly source code for the hstoneS program needs to be translated ("assembled") into a binary _object module_, which is then linked with appropriate libraries to become executable. The simplest approach is to use the GNU C compiler in the same way as it is used to compile a C program such as hstoneC: + + +``` +`% gcc -o hstoneS hstoneS.s` +``` + +This command does the assembling and linking. + +A slightly more efficient approach is to use the _as_ utility that ships with the GNU toolset. This approach separates the assembling and the linking. Here is the assembling step: + + +``` +`% as -o hstoneS.o hstoneS.s ## assemble` +``` + +The extension `.o` is traditional for object modules. The system utility _ld_ then could be used for the linking, but an easier and equally efficient approach is to revert to the _gcc_ command: + + +``` +`% gcc -o hstoneS hstoneS.o ## link` +``` + +This approach highlights again that the C compiler handles any mix of C and assembly, whether source files or object modules. + +### Wrapping up with an explicit system call + +The two hailstone programs use the high-level input/output functions `scanf` and `printf`. These functions are high-level in that they deal with formatted types (in this case, unsigned integers) rather than with raw bytes. In an embedded system, however, these functions might not be available; the low-level input/output functions `read` and `write`, which ultimately implement their high-level counterparts, then would be used instead. These two system functions are low-level in that they work with raw bytes. + +In Arm6 assembly, a program explicitly calls a system function such as `write` in an indirect manner—by invoking one of the aforementioned functions `svc` or `syscall`, for example: + + +``` +        calls      calls +program------->svc------->write +``` + +The integer identifier for a particular system function (e.g., 4 identifies `write`) goes into the appropriate register (register `r7` for `svc` and register `r0` for `syscall`). The code segments below illustrate, first with `svc` and then with `syscall`. + +The two code segments write the traditional greeting to the standard output, which is the screen by default. The standard output has a _file descriptor_, a non-negative integer value that identifies it. The three predefined descriptors are: + + +``` +standard input:  0 (keyboard by default) +standard output: 1 (screen by default) +standard error:  2 (screen by default) +``` + +Here is the code segment for a sample system call with `svc`: + + +``` +msg: .asciz "Hello, world!\n" /* greeting */ +... +mov r0, #1    /* 1 = standard output */ +ldr r1, =msg  /* address of bytes to write */ +mov r2, #14   /* message length (in bytes) */ +mov r7, #4    /* write has 4 as an id */ +svc #0        /* system call to write */ +``` + +The function `write` takes three arguments and, when called via `svc`, the function's arguments go into the following registers: + + * `r0` holds the target for the write operation, in this case, the standard output (`#1`). + * `r1` has the address of the byte(s) to write (`=msg`). + * `r2` specifies how many bytes are to be written (`#14`). + + + +In the case of the `svc` instruction, register `r7` identifies, with a non-negative integer (in this case, `#4`), which system function to call. The `svc` call returns zero (the `#0`) to signal success but usually a negative value to signal an error. + +The `syscall` and `svc` functions differ in detail, but using either to invoke a system function requires the same two steps: + + * Specify the system function to be called (in `r7` for `svc`, in `r0` for `syscall`). + * Put the arguments for the system function in the appropriate registers, which differ between the `svc` and `syscall` variants. + + + +Here is the `syscall` example of invoking the `write` function: + + +``` +msg: .asciz "Hello, world!\n" /* greeting */ +... +mov r1, #1   /* standard output */ +ldr r2, =msg /* address of message */ +mov r3, #14  /* byte count */ +mov r0, #4   /* identifier for write */ +syscall +``` + +C has a thin wrapper not only for the `syscall` function but for the system functions `read` and `write` as well. The C wrapper for `syscall` gives the gist at a high level: + + +``` +syscall(SYS_write,         /* 4 is the id for write */ +        STDOUT_FILENO,     /* 1 is the standard output */ +        "Hello, world!\n", /* message */ +        14);               /* byte length */ +``` + +The direct approach in C uses the wrapper for the system `write` function: + + +``` +`write(STDOUT_FILENO, "Hello, world!\n", 14);` +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/arm6-assembly-language + +作者:[Marty Kalin][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://opensource.com/users/mkalindepauledu +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LAW-Internet_construction_9401467_520x292_0512_dc.png?itok=RPkPPtDe (An intersection of pipes.) +[2]: https://www.arm.com/ +[3]: https://condor.depaul.edu/mkalin +[4]: https://opensource.com/article/19/8/webassembly-speed-code-reuse +[5]: https://plus.maths.org/content/mathematical-mysteries-hailstone-sequences +[6]: https://en.wikipedia.org/wiki/Collatz_conjecture +[7]: http://www.opengroup.org/onlinepubs/009695399/functions/printf.html +[8]: http://www.opengroup.org/onlinepubs/009695399/functions/scanf.html +[9]: https://en.wikipedia.org/wiki/Endianness From f73c3125fea5d19ef1a155005d842660ced7ec34 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 29 Oct 2020 05:02:46 +0800 Subject: [PATCH 0591/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201028?= =?UTF-8?q?=205=20new=20sudo=20features=20you=20need=20to=20know=20in=2020?= =?UTF-8?q?20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201028 5 new sudo features you need to know in 2020.md --- ... sudo features you need to know in 2020.md | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 sources/tech/20201028 5 new sudo features you need to know in 2020.md diff --git a/sources/tech/20201028 5 new sudo features you need to know in 2020.md b/sources/tech/20201028 5 new sudo features you need to know in 2020.md new file mode 100644 index 0000000000..1a341c50ca --- /dev/null +++ b/sources/tech/20201028 5 new sudo features you need to know in 2020.md @@ -0,0 +1,133 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 new sudo features you need to know in 2020) +[#]: via: (https://opensource.com/article/20/10/sudo-19) +[#]: author: (Peter Czanik https://opensource.com/users/czanik) + +5 new sudo features you need to know in 2020 +====== +From central session recording through chroot support to Python API, +sudo 1.9 offers many new features. +![Wratchet set tools][1] + +When you want to perform an action on a [POSIX system][2], one of the safest ways to do so is to use the sudo command. Unlike logging in as the root user and performing what could be a dangerous action, sudo grants any user [designated as a "sudoer"][3]  by the sysadmin temporary permission to perform a normally restricted activity. + +This system has helped keep Linux, Unix, and macOS systems safe from silly mistakes and malicious attacks for decades, and it is the default administrative mechanism on all major Linux distributions today. + +When it was released in May 2020, sudo 1.9 brought many new features, including central collection of session recordings, support for chroot within sudo, and a Python API. If you are surprised by any of these, read my article about some [lesser-known features of sudo][4]. + +Sudo is a lot more than just a prefix for administrative commands. You can fine-tune permissions, record what is happening on the terminal, extend sudo using plugins, store configurations in LDAP, do extensive logging, and much more. + +Version 1.9.0 and subsequent minor releases added a variety of new features (which I'll describe below), including: + + * A recording service to collect sudo session recordings centrally + * Audit plugin API + * Approval plugin API + * Python support for plugins + * Chroot and CWD support built into sudo (starting with 1.9.3) + + + +### Where to get sudo 1.9 + +Most Linux distributions still package the previous generation of sudo (version 1.8), and it will stay that way in long-term support (LTS) releases for several years. The most complete sudo 1.9 package I am aware of in a Linux distribution is openSUSE [Tumbleweed][5], which is a rolling distro, and the sudo package has Python support available in a subpackage. Recent [Fedora][6] releases include sudo 1.9 but without Python. [FreeBSD Ports][7] has the latest sudo version available, and you can enable Python support if you build sudo yourself instead of using the package. + +If your favorite Linux distribution does not yet include sudo 1.9, check the [sudo binaries page][8] to see if a ready-to-use package is available for your system. This page also has packages for several commercial Unix variants. + +As usual, before you start experimenting with sudo settings, _make sure you know the root password_. Yes, even on Ubuntu. Having a temporary "backdoor" is important; without it, you would have to hack your own system if something goes wrong. And remember: a syntactically correct configuration does not mean that anybody can do anything through sudo on that system! + +### Recording service + +The recording service collects session recordings centrally. This offers many advantages compared to local session log storage: + + * It is more convenient to search in one place instead of visiting individual machines for recordings + * Recordings are available even if the sending machine is down + * Recordings cannot be deleted by local users who want to cover their tracks + + + +For a quick test, you can send sessions through non-encrypted connections to the recording service. My blog contains [instructions][9] for setting it up in just a few minutes. For a production setup, I recommend using encryption. There are many possibilities, so read the [documentation][10] that best suits your environment. + +### Audit plugin API + +The new audit plugin API is not a user-visible feature. In other words, you cannot configure it from the sudoers file. It is an API, meaning that you can access audit information from plugins, including ones written in Python. You can use it in many different ways, like sending events from sudo directly to Elasticsearch or Logging-as-a-Service (LaaS) when something interesting happens. You can also use it for debugging and print otherwise difficult-to-access information to the screen in whatever format you like. + +Depending on how you want to use it, you can find its documentation in the sudo plugin manual page (for C) and the sudo Python plugin manual. [Sample Python code][11] is available in the sudo source code, and there is also a [simplified example][12] on my blog. + +### Approval plugin API + +The approval plugin API makes it possible to include extra restrictions before a command will execute. These will run only after the policy plugin succeeds, so you can effectively add additional policy layers without replacing the policy plugin and thus sudoers. Multiple approval plugins may be defined, and all must succeed for the command to execute. + +As with the audit plugin API, you can use it both from C and Python. The [sample Python code][13] documented on my blog is a good introduction to the API. Once you understand how it works, you can extend it to connect sudo to ticketing systems and approve sessions only with a related open ticket. You can also connect to an HR database so that only the engineer on duty can gain administrative privileges. + +### Python support for plugins + +Even though I am not a programmer, my favorite new sudo 1.9 feature is Python support for plugins. You can use most of the APIs available from C with Python as well. Luckily, sudo is not performance-sensitive, so the relatively slow speed of running Python code is not a problem for sudo. Using Python for extending sudo has many advantages: + + * Easier, faster development + * No need to compile; code might even be distributed by configuration management + * Many APIs do not have ready-to-use C clients, but Python code is available + + + +In addition to the audit and approval plugin APIs, there are a few others available, and you can do very interesting things with them. + +By using the policy plugin API, you can replace the sudo policy engine. Note you will lose most sudo features, and there is no more sudoers-based configuration. This can still be useful in niche cases, but most of the time, it is better to keep using sudoers and create additional policies using the approval plugin API. If you want to give it a try, my [introduction to the Python plugin][14] provides a very simple policy: allowing only the `id` command. Once again, make sure you know the root password, as once this policy is enabled, it prevents any practical use of sudo. + +Using the I/O logs API, you can access input and output from user sessions. This means you can analyze what is happening in a session and even terminate it if you find something suspicious. This API has many possible uses, such as data-leak prevention. You can monitor the screen for keywords and, if any of them appear in the data stream, you can break the connection before the keyword can appear on the user's screen. Another possibility is checking what the user is typing and using that data to reconstruct the command line the user is entering. For example, if a user enters `rm -fr /`, you can disconnect the user even before Enter is hit. + +The group plugin API allows non-Unix group lookups. In a way, this is similar to the approval plugin API as it also extends the policy plugin. You can check if a user is part of a given group and act based on this in later parts of the configuration. + +### Chroot and CWD support + +The latest additions to sudo are chroot and change working directory (CWD) support. Neither option is enabled by default—you need to explicitly enable them in the sudoers file. When they're enabled, you can fine-tune target directories or allow users to specify which directory to use. The logs reflect when these settings were used. + +On most systems, chroot is available only to root. If one of your users needs chroot, you need to give them root access, which gives them a lot more power than just chroot. Alternately, you can allow access to the chroot command through sudo, but it still allows loopholes where they can gain full access. When you use sudo's built-in chroot support, you can easily restrict access to a single directory. You can also give users the flexibility to specify the root directory. Of course, this might lead to disasters (e.g., `sudo --chroot / -s`), but at least the event is logged. + +When you run a command through sudo, it sets the working directory to the current directory. This is the expected behavior, but there may be cases when the command needs to be run in a different directory. For example, I recall using an application that checked my privileges by checking whether my working directory was `/root`. + +### Try the new features + +I hope that this article inspires you to take a closer look at sudo 1.9. Central session recording is both more convenient and secure than storing session logs locally. Chroot and CWD support give you additional security and flexibility. And using Python to extend sudo makes it easy to custom-tailor sudo to your environment. You can try the new features by using one of the latest Linux distributions or the ready-to-use packages from the sudo website. + +If you want to learn more about sudo, here are a few resources: + + * [Sudo website][15] + * [Sudo blog][16] + * [Sudo on Twitter][17] + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/sudo-19 + +作者:[Peter Czanik][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://opensource.com/users/czanik +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_osyearbook2016_sysadmin_cc.png?itok=Y1AHCKI4 (Wratchet set tools) +[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains +[3]: https://opensource.com/article/17/12/using-sudo-delegate +[4]: https://opensource.com/article/19/10/know-about-sudo +[5]: https://software.opensuse.org/distributions/tumbleweed +[6]: https://getfedora.org/ +[7]: https://www.freebsd.org/ports/ +[8]: https://www.sudo.ws/download.html#binary +[9]: https://blog.sudo.ws/posts/2020/03/whats-new-in-sudo-1.9-recording-service/ +[10]: https://www.sudo.ws/man/sudo_logsrvd.man.html#EXAMPLES +[11]: https://github.com/sudo-project/sudo/blob/master/plugins/python/example_audit_plugin.py +[12]: https://blog.sudo.ws/posts/2020/06/sudo-1.9-using-the-new-audit-api-from-python/ +[13]: https://blog.sudo.ws/posts/2020/08/sudo-1.9-using-the-new-approval-api-from-python/ +[14]: https://blog.sudo.ws/posts/2020/01/whats-new-in-sudo-1.9-python/ +[15]: https://www.sudo.ws/ +[16]: https://blog.sudo.ws/ +[17]: https://twitter.com/sudoproject From f754f12fe46ff22bb4d9f7d8026b2644f29031e1 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 29 Oct 2020 05:02:59 +0800 Subject: [PATCH 0592/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201028?= =?UTF-8?q?=20A=20few=20things=20I've=20learned=20about=20email=20marketin?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201028 A few things I-ve learned about email marketing.md --- ...ings I-ve learned about email marketing.md | 139 ++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 sources/tech/20201028 A few things I-ve learned about email marketing.md diff --git a/sources/tech/20201028 A few things I-ve learned about email marketing.md b/sources/tech/20201028 A few things I-ve learned about email marketing.md new file mode 100644 index 0000000000..4918d3dd3e --- /dev/null +++ b/sources/tech/20201028 A few things I-ve learned about email marketing.md @@ -0,0 +1,139 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A few things I've learned about email marketing) +[#]: via: (https://jvns.ca/blog/2020/10/28/a-few-things-i-ve-learned-about-email-marketing/) +[#]: author: (Julia Evans https://jvns.ca/) + +A few things I've learned about email marketing +====== + +Hello! I’ve been learning a lot about business over the last few years (it’s possible to make a living by helping people learn! it’s amazing!). One of the things I’ve found hardest to get my head around was email marketing. + +Like a lot of people, I get a lot of unwanted email, and at first I was really opposed to doing any kind of email marketing because I was worried I’d be the _source_ of that unwanted email. But I’ve learned how to do it in a way that feels good to me, and where the replies to my marketing emails are usually along the lines of “wow, I love this, thank you so much!”. ([literally: here are excerpts from the last 20 or so replies I’ve gotten][1]) + +I’m going to structure this as a series of beliefs I had about email marketing that turned out not to be universally true. + +### myth 1: selling things is an adversarial relationship + +I used to think that selling things was a sort of adversarial relationship: the person selling the product wants to convince the buyer (by any means necessary) to spend as much money as possible, and that people buying things are usually kind of resentful of anyone asking them to spend money. + +I’ve learned that actually a lot of people are happy (or even actively **want**) to spend money on something that will help them solve a problem they have. + +Here’s a silly example of something illustrating this: 2 years ago, we’d hired someone to paint our new apartment. We decided to paint a lot of the walls white, and we were stuck with the impossible problem of deciding which of the 10 billion possible shades of white to paint the walls. I found a $27 ebook called [white is complicated][2], and (long story short, this blog post is not about painting) it really helped me confidently choose a shade of white!! We spent thousands of dollars on painting, so $30 was a really good investment in making sure we’d be happy with the result. + +So even though $27 for an ebook on how to choose a white seems silly at first, I was really happy to spend the money, and my guess is a lot of other people who bought that ebook are as well. + +The bigger idea here is that it’s easier to run a business when you’re selling to people who are happy to buy things based on the value they’re getting from the product. In my case, I’ve found that there are lots of programmers who are happy to pay for clear, short, friendly explanations of concepts they need to understand for their jobs. + +### a quick note on how I learned these things: 30x500 + +I originally wrote this blog post about all these things I learned, and it kind of read like I figured out all of these things naturally over the course of running a business. But that’s not how it went at all! I’ve actually found it very hard to debug business problems on my own. A lot of the attitudes I had when I started out running a business were counterproductive (like thinking of selling something as an adversarial process), and I don’t know that many people who run similar businesses who I can get advice from. + +I learned how to think about selling things as a non-adversarial process (and everything else in this blog post, and a lot more) from [30x500][3], a business class by Amy Hoy ([her writing is here][4]) and [Alex Hillman][5] that I bought a couple of years ago. 30x500 is about running a specific kind of business (very briefly: sell to people who buy based on value, decide what to build by researching your audience, market by teaching people helpful things), which happens to be the exact kind of business that I run. It’s been a really great way to learn how to run my business better. + +Okay, back to my misconceptions about email marketing! + +### myth 2: sending email is inherently bad + +The next thing I believed was that sending email from a business was somehow inherently bad and that all marketing email was unwanted. + +I now realize this is untrue even for normal marketing emails – for example, lots of people subscribe to marketing newsletters for brands they like because they want to hear about new products when they come out & sales. + +But marketing emails aren’t just “not inherently bad”, they can actually be really useful! + +### marketing is about building trust + +When I started sending out business emails, I based them on the emails I was used to receiving – I’d announce new zines I’d written, and explain why the zine was useful. + +But what I’ve learned is that (at least for me) marketing isn’t about describing your product to the audience, **marketing is about building trust by helping people**. + +So, instead of just periodically emailing out “hey, here’s a new zine, here’s why it’s good”, my main marketing email list is called [saturday comics][6], and it sends you 1 email a week with a programming comic. + +What I like about this approach to marketing (“just help people learn things for free”) is that it’s literally just what I love doing anyway – I wrote this blog to help people learn things for free for years just because I think it’s fun to help people learn. + +And people love the Saturday Comics! And it makes money – I announce new zines to that list as well, and lots of people buy them. It’s really simple and nice! + +### myth 3: you have to trick people into signing up for your email marketing list + +One pattern I see a lot is that I sign up for some free service, and then I start getting deluged with marketing emails trying to convince me to upgrade to the paid tier or whatever. I used to think that this was how marketing emails **had** to work – you somehow get people’s email and then send them email, and hope that for some reason (???) they decide to buy things from you. + +But, of course, this isn’t true! If your marketing list is actually just full of genuinely helpful emails, and you can describe who it’s intended for clearly (give people a link to the archive to see if they like what they see!), then a lot of people will be happy to sign up and receive the emails! + +If you clearly communicate who your mailing list will help, then people can easily filter themselves in, and the only people on the list will be happy to be on the list. And then you don’t have to send any unwanted email at all! Hooray! + +Here’s one story that influenced how I think about this: once I sent an email to everyone who had bought a past zine saying “hey, I just released this other zine, maybe you want to buy it!”. And I got an angry reply from someone saying something like “why are you emailing me, I just bought that one thing from you, I don’t want you to keep emailing me about other things”. I decided that I agreed with that, and now I’m more careful about being clear about what kinds of emails people are opting into. + +### marketing is about communicating clearly & honestly + +One insight (from Alex Hillman) that helped me a lot recently was – when someone is dissatisfied with something they bought, it doesn’t always mean that the product is “bad”. Maybe the product is helpful to many other people! + +But it definitely means that the person’s expectations weren’t met. A tiny example: one of the few refund requests I’ve gotten for a zine was from someone from who expected there to be more information about sed in the zine, and they were disappointed there was only 1 page about sed. + +So if I communicate clearly & accurately what problems a product solves, who it’s for, and how it solves those problems, people are much more likely to be delighted when they buy it and be happy to buy from me again in the future!. For my zines specifically, I like to make the table of contents very easy to find so that people can see that there’s [1 page about sed][7] :) + +### myth 4: you have to constantly produce new emails + +I’ve tried and failed to start a lot of mailing lists. the pattern I kept getting stuck in was: + +I have an idea for a weekly mailing list I send 2 emails I give up forever + +This was partly because I thought that to have a weekly/biweekly mailing list, you have to write new emails every week. And some people definitely do mailing lists this way, like [Austin Kleon][8]. + +But I learned that there’s a different way to write a mailing list! Instead, you: + +put together a list of your best articles / comics / whatever when someone subscribes to that list, send them 1 email a week (or every 2 weeks, or whatever) with one article from the List Of Your Best Articles + +The point is most people in the world probably haven’t already read your best articles, and so if you just send them one article a week from that list, it’ll probably actually be MORE helpful to them than if you were writing a new article every week. And you don’t need to write any emails every week! + +I think this is called a “drip marketing campaign”, but when I search for that term I don’t find the results super helpful – there’s a lot out there about tools to do this, but as with anything I think the actual content of the emails is the most important thing. + +### myth 5: unsubscribes are the end of the world + +Another email marketing thing I used to get stressed out about was unsubscribes. It always feels a little sad to send an email about something I’m excited about and see 20 people unsubscribe immediately, even if it’s only 0.3% of people on the mailing list. + +But I know that I subscribe to mailing lists very liberally, even on topics that I’m not that interested in, and 70% of the time I decide that I’m not that interested in the topic and unsubscribe eventually. A small percentage of people unsubscribing really just isn’t that big of a deal. + +### myth 6: you need to optimize your open rates + +There are all kinds of analytics you can do with email marketing, like open rates. I love numbers and analyzing things, but so far I really haven’t found trying to A/B test or optimize my numbers to be that productive or healthy. I’d rather spend my energy on just writing more helpful things for people to read. + +The most important thing I’ve learned about website analytics is that it’s unproductive to look at random statistics like “the open rate on this email is 43% but the last one was 47%” and wonder what they mean. What _has_ been helpful has been coming up with a few specific questions that are important to me (“are people visiting this page from links on other sites, or only from my links?”) and keeping very rough track of the answers over time. + +So far I’ve really never used any of the tracking features of my email marketing software. The only thing I’ve done that I’ve found helpful is: sometimes when I release a new zine I’ll send out a discount code to people on the list, and I can tell if people bought the thing from the mailing list because they used the discount code. + +### it’s important to remember there are people on the other side + +The last thing that’s helped me is to remember that even though emailing thousands of people sometimes feels like a weird anonymous thing, there are a lot of very delightful people on the other side! So when I write emails, I usually try to imagine that I’m writing to some very nice person I met at a conference one time who told me that they like my blog. We’re not best friends, but they know my work to some extent, and they’re interested to hear what I have to say. + +I often like to remind people why they’re getting the email, especially if I haven’t emailed that list for a long time – “you signed up to get announcements when I release a new zine, so here’s an announcement!”. I think the technical email marketing term for this is a list being “cold” and “warm”, like if you don’t email a list for too long it’s “cold” and your subscribers might have forgotten that they’re on it. + +### that’s all! + +When I started, I was really convinced that email marketing was this terrible, awful thing that I could not do that mostly involved tricking people into getting emails they don’t want (ok, I’m exaggerating a bit, but I really struggled with it). But it’s possible to do it in a transparent way where I’m mostly just sending people helpful emails that they do want! + +The big surprise for me was that email marketing is not a monolithic thing. I have a lot of choices about how to do it, and if I don’t like the way someone else does email marketing, I can just make different choices when doing it myself! + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/10/28/a-few-things-i-ve-learned-about-email-marketing/ + +作者:[Julia Evans][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://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://gist.github.com/jvns/c2aaecbbbf60b7f3adf3e0be18d54a7b +[2]: https://mariakillam.com/product/white-is-complicated/ +[3]: https://30x500.com/academy/ +[4]: https://stackingthebricks.com/ +[5]: https://dangerouslyawesome.com +[6]: https://wizardzines.com/saturday-comics +[7]: https://wizardzines.com/zines/bite-size-command-line/ +[8]: https://austinkleon.com/ From 506f766ea53ebbcdb9e4ee39dca261765ecd4a7c Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 29 Oct 2020 08:48:53 +0800 Subject: [PATCH 0593/1156] translating --- ...Install Ubuntu Server on a Raspberry Pi.md | 210 ----------------- ...Install Ubuntu Server on a Raspberry Pi.md | 211 ++++++++++++++++++ 2 files changed, 211 insertions(+), 210 deletions(-) delete mode 100644 sources/tech/20200909 How to Install Ubuntu Server on a Raspberry Pi.md create mode 100644 translated/tech/20200909 How to Install Ubuntu Server on a Raspberry Pi.md diff --git a/sources/tech/20200909 How to Install Ubuntu Server on a Raspberry Pi.md b/sources/tech/20200909 How to Install Ubuntu Server on a Raspberry Pi.md deleted file mode 100644 index ac2fa3d489..0000000000 --- a/sources/tech/20200909 How to Install Ubuntu Server on a Raspberry Pi.md +++ /dev/null @@ -1,210 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Install Ubuntu Server on a Raspberry Pi) -[#]: via: (https://itsfoss.com/install-ubuntu-server-raspberry-pi/) -[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) - -How to Install Ubuntu Server on a Raspberry Pi -====== - -The [Raspberry Pi][1] is the best-known [single-board computer][2]. Initially, the scope of the Raspberry Pi project was targeted to the promotion of teaching of basic computer science in schools and in developing countries. - -Its low cost, portability and very low power consumption, made the models far more popular than anticipated. From weather station to home automation, tinkerers built so many [cool projects using Raspberry Pi][3]. - -The [4th generation of the Raspberry Pi][4], is equipped with features and processing power of a regular desktop computer. But this article is not about using RPi as desktop. Instead, I’ll show you how to install Ubuntu server on Raspberry Pi. - -In this tutorial I will use a Raspberry Pi 4 and I will cover the following: - - * Installing Ubuntu Server on a microSD card - * Setting up a wireless network connection on the Raspberry Pi - * Accessing your Raspberry Pi via SSH - - - -![][5] - -**You’ll need the following things for this tutorial**: - - * A micro SD card (8 GB or greater recommended) - * A computer (running Linux, Windows or macOS) with a micro SD card reader - * A Raspberry Pi 2, 3 or 4 - * Good internet connection - * An HDMI cable for the Pi 2 & 3 and a micro HDMI cable for the Pi 4 (optional) - * A USB keyboard set (optional) - - - -### Installing Ubuntu Server on a Raspberry Pi - -![][6] - -I have used Ubuntu for creating Raspberry Pi SD card in this tutorial but you may follow it on other Linux distributions, macOS and Windows as well. This is because the steps for preparing the SD card is the same with Raspberry Pi Imager tool. - -The Raspberry Pi Imager tool downloads the image of your [choice of Raspberry Pi OS][7] automatically. This means that you need a good internet connection for downloading data around 1 GB. - -#### Step 1: Prepare the SD Card with Raspberry Pi Imager - -Make sure you have inserted the microSD card into your computer, and install the Raspberry Pi Imager at your computer. - -You can download the Imager tool for your operating system from these links: - - * [Raspberry Pi Imager for Ubuntu/Debian][8] - * [Raspberry Pi Imager for Windows][9] - * [Raspberry Pi Imager for MacOS][10] - - - -Despite I use Ubuntu, I won’t use the Debian package that is listed above, but I will install the snap package using the command line. This method can be applied to wider range of Linux distributions. - -``` -sudo snap install rpi-imager -``` - -Once you have installed Raspberry Pi Imager tool, find and open it and click on the “CHOOSE OS” menu. - -![][11] - -Scroll across the menu and click on “Ubuntu” (Core and Server Images). - -![][12] - -From the available images, I choose the Ubuntu 20.04 LTS 64 bit. If you have a Raspberry Pi 2, you are limited to the 32bit image. - -**Important Note: If you use the latest Raspberry Pi 4 – 8 GB RAM model, you should choose the 64bit OS, otherwise you will be able to use 4 GB RAM only.** - -![][13] - -Select your microSD card from the “SD Card” menu, and click on “WRITE”after. - -![][14] - -If it shows some error, try writing it again. It will now download the Ubuntu server image and write it to the micro SD card. - -It will notify you when the process is completed. - -![][15] - -#### Step 2: Add WiFi support to Ubuntu server - -Once the micro SD card flashing is done, you are almost ready to use it. There is one thng that you may want to do before using it and that is to add Wi-Fi support. - -With the SD card still inserted in the card reader, open the file manager and locate the “system-boot” partition on the card. - -The file that you are looking for and need to edit is named `network-config`. - -![][16] - -This process can be done on Windows and MacOS too. Edit the **`network-config`** file as already mentioned to add your Wi-Fi credentials. - -Firstly, uncomment (remove the hashtag “#” at the beginning) from lines that are included in the rectangular box. - -After that, replace myhomewifi with your Wi-Fi network name enclosed in quotation marks, such as “itsfoss” and the “S3kr1t” with the Wi-Fi password enclosed in quotation marks, such as “12345679”. - -![][17] - -It may look like this: - -``` -wifis: - wlan0: - dhcp4: true - optional: true - access-points: - "your wifi name": - password: "your_wifi_password" -``` - -Save the file and insert the micro SD card into your Raspberry Pi. During the first boot, if your Raspberry Pi fails connect to the Wi-Fi network, simply reboot your device. - -#### Step 3: Use Ubuntu server on Raspberry Pi (if you have dedicated monitor, keyboard and mouse for Raspberry Pi) - -If you have got an additional set of mouse, keyboard and a monitor for the Raspberry Pi, you can use easily use it like any other computer (but without GUI). - -Simply insert the micro SD card to the Raspberry Pi, plug in the monitor, keyboard and mouse. Now [turn on your Raspberry Pi][18]. It will present TTY login screen (black terminal screen) and aks for username and password. - - * Default username: ubuntu - * Default password: ubuntu - - - -When prompted, use “**ubuntu**” for the password. Right after a successful login, [Ubuntu will ask you to change the default password][19]. - -Enjoy your Ubuntu Server! - -#### Step 3: Connect remotely to your Raspberry Pi via SSH (if you don’t have monitor, keyboard and mouse for Raspberry Pi) - -It is okay if you don’t have a dedicated monitor to be used with Raspberry Pi. Who needs a monitor with a server when you can just SSH into it and use it the way you want? - -**On Ubuntu and Mac OS**, an SSH client is usually already installed. To connect remotely to your Raspberry Pi, you need to discover its IP address. Check the [devices connected to your network][20] and see which one is the Raspberry Pi. - -Since I don’t have access to a Windows machine, you can access a comprehensive guide provided by [Microsoft][21]. - -Open a terminal and run the following command: - -``` -ssh [email protected]_pi_ip_address -``` - -You will be asked to confirm the connection with the message: - -``` -Are you sure you want to continue connecting (yes/no/[fingerprint])? -``` - -Type “yes” and click the enter key. - -![][22] - -When prompted, use “ubuntu” for the password as mentioned earlier. You’ll be asked to change the password of course. - -Once done, you will be automatically logged out and you have to reconnect, using your new password. - -Your Ubuntu server is up and running on a Raspberry Pi! - -**Conclusion** - -Installing Ubuntu Server on a Raspberry Pi is an easy process and it comes pre-configured at a great degree which the use a pleasant experience. - -I have to say that among all the [operating systems that I tried on my Raspberry Pi][7], Ubuntu Server was the easiest to install. I am not exaggerating. Check my guide on [installing Arch Linux on Raspberry Pi][23] for reference. - -I hope this guide helped you in installing Ubuntu server on your Raspberry Pi as well. If you have questions or suggestions, please let me know in the comment section. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/install-ubuntu-server-raspberry-pi/ - -作者:[Dimitrios Savvopoulos][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/dimitrios/ -[b]: https://github.com/lujun9972 -[1]: https://www.raspberrypi.org/ -[2]: https://itsfoss.com/raspberry-pi-alternatives/ -[3]: https://itsfoss.com/raspberry-pi-projects/ -[4]: https://itsfoss.com/raspberry-pi-4/ -[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/Ubuntu-Server-20.04.1-LTS-aarch64.png?resize=800%2C600&ssl=1 -[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/ubuntu-server-raspberry-pi.png?resize=800%2C450&ssl=1 -[7]: https://itsfoss.com/raspberry-pi-os/ -[8]: https://downloads.raspberrypi.org/imager/imager_amd64.deb -[9]: https://downloads.raspberrypi.org/imager/imager.exe -[10]: https://downloads.raspberrypi.org/imager/imager.dmg -[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/raspberry-pi-imager.png?resize=800%2C600&ssl=1 -[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/raspberry-pi-imager-choose-ubuntu.png?resize=800%2C600&ssl=1 -[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/raspberry-pi-imager-ubuntu-server.png?resize=800%2C600&ssl=1 -[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/raspberry-pi-imager-sd-card.png?resize=800%2C600&ssl=1 -[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/ubuntu-server-installed-raspberry-pi.png?resize=799%2C506&ssl=1 -[16]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/ubuntu-server-pi-network-config.png?resize=800%2C565&ssl=1 -[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/Ubuntu-server-wifi.png?resize=800%2C600&ssl=1 -[18]: https://itsfoss.com/turn-on-raspberry-pi/ -[19]: https://itsfoss.com/change-password-ubuntu/ -[20]: https://itsfoss.com/how-to-find-what-devices-are-connected-to-network-in-ubuntu/ -[21]: https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse -[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/ubuntu-server-change-password.png?resize=800%2C600&ssl=1 -[23]: https://itsfoss.com/install-arch-raspberry-pi/ diff --git a/translated/tech/20200909 How to Install Ubuntu Server on a Raspberry Pi.md b/translated/tech/20200909 How to Install Ubuntu Server on a Raspberry Pi.md new file mode 100644 index 0000000000..8dd702fafc --- /dev/null +++ b/translated/tech/20200909 How to Install Ubuntu Server on a Raspberry Pi.md @@ -0,0 +1,211 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Install Ubuntu Server on a Raspberry Pi) +[#]: via: (https://itsfoss.com/install-ubuntu-server-raspberry-pi/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +如何在树莓派上安装 Ubuntu 服务器? +====== + +[树莓派][1]是最著名的[单板计算机][2]。最初,树莓派项目的范围是针对促进学校和发展中国家的计算机基础科学教学。 + +它的低成本、便携性和极低的功耗,使得它的受欢迎程度远远超过预期。从气象站到家庭自动化,玩家们用树莓派搭建了许多[酷炫的项目][3]。 + +[第四代树莓派][4]具备了普通台式电脑的功能和处理能力。但本文并不是要介绍如何使用树莓派作为桌面。相反,我会告诉你如何在树莓派上安装 Ubuntu 服务器。 + +在本教程中,我将使用树莓派 4,以下是我将介绍的内容: + + * 在 microSD 卡上安装 Ubuntu 服务器 + * 在树莓派上设置无线网络连接 + * 通过 SSH 访问你的树莓派 + + + +![][5] + +**本教程需要以下东西**: + + * 一张 micro SD 卡(建议使用 8GB 或更大的卡) + * 一台带有 micro SD 卡读卡器的计算机(运行 Linux、Windows 或 macOS) + * 树莓派 2、3 或 4 + * 良好的互联网连接 + * 用于树莓派 2 和 3 的 HDMI 线和用于树莓派 4的 micro HDMI 线(可选) + * 一套 USB 键盘(可选) + + + +### 在树莓派上安装 Ubuntu 服务器 + +![][6] + +在本教程中,我使用 Ubuntu 来创建树莓派 SD 卡,但你可以在其他 Linux 发行版、macOS 和 Windows 上创建它。这是因为准备 SD 卡的步骤对 Raspberry Pi Imager 工具而言是一样的。 + +Raspberry Pi Imager 工具会自动下载你[选择树莓派系统][7]的镜像。这意味着你需要一个良好的网络连接来下载 1GB 左右的数据。 + +#### 步骤 1:用 Raspberry Pi Imager 准备 SD 卡 + +确保你已将 microSD 卡插入电脑,并在电脑上安装 Raspberry Pi Imager。 + +你可以从这些链接中下载适合你操作系统的 Imager 工具: + + * [用于 Ubuntu/Debian 的 Raspberry Pi Imager][8] + * [用于 Windows 的 Raspberry Pi Imager][9] + * [用于 MacOS 的 Raspberry Pi Imager][10] + + + + +尽管我使用的是 Ubuntu,但我不会使用上面列出的 Debian 软件包,而是使用命令行安装 snap 包。这个方法可以适用于更广泛的 Linux 发行版。 + +``` +sudo snap install rpi-imager +``` + +安装好 Raspberry Pi Imager 工具后,找到并打开它,点击 ”CHOOSE OS“ 菜单。 + +![][11] + +滚动菜单并点击 ”Ubuntu“ (核心和服务器镜像)。 + +![][12] + +从可用的镜像中,我选择了 Ubuntu 20.04 LTS 64 位。如果你有一个树莓派 2,那你只能选择 32 位镜像。 + +**重要提示:如果你使用的是最新的树莓派 4 - 8 GB 内存型号,你应该选择 64 位操作系统,否则只能使用 4 GB 内存。** + +![][13] + +从 “SD Card” 菜单中选择你的 microSD 卡,然后点击 ”WRITE“。 + +![][14] + +如果它显示一些错误,请尝试再次写入它。现在它将下载 Ubuntu 服务器镜像并将其写入 micro SD 卡。 + +当这个过程完成时,它将通知你。 + +![][15] + +#### 步骤 2:在 Ubuntu 服务器上添加 WiFi 支持 + +烧录完 micro SD 卡后,你就差不多可以使用它了。在使用它之前,有一件事情你可能想做,那就是添加 Wi-Fi 支持。 + +SD 卡仍然插入读卡器中,打开文件管理器,找到卡上的 ”system-boot” 分区。 + +你要找的和需要编辑的文件名为 `network-config`。 + +![][16] + +这个过程也可以在 Windows 和 MacOS 上完成。如前所述,编辑 **`network-config`** 文件,添加你的 Wi-Fi 凭证。 + +首先,取消矩形框内的行的注释(删除开头的标签 “#”),然后将 myhomewifi 替换为你的 Wi-Fi 网络名称。 + +之后,将 myhomewifi 替换为你的 Wi-Fi 网络名,用引号括起来,比如 ”itsfoss“,将 ”S3kr1t“ 替换为 Wi-Fi 密码,用引号括起来,比如 ”12345679“。 + +![][17] + +它可能看上去像这样: + +``` +wifis: + wlan0: + dhcp4: true + optional: true + access-points: + "your wifi name": + password: "your_wifi_password" +``` + +保存文件并将 micro SD 卡插入到你的树莓派中。在第一次启动时,如果你的树莓派无法连接到 Wi-Fi 网络,只需重启你的设备。 + +#### 步骤 3:在树莓派上使用 Ubuntu 服务器(如果你有专门的显示器、键盘和鼠标的话) + +如果你有一套额外的鼠标,键盘和显示器,你可以很容易地像其他电脑一样使用树莓派(但没有 GUI)。 + +只需将 micro SD 卡插入树莓派,连接显示器、键盘和鼠标。现在[打开你的树莓派][18]。它将出现 TTY 登录屏幕(黑色终端屏幕)并询问用户名和密码。 + + * 默认用户名:ubuntu + * 默认密码:ubuntu + + + +看到提示时,用 “**ubuntu**” 作为密码。登录成功后,[Ubuntu 会要求你更改默认密码][19]。 + +享受你的 Ubuntu 服务器吧! + +#### 步骤 3:通过 SSH 远程连接到你的树莓派(如果你没有树莓派的显示器、键盘和鼠标的话) + +如果你没有专门的显示器与树莓派一起使用也没关系。当你可以直接通过 SSH 进入它并按照你的方式使用它时,谁还需要一个带有显示器的服务器呢? + +**在 Ubuntu 和 Mac OS**上,通常已经安装了一个 SSH 客户端。要远程连接到你的树莓派,你需要发现它的 IP 地址。检查[连接到你的网络的设备][20],看看哪个是树莓派。 + +由于我没有 Windows 机器,你可以访问[微软][21]提供的综合指南。 + +打开终端,运行以下命令: + +``` +ssh [email protected]_pi_ip_address +``` + +你可能会看到以下信息确认连接: + +``` +Are you sure you want to continue connecting (yes/no/[fingerprint])? +``` + +输入 ”yes“,然后点击回车键。 + +![][22] + +当提示时,用前面提到的 ”ubuntu“ 作为密码。当然,你会被要求更改密码。 + +完成后,你将自动注销,你必须使用新密码重新连接。 + +你的 Ubuntu 服务器就可以在树莓派上运行了! + +**总结** + +在树莓派上安装 Ubuntu 服务器是一个简单的过程,而且它的预配置程度很高,使用起来很愉快。 + +我不得不说,在所有[我在树莓派上尝试的操作系统][7]中,Ubuntu 服务器是最容易安装的。我并没有夸大其词。请查看我的[在树莓派上安装 Arch Linux][23]的指南,以供参考。 + +希望这篇指南也能帮助你在树莓派上安装 Ubuntu 服务器。如果你有问题或建议,请在评论区告诉我。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-ubuntu-server-raspberry-pi/ + +作者:[Dimitrios Savvopoulos][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://www.raspberrypi.org/ +[2]: https://itsfoss.com/raspberry-pi-alternatives/ +[3]: https://itsfoss.com/raspberry-pi-projects/ +[4]: https://itsfoss.com/raspberry-pi-4/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/Ubuntu-Server-20.04.1-LTS-aarch64.png?resize=800%2C600&ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/ubuntu-server-raspberry-pi.png?resize=800%2C450&ssl=1 +[7]: https://itsfoss.com/raspberry-pi-os/ +[8]: https://downloads.raspberrypi.org/imager/imager_amd64.deb +[9]: https://downloads.raspberrypi.org/imager/imager.exe +[10]: https://downloads.raspberrypi.org/imager/imager.dmg +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/raspberry-pi-imager.png?resize=800%2C600&ssl=1 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/raspberry-pi-imager-choose-ubuntu.png?resize=800%2C600&ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/raspberry-pi-imager-ubuntu-server.png?resize=800%2C600&ssl=1 +[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/raspberry-pi-imager-sd-card.png?resize=800%2C600&ssl=1 +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/ubuntu-server-installed-raspberry-pi.png?resize=799%2C506&ssl=1 +[16]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/ubuntu-server-pi-network-config.png?resize=800%2C565&ssl=1 +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/Ubuntu-server-wifi.png?resize=800%2C600&ssl=1 +[18]: https://itsfoss.com/turn-on-raspberry-pi/ +[19]: https://itsfoss.com/change-password-ubuntu/ +[20]: https://itsfoss.com/how-to-find-what-devices-are-connected-to-network-in-ubuntu/ +[21]: https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse +[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/ubuntu-server-change-password.png?resize=800%2C600&ssl=1 +[23]: https://itsfoss.com/install-arch-raspberry-pi/ From 91ef7612449a1c1f9e9b25bc3be57a54c24bbf16 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 29 Oct 2020 08:54:01 +0800 Subject: [PATCH 0594/1156] translating --- .../tech/20201021 5 open source tools I can-t live without.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201021 5 open source tools I can-t live without.md b/sources/tech/20201021 5 open source tools I can-t live without.md index 2d5220c471..25b79f9959 100644 --- a/sources/tech/20201021 5 open source tools I can-t live without.md +++ b/sources/tech/20201021 5 open source tools I can-t live without.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 324fba9c339044abee6ec365c26b77dac1999249 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 29 Oct 2020 20:42:55 +0800 Subject: [PATCH 0595/1156] Rename sources/tech/20201028 A few things I-ve learned about email marketing.md to sources/talk/20201028 A few things I-ve learned about email marketing.md --- .../20201028 A few things I-ve learned about email marketing.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20201028 A few things I-ve learned about email marketing.md (100%) diff --git a/sources/tech/20201028 A few things I-ve learned about email marketing.md b/sources/talk/20201028 A few things I-ve learned about email marketing.md similarity index 100% rename from sources/tech/20201028 A few things I-ve learned about email marketing.md rename to sources/talk/20201028 A few things I-ve learned about email marketing.md From a008b109aa7da7051f42c3a3d43c1daed4dc8088 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 30 Oct 2020 05:01:42 +0800 Subject: [PATCH 0596/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201030?= =?UTF-8?q?=20How=20to=20Use=20apt-cache=20Command=20in=20Debian,=20Ubuntu?= =?UTF-8?q?=20and=20Other=20Linux=20Distributions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md --- ...n, Ubuntu and Other Linux Distributions.md | 167 ++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 sources/tech/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md diff --git a/sources/tech/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md b/sources/tech/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md new file mode 100644 index 0000000000..23b314319b --- /dev/null +++ b/sources/tech/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md @@ -0,0 +1,167 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions) +[#]: via: (https://itsfoss.com/apt-cache-command/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions +====== + +_**With apt-cache command, you can search for package details in the local APT cache. Learn to use apt-cache command in this tutorial.**_ + +### What is apt-cache command used for? + +The [apt][1] [package manager][2] works on a local cache of package metadata. The metadata usually consists information like package name, version, description, dependencies, its repository and developers. With the apt-cache command, you can query this local APT cache and get relevant information. + +You can search for the availability of a package, its version number, its dependencies among other things. I’ll show you how to use the apt-cache command with examples. + +The **location of APT cache** is /var/lib/apt/lists/ directory. Which repository metadata to cache depends on the repositories added in your source list in the /etc/apt/sources.list file and additional repository files located in ls /etc/apt/sources.list.d directory. + +Surprisingly, apt-cache doesn’t clear the APT cache. For that you’ll have to [use the apt-get clean command][3]. + +Needless to say, the APT packaging system is used on Debian and Debian-based Linux distributions like Ubuntu, Linux Mint, elementary OS etc. You cannot use it on Arch or Fedora. + +### Using apt-cache command + +![][4] + +Like any other Linux command, there are several options available with apt-cache and you can always refer to its man page to read about them. + +However, you probably won’t need to use all of them. This is why I am going to show you only the most common and useful examples of the apt-cache command in this tutorial. + +Always update + +It is always a good idea to update the local APT cache to sync it with the remote repositories. How do you do that? You use the command: + +**sudo apt update** + +#### Search for packages + +The most common use of apt-cache command is for finding package. You can use a regex pattern to search for a package in the local APT cache. + +``` +apt-cache search package_name +``` + +By default, it looks for the search term in both the name and description of the package. It shows the matching package along with its short description in alphabetical order. + +![][5] + +You can narrow down your search to look for the search term in package names only. + +``` +apt-cache search --names-only package_name +``` + +![][6] + +If you want complete details of all the matched packages, you may use the `--full` flag. It can also be used with `--names-only` flag. + +![][7] + +#### Get detailed package information + +If you know the exact package name (or if you have manged to find it with the search), you can get the detailed metadata information on the package. + +``` +apt-cache show package_name +``` + +![][8] + +You can see all kind of details in the package metadata like name, version, developer, maintainer, repository, short and long description, package size and even checksum. + +There is another option showpkg that displays information about the package name, version and its forward and reverse dependencies. + +``` +apt-cache showpkg package_name +``` + +#### apt-cache policy + +This is one of the rarely used option of apt-cache command. The policy options helps you debug the issue related to the [preference file][9]. + +If you specify the package name, it will show whether the package is installed, which version is available from which repository and its priority. + +![][10] + +By default, each installed package version has a priority of 100 and a non-installed package has a priority of 500. The same package may have more than one version with a different priority. APT installs the version with higher priority unless the installed version is newer. + +If this doesn’t make sense, it’s okay. It will be extremely rare for a regular Linux user to dwell this deep into package management. + +#### Check dependencies and reverse dependencies of a package + +You can [check the dependencies of a package][11] before (or even after) installing it. It also shows all the possible packages that can fulfill the dependency. + +``` +apt-cache depends package +``` + +![][12] + +You may also check which packages are dependent on a certain package by checking the reverse dependencies with apt-cahce. + +![][13] + +Frankly, I was also surprised to see that a DevOps tool like Ansible has a dependency on a [funny Linux command like Cowsay][14]. I think it’s perhaps because after [installing Ansible][15], it displays some message on the nodes. + +#### Check unmet dependencies + +You may get troubled with [unmet dependencies issue in Ubuntu][16] or other Linux. The apt-cache command provides option to check all the unmet dependencies of various available packages on your system. + +``` +apt-cache unmet +``` + +![][17] + +**Conclusion** + +You can list all available packages with the apt-cache command. The output would be huge, so I suggest combining it with [wc command][18] to get a total number of available packages like this: + +``` +apt-cache pkgnames | wc -l +``` + +Did you notice that you don’t need to be [root user][19] for using apt-cache command? + +The newer [apt command][20] has a few options available to match the features of apt-cache command. Since apt is new, apt-get and its associated commands like apt-cache are still preferred to be used in scripts. + +I hope you find this tutorial helpful. If you have questions about any point discussed above or suggestion to improve it, please let me know in the comments. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/apt-cache-command/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://wiki.debian.org/Apt +[2]: https://itsfoss.com/package-manager/ +[3]: https://itsfoss.com/clear-apt-cache/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-command.png?resize=800%2C450&ssl=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-search.png?resize=759%2C437&ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-search-names-only.png?resize=759%2C209&ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-show-full.png?resize=759%2C722&ssl=1 +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-show-pkgname.png?resize=800%2C795&ssl=1 +[9]: https://debian-handbook.info/browse/stable/sect.apt-get.html#sect.apt.priorities +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-policy.png?resize=795%2C456&ssl=1 +[11]: https://itsfoss.com/check-dependencies-package-ubuntu/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-dependency-check.png?resize=768%2C304&ssl=1 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-reverse-dependency.png?resize=768%2C304&ssl=1 +[14]: https://itsfoss.com/funny-linux-commands/ +[15]: https://linuxhandbook.com/install-ansible-linux/ +[16]: https://itsfoss.com/held-broken-packages-error/ +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-unmet.png?resize=759%2C399&ssl=1 +[18]: https://linuxhandbook.com/wc-command/ +[19]: https://itsfoss.com/root-user-ubuntu/ +[20]: https://itsfoss.com/apt-command-guide/ From dc5a538c3e018d3f4006cbcd315d4e743e0242d0 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 30 Oct 2020 05:02:01 +0800 Subject: [PATCH 0597/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201029?= =?UTF-8?q?=20Improve=20your=20database=20knowledge=20with=20this=20MariaD?= =?UTF-8?q?B=20and=20MySQL=20cheat=20sheet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md --- ...with this MariaDB and MySQL cheat sheet.md | 389 ++++++++++++++++++ 1 file changed, 389 insertions(+) create mode 100644 sources/tech/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md diff --git a/sources/tech/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md b/sources/tech/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md new file mode 100644 index 0000000000..3fd06952ce --- /dev/null +++ b/sources/tech/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md @@ -0,0 +1,389 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Improve your database knowledge with this MariaDB and MySQL cheat sheet) +[#]: via: (https://opensource.com/article/20/10/mariadb-mysql-cheat-sheet) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Improve your database knowledge with this MariaDB and MySQL cheat sheet +====== +Read this article and download our free cheat sheet to get started using +an open source database. +![Cheat Sheet cover image][1] + +When you're writing an application or configuring one for a server, eventually, you will need to store persistent information. Sometimes, a configuration file, such as an INI or [YAML][2] file will do. Other times, a custom file format designed in XML or JSON or similar is better. + +But sometimes you need something that can validate input, search through information quickly, make connections between related data, and generally handle your users' work adeptly. That's what a database is designed to do, and [MariaDB][3] (a fork of [MySQL][4] by some of its original developers) is a great option. I use MariaDB in this article, but the information applies equally to MySQL. + +It's common to interact with a database through programming languages. For this reason, there are [SQL][5] libraries for Java, Python, Lua, PHP, Ruby, C++, and many others. However, before using these libraries, it helps to have an understanding of what's happening with the database engine and why your choice of database is significant. This article introduces MariaDB and the `mysql` command to familiarize you with the basics of how a database handles data. + +If you don't have MariaDB yet, follow the instructions in my article about [installing MariaDB on Linux][6]. If you're not on Linux, use the instructions provided on the MariaDB [download page][7]. + +### Interact with MariaDB + +You can interact with MariaDB using the `mysql` command. First, verify that your server is up and running using the `ping` subcommand, entering your MariaDB password when prompted: + + +``` +$ mysqladmin -u root -p ping +Enter password: +mysqld is alive +``` + +To make exploring SQL easy, open an interactive MariaDB session: + + +``` +$ mysql -u root -p +Enter password: +Welcome to the MariaDB monitor. +Commands end with ; or \g. +[...] +Type 'help;' or '\h' for help. +Type '\c' to clear the current input statement. + +MariaDB [(none)]> +``` + +This places you in a MariaDB subshell, and your prompt is now a MariaDB prompt. Your usual Bash commands don't work here. You must use MariaDB commands. To see a list of MariaDB commands, type `help` (or just `?`). These are administrative commands for your MariaDB shell, so they're useful for customizing your shell, but they aren't part of the SQL language. + +### Learn SQL basics + +The [Structured Query Language (SQL)][8] is named after what it provides: a method to inquire about the contents of a database in a predictable and consistent syntax in order to receive useful results. SQL reads a lot like an ordinary English sentence, if a little robotic. For instance, if you've signed into a database server and you need to understand what you have to work with, type `SHOW DATABASES;` and press Enter for the results. + +SQL commands are terminated with a semicolon. If you forget the semicolon, MariaDB assumes you want to continue your query on the next line, where you can either do so or terminate the query with a semicolon. + + +``` +MariaDB [(NONE)]> SHOW DATABASES; ++--------------------+ +| DATABASE           | ++--------------------+ +| information_schema | +| mysql              | +| performance_schema | +| test               | ++--------------------+ +4 ROWS IN SET (0.000 sec) +``` + +This shows there are four databases present: information_schema, mysql, performance_schema, and test. To issue queries to a database, you must select which database you want MariaDB to use. This is done with the MariaDB command `use`. Once you choose a database, your MariaDB prompt changes to reflect the active database. + + +``` +MariaDB [(NONE)]> USE test; +MariaDB [(test)]> +``` + +#### Show database tables + +Databases contain _tables_, which can be visualized in the same way a spreadsheet is: as a series of rows (called _records_ in a database) and columns. The intersection of a row and a column is called a _field_. + +To see the tables available in a database (you can think of them as tabs in a multi-sheet spreadsheet), use the SQL keyword `SHOW` again: + + +``` +MariaDB [(test)]> SHOW TABLES; +empty SET +``` + +The `test` database doesn't have much to look at, so use the `use` command to switch to the `mysql` database. + + +``` +MariaDB [(test)]> USE mysql; +MariaDB [(mysql)]> SHOW TABLES; + ++---------------------------+ +| Tables_in_mysql           | ++---------------------------+ +| column_stats              | +| columns_priv              | +| db                        | +[...] +| time_zone_transition_type | +| transaction_registry      | +| USER                      | ++---------------------------+ +31 ROWS IN SET (0.000 sec) +``` + +There are a lot more tables in this database! The `mysql` database is the system management database for this MariaDB instance. It contains important data, including an entire user structure to manage database privileges. It's an important database, and you don't always have to interact with it directly, but it's not uncommon to manipulate it in SQL scripts. It's also useful to understand the `mysql` database when you're learning MariaDB because it can help demonstrate some basic SQL commands. + +#### Examine a table + +The last table listed in this instance's `mysql` database is titled `user`. This table contains data about users permitted to access the database. Right now, there's only a root user, but you can add other users with varying privileges to control whether each user can view, update, or create data. To get an idea of all the attributes a MariaDB user can have, you can view column headers in a table: + + +``` +> SHOW COLUMNS IN USER; +MariaDB [mysql]> SHOW COLUMNS IN USER; ++-------------+---------------+------+-----+----------+ +| FIELD       | TYPE          | NULL | KEY | DEFAULT  | ++-------------+---------------+------+-----+----------+ +| Host        | CHAR(60)      | NO   | PRI |          | +| USER        | CHAR(80)      | NO   | PRI |          | +| Password    | CHAR(41)      | NO   |     |          | +| Select_priv | enum('N','Y') | NO   |     | N        | +| Insert_priv | enum('N','Y') | NO   |     | N        | +| Update_priv | enum('N','Y') | NO   |     | N        | +| Delete_priv | enum('N','Y') | NO   |     | N        | +| Create_priv | enum('N','Y') | NO   |     | N        | +| Drop_priv   | enum('N','Y') | NO   |     | N        | +[...] +47 ROWS IN SET (0.001 sec) +``` + +#### Create a new user + +Whether you need help from a fellow human to administer a database or you're setting up a database for a computer to use (for example, in a WordPress, Drupal, or Joomla installation), it's common to need an extra user account within MariaDB. You can create a MariaDB user either by adding it to the `user` table in the `mysql` database, or you can use the SQL keyword `CREATE` to prompt MariaDB to do it for you. The latter features some helper functions so that you don't have to generate all the information manually: + + +``` +`> CREATE USER 'tux'@'localhost' IDENTIFIED BY 'really_secure_password';` +``` + +#### View table fields + +You can view fields and values in a database table with the `SELECT` keyword. In this example, you created a user called `tux`, so select the columns in the `user` table: + + +``` +> SELECT USER,host FROM USER; ++------+------------+ +| USER | host       | ++------+------------+ +| root | localhost  | +[...] +| tux  | localhost  | ++------+------------+ +7 ROWS IN SET (0.000 sec) +``` + +#### Grant privileges to a user + +By looking at the column listing on the `user` table, you can explore a user's status. For instance, the new user `tux` doesn't have permission to do anything with the database. Using the `WHERE` statement, you can view only the record for `tux`: + + +``` +> SELECT USER,select_priv,insert_priv,update_priv FROM USER WHERE USER='tux'; ++------+-------------+-------------+-------------+ +| USER | select_priv | insert_priv | update_priv | ++------+-------------+-------------+-------------+ +| tux  | N           | N           | N           | ++------+-------------+-------------+-------------+ +``` + +Use the `GRANT` command to modify user permissions: + + +``` +> GRANT SELECT ON *.* TO 'tux'@'localhost'; +> FLUSH PRIVILEGES; +``` + +Verify your change: + + +``` +> SELECT USER,select_priv,insert_priv,update_priv FROM USER WHERE USER='tux'; ++------+-------------+-------------+-------------+ +| USER | select_priv | insert_priv | update_priv | ++------+-------------+-------------+-------------+ +| tux  | Y           | N           | N           | ++------+-------------+-------------+-------------+ +``` + +User `tux` now has privileges to select records from all tables. + +### Create a custom database + +So far, you've interacted just with the default databases. Most people rarely interact much with the default databases outside of user management. Usually, you create a database and populate it with tables full of custom data. + +#### Create a MariaDB database + +You may already be able to guess how to create a new database in MariaDB. It's a lot like creating a new user: + + +``` +> CREATE DATABASE example; +Query OK, 1 ROW affected (0.000 sec) +> SHOW DATABASES; ++--------------------+ +| DATABASE           | ++--------------------+ +| example            | +[...] +``` + +Make this new database your active one with the `use` command: + + +``` +`> USE example;` +``` + +#### Create a table + +Creating a table is more complex than creating a database because you must define column headings. MariaDB provides many convenience functions for you to use when creating columns, including data type definitions, automatic incrementing options, constraints to avoid empty values, automated timestamps, and more. + +Here's a simple table to describe a set of users: + + +``` +> CREATE TABLE IF NOT EXISTS member ( +    -> id INT AUTO_INCREMENT PRIMARY KEY, +    -> name VARCHAR(128) NOT NULL, +    -> startdate TIMESTAMP DEFAULT CURRENT_TIMESTAMP); +Query OK, 0 ROWS affected (0.030 sec) +``` + +This table provides a unique identifier to each row by using an auto-increment function. It contains a field for a user's name, which cannot be empty (or `null`), and generates a timestamp when the record is created. + +Populate this table with some sample data using the `INSERT` SQL keyword: + + +``` +> INSERT INTO member (name) VALUES ('Alice'); +Query OK, 1 ROW affected (0.011 sec) +> INSERT INTO member (name) VALUES ('Bob'); +Query OK, 1 ROW affected (0.011 sec) +> INSERT INTO member (name) VALUES ('Carol'); +Query OK, 1 ROW affected (0.011 sec) +> INSERT INTO member (name) VALUES ('David'); +Query OK, 1 ROW affected (0.011 sec) +``` + +Verify the data in the table: + + +``` +> SELECT * FROM member; ++----+-------+---------------------+ +| id | name  | startdate           | ++----+-------+---------------------+ +|  1 | Alice | 2020-10-03 15:25:06 | +|  2 | Bob   | 2020-10-03 15:26:43 | +|  3 | Carol | 2020-10-03 15:26:46 | +|  4 | David | 2020-10-03 15:26:51 | ++----+-------+---------------------+ +4 ROWS IN SET (0.000 sec) +``` + +#### Add multiple rows at once + +Now create a second table: + + +``` +> CREATE TABLE IF NOT EXISTS linux ( +    -> id INT AUTO_INCREMENT PRIMARY KEY, +    -> distro VARCHAR(128) NOT NULL, +Query OK, 0 ROWS affected (0.030 sec) +``` + +Populate it with some sample data, this time using a little `VALUES` shortcut so you can add multiple rows in one command. The `VALUES` keyword expects a list in parentheses, but it can take multiple lists separated by commas: + + +``` +> INSERT INTO linux (distro) + -> VALUES ('Slackware'), ('RHEL'),('Fedora'),('Debian'); +Query OK, 4 ROWS affected (0.011 sec) +Records: 4  Duplicates: 0  Warnings: 0 +> SELECT * FROM linux; ++----+-----------+ +| id | distro    | ++----+-----------+ +|  1 | Slackware | +|  2 | RHEL      | +|  3 | Fedora    | +|  4 | Debian    | ++----+-----------+ +``` + +### Create relationships between tables + +You now have two tables, but there's no relationship between them. They each contain independent data, but you might need to associate a member of the first table to a specific item listed in the second. + +To do that, you can create a new column for the first table that corresponds to something in the second. Because both tables were designed with unique identifiers (the auto-incrementing `id` field), the easiest way to connect them is to use the `id` field of one as a selector for the other. + +Create a new column in the first table to represent a value in the second table: + + +``` +> ALTER TABLE member ADD COLUMN (os INT); +Query OK, 0 ROWS affected (0.012 sec) +Records: 0  Duplicates: 0  Warnings: 0 +> DESCRIBE member; +DESCRIBE member; ++-----------+--------------+------+-----+---------+------+ +| FIELD     | TYPE         | NULL | KEY | DEFAULT | Extra| ++-----------+--------------+------+-----+---------+------+ +| id        | INT(11)      | NO   | PRI | NULL    | auto_| +| name      | VARCHAR(128) | NO   |     | NULL    |      | +| startdate | TIMESTAMP    | NO   |     | cur[...]|      | +| os        | INT(11)      | YES  |     | NULL    |      | ++-----------+--------------+------+-----+---------+------+ +``` + +Using the unique IDs of the `linux` table, assign a distribution to each member. Because the records already exist, use the `UPDATE` SQL keyword rather than `INSERT`. Specifically, you want to select one row and then update the value of one column. Syntactically, this is expressed a little in reverse, with the update happening first and the selection matching last: + + +``` +> UPDATE member SET os=1 WHERE name='Alice'; +Query OK, 1 ROW affected (0.007 sec) +ROWS matched: 1  Changed: 1  Warnings: 0 +``` + +Repeat this process for the other names in the `member` table to populate it with data. For variety, assign three different distributions across the four rows (doubling up on one). + +#### Join tables + +Now that these two tables relate to one another, you can use SQL to display the associated data. There are many kinds of joins in databases, and you can try them all once you know the basics. Here's a basic join to correlate the values found in the `os` field of the `member` table to the `id` field of the `linux` table: + + +``` +SELECT * FROM member JOIN linux ON member.os=linux.id; ++----+-------+---------------------+------+----+-----------+ +| id | name  | startdate           | os   | id | distro    | ++----+-------+---------------------+------+----+-----------+ +|  1 | Alice | 2020-10-03 15:25:06 |    1 |  1 | Slackware | +|  2 | Bob   | 2020-10-03 15:26:43 |    3 |  3 | Fedora    | +|  4 | David | 2020-10-03 15:26:51 |    3 |  3 | Fedora    | +|  3 | Carol | 2020-10-03 15:26:46 |    4 |  4 | Debian    | ++----+-------+---------------------+------+----+-----------+ +4 ROWS IN SET (0.000 sec) +``` + +The `os` and `id` fields form the join. + +In a graphical application, you can imagine that the `os` field might be set by a drop-down menu, the values for which are drawn from the contents of the `distro` field of the `linux` table. By using separate tables for unique but related sets of data, you ensure the consistency and validity of data, and thanks to SQL, you can associate them dynamically later. + +### [Download the MariaDB and MySQL cheat sheet][9] + +MariaDB is an enterprise-grade database. It's designed and proven to be a robust, powerful, and fast database engine. Learning it is a great step toward using it to do things like managing web applications or programming language libraries. As a quick reference when you're using MariaDB, [download our MariaDB and MySQL cheat sheet][9]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/mariadb-mysql-cheat-sheet + +作者:[Seth Kenlon][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://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coverimage_cheat_sheet.png?itok=lYkNKieP (Cheat Sheet cover image) +[2]: https://www.redhat.com/sysadmin/yaml-tips +[3]: https://mariadb.org/ +[4]: https://www.mysql.com/ +[5]: https://en.wikipedia.org/wiki/SQL +[6]: https://opensource.com/article/20/10/install-mariadb-and-mysql-linux +[7]: https://mariadb.org/download +[8]: https://publications.opengroup.org/c449 +[9]: https://opensource.com/downloads/mariadb-mysql-cheat-sheet From 2a2058642bf175a70d27f6f64571ddd779bbe6b4 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 30 Oct 2020 05:02:17 +0800 Subject: [PATCH 0598/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201029?= =?UTF-8?q?=20Managing=20resources=20with=20cgroups=20in=20systemd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201029 Managing resources with cgroups in systemd.md --- ...aging resources with cgroups in systemd.md | 369 ++++++++++++++++++ 1 file changed, 369 insertions(+) create mode 100644 sources/tech/20201029 Managing resources with cgroups in systemd.md diff --git a/sources/tech/20201029 Managing resources with cgroups in systemd.md b/sources/tech/20201029 Managing resources with cgroups in systemd.md new file mode 100644 index 0000000000..5cb7f5c8c8 --- /dev/null +++ b/sources/tech/20201029 Managing resources with cgroups in systemd.md @@ -0,0 +1,369 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Managing resources with cgroups in systemd) +[#]: via: (https://opensource.com/article/20/10/cgroups) +[#]: author: (David Both https://opensource.com/users/dboth) + +Managing resources with cgroups in systemd +====== +Cgroups manage resources per application rather than by the individual +processes that make up an application. +![Business woman on laptop sitting in front of window][1] + +There is little more frustrating to me as a sysadmin than unexpectedly running out of a computing resource. On more than one occasion, I have filled all available disk space in a partition, run out of RAM, and not had enough CPU time to perform my tasks in a reasonable amount of time. Resource management is one of the most important tasks that sysadmins do. + +The point of resource management is to ensure that all processes have relatively equal access to the system resources they need. Resource management also involves ensuring that RAM, hard drive space, and CPU capacity are added when necessary or rationed when that is not possible. In addition, users who hog system resources, whether intentionally or accidentally, should be prevented from doing so. + +There are tools that enable sysadmins to monitor and manage various system resources. For example, [top][2] and similar tools allow you to monitor the use of memory, I/O, storage (disk, SSD, etc.), network, swap space, CPU usage, and more. These tools, particularly those that are CPU-centric, are mostly based on the paradigm that the running process is the unit of control. At best, they provide a way to adjust the nice number–and through that, the priority—or to kill a running process. (For information about nice numbers, see [_Monitoring Linux and Windows hosts with Glances_][3].) + +Other tools based on traditional resource management in a SystemV environment are managed by the `/etc/security/limits.conf` file and the local configuration files located in the `/etc/security/limits.d` directory. Resources can be limited in a fairly crude but useful manner by user or group. Resources that can be managed include various aspects of RAM, total CPU time per day, total amount of data, priority, nice number, number of concurrent logins, number of processes, maximum file size, and more. + +### Using cgroups for process management + +One major difference between [systemd and SystemV][4] is how they handle processes. SystemV treats each process as an entity unto itself. systemd collects related processes into control groups, called [cgroups][5] (short for control groups), and manages system resources for the cgroup as a whole. This means resources can be managed per application rather than by the individual processes that make up an application. + +The control units for cgroups are called slice units. Slices are a conceptualization that allows systemd to order processes in a tree format for ease of management. + +### Viewing cgroups + +I'll start with some commands that allow you to view various types of information about cgroups. The `systemctl status ` command displays slice information about a specified service, including its slice. This example shows the `at` daemon: + + +``` +[root@testvm1 ~]# systemctl status atd.service +● atd.service - Deferred execution scheduler +     Loaded: loaded (/usr/lib/systemd/system/atd.service; enabled; vendor preset: enabled) +     Active: active (running) since Wed 2020-09-23 12:18:24 EDT; 1 day 3h ago +       Docs: man:atd(8) +   Main PID: 1010 (atd) +      Tasks: 1 (limit: 14760) +     Memory: 440.0K +        CPU: 5ms +     CGroup: /system.slice/atd.service +             └─1010 /usr/sbin/atd -f + +Sep 23 12:18:24 testvm1.both.org systemd[1]: Started Deferred execution scheduler. +[root@testvm1 ~]# +``` + +This is an excellent example of one reason that I find systemd more usable than SystemV and the old init program. There is so much more information here than SystemV could provide. The cgroup entry includes the hierarchical structure where the `system.slice` is systemd (PID 1), and the `atd.service` is one level below and part of the `system.slice`. The second line of the cgroup entry also shows the process ID (PID) and the command used to start the daemon. + +The `systemctl` command shows multiple cgroup entries. The `--all` option shows all slices, including those that are not currently active: + + +``` +[root@testvm1 ~]# systemctl -t slice --all +  UNIT                             LOAD   ACTIVE   SUB    DESCRIPTION                     +  -.slice                          loaded active   active Root Slice                       +  system-getty.slice               loaded active   active system-getty.slice               +  system-lvm2\x2dpvscan.slice      loaded active   active system-lvm2\x2dpvscan.slice     +  system-modprobe.slice            loaded active   active system-modprobe.slice           +  system-sshd\x2dkeygen.slice      loaded active   active system-sshd\x2dkeygen.slice     +  system-systemd\x2dcoredump.slice loaded inactive dead   system-systemd\x2dcoredump.slice +  system-systemd\x2dfsck.slice     loaded active   active system-systemd\x2dfsck.slice     +  system.slice                     loaded active   active System Slice                     +  user-0.slice                     loaded active   active User Slice of UID 0             +  user-1000.slice                  loaded active   active User Slice of UID 1000           +  user.slice                       loaded active   active User and Session Slice           + +LOAD   = Reflects whether the unit definition was properly loaded. +ACTIVE = The high-level unit activation state, i.e. generalization of SUB. +SUB    = The low-level unit activation state, values depend on unit type. + +11 loaded units listed. +To show all installed unit files use 'systemctl list-unit-files'. +[root@testvm1 ~]# +``` + +The first thing to notice about this data is that it shows user slices for UIDs 0 (root) and 1000, which is my user login. This shows only the slices and not the services that are part of each slice. This data shows that a slice is created for each user at the time they log in. This can provide a way to manage all of a user's tasks as a single cgroup entity. + +### Explore the cgroup hierarchy + +All is well and good so far, but cgroups are hierarchical, and all of the service units run as members of one of the cgroups. Viewing that hierarchy is easy and uses one old command and one new one that is part of systemd. + +The `ps` command can be used to map the processes and their locations in the cgroup hierarchy. Note that it is necessary to specify the desired data columns when using the `ps` command. I significantly reduced the volume of output from this command below, but I tried to leave enough so you can get a feel for what you might find on your systems: + + +``` +[root@testvm1 ~]# ps xawf -eo pid,user,cgroup,args +    PID USER     CGROUP                      COMMAND +      2 root     -                           [kthreadd] +      3 root     -                            \\_ [rcu_gp] +      4 root     -                            \\_ [rcu_par_gp] +      6 root     -                            \\_ [kworker/0:0H-kblockd] +      9 root     -                            \\_ [mm_percpu_wq] +     10 root     -                            \\_ [ksoftirqd/0] +     11 root     -                            \\_ [rcu_sched] +     12 root     -                            \\_ [migration/0] +     13 root     -                            \\_ [cpuhp/0] +     14 root     -                            \\_ [cpuhp/1] +<SNIP> + 625406 root     -                            \\_ [kworker/3:0-ata_sff] + 625409 root     -                            \\_ [kworker/u8:0-events_unbound] +      1 root     0::/init.scope              /usr/lib/systemd/systemd --switched-root --system --deserialize 30 +    588 root     0::/system.slice/systemd-jo /usr/lib/systemd/systemd-journald +    599 root     0::/system.slice/systemd-ud /usr/lib/systemd/systemd-udevd +    741 root     0::/system.slice/auditd.ser /sbin/auditd +    743 root     0::/system.slice/auditd.ser  \\_ /usr/sbin/sedispatch +    764 root     0::/system.slice/ModemManag /usr/sbin/ModemManager +    765 root     0::/system.slice/NetworkMan /usr/sbin/NetworkManager --no-daemon +    767 root     0::/system.slice/irqbalance /usr/sbin/irqbalance --foreground +    779 root     0::/system.slice/mcelog.ser /usr/sbin/mcelog --ignorenodev --daemon --foreground +    781 root     0::/system.slice/rngd.servi /sbin/rngd -f +    782 root     0::/system.slice/rsyslog.se /usr/sbin/rsyslogd -n +<SNIP> +    893 root     0::/system.slice/sshd.servi sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups +   1130 root     0::/user.slice/user-0.slice  \\_ sshd: root [priv] +   1147 root     0::/user.slice/user-0.slice  |   \\_ sshd: root@pts/0 +   1148 root     0::/user.slice/user-0.slice  |       \\_ -bash +   1321 root     0::/user.slice/user-0.slice  |           \\_ screen +   1322 root     0::/user.slice/user-0.slice  |               \\_ SCREEN +   1323 root     0::/user.slice/user-0.slice  |                   \\_ /bin/bash + 498801 root     0::/user.slice/user-0.slice  |                   |   \\_ man systemd.resource-control + 498813 root     0::/user.slice/user-0.slice  |                   |       \\_ less +   1351 root     0::/user.slice/user-0.slice  |                   \\_ /bin/bash + 123293 root     0::/user.slice/user-0.slice  |                   |   \\_ man systemd.slice + 123305 root     0::/user.slice/user-0.slice  |                   |       \\_ less +   1380 root     0::/user.slice/user-0.slice  |                   \\_ /bin/bash + 625412 root     0::/user.slice/user-0.slice  |                   |   \\_ ps xawf -eo pid,user,cgroup,args + 625413 root     0::/user.slice/user-0.slice  |                   |   \\_ less + 246795 root     0::/user.slice/user-0.slice  |                   \\_ /bin/bash + 625338 root     0::/user.slice/user-0.slice  |                       \\_ /usr/bin/mc -P /var/tmp/mc-root/mc.pwd.246795 + 625340 root     0::/user.slice/user-0.slice  |                           \\_ bash -rcfile .bashrc +   1218 root     0::/user.slice/user-1000.sl  \\_ sshd: dboth [priv] +   1233 dboth    0::/user.slice/user-1000.sl      \\_ sshd: dboth@pts/1 +   1235 dboth    0::/user.slice/user-1000.sl          \\_ -bash +<SNIP> +   1010 root     0::/system.slice/atd.servic /usr/sbin/atd -f +   1011 root     0::/system.slice/crond.serv /usr/sbin/crond -n +   1098 root     0::/system.slice/lxdm.servi /usr/sbin/lxdm-binary +   1106 root     0::/system.slice/lxdm.servi  \\_ /usr/libexec/Xorg -background none :0 vt01 -nolisten tcp -novtswitch -auth /var/run/lxdm/lxdm-:0.auth + 370621 root     0::/user.slice/user-1000.sl  \\_ /usr/libexec/lxdm-session + 370631 dboth    0::/user.slice/user-1000.sl      \\_ xfce4-session + 370841 dboth    0::/user.slice/user-1000.sl          \\_ /usr/bin/ssh-agent /bin/sh -c exec -l bash -c "/usr/bin/startxfce4" + 370911 dboth    0::/user.slice/user-1000.sl          \\_ xfwm4 --display :0.0 --sm-client-id 2dead44ab-0b4d-4101-bca4-e6771f4a8ac2 + 370930 dboth    0::/user.slice/user-1000.sl          \\_ xfce4-panel --display :0.0 --sm-client-id 2ce38b8ef-86fd-4189-ace5-deec1d0e0952 + 370942 dboth    0::/user.slice/user-1000.sl          |   \\_ /usr/lib64/xfce4/panel/wrapper-2.0 /usr/lib64/xfce4/panel/plugins/libsystray.so 6 23068680 systr +ay Notification Area Area where notification icons appear + 370943 dboth    0::/user.slice/user-1000.sl          |   \\_ /usr/lib64/xfce4/panel/wrapper-2.0 /usr/lib64/xfce4/panel/plugins/libpulseaudio-plugin.so 8 2306 +8681 pulseaudio PulseAudio Plugin Adjust the audio volume of the PulseAudio sound system + 370944 dboth    0::/user.slice/user-1000.sl          |   \\_ /usr/lib64/xfce4/panel/wrapper-2.0 /usr/lib64/xfce4/panel/plugins/libxfce4powermanager.so 9 2306 +8682 power-manager-plugin Power Manager Plugin Display the battery levels of your devices and control the brightness of your display + 370945 dboth    0::/user.slice/user-1000.sl          |   \\_ /usr/lib64/xfce4/panel/wrapper-2.0 /usr/lib64/xfce4/panel/plugins/libnotification-plugin.so 10 2 +3068683 notification-plugin Notification Plugin Notification plugin for the Xfce panel + 370948 dboth    0::/user.slice/user-1000.sl          |   \\_ /usr/lib64/xfce4/panel/wrapper-2.0 /usr/lib64/xfce4/panel/plugins/libactions.so 14 23068684 acti +ons Action Buttons Log out, lock or other system actions + 370934 dboth    0::/user.slice/user-1000.sl          \\_ Thunar --sm-client-id 2cfc809d8-4e1d-497a-a5c5-6e4fa509c3fb --daemon + 370939 dboth    0::/user.slice/user-1000.sl          \\_ xfdesktop --display :0.0 --sm-client-id 299be0608-4dca-4055-b4d6-55ec6e73a324 + 370962 dboth    0::/user.slice/user-1000.sl          \\_ nm-applet +<SNIP> +``` + +You can view the entire hierarchy with the `systemd-cgls` command, which is a bit simpler because it does not require any complex options. + +I have shortened this tree view considerably. as well, but I left enough to give you some idea of the amount of data as well as the types of entries you should see when you do this on your system. I did this on one of my virtual machines, and it is about 200 lines long; the amount of data from my primary workstation is about 250 lines: + + +``` +[root@testvm1 ~]# systemd-cgls +Control group /: +-.slice +├─user.slice +│ ├─user-0.slice +│ │ ├─session-1.scope +│ │ │ ├─  1130 sshd: root [priv] +│ │ │ ├─  1147 sshd: root@pts/0 +│ │ │ ├─  1148 -bash +│ │ │ ├─  1321 screen +│ │ │ ├─  1322 SCREEN +│ │ │ ├─  1323 /bin/bash +│ │ │ ├─  1351 /bin/bash +│ │ │ ├─  1380 /bin/bash +│ │ │ ├─123293 man systemd.slice +│ │ │ ├─123305 less +│ │ │ ├─246795 /bin/bash +│ │ │ ├─371371 man systemd-cgls +│ │ │ ├─371383 less +│ │ │ ├─371469 systemd-cgls +│ │ │ └─371470 less +│ │ └─[user@0.service][6] … +│ │   ├─dbus-broker.service +│ │   │ ├─1170 /usr/bin/dbus-broker-launch --scope user +│ │   │ └─1171 dbus-broker --log 4 --controller 12 --machine-id 3bccd1140fca488187f8a1439c832f07 --max-bytes 100000000000000 --max-fds 25000000000000 --max-> +│ │   ├─gvfs-daemon.service +│ │   │ └─1173 /usr/libexec/gvfsd +│ │   └─init.scope +│ │     ├─1137 /usr/lib/systemd/systemd --user +│ │     └─1138 (sd-pam) +│ └─user-1000.slice +│   ├─[user@1000.service][7] … +│   │ ├─dbus\x2d:1.2\x2dorg.xfce.Xfconf.slice +│   │ │ └─dbus-:[1.2-org.xfce.Xfconf@0.service][8] +│   │ │   └─370748 /usr/lib64/xfce4/xfconf/xfconfd +│   │ ├─dbus\x2d:1.2\x2dca.desrt.dconf.slice +│   │ │ └─dbus-:[1.2-ca.desrt.dconf@0.service][9] +│   │ │   └─371262 /usr/libexec/dconf-service +│   │ ├─dbus-broker.service +│   │ │ ├─1260 /usr/bin/dbus-broker-launch --scope user +│   │ │ └─1261 dbus-broker --log 4 --controller 11 --machine-id +<SNIP> +│   │ └─gvfs-mtp-volume-monitor.service +│   │   └─370987 /usr/libexec/gvfs-mtp-volume-monitor +│   ├─session-3.scope +│   │ ├─1218 sshd: dboth [priv] +│   │ ├─1233 sshd: dboth@pts/1 +│   │ └─1235 -bash +│   └─session-7.scope +│     ├─370621 /usr/libexec/lxdm-session +│     ├─370631 xfce4-session +│     ├─370805 /usr/bin/VBoxClient --clipboard +│     ├─370806 /usr/bin/VBoxClient --clipboard +│     ├─370817 /usr/bin/VBoxClient --seamless +│     ├─370818 /usr/bin/VBoxClient --seamless +│     ├─370824 /usr/bin/VBoxClient --draganddrop +│     ├─370825 /usr/bin/VBoxClient --draganddrop +│     ├─370841 /usr/bin/ssh-agent /bin/sh -c exec -l bash -c "/usr/bin/startxfce4" +│     ├─370910 /bin/gpg-agent --sh --daemon --write-env-file /home/dboth/.cache/gpg-agent-info +│     ├─370911 xfwm4 --display :0.0 --sm-client-id 2dead44ab-0b4d-4101-bca4-e6771f4a8ac2 +│     ├─370923 xfsettingsd --display :0.0 --sm-client-id 261b4a437-3029-461c-9551-68c2c42f4fef +│     ├─370930 xfce4-panel --display :0.0 --sm-client-id 2ce38b8ef-86fd-4189-ace5-deec1d0e0952 +│     ├─370934 Thunar --sm-client-id 2cfc809d8-4e1d-497a-a5c5-6e4fa509c3fb --daemon +│     ├─370939 xfdesktop --display :0.0 --sm-client-id 299be0608-4dca-4055-b4d6-55ec6e73a324 +<SNIP> +└─system.slice +  ├─rngd.service +  │ └─1650 /sbin/rngd -f +  ├─irqbalance.service +  │ └─1631 /usr/sbin/irqbalance --foreground +  ├─fprintd.service +  │ └─303383 /usr/libexec/fprintd +  ├─systemd-udevd.service +  │ └─956 /usr/lib/systemd/systemd-udevd +<SNIP> +  ├─systemd-journald.service +  │ └─588 /usr/lib/systemd/systemd-journald +  ├─atd.service +  │ └─1010 /usr/sbin/atd -f +  ├─system-dbus\x2d:1.10\x2dorg.freedesktop.problems.slice +  │ └─dbus-:[1.10-org.freedesktop.problems@0.service][10] +  │   └─371197 /usr/sbin/abrt-dbus -t133 +  ├─sshd.service +  │ └─893 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups +  ├─vboxservice.service +  │ └─802 /usr/sbin/VBoxService -f +  ├─crond.service +  │ └─1011 /usr/sbin/crond -n +  ├─NetworkManager.service +  │ └─765 /usr/sbin/NetworkManager --no-daemon +  ├─switcheroo-control.service +  │ └─787 /usr/libexec/switcheroo-control + <SNIP> +``` + +This tree view shows all of the user and system slices and the services and programs running in each cgroup. Notice the units called "scopes," which group related programs into a management unit, within the `user-1000.slice` in the listing above. The `user-1000.slice/session-7.scope` cgroup contains the GUI desktop program hierarchy, starting with the LXDM display manager session and all of its subtasks, including things like the Bash shell and the Thunar GUI file manager. + +Scope units are not defined in configuration files but are generated programmatically as the result of starting groups of related programs. Scope units do not create or start the processes running as part of that cgroup. All processes within the scope are equal, and there is no internal hierarchy. The life of a scope begins when the first process is created and ends when the last process is destroyed. + +Open several windows on your desktop, such as terminal emulators, LibreOffice, or whatever you want, then switch to an available virtual console and start something like `top` or [Midnight Commander][11]. Run the `systemd-cgls` command on your host, and take note of the overall hierarchy and the scope units. + +The `systemd-cgls` command provides a more complete representation of the cgroup hierarchy (and details of the units that make it up) than any other command I have found. I prefer its cleaner representation of the tree than what the `ps` command provides. + +### With a little help from my friends + +After covering these basics, I had planned to go into more detail about cgroups and how to use them, but I discovered a series of four excellent articles by Red Hat's [Steve Ovens][12] on Opensource.com's sister site [Enable Sysadmin][13]. Rather then basically rewriting Steve's articles, I decided it would be much better to take advantage of his cgroup expertise by linking to them: + + 1. [A Linux sysadmin's introduction to cgroups][14] + 2. [How to manage cgroups with CPUShares][15] + 3. [Managing cgroups the hard way—manually][16] + 4. [Managing cgroups with systemd][17] + + + +Enjoy and learn from them, as I did. + +### Other resources + +There is a great deal of information about systemd available on the internet, but much is terse, obtuse, or even misleading. In addition to the resources mentioned in this article, the following webpages offer more detailed and reliable information about systemd startup. This list has grown since I started this series of articles to reflect the research I have done. + + * The Fedora Project has a good, practical [guide][18] [to systemd][18]. It has pretty much everything you need to know in order to configure, manage, and maintain a Fedora computer using systemd. + * The Fedora Project also has a good [cheat sheet][19] that cross-references the old SystemV commands to comparable systemd ones. + * The [systemd.unit(5) manual page][20] contains a nice list of unit file sections and their configuration options along with concise descriptions of each. + * Red Hat documentation contains a good description of the [Unit file structure][21] as well as other important information. + * For detailed technical information about systemd and the reasons for creating it, check out Freedesktop.org's [description of systemd][22]. This page is one of the best I have found because it contains many links to other important and accurate documentation. + * Linux.com's "More systemd fun" offers more advanced systemd [information and tips][23]. + * See the man page for [systemd.resource-control(5)][24]. + * In [_The Linux kernel user's and administrator's guide_][25], see the [Control Group v2][26] entry. + + + +There is also a series of deeply technical articles for Linux sysadmins by Lennart Poettering, the designer and primary developer of systemd. These articles were written between April 2010 and September 2011, but they are just as relevant now as they were then. Much of everything else good that has been written about systemd and its ecosystem is based on these papers. + + * [Rethinking PID 1][27] + * [systemd for Administrators, Part I][28] + * [systemd for Administrators, Part II][29] + * [systemd for Administrators, Part III][30] + * [systemd for Administrators, Part IV][31] + * [systemd for Administrators, Part V][32] + * [systemd for Administrators, Part VI][33] + * [systemd for Administrators, Part VII][34] + * [systemd for Administrators, Part VIII][35] + * [systemd for Administrators, Part IX][36] + * [systemd for Administrators, Part X][37] + * [systemd for Administrators, Part XI][38] + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/cgroups + +作者:[David Both][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://opensource.com/users/dboth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating) +[2]: https://en.wikipedia.org/wiki/Top_(software) +[3]: https://opensource.com/article/19/11/monitoring-linux-glances +[4]: https://opensource.com/article/20/4/systemd +[5]: https://en.wikipedia.org/wiki/Cgroups +[6]: mailto:user@0.service +[7]: mailto:user@1000.service +[8]: mailto:1.2-org.xfce.Xfconf@0.service +[9]: mailto:1.2-ca.desrt.dconf@0.service +[10]: mailto:1.10-org.freedesktop.problems@0.service +[11]: https://midnight-commander.org/ +[12]: https://www.redhat.com/sysadmin/users/steve-ovens +[13]: https://www.redhat.com/sysadmin/ +[14]: https://www.redhat.com/sysadmin/cgroups-part-one +[15]: https://www.redhat.com/sysadmin/cgroups-part-two +[16]: https://www.redhat.com/sysadmin/cgroups-part-three +[17]: https://www.redhat.com/sysadmin/cgroups-part-four +[18]: https://docs.fedoraproject.org/en-US/quick-docs/understanding-and-administering-systemd/index.html +[19]: https://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet +[20]: https://man7.org/linux/man-pages/man5/systemd.unit.5.html +[21]: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_basic_system_settings/managing-services-with-systemd_configuring-basic-system-settings#Managing_Services_with_systemd-Unit_File_Structure +[22]: https://www.freedesktop.org/wiki/Software/systemd/ +[23]: https://www.linux.com/training-tutorials/more-systemd-fun-blame-game-and-stopping-services-prejudice/ +[24]: https://man7.org/linux/man-pages/man5/systemd.resource-control.5.html +[25]: https://www.kernel.org/doc/html/latest/admin-guide/index.html +[26]: https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html +[27]: http://0pointer.de/blog/projects/systemd.html +[28]: http://0pointer.de/blog/projects/systemd-for-admins-1.html +[29]: http://0pointer.de/blog/projects/systemd-for-admins-2.html +[30]: http://0pointer.de/blog/projects/systemd-for-admins-3.html +[31]: http://0pointer.de/blog/projects/systemd-for-admins-4.html +[32]: http://0pointer.de/blog/projects/three-levels-of-off.html +[33]: http://0pointer.de/blog/projects/changing-roots +[34]: http://0pointer.de/blog/projects/blame-game.html +[35]: http://0pointer.de/blog/projects/the-new-configuration-files.html +[36]: http://0pointer.de/blog/projects/on-etc-sysinit.html +[37]: http://0pointer.de/blog/projects/instances.html +[38]: http://0pointer.de/blog/projects/inetd.html From 6973e839acd5287f0218f8daefba357796f4a842 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 30 Oct 2020 08:43:08 +0800 Subject: [PATCH 0599/1156] translating --- ...201026 ninja- a simple way to do builds.md | 117 ------------------ ...201026 ninja- a simple way to do builds.md | 117 ++++++++++++++++++ 2 files changed, 117 insertions(+), 117 deletions(-) delete mode 100644 sources/tech/20201026 ninja- a simple way to do builds.md create mode 100644 translated/tech/20201026 ninja- a simple way to do builds.md diff --git a/sources/tech/20201026 ninja- a simple way to do builds.md b/sources/tech/20201026 ninja- a simple way to do builds.md deleted file mode 100644 index b56fbaf7e4..0000000000 --- a/sources/tech/20201026 ninja- a simple way to do builds.md +++ /dev/null @@ -1,117 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (ninja: a simple way to do builds) -[#]: via: (https://jvns.ca/blog/2020/10/26/ninja--a-simple-way-to-do-builds/) -[#]: author: (Julia Evans https://jvns.ca/) - -ninja: a simple way to do builds -====== - -Hello! Every so often I find a new piece of software I really like, and today I want to talk about one of my recent favourites: [ninja][1]! - -### incremental builds are useful - -I do a lot of small projects where I want to set up incremental builds – for example, right now I’m writing a zine about bash, and I have one `.svg` file for each page of the zine. I need to convert the SVGs to PDFs, and I’d been doing it something like this: - -``` -for i in *.svg -do - svg2pdf $i $i.pdf # or ${i/.svg/.pdf} if you want to get really fancy -done -``` - -This works fine, but my `svg2pdf` script is a little slow (it uses Inkscape), and it’s annoying to have to wait 90 seconds or whatever to rebuild all the PDFs when I’ve just updated 1 page. - -### build systems are confusing - -In the past I’ve been pretty put off by using a Build System like make or bazel for my small projects because bazel is this Big Complicated Thing and `make` feels a little arcane to me. I don’t really know how to use either of them. - -So for a long time I’ve just written a bash script or something for my builds and resigned myself to just waiting for a minute sometimes. - -### ninja is an EXTREMELY SIMPLE build system - -But ninja is not complicated! Here is literally everything I know about ninja build file syntax: how to create a `rule` and a `build`: - -a `rule` has a command and description (the description is just for humans to read so you can tell what it’s doing when it’s building your code) - -``` -rule svg2pdf - command = inkscape $in --export-text-to-path --export-pdf=$out - description = svg2pdf $in $out -``` - -the syntax for `build` is `build output_file: rule_name input_files`. Here’s one using the `svg2pdf` rule. The output goes in `$out` in the rule and the input goes in `$in`. - -``` -build pdfs/variables.pdf: svg2pdf variables.svg -``` - -That’s it! If you put those two things in a file called `build.ninja` and then run `ninja`, ninja will run `inkscape variables.svg --export-text-to-path --export-pdf=pdfs/variables.pdf`. And then if you run it again, it won’t run anything (because it can tell that you’ve already built `pdfs/variables.pdf` and you’re up to date) - -Ninja has a few more features than this (see [the manual][2]), but I haven’t used them yet. It was originally built [for Chromium][3], so even with a small feature set it can support large builds. - -### ninja files are usually automatically generated - -The magic of ninja is that instead of having to use some confusing Build Language that’s hard to remember because you use it so infrequently (like make), instead the ninja language is SUPER simple, and if you want to do something complicated then you just generate the build file you want using any programming language you want. - -I like to make a `build.py` file or that looks something like this, that creates the ninja build file and then runs `ninja`: - -``` -with open('build.ninja', 'w') as ninja_file: - # write some rules - ninja_file.write(""" -rule svg2pdf - command = inkscape $in --export-text-to-path --export-pdf=$out - description = svg2pdf $in $out -""") - - # some for loop with every file I need to build - for filename in things_to_convert: - ninja_file.write(f""" -build {filename.replace('svg', 'pdf')}: svg2pdf {filename} -""") - -# run ninja -import subprocess -subprocess.check_call(['ninja']) -``` - -I’m sure there are a bunch of ninja best practices, but I don’t know them and for my small projects I find this works well. - -### meson is a build system that generates ninja files - -I don’t know too much about [Meson][4] yet, but recently I was building a C program ([plocate][5], a faster alternative to `locate`) and I noticed that instead of the usual `./configure; make; make install`, there were different build instructions: - -``` -meson builddir -cd builddir -ninja -``` - -It seems like Meson is a build system for C/C++/Java/Rust/Fortran that can use ninja as a backend. - -### that’s all! - -I’ve been using ninja for a few months now. I really like it and it’s caused me approximately 0 build-related headaches which feels pretty magical to me. - --------------------------------------------------------------------------------- - -via: https://jvns.ca/blog/2020/10/26/ninja--a-simple-way-to-do-builds/ - -作者:[Julia Evans][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://jvns.ca/ -[b]: https://github.com/lujun9972 -[1]: https://ninja-build.org/ -[2]: https://ninja-build.org/manual.html -[3]: http://neugierig.org/software/chromium/notes/2011/02/ninja.html -[4]: https://mesonbuild.com/Tutorial.html -[5]: https://blog.sesse.net/blog/tech/2020-09-28-00-37_introducing_plocate diff --git a/translated/tech/20201026 ninja- a simple way to do builds.md b/translated/tech/20201026 ninja- a simple way to do builds.md new file mode 100644 index 0000000000..dcfe386a3f --- /dev/null +++ b/translated/tech/20201026 ninja- a simple way to do builds.md @@ -0,0 +1,117 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (ninja: a simple way to do builds) +[#]: via: (https://jvns.ca/blog/2020/10/26/ninja--a-simple-way-to-do-builds/) +[#]: author: (Julia Evans https://jvns.ca/) + +ninja:一个简单的构建方式 +====== + +大家好!每隔一段时间,我就会发现一款我非常喜欢的新软件,今天我想说说我最近喜欢的一款软件:[ninja][1]! + +### 增量构建很有用 + +我做了很多小项目,在这些项目中,我想设置增量构建。例如,现在我正在写一本关于 bash 的杂志,杂志的每一页都有一个 `.svg`文件。我需要将 SVG 转换为 PDF,我的做法是这样的: + +``` +for i in *.svg +do + svg2pdf $i $i.pdf # or ${i/.svg/.pdf} if you want to get really fancy +done +``` + +这很好用,但是我的 `svg2pdf` 脚本有点慢(它使用 Inkscape),而且当我刚刚只更新了一页的时候,必须等待 90 秒或者其他什么时间来重建所有的 PDF 文件,这很烦人。 + +### 构建系统是让人困惑的 + +在过去,我对使用 make 或 bazel 这样的构建系统来做我的小项目一直很反感,因为 bazel 是个大而复杂的东西,而 `make` 对我来说感觉有点神秘。我真的不知道如何使用它们中的任何一个。 + +所以很长时间以来,我只是写了一个 bash 脚本或者其他的东西来进行构建,然后就认命了,有时候只能等一分钟。 + +### ninja 是一个非常简单的构建系统 + +但 ninja 并不复杂!以下是我所知道的关于 ninja 构建文件的语法:如何创建一个 `rule `和一个 `build`: + +`rule` 有一个命令和描述(描述只是给人看的,所以你可以知道它在构建你的代码时在做什么)。 + +``` +rule svg2pdf + command = inkscape $in --export-text-to-path --export-pdf=$out + description = svg2pdf $in $out +``` + +`build` 的语法是 `build output_file: rule_name input_files`。下面是一个使用 `svg2pdf` 规则的例子。输出在规则中的 `$out` 里,输入在 `$in` 里。 + +``` +build pdfs/variables.pdf: svg2pdf variables.svg +``` + +这就完成了!如果你把这两个东西放在一个叫 `build.ninja` 的文件里,然后运行 `ninja`,ninja 会运行 `inkscape variables.svg --export-text-to-path --export-pdf=pdfs/variables.pdf`。然后如果你再次运行它,它不会运行任何东西(因为它可以告诉你已经构建了 `pdfs/variables.pdf`,而且是最新的)。 + +Ninja 还有一些更多的功能(见[手册][2]),但我还没有用过。它最初是[为 Chromium][3] 构建的,所以即使只有一个小的功能集,它也能支持大型构建。 + +### ninja 文件通常是自动生成的 + +ninja 的神奇之处在于,你不必使用一些混乱的构建语言,它们很难记住(比如 make),因为你不经常使用它,相反,ninja 语言超级简单,如果你想做一些复杂的事情,那么你只需使用任意编程语言生成你想要的构建文件。 + +我喜欢写一个 `build.py` 文件,或者像这样的文件,创建 ninja 的构建文件,然后运行 `ninja`: + +``` +with open('build.ninja', 'w') as ninja_file: + # write some rules + ninja_file.write(""" +rule svg2pdf + command = inkscape $in --export-text-to-path --export-pdf=$out + description = svg2pdf $in $out +""") + + # some for loop with every file I need to build + for filename in things_to_convert: + ninja_file.write(f""" +build {filename.replace('svg', 'pdf')}: svg2pdf {filename} +""") + +# run ninja +import subprocess +subprocess.check_call(['ninja']) +``` + +我相信有一堆 ninja 的最佳实践,但我不知道。对于我的小项目而言,我发现它很好用。 + +### meson 是一个生成 ninja 文件的构建系统 + +我对 [Meson][4] 还不太了解,但最近我在构建一个 C 程序 ([plocate][5],一个比 `locate` 更快的替代方案)时,我注意到它有不同的构建说明,而不是通常的 `./configure; make; make install`: + +``` +meson builddir +cd builddir +ninja +``` + +好像 Meson 是一个 C/C++/Java/Rust/Fortran 的构建系统,可以用 ninja 作为后端。 + +### 就是这些! + +我使用 ninja 已经有几个月了。我真的很喜欢它,而且它几乎没有给我带来让人头疼的构建问题,这让我感觉非常神奇。 + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/10/26/ninja--a-simple-way-to-do-builds/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://ninja-build.org/ +[2]: https://ninja-build.org/manual.html +[3]: http://neugierig.org/software/chromium/notes/2011/02/ninja.html +[4]: https://mesonbuild.com/Tutorial.html +[5]: https://blog.sesse.net/blog/tech/2020-09-28-00-37_introducing_plocate From 8b2bc8c5f789f4126fd80a229ec8711a30a891ca Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 30 Oct 2020 08:51:22 +0800 Subject: [PATCH 0600/1156] translating --- ...n in Ubuntu and Other Linux Distributions -Beginner-s Tip.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md b/sources/tech/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md index 0925e8703e..3cbee66656 100644 --- a/sources/tech/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md +++ b/sources/tech/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 5cb9788e7424bb7c5e31083a66f79eb353eb1a71 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 30 Oct 2020 11:23:57 +0800 Subject: [PATCH 0601/1156] PRF @chenmu-kk --- ...ution to open source- Making a decision.md | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/translated/talk/20191105 My first contribution to open source- Making a decision.md b/translated/talk/20191105 My first contribution to open source- Making a decision.md index 38cd62ac87..142b42a18a 100644 --- a/translated/talk/20191105 My first contribution to open source- Making a decision.md +++ b/translated/talk/20191105 My first contribution to open source- Making a decision.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( chenmu-kk ) +[#]: translator: (chenmu-kk) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -9,33 +9,36 @@ 我的第一次开源贡献:做出决定 ====== -一位新的开源贡献者记录了她加入到开源项目后开始犯得五个错误。 -![Lightbulb][1] +> 一位新的开源贡献者告诉你如何加入到开源项目中。 -先前,我将大量的责任归咎于[冒充综合症][2]因为这延迟了我的第一个开源贡献。但还有一个我无法忽视的因素:我无法做决定来拯救我的生活。 在[成千上百万][3]的开源项目中抉择时,选择一个要做贡献的项目势不可挡。如此压迫以至于我常常不得不关掉我的笔记本去思考:“或许我可以改天再做一次”。 +![](https://img.linux.net.cn/data/attachment/album/202010/30/112350rh0xwp1x1y6awehn.jpg) -错误二是让我对做决定的恐惧妨碍了我做出第一次贡献。在理想世界里,也许我会带着一个我真正关心和想去做的特定项目开始我的开源之旅,但我有的只是总得为开源项目做出的贡献的模糊目标。对于那些处于同一处境的人来说,这儿有一些策略可以为自己的贡献挑选合适的项目(或者至少是一个好的项目)。 +先前,我把我的第一次开源贡献的拖延归咎于[冒牌综合症][2]。但还有一个我无法忽视的因素:我做出决定太艰难了。在[成千上百万][3]的开源项目中选择时,选择一个要做贡献的项目是难以抉择的。如此重负,以至于我常常不得不关掉我的笔记本去思考:“或许我改天再做吧”。 -### 我经常使用的工具 +错误之二是让我对做出决定的恐惧妨碍了我做出第一次贡献。在理想世界里,也许开始我的开源之旅时,心中就已经有了一个真正关心和想去做的具体项目,但我有的只是总得为开源项目做出贡献的模糊目标。对于那些处于同一处境的人来说,这儿有一些帮助我挑选出合适的项目(或者至少是一个好的项目)来做贡献的策略。 -一开始,我不认为有必要将自己局限于已经熟悉的工具或项目。有一些我之前从未使用过,但由于他们活跃的社区,或者他们解决了有趣的问题,因此看起来很有吸引力。 +### 经常使用的工具 -但是,考虑我投入到这个项目中的时间有限,我决定继续使用我了解的工具。要了解工具需求,你需要熟悉它的工作方式。如果您想为自己不熟悉的项目做贡献,则需要完成一个额外的步骤来了解代码的功能和目标。这个额外的工作量是有趣且值得的,但也会使你的工作时间加倍。因为我的目标主要是贡献,坚持我所知道的是缩小范围一个很好的方式。回馈一个你认为有用的项目也是一种回报。 +一开始,我不认为有必要将自己局限于已经熟悉的工具或项目。有一些项目我之前从未使用过,但由于它们的社区很活跃,或者它们解决的问题很有趣,因此看起来很有吸引力。 -### 我经常使用的工具 +但是,考虑我投入到这个项目中的时间有限,我决定继续投入到我了解的工具上去。要了解工具需求,你需要熟悉它的工作方式。如果你想为自己不熟悉的项目做贡献,则需要完成一个额外的步骤来了解代码的功能和目标。这个额外的工作量可能是有趣且值得的,但也会使你的工作时间加倍。因为我的目标主要是贡献,投入到我了解的工具上是缩小范围的很好方式。回馈一个你认为有用的项目也是有意义的。 -一开始,我不认为有必要将自己局限于已经熟悉的工具或项目。有一些我之前从未使用过,但由于他们活跃的社区,或者他们解决了有趣的问题,因此看起来很有吸引力。 +### 活跃而友好的社区 -但是,考虑我投入到这个项目中的时间有限,我决定继续使用我了解的工具。要了解工具需求,你需要熟悉它的工作方式。如果您想为自己不熟悉的项目做贡献,则需要完成一个额外的步骤来了解代码的功能和目标。这个额外的工作量是有趣且值得的,但也会使你的工作时间加倍。因为我的目标主要是贡献,坚持我所知道的是缩小范围一个很好的方式。回馈一个你认为有用的项目也是一种回报。 +在选择项目的时候,我希望在那里有人会审查我写的代码才会觉得有信心。当然,我也希望审核我代码的人是个和善的人。毕竟,把你的作品放在那里接受公众监督是很可怕的。虽然我对建设性的反馈持开放态度,但开发者社区中的一些有毒角落是我希望避免的。 -因为这是我第一次为开源项目做出贡献,在此过程中我有很多问题。一些项目社区非常擅长记录选择问题和提出请求的程序。一些项目社区在记录流程方面很优秀,可以用来挑选其中的项目并提交请求。尽管那时我没有选择它们,因为在此之前我从未使用过该产品,[Gatsby][4]是该实践的一个范例。 +为了评估我将要加入的社区,我查看了我正在考虑加入的仓库的议题issue部分。我要查看核心团队中是否有人定期回复。更重要的是,我试着确保没有人在评论中互相诋毁(这在议题讨论中是很常见的)。我还留意了那些有行为准则的项目,概述了什么是适当的和不适当的在线互动行为。 -这种细致的文件帮助我们缓解一些不知如何去做的不安全感。它也给了我希望,项目是开放给新的贡献者,并将花时间来查看我的工作。除了贡献准则外,我还查看了问题部分,看看这个项目是否利用了“好的第一个问题”标志。这是该项目对初学者开放的另一个标志(并帮助你学会如何操作)。 +### 明确的贡献准则 + +因为这是我第一次为开源项目做出贡献,在此过程中我有很多问题。一些项目社区在流程的文档记录方面做的很好,可以用来指导挑选其中的议题并发起拉取请求。 [Gatsby][4] 是这种做法的典范,尽管那时我没有选择它们,因为在此之前我从未使用过该产品。 + +这种清晰的文档帮助我们缓解了一些不知如何去做的不安全感。它也给了我希望:项目对新的贡献者是开放的,并且会花时间来查看我的工作。除了贡献准则外,我还查看了议题部分,看看这个项目是否使用了“第一个好议题good first issue”标志。这是该项目对初学者开放的另一个迹象(并可以帮助你学会要做什么)。 ### 总结 -如果你还没有计划好一个项目,那么选择合适的领域进行您的第一个开源贡献已势不可挡。列出一系列标准可以帮助自己缩减选择范围,并为自己的首次提交找到一个好的项目。 +如果你还没有计划好选择一个项目,那么选择合适的领域进行你的第一个开源贡献更加可行。列出一系列标准可以帮助自己缩减选择范围,并为自己的第一个拉取请求找到一个好的项目。 -------------------------------------------------------------------------------- @@ -44,7 +47,7 @@ via: https://opensource.com/article/19/11/my-first-open-source-contribution-mist 作者:[Galen Corey][a] 选题:[lujun9972][b] 译者:[chenmu-kk](https://github.com/chenmu-kk) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 4f32c3849528c76667ead8ffba39bf379b789c41 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 30 Oct 2020 11:24:32 +0800 Subject: [PATCH 0602/1156] PUB @chenmu-kk https://linux.cn/article-12768-1.html --- ... first contribution to open source- Making a decision.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/talk => published}/20191105 My first contribution to open source- Making a decision.md (98%) diff --git a/translated/talk/20191105 My first contribution to open source- Making a decision.md b/published/20191105 My first contribution to open source- Making a decision.md similarity index 98% rename from translated/talk/20191105 My first contribution to open source- Making a decision.md rename to published/20191105 My first contribution to open source- Making a decision.md index 142b42a18a..a8863ea7ff 100644 --- a/translated/talk/20191105 My first contribution to open source- Making a decision.md +++ b/published/20191105 My first contribution to open source- Making a decision.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (chenmu-kk) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12768-1.html) [#]: subject: (My first contribution to open source: Making a decision) [#]: via: (https://opensource.com/article/19/11/my-first-open-source-contribution-mistake-decisions) [#]: author: (Galen Corey https://opensource.com/users/galenemco) From 400e53def5ad5e61809d2775f6b09c3448cf7bbf Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 30 Oct 2020 12:21:44 +0800 Subject: [PATCH 0603/1156] PRF @geekpi --- ...ny computer with this bootable USB tool.md | 49 +++++++++---------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/translated/tech/20201014 Try Linux on any computer with this bootable USB tool.md b/translated/tech/20201014 Try Linux on any computer with this bootable USB tool.md index 20029022bd..76bed944bf 100644 --- a/translated/tech/20201014 Try Linux on any computer with this bootable USB tool.md +++ b/translated/tech/20201014 Try Linux on any computer with this bootable USB tool.md @@ -1,75 +1,72 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Try Linux on any computer with this bootable USB tool) [#]: via: (https://opensource.com/article/20/10/fedora-media-writer) [#]: author: (Sumantro Mukherjee https://opensource.com/users/sumantro) -用这个可引导的 USB 工具在任何电脑上尝试 Linux +用这个创建可引导 USB 的工具在电脑上尝试 Linux ====== -Fedora Media Writer 是创建 Live USB 以尝试 Linux 的方便的方法。 -![Multiple USB plugs in different colors][1] -[Fedora Media Writer][2] 是一个小巧、轻量、全面的工具,它简化了 Linux 的入门体验。它将 Fedora Workstation 或 Server 下载并写入一个可以在任何系统上引导的 USB 驱动器,使你无需将其安装到硬盘上就可以试用 Fedora Linux。 +> Fedora Media Writer 是创建临场版 USB 以尝试 Linux 的方便方法。 -Media Writer 工具可以用来创建一个实时的、可引导的 USB。在你的平台上安装 Fedora Media Writer 应用后,你可以下载并烧录最新的 Fedora Workstation 或 Server 稳定版,也可以选择你下载的任何其他镜像。而且它并不局限于英特尔 64 位设备。它还可以用于 ARM 设备,[如树莓派][3],它们每天都在变得更加强大和有用。 +![](https://img.linux.net.cn/data/attachment/album/202010/30/122142c1cmcv7cxgjmw5vw.jpg) + +[Fedora Media Writer][2] 是一个小巧、轻量、全面的工具,它简化了 Linux 的入门体验。它可以下载 Fedora 的 Workstation 或 Server 版本并写入到一个可以在任何系统上引导的 USB 驱动器上,使你无需将其安装到硬盘上就可以试用 Fedora Linux。 + +Media Writer 工具可以用来创建一个临场体验的Live、可引导的 USB 驱动器。在你的平台上安装 Fedora Media Writer 应用后,你可以下载并烧录最新的 Fedora Workstation 或 Server 稳定版,也可以选择烧录你下载的任何其他镜像。而且它并不局限于英特尔 64 位设备。它还可以用于 ARM 设备,如[树莓派][3],这些设备日益变得更加强大和有用。 ![Fedora Media Writer main screen][4] -(Sumantro Mukherjee, [CC BY-SA 4.0][5]) - ### 安装 Fedora Media Writer -你有几种方式来[安装 Fedora Media Writer][6]。你可以在 GitHub 上[从源码编译][7]、下载 MacOS 或 Windows 版本、使用 **dnf** 或 **yum** 安装 RPM 包、或者以 Flatpak 的形式获得。 +[安装 Fedora Media Writer][6] 有几种方式。你可以通过 GitHub [从源码编译][7]、下载 MacOS 或 Windows 版本、使用 `dnf` 或 `yum` 安装 RPM 包,或者以 Flatpak 的形式获得。 在 Fedora 上: - ``` -`$ sudo dnf install mediawriter` +$ sudo dnf install mediawriter ``` 最新版本请参见 GitHub 仓库的[发布][8]部分。 -### 准备好你的媒体 +### 准备好你的媒体介质 -首先,你需要一个 USB 驱动器来安装你的 Linux 操作系统。这就是 Fedora Media Writer 要烧录的东西。这个驱动器必须是空白或可擦除的,因为 **USB 驱动器上的所有数据都会被删除**。如果有任何数据,哪怕只是一个文件,如果你不想丢失,那么你必须在继续之前备份它! +首先,你需要一个 USB 驱动器来安装你的 Linux 操作系统。这就是 Fedora Media Writer 要烧录的设备。这个驱动器必须是空白或可擦除的,因为 **该 USB 驱动器上的所有数据都会被删除**。如果有任何数据,哪怕只是一个文件,如果你不想丢失,那么你必须在继续之前备份它! -确认你的 U 盘是可擦除的后,将它插入你的电脑并启动 Fedora Media Writer。 +确认你的 USB 驱动器是可擦除的之后,将它插入你的电脑并启动 Fedora Media Writer。 ### 使用 Fedora Media Writer -当你启动 Fedora Media Writer 时,你会看到一个页面,提示你从互联网上获取一个可引导的镜像,或者从你的硬盘上加载一个自定义镜像。第一个选择是 Fedora 的最新版本。工作站版适用于台式机和笔记本电脑,服务器版适用于虚拟化、机架服务器或任何你想作为服务器运行的情况。 +当你启动 Fedora Media Writer 时,你会看到一个页面,提示你从互联网上获取一个可引导的镜像,或者从你的硬盘上加载一个自定义镜像。第一个选择是 Fedora 的最新版本。Workstation 版本适用于台式机和笔记本电脑,Server 版本适用于虚拟化、机架服务器或任何你想作为服务器运行的情况。 -如果你选择了 Fedora 镜像,Media Writer 会下载一个光盘镜像(通常称为 ”iso“,文件扩展名为 **.iso**),并将其保存到你的 `Downloads` 文件夹中,这样你就可以重复使用它来烧录另一个驱动器。 +如果你选择了 Fedora 镜像,Media Writer 会下载一个光盘镜像(通常称为 “iso”,文件扩展名为 .iso),并将其保存到你的下载文件夹中,这样你就可以重复使用它来烧录另一个驱动器。 ![Select your image][9] -另外还有 Fedora Spins,这是来自 Fedora 社区的镜像,它旨在满足小众的兴趣。例如,如果你是 [MATE 桌面][10]的粉丝,那么你会很高兴地发现 Media Writer 提供的 MATE ”spin“。它有很多选择,所以请滚动查看所有的。如果你是 Linux 的新手,不要被吓到或困惑:额外的选项是为长期用户准备的,这些用户除了默认的选项外,还发展出了自己的偏好,所以对你来说,只使用工作站或服务器选项是安全的,这取决于你是想把 Fedora 作为一个桌面还是作为一个服务器操作系统来运行。 +另外还有 Fedora Spins,这是来自 Fedora 社区的镜像,它旨在满足小众的兴趣。例如,如果你是 [MATE 桌面][10]的粉丝,那么你会很高兴地发现 Media Writer 提供了 MATE spin。它有很多,所以请滚动查看所有的选择。如果你是 Linux 的新手,不要被吓到或感到困惑:这些额外的选项是为老用户准备的,这些用户除了默认的选项外,还发展出了自己的偏好,所以对你来说,只使用 Workstation 或 Server 选项就行,这取决于你是想把 Fedora 作为一个桌面还是作为一个服务器操作系统来运行。 -如果你需要一个与你当前使用的 CPU 不同的镜像,从窗口右上角的下拉菜单中选择 CPU 架构。 +如果你需要一个与你当前使用的 CPU 不同架构的镜像,从窗口右上角的下拉菜单中选择 CPU 架构。 -如果你已经将镜像保存在硬盘上,请选择**自定义映像**选项,并选择你要烧录到 USB 的发行版的 **.iso** 文件。 +如果你已经将镜像保存在硬盘上,请选择“Custom Image”选项,并选择你要烧录到 USB 的发行版的 .iso 文件。 ### 写入 USB 驱动器 当你下载或选择了一个镜像,你必须确认你要将该镜像写入驱动器。 -驱动器选择下拉菜单只显示外部驱动器,所以你不会意外地覆盖自己的硬盘驱动器。这是 Fedora Media Writer 的一个重要功能,它比你在网上看到的许多手动说明要安全得多。然而,如果你的计算机上连接了多个外部驱动器,除了你想覆盖的那个,你应该将它们全部移除,以增加安全性。 +驱动器选择下拉菜单只显示了外部驱动器,所以你不会意外地覆盖自己的硬盘驱动器。这是 Fedora Media Writer 的一个重要功能,它比你在网上看到的许多手动说明要安全得多。然而,如果你的计算机上连接了多个外部驱动器,除了你想覆盖的那个,你应该将它们全部移除,以增加安全性。 -选择你要安装镜像的驱动器,然后单击**写入磁盘**按钮。 +选择你要安装镜像的驱动器,然后单击“Write to Disk”按钮。 ![Media write][11] -  - -等一会儿镜像被写入你的驱动器,然后查看 Don Watkins 对[如何从 USB 驱动器启动到 Linux][12]的出色概述 。 +稍等一会儿,镜像就会被写入到你的驱动器,然后可以看看 Don Watkins 对[如何从 USB 驱动器启动到 Linux][12]的出色介绍。 ### 开始使用 Linux -Fedora Media Writer 是一种将 Fedora Workstation 或 Server,或任何 Linux 发行版烧录到 USB 驱动器的方法,因此你可以在设备安装它之前试用它。试试吧,并在评论中分享你的经验和问题。 +Fedora Media Writer 是一种将 Fedora Workstation 或 Server,或任何 Linux 发行版烧录到 USB 驱动器的方法,因此你可以在安装它到设备上之前试用它。试试吧,并在评论中分享你的经验和问题。 -------------------------------------------------------------------------------- @@ -78,7 +75,7 @@ via: https://opensource.com/article/20/10/fedora-media-writer 作者:[Sumantro Mukherjee][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From bce93b2acffaad75fde5b694415dbc4a8a9cb540 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 30 Oct 2020 12:22:20 +0800 Subject: [PATCH 0604/1156] PUB @geekpi https://linux.cn/article-12769-1.html --- ...4 Try Linux on any computer with this bootable USB tool.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201014 Try Linux on any computer with this bootable USB tool.md (98%) diff --git a/translated/tech/20201014 Try Linux on any computer with this bootable USB tool.md b/published/20201014 Try Linux on any computer with this bootable USB tool.md similarity index 98% rename from translated/tech/20201014 Try Linux on any computer with this bootable USB tool.md rename to published/20201014 Try Linux on any computer with this bootable USB tool.md index 76bed944bf..9e72c9dab8 100644 --- a/translated/tech/20201014 Try Linux on any computer with this bootable USB tool.md +++ b/published/20201014 Try Linux on any computer with this bootable USB tool.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12769-1.html) [#]: subject: (Try Linux on any computer with this bootable USB tool) [#]: via: (https://opensource.com/article/20/10/fedora-media-writer) [#]: author: (Sumantro Mukherjee https://opensource.com/users/sumantro) From d1e307ea6f1d0ca96debe838a2f59f7a811bff5e Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Fri, 30 Oct 2020 14:03:43 +0800 Subject: [PATCH 0605/1156] Update 20190925 Most enterprise networks can-t handle big data loads.md --- ...0925 Most enterprise networks can-t handle big data loads.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20190925 Most enterprise networks can-t handle big data loads.md b/sources/talk/20190925 Most enterprise networks can-t handle big data loads.md index 191900c10a..725783e362 100644 --- a/sources/talk/20190925 Most enterprise networks can-t handle big data loads.md +++ b/sources/talk/20190925 Most enterprise networks can-t handle big data loads.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: ( chenmu-kk ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f2a23214366ca3838d6369f93aa0077bf2460150 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 31 Oct 2020 00:06:01 +0800 Subject: [PATCH 0606/1156] PRF @MjSeven --- ...nternet from the command line with curl.md | 68 +++++++++++-------- 1 file changed, 39 insertions(+), 29 deletions(-) diff --git a/translated/tech/20200521 Use the internet from the command line with curl.md b/translated/tech/20200521 Use the internet from the command line with curl.md index 156b195494..a64c3fbb3a 100644 --- a/translated/tech/20200521 Use the internet from the command line with curl.md +++ b/translated/tech/20200521 Use the internet from the command line with curl.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Use the internet from the command line with curl) @@ -9,19 +9,21 @@ 使用 curl 从命令行访问互联网 ====== -下载我们整理的 curl 备忘录。在不使用图形界面的情况下从互联网上获取所需的信息,curl 是一种快速有效的方法。 -![Cheat Sheet cover image][1] +> 下载我们整理的 curl 备忘录。要在不使用图形界面的情况下从互联网上获取所需的信息,curl 是一种快速有效的方法。 -Curl 通常被认为是非交互式 Web 浏览器,这意味着它能够从互联网上获取信息并在你的终端中显示或将其保存到文件中。从表面看,这是 Web 浏览器,例如 Firefox 或 Chromium 所做的工作,只是它们默认情况下会 _渲染_ 信息,而 curl 会下载并显示原始信息。实际上,curl 命令可以做更多的事情,并且能够使用多种协议与服务器进行双向传输数据,这些协议包括 HTTP、FTP、SFTP、IMAP、POP3、LDAP、SMB、SMTP 等。对于普通终端用户来说,这是一个有用的工具;而对于系统管理员,这非常便捷;对于微服务和云开发人员来说,它是质量保证的工具。 +![(https://img.linux.net.cn/data/attachment/album/202010/31/000543n032ud499yy4d94v.jpg) -Curl 被设计为在没有用户交互的情况下工作,因此与 Firefox 不同,你必须从头到尾考虑与在线数据的交互。例如,如果想要在 Firefox 中查看网页,你需要启动 Firefox 窗口。打开 Firefox 后,在地址栏或搜索引擎中输入要访问的网站。然后,导航到网站,然后单击要查看的页面。 +`curl` 通常被视作一款非交互式 Web 浏览器,这意味着它能够从互联网上获取信息,并在你的终端中显示,或将其保存到文件中。从表面看,这是 Web 浏览器,类似 Firefox 或 Chromium 所做的工作,只是它们默认情况下会*渲染*信息,而 `curl` 会下载并显示原始信息。实际上,`curl` 命令可以做更多的事情,并且能够使用多种协议与服务器进行双向传输数据,这些协议包括 HTTP、FTP、SFTP、IMAP、POP3、LDAP、SMB、SMTP 等。对于普通终端用户来说,这是一个有用的工具;而对于系统管理员,这非常便捷;对于微服务和云开发人员来说,它是一个质量保证工具。 -对于 curl 来说也是如此,不同之处在于你需要一次执行所有操作:在启动 curl 的同时提供需要访问的 Internet 位置,并告诉它是否要将数据保存在终端或文件中。当你必须与需要身份验证的网站或 API 进行交互时,会变得有点复杂,但是一旦你学习了 **curl** 命令语法,它就会成为你的第二天性。为了帮助你掌握它,我们在一个方便的[备忘录][2]中收集了相关的语法信息。 +`curl` 被设计为在没有用户交互的情况下工作,因此与 Firefox 不同,你必须从头到尾考虑与在线数据的交互。例如,如果想要在 Firefox 中查看网页,你需要启动 Firefox 窗口。打开 Firefox 后,在地址栏或搜索引擎中输入要访问的网站。然后,导航到网站,然后单击要查看的页面。 + +对于 `curl` 来说也是如此,不同之处在于你需要一次执行所有操作:在启动 `curl` 的同时提供需要访问的互联网地址,并告诉它是否要将数据保存在终端或文件中。当你必须与需要身份验证的网站或 API 进行交互时,会变得有点复杂,但是一旦你学习了 `curl` 命令语法,它就会变得自然而然。为了帮助你掌握它,我们在一个方便的[备忘录][2]中收集了相关的语法信息。 ### 使用 curl 下载文件 -你可以通过提供指向特定 URL 的链接来使用 **curl** 命令下载文件。如果你提供的 URL 默认为 **index.html**,那么将下载此页面,并将下载的文件显示在终端屏幕上。你可以将数据通过管道传递到 less、tail 或任何其它命令: +你可以通过提供指向特定 URL 的链接来使用 `curl` 命令下载文件。如果你提供的 URL 默认为 `index.html`,那么将下载此页面,并将下载的文件显示在终端屏幕上。你可以将数据通过管道传递到 `less`、`tail` 或任何其它命令: + ``` $ curl "http://example.com" | tail -n 4

      Example Domain

      @@ -30,16 +32,17 @@ $ curl "http://example.com" | tail -n 4 ``` -由于某些 URL 包含特殊字符,shell 通常会将其解释,因此用引号将 URL 包起来是最安全的。 +由于某些 URL 包含特殊字符,shell 通常会将其解释,因此最安全的做法用引号将 URL 包起来。 + +某些文件无法很好的在终端中转换显示。你可以使用 `--remote-name` 选项使文件根据服务器上的命名进行保存: -某些文件在终端中无法很好的转换显示。你可以使用 **\--remote-name** 选项使文件根据服务器上的命名进行保存: ``` -$ curl --remote-name "" +$ curl --remote-name "https://example.com/linux-distro.iso" $ ls linux-distro.iso ``` -或者,你可以使用 **\--output** 选项来命名你想要下载的内容: +或者,你可以使用 `--output` 选项来命名你想要下载的内容: ``` curl "http://example.com/foo.html" --output bar.html @@ -47,35 +50,38 @@ curl "http://example.com/foo.html" --output bar.html ### 使用 curl 列出带有远程目录的内容 -因为 curl 不是交互式的,所以很难浏览页面上的可下载元素。如果你要连接的远程服务器允许,可以使用 **curl** 来列出目录的内容: +因为 `curl` 不是交互式的,所以很难浏览页面上的可下载元素。如果你要连接的远程服务器允许,可以使用 `curl` 来列出目录的内容: + ``` $ curl --list-only "https://example.com/foo/" ``` ### 继续中断下载 -如果你正在下载一个非常大的文件,你可能会发现有时候必须中断下载。Curl 非常智能,可以确定下载从何处中断并继续下载。这意味着,下一次当你下载一个 4GB 的 Linux 发行版 ISO 出现问题时,就不必重新开始了。**\--continue-at** 的语法有点不寻常:如果你知道下载中断时的字节数,你可以提供给 curl;否则,你可以使用单独的一个破折号(**-**)指示 curl 自动检测: +如果你正在下载一个非常大的文件,你可能会发现有时候必须中断下载。`curl` 非常智能,可以确定下载从何处中断并继续下载。这意味着,下一次当你下载一个 4GB 的 Linux 发行版的 ISO 出现问题时,就不必重新开始了。`--continue-at` 的语法有点不寻常:如果你知道下载中断时的字节数,你可以提供给 `curl`;否则,你可以使用单独的一个破折号(`-`)指示 curl 自动检测: + ``` $ curl --remote-name --continue-at - "https://example.com/linux-distro.iso" ``` ### 下载文件序列 -如果你需要下载多个文件而不是一个大文件,那么 curl 可以帮助你解决这个问题。假设你知道要下载的文件的位置和文件名模式,则可以使用 curl 的排序标记:中括号中整数范围内的起点和终点。对于输出文件名,使用 **#1** 表示第一个变量: +如果你需要下载多个文件而不是一个大文件,那么 `curl` 可以帮助你解决这个问题。假设你知道要下载的文件的位置和文件名模式,则可以使用 `curl` 的序列标记:中括号里是整数范围的起点和终点。对于输出文件名,使用 `#1` 表示第一个变量: ``` $ curl "https://example.com/file_[1-4].webp" --output "file_#1.webp" ``` -如果你需要使用其它变量来表示另一个序列,按照每个变量在命令中出现的顺序表示它们。例如,在这个命令中,**#1** 指目录 **images_000** 到 **images_009**,而 **#2** 指目录 **file_1.webp** 至 **file_4.webp**。 +如果你需要使用其它变量来表示另一个序列,按照每个变量在命令中出现的顺序表示它们。例如,在这个命令中,`#1` 指目录 `images_000` 到 `images_009`,而 `#2` 指目录 `file_1.webp` 至 `file_4.webp`: + ``` -$ curl "" \ -\--output "file_#1-#2.webp" +$ curl "https://example.com/images_00[0-9]/file_[1-4].webp" --output "file_#1-#2.webp" ``` ### 从站点下载所有 PNG 文件 -你也可以仅使用 **curl** 和 **grep** 进行一些基本的 Web 抓取操作,以找到想要下载的内容。例如,假设你需要下载与正在归档网页关联的所有图像,首先,下载引用图像的页面。将页面内通过管道传输到 grep,搜索所需的图片类型(在此示例中为 PNG)。最后,创建一个 **while** 循环来构造下载 URL,并将文件保存到你的计算机: +你也可以仅使用 `curl` 和 `grep` 进行一些基本的 Web 抓取操作,以找到想要下载的内容。例如,假设你需要下载与正在归档网页关联的所有图像,首先,下载引用了图像的页面。将页面内通过管道传输到 `grep`,搜索所需的图片类型(在此示例中为 PNG)。最后,创建一个 `while` 循环来构造下载 URL,并将文件保存到你的计算机: + ``` $ curl https://example.com |\ grep --only-matching 'src="[^"]*.[png]"' |\ @@ -85,13 +91,14 @@ curl https://example.com/"${i}" -o "${i##*/}"; \ done ``` -这只是一个示例,但它展示了 curl 与 Unix 管道和一些基本巧妙的解析结合使用时是多么的灵活。 +这只是一个示例,但它展示了 `curl` 与 Unix 管道和一些基本而巧妙的解析结合使用时是多么的灵活。 ### 获取 HTML 头 用于数据交换的协议在计算机发送通信的数据包中嵌入了大量元数据。HTTP 头是数据初始部分的组件。在连接一个网站出现问题时,查看这些报文头(尤其是响应码)会有所帮助: + ``` -curl --head "" +curl --head "https://example.com" HTTP/2 200 accept-ranges: bytes age: 485487 @@ -110,19 +117,22 @@ content-length: 1256 响应 200 通常是 HTTP 成功指示符,这是你与服务器连接时通常期望的结果。著名的 404 响应表示找不到页面,而 500 则表示服务器在处理请求时出现了错误。 -要查看协商过程中发生了什么错误,添加 **\--shou-error** 选项: +要查看协商过程中发生了什么错误,添加 `--show-error` 选项: + ``` $ curl --head --show-error "http://opensource.ga" ``` -除非你可以访问要连接的服务器,否则这些问题将很难解决,但是 curl 通常会尽力连接你指定的地址。有时在网络上进行测试时,无休止的重试似乎只会浪费时间,因此你可以使用 **\--fail-early** 选项来强制 curl 在失败时迅速退出: +除非你可以访问要连接的服务器,否则这些问题将很难解决,但是 `curl` 通常会尽力连接你指定的地址。有时在网络上进行测试时,无休止的重试似乎只会浪费时间,因此你可以使用 `--fail-early` 选项来强制 `curl` 在失败时迅速退出: + ``` curl --fail-early "http://opensource.ga" ``` ### 由 3xx 响应指定的重定向查询 -300 这个系列的响应更加灵活。具体来说,301 响应意味着一个 URL 已被永久移动到其它位置。对于网站管理员来说,重新定位内容并留下“痕迹”是一种常见的方式,这样访问老地址的人们仍然可以找到它。默认情况下,Curl 不会进行 301 重定向,但你可以使用 **\--localtion** 选项使其继续进入 301 响应指向的目标: +300 这个系列的响应更加灵活。具体来说,301 响应意味着一个 URL 已被永久移动到其它位置。对于网站管理员来说,重新定位内容并留下“痕迹”是一种常见的方式,这样访问旧地址的人们仍然可以找到它。默认情况下,`curl` 不会进行 301 重定向,但你可以使用 `--localtion` 选项使其继续进入 301 响应指向的目标: + ``` $ curl "https://iana.org" | grep title 301 Moved Permanently @@ -132,15 +142,15 @@ $ curl --location "https://iana.org" ### 展开短网址 -如果你想要在访问短网址之前先查看它们,那么 **\--location** 选项非常有用。短网址对于有字符限制的社交网络(当然,如果你使用[现代和开源的社交网络][4]的话,这可能不是问题),或者对于用户不能复制粘贴长地址的打印媒体来说是有用处的。但是,它们也可能存在风险,因为其目的地址本质上是隐藏的。通过结合使用 **\--head** 选项仅查看 HTTP 头,**\--location** 选项可以查看一个 URL 的最终地址,你可以查看一个短网址而无需加载其完整的资源: +如果你想要在访问短网址之前先查看它们,那么 `--location` 选项非常有用。短网址对于有字符限制的社交网络(当然,如果你使用[现代和开源的社交网络][4]的话,这可能不是问题),或者对于用户不能复制粘贴长地址的印刷媒体来说是有用处的。但是,它们也可能存在风险,因为其目的地址本质上是隐藏的。通过结合使用 `--head` 选项仅查看 HTTP 头,`--location` 选项可以查看一个 URL 的最终地址,你可以查看一个短网址而无需加载其完整的资源: + ``` -$ curl --head --location \ -"" +$ curl --head --location "" ``` -### [下载我们的 curl 备忘录][2] +### 下载我们的 curl 备忘录 -一旦你开始考虑了将探索 web 由一条命令来完成,那么 curl 就成为一种快速有效的方式,可以从 Internet 上获取所需的信息,而无需麻烦图形界面。为了帮助你适应到工作流中,我们创建了一个 [curl 备忘录][2],它包含常见的 curl 用法和语法,包括使用它查询 API 的概述。 +一旦你开始考虑了将探索 web 由一条命令来完成,那么 `curl` 就成为一种快速有效的方式,可以从互联网上获取所需的信息,而无需麻烦图形界面。为了帮助你适应到工作流中,我们创建了一个 [curl 备忘录][2],它包含常见的 `curl` 用法和语法,包括使用它查询 API 的概述。 -------------------------------------------------------------------------------- @@ -149,7 +159,7 @@ via: https://opensource.com/article/20/5/curl-cheat-sheet 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[MjSeven](https://github.com/MjSeven) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From dbff471b7f05b1ba26b6976c1727ae4c1d196638 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 31 Oct 2020 00:07:02 +0800 Subject: [PATCH 0607/1156] PUB @MjSeven https://linux.cn/article-12772-1.html --- ...0521 Use the internet from the command line with curl.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20200521 Use the internet from the command line with curl.md (98%) diff --git a/translated/tech/20200521 Use the internet from the command line with curl.md b/published/20200521 Use the internet from the command line with curl.md similarity index 98% rename from translated/tech/20200521 Use the internet from the command line with curl.md rename to published/20200521 Use the internet from the command line with curl.md index a64c3fbb3a..9880cead4e 100644 --- a/translated/tech/20200521 Use the internet from the command line with curl.md +++ b/published/20200521 Use the internet from the command line with curl.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12772-1.html) [#]: subject: (Use the internet from the command line with curl) [#]: via: (https://opensource.com/article/20/5/curl-cheat-sheet) [#]: author: (Seth Kenlon https://opensource.com/users/seth) @@ -12,7 +12,7 @@ > 下载我们整理的 curl 备忘录。要在不使用图形界面的情况下从互联网上获取所需的信息,curl 是一种快速有效的方法。 -![(https://img.linux.net.cn/data/attachment/album/202010/31/000543n032ud499yy4d94v.jpg) +![](https://img.linux.net.cn/data/attachment/album/202010/31/000543n032ud499yy4d94v.jpg) `curl` 通常被视作一款非交互式 Web 浏览器,这意味着它能够从互联网上获取信息,并在你的终端中显示,或将其保存到文件中。从表面看,这是 Web 浏览器,类似 Firefox 或 Chromium 所做的工作,只是它们默认情况下会*渲染*信息,而 `curl` 会下载并显示原始信息。实际上,`curl` 命令可以做更多的事情,并且能够使用多种协议与服务器进行双向传输数据,这些协议包括 HTTP、FTP、SFTP、IMAP、POP3、LDAP、SMB、SMTP 等。对于普通终端用户来说,这是一个有用的工具;而对于系统管理员,这非常便捷;对于微服务和云开发人员来说,它是一个质量保证工具。 From f06e78cb394327482527b68e0d4ebf94f8602ee2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 31 Oct 2020 12:51:41 +0800 Subject: [PATCH 0608/1156] PRF @wxy --- ... Jargon Buster- What is Display Manager in Linux.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/translated/tech/20201012 Linux Jargon Buster- What is Display Manager in Linux.md b/translated/tech/20201012 Linux Jargon Buster- What is Display Manager in Linux.md index 789d1aebe5..08e671a1fa 100644 --- a/translated/tech/20201012 Linux Jargon Buster- What is Display Manager in Linux.md +++ b/translated/tech/20201012 Linux Jargon Buster- What is Display Manager in Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Linux Jargon Buster: What is Display Manager in Linux?) @@ -46,9 +46,9 @@ Linux 黑话解释:什么是显示管理器? 有这么多的桌面环境可供选择,它们都有自己的显示管理器吗?不,不是这样的。 -正如我之前提到的,可见的登录屏幕被称为欢迎页。这个欢迎页可以被自定义来改变登录屏幕的外观。 +正如我之前提到的,可见的登录屏幕被称为欢迎页。这个欢迎页可以进行自定义来改变登录屏幕的外观。 -事实上,许多发行版和/或桌面环境都编写了自己的欢迎页,以给用户提供一个类似于他们品牌的登录屏幕。 +事实上,许多发行版和/或桌面环境都制作了自己的欢迎页,以给用户提供一个类似于他们品牌的登录屏幕。 例如,Mint 的 Cinnamon 桌面使用了 LightDM,但有自己的欢迎页来给它更多的 Mint 式(或者我应该说是 Cinnamon)的外观。 @@ -66,7 +66,7 @@ Linux 黑话解释:什么是显示管理器? ![][12] -如果当时没有做切换,那么以后可以通过手动配置来改变显示管理器。不同的发行版重新配置显示管理器的方法略有不同,不在本文讨论范围内。 +如果当时没有做切换,那么以后可以通过手动配置来改变显示管理器。不同的发行版重新配置显示管理器的方法略有不同,这不在本文讨论范围内。 ### 结语 @@ -81,7 +81,7 @@ via: https://itsfoss.com/display-manager/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 7a6ce76b28ea80e10136927ee747a4796876e0a1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 31 Oct 2020 12:53:49 +0800 Subject: [PATCH 0609/1156] PUB @wxy https://linux.cn/article-12773-1.html --- ...2 Linux Jargon Buster- What is Display Manager in Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201012 Linux Jargon Buster- What is Display Manager in Linux.md (98%) diff --git a/translated/tech/20201012 Linux Jargon Buster- What is Display Manager in Linux.md b/published/20201012 Linux Jargon Buster- What is Display Manager in Linux.md similarity index 98% rename from translated/tech/20201012 Linux Jargon Buster- What is Display Manager in Linux.md rename to published/20201012 Linux Jargon Buster- What is Display Manager in Linux.md index 08e671a1fa..efbd10a32d 100644 --- a/translated/tech/20201012 Linux Jargon Buster- What is Display Manager in Linux.md +++ b/published/20201012 Linux Jargon Buster- What is Display Manager in Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12773-1.html) [#]: subject: (Linux Jargon Buster: What is Display Manager in Linux?) [#]: via: (https://itsfoss.com/display-manager/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From 8bc277ad22c2aa4c275332a35983818a53c26422 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 31 Oct 2020 13:00:45 +0800 Subject: [PATCH 0610/1156] PRF --- ...2 Linux Jargon Buster- What is Display Manager in Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/published/20201012 Linux Jargon Buster- What is Display Manager in Linux.md b/published/20201012 Linux Jargon Buster- What is Display Manager in Linux.md index efbd10a32d..2aef0b010f 100644 --- a/published/20201012 Linux Jargon Buster- What is Display Manager in Linux.md +++ b/published/20201012 Linux Jargon Buster- What is Display Manager in Linux.md @@ -12,7 +12,7 @@ Linux 黑话解释:什么是显示管理器? > 在这篇 Linux 黑话解释中,你将了解 Linux 中的显示管理器。它是桌面环境的一部分吗?它的作用是什么? -### 在 Linux 中什么是显示管理器? +### 什么是 Linux 中的显示管理器? 简单来说,显示管理器display manager(DM)是一个为你的 Linux 发行版提供图形登录功能的程序。它控制用户会话并管理用户认证。显示管理器会在你输入用户名和密码后,立即启动[显示服务器][1]并加载[桌面环境][2]。 @@ -52,7 +52,7 @@ Linux 黑话解释:什么是显示管理器? 例如,Mint 的 Cinnamon 桌面使用了 LightDM,但有自己的欢迎页来给它更多的 Mint 式(或者我应该说是 Cinnamon)的外观。 -![基于 LightDM 的 Linux Mint 登录屏幕][9]。 +![基于 LightDM 的 Linux Mint 登录屏幕][9] 来看看 Kali Linux 的登录界面: From 648a1863314218e3b4f9ad067edf5dd8f97e146f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 1 Nov 2020 10:06:42 +0800 Subject: [PATCH 0611/1156] PRF @geekpi --- ...nOffice and Support LibreOffice Instead.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/translated/tech/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md b/translated/tech/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md index 5620f99321..cbbbbbd46d 100644 --- a/translated/tech/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md +++ b/translated/tech/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md @@ -1,20 +1,20 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead) [#]: via: (https://itsfoss.com/libreoffice-letter-openoffice/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -LibreOffice 希望 Apache 放弃陷入困境的 OpenOffice,转而支持 LibreOffice +文档基金会希望 Apache 放弃陷入困境的 OpenOffice,转而支持 LibreOffice ====== 对于 Linux 用户来说,当我们想到[微软 Office 的开源替代品][1]时,Apache OpenOffice 仍然是一个相关的推荐,这是不言而喻的。然而,在过去的几年里,OpenOffice 的发展几乎是停滞的。 -当然,考虑到 Abhishek 早在 2016年 就写过 [Apache OpenOffice 关闭的可能性][2],这并不令人震惊。 +当然,考虑到 Abhishek 早在 2016 年就写过 [Apache OpenOffice 关闭的可能性][2],这并不令人震惊。 -现在,在[文档基金会的公开信][3]中,他们呼吁 Apache OpenOffice 推荐用户开始使用更好的替代品,比如 LibreOffice。在本文中,我将提到文档基金会的博文中的一些重点,以及它对 Apache OpenOffice 的意义。 +现在,在一封[文档基金会的公开信][3]中,他们呼吁 Apache OpenOffice 推荐用户开始使用更好的替代品,比如 LibreOffice。在本文中,我将提到文档基金会的博文中的一些重点,以及它对 Apache OpenOffice 的意义。 ![][4] @@ -28,11 +28,11 @@ LibreOffice 希望 Apache 放弃陷入困境的 OpenOffice,转而支持 LibreO ![][5] -现在 OpenOffice 已经没有重大的开发了,Apache OpenOffice 的未来是什么?最大开源基金会一个有些活跃的项目没有重大发布? +现在 OpenOffice 已经没有重大的开发了,Apache OpenOffice 的未来是什么?一个相当活跃的项目,这个最大的开源基金会会不发布重大版本? 这听起来并不乐观,而这正是文档基金会在他们的公开信中所强调的: -> OpenOffice(.org),LibreOffice 的”父项目“,是一个伟大的办公套件,它改变了世界。它有着引人入胜的历史,但**自从 2014 年以来,Apache OpenOffice (它现在的家)还没有一个重大的版本**。没错,六年多来,没有重大的新功能或重大更新到来。很少有次要的发布,而且在及时的安全更新方面也存在问题。 +> OpenOffice(.org),是 LibreOffice 的”父项目“,它是一个伟大的办公套件,它改变了世界。它有着引人入胜的历史,但**自从 2014 年以来,Apache OpenOffice (它现在的家)还没有一个重大的版本**。没错,六年多来,没有重大的新功能或重大更新到来,也很少发布次要版本,而且在及时的安全更新方面也存在问题。 对于一个普通用户来说,如果他们不知道 [LibreOffice][6],我肯定希望他们知道。但是,Apache 基金会是否应该建议 OpenOffice 用户尝试使用 LibreOffice 来体验更好或更高级的办公套件呢? @@ -48,9 +48,9 @@ LibreOffice 希望 Apache 放弃陷入困境的 OpenOffice,转而支持 LibreO 如果 OpenOffice 能完成工作,用户可能不需要努力寻找替代品。那么,因为他们的缓慢开发而呼唤另一个项目,建议用户采用未来工具并推荐它是一个好主意么? -在争论中,有人可能会说,如果你已经完成了,并且对改进 OpenOffice 没有兴趣,那么推广你的竞争对手才是公平的。而且,这并没有错,开源社区应该一直合作,以确保新用户得到最好的选择。 +在争论中,有人可能会说,如果你已经完成了你的目标,并且对改进 OpenOffice 没有兴趣,那么推广你的竞争对手才是公平的。而且,这并没有错,开源社区应该一直合作,以确保新用户得到最好的选择。 -从另一个侧面来看,我们可以说,文档基金会对于 OpenOffice 在 2020 年即使没有任何重大改进却仍然有重要意义感到沮丧。 +从另一个侧面来看,我们可以说,文档基金会对于 OpenOffice 到了 2020 年即使没有任何重大改进却仍然有重要意义感到沮丧。 我不会去评判,但当我看了这封公开信时,这些矛盾的想法就浮现在我的脑海里。 @@ -67,7 +67,7 @@ via: https://itsfoss.com/libreoffice-letter-openoffice/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -77,5 +77,5 @@ via: https://itsfoss.com/libreoffice-letter-openoffice/ [2]: https://itsfoss.com/openoffice-shutdown/ [3]: https://blog.documentfoundation.org/blog/2020/10/12/open-letter-to-apache-openoffice/ [4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/libre-office-open-office.png?resize=800%2C450&ssl=1 -[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/libre-office-open-office-derivatives.jpg?resize=800%2C166&ssl=1 +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/libre-office-open-office-derivatives.jpg?resize=1536%2C319&ssl=1 [6]: https://itsfoss.com/libreoffice-tips/ From 7d1588a2d78de88a388a8c4cb06737e4f6bcc7db Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 1 Nov 2020 10:07:34 +0800 Subject: [PATCH 0612/1156] PUB @geekpi https://linux.cn/article-12775-1.html --- ...p the Ailing OpenOffice and Support LibreOffice Instead.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md (98%) diff --git a/translated/tech/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md b/published/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md similarity index 98% rename from translated/tech/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md rename to published/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md index cbbbbbd46d..216a944683 100644 --- a/translated/tech/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md +++ b/published/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12775-1.html) [#]: subject: (LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead) [#]: via: (https://itsfoss.com/libreoffice-letter-openoffice/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From 48a73a57bbd143f3971ebfa0d06a27cdd7845487 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 1 Nov 2020 10:16:26 +0800 Subject: [PATCH 0613/1156] =?UTF-8?q?=E5=BD=92=E6=A1=A3=20202010?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{ => 202010}/20180414 Go on very small hardware Part 2.md | 0 .../{ => 202010}/20180710 Building a Messenger App- Messages.md | 0 .../20180710 Building a Messenger App- Realtime Messages.md | 0 .../20180712 Building a Messenger App- Development Login.md | 0 .../20180716 Building a Messenger App- Access Page.md | 0 .../{ => 202010}/20180719 Building a Messenger App- Home Page.md | 0 .../20180720 Building a Messenger App- Conversation Page.md | 0 ...20190102 Using Yarn on Ubuntu and Other Linux Distributions.md | 0 .../{ => 202010}/20190521 How to Disable IPv6 on Ubuntu Linux.md | 0 .../20190822 Things You Didn-t Know About GNU Readline.md | 0 ...105 My first contribution to open source- Making a decision.md | 0 .../{ => 202010}/20200512 Scan your Linux security with Lynis.md | 0 .../20200521 Use the internet from the command line with curl.md | 0 .../{ => 202010}/20200629 Using Bash traps in your scripts.md | 0 ...3 Automate testing for website errors with this Python tool.md | 0 ...0200810 How to read Lynis reports to improve Linux security.md | 0 .../20200811 TCP window scaling, timestamps and SACK.md | 0 .../20200820 Learn the basics of programming with C.md | 0 .../20200826 What is IPv6, and why aren-t we there yet.md | 0 .../{ => 202010}/20200901 Create a mobile app with Flutter.md | 0 .../{ => 202010}/20200903 A practical guide to learning awk.md | 0 .../{ => 202010}/20200908 How to install software with Ansible.md | 0 ...container orchestration with Ansible modules for Kubernetes.md | 0 .../20200914 NFC vs. Bluetooth LE- When to use which.md | 0 ...o Create-Configure LVM (Logical Volume Management) in Linux.md | 0 ...pp Grid, Performance Improvements and Tons of Other Changes.md | 0 ...w to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md | 0 .../20200921 Installing and running Vagrant using qemu-kvm.md | 0 ...How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md | 0 .../20200923 Find security issues in Go code using gosec.md | 0 ...uestions to ask yourself when writing project documentation.md | 0 ...te Generators to Create Fast and Resource-Friendly Websites.md | 0 ...s FOSS (Free and Open Source Software)- What is Open Source.md | 0 published/{ => 202010}/20200928 Create template files in GNOME.md | 0 ...r (to Find and Kill RAM and CPU Eating Tabs and Extensions).md | 0 ...928 How to view information on your Linux devices with lshw.md | 0 ...ng is an Open Source MS-Paint Type of App for Linux Desktop.md | 0 ...resent Slides in Linux Terminal With This Nifty Python Tool.md | 0 .../20200930 Recovering deleted files on Linux with testdisk.md | 0 ...uster- What is a Package Manager in Linux- How Does it Work.md | 0 ...your web experience with this internet protocol alternative.md | 0 ...rate your calendar with Ansible to avoid schedule conflicts.md | 0 .../20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md | 0 ...09 How to Remove Physical Volume from a Volume Group in LVM.md | 0 ...010 6 Essential Things To Do After Installing Manjaro Linux.md | 0 ... Microsoft be en route to dumping Windows in favor of Linux.md | 0 ...01012 Linux Jargon Buster- What is Display Manager in Linux.md | 0 .../{ => 202010}/20201013 Install MariaDB or MySQL on Linux.md | 0 .../20201014 2 Ways to Download Files From Linux Terminal.md | 0 ...layer is a Desktop App for Various Streaming Music Services.md | 0 ...01014 Try Linux on any computer with this bootable USB tool.md | 0 published/{ => 202010}/20201016 Set up ZFS on Linux with yum.md | 0 published/{ => 202010}/20201027 Fedora 33 is officially here.md | 0 53 files changed, 0 insertions(+), 0 deletions(-) rename published/{ => 202010}/20180414 Go on very small hardware Part 2.md (100%) rename published/{ => 202010}/20180710 Building a Messenger App- Messages.md (100%) rename published/{ => 202010}/20180710 Building a Messenger App- Realtime Messages.md (100%) rename published/{ => 202010}/20180712 Building a Messenger App- Development Login.md (100%) rename published/{ => 202010}/20180716 Building a Messenger App- Access Page.md (100%) rename published/{ => 202010}/20180719 Building a Messenger App- Home Page.md (100%) rename published/{ => 202010}/20180720 Building a Messenger App- Conversation Page.md (100%) rename published/{ => 202010}/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md (100%) rename published/{ => 202010}/20190521 How to Disable IPv6 on Ubuntu Linux.md (100%) rename published/{ => 202010}/20190822 Things You Didn-t Know About GNU Readline.md (100%) rename published/{ => 202010}/20191105 My first contribution to open source- Making a decision.md (100%) rename published/{ => 202010}/20200512 Scan your Linux security with Lynis.md (100%) rename published/{ => 202010}/20200521 Use the internet from the command line with curl.md (100%) rename published/{ => 202010}/20200629 Using Bash traps in your scripts.md (100%) rename published/{ => 202010}/20200723 Automate testing for website errors with this Python tool.md (100%) rename published/{ => 202010}/20200810 How to read Lynis reports to improve Linux security.md (100%) rename published/{ => 202010}/20200811 TCP window scaling, timestamps and SACK.md (100%) rename published/{ => 202010}/20200820 Learn the basics of programming with C.md (100%) rename published/{ => 202010}/20200826 What is IPv6, and why aren-t we there yet.md (100%) rename published/{ => 202010}/20200901 Create a mobile app with Flutter.md (100%) rename published/{ => 202010}/20200903 A practical guide to learning awk.md (100%) rename published/{ => 202010}/20200908 How to install software with Ansible.md (100%) rename published/{ => 202010}/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md (100%) rename published/{ => 202010}/20200914 NFC vs. Bluetooth LE- When to use which.md (100%) rename published/{ => 202010}/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md (100%) rename published/{ => 202010}/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md (100%) rename published/{ => 202010}/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md (100%) rename published/{ => 202010}/20200921 Installing and running Vagrant using qemu-kvm.md (100%) rename published/{ => 202010}/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md (100%) rename published/{ => 202010}/20200923 Find security issues in Go code using gosec.md (100%) rename published/{ => 202010}/20200925 5 questions to ask yourself when writing project documentation.md (100%) rename published/{ => 202010}/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md (100%) rename published/{ => 202010}/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md (100%) rename published/{ => 202010}/20200928 Create template files in GNOME.md (100%) rename published/{ => 202010}/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md (100%) rename published/{ => 202010}/20200928 How to view information on your Linux devices with lshw.md (100%) rename published/{ => 202010}/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md (100%) rename published/{ => 202010}/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md (100%) rename published/{ => 202010}/20200930 Recovering deleted files on Linux with testdisk.md (100%) rename published/{ => 202010}/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md (100%) rename published/{ => 202010}/20201006 Simplify your web experience with this internet protocol alternative.md (100%) rename published/{ => 202010}/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md (100%) rename published/{ => 202010}/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md (100%) rename published/{ => 202010}/20201009 How to Remove Physical Volume from a Volume Group in LVM.md (100%) rename published/{ => 202010}/20201010 6 Essential Things To Do After Installing Manjaro Linux.md (100%) rename published/{ => 202010}/20201012 Could Microsoft be en route to dumping Windows in favor of Linux.md (100%) rename published/{ => 202010}/20201012 Linux Jargon Buster- What is Display Manager in Linux.md (100%) rename published/{ => 202010}/20201013 Install MariaDB or MySQL on Linux.md (100%) rename published/{ => 202010}/20201014 2 Ways to Download Files From Linux Terminal.md (100%) rename published/{ => 202010}/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md (100%) rename published/{ => 202010}/20201014 Try Linux on any computer with this bootable USB tool.md (100%) rename published/{ => 202010}/20201016 Set up ZFS on Linux with yum.md (100%) rename published/{ => 202010}/20201027 Fedora 33 is officially here.md (100%) diff --git a/published/20180414 Go on very small hardware Part 2.md b/published/202010/20180414 Go on very small hardware Part 2.md similarity index 100% rename from published/20180414 Go on very small hardware Part 2.md rename to published/202010/20180414 Go on very small hardware Part 2.md diff --git a/published/20180710 Building a Messenger App- Messages.md b/published/202010/20180710 Building a Messenger App- Messages.md similarity index 100% rename from published/20180710 Building a Messenger App- Messages.md rename to published/202010/20180710 Building a Messenger App- Messages.md diff --git a/published/20180710 Building a Messenger App- Realtime Messages.md b/published/202010/20180710 Building a Messenger App- Realtime Messages.md similarity index 100% rename from published/20180710 Building a Messenger App- Realtime Messages.md rename to published/202010/20180710 Building a Messenger App- Realtime Messages.md diff --git a/published/20180712 Building a Messenger App- Development Login.md b/published/202010/20180712 Building a Messenger App- Development Login.md similarity index 100% rename from published/20180712 Building a Messenger App- Development Login.md rename to published/202010/20180712 Building a Messenger App- Development Login.md diff --git a/published/20180716 Building a Messenger App- Access Page.md b/published/202010/20180716 Building a Messenger App- Access Page.md similarity index 100% rename from published/20180716 Building a Messenger App- Access Page.md rename to published/202010/20180716 Building a Messenger App- Access Page.md diff --git a/published/20180719 Building a Messenger App- Home Page.md b/published/202010/20180719 Building a Messenger App- Home Page.md similarity index 100% rename from published/20180719 Building a Messenger App- Home Page.md rename to published/202010/20180719 Building a Messenger App- Home Page.md diff --git a/published/20180720 Building a Messenger App- Conversation Page.md b/published/202010/20180720 Building a Messenger App- Conversation Page.md similarity index 100% rename from published/20180720 Building a Messenger App- Conversation Page.md rename to published/202010/20180720 Building a Messenger App- Conversation Page.md diff --git a/published/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md b/published/202010/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md similarity index 100% rename from published/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md rename to published/202010/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md diff --git a/published/20190521 How to Disable IPv6 on Ubuntu Linux.md b/published/202010/20190521 How to Disable IPv6 on Ubuntu Linux.md similarity index 100% rename from published/20190521 How to Disable IPv6 on Ubuntu Linux.md rename to published/202010/20190521 How to Disable IPv6 on Ubuntu Linux.md diff --git a/published/20190822 Things You Didn-t Know About GNU Readline.md b/published/202010/20190822 Things You Didn-t Know About GNU Readline.md similarity index 100% rename from published/20190822 Things You Didn-t Know About GNU Readline.md rename to published/202010/20190822 Things You Didn-t Know About GNU Readline.md diff --git a/published/20191105 My first contribution to open source- Making a decision.md b/published/202010/20191105 My first contribution to open source- Making a decision.md similarity index 100% rename from published/20191105 My first contribution to open source- Making a decision.md rename to published/202010/20191105 My first contribution to open source- Making a decision.md diff --git a/published/20200512 Scan your Linux security with Lynis.md b/published/202010/20200512 Scan your Linux security with Lynis.md similarity index 100% rename from published/20200512 Scan your Linux security with Lynis.md rename to published/202010/20200512 Scan your Linux security with Lynis.md diff --git a/published/20200521 Use the internet from the command line with curl.md b/published/202010/20200521 Use the internet from the command line with curl.md similarity index 100% rename from published/20200521 Use the internet from the command line with curl.md rename to published/202010/20200521 Use the internet from the command line with curl.md diff --git a/published/20200629 Using Bash traps in your scripts.md b/published/202010/20200629 Using Bash traps in your scripts.md similarity index 100% rename from published/20200629 Using Bash traps in your scripts.md rename to published/202010/20200629 Using Bash traps in your scripts.md diff --git a/published/20200723 Automate testing for website errors with this Python tool.md b/published/202010/20200723 Automate testing for website errors with this Python tool.md similarity index 100% rename from published/20200723 Automate testing for website errors with this Python tool.md rename to published/202010/20200723 Automate testing for website errors with this Python tool.md diff --git a/published/20200810 How to read Lynis reports to improve Linux security.md b/published/202010/20200810 How to read Lynis reports to improve Linux security.md similarity index 100% rename from published/20200810 How to read Lynis reports to improve Linux security.md rename to published/202010/20200810 How to read Lynis reports to improve Linux security.md diff --git a/published/20200811 TCP window scaling, timestamps and SACK.md b/published/202010/20200811 TCP window scaling, timestamps and SACK.md similarity index 100% rename from published/20200811 TCP window scaling, timestamps and SACK.md rename to published/202010/20200811 TCP window scaling, timestamps and SACK.md diff --git a/published/20200820 Learn the basics of programming with C.md b/published/202010/20200820 Learn the basics of programming with C.md similarity index 100% rename from published/20200820 Learn the basics of programming with C.md rename to published/202010/20200820 Learn the basics of programming with C.md diff --git a/published/20200826 What is IPv6, and why aren-t we there yet.md b/published/202010/20200826 What is IPv6, and why aren-t we there yet.md similarity index 100% rename from published/20200826 What is IPv6, and why aren-t we there yet.md rename to published/202010/20200826 What is IPv6, and why aren-t we there yet.md diff --git a/published/20200901 Create a mobile app with Flutter.md b/published/202010/20200901 Create a mobile app with Flutter.md similarity index 100% rename from published/20200901 Create a mobile app with Flutter.md rename to published/202010/20200901 Create a mobile app with Flutter.md diff --git a/published/20200903 A practical guide to learning awk.md b/published/202010/20200903 A practical guide to learning awk.md similarity index 100% rename from published/20200903 A practical guide to learning awk.md rename to published/202010/20200903 A practical guide to learning awk.md diff --git a/published/20200908 How to install software with Ansible.md b/published/202010/20200908 How to install software with Ansible.md similarity index 100% rename from published/20200908 How to install software with Ansible.md rename to published/202010/20200908 How to install software with Ansible.md diff --git a/published/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md b/published/202010/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md similarity index 100% rename from published/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md rename to published/202010/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md diff --git a/published/20200914 NFC vs. Bluetooth LE- When to use which.md b/published/202010/20200914 NFC vs. Bluetooth LE- When to use which.md similarity index 100% rename from published/20200914 NFC vs. Bluetooth LE- When to use which.md rename to published/202010/20200914 NFC vs. Bluetooth LE- When to use which.md diff --git a/published/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md b/published/202010/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md similarity index 100% rename from published/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md rename to published/202010/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md diff --git a/published/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md b/published/202010/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md similarity index 100% rename from published/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md rename to published/202010/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md diff --git a/published/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md b/published/202010/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md similarity index 100% rename from published/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md rename to published/202010/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md diff --git a/published/20200921 Installing and running Vagrant using qemu-kvm.md b/published/202010/20200921 Installing and running Vagrant using qemu-kvm.md similarity index 100% rename from published/20200921 Installing and running Vagrant using qemu-kvm.md rename to published/202010/20200921 Installing and running Vagrant using qemu-kvm.md diff --git a/published/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md b/published/202010/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md similarity index 100% rename from published/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md rename to published/202010/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md diff --git a/published/20200923 Find security issues in Go code using gosec.md b/published/202010/20200923 Find security issues in Go code using gosec.md similarity index 100% rename from published/20200923 Find security issues in Go code using gosec.md rename to published/202010/20200923 Find security issues in Go code using gosec.md diff --git a/published/20200925 5 questions to ask yourself when writing project documentation.md b/published/202010/20200925 5 questions to ask yourself when writing project documentation.md similarity index 100% rename from published/20200925 5 questions to ask yourself when writing project documentation.md rename to published/202010/20200925 5 questions to ask yourself when writing project documentation.md diff --git a/published/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md b/published/202010/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md similarity index 100% rename from published/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md rename to published/202010/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md diff --git a/published/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md b/published/202010/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md similarity index 100% rename from published/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md rename to published/202010/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md diff --git a/published/20200928 Create template files in GNOME.md b/published/202010/20200928 Create template files in GNOME.md similarity index 100% rename from published/20200928 Create template files in GNOME.md rename to published/202010/20200928 Create template files in GNOME.md diff --git a/published/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md b/published/202010/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md similarity index 100% rename from published/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md rename to published/202010/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md diff --git a/published/20200928 How to view information on your Linux devices with lshw.md b/published/202010/20200928 How to view information on your Linux devices with lshw.md similarity index 100% rename from published/20200928 How to view information on your Linux devices with lshw.md rename to published/202010/20200928 How to view information on your Linux devices with lshw.md diff --git a/published/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md b/published/202010/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md similarity index 100% rename from published/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md rename to published/202010/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md diff --git a/published/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md b/published/202010/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md similarity index 100% rename from published/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md rename to published/202010/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md diff --git a/published/20200930 Recovering deleted files on Linux with testdisk.md b/published/202010/20200930 Recovering deleted files on Linux with testdisk.md similarity index 100% rename from published/20200930 Recovering deleted files on Linux with testdisk.md rename to published/202010/20200930 Recovering deleted files on Linux with testdisk.md diff --git a/published/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md b/published/202010/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md similarity index 100% rename from published/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md rename to published/202010/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md diff --git a/published/20201006 Simplify your web experience with this internet protocol alternative.md b/published/202010/20201006 Simplify your web experience with this internet protocol alternative.md similarity index 100% rename from published/20201006 Simplify your web experience with this internet protocol alternative.md rename to published/202010/20201006 Simplify your web experience with this internet protocol alternative.md diff --git a/published/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md b/published/202010/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md similarity index 100% rename from published/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md rename to published/202010/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md diff --git a/published/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md b/published/202010/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md similarity index 100% rename from published/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md rename to published/202010/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md diff --git a/published/20201009 How to Remove Physical Volume from a Volume Group in LVM.md b/published/202010/20201009 How to Remove Physical Volume from a Volume Group in LVM.md similarity index 100% rename from published/20201009 How to Remove Physical Volume from a Volume Group in LVM.md rename to published/202010/20201009 How to Remove Physical Volume from a Volume Group in LVM.md diff --git a/published/20201010 6 Essential Things To Do After Installing Manjaro Linux.md b/published/202010/20201010 6 Essential Things To Do After Installing Manjaro Linux.md similarity index 100% rename from published/20201010 6 Essential Things To Do After Installing Manjaro Linux.md rename to published/202010/20201010 6 Essential Things To Do After Installing Manjaro Linux.md diff --git a/published/20201012 Could Microsoft be en route to dumping Windows in favor of Linux.md b/published/202010/20201012 Could Microsoft be en route to dumping Windows in favor of Linux.md similarity index 100% rename from published/20201012 Could Microsoft be en route to dumping Windows in favor of Linux.md rename to published/202010/20201012 Could Microsoft be en route to dumping Windows in favor of Linux.md diff --git a/published/20201012 Linux Jargon Buster- What is Display Manager in Linux.md b/published/202010/20201012 Linux Jargon Buster- What is Display Manager in Linux.md similarity index 100% rename from published/20201012 Linux Jargon Buster- What is Display Manager in Linux.md rename to published/202010/20201012 Linux Jargon Buster- What is Display Manager in Linux.md diff --git a/published/20201013 Install MariaDB or MySQL on Linux.md b/published/202010/20201013 Install MariaDB or MySQL on Linux.md similarity index 100% rename from published/20201013 Install MariaDB or MySQL on Linux.md rename to published/202010/20201013 Install MariaDB or MySQL on Linux.md diff --git a/published/20201014 2 Ways to Download Files From Linux Terminal.md b/published/202010/20201014 2 Ways to Download Files From Linux Terminal.md similarity index 100% rename from published/20201014 2 Ways to Download Files From Linux Terminal.md rename to published/202010/20201014 2 Ways to Download Files From Linux Terminal.md diff --git a/published/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md b/published/202010/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md similarity index 100% rename from published/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md rename to published/202010/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md diff --git a/published/20201014 Try Linux on any computer with this bootable USB tool.md b/published/202010/20201014 Try Linux on any computer with this bootable USB tool.md similarity index 100% rename from published/20201014 Try Linux on any computer with this bootable USB tool.md rename to published/202010/20201014 Try Linux on any computer with this bootable USB tool.md diff --git a/published/20201016 Set up ZFS on Linux with yum.md b/published/202010/20201016 Set up ZFS on Linux with yum.md similarity index 100% rename from published/20201016 Set up ZFS on Linux with yum.md rename to published/202010/20201016 Set up ZFS on Linux with yum.md diff --git a/published/20201027 Fedora 33 is officially here.md b/published/202010/20201027 Fedora 33 is officially here.md similarity index 100% rename from published/20201027 Fedora 33 is officially here.md rename to published/202010/20201027 Fedora 33 is officially here.md From 5efe97e9aa9d012df34cf44b48bdb1579c313bf6 Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Sun, 1 Nov 2020 15:42:00 +0800 Subject: [PATCH 0614/1156] Update 20190925 Most enterprise networks can-t handle big data loads.md --- ...0925 Most enterprise networks can-t handle big data loads.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20190925 Most enterprise networks can-t handle big data loads.md b/sources/talk/20190925 Most enterprise networks can-t handle big data loads.md index 725783e362..a55b0bdc91 100644 --- a/sources/talk/20190925 Most enterprise networks can-t handle big data loads.md +++ b/sources/talk/20190925 Most enterprise networks can-t handle big data loads.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( chenmu-kk ) +[#]: translator: (chenmu-kk) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From e94829fccb2ed12cd6aa556f33cdd489643b28f9 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 1 Nov 2020 15:52:21 +0800 Subject: [PATCH 0615/1156] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @xiao-song-123 恭喜你,完成了第一篇翻译贡献! --- ... source underpins blockchain technology.md | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/translated/tech/20201001 How open source underpins blockchain technology.md b/translated/tech/20201001 How open source underpins blockchain technology.md index da4141388c..716664f9bc 100644 --- a/translated/tech/20201001 How open source underpins blockchain technology.md +++ b/translated/tech/20201001 How open source underpins blockchain technology.md @@ -1,6 +1,6 @@ [#]: collector: "lujun9972" [#]: translator: "xiao-song-123" -[#]: reviewer: " " +[#]: reviewer: "wxy" [#]: publisher: " " [#]: url: " " [#]: subject: "How open source underpins blockchain technology" @@ -9,63 +9,61 @@ 开源是如何支撑区块链技术发展的 ====== -创造出区块链安全性和可靠性的原因:是开放,而非监管。 -![cubes coming together to create a larger cube][1] +> 创造出区块链安全性和可靠性的原因:是开放,而非监管。 +![](https://img.linux.net.cn/data/attachment/album/202011/01/155124l5c81g86mfwgjxfx.jpg) 当人们发现以安全性而闻名的区块链技术居然是建立在开源软件代码之上时,通常会感到非常惊讶。事实上,正是这种开放性才赋予了区块链技术的安全性和可靠性。 -把任何事物构建成开源的,其核心价值之一就是提高效率。建立起一个有着不同观点和技能的开发人员社区,这些开发人员工作在同一个代码库的时候,可以成倍增加构建出来的应用程序数量以及复杂性。 +以开源方式构建的任何事物,其核心价值之一就是为了提高效率。建立起一个有着不同观点和技能的开发人员社区,这些开发人员工作在同一个代码库的时候,可以成倍增加构建出来的应用程序数量以及复杂性。 ### 开源比人们想象中的要更加普遍 -开源的 Linux,就是一种比较流行的操作系统。Linux 为服务器提供了许多服务,这些服务让我们可以轻松地共享个人信息。其中包括 Google,Facebook 和数千个主要网站。当我们使用这些服务时,就是在和这些在网络上运行着 Linux 系统的计算机进行交互。Chromebook 也使用 Linux,Android 手机使用的操作系统也是基于 Linux 的。 +开源的 Linux,就是一种比较流行的操作系统。Linux 为服务器提供了许多服务,这些服务让我们可以轻松地共享个人信息。其中包括 Google、Facebook 和数千个主要网站。当我们使用这些服务时,就是在和这些在网络上运行着 Linux 系统的计算机进行交互。Chromebook 也使用 Linux,Android 手机使用的操作系统也是基于 Linux 的。 -Linux 不属于任何一家公司,人们可以免费使用并且可以共同协作来完善创造它。自 2005 年推出以来,已经有来自 1,700 多家公司的 20,000 多名开发人员 [为其中的代码做出了贡献][2] 。 +Linux 不属于任何一家公司,人们可以免费使用并且可以共同协作来完善创造它。自 2005 年推出以来,已经有来自 1,700 多家公司的 20,000 多名开发人员 [为其中的代码做出了贡献][2] 。 -这就是开源软件的工作原理。大量的人为此贡献,并不断添加、修改或构建开源代码库来创建新的应用程序和平台。区块链和加密货币的大部分代码都是使用开源软件开发的。开源软件是由热情的用户构建的,这些用户对错误、故障或缺陷时刻保持警惕。当发现问题时,开源社区中的开发人员将一起努力来解决问题。 +这就是开源软件的运作方式。大量的人为此贡献,并不断添加、修改或构建开源代码库来创建新的应用程序和平台。区块链和加密货币的大部分代码都是使用开源软件开发的。开源软件是由充满热情的用户构建的,这些用户对错误、故障或缺陷时刻保持警惕。当发现问题时,开源社区中的开发人员将一起努力来解决问题。 ### 区块链和开源 整个开源区块链开发者社区都在不断地添加和完善代码库。 -以下是区块链执行的基本方式: +以下是区块链的基本表现方式: * 区块链平台具有一个交易数据库,该交易数据库允许对等方在任何时候彼此进行交易。 * 附有用户识别标签,以方便交易。 * 平台一定有一种安全的方式来在交易批准前对交易进行验证。 * 无法被验证的交易不会进行。 +开源软件允许开发者在 [去中心化应用程序(Dapp)][3]中创建这些平台,这是区块链中交易的安全、保障和可变性的关键。 - -开源软件允许开发者在 [去中心化应用程序(Dapp)][3]中创建这些平台,这是区块链中交易的安全性、安全性和可变性的关键。 - -这种去中心化的方式意味着没有中央权威机构来调解交易,没有人能控制发生的事情。直接点对点的交易可以更快速、安全的进行。随着交易记录在分类账簿中,这条交易记录也会分发到系统各处。 +这种去中心化的方式意味着没有中央权威机构来调解交易,没有人能控制发生的事情。直接的点对点的交易可以更快速、安全的进行。由于交易被记录在分类账簿中,它们也会分发到整个生态系统中。 区块链使用密码学来保证安全。每一笔交易都携带着与前一笔交易相关联的信息,以验证其真实性。这可以防止威胁者篡改数据,因为一旦数据被添加到公共分类账中,其他用户就不能更改。 ### 区块链是开源的吗? -虽然区块链本身在技术上可能不是开源的,但区块链系统通常是使用开源软件实现的,因为没有政府机构对其进行监管,所以这些开源软件使用的概念体现了一种开放文化。私人公司开发的用于处理金融交易的专有软件很可能受到 [政府机构 ][4] 的监管。在美国,这可能包括美国证券交易委员会 (SEC)、联邦储备委员会和联邦存款保险公司 (FDIC)。区块链技术在开放环境下使用不需要政府监管,实际上,用来验证交易的是用户社区。 +虽然区块链本身在技术上可以是不开源的,但区块链系统通常是使用开源软件实现的,因为没有政府机构对其进行监管,所以这些开源软件使用的概念体现了一种开放文化。私人公司开发的用于处理金融交易的专有软件很可能受到 [政府机构][4] 的监管。在美国,这可能包括美国证券交易委员会(SEC)、联邦储备委员会和联邦存款保险公司(FDIC)。区块链技术在开放环境下使用不需要政府监管,实际上,用来验证交易的是用户社区。 -你可以称它为众包的一种极端形式,既用于开发构建区块链平台的开源软件,也用于验证交易。这就是区块链得到如此多关注的原因之一:它有可能颠覆整个行业,因为它可以作为处理和验证交易的权威中介。 +你可以称它为一种极端的众包形式,既用于开发构建区块链平台的开源软件,也用于验证交易。这就是区块链得到如此多关注的原因之一:它有可能颠覆整个行业,因为它可以作为处理和验证交易的权威中介。 ### 比特币,以太坊和其他加密货币 -截至2020年6月,超过 [5000万人拥有区块链钱包][5] 。他们大多数用于金融交易,例如交易比特币,以太坊和其他加密货币。 与交易员观察股票价格一样,[检查加密货币价格][6] 已成为许多人的主流。 +截至 2020 年 6 月,超过 [5000 万人拥有区块链钱包][5] 。他们大多数用于金融交易,例如交易比特币、以太坊和其他加密货币。对许多人来说,像交易员观察股票价格一样,[查看加密货币价格][6] 已成为主流。 -加密货币平台也使用开源软件。[以太坊项目][7] 开发出了任何人都可以免费使用的开源软件,社区中大量的开发者都为此贡献了代码。比特币客户端的参考实现版是由 450 多个开发人员和工程师进行开发的,他们已经贡献了超过 150,000 行代码。 +加密货币平台也使用开源软件。[以太坊项目][7] 开发出了任何人都可以免费使用的开源软件,社区中大量的开发者都为此贡献了代码。比特币客户端的参考实现版是由 450 多个开发人员和工程师进行开发的,他们已经贡献了超过 150,000 个贡献。 -加密货币区块链是一个持续增长的记录。每个被称作为块的记录按顺序链接在一起,它们互相链接形成一条链。每个块都有其自己的唯一标记,这个标记称为 [哈希][8] 。一个块包含自身的哈希值和前一个块密码的哈希值。从本质上讲,每个块都链接到前一个块,形成了无法中断的长链,每个长链都包含有关用于验证交易的其他块的信息。 +加密货币区块链是一个持续增长的记录。每个被称作为块的记录按顺序链接在一起,它们互相链接形成一条链。每个块都有其自己的唯一标记,这个标记称为 [哈希][8] 。一个块包含自身的哈希值和前一个块的加密计算出的哈希值。从本质上讲,每个块都链接到前一个块,形成了无法中断的长链,每个块都包含其它区块的信息,用于验证交易。 在金融或是加密货币的区块链中没有中央银行。这些分布在整个互联网中的区块,建立了一个性能强大的审计跟踪系统。任何人都能够通过区块链来验证交易,但却不能更改上面的记录。 ### 牢不可破的区块链 -尽管区块链不受任何政府或机构的监管,但分布式的网络保证了它们的安全。随着区块链的发展,每一笔交易都会增加伪造的难度。区块分布在世界各地的网络中,它们使用的信任标记不可被改变,这条链条变得牢不可破。 +尽管区块链不受任何政府或机构的监管,但分布式的网络保证了它们的安全。随着链的增长,每一笔交易都会增加伪造的难度。区块分布在世界各地的网络中,它们使用的信任标记不可被改变,这条链条几乎变得牢不可破。 -这种去中心化的网络,其背后的代码是开源的,也是用户在交易中不必使用诸如银行或经纪人之类的中介就可以相互信任的原因之一。支撑加密货币平台的软件是由相互独立的开发者组建的联盟创建的,并且任何人都可以免费使用。这创造了世界上最大的制衡体系之一。 +这种去中心化的网络,其背后的代码是开源的,这也是用户在交易中不必使用诸如银行或经纪人之类的中介就可以相互信任的原因之一。支撑加密货币平台的软件是由相互独立的开发者组建的联盟创建的,并且任何人都可以免费使用。这创造了世界上最大的制衡体系之一。 -------------------------------------------------------------------------------- @@ -74,7 +72,7 @@ via: https://opensource.com/article/20/10/open-source-blockchain 作者:[Matt Shealy][a] 选题:[lujun9972][b] 译者:[xiao-song-123](https://github.com/xiao-song-123) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From e1555dcfff044da1eead5f236f28949e2cd54ac3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 1 Nov 2020 15:53:48 +0800 Subject: [PATCH 0616/1156] PUB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @xiao-song-123 本文首发地址: https://linux.cn/article-12776-1.html 您的 LCTT 专页地址: https://linux.cn/lctt/xiao-song-123 --- ...0201001 How open source underpins blockchain technology.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201001 How open source underpins blockchain technology.md (99%) diff --git a/translated/tech/20201001 How open source underpins blockchain technology.md b/published/20201001 How open source underpins blockchain technology.md similarity index 99% rename from translated/tech/20201001 How open source underpins blockchain technology.md rename to published/20201001 How open source underpins blockchain technology.md index 716664f9bc..8205d3b2ce 100644 --- a/translated/tech/20201001 How open source underpins blockchain technology.md +++ b/published/20201001 How open source underpins blockchain technology.md @@ -1,8 +1,8 @@ [#]: collector: "lujun9972" [#]: translator: "xiao-song-123" [#]: reviewer: "wxy" -[#]: publisher: " " -[#]: url: " " +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12776-1.html" [#]: subject: "How open source underpins blockchain technology" [#]: via: "https://opensource.com/article/20/10/open-source-blockchain" [#]: author: "Matt Shealy https://opensource.com/users/mshealy" From c1fe687e1c06c3d8d58ecfe75c851ad26f9574f6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 1 Nov 2020 22:34:59 +0800 Subject: [PATCH 0617/1156] APL --- ...e Command in Debian, Ubuntu and Other Linux Distributions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md b/sources/tech/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md index 23b314319b..cc1fe5b59d 100644 --- a/sources/tech/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md +++ b/sources/tech/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 2af052f46694a36420b4c838ea5cc18fbd00b7bc Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 1 Nov 2020 23:08:00 +0800 Subject: [PATCH 0618/1156] TSL --- ...n, Ubuntu and Other Linux Distributions.md | 167 ----------------- ...n, Ubuntu and Other Linux Distributions.md | 169 ++++++++++++++++++ 2 files changed, 169 insertions(+), 167 deletions(-) delete mode 100644 sources/tech/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md create mode 100644 translated/tech/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md diff --git a/sources/tech/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md b/sources/tech/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md deleted file mode 100644 index cc1fe5b59d..0000000000 --- a/sources/tech/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md +++ /dev/null @@ -1,167 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions) -[#]: via: (https://itsfoss.com/apt-cache-command/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions -====== - -_**With apt-cache command, you can search for package details in the local APT cache. Learn to use apt-cache command in this tutorial.**_ - -### What is apt-cache command used for? - -The [apt][1] [package manager][2] works on a local cache of package metadata. The metadata usually consists information like package name, version, description, dependencies, its repository and developers. With the apt-cache command, you can query this local APT cache and get relevant information. - -You can search for the availability of a package, its version number, its dependencies among other things. I’ll show you how to use the apt-cache command with examples. - -The **location of APT cache** is /var/lib/apt/lists/ directory. Which repository metadata to cache depends on the repositories added in your source list in the /etc/apt/sources.list file and additional repository files located in ls /etc/apt/sources.list.d directory. - -Surprisingly, apt-cache doesn’t clear the APT cache. For that you’ll have to [use the apt-get clean command][3]. - -Needless to say, the APT packaging system is used on Debian and Debian-based Linux distributions like Ubuntu, Linux Mint, elementary OS etc. You cannot use it on Arch or Fedora. - -### Using apt-cache command - -![][4] - -Like any other Linux command, there are several options available with apt-cache and you can always refer to its man page to read about them. - -However, you probably won’t need to use all of them. This is why I am going to show you only the most common and useful examples of the apt-cache command in this tutorial. - -Always update - -It is always a good idea to update the local APT cache to sync it with the remote repositories. How do you do that? You use the command: - -**sudo apt update** - -#### Search for packages - -The most common use of apt-cache command is for finding package. You can use a regex pattern to search for a package in the local APT cache. - -``` -apt-cache search package_name -``` - -By default, it looks for the search term in both the name and description of the package. It shows the matching package along with its short description in alphabetical order. - -![][5] - -You can narrow down your search to look for the search term in package names only. - -``` -apt-cache search --names-only package_name -``` - -![][6] - -If you want complete details of all the matched packages, you may use the `--full` flag. It can also be used with `--names-only` flag. - -![][7] - -#### Get detailed package information - -If you know the exact package name (or if you have manged to find it with the search), you can get the detailed metadata information on the package. - -``` -apt-cache show package_name -``` - -![][8] - -You can see all kind of details in the package metadata like name, version, developer, maintainer, repository, short and long description, package size and even checksum. - -There is another option showpkg that displays information about the package name, version and its forward and reverse dependencies. - -``` -apt-cache showpkg package_name -``` - -#### apt-cache policy - -This is one of the rarely used option of apt-cache command. The policy options helps you debug the issue related to the [preference file][9]. - -If you specify the package name, it will show whether the package is installed, which version is available from which repository and its priority. - -![][10] - -By default, each installed package version has a priority of 100 and a non-installed package has a priority of 500. The same package may have more than one version with a different priority. APT installs the version with higher priority unless the installed version is newer. - -If this doesn’t make sense, it’s okay. It will be extremely rare for a regular Linux user to dwell this deep into package management. - -#### Check dependencies and reverse dependencies of a package - -You can [check the dependencies of a package][11] before (or even after) installing it. It also shows all the possible packages that can fulfill the dependency. - -``` -apt-cache depends package -``` - -![][12] - -You may also check which packages are dependent on a certain package by checking the reverse dependencies with apt-cahce. - -![][13] - -Frankly, I was also surprised to see that a DevOps tool like Ansible has a dependency on a [funny Linux command like Cowsay][14]. I think it’s perhaps because after [installing Ansible][15], it displays some message on the nodes. - -#### Check unmet dependencies - -You may get troubled with [unmet dependencies issue in Ubuntu][16] or other Linux. The apt-cache command provides option to check all the unmet dependencies of various available packages on your system. - -``` -apt-cache unmet -``` - -![][17] - -**Conclusion** - -You can list all available packages with the apt-cache command. The output would be huge, so I suggest combining it with [wc command][18] to get a total number of available packages like this: - -``` -apt-cache pkgnames | wc -l -``` - -Did you notice that you don’t need to be [root user][19] for using apt-cache command? - -The newer [apt command][20] has a few options available to match the features of apt-cache command. Since apt is new, apt-get and its associated commands like apt-cache are still preferred to be used in scripts. - -I hope you find this tutorial helpful. If you have questions about any point discussed above or suggestion to improve it, please let me know in the comments. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/apt-cache-command/ - -作者:[Abhishek Prakash][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/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://wiki.debian.org/Apt -[2]: https://itsfoss.com/package-manager/ -[3]: https://itsfoss.com/clear-apt-cache/ -[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-command.png?resize=800%2C450&ssl=1 -[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-search.png?resize=759%2C437&ssl=1 -[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-search-names-only.png?resize=759%2C209&ssl=1 -[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-show-full.png?resize=759%2C722&ssl=1 -[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-show-pkgname.png?resize=800%2C795&ssl=1 -[9]: https://debian-handbook.info/browse/stable/sect.apt-get.html#sect.apt.priorities -[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-policy.png?resize=795%2C456&ssl=1 -[11]: https://itsfoss.com/check-dependencies-package-ubuntu/ -[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-dependency-check.png?resize=768%2C304&ssl=1 -[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-reverse-dependency.png?resize=768%2C304&ssl=1 -[14]: https://itsfoss.com/funny-linux-commands/ -[15]: https://linuxhandbook.com/install-ansible-linux/ -[16]: https://itsfoss.com/held-broken-packages-error/ -[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-unmet.png?resize=759%2C399&ssl=1 -[18]: https://linuxhandbook.com/wc-command/ -[19]: https://itsfoss.com/root-user-ubuntu/ -[20]: https://itsfoss.com/apt-command-guide/ diff --git a/translated/tech/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md b/translated/tech/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md new file mode 100644 index 0000000000..36521d7fb8 --- /dev/null +++ b/translated/tech/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md @@ -0,0 +1,169 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions) +[#]: via: (https://itsfoss.com/apt-cache-command/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Debian、Ubuntu 中使用 apt-cache 命令 +====== + +> 使用 apt-cache 命令,你可以在本地 APT 缓存中搜索软件包的详细信息。在本教程中学习使用 apt-cache 命令。 + +### apt-cache 命令是用来干什么的? + +[APT][1] [包管理器][2]工作在软件包元数据的本地缓存上。元数据通常由包名、版本、描述、依赖关系、仓库和开发者等信息组成。通过 `apt-cache` 命令,你可以查询这个本地 APT 缓存并获得相关信息。 + +你可以搜索一个包的可用性、它的版本号、它的依赖关系等等。我将通过实例告诉你如何使用 `apt-cache`命令。 + +APT 缓存的位置是 `/var/lib/apt/lists/` 目录。缓存哪些仓库元数据取决于你的源列表中 `/etc/apt/sources.list` 文件中添加的仓库,以及位于 `/etc/apt/sources.list.d` 目录下的额外仓库文件。 + +令人惊讶的是,`apt-cache` 并不能清除 APT 缓存。为此,你必须[使用 apt-get clean 命令][3]。 + +不用说,APT 打包系统是在 Debian 和基于 Debian 的 Linux 发行版上使用的,比如 Ubuntu、Linux Mint、Elementary OS 等。你不能在 Arch 或 Fedora 上使用它。 + +### 使用 apt-cache 命令 + +![][4] + +就像其他 Linux 命令一样,`apt-cache` 也有一些可用的选项,你可以随时参考它的手册页来了解这些选项。 + +然而,你可能并不需要使用所有的选项。这就是为什么我在本教程中只向你展示 `apt-cache` 命令中最常见和最有用的例子。 + +#### 始终更新 + +更新本地 APT 缓存以与远程仓库同步是一个好主意。如何做到这一点呢?你可以使用命令: + +``` +sudo apt update +``` + +#### 搜索软件包 + +`apt-cache` 命令最常见的用途是查找软件包。你可以使用一个正则表达式来搜索本地 APT 缓存中的包。 + +``` +apt-cache search package_name +``` + +默认情况下,它会在软件包的名称和描述中查找搜索关键词。它按字母顺序显示匹配的软件包及其简短的描述。 + +![][5] + +你也可以缩小搜索范围,只在产品名称中查找搜索词。 + +``` +apt-cache search --names-only package_name +``` + +![][6] + +如果你想知道所有匹配软件包的完整细节,你可以使用 `--full` 标志。 + +![][7] + +#### 获取详细的包装信息 + +如果你知道确切的软件包名称(或者你已经成功地通过搜索找到了它),你可以得到软件包的详细元数据信息。 + +``` +apt-cache show package_name +``` + +![][8] + +你可以看到软件包元数据中的所有细节,比如名称、版本、开发者、维护者、仓库、长短描述、软件包大小甚至是校验和。 + +还有一个选项 `showpkg` 可以显示软件包的名称、版本、正向和反向依赖关系等信息。 + +``` +apt-cache showpkg package_name +``` + +#### apt-cache 的策略 + +这是 `apt-cache` 命令中很少使用的一个选项。`policy` 选项可以帮助你调试与 [preference 文件][9]相关的问题。 + +如果你指定了软件包的名称,它将显示该软件包是否已经安装,在哪个版本的仓库中可用,以及它的优先级。 + +![][10] + +默认情况下,每个已安装的软件包版本的优先级为 100,未安装的软件包的优先级为 500。同一软件包可能有多个不同优先级的版本。APT 会安装优先级较高的版本,除非安装的版本较新。 + +如果不理解这个部分,也没关系。对于一个普通的 Linux 用户来说,会极少纠结于这么深的软件包管理。 + +#### 检查软件包的依赖关系和反向依赖关系。 + +你可以在安装之前(甚至在安装之后)[检查一个包的依赖关系][11]。它还会显示所有可能满足依赖关系的软件包。 + +``` +apt-cache depends package +``` + +![][12] + +你也可以通过 `apt-cahce` 检查反向依赖关系来检查哪些包是依赖于某个包的。 + +![][13] + +坦白说,看到 Ansible 这样的 DevOps 工具对 [Cowsay 这样有趣的 Linux 命令][14]有依赖性,我也很惊讶。我想可能是因为在[安装 Ansible][15]之后,它会在节点上显示一些信息。 + +#### 检查未满足的依赖性 + +你可能会被 [Ubuntu 中未满足的依赖问题][16]所困扰,其他 Linux 也有类似问题。`apt-cache` 命令提供了一个选项来检查系统中各种可用软件包的所有未满足的依赖关系。 + +``` +apt-cache unmet +``` + +![][17] + +### 结论 + +你可以用 `apt-cache` 命令列出所有可用的软件包。输出结果会很庞大,所以我建议将其与 [wc 命令][18] 结合起来,得到可用软件包的总数,就像这样: + +``` +apt-cache pkgnames | wc -l +``` + +你是否注意到你不需要成为 [root 用户][19]就可以使用 `apt-cache` 命令? + +较新的 [apt 命令][20]也有一些与 `apt-cache` 命令对应的功能选项。由于 `apt` 比较新,所以在脚本中还是首选 `apt-get` 及其相关的 `apt-cache` 等命令。 + +希望你觉得本教程对你有帮助。如果你对上面讨论的任何一点有疑问或者有改进的建议,请在评论中告诉我。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/apt-cache-command/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://wiki.debian.org/Apt +[2]: https://itsfoss.com/package-manager/ +[3]: https://itsfoss.com/clear-apt-cache/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-command.png?resize=800%2C450&ssl=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-search.png?resize=759%2C437&ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-search-names-only.png?resize=759%2C209&ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-show-full.png?resize=759%2C722&ssl=1 +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-show-pkgname.png?resize=800%2C795&ssl=1 +[9]: https://debian-handbook.info/browse/stable/sect.apt-get.html#sect.apt.priorities +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-policy.png?resize=795%2C456&ssl=1 +[11]: https://itsfoss.com/check-dependencies-package-ubuntu/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-dependency-check.png?resize=768%2C304&ssl=1 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-reverse-dependency.png?resize=768%2C304&ssl=1 +[14]: https://itsfoss.com/funny-linux-commands/ +[15]: https://linuxhandbook.com/install-ansible-linux/ +[16]: https://itsfoss.com/held-broken-packages-error/ +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-unmet.png?resize=759%2C399&ssl=1 +[18]: https://linuxhandbook.com/wc-command/ +[19]: https://itsfoss.com/root-user-ubuntu/ +[20]: https://itsfoss.com/apt-command-guide/ From 48b0b5732c0a7bd5a98e9d0a09b0e359b524d8e9 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 2 Nov 2020 08:54:01 +0800 Subject: [PATCH 0619/1156] translated --- ... open source tools I can-t live without.md | 104 ------------------ ... open source tools I can-t live without.md | 103 +++++++++++++++++ 2 files changed, 103 insertions(+), 104 deletions(-) delete mode 100644 sources/tech/20201021 5 open source tools I can-t live without.md create mode 100644 translated/tech/20201021 5 open source tools I can-t live without.md diff --git a/sources/tech/20201021 5 open source tools I can-t live without.md b/sources/tech/20201021 5 open source tools I can-t live without.md deleted file mode 100644 index 25b79f9959..0000000000 --- a/sources/tech/20201021 5 open source tools I can-t live without.md +++ /dev/null @@ -1,104 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (5 open source tools I can't live without) -[#]: via: (https://opensource.com/article/20/10/open-source-tools) -[#]: author: (Victoria Martinez de la Cruz https://opensource.com/users/vkmc) - -5 open source tools I can't live without -====== -Increase your productivity inside and outside the terminal by keeping -these tools in your own bag of tricks. -![woman on laptop sitting at the window][1] - -Some time ago, I engaged with a Twitter thread that went viral among techies. The challenge? Pick only five tools that you cannot live without. I started to think about this in relation to my everyday life, and picking just five tools was not easy. I use many tools that I consider essential, such as my [IRC][2] client to connect with my colleagues and friends (yes, I still use IRC), a good text editor to hack on things, a calendar app to keep organized, and a videoconferencing platform when more direct interaction is needed. - -So let me put a twist on this challenge: Pick just five open source tools that boost your productivity. Here's my list; please share yours in the comments. - -### tmate - -![tmate screenshot][3] - -(Victoria Marinez de la Cruz, [CC BY-SA 4.0][4]) - -Oh, I love this tool. tmate is a fork of the well-known [tmux][5] terminal multiplexer that allows you to start a tmux session and share it over SSH. You can use it for [pair programming][6] (which is my primary use case) or for remote control. - -If you collaborate often with your team members, and you want an easy, distro-agnostic, open source way to program with them (and sharing terminal access is enough for you), this is definitely a must-add to your list. - -Get more info on [tmate's website][7], or check out the code on [GitHub][8]. - -### ix - -ix is a command-line pastebin. You don't need to install anything; you can create new pastes just by `curl`ing to the [ix.io][9] site. For example, `echo Hello world. | curl -F 'f:1=<-' ix.io` will give you a link to ix.io where the message "Hello world" is pasted. This is very convenient when you want to share logs for debugging purposes or to save config files in servers where you don't have a desktop environment. - -One downside is that the source code is not yet published, even though it is intended to be free and open source. If you are the author and are reading this post, please post the code so that we can contribute to the polishing process. - -### asciinema - -Yes, this is another terminal tool. asciinema allows you to record your terminal. There are many ways to use it, but I generally use it to make demos for presentations. It's very easy to use, and there are packages available for many Linux distributions and other platforms. - -To see how it works, check out this [cool demo][10]. Isn't it great? - -Get more information on [asciinema's website][11] and access its source code on [GitHub][12]. - -### GNOME Pomodoro - -![pomodoro timer gnome][13] - -(Victoria Martinez de la Cruz, [CC BY-SA 4.0][4]) - -OK, that's enough with the terminal tools. Now I want to share this simple gem for getting and staying organized. Have you heard about the [Pomodoro Technique][14]? Pomodoro is basically a time-management tool. It uses a tomato-shaped timer that helps you split your time into work chunks and breaks (by default, 25 minutes of work followed by five-minute breaks). And, after every four pomodoros, you take a longer break (15 minutes by default). The idea is that you stay focused during the work time, and you stretch and relax on the breaks. - -This sounds very, very simple, and you might be hesitant to allow a tomato-shaped clock to control your life, but it definitely helped me get better organized and avoid exhaustion when trying to focus on many things at the same time. - -Whatever your role, I highly recommend this practice. And among the many different tools that implement it, I recommend the GNOME Pomodoro app. It's available for major GNU/Linux distros, so it requires that you use the GNOME desktop environment (this might be its downside). - -Check out more information on [GNOME Pomodoro's website][15], and access its [GitHub][16] repo to get the source code and learn how you can contribute. - -### Jitsi - -Last but not least is Jitsi. When you're working on a remote, globally distributed team, you need a way to connect with people. Instant messaging is good, but sometimes it's better to have a quick meeting to discuss things face to face (well, seeing each other faces). There are a lot of [videoconferencing tools][17] available, but I like Jitsi a lot. Not only because it's free and open source, but also because it provides a clean, functional interface. You can set up your own Jitsi server (for business purposes), but you can also try out a public Jitsi instance by going to the [Jitsi Meet][18] website. - -A good practice for setting up this kind of meeting: use it only when you have a clear agenda in mind. And always ask yourself, can this meeting be an email instead? Follow these guidelines and use Jitsi with caution, and your workday will be extremely productive! - -Learn more on [Jitsi's website][19] and start contributing by accessing its [GitHub][20] repository. - -* * * - -I hope my list helps you reach the next level in productivity. What are your five, can't-do-without-them, open source productivity tools? Let me know in the comments! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/10/open-source-tools - -作者:[Victoria Martinez de la Cruz][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://opensource.com/users/vkmc -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-window-focus.png?itok=g0xPm2kD (young woman working on a laptop) -[2]: https://en.wikipedia.org/wiki/Internet_Relay_Chat -[3]: https://opensource.com/sites/default/files/pictures/tmate-opensource.jpg (tmate screenshot) -[4]: https://creativecommons.org/licenses/by-sa/4.0/ -[5]: https://opensource.com/article/20/7/tmux-cheat-sheet -[6]: https://en.wikipedia.org/wiki/Pair_programming -[7]: https://tmate.io/ -[8]: https://github.com/tmate-io/tmate -[9]: http://ix.io/ -[10]: https://asciinema.org/a/239367 -[11]: https://asciinema.org/ -[12]: https://github.com/asciinema/asciinema -[13]: https://opensource.com/sites/default/files/pictures/pomodoro_timer_gnome.jpg (pomodoro timer gnome) -[14]: https://en.wikipedia.org/wiki/Pomodoro_Technique -[15]: https://gnomepomodoro.org/ -[16]: https://github.com/codito/gnome-pomodoro -[17]: https://opensource.com/article/20/5/open-source-video-conferencing -[18]: https://meet.jit.si/ -[19]: https://jitsi.org/ -[20]: https://github.com/jitsi diff --git a/translated/tech/20201021 5 open source tools I can-t live without.md b/translated/tech/20201021 5 open source tools I can-t live without.md new file mode 100644 index 0000000000..027d230e86 --- /dev/null +++ b/translated/tech/20201021 5 open source tools I can-t live without.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 open source tools I can't live without) +[#]: via: (https://opensource.com/article/20/10/open-source-tools) +[#]: author: (Victoria Martinez de la Cruz https://opensource.com/users/vkmc) + +5 个我不能离开的开源工具 +====== +通过将这些工具放在自己的技囊中,提高终端内外的工作效率。 +![woman on laptop sitting at the window][1] + +前段时间,我参与了一个在科技人士中广为流传的 Twitter 话题。挑战是什么?只挑选五个你不能没有的工具。我开始结合我的日常生活来思考这个问题,只挑出五个工具并不容易。我使用了许多我认为必不可少的工具,比如我的 [IRC][2] 客户端来与同事和朋友联系(是的,我仍然使用 IRC),一个好的文本编辑器来做事情,一个日历应用来保持有条不紊,以及当需要更直接的互动时的一个视频会议平台。 + +所以,让我给这个挑战来个转折:选出五个能提高你工作效率的开源工具。这是我的清单。请在评论中分享你的清单。 + +### tmate + +![tmate screenshot][3] + +(Victoria Marinez de la Cruz, [CC BY-SA 4.0][4]) + +tmate 是著名的 [tmux][5] 终端多路复用器的一个分支,它允许你启动一个 tmux 会话并通过 SSH 共享。你可以用它来进行[配对编程][6](这是我的主要使用场景),也可以用来进行远程控制。 + +如果你经常与你的团队成员合作,并且你想要一个简单的、与发行版无关的、开源的方式与他们一起编程(而且共享终端访问对你来说已经足够了),这绝对是你必须加到列表中的东西。 + +在 [tmate 的网站][7]上获取更多信息,或者在 [GitHub][8] 上查看代码。 + +### ix + +ix 是一个命令行粘贴板。你不需要安装任何东西。你可以通过 `curl` 到 [ix.io][9] 站点来创建新的粘贴。例如, `echo Hello world. | curl -F 'f:1=<-' ix.io` 会给你一个到 ix.io 的链接,那里粘贴了消息 “Hello world” 的信息。当你想分享日志用于调试或在没有桌面环境的服务器上保存配置文件时,这非常方便。 + +有一个缺点是源码还没有公布,尽管它的目的是免费和开源。如果你是作者,并且正在阅读这篇文章,请发布代码,这样我们就可以为打磨过程做出贡献。 + +### asciinema + +是的,这是另一个终端工具,asciinema 可以让你记录你的终端。使用它的方法有很多,但我一般用它来制作 demo 演示。它非常容易使用,而且有很多 Linux 发行版和其他平台的软件包。 + +要想知道它是如何工作的,可以看看这个[酷炫的 demo][10]。是不是很棒? + +在 [asciinema 的网站][11]上获取更多信息,在 [GitHub][12] 上访问其源代码。 + +### GNOME Pomodoro + +![pomodoro timer gnome][13] + +(Victoria Martinez de la Cruz, [CC BY-SA 4.0][4]) + +好了,关于终端工具的介绍就到此为止。现在我想和大家分享一下这个简单的宝物,它让你的工作变得有条不紊。你听说过 [Pomodoro Technique][14] 吗?Pomodoro 基本上是一个时间管理工具。它使用一个番茄形状的计时器,帮助你将时间分成工作时间和休息时间(默认情况下,25 分钟的工作后有 5 分钟的休息时间)。而且,每隔 4 个 pomodoro 之后,你就会有更长的休息时间(默认为 15 分钟)。这样做的目的是让你在工作时间内保持专注,而在休息时间内进行伸展和放松。 + +这听起来非常非常简单,你可能会对让一个番茄形状的时钟来控制你的生活感到犹豫,但它确实帮助我更好地组织起来,避免在试图同时专注于许多事情时感到疲惫。 + +无论你是什么角色,我都强烈推荐这种做法。而在众多实现它的不同工具中,我推荐 GNOME Pomodoro 应用。它适用于主要的 GNU/Linux 发行版,所以它需要你使用 GNOME 桌面环境(这可能是它的缺点)。 + +在 [GNOME Pomodoro 的网站][15]上查看更多信息,并访问其 [GitHub][16] 仓库来获取源码并了解如何做出贡献。 + +### Jitsi + +最后但并非最不重要的是 Jitsi。当你在一个远程、全球分布的团队中工作时,你需要一种与人们联系的方式。即时通讯是好的,但有时最好还是开个快速会议,面对面地讨论事情(嗯,看到对方的脸)。有很多[视频会议工具][17]可用,但我很喜欢 Jitsi。不仅因为它是免费和开源的,还因为它提供了一个简洁、实用的界面。你可以设置自己的 Jitsi 服务器(用于商业目的),但你也可以通过访问 [Jitsi Meet][18] 网站来试用一个公共的 Jitsi 实例。 + +设置这种会议的一个好做法是:只有在你心中有明确的议程时才使用它。而且要时刻问自己,这个会议能不能用电子邮件代替?遵循这些准则,谨慎使用 Jitsi,你的工作日将会非常高效! + +在 [Jitsi 网站][19]上了解更多信息,并通过访问其 [GitHub][20] 仓库开始贡献。 + +* * * + +我希望我的清单能帮助你在生产力上达到一个新的水平。你的 5 个不能离开的开源生产力工具是什么?在评论中告诉我。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/open-source-tools + +作者:[Victoria Martinez de la Cruz][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/vkmc +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-window-focus.png?itok=g0xPm2kD (young woman working on a laptop) +[2]: https://en.wikipedia.org/wiki/Internet_Relay_Chat +[3]: https://opensource.com/sites/default/files/pictures/tmate-opensource.jpg (tmate screenshot) +[4]: https://creativecommons.org/licenses/by-sa/4.0/ +[5]: https://opensource.com/article/20/7/tmux-cheat-sheet +[6]: https://en.wikipedia.org/wiki/Pair_programming +[7]: https://tmate.io/ +[8]: https://github.com/tmate-io/tmate +[9]: http://ix.io/ +[10]: https://asciinema.org/a/239367 +[11]: https://asciinema.org/ +[12]: https://github.com/asciinema/asciinema +[13]: https://opensource.com/sites/default/files/pictures/pomodoro_timer_gnome.jpg (pomodoro timer gnome) +[14]: https://en.wikipedia.org/wiki/Pomodoro_Technique +[15]: https://gnomepomodoro.org/ +[16]: https://github.com/codito/gnome-pomodoro +[17]: https://opensource.com/article/20/5/open-source-video-conferencing +[18]: https://meet.jit.si/ +[19]: https://jitsi.org/ +[20]: https://github.com/jitsi From e653d0eaa9fa6e0111f04b7b0d0f3efc7d3e6fe8 Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Mon, 2 Nov 2020 09:22:03 +0800 Subject: [PATCH 0620/1156] Update 20190925 Most enterprise networks can-t handle big data loads.md --- ...0925 Most enterprise networks can-t handle big data loads.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20190925 Most enterprise networks can-t handle big data loads.md b/sources/talk/20190925 Most enterprise networks can-t handle big data loads.md index a55b0bdc91..52778b1b90 100644 --- a/sources/talk/20190925 Most enterprise networks can-t handle big data loads.md +++ b/sources/talk/20190925 Most enterprise networks can-t handle big data loads.md @@ -7,7 +7,7 @@ [#]: via: (https://www.networkworld.com/article/3440519/most-enterprise-networks-cant-handle-big-data-loads.html) [#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) -Most enterprise networks can't handle big data loads +大多数企业网络无法处理大数据负载 ====== As more data moves through the network, efforts to keep up are lagging due to leadership and technology issues. Metamorworks / Getty Images From d0cbcd227c64fdba1cb00160238465af99983d67 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 2 Nov 2020 09:28:52 +0800 Subject: [PATCH 0621/1156] translating --- sources/tech/20201028 What-s new in Fedora 33 Workstation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201028 What-s new in Fedora 33 Workstation.md b/sources/tech/20201028 What-s new in Fedora 33 Workstation.md index 853af7ed6a..bff7b31228 100644 --- a/sources/tech/20201028 What-s new in Fedora 33 Workstation.md +++ b/sources/tech/20201028 What-s new in Fedora 33 Workstation.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 7fd6b00240661e15881b9f7b7459b0d99cdddf63 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 2 Nov 2020 09:53:42 +0800 Subject: [PATCH 0622/1156] PRF @robsean --- ...pace in -boot Partition on Ubuntu Linux.md | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/translated/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md b/translated/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md index 6179dc28d4..085d6e978a 100644 --- a/translated/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md +++ b/translated/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Free Up Space in /boot Partition on Ubuntu Linux?) @@ -10,13 +10,13 @@ 如何在 Ubuntu Linux 上释放 /boot 分区的空间? ====== -前几天,我收到一个警告,/boot 分区已经几乎满了或者已经没有剩余空间了。是的,我有一个独立的 /boot 分区,我相信现在很少有人这样做了。 +前几天,我收到一个警告,`/boot` 分区已经几乎满了,没有剩余空间了。是的,我有一个独立的 `/boot` 分区,我相信现在很少有人这样做了。(LCTT 译注:个人认为保留单独的 /boot 分区是个好的运维经验,除此以外,/tmp、/var 也单独划定分区比较好。) -这是我第一次看到这样一个错误,它让我很迷惑。现在,这里有一些 [方法来释放在 Ubuntu 上的分区][1] (或者基于 Ubuntu 的发行版) ,但是在这种情况下并不是所有的方法都能用。 +这是我第一次看到这样一个错误,它让我很迷惑。现在,这里有一些 [方法来释放在 Ubuntu (或基于 Ubuntu 的分区)上的分区][1] ,但是在这种情况下并不是所有的方法都能用。 -这就是为什么我决定写这些我释放 /boot 分区空间的步骤的原因。 +这就是为什么我决定写这些我释放 `/boot` 分区空间的步骤的原因。 -### 如何在 Ubuntu 上释放 /boot 分区的空间(如果你的 /boot 分区空间不足) +### 如何在 Ubuntu 上释放 /boot 分区的空间 ![][2] @@ -24,7 +24,7 @@ #### 方法 1: 使用 apt autoremove -你不必是一名终端专家来做这件事,它只需要一个命令,你将移除未使用的内核来释放 /boot 分区中是空间。 +你不必是一名终端专家来做这件事,它只需要一个命令,你将移除未使用的内核来释放 `/boot` 分区中是空间。 你所有要做的事情是,输入: @@ -32,7 +32,7 @@ sudo apt autoremove ``` -这个命令不仅仅可以移除未使用的内核,而且也将摆脱你不需要的或工具安装后所不需要的依赖项。 +这个命令不仅仅可以移除未使用的内核,而且也将移除你不需要的或工具安装后所不需要的依赖项。 在你输入命令后,它将列出将被移除的东西,你只需要确认操作即可。如果你很好奇它将移除什么,你可以仔细检查一下看看它实际移除了什么。 @@ -40,13 +40,13 @@ sudo apt autoremove ![][3] -你必需按 **Y** 按键来继续。 +你必须按 `Y` 按键来继续。 -_**值得注意的是,这种方法只在你仅剩余一点点空间并并且得到警告的情况下才有效。但是,如果你的 /boot 分区已经满了,APT 甚至可能不会工作。**_ +**值得注意的是,这种方法只在你还剩余一点点空间,并且得到警告的情况下才有效。但是,如果你的 `/boot` 分区已经满了,APT 甚至可能不会工作。** 在接下来的方法中,我将重点介绍两种不同的方法,通过这些方法你可以使用 GUI 和终端来移除旧内核来释放空间。 -#### 方法 2: 手动移除未使用的内核(如果 apt autoremove 不工作的话) +#### 方法 2: 手动移除未使用的内核 在你尝试 [移除一些旧内核][4] 来释放空间前,你需要识别当前活动的内核,并且确保你不会删除它。 @@ -56,43 +56,43 @@ _**值得注意的是,这种方法只在你仅剩余一点点空间并并且 uname -r ``` -[uname 命令通常用于获取 Linux 系统信息][6] 。在这里,这个命令显示当前正在被使用的 Linux 内核。它看起来应该是这样: +[uname 命令通常用于获取 Linux 系统信息][6]。在这里,这个命令显示当前正在被使用的 Linux 内核。它看起来应该是这样: ![][7] -现在,你已经知道你当前的 Linux 内核是什么,你必需移除一个不同于这个版本内核的内核。你应该把它记录在某些地方,以便你不会不知不觉地移除它。 +现在,你已经知道你当前的 Linux 内核是什么,你必须移除一个不同于这个版本的内核。你应该把它记录在某些地方,以便你不会不知不觉地移除它。 -接下来,要移除它,你可以使用终端或 GUI . +接下来,要移除它,你可以使用终端或 GUI。 -警告! - -在删除内核时一定要额外的小心。只识别和删除旧内核,而不是当前你正在使用的内核,否则你将会拥有一个残缺的系统。 +> 警告! +> +> 在删除内核时一定要额外的小心。只识别和删除旧内核,而不是当前你正在使用的内核,否则你将会拥有一个残缺的系统。 ##### 使用一个 GUI 工具来移除旧的 Linux 内核 -你可以使用 [Synaptic 软件包管理器][8] 或一个类似 [Stacer][9] 的工具来开始。就我个人而言,当我遇到一个满满的 /boot 分区且 apt 损坏是,我使用 [Stacer][6] 来丢弃旧内核。因此,让我向你展示一下它看起的样子。 +你可以使用 [Synaptic 软件包管理器][8] 或一个类似 [Stacer][9] 的工具来开始。就我个人而言,当我遇到一个满满的 `/boot` 分区且 APT 损坏时,我使用 [Stacer][6] 来丢弃旧内核。因此,让我向你展示一下它看起的样子。 -首先,你需要启动 “**Stacer**” ,然后导航到软件包卸载器,如下面屏幕截图所示。 +首先,你需要启动 Stacer ,然后导航到软件包卸载器,如下面屏幕截图所示。 ![][10] -在这里,搜索 “**image**” ,你将找到你所拥有的 Linux 内核。你只需要删除旧内核版本的镜像,而不是当前内核的镜像。 +在这里,搜索 “image” ,你将找到你所拥有的 Linux 内核。你只需要删除旧内核版本的镜像,而不是当前内核的镜像。 -在上面的屏幕截图中,我已经指出了我系统上的当前内核和旧内核,因此你必需注意你系统上的内核。 +在上面的屏幕截图中,我已经指出了我系统上的当前内核和旧内核,因此你必须注意你系统上的内核。 你没有必要删除任何其它东西,只需要删除旧的内核版本。 -同样的,只需要在软件包列表中搜索 “**headers**” ,并删除如下显示的旧的 “**headers**” 版本。 +同样的,只需要在软件包列表中搜索 “headers” ,并删除如下显示的旧的 “headers” 版本。 ![][11] -只是提醒你,你 **不希望移除 “linux-headers-generic”** 。只是关注那些与其相关的有版本号的。 +作为提醒,你 **不会希望移除 `linux-headers-generic`** 。只关注一下那些与其相关的有版本号的就行。 -然后,就这样,你完成了所有的工作,apt 将会再次工作,并且你将成功地释放来自 /boot 分区的一些空间。同样地,你也可以使用任意其它的软件包管理器来完成这些工作。 +然后,就这样,你完成了所有的工作,APT 将会再次工作,并且你将成功地释放来自 `/boot` 分区的一些空间。同样地,你也可以使用任意其它的软件包管理器来完成这些工作。 #### 使用命令行来移除旧内核 -使用命令行来移除旧内核与使用 GUI 来移除旧内核是一样的。因此,如果你没有选择使用一款 GUI 软件 (如果它是一台远程机器/一项远程服务) 的权利,或者如果你只是对终端情有独钟,你可以仿效下面的步骤。 +使用命令行来移除旧内核与使用 GUI 来移除旧内核是一样的。因此,如果你没有选择使用 GUI 软件(如果它是一台远程机器/一项远程服务)的权利,或者如果你只是对终端情有独钟,你可以仿效下面的步骤。 首先,使用下面的命令列出所有已安装的内核: @@ -104,15 +104,15 @@ ls -l /boot ![][12] -写为 “**old**” 的内核,或者不匹配你当前内核版本,都是未使用的内核,你可以删除它们。 +标记为 “old” 的内核,或者不匹配你当前内核版本,都是未使用的内核,你可以删除它们。 -现在,你可以使用 **rm** 命令来移除具体指定来自 /boot 分区中的内核,使用下面的命令(一个命令对应一个内核): +现在,你可以使用 `rm` 命令来移除具体指定来自 `/boot` 分区中的内核,使用下面的命令(一个命令对应一个内核): ``` sudo rm /boot/vmlinuz-5.4.0-7634-generic ``` -务必检查你发系统的版本 — 它可能与你的系统的版本不同。 +务必检查系统的版本 — 这里可能与你的系统的版本不同。 如果你有很多未使用的内核,这将需要一些时间。因此,你也可以下面的命令丢弃多个内核: @@ -120,7 +120,7 @@ sudo rm /boot/vmlinuz-5.4.0-7634-generic sudo rm /boot/*-5.4.0-{7634}-* ``` -为了澄清这一点,你需要用逗号分隔内核版本号的最后一部分/编码,以便同时删除它们。 +为了清晰起见,你需要用逗号分隔内核版本号的最后一部分/编码,以便同时删除它们。 假设,我有两个旧的内核 5.4.0-7634-generic 和 5.4.0-7624 ,那么命令将是: @@ -128,15 +128,15 @@ sudo rm /boot/*-5.4.0-{7634}-* sudo rm /boot/*-5.4.0-{7634,7624}-* ``` -如果你不希望在 grub 启动菜单中再看到这些旧的内核版本,你可以使用下面的命令简单地 [更新 grub][13] : +如果你不希望在 grub 启动菜单中再看到这些旧的内核版本,你可以使用下面的命令简单地 [更新 grub][13]: ``` sudo update-grub ``` -就这样,你完成了所有的工作。你已经释放了空间,还修复了可能潜在的破损的 APT 问题,如果它是一个在你的 /boot 分区填满后出现的重要的问题的话。 +就这样,你完成了所有的工作。你已经释放了空间,还修复了可能潜在的破损的 APT 问题,如果它是一个在你的 `/boot` 分区填满后出现的重要的问题的话。 -在一些情况下,你需要输入这些命令来修复破损的 (正如我在论坛中注意到的): +在一些情况下,你需要输入这些命令来修复破损的(正如我在论坛中注意到的): ``` sudo dpkg --configure -a @@ -152,7 +152,7 @@ via: https://itsfoss.com/free-boot-partition-ubuntu/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[robsean](https://github.com/robsean) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 73c447dba869f82075e16cf3a9a531fcb0dd9699 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 2 Nov 2020 09:56:11 +0800 Subject: [PATCH 0623/1156] PUB @robsean https://linux.cn/article-12779-1.html --- ...How to Free Up Space in -boot Partition on Ubuntu Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md (99%) diff --git a/translated/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md b/published/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md similarity index 99% rename from translated/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md rename to published/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md index 085d6e978a..c73bd3a14d 100644 --- a/translated/tech/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md +++ b/published/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12779-1.html) [#]: subject: (How to Free Up Space in /boot Partition on Ubuntu Linux?) [#]: via: (https://itsfoss.com/free-boot-partition-ubuntu/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From 68db4e26853c2a597fac0205faf986f8429ade48 Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Mon, 2 Nov 2020 14:19:17 +0800 Subject: [PATCH 0624/1156] Update 20190925 Most enterprise networks can-t handle big data loads.md --- ...se networks can-t handle big data loads.md | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sources/talk/20190925 Most enterprise networks can-t handle big data loads.md b/sources/talk/20190925 Most enterprise networks can-t handle big data loads.md index 52778b1b90..39c4a5195a 100644 --- a/sources/talk/20190925 Most enterprise networks can-t handle big data loads.md +++ b/sources/talk/20190925 Most enterprise networks can-t handle big data loads.md @@ -9,34 +9,34 @@ 大多数企业网络无法处理大数据负载 ====== -As more data moves through the network, efforts to keep up are lagging due to leadership and technology issues. +随着越来越多的数据通过网络传输,由于领导力和技术问题,数据网络跟上数据传输速度的工作正在滞后。 Metamorworks / Getty Images -Another week, another survey that finds IT cannot keep up with the ever-expanding data overload. This time the problem surrounds network bandwidth and overall performance. +又过了一周,另一项调查发现,IT已经无法跟上不断膨胀的数据过载。这次问题将围绕着网络带宽和整体性能展开。 -[A survey of 300 IT professionals][1] conducted by management consultant firm Accenture found the majority feel their enterprise networks are not up to the task of handling big data and internet of things (IoT) deployments. Only 43% of those companies polled said their networks are ready to support the cloud, IoT, and other digital technologies. +管理咨询公司埃森哲(Accenture)对[300名IT专业人士进行的一项调查][1] 发现,大多数人感觉他们企业网络无法胜任处理大数据的任务和物联网 (IoT) 部署。只有43%的受访公司表示他们的网络已经准备好支持云服务、物联网和其他数字技术。 **[ Learn more about SDN: Find out [where SDN is going][2] and learn the [difference between SDN and NFV][3]. | Get regularly scheduled insights: [Sign up for Network World newsletters][4]. ]** -A key reason (58%) is a “misalignment between IT and business needs” that is slowing those rollouts. That is an unusual finding, since 85% of respondents also reported that their networks were completely or mostly ready to support the business’ digital initiatives. So which is it? +一个关键原因(58%)是“IT与商业需求的不一致性”,这减缓了这些项目的推出。这是一个不同寻常的发现,因为85%的受访者也表示他们的网络已经完全或者大体上已经准备好支持企业的数字化计划。到底是哪一个呢? -The second and third most commonly cited barriers were “inherent complexities between business requirements and operational needs” and “demands for bandwidth, performance, etc. outpacing the ability to deliver” at 45% each. +第二和第三大时常提及的障碍是“业务需求和运营需求间固有的复杂性”以及“对带宽、性能等方面的需求超过交付能力”,各占45%。 -Network bottlenecks continue to grow as the sheer amount of data being pumped over the wires continues to increase thanks to analytics and other big data technologies. The survey found that bandwidth demands were not being met and current network performance continues to fall short. +由于分析技术和其他大数据技术的推动,大量传输数据持续涌入网络线路,网络瓶颈持续增长。调查发现,带宽需求并未满足,目前的网络性能依旧达不到要求。 -Other reasons cited were lack of networking skills, device sprawl, and aging equipment. +其他原因还包括缺乏网络技术、设备扩展和设备老化。 -### One solution to network performance woes: SDN +### 网络性能问题的一个解决方案:SDN -Accenture found that most firms said [software-defined networks (SDN)][5] were the solution for bandwidth and performance challenges, with 77% of those surveyed reporting they were in the process of deploying SDN or have completed the deployment. It qualified that, noting that while SDN may be in place in parts of the organization, it is not always rolled out uniformly enterprise-wide. +埃森哲发现,大多数公司表示 [软件定义网络 (SDN)][5] 是应对带宽和性能挑战的解决方案,77%的受访企业在调查中表示正在部署SDN或者已完成部署。它指出,虽然SDN可能在组织的某部分中存在,它并不总是在整个企业范围内统一地推出。 **** From HPE: [ITaaS and Corporate Storage Technology][6]: This blog explains why pay-per-use IT models, such as ITaaS, could be the next chapter in IT infrastructure. (Sponsored) **** -Now, while it seems no one ever has enough budget for all of their IT ambitions, 31% of those surveyed describe funding network improvements as “easy” and within the network infrastructure team’s control, with CIOs/CTOs being much more likely to report the funding process as “easy” (40%), compared to their direct reports (13%) or directors and vice presidents of infrastructure/network (19%).  +如今看来,似乎从未有人有足够的预算来满足他们所有的IT雄心,但31%受访者认为网络改善筹资“简单”。而且在网络基础设施团队的控制下,首席信息官/首席技术官更可能将融资过程报告为“轻松”(40%),相较于直接下属(13%)或基础设施/网络主管和副总裁(19%)。 -Saying, "Legacy networks alone cannot support the innovation and performance required in the digital age," the report calls for embracing new technologies, without saying SDN by name. It also called for greater collaboration between the C suite and their direct reports because it was clear there was a disconnect between how the two sides viewed things. +报告指出,“仅靠传统网络无法支持数字时代所需的创新和性能。”呼吁拥抱新技术,但没有提到SDN的名字。同时呼吁首席执行官和他们直接下属间加强合作,因为很明显,双方在看待问题的方式上存在分歧。 -"We believe a new network paradigm is needed to ensure networks meet current and future business needs. However, although there are signs of progress, the pace of change is slow. Companies must undertake significant work before they achieve a unified and standardized enterprise capability that will offer the bandwidth, performance and security necessary to support business needs today—and tomorrow," the report concluded. +报告总结说,“我们认为需要一种新的网络范式来确保网络满足当前和未来的业务需求。然而,尽管有进步的迹象,但改变的步伐缓慢。公司必须承担起重担,才能实现统一和标准化企业能力,提供必要的带宽、性能和安全,以支持当前和未来的业务需求”。 **[ Now see: [How network pros acquire skills for SDN, programmable networks][7] ]** From 43146304d8f5023c082a9a93d0779740bf52e39a Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Mon, 2 Nov 2020 14:21:01 +0800 Subject: [PATCH 0625/1156] Update 20190925 Most enterprise networks can-t handle big data loads.md --- ...0925 Most enterprise networks can-t handle big data loads.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20190925 Most enterprise networks can-t handle big data loads.md b/sources/talk/20190925 Most enterprise networks can-t handle big data loads.md index 39c4a5195a..53fb677838 100644 --- a/sources/talk/20190925 Most enterprise networks can-t handle big data loads.md +++ b/sources/talk/20190925 Most enterprise networks can-t handle big data loads.md @@ -48,7 +48,7 @@ via: https://www.networkworld.com/article/3440519/most-enterprise-networks-cant- 作者:[Andy Patrizio][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[chenmu-kk](https://github.com/chenmu-kk) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From bd1e0f4ec39b8ab486ee03c9624df516af227ec8 Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Mon, 2 Nov 2020 14:23:29 +0800 Subject: [PATCH 0626/1156] Rename sources/talk/20190925 Most enterprise networks can-t handle big data loads.md to translated/talk/20190925 Most enterprise networks can-t handle big data loads.md --- ...190925 Most enterprise networks can-t handle big data loads.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/talk/20190925 Most enterprise networks can-t handle big data loads.md (100%) diff --git a/sources/talk/20190925 Most enterprise networks can-t handle big data loads.md b/translated/talk/20190925 Most enterprise networks can-t handle big data loads.md similarity index 100% rename from sources/talk/20190925 Most enterprise networks can-t handle big data loads.md rename to translated/talk/20190925 Most enterprise networks can-t handle big data loads.md From 81532e53e440b87a4ed77b1a8bcb3e7aa2a59ae3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 3 Nov 2020 00:07:12 +0800 Subject: [PATCH 0627/1156] PRF @gxlct008 --- ...0503 Go on very small hardware (Part 3).md | 110 +++++++++--------- 1 file changed, 53 insertions(+), 57 deletions(-) diff --git a/translated/tech/20180503 Go on very small hardware (Part 3).md b/translated/tech/20180503 Go on very small hardware (Part 3).md index 28d5817236..11ef451aa7 100644 --- a/translated/tech/20180503 Go on very small hardware (Part 3).md +++ b/translated/tech/20180503 Go on very small hardware (Part 3).md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (gxlct008) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Go on very small hardware Part 3) @@ -9,27 +9,31 @@ Go 语言在极小硬件上的运用(三) ====== -[![STM32F030F4P6][1]][2] -在本系列的 [第一][3] 和 [第二][4] 部分中讨论的大多数示例都是以一种或另一种方式闪烁的 LED。起初它可能很有趣,但是一段时间后变得有些无聊。让我们做些更有趣的事情…… +![](https://img.linux.net.cn/data/attachment/album/202010/24/090026to9c9sweyrw9ww37.png) + + +在本系列的 [第一][3] 和 [第二][4] 部分中讨论的大多数示例都是以某种方式闪烁的 LED。起初它可能很有趣,但是一段时间后变得有些无聊。让我们做些更有趣的事情…… …让我们点亮更多的 LED! -### WS281x LEDs +![STM32F030F4P6][1] -[WS281x][5] RGB LED(及其克隆)非常受欢迎。您可以作为单个元素购买、链成长条或组装成矩阵、环或其他形状因子。 +### WS281x LED + +[WS281x][5] RGB LED(及其克隆品)非常受欢迎。你可以以单个元素购买、链成长条或组装成矩阵、环或其他形状。 ![WS2812B][6] -它们可以串联连接,基于这个事实,您可以只用 MCU 的单个引脚就可以控制一个很长的 LED 灯条。不幸的是,它们的内部控制器使用的物理协议不能直接适用于您在 MCU 中可以找到的任何外围设备。您必须使用 位脉冲bit-banging或以特殊方式使用可用的外设。 +它们可以串联连接,基于这个事实,你可以只用 MCU 的单个引脚就可以控制一个很长的 LED 灯条。不幸的是,它们的内部控制器使用的物理协议不能直接适用于你在 MCU 中可以找到的任何外围设备。你必须使用 位脉冲bit-banging或以特殊方式使用可用的外设。 -哪种可用的解决方案最有效取决于同时控制的 LED 灯条数量。如果您必须驱动 4 到 16 个条带,那么最有效的方法是 [使用定时器和 DMA][7](请不要忽略 Martin 文章末尾的链接)。 +哪种可用的解决方案最有效取决于同时控制的 LED 灯条数量。如果你必须驱动 4 到 16 个灯条,那么最有效的方法是 [使用定时器和 DMA][7](请不要忽略这篇文章末尾的链接)。 -如果只需要控制一个或两个条带,请使用可用的 SPI 或 UART 外设。对于 SPI,您只能在发送的一个字节中编码两个 WS281x 位。由于巧妙地使用了起始位和停止位,UART 允许更密集的编码:每发送一个字节 3 位。 +如果只需要控制一个或两个灯条,请使用可用的 SPI 或 UART 外设。对于 SPI,你只能在发送的一个字节中编码两个 WS281x 位。由于巧妙地使用了起始位和停止位,UART 允许更密集的编码:每发送一个字节 3 位。 -我在 [此站点][8] 上找到了有关 UART 协议如何适用于 WS281x 协议的最佳解释。如果您不懂波兰语,这里是 [英文翻译][9]。 +我在 [此站点][8] 上找到了有关 UART 协议如何适用于 WS281x 协议的最佳解释。如果你不懂波兰语,这里是 [英文翻译][9]。 -基于 WS281x 的 LED 仍然是最受欢迎的,但市场上也有 SPI 控制的 LED:[APA102][10],[SK9822][11]。关于它们的三篇有趣的文章在这里:[1][12],[2][13],[3][14] +基于 WS281x 的 LED 仍然是最受欢迎的,但市场上也有 SPI 控制的 LED:[APA102][10]、[SK9822][11]。关于它们的三篇有趣的文章在这里:[1][12]、[2][13]、[3][14]。 ### LED 环 @@ -43,12 +47,11 @@ Go 语言在极小硬件上的运用(三) ![WS2812B][16] -我们的 STM32F030F4P6 MCU 和整个 STM32 F0、F3、F7、L4 系列具有 F1、F4、L1 MCU 不具备的一项重要功能:它可以反转 UART 信号,因此我们可以将环直接连接到 UART TXD 引脚。如果您不知道我们需要这种反转,那么您可能没有读过我上面提到的 [文章][9]。 +我们的 STM32F030F4P6 MCU 和整个 STM32 F0、F3、F7、L4 系列具有 F1、F4、L1 MCU 不具备的一项重要功能:它可以反转 UART 信号,因此我们可以将环直接连接到 UART TXD 引脚。如果你不知道我们需要这种反转,那么你可能没有读过我上面提到的 [文章][9]。 -因此,您不能以这种方式使用流行的 [Blue Pill][17] 或 [STM32F4-DISCOVERY][18]。使用其 SPI 外设或外部反相器。有关使用 SPI 的 NUCLEO-F411RE,请参见 [圣诞树灯][19] 项目作为 UART + 逆变器的示例或 [WS2812示例][20]。 +因此,你不能以这种方式使用流行的 [Blue Pill][17] 或 [STM32F4-DISCOVERY][18]。使用其 SPI 外设或外部反相器。有关使用 SPI 的 NUCLEO-F411RE,请参见 [圣诞树灯][19] 项目作为 UART + 逆变器的示例或 [WS2812示例][20]。 - -顺便说一下,大多数 DISCOVERY 板可能还有一个问题:它们在 VDD = 3V 而不是 3.3V 的情况下工作。 对于高 DI,WS281x 至少要求电源电压 * 0.7。如果是 5V 电源,则为 3.5V;如果是 4.7V 电源,则为 3.3V;可在 DISCOVERY 的 5V 引脚上找到。如您所见,即使在我们的情况下,第一个 LED 的工作电压也低于规格 0.2V。对于 DISCOVERY 板,如果供电 4.7V,它将工作在低于规格的 0.3V 下;如果供电 5V,它将工作在低于规格 0.5V 下。 +顺便说一下,大多数 DISCOVERY 板可能还有一个问题:它们在 VDD = 3V 而不是 3.3V 的情况下工作。 对于高 DI,WS281x 至少要求电源电压 * 0.7。如果是 5V 电源,则为 3.5V;如果是 4.7V 电源,则为 3.3V;可在 DISCOVERY 的 5V 引脚上找到。如你所见,即使在我们的情况下,第一个 LED 的工作电压也低于规格 0.2V。对于 DISCOVERY 板,如果供电 4.7V,它将工作在低于规格的 0.3V 下;如果供电 5V,它将工作在低于规格 0.5V 下。 让我们结束这段冗长的介绍并转到代码: @@ -134,9 +137,9 @@ var ISRs = [...]func(){ } ``` -##### 导入部分 +#### 导入部分 -与前面的示例相比,导入部分中的新内容是 `rand/math` 包和带有 `led/ws281x` 子树的 led 包。 led 包本身包含 `Color` 类型的定义。 `led/ws281x/wsuart` 定义了 `ColorOrder`、`Pixel` 和 `Strip` 类型。 +与前面的示例相比,导入部分中的新内容是 `rand/math` 包和带有 `led/ws281x` 子树的 `led` 包。 `led` 包本身包含 `Color` 类型的定义。 `led/ws281x/wsuart` 定义了 `ColorOrder`、`Pixel` 和 `Strip` 类型。 我想知道如何使用 `image/color` 中的 `Color` 或 `RGBA` 类型,以及如何以它将实现 `image.Image` 接口的方式定义 `Strip`。 但是由于使用了 [gamma 校正][21] 和 大开销的 `color/draw` 包,我以简单的方式结束: @@ -147,13 +150,13 @@ type Strip []Pixel 使用一些有用的方法。然而,这种情况在未来可能会改变。 -##### init 函数 +#### init 函数 `init` 函数没有太多新颖之处。 UART 波特率从 115200 更改为 3000000000/1390 ≈ 2158273,相当于每个 WS2812 位 1390 纳秒。 CR2 寄存器中的 TxInv 位设置为反转 TXD 信号。 -##### main 函数 +#### main 函数 -`XorShift64` 伪随机数生成器用于生成随机颜色。 [XORSHIFT][22] 是目前由 `math/rand` 包实现的唯一算法。您必须使用带有非零参数的 `Seed` 方法显式初始化它。 +`XorShift64` 伪随机数生成器用于生成随机颜色。 [XORSHIFT][22] 是目前由 `math/rand` 包实现的唯一算法。你必须使用带有非零参数的 `Seed` 方法显式初始化它。 `rgb` 变量的类型为 `wsuart.ColorOrder`,并设置为 WS2812 使用的 GRB 颜色顺序(WS2811 使用 RGB 顺序)。然后用于将颜色转换为像素。 @@ -166,9 +169,9 @@ strip.Clear() 其余代码使用随机颜色绘制类似于 “Please Wait…” 微调器的内容。 -条带切片充当帧缓冲区。 `tts.Write(strip.Bytes()` 将帧缓冲区的内容发送到环。 +`strip` 切片充当帧缓冲区。 `tts.Write(strip.Bytes())` 将帧缓冲区的内容发送到环。 -##### 中断 +#### 中断 该程序由处理中断的代码组成,与先前的 [UART 示例][23] 中的代码相同。 @@ -182,27 +185,25 @@ $ arm-none-eabi-size cortexm0.elf $ openocd -d0 -f interface/stlink.cfg -f target/stm32f0x.cfg -c 'init; program cortexm0.elf; reset run; exit' ``` -我跳过了 openocd 输出。下面的视频显示了该程序的工作原理: +我跳过了 `openocd` 的输出。下面的视频显示了该程序的工作原理: 原文中插入视频的代码: - + +![video](https://ziutek.github.io/videos/rgbspinner.mp4) ### 让我们做些有用的事情... -在 [第一部分][3] 的开头,我曾问过:“我们能降到多低,还能做一些有用的事情?”。 我们的 MCU 实际上是一种低端设备(8 比特的人可能会不同意我的看法),但到目前为止,我们还没有做任何有用的事情。 +在 [第一部分][3] 的开头,我曾问过:“Go 能深入到多低层,而还能做一些有用的事情?”。 我们的 MCU 实际上是一种低端设备(8 比特的人可能会不同意我的看法),但到目前为止,我们还没有做任何有用的事情。 所以... 让我们做些有用的事情... 让我们做个时钟! -在互联网上有许多由 RGB LED 构成的时钟示例。让我们用小板子和 RGB 环制作自己的时钟。我们按照下面的描述更改先前的代码。 +在互联网上有许多由 RGB LED 构成的时钟示例。让我们用我们的小板子和 RGB 环制作自己的时钟。我们按照下面的描述更改先前的代码。 -##### 导入部分 +#### 导入部分 删除 `math/rand` 包,然后添加 `stm32/hal/exti`。 -##### 全局变量 +#### 全局变量 添加两个新的全局变量:`btn` 和 `btnev`: @@ -214,9 +215,9 @@ var ( ) ``` -它们将用来处理那些用于设置时钟的 “button”。我们的板子除了重置之外没有其他按钮,但是如果没有它,我们仍然可以通过某种方式进行管理。 +它们将用来处理那些用于设置时钟的 “按钮”。我们的板子除了重置之外没有其他按钮,但是如果没有它,我们仍然可以通过某种方式进行管理。 -##### init 函数 +#### init 函数 将这段代码添加到 `init` 函数: @@ -237,9 +238,9 @@ rtos.IRQ(irq.EXTI4_15).Enable() 我们使用 EXTI 外设来跟踪 PA4 状态。它被配置为在发生任何更改时都会产生中断。 -##### btnWait 函数 +#### btnWait 函数 -定义一个新的辅助功能: +定义一个新的辅助函数: ``` func btnWait(state int, deadline int64) bool { @@ -254,7 +255,7 @@ func btnWait(state int, deadline int64) bool { } ``` -它等待 “button” 引脚上的指定状态,但只等到最后期限出现。这是稍微改进的轮询代码: +它等待 “按钮” 引脚上的指定状态,但只等到最后期限出现。这是稍微改进的轮询代码: ``` for btn.Load() != state { @@ -264,9 +265,9 @@ for btn.Load() != state { } ``` -我们的 `btnWait` 函数不是忙于等待状态或截止日期,而是使用 `rtos.EventFlag` 类型的 `btnev` 变量休眠,直到有事情发生。您当然可以使用通道而不是 `rtos.EventFlag`,但是后者便宜得多。 +我们的 `btnWait` 函数不是忙于等待 `state` 或 `deadline`,而是使用 `rtos.EventFlag` 类型的 `btnev` 变量休眠,直到有事情发生。你当然可以使用通道而不是 `rtos.EventFlag`,但是后者便宜得多。 -##### main 函数 +#### main 函数 我们需要全新的 `main` 函数: @@ -331,11 +332,11 @@ func main() { } ``` -我们使用 `rtos.Nanosec` 函数代替 `time.Now` 来获取当前时间。这样可以节省大量的 Flash,但也使我们的时钟变成了不知道日、月、年的老式设备,最糟糕的是它无法处理夏令时的变化。 +我们使用 `rtos.Nanosec` 函数代替 `time.Now` 来获取当前时间。这样可以节省大量的闪存,但也使我们的时钟变成了不知道日、月、年的老式设备,最糟糕的是它无法处理夏令时的变化。 我们的环有 24 个 LED,因此秒针的显示精度可以达到 2.5 秒。为了不牺牲这种精度并获得流畅的运行效果,我们使用 1/4 秒作为基准间隔。半秒就足够了,但四分之一秒更准确,而且与 16 和 48 个 LED 配合使用也很好。 -红色、绿色和蓝色分别用于时针、分针和秒针。这允许我们使用简单的 `逻辑或操作` 进行颜色混合。我们 `Color.Blend` 方法可以混合任意颜色,但是我们缺少 Flash,所以我们选择最简单的解决方案。 +红色、绿色和蓝色分别用于时针、分针和秒针。这允许我们使用简单的“逻辑或操作”进行颜色混合。我们 `Color.Blend` 方法可以混合任意颜色,但是我们闪存不多,所以我们选择最简单的解决方案。 我们只有在秒针移动时才重画时钟。 @@ -345,9 +346,9 @@ btnWait(0, int64(qs+ds)*25e7) 上面的这行代码等待的正是那一刻,或者是按钮的按下。 -每按一下按钮就会把时钟向前调一调。按住按钮一段时间会产生加速度。 +每按一下按钮就会把时钟向前调一调。按住按钮一段时间会加速调整。 -##### 中断 +#### 中断 定义新的中断处理程序: @@ -363,12 +364,11 @@ func exti4_15ISR() { 并将 `irq.EXTI4_15: exti4_15ISR` 条目添加到 ISR 数组。 -该处理程序(或中断服务程序)处理 EXTI4_15 IRQ。 Cortex-M0 CPU 支持的 IRQ 明显少于其较大的同类兄弟处理器,因此您经常可以看到一个 IRQ 被多个中断源共享。在我们的例子中,一个 IRQ 由 12 个 EXTI 线共享。 +该处理程序(或中断服务程序)处理 EXTI4_15 IRQ。 Cortex-M0 CPU 支持的 IRQ 明显少于其较大的同类兄弟处理器,因此你经常可以看到一个 IRQ 被多个中断源共享。在我们的例子中,一个 IRQ 由 12 个 EXTI 线共享。 -exti4_15ISR 读取所有挂起的位,并从中选择 12 个更高的有效位。接下来,它清除 EXTI 中选中的位并开始处理它们。在我们的例子中,仅检查第 4 位。 `btnev.Signal(1)` 引发 `btnev.Wait(1, deadline)` 唤醒并返回 true。 +exti4_15ISR 读取所有挂起的位,并从中选择 12 个更高的有效位。接下来,它清除 EXTI 中选中的位并开始处理它们。在我们的例子中,仅检查第 4 位。 `btnev.Signal(1)` 引发 `btnev.Wait(1, deadline)` 唤醒并返回 `true`。 - -您可以在 [Github][24] 上找到完整的代码。让我们来编译它: +你可以在 [Github][24] 上找到完整的代码。让我们来编译它: ``` $ egc @@ -377,7 +377,7 @@ $ arm-none-eabi-size cortexm0.elf 15960 240 216 16416 4020 cortexm0.elf ``` -这里所有的改进只有 184 个字节。让我们再次重新构建所有内容,但这次在 typeinfo 中不使用任何类型和字段名: +这里所有的改进只得到 184 个字节。让我们再次重新构建所有内容,但这次在 typeinfo 中不使用任何类型和字段名: ``` $ cd $HOME/emgo @@ -389,26 +389,22 @@ $ arm-none-eabi-size cortexm0.elf 15120 240 216 15576 3cd8 cortexm0.elf ``` -现在,有了千字节的空闲空间,您可以改进一些东西。让我们看看它是如何工作的: +现在,有了千字节的空闲空间,你可以改进一些东西。让我们看看它是如何工作的: -原文中插入视频的代码: - +![video](https://ziutek.github.io/videos/rgbclock.mp4) 我不知道我是怎么精确打到 3:00 的!? -以上就是所有内容!在第 4 部分(本系列的结束)中,我们将尝试在 LCD 上显示一些内容。 +以上就是所有内容!在第 4 部分(本系列的结束)中,我们将尝试在 LCD 上显示一些内容。(LCTT 译注:然而烂尾了,第三篇写于 2018 年,整个博客当年就停更了。) -------------------------------------------------------------------------------- via: https://ziutek.github.io/2018/05/03/go_on_very_small_hardware3.html -作者:[-;Michał Derkacz][a] +作者:[Michał Derkacz][a] 选题:[lujun9972][b] 译者:[gxlct008](https://github.com/gxlct008) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -416,8 +412,8 @@ via: https://ziutek.github.io/2018/05/03/go_on_very_small_hardware3.html [b]: https://github.com/lujun9972 [1]: https://ziutek.github.io/images/mcu/f030-demo-board/board.jpg [2]: https://ziutek.github.io/2018/05/03/go_on_very_small_hardware3.html -[3]: https://ziutek.github.io/2018/03/30/go_on_very_small_hardware.html -[4]: https://ziutek.github.io/2018/04/14/go_on_very_small_hardware2.html +[3]: https://linux.cn/article-11383-1.html +[4]: https://linux.cn/article-12747-1.html [5]: http://www.world-semi.com/solution/list-4-1.html [6]: https://ziutek.github.io/images/led/ws2812b.jpg [7]: http://www.martinhubacek.cz/arm/improved-stm32-ws2812b-library From b4550919c2bb51194a8723ec25c4c8081d3838b8 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 3 Nov 2020 00:09:13 +0800 Subject: [PATCH 0628/1156] PUB @gxlct008 https://linux.cn/article-12782-1.html --- .../20180503 Go on very small hardware (Part 3).md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20180503 Go on very small hardware (Part 3).md (99%) diff --git a/translated/tech/20180503 Go on very small hardware (Part 3).md b/published/20180503 Go on very small hardware (Part 3).md similarity index 99% rename from translated/tech/20180503 Go on very small hardware (Part 3).md rename to published/20180503 Go on very small hardware (Part 3).md index 11ef451aa7..ac3c5c9ebc 100644 --- a/translated/tech/20180503 Go on very small hardware (Part 3).md +++ b/published/20180503 Go on very small hardware (Part 3).md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (gxlct008) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12782-1.html) [#]: subject: (Go on very small hardware Part 3) [#]: via: (https://ziutek.github.io/2018/05/03/go_on_very_small_hardware3.html) [#]: author: (Michał Derkacz ) From 9b72fc0e71dafb5855a72cb5c78646e6eb04dd20 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 3 Nov 2020 00:14:34 +0800 Subject: [PATCH 0629/1156] PRF --- published/20180503 Go on very small hardware (Part 3).md | 2 -- 1 file changed, 2 deletions(-) diff --git a/published/20180503 Go on very small hardware (Part 3).md b/published/20180503 Go on very small hardware (Part 3).md index ac3c5c9ebc..4fa8c39c6d 100644 --- a/published/20180503 Go on very small hardware (Part 3).md +++ b/published/20180503 Go on very small hardware (Part 3).md @@ -187,8 +187,6 @@ $ openocd -d0 -f interface/stlink.cfg -f target/stm32f0x.cfg -c 'init; program c 我跳过了 `openocd` 的输出。下面的视频显示了该程序的工作原理: -原文中插入视频的代码: - ![video](https://ziutek.github.io/videos/rgbspinner.mp4) ### 让我们做些有用的事情... From 82f7535b747cb6c0fb4a8500ccb77be5a87d8e16 Mon Sep 17 00:00:00 2001 From: "Xiaobin.Liu" Date: Tue, 3 Nov 2020 00:42:41 +0800 Subject: [PATCH 0630/1156] APL --- ...atabase knowledge with this MariaDB and MySQL cheat sheet.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md b/sources/tech/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md index 3fd06952ce..b68e42e455 100644 --- a/sources/tech/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md +++ b/sources/tech/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lxbwolf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From ecd9342d21aafe5dfa8e40a349b30d32f9e776bc Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 3 Nov 2020 05:01:37 +0800 Subject: [PATCH 0631/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201102?= =?UTF-8?q?=204=20cool=20new=20projects=20to=20try=20in=20COPR=20from=20Oc?= =?UTF-8?q?tober=202020?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201102 4 cool new projects to try in COPR from October 2020.md --- ...ojects to try in COPR from October 2020.md | 132 ++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 sources/tech/20201102 4 cool new projects to try in COPR from October 2020.md diff --git a/sources/tech/20201102 4 cool new projects to try in COPR from October 2020.md b/sources/tech/20201102 4 cool new projects to try in COPR from October 2020.md new file mode 100644 index 0000000000..b88e106090 --- /dev/null +++ b/sources/tech/20201102 4 cool new projects to try in COPR from October 2020.md @@ -0,0 +1,132 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 cool new projects to try in COPR from October 2020) +[#]: via: (https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-from-october-2020/) +[#]: author: (frostyx https://fedoramagazine.org/author/frostyx/) + +4 cool new projects to try in COPR from October 2020 +====== + +![][1] + +COPR is a [collection][2] of personal repositories for software +that isn’t carried in Fedora. Some software doesn’t conform to +standards that allow easy packaging. Or it may not meet other Fedora +standards, despite being free and open-source. COPR can offer these +projects outside the Fedora set of packages. Software in COPR isn’t +supported by Fedora infrastructure or signed by the project. However, +it can be a neat way to try new or experimental software. + +This article presents a few new and interesting projects in COPR. If +you’re new to using COPR, see the [COPR User Documentation][3] +for how to get started. + +### Dialect + +[Dialect][4] translates text to foreign languages using Google Translate. It remembers your translation history and supports features such as automatic language detection and text to speech. The user interface is minimalistic and mimics the Google Translate tool itself, so it is really easy to use. + +![][5] + +#### Installation instructions + +The [repo][6] currently provides Dialect for Fedora 33 and Fedora +Rawhide. To install it, use these commands: + +``` +sudo dnf copr enable lyessaadi/dialect +sudo dnf install dialect +``` + +### GitHub CLI + +[gh][7] is an official GitHub command-line client. It provides fast +access and full control over your project issues, pull requests, and +releases, right in the terminal. Issues (and everything else) can also +be easily viewed in the web browser for a more standard user interface +or sharing with others. + +![][8] + +#### Installation instructions + +The [repo][9] currently provides _gh_ for Fedora 33 and Fedora +Rawhide. To install it, use these commands: + +``` +sudo dnf copr enable jdoss/github-cli +sudo dnf install github-cli +``` + +### Glide + +[Glide][10] is a minimalistic media player based on GStreamer. It +can play both local and remote files in any multimedia format +supported by GStreamer itself. If you are in need of a multi-platform +media player with a simple user interface, you might want to give Glide a try. + +![][11] + +#### Installation instructions + +The [repo][12] currently provides Glide for Fedora 32, 33, and +Rawhide. To install it, use these commands: + +``` +sudo dnf copr enable atim/glide-rs +sudo dnf install glide-rs +``` + +### Vim ALE + +[ALE][13] is a plugin for Vim text editor, providing syntax and +semantic error checking. It also brings support for fixing code and +many other IDE-like features such as TAB-completion, jumping to +definitions, finding references, viewing documentation, etc. + +![][14] + +#### Installation instructions + +The [repo][15] currently provides _vim-ale_ for Fedora 31, +32, 33, and Rawhide, as well as for EPEL8. To install it, use these +commands: + +``` +sudo dnf copr enable praiskup/vim-ale +sudo dnf install vim-ale +``` + +Editors note: Previous COPR articles can be found [here][16]. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-from-october-2020/ + +作者:[frostyx][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/frostyx/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2017/08/4-copr-945x400.jpg +[2]: https://copr.fedorainfracloud.org/ +[3]: https://docs.pagure.org/copr.copr/user_documentation.html +[4]: https://github.com/gi-lom/dialect +[5]: https://fedoramagazine.org/wp-content/uploads/2020/10/dialect.png +[6]: https://copr.fedorainfracloud.org/coprs/lyessaadi/dialect/ +[7]: https://github.com/cli/cli +[8]: https://fedoramagazine.org/wp-content/uploads/2020/10/github-cli.png +[9]: https://copr.fedorainfracloud.org/coprs/jdoss/github-cli/ +[10]: https://github.com/philn/glide +[11]: https://fedoramagazine.org/wp-content/uploads/2020/10/glide.png +[12]: https://copr.fedorainfracloud.org/coprs/atim/glide-rs/ +[13]: https://github.com/dense-analysis/ale +[14]: https://fedoramagazine.org/wp-content/uploads/2020/10/vim-ale.png +[15]: https://copr.fedorainfracloud.org/coprs/praiskup/vim-ale/ +[16]: https://fedoramagazine.org/?s=COPR From bafd09268f45bfd6b57ed4a40c9413cb181841bc Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 3 Nov 2020 05:03:11 +0800 Subject: [PATCH 0632/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201103?= =?UTF-8?q?=20The=20New=20Raspberry=20Pi=20400=20is=20Basically=20a=20Tiny?= =?UTF-8?q?=20Computer=20Inside=20a=20Keyboard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md --- ...cally a Tiny Computer Inside a Keyboard.md | 101 ++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 sources/tech/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md diff --git a/sources/tech/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md b/sources/tech/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md new file mode 100644 index 0000000000..016bd1c5cb --- /dev/null +++ b/sources/tech/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md @@ -0,0 +1,101 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard) +[#]: via: (https://itsfoss.com/raspberry-pi-400/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard +====== + +Raspberry Pi needs no introduction. What started as a low-spec computer for DIY enthusiasts, it can now be used as full-featured desktop. + +With the Raspberry Pi 400 release, they are making it more friendly for home computer usage. The Raspberry Pi 400 is basically a computer in the form of a keyboard. + +If you remember, [Commodore 64][1] was also a computer in the form of a keyboard back in 1982. Even though it isn’t unique, for a successful product like Raspberry Pi, it is a sweet deal. + +### Raspberry Pi 400: Overview + +![][2] + +It is based on the Raspberry Pi 4 (with 4 GB RAM) and has been tweaked to run cooler as well. With a Quad-core processor, it is faster than ever. + +Not just limited to the ease of use and portability, but it should save you a lot of desk space. And, just like me, if you were planning to get a spare computer to test stuff, I think I may want to go with the Raspberry Pi 400 instead of building another PC or [Linux-based mini PC][3]. + +Even though I’ve mentioned the tech specs below, you can watch the official video to get an idea on how it looks and if it’s promising enough as your home computer: + +### Raspberry Pi 400 specification + +Here’s the tech specs for the Pi 400: + + * Broadcom BCM2711 quad-core Cortex-A72 (ARM v8) 64-bit SoC @ 1.8GHz + * 4GB LPDDR4-3200 + * Dual-band (2.4GHz and 5.0GHz) IEEE 802.11b/g/n/ac wireless LAN + * Bluetooth 5.0, BLE + * Gigabit Ethernet + * 2 × USB 3.0 and 1 × USB 2.0 ports + * Horizontal 40-pin GPIO header + * 2 × micro HDMI ports (supports up to 4Kp60) + * H.265 (4Kp60 decode); H.264 (1080p60 decode, 1080p30 encode); OpenGL ES 3.0 graphics + * MicroSD card slot for operating system and data storage + * 78- or 79-key compact keyboard (depending on regional variant) + * 5V DC via USB connector + * Operating temperature: 0°C to +50°C ambient + * Maximum dimensions 286 mm × 122 mm × 23 mm + + + +![][4] + +### Pricing & Availability + +For **$70**, this is the best modern home computer that you can get with the simplicity of just having a keyboard and being able to carry it anywhere (you just need a screen to connect to). + +You can either get just the Raspberry Pi 400 for **$70** or get the complete kit for **$100** with a USB mouse, micro HDMI to HDMI cable, USB-C power supply, a beginners guide, and an SD card with Raspberry Pi OS pre-installed. + +If you’re wondering, for the keyboard layout support, here’s what the press release mentioned: + +> At launch, we are supporting English (UK and US), French, Italian, German, and Spanish keyboard layouts, with (for the first time) translated versions of the Beginner’s Guide. In the near future, we plan to support the same set of languages as our [official keyboard][5]. + +In other words, they support every major keyboard layout to start with. So, it shouldn’t be an issue for the majority. + +In addition to the details for keyboard layout, here’s how you can get your hands on a Raspberry Pi 400: + +> UK, US, and French Raspberry Pi 400 [kits][6] and [computers][7] are available to buy right now. Italian, German, and Spanish units are on their way to Raspberry Pi Approved Resellers, who should have them in stock in the next week. +> +> We expect that Approved Resellers in India, Australia, and New Zealand will have kits and computers in stock by the end of the year. We’re rapidly rolling out compliance certification for other territories too, so that Raspberry Pi 400 will be available around the world in the first few months of 2021. +> +> Of course, if you’re anywhere near Cambridge, you can head over to the [Raspberry Pi Store][8] to pick up your Raspberry Pi 400 today. + +[Raspberry Pi 400][9] + +### Wrapping Up + +Raspberry Pi 400 is definitely something impressive and useful in the current time when remote work is becoming the new norm. + +What do you think about the new Raspberry Pi 400? Planning to get one? Let me know your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/raspberry-pi-400/ + +作者:[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://en.wikipedia.org/wiki/Commodore_64 +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/raspberry-pi-400.jpg?resize=800%2C554&ssl=1 +[3]: https://itsfoss.com/linux-based-mini-pc/ +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/raspberry-pi-400-shot.jpeg?resize=800%2C572&ssl=1 +[5]: https://www.raspberrypi.org/products/raspberry-pi-keyboard-and-hub/ +[6]: https://www.raspberrypi.org/products/raspberry-pi-400/ +[7]: https://www.raspberrypi.org/products/raspberry-pi-400-unit/ +[8]: https://www.raspberrypi.org/raspberry-pi-store/ +[9]: https://www.raspberrypi.org/products/raspberry-pi-400 From fd3883c4382efd9d818a112eb75ce19353207947 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 3 Nov 2020 05:03:24 +0800 Subject: [PATCH 0633/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201103?= =?UTF-8?q?=20GnuCash:=20A=20Powerful=20Open=20Source=20Accounting=20Softw?= =?UTF-8?q?are?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201103 GnuCash- A Powerful Open Source Accounting Software.md --- ...owerful Open Source Accounting Software.md | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 sources/tech/20201103 GnuCash- A Powerful Open Source Accounting Software.md diff --git a/sources/tech/20201103 GnuCash- A Powerful Open Source Accounting Software.md b/sources/tech/20201103 GnuCash- A Powerful Open Source Accounting Software.md new file mode 100644 index 0000000000..0fb7826743 --- /dev/null +++ b/sources/tech/20201103 GnuCash- A Powerful Open Source Accounting Software.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (GnuCash: A Powerful Open Source Accounting Software) +[#]: via: (https://itsfoss.com/gnucash/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +GnuCash: A Powerful Open Source Accounting Software +====== + +_**Brief: GnuCash is a popular free and open-source accounting software that can be used to manage personal finance as well as business transactions.**_ + +Considering the complexities of managing personal finances and business transactions, you will find a lot of online services or software tools that aim to simplify things. Some tools simply let you add expenses and income to keep track of your savings while others offer different features. + +I have already covered several [open source account software][1] in the past. Here, I will be focusing on one of the options — **GnuCash**, which is a popular free accounting software with plenty of features for every user. + +### GnuCash: Free & Open Source Accounting Software + +![][2] + +GnuCash is a free accounting software tailored for professional requirements to track transactions, stocks, etc. It is available for Linux, BSD, macOS, and Windows as well. + +Even though it can be overwhelming to start with, it is easy to use for managing personal transactions as well. You can get a detailed report to analyze after you’ve started managing an account and added transactions to it. + +### Features of GnuCash + +![][3] + +As I mentioned earlier, GnuCash comes loaded with a bunch of features which could be overwhelming for someone new to accounting, but I think it should be worth it: + + * Double-entry Accounting + * Stock/Bond/Mutual Fund accounts + * Small-business accounting with tax support (like GST in India) + * Detailed report for breakdown + * Graph for easy analysis + * Financial calculations support + * Auto-saving feature + * Color coding + * Online Banking Wizard + * Journal + * Loan repayment calculator + * Price database for quick calculation + * Budget balance sheet, flow, graph for each category + * Ability to export as CSV + * Add Customer, Vendor, and Employee records separately + * Scheduled transactions + * Ability to set a Budget + * Configuring bill generator to ease up the accounting process + + + +I’m no expert but this is just the tip of the iceberg. You will find a host of options to customize and set for your accounting needs. + +![Gnucash Report][4] + +### Installing GnuCash on Linux + +You can find GnuCash in the software center of your Linux distribution. Install it from there or use the [package manager of your distribution][5]. + +A [Flatpak package][6] is also available for those who want the latest version. In case you didn’t know, I’d suggest you to go through our [Flatpak guide][7]. + +Alternatively, you can build it from source or you can head to their [official download page][8] to explore options for your Linux distribution. + +[GnuCash][9] + +### Wrapping Up + +For basic personal finance management, it was a little overwhelming for me because I prefer to use an Android app for simplicity. However, if you take a look around for a few minutes, it is easy to understand and GnuCash seems flexible for most requirements. + +If you like to manage your or your business’s finances, you may give it a try. It is definitely better than keeping data in spreadsheet :) + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gnucash/ + +作者:[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/open-source-accounting-software/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/gnucash.jpg?resize=800%2C633&ssl=1 +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/gnucash-screenshot.jpg?resize=800%2C636&ssl=1 +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/gnucash-report.jpg?resize=800%2C638&ssl=1 +[5]: https://itsfoss.com/package-manager/ +[6]: https://flathub.org/apps/details/org.gnucash.GnuCash +[7]: https://itsfoss.com/flatpak-guide/ +[8]: https://www.gnucash.org/download.phtml#distribution +[9]: https://www.gnucash.org From cdf43bef4b07f9d0a7ea8e2a37999466048aa8fe Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 3 Nov 2020 05:03:37 +0800 Subject: [PATCH 0634/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201103?= =?UTF-8?q?=20Linux=20Jargon=20Buster:=20What=20are=20GUI,=20CLI=20and=20T?= =?UTF-8?q?UI=20in=20Linux=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201103 Linux Jargon Buster- What are GUI, CLI and TUI in Linux.md --- ...ter- What are GUI, CLI and TUI in Linux.md | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 sources/tech/20201103 Linux Jargon Buster- What are GUI, CLI and TUI in Linux.md diff --git a/sources/tech/20201103 Linux Jargon Buster- What are GUI, CLI and TUI in Linux.md b/sources/tech/20201103 Linux Jargon Buster- What are GUI, CLI and TUI in Linux.md new file mode 100644 index 0000000000..cc4b54ff55 --- /dev/null +++ b/sources/tech/20201103 Linux Jargon Buster- What are GUI, CLI and TUI in Linux.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux Jargon Buster: What are GUI, CLI and TUI in Linux?) +[#]: via: (https://itsfoss.com/gui-cli-tui/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Linux Jargon Buster: What are GUI, CLI and TUI in Linux? +====== + +When you start using Linux and follow Linux-based websites and forums, you’ll often come across terms like GUI, CLI and sometimes TUI. + +This chapter of Linux Jargon Buster briefly explains these terms so that you as a (new) Linux user can understand the context better when these acronyms are used. + +To be honest, the terms like GUI, CLI or TUI are not exclusive to Linux. These are generic computing terms and you’ll find them used in non-Linux discussions as well. + +### GUI – Graphical User Interface + +Probably the most common term you’ll across on It’s FOSS. It’s because we focus on desktop Linux users and try to cover the easy to use graphical methods and applications. + +A GUI application or graphical application is basically anything that you can interact with your mouse, touchpad or touch screen. You have icons and other visual notions and you can use your mouse pointer to access the functionalities. + +![GIMP: A GUI app for photo editing][1] + +On Linux, a [desktop environment][2] provides the graphical interface for you to interact with your system. Then you can use GUI applications like GIMP, VLC Firefox, LibreOffice, file manager etc for various tasks. + +GUI has made computing easier for the common users otherwise it would have remained a geek-only zone. + +### CLI – Command Line Interface + +CLI is basically a command line program that accepts inputs to perform a certain function. Basically, any application that you can use via commands in the terminal falls into this category. + +![apt-cache is a CLI tool for interacting with APT cache on Debian-based systems][3] + +Early computers didn’t have mouse to interact with the operating system. You had to do interact with the machine using commands. + +If you think that’s difficult you should know that the earlier computers didn’t even have a screen to see what is being typed on, they had actual paper printer to see their typed commands. I have never used such a computer or seen in my real life. The closest thing I used was the microcontroller kits during my studies. + +![Ken Thompson And Dennis Ritchie Working on developing UNIX operating system on PDP 11 computer. | Image Credit][4] + +Is CLI relevant these days? Absolutely. Commands always have their benefit specially when you are dealing with the core functioning and configuration of the operating system like setting up firewall, managing network or even [package management][5]. + +You may have a GUI-based application to do the same task but commands give you more granular access to those features. In any case, you’ll find that GUI application also interact with the operating system with commands (used in their code). + +![Handbrake GUI app uses FFMPEG CLI tool underneath][6] + +Many popular GUI applications are often based on CLI tools. Take [Handbrake][7] for example. It’s a popular open source media converter and it uses the [FFMPEG command][8] line tool underneath. + +Quite evidently, using command line tools is not as easy as the graphical ones. Don’t worry. Unless you have specific needs, you should be able to use your Linux system graphically. However, knowing the basic Linux commands helps a great deal. + +### TUI – Terminal User Interface (also known as Text-based User Interface) + +This is the most uncommon term of the three. TUI is basically part GUI and part CLI. Confused? Let me explain that for you. + +You already know that early computers used CLI. Before the advent of the actual GUI, the text-based user interface provided a very basic kind of graphical interaction in the terminal. You have more visuals and could use mouse and keyboard to interact with the application. + +![nnn File Browser in terminal][9] + +TUI stands for text-based user interface or terminal user interface. Text-based because primarily, you have a bunch of text on the screen and terminal user interface because they are used only in the terminal. + +TUI applications are not that common but you still have a bunch of them. [Terminal based web browsers][10] are good example of TUI programs. [Terminal-based games][11] also fell in this category. + +![CMUS is terminal based music player][12] + +You may come across TUI when you are [installing multimedia codecs in Ubuntu][13] where you have to accept EULA or make a choice. + +TUI apps are not as user-friendly as GUI applications, and they often have a learning curve involved but they are a bit easier to use than the command line tools. + +**In the end…** + +TUI apps are often also considered as CLI applications because they are restricted to the terminal. In my opinion, it’s up to you if you consider them different from CLI. + +I hope you liked this part of Linux Jargon Buster. If you have any suggestions for topics in this series, please let me know in the comments and I’ll try to cover them in the future. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gui-cli-tui/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/04/gimp-2-10-interface.jpg?resize=800%2C450&ssl=1 +[2]: https://itsfoss.com/what-is-desktop-environment/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-search-names-only.png?resize=759%2C209&ssl=1 +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/Ken_Thompson_and_Dennis_Ritchie_at_PDP-11.jpg?resize=800%2C641&ssl=1 +[5]: https://itsfoss.com/package-manager/ +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/handbrake.png?resize=800%2C537&ssl=1 +[7]: https://itsfoss.com/handbrake/ +[8]: https://itsfoss.com/ffmpeg/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/nnn-file-browser.jpg?resize=800%2C597&ssl=1 +[10]: https://itsfoss.com/terminal-web-browsers/ +[11]: https://itsfoss.com/best-command-line-games-linux/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/07/cmus-interface.png?resize=734%2C436&ssl=1 +[13]: https://itsfoss.com/install-media-codecs-ubuntu/ From 10ddcc6505b3419f119f8ce685b735bb5ff9799b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 3 Nov 2020 05:03:50 +0800 Subject: [PATCH 0635/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201103?= =?UTF-8?q?=20A=20Brief=20History=20of=20Ubuntu=20Touch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201103 A Brief History of Ubuntu Touch.md --- ...0201103 A Brief History of Ubuntu Touch.md | 154 ++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 sources/tech/20201103 A Brief History of Ubuntu Touch.md diff --git a/sources/tech/20201103 A Brief History of Ubuntu Touch.md b/sources/tech/20201103 A Brief History of Ubuntu Touch.md new file mode 100644 index 0000000000..c770c2e613 --- /dev/null +++ b/sources/tech/20201103 A Brief History of Ubuntu Touch.md @@ -0,0 +1,154 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A Brief History of Ubuntu Touch) +[#]: via: (https://itsfoss.com/ubuntu-touch/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +A Brief History of Ubuntu Touch +====== + +Sensing the tech trend, Ubuntu tried its hands on creating a Linux-based mobile operating system. The first announcement came a decade back and six years down the line, Ubuntu closed the curtains on the project. + +What went wrong? How it started? Is Ubuntu Touch still alive? Let’s take a look at the history of Ubuntu Touch in chronological order. + +### Shuttleworth Announced Ubuntu Touch + +![][1] + +The [Ubuntu Touch project][2] began with a blog post by Canonical founder [Mark Shuttleworth][3]. The [blog post][4], dated October 31, 2011, started with a bold prediction: “By 14.04 LTS Ubuntu will power tablets, phones, TVs and smart screens from the car to the office kitchen, and it will connect those devices cleanly and seamlessly to the desktop, the server and the cloud.” + +Shuttleworth went on to explain that this move would be accomplished mainly through the use of the company’s new desktop environment, Unity. (Unity was introduced in Ubuntu 10.10.) “Unity, the desktop interface in today’s Ubuntu 11.10, was designed with this specific vision in mind.” + +The whole idea behind Unity was to create an interface that would work on different screen resolutions. + +_**“Unity’s core elements are arranged in exactly the way we need to create coherence across all of those devices. This was the origin of the name Unity – a single core interface framework, that scales across all screens, and supports all toolkits.”**_ + +Shuttleworth said that this move was motivated by the increasing use of mobile devices. “Make no mistake – just as the world is changing for manufacturers so is it changing for Linux distributions. Today, 70% of people in Egypt access the Internet solely via the phone. Even in the US that figure is a startling 25%.” + +### Ubuntu Touch is Released to the World + +![][5] + +The Unity desktop environment was originally introduced in the netbook version of Ubuntu 10.10. However, the phone interface wouldn’t be seen by the public until 2013. [Mark Shuttleworth demoed][6] it at the 2013 CES. + +Ubuntu Touch 1.0 was baked into the [Ubuntu 13.10 release][7]. This version primarily supported “Galaxy Nexus and Nexus 4 phone” with other images being available, as well. + +The [system requirements][8] for Ubuntu Touch looked a little bit like this: + +| Entry-level Ubuntu smartphone | High-end Ubuntu “superphone” +---|---|--- +Processor architecture | 1Ghz Cortex A9 | Quad-core A9 or Intel Atom +Memory | 512MB – 1GB | Min 1GB +Flash storage | 4-8GB eMMC + SD | Min 32GB eMMC + SD +Multi-touch | Yes | Yes +Desktop convergence | No | Yes + +![Convergence concept][9] + +Note: The last item on the above list (**desktop convergence**) might be a new idea to some people. This meant that you could use your Ubuntu Touch device like a phone, but you could also hook it up to a display, keyboard, and mouse to use it as a desktop. Unfortunately, Ubuntu Touch never gained this feature. + +### Ubuntu Tries to Crowdfund a Phone + +To show off what an ideal Ubuntu phone would look like, Canonical started a crowdfunding campaign to finance the [Ubuntu Edge][10] on July 22, 2013. The goal was to raise $32 million in a month to produce 40,000 devices. + +According to the campaign’s page, Canonical hoped to use the new device “to provide a low-volume, high-technology platform, crowdfunded by enthusiasts and mobile computing professionals. A pioneering project that accelerates the adoption of new technologies and drives them down into the mainstream.” + +The Ubuntu Edge was considered high-end at the time with the following specs: + +Mobile OS | Dual-boots Android and Ubuntu mobile +---|--- +Desktop OS | Ubuntu Desktop +RAM | 4GB +Internal storage | 128GB +Screen | 720 x 1,280, 4.5 inches +Protection | Sapphire Glass +Connectivity | Dual-LTE, GSM +Speakers | Stereo +Battery | Silicon-anode Li-ion +Price | $695 + +Interestingly, several large companies pledged money. For example, [Bloomberg pledged $800,000][11]. They made this pledge because they believed that Ubuntu Touch “could benefit its clients and the future of mobile Relevant Products/Services computing.” + +Ultimately, the campaign didn’t reach its goal. It only reached $12.7 million or 37% of the goal. The amount raised was the biggest a crowdfunding campaign ever saw. + +### Ubuntu Touch Goes into Production (Sort of) + +Though Canonical failed to make its own hardware, it continued working on the software part i.e., developing the Ubuntu Touch mobile operating system. + +![][12] + +Ubuntu Touch was released to device makers in 2014. That same year, [two device makers committed][13] to produce Ubuntu phones. These two companies, Chinese Meizu and Spanish BQ, weren’t exactly global household names, but Shuttleworth said that was all part of the plan. + +_“While we’re happy to work with household names, we want to be involved with partners for whom we can be a significant part of their story, rather than being appended to the more complicated story of other brands.”_ + +Both companies produced and released several phones with Ubuntu Touch as the main operating system. BQ also released an Ubuntu Touch tablet. However, no other manufacturer signed up to make Ubuntu Touch devices. + +### Canonical Discontinues Ubuntu Touch + +![Unity 8 was in beta when Ubuntu discontinued Unity and Ubuntu Touch project][14] + +In early April of 2017, Mark Shuttleworth made another [announcement][15]. After mentioning that Canonical had experienced an “excellent quarter and excellent year”, Shuttleworth [announced the end of the Ubuntu Touch and Unity][16]. “I’m writing to let you know that we will end our investment in Unity8, the phone and convergence shell.” Instead, Canonical would focus on desktop Ubuntu. + +He continued: + +> I took the view that, if convergence was the future and we could deliver it as free software, that would be widely appreciated both in the free software community and in the technology industry, where there is substantial frustration with the existing, closed, alternatives available to manufacturers. I was wrong on both counts. In the community, our efforts were seen fragmentation not innovation. And industry has not rallied to the possibility, instead taking a ‘better the devil you know’ approach to those form factors, or investing in home-grown platforms. What the Unity8 team has delivered so far is beautiful, usable and solid, but I respect that markets, and community, ultimately decide which products grow and which disappear. + +He closed by saying that it was a hard decision to make because of his strong belief in the future of convergence. + +### The Community Keeps the Project Alive + +When Shuttleworth’s announcement hit the internet, all the supporters of Ubuntu Touch were shocked. Many were unsure of what would happen to the devices that they owned. Thankfully, the community came to the rescue. + +![][17] + +Shortly after Shuttleworth’s announcement, Marius Gripsgård [announced][18] that the UBports team would be keeping Ubuntu Touch alive. UBports was already well known in the Ubuntu Touch community for their work on porting it to more devices. + +Several other projects tried to do the same with the desktop version of Unity, but most did not last long. One of them had the inventive name of Yunit but I guess it is not actively developed anymore. + +[UBports is the only project][2] that is keeping Ubuntu Touch alive by continuously working on its development. + +### Epilogue + +Ubuntu Touch was not the success that Canonical wanted it to be. It was too early for the market. However, it did lay the groundwork for the Linux phones that we have now. + +I believe that the [PinePhone][19] and the [Purism Librem 5][20] phone would not have come about without Ubuntu Touch sparking interest in a Linux phone. At the same time, the Canonical engineers and programmers solved problems that laid the groundwork for these modern phones. You don’t get successes without a few failures along the way. + +If you found this article interesting, please take a minute to share it on social media, Hacker News, or [Reddit][21]. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ubuntu-touch/ + +作者:[John Paul][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/john/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/ubuntu-touch-devices.jpg?resize=800%2C497&ssl=1 +[2]: https://ubuntu-touch.io/ +[3]: https://en.wikipedia.org/wiki/Mark_Shuttleworth +[4]: https://www.markshuttleworth.com/archives/820 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/ubuntu-touch-tablet.jpg?resize=625%2C363&ssl=1 +[6]: https://www.youtube.com/watch?v=RO7QbCqFY7Y +[7]: https://wiki.ubuntu.com/SaucySalamander/ReleaseNotes#Ubuntu_for_Phones +[8]: https://web.archive.org/web/20130326085927/http://www.ubuntu.com/devices/phone/operators-and-oems +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2016/02/convergence-ubuntu.jpg?resize=1024%2C588&ssl=1 +[10]: https://www.indiegogo.com/projects/ubuntu-edge#/ +[11]: https://web.archive.org/web/20131020144457/http://www.cio-today.com/story.xhtml?story_title=Ubuntu_Edge_Smartphone_Raises_Millions__Falls_Short&story_id=10200A158ZW0 +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2015/02/image-phone-overview.jpg?resize=567%2C302&ssl=1 +[13]: https://www.cnet.com/news/ubuntu-touch-gets-grip-on-its-first-phone-makers/ +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/unity8_ubports.png?resize=800%2C450&ssl=1 +[15]: https://ubuntu.com/blog/growing-ubuntu-for-cloud-and-iot-rather-than-phone-and-convergence +[16]: https://itsfoss.com/ubuntu-unity-shutdown/ +[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/ubports.jpeg?resize=720%2C480&ssl=1 +[18]: https://news.softpedia.com/news/ubuntu-touch-and-unity-8-are-not-dead-ubports-community-will-keep-them-alive-514620.shtml +[19]: https://itsfoss.com/pinephone/ +[20]: https://itsfoss.com/librem-linux-phone/ +[21]: https://%0Areddit.com/r/linuxusersgroup From d2f553f9513287cbc034223005ceb1db9f6a7557 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 3 Nov 2020 05:04:02 +0800 Subject: [PATCH 0636/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201103?= =?UTF-8?q?=2027=20Super=20Cool=20Raspberry=20Pi=20Zero=20W=20Projects=20f?= =?UTF-8?q?or=20DIY=20Enthusiasts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201103 27 Super Cool Raspberry Pi Zero W Projects for DIY Enthusiasts.md --- ... Pi Zero W Projects for DIY Enthusiasts.md | 364 ++++++++++++++++++ 1 file changed, 364 insertions(+) create mode 100644 sources/tech/20201103 27 Super Cool Raspberry Pi Zero W Projects for DIY Enthusiasts.md diff --git a/sources/tech/20201103 27 Super Cool Raspberry Pi Zero W Projects for DIY Enthusiasts.md b/sources/tech/20201103 27 Super Cool Raspberry Pi Zero W Projects for DIY Enthusiasts.md new file mode 100644 index 0000000000..e315657689 --- /dev/null +++ b/sources/tech/20201103 27 Super Cool Raspberry Pi Zero W Projects for DIY Enthusiasts.md @@ -0,0 +1,364 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (27 Super Cool Raspberry Pi Zero W Projects for DIY Enthusiasts) +[#]: via: (https://itsfoss.com/raspberry-pi-zero-projects/) +[#]: author: (Chinmay https://itsfoss.com/author/chinmay/) + +27 Super Cool Raspberry Pi Zero W Projects for DIY Enthusiasts +====== + +The small form factor of the [Raspberry Pi Zero W][1] enables a new range of projects. In fact, a lot of people use the Pi Zero in the final version of the project after prototyping on a different full-sized Pi board. And, that’s because it consumes much less power compared to the flagship Pi boards and makes it ideal to build battery powered gadgets. + +Preview | Product | Price | +---|---|---|--- +![CanaKit Raspberry Pi Zero W \(Wireless\) Complete Starter Kit - 16 GB Edition][2] ![CanaKit Raspberry Pi Zero W \(Wireless\) Complete Starter Kit - 16 GB Edition][2] | [CanaKit Raspberry Pi Zero W (Wireless) Complete Starter Kit - 16 GB Edition][3] | $32.99[][4] | [Buy on Amazon][5] + +After scouring [Instructables][6], [Reddit][7], [Hackaday][8], other maker oriented communities and my own experience with Pi, I have compiled a list of projects built around the Raspberry Pi Zero and the Raspberry Pi Zero W. The community is extremely innovative and all these projects make impressive use of various features of this maker board. + +So, in addition to the awesome list of [Raspberry Pi Projects][9] that we covered earlier, here, we will be focusing on Raspberry Pi Zero! + +### Top Creative Projects You Can Build With Raspberry Pi Zero + +![][10] + +Of course, you’re free to use some [Raspberry Pi Zero alternatives][11] and try the same project ideas mentioned below. + +#### 1\. Portable Game Console + +This is by far my favorite project built around the Raspberry Pi Zero, hence featured at the top. Today we have emulators for most of the retro games. This project puts the Pi Zero in the classic game-boy form factor. You can play most of your favorite retro games and you can play them anywhere. + +This project is also beautifully documented in YouTube video(s) and on Instructables. + +[Portable Game Console][12] + +#### 2\. DIY Smart Speaker Powered by Alexa + +Amazon’s Alexa has always been very tinkerer friendly and makers around the world have built all kinds of Alexa based devices. This project also adds RGB programmable LED’s to make it look a little more like the echo speaker. + +[DIY Smart Speaker][13] + +#### 3\. Home Network Music System + +Getting a proper home music system setup is usually expensive. However, with the inexpensive Raspberry Pi Zero, you can utilize your MP3 collection to set up a home network music system. + +This project uses the [PiDrive][14], PiDrive is basically a Raspberry Pi Zero W attached to a hard disk. Unfortunately, I think it has been discontinued but you can also build it using a normal Pi Zero W in different configurations. You can play local music or even stream from different services. + +[Pi MusicBox][15] + +#### 4\. Network Ad Blocker using Pi-Hole + +This is something I personally use on a daily basis and it has completely changed my internet experience. If you’re someone who doesn’t want to see advertisements while you browse around online, an Ad blocker using Raspberry Pi would be exciting, right? + +[Pi-Hole][16] on a Raspberry Pi can block all the ads on your entire network. Anyone on the network with an active Pi-Hole will have an ad-free experience. It also speeds up your internet experience since the bandwidth used by ads is freed up. + +You can watch Linus’ video to get an idea or refer to the detailed post in Linus Tech Tips forums linked in the button below. + +[Ad-Blocker using Pi Hole][17] + +#### 5\. AirPlay Speaker using Raspberry Pi Zero + +![][18] + +AirPlay is a chromecast equivalent in the Apple ecosystem, you can cast media from your Apple devices to an AirPlay supported speaker. + +This project is built very well with 3D printed parts and you can find detailed instructions for it. + +[AirPlay Speaker][19] + +#### 6\. DIY Google Home with a Bluetooth Speaker + +![][20] + +This is another nifty little project which is a tinkerer’s dream. Building your own smart speaker powered by the Google Assistant? Indeed, exciting! + +Here, a Pi Zero is paired with a Bluetooth speaker, microphone and the Google Assistant SDK to achieve some functionalities. You can ask questions and do most of the things you can with the official Google Home device. This project does not handle the casting part of the Google Home experience though. + +[DIY Google Home][21] + +#### 7\. Pedal Pi – Raspberry Pi Zero Guitar Pedal + +Pedal Pi is a programmable Lo-Fi guitar pedal built using the Pi Zero where you can program your own custom effects. The project is fully open source (including the hardware) as well. It goes to prove how versatile the Pi Zero can be. + +It can be an incredibly fun experience for people who are makers and also into digital music. + +[Pedal Pi][22] + +#### 8\. ZeroBot – FPV Robot + +There are a lot of different robots you can build using the Pi Zero. It is almost perfect for any kind of robot that you can think of building. It has ample amount of [GPIO][23], a decent processor, a camera interface and the choice of software stack and programming language. + +The ZeroBot is an [FPV][24] bot which also has a camera and is able to transmit what it is seeing. It even features a completely 3D printed body. + +You can find [detailed instructions here][25]. + +#### 9\. WiFi Security Camera + +Raspberry Pi Zero W comes with a CSI connector where you can connect the camera module. This compatibility also lets you easily build a WiFi-powered CCTV camera(s) for your home at a very reasonable price compared to commercial products. + +The [motionEyeOS][26] is a purposely built to convert your SBC (in this case the Pi Zero) to a surveillance system. You can find more information in the video above or head to the link below. + +[WiFi Security Camera][27] + +#### 10\. PIX-E GIF Camera + +![][28] + +GIF’s have taken over social media and all IM platforms. Just thinking of a dedicated GIF camera makes me chuckle. That’s exactly what this project is all about. I am very curious about how it would turn out with the new HQ camera which has a much better image quality. + +This [project has been documented][29] really well with accompanying videos on Hackaday + +[GIF Camera][29] + +#### 11\. Wearable Timelapse Camera + +One of the sleekest camera project I’ve seen, this is a wearable camera. You can take time-lapses, and videos from a first person’s perspective. + +This is a project by Adafruit and is documented really well. Refer to the video above to get an idea or head to the link below. + +[Wearable Timelapse Camera][30] + +#### 12\. Telescope Camera + +![][31] + +Building a telescope camera is one of the most popular camera based applications for the Pi Zero. Makers around the world have taken amazing pictures with their DIY telescope cameras. + +[Telescope Camera][32] + +#### 13\. Kodi on Pi Zero + +Kodi is one of the best open source [media server software][33] for making a media box for your TV. The amazing part is that it also runs on the Pi Zero W. + +Now you can DIY an alternative to the Amazon Fire TV Stick. + +[Kodi on Pi Zero][34] + +#### 14\. OctoPrint – Wireless 3D Printing + +![][35] + +If you are into 3D printing, you would have heard about [OctoPrint][36] at some point. OctoPrint unlocks many feature comforts we enjoy with normal printers like sending print jobs directly from the computer to the 3D printer instead of using a micro SD card. You can also attach a webcam and monitor your prints and control all aspects of the printer. + +OctoPrint is usually used with the bigger Pi’s but it can also be used with the Raspberry Pi Zero W with some soldering and mods. It is important to note that there is low WiFi interference when using the Pi Zero since it can impact prints. Here are some references talking about OctoPrint on Pi Zero to help you build it yourself: + + * [OctoPrint on Pi Zero][37] + * [OctoPrint on Pi Zero (from Prusa 3D)][38] + + + +#### 15\. Pirate Radio Station + +This seems like quite a fun idea, you can actually make the Pi Zero W broadcast using FM. + +It also happens to be a simple project and you don’t need many additional components either. You can be your own neighborhood RJ, do make sure to check out the legal aspects of a pirate radio station in your country. + +[Pirate Radio Station][39] + +#### 16\. IoT Smart Alarm Clock + +![][40] + +Here’s a project making something which might sound very trivial but nevertheless is super cool and underrated. + +The freedom of being able to program your own alarm clock, automating it with scripts and making your life a little easier and fun (and still not waking up) sounds exciting! + +[IoT Smart Alarm Clock][41] + +#### 17\. Pi Zero Tesla Coil + +This is the most unexpected yet an amazing project I’ve come across which uses the Pi Zero W. + +It doesn’t get cooler than playing music on a [tesla coil][42] using the Pi. Make sure you watch the video. + +[Tesla Coil with Pi Zero][43] + +#### 18\. Network Performance Monitoring using Pi Zero + +![][44] + +If you like to keep tabs on your network, you should check out this project. + +This is a [bandwidth monitor][45] built using the Pi Zero W that features a nifty little screen to display important stats. + +[Bandwidth Monitor][45] + +#### 19\. Pi Pod – Raspberry Pi Zero Music Player + +![][46] + +It’s 2020 and you might be thinking who would want a portable music player since mobile phones have replaced them almost entirely. But, there are always people (including myself) who would want a device dedicated to music and does not do anything else. + +This project features the Raspberry Pi Zero W in another form and looks pretty neat. It’s called the **Pi Pod**. + +You can also design your own 3D printable enclosure and customize every element of the music player. + +[Pi Pod][47] + +#### 20\. Raspberry Pi Drone + +![][48] + +The Pi Zero packs in enough features and processing power for it be at the heart of a drone. It is light weight, cheaper than some alternative drone specific boards too. You also get the freedom of using different firmware(s) or code one on your own. + +There are also many open source designs available for the frame of the drone on [Thingiverse.][49] + +[Pi Drone][50] + +#### 21\. Internet Connected Info Display + +The Pi Zero W is capable of connecting to the internet via WiFi, it also has all the GPIO and display outputs to make a highly functional device to display information from the internet. + +The freedom of programming means that you can have the display show any information you need. Your google calendar events, stock prices and anything you can find on the internet. +Here are a couple of interesting projects which are built around this idea. + + 1. [YouTube Subscriber Counter][51] + 2. [Raspberry Pi Internet Connected Information Display][52] + + + +#### 22\. Raspberry Pi Pocket Projector + +Ever since Texas Instruments came out with the mini projector evaluation board, a Raspberry Pi Zero based projector has been a very popular project. + +If you can get your hands on the projector module, this can be a very interesting build. This is not a beginner-friendly project, but a tinkerer should feel right at home. You can find all the relevant details from the video above. + +#### 23\. VPN Server + +![][53] + +In today’s world, extra care needs to be taken about companies barging into one’s privacy and using a VPN is becoming more and more commonplace. + +Fret not, you can utilize the Raspberry Pi Zero W with [OpenVPN][54] to add an extra layer of security to your home network. This can be a great for small families where everyone in the house can be protected and don’t need to separate VPN subscriptions. + +[VPN Server][55] + +#### 24\. Weather Station + +![][56] + +This is a very cool project, a complete weather station which can display various weather metrics for the day and forecasts too. It even includes a 3D printed case which looks pretty sharp. The amazing part is that you can use the display to show things other than weather as well. + +As I also noticed in another similar project on [Instructables][57], you may also tweak it with your own custom database and website. + +[Weather Station][58] + +#### 25\. Ambient Lighting System for TV + +An ambient lighting system enhances the TV experience, this is another amazing project involving the Raspberry Pi Zero. + +In real life this effect feels like a dynamic portrait mode applied to the screen and whatever is being shown on the screen, makes the experience a lot immersive. + +GreatScott (a popular YouTuber) for content based around electronics and DIY shows you around with the project in the video above. You may also refer to the written instructions from the link below. + +[Ambient Lighting System][59] + +#### 26\. Wireless Network Printer + +![][60] + +The Pi Zero W is a great board to make any old printer free from being fixed to one computer and have the freedom of placing it anywhere. + +This way print jobs can be sent from multiple computers, phones on the same network. This is a quality of life improvement which is highly underrated, even in households. + +This project utilizes [CUPS][61] running on Pi Zero W to make your printer wireless. + +[Wireless Network Printer][62] + +#### 27\. Pi Zero Cluster + +![][63] + +You can pack in 10’s of these tiny computers together to have access to massive amounts of parallel processing. The GPU’s on these SBC’s can be utilized for challenging compute needs. + +Regular Raspberry Pi’s have long been used to make clusters and Raspberry Pi based super computers consisting of 100’s – 1000’s of Pi’s. Since the introduction of the Pi Zero with it’s lower price and size, it is possible to put more of them into a small space. + +There are many custom boards which are built to hold multiple Pi Zero’s. + +[Pi Zero Cluster][64] + +#### Closing Thoughts + +The projects featured here are only a tip of the iceberg. You can find many more projects if you look around on the internet. The versatility of the Raspberry Pi Zero is unprecedented, combined with its affordability it is one of the most used SBC by makers and tinkerers around the world. + +What did you build with the Raspberry Pi Zero ? Put it in the comments below along with your favorite projects. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/raspberry-pi-zero-projects/ + +作者:[Chinmay][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/chinmay/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/raspberry-pi-zero-w/ +[2]: https://i1.wp.com/m.media-amazon.com/images/I/517BwcAPmTL._SL160_.jpg?ssl=1 +[3]: https://www.amazon.com/dp/B072N3X39J?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (CanaKit Raspberry Pi Zero W (Wireless) Complete Starter Kit - 16 GB Edition) +[4]: https://www.amazon.com/gp/prime/?tag=chmod7mediate-20 (Amazon Prime) +[5]: https://www.amazon.com/dp/B072N3X39J?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (Buy on Amazon) +[6]: https://www.instructables.com +[7]: https://www.reddit.com/r/raspberry_pi +[8]: https://hackaday.com +[9]: https://itsfoss.com/raspberry-pi-projects/ +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/raspberry-pi-zero-w-projects.png?resize=800%2C450&ssl=1 +[11]: https://itsfoss.com/raspberry-pi-zero-alternatives/ +[12]: https://www.instructables.com/DIY-Raspberry-Pi-Zero-Handheld-Game-Console/ +[13]: https://www.instructables.com/Alexa-Assistant-With-a-10-Raspberry-Pi-Zero-W-and-/ +[14]: https://www.raspberrypi.org/blog/meet-314gb-pidrive/ +[15]: https://www.instructables.com/Raspberry-Pi-Home-Network-Music-System/ +[16]: https://pi-hole.net/ +[17]: https://linustechtips.com/main/topic/1094810-pi-hole-setup-tutorial/ +[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/pi-airplay-speaker.png?resize=800%2C578&ssl=1 +[19]: https://www.hackster.io/fvdbosch/raspberry-pi-zero-airplay-speaker-d99feb +[20]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/pi-google-home.png?resize=800%2C541&ssl=1 +[21]: https://www.instructables.com/DIY-Google-Home-With-Bluetooth-Speaker-on-Raspberr/ +[22]: https://www.instructables.com/Raspberry-Pi-Zero-Guitar-Pedal/ +[23]: https://en.wikipedia.org/wiki/General-purpose_input/output +[24]: https://en.wikipedia.org/wiki/First-person_view_(radio_control) +[25]: https://hackaday.io/project/25092-zerobot-raspberry-pi-zero-fpv-robot +[26]: https://github.com/ccrisan/motioneyeos +[27]: https://maker.pro/raspberry-pi/projects/how-to-build-a-cctv-network-camera-with-raspberry-pi-zero-w-and-motionpie +[28]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/pi-gif-camera.jpg?resize=800%2C633&ssl=1 +[29]: https://hackaday.io/project/16358-pix-e-gif-camera +[30]: https://learn.adafruit.com/raspberry-pi-wearable-time-lapse-camera/overview +[31]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/pi-telescope-camera.png?resize=800%2C555&ssl=1 +[32]: https://www.instructables.com/Astrophotography-With-the-Raspberry-Pi-Zero/ +[33]: https://itsfoss.com/best-linux-media-server/ +[34]: https://dronebotworkshop.com/kodi-raspberry-pi/ +[35]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/octoprint-logo.png?resize=515%2C421&ssl=1 +[36]: https://octoprint.org +[37]: https://toglefritz.com/how-to-run-octoprint-on-a-raspberry-pi-zero/ +[38]: https://help.prusa3d.com/en/article/octoprint-building-an-image-for-raspberry-pi-zero-w_2182 +[39]: https://makezine.com/projects/pirate-radio-throwies/ +[40]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/pi-iot-clock.png?resize=800%2C472&ssl=1 +[41]: https://hackaday.io/project/19230-iot-smart-alarm-clock +[42]: https://en.wikipedia.org/wiki/Tesla_coil +[43]: https://www.extremeelectronics.co.uk/electronic-tesla-coils/pi-zero-tesla-coil/ +[44]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/pi-network-performance.png?resize=800%2C432&ssl=1 +[45]: https://www.instructables.com/Bandwidth-Monitor/ +[46]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/pi-pod-music-player.png?resize=743%2C542&ssl=1 +[47]: https://www.raspberrypi.org/blog/pipod-pi-zero-music-player/ +[48]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/pi-zero-drone.png?resize=736%2C552&ssl=1 +[49]: https://thingiverse.com +[50]: https://www.hackster.io/12590/pi0drone-a-200-smart-drone-with-the-pi-zero-4fec08?f=1 +[51]: https://www.youtube.com/watch?v=afY_xHqQu-s +[52]: https://www.hackster.io/fvdbosch/raspberry-pi-zero-internet-connected-information-display-5cae96 +[53]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/pi-open-vpn.jpg?resize=800%2C296&ssl=1 +[54]: https://openvpn.net/ +[55]: https://circuitdigest.com/microcontroller-projects/turn-your-raspberry-pi-zero-in-to-a-vpn-server-using-openvpn +[56]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/pi-zero-weather-station.png?resize=800%2C599&ssl=1 +[57]: https://www.instructables.com/Complete-Raspberry-Pi-Weather-Station/ +[58]: https://www.hackster.io/hartmut-wendt/raspberry-pi-based-weather-station-a9a7dd +[59]: https://www.instructables.com/Make-Your-Own-Ambient-Lighting-With-the-Raspberry-/ +[60]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/pi-wireless-printer.jpg?resize=800%2C450&ssl=1 +[61]: https://www.cups.org/ +[62]: https://maker.pro/raspberry-pi/projects/how-to-turn-a-usb-printer-into-a-wireless-printer-with-raspberry-pi-zero-w +[63]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/pi-zero-cluster.png?resize=800%2C531&ssl=1 +[64]: https://magpi.raspberrypi.org/articles/clusterhat-review-cluster-hat-kit From 9f9a0b27c43babce98007bb4cbd743b9572b4c38 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 3 Nov 2020 05:04:30 +0800 Subject: [PATCH 0637/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201102?= =?UTF-8?q?=205=20reasons=20to=20use=20Linux=20in=202020?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201102 5 reasons to use Linux in 2020.md --- ...20201102 5 reasons to use Linux in 2020.md | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 sources/tech/20201102 5 reasons to use Linux in 2020.md diff --git a/sources/tech/20201102 5 reasons to use Linux in 2020.md b/sources/tech/20201102 5 reasons to use Linux in 2020.md new file mode 100644 index 0000000000..832ac8fd46 --- /dev/null +++ b/sources/tech/20201102 5 reasons to use Linux in 2020.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 reasons to use Linux in 2020) +[#]: via: (https://opensource.com/article/20/11/linux-2020) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +5 reasons to use Linux in 2020 +====== +Here's a look back at the year so far and a review of what you need to +know about Linux in 2020. +![Penguin driving a car with a yellow background][1] + +Some of the best technology is a moving target. When technology stagnates, society tends to outpace and outgrow it. [Linux][2], the widely used open source operating system (OS), is a foundational technology and the basis for some of the most progressive modern computing ideas. So, while it's startlingly unchanged after three decades of development, it also allows adaptation. As a result, Linux is in a unique position of being both a sound investment in skills because it doesn't change and a seemingly eternal driving force for new skills to learn. + +The year 2020 has been a strange one—by any measure—but for Linux, it's been a typical development cycle. Here's a look back at the year so far and a review of what you need to know about Linux in 2020. + +### ZFS on Linux + +The ZFS filesystem offers integrity checking for data and metadata, redundancy with mirroring, support for up to _256 trillion yobibytes_ of storage, hardware-accelerated native encryption, and efficient replication. ZFS is a Sun Microsystems innovation that, unfortunately, has a license that prohibits it from being bundled with Linux by default. However, the [OpenZFS][3] group has ported the project to BSD and Linux so that you can run ZFS on anything from your laptop to your data center. + +Getting started with ZFS is surprisingly simple on Fedora Linux, as Sheng Mao demonstrates in his article on [setting up ZFS on Linux][4]. + +### Linux interrupts + +No matter how familiar you are with Linux, there's always an opportunity to dive deeper and discover how it achieves what it does so well. Computers running stock markets, digital film studios, audio workstations, and other performance-intensive tasks need real-time processing, while other computers can afford to be a little lazy when processing requests, and it's no small task to manage the myriad loops happening on a computer at any given millisecond. Understanding how and why the Linux kernel manages interrupt requests (IRQs) may not be vital to the everyday user, but it's a fascinating study no matter what you do on computers. Read Stephan Avenwedde's article "[How the Linux kernel handles interrupts][5]" to learn more. + +### Linux in your pocket + +Since Google's Android OS runs on a Linux kernel, many of us technically have Linux in our pockets. As comforting as that might be, Android's smooth Java frontend doesn't always provide the Linux _feeling_ many Linux users long for. And some users don't have an Android phone at all. + +The good news is that you can use Linux on your Android or iOS device, complete with a terminal, Bash, Python, a package manager, and all the other things you love about your favorite open source desktop OS. + +If you're on Android, read my article about [Termux][6]. And if you're on iOS, read Lee Tusman's excellent article about [running a Linux command line on your iOS device][7]. + +### New commands on Linux + +Time marches on, and sometimes the old, quaint commands of yesteryear are insufficient for modern systems. Although your muscle memory may cling to commands like `crontab` and `ifconfig` (and `iwconfig` and `wpa_supplicant`), there are perfectly good replacements for these and more. If you can't bring yourself to abandon your old commands, get familiar with [Bash aliases][8] because these new commands are worth learning. + + * Drop `ifconfig` for `nmcli`. Look, at some point, you have to admit that the unholy combination of `ifconfig` plus `iwconfig` and a foray into `wpa_supplicant` (which you secretly dropped long ago in favor of `wicd` anyway) just isn't efficient. Linux uses `nmcli` now, and it's become a highly usable, sometimes even intuitive way to interface with your network. Read Dave McKay's excellent [nmcli tutorial][9]. + * Cronjobs, `at`, and `batch` are uniquely timeless commands that probably ought never be replaced. They're great for quick and simple scheduling, but for complex jobs, you might find some features you like in a supplement to them: systemd timers. David Both provides an extensive [systemd timers tutorial][10] that demonstrates how to write and monitor your important custom system tasks. + * `gcore` and `gdb` are important debuggers that developers may be familiar with. A new take on `gcore` functionality is Microsoft's ProcDump, which obtains a core dump of a process ID (PID) so that you can analyze it with `gdb`. It's more an alternative than a replacement, but it's worth trying if you're curious about different tools. Read Guarav Kamathe's [ProcDump tutorial][11] for more information. + + + +### The cloud runs on Linux + +As "the cloud" continues full steam ahead, Linux remains its main driving force. The cloud is a collection of computers (nodes) with a massively distributed filesystem (such as [Ceph][12]), and it's commonly managed with Kubernetes ("_KOO-burr-net-eez"_] or [OpenShift][13]. + +Regardless of how well you know Linux on your laptop or desktop or even in your private data center, there's a whole new world of Linux experimentation available in containers running on the cloud. It can take some adjustment to learn how to get comfortable in an ephemeral container, but with some practice and a little context, you can build some interesting systems and then orchestrate them (that is, cause them to update, scale, and perform as needed) with Kubernetes. + +Jiaqi Liu wrote one of the best overviews of the cloud workflow in "[A beginner's guide to Kubernetes container orchestration][14]." Read it, and then download Chris Collins' [Kubernetes eBook][15] to build your own cloud at home on a Raspberry Pi cluster. + +### Open source growth + +Linux users relish the consistency and stability of Linux, and it's a testament to the original Unix system design that the OS can stay the same while also pushing its boundaries into exciting new forms of technology. Part of the fun of Linux and open source is the sense of discovery you get when you start learning a new command and the sense of accomplishment when it works to make your life easier. Take a look at the latest Linux developments, and get started with something new today! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/linux-2020 + +作者:[Seth Kenlon][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://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/car-penguin-drive-linux-yellow.png?itok=twWGlYAc (Penguin driving a car with a yellow background) +[2]: https://opensource.com/resources/linux +[3]: https://openzfs.org/wiki/Main_Page +[4]: https://opensource.com/article/20/10/zfs-dnf +[5]: https://opensource.com/article/20/10/linux-kernel-interrupts +[6]: https://opensource.com/article/20/8/termux +[7]: https://opensource.com/article/20/9/run-linux-ios +[8]: https://opensource.com/article/19/7/bash-aliases +[9]: https://opensource.com/article/20/7/nmcli +[10]: https://opensource.com/article/20/7/systemd-timers +[11]: https://opensource.com/article/20/7/procdump-linux +[12]: https://opensource.com/business/15/1/introduction-ceph-storage-openstack +[13]: https://www.redhat.com/en/technologies/cloud-computing/openshift +[14]: https://opensource.com/article/20/6/container-orchestration +[15]: https://opensource.com/downloads/kubernetes-raspberry-pi From 6cec5c65560d79a9a74843686f307ba25e417b9c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 3 Nov 2020 05:04:42 +0800 Subject: [PATCH 0638/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201102?= =?UTF-8?q?=204=20reasons=20why=20JavaScript=20is=20so=20popular?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201102 4 reasons why JavaScript is so popular.md --- ... 4 reasons why JavaScript is so popular.md | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 sources/tech/20201102 4 reasons why JavaScript is so popular.md diff --git a/sources/tech/20201102 4 reasons why JavaScript is so popular.md b/sources/tech/20201102 4 reasons why JavaScript is so popular.md new file mode 100644 index 0000000000..bf35c455bd --- /dev/null +++ b/sources/tech/20201102 4 reasons why JavaScript is so popular.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 reasons why JavaScript is so popular) +[#]: via: (https://opensource.com/article/20/11/javascript-popular) +[#]: author: (Nimisha Mukherjee https://opensource.com/users/nimisha) + +4 reasons why JavaScript is so popular +====== +There are good reasons why JavaScript is consistently among the top +programming languages. +![JavaScript in Vim][1] + +As this chart from GitHub's _[State of the Octoverse][2]_ report shows, [JavaScript][3] has consistently been most popular programming language based on the number of contributors to projects on GitHub. + +![Top Languages from The State of the Octoverse report][4] + +Top languages, per The State of the Octoverse (© 2019, [GitHub Corp][2]) + +In the [previous article][5] in this series, I dove into the history of JavaScript. In this article, I'll share four of [the reasons][6] it is so popular. + +### 1\. JavaScript caters to beginner, intermediate, and advanced developers + +JavaScript does not need any environment setup; just open a browser, like Chrome, navigate to [Developer Tools][7], and start coding. Writing a "Hello World" program is as simple as: + + +``` +`console.log("Hello World");` +``` + +JavaScript's flexibility is best suited for intermediate developers. The language just helps get things done by letting the developer focus on solving the problem. Developers can use a mix of plugins and their own code snippets to get an application working. + +While JavaScript is relatively easy to get started with, it is not straightforward to master. If you want to get to an advanced level, here are some of the concepts you need to know: + + * **JavaScript's [multi-paradigm][8] nature:** JavaScript supports both functional programming and object-oriented programming (OOP). + * **Applying [design patterns][9] in JavaScript:** The model-view-* ([MV*][10]) design patterns have been among the most popular and have led to the development of [several modern frameworks][11]. + * **[Inheritance with prototype chain][12]:** JavaScript cannot implement OOP in the traditional Java class-based model due to its dynamic nature. OOP in JavaScript is achieved through the prototypal inheritance model. + * **[Closures][13]:** A closure gives access to an outer function's scope from an inner function. + * **[Currying][14]:** Currying is a transformation of functions that translates a function from callable as f(a, b, c) into callable as f(a)(b)(c). + * **[Promises][15] and [Observables][16]:** These help you work with asynchronous functions. + * **[TypeScript][17]:** This adds static typing to JavaScript. + + + +### 2\. Omni-platform + +JavaScript can run everywhere, including: + + * Devices like mobiles, tablets, and laptops + * On the client-side as well as the server-side + + + +This ability to run everywhere makes JavaScript a universal language. + +### 3\. Open standards and community + +[ECMAScript][18] is the standardized version of JavaScript as well as an open standard language. Companies can use ECMAScript to create a JavaScript implementation. According to [Wikipedia][19], "an ECMAScript engine  is a program that executes source code written in a version of the ECMAScript language standard, for example, JavaScript." The most popular engines, [V8][20] and [SpiderMonkey][21], are open source projects. + +JavaScript has been around for 25 years and has a vast community behind it. A developer is spoiled for choice. The community has built so many plugins and frameworks that the phrase "[framework fatigue][22]" was coined. + +### 4\. Modern frameworks + +Modern frameworks like [React][23], [Angular][24], and [Vue.js][25] have stabilized and are being optimized for better performance. Most frameworks are very developer-friendly with good community support. + +### The future + +JavaScript is here to stay. Full-stack development and the modern frontend framework continue to help JavaScript cement its position as one of the most popular programming languages. + +The [next wave of JavaScript][26] might put the spotlight on: + + * **[Deno][27]:** A modern and secure runtime for JavaScript + * **Web components:** Reusable custom elements + * **Integration with AI and ML:** Projects like [Supernova][28] and [BAYOU][29] have made substantial breakthroughs in integrating JavaScript with artificial intelligence and machine learning. + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/javascript-popular + +作者:[Nimisha Mukherjee][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://opensource.com/users/nimisha +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/javascript_vim.jpg?itok=mqkAeakO (JavaScript in Vim) +[2]: https://octoverse.github.com/ +[3]: https://en.wikipedia.org/wiki/JavaScript +[4]: https://opensource.com/sites/default/files/uploads/toplanguages-the_state_of_the_octoverse.png (Top Languages from The State of the Octoverse report) +[5]: https://opensource.com/article/20/10/javascript-part-1 +[6]: https://medium.com/paul-heintzelman/so-why-is-javascript-so-popular-f35bd6cfeb39 +[7]: https://developers.google.com/web/tools/chrome-devtools +[8]: https://medium.com/javascript-in-plain-english/what-are-javascript-programming-paradigms-3ef0f576dfdb +[9]: https://addyosmani.com/resources/essentialjsdesignpatterns/book/ +[10]: https://developpaper.com/javascript-mv-pattern/ +[11]: https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93viewmodel#JavaScript_frameworks +[12]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain +[13]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures +[14]: https://javascript.info/currying-partials +[15]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise +[16]: https://rxjs-dev.firebaseapp.com/guide/observable +[17]: https://en.wikipedia.org/wiki/TypeScript +[18]: https://en.wikipedia.org/wiki/ECMAScript +[19]: https://en.wikipedia.org/wiki/List_of_ECMAScript_engines +[20]: https://en.wikipedia.org/wiki/V8_%28JavaScript_engine%29 +[21]: https://en.wikipedia.org/wiki/SpiderMonkey +[22]: https://teropa.info/blog/2015/07/15/overcoming-javascript-framework-fatigue.html +[23]: https://en.wikipedia.org/wiki/React_%28web_framework%29 +[24]: https://en.wikipedia.org/wiki/Angular_%28web_framework%29 +[25]: https://en.wikipedia.org/wiki/Vue.js +[26]: https://medium.com/@rangleio/the-future-of-javascript-in-the-front-end-world-2544c1814e2 +[27]: https://en.wikipedia.org/wiki/Deno_%28software%29 +[28]: https://techcrunch.com/2018/03/13/supernova-studio/ +[29]: https://futurism.com/military-created-ai-learned-to-program From 2933105096e834e5181885d1235ec5bb6ec66a84 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 3 Nov 2020 05:04:54 +0800 Subject: [PATCH 0639/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201102?= =?UTF-8?q?=20Understand=20your=20Python=20code=20with=20this=20open=20sou?= =?UTF-8?q?rce=20visualization=20tool?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201102 Understand your Python code with this open source visualization tool.md --- ...ith this open source visualization tool.md | 113 ++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 sources/tech/20201102 Understand your Python code with this open source visualization tool.md diff --git a/sources/tech/20201102 Understand your Python code with this open source visualization tool.md b/sources/tech/20201102 Understand your Python code with this open source visualization tool.md new file mode 100644 index 0000000000..88fbd404ff --- /dev/null +++ b/sources/tech/20201102 Understand your Python code with this open source visualization tool.md @@ -0,0 +1,113 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Understand your Python code with this open source visualization tool) +[#]: via: (https://opensource.com/article/20/11/python-code-viztracer) +[#]: author: (Tian Gao https://opensource.com/users/gaogaotiantian) + +Understand your Python code with this open source visualization tool +====== +VizTracer visualizes and traces Python code to provide greater insight +into how the code works. +![Python programming language logo with question marks][1] + +It's challenging to understand your Python project as it gets larger and more complex. Even when you write the entire project, it's impossible to know how it works fully. Debugging and profiling your code is essential to better understanding it. + +[VizTracer][2] is a tool to help you understand Python code by tracing and visualizing its execution. Without making any changes to your source code, VizTracer can log function entries/exits, function arguments/returns, and any arbitrary variables, then display the data using an intuitive front-end Google [Trace-Viewer][3]. + +Here is an example of running a [Monte Carlo tree search][4]: + +![Monte Carlo tree search visualization][5] + +(Tian Gao, [CC BY-SA 4.0][6]) + +Every function is logged and visualized in stack style on a timeline so that you can see what is happening when you run a program. You can zoom in to see the details at any specific point: + +![Zooming in on VizTracer visualization][7] + +(Tian Gao, [CC BY-SA 4.0][6]) + +VizTracer can also automatically log function arguments and return value; you can click on the function entry and see the detail info: + +![Viewing VizTracer details][8] + +(Tian Gao, [CC BY-SA 4.0][6]) + +Or you can create a whole new signal and use it to log variables. For example, this shows the cost value when you do a gradient descent: + +![VizTracer gradient descent][9] + +(Tian Gao, [CC BY-SA 4.0][6]) + +In contrast to other tools with complicated setups, VizTracer is super-easy to use and does not have any dependencies. You can install it from pip with: + + +``` +`pip install viztracer` +``` + +And trace your program by entering (where `` is the name of your script): + + +``` +`viztracer ` +``` + +VizTracer will generate an HTML report in your working directory that you can open in Chrome. + +VizTracer offers other advanced features, such as filters, which you can use to filter out the functions that you do not want to trace so that you'll have a cleaner report. For example, to include only the functions in files, you are interested in: + + +``` +`viztracer include_files ./ --run ` +``` + +To record the function arguments and return value: + + +``` +`viztracer --log_function_args --log_return_value ` +``` + +To log any arbitrary variables matching a certain regex: + + +``` +# log variables starts with a +viztracer --log_var a.* --run <your_script.py> +``` + +You can get other features, like custom events to log numeric values and objects, by making minor modifications to your source code. + +VizTracer also includes a virtual debugger (vdb) that can debug VizTracer's log file. vdb debugs your executed code (much like [pdb][10]) so that you can understand the code flow. Helpfully, it supports running back in time because it knows everything that happened. + +Unlike some prototypes, VizTracer implements its core in pure C, which significantly reduces the overhead to a level similar to [cProfile][11]. + +VizTracer is open source, released under the Apache 2.0 License, and supports all common operating systems platforms (Linux, macOS, and Windows). You can learn more about its features and access its source code on [GitHub][2]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/python-code-viztracer + +作者:[Tian Gao][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://opensource.com/users/gaogaotiantian +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python_programming_question.png?itok=cOeJW-8r (Python programming language logo with question marks) +[2]: https://github.com/gaogaotiantian/viztracer +[3]: http://google.github.io/trace-viewer/ +[4]: https://en.wikipedia.org/wiki/Monte_Carlo_tree_search +[5]: https://opensource.com/sites/default/files/uploads/viztracer_mcts.png (Monte Carlo tree search visualization) +[6]: https://creativecommons.org/licenses/by-sa/4.0/ +[7]: https://opensource.com/sites/default/files/uploads/viztracer_zoomin.png (Zooming in on VizTracer visualization) +[8]: https://opensource.com/sites/default/files/uploads/viztracer_details.png (Viewing VizTracer details) +[9]: https://opensource.com/sites/default/files/uploads/viztracer_gradient.png (VizTracer gradient descent) +[10]: https://docs.python.org/3/library/pdb.html +[11]: https://docs.python.org/2/library/profile.html#module-cProfile From c71df49b7a3dba39ac1dec0cb07c6a58c7ba4227 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 3 Nov 2020 05:05:16 +0800 Subject: [PATCH 0640/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201030?= =?UTF-8?q?=20My=20journey=20to=20becoming=20an=20open=20source=20mentor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201030 My journey to becoming an open source mentor.md --- ...urney to becoming an open source mentor.md | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 sources/tech/20201030 My journey to becoming an open source mentor.md diff --git a/sources/tech/20201030 My journey to becoming an open source mentor.md b/sources/tech/20201030 My journey to becoming an open source mentor.md new file mode 100644 index 0000000000..035ffaa8c7 --- /dev/null +++ b/sources/tech/20201030 My journey to becoming an open source mentor.md @@ -0,0 +1,92 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My journey to becoming an open source mentor) +[#]: via: (https://opensource.com/article/20/10/open-source-mentor) +[#]: author: (Mehant Kammakomati https://opensource.com/users/mehant-kammakomati) + +My journey to becoming an open source mentor +====== +I grew from a teenage open source novice to a 20-year-old frequent +contributor and mentor to new users. +![Puzzle pieces coming together to form a computer screen][1] + +I was just 16 when I made my first meaningful open source contribution. It was the first code contribution I ever made, and I learned a lot from it. I'm 20 now, and I've been strongly attached to free and open source software (FOSS) ever since. I strive to be a friend to my community colleagues and to help others continue growing, learning, and succeeding. + +### Early days + +I first heard about FOSS through the [Google Code-In][2] contest. I was 16, but I was already learning computer science fundamentals, the C++ programming language, and anything else about computers I could get my hands on. I was very excited about the contest—not just because of the free Google swag, but because it gave me the opportunity to work directly on codebases being used all around the world. I jumped into the contest feet-first and started trying to solve as many open source software tasks as I could in the code, design, documentation, and research. + +![Google Code-in Mehant Kammakomati][3] + +(Mehant Kammakomati, [CC BY-SA 4.0][4]) + +It wasn't easy. I didn't know the FOSS community culture, nor much about the software development methodologies they used, nor even how to seek help or interact with others. So, rather than focusing on tasks, I started by focusing on understanding these fundamentals. + +In a way, I spent much of my time during the contest learning more about how open source development works instead of closing tasks. But I wasn't sad about my failure to contribute code during the contest and instead focused on my success in getting acquainted with free software and open source culture. + +### Fundamentals + +I didn't stop my journey there. As a beginner, I learned: + + 1. Git + 2. GitHub + 3. Using the terminal + 4. Writing meaningful commit messages + 5. How to communicate with colleagues and partake in project discussions + 6. A new way of looking at codebases and project anatomy + 7. Basic fundamentals of computer science + 8. Important components of the technical stack and programming languages + + + +The following year, I participated again in the Google Code-In contest to implement what I'd learned and try to make better bonds with my new FOSS friends. This time, I was able to complete a good number of tasks and make some valuable contributions that were pushed into production. As a result, I was selected as one of the 50 grand prize winners out of all the participants from all over the world. Being a kid, this gave me the motivation to make FOSS one of my best friends. + +### Programs that got me closer to FOSS + +From my start, I always liked being part of FOSS, and the journey has been amazing and addictive. I wanted to learn more, and I believed participating in FOSS initiatives and programs would help this happen. [Hacktoberfest][5] is one such initiative where I was able to contribute to Microsoft open source software and various other projects in 2018 and 2019. All the lessons I learned in Google Code-In were reinforced and strengthened.  + +[Google Summer of Code][6] (GSoC) was another important, engaging, and challenging experience for me. I became part of the GSoC 2019 and 2020 programs as a student with the [Sustainable Computing Research Lab][7]. These were two fast-paced and exciting summers spent hunting down bugs, writing new features, and documenting the work. + +In 2019, [Red Hat's Open Source Contest][8] was another wonderful opportunity to work on open source engineering problems. Red Hat is one of my dream companies—it provides open source software products (particularly interesting to me are container technologies and orchestration tools), so I'm lucky to have been part of the contest. The best part was that I was paired with a Red Hat engineer to mentor me throughout the course of the contest. I contributed to the [ansible-bender][9] project, and the journey absolutely stepped up my skills to the next level.  + +![Red Hat Open Source contest certificate][10] + +(Mehant Kammakomati, [CC BY-SA 4.0][4]) + +I also made valuable contributions to the [SPDX][11] online tools for their deployment infrastructure. While I was learning about blockchain technology, I contributed to Hyperledger Fabric's Python SDK. + +### Spreading FOSS culture + +I also served as a Google Code-In mentor in 2018 and 2019 and mentored many young aspirants making their very first valuable FOSS contributions. I was able to review around 400+ tasks and had the privilege of helping hundreds of students. + +Through my time as an open source benefactor, I've learned that the open source model is the best way to host a project. It avails you of many benefits, ranging from obtaining contributions from all over the world to getting project funding. Through my time as a contributor to open source programs, I've learned the value of working to inculcate FOSS culture in our institutions and students. + +I strongly believe in FOSS, and I recommend being part of this culture. Maybe you'll find it difficult to start, but if you seek the advice of friendly participants online or in a sponsored program, you'll surely get help. The most important part of the journey is the first few steps; once you get past that, you'll soon feel responsible and proud of each and every contribution you make—code or otherwise—knowing it helps your friends around the world. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/open-source-mentor + +作者:[Mehant Kammakomati][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://opensource.com/users/mehant-kammakomati +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/puzzle_computer_solve_fix_tool.png?itok=U0pH1uwj (Puzzle pieces coming together to form a computer screen) +[2]: https://en.wikipedia.org/wiki/Google_Code-in +[3]: https://opensource.com/sites/default/files/pictures/google_code-in.jpg (Google Code-in Mehant Kammakomati) +[4]: https://creativecommons.org/licenses/by-sa/4.0/ +[5]: https://hacktoberfest.digitalocean.com/ +[6]: https://summerofcode.withgoogle.com/archive/ +[7]: https://scorelab.org/ +[8]: https://research.redhat.com/red-hat-open-source-contest/ +[9]: https://opensource.com/article/19/10/building-container-images-ansible +[10]: https://opensource.com/sites/default/files/pictures/redhatcertificate.jpg (Red Hat Open Source contest certificate) +[11]: https://en.wikipedia.org/wiki/Software_Package_Data_Exchange From 3cf7b127a22888032aaa903d09d48d113ec167c0 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 3 Nov 2020 08:43:03 +0800 Subject: [PATCH 0641/1156] translated --- ...her Linux Distributions -Beginner-s Tip.md | 87 ------------------- ...her Linux Distributions -Beginner-s Tip.md | 87 +++++++++++++++++++ 2 files changed, 87 insertions(+), 87 deletions(-) delete mode 100644 sources/tech/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md create mode 100644 translated/tech/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md diff --git a/sources/tech/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md b/sources/tech/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md deleted file mode 100644 index 3cbee66656..0000000000 --- a/sources/tech/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md +++ /dev/null @@ -1,87 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Clear Terminal Screen in Ubuntu and Other Linux Distributions [Beginner’s Tip]) -[#]: via: (https://itsfoss.com/clear-terminal-ubuntu/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -How to Clear Terminal Screen in Ubuntu and Other Linux Distributions [Beginner’s Tip] -====== - -When you are working in the terminal, often you’ll find that your terminal screen is filled up with too many commands and their outputs. - -You may want to clear the terminal to declutter the screen and focus on the next task you are going to perform. Clearing the Linux terminal screen helps a lot, trust me. - -### Clear Linux terminal with clear command - -So, how do you clear terminal in Linux? The simplest and the most common way is to use the clear command: - -``` -clear -``` - -You need no option with the clear command. It’s that simple but there are some additional things you need to know about it. - -![][1] - -_**The clear command and other methods of clearing screen may depend on the terminal emulator you are using.**_ Terminal emulator is the terminal application that you use for accessing the Linux shell (command line). - -If you use clear command on Ubuntu with GNOME Terminal, it will clear the screen and you won’t be able to see what else you had on the screen previously. - -In many other terminal emulators or Putty, it may just clear the screen for one page. If you scroll with mouse or PageUp and PageDown keys, you can still access the old screen outputs. - -Frankly, it depends on your need. If you suddenly realize that you need to refer to the output of a previously run command, perhaps having that option available will be helpful. - -### Other ways to clear terminal screen in Linux - -![][2] - -Clear command is not the only way to clear the terminal screen. - -You can use Ctrl+L [keyboard shortcut in Linux][3] to clear the screen. It works in most terminal emulators. - -``` -Ctrl+L -``` - -If you use Ctrl+L and clear command in GNOME terminal (default in Ubuntu), you’ll notice the difference between their impact. Ctrl+L moves the screen one page down giving the illusion of a clean screen but you can still access the command output history by scrolling up. - -**Some other terminal emulators have this keyboard shortcut set at Ctrl+Shift+K.** - -You can also use reset command for clearing the terminal screen. Actually, this command performs a complete terminal re-initialization. It could take a bit longer than clear command, though. - -``` -reset -``` - -There are a couple of other complicated ways to clear the screen when you want to clear the screen completely. But since the command is a bit complicated, it’s better to use it as [alias in Linux][4]: - -``` -alias cls='printf "\033c"' -``` - -You can add this alias to your bash profile so that it is available as command. - -I know this was a pretty basic topic and most Linux users probably already knew it but it doesn’t harm in covering the elementary topics for the new Linux users. Isn’t it? - -Got some secretive tip on clearing terminal screen? Why not share it with us? - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/clear-terminal-ubuntu/ - -作者:[Abhishek Prakash][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/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/clear-command-linux.gif?resize=800%2C432&ssl=1 -[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/clear-terminal-screen-linux.png?resize=800%2C450&ssl=1 -[3]: https://linuxhandbook.com/linux-shortcuts/ -[4]: https://linuxhandbook.com/linux-alias-command/ diff --git a/translated/tech/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md b/translated/tech/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md new file mode 100644 index 0000000000..3f0e150395 --- /dev/null +++ b/translated/tech/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Clear Terminal Screen in Ubuntu and Other Linux Distributions [Beginner’s Tip]) +[#]: via: (https://itsfoss.com/clear-terminal-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何清除 Ubuntu 和其他 Linux 发行版的终端屏幕(初学者提示) +====== + +在终端上工作时,通常会发现终端屏幕上显示了太多的命令及其输出。 + +你可能需要清除终端屏幕并专注于要执行的下一个任务。相信我,清除 Linux 终端屏幕会很有帮助。 + +### 使用 clear 命令清除 Linux 终端 + +那么,如何清除 Linux 中的终端?最简单,最常见的方法是使用 clear 命令: + +``` +clear +``` + +你无需使用 clear 命令选项。就是这么简单,但是你还需要了解其他一些内容。 + +![][1] + +_ **clear 命令和其他清除屏幕的方法可能取决于你使用的终端模拟器。** _ 终端模拟器是用于访问 Linux Shell(命令行)的终端应用。 + +如果你在具有 GNOME Terminal 的 Ubuntu 上使用 clear 命令,它将清除屏幕,并且你将无法看到之前屏幕上的内容。 + +在许多其他终端模拟器或 Putty 中,它可能只清除一页屏幕。如果使用鼠标或 PageUp 和 PageDown 键滚动,那么仍然可以看到以前的屏幕输出。 + +坦白说,这取决于你的需要。如果你突然意识到需要引用以前运行的命令的输出,那么也许可以使用该方式。 + +### 在 Linux 中清除终端屏幕的其他方法 + +![][2] + +clear 命令不是清除终端屏幕的唯一方法。 + +你可以在 Linux 中使用 Ctrl+L [键盘快捷键][3]来清除屏幕。它适用于大多数终端模拟器。 + +``` +Ctrl+L +``` + +如果你在 GNOME terminal (Ubuntu 中默认)中使用 Ctrl+L 和 clear 命令,那么你会注意到它们的影响有所不同。Ctrl+L 将屏幕向下移动一页,给人一种干净的错觉,但是你仍然可以通过向上滚动来访问命令输出历史。 + +**某些其他终端模拟器将此键盘快捷键设置为 Ctrl+Shift+K**。 + +你也可以使用 reset 命令清除终端屏幕。实际上,此命令执行完整的终端重新初始化。但是,它可能比 clear 命令要花费更长的时间。 + +``` +reset +``` + +当你想完全清除屏幕时,还有几种其他复杂的方法可以清除屏幕。但是由于命令有点复杂,所以最好将它作为 [Linux 中的别名][4]: + +``` +alias cls='printf "\033c"' +``` + +你可以将此别名添加到你的 bash 配置文件中,以便作为命令使用。 + +我知道这是一个非常基本的主题,大多数 Linux 用户可能已经知道了,但这对于为新 Linux 用户介绍基本主题并没有什么坏处。是不是? + +在清除终端屏幕上有些秘密提示​​吗?为什么不与我们分享呢? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/clear-terminal-ubuntu/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/clear-command-linux.gif?resize=800%2C432&ssl=1 +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/clear-terminal-screen-linux.png?resize=800%2C450&ssl=1 +[3]: https://linuxhandbook.com/linux-shortcuts/ +[4]: https://linuxhandbook.com/linux-alias-command/ From 35ab2098bfca10bad9fc66eae238f725852474ba Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 3 Nov 2020 08:55:56 +0800 Subject: [PATCH 0642/1156] translating --- ...TS Release and it has Some Exciting Improvements Lined Up.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md b/sources/tech/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md index ccb6a1c284..45ae5f36c1 100644 --- a/sources/tech/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md +++ b/sources/tech/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 7d27c49a91b3fe4540d52148178dc690811fad71 Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Tue, 3 Nov 2020 09:53:04 +0800 Subject: [PATCH 0643/1156] Update 20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md --- ...critical, a mixed-channel architecture is the best option.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md b/sources/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md index 29a73998d7..3a13957772 100644 --- a/sources/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md +++ b/sources/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (chenmu-kk) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 3c94251bf2cd1cfa0a95b8b87858b30c6e7c58cd Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 3 Nov 2020 10:28:14 +0800 Subject: [PATCH 0644/1156] PRF @geekpi --- ...Install Ubuntu Server on a Raspberry Pi.md | 65 ++++++++----------- 1 file changed, 28 insertions(+), 37 deletions(-) diff --git a/translated/tech/20200909 How to Install Ubuntu Server on a Raspberry Pi.md b/translated/tech/20200909 How to Install Ubuntu Server on a Raspberry Pi.md index 8dd702fafc..569598e580 100644 --- a/translated/tech/20200909 How to Install Ubuntu Server on a Raspberry Pi.md +++ b/translated/tech/20200909 How to Install Ubuntu Server on a Raspberry Pi.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Install Ubuntu Server on a Raspberry Pi) @@ -10,7 +10,9 @@ 如何在树莓派上安装 Ubuntu 服务器? ====== -[树莓派][1]是最著名的[单板计算机][2]。最初,树莓派项目的范围是针对促进学校和发展中国家的计算机基础科学教学。 +![][6] + +[树莓派][1]是最著名的[单板计算机][2]。最初,树莓派项目的范围旨在促进学校和发展中国家的计算机基础科学的教学。 它的低成本、便携性和极低的功耗,使得它的受欢迎程度远远超过预期。从气象站到家庭自动化,玩家们用树莓派搭建了许多[酷炫的项目][3]。 @@ -22,28 +24,22 @@ * 在树莓派上设置无线网络连接 * 通过 SSH 访问你的树莓派 - - ![][5] -**本教程需要以下东西**: +**本教程需要以下设备**: * 一张 micro SD 卡(建议使用 8GB 或更大的卡) * 一台带有 micro SD 卡读卡器的计算机(运行 Linux、Windows 或 macOS) * 树莓派 2、3 或 4 * 良好的互联网连接 - * 用于树莓派 2 和 3 的 HDMI 线和用于树莓派 4的 micro HDMI 线(可选) + * 用于树莓派 2 和 3 的 HDMI 线和用于树莓派 4 的 micro HDMI 线(可选) * 一套 USB 键盘(可选) - - ### 在树莓派上安装 Ubuntu 服务器 -![][6] - 在本教程中,我使用 Ubuntu 来创建树莓派 SD 卡,但你可以在其他 Linux 发行版、macOS 和 Windows 上创建它。这是因为准备 SD 卡的步骤对 Raspberry Pi Imager 工具而言是一样的。 -Raspberry Pi Imager 工具会自动下载你[选择树莓派系统][7]的镜像。这意味着你需要一个良好的网络连接来下载 1GB 左右的数据。 +Raspberry Pi Imager 工具会自动下载你[选择的树莓派系统][7]镜像。这意味着你需要一个良好的网络连接来下载 1GB 左右的数据。 #### 步骤 1:用 Raspberry Pi Imager 准备 SD 卡 @@ -55,20 +51,17 @@ Raspberry Pi Imager 工具会自动下载你[选择树莓派系统][7]的镜像 * [用于 Windows 的 Raspberry Pi Imager][9] * [用于 MacOS 的 Raspberry Pi Imager][10] - - - 尽管我使用的是 Ubuntu,但我不会使用上面列出的 Debian 软件包,而是使用命令行安装 snap 包。这个方法可以适用于更广泛的 Linux 发行版。 ``` sudo snap install rpi-imager ``` -安装好 Raspberry Pi Imager 工具后,找到并打开它,点击 ”CHOOSE OS“ 菜单。 +安装好 Raspberry Pi Imager 工具后,找到并打开它,点击 “CHOOSE OS” 菜单。 ![][11] -滚动菜单并点击 ”Ubuntu“ (核心和服务器镜像)。 +滚动菜单并点击 “Ubuntu” (“核心”和“服务器”镜像)。 ![][12] @@ -78,7 +71,7 @@ sudo snap install rpi-imager ![][13] -从 “SD Card” 菜单中选择你的 microSD 卡,然后点击 ”WRITE“。 +从 “SD Card” 菜单中选择你的 microSD 卡,然后点击 “WRITE”。 ![][14] @@ -90,19 +83,19 @@ sudo snap install rpi-imager #### 步骤 2:在 Ubuntu 服务器上添加 WiFi 支持 -烧录完 micro SD 卡后,你就差不多可以使用它了。在使用它之前,有一件事情你可能想做,那就是添加 Wi-Fi 支持。 +烧录完 micro SD 卡后,你就差不多可以使用它了。在使用它之前,有一件事情你可能想做,那就是添加 Wi-Fi 支持。 -SD 卡仍然插入读卡器中,打开文件管理器,找到卡上的 ”system-boot” 分区。 +SD 卡仍然插入读卡器中,打开文件管理器,找到卡上的 “system-boot” 分区。 你要找的和需要编辑的文件名为 `network-config`。 ![][16] -这个过程也可以在 Windows 和 MacOS 上完成。如前所述,编辑 **`network-config`** 文件,添加你的 Wi-Fi 凭证。 +这个过程也可以在 Windows 和 MacOS 上完成。如前所述,编辑 `network-config` 文件,添加你的 Wi-Fi 凭证。 -首先,取消矩形框内的行的注释(删除开头的标签 “#”),然后将 myhomewifi 替换为你的 Wi-Fi 网络名称。 +首先,取消矩形框内的行的注释(删除开头的标签 `#`)。 -之后,将 myhomewifi 替换为你的 Wi-Fi 网络名,用引号括起来,比如 ”itsfoss“,将 ”S3kr1t“ 替换为 Wi-Fi 密码,用引号括起来,比如 ”12345679“。 +之后,将 `myhomewifi` 替换为你的 Wi-Fi 网络名,比如 `"itsfoss"`,将 `"S3kr1t"` 替换为 Wi-Fi 密码,用引号括起来,比如 `"12345679"`。 ![][17] @@ -126,27 +119,25 @@ wifis: 只需将 micro SD 卡插入树莓派,连接显示器、键盘和鼠标。现在[打开你的树莓派][18]。它将出现 TTY 登录屏幕(黑色终端屏幕)并询问用户名和密码。 - * 默认用户名:ubuntu - * 默认密码:ubuntu + * 默认用户名:`ubuntu` + * 默认密码:`ubuntu` +看到提示符时,用 `ubuntu` 作为密码。登录成功后,[Ubuntu 会要求你更改默认密码][19]。 - -看到提示时,用 “**ubuntu**” 作为密码。登录成功后,[Ubuntu 会要求你更改默认密码][19]。 - -享受你的 Ubuntu 服务器吧! +享受你的 Ubuntu 服务器吧! #### 步骤 3:通过 SSH 远程连接到你的树莓派(如果你没有树莓派的显示器、键盘和鼠标的话) -如果你没有专门的显示器与树莓派一起使用也没关系。当你可以直接通过 SSH 进入它并按照你的方式使用它时,谁还需要一个带有显示器的服务器呢? +如果你没有专门与树莓派一起使用的显示器也没关系。当你可以直接通过 SSH 进入它并按照你的方式使用它时,谁还需要一个带有显示器的服务器呢? -**在 Ubuntu 和 Mac OS**上,通常已经安装了一个 SSH 客户端。要远程连接到你的树莓派,你需要发现它的 IP 地址。检查[连接到你的网络的设备][20],看看哪个是树莓派。 +**在 Ubuntu 和 Mac OS**上,通常已经安装了一个 SSH 客户端。要远程连接到你的树莓派,你需要找到它的 IP 地址。检查[连接到你的网络的设备][20],看看哪个是树莓派。 由于我没有 Windows 机器,你可以访问[微软][21]提供的综合指南。 打开终端,运行以下命令: ``` -ssh [email protected]_pi_ip_address +ssh ubuntu@raspberry_pi_ip_address ``` 你可能会看到以下信息确认连接: @@ -155,21 +146,21 @@ ssh [email protected]_pi_ip_address Are you sure you want to continue connecting (yes/no/[fingerprint])? ``` -输入 ”yes“,然后点击回车键。 +输入 `yes`,然后点击回车键。 ![][22] -当提示时,用前面提到的 ”ubuntu“ 作为密码。当然,你会被要求更改密码。 +当提示时,用前面提到的 `ubuntu` 作为密码。当然,你会被要求更改密码。 完成后,你将自动注销,你必须使用新密码重新连接。 -你的 Ubuntu 服务器就可以在树莓派上运行了! +你的 Ubuntu 服务器就可以在树莓派上运行了! -**总结** +### 总结 在树莓派上安装 Ubuntu 服务器是一个简单的过程,而且它的预配置程度很高,使用起来很愉快。 -我不得不说,在所有[我在树莓派上尝试的操作系统][7]中,Ubuntu 服务器是最容易安装的。我并没有夸大其词。请查看我的[在树莓派上安装 Arch Linux][23]的指南,以供参考。 +我不得不说,在所有[我在树莓派上尝试的操作系统][7]中,Ubuntu 服务器是最容易安装的。我并没有夸大其词。请查看我的[在树莓派上安装 Arch Linux][23] 的指南,以供参考。 希望这篇指南也能帮助你在树莓派上安装 Ubuntu 服务器。如果你有问题或建议,请在评论区告诉我。 @@ -180,7 +171,7 @@ via: https://itsfoss.com/install-ubuntu-server-raspberry-pi/ 作者:[Dimitrios Savvopoulos][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6f13c560d5aab65f0cd75663e0d8e5857d614d7e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 3 Nov 2020 10:30:51 +0800 Subject: [PATCH 0645/1156] PUB @geekpi https://linux.cn/article-12783-1.html --- ...20200909 How to Install Ubuntu Server on a Raspberry Pi.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200909 How to Install Ubuntu Server on a Raspberry Pi.md (99%) diff --git a/translated/tech/20200909 How to Install Ubuntu Server on a Raspberry Pi.md b/published/20200909 How to Install Ubuntu Server on a Raspberry Pi.md similarity index 99% rename from translated/tech/20200909 How to Install Ubuntu Server on a Raspberry Pi.md rename to published/20200909 How to Install Ubuntu Server on a Raspberry Pi.md index 569598e580..58c77ccb7f 100644 --- a/translated/tech/20200909 How to Install Ubuntu Server on a Raspberry Pi.md +++ b/published/20200909 How to Install Ubuntu Server on a Raspberry Pi.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12783-1.html) [#]: subject: (How to Install Ubuntu Server on a Raspberry Pi) [#]: via: (https://itsfoss.com/install-ubuntu-server-raspberry-pi/) [#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) From ca07b0412f211477a6e1aa2824282cdd356d8961 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 3 Nov 2020 10:37:39 +0800 Subject: [PATCH 0646/1156] Rename sources/tech/20201030 My journey to becoming an open source mentor.md to sources/talk/20201030 My journey to becoming an open source mentor.md --- .../20201030 My journey to becoming an open source mentor.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20201030 My journey to becoming an open source mentor.md (100%) diff --git a/sources/tech/20201030 My journey to becoming an open source mentor.md b/sources/talk/20201030 My journey to becoming an open source mentor.md similarity index 100% rename from sources/tech/20201030 My journey to becoming an open source mentor.md rename to sources/talk/20201030 My journey to becoming an open source mentor.md From e7a1e775cdf28ba1c9e1752d37a06784a36bf709 Mon Sep 17 00:00:00 2001 From: zouchong Date: Tue, 3 Nov 2020 20:11:12 +0800 Subject: [PATCH 0647/1156] hankchow translating --- ...a Kubernetes Minecraft server with Ansible-s Helm modules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201012 Build a Kubernetes Minecraft server with Ansible-s Helm modules.md b/sources/tech/20201012 Build a Kubernetes Minecraft server with Ansible-s Helm modules.md index 08dd088007..8708a104d9 100644 --- a/sources/tech/20201012 Build a Kubernetes Minecraft server with Ansible-s Helm modules.md +++ b/sources/tech/20201012 Build a Kubernetes Minecraft server with Ansible-s Helm modules.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (HankChow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From e06fd0478a11d94441f842a980701d9dcf0ca801 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 4 Nov 2020 05:02:15 +0800 Subject: [PATCH 0648/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201103?= =?UTF-8?q?=20Create=20a=20list=20in=20a=20Flutter=20mobile=20app?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201103 Create a list in a Flutter mobile app.md --- ...3 Create a list in a Flutter mobile app.md | 379 ++++++++++++++++++ 1 file changed, 379 insertions(+) create mode 100644 sources/tech/20201103 Create a list in a Flutter mobile app.md diff --git a/sources/tech/20201103 Create a list in a Flutter mobile app.md b/sources/tech/20201103 Create a list in a Flutter mobile app.md new file mode 100644 index 0000000000..b6befbda3b --- /dev/null +++ b/sources/tech/20201103 Create a list in a Flutter mobile app.md @@ -0,0 +1,379 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Create a list in a Flutter mobile app) +[#]: via: (https://opensource.com/article/20/11/flutter-lists-mobile-app) +[#]: author: (Vitaly Kuprenko https://opensource.com/users/kooper) + +Create a list in a Flutter mobile app +====== +Learn how to create Flutter app screens and pass data between them. +![Mobile devices and collaboration leads to staring at our phones][1] + +Flutter is a popular open source toolkit for building cross-platform apps. In "[Create a mobile app with Flutter][2]," I demonstrated how to install [Flutter][3] on Linux and create your first app. In this article, I'll show you how to add a list of items in your app, with each item opening a new screen. This is a common design method for mobile apps, so you've probably seen it before, but here's a screenshot to help you visualize it: + +![Testing the Flutter app][4] + +(Vitaly Kuprenko, [CC BY-SA 4.0][5]) + +Flutter uses the [Dart][6] language. In some of the code snippets below, you'll see statements beginning with slashes. Two slashes (`/ /`) is for code comments, which explain certain pieces of code. Three slashes (`/ / /`) denotes Dart's documentation comments, which explain Dart classes and their properties and other useful information. + +### Examine a Flutter app's main parts + +A typical entry point for a  Flutter application is a `main()` function, usually found in a file called `lib/main.dart`: + + +``` +void main() { + runApp(MyApp()); +} +``` + +This method is called when the app is launched. It runs `MyApp()`, a StatelessWidget containing all necessary app settings in the `MaterialApp()` widget (app theme, initial page to open, and so on): + + +``` +class MyApp extends StatelessWidget { + @override + Widget build(BuildContext context) { +   return MaterialApp( +     title: 'Flutter Demo', +     theme: ThemeData( +       primarySwatch: Colors.blue, +       visualDensity: VisualDensity.adaptivePlatformDensity, +     ), +     home: MyHomePage(title: 'Flutter Demo Home Page'), +   ); + } +} +``` + +The initial page generated is called `MyHomePage()`. It's a stateful widget that contains variables that can be passed to a widget constructor parameter (take a look at the code above, where you pass the variable `title` to the page constructor): + + +``` +class MyHomePage extends StatefulWidget { +  MyHomePage({[Key][7] key, this.title}) : super(key: key); + +  final [String][8] title; + +  @override +  _MyHomePageState createState() => _MyHomePageState(); +} +``` + +StatefulWidget means that this page has its own state: `_MyHomePageState`. It lets you call the `setState()` method there to rebuild the page's user interface (UI): + + +``` +class _MyHomePageState extends State<MyHomePage> { + int _counter = 0; // Number of taps on + button. + + void _incrementCounter() { // Increase number of taps and update UI by calling setState(). +   setState(() { +     _counter++; +   }); + } + ... +} +``` + +A `build()` function in stateful and stateless widgets is responsible for UI appearance: + + +``` +@override +Widget build(BuildContext context) { + return Scaffold( // Page widget. +   appBar: AppBar( // Page app bar with title and back button if user can return to previous screen. +     title: Text(widget.title), // Text to display page title. +   ), +   body: Center( // Widget to center child widget. +     child: Column( // Display children widgets in column. +       mainAxisAlignment: MainAxisAlignment.center, +       children: <Widget>[ +         Text( // Static text. +           'You have pushed the button this many times:', +         ), +         Text( // Text with our taps number. +           '$_counter', // $ sign allows us to use variables inside a string. +           style: Theme.of(context).textTheme.headline4,// Style of the text, “Theme.of(context)” takes our context and allows us to access our global app theme. +         ), +       ], +     ), +   ), +        // Floating action button to increment _counter number. +   floatingActionButton: FloatingActionButton( +     onPressed: _incrementCounter, +     tooltip: 'Increment', +     child: [Icon][9](Icons.add), +   ), + ); +} +``` + +### Modify your app + +It's good practice to separate the `main()` method and other pages' code into different files. To do so, you need to create a new .dart file by right-clicking on the **lib** folder then selecting **New > Dart File**: + +![Create a new Dart file][10] + +(Vitaly Kuprenko, [CC BY-SA 4.0][5]) + +Name the file `items_list_page`. + +Switch back to your `main.dart` file, cut the `MyHomePage` and `_MyHomePageState` code, and paste it into your new file. Next, set your cursor on `StatefulWidget` (underlined below in red), press Alt+Enter, and select `package:flutter/material.dart`: + +![Importing Flutter package][11] + +(Vitaly Kuprenko, [CC BY-SA 4.0][5]) + +This adds `flutter/material.dart` to your file so that you can use the default material widgets Flutter provides. + +Then, right-click on **MyHomePage class > Refactor > Rename…** and rename this class to `ItemsListPage`: + +![Renaming StatefulWidget class][12] + +(Vitaly Kuprenko, [CC BY-SA 4.0][5]) + +Flutter recognizes that you renamed the StatefulWidget class and automatically renames its State class: + +![State class renamed automatically][13] + +(Vitaly Kuprenko, [CC BY-SA 4.0][5]) + +Return to the `main.dart` file and change the name `MyHomePage` to `ItemsListPage`. Once you start typing, your Flutter integrated development environment (probably IntelliJ IDEA Community Edition, Android Studio, and VS Code or [VSCodium][14]) suggests how to autocomplete your code: + +![IDE suggests autocompleting code][15] + +(Vitaly Kuprenko, [CC BY-SA 4.0][5]) + +Press Enter to complete your input. It will add the missing import to the top of the file automatically: + +![Adding missing import ][16] + +(Vitaly Kuprenko, [CC BY-SA 4.0][5]) + +You've completed your initial setup. Now you need to create a new .dart file in the **lib** folder and name it `item_model`. (Note that classes have UpperCamelCase names, but files have snake_case names.) Paste this code into the new file: + + +``` +/// Class that stores list item info: +/// [id] - unique identifier, number. +/// [icon] - icon to display in UI. +/// [title] - text title of the item. +/// [description] - text description of the item. +class ItemModel { + // class constructor + ItemModel(this.id, this.icon, this.title, this.description); + + // class fields + final int id; + final IconData icon; + final [String][8] title; + final [String][8] description; +} +``` + +Return to `items_list_page.dart`, and replace the existing `_ItemsListPageState` code with: + + +``` +class _ItemsListPageState extends State<ItemsListPage> { + +// Hard-coded list of [ItemModel] to be displayed on our page. + final List<ItemModel> _items = [ +   ItemModel(0, Icons.account_balance, 'Balance', 'Some info'), +   ItemModel(1, Icons.account_balance_wallet, 'Balance wallet', 'Some info'), +   ItemModel(2, Icons.alarm, 'Alarm', 'Some info'), +   ItemModel(3, Icons.my_location, 'My location', 'Some info'), +   ItemModel(4, Icons.laptop, 'Laptop', 'Some info'), +   ItemModel(5, Icons.backup, 'Backup', 'Some info'), +   ItemModel(6, Icons.settings, 'Settings', 'Some info'), +   ItemModel(7, Icons.call, 'Call', 'Some info'), +   ItemModel(8, Icons.restore, 'Restore', 'Some info'), +   ItemModel(9, Icons.camera_alt, 'Camera', 'Some info'), + ]; + + @override + Widget build(BuildContext context) { +   return Scaffold( +       appBar: AppBar( +         title: Text(widget.title), +       ), +       body: [ListView][17].builder( // Widget which creates [ItemWidget] in scrollable list. +         itemCount: _items.length, // Number of widget to be created. +         itemBuilder: (context, itemIndex) => // Builder function for every item with index. +             ItemWidget(_items[itemIndex], () { +           _onItemTap(context, itemIndex); +         }), +       )); + } + + // Method which uses BuildContext to push (open) new MaterialPageRoute (representation of the screen in Flutter navigation model) with ItemDetailsPage (StateFullWidget with UI for page) in builder. + _onItemTap(BuildContext context, int itemIndex) { +   Navigator.of(context).push(MaterialPageRoute( +       builder: (context) => ItemDetailsPage(_items[itemIndex]))); + } +} + +// StatelessWidget with UI for our ItemModel-s in ListView. +class ItemWidget extends StatelessWidget { + const ItemWidget(this.model, this.onItemTap, {[Key][7] key}) : super(key: key); + + final ItemModel model; + final Function onItemTap; + + @override + Widget build(BuildContext context) { +   return InkWell( // Enables taps for child and add ripple effect when child widget is long pressed. +     onTap: onItemTap, +     child: ListTile( // Useful standard widget for displaying something in ListView. +       leading: [Icon][9](model.icon), +       title: Text(model.title), +     ), +   ); + } +} +``` + +Consider moving `ItemWidget` to a separate file in the **lib** folder to improve the readability of your code. + +The only thing missing is the `ItemDetailsPage` class. Create a new file in the **lib** folder and name it `item_details_page`. Then copy and paste this code there: + + +``` +import 'package:flutter/material.dart'; + +import 'item_model.dart'; + +/// Widget for displaying detailed info of [ItemModel] +class ItemDetailsPage extends StatefulWidget { + final ItemModel model; + + const ItemDetailsPage(this.model, {[Key][7] key}) : super(key: key); + + @override + _ItemDetailsPageState createState() => _ItemDetailsPageState(); +} + +class _ItemDetailsPageState extends State<ItemDetailsPage> { + @override + Widget build(BuildContext context) { +   return Scaffold( +     appBar: AppBar( +       title: Text(widget.model.title), +     ), +     body: Center( +       child: Column( +         children: [ +           const SizedBox(height: 16), +           [Icon][9]( +             widget.model.icon, +             size: 100, +           ), +           const SizedBox(height: 16), +           Text( +             'Item description: ${widget.model.description}', +             style: TextStyle(fontSize: 18), +           ) +         ], +       ), +     ), +   ); + } +} +``` + +Almost nothing new here. Notice that `_ItemDetailsPageState` is using the `widget.item.title` code. It enables referring to the `StatefulWidget` fields in its `State` class. + +### Add some animation + +Now, it's time to add some basic animation: + + 1. Go to `ItemWidget` code. + 2. Put the cursor on the `Icon()` widget in the `build()` method. + 3. Press Alt+Enter and select "Wrap with widget…" + + + +![Wrap with widget option][18] + +(Vitaly Kuprenko, [CC BY-SA 4.0][5]) + +Start typing "Hero" and select the suggestion for `Hero((Key key, @required this, tag, this.create))`: + +![Finding the Hero widget][19] + +(Vitaly Kuprenko, [CC BY-SA 4.0][5]) + +Next, add the tag property `tag: model.id` to the Hero widget: + +![Adding the tag property model.id to the Hero widget][20] + +(Vitaly Kuprenko, [CC BY-SA 4.0][5]) + +And the final step is to make the same change in the `item_details_page.dart` file: + +![Changing item_details_page.dart file][21] + +(Vitaly Kuprenko, [CC BY-SA 4.0][5]) + +The previous steps wrapped the `Icon()` widget with the `Hero()` widget. Do you remember in `ItemModel` you added the `id field` but didn't use it anywhere? The Hero widget takes a unique tag for the child widget. If Hero detects that different app screens (MaterialPageRoute) have a Hero widget with the same tag, it'll automatically animate the transition between these pages. + +Test it out by running the app on an Android emulator or physical device. When you open and close the item details page, you'll see a nice animation of the icon: + +![Testing the Flutter app][4] + +(Vitaly Kuprenko, [CC BY-SA 4.0][5]) + +### Wrapping up + +In this tutorial, you learned: + + * The components of a standard, automatically created app + * How to add several pages that pass data among each other + * How to add a simple animation for those pages + + + +If you want to learn more, check out Flutter's [docs][22] (with links to sample projects, videos, and "recipes" for creating Flutter apps) and the [source code][23], which is open source under a BSD 3-Clause License. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/flutter-lists-mobile-app + +作者:[Vitaly Kuprenko][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://opensource.com/users/kooper +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/team-phone-collaboration-mobile-device.png?itok=v3EjbRK6 (Mobile devices and collaboration leads to staring at our phones) +[2]: https://opensource.com/article/20/9/mobile-app-flutter +[3]: https://flutter.dev/ +[4]: https://opensource.com/sites/default/files/uploads/flutter_test.gif (Testing the Flutter app) +[5]: https://creativecommons.org/licenses/by-sa/4.0/ +[6]: https://dart.dev/ +[7]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+key +[8]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string +[9]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+icon +[10]: https://opensource.com/sites/default/files/uploads/flutter_new-dart-file_0.png (Create a new Dart file) +[11]: https://opensource.com/sites/default/files/uploads/flutter_import-package.png (Importing Flutter package) +[12]: https://opensource.com/sites/default/files/uploads/flutter_rename-class.png (Renaming StatefulWidget class) +[13]: https://opensource.com/sites/default/files/uploads/flutter_stateclassrenamed.png (State class renamed automatically) +[14]: https://opensource.com/article/20/6/open-source-alternatives-vs-code +[15]: https://opensource.com/sites/default/files/uploads/flutter_autocomplete.png (IDE suggests autocompleting code) +[16]: https://opensource.com/sites/default/files/uploads/flutter_import-input.png (Adding missing import ) +[17]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+listview +[18]: https://opensource.com/sites/default/files/uploads/flutter_wrapwithwidget.png (Wrap with widget option) +[19]: https://opensource.com/sites/default/files/uploads/flutter_hero.png (Finding the Hero widget) +[20]: https://opensource.com/sites/default/files/uploads/flutter_hero-tag.png (Adding the tag property model.id to the Hero widget) +[21]: https://opensource.com/sites/default/files/uploads/flutter_details-tag.png (Changing item_details_page.dart file) +[22]: https://flutter.dev/docs +[23]: https://github.com/flutter From a86907b764c86ec5bfa5ab7cb5cc90028b5efcb7 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 4 Nov 2020 05:02:27 +0800 Subject: [PATCH 0649/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201103?= =?UTF-8?q?=204=20ways=20to=20run=20Kubernetes=20locally?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201103 4 ways to run Kubernetes locally.md --- ...201103 4 ways to run Kubernetes locally.md | 137 ++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 sources/tech/20201103 4 ways to run Kubernetes locally.md diff --git a/sources/tech/20201103 4 ways to run Kubernetes locally.md b/sources/tech/20201103 4 ways to run Kubernetes locally.md new file mode 100644 index 0000000000..b2035519b2 --- /dev/null +++ b/sources/tech/20201103 4 ways to run Kubernetes locally.md @@ -0,0 +1,137 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 ways to run Kubernetes locally) +[#]: via: (https://opensource.com/article/20/11/run-kubernetes-locally) +[#]: author: (Bryant Son https://opensource.com/users/brson) + +4 ways to run Kubernetes locally +====== +Set up a local development environment or just try out the container +orchestration platform with these tools. +![Business woman on laptop sitting in front of window][1] + +[Kubernetes][2] is an open source orchestration platform for containers. Developed by Google, it offers an open source system for automating deployment, scaling, and managing containerized applications. Although most people run Kubernetes in a cloud environment, running a Kubernetes cluster locally is not only possible, it has at least two benefits: + + * You can quickly try out Kubernetes before deciding to use it as your primary platform to deploy your application. + * You can set it up as a local development environment before pushing anything to a public cloud, thus allowing separation between the development environment and the production environment. + + + +Setting up a local Kubernetes environment as your development environment is the recommended option, no matter your situation, because this setup can create a safe and agile application-deployment process. + +Fortunately, there are multiple platforms that you can try out to run Kubernetes locally, and they are all open source and available under the [Apache 2.0][3] license. + + * [Minikube][4] has the primary goals of being the best tool for local Kubernetes application development, and to support all Kubernetes features that fit. + * [kind][5] runs local Kubernetes clusters using Docker container "nodes." + * [CodeReady Containers][6] (CRC) manages a local OpenShift 4.x cluster optimized for testing and development purposes. + * [Minishift][7] helps you run OpenShift 3.x clusters locally by running a single-node OpenShift cluster inside a virtual machine (VM). + + + +### Minikube + +![Minikube][8] + +(Bryant Son, [CC BY-SA 4.0][9]) + +[Minikube][10] is the most well-known and popular choice to run a Kubernetes environment on a local computer. No matter what operating system you use, [Minikube's documentation][11] offers an easy [installation][12] guide for you. Generally, installing Minikube is as simple as running two commands: + + +``` +$ curl -LO +$ sudo install minikube-PLATFORM-amd64 /usr/local/bin/minikube +``` + +Minikube quickly sets up a local Kubernetes cluster on Linux, macOS, or Windows with the following features: + + * Supports the latest Kubernetes release (+6 previous minor versions) + * Cross-platform (Linux, macOS, Windows) + * Deploys as a VM, a container, or on bare-metal + * Multiple container runtimes (CRI-O, containerd, Docker) + * Docker API endpoint for blazing-fast image pushes + * LoadBalancer, filesystem mounts, FeatureGates, and other advanced features + * Add-ons for easily installing Kubernetes applications + + + +Because Minikube is an open source project, you can contribute to its [source code][4]. + +### kind + +![kind][13] + +(Bryant Son, [CC BY-SA 4.0][9]) + +[kind][14]'s developers describe it as "a tool for running local Kubernetes clusters using Docker container 'nodes.'" It was designed for testing Kubernetes but may also be used for local development or continuous integration. + +kind supports: + + * Multi-node (including high-availability) clusters + * Building Kubernetes release builds from source + * Make/Bash/Docker or Bazel, in addition to pre-published builds + * Linux, macOS, and Windows + + + +In addition, kind is a Cloud Native Computing Foundation (CNCF)-certified conformant Kubernetes installer. Because it's open source, you can find kind's [source code][5] in its GitHub repository. + +### CodeReady Container (CRC) + +![CodeReady Container][15] + +(Bryant Son, [CC BY-SA 4.0][9]) + +If you want to try the latest version of OpenShift locally, try Red Hat [CodeReady Containers][16] (CRC). CRC brings a minimal OpenShift 4.x cluster to your local computer that provides a minimal environment for development and testing purposes. CRC is mainly targeted for use on developers' desktops. + +You can find CodeReady Container's [source code][6] on GitHub, also available under the Apache 2.0 license. + +### Minishift + +![Minishift][17] + +(Bryant Son, [CC BY-SA 4.0][9]) + +The [Minishift][7] project [helps you run a version of OpenShift][18] with [OKD][19] locally with a single-node OpenShift cluster inside a virtual machine. You can use it to [try OpenShift][20] or to develop for the cloud, on your local host. + +Like the other tools on this list, Minishift is open source, and you can access its [source code][7] on GitHub. + +### Kubernetes for the people + +As you can see, there are several ways to try out Kubernetes in your local environment. Did I miss anything? Feel free to leave a comment to ask a question or make a suggestion. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/run-kubernetes-locally + +作者:[Bryant Son][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://opensource.com/users/brson +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating) +[2]: https://kubernetes.io/ +[3]: https://www.apache.org/licenses/LICENSE-2.0 +[4]: https://github.com/kubernetes/minikube +[5]: https://github.com/kubernetes-sigs/kind +[6]: https://github.com/code-ready/crc +[7]: https://github.com/minishift/minishift +[8]: https://opensource.com/sites/default/files/uploads/1_minikube.jpg (Minikube) +[9]: https://creativecommons.org/licenses/by-sa/4.0/ +[10]: https://minikube.sigs.k8s.io/docs/ +[11]: https://minikube.sigs.k8s.io/docs +[12]: https://minikube.sigs.k8s.io/docs/start/ +[13]: https://opensource.com/sites/default/files/uploads/2_kind.jpg (kind) +[14]: https://kind.sigs.k8s.io +[15]: https://opensource.com/sites/default/files/uploads/4_crc.jpg (CodeReady Container) +[16]: https://code-ready.github.io/crc +[17]: https://opensource.com/sites/default/files/uploads/3_minishift.jpg (Minishift) +[18]: https://www.redhat.com/sysadmin/kubernetes-cluster-laptop +[19]: https://www.okd.io/ +[20]: https://www.redhat.com/sysadmin/learn-openshift-minishift From c7836b7614b0247d659f12efc885ca18e3a6fe0b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 4 Nov 2020 05:02:39 +0800 Subject: [PATCH 0650/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201103?= =?UTF-8?q?=20How=20the=20Kubernetes=20scheduler=20works?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201103 How the Kubernetes scheduler works.md --- ...1103 How the Kubernetes scheduler works.md | 159 ++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 sources/tech/20201103 How the Kubernetes scheduler works.md diff --git a/sources/tech/20201103 How the Kubernetes scheduler works.md b/sources/tech/20201103 How the Kubernetes scheduler works.md new file mode 100644 index 0000000000..ba6918fdc9 --- /dev/null +++ b/sources/tech/20201103 How the Kubernetes scheduler works.md @@ -0,0 +1,159 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How the Kubernetes scheduler works) +[#]: via: (https://opensource.com/article/20/11/kubernetes-scheduler) +[#]: author: (Mike Calizo https://opensource.com/users/mcalizo) + +How the Kubernetes scheduler works +====== +Understand how the Kubernetes scheduler discovers new pods and assigns +them to nodes. +![Parts, modules, containers for software][1] + +[Kubernetes][2] has emerged as the standard orchestration engine for containers and containerized workloads. It provides a common, open source abstraction layer that spans public and private cloud environments. + +For those already familiar with Kubernetes and its components, the conversation is usually around maximizing Kubernetes' power. But when you're just learning Kubernetes, it's wise to begin with some general knowledge about Kubernetes and its components (including the [Kubernetes scheduler][3]), as shown in this high-level view, before trying to use it in production. + +![][4] + +Kubernetes also uses control planes and nodes. + + 1. **Control plane:** Also known as master, these nodes are responsible for making global decisions about the clusters and detecting or responding to cluster events. The control plane components are: + * etcd + * kube-apiserver  + * kube-controller-manager + * scheduler + 2. **Nodes:** Also called worker nodes, these sets of nodes are where a workload resides. They should always talk to the control plane to get the information necessary for the workload to run and to communicate and connect outside the cluster. Worker nodes' components are: + * kubelet + * kube-proxy + * container runtime Interface. + + + +I hope this background helps you understand how the Kubernetes components are stacked together. + +### How Kubernetes scheduler works + +A Kubernetes [pod][5] is comprised of one or more containers with shared storage and network resources. The Kubernetes scheduler's task is to ensure that each pod is assigned to a node to run on. + +At a high level, here is how the Kubernetes scheduler works: + + 1. Every pod that needs to be scheduled is added to a queue + 2. When new pods are created, they are also added to the queue + 3. The scheduler continuously takes pods off that queue and schedules them + + + +The [scheduler's code][6] (`scheduler.go`) is large, around 9,000 lines, and fairly complex, but the important bits to tackle are: + + 1. **Code that waits/watches for pod creation** +The code that watches for pod creation begins on line 8970 of `scheduler.go`; it waits indefinitely for new pods: + + +``` +// Run begins watching and scheduling. It waits for cache to be synced, then starts a goroutine and returns immediately. + +func (sched *Scheduler) Run() { +        if !sched.config.WaitForCacheSync() { +                return +        } + +        go wait.Until(sched.scheduleOne, 0, sched.config.StopEverything) +``` + + 2. **Code that is responsible for queuing the pod** +The function responsible for pod queuing is: + + +``` +// queue for pods that need scheduling +        podQueue *cache.FIFO +``` + +The code responsible for queuing the pod begins on line 7360 of `scheduler.go`. When the event handler is triggered to indicate that a new pod is available, this piece of code automatically puts the new pod in the queue: + + +``` +func (f *ConfigFactory) getNextPod() *v1.Pod { +        for { +                pod := cache.Pop(f.podQueue).(*v1.Pod) +                if f.ResponsibleForPod(pod) { +                        glog.V(4).Infof("About to try and schedule pod %v", pod.Name) +                        return pod +                } +        } +} +``` + + 3. **Code that handles errors** +You will inevitably encounter scheduling errors in pod scheduling. The following code is how the scheduler handles the errors. It listens to `podInformer` and then spits out an error that the pod was not scheduled and terminates: + + +``` +// scheduled pod cache +        podInformer.Informer().AddEventHandler( +                cache.FilteringResourceEventHandler{ +                        FilterFunc: func(obj interface{}) bool { +                                switch t := obj.(type) { +                                case *v1.Pod: +                                        return assignedNonTerminatedPod(t) +                                default: +                                        runtime.HandleError(fmt.Errorf("unable to handle object in %T: %T", c, obj)) +                                        return false +                                } +                        }, +``` + + + + +In other words, the Kubernetes scheduler is responsible for: + + * Scheduling the newly created pods on nodes with enough space to satisfy the pod's resource needs + * Listening to the kube-apiserver and the controller for the presence of newly created pods and then scheduling them to an available node on the cluster + * Watching for unscheduled pods and binding them to nodes by using the `/binding` pod sub-resource API. + + + +For example, imagine an application is being deployed that requires 1GB of memory and two CPU cores. Therefore, the pods for the application are created on a node that has enough resources available. Then, the scheduler continues to run forever, watching to see if there are pods that need to be scheduled. + +### Learn more + +To have a working Kubernetes cluster, you need to get all the components above working together in sync. The scheduler is a complex piece of code, but Kubernetes is awesome software, and currently, it's the default choice when talking about adopting cloud-native applications. + +Learning Kubernetes requires time and effort, but having it as one of your skills will give you an edge that should bring rewards in your career. There are a lot of good learning resources available, and the [documentation][7] is good. If you are interested in learning more, I recommend starting with: + + * [Kubernetes the hard way][8] + * [Kubernetes the hard way on bare metal][9] + * [Kubernetes the hard way on AWS][10] + + + +What are your favorite ways to learn about Kubernetes? Please share in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/kubernetes-scheduler + +作者:[Mike Calizo][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://opensource.com/users/mcalizo +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/containers_modules_networking_hardware_parts.png?itok=rPpVj92- (Parts, modules, containers for software) +[2]: https://kubernetes.io/ +[3]: https://kubernetes.io/docs/concepts/scheduling-eviction/kube-scheduler/ +[4]: https://lh4.googleusercontent.com/egB0SSsAglwrZeWpIgX7MDF6u12oxujfoyY6uIPa8WLqeVHb8TYY_how57B4iqByELxvitaH6-zjAh795wxAB8zenOwoz2YSMIFRqHsMWD9ohvUTc3fNLCzo30r7lUynIHqcQIwmtRo +[5]: https://kubernetes.io/docs/concepts/workloads/pods/ +[6]: https://github.com/kubernetes/kubernetes/blob/e4551d50e57c089aab6f67333412d3ca64bc09ae/plugin/pkg/scheduler/scheduler.go +[7]: https://kubernetes.io/docs/home/ +[8]: https://github.com/kelseyhightower/kubernetes-the-hard-way +[9]: https://github.com/Praqma/LearnKubernetes/blob/master/kamran/Kubernetes-The-Hard-Way-on-BareMetal.md +[10]: https://github.com/Praqma/LearnKubernetes/blob/master/kamran/Kubernetes-The-Hard-Way-on-AWS.md From 2ddf7bcbc3d83557eda9c3927b88328eb9db5c79 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 4 Nov 2020 08:42:57 +0800 Subject: [PATCH 0651/1156] translating --- ...028 What-s new in Fedora 33 Workstation.md | 81 ------------------- ...028 What-s new in Fedora 33 Workstation.md | 81 +++++++++++++++++++ 2 files changed, 81 insertions(+), 81 deletions(-) delete mode 100644 sources/tech/20201028 What-s new in Fedora 33 Workstation.md create mode 100644 translated/tech/20201028 What-s new in Fedora 33 Workstation.md diff --git a/sources/tech/20201028 What-s new in Fedora 33 Workstation.md b/sources/tech/20201028 What-s new in Fedora 33 Workstation.md deleted file mode 100644 index bff7b31228..0000000000 --- a/sources/tech/20201028 What-s new in Fedora 33 Workstation.md +++ /dev/null @@ -1,81 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (What’s new in Fedora 33 Workstation) -[#]: via: (https://fedoramagazine.org/whats-new-fedora-33-workstation/) -[#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) - -What’s new in Fedora 33 Workstation -====== - -![][1] - -Fedora 33 Workstation is the [latest release][2] of our free, leading-edge operating system. You can download it from [the official website here][3] right now. There are several new and noteworthy changes in Fedora 33 Workstation. Read more details below. - -### GNOME 3.38 - -Fedora 33 Workstation includes the latest release of GNOME Desktop Environment for users of all types. GNOME 3.38 in Fedora 33 Workstation includes many updates and improvements, including: - -#### A new GNOME Tour app - -New users are now greeted by “a new _Tour_ application, highlighting the main functionality of the desktop and providing first time users a nice welcome to GNOME.” - -![The new GNOME Tour application in Fedora 33][4] - -#### Drag to reorder apps - -GNOME 3.38 replaces the previously split Frequent and All apps views with a single customizable and consistent view that allows you to reorder apps and organize them into custom folders. Simply click and drag to move apps around. - -![GNOME 3.38 Drag to Reorder][5] - -#### Improved screen recording - -The screen recording infrastructure in GNOME Shell has been improved to take advantage of PipeWire and kernel APIs. This will help reduce resource consumption and improve responsiveness. - -GNOME 3.38 also provides many additional features and enhancements. Check out the [GNOME 3.38 Release Notes][6] for further information. - -* * * - -### B-tree file system - -As [announced previously][7], new installations of Fedora 33 will default to using [Btrfs][8]. Features and enhancements are added to Btrfs with each new kernel release. The [change log][9] has a complete summary of the features that each new kernel version brings to Btrfs. - -* * * - -### Swap on ZRAM - -Anaconda and Fedora IoT have been using swap-on-zram by default for years. With Fedora 33, swap-on-zram will be enabled by default instead of a swap partition. Check out [the Fedora wiki page][10] for more details about swap-on-zram. - -* * * - -### Nano by default - -Fresh Fedora 33 installations will set the EDITOR environment variable to [_nano_ by default][11]. This change affects several command line tools that spawn a text editor when they require user input. With earlier releases, this environment variable default was unspecified, leaving it up to the individual application to pick a default editor. Typically, applications would use _[vi][12]_ as their default editor due to it being a small application that is traditionally available on the base installation of most Unix/Linux operating systems. Since Fedora 33 includes nano in its base installation, and since nano is more intuitive for a beginning user to use, Fedora 33 will use nano by default. Users who want vi can, of course, override the value of the EDITOR variable in their own environment. See [the Fedora change request][11] for more details. - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/whats-new-fedora-33-workstation/ - -作者:[Gregory Bartholomew][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/glb/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2020/10/f33workstation-816x345.jpg -[2]: https://fedoramagazine.org/announcing-fedora-33/ -[3]: https://getfedora.org/workstation -[4]: https://fedoramagazine.org/wp-content/uploads/2020/10/fedora-33-gnome-tour-1.png -[5]: https://fedoramagazine.org/wp-content/uploads/2020/10/drag-to-reorder-1.gif -[6]: https://help.gnome.org/misc/release-notes/3.38/ -[7]: https://fedoramagazine.org/btrfs-coming-to-fedora-33/ -[8]: https://en.wikipedia.org/wiki/Btrfs -[9]: https://btrfs.wiki.kernel.org/index.php/Changelog#By_feature -[10]: https://fedoraproject.org/wiki/Changes/SwapOnZRAM -[11]: https://fedoraproject.org/wiki/Changes/UseNanoByDefault -[12]: https://en.wikipedia.org/wiki/Vi diff --git a/translated/tech/20201028 What-s new in Fedora 33 Workstation.md b/translated/tech/20201028 What-s new in Fedora 33 Workstation.md new file mode 100644 index 0000000000..a181148cac --- /dev/null +++ b/translated/tech/20201028 What-s new in Fedora 33 Workstation.md @@ -0,0 +1,81 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What’s new in Fedora 33 Workstation) +[#]: via: (https://fedoramagazine.org/whats-new-fedora-33-workstation/) +[#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) + +Fedora 33 Workstation 的新功能 +====== + +![][1] + +Fedora 33 Workstation 是我们免费的、领先的操作系统的[最新版本][2]。你现在就可以从[官方网站][3]下载它。Fedora 33 Workstation 中有一些新的和值得注意的变化。请阅读更多如下细节。 + +### GNOME 3.38 + +Fedora 33 Workstation 为各类用户提供了最新版本的 GNOME 桌面环境。在 Fedora 33 Workstation 中的 GNOME 3.38 包含了许多更新和改进,包括: + +#### 一个新的 GNOME Tour 应用 + +现在,新用户会看到一个“新的 _Tour_ 应用,高亮显示了桌面的主要功能,并为第一次使用 GNOME 的用户提供一个很好的欢迎”。 + +![The new GNOME Tour application in Fedora 33][4] + +#### 拖动重排序应用 + +GNOME 3.38 用一个单一的可定制和一致的视图取代了之前分开的常用和所有应用视图,这允许你重新排列应用并将它们组织到自定义文件夹中。只需点击并拖动即可移动应用。 + +![GNOME 3.38 Drag to Reorder][5] + +#### 改进屏幕录制 + +GNOME Shell 中的屏幕录制基础架构已被改进,以利用 PipeWire 和内核 API。这将有助于减少资源消耗并提高响应速度。 + +GNOME 3.38 还提供了许多额外的功能和改进。查看 [GNOME 3.38 发行说明][6]以获得更多信息。 + +* * * + +### B-tree 文件系统 + +正如[之前宣布的][7],新安装的 Fedora 33 将默认使用 [Btrfs][8]。每一个新的内核版本都会为 Btrfs 增加一些特性和增强功能。[变更日志][9]有一个完整的总结,它介绍了每个新内核版本给 Btrfs 带来的功能。 + +* * * + +### Swap on ZRAM + +Anaconda 和 Fedora IoT 多年来一直默认使用 swap-on-zram。在 Fedora 33 中,swap-on-zram 将被默认启用,而不是 swap 分区。查看 [Fedora wiki 页面][10]了解更多关于 swap-on-zram 的细节。 + +* * * + +### 默认使用 Nano + +新的 Fedora 33 将把 EDITOR 环境变量默认设置为 [_nano_ ][11]。这个变化影响了一些命令行工具,当它们需要用户输入时,会打开一个文本编辑器。在早期的版本中,这个环境变量的默认值并没有被指定,而是由各个应用程序来选择一个默认的编辑器。通常情况下,应用程序会使用 [_vi_][12]作为它们的默认编辑器,因为它是一个小应用,通常在大多数 Unix/Linux 操作系统的基础安装中都可以使用。由于 Fedora 33 的基本安装中包含了 nano,而且 nano 对于初学者来说更加直观,所以 Fedora 33 将默认使用 nano。当然,想要使用 vi 的用户可以在自己的环境中覆盖 EDITOR 变量的值。详见[Fedora修改请求][11]获取更多信息。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/whats-new-fedora-33-workstation/ + +作者:[Gregory Bartholomew][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/glb/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/10/f33workstation-816x345.jpg +[2]: https://fedoramagazine.org/announcing-fedora-33/ +[3]: https://getfedora.org/workstation +[4]: https://fedoramagazine.org/wp-content/uploads/2020/10/fedora-33-gnome-tour-1.png +[5]: https://fedoramagazine.org/wp-content/uploads/2020/10/drag-to-reorder-1.gif +[6]: https://help.gnome.org/misc/release-notes/3.38/ +[7]: https://fedoramagazine.org/btrfs-coming-to-fedora-33/ +[8]: https://en.wikipedia.org/wiki/Btrfs +[9]: https://btrfs.wiki.kernel.org/index.php/Changelog#By_feature +[10]: https://fedoraproject.org/wiki/Changes/SwapOnZRAM +[11]: https://fedoraproject.org/wiki/Changes/UseNanoByDefault +[12]: https://en.wikipedia.org/wiki/Vi From 61cbeda14140da82ba4f2dbd74caea75ae3a7974 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 4 Nov 2020 08:57:59 +0800 Subject: [PATCH 0652/1156] translating --- ...1102 4 cool new projects to try in COPR from October 2020.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201102 4 cool new projects to try in COPR from October 2020.md b/sources/tech/20201102 4 cool new projects to try in COPR from October 2020.md index b88e106090..80bd6f2f77 100644 --- a/sources/tech/20201102 4 cool new projects to try in COPR from October 2020.md +++ b/sources/tech/20201102 4 cool new projects to try in COPR from October 2020.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d3c803e1af770536e8d3de0f30506c8061dfb2eb Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 4 Nov 2020 10:14:46 +0800 Subject: [PATCH 0653/1156] PRF --- ... in Debian, Ubuntu and Other Linux Distributions.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/translated/tech/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md b/translated/tech/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md index 36521d7fb8..288867e50a 100644 --- a/translated/tech/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md +++ b/translated/tech/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions) @@ -52,7 +52,7 @@ apt-cache search package_name ![][5] -你也可以缩小搜索范围,只在产品名称中查找搜索词。 +你也可以缩小搜索范围,只在软件包名称中查找搜索词。 ``` apt-cache search --names-only package_name @@ -92,7 +92,7 @@ apt-cache showpkg package_name 默认情况下,每个已安装的软件包版本的优先级为 100,未安装的软件包的优先级为 500。同一软件包可能有多个不同优先级的版本。APT 会安装优先级较高的版本,除非安装的版本较新。 -如果不理解这个部分,也没关系。对于一个普通的 Linux 用户来说,会极少纠结于这么深的软件包管理。 +如果不理解这个部分,也没关系。对于一个普通的 Linux 用户来说,会极少纠结于这么深的软件包管理知识。 #### 检查软件包的依赖关系和反向依赖关系。 @@ -130,7 +130,7 @@ apt-cache pkgnames | wc -l 你是否注意到你不需要成为 [root 用户][19]就可以使用 `apt-cache` 命令? -较新的 [apt 命令][20]也有一些与 `apt-cache` 命令对应的功能选项。由于 `apt` 比较新,所以在脚本中还是首选 `apt-get` 及其相关的 `apt-cache` 等命令。 +较新的 [apt 命令][20]也有一些与 `apt-cache` 命令相对应的功能选项。由于 `apt` 比较新,所以在脚本中还是首选使用 `apt-get` 及其相关的 `apt-cache` 等命令。 希望你觉得本教程对你有帮助。如果你对上面讨论的任何一点有疑问或者有改进的建议,请在评论中告诉我。 @@ -141,7 +141,7 @@ via: https://itsfoss.com/apt-cache-command/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From e45b25669a88aabaa0f168a9a53f5d9c69ec2d46 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 4 Nov 2020 10:15:22 +0800 Subject: [PATCH 0654/1156] PUB @geekpi https://linux.cn/article-12786-1.html --- ...Command in Debian, Ubuntu and Other Linux Distributions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md (99%) diff --git a/translated/tech/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md b/published/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md similarity index 99% rename from translated/tech/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md rename to published/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md index 288867e50a..32432da3d8 100644 --- a/translated/tech/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md +++ b/published/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12786-1.html) [#]: subject: (How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions) [#]: via: (https://itsfoss.com/apt-cache-command/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From 6676178d8e6af4ed688dbabcfca9f3dc99e20359 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 4 Nov 2020 10:31:15 +0800 Subject: [PATCH 0655/1156] PRF @geekpi --- ...t Cache and Reclaim Precious Disk Space.md | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/translated/tech/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md b/translated/tech/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md index b1cabdd910..3ea3e497cc 100644 --- a/translated/tech/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md +++ b/translated/tech/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md @@ -1,50 +1,52 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Clear Apt Cache and Reclaim Precious Disk Space) [#]: via: (https://itsfoss.com/clear-apt-cache/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -如何清除 apt 缓存来回收宝贵的磁盘空间 +如何清除 APT 缓存来回收宝贵的磁盘空间 ====== -如何清除 apt 缓存?你只需使用这个 [apt-get 命令][1]选项: +![][13] + +如何清除 APT 缓存?你只需使用这个 [apt-get 命令][1]选项: ``` sudo apt-get clean ``` -但是,清理 apt 缓存不仅仅是运行上面的命令。 +但是,清理 APT 缓存不仅仅是运行上面的命令。 -在本教程中,我将解释什么是 apt 缓存、为什么会使用它、为什么你要清理它,以及关于清理 apt 缓存你应该知道的其他事情。 +在本教程中,我将解释什么是 APT 缓存、为什么会使用它、为什么你要清理它,以及关于清理 APT 缓存你应该知道的其他事情。 -我将在这里使用 Ubuntu 作为参考,但由于这是关于 apt 的,因此它也适用于 [Debian][2] 和其他基于 Debian 和 Ubuntu 的发行版,比如 Linux Mint、Deepin 等等。 +我将在这里使用 Ubuntu 作为参考,但由于这是关于 APT 的,因此它也适用于 [Debian][2] 和其他基于 Debian 和 Ubuntu 的发行版,比如 Linux Mint、Deepin 等等。 -### 什么是 apt 缓存?为什么要使用它? +### 什么是 APT 缓存?为什么要使用它? -当你使用 apt-get 或 [apt 命令][3]安装一个软件包时(或在软件中心安装 DEB 包),apt [包管理器][4]会以 .deb 格式下载软件包及其依赖关系,并将其保存在 /var/cache/apt/archives 文件夹中。 +当你使用 `apt-get` 或 [apt 命令][3]安装一个软件包时(或在软件中心安装 DEB 包),APT [包管理器][4]会以 .deb 格式下载软件包及其依赖关系,并将其保存在 `/var/cache/apt/archives` 文件夹中。 ![][5] -下载时,apt 将 deb 包保存在 /var/cache/apt/archives/partial 目录下。当 deb 包完全下载完毕后,它会被移到 /var/cache/apt/archives 目录下。 +下载时,`apt` 将 deb 包保存在 `/var/cache/apt/archives/partial` 目录下。当 deb 包完全下载完毕后,它会被移到 `/var/cache/apt/archives` 目录下。 下载完包的 deb 文件及其依赖关系后,你的系统就会[从这些 deb 文件中安装包][6]。 -现在你明白缓存的用途了吧?系统在安装软件包之前,需要一个地方把软件包文件存放在某个地方。如果你了解 [Linux 目录结构][7],你就会明白,/var/cache 是合适的地方。 +现在你明白缓存的用途了吧?系统在安装软件包之前,需要一个地方把软件包文件存放在某个地方。如果你了解 [Linux 目录结构][7],你就会明白,`/var/cache` 是合适的地方。 #### 为什么安装包后要保留缓存? 下载的 deb 文件在安装完成后并不会立即从目录中删除。如果你删除了一个软件包,然后重新安装,你的系统会在缓存中查找这个软件包,并从这里获取它,而不是重新下载(只要缓存中的软件包版本与远程仓库中的版本相同)。 -这样就快多了。你可以自己尝试一下,看看一个程序第一次安装,删除后再安装需要多长时间。你可以[使用 time 命令来了解完成一个命令需要多长时间][8]:_**time sudo apt install package_name**_ +这样就快多了。你可以自己尝试一下,看看一个程序第一次安装,删除后再安装需要多长时间。你可以[使用 time 命令来了解完成一个命令需要多长时间][8]:`time sudo apt install package_name`。 我找不到任何关于缓存保留策略的内容,所以我无法说明 Ubuntu 会在缓存中保留下载的包多长时间。 -#### 你应该清理 apt 缓存吗? +#### 你应该清理 APT 缓存吗? -这取决于你。如果你的根目录下的磁盘空间用完了,你可以清理 apt cache 来回收磁盘空间。这是 [Ubuntu 上释放磁盘空间的几种方法][9]之一。 +这取决于你。如果你的根目录下的磁盘空间用完了,你可以清理 APT 缓存来回收磁盘空间。这是 [Ubuntu 上释放磁盘空间的几种方法][9]之一。 使用 [du 命令][10]检查缓存占用了多少空间: @@ -52,43 +54,41 @@ sudo apt-get clean 有的时候,这可能会占用几百兆,如果你正在运行一个服务器,这些空间可能是至关重要的。 -#### 如何清理 apt 缓存? +#### 如何清理 APT 缓存? -如果你想清除 apt 缓存,有一个专门的命令来做。所以不要去手动删除缓存目录。只要使用这个命令就可以了: +如果你想清除 APT 缓存,有一个专门的命令来做。所以不要去手动删除缓存目录。只要使用这个命令就可以了: ``` sudo apt-get clean ``` -这将删除 /var/cache/apt/archives 目录的内容(除了锁文件)。以下是 apt-get clean 命令模拟删除内容: +这将删除 `/var/cache/apt/archives` 目录的内容(除了锁文件)。以下是 `apt-get clean` 命令模拟删除内容: ![][12] -还有一个命令是关于清理 apt 缓存的: +还有一个命令是关于清理 APT 缓存的: ``` sudo apt-get autoclean ``` -与 clean 不同的是,autoclean 只删除那些无法从仓库中下载的包。 +与 `clean` 不同的是,`autoclean` 只删除那些无法从仓库中下载的包。 -假设你安装了包 xyz。它的 deb 文件仍然保留在缓存中。如果现在仓库中有新的 xyz 包,那么缓存中现有的这个 xyz 包就已经过时了,没有用了。autoclean 选项会删除这种不能再下载的无用包。 +假设你安装了包 xyz。它的 deb 文件仍然保留在缓存中。如果现在仓库中有新的 xyz 包,那么缓存中现有的这个 xyz 包就已经过时了,没有用了。`autoclean` 选项会删除这种不能再下载的无用包。 #### 删除 apt 缓存安全吗? -![][13] +是的,清除 APT 创建的缓存是完全安全的。它不会对系统的性能产生负面影响。也许如果你重新安装软件包,下载时间会更长一些,但也仅此而已。 -是的,清除 apt 创建的缓存是完全安全的。它不会对系统的性能产生负面影响。也许如果你重新安装软件包,下载时间会更长一些,但也仅此而已。 - -再说一次,使用 apt-get clean 命令。它比手动删除缓存目录更快、更简单。 +再说一次,使用 `apt-get clean` 命令。它比手动删除缓存目录更快、更简单。 你也可以使用像 [Stacer][14] 或 [Bleachbit][15] 这样的图形工具来实现这个目的。 #### 总结 -在写这篇文章的时候,新的 apt 命令没有内置选项。不过,为了保持向后的兼容性,仍然可以运行 _**apt clean**_ (内部应该是运行 apt-get clean)。请参考这篇文章来[了解 apt 和 apt-get 的区别][16]。 +在写这篇文章的时候,新的 `apt` 命令没有这样的内置选项。不过,为了保持向后的兼容性,仍然可以运行 `apt clean` (内部应该是运行了 `apt-get clean`)。请参考这篇文章来[了解 apt 和 apt-get 的区别][16]。 -我希望你觉得这个关于 apt 缓存的解释很有趣。虽然这不是什么必要的东西,但了解这些小东西会让你对你的 Linux 系统更加了解。 +我希望你觉得这个关于 APT 缓存的解释很有趣。虽然这不是什么必要的东西,但了解这些小东西会让你对你的 Linux 系统更加了解。 欢迎你在评论区提出反馈和建议。 @@ -99,7 +99,7 @@ via: https://itsfoss.com/clear-apt-cache/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 18cdd962c73af4632e9e90e896d44c7c9df716a0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 4 Nov 2020 10:31:45 +0800 Subject: [PATCH 0656/1156] PUB @geekpi https://linux.cn/article-12787-1.html --- ... How to Clear Apt Cache and Reclaim Precious Disk Space.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md (98%) diff --git a/translated/tech/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md b/published/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md similarity index 98% rename from translated/tech/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md rename to published/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md index 3ea3e497cc..de0b5a3659 100644 --- a/translated/tech/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md +++ b/published/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12787-1.html) [#]: subject: (How to Clear Apt Cache and Reclaim Precious Disk Space) [#]: via: (https://itsfoss.com/clear-apt-cache/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From 8dffef12540cd9374b9c028f63c56e3f96c24f1a Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Wed, 4 Nov 2020 13:18:17 +0800 Subject: [PATCH 0657/1156] Update 20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md --- ...itical, a mixed-channel architecture is the best option.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md b/sources/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md index 3a13957772..bbb6d9563f 100644 --- a/sources/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md +++ b/sources/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md @@ -10,11 +10,11 @@ When Wi-Fi is mission-critical, a mixed-channel architecture is the best option ====== -### Multi-channel is the norm for Wi-Fi today, but it’s not always the best choice. Single-channel and hybrid APs offer compelling alternatives when reliable Wi-Fi is a must. +### 当Wi-Fi 成为关键业务时,对于如今的它来说,混合信道架构是最好的多信道选择,但它并不总是最佳的选择。当需要可靠的Wi-Fi时,单信道和混合Aps提供了令人信服的替代方案。 ![Getty Images][1] -I’ve worked with a number of companies that have implemented digital projects only to see them fail. The ideation was correct, the implementation was sound, and the market opportunity was there. The weak link? The Wi-Fi network. +I’ve worked with a number of companies that have implemented digital projects only to 我曾与许多实施数字项目的公司合作,结果却发现它们失败了。想法是正确的,施行是健全的,市场机遇也在那里。那薄弱的环节在哪里呢?是Wi-Fi网络。 For example, a large hospital wanted to improve clinician response times to patient alarms by having telemetry information sent to mobile devices. Without the system, the only way a nurse would know about a patient alarm is from an audible alert. And with all the background noise, it’s often tough to discern where noises are coming from. The problem was the Wi-Fi network in the hospital had not been upgraded in years and caused messages to be significantly delayed in their delivery, often taking four to five minutes to deliver. The long delivery times caused a lack of confidence in the system, so many clinicians stopped using it and went back to manual alerting. As a result, the project was considered a failure. From 4e18612b696b11d9c576717bfaa9d875ea848531 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 4 Nov 2020 23:46:22 +0800 Subject: [PATCH 0658/1156] PRF @geekpi --- ... virtual tables in Apache Cassandra 4.0.md | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/translated/tech/20201006 Start using virtual tables in Apache Cassandra 4.0.md b/translated/tech/20201006 Start using virtual tables in Apache Cassandra 4.0.md index d4f20db68c..13c0509f3d 100644 --- a/translated/tech/20201006 Start using virtual tables in Apache Cassandra 4.0.md +++ b/translated/tech/20201006 Start using virtual tables in Apache Cassandra 4.0.md @@ -1,40 +1,38 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Start using virtual tables in Apache Cassandra 4.0) [#]: via: (https://opensource.com/article/20/10/virtual-tables-apache-cassandra) [#]: author: (Ben Bromhead https://opensource.com/users/ben-bromhead) -开始在 Apache Cassandra 4.0 中使用虚拟表 +如何在 Apache Cassandra 4.0 中使用虚拟表 ====== -它们是什么以及如何使用它们。 -![Computer laptop in space][1] -在最近的 [Apache Cassandra 4.0 测试版][3]中的[众多新增功能][2]中,虚拟表是一个值得关注的功能。 +> 虚拟表是什么以及如何使用。 -在以前的 Cassandra 版本中,用户需要访问 Java 管理扩展 ([JMX][4]) 来检查 Cassandra 的细节,如运行中的压缩、客户端、度量和各种配置设置。虚拟表消除了这些挑战。Cassandra 4.0 测试版使用户能够从一个只读的系统表中以 Cassandra 查询语言 (CQL) 行的形式查询这些细节和数据。 +![](https://img.linux.net.cn/data/attachment/album/202011/04/234511kpmv6dzac6fjmr65.jpg) -以下是之前 Cassandra 版本中基于 JMX 的机制是如何工作的。想象一下,一个用户想要检查集群中某个节点的压缩状态。用户首先要建立一个 JMX 连接,在节点上运行 `nodetool compactionstats`。这个要求给用户带来了一些复杂的问题。用户的客户端是否配置了 JMX 访问?Cassandra 节点和防火墙是否配置为允许 JMX 访问?是否准备好了适当的安全和审计措施,并落实到位?这些只是用户在处理 Cassandra 以前版本时不得不面对的一些问题。 +在最近的发布的 [Apache Cassandra 4.0 测试版][3]中的[众多新增功能][2]中,虚拟表virtual table是一个值得关注的功能。 + +在以前的 Cassandra 版本中,用户需要访问 Java 管理扩展Java Management Extensions([JMX][4]) 来查看 Cassandra 的细节,如运行中的压实compaction、客户端、度量和各种配置设置。虚拟表消除了这些挑战。Cassandra 4.0 测试版让用户能够从一个只读的系统表中以 Cassandra 查询语言Cassandra Query Language(CQL)行的形式查询这些细节和数据。 + +以下是之前 Cassandra 版本中基于 JMX 的机制是如何工作的。想象一下,一个用户想要检查集群中某个节点的压实状态。用户首先要建立一个 JMX 连接,在节点上运行 `nodetool compactionstats`。这个要求马上就给用户带来了一些复杂的问题。用户的客户端是否配置了 JMX 访问?Cassandra 节点和防火墙是否配置为允许 JMX 访问?是否准备好了适当的安全和审计措施,并落实到位?这些只是用户在处理 Cassandra 以前版本时必须面对的其中一些问题。 在 Cassandra 4.0 中,虚拟表使得用户可以利用之前配置的驱动来查询所需信息。这一变化消除了与实现和维护 JMX 访问相关的所有开销。 -Cassandra 4.0 创建了两个新的键空间来帮助用户利用虚拟表:`system_views` 和 `system_virtual_schema`。`system_views` 键空间包含了用户查询的所有有价值的信息,有用地存储在一些表中。`system_virtual_schema` 键空间,顾名思义,存储了这些虚拟表的所有必要的模式信息。 +Cassandra 4.0 创建了两个新的键空间keyspace来帮助用户利用虚拟表:`system_views` 和 `system_virtual_schema`。`system_views` 键空间包含了用户查询的所有有价值的信息,有用地存储在一些表中。`system_virtual_schema` 键空间,顾名思义,存储了这些虚拟表的所有必要的模式信息。 ![system_views and system_virtual_schema keyspaces and tables][5] -(Ben Bromhead, [CC BY-SA 4.0][6]) +重要的是要明白,每个虚拟表的范围仅限于其节点。任何虚拟表查询都将返回的数据,只对其协调器的节点有效,而不管一致性如何。为了简化这一要求,已经在几个驱动中添加了支持,以便在这些查询中指定协调器节点 (Python、DataStax Java 和其他驱动现在提供了这种支持)。 -重要的是要明白,每个虚拟表的范围仅限于其节点。任何虚拟表查询都将返回只对作为其协调器的节点有效的数据,而不管一致性如何。为了简化这一要求,已经在几个驱动中添加了支持,以便在这些查询中指定协调器节点 (Python、DataStax Java 和其他驱动现在提供了这种支持)。 - -为了说明这一点,请检查这个 `sstable_tasks` 虚拟表。这个虚拟表显示了对 [SSTables][7] 的所有操作,包括压缩、清理、升级等。 +为了说明这一点,请查看这个 `sstable_tasks` 虚拟表。这个虚拟表显示了对 [SSTables][7] 的所有操作,包括压实、清理、升级等。 ![Querying the sstable_tasks virtual table][8] -(Ben Bromhead, [CC BY-SA 4.0][6]) - -如果用户在以前的 Cassandra 版本中运行 `nodetool compactionstats`,则会显示相同类型的信息。 在这里,查询发现该节点当前有一个活动的压缩。它还显示了它的进度以及它的键空间和表。得益于虚拟表,用户可以快速收集这些信息,并同样有效地获得正确诊断集群健康状况所需的能力。 +如果用户在以前的 Cassandra 版本中运行 `nodetool compactionstats`,则会显示相同类型的信息。 在这里,这个查询发现该节点当前有一个活动的压缩。它还显示了它的进度以及它的键空间和表。得益于虚拟表,用户可以快速收集这些信息,并同样有效地获得正确诊断集群健康状况所需的能力。 需要说明的是,Cassandra 4.0 并没有去除对 JMX 访问的需求。JMX 仍然是查询某些指标的唯一选择。尽管如此,用户会欢迎简单地使用 CQL 来获取关键集群指标的能力。由于虚拟表提供的便利,用户可能会将之前投入到 JMX 工具的时间和资源重新投入到 Cassandra 本身。客户端工具也应该开始利用虚拟表提供的优势。 @@ -47,7 +45,7 @@ via: https://opensource.com/article/20/10/virtual-tables-apache-cassandra 作者:[Ben Bromhead][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a4d599b8770f68d08414ff71cee8a8b31c1dfc46 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 4 Nov 2020 23:47:07 +0800 Subject: [PATCH 0659/1156] PUB @geekpi https://linux.cn/article-12791-1.html --- ...1006 Start using virtual tables in Apache Cassandra 4.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201006 Start using virtual tables in Apache Cassandra 4.0.md (98%) diff --git a/translated/tech/20201006 Start using virtual tables in Apache Cassandra 4.0.md b/published/20201006 Start using virtual tables in Apache Cassandra 4.0.md similarity index 98% rename from translated/tech/20201006 Start using virtual tables in Apache Cassandra 4.0.md rename to published/20201006 Start using virtual tables in Apache Cassandra 4.0.md index 13c0509f3d..ba78aa772f 100644 --- a/translated/tech/20201006 Start using virtual tables in Apache Cassandra 4.0.md +++ b/published/20201006 Start using virtual tables in Apache Cassandra 4.0.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12791-1.html) [#]: subject: (Start using virtual tables in Apache Cassandra 4.0) [#]: via: (https://opensource.com/article/20/10/virtual-tables-apache-cassandra) [#]: author: (Ben Bromhead https://opensource.com/users/ben-bromhead) From 82bf04192a1657ae4a660b279b777090e7d5eb5b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 4 Nov 2020 23:54:58 +0800 Subject: [PATCH 0660/1156] APL --- ...rry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md b/sources/tech/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md index 016bd1c5cb..e7aaee54e3 100644 --- a/sources/tech/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md +++ b/sources/tech/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 96280242f56b81c7a25f6825b2d3d641c7fcaa90 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 5 Nov 2020 00:39:45 +0800 Subject: [PATCH 0661/1156] TSL --- ...cally a Tiny Computer Inside a Keyboard.md | 101 ------------------ ...cally a Tiny Computer Inside a Keyboard.md | 100 +++++++++++++++++ 2 files changed, 100 insertions(+), 101 deletions(-) delete mode 100644 sources/tech/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md create mode 100644 translated/tech/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md diff --git a/sources/tech/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md b/sources/tech/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md deleted file mode 100644 index e7aaee54e3..0000000000 --- a/sources/tech/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md +++ /dev/null @@ -1,101 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard) -[#]: via: (https://itsfoss.com/raspberry-pi-400/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard -====== - -Raspberry Pi needs no introduction. What started as a low-spec computer for DIY enthusiasts, it can now be used as full-featured desktop. - -With the Raspberry Pi 400 release, they are making it more friendly for home computer usage. The Raspberry Pi 400 is basically a computer in the form of a keyboard. - -If you remember, [Commodore 64][1] was also a computer in the form of a keyboard back in 1982. Even though it isn’t unique, for a successful product like Raspberry Pi, it is a sweet deal. - -### Raspberry Pi 400: Overview - -![][2] - -It is based on the Raspberry Pi 4 (with 4 GB RAM) and has been tweaked to run cooler as well. With a Quad-core processor, it is faster than ever. - -Not just limited to the ease of use and portability, but it should save you a lot of desk space. And, just like me, if you were planning to get a spare computer to test stuff, I think I may want to go with the Raspberry Pi 400 instead of building another PC or [Linux-based mini PC][3]. - -Even though I’ve mentioned the tech specs below, you can watch the official video to get an idea on how it looks and if it’s promising enough as your home computer: - -### Raspberry Pi 400 specification - -Here’s the tech specs for the Pi 400: - - * Broadcom BCM2711 quad-core Cortex-A72 (ARM v8) 64-bit SoC @ 1.8GHz - * 4GB LPDDR4-3200 - * Dual-band (2.4GHz and 5.0GHz) IEEE 802.11b/g/n/ac wireless LAN - * Bluetooth 5.0, BLE - * Gigabit Ethernet - * 2 × USB 3.0 and 1 × USB 2.0 ports - * Horizontal 40-pin GPIO header - * 2 × micro HDMI ports (supports up to 4Kp60) - * H.265 (4Kp60 decode); H.264 (1080p60 decode, 1080p30 encode); OpenGL ES 3.0 graphics - * MicroSD card slot for operating system and data storage - * 78- or 79-key compact keyboard (depending on regional variant) - * 5V DC via USB connector - * Operating temperature: 0°C to +50°C ambient - * Maximum dimensions 286 mm × 122 mm × 23 mm - - - -![][4] - -### Pricing & Availability - -For **$70**, this is the best modern home computer that you can get with the simplicity of just having a keyboard and being able to carry it anywhere (you just need a screen to connect to). - -You can either get just the Raspberry Pi 400 for **$70** or get the complete kit for **$100** with a USB mouse, micro HDMI to HDMI cable, USB-C power supply, a beginners guide, and an SD card with Raspberry Pi OS pre-installed. - -If you’re wondering, for the keyboard layout support, here’s what the press release mentioned: - -> At launch, we are supporting English (UK and US), French, Italian, German, and Spanish keyboard layouts, with (for the first time) translated versions of the Beginner’s Guide. In the near future, we plan to support the same set of languages as our [official keyboard][5]. - -In other words, they support every major keyboard layout to start with. So, it shouldn’t be an issue for the majority. - -In addition to the details for keyboard layout, here’s how you can get your hands on a Raspberry Pi 400: - -> UK, US, and French Raspberry Pi 400 [kits][6] and [computers][7] are available to buy right now. Italian, German, and Spanish units are on their way to Raspberry Pi Approved Resellers, who should have them in stock in the next week. -> -> We expect that Approved Resellers in India, Australia, and New Zealand will have kits and computers in stock by the end of the year. We’re rapidly rolling out compliance certification for other territories too, so that Raspberry Pi 400 will be available around the world in the first few months of 2021. -> -> Of course, if you’re anywhere near Cambridge, you can head over to the [Raspberry Pi Store][8] to pick up your Raspberry Pi 400 today. - -[Raspberry Pi 400][9] - -### Wrapping Up - -Raspberry Pi 400 is definitely something impressive and useful in the current time when remote work is becoming the new norm. - -What do you think about the new Raspberry Pi 400? Planning to get one? Let me know your thoughts in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/raspberry-pi-400/ - -作者:[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://en.wikipedia.org/wiki/Commodore_64 -[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/raspberry-pi-400.jpg?resize=800%2C554&ssl=1 -[3]: https://itsfoss.com/linux-based-mini-pc/ -[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/raspberry-pi-400-shot.jpeg?resize=800%2C572&ssl=1 -[5]: https://www.raspberrypi.org/products/raspberry-pi-keyboard-and-hub/ -[6]: https://www.raspberrypi.org/products/raspberry-pi-400/ -[7]: https://www.raspberrypi.org/products/raspberry-pi-400-unit/ -[8]: https://www.raspberrypi.org/raspberry-pi-store/ -[9]: https://www.raspberrypi.org/products/raspberry-pi-400 diff --git a/translated/tech/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md b/translated/tech/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md new file mode 100644 index 0000000000..5643313844 --- /dev/null +++ b/translated/tech/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard) +[#]: via: (https://itsfoss.com/raspberry-pi-400/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +新的树莓派 400:一台藏身于键盘内微型计算机 +====== + +树莓派已经无需介绍。起初是 DIY 爱好者的低规格电脑,而现在可以作为全功能桌面使用了。 + +随着树莓派 400 的发布,使得它更加适合作为家庭电脑使用。树莓派 400 基本上是一台藏身于键盘内微型计算机。 + +如果你还记得,[Commodore 64][1] 在 1982 年时也是一台键盘形式的电脑。尽管树莓派 400 并不是独一无二的,但对于树莓派这样的成功产品来说,这是一个令人心仪的产品。 + +### 树莓派 400 概观 + +![][2] + +它是基于树莓派 4 的(带有 4GB 内存),并已调整为带有冷却器。采用四核处理器,速度比以往更快。 + +不仅仅是易用性和便携性,它应该可以为你节省很多桌面空间。而且,就像我一样,如果你打算买一台备用电脑来测试东西,我想我可能会选择树莓派 400,而不是组装另一台 PC 或[基于 Linux 的迷你 PC][3]。 + +尽管我在下面提到了技术规格,但你可以观看官方视频来了解它的外观,以及它所承诺的是否可以满足作为你的家用电脑的需求。 + +![video](https://www.youtube.com/embed/ZSvHJ97d8n8) + +### 树莓派 400 技术规格 + + * 博通 BCM2711 四核 Cortex-A72(ARM v8)64 位 SoC @ 1.8GHz + * 4GB LPDDR4-3200 + * 双频(2.4GHz 和 5.0GHz)IEEE 802.11b/g/n/ac 无线局域网 + * 蓝牙 5.0,BLE + * 千兆以太网 + * 2 个 USB 3.0 和 1 个 USB 2.0 端口 + * 水平 40 针 GPIO 头 + * 2 个 micro HDMI 端口(支持最高 4Kp60) + * H.265(4Kp60 解码);H.264(1080p60 解码,1080p30 编码);OpenGL ES 3.0 图形 + * micro SD 卡插槽,用于操作系统和数据存储 + * 78 或 79 键的小型键盘(取决于地区差异) + * 5V DC,通过 USB 连接器 + * 工作温度:环境温度 0℃ 至 +50℃。 + * 最大尺寸 286 毫米 × 122 毫米 × 23 毫米 + + +![][4] + +### 定价与供应 + +付出 **70** 美元,这是你所能得到的最好的现代家用电脑,只需一个键盘就可以简单的携带到任何地方(你只需要一个屏幕连接)。 + +你可以花 70 美元只买树莓派 400,也可以花 100 美元买完整的套装,它包括一个 USB 鼠标、micro HDMI 转 HDMI 线、USB-C 电源、一本初学者指南和一张预装了树莓派操作系统的 SD 卡。 + +如果你想知道,对于键盘布局的支持,新闻稿中是这样提到的: + +> 在发布时,我们支持英语(英国和美国)、法语、意大利语、德语和西班牙语的键盘布局,并(首次)提供翻译版的新手指南。在不久的将来,我们计划支持与我们的[官方键盘][5]相同的语言集。 + +换句话说,一开始他们就支持所有主要的键盘布局。所以,对于大多数人来说,这应该不是问题。 + +除了键盘布局的细节外,下面是你如何获得树莓派 400 的方法: + +> 英国、美国和法国的树莓派 400 [套件][6]和[电脑][7]现在就可以购买。意大利、德国和西班牙的产品正在送往树莓派授权经销商的路上,他们应该在下周就会有货。 +> +> 我们预计,印度、澳大利亚和新西兰的授权经销商将在今年年底前拿到套件和电脑。我们也在迅速推出其他地区的合规认证,因此树莓派 400 将在 2021 年的前几个月在全球范围内上市。 +> +> 当然,如果你在剑桥附近的任何地方,你可以前往[树莓派商店][8],今天就可以领取你的树莓派 400。 + +- [树莓派 400][9] + +### 总结 + +在远程办公成为新常态的当下,树莓派 400 绝对是令人印象深刻的好东西,也是非常有用的。 + +你对新的树莓派 400 有什么看法?打算买一台吗?在下面的评论中告诉我你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/raspberry-pi-400/ + +作者:[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://en.wikipedia.org/wiki/Commodore_64 +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/raspberry-pi-400.jpg?resize=800%2C554&ssl=1 +[3]: https://itsfoss.com/linux-based-mini-pc/ +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/raspberry-pi-400-shot.jpeg?resize=800%2C572&ssl=1 +[5]: https://www.raspberrypi.org/products/raspberry-pi-keyboard-and-hub/ +[6]: https://www.raspberrypi.org/products/raspberry-pi-400/ +[7]: https://www.raspberrypi.org/products/raspberry-pi-400-unit/ +[8]: https://www.raspberrypi.org/raspberry-pi-store/ +[9]: https://www.raspberrypi.org/products/raspberry-pi-400 From a0b7f0661f27d81f3a74783541412add4b56c06a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 5 Nov 2020 05:01:37 +0800 Subject: [PATCH 0662/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201105?= =?UTF-8?q?=20How=20to=20Scan/Detect=20New=20LUNs=20and=20SCSI=20Disks=20o?= =?UTF-8?q?n=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md --- ...Detect New LUNs and SCSI Disks on Linux.md | 163 ++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 sources/tech/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md diff --git a/sources/tech/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md b/sources/tech/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md new file mode 100644 index 0000000000..c965d8ee57 --- /dev/null +++ b/sources/tech/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md @@ -0,0 +1,163 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Scan/Detect New LUNs and SCSI Disks on Linux) +[#]: via: (https://www.2daygeek.com/scan-detect-luns-scsi-disks-on-redhat-centos-oracle-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +How to Scan/Detect New LUNs and SCSI Disks on Linux +====== + +When the Linux system has connected to the SAN (Storage Area Network) you need to rescan the iSCSI service to discover new LUNs. + +To do so, you must provide the WWN number of the Linux host and required LUN size to the storage team. + +The following article will help you [**find the WWN number of a Linux host**][1]. + +Once the storage team has mapped the LUNs with the given Linux host, they will provide you with the new LUN details. + +LUN in storage terms is referred to as serial-hex of LUN. + +You need to scan the SCSI host to find new LUNs assigned by the storage team. + +This can be done in two ways, scan each scsi host device or run the “rescan-scsi-bus.sh” script to detect new disks. + +After scanning they can be found under the “/dev/disk/by-id” directory. + +``` +# ll /dev/disk/by-id + +total 0 +lrwxrwxrwx 1 root root 10 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684b -> ../../sdah +lrwxrwxrwx 1 root root 9 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684c -> ../../sdw +. +. +lrwxrwxrwx 1 root root 10 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684d -> ../../sdjk +lrwxrwxrwx 1 root root 10 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684e -> ../../sdaa +lrwxrwxrwx 1 root root 9 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684f -> ../../sdh +``` + +Also, you can find them using the Multipath command if you already have them configured with Multipath. + +Multipath is mostly configured into the Oracle database server for better performance. + +``` +# multipath -ll + +60a98000486e542d4f5a2f47694d684b dm-37 NETAPP,LUN C-Mode +size=512G features='3 queue_if_no_path pg_init_retries 50' hwhandler='1 alua' wp=rw +|-+- policy='round-robin 0' prio=50 status=active +| |- 1:0:4:18 sdoe 128:416 active ready running +| |- 0:0:4:18 sdpq 131:256 active ready running +| |- 0:0:5:18 sdsr 135:496 active ready running +| `- 1:0:5:18 sdsq 135:480 active ready running +`-+- policy='round-robin 0' prio=10 status=enabled + |- 1:0:1:18 sdfw 131:32 active ready running + |- 1:0:0:18 sdci 69:96 active ready running + |- 0:0:1:18 sdbz 68:208 active ready running + |- 0:0:0:18 sds 65:32 active ready running + |- 1:0:3:18 sdmd 69:336 active ready running + |- 1:0:2:18 sdjj 8:464 active ready running + |- 0:0:3:34 sdjt 65:368 active ready running + `- 0:0:2:34 sdgi 131:224 active ready running +``` + +This procedure works on Red Hat 6.x, 7.x and 8.x (RHEL – Red Hat Enterprise Linux) based systems such as CentOS and Oracle Linux. + +### Method-1: How to Scan New LUNs and SCSI Disks on Linux Using the “/sys” Class File + +The sysfs filesystem is a pseudo-filesystem which provides an interface to kernel data structures. + +The files under sysfs provide information about devices, kernel modules, filesystems, and other kernel components. + +The sysfs filesystem is commonly mounted at “/sys”. Typically, it is mounted automatically by the system. + +You can use the echo command to scan each scsi host device as shown below. + +``` +# echo "- - -" > /sys/class/scsi_host/host[n]/scan +``` + +When you run the above command that rescan everything, the three dash (“- – -“) refers the wildcard option. These values would be as follow. + +``` +# echo "c t l" > /sys/class/scsi_host/host[n]/scan +``` + +where + + * **c –** Channel on the HBA + * **t –** SCSI target ID + * **l –** LUN ID + * **n –** HBA number + + + +Run the below command to find all the host bus number on your system. + +``` +# ls /sys/class/scsi_host +host0 host1 host2 +``` + +Once you get the host bus number, run the following command to discover new disks. + +``` +# echo "- - -" > /sys/class/scsi_host/host0/scan +# echo "- - -" > /sys/class/scsi_host/host1/scan +# echo "- - -" > /sys/class/scsi_host/host2/scan +``` + +Also, it can be scanned using “for loop” with a single command. + +``` +# for host in ls /sys/class/scsi_host/;do echo "- - -" >/sys/class/scsi_host/${host}/scan; done +``` + +You can check them using the **[ls command][2]** as mentioned at the beginning of the article. + +``` +# ls /dev/disk/by-id | grep -i "serial-hex of LUN" +``` + +### Method-2: How to Scan New LUNs and SCSI Disks on Linux Using the rescan-scsi-bus.sh Script + +Make sure you have already installed the “sg3_utils” package to use this script. Otherwise, run the following command to install it. + +For **RHEL/CentOS 6/7** systems, use the **[yum command][3]** to install sg3_utils. + +``` +# yum install -y sg3_utils +``` + +For **RHEL/CentOS 8** and Fedora systems, use the **[dnf command][4]** to install sg3_utils. + +``` +# dnf install -y sg3_utils +``` + +Now you can rescan the LUNs using the rescan-scsi-bus.sh script. + +``` +# ./rescan-scsi-bus.sh +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/scan-detect-luns-scsi-disks-on-redhat-centos-oracle-linux/ + +作者:[Magesh Maruthamuthu][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://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/how-to-find-wwn-wwnn-wwpn-number-of-hba-card-in-linux/ +[2]: https://www.2daygeek.com/linux-unix-ls-command-display-directory-contents/ +[3]: https://www.2daygeek.com/linux-yum-command-examples-manage-packages-rhel-centos-systems/ +[4]: https://www.2daygeek.com/linux-dnf-command-examples-manage-packages-fedora-centos-rhel-systems/ From 75a971fe1303e04253edfb6c09d67cbaac5ec0ea Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 5 Nov 2020 05:02:40 +0800 Subject: [PATCH 0663/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201030?= =?UTF-8?q?=20How=20to=20rebase=20to=20Fedora=2033=20on=20Silverblue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201030 How to rebase to Fedora 33 on Silverblue.md --- ...ow to rebase to Fedora 33 on Silverblue.md | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 sources/tech/20201030 How to rebase to Fedora 33 on Silverblue.md diff --git a/sources/tech/20201030 How to rebase to Fedora 33 on Silverblue.md b/sources/tech/20201030 How to rebase to Fedora 33 on Silverblue.md new file mode 100644 index 0000000000..c17bf28706 --- /dev/null +++ b/sources/tech/20201030 How to rebase to Fedora 33 on Silverblue.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to rebase to Fedora 33 on Silverblue) +[#]: via: (https://fedoramagazine.org/how-to-rebase-to-fedora-33-on-silverblue/) +[#]: author: (Michal Konečný https://fedoramagazine.org/author/zlopez/) + +How to rebase to Fedora 33 on Silverblue +====== + +![][1] + +Silverblue is [an operating system for your desktop built on Fedora][2]. It’s excellent for daily use, development, and container-based workflows. It offers [numerous advantages][3] such as being able to roll back in case of any problems. If you want to update to Fedora 33 on your Silverblue system, this article tells you how. It not only shows you what to do, but also how to revert things if something unforeseen happens. + +Prior to actually doing the rebase to Fedora 33, you should apply any pending updates. Enter the following in the terminal: + +``` +$ rpm-ostree update +``` + +or install updates through GNOME Software and reboot. + +### Rebasing using GNOME Software + +The GNOME Software shows you that there is new version of Fedora available on the Updates screen. + +![Fedora 33 is available][4] + +First thing you need to do is to download the new image, so click on the _Download_ button. This will take some time and after it’s done you will see that the update is ready to install. + +![Fedora 33 is ready for installation][5] + +Click on the _Install_ button. This step will take only a few moments and then you will be prompted to restart your computer. + +![Restart is needed to rebase to Fedora 33 Silverblue][6] + +Click on _Restart_ button and you are done. After restart you will end up in new and shiny release of Fedora 33. Easy, isn’t it? + +### Rebasing using terminal + +If you prefer to do everything in a terminal, than this next guide is for you. + +Rebasing to Fedora 33 using terminal is easy. First, check if the 33 branch is available: + +``` +$ ostree remote refs fedora +``` + +You should see the following in the output: + +``` +fedora:fedora/33/x86_64/silverblue +``` + +Next, rebase your system to the Fedora 33 branch. + +``` +$ rpm-ostree rebase fedora:fedora/33/x86_64/silverblue +``` + +Finally, the last thing to do is restart your computer and boot to Fedora 33. + +### How to roll back + +If anything bad happens—for instance, if you can’t boot to Fedora 33 at all—it’s easy to go back. Pick the previous entry in the GRUB menu at boot, and your system will start in its previous state before switching to Fedora 33. To make this change permanent, use the following command: + +``` +$ rpm-ostree rollback +``` + +That’s it. Now you know how to rebase Silverblue to Fedora 33 and roll back. So why not do it today? + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-to-rebase-to-fedora-33-on-silverblue/ + +作者:[Michal Konečný][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/zlopez/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/02/fedora-silverblue-logo.png +[2]: https://docs.fedoraproject.org/en-US/fedora-silverblue/ +[3]: https://fedoramagazine.org/give-fedora-silverblue-a-test-drive/ +[4]: https://fedoramagazine.org/wp-content/uploads/2020/10/Screenshot-from-2020-10-29-12-53-37-1024x725.png +[5]: https://fedoramagazine.org/wp-content/uploads/2020/10/Screenshot-from-2020-10-29-13-00-15-1024x722.png +[6]: https://fedoramagazine.org/wp-content/uploads/2020/10/Screenshot-from-2020-10-29-13-01-32-1024x727.png From 1129e63e85753a03dff2d504929517e1bba8dc80 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 5 Nov 2020 05:04:24 +0800 Subject: [PATCH 0664/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201105?= =?UTF-8?q?=20How=20to=20Check=20Free=20Disk=20Space=20on=20Linux=20[Termi?= =?UTF-8?q?nal=20and=20GUI=20Methods]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md --- ...pace on Linux -Terminal and GUI Methods.md | 129 ++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 sources/tech/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md diff --git a/sources/tech/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md b/sources/tech/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md new file mode 100644 index 0000000000..abbe114c41 --- /dev/null +++ b/sources/tech/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md @@ -0,0 +1,129 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Check Free Disk Space on Linux [Terminal and GUI Methods]) +[#]: via: (https://itsfoss.com/check-free-disk-space-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +How to Check Free Disk Space on Linux [Terminal and GUI Methods] +====== + +_**How much disk space I have utilized?**_ + +The simplest way to find the free disk space on Linux is to [use df command][1]. The df command stands for disk-free and quite obviously, it shows you the free and available disk space on Linux systems. + +``` +df -h +``` + +With `-h` option, it shows the disk space in human-readable format (MB and GB). + +Here’s the output of the df command for my Dell XPS system that has only Linux installed with encrypted disk: + +![Checking free disk space with df command in Linux][2] + +If the above output is confusing for you, don’t worry. I’ll explain a few things around checking available disk space in Linux. _**I’ll also show the GUI method for desktop Linux users.**_ + +### Method 1: Checking free disk space in Linux with df command (and understanding its output) + +When you use the df command to check disk space, it will show a bunch of ‘file systems’ with their size, used space and free space. Your actual disks should normally be listed as one of the following: + + * /dev/sda + * /dev/sdb + * /dev/nvme0n1p + + + +This is not a hard and fast rule but it gives you an indication to easily recognize the actual disk from the crowd. + +Your Linux system might have several partitions on your disk for boot, EFI, root, swap, home etc. In such cases, these partitions are reflected with a number at the end of the ‘disk name’, like /dev/sda1, /dev/nvme0n1p2 etc. + +You could identify which partition is used for what purpose from its mount point. Root is mounted on /, EFI in /boot/EFI etc. + +In my case, I have used 41% of the 232 GB of disk space under root. If you have 2-3 big partitions (like root, home etc), you’ll have to make a calculation here. + +![Understanding df command output][3] + + * **tmpfs**: The [tmpfs][4] (temporary filesystem) used for keeping files in virtual memory. You can ignore this virtual filesystem comfortably. + * **udev**: The [udev filesystem][5] is used for storing information related to devices (like USB, network card, CD ROM etc) plugged to your system. You may ignore it as well. + * **/dev/loop**: These are loop devices. You’ll see plenty of them while checking disk space in Ubuntu because of snap applications. Loops are virtual devices that allow normal files to be accessed as block devices. With the loop devices, snap applications are sandboxed in their own virtual disk. Since they are under root, you don’t need to count their used disk space separately. + + + +#### Missing disk space? Check if you have mounted all disks and partitions + +Keep in mind that the df command only shows disk space for mounted filesystems. If you are using more than one Linux distribution (or operating systems) on the same disk or you have multiple disks on your system, you need to mount them first in order to see the free space available on those partitions and disks. + +For example, my [Intel NUC][6] has two SSDs and 4 or 5 Linux distributions installed on them. It shows additional disks only when I mount them explicitly. + +![][7] + +You can use the lsblk command to see all the disks and partitions on your system. + +![][8] + +Once you have the disk partition name, you can mount it in this fashion: + +``` +sudo mount /dev/sdb2 /mnt +``` + +I hope this gives you a pretty good idea about checking hard drive space on Linux. Let’s see how to do it graphically. + +### Method 2: Check free disk usage graphically + +Checking free disk space graphically is much easier in Ubuntu with the Disk Usage Analyzer tool. + +![Disk Usage Analyzer Tool][9] + +You’ll see all the actual disks and partitions here. You may have to mount some partitions by clicking on them. It displays the disk usage for all the mounted partitions. + +![Disk usage check][10] + +#### Checking free disk space with GNOME Disks utility + +Otherwise, the GNOME Disks utility is also pretty handy tool. + +![GNOME Disks Tool][11] + +Start the tool and select the disk. Select a partition to see the free disk space. If a partition is not mounted, mount it first by clicking the ‘play’ icon. + +![Free Disk Space Check in Ubuntu Desktop][12] + +I think all major desktop environments have some sort of graphical tool to check the disk usage on Linux. You can search for it in the menu of your desktop Linux system. + +**Conclusion** + +There can be more ways and tools to check the disk space of course. I showed you the most common command line and GUI methods for this purpose. + +I also explained a few things that might trouble you in understanding the disk usage. Hope you like it. + +If you have questions or suggestions, please let me know in the comment section. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/check-free-disk-space-linux/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://linuxhandbook.com/df-command/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/free-disk-space-linux-df-command-output.png?resize=786%2C475&ssl=1 +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/df-command-output.png?resize=800%2C600&ssl=1 +[4]: https://www.kernel.org/doc/html/latest/filesystems/tmpfs.html +[5]: https://wiki.debian.org/udev +[6]: https://itsfoss.com/install-linux-on-intel-nuc/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/df-command-ubuntu-1.png?resize=786%2C443&ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/lsblk-command-to-see-disks-linux.png?resize=786%2C538&ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/disk-usage-analyzer-tool-linux.jpg?resize=800%2C250&ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/free-disk-space-ubuntu-desktop.png?resize=800%2C648&ssl=1 +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/disks-tool-linux.jpg?resize=800%2C250&ssl=1 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/free-disk-space-check-ubuntu-desktop.png?resize=800%2C600&ssl=1 From dd2b63ab11e7c9d65860ee6b5a3f432294ece1f4 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 5 Nov 2020 05:05:04 +0800 Subject: [PATCH 0665/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201105?= =?UTF-8?q?=20Got=20Kids=3F=20Limit=20Computer=20Usage=20Per=20Account=20i?= =?UTF-8?q?n=20Linux=20With=20Timekpr-nExt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md --- ... Per Account in Linux With Timekpr-nExt.md | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 sources/tech/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md diff --git a/sources/tech/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md b/sources/tech/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md new file mode 100644 index 0000000000..0b3ed25c39 --- /dev/null +++ b/sources/tech/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md @@ -0,0 +1,111 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Got Kids? Limit Computer Usage Per Account in Linux With Timekpr-nExt) +[#]: via: (https://itsfoss.com/timekpr-next/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Got Kids? Limit Computer Usage Per Account in Linux With Timekpr-nExt +====== + +_**Open source software highlight of this week is Timekpr-nExt. It is a GUI application to limit the computer usage for certain accounts on a Linux system. This is a handy utility for parents who do not want children to spend excessive time on the computer.**_ + +### Use Timekpr-nExt to limit computer usage on Linux + +If you have young children at home who spend too much time on computer, you may want to put some sort of restriction on the usage. + +Timekpr-nExt enables you to limit computer usage for certain accounts based on the time of day, number of hours a day, week or month. You may also set time interval to force the account user to take break. + +![][1] + +After the given time expires, the user is automatically logged out and cannot log back in until the restriction conditions are satisfied. + +![][2] + +Of course, this means that you need to have separate non-admin (no sudo access) accounts for the children. If the kids accounts also have admin access, they can change the settings easily. Kids are smart, you know. + +### Features of Timekpr-nExt + +Apart from an annoyingly stylized name, Timekpr-nExt has the following features: + + * Limit system usage as day wise limit, daily limit, weekly or monthly limit + * You can also set access restrictions based on time and hour + * Users can be shown notification about how much time they have left + * Set the lockout action (terminate session, shutdown, suspend or lock screen) + * Track the time usage of the accounts + + + +Keep the following things in mind: + + * Check carefully which account you are configuring. _**Do not lock yourself out**_. + * Hit the apply or set button for each configuration changes otherwise the changes won’t be set. + * Children accounts should not have admin action otherwise they can overwrite the settings. + + + +Read the [documents about more information on using Timekpr-nExt][3]. + +### Installing Timekpr-nExt on Linux + +For Ubuntu-based Linux distributions (like Mint, Linux Lite etc), there is an [official PPA available][4]. You can install it by using the following commands one by one: + +``` +sudo add-apt-repository ppa:mjasnik/ppa +sudo apt update +sudo apt install timekpr-next +``` + +Arch Linux users can [find it in AUR][5]. For others, please check your distribution’s repository. If there is no such package, you may try using the source code. + +[Timekpr-nExt Source Code][6] + +_**Again, do not use Timekpr-nExt for your own main account. You may lock yourself out.**_ + +You’ll see two instances of the application. Use the one with (SU) at the beginning. + +![][7] + +#### Removing Timekpr-nExt + +I cannot say for certain if removing Timekpr-nExt will also remove the restrictions you put in place for the users. It will be a good idea to manually restore them (putting 24 hr interval a day). There is no reset button here. + +To remove this application (if you used PPA to install it), use the following command: + +``` +sudo apt-get remove --purge timekpr-next +``` + +Delete the PPA repository as well: + +``` +sudo add-apt-repository -r ppa:mjasnik/ppa +``` + +Like [blocking adult content on Linux][8], this application is also children specific. Not everyone would find it useful but people with young children at home may use it if they feel the need. + +Do you use some other application to monitor/restrict children from accessing computer? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/timekpr-next/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/timekpr-next-ubuntu.png?resize=800%2C612&ssl=1 +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/timekpr-next-icon-system-notification-area.png?resize=640%2C94&ssl=1 +[3]: https://mjasnik.gitlab.io/timekpr-next/ +[4]: https://launchpad.net/~mjasnik/+archive/ubuntu/ppa +[5]: https://aur.archlinux.org/packages/timekpr-next/ +[6]: https://launchpad.net/timekpr-next +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/timekeeper-next.jpg?resize=799%2C250&ssl=1 +[8]: https://itsfoss.com/how-to-block-porn-by-content-filtering-on-ubuntu/ From da3e84b3e207314ec08e72e8615418306390f530 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 5 Nov 2020 05:09:40 +0800 Subject: [PATCH 0666/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200711?= =?UTF-8?q?=20scanimage:=20scan=20from=20the=20command=20line!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200711 scanimage- scan from the command line.md --- ...1 scanimage- scan from the command line.md | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 sources/tech/20200711 scanimage- scan from the command line.md diff --git a/sources/tech/20200711 scanimage- scan from the command line.md b/sources/tech/20200711 scanimage- scan from the command line.md new file mode 100644 index 0000000000..91cda0b4ae --- /dev/null +++ b/sources/tech/20200711 scanimage- scan from the command line.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (scanimage: scan from the command line!) +[#]: via: (https://jvns.ca/blog/2020/07/11/scanimage--scan-from-the-command-line/) +[#]: author: (Julia Evans https://jvns.ca/) + +scanimage: scan from the command line! +====== + +Here’s another quick post about a command line tool I was delighted by. + +Last night, I needed to scan some documents for some bureaucratic reasons. I’d never used a scanner on Linux before and I was worried it would take hours to figure out. I started by using `gscan2pdf` and had trouble figuring out the user interface – I wanted to scan both sides of the page at the same time (which I knew our scanner supported) but couldn’t get it to work. + +### enter scanimage! + +`scanimage` is a command line tool, in the `sane-utils` Debian package. I think all Linux scanning tools use the `sane` libraries (“scanner access now easy”) so my guess is that it has similar abilities to any other scanning software. I didn’t need OCR in this case so we’re not going to talk about OCR. + +### get your scanner’s name with `scanimage -L` + +`scanimage -L` lists all scanning devices you have. + +At first I couldn’t get this to work and I was a bit frustrated but it turned out that I’d connected the scanner to my computer, but not plugged it into the wall. Oops. + +Once everything was plugged in it worked right away. Apparently our scanner is called `fujitsu:ScanSnap S1500:2314`. Hooray! + +### list options for your scanner with `--help` + +Apparently each scanner has different options (makes sense!) so I ran this command to get the options for my scanner: + +``` +scanimage --help -d 'fujitsu:ScanSnap S1500:2314' +``` + +I found out that my scanner supported a `--source` option (which I could use to enable duplex scanning) and a `--resolution` option (which I changed to 150 to decrease the file sizes and make scanning faster). + +### scanimage doesn’t output PDFs (but you can write a tiny script) + +The only downside was – I wanted a PDF of my scanned document, and scanimage doesn’t seem to support PDF output. + +So I wrote this 5-line shell script to scan a bunch of PNGs into a temp directory and convert the resulting PNGs to a PDF. + +``` +#!/bin/bash +set -e + +DIR=`mktemp -d` +CUR=$PWD +cd $DIR +scanimage -b --format png -d 'fujitsu:ScanSnap S1500:2314' --source 'ADF Front' --resolution 150 +convert *.png $CUR/$1 +``` + +I ran the script like this. `scan-single-sided output-file-to-save.pdf` + +You’ll probably need a different `-d` and `--source` for your scanner. + +### it was so easy! + +I always expect using printers/scanners on Linux to be a nightmare and I was really surprised how `scanimage` Just Worked – I could just run my script with `scan-single-sided receipts.pdf` and it would scan a document and save it to `receipts.pdf`!. +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/07/11/scanimage--scan-from-the-command-line/ + +作者:[Julia Evans][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://jvns.ca/ +[b]: https://github.com/lujun9972 From ce1e17c077d736b36c4e054fdf1e35b43955b701 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 5 Nov 2020 05:10:12 +0800 Subject: [PATCH 0667/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200619?= =?UTF-8?q?=20A=20little=20bit=20of=20plain=20Javascript=20can=20do=20a=20?= =?UTF-8?q?lot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200619 A little bit of plain Javascript can do a lot.md --- ...le bit of plain Javascript can do a lot.md | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 sources/tech/20200619 A little bit of plain Javascript can do a lot.md diff --git a/sources/tech/20200619 A little bit of plain Javascript can do a lot.md b/sources/tech/20200619 A little bit of plain Javascript can do a lot.md new file mode 100644 index 0000000000..ac36191038 --- /dev/null +++ b/sources/tech/20200619 A little bit of plain Javascript can do a lot.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A little bit of plain Javascript can do a lot) +[#]: via: (https://jvns.ca/blog/2020/06/19/a-little-bit-of-plain-javascript-can-do-a-lot/) +[#]: author: (Julia Evans https://jvns.ca/) + +A little bit of plain Javascript can do a lot +====== + +I’ve never worked as a professional frontend developer, so even though I’ve been writing HTML/CSS/JS for 15 years for little side projects, all of the projects have been pretty small, sometimes I don’t write any Javascript for years in between, and I often don’t quite feel like I know what I’m doing. + +Partly because of that, I’ve leaned on libraries a lot! Ten years ago I used to use jQuery, and since maybe 2017 I’ve been using a lot of vue.js for my little Javascript projects (you can see a [little whack-a-mole game I made here as an intro to Vue][1]). + +But last week, for the first time in a while, I wrote some plain Javascript without a library and it was fun so I wanted to talk about it a bit! + +### experimenting with just plain Javascript + +I really like Vue. But last week when I started building , I had slightly different constraints than usual – I wanted to use the same HTML to generate both a PDF (with [Prince][2]) and to make an interactive version of the questions. + +I couldn’t really see how that would work with Vue (because Vue wants to create all the HTML itself), and because it was a small project I decided to try writing it in plain Javascript with no libraries – just write some HTML/CSS and add a single ``. + +I hadn’t done this in a while, and I learned a few things along the way that made it easier than I thought it would be when I started. + +### do almost everything by adding & removing CSS classes + +I decided to implement almost all of the UI by just adding & removing CSS classes, and using [CSS transitions][3] if I want to animate a transition. + +here’s a small example, where clicking the “next” question button adds the “done” class to the parent div. + +``` +div.querySelector('.next-question').onclick = function () { + show_next_row(); + this.parentElement.parentElement.classList.add('done'); +} +``` + +This worked pretty well. My CSS as always is a bit of a mess but it felt manageable. + +### add/remove CSS classes with `.classList` + +I started out by editing the classes like this: `x.className = 'new list of classes'`. That felt a bit messy though and I wondered if there was a better way. And there was! + +You can also add CSS classes like this: + +``` +let x = document.querySelector('div'); +x.classList.add('hi'); +x.classList.remove('hi'); +``` + +`element.classList.remove('hi')` is way cleaner than what I was doing before. + +### find elements with `document.querySelectorAll` + +When I started learning jQuery I remember thinking that if you wanted to easily find something in the DOM you had to use jQuery (like `$('.class')`). I just learned this week that you can actually write `document.querySelectorAll('.some-class')` instead, and then you don’t need to depend on any library! + +I got curious about when `querySelectorAll` was introduced. I Googled a tiny bit and it looks like the [Selectors API was built sometime between 2008 and 2013 – I found a [post from the jQuery author discussing the proposed implementation in 2008][4], and [a blog post from 2011][5] saying it was in all major browsers by then, so maybe it didn’t exist when I started using jQuery but it’s definitely been around for quite a while :) + +### set `.innerHTML` + +In one place I wanted to change a button’s HTML contents. Creating DOM elements with `document.createElement` is pretty annoying, so I tried to do that as little as possible and instead set `.innerHTML` to the HTML string I wanted: + +``` +button.innerHTML = `I learned something! + +`; +``` + +### scroll through the page with `.scrollIntoView` + +The last fun thing I learned about is `.scrollIntoView` – I wanted to scroll down to the next question automatically when someone clicked “next question”. Turns out this is just one line of code: + +``` +row.classList.add('revealed'); +row.scrollIntoView({behavior: 'smooth', block: 'center'}); +``` + +### another vanilla JS example: peekobot + +Another small example of a plain JS library I thought was nice is [peekobot][6], which is a little chatbot interface that’s 100 lines of JS/CSS. + +Looking at [its Javascript][7], it uses some similar patterns – a lot of `.classList.add`, some adding elements to the DOM, some `.querySelectorAll`. + +I learned from reading peekobot’s source about [.closest][8] which finds the closest ancestor that matches a given selector. That seems like it would be a nice way to get rid of some of the `.parentElement.parentElement` that I was writing in my Javascript, which felt a bit fragile. + +### plain Javascript can do a lot! + +I was pretty surprised by how much I could get done with just plain JS. I ended up writing about 50 lines of JS to do everything I wanted to do, plus a bit extra to collect some anonymous metrics about what folks were learning. + +As usual with my frontend posts, this isn’t meant to be Serious Frontend Engineering Advice – my goal is to be able to write little websites with less than 200 lines of Javascript that mostly work. If you are also flailing around in frontend land I hope this helps a bit! + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/06/19/a-little-bit-of-plain-javascript-can-do-a-lot/ + +作者:[Julia Evans][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://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://jvns.ca/blog/2017/06/26/vue-js-fun/ +[2]: https://www.princexml.com/ +[3]: https://3dtransforms.desandro.com/card-flip +[4]: https://johnresig.com/blog/thoughts-on-queryselectorall/ +[5]: https://tiffanybbrown.com/2011/08/12/meet-the-selectors-api/ +[6]: https://peekobot.github.io/peekobot/ +[7]: https://github.com/Peekobot/peekobot/blob/master/peekobot.js +[8]: https://developer.mozilla.org/en-US/docs/Web/API/Element/closest From a034604ad2b1e84430d9a6ca0c8f8223ac13a783 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 5 Nov 2020 05:10:20 +0800 Subject: [PATCH 0668/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200617?= =?UTF-8?q?=20What=20happens=20when=20you=20update=20your=20DNS=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200617 What happens when you update your DNS.md --- ...7 What happens when you update your DNS.md | 236 ++++++++++++++++++ 1 file changed, 236 insertions(+) create mode 100644 sources/tech/20200617 What happens when you update your DNS.md diff --git a/sources/tech/20200617 What happens when you update your DNS.md b/sources/tech/20200617 What happens when you update your DNS.md new file mode 100644 index 0000000000..0a17d1d621 --- /dev/null +++ b/sources/tech/20200617 What happens when you update your DNS.md @@ -0,0 +1,236 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What happens when you update your DNS?) +[#]: via: (https://jvns.ca/blog/how-updating-dns-works/) +[#]: author: (Julia Evans https://jvns.ca/) + +What happens when you update your DNS? +====== + +I’ve seen a lot of people get confused about updating their site’s DNS records to change the IP address. Why is it slow? Do you really have to wait 2 days for everything to update? Why do some people see the new IP and some people see the old IP? What’s happening? + +So I wanted to write a quick exploration of what’s happening behind the scenes when you update a DNS record. + +### how DNS works: recursive vs authoritative DNS servers + +First, we need to explain a little bit about DNS. There are 2 kinds of DNS servers: **authoritative** and **recursive**. + +**authoritative** DNS servers (also known as **nameservers**) have a database of IP addresses for each domain they’re responsible for. For example, right now an authoritative DNS server for github.com is ns-421.awsdns-52.com. You can ask it for github.com’s IP like this; + +``` +dig @ns-421.awsdns-52.com github.com +``` + +**recursive** DNS servers, by themselves, don’t know anything about who owns what IP address. They figure out the IP address for a domain by asking the right authoritative DNS servers, and then cache that IP address in case they’re asked again. 8.8.8.8 is a recursive DNS server. + +When people visit your website, they’re probably making their DNS queries to a recursive DNS server. So, how do recursive DNS servers work? Let’s see! + +### how does a recursive DNS server query for github.com? + +Let’s go through an example of what a recursive DNS server (like 8.8.8.8) does when you ask it for an IP address (A record) for github.com. First – if it already has something cached, it’ll give you what it has cached. But what if all of its caches are expired? Here’s what happens: + +**step 1**: it has IP addresses for the root DNS servers hardcoded in its source code. You can see this in [unbound’s source code here][1]. Let’s say it picks `198.41.0.4` to start with. Here’s the [official source][2] for those hardcoded IP addresses, also known as a “root hints file”. + +**step 2**: Ask the root nameservers about `github.com`. + +We can roughly reproduce what happens with `dig`. What this gives us is a new authoritative nameserver to ask: a nameserver for `.com`, with the IP `192.5.6.30`. + +``` +$ dig @198.41.0.4 github.com +... +com. 172800 IN NS a.gtld-servers.net. +... +a.gtld-servers.net. 172800 IN A 192.5.6.30 +... +``` + +The details of the DNS response are a little more complicated than that – in this case, there’s an authority section with some NS records and an additional section with A records so you don’t need to do an extra lookup to get the IP addresses of those nameservers. + +(in practice, 99.99% of the time it’ll already have the address of the `.com` nameservers cached, but we’re pretending we’re really starting from scratch) + +**step 3**: Ask the `.com` nameservers about `github.com`. + +``` +$ dig @192.5.6.30 github.com +... +github.com. 172800 IN NS ns-421.awsdns-52.com. +ns-421.awsdns-52.com. 172800 IN A 205.251.193.165 +... +``` + +We have a new IP address to ask! This one is the nameserver for `github.com`. + +**step 4**: Ask the `github.com` nameservers about `github.com`. + +We’re almost done! + +``` +$ dig @205.251.193.165 github.com + +github.com. 60 IN A 140.82.112.4 +``` + +Hooray!! We have an `A` record for `github.com`! Now the recursive nameserver has `github.com`’s IP address and can return it back to you. And it could do all of this by only hardcoding a few IP addresses: the addresses of the root nameservers. + +### how to see all of a recursive DNS server’s steps: `dig +trace` + +When I want to see what a recursive DNS server would do when resolving a domain, I run + +``` +$ dig @8.8.8.8 +trace github.com +``` + +This shows all the DNS records that it requests, starting at the root DNS servers – all the 4 steps that we just went through. + +### let’s update some DNS records! + +Now that we know the basics of how DNS works, let’s update some DNS records and see what happens. + +When you update your DNS records, there are two main options: + + 1. keep the same nameservers + 2. change nameservers + + + +### let’s talk about TTLs + +We’ve forgotten something important though! TTLs! You know how we said earlier that the recursive DNS server will cache records until they expire? The way it decides whether the record should expire is by looking at its **TTL** or “time to live”. + +In this example, the TTL for the A record github’s nameserver returns for its DNS record is `60`, which means 60 seconds: + +``` +$ dig @205.251.193.165 github.com + +github.com. 60 IN A 140.82.112.4 +``` + +That’s a pretty short TTL, and _in theory_ if everybody’s DNS implementation followed the [DNS standard][3] it means that if Github decided to change the IP address for `github.com`, everyone should get the new IP address within 60 seconds. Let’s see how that plays out in practice + +### option 1: update a DNS record on the same nameservers + +First, I updated my nameservers (Cloudflare) to have a new DNS record: an A record that maps `test.jvns.ca` to `1.2.3.4`. + +``` +$ dig @8.8.8.8 test.jvns.ca +test.jvns.ca. 299 IN A 1.2.3.4 +``` + +This worked immediately! There was no need to wait at all, because there was no `test.jvns.ca` DNS record before that could have been cached. Great. But it looks like the new record is cached for ~5 minutes (299 seconds). + +So, what if we try to change that IP? I changed it to `5.6.7.8`, and then ran the same DNS query. + +``` +$ dig @8.8.8.8 test.jvns.ca +test.jvns.ca. 144 IN A 1.2.3.4 +``` + +Hmm, it seems like that DNS server has the `1.2.3.4` record still cached for another 144 seconds. Interestingly, if I query `8.8.8.8` multiple times I actually get inconsistent results – sometimes it’ll give me the new IP and sometimes the old IP, I guess because 8.8.8.8 actually load balances to a bunch of different backends which each have their own cache. + +After I waited 5 minutes, all of the `8.8.8.8` caches had updated and were always returning the new `5.6.7.8` record. Awesome. That was pretty fast! + +### you can’t always rely on the TTL + +As with most internet protocols, not everything obeys the DNS specification. Some ISP DNS servers will cache records for longer than the TTL specifies, like maybe for 2 days instead of 5 minutes. And people can always hardcode the old IP address in their /etc/hosts. + +What I’d expect to happen in practice when updating a DNS record with a 5 minute TTL is that a large percentage of clients will move over to the new IPs quickly (like within 15 minutes), and then there will be a bunch of stragglers that slowly update over the next few days. + +### option 2: updating your nameservers + +So we’ve seen that when you update an IP address without changing your nameservers, a lot of DNS servers will pick up the new IP pretty quickly. Great. But what happens if you change your nameservers? Let’s try it! + +I didn’t want to update the nameservers for my blog, so instead I went with a different domain I own and use in the examples for the [HTTP zine][4]: `examplecat.com`. + +Previously, my nameservers were set to dns1.p01.nsone.net. I decided to switch them over to Google’s nameservers – `ns-cloud-b1.googledomains.com` etc. + +When I made the change, my domain registrar somewhat ominiously popped up the message – “Changes to examplecat.com saved. They’ll take effect within the next 48 hours”. Then I set up a new A record for the domain, to make it point to `1.2.3.4` + +Okay, let’s see if that did anything + +``` +$ dig @8.8.8.8 examplecat.com +examplecat.com. 17 IN A 104.248.50.87 +``` + +No change. If I ask a different DNS server, it knows the new IP: + +``` +$ dig @1.1.1.1 examplecat.com +examplecat.com. 299 IN A 1.2.3.4 +``` + +but 8.8.8.8 is still clueless. The reason 1.1.1.1 sees the new IP even though I just changed it 5 minutes ago is presumably that nobody had ever queried 1.1.1.1 about examplecat.com before, so it had nothing in its cache. + +### nameserver TTLs are much longer + +The reason that my registrar was saying “THIS WILL TAKE 48 HOURS” is that the TTLs on NS records (which are how recursive nameservers know which nameserver to ask) are MUCH longer! + +The new nameserver is definitely returning the new IP address for `examplecat.com` + +``` +$ dig @ns-cloud-b1.googledomains.com examplecat.com +examplecat.com. 300 IN A 1.2.3.4 +``` + +But remember what happened when we queried for the `github.com` nameservers, way back? + +``` +$ dig @192.5.6.30 github.com +... +github.com. 172800 IN NS ns-421.awsdns-52.com. +ns-421.awsdns-52.com. 172800 IN A 205.251.193.165 +... +``` + +172800 seconds is 48 hours! So nameserver updates will in general take a lot longer to expire from caches and propagate than just updating an IP address without changing your nameserver. + +### how do your nameservers get updated? + +When I update the nameservers for `examplecat.com`, what happens is that he `.com` nameserver gets a new `NS` record with the new domain. Like this: + +``` +dig ns @j.gtld-servers.net examplecat.com + +examplecat.com. 172800 IN NS ns-cloud-b1.googledomains.com +``` + +But how does that new NS record get there? What happens is that I tell my **domain registrar** what I want the new nameservers to be by updating it on the website, and then my domain registrar tells the `.com` nameservers to make the update. + +For `.com`, these updates happen pretty fast (within a few minutes), but I think for some other TLDs the TLD nameservers might not apply updates as quickly. + +### your program’s DNS resolver library might also cache DNS records + +One more reason TTLs might not be respected in practice: many programs need to resolve DNS names, and some programs will also cache DNS records indefinitely in memory (until the program is restarted). + +For example, AWS has an article on [Setting the JVM TTL for DNS Name Lookups][5]. I haven’t written that much JVM code that does DNS lookups myself, but from a little Googling about the JVM and DNS it seems like you can configure the JVM so that it caches every DNS lookup indefinitely. (like [this elasticsearch issue][6]) + +### that’s all! + +I hope this helps you understand what’s going on when updating your DNS! + +As a disclaimer, again – TTLs definitely don’t tell the whole story about DNS propagation – some recursive DNS servers definitely don’t respect TTLs, even if the major ones like 8.8.8.8 do. So even if you’re just updating an A record with a short TTL, it’s very possible that in practice you’ll still get some requests to the old IP for a day or two. + +Also, I changed the nameservers for `examplecat.com` back to their old values after publishing this post. + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/how-updating-dns-works/ + +作者:[Julia Evans][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://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://github.com/NLnetLabs/unbound/blob/6e0756e819779d9cc2a14741b501cadffe446c93/iterator/iter_hints.c#L131 +[2]: https://www.iana.org/domains/root/files +[3]: https://tools.ietf.org/html/rfc1035 +[4]: https://wizardzines.com/zines/http/ +[5]: https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/java-dg-jvm-ttl.html +[6]: https://github.com/elastic/elasticsearch/issues/16412 From 5eb262dfb77cbb38d874333b471b41379fd7e7fc Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 5 Nov 2020 05:10:35 +0800 Subject: [PATCH 0669/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200508?= =?UTF-8?q?=20Metaphors=20in=20man=20pages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200508 Metaphors in man pages.md --- .../tech/20200508 Metaphors in man pages.md | 182 ++++++++++++++++++ 1 file changed, 182 insertions(+) create mode 100644 sources/tech/20200508 Metaphors in man pages.md diff --git a/sources/tech/20200508 Metaphors in man pages.md b/sources/tech/20200508 Metaphors in man pages.md new file mode 100644 index 0000000000..8a9ea9c3b9 --- /dev/null +++ b/sources/tech/20200508 Metaphors in man pages.md @@ -0,0 +1,182 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Metaphors in man pages) +[#]: via: (https://jvns.ca/blog/2020/05/08/metaphors-in-man-pages/) +[#]: author: (Julia Evans https://jvns.ca/) + +Metaphors in man pages +====== + +This morning I was watching a [great talk by Maggie Appleton][1] about metaphors. In the talk, she explains the difference between a “figurative metaphor” and a “cognitive metaphor”, and references this super interesting book called [Metaphors We Live By][2] which I immediately got and started reading. + +Here’s an example from “Metaphors We Live By” of a bunch of metaphors we use for ideas: + + * ideas as **food**: “_raw_ facts”, “_half-baked_ ideas”, “_swallow_ that claim”, “_spoon-feed_ our students”, “_meaty_ part of the paper”, “that idea has been _fermenting_ for years” + * ideas as **people**: “the theory of relativity _gave birth_ to an enormous number of ideas”, “whose _brainchild_ was that”, “those ideas _died off_ in the middle ages”, “cognitive psychology is in its _infancy_“ + * ideas as **products**: “we’ve _generated_ a lot of ideas this week”, “it needs to be _refined_”, “his _intellectual productivity_ has decreased in recent years” + * ideas as **commodities**: “he won’t _buy_ that”, “that’s a _worthless_ idea”, “she has _valuable_ ideas” + * ideas as **resources**: “he _ran out_ of ideas”, “let’s _pool_ our ideas”, “that idea will _go a long way_“ + * ideas as **cutting instruments**: “that’s an _incisive_ idea”, “that _cuts right to the heart_ of the matter”, “he’s _sharp_“ + * ideas as **fashions**: “that idea _went out of style_ years ago”, “marxism is _fashionable_ in western europe”, “berkeley is a center of _avant-garde_ thought”, “semiotics has become quite _chic_“ + + + +There’s a [long list of more English metaphors here][3], including many metaphors from the book. + +I was surprised that there were so many different metaphors for ideas, and that we’re using metaphors like this all the time in normal language. + +### let’s look for metaphors in man pages! + +Okay, let’s get to the point of this blog post, which is just a small fun exploration – there aren’t going to be any Deep Programming Insights here. + +I went through some of the examples of metaphors in Metaphors To Live By and grepped all the man pages on my computer for them. + +### processes as people + +This is one of the richer categories – a lot of different man pages seem to agree that processes are people, or at least alive in some way. + + * Hangup detected on controlling terminal or **death** of controlling process (`man 7 signal`) + * can access the local **agent** through the forwarded connection (`man ssh_config`) + * If the exit of the process causes a process group to become **orphaned** (`man exit`) + * If a parent process terminates, then its **“zombie” children** (if any) (`man wait`) + * … send SIGHUP to the **parent** process of the client (`man tmux`) + * Otherwise, it **“runs” to catch up** or waits (`man mplayer`) + * However, Git does not (and it should not) change tags **behind users back** (`man git-tag`) + * will **listen** forever for a connection (`man nc_openbsd`) + * this monitor scales badly with the number of files being **observed** (`man fswatch`) + * If you try to use the **birth** time of a reference file (`man file`) + * a program **died** due to a fatal signal (`man xargs`) + * protocol version in the TLS **handshake** (`man curl`) + * it will **look for** a debug object at… (`man valgrind`) + + + +### data as food + + * “Apparently some digital cameras get **indigestion** if you feed them a CF card) (`man mkfs`) + * “Send packets using **raw** ethernet frames or IP packets” (`man nmap`) + * “the above example can be thought of as a maximizing repeat that must **swallow** everything it can” (`man pcrepattern`) + * “This will allow you to **feed** newline-delimited name=value pairs to the script on’ (`man CGI`) + + + +### data as objects + + * Kill the tmux server and clients and **destroy** all sessions (`tmux`) + * Each command will produce one **block** of output on standard output. (`man tmux`) + * “HTTPS guarantees that the password will not **travel** in the clear” (`man Net::SSLeay`) + * “way to **pack** more than one certificate into an ASN.1 structure” (`man gpgsm`) + + + +### processes as machines/objects + + * “This is **fragile**, subject to change, and thus should not be relied upon” (`man ps`) + * “This is useful if you have to use **broken** DNS” (`man aria2c`) + * “This provides good safety measures, but **breaks down** when” (`man git-apply`) + * “debugfs is a debugging tool. It has **rough edges**!” (`man debugfs`) + + + +### containers + +There are LOTS of containers: directories, files, strings, caches, queues, buffers, etc. + + * can exploit that to **get out** of the chroot directory (`man chroot`) + * “The file **containing** the RFC 4648 Section 5 base64url encoded 128-bit secret key” + * “Keys must start with a lowercase character and **contain** only hyphens” + * “just specify an **empty** string” (`man valgrind`) + * “the cache is **full** and a new page that isn’t cached becomes visible” (`man zathurarc`) + * “Number of table **overflows**” (`man lnstat`) + * “likely **overflow** the buffer” (`man g++`) + + + +### resources + +There are also lots of kinds of resources: bandwidth, TCP sockets, session IDs, stack space, memory, disk space. + + * This is not recommended and **wastes** bitrate (`man bitrate`) + * corruption or **lost** data if the system crashes (`man btree`) + * you don’t want Wget to **consume** the entire available bandwidth (`man wget`) + * Larger values will be slower and cause x264 to **consume** more memory (`man mplayer`) + * the resulting file can **consume** some disk space (`man socat`) + * attempting to **reuse** SSL session-ID (`man curl`) + * This option controls stack space **reuse** (`man gcc`) + * Keep the TCP socket open between queries and **reuse** it rather than creating a new TCP socket (`man dig`) + * the maximum value will easily **eat up** three extra gigabytes or so of memory (`man valgrind`) + + + +### orientation (up, down, above, below) + + * Send the escape character to the **frontend** (`man qemu-system`) + * Note that TLS 1.3 is only supported by a subset of TLS **backends** (`man curl`) + * This option may be useful if you are **behind** a router (`man mplayer`) + * When a file that exists on the **lower** layer is renamed (`man rename`) + * Several of the socket options should be handled at **lower** levels (`man getsockopt`) + * while still performing such **higher** level functionality (`man nmap`) + * This is the same string passed **back to** the front end (`man sudo_plugin`) + * On Linux, `futimens` is a library function implemented **on top** of the `utimensat` system call (`man futimens`) + + + +### buildings + +Limits as rooms/buildings (which have floors, and ceilings, which you hit) are kind of fun: + + * the kernel places a **floor** of 32 pages on this size limit (`man execve`) + * This specifies a **ceiling** to which the process’s nice value can be raised (`man getrlimit`) + * If this limit is **hit** the search is aborted (`man gcc`) + * these libraries are used as the **foundation** for many of the libraries (`man Glib`) + + + +### money / wealth + + * This is a very **expensive** operation for large projects, so use it with caution (`man git-log`) + * Note that since this operation is very I/O **expensive** (`man git-filter-branch`) + * provides a **rich** interface for scripts to print disk layouts (`man fdisk`) + * The number of times the softirq handler function terminated per second because its **budget** was consumed (`man sar.sysstat`) + * the extra **cost** depends a lot on the application at hand (`man valgrind`) + + + +### more miscellaneous metaphors + +here are some more I found that didn’t fit into any of those categories yet. + + * when a thread is created under glibc, just one **big** lock is used for all thread setup (`man valgrind`) + * will likely **drop** the connection (`man x11vnc`) + * on all **paths** from the load to the function entry (`man gcc`) + * it is a very good idea to **wipe** filesystem signatures, data, etc. before (`man cryptsetup`) + * they will be **embedded** into the document + * the client should automatically **follow** referrals returned + * even if there exist mappings that **cover** the whole address space requested (`man mremap`) + * when a network interface **disappears** (`man systemd-resolve`) + + + +### we’re all using metaphors all the time + +I found a lot more metaphors than I expected, and most of them are just part of how I’d normally talk about a program. Interesting! + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/05/08/metaphors-in-man-pages/ + +作者:[Julia Evans][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://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://www.youtube.com/watch?v=K8MF3aDg-bM&feature=youtu.be&t=14991 +[2]: https://www.goodreads.com/book/show/34459.Metaphors_We_Live_By +[3]: https://metaphor.icsi.berkeley.edu/pub/en/index.php/Category:Metaphor From c6714b998059d6ee61655288fd16562afc6525cc Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 5 Nov 2020 08:47:11 +0800 Subject: [PATCH 0670/1156] translated --- ...has Some Exciting Improvements Lined Up.md | 93 ------------------- ...has Some Exciting Improvements Lined Up.md | 80 ++++++++++++++++ 2 files changed, 80 insertions(+), 93 deletions(-) delete mode 100644 sources/tech/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md create mode 100644 translated/tech/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md diff --git a/sources/tech/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md b/sources/tech/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md deleted file mode 100644 index 45ae5f36c1..0000000000 --- a/sources/tech/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md +++ /dev/null @@ -1,93 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up) -[#]: via: (https://itsfoss.com/kernel-5-10/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up -====== - -_**Development for Linux Kernel 5.10 is in progress. It’s been confirmed to be a long term support release and it will be bringing newer hardware support among other promised features.**_ - -### Linux Kernel 5.10 will be Long Term Support Release - -**Greg Kroah-Hartman**, the key stable kernel maintainer, addressed an “Ask the Expert” session at Linux Foundation’s Open-Source Summit Europe and confirmed that Linux 5.10 will be the next LTS release. - -Even though there were some early speculations of 5.9 being the LTS release, Greg clarified that the last kernel release of the year will always be an LTS release. - -As of now, [Linux Kernel 5.4][1] series happens to be the latest LTS version out there which added a lot of improvements and hardware support. Also, considering the development progress with Linux [Kernel 5.8][2] being the biggest release so far and Linux 5.10’s first release candidate being close to it, there’s a lot of things going on under the hood. - -> Because people keep asking me… -> -> — Greg K-H (@gregkh) [October 26, 2020][3] - -Let’s take a look at some of the features and improvements that you can expect with Linux Kernel 5.10. - -### Linux kernel 5.10 features - -![][4] - -**Note:** _Linux Kernel 5.10 is still in early development. So, we will be updating the article regularly for the latest additions/feature updates._ - -#### AMD Zen 3 Processor Support - -The new [Ryzen 5000][5] lineup is one of the biggest buzzes of 2020. So, with Linux Kernel 5.10 release candidate version, various additions are being made for Zen 3 processors. - -#### Intel Rocket Lake Support - -I do not hope for a lot with Intel’s Rocket Lake chipsets arriving Q1 next year (2021). But, considering that Intel’s constantly squeezing everything out of that 14 nm process, it is definitely a good thing to see work done for Intel Rocket Lake on Linux Kernel 5.10 - -#### Open Source Driver for Radeon RX 6000 series - -Even though we’re covering this a day before the Big Navi reveal, the Radeon RX 6000 series is definitely going to be something impressive to compete with NVIDIA RTX 3000 series. - -Of course, unless it suffers from the same issues the Vega series or the 5000 series met with. - -It’s good to see work being already done for an open source driver to support the next-gen Radeon GPUs on Linux Kernel 5.10. - -#### File System Optimizations and Storage Improvements - -[Phoronix][6] reports on file-system optimizations and storage improvements with 5.10 as well. So, judging by that, we should see some performance improvements. - -#### Other Improvements - -Undoubtedly, you should expect a great deal of driver updates and hardware supports with the new kernel. - -For now, the support for SoundBlaster AE-7, early support for NVIDIA Orin (AI processor), and Tiger Lake GPU improvements seem to be the key highlights. - -A stable release for Linux Kernel 5.10 should be expected around the mid-December timeline. It will be supported for at least 2 years but you could end up with security/bug fix updates till 2026. So, we will have to stay tuned to the development for anything exciting on the next Linux Kernel 5.10 LTS release. - -**Recommended Read:** - -![][7] - -#### [Explained! Why Your Distribution Still Using an ‘Outdated’ Linux Kernel?][8] - -A new stable kernel is released every 2-3 months yet your distribution might still be using an old, outdated Linux kernel. But you don’t need to worry and here’s why! - -What do you think about the upcoming Linux Kernel 5.10 release? Let us know your thoughts in the comments. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/kernel-5-10/ - -作者:[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/linux-kernel-5-4/ -[2]: https://itsfoss.com/kernel-5-8-release/ -[3]: https://twitter.com/gregkh/status/1320745076566433793?ref_src=twsrc%5Etfw -[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/kernel-5-10-release.png?resize=800%2C450&ssl=1 -[5]: https://www.tomsguide.com/news/amd-ryzen-5000-revealed-what-it-means-for-pc-gaming -[6]: https://www.phoronix.com/scan.php?page=article&item=linux-510-features&num=1 -[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/12/why_Linux_distro_use_outdated_kernel.jpg?fit=800%2C450&ssl=1 -[8]: https://itsfoss.com/why-distros-use-old-kernel/ diff --git a/translated/tech/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md b/translated/tech/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md new file mode 100644 index 0000000000..bdcd81e8c7 --- /dev/null +++ b/translated/tech/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md @@ -0,0 +1,80 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up) +[#]: via: (https://itsfoss.com/kernel-5-10/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Linux Kernel 5.10 将是下一个 LTS 版本,它有一些令人兴奋的改进 +====== + +_**Linux Kernel 5.10 的开发正在进行中。已确认这是一个长期支持的版本,将带来更新的硬件支持和其他承诺的功能。**_ + +### Linux Kernel 5.10 将是长期支持版本 + +主要稳定内核维护者 **Greg Kroah-Hartman** 在 Linux 基金会欧洲开源峰会的 “Ask the Expert” 会议上发言,确认 Linux 5.10 将是下一个 LTS 版本。 + +尽管早期有一些关于 5.9 是 LTS 版本的猜测,但 Greg 澄清说,一年的最后一个内核版本永远是 LTS 版本。 + +目前来看,[Linux Kernel 5.4][1] 系列恰好是最新的 LTS 版本,它增加了很多改进和硬件支持。另外,考虑到开发进度,Linux [Kernel 5.8][2] 是目前最大的版本,而 Linux 5.10 的第一个候选版本也很接近,所以下面有很多事情要做。 + +让我们来看看 Linux Kernel 5.10 的一些功能和改进。 + +### Linux kernel 5.10 的功能 + +![][4] + +**注意:** _Linux Kernel 5.10 仍处于早期开发阶段。因此,我们将定期更新文章,以更新最新的补充/功能。_ + +#### AMD Zen 3 处理器支持 + +新的 [Ryzen 5000][5] 产品线是 2020 年最大的看点之一。所以,随着 Linux Kernel 5.10 发布候选版本的推出,针对 Zen 3 处理器的各种新增功能也在陆续推出。 + +#### Intel Rocket Lake 支持 + +我并不对 Intel 的 Rocket Lake 芯片组在明年 Q1(2021 年)出货报太大希望。但是,考虑到英特尔在不断地压榨 14 纳米制程,看到 Intel Rocket Lake 在 Linux Kernel 5.10 上所做的工作,绝对是一件好事。 + +#### Radeon RX 6000 系列开源驱动 + +尽管我们是在 Big Navi 揭晓前一天才报道的,但 Radeon RX 6000 系列绝对会是一个令人印象深刻的东西,可以和 NVIDIA RTX 3000 系列竞争。 + +当然,除非它和 Vega 系列或 5000 系列遇到的同样问题。 + +很高兴在 Linux Kernel 5.10 上看到下一代 Radeon GPU 的开源驱动已经完成。 + + +#### 文件系统优化和存储改进 + +[Phoronix][6] 报道了 5.10 也对文件系统进行了优化和存储改进。所以,从这一点来看,我们应该会看到一些性能上的改进。 + +#### 其他改进 + +毫无疑问,你应该期待新内核带来大量的驱动更新和硬件支持。 + +目前,对 SoundBlaster AE-7 的支持、对 NVIDIA Orin(AI 处理器)的早期支持以及 Tiger Lake GPU 的改进似乎是主要亮点。 + +Linux Kernel 5.10 的稳定版本应该会在 12 月中旬左右发布。它将被支持至少2年,但可能一直会有安全/bug 修复更新,直到 2026 年。因此,我们将继续关注下一个 Linux Kernel 5.10 LTS 版本的发展,以获得任何令人兴奋的东西。 + +你对即将发布的 Linux Kernel 5.10 有什么看法?请在评论中告诉我们你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/kernel-5-10/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者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/linux-kernel-5-4/ +[2]: https://itsfoss.com/kernel-5-8-release/ +[3]: https://twitter.com/gregkh/status/1320745076566433793?ref_src=twsrc%5Etfw +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/kernel-5-10-release.png?resize=800%2C450&ssl=1 +[5]: https://www.tomsguide.com/news/amd-ryzen-5000-revealed-what-it-means-for-pc-gaming +[6]: https://www.phoronix.com/scan.php?page=article&item=linux-510-features&num=1 From 7c7821b2cae8d4e52b0eebde56b3cc0b3b2a03d6 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 5 Nov 2020 08:54:50 +0800 Subject: [PATCH 0671/1156] translating --- sources/tech/20201103 4 ways to run Kubernetes locally.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201103 4 ways to run Kubernetes locally.md b/sources/tech/20201103 4 ways to run Kubernetes locally.md index b2035519b2..9a5e4c981e 100644 --- a/sources/tech/20201103 4 ways to run Kubernetes locally.md +++ b/sources/tech/20201103 4 ways to run Kubernetes locally.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 98677f87ef18ee2f35ea7bf8dfd2bec63e04d4a7 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 5 Nov 2020 19:19:02 +0800 Subject: [PATCH 0672/1156] PRF --- ...sically a Tiny Computer Inside a Keyboard.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/translated/tech/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md b/translated/tech/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md index 5643313844..7ea0e4c667 100644 --- a/translated/tech/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md +++ b/translated/tech/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard) @@ -10,7 +10,7 @@ 新的树莓派 400:一台藏身于键盘内微型计算机 ====== -树莓派已经无需介绍。起初是 DIY 爱好者的低规格电脑,而现在可以作为全功能桌面使用了。 +树莓派是什么已经无需介绍。这台起初是为 DIY 爱好者打造的低规格电脑,现在可以作为全功能桌面使用了。 随着树莓派 400 的发布,使得它更加适合作为家庭电脑使用。树莓派 400 基本上是一台藏身于键盘内微型计算机。 @@ -20,11 +20,11 @@ ![][2] -它是基于树莓派 4 的(带有 4GB 内存),并已调整为带有冷却器。采用四核处理器,速度比以往更快。 +它是基于树莓派 4 的(带有 4GB 内存),并已调整附加了冷却器。它采用四核处理器,速度比以往更快。 -不仅仅是易用性和便携性,它应该可以为你节省很多桌面空间。而且,就像我一样,如果你打算买一台备用电脑来测试东西,我想我可能会选择树莓派 400,而不是组装另一台 PC 或[基于 Linux 的迷你 PC][3]。 +除了易用性和便携性,它还可以为你节省很多桌面空间。而且,就像我一样,如果你打算买一台备用电脑来测试东西,我想我可能会选择树莓派 400,而不是组装另一台 PC 或[基于 Linux 的迷你 PC][3]。 -尽管我在下面提到了技术规格,但你可以观看官方视频来了解它的外观,以及它所承诺的是否可以满足作为你的家用电脑的需求。 +尽管我在下面提到了它的技术规格,但你可以观看官方视频来了解它的外观,以及它所承诺的是否可以满足作为你的家用电脑的需求。 ![video](https://www.youtube.com/embed/ZSvHJ97d8n8) @@ -45,14 +45,13 @@ * 工作温度:环境温度 0℃ 至 +50℃。 * 最大尺寸 286 毫米 × 122 毫米 × 23 毫米 - ![][4] ### 定价与供应 -付出 **70** 美元,这是你所能得到的最好的现代家用电脑,只需一个键盘就可以简单的携带到任何地方(你只需要一个屏幕连接)。 +这是你付出 **70** 美元,所能得到的最好的现代家用电脑,只需一个键盘就可以简单的携带到任何地方(你只需要一个屏幕连接)。 -你可以花 70 美元只买树莓派 400,也可以花 100 美元买完整的套装,它包括一个 USB 鼠标、micro HDMI 转 HDMI 线、USB-C 电源、一本初学者指南和一张预装了树莓派操作系统的 SD 卡。 +你可以花 70 美元只买树莓派 400,也可以花 100 美元买完整的套装,它还包括一个 USB 鼠标、micro HDMI 转 HDMI 线、USB-C 电源、一本初学者指南和一张预装了树莓派操作系统的 SD 卡。 如果你想知道,对于键盘布局的支持,新闻稿中是这样提到的: @@ -83,7 +82,7 @@ via: https://itsfoss.com/raspberry-pi-400/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From e728cccc2de665e672d6f438e8f0b0859283e7c7 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 5 Nov 2020 19:20:47 +0800 Subject: [PATCH 0673/1156] PUB @wxy https://linux.cn/article-12793-1.html --- ...y Pi 400 is Basically a Tiny Computer Inside a Keyboard.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md (98%) diff --git a/translated/tech/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md b/published/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md similarity index 98% rename from translated/tech/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md rename to published/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md index 7ea0e4c667..1a070873f6 100644 --- a/translated/tech/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md +++ b/published/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12793-1.html) [#]: subject: (The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard) [#]: via: (https://itsfoss.com/raspberry-pi-400/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From 35941d43b455031962c627341b1b3ed828c39d4d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 6 Nov 2020 05:01:41 +0800 Subject: [PATCH 0674/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201106?= =?UTF-8?q?=2011=20Linux=20Distributions=20You=20Can=20Rely=20on=20for=20Y?= =?UTF-8?q?our=20Ancient=2032-bit=20Computer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201106 11 Linux Distributions You Can Rely on for Your Ancient 32-bit Computer.md --- ...ely on for Your Ancient 32-bit Computer.md | 224 ++++++++++++++++++ 1 file changed, 224 insertions(+) create mode 100644 sources/tech/20201106 11 Linux Distributions You Can Rely on for Your Ancient 32-bit Computer.md diff --git a/sources/tech/20201106 11 Linux Distributions You Can Rely on for Your Ancient 32-bit Computer.md b/sources/tech/20201106 11 Linux Distributions You Can Rely on for Your Ancient 32-bit Computer.md new file mode 100644 index 0000000000..54608a245e --- /dev/null +++ b/sources/tech/20201106 11 Linux Distributions You Can Rely on for Your Ancient 32-bit Computer.md @@ -0,0 +1,224 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (11 Linux Distributions You Can Rely on for Your Ancient 32-bit Computer) +[#]: via: (https://itsfoss.com/32-bit-linux-distributions/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +11 Linux Distributions You Can Rely on for Your Ancient 32-bit Computer +====== + +If you’ve been keeping up with the latest [Linux distributions][1], you must have noticed that 32-bit support has been dropped from [most of the popular Linux distributions][2]. Arch Linux, Ubuntu, Fedora, everyone has dropped the support for this older architecture. + +But, what if you have vintage hardware with you that still needs to be revived or you want to make use of it for something? Fret not, there are still a few options left to choose from for your 32-bit system. + +In this article, I’ve tried to compile some of the best Linux distributions that will keep on supporting 32-bit platform for next few years. + +### Top Linux distributions that still offer 32-bit support + +![][3] + +This list is a bit different from [our earlier list of Linux distributions for old laptops][4]. Even 64-bit computers can be considered old if they were released before 2010. This is why some suggestions listed there included distros that only support 64-bit now. + +The information presented here are correct as per my knowledge and findings but if you find otherwise, please let me know in the comment section. + +Before you go on, I suppose you know [how to check if you have a 32 bit or 64 bit computer][5]. + +#### 1\. Debian + +![Image Credits: mrneilypops / Deviantart][6] + +Debian is a fantastic choice for 32-bit systems because they still support it with their latest stable release. At the time of writing this, the latest stable release **Debian 10 “buster”** offers a 32-bit version and is supported until 2024. + +If you’re new to Debian, it is worth mentioning that you get solid documentation for everything on their [official wiki][7]. So, it shouldn’t be an issue to get started. + +You can browse through the [available installers][8] to get it installed. However, before you proceed, I would recommend referring to the list of [things to remember before installing Debian][9] in addition to its [installation manual][10]. + +[Debian][11] + +#### 2\. Slax + +![][12] + +If you just want to quickly boot up a device for some temporary work, Slax is an impressive option. + +It is based on Debian but it aims to be a portable and fast option that is meant to be run through USB devices or DVDs. You can download the 32-bit ISO file from their website for free or purchase a rewritable DVD/encrypted pendrive with Slax pre-installed. + +Of course, this isn’t meant to replace a traditional desktop operating system. But, yes, you do get the 32-bit support with Debian as its base. + +[Slax][13] + +#### 3\. AntiX + +![Image Credits: Opensourcefeed][14] + +Yet another impressive Debian-based distribution. AntiX is popularly known as a systemd-free distribution which focuses on performance while being a lightweight installation. + +It is perfectly suitable for just about any old 32-bit system. To give you an idea, it just needs 256 MB RAM and 2.7 GB storage space at the very least. Not just easy to install, but the user experience is focused for both newbies and experienced users as well. + +You should get the latest version based on Debian’s latest stable branch available. + +[AntiX][15] + +#### 4\. openSUSE + +![][16] + +openSUSE is an independent Linux distribution that supports 32-bit systems as well. Even though the latest regular version (Leap) does not offer 32-bit images, the rolling release edition (Tumbleweed) does provide 32-bit image. + +It will be an entirely different experience if you’re new. However, I suggest you to go through the [reasons why you should be using openSUSE.][17] + +It is mostly focused for developers and system administrators but you can utilize it as an average desktop user as well. It is worth noting that openSUSE is not meant to run on vintage hardware — so you have to make sure that you have at least 2 GB RAM, 40+ GB storage space, and a dual core processor. + +[openSUSE][18] + +#### 5\. Emmabuntüs + +![][19] + +Emmabuntus is an interesting distribution that aims to extend the life of the hardware to reduce waste of raw materials with 32-bit support. As a group they’re also involved in providing computers and digital technologies to schools. + +It offers two different editions, one based on Ubuntu and the other based on Debian. If you want a longer 32-bit support, you may want to go with the Debian edition. It may not be the best option, but with a number of pre-configured software to make the Linux learning experience easy and 32-bit support, it is a decent option if you want to support their cause in the process. + +[Emmanbuntus][20] + +#### 6\. NixOS + +![Nixos KDE Edition \(Image Credits: Distrowatch\)][21] + +NixOS is yet another independent Linux distribution that supports 32-bit systems. It focuses on providing a reliable system where packages are isolated from each other. + +This may not be directly geared towards average users but it is a KDE-powered usable distribution with a unique approach to package management. You can learn more about its [features][22] from its official website. + +[NixOS][23] + +#### 7\. Gentoo Linux + +![][24] + +If you’re an experienced Linux user and looking for a 32-bit Linux distributions, Gentoo Linux should be a great choice. + +You can easily configure, compile, and install a kernel through package manager with Gentoo Linux if you want. Not just limited to its configurability, which it is popularly known for, you will also be able to run it without any issues on older hardware. + +Even if you’re not an experienced user and want to give it a try, simply read through the [installation instructions][25] and you will be in for an adventure. + +[Gentoo Linux][26] + +#### 8\. Devuan + +![][27] + +[Devuan][28] is yet another systemd-free distribution. It is technically a fork of Debian, just without systemd and encouraging [Init freedom][29]. + +It may not be a very popular Linux distribution for an average user but if you want a systemd-free distribution and 32-bit support, Devuan should be a good option. + +[Devuan][30] + +#### 9\. Void Linux + +![][31] + +Void Linux is an interesting distribution independently developed by volunteers. It aims to be a general purpose OS while offering a stable rolling release cycle. It features runit as the init system instead of systemd and gives you the option of several [desktop environments][32]. + +It has an extremely impressive minimum requirement specification with just 96 MB of RAM paired up with Pentium 4 (or equivalent) chip. Try it out! + +[Void Linux][33] + +#### 10\. Q4OS + +![][34] + +Q4OS is another Debian-based distribution that focuses on providing a minimal and fast desktop user experience. It also happens to be one of the [best lightweight Linux distributions][4] in our list. It features the [Trinity desktop][35] for its 32-bit edition and you can find KDE Plasma support on 64-bit version. + +Similar to Void Linux, Q4OS also runs on a bare minimum of at least 128 MB RAM and a 300 MHz CPU with a 3 GB storage space requirement. It should be more than enough for any vintage hardware. So, I’d say, you should definitely try it out! + +To know more about it, you can also check out [our review of Q4OS][36]. + +[Q$OS][37] + +#### 11: MX Linux + +![][38] + +If you’ve got a slightly decent configuration (not completely vintage but old), MX Linux would be my personal recommendation for 32-bit systems. It also happens to be one of the [best Linux distributions][2] for every type of user. + +In general, MX Linux is a fantastic lightweight and customizable distribution based on Debian. You get the option to choose from KDE, XFCE or Fluxbox (which is their own desktop environment for older hardware). You can explore more about it on their official website and give it a try. + +[MX Linux][39] + +### Honorable Mention: Funtoo + +Funtoo is a Gentoo-based community-developed Linux distribution. It focuses on giving you the best performance with Gentoo Linux along with some extra packages to make the experience complete for users. It is also interesting to note that the development is actually led by Gentoo Linux’s creator **Daniel Robbins**. + +Of course, if you’re new to Linux, you may not have the best experience here. But, it does support 32-bit systems and works well across many older Intel/AMD chipsets. Explore more about it on its official website to see if you want to try it out. + +[Funtoo][40] + +### Wrapping Up + +I focused the list on Debian-based and some Independent distributions. However, if you don’t mind long term support and just want to get your hands on a 32-bit supported image, you can try any Ubuntu 18.04 based distributions (or any official flavour) as well. + +At the time of writing this, they just have a few more months of software support left. Hence, I avoided mentioning it as the primary options. But, if you like Ubuntu 18.04 based distros or any of its flavours, you do have options like [LXLE][41], [Linux Lite][42], [Zorin Lite 15][43], and other official flavours. + +Even though most modern desktop operating systems based on Ubuntu have dropped support for 32-bit support. You still have plenty of choices to go with. + +What would you prefer to have on your 32-bit system? Let me know your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/32-bit-linux-distributions/ + +作者:[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/what-is-linux-distribution/ +[2]: https://itsfoss.com/best-linux-distributions/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/32-bit-linux.png?resize=800%2C450&ssl=1 +[4]: https://itsfoss.com/lightweight-linux-beginners/ +[5]: https://itsfoss.com/32-bit-64-bit-ubuntu/ +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/debian-screenshot.png?resize=800%2C450&ssl=1 +[7]: https://wiki.debian.org/FrontPage +[8]: https://www.debian.org/releases/buster/debian-installer/ +[9]: https://itsfoss.com/before-installing-debian/ +[10]: https://www.debian.org/releases/buster/installmanual +[11]: https://www.debian.org/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/slax-screenshot.jpg?resize=800%2C600&ssl=1 +[13]: https://www.slax.org +[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/antiX-19-1.jpg?resize=800%2C500&ssl=1 +[15]: https://antixlinux.com +[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/opensuse-15-1.png?resize=800%2C500&ssl=1 +[17]: https://itsfoss.com/why-use-opensuse/ +[18]: https://www.opensuse.org/ +[19]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/Emmabuntus-xfce.png?resize=800%2C500&ssl=1 +[20]: https://emmabuntus.org/ +[21]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/nixos-kde.jpg?resize=800%2C500&ssl=1 +[22]: https://nixos.org/features.html +[23]: https://nixos.org/ +[24]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/gentoo-linux.png?resize=800%2C450&ssl=1 +[25]: https://www.gentoo.org/get-started/ +[26]: https://www.gentoo.org +[27]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/devuan-beowulf.jpg?resize=800%2C600&ssl=1 +[28]: https://itsfoss.com/devuan-3-release/ +[29]: https://www.devuan.org/os/init-freedom +[30]: https://www.devuan.org +[31]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/void-linux.jpg?resize=800%2C450&ssl=1 +[32]: https://itsfoss.com/best-linux-desktop-environments/ +[33]: https://voidlinux.org/ +[34]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/q4os8Debonaire.jpg?resize=800%2C500&ssl=1 +[35]: https://en.wikipedia.org/wiki/Trinity_Desktop_Environment +[36]: https://itsfoss.com/q4os-linux-review/ +[37]: https://q4os.org/index.html +[38]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/08/mx-linux-19-2-kde.jpg?resize=800%2C452&ssl=1 +[39]: https://mxlinux.org/ +[40]: https://www.funtoo.org/Welcome +[41]: https://www.lxle.net/ +[42]: https://www.linuxliteos.com +[43]: https://zorinos.com/download/15/lite/32/ From 9f0e82a1bafcc563925f0773e7fe4be7f4b78ce5 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 6 Nov 2020 05:01:57 +0800 Subject: [PATCH 0675/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201105?= =?UTF-8?q?=205=20surprising=20ways=20I=20use=20Jupyter=20to=20improve=20m?= =?UTF-8?q?y=20life?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201105 5 surprising ways I use Jupyter to improve my life.md --- ...g ways I use Jupyter to improve my life.md | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 sources/tech/20201105 5 surprising ways I use Jupyter to improve my life.md diff --git a/sources/tech/20201105 5 surprising ways I use Jupyter to improve my life.md b/sources/tech/20201105 5 surprising ways I use Jupyter to improve my life.md new file mode 100644 index 0000000000..3fa9083248 --- /dev/null +++ b/sources/tech/20201105 5 surprising ways I use Jupyter to improve my life.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 surprising ways I use Jupyter to improve my life) +[#]: via: (https://opensource.com/article/20/11/surprising-jupyter) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +5 surprising ways I use Jupyter to improve my life +====== +Jupyter is much more than a data-analysis tool. Learn about some of the +most creative ways you can use the Python-based software. +![Computer laptop in space][1] + +The [Jupyter][2] project offers interactive ways to write software with technology like JupyterLab and Jupyter Notebook. This software is commonly used for data analysis, but what you might not know (and the Jupyter community didn't expect) is how many things you can do with it. + +Here are my top five unexpected and creative ways to use Jupyter. + +### 1\. Manipulate images + +There are great open source tools out there for [image editing and manipulation][3]—from those that rival Photoshop to the experimental work of [Glimpse][4]. Even with all those options, sometimes I just don't want to leave the world of [Python][5]. + +Luckily, Jupyter is a great option for doing light image manipulation. Taking advantage of the fact that Jupyter directly shows [Pillow][6] objects as images lets you experiment with pictures as much as you want. I even used it to [make a coloring book page][7] for my child. + +### 2\. Make an SSH jumpbox remote control + +Since JupyterLab lets you [upload and download][8] files, [edit][9] files, and even [run terminals][10], it has all the pieces necessary to make an SSH jumpbox environment. + +With some SSH-forwarding magic, you can make Jupyter your [remote console][11] on the other side of a firewall. + +### 3\. Develop web applications + +One of my favorite ways to use Jupyter is for an unexpected kind of software development. I [gave a talk][12] where I developed a [web application in real time][13] using a Jupyter notebook. The talk concluded with a simple form that is XSS- and CSS-safe and included some light server-side computation. + +A day-to-day Jupyter user may not expect it to be a great web development environment, but it's a remarkably powerful one. + +### 4\. Pull reports from your favorite services + +Data analysis in JupyterLab is a common use, but what about self-improvement analysis? + +You can use Jupyter to [analyze your calendar][14]. If your favorite services allow API export, or even let you export a CSV, you can correlate those against your calendar. If you find out that you were posting on social media when your calendar said you were supposed to be in a meeting with your manager, however, Jupyter can't do much to help you! + +### 5\. Develop games + +My favorite way to expand the expectations of what I can accomplish in a Jupyter Notebook is by building a game with my child. I wrote about this previously, with a step-by-step tutorial on [writing a game][15] using [PursuedPyBear][16] and Jupyter. + +This iterative approach to game development is especially helpful when trying to figure out game mechanics. It's a game-changer (sorry, I had to) to be able to change the rules mid-game. + +You can even use IPywidgets to modify the numeric parameters, as [this video][17] shows. + +### [Download the eBook][18] + +JupyterLab and Jupyter Notebooks offer an incredible environment for experimenting. [Download this guide][18] that contains tutorials on the surprising ways to use Jupyter.  + +How are you using it in creative ways? Share your favorites in the comments below. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/surprising-jupyter + +作者:[Moshe Zadka][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://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_space_graphic_cosmic.png?itok=wu493YbB (Computer laptop in space) +[2]: https://jupyter.org/ +[3]: https://opensource.com/life/12/6/design-without-debt-five-tools-for-designers +[4]: https://glimpse-editor.github.io/ +[5]: https://opensource.com/resources/python +[6]: https://pillow.readthedocs.io/en/stable/index.html +[7]: https://opensource.com/article/20/8/edit-images-python +[8]: https://jupyterlab.readthedocs.io/en/stable/user/files.html#uploading-and-downloading +[9]: https://jupyterlab.readthedocs.io/en/stable/user/files.html#opening-files +[10]: https://jupyterlab.readthedocs.io/en/stable/user/terminal.html +[11]: https://opensource.com/article/20/8/remote-management-jupyter +[12]: https://opensource.com/article/20/8/write-talk-using-jupyter-notebooks +[13]: https://github.com/moshez/interactive-web-development/blob/e31ae72d8cab7637d18bc734c4e8afc10c60251f/interactive-web-development.ipynb +[14]: https://opensource.com/article/20/9/analyze-your-life-jupyter +[15]: https://opensource.com/article/20/5/python-games +[16]: https://ppb.dev/ +[17]: https://www.youtube.com/watch?v=JaTf_ZT7tE8 +[18]: https://opensource.com/downloads/jupyter-guide From 54d3bbba1d173ab6de949449a0ebd1d63165553a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 6 Nov 2020 05:02:09 +0800 Subject: [PATCH 0676/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201105?= =?UTF-8?q?=20Tweak=20your=20Git=20config=20for=20multiple=20user=20IDs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201105 Tweak your Git config for multiple user IDs.md --- ...k your Git config for multiple user IDs.md | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 sources/tech/20201105 Tweak your Git config for multiple user IDs.md diff --git a/sources/tech/20201105 Tweak your Git config for multiple user IDs.md b/sources/tech/20201105 Tweak your Git config for multiple user IDs.md new file mode 100644 index 0000000000..d0f0a0c35d --- /dev/null +++ b/sources/tech/20201105 Tweak your Git config for multiple user IDs.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Tweak your Git config for multiple user IDs) +[#]: via: (https://opensource.com/article/20/10/git-config) +[#]: author: (Ramanathan M https://opensource.com/users/muthiahramanathan) + +Tweak your Git config for multiple user IDs +====== +Use the same machine for your work and personal Git commits without +manually resetting your config. +![Chat via email][1] + +Git's [git config][2] command (hereafter referred to as "config") enables you to set repository or global options for Git. It has many options, and one of them, `includeIf`, is handy when you have dual roles using Git, for example, working full time as a developer and contributing to open source projects in your spare time. Most people in this situation don't want to use a common config for both roles or, at the very least, would rather keep certain portions of their config distinct, especially if they use the same computer in both roles. + +This is my situation, so I keep two separate sets of mail IDs as part of my Git config. This way, commits in repositories related to projects at my workplace carry my office mail ID, whereas the commits made to repositories hosted in my personal GitHub account use my personal mail ID. + +To illustrate, here is a sample snippet from my global config (maintained at `$HOME/.gitconfig`), which I will describe below. + + +``` +[includeIf "gitdir:~/priv_scm/"] +        path = ~/priv_scm/.gitconfig +[includeIf "gitdir:~/work_scm/"] +        path = ~/work_scm/.gitconfig +``` + +### What's includeIf? + +The `includeIf.condition.path` variable, part of the `include` config directives, allows you to set a custom config conditionally. Also, the path to the custom config can be set as part of the directive. + +This directive supports three keywords: `gitdir`, `gitdir/I`, and `onbranch`. I will briefly explain `gitdir`, which I use in the code snippet above; you can learn about the other two in the [docs][3]. + +Using the `gitdir` keyword in the `includeIf` directive causes a conditional check to be performed on the pattern. Per the rule, if the current working directory matches the specified directory pattern in `gitdir`, then it picks the config from the given path. I'll apply this rule on the config snippet to show how it's evaluated. + +In the config snippet, you can see a simple pattern, `~/`, used along with the `gitdir` keyword. This pattern is substituted with the value stored in the `$HOME` environment variable. + +### How to use it + +If you're using the same system to work on open source projects hosted on GitHub or GitLab and committing to Git repositories at work, you can have two top-level directories, like `$HOME/priv_scm` and `$HOME/work_scm`. Within these two directories, you can have two separate `.gitconfig` files with settings related to your `user.name` and `user.email`. However, they can also be included in a global `.gitconfig` stored at `$HOME` that can hold all the customizations common to both environments. + +Here is a snippet of an example `$HOME/priv_scm/.gitconfig`: + + +``` +$ cat $HOME/priv_scm/.gitconfig +[user] +    name  = Ramanathan Muthiah +    email = <personal-mailid-goes-here> +``` + +With this config in place, you can switch directories and start working on open source projects without resetting some of the config related to Git manually. These changes are handled automatically in the main `.gitconfig` with the aid of the `includeIf` conditional directive. + +### Git tips + +I hope this tip helps you organize your Git projects. What are your favorite Git tips? Share them in the comments! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/git-config + +作者:[Ramanathan M][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://opensource.com/users/muthiahramanathan +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_chat_communication_message.png?itok=LKjiLnQu (Chat via email) +[2]: https://git-scm.com/docs/git-config +[3]: https://git-scm.com/docs/git-config#_conditional_includes From 0943488b3842d4e27a3cfa7edd2f616e7215dd18 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 6 Nov 2020 05:02:22 +0800 Subject: [PATCH 0677/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201105?= =?UTF-8?q?=206=20evening=20rituals=20for=20working=20in=20tech?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201105 6 evening rituals for working in tech.md --- ...5 6 evening rituals for working in tech.md | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 sources/tech/20201105 6 evening rituals for working in tech.md diff --git a/sources/tech/20201105 6 evening rituals for working in tech.md b/sources/tech/20201105 6 evening rituals for working in tech.md new file mode 100644 index 0000000000..6b999b090e --- /dev/null +++ b/sources/tech/20201105 6 evening rituals for working in tech.md @@ -0,0 +1,49 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 evening rituals for working in tech) +[#]: via: (https://opensource.com/article/20/11/evening-rituals-working-tech) +[#]: author: (Jen Wike Huger https://opensource.com/users/jen-wike) + +6 evening rituals for working in tech +====== +After a busy day of virtual meetings, emails, coding, and collaborating, +how do you wind down for the night? +![A farm road][1] + +This strange time has given us, on one hand, the chance to slow down, yet on the other, it's busier than ever. Especially if you have others in your life to care for in addition to yourself. But you can't give from an empty cup, so, this list of evening rituals is focused on what you can do for yourself right after you turn the computer off, shut the laptop, or say goodbye to the last virtual meeting of the day. + +1\. Head to the nearest door and take a big, deep belly breath in... and out. I don't care if it's snowing. Fill your lungs with fresh air. Stay for a while if you can -- take a lap around the yard, or walk down the street and back. + +2\. If you have some time, make a cup of tea -- black (is caffeinated, so beware), green, or herbal -- and, let it cool down while you get your shoes (and maybe a jacket) on. Pop it in a favorite thermos, and take a stroll around your neighborhood. You don't have to have a plan or a place you're walking to. Set a timer for 15 minutes if you only have a short window. + +3\. Turn on a song that pops into your head or the one you didn't get a chance to jam/relax to earlier today. + +4\. If you have some time, stand up and dance it out or lay all the way down with your feet up. No more sitting. Don't think, just listen. Research shows giving your brain blank space helps you think and deal better later. + +5\. Open your [reader app][2] or pick up a book (the latter is easier on your eyes), and fully indulge, letting the day slip away, or give yourself enough time to read at least one chapter. + +6\. Make food that feels good. Maybe that means a few basic ingredients and simple instructions. Maybe that means putting together that new, complex meal you've been excited about since you picked up the items at the grocery store. + +Can you combine some of these to get even more out of your evening ritual time? If you're working in tech, creating rituals like this—whether they're [in the morning][3], middle of your day, or evening—is critical as we live out a new normal working from home, taking meetings virtually, and missing the energy of in-person connections with colleagues.  + +What is your evening ritual? + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/evening-rituals-working-tech + +作者:[Jen Wike Huger][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://opensource.com/users/jen-wike +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDUCATION_jadud_farm-road.png?itok=of8IuSM5 (A farm road) +[2]: https://opensource.com/article/20/2/linux-ebook-readers +[3]: https://opensource.com/article/20/10/tech-morning-rituals From 85de6b016fcb6196f558f9627c98cda9aa516798 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 6 Nov 2020 08:39:53 +0800 Subject: [PATCH 0678/1156] translating --- ...ojects to try in COPR from October 2020.md | 132 ------------------ ...ojects to try in COPR from October 2020.md | 109 +++++++++++++++ 2 files changed, 109 insertions(+), 132 deletions(-) delete mode 100644 sources/tech/20201102 4 cool new projects to try in COPR from October 2020.md create mode 100644 translated/tech/20201102 4 cool new projects to try in COPR from October 2020.md diff --git a/sources/tech/20201102 4 cool new projects to try in COPR from October 2020.md b/sources/tech/20201102 4 cool new projects to try in COPR from October 2020.md deleted file mode 100644 index 80bd6f2f77..0000000000 --- a/sources/tech/20201102 4 cool new projects to try in COPR from October 2020.md +++ /dev/null @@ -1,132 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (4 cool new projects to try in COPR from October 2020) -[#]: via: (https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-from-october-2020/) -[#]: author: (frostyx https://fedoramagazine.org/author/frostyx/) - -4 cool new projects to try in COPR from October 2020 -====== - -![][1] - -COPR is a [collection][2] of personal repositories for software -that isn’t carried in Fedora. Some software doesn’t conform to -standards that allow easy packaging. Or it may not meet other Fedora -standards, despite being free and open-source. COPR can offer these -projects outside the Fedora set of packages. Software in COPR isn’t -supported by Fedora infrastructure or signed by the project. However, -it can be a neat way to try new or experimental software. - -This article presents a few new and interesting projects in COPR. If -you’re new to using COPR, see the [COPR User Documentation][3] -for how to get started. - -### Dialect - -[Dialect][4] translates text to foreign languages using Google Translate. It remembers your translation history and supports features such as automatic language detection and text to speech. The user interface is minimalistic and mimics the Google Translate tool itself, so it is really easy to use. - -![][5] - -#### Installation instructions - -The [repo][6] currently provides Dialect for Fedora 33 and Fedora -Rawhide. To install it, use these commands: - -``` -sudo dnf copr enable lyessaadi/dialect -sudo dnf install dialect -``` - -### GitHub CLI - -[gh][7] is an official GitHub command-line client. It provides fast -access and full control over your project issues, pull requests, and -releases, right in the terminal. Issues (and everything else) can also -be easily viewed in the web browser for a more standard user interface -or sharing with others. - -![][8] - -#### Installation instructions - -The [repo][9] currently provides _gh_ for Fedora 33 and Fedora -Rawhide. To install it, use these commands: - -``` -sudo dnf copr enable jdoss/github-cli -sudo dnf install github-cli -``` - -### Glide - -[Glide][10] is a minimalistic media player based on GStreamer. It -can play both local and remote files in any multimedia format -supported by GStreamer itself. If you are in need of a multi-platform -media player with a simple user interface, you might want to give Glide a try. - -![][11] - -#### Installation instructions - -The [repo][12] currently provides Glide for Fedora 32, 33, and -Rawhide. To install it, use these commands: - -``` -sudo dnf copr enable atim/glide-rs -sudo dnf install glide-rs -``` - -### Vim ALE - -[ALE][13] is a plugin for Vim text editor, providing syntax and -semantic error checking. It also brings support for fixing code and -many other IDE-like features such as TAB-completion, jumping to -definitions, finding references, viewing documentation, etc. - -![][14] - -#### Installation instructions - -The [repo][15] currently provides _vim-ale_ for Fedora 31, -32, 33, and Rawhide, as well as for EPEL8. To install it, use these -commands: - -``` -sudo dnf copr enable praiskup/vim-ale -sudo dnf install vim-ale -``` - -Editors note: Previous COPR articles can be found [here][16]. - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-from-october-2020/ - -作者:[frostyx][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/frostyx/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2017/08/4-copr-945x400.jpg -[2]: https://copr.fedorainfracloud.org/ -[3]: https://docs.pagure.org/copr.copr/user_documentation.html -[4]: https://github.com/gi-lom/dialect -[5]: https://fedoramagazine.org/wp-content/uploads/2020/10/dialect.png -[6]: https://copr.fedorainfracloud.org/coprs/lyessaadi/dialect/ -[7]: https://github.com/cli/cli -[8]: https://fedoramagazine.org/wp-content/uploads/2020/10/github-cli.png -[9]: https://copr.fedorainfracloud.org/coprs/jdoss/github-cli/ -[10]: https://github.com/philn/glide -[11]: https://fedoramagazine.org/wp-content/uploads/2020/10/glide.png -[12]: https://copr.fedorainfracloud.org/coprs/atim/glide-rs/ -[13]: https://github.com/dense-analysis/ale -[14]: https://fedoramagazine.org/wp-content/uploads/2020/10/vim-ale.png -[15]: https://copr.fedorainfracloud.org/coprs/praiskup/vim-ale/ -[16]: https://fedoramagazine.org/?s=COPR diff --git a/translated/tech/20201102 4 cool new projects to try in COPR from October 2020.md b/translated/tech/20201102 4 cool new projects to try in COPR from October 2020.md new file mode 100644 index 0000000000..de7397e856 --- /dev/null +++ b/translated/tech/20201102 4 cool new projects to try in COPR from October 2020.md @@ -0,0 +1,109 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 cool new projects to try in COPR from October 2020) +[#]: via: (https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-from-october-2020/) +[#]: author: (frostyx https://fedoramagazine.org/author/frostyx/) + +COPR 仓库中 4 个很酷的新项目(2020.10) +====== + +![][1] + +COPR 是个人软件仓库[集合][2],它不在 Fedora 中。这是因为某些软件不符合轻松打包的标准;或者它可能不符合其他 Fedora 标准,尽管它是自由而开源的。COPR 可以在 Fedora 套件之外提供这些项目。COPR 中的软件不受 Fedora 基础设施的支持,或者是由项目自己背书的。但是,这是一种尝试新的或实验性的软件的一种巧妙的方式。 + +本文介绍了 COPR 中一些有趣的新项目。如果你第一次使用 COPR,请参阅 [COPR 用户文档][3]。 + +### Dialect + +[Dialect][4] 使用谷歌翻译将文本翻译成外语。它可以记住你的翻译历史,并支持自动语言检测和文本到语音等功能。用户界面简约,模仿谷歌翻译工具本身,所以它真的很容易使用。 + +![][5] + +#### 安装说明 + +目前[仓库][6]在 Fedora 33 和 Fedora Rawhide 中提供了 Dialect。要安装它,请使用下面的命令: + +``` +sudo dnf copr enable lyessaadi/dialect +sudo dnf install dialect +``` + +### GitHub CLI + +[gh][7] 是一个官方的 GitHub 命令行客户端。它在终端提供了快速的访问,并完全控制你的项目问题、拉取请求和发布。问题(和其他东西)也可以在浏览器中轻松查看,以获得更标准的用户界面,或与他人分享。 + +![][8] + +#### 安装说明 + +目前[仓库][9]在 Fedora 33 和 Fedora Rawhide 中提供了 _gh_ 。要安装它,请使用下面的命令: + +``` +sudo dnf copr enable jdoss/github-cli +sudo dnf install github-cli +``` + +### Glide + +[Glide][10] 是一个基于 GStreamer 的极简主义媒体播放器。它可以播放任何 GStreamer 支持的多媒体格式的本地和远程文件。如果你需要一个多平台的具有简单用户界面的媒体播放器,你可能会想试试 Glide。 + +![][11] + +#### 安装说明 + +目前[仓库][12]在 Fedora 32、33 和 Rawhide 中提供了 Glide。要安装它,请使用下面的命令: + +``` +sudo dnf copr enable atim/glide-rs +sudo dnf install glide-rs +``` + +### Vim ALE + +[ALE][13] 是 Vim 文本编辑器的一个插件,它提供了语法和语义错误检查。它还带来了诸如代码修复和许多其他类似于 IDE 的功能,如 TAB 补全、跳转到定义、查找引用、查看文档等。 + +![][14] + +#### 安装说明 + +目前[仓库][15]在 Fedora 31、32、33 和 Rawhide 还有 EPEL8 中提供了 _vim-ale_ 。要安装它,请使用下面的命令: + +``` +sudo dnf copr enable praiskup/vim-ale +sudo dnf install vim-ale +``` + +编者注:可在[此处][16]查阅以前的 COPR 文章。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-from-october-2020/ + +作者:[frostyx][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/frostyx/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2017/08/4-copr-945x400.jpg +[2]: https://copr.fedorainfracloud.org/ +[3]: https://docs.pagure.org/copr.copr/user_documentation.html +[4]: https://github.com/gi-lom/dialect +[5]: https://fedoramagazine.org/wp-content/uploads/2020/10/dialect.png +[6]: https://copr.fedorainfracloud.org/coprs/lyessaadi/dialect/ +[7]: https://github.com/cli/cli +[8]: https://fedoramagazine.org/wp-content/uploads/2020/10/github-cli.png +[9]: https://copr.fedorainfracloud.org/coprs/jdoss/github-cli/ +[10]: https://github.com/philn/glide +[11]: https://fedoramagazine.org/wp-content/uploads/2020/10/glide.png +[12]: https://copr.fedorainfracloud.org/coprs/atim/glide-rs/ +[13]: https://github.com/dense-analysis/ale +[14]: https://fedoramagazine.org/wp-content/uploads/2020/10/vim-ale.png +[15]: https://copr.fedorainfracloud.org/coprs/praiskup/vim-ale/ +[16]: https://fedoramagazine.org/?s=COPR From a3a3d07fe294c689bbcd043cbcac854142fbf63a Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 6 Nov 2020 08:52:50 +0800 Subject: [PATCH 0679/1156] translating --- ...01105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md b/sources/tech/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md index c965d8ee57..bc63527249 100644 --- a/sources/tech/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md +++ b/sources/tech/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 11b28e0dc754b77f07e1f401189552c639753673 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 7 Nov 2020 10:55:05 +0800 Subject: [PATCH 0680/1156] PRF @geekpi --- ...201026 ninja- a simple way to do builds.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/translated/tech/20201026 ninja- a simple way to do builds.md b/translated/tech/20201026 ninja- a simple way to do builds.md index dcfe386a3f..da7f8a3951 100644 --- a/translated/tech/20201026 ninja- a simple way to do builds.md +++ b/translated/tech/20201026 ninja- a simple way to do builds.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (ninja: a simple way to do builds) @@ -27,15 +27,15 @@ done ### 构建系统是让人困惑的 -在过去,我对使用 make 或 bazel 这样的构建系统来做我的小项目一直很反感,因为 bazel 是个大而复杂的东西,而 `make` 对我来说感觉有点神秘。我真的不知道如何使用它们中的任何一个。 +在过去,我对使用 `make` 或 `bazel` 这样的构建系统来做我的小项目一直很反感,因为 `bazel` 是个大而复杂的东西,而 `make` 对我来说感觉有点神秘。我真的不想使用它们中的任何一个。 所以很长时间以来,我只是写了一个 bash 脚本或者其他的东西来进行构建,然后就认命了,有时候只能等一分钟。 -### ninja 是一个非常简单的构建系统 +### ninja 是一个极其简单的构建系统 -但 ninja 并不复杂!以下是我所知道的关于 ninja 构建文件的语法:如何创建一个 `rule `和一个 `build`: +但 `ninja` 并不复杂!以下是我所知道的关于 ninja 构建文件的语法:创建一个 `rule` 和一个 `build`: -`rule` 有一个命令和描述(描述只是给人看的,所以你可以知道它在构建你的代码时在做什么)。 +`rule` 有一个命令(`command`)和描述(`description`)参数(描述只是给人看的,所以你可以知道它在构建你的代码时在做什么)。 ``` rule svg2pdf @@ -55,7 +55,7 @@ Ninja 还有一些更多的功能(见[手册][2]),但我还没有用过。 ### ninja 文件通常是自动生成的 -ninja 的神奇之处在于,你不必使用一些混乱的构建语言,它们很难记住(比如 make),因为你不经常使用它,相反,ninja 语言超级简单,如果你想做一些复杂的事情,那么你只需使用任意编程语言生成你想要的构建文件。 +ninja 的神奇之处在于,你不必使用一些混乱的构建语言,它们很难记住,因为你不经常使用它(比如 `make`),相反,ninja 语言超级简单,如果你想做一些复杂的事情,那么你只需使用任意编程语言生成你想要的构建文件。 我喜欢写一个 `build.py` 文件,或者像这样的文件,创建 ninja 的构建文件,然后运行 `ninja`: @@ -79,11 +79,11 @@ import subprocess subprocess.check_call(['ninja']) ``` -我相信有一堆 ninja 的最佳实践,但我不知道。对于我的小项目而言,我发现它很好用。 +我相信有一堆 `ninja` 的最佳实践,但我不知道。对于我的小项目而言,我发现它很好用。 ### meson 是一个生成 ninja 文件的构建系统 -我对 [Meson][4] 还不太了解,但最近我在构建一个 C 程序 ([plocate][5],一个比 `locate` 更快的替代方案)时,我注意到它有不同的构建说明,而不是通常的 `./configure; make; make install`: +我对 [Meson][4] 还不太了解,但最近我在构建一个 C 程序 ([plocate][5],一个比 `locate` 更快的替代方案)时,我注意到它有不同的构建说明,而不是通常的 `./configure; make; make install`: ``` meson builddir @@ -91,7 +91,7 @@ cd builddir ninja ``` -好像 Meson 是一个 C/C++/Java/Rust/Fortran 的构建系统,可以用 ninja 作为后端。 +看起来 Meson 是一个可以用 ninja 作为后端的 C/C++/Java/Rust/Fortran 构建系统。 ### 就是这些! @@ -104,7 +104,7 @@ via: https://jvns.ca/blog/2020/10/26/ninja--a-simple-way-to-do-builds/ 作者:[Julia Evans][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 967073def7101c5f9d1b87ac28497d33351b8453 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 7 Nov 2020 10:55:33 +0800 Subject: [PATCH 0681/1156] PUB @geekpi https://linux.cn/article-12798-1.html --- .../20201026 ninja- a simple way to do builds.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201026 ninja- a simple way to do builds.md (98%) diff --git a/translated/tech/20201026 ninja- a simple way to do builds.md b/published/20201026 ninja- a simple way to do builds.md similarity index 98% rename from translated/tech/20201026 ninja- a simple way to do builds.md rename to published/20201026 ninja- a simple way to do builds.md index da7f8a3951..43911730e3 100644 --- a/translated/tech/20201026 ninja- a simple way to do builds.md +++ b/published/20201026 ninja- a simple way to do builds.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12798-1.html) [#]: subject: (ninja: a simple way to do builds) [#]: via: (https://jvns.ca/blog/2020/10/26/ninja--a-simple-way-to-do-builds/) [#]: author: (Julia Evans https://jvns.ca/) From e7f1d9425f8a77a42ed72db632dec0f7be564c06 Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Sat, 7 Nov 2020 18:37:35 +0800 Subject: [PATCH 0682/1156] Update 20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md --- ...channel architecture is the best option.md | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/sources/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md b/sources/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md index bbb6d9563f..6eb1516fa4 100644 --- a/sources/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md +++ b/sources/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md @@ -7,59 +7,59 @@ [#]: via: (https://www.networkworld.com/article/3386376/when-wi-fi-is-mission-critical-a-mixed-channel-architecture-is-the-best-option.html#tk.rss_all) [#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/) -When Wi-Fi is mission-critical, a mixed-channel architecture is the best option +当Wi-Fi 成为关键业务时,混合信道架构是最好的多信道选择 ====== ### 当Wi-Fi 成为关键业务时,对于如今的它来说,混合信道架构是最好的多信道选择,但它并不总是最佳的选择。当需要可靠的Wi-Fi时,单信道和混合Aps提供了令人信服的替代方案。 ![Getty Images][1] -I’ve worked with a number of companies that have implemented digital projects only to 我曾与许多实施数字项目的公司合作,结果却发现它们失败了。想法是正确的,施行是健全的,市场机遇也在那里。那薄弱的环节在哪里呢?是Wi-Fi网络。 +我曾与许多实施数字项目的公司合作,结果却发现它们失败了。想法是正确的,施行是健全的,市场机遇也在那里。薄弱的环节在哪里呢?是Wi-Fi网络。 -For example, a large hospital wanted to improve clinician response times to patient alarms by having telemetry information sent to mobile devices. Without the system, the only way a nurse would know about a patient alarm is from an audible alert. And with all the background noise, it’s often tough to discern where noises are coming from. The problem was the Wi-Fi network in the hospital had not been upgraded in years and caused messages to be significantly delayed in their delivery, often taking four to five minutes to deliver. The long delivery times caused a lack of confidence in the system, so many clinicians stopped using it and went back to manual alerting. As a result, the project was considered a failure. +例如,一家大型医院希望通过将遥测信息发送到移动设备,来提高临床医生对患者警报的响应时间。如果没有这个系统,护士了解病人警报的唯一途径就是通过声音警报。在所有嘈杂的背景音中,通常很难分辨噪音来自哪里。问题是这家医院中的Wi-Fi网络已经很多年未升级了,这导致信息传递严重延迟(通常需要4~5分钟)。过长的信息传递导致人们对该系统失去信心,因此许多临床医生停止使用该系统,转而使用手动警报。最终,人们认为这个项目是失败的。 -I’ve seen similar examples in manufacturing, K-12 education, entertainment, and other industries. Businesses are competing on the basis of customer experience, and that’s driven from the ever-expanding, ubiquitous wireless edge. Great Wi-Fi doesn’t necessarily mean market leadership, but bad Wi-Fi will have a negative impact on customers and employees. And in today’s competitive climate, that’s a recipe for disaster. +我曾在制造业、K-12教育、娱乐和其他行业中见过类似的案例。企业竞争的基础是客户体验,而竞争的动力来自不断扩展又无处不在的无线优势。好的 Wi-Fi并不意味着市场领导地位,但是劣质的Wi-Fi将会对客户和员工产生负面影响。而在当今竞争激烈的环境下,这是灾难的根源。 **[ Read also:[Wi-Fi site-survey tips: How to avoid interference, dead spots][2] ]** -## Wi-Fi performance historically inconsistent +## Wi-Fi性能历来不一致 -The problem with Wi-Fi is that it’s inherently flaky. I’m sure everyone reading this has experienced the typical flaws with failed downloads, dropped connections, inconsistent performance, and lengthy wait times to connect to public hot spots. +Wi-Fi的问题在于它本身就很脆弱。我相信每个阅读这篇文章的人都经历过下载失败、连接中断、性能不一致以及连接公用热点的漫长等待时间等缺陷。 -Picture sitting in a conference prior to a keynote address and being able to tweet, send email, browse the web, and do other things with no problem. Then the keynote speaker comes on stage and the entire audiences start snapping pics, uploading those pictures, and streaming things – and the Wi-Fi stops working. I find this to be the norm more than the exception, underscoring the need for [no-compromise Wi-Fi][3]. +想象一下,你坐在一个会议上,在一个主题演讲之前,你可以随意地发推特、发电子邮件、浏览网页以及做其他事情。然后主讲人上台,所有观众开始拍照,上传并流传信息——然后网络崩溃了。我发现这不仅仅是一个例外,更是一种常态,强调了对[不妥协Wi-Fi][3]的需求。 -The question for network professionals is how to get to a place where the Wi-Fi is rock solid 100% of the time. Some say that just beefing up the existing network will do that, and it might, but in some cases, the type of Wi-Fi might not be appropriate. +对于网络技术人员的问题是如何到达一个Wi-Fi一直不间断保持100%的地方。有人说只要加强现存的网络可以做到,这也许可以,但在某些情况下,Wi-Fi的类型可能并不合适。 -The most commonly deployed type of Wi-Fi is multi-channel, also known as micro-cell, where each client connects to the access point (AP) using a radio channel. A high-quality experience is based on two things: good signal strength and minimal interference. Several things can cause interference, such as APs being too close, layout issues, or interference from other equipment. To minimize interference, businesses invest a significant amount of time and money in [site surveys to plan the optimal channel map][2], but even with that’s done well, Wi-Fi glitches can still happen. +最常见的Wi-Fi部署类型是多信道,也称为微蜂窝,每个客户端通过无线信道连接到接入点(AP)。高质量的通话体验基于两点:良好的信号强度和最小的干扰。有几个因素会导致干扰,例如接入点太靠近,布局问题或者来自其他设备的干扰。为了最大程度地减少干扰,企业需要在现场调查中投入大量的时间和资金来规划最佳的信道地图,但即使这些做得很好,Wi-Fi故障仍然可能发生。 [site surveys to plan the optimal channel map][2], but even with that’s done well, Wi-Fi glitches can still happen. **[[Take this mobile device management course from PluralSight and learn how to secure devices in your company without degrading the user experience.][4] ]** -## Multi-channel Wi-Fi not always the best choice +## 多通道Wi-Fi并非总是最佳选择 -For many carpeted offices, multi-channel Wi-Fi is likely to be solid, but there are some environments where external circumstances will impact performance. A good example of this is a multi-tenant building in which there are multiple Wi-Fi networks transmitting on the same channel and interfering with one another. Another example is a hospital where there are many campus workers moving between APs. The client will also try to connect to the best AP, causing the client to continually disconnect and reconnect resulting in dropped sessions. Then there are environments such as schools, airports, and conference facilities where there is a high number of transient devices and multi-channel can struggle to keep up. +对于许多铺着地毯的办公室来说,多通道Wi-Fi可能是可靠的,但在某些环境中,外部环境会影响性能。一个很好的例子是多租户建筑,其中有多个Wi-Fi网络在同一信道上传输并相互干扰。另一个例子是医院,这里有许多工作人员在多个接入点间流动。有并联Wi-Fi网络传输在相同通道并相互干扰。客户端将试图连接到最佳接入点,导致客户端不断断开连接并重新连接,从而导致会话中断。还有一些环境,例如学校、机场和会议设施,那里存在大量的瞬态设备,而多通道则难以跟上。 -## Single channel Wi-Fi offers better reliability but with a performance hit +## 单通道Wi-Fi提供更好的可靠性但与此同时性能会受到影响 -What’s a network manager to do? Is inconsistent Wi-Fi just a fait accompli? Multi-channel is the norm, but it isn’t designed for dynamic physical environments or those where reliable connectivity is a must. +网络管理器要做什么?不一致的Wi-Fi只是一个既定事实吗?多信道是一种标准,但它并非是为动态物理环境或那些需要可靠的连接环境而设计的。 -Several years ago an alternative architecture was proposed that would solve these problems. As the name suggests, “single channel” Wi-Fi uses a single radio channel for all APs in the network. Think of this as being a single Wi-Fi fabric that operates on one channel. With this architecture, the placement of APs is irrelevant because they all utilize the same channel, so they won’t interfere with one another. This has an obvious simplicity advantage, such as if coverage is poor, there’s no reason to do another expensive site survey. Instead, just drop in APs where they are needed. +几年前提出了一项解决这些问题的替代架构。顾名思义,“单信道”Wi-Fi在网络中为所有接入点使用单一的无线频道。可以把它想象成在一个信道上运行的单个Wi-Fi结构。这种架构中,接入点的位置无关紧要,因为他们都利用相同的通道,因此不会互相干扰。这有一个显而易见的简化优势,比如,如果覆盖率很低,那就没有理由再做一次昂贵的现场调查。相反,只需在需要的地方布置接入点就可以了。 -One of the disadvantages of single-channel is that aggregate network throughput was lower than multi-channel because only one channel can be used. This might be fine in environments where reliability trumps performance, but many organizations want both. +单通道的缺点之一是总网络吞吐量低于多通道,因为只能使用一个通道。在可靠性高于性能的环境中,这可能会很好,但许多组织希望二者兼而有之。 -## Hybrid APs offer the best of both worlds +## 混合接入点提供了两全其美的优势 -There has been recent innovation from the manufacturers of single-channel systems that mix channel architectures, creating a “best of both worlds” deployment that offers the throughput of multi-channel with the reliability of single-channel. For example, Allied Telesis offers Hybrid APs that can operate in multi-channel and single-channel mode simultaneously. That means some web clients can be assigned to the multi-channel to have maximum throughput, while others can use single-channel for seamless roaming experience. +单信道系统制造商最近进行了创新,将信道架构混合在一起,创造了一种“两全其美”的部署,可提供多信道的吞吐量和单信道的可靠性。举个例子,安奈特提供了混合接入点,可以同时在多信道和单信道模式下运行。这意味着可以分配一些web客户端到多信道以获得最大的吞吐量,而其他的web客户端则可使用单信道来获得无缝漫游体验。 -A practical use-case of such a mix might be a logistics facility where the office staff uses multi-channel, but the fork-lift operators use single-channel for continuous connectivity as they move throughout the warehouse. +这种混合的实际用例可能是物流设施,办公室工作人员使用多通道,但叉车操作员在整个仓库移动时使用单一通道持续连接。 -Wi-Fi was once a network of convenience, but now it is perhaps the most mission-critical of all networks. A traditional multi-channel system might work, but due diligence should be done to see how it functions under a heavy load. IT leaders need to understand how important Wi-Fi is to digital transformation initiatives and do the proper testing to ensure it’s not the weak link in the infrastructure chain and choose the best technology for today’s environment. +Wi-Fi曾是一个便利的网络,但如今他或许是所有网络中最关键的任务。传统的多信道体系也许可以工作,但应该做一些尽职调查来看看它在重负下如何运转。IT领导者需要了解Wi-Fi对数字转型计划的重要性,并进行适当的测试,以确保它不是基础设施链中的薄弱环节,并为当今环境选择最佳技术。 -**Reviews: 4 free, open-source network monitoring tools:** +**综述:4个免费的开源网络监控工具** - * [Icinga: Enterprise-grade, open-source network-monitoring that scales][5] - * [Nagios Core: Network-monitoring software with lots of plugins, steep learning curve][6] - * [Observium open-source network monitoring tool: Won’t run on Windows but has a great user interface][7] - * [Zabbix delivers effective no-frills network monitoring][8] + * [Icinga:可扩展的企业级开源网络监控][5] + * [Nagios Core: 包含大量插件、陡峭学习曲线的网络监控软件][6] + * [Observium 开源网络监控工具: 无法在Windows系统上运行,但有着出色的用户界面][7] + * [Zabbix 提供有效的网络监控][8] @@ -71,7 +71,7 @@ via: https://www.networkworld.com/article/3386376/when-wi-fi-is-mission-critical 作者:[Zeus Kerravala][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[chenmu-kk](https://github.com/chenmu-kk) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 002bf67d496a8e103aec2b48800d2d5a07a756bd Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Sat, 7 Nov 2020 18:42:52 +0800 Subject: [PATCH 0683/1156] Update and rename sources/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md to translated/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md --- ...itical, a mixed-channel architecture is the best option.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {sources => translated}/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md (94%) diff --git a/sources/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md b/translated/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md similarity index 94% rename from sources/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md rename to translated/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md index 6eb1516fa4..4bdbdc4c27 100644 --- a/sources/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md +++ b/translated/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md @@ -14,7 +14,7 @@ ![Getty Images][1] -我曾与许多实施数字项目的公司合作,结果却发现它们失败了。想法是正确的,施行是健全的,市场机遇也在那里。薄弱的环节在哪里呢?是Wi-Fi网络。 +我曾与许多实施数字项目的公司合作,结果却发现它们失败了。正确的想法,健全地施行,现存地市场机遇。哪里是薄弱的环节?是Wi-Fi网络。 例如,一家大型医院希望通过将遥测信息发送到移动设备,来提高临床医生对患者警报的响应时间。如果没有这个系统,护士了解病人警报的唯一途径就是通过声音警报。在所有嘈杂的背景音中,通常很难分辨噪音来自哪里。问题是这家医院中的Wi-Fi网络已经很多年未升级了,这导致信息传递严重延迟(通常需要4~5分钟)。过长的信息传递导致人们对该系统失去信心,因此许多临床医生停止使用该系统,转而使用手动警报。最终,人们认为这个项目是失败的。 @@ -30,7 +30,7 @@ Wi-Fi的问题在于它本身就很脆弱。我相信每个阅读这篇文章的 对于网络技术人员的问题是如何到达一个Wi-Fi一直不间断保持100%的地方。有人说只要加强现存的网络可以做到,这也许可以,但在某些情况下,Wi-Fi的类型可能并不合适。 -最常见的Wi-Fi部署类型是多信道,也称为微蜂窝,每个客户端通过无线信道连接到接入点(AP)。高质量的通话体验基于两点:良好的信号强度和最小的干扰。有几个因素会导致干扰,例如接入点太靠近,布局问题或者来自其他设备的干扰。为了最大程度地减少干扰,企业需要在现场调查中投入大量的时间和资金来规划最佳的信道地图,但即使这些做得很好,Wi-Fi故障仍然可能发生。 [site surveys to plan the optimal channel map][2], but even with that’s done well, Wi-Fi glitches can still happen. +最常见的Wi-Fi部署类型是多信道,也称为微蜂窝,每个客户端通过无线信道连接到接入点(AP)。高质量的通话体验基于两点:良好的信号强度和最小的干扰。有几个因素会导致干扰,例如接入点太靠近,布局问题或者来自其他设备的干扰。为了最大程度地减少干扰,企业需要投入大量的时间和资金在 [现场调查中规划最佳的信道地图][2],但即使这些做得很好,Wi-Fi故障仍然可能发生。 **[[Take this mobile device management course from PluralSight and learn how to secure devices in your company without degrading the user experience.][4] ]** From fb11fc2d1f885b88838beb159b7c1c163955d2d9 Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Sat, 7 Nov 2020 18:44:33 +0800 Subject: [PATCH 0684/1156] Update 20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md --- ...critical, a mixed-channel architecture is the best option.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md b/translated/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md index 4bdbdc4c27..e0133ea9e9 100644 --- a/translated/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md +++ b/translated/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md @@ -14,7 +14,7 @@ ![Getty Images][1] -我曾与许多实施数字项目的公司合作,结果却发现它们失败了。正确的想法,健全地施行,现存地市场机遇。哪里是薄弱的环节?是Wi-Fi网络。 +我曾与许多实施数字项目的公司合作,结果却发现它们失败了。正确的想法,健全地施行,现存的市场机遇。哪里是薄弱的环节?是Wi-Fi网络。 例如,一家大型医院希望通过将遥测信息发送到移动设备,来提高临床医生对患者警报的响应时间。如果没有这个系统,护士了解病人警报的唯一途径就是通过声音警报。在所有嘈杂的背景音中,通常很难分辨噪音来自哪里。问题是这家医院中的Wi-Fi网络已经很多年未升级了,这导致信息传递严重延迟(通常需要4~5分钟)。过长的信息传递导致人们对该系统失去信心,因此许多临床医生停止使用该系统,转而使用手动警报。最终,人们认为这个项目是失败的。 From cf20d763ceeae41efd0040969cdb809879069f17 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 8 Nov 2020 08:07:53 +0800 Subject: [PATCH 0685/1156] PRF @geekpi --- ...028 What-s new in Fedora 33 Workstation.md | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/translated/tech/20201028 What-s new in Fedora 33 Workstation.md b/translated/tech/20201028 What-s new in Fedora 33 Workstation.md index a181148cac..a8397973c4 100644 --- a/translated/tech/20201028 What-s new in Fedora 33 Workstation.md +++ b/translated/tech/20201028 What-s new in Fedora 33 Workstation.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (What’s new in Fedora 33 Workstation) @@ -12,7 +12,7 @@ Fedora 33 Workstation 的新功能 ![][1] -Fedora 33 Workstation 是我们免费的、领先的操作系统的[最新版本][2]。你现在就可以从[官方网站][3]下载它。Fedora 33 Workstation 中有一些新的和值得注意的变化。请阅读更多如下细节。 +Fedora 33 Workstation 是我们这个免费的、领先的操作系统的[最新版本][2]。你现在就可以从[官方网站][3]下载它。Fedora 33 Workstation 中有一些新的和值得注意的变化。请阅读如下更多细节。 ### GNOME 3.38 @@ -20,13 +20,13 @@ Fedora 33 Workstation 为各类用户提供了最新版本的 GNOME 桌面环境 #### 一个新的 GNOME Tour 应用 -现在,新用户会看到一个“新的 _Tour_ 应用,高亮显示了桌面的主要功能,并为第一次使用 GNOME 的用户提供一个很好的欢迎”。 +现在,新用户会看到一个“新的 Tour 应用,重点展示了桌面的主要功能,并为第一次使用 GNOME 的用户提供一个很好的欢迎页”。 ![The new GNOME Tour application in Fedora 33][4] #### 拖动重排序应用 -GNOME 3.38 用一个单一的可定制和一致的视图取代了之前分开的常用和所有应用视图,这允许你重新排列应用并将它们组织到自定义文件夹中。只需点击并拖动即可移动应用。 +GNOME 3.38 用一个单一的可定制的、一致的视图取代了之前分开的“常用”和“所有”应用视图,这允许你重新排列应用并将它们组织到自定义文件夹中。只需点击并拖动即可移动应用。 ![GNOME 3.38 Drag to Reorder][5] @@ -36,23 +36,17 @@ GNOME Shell 中的屏幕录制基础架构已被改进,以利用 PipeWire 和 GNOME 3.38 还提供了许多额外的功能和改进。查看 [GNOME 3.38 发行说明][6]以获得更多信息。 -* * * - -### B-tree 文件系统 +#### B-tree 文件系统 正如[之前宣布的][7],新安装的 Fedora 33 将默认使用 [Btrfs][8]。每一个新的内核版本都会为 Btrfs 增加一些特性和增强功能。[变更日志][9]有一个完整的总结,它介绍了每个新内核版本给 Btrfs 带来的功能。 -* * * +#### Swap on ZRAM -### Swap on ZRAM +Anaconda 和 Fedora IoT 多年来一直默认使用 swap-on-zram。在 Fedora 33 中,将默认启用 swap-on-zram,而不是交换分区。查看 [Fedora wiki 页面][10]了解更多关于 swap-on-zram 的细节。 -Anaconda 和 Fedora IoT 多年来一直默认使用 swap-on-zram。在 Fedora 33 中,swap-on-zram 将被默认启用,而不是 swap 分区。查看 [Fedora wiki 页面][10]了解更多关于 swap-on-zram 的细节。 +#### 默认使用 Nano -* * * - -### 默认使用 Nano - -新的 Fedora 33 将把 EDITOR 环境变量默认设置为 [_nano_ ][11]。这个变化影响了一些命令行工具,当它们需要用户输入时,会打开一个文本编辑器。在早期的版本中,这个环境变量的默认值并没有被指定,而是由各个应用程序来选择一个默认的编辑器。通常情况下,应用程序会使用 [_vi_][12]作为它们的默认编辑器,因为它是一个小应用,通常在大多数 Unix/Linux 操作系统的基础安装中都可以使用。由于 Fedora 33 的基本安装中包含了 nano,而且 nano 对于初学者来说更加直观,所以 Fedora 33 将默认使用 nano。当然,想要使用 vi 的用户可以在自己的环境中覆盖 EDITOR 变量的值。详见[Fedora修改请求][11]获取更多信息。 +新的 Fedora 33 将把 `EDITOR` 环境变量默认设置为 [nano][11]。这个变化影响了一些命令行工具,当它们需要用户输入时,会打开一个文本编辑器。在早期的版本中,这个环境变量的默认值并没有被指定,而是由各个应用程序来选择一个默认的编辑器。通常情况下,应用程序会使用 [vi][12] 作为它们的默认编辑器,因为它是一个小应用,通常在大多数 Unix/Linux 操作系统的基础安装中都可以使用。由于 Fedora 33 的基本安装中包含了 nano,而且 nano 对于初学者来说更加直观,所以 Fedora 33 将默认使用 nano。当然,想要使用 vi 的用户可以在自己的环境中覆盖 `EDITOR` 变量的值。详见[Fedora 修改请求][11]获取更多信息。 -------------------------------------------------------------------------------- @@ -61,7 +55,7 @@ via: https://fedoramagazine.org/whats-new-fedora-33-workstation/ 作者:[Gregory Bartholomew][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8ad8c757cf5456739db7ee7c839a82da886321a5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 8 Nov 2020 08:08:24 +0800 Subject: [PATCH 0686/1156] PUB @geekpi https://linux.cn/article-12801-1.html --- .../20201028 What-s new in Fedora 33 Workstation.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201028 What-s new in Fedora 33 Workstation.md (98%) diff --git a/translated/tech/20201028 What-s new in Fedora 33 Workstation.md b/published/20201028 What-s new in Fedora 33 Workstation.md similarity index 98% rename from translated/tech/20201028 What-s new in Fedora 33 Workstation.md rename to published/20201028 What-s new in Fedora 33 Workstation.md index a8397973c4..c4027535d2 100644 --- a/translated/tech/20201028 What-s new in Fedora 33 Workstation.md +++ b/published/20201028 What-s new in Fedora 33 Workstation.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12801-1.html) [#]: subject: (What’s new in Fedora 33 Workstation) [#]: via: (https://fedoramagazine.org/whats-new-fedora-33-workstation/) [#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) From 433c096e100303a2759607298633f4513a76d433 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 8 Nov 2020 09:28:52 +0800 Subject: [PATCH 0687/1156] APL --- ...3 Linux Jargon Buster- What are GUI, CLI and TUI in Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201103 Linux Jargon Buster- What are GUI, CLI and TUI in Linux.md b/sources/tech/20201103 Linux Jargon Buster- What are GUI, CLI and TUI in Linux.md index cc4b54ff55..bdef06b9d4 100644 --- a/sources/tech/20201103 Linux Jargon Buster- What are GUI, CLI and TUI in Linux.md +++ b/sources/tech/20201103 Linux Jargon Buster- What are GUI, CLI and TUI in Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From bee0aae904b1208f4bfc3384ee9272fa2cf70693 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 8 Nov 2020 10:08:30 +0800 Subject: [PATCH 0688/1156] TSL&PRF @wxy --- ...ter- What are GUI, CLI and TUI in Linux.md | 102 ------------------ ...ter- What are GUI, CLI and TUI in Linux.md | 102 ++++++++++++++++++ 2 files changed, 102 insertions(+), 102 deletions(-) delete mode 100644 sources/tech/20201103 Linux Jargon Buster- What are GUI, CLI and TUI in Linux.md create mode 100644 translated/tech/20201103 Linux Jargon Buster- What are GUI, CLI and TUI in Linux.md diff --git a/sources/tech/20201103 Linux Jargon Buster- What are GUI, CLI and TUI in Linux.md b/sources/tech/20201103 Linux Jargon Buster- What are GUI, CLI and TUI in Linux.md deleted file mode 100644 index bdef06b9d4..0000000000 --- a/sources/tech/20201103 Linux Jargon Buster- What are GUI, CLI and TUI in Linux.md +++ /dev/null @@ -1,102 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Linux Jargon Buster: What are GUI, CLI and TUI in Linux?) -[#]: via: (https://itsfoss.com/gui-cli-tui/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -Linux Jargon Buster: What are GUI, CLI and TUI in Linux? -====== - -When you start using Linux and follow Linux-based websites and forums, you’ll often come across terms like GUI, CLI and sometimes TUI. - -This chapter of Linux Jargon Buster briefly explains these terms so that you as a (new) Linux user can understand the context better when these acronyms are used. - -To be honest, the terms like GUI, CLI or TUI are not exclusive to Linux. These are generic computing terms and you’ll find them used in non-Linux discussions as well. - -### GUI – Graphical User Interface - -Probably the most common term you’ll across on It’s FOSS. It’s because we focus on desktop Linux users and try to cover the easy to use graphical methods and applications. - -A GUI application or graphical application is basically anything that you can interact with your mouse, touchpad or touch screen. You have icons and other visual notions and you can use your mouse pointer to access the functionalities. - -![GIMP: A GUI app for photo editing][1] - -On Linux, a [desktop environment][2] provides the graphical interface for you to interact with your system. Then you can use GUI applications like GIMP, VLC Firefox, LibreOffice, file manager etc for various tasks. - -GUI has made computing easier for the common users otherwise it would have remained a geek-only zone. - -### CLI – Command Line Interface - -CLI is basically a command line program that accepts inputs to perform a certain function. Basically, any application that you can use via commands in the terminal falls into this category. - -![apt-cache is a CLI tool for interacting with APT cache on Debian-based systems][3] - -Early computers didn’t have mouse to interact with the operating system. You had to do interact with the machine using commands. - -If you think that’s difficult you should know that the earlier computers didn’t even have a screen to see what is being typed on, they had actual paper printer to see their typed commands. I have never used such a computer or seen in my real life. The closest thing I used was the microcontroller kits during my studies. - -![Ken Thompson And Dennis Ritchie Working on developing UNIX operating system on PDP 11 computer. | Image Credit][4] - -Is CLI relevant these days? Absolutely. Commands always have their benefit specially when you are dealing with the core functioning and configuration of the operating system like setting up firewall, managing network or even [package management][5]. - -You may have a GUI-based application to do the same task but commands give you more granular access to those features. In any case, you’ll find that GUI application also interact with the operating system with commands (used in their code). - -![Handbrake GUI app uses FFMPEG CLI tool underneath][6] - -Many popular GUI applications are often based on CLI tools. Take [Handbrake][7] for example. It’s a popular open source media converter and it uses the [FFMPEG command][8] line tool underneath. - -Quite evidently, using command line tools is not as easy as the graphical ones. Don’t worry. Unless you have specific needs, you should be able to use your Linux system graphically. However, knowing the basic Linux commands helps a great deal. - -### TUI – Terminal User Interface (also known as Text-based User Interface) - -This is the most uncommon term of the three. TUI is basically part GUI and part CLI. Confused? Let me explain that for you. - -You already know that early computers used CLI. Before the advent of the actual GUI, the text-based user interface provided a very basic kind of graphical interaction in the terminal. You have more visuals and could use mouse and keyboard to interact with the application. - -![nnn File Browser in terminal][9] - -TUI stands for text-based user interface or terminal user interface. Text-based because primarily, you have a bunch of text on the screen and terminal user interface because they are used only in the terminal. - -TUI applications are not that common but you still have a bunch of them. [Terminal based web browsers][10] are good example of TUI programs. [Terminal-based games][11] also fell in this category. - -![CMUS is terminal based music player][12] - -You may come across TUI when you are [installing multimedia codecs in Ubuntu][13] where you have to accept EULA or make a choice. - -TUI apps are not as user-friendly as GUI applications, and they often have a learning curve involved but they are a bit easier to use than the command line tools. - -**In the end…** - -TUI apps are often also considered as CLI applications because they are restricted to the terminal. In my opinion, it’s up to you if you consider them different from CLI. - -I hope you liked this part of Linux Jargon Buster. If you have any suggestions for topics in this series, please let me know in the comments and I’ll try to cover them in the future. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/gui-cli-tui/ - -作者:[Abhishek Prakash][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/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/04/gimp-2-10-interface.jpg?resize=800%2C450&ssl=1 -[2]: https://itsfoss.com/what-is-desktop-environment/ -[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-search-names-only.png?resize=759%2C209&ssl=1 -[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/Ken_Thompson_and_Dennis_Ritchie_at_PDP-11.jpg?resize=800%2C641&ssl=1 -[5]: https://itsfoss.com/package-manager/ -[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/handbrake.png?resize=800%2C537&ssl=1 -[7]: https://itsfoss.com/handbrake/ -[8]: https://itsfoss.com/ffmpeg/ -[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/nnn-file-browser.jpg?resize=800%2C597&ssl=1 -[10]: https://itsfoss.com/terminal-web-browsers/ -[11]: https://itsfoss.com/best-command-line-games-linux/ -[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/07/cmus-interface.png?resize=734%2C436&ssl=1 -[13]: https://itsfoss.com/install-media-codecs-ubuntu/ diff --git a/translated/tech/20201103 Linux Jargon Buster- What are GUI, CLI and TUI in Linux.md b/translated/tech/20201103 Linux Jargon Buster- What are GUI, CLI and TUI in Linux.md new file mode 100644 index 0000000000..50fade6de8 --- /dev/null +++ b/translated/tech/20201103 Linux Jargon Buster- What are GUI, CLI and TUI in Linux.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux Jargon Buster: What are GUI, CLI and TUI in Linux?) +[#]: via: (https://itsfoss.com/gui-cli-tui/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Linux 黑话解释:什么是 Linux 中的 GUI、CLI 和 TUI? +====== + +当你开始使用 Linux 并关注关于 Linux 的网站和论坛时,你会经常遇到诸如 GUI、CLI 等术语,有时还会遇到 TUI。 + +这一章的 Linux 黑话解释简要解释了这些术语,以便你作为一个(新的)Linux 用户在使用这些缩写词时能够更好地理解上下文。 + +说实话,像 GUI、CLI 或 TUI 这样的术语并不是 Linux 的专属术语。这些都是通用的计算术语,你会发现在非 Linux 的讨论中也会用到它们。 + +### GUI - 图形用户界面Graphical User Interface + +这可能是你在这里最常遇到的词汇。这是因为我们专注于桌面 Linux 用户,并试图涵盖易于使用的图形化方法和应用程序。 + +GUI 应用程序(或图形应用程序)基本上是指任何可以与你的鼠标、触摸板或触摸屏交互的东西。有了图标和其他视觉概念,你可以使用鼠标指针来访问功能。 + +![GIMP:一个用于照片编辑的GUI应用程序][1] + +在 Linux 上,[桌面环境][2]为你提供了与系统交互的图形界面,然后,你可以使用 GUI 应用程序,如 GIMP,VLC、Firefox、LibreOffice、文件管理器等来完成各种任务。 + +GUI 使普通用户的计算机使用变得更加容易,否则它将仍然是一个极客专用区。 + +### CLI - 命令行界面Command Line Interface + +CLI 基本上是一个接受输入来执行某种功能的命令行程序。基本上,任何可以在终端中通过命令使用的应用程序都属于这一类。 + +![apt-cache 是一个 CLI 工具,用于在基于 Debian 的系统上与 APT 缓存交互][3] + +早期的电脑与操作系统交互没有鼠标,你必须使用命令与机器互动。 + +如果你认为这都算困难,那你应该知道,早期的计算机甚至没有一个屏幕可以看到正在输入的东西,他们用实体的纸质打印机看到他们的输入命令。我从来没有用过这样的电脑,也没有在现实生活中看到过。我用过的最接近的东西是学习期间的单片机套件。 + +![肯•汤普森和丹尼斯•里奇在 PDP11 电脑上开发 UNIX 操作系统][4] + +现在的 CLI 还有用吗?当然有。命令总是有它的好处,特别是当你处理操作系统的核心功能和配置时,比如设置防火墙、管理网络甚至[包管理][5]。 + +你可能会有一个基于 GUI 的应用程序来完成同样的任务,但命令可以让你更精细地访问这些功能。在一些情况下,你会发现 GUI 应用程序也会用命令(在它们的代码中使用)与操作系统交互。 + +![Handbrake GUI 应用程序在底层使用 FFMPEG CLI 工具][6] + +许多流行的 GUI 应用程序往往是基于 CLI 工具的。以[Handbrake][7] 为例。这是一个流行的开源媒体转换器,它底层使用的是 [FFMPEG 命令行][8]工具。 + +很明显,使用命令行工具没有图形工具那么简单。不要担心。除非你有特殊需要,否则你应该可以用图形化的方式使用 Linux 系统。然而,了解基本的 Linux 命令会有很大的帮助。 + +### TUI - 终端用户界面Terminal User Interface(也称为基于文本的用户界面Text-based User Interface) + +这是三者中最不常见的名词。TUI 基本上部分是 GUI,部分是 CLI。糊涂了吗?让我为你解释一下。 + +你已经知道,早期的计算机使用 CLI。在实际的 GUI 出现之前,基于文本的用户界面在终端中提供了一种非常基本的图形交互。你会有更多的视觉效果,也可以使用鼠标和键盘与应用程序进行交互。 + +![终端中的 nnn 文件浏览器][9] + +TUI 是基于文本的用户界面或终端用户界面的缩写。“基于文本”这个说法主要是因为你在屏幕上有一堆文本,而“终端用户界面”的说法是因为它们只在终端中使用。 + +TUI 的应用虽然不是那么常见,但你还是有一些的。[基于终端的 Web 浏览器][10]是 TUI 程序的好例子。[基于终端的游戏][11]也属于这一类。 + +![CMUS 是基于终端的音乐播放器][12] + +当你在 [Ubuntu 中安装多媒体编解码器][13]时,你可能会遇到 TUI,你必须接受 EULA 或做出选择。 + +TUI 应用程序不像 GUI 应用程序那样用户友好,它们经常会有学习曲线,但它们比命令行工具更容易使用一些。 + +### 最后…… + +TUI 应用程序通常也被认为是 CLI 应用程序,因为它们被限制在终端上。在我看来,你是否认为它们与 CLI 不同,这取决于你。 + +我希望你喜欢这篇 Linux 黑话解释。如果你对这个系列的主题有什么建议,请在评论中告诉我,我将在以后尽量涵盖它们。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gui-cli-tui/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/04/gimp-2-10-interface.jpg?resize=800%2C450&ssl=1 +[2]: https://itsfoss.com/what-is-desktop-environment/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-search-names-only.png?resize=759%2C209&ssl=1 +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/Ken_Thompson_and_Dennis_Ritchie_at_PDP-11.jpg?resize=800%2C641&ssl=1 +[5]: https://itsfoss.com/package-manager/ +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/handbrake.png?resize=800%2C537&ssl=1 +[7]: https://itsfoss.com/handbrake/ +[8]: https://itsfoss.com/ffmpeg/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/nnn-file-browser.jpg?resize=800%2C597&ssl=1 +[10]: https://itsfoss.com/terminal-web-browsers/ +[11]: https://itsfoss.com/best-command-line-games-linux/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/07/cmus-interface.png?resize=734%2C436&ssl=1 +[13]: https://itsfoss.com/install-media-codecs-ubuntu/ From 0e6a7022c7947ab13158ca26fdbe4143d26ee96d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 8 Nov 2020 10:25:56 +0800 Subject: [PATCH 0689/1156] APL --- ...201105 5 surprising ways I use Jupyter to improve my life.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201105 5 surprising ways I use Jupyter to improve my life.md b/sources/tech/20201105 5 surprising ways I use Jupyter to improve my life.md index 3fa9083248..d694154b5b 100644 --- a/sources/tech/20201105 5 surprising ways I use Jupyter to improve my life.md +++ b/sources/tech/20201105 5 surprising ways I use Jupyter to improve my life.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 3595b49985f6cf595f2686b8aaca68e8e54223eb Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 8 Nov 2020 11:04:25 +0800 Subject: [PATCH 0690/1156] TSL&PRF @wxy --- ...g ways I use Jupyter to improve my life.md | 88 ------------------ ...g ways I use Jupyter to improve my life.md | 89 +++++++++++++++++++ 2 files changed, 89 insertions(+), 88 deletions(-) delete mode 100644 sources/tech/20201105 5 surprising ways I use Jupyter to improve my life.md create mode 100644 translated/tech/20201105 5 surprising ways I use Jupyter to improve my life.md diff --git a/sources/tech/20201105 5 surprising ways I use Jupyter to improve my life.md b/sources/tech/20201105 5 surprising ways I use Jupyter to improve my life.md deleted file mode 100644 index d694154b5b..0000000000 --- a/sources/tech/20201105 5 surprising ways I use Jupyter to improve my life.md +++ /dev/null @@ -1,88 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (5 surprising ways I use Jupyter to improve my life) -[#]: via: (https://opensource.com/article/20/11/surprising-jupyter) -[#]: author: (Moshe Zadka https://opensource.com/users/moshez) - -5 surprising ways I use Jupyter to improve my life -====== -Jupyter is much more than a data-analysis tool. Learn about some of the -most creative ways you can use the Python-based software. -![Computer laptop in space][1] - -The [Jupyter][2] project offers interactive ways to write software with technology like JupyterLab and Jupyter Notebook. This software is commonly used for data analysis, but what you might not know (and the Jupyter community didn't expect) is how many things you can do with it. - -Here are my top five unexpected and creative ways to use Jupyter. - -### 1\. Manipulate images - -There are great open source tools out there for [image editing and manipulation][3]—from those that rival Photoshop to the experimental work of [Glimpse][4]. Even with all those options, sometimes I just don't want to leave the world of [Python][5]. - -Luckily, Jupyter is a great option for doing light image manipulation. Taking advantage of the fact that Jupyter directly shows [Pillow][6] objects as images lets you experiment with pictures as much as you want. I even used it to [make a coloring book page][7] for my child. - -### 2\. Make an SSH jumpbox remote control - -Since JupyterLab lets you [upload and download][8] files, [edit][9] files, and even [run terminals][10], it has all the pieces necessary to make an SSH jumpbox environment. - -With some SSH-forwarding magic, you can make Jupyter your [remote console][11] on the other side of a firewall. - -### 3\. Develop web applications - -One of my favorite ways to use Jupyter is for an unexpected kind of software development. I [gave a talk][12] where I developed a [web application in real time][13] using a Jupyter notebook. The talk concluded with a simple form that is XSS- and CSS-safe and included some light server-side computation. - -A day-to-day Jupyter user may not expect it to be a great web development environment, but it's a remarkably powerful one. - -### 4\. Pull reports from your favorite services - -Data analysis in JupyterLab is a common use, but what about self-improvement analysis? - -You can use Jupyter to [analyze your calendar][14]. If your favorite services allow API export, or even let you export a CSV, you can correlate those against your calendar. If you find out that you were posting on social media when your calendar said you were supposed to be in a meeting with your manager, however, Jupyter can't do much to help you! - -### 5\. Develop games - -My favorite way to expand the expectations of what I can accomplish in a Jupyter Notebook is by building a game with my child. I wrote about this previously, with a step-by-step tutorial on [writing a game][15] using [PursuedPyBear][16] and Jupyter. - -This iterative approach to game development is especially helpful when trying to figure out game mechanics. It's a game-changer (sorry, I had to) to be able to change the rules mid-game. - -You can even use IPywidgets to modify the numeric parameters, as [this video][17] shows. - -### [Download the eBook][18] - -JupyterLab and Jupyter Notebooks offer an incredible environment for experimenting. [Download this guide][18] that contains tutorials on the surprising ways to use Jupyter.  - -How are you using it in creative ways? Share your favorites in the comments below. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/11/surprising-jupyter - -作者:[Moshe Zadka][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://opensource.com/users/moshez -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_space_graphic_cosmic.png?itok=wu493YbB (Computer laptop in space) -[2]: https://jupyter.org/ -[3]: https://opensource.com/life/12/6/design-without-debt-five-tools-for-designers -[4]: https://glimpse-editor.github.io/ -[5]: https://opensource.com/resources/python -[6]: https://pillow.readthedocs.io/en/stable/index.html -[7]: https://opensource.com/article/20/8/edit-images-python -[8]: https://jupyterlab.readthedocs.io/en/stable/user/files.html#uploading-and-downloading -[9]: https://jupyterlab.readthedocs.io/en/stable/user/files.html#opening-files -[10]: https://jupyterlab.readthedocs.io/en/stable/user/terminal.html -[11]: https://opensource.com/article/20/8/remote-management-jupyter -[12]: https://opensource.com/article/20/8/write-talk-using-jupyter-notebooks -[13]: https://github.com/moshez/interactive-web-development/blob/e31ae72d8cab7637d18bc734c4e8afc10c60251f/interactive-web-development.ipynb -[14]: https://opensource.com/article/20/9/analyze-your-life-jupyter -[15]: https://opensource.com/article/20/5/python-games -[16]: https://ppb.dev/ -[17]: https://www.youtube.com/watch?v=JaTf_ZT7tE8 -[18]: https://opensource.com/downloads/jupyter-guide diff --git a/translated/tech/20201105 5 surprising ways I use Jupyter to improve my life.md b/translated/tech/20201105 5 surprising ways I use Jupyter to improve my life.md new file mode 100644 index 0000000000..15ba339821 --- /dev/null +++ b/translated/tech/20201105 5 surprising ways I use Jupyter to improve my life.md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 surprising ways I use Jupyter to improve my life) +[#]: via: (https://opensource.com/article/20/11/surprising-jupyter) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +5 种令人惊讶的使用 Jupyter 的方式 +====== + +> Jupyter 不仅仅是一个数据分析工具,让我们看看如何以最有创意的方式使用这个基于 Python 的软件。 + +!["太空中的电脑笔记本"[1] + +[Jupyter][2] 项目提供了用 JupyterLab 和 Jupyter Notebook 等交互式编写软件的技术方式。这个软件通常用于数据分析,但你可能不知道(Jupyter 社区也没有想到),你可以用它做多少事情。 + +以下是我使用 Jupyter 的五大意想不到的创造性方法。 + +### 1、处理图像 + +在[图像编辑和处理][3]方面,有很多很好的开源工具 —— 从那些可以与 Photoshop 媲美的工具到实验性的 [Glimpse][4]。但即使有这么多选择,有时我还是不想离开 [Python][5] 的世界。 + +幸运的是,Jupyter 是一个做轻量级图像处理的好选择。利用 Jupyter 直接将 [Pillow][6] 对象显示为图像的优势,让你可以尽情地对图片进行实验。我甚至还用它给孩子[做了一个涂色画][7]。 + +### 2、做一个 SSH 跳板遥控器 + +由于 JupyterLab 可以让你[上传和下载][8]文件、[编辑][9]文件,甚至[运行终端][10],所以它拥有制作 SSH 跳板环境所需的所有部件。 + +通过一些 SSH 转发魔法,你可以让 Jupyter 成为防火墙另一边的[远程控制台][11]。 + +### 3、开发 Web 应用程序 + +我最喜欢的使用 Jupyter 的方式之一是用于一种意想不到的软件开发。我[做了一次演讲][12],在演讲中,我使用 Jupyter Notebook 实时开发了一个 [Web 应用][13]。讲演的最后是一个简单的表单,它是 XSS 和 CSS 安全的,并包括一些轻量级的服务器端计算。 + +一个日常的 Jupyter 用户可能不会期望它是一个最棒的 Web 开发环境,但它是一个非常强大的环境。 + +### 4、从你喜欢的服务中提取报告 + +JupyterLab 中的数据分析是一种常见的用法,但自我提升分析self-improvement analysis呢? + +你可以使用 Jupyter 来[分析你的日历][14]。如果你最喜欢的服务允许 API 导出,甚至可以让你导出一个 CSV,你可以将这些与你的日历进行关联。如果你发现你在社交媒体上发帖的时候,你的日历上写着你应该和你的经理开会,那 Jupyter 也救不了你! + +### 5、开发游戏 + +对于扩大对 Jupyter Notebook 的期望值,我最喜欢的方式是和孩子一起建立一个游戏。我之前写过这方面的文章,有一个使用 [PursuedPyBear][16] 和 Jupyter [编写游戏][15]的分步教程。 + +在试图弄清游戏机制时,这种迭代式的游戏开发方法特别有用。能够在游戏中途改变规则(对不起,我必须得这样做)是一个改变游戏规则的方法。 + +你甚至可以使用 IPywidgets 来修改数字参数,就像[这个视频][17]所示。 + +### 下载电子书 + +JupyterLab 和 Jupyter Notebooks 提供了一个不可思议的实验环境。[下载这本指南][18],其中包含了以令人吃惊的方式使用 Jupyter 的教程。  + +你是如何以创造性的方式使用它的?在下面的评论中分享你的最爱。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/surprising-jupyter + +作者:[Moshe Zadka][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://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_space_graphic_cosmic.png?itok=wu493YbB (Computer laptop in space) +[2]: https://jupyter.org/ +[3]: https://opensource.com/life/12/6/design-without-debt-five-tools-for-designers +[4]: https://glimpse-editor.github.io/ +[5]: https://opensource.com/resources/python +[6]: https://pillow.readthedocs.io/en/stable/index.html +[7]: https://opensource.com/article/20/8/edit-images-python +[8]: https://jupyterlab.readthedocs.io/en/stable/user/files.html#uploading-and-downloading +[9]: https://jupyterlab.readthedocs.io/en/stable/user/files.html#opening-files +[10]: https://jupyterlab.readthedocs.io/en/stable/user/terminal.html +[11]: https://opensource.com/article/20/8/remote-management-jupyter +[12]: https://opensource.com/article/20/8/write-talk-using-jupyter-notebooks +[13]: https://github.com/moshez/interactive-web-development/blob/e31ae72d8cab7637d18bc734c4e8afc10c60251f/interactive-web-development.ipynb +[14]: https://opensource.com/article/20/9/analyze-your-life-jupyter +[15]: https://opensource.com/article/20/5/python-games +[16]: https://ppb.dev/ +[17]: https://www.youtube.com/watch?v=JaTf_ZT7tE8 +[18]: https://opensource.com/downloads/jupyter-guide From 39fa1bbedaedfb67a935a20831ffbbd7a8fe39b4 Mon Sep 17 00:00:00 2001 From: "Xiaobin.Liu" Date: Sun, 8 Nov 2020 15:02:35 +0800 Subject: [PATCH 0691/1156] TSL --- ...with this MariaDB and MySQL cheat sheet.md | 389 ------------------ ...with this MariaDB and MySQL cheat sheet.md | 389 ++++++++++++++++++ 2 files changed, 389 insertions(+), 389 deletions(-) delete mode 100644 sources/tech/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md create mode 100644 translated/tech/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md diff --git a/sources/tech/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md b/sources/tech/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md deleted file mode 100644 index b68e42e455..0000000000 --- a/sources/tech/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md +++ /dev/null @@ -1,389 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lxbwolf) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Improve your database knowledge with this MariaDB and MySQL cheat sheet) -[#]: via: (https://opensource.com/article/20/10/mariadb-mysql-cheat-sheet) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Improve your database knowledge with this MariaDB and MySQL cheat sheet -====== -Read this article and download our free cheat sheet to get started using -an open source database. -![Cheat Sheet cover image][1] - -When you're writing an application or configuring one for a server, eventually, you will need to store persistent information. Sometimes, a configuration file, such as an INI or [YAML][2] file will do. Other times, a custom file format designed in XML or JSON or similar is better. - -But sometimes you need something that can validate input, search through information quickly, make connections between related data, and generally handle your users' work adeptly. That's what a database is designed to do, and [MariaDB][3] (a fork of [MySQL][4] by some of its original developers) is a great option. I use MariaDB in this article, but the information applies equally to MySQL. - -It's common to interact with a database through programming languages. For this reason, there are [SQL][5] libraries for Java, Python, Lua, PHP, Ruby, C++, and many others. However, before using these libraries, it helps to have an understanding of what's happening with the database engine and why your choice of database is significant. This article introduces MariaDB and the `mysql` command to familiarize you with the basics of how a database handles data. - -If you don't have MariaDB yet, follow the instructions in my article about [installing MariaDB on Linux][6]. If you're not on Linux, use the instructions provided on the MariaDB [download page][7]. - -### Interact with MariaDB - -You can interact with MariaDB using the `mysql` command. First, verify that your server is up and running using the `ping` subcommand, entering your MariaDB password when prompted: - - -``` -$ mysqladmin -u root -p ping -Enter password: -mysqld is alive -``` - -To make exploring SQL easy, open an interactive MariaDB session: - - -``` -$ mysql -u root -p -Enter password: -Welcome to the MariaDB monitor. -Commands end with ; or \g. -[...] -Type 'help;' or '\h' for help. -Type '\c' to clear the current input statement. - -MariaDB [(none)]> -``` - -This places you in a MariaDB subshell, and your prompt is now a MariaDB prompt. Your usual Bash commands don't work here. You must use MariaDB commands. To see a list of MariaDB commands, type `help` (or just `?`). These are administrative commands for your MariaDB shell, so they're useful for customizing your shell, but they aren't part of the SQL language. - -### Learn SQL basics - -The [Structured Query Language (SQL)][8] is named after what it provides: a method to inquire about the contents of a database in a predictable and consistent syntax in order to receive useful results. SQL reads a lot like an ordinary English sentence, if a little robotic. For instance, if you've signed into a database server and you need to understand what you have to work with, type `SHOW DATABASES;` and press Enter for the results. - -SQL commands are terminated with a semicolon. If you forget the semicolon, MariaDB assumes you want to continue your query on the next line, where you can either do so or terminate the query with a semicolon. - - -``` -MariaDB [(NONE)]> SHOW DATABASES; -+--------------------+ -| DATABASE           | -+--------------------+ -| information_schema | -| mysql              | -| performance_schema | -| test               | -+--------------------+ -4 ROWS IN SET (0.000 sec) -``` - -This shows there are four databases present: information_schema, mysql, performance_schema, and test. To issue queries to a database, you must select which database you want MariaDB to use. This is done with the MariaDB command `use`. Once you choose a database, your MariaDB prompt changes to reflect the active database. - - -``` -MariaDB [(NONE)]> USE test; -MariaDB [(test)]> -``` - -#### Show database tables - -Databases contain _tables_, which can be visualized in the same way a spreadsheet is: as a series of rows (called _records_ in a database) and columns. The intersection of a row and a column is called a _field_. - -To see the tables available in a database (you can think of them as tabs in a multi-sheet spreadsheet), use the SQL keyword `SHOW` again: - - -``` -MariaDB [(test)]> SHOW TABLES; -empty SET -``` - -The `test` database doesn't have much to look at, so use the `use` command to switch to the `mysql` database. - - -``` -MariaDB [(test)]> USE mysql; -MariaDB [(mysql)]> SHOW TABLES; - -+---------------------------+ -| Tables_in_mysql           | -+---------------------------+ -| column_stats              | -| columns_priv              | -| db                        | -[...] -| time_zone_transition_type | -| transaction_registry      | -| USER                      | -+---------------------------+ -31 ROWS IN SET (0.000 sec) -``` - -There are a lot more tables in this database! The `mysql` database is the system management database for this MariaDB instance. It contains important data, including an entire user structure to manage database privileges. It's an important database, and you don't always have to interact with it directly, but it's not uncommon to manipulate it in SQL scripts. It's also useful to understand the `mysql` database when you're learning MariaDB because it can help demonstrate some basic SQL commands. - -#### Examine a table - -The last table listed in this instance's `mysql` database is titled `user`. This table contains data about users permitted to access the database. Right now, there's only a root user, but you can add other users with varying privileges to control whether each user can view, update, or create data. To get an idea of all the attributes a MariaDB user can have, you can view column headers in a table: - - -``` -> SHOW COLUMNS IN USER; -MariaDB [mysql]> SHOW COLUMNS IN USER; -+-------------+---------------+------+-----+----------+ -| FIELD       | TYPE          | NULL | KEY | DEFAULT  | -+-------------+---------------+------+-----+----------+ -| Host        | CHAR(60)      | NO   | PRI |          | -| USER        | CHAR(80)      | NO   | PRI |          | -| Password    | CHAR(41)      | NO   |     |          | -| Select_priv | enum('N','Y') | NO   |     | N        | -| Insert_priv | enum('N','Y') | NO   |     | N        | -| Update_priv | enum('N','Y') | NO   |     | N        | -| Delete_priv | enum('N','Y') | NO   |     | N        | -| Create_priv | enum('N','Y') | NO   |     | N        | -| Drop_priv   | enum('N','Y') | NO   |     | N        | -[...] -47 ROWS IN SET (0.001 sec) -``` - -#### Create a new user - -Whether you need help from a fellow human to administer a database or you're setting up a database for a computer to use (for example, in a WordPress, Drupal, or Joomla installation), it's common to need an extra user account within MariaDB. You can create a MariaDB user either by adding it to the `user` table in the `mysql` database, or you can use the SQL keyword `CREATE` to prompt MariaDB to do it for you. The latter features some helper functions so that you don't have to generate all the information manually: - - -``` -`> CREATE USER 'tux'@'localhost' IDENTIFIED BY 'really_secure_password';` -``` - -#### View table fields - -You can view fields and values in a database table with the `SELECT` keyword. In this example, you created a user called `tux`, so select the columns in the `user` table: - - -``` -> SELECT USER,host FROM USER; -+------+------------+ -| USER | host       | -+------+------------+ -| root | localhost  | -[...] -| tux  | localhost  | -+------+------------+ -7 ROWS IN SET (0.000 sec) -``` - -#### Grant privileges to a user - -By looking at the column listing on the `user` table, you can explore a user's status. For instance, the new user `tux` doesn't have permission to do anything with the database. Using the `WHERE` statement, you can view only the record for `tux`: - - -``` -> SELECT USER,select_priv,insert_priv,update_priv FROM USER WHERE USER='tux'; -+------+-------------+-------------+-------------+ -| USER | select_priv | insert_priv | update_priv | -+------+-------------+-------------+-------------+ -| tux  | N           | N           | N           | -+------+-------------+-------------+-------------+ -``` - -Use the `GRANT` command to modify user permissions: - - -``` -> GRANT SELECT ON *.* TO 'tux'@'localhost'; -> FLUSH PRIVILEGES; -``` - -Verify your change: - - -``` -> SELECT USER,select_priv,insert_priv,update_priv FROM USER WHERE USER='tux'; -+------+-------------+-------------+-------------+ -| USER | select_priv | insert_priv | update_priv | -+------+-------------+-------------+-------------+ -| tux  | Y           | N           | N           | -+------+-------------+-------------+-------------+ -``` - -User `tux` now has privileges to select records from all tables. - -### Create a custom database - -So far, you've interacted just with the default databases. Most people rarely interact much with the default databases outside of user management. Usually, you create a database and populate it with tables full of custom data. - -#### Create a MariaDB database - -You may already be able to guess how to create a new database in MariaDB. It's a lot like creating a new user: - - -``` -> CREATE DATABASE example; -Query OK, 1 ROW affected (0.000 sec) -> SHOW DATABASES; -+--------------------+ -| DATABASE           | -+--------------------+ -| example            | -[...] -``` - -Make this new database your active one with the `use` command: - - -``` -`> USE example;` -``` - -#### Create a table - -Creating a table is more complex than creating a database because you must define column headings. MariaDB provides many convenience functions for you to use when creating columns, including data type definitions, automatic incrementing options, constraints to avoid empty values, automated timestamps, and more. - -Here's a simple table to describe a set of users: - - -``` -> CREATE TABLE IF NOT EXISTS member ( -    -> id INT AUTO_INCREMENT PRIMARY KEY, -    -> name VARCHAR(128) NOT NULL, -    -> startdate TIMESTAMP DEFAULT CURRENT_TIMESTAMP); -Query OK, 0 ROWS affected (0.030 sec) -``` - -This table provides a unique identifier to each row by using an auto-increment function. It contains a field for a user's name, which cannot be empty (or `null`), and generates a timestamp when the record is created. - -Populate this table with some sample data using the `INSERT` SQL keyword: - - -``` -> INSERT INTO member (name) VALUES ('Alice'); -Query OK, 1 ROW affected (0.011 sec) -> INSERT INTO member (name) VALUES ('Bob'); -Query OK, 1 ROW affected (0.011 sec) -> INSERT INTO member (name) VALUES ('Carol'); -Query OK, 1 ROW affected (0.011 sec) -> INSERT INTO member (name) VALUES ('David'); -Query OK, 1 ROW affected (0.011 sec) -``` - -Verify the data in the table: - - -``` -> SELECT * FROM member; -+----+-------+---------------------+ -| id | name  | startdate           | -+----+-------+---------------------+ -|  1 | Alice | 2020-10-03 15:25:06 | -|  2 | Bob   | 2020-10-03 15:26:43 | -|  3 | Carol | 2020-10-03 15:26:46 | -|  4 | David | 2020-10-03 15:26:51 | -+----+-------+---------------------+ -4 ROWS IN SET (0.000 sec) -``` - -#### Add multiple rows at once - -Now create a second table: - - -``` -> CREATE TABLE IF NOT EXISTS linux ( -    -> id INT AUTO_INCREMENT PRIMARY KEY, -    -> distro VARCHAR(128) NOT NULL, -Query OK, 0 ROWS affected (0.030 sec) -``` - -Populate it with some sample data, this time using a little `VALUES` shortcut so you can add multiple rows in one command. The `VALUES` keyword expects a list in parentheses, but it can take multiple lists separated by commas: - - -``` -> INSERT INTO linux (distro) - -> VALUES ('Slackware'), ('RHEL'),('Fedora'),('Debian'); -Query OK, 4 ROWS affected (0.011 sec) -Records: 4  Duplicates: 0  Warnings: 0 -> SELECT * FROM linux; -+----+-----------+ -| id | distro    | -+----+-----------+ -|  1 | Slackware | -|  2 | RHEL      | -|  3 | Fedora    | -|  4 | Debian    | -+----+-----------+ -``` - -### Create relationships between tables - -You now have two tables, but there's no relationship between them. They each contain independent data, but you might need to associate a member of the first table to a specific item listed in the second. - -To do that, you can create a new column for the first table that corresponds to something in the second. Because both tables were designed with unique identifiers (the auto-incrementing `id` field), the easiest way to connect them is to use the `id` field of one as a selector for the other. - -Create a new column in the first table to represent a value in the second table: - - -``` -> ALTER TABLE member ADD COLUMN (os INT); -Query OK, 0 ROWS affected (0.012 sec) -Records: 0  Duplicates: 0  Warnings: 0 -> DESCRIBE member; -DESCRIBE member; -+-----------+--------------+------+-----+---------+------+ -| FIELD     | TYPE         | NULL | KEY | DEFAULT | Extra| -+-----------+--------------+------+-----+---------+------+ -| id        | INT(11)      | NO   | PRI | NULL    | auto_| -| name      | VARCHAR(128) | NO   |     | NULL    |      | -| startdate | TIMESTAMP    | NO   |     | cur[...]|      | -| os        | INT(11)      | YES  |     | NULL    |      | -+-----------+--------------+------+-----+---------+------+ -``` - -Using the unique IDs of the `linux` table, assign a distribution to each member. Because the records already exist, use the `UPDATE` SQL keyword rather than `INSERT`. Specifically, you want to select one row and then update the value of one column. Syntactically, this is expressed a little in reverse, with the update happening first and the selection matching last: - - -``` -> UPDATE member SET os=1 WHERE name='Alice'; -Query OK, 1 ROW affected (0.007 sec) -ROWS matched: 1  Changed: 1  Warnings: 0 -``` - -Repeat this process for the other names in the `member` table to populate it with data. For variety, assign three different distributions across the four rows (doubling up on one). - -#### Join tables - -Now that these two tables relate to one another, you can use SQL to display the associated data. There are many kinds of joins in databases, and you can try them all once you know the basics. Here's a basic join to correlate the values found in the `os` field of the `member` table to the `id` field of the `linux` table: - - -``` -SELECT * FROM member JOIN linux ON member.os=linux.id; -+----+-------+---------------------+------+----+-----------+ -| id | name  | startdate           | os   | id | distro    | -+----+-------+---------------------+------+----+-----------+ -|  1 | Alice | 2020-10-03 15:25:06 |    1 |  1 | Slackware | -|  2 | Bob   | 2020-10-03 15:26:43 |    3 |  3 | Fedora    | -|  4 | David | 2020-10-03 15:26:51 |    3 |  3 | Fedora    | -|  3 | Carol | 2020-10-03 15:26:46 |    4 |  4 | Debian    | -+----+-------+---------------------+------+----+-----------+ -4 ROWS IN SET (0.000 sec) -``` - -The `os` and `id` fields form the join. - -In a graphical application, you can imagine that the `os` field might be set by a drop-down menu, the values for which are drawn from the contents of the `distro` field of the `linux` table. By using separate tables for unique but related sets of data, you ensure the consistency and validity of data, and thanks to SQL, you can associate them dynamically later. - -### [Download the MariaDB and MySQL cheat sheet][9] - -MariaDB is an enterprise-grade database. It's designed and proven to be a robust, powerful, and fast database engine. Learning it is a great step toward using it to do things like managing web applications or programming language libraries. As a quick reference when you're using MariaDB, [download our MariaDB and MySQL cheat sheet][9]. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/10/mariadb-mysql-cheat-sheet - -作者:[Seth Kenlon][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://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coverimage_cheat_sheet.png?itok=lYkNKieP (Cheat Sheet cover image) -[2]: https://www.redhat.com/sysadmin/yaml-tips -[3]: https://mariadb.org/ -[4]: https://www.mysql.com/ -[5]: https://en.wikipedia.org/wiki/SQL -[6]: https://opensource.com/article/20/10/install-mariadb-and-mysql-linux -[7]: https://mariadb.org/download -[8]: https://publications.opengroup.org/c449 -[9]: https://opensource.com/downloads/mariadb-mysql-cheat-sheet diff --git a/translated/tech/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md b/translated/tech/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md new file mode 100644 index 0000000000..a3e1c0b339 --- /dev/null +++ b/translated/tech/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md @@ -0,0 +1,389 @@ +[#]: collector: "lujun9972" +[#]: translator: "lxbwolf" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "Improve your database knowledge with this MariaDB and MySQL cheat sheet" +[#]: via: "https://opensource.com/article/20/10/mariadb-mysql-cheat-sheet" +[#]: author: "Seth Kenlon https://opensource.com/users/seth" + +使用这个 MariaDB 和 MySQL 备忘单提升你的数据库技能 +====== + +阅读本文并下载我们的免费备忘单,去使用开源的数据库吧。 +![Cheat Sheet cover image][1] + +当你写一个程序或配置一个服务时,你最终都要持久化存储信息。有时候,你只需要一个 INI 或者 [YAML][2] 配置文件就够了。而有时候,一个自定义格式的 XML 或者 JSON 或其他类似的文件会更好。 + +但也有时候你需要校验输入、快速查询信息、关联数据、通常还要熟练地处理你的用户的请求。这就是设计数据库的目的,而 [MariaDB][3](由 [MySQL][4] 的原始开发人员开发的一个分支) 是一个极佳的选项。在本文中我使用的是 MariaDB,但这些信息同样适用于 MySQL。 + +通过编程语言与数据库进行交互是很普遍的。正因如此,出现了大量 Java、Python、Lua、PHP、Ruby、C++ 和其他语言的 [SQL][5] 库。然而,在使用这些库之前,理解数据库引擎做了什么以及为什么选择数据库是重要的对我们会很有帮助。本文介绍 MariaDB 和 `mysql` 命令来帮助你熟悉数据库处理数据的基本原理。 + +如果你还没有安装 MariaDB,请查阅我的文章 [在 Linux 上安装 MariaDB][6]。如果你没有使用 Linux,请参照 MariaDB [下载页面][7]提供的指导方法。 + +### 与 MariaDB 交互 + +你可以使用 `mysql` 命令与 MariaDB 进行交互。首先使用子命令 `ping` 确认你的服务是运行着的,在提示后输入密码: + + +``` +$ mysqladmin -u root -p ping +Enter password: +mysqld is alive +``` + +为了易于读者理解,打开一个交互式的 MariaDB 会话: + + +``` +$ mysql -u root -p +Enter password: +Welcome to the MariaDB monitor. +Commands end with ; or \g. +[...] +Type 'help;' or '\h' for help. +Type '\c' to clear the current input statement. + +MariaDB [(none)]> +``` + +你现在是在一个 MariaDB 子 shell 中,提示框是 MariaDB 提示框。普通的 Bash 命令在这里不能使用,只能用 MariaDB 命令。输入 `help` (或 `?`)查看命令列表。这些是你的 MariaDB shell 的管理命令,使用它们可以定制你的 shell,但它们不属于 SQL 语言。 + +### 学习 SQL 基本知识 + +[结构化查询语言][8] 是基于它们的能力定义的:一种通过有规则且一致的语法来查询数据库中的内容得到有用的结果的方法。SQL 看起来像是普通的英文语句,有一点点生硬。例如,如果你登入数据库服务器,想查看有哪些库,输入 `SHOW DATABASES;` 并回车就能看到结果。 + +SQL 命令以分号作为结尾。如果你忘记输入分号,MariaDB 会认为你是想在下一行继续输入你的查询命令,在下一行你可以继续输入命令也可以输入分号结束命令。 + + +``` +MariaDB [(NONE)]> SHOW DATABASES; ++--------------------+ +| DATABASE | ++--------------------+ +| information_schema | +| mysql | +| performance_schema | +| test | ++--------------------+ +4 ROWS IN SET (0.000 sec) +``` + +上面的例子显示当前有四个数据库:information_schema、mysql、performance_schema 和 test。你必须指定 MariaDB 使用哪个库,才能对该库使用查询语句。指定数据库的命令是 `use`。当你选择了一个库后,MariaDB 提示框会切换为选择的库。 + + +``` +MariaDB [(NONE)]> USE test; +MariaDB [(test)]> +``` + +#### 显示数据库的表 + +数据库里有_表_,与电子表格类似:有一系列的行(在数据库中称为_记录_)和列。一个行和一个列唯一确定一个 _filed_。 + +查看一个数据库中可用的表(可以理解为多表单电子表格中的一页),使用 SQL 关键字 `SHOW`: + + +``` +MariaDB [(test)]> SHOW TABLES; +empty SET +``` + +`test` 数据库是空的,所以使用 `use` 命令切换到 `mysql` 数据库: + + +``` +MariaDB [(test)]> USE mysql; +MariaDB [(mysql)]> SHOW TABLES; + ++---------------------------+ +| Tables_in_mysql | ++---------------------------+ +| column_stats | +| columns_priv | +| db | +[...] +| time_zone_transition_type | +| transaction_registry | +| USER | ++---------------------------+ +31 ROWS IN SET (0.000 sec) +``` + +这个数据库中有很多表!`mysql` 数据库是这个 MariaDB 实例的系统管理数据库。它里面包含重要数据,比如用来管理数据库权限的用户结构。这个数据库很重要,你不需要经常直接与它交互,但是使用 SQL 脚本来操作它却很常见。当你学习 MariaDB 时理解 `mysql` 数据库很有用,因为它有助于说明一些基本的 SQL 命令。 + +#### 检查一个表 + +这个实例的 `mysql` 数据库的最后一个表名为 `user`。这个表包含了可以访问这个数据库的用户。当前里面只有一个 root 用户,但是你可以添加不同权限的用户,赋予它们查看、更新或创建数据的权限。你可以查看一个表的列首来了解一个 MariaDB 用户的所有属性: + + +``` +> SHOW COLUMNS IN USER; +MariaDB [mysql]> SHOW COLUMNS IN USER; ++-------------+---------------+------+-----+----------+ +| FIELD | TYPE | NULL | KEY | DEFAULT | ++-------------+---------------+------+-----+----------+ +| Host | CHAR(60) | NO | PRI | | +| USER | CHAR(80) | NO | PRI | | +| Password | CHAR(41) | NO | | | +| Select_priv | enum('N','Y') | NO | | N | +| Insert_priv | enum('N','Y') | NO | | N | +| Update_priv | enum('N','Y') | NO | | N | +| Delete_priv | enum('N','Y') | NO | | N | +| Create_priv | enum('N','Y') | NO | | N | +| Drop_priv | enum('N','Y') | NO | | N | +[...] +47 ROWS IN SET (0.001 sec) +``` + +#### 创建一个新的用户 + +不论你是否需要一个普通的账号来管理数据库或者为计算机配置数据库(例如安装 WordPress、Drupal 或 Joomla时),在 MariaDB 中多建一个用户账号是很普遍的。你可以通过向 `mysql` 数据库的 `user` 表中添加一个用户或使用 SQL 关键字 `CREATE` 来提示 MariaDB 创建一个 MariaDB 用户。使用 `CREATE` 来创建新用户会默认执行一些有用的方法,因此你不需要手动生成所有的信息: + + +``` +`> CREATE USER 'tux'@'localhost' IDENTIFIED BY 'really_secure_password';` +``` + +#### 查看表的字段 + +你可以使用 `SELECT` 关键字来查看数据库表的字段和值。这本例中,你创建了一个名为 `tux` 的用户,因此查询 `user` 表中的列: + + +``` +> SELECT USER,host FROM USER; ++------+------------+ +| USER | host | ++------+------------+ +| root | localhost | +[...] +| tux | localhost | ++------+------------+ +7 ROWS IN SET (0.000 sec) +``` + +#### 为一个用户赋予权限 + +通过查看 `user` 表列出的信息,你可以看到用户的状态。例如,新用户 `tux` 对这个数据库没有任何权限。使用 `WHERE` 语句你可以只查 `tux` 那一条记录。 + + +``` +> SELECT USER,select_priv,insert_priv,update_priv FROM USER WHERE USER='tux'; ++------+-------------+-------------+-------------+ +| USER | select_priv | insert_priv | update_priv | ++------+-------------+-------------+-------------+ +| tux | N | N | N | ++------+-------------+-------------+-------------+ +``` + +使用 `GRANT` 命令修改用户的权限: + + +``` +> GRANT SELECT ON *.* TO 'tux'@'localhost'; +> FLUSH PRIVILEGES; +``` + +验证你的修改: + + +``` +> SELECT USER,select_priv,insert_priv,update_priv FROM USER WHERE USER='tux'; ++------+-------------+-------------+-------------+ +| USER | select_priv | insert_priv | update_priv | ++------+-------------+-------------+-------------+ +| tux | Y | N | N | ++------+-------------+-------------+-------------+ +``` + +`tux` 用户现在有了从所有表中查询记录的权限。 + +### 创建自定义的数据库 + +到目前为止,你一直在与默认的数据库进行交互。除了用户管理,大部分人很少会与默认的数据库进行交互。通常,你会用自定义的数据来填充创建的数据库。 + +#### 创建一个 MariaDB 数据库 + +你可能已经可以自己在 MariaDB 中创建新数据库了。创建数据库跟新建用户差不多。 + + +``` +> CREATE DATABASE example; +Query OK, 1 ROW affected (0.000 sec) +> SHOW DATABASES; ++--------------------+ +| DATABASE | ++--------------------+ +| example | +[...] +``` + +使用 `use` 命令来把这个新建的数据库作为当前使用的库: + + +``` +`> USE example;` +``` + +#### 创建一个表 + +创建表比创建数据库要复杂,因为你必须定义列首。MariaDB 提供了很多方便的函数,可以用于创建列,引入数据类型定义,自增选项,对空值的约束,自动时间戳等等。 + +下面是用来描述一系列用户的一个简单的表: + + +``` +> CREATE TABLE IF NOT EXISTS member ( + -> id INT AUTO_INCREMENT PRIMARY KEY, + -> name VARCHAR(128) NOT NULL, + -> startdate TIMESTAMP DEFAULT CURRENT_TIMESTAMP); +Query OK, 0 ROWS affected (0.030 sec) +``` + +这个表通过使用一个自动递增的方法来唯一标识每一行。表示用户名字的字段不能为空(或 `null`),每一行被创建时会自动生成时间戳。 + +使用 SQL 关键字 `INSERT` 向这个表填充一些示例数据: + + +``` +> INSERT INTO member (name) VALUES ('Alice'); +Query OK, 1 ROW affected (0.011 sec) +> INSERT INTO member (name) VALUES ('Bob'); +Query OK, 1 ROW affected (0.011 sec) +> INSERT INTO member (name) VALUES ('Carol'); +Query OK, 1 ROW affected (0.011 sec) +> INSERT INTO member (name) VALUES ('David'); +Query OK, 1 ROW affected (0.011 sec) +``` + +验证一下表里的数据: + + +``` +> SELECT * FROM member; ++----+-------+---------------------+ +| id | name | startdate | ++----+-------+---------------------+ +| 1 | Alice | 2020-10-03 15:25:06 | +| 2 | Bob | 2020-10-03 15:26:43 | +| 3 | Carol | 2020-10-03 15:26:46 | +| 4 | David | 2020-10-03 15:26:51 | ++----+-------+---------------------+ +4 ROWS IN SET (0.000 sec) +``` + +#### 同时增加多行数据 + +再创建一个表: + + +``` +> CREATE TABLE IF NOT EXISTS linux ( + -> id INT AUTO_INCREMENT PRIMARY KEY, + -> distro VARCHAR(128) NOT NULL, +Query OK, 0 ROWS affected (0.030 sec) +``` + +填充一些示例数据,这次使用 `VALUES` 快捷方式,这样你可以一次添加多行数据。`VALUES` 关键字需要一个用括号包围的列表作为参数,也可以用逗号分隔的多个列表作为参数。 + + +``` +> INSERT INTO linux (distro) + -> VALUES ('Slackware'), ('RHEL'),('Fedora'),('Debian'); +Query OK, 4 ROWS affected (0.011 sec) +Records: 4 Duplicates: 0 Warnings: 0 +> SELECT * FROM linux; ++----+-----------+ +| id | distro | ++----+-----------+ +| 1 | Slackware | +| 2 | RHEL | +| 3 | Fedora | +| 4 | Debian | ++----+-----------+ +``` + +### 关联多个表 + +现在你有两个表,之间没有关联。两个表的数据是独立的,但是你可能需要表一中的一个值来识别表二的记录。 + +你可以在表一中新增一列对应表二中的值。因为两个表都有唯一的标识符(自动递增的 `id` 字段),关联的它们的最简单的方式是,使用表一中的 `id` 字段作为表二的查询条件。 + +在表一中创建一列用来表示表二中的一个值。 + + +``` +> ALTER TABLE member ADD COLUMN (os INT); +Query OK, 0 ROWS affected (0.012 sec) +Records: 0 Duplicates: 0 Warnings: 0 +> DESCRIBE member; +DESCRIBE member; ++-----------+--------------+------+-----+---------+------+ +| FIELD | TYPE | NULL | KEY | DEFAULT | Extra| ++-----------+--------------+------+-----+---------+------+ +| id | INT(11) | NO | PRI | NULL | auto_| +| name | VARCHAR(128) | NO | | NULL | | +| startdate | TIMESTAMP | NO | | cur[...]| | +| os | INT(11) | YES | | NULL | | ++-----------+--------------+------+-----+---------+------+ +``` + +把 `linux` 表中的独一无二的 ID 分配给每个成员。因为记录已经存在,使用 `UPDATE` 关键字而不是 `INSERT`。尤其是当你想查询某行然后再更新某列值时。语法上,表达方式有点倒装,先更新后查询: + + +``` +> UPDATE member SET os=1 WHERE name='Alice'; +Query OK, 1 ROW affected (0.007 sec) +ROWS matched: 1 Changed: 1 Warnings: 0 +``` + +要填充数据,请对其他名字重复执行这个过程。为了数据的多样性,在四行记录中分配三个不同的值。 + +#### 连接表 + +现在这两个表彼此有了关联,你可以使用 SQL 来展示关联的数据。数据库中有很多种连接方式,你可以尽请尝试。下面的例子是关联 `member` 表中 `os` 字段和 `linux` 表中 `id` 字段: + + +``` +SELECT * FROM member JOIN linux ON member.os=linux.id; ++----+-------+---------------------+------+----+-----------+ +| id | name | startdate | os | id | distro | ++----+-------+---------------------+------+----+-----------+ +| 1 | Alice | 2020-10-03 15:25:06 | 1 | 1 | Slackware | +| 2 | Bob | 2020-10-03 15:26:43 | 3 | 3 | Fedora | +| 4 | David | 2020-10-03 15:26:51 | 3 | 3 | Fedora | +| 3 | Carol | 2020-10-03 15:26:46 | 4 | 4 | Debian | ++----+-------+---------------------+------+----+-----------+ +4 ROWS IN SET (0.000 sec) +``` + +连接 `os` 和 `id` 字段。 + +在图像化的应用中,你可以想象 `os` 字段可以在下拉菜单中设置,值的来源是 `linux` 表中的 `distro` 字段。通过使用多个表中独立却有关联的数据,你可以保证数据的一致性和有效性,使用 SQL 你可以动态地关联它们。 + +### [下载 MariaDB 和 MySQL 备忘单][9] + +MariaDB 是企业级的数据库。它是健壮、强大、高效的数据库引擎。学习它是你向管理 web 应用和编写语言库迈出的伟大的一步。你可以[下载 MariaDB 和 MySQL 备忘单][9],在你使用 MariaDB 时可以快速参考。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/mariadb-mysql-cheat-sheet + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coverimage_cheat_sheet.png?itok=lYkNKieP "Cheat Sheet cover image" +[2]: https://www.redhat.com/sysadmin/yaml-tips +[3]: https://mariadb.org/ +[4]: https://www.mysql.com/ +[5]: https://en.wikipedia.org/wiki/SQL +[6]: https://opensource.com/article/20/10/install-mariadb-and-mysql-linux +[7]: https://mariadb.org/download +[8]: https://publications.opengroup.org/c449 +[9]: https://opensource.com/downloads/mariadb-mysql-cheat-sheet \ No newline at end of file From f2f1229df6b5325046aff80f092075b8a8c80c6f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 8 Nov 2020 18:35:22 +0800 Subject: [PATCH 0692/1156] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @chenmu-kk 这篇稍有过时,应尽量翻译较新的文章~~ --- ...se networks can-t handle big data loads.md | 34 ++++++++----------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/translated/talk/20190925 Most enterprise networks can-t handle big data loads.md b/translated/talk/20190925 Most enterprise networks can-t handle big data loads.md index 53fb677838..e5d819f237 100644 --- a/translated/talk/20190925 Most enterprise networks can-t handle big data loads.md +++ b/translated/talk/20190925 Most enterprise networks can-t handle big data loads.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (chenmu-kk) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Most enterprise networks can't handle big data loads) @@ -9,38 +9,32 @@ 大多数企业网络无法处理大数据负载 ====== -随着越来越多的数据通过网络传输,由于领导力和技术问题,数据网络跟上数据传输速度的工作正在滞后。 -Metamorworks / Getty Images -又过了一周,另一项调查发现,IT已经无法跟上不断膨胀的数据过载。这次问题将围绕着网络带宽和整体性能展开。 +> 随着网络中流动着越来越多的数据,由于领导力和技术问题,网络正在滞后于数据的发展速度。 -管理咨询公司埃森哲(Accenture)对[300名IT专业人士进行的一项调查][1] 发现,大多数人感觉他们企业网络无法胜任处理大数据的任务和物联网 (IoT) 部署。只有43%的受访公司表示他们的网络已经准备好支持云服务、物联网和其他数字技术。 +![](https://images.idgesg.net/images/article/2019/08/gettyimages-811109186-100808291-large.jpg) -**[ Learn more about SDN: Find out [where SDN is going][2] and learn the [difference between SDN and NFV][3]. | Get regularly scheduled insights: [Sign up for Network World newsletters][4]. ]** +又过了一周,另一项调查发现,IT 已经无法跟上不断膨胀的数据过载。这次的问题将主要是网络带宽和整体性能。 -一个关键原因(58%)是“IT与商业需求的不一致性”,这减缓了这些项目的推出。这是一个不同寻常的发现,因为85%的受访者也表示他们的网络已经完全或者大体上已经准备好支持企业的数字化计划。到底是哪一个呢? +管理咨询公司埃森哲对 [300 名 IT 专业人士进行的一项调查][1] 发现,大多数人认为他们企业网络无法胜任处理大数据的任务和物联网部署的任务。只有 43% 的受访公司表示他们的网络已经准备好支持云服务、物联网和其他数字技术。 -第二和第三大时常提及的障碍是“业务需求和运营需求间固有的复杂性”以及“对带宽、性能等方面的需求超过交付能力”,各占45%。 +一个关键原因(58%)是“IT 与商业需求之间的错位”,这延缓了这些项目的进展。这是一个不同寻常的发现,因为 85% 的受访者还表示他们的网络已经完全或者大体上已经准备好支持企业的数字化计划。那么,究竟是哪一种情况呢? -由于分析技术和其他大数据技术的推动,大量传输数据持续涌入网络线路,网络瓶颈持续增长。调查发现,带宽需求并未满足,目前的网络性能依旧达不到要求。 +第二和第三大时常提及的障碍是“业务需求和运营需求间固有的复杂性”以及“对带宽、性能等方面的需求超过交付能力”,各占 45%。 + +由于分析技术和其他大数据技术的推动,大量传输的数据持续涌入网络线路,网络瓶颈持续增长。调查发现,带宽需求并未得到满足,目前的网络性能依旧达不到要求。 其他原因还包括缺乏网络技术、设备扩展和设备老化。 ### 网络性能问题的一个解决方案:SDN -埃森哲发现,大多数公司表示 [软件定义网络 (SDN)][5] 是应对带宽和性能挑战的解决方案,77%的受访企业在调查中表示正在部署SDN或者已完成部署。它指出,虽然SDN可能在组织的某部分中存在,它并不总是在整个企业范围内统一地推出。 +埃森哲发现,大多数公司表示 [软件定义网络(SDN)][5] 是应对带宽和性能挑战的解决方案,77% 的受访企业在调查中表示正在部署 SDN 或者已完成部署。它指出,虽然 SDN 可能在组织的某部分中存在,它并不总是在整个企业范围内统一地推出。 -**** From HPE: [ITaaS and Corporate Storage Technology][6]: This blog explains why pay-per-use IT models, such as ITaaS, could be the next chapter in IT infrastructure. (Sponsored) **** +如今看来,似乎从未有人有足够的预算来满足他们所有的 IT 雄心,但 31% 受访者认为为网络改善提供资金是“简单的”,而且是在网络基础设施团队的控制范围内,相较于直接下属(13%)或基础设施/网络主管和副总裁(19%),首席信息官/首席技术官更可能将融资过程报告为“轻松”(40%)。 -如今看来,似乎从未有人有足够的预算来满足他们所有的IT雄心,但31%受访者认为网络改善筹资“简单”。而且在网络基础设施团队的控制下,首席信息官/首席技术官更可能将融资过程报告为“轻松”(40%),相较于直接下属(13%)或基础设施/网络主管和副总裁(19%)。 +报告指出,“仅靠传统网络无法支持数字时代所需的创新和性能。”报告呼吁拥抱新技术,但没有提到 SDN 的名字。同时它还呼吁首席执行官和他们直接下属间加强合作,因为很明显,双方在看待问题的方式上存在分歧。 -报告指出,“仅靠传统网络无法支持数字时代所需的创新和性能。”呼吁拥抱新技术,但没有提到SDN的名字。同时呼吁首席执行官和他们直接下属间加强合作,因为很明显,双方在看待问题的方式上存在分歧。 - -报告总结说,“我们认为需要一种新的网络范式来确保网络满足当前和未来的业务需求。然而,尽管有进步的迹象,但改变的步伐缓慢。公司必须承担起重担,才能实现统一和标准化企业能力,提供必要的带宽、性能和安全,以支持当前和未来的业务需求”。 - -**[ Now see: [How network pros acquire skills for SDN, programmable networks][7] ]** - -Join the Network World communities on [Facebook][8] and [LinkedIn][9] to comment on topics that are top of mind. +报告总结说,“我们认为需要一种新的网络范式来确保网络满足当前和未来的业务需求。然而,尽管有进步的迹象,但变革的步伐缓慢。公司必须承担起重担,才能实现统一和标准化企业能力,提供必要的带宽、性能和安全,以支持当前和未来的业务需求”。 -------------------------------------------------------------------------------- @@ -49,7 +43,7 @@ via: https://www.networkworld.com/article/3440519/most-enterprise-networks-cant- 作者:[Andy Patrizio][a] 选题:[lujun9972][b] 译者:[chenmu-kk](https://github.com/chenmu-kk) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ebda51f88a98db2d67e70200cc49d579131939b2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 8 Nov 2020 18:35:55 +0800 Subject: [PATCH 0693/1156] PUB @chenmu-kk https://linux.cn/article-12803-1.html --- ...25 Most enterprise networks can-t handle big data loads.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20190925 Most enterprise networks can-t handle big data loads.md (98%) diff --git a/translated/talk/20190925 Most enterprise networks can-t handle big data loads.md b/published/20190925 Most enterprise networks can-t handle big data loads.md similarity index 98% rename from translated/talk/20190925 Most enterprise networks can-t handle big data loads.md rename to published/20190925 Most enterprise networks can-t handle big data loads.md index e5d819f237..ae1615b66f 100644 --- a/translated/talk/20190925 Most enterprise networks can-t handle big data loads.md +++ b/published/20190925 Most enterprise networks can-t handle big data loads.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (chenmu-kk) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12803-1.html) [#]: subject: (Most enterprise networks can't handle big data loads) [#]: via: (https://www.networkworld.com/article/3440519/most-enterprise-networks-cant-handle-big-data-loads.html) [#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) From f94b8b86b23a53e387c98ff84899d4035a25c31b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 8 Nov 2020 18:58:51 +0800 Subject: [PATCH 0694/1156] PRF @geekpi --- ... open source tools I can-t live without.md | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/translated/tech/20201021 5 open source tools I can-t live without.md b/translated/tech/20201021 5 open source tools I can-t live without.md index 027d230e86..d9e9ad3336 100644 --- a/translated/tech/20201021 5 open source tools I can-t live without.md +++ b/translated/tech/20201021 5 open source tools I can-t live without.md @@ -1,28 +1,28 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (5 open source tools I can't live without) [#]: via: (https://opensource.com/article/20/10/open-source-tools) [#]: author: (Victoria Martinez de la Cruz https://opensource.com/users/vkmc) -5 个我不能离开的开源工具 +5 个我不可或缺的开源工具 ====== -通过将这些工具放在自己的技囊中,提高终端内外的工作效率。 -![woman on laptop sitting at the window][1] -前段时间,我参与了一个在科技人士中广为流传的 Twitter 话题。挑战是什么?只挑选五个你不能没有的工具。我开始结合我的日常生活来思考这个问题,只挑出五个工具并不容易。我使用了许多我认为必不可少的工具,比如我的 [IRC][2] 客户端来与同事和朋友联系(是的,我仍然使用 IRC),一个好的文本编辑器来做事情,一个日历应用来保持有条不紊,以及当需要更直接的互动时的一个视频会议平台。 +> 通过将这些工具放在自己的技能包中,提高你在终端内、外的工作效率。 -所以,让我给这个挑战来个转折:选出五个能提高你工作效率的开源工具。这是我的清单。请在评论中分享你的清单。 +![](https://img.linux.net.cn/data/attachment/album/202011/08/185810ffjljj7o830fboz3.jpg) + +前段时间,我参与了一个在科技人士中广为流传的 Twitter 话题。“挑战?只挑选五个你不能没有的工具。”我开始结合我的日常生活来思考这个问题,只挑出五个工具并不容易。我使用了许多我认为必不可少的工具,比如用来与同事和朋友联系的 [IRC][2] 客户端(是的,我仍然使用 IRC),一个用来做各种事情的出色的文本编辑器,一个用来保持有条不紊的日历应用,以及当需要更直接的互动时的一个视频会议平台。 + +所以,让我给这个挑战来个变化:选出五个能提高你工作效率的开源工具。这是我的清单。请在评论中分享你的清单。 ### tmate ![tmate screenshot][3] -(Victoria Marinez de la Cruz, [CC BY-SA 4.0][4]) - -tmate 是著名的 [tmux][5] 终端多路复用器的一个分支,它允许你启动一个 tmux 会话并通过 SSH 共享。你可以用它来进行[配对编程][6](这是我的主要使用场景),也可以用来进行远程控制。 +哦,我喜欢这个工具。`tmate` 是著名的 [tmux][5] 终端多路复用器的一个复刻,它允许你启动一个 `tmux` 会话并通过 SSH 共享。你可以用它来进行[结对编程][6](这是我的主要使用场景),也可以用来进行远程控制。 如果你经常与你的团队成员合作,并且你想要一个简单的、与发行版无关的、开源的方式与他们一起编程(而且共享终端访问对你来说已经足够了),这绝对是你必须加到列表中的东西。 @@ -30,15 +30,15 @@ tmate 是著名的 [tmux][5] 终端多路复用器的一个分支,它允许你 ### ix -ix 是一个命令行粘贴板。你不需要安装任何东西。你可以通过 `curl` 到 [ix.io][9] 站点来创建新的粘贴。例如, `echo Hello world. | curl -F 'f:1=<-' ix.io` 会给你一个到 ix.io 的链接,那里粘贴了消息 “Hello world” 的信息。当你想分享日志用于调试或在没有桌面环境的服务器上保存配置文件时,这非常方便。 +`ix` 是一个命令行粘贴板。你不需要安装任何东西。你可以通过 `curl` 到 [ix.io][9] 站点来创建新的粘贴。例如,`echo Hello world. | curl -F 'f:1=<-' ix.io` 会给你一个到 ix.io 的链接,那里粘贴了消息 “Hello world” 的信息。当你想分享日志用于调试或在没有桌面环境的服务器上保存配置文件时,这非常方便。 -有一个缺点是源码还没有公布,尽管它的目的是免费和开源。如果你是作者,并且正在阅读这篇文章,请发布代码,这样我们就可以为打磨过程做出贡献。 +有一个缺点是源码还没有公布,尽管它的目的是自由开源。如果你是作者,并且正在阅读这篇文章,请发布代码,这样我们就可以为打磨它的过程做出贡献。 ### asciinema -是的,这是另一个终端工具,asciinema 可以让你记录你的终端。使用它的方法有很多,但我一般用它来制作 demo 演示。它非常容易使用,而且有很多 Linux 发行版和其他平台的软件包。 +是的,这是另一个终端工具,`asciinema` 可以让你记录你的终端。使用它的方法有很多,但我一般用它来制作演示。它非常容易使用,而且有很多 Linux 发行版和其他平台的软件包。 -要想知道它是如何工作的,可以看看这个[酷炫的 demo][10]。是不是很棒? +要想知道它是如何工作的,可以看看这个[酷炫的演示][10]。是不是很棒? 在 [asciinema 的网站][11]上获取更多信息,在 [GitHub][12] 上访问其源代码。 @@ -46,11 +46,9 @@ ix 是一个命令行粘贴板。你不需要安装任何东西。你可以通 ![pomodoro timer gnome][13] -(Victoria Martinez de la Cruz, [CC BY-SA 4.0][4]) +好了,关于终端工具的介绍就到此为止。现在我想和大家分享一下这个简单的宝物,它让你的工作变得有条不紊。你听说过 [番茄工作法][14] 吗?Pomodoro 基本上是一个时间管理工具。它使用一个番茄形状的计时器,帮助你将时间分成工作时间和休息时间(默认情况下,25 分钟的工作后有 5 分钟的休息时间)。而且,每隔 4 个“番茄”之后,你就会有更长的休息时间(默认为 15 分钟)。这样做的目的是让你在工作时间内保持专注,而在休息时间内进行伸展和放松。 -好了,关于终端工具的介绍就到此为止。现在我想和大家分享一下这个简单的宝物,它让你的工作变得有条不紊。你听说过 [Pomodoro Technique][14] 吗?Pomodoro 基本上是一个时间管理工具。它使用一个番茄形状的计时器,帮助你将时间分成工作时间和休息时间(默认情况下,25 分钟的工作后有 5 分钟的休息时间)。而且,每隔 4 个 pomodoro 之后,你就会有更长的休息时间(默认为 15 分钟)。这样做的目的是让你在工作时间内保持专注,而在休息时间内进行伸展和放松。 - -这听起来非常非常简单,你可能会对让一个番茄形状的时钟来控制你的生活感到犹豫,但它确实帮助我更好地组织起来,避免在试图同时专注于许多事情时感到疲惫。 +这听起来非常非常简单,你可能会对让一个番茄形状的时钟来控制你的生活感到犹豫,但它确实帮助我变得跟有条理,并且在试图同时专注于许多事情时避免感到疲惫。 无论你是什么角色,我都强烈推荐这种做法。而在众多实现它的不同工具中,我推荐 GNOME Pomodoro 应用。它适用于主要的 GNU/Linux 发行版,所以它需要你使用 GNOME 桌面环境(这可能是它的缺点)。 @@ -58,7 +56,7 @@ ix 是一个命令行粘贴板。你不需要安装任何东西。你可以通 ### Jitsi -最后但并非最不重要的是 Jitsi。当你在一个远程、全球分布的团队中工作时,你需要一种与人们联系的方式。即时通讯是好的,但有时最好还是开个快速会议,面对面地讨论事情(嗯,看到对方的脸)。有很多[视频会议工具][17]可用,但我很喜欢 Jitsi。不仅因为它是免费和开源的,还因为它提供了一个简洁、实用的界面。你可以设置自己的 Jitsi 服务器(用于商业目的),但你也可以通过访问 [Jitsi Meet][18] 网站来试用一个公共的 Jitsi 实例。 +最后但同样重要的是 Jitsi。当你在一个远程、遍布全球的团队中工作时,你需要一种与人们联系的方式。即时通讯是好的,但有时最好还是开个快速会议,面对面地讨论事情(嗯,看到对方的脸)。有很多[视频会议工具][17]可用,但我很喜欢 Jitsi。不仅因为它是免费和开源的,还因为它提供了一个简洁、实用的界面。你可以设置自己的 Jitsi 服务器(用于商业目的),但你也可以通过访问 [Jitsi Meet][18] 网站来试用一个公共的 Jitsi 实例。 设置这种会议的一个好做法是:只有在你心中有明确的议程时才使用它。而且要时刻问自己,这个会议能不能用电子邮件代替?遵循这些准则,谨慎使用 Jitsi,你的工作日将会非常高效! @@ -75,7 +73,7 @@ via: https://opensource.com/article/20/10/open-source-tools 作者:[Victoria Martinez de la Cruz][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 485643ea79dbc62d2fa27698e6b5071164eeb497 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 8 Nov 2020 18:59:30 +0800 Subject: [PATCH 0695/1156] PUB @geekpi https://linux.cn/article-12804-1.html --- .../20201021 5 open source tools I can-t live without.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201021 5 open source tools I can-t live without.md (98%) diff --git a/translated/tech/20201021 5 open source tools I can-t live without.md b/published/20201021 5 open source tools I can-t live without.md similarity index 98% rename from translated/tech/20201021 5 open source tools I can-t live without.md rename to published/20201021 5 open source tools I can-t live without.md index d9e9ad3336..d60f272f59 100644 --- a/translated/tech/20201021 5 open source tools I can-t live without.md +++ b/published/20201021 5 open source tools I can-t live without.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12804-1.html) [#]: subject: (5 open source tools I can't live without) [#]: via: (https://opensource.com/article/20/10/open-source-tools) [#]: author: (Victoria Martinez de la Cruz https://opensource.com/users/vkmc) From 879e509315c56ffc663cf983a499c3555266e1c5 Mon Sep 17 00:00:00 2001 From: xiao-song-123 <59152623+xiao-song-123@users.noreply.github.com> Date: Mon, 9 Nov 2020 08:34:38 +0800 Subject: [PATCH 0696/1156] translating --- ...your Python code with this open source visualization tool.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201102 Understand your Python code with this open source visualization tool.md b/sources/tech/20201102 Understand your Python code with this open source visualization tool.md index 88fbd404ff..a2a5773cfa 100644 --- a/sources/tech/20201102 Understand your Python code with this open source visualization tool.md +++ b/sources/tech/20201102 Understand your Python code with this open source visualization tool.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (xiao-song-123) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From fd8386109ef1441b92e8e396eda3837beff67dec Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 9 Nov 2020 08:45:57 +0800 Subject: [PATCH 0697/1156] translating --- ...201103 4 ways to run Kubernetes locally.md | 137 ------------------ ...201103 4 ways to run Kubernetes locally.md | 136 +++++++++++++++++ 2 files changed, 136 insertions(+), 137 deletions(-) delete mode 100644 sources/tech/20201103 4 ways to run Kubernetes locally.md create mode 100644 translated/tech/20201103 4 ways to run Kubernetes locally.md diff --git a/sources/tech/20201103 4 ways to run Kubernetes locally.md b/sources/tech/20201103 4 ways to run Kubernetes locally.md deleted file mode 100644 index 9a5e4c981e..0000000000 --- a/sources/tech/20201103 4 ways to run Kubernetes locally.md +++ /dev/null @@ -1,137 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (4 ways to run Kubernetes locally) -[#]: via: (https://opensource.com/article/20/11/run-kubernetes-locally) -[#]: author: (Bryant Son https://opensource.com/users/brson) - -4 ways to run Kubernetes locally -====== -Set up a local development environment or just try out the container -orchestration platform with these tools. -![Business woman on laptop sitting in front of window][1] - -[Kubernetes][2] is an open source orchestration platform for containers. Developed by Google, it offers an open source system for automating deployment, scaling, and managing containerized applications. Although most people run Kubernetes in a cloud environment, running a Kubernetes cluster locally is not only possible, it has at least two benefits: - - * You can quickly try out Kubernetes before deciding to use it as your primary platform to deploy your application. - * You can set it up as a local development environment before pushing anything to a public cloud, thus allowing separation between the development environment and the production environment. - - - -Setting up a local Kubernetes environment as your development environment is the recommended option, no matter your situation, because this setup can create a safe and agile application-deployment process. - -Fortunately, there are multiple platforms that you can try out to run Kubernetes locally, and they are all open source and available under the [Apache 2.0][3] license. - - * [Minikube][4] has the primary goals of being the best tool for local Kubernetes application development, and to support all Kubernetes features that fit. - * [kind][5] runs local Kubernetes clusters using Docker container "nodes." - * [CodeReady Containers][6] (CRC) manages a local OpenShift 4.x cluster optimized for testing and development purposes. - * [Minishift][7] helps you run OpenShift 3.x clusters locally by running a single-node OpenShift cluster inside a virtual machine (VM). - - - -### Minikube - -![Minikube][8] - -(Bryant Son, [CC BY-SA 4.0][9]) - -[Minikube][10] is the most well-known and popular choice to run a Kubernetes environment on a local computer. No matter what operating system you use, [Minikube's documentation][11] offers an easy [installation][12] guide for you. Generally, installing Minikube is as simple as running two commands: - - -``` -$ curl -LO -$ sudo install minikube-PLATFORM-amd64 /usr/local/bin/minikube -``` - -Minikube quickly sets up a local Kubernetes cluster on Linux, macOS, or Windows with the following features: - - * Supports the latest Kubernetes release (+6 previous minor versions) - * Cross-platform (Linux, macOS, Windows) - * Deploys as a VM, a container, or on bare-metal - * Multiple container runtimes (CRI-O, containerd, Docker) - * Docker API endpoint for blazing-fast image pushes - * LoadBalancer, filesystem mounts, FeatureGates, and other advanced features - * Add-ons for easily installing Kubernetes applications - - - -Because Minikube is an open source project, you can contribute to its [source code][4]. - -### kind - -![kind][13] - -(Bryant Son, [CC BY-SA 4.0][9]) - -[kind][14]'s developers describe it as "a tool for running local Kubernetes clusters using Docker container 'nodes.'" It was designed for testing Kubernetes but may also be used for local development or continuous integration. - -kind supports: - - * Multi-node (including high-availability) clusters - * Building Kubernetes release builds from source - * Make/Bash/Docker or Bazel, in addition to pre-published builds - * Linux, macOS, and Windows - - - -In addition, kind is a Cloud Native Computing Foundation (CNCF)-certified conformant Kubernetes installer. Because it's open source, you can find kind's [source code][5] in its GitHub repository. - -### CodeReady Container (CRC) - -![CodeReady Container][15] - -(Bryant Son, [CC BY-SA 4.0][9]) - -If you want to try the latest version of OpenShift locally, try Red Hat [CodeReady Containers][16] (CRC). CRC brings a minimal OpenShift 4.x cluster to your local computer that provides a minimal environment for development and testing purposes. CRC is mainly targeted for use on developers' desktops. - -You can find CodeReady Container's [source code][6] on GitHub, also available under the Apache 2.0 license. - -### Minishift - -![Minishift][17] - -(Bryant Son, [CC BY-SA 4.0][9]) - -The [Minishift][7] project [helps you run a version of OpenShift][18] with [OKD][19] locally with a single-node OpenShift cluster inside a virtual machine. You can use it to [try OpenShift][20] or to develop for the cloud, on your local host. - -Like the other tools on this list, Minishift is open source, and you can access its [source code][7] on GitHub. - -### Kubernetes for the people - -As you can see, there are several ways to try out Kubernetes in your local environment. Did I miss anything? Feel free to leave a comment to ask a question or make a suggestion. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/11/run-kubernetes-locally - -作者:[Bryant Son][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://opensource.com/users/brson -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating) -[2]: https://kubernetes.io/ -[3]: https://www.apache.org/licenses/LICENSE-2.0 -[4]: https://github.com/kubernetes/minikube -[5]: https://github.com/kubernetes-sigs/kind -[6]: https://github.com/code-ready/crc -[7]: https://github.com/minishift/minishift -[8]: https://opensource.com/sites/default/files/uploads/1_minikube.jpg (Minikube) -[9]: https://creativecommons.org/licenses/by-sa/4.0/ -[10]: https://minikube.sigs.k8s.io/docs/ -[11]: https://minikube.sigs.k8s.io/docs -[12]: https://minikube.sigs.k8s.io/docs/start/ -[13]: https://opensource.com/sites/default/files/uploads/2_kind.jpg (kind) -[14]: https://kind.sigs.k8s.io -[15]: https://opensource.com/sites/default/files/uploads/4_crc.jpg (CodeReady Container) -[16]: https://code-ready.github.io/crc -[17]: https://opensource.com/sites/default/files/uploads/3_minishift.jpg (Minishift) -[18]: https://www.redhat.com/sysadmin/kubernetes-cluster-laptop -[19]: https://www.okd.io/ -[20]: https://www.redhat.com/sysadmin/learn-openshift-minishift diff --git a/translated/tech/20201103 4 ways to run Kubernetes locally.md b/translated/tech/20201103 4 ways to run Kubernetes locally.md new file mode 100644 index 0000000000..41b9f835c0 --- /dev/null +++ b/translated/tech/20201103 4 ways to run Kubernetes locally.md @@ -0,0 +1,136 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 ways to run Kubernetes locally) +[#]: via: (https://opensource.com/article/20/11/run-kubernetes-locally) +[#]: author: (Bryant Son https://opensource.com/users/brson) + +本地运行 Kubernetes 的 4 种方法 +====== +设置一个本地开发环境,或者直接用这些工具尝试容器编排平台。 +![Business woman on laptop sitting in front of window][1] + +[Kubernetes][2] 是一个开源的容器编排平台。它由 Google 开发,为自动化部署、扩展和管理容器化应用提供了一个开源系统。虽然大多数人在云环境中运行 Kubernetes,但在本地运行 Kubernetes 集群不仅是可能的,它还至少有两个好处: + +* 在决定使用 Kubernetes 作为主要平台部署应用之前,你可以快速试用它。 +* 在将任何东西推送到公共云之前,你可以将其设置为本地开发环境,从而实现开发环境和生产环境之间的分离。 + + + +无论你的情况如何,将本地 Kubernetes 环境设置为你的开发环境都是推荐的选择,因为这种设置可以创建一个安全而敏捷的应用部署流程。 + +幸运的是,有多个平台可以让你尝试在本地运行 Kubernetes,它们都是开源的,并且都是 [Apache 2.0][3] 许可。 + +* [Minikube][4] 的主要目标是成为本地 Kubernetes 应用开发的最佳工具,并支持所有适合的 Kubernetes 特性。 +* [kind][5] 使用 Docker 容器“节点”运行本地 Kubernetes 集群。 +* [CodeReady Containers][6] (CRC) 管理为测试和开发目的优化的本地 OpenShift 4.x 集群。 +* [Minishift][7] 通过在虚拟机 (VM) 内运行单节点 OpenShift 集群,帮助你在本地运行 OpenShift 3.x 集群。 + + + +### Minikube + +![Minikube][8] + +(Bryant Son, [CC BY-SA 4.0][9]) + +[Minikube][10] 是在本地计算机上运行 Kubernetes 环境的最知名和最流行的选择。无论你使用什么操作系统,[Minikube 的文档][11]都会为你提供一个简单的[安装][12]指南。一般来说,安装 Minikube 只需运行两条命令: + + +``` +$ curl -LO +$ sudo install minikube-PLATFORM-amd64 /usr/local/bin/minikube +``` + +Minikube 可在Linux、macOS 或 Windows 上快速设置本地 Kubernetes 集群,其功能如下: + +* 支持最新的 Kubernetes 版本(包括 6 个以前的小版本) +* 跨平台 (Linux、macOS、Windows) +* 以虚拟机、容器或裸机的形式部署 +* 多个容器运行时 (CRI-O、containerd、Docker) +* 用于快速推送镜像的 Docker API 端点 +* 负载均衡器、文件系统挂载、FeatureGates 和其他高级功能 +* 用于轻松安装 Kubernetes 应用的附加组件 + + + +因为 Minikube 是一个开源项目,你可以对它的[源代码][4]做贡献。 + +### kind + +![kind][13] + +(Bryant Son, [CC BY-SA 4.0][9]) + +[kind][14] 的开发者将其描述为“一个使用 Docker 容器“节点”运行本地 Kubernetes 集群的工具”。它是为测试 Kubernetes 而设计的,但也可能用于本地开发或持续集成。 + +kind 支持: + +* 多节点(包括高可用性)集群。 +* 从源码构建 Kubernetes 版本 +* Make/Bash/Docker 或 Bazel,以及预发布构建。 +* Linux、MacOS 和 Windows + + + +此外,kind 是一个经过云原生计算基金会 (CNCF) 认证的 Kubernetes 合规安装程序。因为它是开源的,你可以在它的 GitHub 仓库中找到 kind 的[源码][5]。 + +### CodeReady Container (CRC) + +![CodeReady Container][15] + +(Bryant Son, [CC BY-SA 4.0][9]) + +如果你想在本地尝试最新版本的 OpenShift,可以尝试红帽的 [CodeReady Containers][16] (CRC)。CRC 将一个最小的 OpenShift 4.x 集群带到你的本地计算机上,为开发和测试目的提供一个最小的环境。CRC 主要针对开发者的桌面使用。 + +你可以在 GitHub 上找到 CodeReady Container 的[源码][6],也是在 Apache 2.0 许可下提供的。 + +### Minishift + +![Minishift][17] + +(Bryant Son, [CC BY-SA 4.0][9]) + +[Minishift][7] 项目帮助你在本地用 [OKD][19] 在虚拟机内的单节点 OpenShift 集群[运行一个版本的 OpenShift][18]。你可以用它来[尝试 OpenShift][20],或者在你的本地主机上为云开发。 + +和这个列表中的其他工具一样,Minishift 也是开源的,你可以在 GitHub 上访问它的[源码][7]。 + +### 为人服务的 Kubernetes + +正如你所看到的,有几种方法可以在本地环境中试用 Kubernetes。我有遗漏么?欢迎留言提问或提出建议。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/run-kubernetes-locally + +作者:[Bryant Son][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/brson +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating) +[2]: https://kubernetes.io/ +[3]: https://www.apache.org/licenses/LICENSE-2.0 +[4]: https://github.com/kubernetes/minikube +[5]: https://github.com/kubernetes-sigs/kind +[6]: https://github.com/code-ready/crc +[7]: https://github.com/minishift/minishift +[8]: https://opensource.com/sites/default/files/uploads/1_minikube.jpg (Minikube) +[9]: https://creativecommons.org/licenses/by-sa/4.0/ +[10]: https://minikube.sigs.k8s.io/docs/ +[11]: https://minikube.sigs.k8s.io/docs +[12]: https://minikube.sigs.k8s.io/docs/start/ +[13]: https://opensource.com/sites/default/files/uploads/2_kind.jpg (kind) +[14]: https://kind.sigs.k8s.io +[15]: https://opensource.com/sites/default/files/uploads/4_crc.jpg (CodeReady Container) +[16]: https://code-ready.github.io/crc +[17]: https://opensource.com/sites/default/files/uploads/3_minishift.jpg (Minishift) +[18]: https://www.redhat.com/sysadmin/kubernetes-cluster-laptop +[19]: https://www.okd.io/ +[20]: https://www.redhat.com/sysadmin/learn-openshift-minishift \ No newline at end of file From e5e3432f9be380a40206c42f91e3a7d4f7e3879f Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 9 Nov 2020 08:56:52 +0800 Subject: [PATCH 0698/1156] translating --- .../20201105 Tweak your Git config for multiple user IDs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201105 Tweak your Git config for multiple user IDs.md b/sources/tech/20201105 Tweak your Git config for multiple user IDs.md index d0f0a0c35d..43e6e6a513 100644 --- a/sources/tech/20201105 Tweak your Git config for multiple user IDs.md +++ b/sources/tech/20201105 Tweak your Git config for multiple user IDs.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 78ff15ce121df61f638fc226011d90c523005d51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Mon, 9 Nov 2020 09:01:34 +0800 Subject: [PATCH 0699/1156] Translated --- .../20200928 Add sound to your Python game.md | 166 ------------------ .../20200928 Add sound to your Python game.md | 166 ++++++++++++++++++ 2 files changed, 166 insertions(+), 166 deletions(-) delete mode 100644 sources/tech/20200928 Add sound to your Python game.md create mode 100644 translated/tech/20200928 Add sound to your Python game.md diff --git a/sources/tech/20200928 Add sound to your Python game.md b/sources/tech/20200928 Add sound to your Python game.md deleted file mode 100644 index d17429da26..0000000000 --- a/sources/tech/20200928 Add sound to your Python game.md +++ /dev/null @@ -1,166 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (robsean) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Add sound to your Python game) -[#]: via: (https://opensource.com/article/20/9/add-sound-python-game) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Add sound to your Python game -====== -Hear what happens when your hero fights, jumps, collects loot, and more -by adding sounds to your game. Learn how in the 13th article in this -series on creating a platformer in Pygame. -![Colorful sound wave graph][1] - -This is part 13 in an ongoing series about creating video games in [Python 3][2] using the [Pygame][3] module. Previous articles are: - - 1. [Learn how to program in Python by building a simple dice game][4] - 2. [Build a game framework with Python using the Pygame module][5] - 3. [How to add a player to your Python game][6] - 4. [Using Pygame to move your game character around][7] - 5. [What's a hero without a villain? How to add one to your Python game][8] - 6. [Add platforms to your game][9] - 7. [Simulate gravity in your Python game][10] - 8. [Add jumping to your Python platformer game][11] - 9. [Enable your Python game player to run forward and backward][12] - 10. [Using Python to set up loot in Pygame][13] - 11. [Add scorekeeping to your Python game][14] - 12. [Add throwing mechanics to your Python game][15] - - - -Pygame provides an easy way to integrate sounds into your Python video game. Pygame's [mixer module][16] can play one or more sounds on command, and by mixing those sounds together, you can have, for instance, background music playing at the same time you hear the sounds of your hero collecting loot or jumping over enemies. - -It is easy to integrate the mixer module into an existing game, so—rather than giving you code samples showing you exactly where to put them—this article explains the four steps required to get sound in your application. - -### Start the mixer - -First, in your code's setup section, start the mixer process. Your code already starts Pygame and Pygame fonts, so grouping it together with these is a good idea: - - -``` -pygame.init() -pygame.font.init() -pygame.mixer.init() # add this line -``` - -### Define the sounds - -Next, you must define the sounds you want to use. This requires that you have the sounds on your computer, just as using fonts requires you to have fonts, and using graphics requires you to have graphics. - -You also must bundle those sounds with your game so that anyone playing your game has the sound files. - -To bundle a sound with your game, first create a new directory in your game folder, right along with the directory you created for your images and fonts. Call it `sound`: - - -``` -`s = 'sound'` -``` - -Even though there are plenty of sounds on the internet, it's not necessarily _legal_ to download them and give them away with your game. It seems strange because so many sounds from famous video games are such a part of popular culture, but that's how the law works. If you want to ship a sound with your game, you must find an open source or [Creative Commons][17] sound that gives you permission to give the sound away with your game. - -There are several sites that specialize in free and legal sounds, including: - - * [Freesound][18] hosts sound effects of all sorts. - * [Incompetech][19] hosts background music. - * [Open Game Art][20] hosts some sound effects and music. - - - -Some sound files are free to use only if you give the composer or sound designer credit. Read the conditions of use carefully before bundling any with your game! Musicians and sound designers work just as hard on their sounds as you work on your code, so it's nice to give them credit even when they don't require it. - -To give your sound sources credit, list the sounds that you use in a text file called `CREDIT`, and place the text file in your game folder. - -You might also try making your own music. The excellent [LMMS][21] audio workstation is easy to use and ships with lots of interesting sounds. It's available on all major platforms and exports to [Ogg Vorbis][22] (OGG) audio format. - -### Add sound to Pygame - -When you find a sound that you like, download it. If it comes in a ZIP or TAR file, extract it and move the sounds into the `sound` folder in your game directory. - -If the sound file has a complicated name with spaces or special characters, rename it. The filename is completely arbitrary, and the simpler it is, the easier it is for you to type into your code. - -Most video games use OGG sound files because the format provides high quality in small file sizes. When you download a sound file, it might be an MP3, WAVE, FLAC, or another audio format. To keep your compatibility high and your download size low, convert these to Ogg Vorbis with a tool like [fre:ac][23] or [Miro][24]. - -For example, assume you have downloaded a sound file called `ouch.ogg`. - -In your code's setup section, create a variable representing the sound file you want to use: - - -``` -`ouch = pygame.mixer.Sound(os.path.join(s, 'ouch.ogg'))` -``` - -### Trigger a sound - -To use a sound, all you have to do is call the variable when you want to trigger it. For instance, to trigger the `OUCH` sound effect when your player hits an enemy: - - -``` -for enemy in enemy_hit_list: -    pygame.mixer.Sound.play(ouch) -    score -= 1 -``` - -You can create sounds for all kinds of actions, such as jumping, collecting loot, throwing, colliding, and whatever else you can imagine. - -### Add background music - -If you have music or atmospheric sound effects you want to play in your game's background, you can use the `music` function of Pygame's mixer module. In your setup section, load the music file: - - -``` -`music = pygame.mixer.music.load(os.path.join(s, 'music.ogg'))` -``` - -And start the music: - - -``` -`pygame.mixer.music.play(-1)` -``` - -The `-1` value tells Pygame to loop the music file infinitely. You can set it to anything from `0` and beyond to define how many times the music should loop before stopping. - -### Enjoy the soundscapes - -Music and sound can add a lot of flavor to your game. Try adding some to your Pygame project! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/9/add-sound-python-game - -作者:[Seth Kenlon][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://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/colorful_sound_wave.png?itok=jlUJG0bM (Colorful sound wave graph) -[2]: https://www.python.org/ -[3]: https://www.pygame.org/news -[4]: https://opensource.com/article/17/10/python-101 -[5]: https://opensource.com/article/17/12/game-framework-python -[6]: https://opensource.com/article/17/12/game-python-add-a-player -[7]: https://opensource.com/article/17/12/game-python-moving-player -[8]: https://opensource.com/article/18/5/pygame-enemy -[9]: https://opensource.com/article/18/7/put-platforms-python-game -[10]: https://opensource.com/article/19/11/simulate-gravity-python -[11]: https://opensource.com/article/19/12/jumping-python-platformer-game -[12]: https://opensource.com/article/19/12/python-platformer-game-run -[13]: https://opensource.com/article/19/12/loot-python-platformer-game -[14]: https://opensource.com/article/20/1/add-scorekeeping-your-python-game -[15]: https://opensource.com/article/20/9/add-throwing-python-game -[16]: https://www.pygame.org/docs/ref/mixer.html -[17]: https://opensource.com/article/20/1/what-creative-commons -[18]: https://freesound.org -[19]: https://incompetech.filmmusic.io -[20]: https://opengameart.org -[21]: https://opensource.com/life/16/2/linux-multimedia-studio -[22]: https://en.wikipedia.org/wiki/Vorbis -[23]: https://www.freac.org/index.php/en/downloads-mainmenu-330 -[24]: http://getmiro.com diff --git a/translated/tech/20200928 Add sound to your Python game.md b/translated/tech/20200928 Add sound to your Python game.md new file mode 100644 index 0000000000..916f54cc64 --- /dev/null +++ b/translated/tech/20200928 Add sound to your Python game.md @@ -0,0 +1,166 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Add sound to your Python game) +[#]: via: (https://opensource.com/article/20/9/add-sound-python-game) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +添加声音到你的 Python 游戏 +====== +通过添加声音到你的游戏中,听听当你的英雄战斗,跳跃,收集战利品时会发生什么。学习如何在这一 Pygame 系列的第十三篇文章中,创建一个声音平台类精灵。 +![彩色声波图][1] + +这是仍在进行中的关于使用 [Pygame][3] 模块来在 [Python 3][2] 中创建电脑游戏的第十三部分。先前的文章是: + + 1. [通过构建一个简单的掷骰子游戏去学习怎么用 Python 编程][4] + 2. [使用 Python 和 Pygame 模块构建一个游戏框架][5] + 3. [如何在你的 Python 游戏中添加一个玩家][6] + 4. [用 Pygame 使你的游戏角色移动起来][7] + 5. [如何向你的 Python 游戏中添加一个敌人][8] + 6. [在 Pygame 游戏中放置平台][9] + 7. [在你的 Python 游戏中模拟引力][10] + 8. [为你的 Python 平台类游戏添加跳跃功能][11] + 9. [使你的 Python 游戏玩家能够向前和向后跑][12] + 10. [在你的 Python 平台类游戏中放一些奖励][13] + 11. [添加计分到你的 Python 游戏][14] + 12. [在你的Python游戏中加入投掷技巧][15] + + + +Pygame 提供了一种简单的方法来集成声音到你的 Python 电脑游戏中。Pygame 的 [mixer 模块][16] 可以依据命令播放一个或多个声音,并且你也可以将这些声音混合在一起,例如,你能够在听到你的英雄收集奖励或跳过敌人声音的同时播放背景音乐。 + +集成 mixer 模块到一个已存在的游戏中是很容易的,因此 — 并不是给予你代码示例来向你展示放置它们的准确位置 — 这篇文章分四个所需要的步骤来阐明如何在你应用程序中的获取声音。 + +### 启动 mixer + +首先,在你代码的 setup 部分,启动 mixer 进程。你的代码已经启动 Pygame 和 Pygame 字体,因此将它们归类到一起是一个很好的主意: + + +``` +pygame.init() +pygame.font.init() +pygame.mixer.init() # add this line +``` + +### 定义声音 + +接下来,你必需定义你想要使用的声音。这样就要求你的计算机上有声音文件,就像使用字体就要求你有字体文件,使用图像就要求你有图像文件一样。 + +你还必需把这些声音与你的游戏捆绑在一起,以便任何玩你游戏的人都有声音文件。 + +为将一个声音与你的游戏捆绑在一起,首先在你的游戏目录中创建一个新的目录,就像你为你图像和字体创建的目录一样。称它为 `sound`: + + +``` +s = 'sound' +``` + +尽管在互联网上有很多声音文件,下载这些声音文件并将其与你的游戏一起分发并不一定是合法的。这看起来是很奇怪的,因为这么多来自著名电脑游戏的声音是流行文化的一部分,但法律就是这样运作的。如果你想与你的游戏一起分发一个声音文件,你必需找到一个开放源码或 [Creative Commons][17] 声音文件,它们准许与游戏一起提供声音。 + +这里有一些专门提供自由和合法的声音文件的网站,包括: + + * [Freesound][18] 托管存储所有种类的音效。 + * [Incompetech][19] 托管存储背景音乐。 + * [Open Game Art][20] 托管存储一些音效和音乐。 + + + + + +一些声音文件只有当你给予作曲家或声音设计师一下费用时才是可以自由使用的。在与你的游戏捆绑前,仔细阅读使用条件!音乐家和声音设计师在声音上的工作就像你在代码上的工作一样努力,因此当他们不要一些费用时,给予他们一些费用也是极好的。 + +给予你的声音源文件一些费用,在一个名称为 `CREDIT` 的文本文件中列出你使用的声音,并在你的游戏文件夹中放置该文本文件。 + +你也可以尝试制作你自己的音乐。极好的 [LMMS][21] 音频工作站易于使用,并携带很多有趣的声音。它在所有主要的平台上都可以使用,也可以导出为 [Ogg Vorbis][22] (OGG) 音频格式。 + +### 添加声音到 Pygame + +当你找到你喜欢的一个声音文件时,下载它。如果它来自一个 ZIP 或 TAR 文件中,提取它并将其移动到你游戏目录中的 `sound` 文件夹中。 + +如果声音文件有一个带有空格或特殊字符的名字,重新命名它。文件名称是完全随意的,它的名称越简单,你就越容易输入到你的代码中。 + +大多数的电脑游戏使用 OGG 格式声音文件,因为这种格式在占有较小空间的情况下提供高质量的声音。当你下载一个声音文件时,它可能是一个 MP3, WAVE, FLAC, 或者其它的音频格式。为保持你的文件的较高兼容性和降低下载文件大小,使用一个工具 (像 [fre:ac][23] 或 [Miro][24]) 来转换这些的文件格式为 Ogg 格式。 + +例如,假设你已经下载一个称为 ouch.ogg 的声音文件。 + +在你代码的 setup 部分中,创建一个代表这你想使用的声音文件的变量: + + +``` +ouch = pygame.mixer.Sound(os.path.join(s, 'ouch.ogg')) +``` + +### 触发一个声音 + +为使用一个声音,你所需要做的全部工作是,当你想触发声音时来调用变量。例如,当你的玩家击中一名敌人时,触发 `OUCH` 声音效果: + + +``` +for enemy in enemy_hit_list: + pygame.mixer.Sound.play(ouch) + score -= 1 +``` + +你可以为所有的动作类型创建声音,例如,跳跃,收集奖励,投掷,碰撞,和任何你可以想象到的东西。 + +### 添加背景音乐 + +如果你有你想在你的游戏的背景中播放的音乐或令人激动的音效,你可以使用 Pygame 中的 mixer 模块中的`music` 函数。在你的 setup 部分中,加载音乐文件: + + +``` +music = pygame.mixer.music.load(os.path.join(s, 'music.ogg')) +``` + +然后,开始音乐: + + +``` +pygame.mixer.music.play(-1) +``` + +`-1` 值来告诉 Pygame 无限循环音乐文件。你可以将其设置为 `0` 或任意更高的数值,以定义音乐在停止前循环多少次。 + +### 享受声音时空 + +音乐和声音可以为你的游戏添加很多韵味。尝试添加一些声音到你的 Pygame 工程! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/add-sound-python-game + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/colorful_sound_wave.png?itok=jlUJG0bM (Colorful sound wave graph) +[2]: https://www.python.org/ +[3]: https://www.pygame.org/news +[4]: https://opensource.com/article/17/10/python-101 +[5]: https://opensource.com/article/17/12/game-framework-python +[6]: https://opensource.com/article/17/12/game-python-add-a-player +[7]: https://opensource.com/article/17/12/game-python-moving-player +[8]: https://opensource.com/article/18/5/pygame-enemy +[9]: https://opensource.com/article/18/7/put-platforms-python-game +[10]: https://opensource.com/article/19/11/simulate-gravity-python +[11]: https://opensource.com/article/19/12/jumping-python-platformer-game +[12]: https://opensource.com/article/19/12/python-platformer-game-run +[13]: https://opensource.com/article/19/12/loot-python-platformer-game +[14]: https://opensource.com/article/20/1/add-scorekeeping-your-python-game +[15]: https://opensource.com/article/20/9/add-throwing-python-game +[16]: https://www.pygame.org/docs/ref/mixer.html +[17]: https://opensource.com/article/20/1/what-creative-commons +[18]: https://freesound.org +[19]: https://incompetech.filmmusic.io +[20]: https://opengameart.org +[21]: https://opensource.com/life/16/2/linux-multimedia-studio +[22]: https://en.wikipedia.org/wiki/Vorbis +[23]: https://www.freac.org/index.php/en/downloads-mainmenu-330 +[24]: http://getmiro.com From 4e9caa667c50bc6b02655eb78ab90cafe27c150a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Mon, 9 Nov 2020 09:06:00 +0800 Subject: [PATCH 0700/1156] Translating --- .../tech/20200918 Add throwing mechanics to your Python game.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200918 Add throwing mechanics to your Python game.md b/sources/tech/20200918 Add throwing mechanics to your Python game.md index 8022106421..cb441ea94a 100644 --- a/sources/tech/20200918 Add throwing mechanics to your Python game.md +++ b/sources/tech/20200918 Add throwing mechanics to your Python game.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (robsean) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f545c84b0551d277fa2b6c71b6ee9959a8425376 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Mon, 9 Nov 2020 09:14:19 +0800 Subject: [PATCH 0701/1156] Translating --- ... Check Free Disk Space on Linux -Terminal and GUI Methods.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md b/sources/tech/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md index abbe114c41..0afc1f1e32 100644 --- a/sources/tech/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md +++ b/sources/tech/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (robsean) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From e920b0337d3cc918214b0ad0e17b4c3e5de10c4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Mon, 9 Nov 2020 09:15:39 +0800 Subject: [PATCH 0702/1156] Translating --- .../tech/20200922 Easily set image transparency using GIMP.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200922 Easily set image transparency using GIMP.md b/sources/tech/20200922 Easily set image transparency using GIMP.md index 54e3e9da76..b8d587cca3 100644 --- a/sources/tech/20200922 Easily set image transparency using GIMP.md +++ b/sources/tech/20200922 Easily set image transparency using GIMP.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (robsean) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From cd232d72947d5cb3aaa973ac1fb10cfba2eb89a1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 9 Nov 2020 10:39:05 +0800 Subject: [PATCH 0703/1156] PRF @geekpi --- ...her Linux Distributions -Beginner-s Tip.md | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/translated/tech/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md b/translated/tech/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md index 3f0e150395..832e871d20 100644 --- a/translated/tech/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md +++ b/translated/tech/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md @@ -1,56 +1,56 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Clear Terminal Screen in Ubuntu and Other Linux Distributions [Beginner’s Tip]) [#]: via: (https://itsfoss.com/clear-terminal-ubuntu/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -如何清除 Ubuntu 和其他 Linux 发行版的终端屏幕(初学者提示) +如何清除 Ubuntu 和其他 Linux 发行版的终端屏幕 ====== +![][2] + 在终端上工作时,通常会发现终端屏幕上显示了太多的命令及其输出。 你可能需要清除终端屏幕并专注于要执行的下一个任务。相信我,清除 Linux 终端屏幕会很有帮助。 ### 使用 clear 命令清除 Linux 终端 -那么,如何清除 Linux 中的终端?最简单,最常见的方法是使用 clear 命令: +那么,如何清除 Linux 中的终端?最简单,最常见的方法是使用 `clear` 命令: ``` clear ``` -你无需使用 clear 命令选项。就是这么简单,但是你还需要了解其他一些内容。 +`clear` 命令无需选项。就是这么简单,但是你还需要了解其他一些内容。 ![][1] -_ **clear 命令和其他清除屏幕的方法可能取决于你使用的终端模拟器。** _ 终端模拟器是用于访问 Linux Shell(命令行)的终端应用。 +`clear` 命令和其他清除屏幕的方法可能取决于你使用的终端模拟器。终端模拟器是用于访问 Linux Shell(命令行)的终端应用。 -如果你在具有 GNOME Terminal 的 Ubuntu 上使用 clear 命令,它将清除屏幕,并且你将无法看到之前屏幕上的内容。 +如果你在带有 GNOME 终端的 Ubuntu 上使用 `clear` 命令,它将清除屏幕,并且你将无法看到之前屏幕上的内容。 -在许多其他终端模拟器或 Putty 中,它可能只清除一页屏幕。如果使用鼠标或 PageUp 和 PageDown 键滚动,那么仍然可以看到以前的屏幕输出。 +在许多其他终端模拟器或 Putty 中,它可能只清除一页屏幕。如果使用鼠标或 `PageUp` 和 `PageDown` 键滚动,那么仍然可以看到以前的屏幕输出。 坦白说,这取决于你的需要。如果你突然意识到需要引用以前运行的命令的输出,那么也许可以使用该方式。 ### 在 Linux 中清除终端屏幕的其他方法 -![][2] +`clear` 命令不是清除终端屏幕的唯一方法。 -clear 命令不是清除终端屏幕的唯一方法。 - -你可以在 Linux 中使用 Ctrl+L [键盘快捷键][3]来清除屏幕。它适用于大多数终端模拟器。 +你可以在 Linux 中使用 `Ctrl+L` [键盘快捷键][3]来清除屏幕。它适用于大多数终端模拟器。 ``` Ctrl+L ``` -如果你在 GNOME terminal (Ubuntu 中默认)中使用 Ctrl+L 和 clear 命令,那么你会注意到它们的影响有所不同。Ctrl+L 将屏幕向下移动一页,给人一种干净的错觉,但是你仍然可以通过向上滚动来访问命令输出历史。 +如果你在 GNOME 终端(Ubuntu 中默认)中使用 `Ctrl+L` 和 `clear` 命令,那么你会注意到它们的影响有所不同。`Ctrl+L` 将屏幕向下移动一页,给人一种干净的错觉,但是你仍然可以通过向上滚动来访问命令输出历史。 -**某些其他终端模拟器将此键盘快捷键设置为 Ctrl+Shift+K**。 +**某些其他终端模拟器将此键盘快捷键设置为 `Ctrl+Shift+K`**。 -你也可以使用 reset 命令清除终端屏幕。实际上,此命令执行完整的终端重新初始化。但是,它可能比 clear 命令要花费更长的时间。 +你也可以使用 `reset` 命令清除终端屏幕。实际上,此命令执行完整的终端重新初始化。但是,它可能比 `clear` 命令要花费更长的时间。 ``` reset @@ -75,7 +75,7 @@ via: https://itsfoss.com/clear-terminal-ubuntu/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 9ebadc80836c634976913c093959ab2ec11993c1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 9 Nov 2020 10:39:37 +0800 Subject: [PATCH 0704/1156] PUB @geekpi https://linux.cn/article-12806-1.html --- ...in Ubuntu and Other Linux Distributions -Beginner-s Tip.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md (98%) diff --git a/translated/tech/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md b/published/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md similarity index 98% rename from translated/tech/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md rename to published/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md index 832e871d20..bb5988667c 100644 --- a/translated/tech/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md +++ b/published/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12806-1.html) [#]: subject: (How to Clear Terminal Screen in Ubuntu and Other Linux Distributions [Beginner’s Tip]) [#]: via: (https://itsfoss.com/clear-terminal-ubuntu/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From 8cf399dab4d42df73d4b2815f1c192d431c456bc Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 9 Nov 2020 11:00:04 +0800 Subject: [PATCH 0705/1156] PRF @geekpi --- ...has Some Exciting Improvements Lined Up.md | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/translated/tech/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md b/translated/tech/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md index bdcd81e8c7..0397417126 100644 --- a/translated/tech/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md +++ b/translated/tech/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md @@ -1,40 +1,40 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up) [#]: via: (https://itsfoss.com/kernel-5-10/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -Linux Kernel 5.10 将是下一个 LTS 版本,它有一些令人兴奋的改进 +Linux 内核 5.10 LTS 的一些令人兴奋的改进 ====== -_**Linux Kernel 5.10 的开发正在进行中。已确认这是一个长期支持的版本,将带来更新的硬件支持和其他承诺的功能。**_ +> Linux 内核 5.10 的开发正在进行中。已确认这是一个长期支持的版本,将带来更新的硬件支持和其他承诺的功能。 ### Linux Kernel 5.10 将是长期支持版本 -主要稳定内核维护者 **Greg Kroah-Hartman** 在 Linux 基金会欧洲开源峰会的 “Ask the Expert” 会议上发言,确认 Linux 5.10 将是下一个 LTS 版本。 +主要稳定内核维护者 **Greg Kroah-Hartman** 在 Linux 基金会欧洲开源峰会的 “Ask the Expert” 环节上发言,确认 Linux 5.10 将是下一个 LTS 版本。 -尽管早期有一些关于 5.9 是 LTS 版本的猜测,但 Greg 澄清说,一年的最后一个内核版本永远是 LTS 版本。 +尽管早期有一些关于 5.9 是 LTS 版本的猜测,但 Greg 澄清说,**一年的最后一个内核版本永远是 LTS 版本**。 -目前来看,[Linux Kernel 5.4][1] 系列恰好是最新的 LTS 版本,它增加了很多改进和硬件支持。另外,考虑到开发进度,Linux [Kernel 5.8][2] 是目前最大的版本,而 Linux 5.10 的第一个候选版本也很接近,所以下面有很多事情要做。 +目前来看,[Linux 内核 5.4][1] 系列恰好是最新的 LTS 版本,它增加了很多改进和硬件支持。另外,考虑到开发进度,Linux [内核 5.8][2] 是目前最大的版本,而 Linux 5.10 的第一个候选版本也很接近,所以下面有很多事情要做。 -让我们来看看 Linux Kernel 5.10 的一些功能和改进。 +让我们来看看 Linux 内核 5.10 的一些功能和改进。 -### Linux kernel 5.10 的功能 +### Linux 内核 5.10 特性 ![][4] -**注意:** _Linux Kernel 5.10 仍处于早期开发阶段。因此,我们将定期更新文章,以更新最新的补充/功能。_ +**注意:** Linux 内核 5.10 仍处于早期开发阶段。因此,我们将定期更新文章,以更新最新的补充/功能。 #### AMD Zen 3 处理器支持 -新的 [Ryzen 5000][5] 产品线是 2020 年最大的看点之一。所以,随着 Linux Kernel 5.10 发布候选版本的推出,针对 Zen 3 处理器的各种新增功能也在陆续推出。 +新的 [Ryzen 5000][5] 产品线是 2020 年最大的看点之一。所以,随着 Linux 内核 5.10 发布候选版本的推出,针对 Zen 3 处理器的各种新增功能也在陆续推出。 #### Intel Rocket Lake 支持 -我并不对 Intel 的 Rocket Lake 芯片组在明年 Q1(2021 年)出货报太大希望。但是,考虑到英特尔在不断地压榨 14 纳米制程,看到 Intel Rocket Lake 在 Linux Kernel 5.10 上所做的工作,绝对是一件好事。 +我并不对 Intel 的 Rocket Lake 芯片组在明年(2021 年) Q1 出货报太大希望。但是,考虑到英特尔在不断地压榨 14 纳米制程,看到 Intel Rocket Lake 在 Linux 内核 5.10 上所做的工作,绝对是一件好事。 #### Radeon RX 6000 系列开源驱动 @@ -42,8 +42,7 @@ _**Linux Kernel 5.10 的开发正在进行中。已确认这是一个长期支 当然,除非它和 Vega 系列或 5000 系列遇到的同样问题。 -很高兴在 Linux Kernel 5.10 上看到下一代 Radeon GPU 的开源驱动已经完成。 - +很高兴在 Linux 内核 5.10 上看到下一代 Radeon GPU 的开源驱动已经完成。 #### 文件系统优化和存储改进 @@ -55,9 +54,9 @@ _**Linux Kernel 5.10 的开发正在进行中。已确认这是一个长期支 目前,对 SoundBlaster AE-7 的支持、对 NVIDIA Orin(AI 处理器)的早期支持以及 Tiger Lake GPU 的改进似乎是主要亮点。 -Linux Kernel 5.10 的稳定版本应该会在 12 月中旬左右发布。它将被支持至少2年,但可能一直会有安全/bug 修复更新,直到 2026 年。因此,我们将继续关注下一个 Linux Kernel 5.10 LTS 版本的发展,以获得任何令人兴奋的东西。 +Linux 内核 5.10 的稳定版本应该会在 12 月中旬左右发布。它将被支持至少 2 年,但可能一直会有安全和 bug 修复更新,直到 2026 年。因此,我们将继续关注下一个 Linux 内核 5.10 LTS 版本的发展,以获得任何令人兴奋的东西。 -你对即将发布的 Linux Kernel 5.10 有什么看法?请在评论中告诉我们你的想法。 +你对即将发布的 Linux 内核 5.10 有什么看法?请在评论中告诉我们你的想法。 -------------------------------------------------------------------------------- @@ -66,7 +65,7 @@ via: https://itsfoss.com/kernel-5-10/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 30cae4dfa8a62945fec4cd6c6bcad941e0791f2d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 9 Nov 2020 11:00:33 +0800 Subject: [PATCH 0706/1156] PUB @geekpi https://linux.cn/article-12807-1.html --- ... Release and it has Some Exciting Improvements Lined Up.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md (98%) diff --git a/translated/tech/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md b/published/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md similarity index 98% rename from translated/tech/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md rename to published/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md index 0397417126..ac2f20a8e5 100644 --- a/translated/tech/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md +++ b/published/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12807-1.html) [#]: subject: (Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up) [#]: via: (https://itsfoss.com/kernel-5-10/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From 8c82cdc014447d109b0529a369d8dca2b1ae45e8 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 9 Nov 2020 11:10:09 +0800 Subject: [PATCH 0707/1156] APL --- ...1028 How JavaScript became a serious programming language.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201028 How JavaScript became a serious programming language.md b/sources/tech/20201028 How JavaScript became a serious programming language.md index 7818764717..e1d5ee3218 100644 --- a/sources/tech/20201028 How JavaScript became a serious programming language.md +++ b/sources/tech/20201028 How JavaScript became a serious programming language.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 8e90d1bf3273e856f65b97a49267b48e91727c65 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 9 Nov 2020 11:56:56 +0800 Subject: [PATCH 0708/1156] TSL&PRF @wxy --- ...t became a serious programming language.md | 81 ------------------ ...t became a serious programming language.md | 82 +++++++++++++++++++ 2 files changed, 82 insertions(+), 81 deletions(-) delete mode 100644 sources/tech/20201028 How JavaScript became a serious programming language.md create mode 100644 translated/tech/20201028 How JavaScript became a serious programming language.md diff --git a/sources/tech/20201028 How JavaScript became a serious programming language.md b/sources/tech/20201028 How JavaScript became a serious programming language.md deleted file mode 100644 index e1d5ee3218..0000000000 --- a/sources/tech/20201028 How JavaScript became a serious programming language.md +++ /dev/null @@ -1,81 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How JavaScript became a serious programming language) -[#]: via: (https://opensource.com/article/20/10/history-javascript) -[#]: author: (Nimisha Mukherjee https://opensource.com/users/nimisha) - -How JavaScript became a serious programming language -====== -From humble beginnings as a way to make websites pretty, JavaScript has -been transformed into a serious programming language. -![Javascript code close-up with neon graphic overlay][1] - -JavaScript's humble start began in 1995, when it was [created in just 10 days][2] by Brendan Eich, then an employee with Netscape Communications Corporation. JavaScript has come a long way since then, from a tool to make websites pretty to a serious programming language. - -In its early days, JavaScript was considered a visual tool that made websites a little more fun and attractive. Languages like [Jakarta Server Pages][3] (JSP; formerly JavaServer Pages) used to do all the heavy lifting on rendered web pages, and JavaScript was used to create basic interactions, visual enhancements, and animations. - -For a long time, the demarcations between HTML, CSS, and JavaScript were not clear. Frontend development primarily consists of HTML, CSS, and JavaScript, forming a "[layer cake][4]" of standard web technologies. - -![Layer cake of standard web technologies][5] - -The "[layer cake][4]" of standard web technologies (Mozilla Developers Network, [CC BY-SA 4.0][6]) - -HTML and CSS provide structure, format, and style to content. JavaScript comes into play once a web page does something beyond displaying static content. Ecma International develops JavaScript specifications, and the World Wide Web Consortium (W3C) develops HTML and CSS specifications. - -### How JavaScript gained prominence - -There is a long [history][7] behind how JavaScript came to be the [most popular][8] programming language. Back in the 1990s, Java was king, and comparisons to it were inevitable. Many engineers thought JavaScript was not a good programming language due to lack of support for object-oriented programming. Even though it was not evident, JavaScript's object-model and functional features were already present in its first version. - -After JavaScript's rushed release in 1995, Netscape submitted it to the European Computer Manufacturers Association (ECMA) International for standardization. This led to [ECMAScript][9], a JavaScript standard meant to ensure interoperability of web pages across different web browsers. ECMAScript 1 came out in June 1997 and helped to advance the standardization of JavaScript. - -During this time, PHP and JSP became popular server-side language choices. JSP had gained prominence as the preferred alternative to Common Gateway Interface ([CGI][10]) because it enabled embedding Java code in HTML. While it was popular, developers found it unnatural to have Java inside HTML. In addition, even for the simplest text change on HTML, JSP had to undergo a time-consuming lifecycle. In today's microservice world, JSP-oriented pages are considered technical debt.  - -[PHP][11] works similarly to JSP but the PHP code is processed as a Common Gateway Interface ([CGI][10]) executable. PHP-based web applications are easier to deploy than those based on JSP. Overall, it is easier to get up and running with PHP. Today, PHP and JavaScript are one of the most popular combinations for creating dynamic websites. PHP serves as the server-side scripting and JavaScript as the client-side scripting. - -JavaScript's adoption grew with the release of [jQuery][12], a multi-purpose JavaScript library that simplifies tedious Document Object Model (DOM) management, event handling, and [Ajax][13], in 2006.  - -The turning point for JavaScript came in 2009 when [Node.js][14] was released. Developers could now write server-side scripting with JavaScript. Closely following were frameworks like [Backbone.js][15] and [AngularJS][16], both released in 2010. This led to the concept of full-stack development using a single language. - -In 2015, Ecma International released ECMAScript 6 (ES6), which added significant new syntax for writing complex applications, including class declarations. Other new features included iterators, arrow function expressions, let and const keywords, typed arrays, new collections (maps, sets, and WeakMap), promises, template literals for strings, and many other cool features. Later editions have gone on to add more features that have made JavaScript more robust, streamlined, and reliable. - -### Conclusion - -JavaScript has advanced significantly over the past two decades. Most browsers now compete to meet compliance, so the latest specifications are rolled out faster. - -There are a host of stable JavaScript frameworks to choose from, depending on your project requirements, including the most popular ones: [React][17], [Angular][18], and [Vue.js][19]. In the next article in this series, I'll dive into why JavaScript is so popular. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/10/history-javascript - -作者:[Nimisha Mukherjee][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://opensource.com/users/nimisha -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_javascript.jpg?itok=60evKmGl (Javascript code close-up with neon graphic overlay) -[2]: https://en.wikipedia.org/wiki/JavaScript -[3]: https://en.wikipedia.org/wiki/Jakarta_Server_Pages -[4]: https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps/What_is_JavaScript -[5]: https://opensource.com/sites/default/files/uploads/layercakewebtech.png (Layer cake of standard web technologies) -[6]: https://creativecommons.org/licenses/by-sa/4.0/ -[7]: https://blog.logrocket.com/history-of-frontend-frameworks/ -[8]: https://octoverse.github.com/ -[9]: https://en.wikipedia.org/wiki/ECMAScript -[10]: https://en.wikipedia.org/wiki/Common_Gateway_Interface -[11]: https://en.wikipedia.org/wiki/PHP#:~:text=PHP%20development%20began%20in%201994,Interpreter%22%20or%20PHP%2FFI. -[12]: https://en.wikipedia.org/wiki/JQuery -[13]: https://en.wikipedia.org/wiki/Ajax_(programming) -[14]: https://en.wikipedia.org/wiki/Node.js -[15]: https://en.wikipedia.org/wiki/Backbone.js -[16]: https://en.wikipedia.org/wiki/AngularJS -[17]: https://reactjs.org/ -[18]: https://angular.io/ -[19]: https://vuejs.org/ diff --git a/translated/tech/20201028 How JavaScript became a serious programming language.md b/translated/tech/20201028 How JavaScript became a serious programming language.md new file mode 100644 index 0000000000..b15d5b52c6 --- /dev/null +++ b/translated/tech/20201028 How JavaScript became a serious programming language.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How JavaScript became a serious programming language) +[#]: via: (https://opensource.com/article/20/10/history-javascript) +[#]: author: (Nimisha Mukherjee https://opensource.com/users/nimisha) + +JavaScript 是如何成为一门严肃的编程语言的 +====== + +> 从最开始作为一种使网站变得漂亮的方式,JavaScript 已转变为一种严肃的编程语言。 + +![Javascript 代码特写与霓虹灯图形叠加][1] + +JavaScript 的卑微起步始于 1995 年,是由当时在 Netscape 通信公司工作的 Brendan Eich [在短短 10 天内创建的][2]。从那时起,JavaScript 已经走过了漫长的道路,从一个让网站变得漂亮的工具变成了一种严肃的编程语言。 + +在其早期,JavaScript 被认为是一种视觉工具,它使网站变得更有趣和更有吸引力。像 [Jakarta Server Pages][3](即 JSP,以前称作 JavaServer Pages)这样的语言曾经用来完成渲染网页的繁重工作,而 JavaScript 则被用来创建基本的交互、视觉增强和动画。 + +长期以来,HTML、CSS 和 JavaScript 之间的分界并不明确。前端开发主要由 HTML、CSS 和 JavaScript 组成,形成了标准 Web 技术的“[多层蛋糕][4]”。 + +![标准 Web 技术的多层蛋糕][5] + +*标准网络技术的“[多层蛋糕][4]”(Mozilla 开发者网络,[CC BY-SA 4.0][6])* + +HTML 和 CSS 为内容提供结构、格式和样式。一旦网页要做一些超越了显示静态内容的事情,就是 JavaScript 的用武之地。Ecma 国际部开发了 JavaScript 规范,万维网联盟World Wide Web Consortium(W3C)开发了 HTML 和 CSS 规范。 + +### JavaScript 是如何获得突出地位的 + +JavaScript 是如何成为[最受欢迎的][8]编程语言的,背后有一段漫长的[历史][7]。早在 20 世纪 90 年代,Java 是王者,不可避免的人们会与它进行比较。许多工程师认为 JavaScript 不是一门好的编程语言,因为它缺乏对面向对象编程的支持。尽管当时并不明显,但其实 JavaScript 的对象模型和功能特性在其第一个版本中就已经出现了。 + +1995 年 JavaScript 匆匆发布后,网景公司将其提交给了欧洲计算机制造商协会European Computer Manufacturers Association(ECMA)国际部进行标准化。由此产生了 [ECMAScript][9],这是一个 JavaScript 标准,旨在确保不同 Web 浏览器之间网页的互操作性。ECMAScript 1 于 1997 年 6 月问世,帮助推进了 JavaScript 的标准化。 + +在此期间,PHP 和 JSP 成为了服务器端编程语言的流行选择。JSP 作为通用网关接口Common Gateway Interface([CGI][10])的首选替代方案获得了突出的地位,因为它可以在 HTML 中嵌入 Java 代码。虽然它很受欢迎,但开发人员发现将 Java 嵌入 HTML 中是不自然的。此外,即使是 HTML 上最简单的文本变化,JSP 也必须经历一个耗时的生命周期。在今天的微服务世界里,面向 JSP 的页面被认为是技术债务。  + +[PHP][11] 的工作原理与 JSP 类似,但 PHP 代码以一个通用网关接口([CGI][10])的可执行文件来处理。基于 PHP 的 Web 应用比基于 JSP 的应用更容易部署。总的来说,使用 PHP 更容易上手和运行。今天,PHP 和 JavaScript 是创建动态网站最流行的组合之一:PHP 作为服务器端脚本,JavaScript 作为客户端脚本。 + +伴随着 2006 年 [jQuery][12] 的发布,JavaScript 的应用越来越多。jQuery 是一个多用途的 JavaScript 库,简化了繁琐的文档对象模型Document Object Model(DOM)管理、事件处理和 [Ajax][13]。  + +2009 年 [Node.js][14] 的发布是 JavaScript 发展的转折点。开发者现在可以用 JavaScript 编写服务器端脚本了。紧随其后的是 2010 年发布的 [Backbone.js][15] 和 [AngularJS][16] 等框架。这导致了出现了使用单一语言进行全栈开发的概念。 + +2015 年,Ecma 国际部发布了 ECMAScript 6(ES6),它为编写复杂的应用程序增加了包括类声明在内的重要新语法。其他新特性还包括迭代器、箭头函数表达式、`let` 和 `const` 关键字、类型化数组、新的集合(映射、集合和 WeakMap)、Promise、字符串的模板字元以及许多其它很酷的特性。后来的版本又继续增加了更多的功能,使 JavaScript 更加强大、精简和可靠。 + +### 总结 + +在过去的 20 年里,JavaScript 有了长足的进步。现在大多数浏览器都在争相满足合规性,因此最新的规范推出得更快。 + +根据你的项目需求,有大量稳定的 JavaScript 框架可供选择,包括最流行的 [React][17]、[Angular][18] 和 [Vue.js][19] 等等。在本系列的下一篇文章中,我将深入探讨为什么 JavaScript 如此受欢迎。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/history-javascript + +作者:[Nimisha Mukherjee][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://opensource.com/users/nimisha +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_javascript.jpg?itok=60evKmGl (Javascript code close-up with neon graphic overlay) +[2]: https://en.wikipedia.org/wiki/JavaScript +[3]: https://en.wikipedia.org/wiki/Jakarta_Server_Pages +[4]: https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps/What_is_JavaScript +[5]: https://opensource.com/sites/default/files/uploads/layercakewebtech.png (Layer cake of standard web technologies) +[6]: https://creativecommons.org/licenses/by-sa/4.0/ +[7]: https://blog.logrocket.com/history-of-frontend-frameworks/ +[8]: https://octoverse.github.com/ +[9]: https://en.wikipedia.org/wiki/ECMAScript +[10]: https://en.wikipedia.org/wiki/Common_Gateway_Interface +[11]: https://en.wikipedia.org/wiki/PHP#:~:text=PHP%20development%20began%20in%201994,Interpreter%22%20or%20PHP%2FFI. +[12]: https://en.wikipedia.org/wiki/JQuery +[13]: https://en.wikipedia.org/wiki/Ajax_(programming) +[14]: https://en.wikipedia.org/wiki/Node.js +[15]: https://en.wikipedia.org/wiki/Backbone.js +[16]: https://en.wikipedia.org/wiki/AngularJS +[17]: https://reactjs.org/ +[18]: https://angular.io/ +[19]: https://vuejs.org/ From fa0251f86ba47d43dcc530668e1dfabc9e3dc68d Mon Sep 17 00:00:00 2001 From: xiao-song-123 <463020345@qq.com> Date: Mon, 9 Nov 2020 15:10:22 +0800 Subject: [PATCH 0709/1156] Update 20201102 Understand your Python code with this open source visualization tool.md --- ...ith this open source visualization tool.md | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/sources/tech/20201102 Understand your Python code with this open source visualization tool.md b/sources/tech/20201102 Understand your Python code with this open source visualization tool.md index a2a5773cfa..3a0b32259f 100644 --- a/sources/tech/20201102 Understand your Python code with this open source visualization tool.md +++ b/sources/tech/20201102 Understand your Python code with this open source visualization tool.md @@ -1,13 +1,13 @@ -[#]: collector: (lujun9972) -[#]: translator: (xiao-song-123) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Understand your Python code with this open source visualization tool) -[#]: via: (https://opensource.com/article/20/11/python-code-viztracer) -[#]: author: (Tian Gao https://opensource.com/users/gaogaotiantian) +[#]: collector: "lujun9972" +[#]: translator: "xiao-song-123" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "Understand your Python code with this open source visualization tool" +[#]: via: "https://opensource.com/article/20/11/python-code-viztracer" +[#]: author: "Tian Gao https://opensource.com/users/gaogaotiantian" -Understand your Python code with this open source visualization tool +使用此开源可视化工具来理解您的Python代码 ====== VizTracer visualizes and traces Python code to provide greater insight into how the code works. @@ -100,14 +100,14 @@ via: https://opensource.com/article/20/11/python-code-viztracer [a]: https://opensource.com/users/gaogaotiantian [b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python_programming_question.png?itok=cOeJW-8r (Python programming language logo with question marks) +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python_programming_question.png?itok=cOeJW-8r "Python programming language logo with question marks" [2]: https://github.com/gaogaotiantian/viztracer [3]: http://google.github.io/trace-viewer/ [4]: https://en.wikipedia.org/wiki/Monte_Carlo_tree_search -[5]: https://opensource.com/sites/default/files/uploads/viztracer_mcts.png (Monte Carlo tree search visualization) +[5]: https://opensource.com/sites/default/files/uploads/viztracer_mcts.png "Monte Carlo tree search visualization" [6]: https://creativecommons.org/licenses/by-sa/4.0/ -[7]: https://opensource.com/sites/default/files/uploads/viztracer_zoomin.png (Zooming in on VizTracer visualization) -[8]: https://opensource.com/sites/default/files/uploads/viztracer_details.png (Viewing VizTracer details) -[9]: https://opensource.com/sites/default/files/uploads/viztracer_gradient.png (VizTracer gradient descent) +[7]: https://opensource.com/sites/default/files/uploads/viztracer_zoomin.png "Zooming in on VizTracer visualization" +[8]: https://opensource.com/sites/default/files/uploads/viztracer_details.png "Viewing VizTracer details" +[9]: https://opensource.com/sites/default/files/uploads/viztracer_gradient.png "VizTracer gradient descent" [10]: https://docs.python.org/3/library/pdb.html [11]: https://docs.python.org/2/library/profile.html#module-cProfile From 2db19e849961f3da42c3f938886fbb0f9705b47e Mon Sep 17 00:00:00 2001 From: xiao-song-123 <463020345@qq.com> Date: Mon, 9 Nov 2020 17:21:06 +0800 Subject: [PATCH 0710/1156] translated --- ...ith this open source visualization tool.md | 39 +++++++++---------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/sources/tech/20201102 Understand your Python code with this open source visualization tool.md b/sources/tech/20201102 Understand your Python code with this open source visualization tool.md index 3a0b32259f..8cbaf0b286 100644 --- a/sources/tech/20201102 Understand your Python code with this open source visualization tool.md +++ b/sources/tech/20201102 Understand your Python code with this open source visualization tool.md @@ -7,71 +7,70 @@ [#]: via: "https://opensource.com/article/20/11/python-code-viztracer" [#]: author: "Tian Gao https://opensource.com/users/gaogaotiantian" -使用此开源可视化工具来理解您的Python代码 +使用开源可视化工具来理解您的 Python 代码 ====== -VizTracer visualizes and traces Python code to provide greater insight -into how the code works. +VizTracer 工具可以可视化并跟踪 Python 代码,让您可以更深入地了解其工作原理。 ![Python programming language logo with question marks][1] -It's challenging to understand your Python project as it gets larger and more complex. Even when you write the entire project, it's impossible to know how it works fully. Debugging and profiling your code is essential to better understanding it. +随之 Python 项目变得越来越大、越复杂,理解起它来就变得充满挑战性。即使是您自己独自编写了整个项目,也不可能完全知道项目是如何工作的。为了能更好的理解您的代码,调试和分析代码变得至关重要。 -[VizTracer][2] is a tool to help you understand Python code by tracing and visualizing its execution. Without making any changes to your source code, VizTracer can log function entries/exits, function arguments/returns, and any arbitrary variables, then display the data using an intuitive front-end Google [Trace-Viewer][3]. +[VizTracer][2] 是一个这样的工具,它通过跟踪和可视化 Python 代码的执行过程,来帮助您对代码的理解。无需对源代码进行任何更改,VizTracer 即可记录函数的入口 / 出口,函数参数 / 返回值以及任意变量,然后通过 [Trace-Viewer][3] 使用直观的谷歌前端界面来显示数据。 -Here is an example of running a [Monte Carlo tree search][4]: +下面是一个运行[蒙特卡洛树搜索][4]的例子: ![Monte Carlo tree search visualization][5] (Tian Gao, [CC BY-SA 4.0][6]) -Every function is logged and visualized in stack style on a timeline so that you can see what is happening when you run a program. You can zoom in to see the details at any specific point: +每个函数都在时间线上以堆栈的形式记录和可视化,这样您就可以看到在运行程序时发生了什么。您可以放大查看任意特定点的详细信息: ![Zooming in on VizTracer visualization][7] (Tian Gao, [CC BY-SA 4.0][6]) -VizTracer can also automatically log function arguments and return value; you can click on the function entry and see the detail info: +VizTracer 还可以自动记录函数参数和返回值。您可以单击功能条目并查看详细信息: ![Viewing VizTracer details][8] (Tian Gao, [CC BY-SA 4.0][6]) -Or you can create a whole new signal and use it to log variables. For example, this shows the cost value when you do a gradient descent: +或者您可以创建一个全新的信号,并用它来记录变量。例如,这显示了执行梯度下降时的代价值: ![VizTracer gradient descent][9] (Tian Gao, [CC BY-SA 4.0][6]) -In contrast to other tools with complicated setups, VizTracer is super-easy to use and does not have any dependencies. You can install it from pip with: +与其他设置复杂的工具相比,VizTracer 使用起来非常简单,并且没有任何依赖关系。您可以从 pip 安装它: ``` `pip install viztracer` ``` -And trace your program by entering (where `` is the name of your script): +您也可以通过输入来跟踪你的程序 ( `` 是您脚本的名称): ``` `viztracer ` ``` -VizTracer will generate an HTML report in your working directory that you can open in Chrome. +VizTracer 将在您的工作目录中生成一个 HTML 报告,您可以在 Chrome 浏览器中打开它。 -VizTracer offers other advanced features, such as filters, which you can use to filter out the functions that you do not want to trace so that you'll have a cleaner report. For example, to include only the functions in files, you are interested in: +VizTracer 还提供了其他高级功能,比如过滤器功能,您可以使用它过滤掉不想跟踪的函数,获得更清晰的报告。例如,要仅包含文件中的函数,您需要: ``` `viztracer include_files ./ --run ` ``` -To record the function arguments and return value: +记录函数参数和返回值: ``` `viztracer --log_function_args --log_return_value ` ``` -To log any arbitrary variables matching a certain regex: +记录与某个正则表达式匹配的任意变量: ``` @@ -79,13 +78,13 @@ To log any arbitrary variables matching a certain regex: viztracer --log_var a.* --run <your_script.py> ``` -You can get other features, like custom events to log numeric values and objects, by making minor modifications to your source code. +您可以通过对源代码进行较小的修改来获得其他功能,例如自定义事件来记录数值和对象。 -VizTracer also includes a virtual debugger (vdb) that can debug VizTracer's log file. vdb debugs your executed code (much like [pdb][10]) so that you can understand the code flow. Helpfully, it supports running back in time because it knows everything that happened. +VizTracer 还包括一个虚拟调试器( vdb ),它可以调试 VizTracer 的日志文件。可以用 vdb 调试您运行中的代码 (与 [pdb][10] 非常相似 ) 以便您了解代码流。有用的是,它还支持时间回溯,因为它知道发生的一切。 -Unlike some prototypes, VizTracer implements its core in pure C, which significantly reduces the overhead to a level similar to [cProfile][11]. +与一些原型不同,VizTracer 使用纯 C 语言实现其核心,这将极大地减少开销,使其达到类似于 [cProfile][11] 的水平。 -VizTracer is open source, released under the Apache 2.0 License, and supports all common operating systems platforms (Linux, macOS, and Windows). You can learn more about its features and access its source code on [GitHub][2]. +VizTracer 是开源的,在 Apache 2.0 许可下发布,支持所有常见的操作系统平台(Linux、macOS和Windows)。你可以在 [GitHub][2] 上了解关于它的更多特性并访问源代码。 -------------------------------------------------------------------------------- @@ -93,7 +92,7 @@ via: https://opensource.com/article/20/11/python-code-viztracer 作者:[Tian Gao][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[xiao-song-123](https://github.com/xiao-song-123) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From d51e388f7325c76d5aa00ba432080042d63d8e24 Mon Sep 17 00:00:00 2001 From: xiao-song-123 <463020345@qq.com> Date: Mon, 9 Nov 2020 17:23:11 +0800 Subject: [PATCH 0711/1156] translated --- ...d your Python code with this open source visualization tool.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20201102 Understand your Python code with this open source visualization tool.md (100%) diff --git a/sources/tech/20201102 Understand your Python code with this open source visualization tool.md b/translated/tech/20201102 Understand your Python code with this open source visualization tool.md similarity index 100% rename from sources/tech/20201102 Understand your Python code with this open source visualization tool.md rename to translated/tech/20201102 Understand your Python code with this open source visualization tool.md From 669c5f9e4c180f18826fe661283cf63fc66de576 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 10 Nov 2020 08:43:59 +0800 Subject: [PATCH 0712/1156] translated --- ...Detect New LUNs and SCSI Disks on Linux.md | 163 ------------------ ...Detect New LUNs and SCSI Disks on Linux.md | 163 ++++++++++++++++++ 2 files changed, 163 insertions(+), 163 deletions(-) delete mode 100644 sources/tech/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md create mode 100644 translated/tech/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md diff --git a/sources/tech/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md b/sources/tech/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md deleted file mode 100644 index bc63527249..0000000000 --- a/sources/tech/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md +++ /dev/null @@ -1,163 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Scan/Detect New LUNs and SCSI Disks on Linux) -[#]: via: (https://www.2daygeek.com/scan-detect-luns-scsi-disks-on-redhat-centos-oracle-linux/) -[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) - -How to Scan/Detect New LUNs and SCSI Disks on Linux -====== - -When the Linux system has connected to the SAN (Storage Area Network) you need to rescan the iSCSI service to discover new LUNs. - -To do so, you must provide the WWN number of the Linux host and required LUN size to the storage team. - -The following article will help you [**find the WWN number of a Linux host**][1]. - -Once the storage team has mapped the LUNs with the given Linux host, they will provide you with the new LUN details. - -LUN in storage terms is referred to as serial-hex of LUN. - -You need to scan the SCSI host to find new LUNs assigned by the storage team. - -This can be done in two ways, scan each scsi host device or run the “rescan-scsi-bus.sh” script to detect new disks. - -After scanning they can be found under the “/dev/disk/by-id” directory. - -``` -# ll /dev/disk/by-id - -total 0 -lrwxrwxrwx 1 root root 10 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684b -> ../../sdah -lrwxrwxrwx 1 root root 9 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684c -> ../../sdw -. -. -lrwxrwxrwx 1 root root 10 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684d -> ../../sdjk -lrwxrwxrwx 1 root root 10 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684e -> ../../sdaa -lrwxrwxrwx 1 root root 9 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684f -> ../../sdh -``` - -Also, you can find them using the Multipath command if you already have them configured with Multipath. - -Multipath is mostly configured into the Oracle database server for better performance. - -``` -# multipath -ll - -60a98000486e542d4f5a2f47694d684b dm-37 NETAPP,LUN C-Mode -size=512G features='3 queue_if_no_path pg_init_retries 50' hwhandler='1 alua' wp=rw -|-+- policy='round-robin 0' prio=50 status=active -| |- 1:0:4:18 sdoe 128:416 active ready running -| |- 0:0:4:18 sdpq 131:256 active ready running -| |- 0:0:5:18 sdsr 135:496 active ready running -| `- 1:0:5:18 sdsq 135:480 active ready running -`-+- policy='round-robin 0' prio=10 status=enabled - |- 1:0:1:18 sdfw 131:32 active ready running - |- 1:0:0:18 sdci 69:96 active ready running - |- 0:0:1:18 sdbz 68:208 active ready running - |- 0:0:0:18 sds 65:32 active ready running - |- 1:0:3:18 sdmd 69:336 active ready running - |- 1:0:2:18 sdjj 8:464 active ready running - |- 0:0:3:34 sdjt 65:368 active ready running - `- 0:0:2:34 sdgi 131:224 active ready running -``` - -This procedure works on Red Hat 6.x, 7.x and 8.x (RHEL – Red Hat Enterprise Linux) based systems such as CentOS and Oracle Linux. - -### Method-1: How to Scan New LUNs and SCSI Disks on Linux Using the “/sys” Class File - -The sysfs filesystem is a pseudo-filesystem which provides an interface to kernel data structures. - -The files under sysfs provide information about devices, kernel modules, filesystems, and other kernel components. - -The sysfs filesystem is commonly mounted at “/sys”. Typically, it is mounted automatically by the system. - -You can use the echo command to scan each scsi host device as shown below. - -``` -# echo "- - -" > /sys/class/scsi_host/host[n]/scan -``` - -When you run the above command that rescan everything, the three dash (“- – -“) refers the wildcard option. These values would be as follow. - -``` -# echo "c t l" > /sys/class/scsi_host/host[n]/scan -``` - -where - - * **c –** Channel on the HBA - * **t –** SCSI target ID - * **l –** LUN ID - * **n –** HBA number - - - -Run the below command to find all the host bus number on your system. - -``` -# ls /sys/class/scsi_host -host0 host1 host2 -``` - -Once you get the host bus number, run the following command to discover new disks. - -``` -# echo "- - -" > /sys/class/scsi_host/host0/scan -# echo "- - -" > /sys/class/scsi_host/host1/scan -# echo "- - -" > /sys/class/scsi_host/host2/scan -``` - -Also, it can be scanned using “for loop” with a single command. - -``` -# for host in ls /sys/class/scsi_host/;do echo "- - -" >/sys/class/scsi_host/${host}/scan; done -``` - -You can check them using the **[ls command][2]** as mentioned at the beginning of the article. - -``` -# ls /dev/disk/by-id | grep -i "serial-hex of LUN" -``` - -### Method-2: How to Scan New LUNs and SCSI Disks on Linux Using the rescan-scsi-bus.sh Script - -Make sure you have already installed the “sg3_utils” package to use this script. Otherwise, run the following command to install it. - -For **RHEL/CentOS 6/7** systems, use the **[yum command][3]** to install sg3_utils. - -``` -# yum install -y sg3_utils -``` - -For **RHEL/CentOS 8** and Fedora systems, use the **[dnf command][4]** to install sg3_utils. - -``` -# dnf install -y sg3_utils -``` - -Now you can rescan the LUNs using the rescan-scsi-bus.sh script. - -``` -# ./rescan-scsi-bus.sh -``` - --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/scan-detect-luns-scsi-disks-on-redhat-centos-oracle-linux/ - -作者:[Magesh Maruthamuthu][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://www.2daygeek.com/author/magesh/ -[b]: https://github.com/lujun9972 -[1]: https://www.2daygeek.com/how-to-find-wwn-wwnn-wwpn-number-of-hba-card-in-linux/ -[2]: https://www.2daygeek.com/linux-unix-ls-command-display-directory-contents/ -[3]: https://www.2daygeek.com/linux-yum-command-examples-manage-packages-rhel-centos-systems/ -[4]: https://www.2daygeek.com/linux-dnf-command-examples-manage-packages-fedora-centos-rhel-systems/ diff --git a/translated/tech/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md b/translated/tech/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md new file mode 100644 index 0000000000..9fc298c259 --- /dev/null +++ b/translated/tech/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md @@ -0,0 +1,163 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Scan/Detect New LUNs and SCSI Disks on Linux) +[#]: via: (https://www.2daygeek.com/scan-detect-luns-scsi-disks-on-redhat-centos-oracle-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +如何在 Linux 上扫描/检测新的 LUN 和 SCSI 磁盘? +====== + +当 Linux 系统连接到 SAN(存储区域网络)后,你需要重新扫描 iSCSI 服务以发现新的 LUN。 + +要做到这一点,你必须向存储团队提供 Linux 主机的 WWN 号和所需的 LUN 大小。 + +下文将帮助你[**查找 Linux 主机的 WWN 号**][1]。 + +当存储团队将 LUN 与给定的 Linux 主机进行了映射,他们将为你提供新的 LUN 详细信息。 + +LUN 在存储术语中被称为 LUN 的串行十六进制。 + +你需要扫描 SCSI 主机来寻找存储团队分配的新 LUN。 + +这可以通过两种方式进行,扫描每个 scsi 主机设备或运行 “rescan-scsi-bus.sh” 脚本来检测新磁盘。 + +扫描后可以在 “/dev/disk/by-id” 目录下找到它们。 + +``` +# ll /dev/disk/by-id + +total 0 +lrwxrwxrwx 1 root root 10 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684b -> ../../sdah +lrwxrwxrwx 1 root root 9 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684c -> ../../sdw +. +. +lrwxrwxrwx 1 root root 10 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684d -> ../../sdjk +lrwxrwxrwx 1 root root 10 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684e -> ../../sdaa +lrwxrwxrwx 1 root root 9 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684f -> ../../sdh +``` + +另外,如果你已经用 Multipath 配置了它们,那么可以用 Multipath 命令找到。 + +Multipath 主要是配置到 Oracle 数据库服务器中,以提高性能。 + +``` +# multipath -ll + +60a98000486e542d4f5a2f47694d684b dm-37 NETAPP,LUN C-Mode +size=512G features='3 queue_if_no_path pg_init_retries 50' hwhandler='1 alua' wp=rw +|-+- policy='round-robin 0' prio=50 status=active +| |- 1:0:4:18 sdoe 128:416 active ready running +| |- 0:0:4:18 sdpq 131:256 active ready running +| |- 0:0:5:18 sdsr 135:496 active ready running +| `- 1:0:5:18 sdsq 135:480 active ready running +`-+- policy='round-robin 0' prio=10 status=enabled +|- 1:0:1:18 sdfw 131:32 active ready running +|- 1:0:0:18 sdci 69:96 active ready running +|- 0:0:1:18 sdbz 68:208 active ready running +|- 0:0:0:18 sds 65:32 active ready running +|- 1:0:3:18 sdmd 69:336 active ready running +|- 1:0:2:18 sdjj 8:464 active ready running +|- 0:0:3:34 sdjt 65:368 active ready running +`- 0:0:2:34 sdgi 131:224 active ready running +``` + +这个过程适用于基于 Red Hat 6.x、7.x 和 8.x(RHEL - Red Hat Enterprise Linux)的系统,如 CentOS 和 Oracle Linux。 + +### 方法 1:如何使用 “/sys” 类文件在 Linux 上扫描新的 LUN 和 SCSI 磁盘 + +sysfs 文件系统是一个伪文件系统,它为内核数据结构提供了一个接口。 + +sysfs 下的文件提供了关于设备、内核模块、文件系统和其他内核组件的信息。 + +sysfs 文件系统通常被挂载在 “/sys”。通常,它是由系统自动挂载的。 + +你可以使用 echo 命令来扫描每个 scsi 主机设备,如下所示: + +``` +# echo "- - -" > /sys/class/scsi_host/host[n]/scan +``` + +当你运行上面的重新扫描所有的命令时,三个破折号(“- – -“)指的是通配符选项。这些值如下: + +``` +# echo "c t l" > /sys/class/scsi_host/host[n]/scan +``` + +这里: + +* **c –** HBA 上的通道 +* **t –** SCSI 目标 ID +* **l –** LUN ID +* **n –** HBA 编号 + + + +运行下面的命令来查找系统中所有的主机总线编号: + +``` +# ls /sys/class/scsi_host +host0 host1 host2 +``` + +得到主机总线编号后,运行以下命令来发现新的磁盘: + +``` +# echo "- - -" > /sys/class/scsi_host/host0/scan +# echo "- - -" > /sys/class/scsi_host/host1/scan +# echo "- - -" > /sys/class/scsi_host/host2/scan +``` + +另外,还可以用 ”for 循环“用一条命令进行扫描。 + +``` +# for host in ls /sys/class/scsi_host/;do echo "- - -" >/sys/class/scsi_host/${host}/scan; done +``` + +你可以使用文章开头提到的 **[ls 命令][2]**来检查它们。 + +``` +# ls /dev/disk/by-id | grep -i "serial-hex of LUN" +``` + +### 方法 2:如何使用 rescan-scsi-bus.sh 脚本在 Linux 上扫描新的 LUN 和 SCSI 磁盘 + +确保你已经安装了 “sg3_utils” 包来使用这个脚本。否则,运行以下命令来安装它。 + +对于 **RHEL/CentOS 6/7** 系统,使用 **[yum 命令][3]**安装 sg3_utils。 + +``` +# yum install -y sg3_utils +``` + +对于 **RHEL/CentOS 8** 和 Fedora 系统,使用 **[dnf 命令][4]**安装 sg3_utils。 + +``` +# dnf install -y sg3_utils +``` + +现在你可以使用 rescan-scsi-bus.sh 脚本重新扫描 LUN。 + +``` +# ./rescan-scsi-bus.sh +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/scan-detect-luns-scsi-disks-on-redhat-centos-oracle-linux/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/how-to-find-wwn-wwnn-wwpn-number-of-hba-card-in-linux/ +[2]: https://www.2daygeek.com/linux-unix-ls-command-display-directory-contents/ +[3]: https://www.2daygeek.com/linux-yum-command-examples-manage-packages-rhel-centos-systems/ +[4]: https://www.2daygeek.com/linux-dnf-command-examples-manage-packages-fedora-centos-rhel-systems/ \ No newline at end of file From 1a28012bbf1b62dda9341eefd1b67e053a786da9 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 10 Nov 2020 08:53:49 +0800 Subject: [PATCH 0713/1156] translating --- ...01103 GnuCash- A Powerful Open Source Accounting Software.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201103 GnuCash- A Powerful Open Source Accounting Software.md b/sources/tech/20201103 GnuCash- A Powerful Open Source Accounting Software.md index 0fb7826743..56be77dbaa 100644 --- a/sources/tech/20201103 GnuCash- A Powerful Open Source Accounting Software.md +++ b/sources/tech/20201103 GnuCash- A Powerful Open Source Accounting Software.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From cd7304a7892aab0827bf8c5fb396e390050fa4da Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 10 Nov 2020 09:24:28 +0800 Subject: [PATCH 0714/1156] PUB @wxy https://linux.cn/article-12809-1.html --- ...nux Jargon Buster- What are GUI, CLI and TUI in Linux.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201103 Linux Jargon Buster- What are GUI, CLI and TUI in Linux.md (97%) diff --git a/translated/tech/20201103 Linux Jargon Buster- What are GUI, CLI and TUI in Linux.md b/published/20201103 Linux Jargon Buster- What are GUI, CLI and TUI in Linux.md similarity index 97% rename from translated/tech/20201103 Linux Jargon Buster- What are GUI, CLI and TUI in Linux.md rename to published/20201103 Linux Jargon Buster- What are GUI, CLI and TUI in Linux.md index 50fade6de8..b75edaa882 100644 --- a/translated/tech/20201103 Linux Jargon Buster- What are GUI, CLI and TUI in Linux.md +++ b/published/20201103 Linux Jargon Buster- What are GUI, CLI and TUI in Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12809-1.html) [#]: subject: (Linux Jargon Buster: What are GUI, CLI and TUI in Linux?) [#]: via: (https://itsfoss.com/gui-cli-tui/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) @@ -10,6 +10,8 @@ Linux 黑话解释:什么是 Linux 中的 GUI、CLI 和 TUI? ====== +![](https://img.linux.net.cn/data/attachment/album/202011/10/092051zw3ofb365a63fahl.jpg) + 当你开始使用 Linux 并关注关于 Linux 的网站和论坛时,你会经常遇到诸如 GUI、CLI 等术语,有时还会遇到 TUI。 这一章的 Linux 黑话解释简要解释了这些术语,以便你作为一个(新的)Linux 用户在使用这些缩写词时能够更好地理解上下文。 From e02155eba76b6ca6a393f5cfe651206abd93228a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 10 Nov 2020 09:57:26 +0800 Subject: [PATCH 0715/1156] PRF @geekpi --- ...ol new projects to try in COPR from October 2020.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/translated/tech/20201102 4 cool new projects to try in COPR from October 2020.md b/translated/tech/20201102 4 cool new projects to try in COPR from October 2020.md index de7397e856..739c8cf742 100644 --- a/translated/tech/20201102 4 cool new projects to try in COPR from October 2020.md +++ b/translated/tech/20201102 4 cool new projects to try in COPR from October 2020.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (4 cool new projects to try in COPR from October 2020) @@ -33,13 +33,13 @@ sudo dnf install dialect ### GitHub CLI -[gh][7] 是一个官方的 GitHub 命令行客户端。它在终端提供了快速的访问,并完全控制你的项目问题、拉取请求和发布。问题(和其他东西)也可以在浏览器中轻松查看,以获得更标准的用户界面,或与他人分享。 +[gh][7] 是一个官方的 GitHub 命令行客户端。它在终端提供了快速的访问,并完全控制你的项目问题、拉取请求和发布。议题(和其他东西)也可以在浏览器中轻松查看,以获得更标准的用户界面,或与他人分享。 ![][8] #### 安装说明 -目前[仓库][9]在 Fedora 33 和 Fedora Rawhide 中提供了 _gh_ 。要安装它,请使用下面的命令: +目前[仓库][9]在 Fedora 33 和 Fedora Rawhide 中提供了 `gh` 。要安装它,请使用下面的命令: ``` sudo dnf copr enable jdoss/github-cli @@ -69,7 +69,7 @@ sudo dnf install glide-rs #### 安装说明 -目前[仓库][15]在 Fedora 31、32、33 和 Rawhide 还有 EPEL8 中提供了 _vim-ale_ 。要安装它,请使用下面的命令: +目前[仓库][15]在 Fedora 31、32、33 和 Rawhide 还有 EPEL8 中提供了 `vim-ale` 。要安装它,请使用下面的命令: ``` sudo dnf copr enable praiskup/vim-ale @@ -85,7 +85,7 @@ via: https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-from-october- 作者:[frostyx][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 3b38d490aa378415391e43f8b1d1fbdf51eb24d2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 10 Nov 2020 09:57:56 +0800 Subject: [PATCH 0716/1156] PUB @geekpi https://linux.cn/article-12810-1.html --- ...02 4 cool new projects to try in COPR from October 2020.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201102 4 cool new projects to try in COPR from October 2020.md (98%) diff --git a/translated/tech/20201102 4 cool new projects to try in COPR from October 2020.md b/published/20201102 4 cool new projects to try in COPR from October 2020.md similarity index 98% rename from translated/tech/20201102 4 cool new projects to try in COPR from October 2020.md rename to published/20201102 4 cool new projects to try in COPR from October 2020.md index 739c8cf742..a3e17071d5 100644 --- a/translated/tech/20201102 4 cool new projects to try in COPR from October 2020.md +++ b/published/20201102 4 cool new projects to try in COPR from October 2020.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12810-1.html) [#]: subject: (4 cool new projects to try in COPR from October 2020) [#]: via: (https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-from-october-2020/) [#]: author: (frostyx https://fedoramagazine.org/author/frostyx/) From b6d34675d0cafb545aeb2599f1efd933195afe87 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 10 Nov 2020 10:19:33 +0800 Subject: [PATCH 0717/1156] APL --- sources/tech/20201102 4 reasons why JavaScript is so popular.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201102 4 reasons why JavaScript is so popular.md b/sources/tech/20201102 4 reasons why JavaScript is so popular.md index bf35c455bd..9108d25420 100644 --- a/sources/tech/20201102 4 reasons why JavaScript is so popular.md +++ b/sources/tech/20201102 4 reasons why JavaScript is so popular.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From afafcd824c09f84b036a3c6a2b3155fd93494357 Mon Sep 17 00:00:00 2001 From: xiao-song-123 <59152623+xiao-song-123@users.noreply.github.com> Date: Tue, 10 Nov 2020 12:36:44 +0800 Subject: [PATCH 0718/1156] translating --- .../tech/20201022 5 steps to learn any programming language.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201022 5 steps to learn any programming language.md b/sources/tech/20201022 5 steps to learn any programming language.md index d0df23d4c0..e47125a9b9 100644 --- a/sources/tech/20201022 5 steps to learn any programming language.md +++ b/sources/tech/20201022 5 steps to learn any programming language.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (xiao-song-123) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 3ea743b32eaebeb6dbcedd321aff91681b6416cd Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 10 Nov 2020 22:41:44 +0800 Subject: [PATCH 0719/1156] TSL&PRF @wxy --- ... 4 reasons why JavaScript is so popular.md | 121 ------------------ ... 4 reasons why JavaScript is so popular.md | 115 +++++++++++++++++ 2 files changed, 115 insertions(+), 121 deletions(-) delete mode 100644 sources/tech/20201102 4 reasons why JavaScript is so popular.md create mode 100644 translated/tech/20201102 4 reasons why JavaScript is so popular.md diff --git a/sources/tech/20201102 4 reasons why JavaScript is so popular.md b/sources/tech/20201102 4 reasons why JavaScript is so popular.md deleted file mode 100644 index 9108d25420..0000000000 --- a/sources/tech/20201102 4 reasons why JavaScript is so popular.md +++ /dev/null @@ -1,121 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (4 reasons why JavaScript is so popular) -[#]: via: (https://opensource.com/article/20/11/javascript-popular) -[#]: author: (Nimisha Mukherjee https://opensource.com/users/nimisha) - -4 reasons why JavaScript is so popular -====== -There are good reasons why JavaScript is consistently among the top -programming languages. -![JavaScript in Vim][1] - -As this chart from GitHub's _[State of the Octoverse][2]_ report shows, [JavaScript][3] has consistently been most popular programming language based on the number of contributors to projects on GitHub. - -![Top Languages from The State of the Octoverse report][4] - -Top languages, per The State of the Octoverse (© 2019, [GitHub Corp][2]) - -In the [previous article][5] in this series, I dove into the history of JavaScript. In this article, I'll share four of [the reasons][6] it is so popular. - -### 1\. JavaScript caters to beginner, intermediate, and advanced developers - -JavaScript does not need any environment setup; just open a browser, like Chrome, navigate to [Developer Tools][7], and start coding. Writing a "Hello World" program is as simple as: - - -``` -`console.log("Hello World");` -``` - -JavaScript's flexibility is best suited for intermediate developers. The language just helps get things done by letting the developer focus on solving the problem. Developers can use a mix of plugins and their own code snippets to get an application working. - -While JavaScript is relatively easy to get started with, it is not straightforward to master. If you want to get to an advanced level, here are some of the concepts you need to know: - - * **JavaScript's [multi-paradigm][8] nature:** JavaScript supports both functional programming and object-oriented programming (OOP). - * **Applying [design patterns][9] in JavaScript:** The model-view-* ([MV*][10]) design patterns have been among the most popular and have led to the development of [several modern frameworks][11]. - * **[Inheritance with prototype chain][12]:** JavaScript cannot implement OOP in the traditional Java class-based model due to its dynamic nature. OOP in JavaScript is achieved through the prototypal inheritance model. - * **[Closures][13]:** A closure gives access to an outer function's scope from an inner function. - * **[Currying][14]:** Currying is a transformation of functions that translates a function from callable as f(a, b, c) into callable as f(a)(b)(c). - * **[Promises][15] and [Observables][16]:** These help you work with asynchronous functions. - * **[TypeScript][17]:** This adds static typing to JavaScript. - - - -### 2\. Omni-platform - -JavaScript can run everywhere, including: - - * Devices like mobiles, tablets, and laptops - * On the client-side as well as the server-side - - - -This ability to run everywhere makes JavaScript a universal language. - -### 3\. Open standards and community - -[ECMAScript][18] is the standardized version of JavaScript as well as an open standard language. Companies can use ECMAScript to create a JavaScript implementation. According to [Wikipedia][19], "an ECMAScript engine  is a program that executes source code written in a version of the ECMAScript language standard, for example, JavaScript." The most popular engines, [V8][20] and [SpiderMonkey][21], are open source projects. - -JavaScript has been around for 25 years and has a vast community behind it. A developer is spoiled for choice. The community has built so many plugins and frameworks that the phrase "[framework fatigue][22]" was coined. - -### 4\. Modern frameworks - -Modern frameworks like [React][23], [Angular][24], and [Vue.js][25] have stabilized and are being optimized for better performance. Most frameworks are very developer-friendly with good community support. - -### The future - -JavaScript is here to stay. Full-stack development and the modern frontend framework continue to help JavaScript cement its position as one of the most popular programming languages. - -The [next wave of JavaScript][26] might put the spotlight on: - - * **[Deno][27]:** A modern and secure runtime for JavaScript - * **Web components:** Reusable custom elements - * **Integration with AI and ML:** Projects like [Supernova][28] and [BAYOU][29] have made substantial breakthroughs in integrating JavaScript with artificial intelligence and machine learning. - - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/11/javascript-popular - -作者:[Nimisha Mukherjee][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://opensource.com/users/nimisha -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/javascript_vim.jpg?itok=mqkAeakO (JavaScript in Vim) -[2]: https://octoverse.github.com/ -[3]: https://en.wikipedia.org/wiki/JavaScript -[4]: https://opensource.com/sites/default/files/uploads/toplanguages-the_state_of_the_octoverse.png (Top Languages from The State of the Octoverse report) -[5]: https://opensource.com/article/20/10/javascript-part-1 -[6]: https://medium.com/paul-heintzelman/so-why-is-javascript-so-popular-f35bd6cfeb39 -[7]: https://developers.google.com/web/tools/chrome-devtools -[8]: https://medium.com/javascript-in-plain-english/what-are-javascript-programming-paradigms-3ef0f576dfdb -[9]: https://addyosmani.com/resources/essentialjsdesignpatterns/book/ -[10]: https://developpaper.com/javascript-mv-pattern/ -[11]: https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93viewmodel#JavaScript_frameworks -[12]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain -[13]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures -[14]: https://javascript.info/currying-partials -[15]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise -[16]: https://rxjs-dev.firebaseapp.com/guide/observable -[17]: https://en.wikipedia.org/wiki/TypeScript -[18]: https://en.wikipedia.org/wiki/ECMAScript -[19]: https://en.wikipedia.org/wiki/List_of_ECMAScript_engines -[20]: https://en.wikipedia.org/wiki/V8_%28JavaScript_engine%29 -[21]: https://en.wikipedia.org/wiki/SpiderMonkey -[22]: https://teropa.info/blog/2015/07/15/overcoming-javascript-framework-fatigue.html -[23]: https://en.wikipedia.org/wiki/React_%28web_framework%29 -[24]: https://en.wikipedia.org/wiki/Angular_%28web_framework%29 -[25]: https://en.wikipedia.org/wiki/Vue.js -[26]: https://medium.com/@rangleio/the-future-of-javascript-in-the-front-end-world-2544c1814e2 -[27]: https://en.wikipedia.org/wiki/Deno_%28software%29 -[28]: https://techcrunch.com/2018/03/13/supernova-studio/ -[29]: https://futurism.com/military-created-ai-learned-to-program diff --git a/translated/tech/20201102 4 reasons why JavaScript is so popular.md b/translated/tech/20201102 4 reasons why JavaScript is so popular.md new file mode 100644 index 0000000000..6baa765416 --- /dev/null +++ b/translated/tech/20201102 4 reasons why JavaScript is so popular.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 reasons why JavaScript is so popular) +[#]: via: (https://opensource.com/article/20/11/javascript-popular) +[#]: author: (Nimisha Mukherjee https://opensource.com/users/nimisha) + +JavaScript 如此受欢迎的 4 个原因 +====== + +> JavaScript 之所以能在编程语言中名列前茅,是有充分的理由的。 + +![JavaScript in Vim][1] + +如 GitHub 的 [The State of the Octoverse][2] 报告的这张图所示,如果按 GitHub 上项目的贡献者数量统计,[JavaScript][3] 一直是最受欢迎的编程语言。 + +![The State of the Octoverse 报告中的热门语言][4] + +*热门语言,根据《The State of the Octoverse》(©2019,[GitHub Corp][2])* + +在本系列的 [上一篇][5] 中,我们深入了解了 JavaScript 的历史。在这篇文章中,我将分享它如此受欢迎的四个[原因][6]。 + +### 1、JavaScript 适合初级、中级和高级开发人员 + +JavaScript 不需要任何环境设置,只要打开浏览器,比如 Chrome 浏览器,导航到[开发者工具][7],就可以开始编码。编写一个 “Hello World” 的程序,就这么简单: + +``` +console.log("Hello World"); +``` + +JavaScript 的灵活性最适合中级开发人员。该语言只是通过让开发人员专注于解决问题来帮助完成任务。开发者可以混合使用插件和自己的代码片段来让一个应用程序工作。 + +虽然 JavaScript 比较容易上手,但它并不是一下子就能掌握的。如果你想达到高级水平,这里有一些你需要了解的概念: + + * **JavaScript 的[多范式][8]特性:** JavaScript 同时支持函数式编程和面向对象编程(OOP)。 + * **在 JavaScript 中应用[设计模式][9]:** 模型-视图-*([MV*][10])设计模式一直是最流行的模式之一,并促成了[多个现代框架][11]的发展。 + * **[带原型链的继承][12]:** JavaScript 由于其动态的特性,无法实现传统的 Java 基于类的模式下的 OOP。JavaScript 中的 OOP 是通过原型继承模型实现的。 + * **[闭包][13]:** 闭包可以从内部函数中访问外部函数的作用域。 + * **[Currying][14]:** Currying 是函数的一种转换,它将函数从 `f(a, b, c)` 的调用形式转换为 `f(a)(b)(c)` 调用形式。 + * **[Promises][15] 和 [Observables][16]:** 这些可以帮助你处理异步函数。 + * **[TypeScript][17]:** 在 JavaScript 中添加了静态类型。 + +### 2、全平台 + +JavaScript 可以在任何地方运行,包括: + + * 手机、平板电脑和笔记本电脑等设备。 + * 在客户端和服务器端。 + +这种在任何地方都能运行的能力使 JavaScript 成为一种通用语言。 + +### 3、开放标准和社区 + +[ECMAScript][18] 是 JavaScript 的标准化版本,也是一种开放的标准语言。公司可以使用 ECMAScript 来创建 JavaScript 的实现。根据[维基百科][19],“ECMAScript 引擎是执行以 ECMAScript 语言标准编写的源代码(例如,JavaScript)的程序”。最流行的引擎 [V8][20] 和 [SpiderMonkey][21] 是开源项目。 + +JavaScript 已经存在了 25 年,背后有一个庞大的社区。开发者们简直目不暇接,社区已经构建了如此多的插件和框架,以至于创造了“[框架疲劳][22]”这个词。 + +### 4、现代框架 + +现代框架如 [React][23]、[Angular][24] 和 [Vue.js][25] 已经稳定下来,并且正在进行优化以获得更好的性能。大多数框架对开发者非常友好,有良好的社区支持。 + +### 未来 + +JavaScript 是永恒的。全栈开发和现代前端框架继续帮助 JavaScript 巩固其作为最受欢迎的编程语言之一的地位。 + +JavaScript 的[下一波][26]可能会将焦点放在。 + + * **[Deno][27]:** JavaScript 的现代安全运行时。 + * **网络组件:** 可重复使用的自定义元素。 + * **与 AI 和 ML 的整合:** 像 [Supernova][28] 和 [BAYOU][29] 这样的项目在将 JavaScript 与人工智能和机器学习整合方面取得了实质性的突破。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/javascript-popular + +作者:[Nimisha Mukherjee][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://opensource.com/users/nimisha +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/javascript_vim.jpg?itok=mqkAeakO (JavaScript in Vim) +[2]: https://octoverse.github.com/ +[3]: https://en.wikipedia.org/wiki/JavaScript +[4]: https://opensource.com/sites/default/files/uploads/toplanguages-the_state_of_the_octoverse.png (Top Languages from The State of the Octoverse report) +[5]: https://opensource.com/article/20/10/javascript-part-1 +[6]: https://medium.com/paul-heintzelman/so-why-is-javascript-so-popular-f35bd6cfeb39 +[7]: https://developers.google.com/web/tools/chrome-devtools +[8]: https://medium.com/javascript-in-plain-english/what-are-javascript-programming-paradigms-3ef0f576dfdb +[9]: https://addyosmani.com/resources/essentialjsdesignpatterns/book/ +[10]: https://developpaper.com/javascript-mv-pattern/ +[11]: https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93viewmodel#JavaScript_frameworks +[12]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain +[13]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures +[14]: https://javascript.info/currying-partials +[15]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise +[16]: https://rxjs-dev.firebaseapp.com/guide/observable +[17]: https://en.wikipedia.org/wiki/TypeScript +[18]: https://en.wikipedia.org/wiki/ECMAScript +[19]: https://en.wikipedia.org/wiki/List_of_ECMAScript_engines +[20]: https://en.wikipedia.org/wiki/V8_%28JavaScript_engine%29 +[21]: https://en.wikipedia.org/wiki/SpiderMonkey +[22]: https://teropa.info/blog/2015/07/15/overcoming-javascript-framework-fatigue.html +[23]: https://en.wikipedia.org/wiki/React_%28web_framework%29 +[24]: https://en.wikipedia.org/wiki/Angular_%28web_framework%29 +[25]: https://en.wikipedia.org/wiki/Vue.js +[26]: https://medium.com/@rangleio/the-future-of-javascript-in-the-front-end-world-2544c1814e2 +[27]: https://en.wikipedia.org/wiki/Deno_%28software%29 +[28]: https://techcrunch.com/2018/03/13/supernova-studio/ +[29]: https://futurism.com/military-created-ai-learned-to-program From 1c61765b1d8c41091e6f415fa63e940c4e4562ce Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 11 Nov 2020 08:40:10 +0800 Subject: [PATCH 0720/1156] translated --- ...k your Git config for multiple user IDs.md | 75 ------------------- ...k your Git config for multiple user IDs.md | 74 ++++++++++++++++++ 2 files changed, 74 insertions(+), 75 deletions(-) delete mode 100644 sources/tech/20201105 Tweak your Git config for multiple user IDs.md create mode 100644 translated/tech/20201105 Tweak your Git config for multiple user IDs.md diff --git a/sources/tech/20201105 Tweak your Git config for multiple user IDs.md b/sources/tech/20201105 Tweak your Git config for multiple user IDs.md deleted file mode 100644 index 43e6e6a513..0000000000 --- a/sources/tech/20201105 Tweak your Git config for multiple user IDs.md +++ /dev/null @@ -1,75 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Tweak your Git config for multiple user IDs) -[#]: via: (https://opensource.com/article/20/10/git-config) -[#]: author: (Ramanathan M https://opensource.com/users/muthiahramanathan) - -Tweak your Git config for multiple user IDs -====== -Use the same machine for your work and personal Git commits without -manually resetting your config. -![Chat via email][1] - -Git's [git config][2] command (hereafter referred to as "config") enables you to set repository or global options for Git. It has many options, and one of them, `includeIf`, is handy when you have dual roles using Git, for example, working full time as a developer and contributing to open source projects in your spare time. Most people in this situation don't want to use a common config for both roles or, at the very least, would rather keep certain portions of their config distinct, especially if they use the same computer in both roles. - -This is my situation, so I keep two separate sets of mail IDs as part of my Git config. This way, commits in repositories related to projects at my workplace carry my office mail ID, whereas the commits made to repositories hosted in my personal GitHub account use my personal mail ID. - -To illustrate, here is a sample snippet from my global config (maintained at `$HOME/.gitconfig`), which I will describe below. - - -``` -[includeIf "gitdir:~/priv_scm/"] -        path = ~/priv_scm/.gitconfig -[includeIf "gitdir:~/work_scm/"] -        path = ~/work_scm/.gitconfig -``` - -### What's includeIf? - -The `includeIf.condition.path` variable, part of the `include` config directives, allows you to set a custom config conditionally. Also, the path to the custom config can be set as part of the directive. - -This directive supports three keywords: `gitdir`, `gitdir/I`, and `onbranch`. I will briefly explain `gitdir`, which I use in the code snippet above; you can learn about the other two in the [docs][3]. - -Using the `gitdir` keyword in the `includeIf` directive causes a conditional check to be performed on the pattern. Per the rule, if the current working directory matches the specified directory pattern in `gitdir`, then it picks the config from the given path. I'll apply this rule on the config snippet to show how it's evaluated. - -In the config snippet, you can see a simple pattern, `~/`, used along with the `gitdir` keyword. This pattern is substituted with the value stored in the `$HOME` environment variable. - -### How to use it - -If you're using the same system to work on open source projects hosted on GitHub or GitLab and committing to Git repositories at work, you can have two top-level directories, like `$HOME/priv_scm` and `$HOME/work_scm`. Within these two directories, you can have two separate `.gitconfig` files with settings related to your `user.name` and `user.email`. However, they can also be included in a global `.gitconfig` stored at `$HOME` that can hold all the customizations common to both environments. - -Here is a snippet of an example `$HOME/priv_scm/.gitconfig`: - - -``` -$ cat $HOME/priv_scm/.gitconfig -[user] -    name  = Ramanathan Muthiah -    email = <personal-mailid-goes-here> -``` - -With this config in place, you can switch directories and start working on open source projects without resetting some of the config related to Git manually. These changes are handled automatically in the main `.gitconfig` with the aid of the `includeIf` conditional directive. - -### Git tips - -I hope this tip helps you organize your Git projects. What are your favorite Git tips? Share them in the comments! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/10/git-config - -作者:[Ramanathan M][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://opensource.com/users/muthiahramanathan -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_chat_communication_message.png?itok=LKjiLnQu (Chat via email) -[2]: https://git-scm.com/docs/git-config -[3]: https://git-scm.com/docs/git-config#_conditional_includes diff --git a/translated/tech/20201105 Tweak your Git config for multiple user IDs.md b/translated/tech/20201105 Tweak your Git config for multiple user IDs.md new file mode 100644 index 0000000000..f928242a3d --- /dev/null +++ b/translated/tech/20201105 Tweak your Git config for multiple user IDs.md @@ -0,0 +1,74 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Tweak your Git config for multiple user IDs) +[#]: via: (https://opensource.com/article/20/10/git-config) +[#]: author: (Ramanathan M https://opensource.com/users/muthiahramanathan) + +调整你的 Git 配置以适应多个用户 ID 的需要 +====== +使用相同的机器用于工作和个人的 Git 提交,而无需手动重置你的配置。 +![Chat via email][1] + +Git 的 [git config][2] 命令可以让你为 Git 设置仓库或全局选项。它有很多选项,其中的一个选项 `includeIf` 在你使用在 Git 时有双重角色时非常方便,比如说,你既是全职的开发者,又在业余时间为开源项目做贡献。在这种情况下,大多数人都不想为两个角色使用一个共同的配置,或者,至少,他们宁愿保持配置的某些部分是不同的,尤其是当他们在两个角色中使用同一台计算机时。 + +我的情况就是这样,所以我在 Git 配置中保留了两组不同的邮件 ID。这样一来,在我工作场所的项目仓库中提交的内容就会使用我办公室的邮件 ID,而在我个人 GitHub 帐户中提交的内容则使用我个人的邮件 ID。 + +以下是我的全局配置(维护在 `$HOME/.gitconfig`)中的一个片段,我将在下文中介绍。 + + +``` +[includeIf "gitdir:~/priv_scm/"] +        path = ~/priv_scm/.gitconfig +[includeIf "gitdir:~/work_scm/"] +        path = ~/work_scm/.gitconfig +``` + +### 什么是 includeIf? + +`includeIf.condition.path` 变量,是 `include` 配置指令的一部分,允许你有条件地设置自定义 config。同时,自定义配置的路径也可以作为指令的一部分来设置。 + +这个指令支持三个关键字:`gitdir`、`gitdir/I` 和 `onbranch`。我将简单解释一下 `gitdir`,我在上面的代码片段中使用了它。你可以在[文档][3]中了解其他两个关键词。 + +在 `includeIf` 指令中使用 `gitdir` 关键字会对模式进行条件检查。根据规则,如果当前工作目录与 `gitdir` 中指定的目录模式相匹配,那么它就会从给定的路径中选取配置。我将在配置片段上应用这个规则来展示它是如何被应用的。 + +在配置片段中,你可以看到一个简单的模式,`~/`,它与 `gitdir` 关键字一起使用。这个模式会被存储在 `$HOME` 环境变量中的值所替代。 + +### 如何使用它 + +如果你使用同一个系统在 GitHub 或 GitLab 上的开源项目上工作,并在工作中提交到 Git 仓库,你可以有两个顶级目录,比如 `$HOME/priv_scm` 和 `$HOME/work_scm`。在这两个目录中,你可以有两个单独的 `.gitconfig` 文件,其中包含与你的 `user.name` 和 `user.email` 相关的设置。然而,它们也可以包含存储在 `$HOME` 的全局 `.gitconfig` 中,它可以保存两个环境通用的所有自定义项。 + +这里是一个例子 `$HOME/priv_scm/.gitconfig` 的片段: + + +``` +$ cat $HOME/priv_scm/.gitconfig +[user] +    name  = Ramanathan Muthiah +    email = <personal-mailid-goes-here> +``` + +有了这个配置,你就可以切换目录,并开始在开源项目上工作,而无需手动重置一些与 Git 相关的配置。这些更改会在主 `.gitconfig` 中借助 `includeIf` 条件指令自动处理。 + +### Git 小贴士 + +希望这个小贴士能帮助你组织 Git 项目。你最喜欢的 Git 小贴士是什么?请在评论中分享吧! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/git-config + +作者:[Ramanathan M][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/muthiahramanathan +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_chat_communication_message.png?itok=LKjiLnQu (Chat via email) +[2]: https://git-scm.com/docs/git-config +[3]: https://git-scm.com/docs/git-config#_conditional_includes From afa00462981b168b744ec72b07d70d6c8c3eb60e Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 11 Nov 2020 08:47:29 +0800 Subject: [PATCH 0721/1156] translating --- ...u- What-s the Difference Between the Two KDE Distribution.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md b/sources/tech/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md index 7c109aa415..e596275232 100644 --- a/sources/tech/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md +++ b/sources/tech/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 07fc3a3b823648ae0e5b0a9c90cf8ec1d789b149 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 12 Nov 2020 01:12:54 +0800 Subject: [PATCH 0722/1156] PUB @wxy https://linux.cn/article-12813-1.html --- ... How JavaScript became a serious programming language.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20201028 How JavaScript became a serious programming language.md (97%) diff --git a/translated/tech/20201028 How JavaScript became a serious programming language.md b/published/20201028 How JavaScript became a serious programming language.md similarity index 97% rename from translated/tech/20201028 How JavaScript became a serious programming language.md rename to published/20201028 How JavaScript became a serious programming language.md index b15d5b52c6..3b6b15fd92 100644 --- a/translated/tech/20201028 How JavaScript became a serious programming language.md +++ b/published/20201028 How JavaScript became a serious programming language.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12813-1.html) [#]: subject: (How JavaScript became a serious programming language) [#]: via: (https://opensource.com/article/20/10/history-javascript) [#]: author: (Nimisha Mukherjee https://opensource.com/users/nimisha) @@ -12,7 +12,7 @@ JavaScript 是如何成为一门严肃的编程语言的 > 从最开始作为一种使网站变得漂亮的方式,JavaScript 已转变为一种严肃的编程语言。 -![Javascript 代码特写与霓虹灯图形叠加][1] +![](https://img.linux.net.cn/data/attachment/album/202011/12/010945vezib4p1b1ti6pjt.jpg) JavaScript 的卑微起步始于 1995 年,是由当时在 Netscape 通信公司工作的 Brendan Eich [在短短 10 天内创建的][2]。从那时起,JavaScript 已经走过了漫长的道路,从一个让网站变得漂亮的工具变成了一种严肃的编程语言。 From 8eea66b9e47f73afe8b4475173ffd31208ce6b73 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 12 Nov 2020 01:38:36 +0800 Subject: [PATCH 0723/1156] PRF --- ...weak your Git config for multiple user IDs.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/translated/tech/20201105 Tweak your Git config for multiple user IDs.md b/translated/tech/20201105 Tweak your Git config for multiple user IDs.md index f928242a3d..2b8745d98c 100644 --- a/translated/tech/20201105 Tweak your Git config for multiple user IDs.md +++ b/translated/tech/20201105 Tweak your Git config for multiple user IDs.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Tweak your Git config for multiple user IDs) @@ -9,16 +9,17 @@ 调整你的 Git 配置以适应多个用户 ID 的需要 ====== -使用相同的机器用于工作和个人的 Git 提交,而无需手动重置你的配置。 -![Chat via email][1] -Git 的 [git config][2] 命令可以让你为 Git 设置仓库或全局选项。它有很多选项,其中的一个选项 `includeIf` 在你使用在 Git 时有双重角色时非常方便,比如说,你既是全职的开发者,又在业余时间为开源项目做贡献。在这种情况下,大多数人都不想为两个角色使用一个共同的配置,或者,至少,他们宁愿保持配置的某些部分是不同的,尤其是当他们在两个角色中使用同一台计算机时。 +> 可以使用相同的机器用于工作和个人的 Git 提交,而无需手动重置你的配置。 + +![](https://img.linux.net.cn/data/attachment/album/202011/12/013805t4u4nu57rc6ur7nt.jpg) + +Git 的 [git config][2] 命令可以让你为 Git 设置仓库或全局选项。它有很多选项,其中的一个选项 `includeIf` 在你使用在 Git 时有双重角色时非常方便,比如说,你既是全职的开发者,又在业余时间为开源项目做贡献。在这种情况下,大多数人都不想为两个角色使用一个共同的配置,或者,至少,他们肯定希望保持配置的某些部分是不同的,尤其是当他们在两个角色中使用同一台计算机时。 我的情况就是这样,所以我在 Git 配置中保留了两组不同的邮件 ID。这样一来,在我工作场所的项目仓库中提交的内容就会使用我办公室的邮件 ID,而在我个人 GitHub 帐户中提交的内容则使用我个人的邮件 ID。 以下是我的全局配置(维护在 `$HOME/.gitconfig`)中的一个片段,我将在下文中介绍。 - ``` [includeIf "gitdir:~/priv_scm/"]         path = ~/priv_scm/.gitconfig @@ -28,7 +29,7 @@ Git 的 [git config][2] 命令可以让你为 Git 设置仓库或全局选项。 ### 什么是 includeIf? -`includeIf.condition.path` 变量,是 `include` 配置指令的一部分,允许你有条件地设置自定义 config。同时,自定义配置的路径也可以作为指令的一部分来设置。 +`includeIf.condition.path` 变量,是 `include` 配置指令的一部分,允许你有条件地设置自定义配置。同时,自定义配置的路径也可以作为指令的一部分来设置。 这个指令支持三个关键字:`gitdir`、`gitdir/I` 和 `onbranch`。我将简单解释一下 `gitdir`,我在上面的代码片段中使用了它。你可以在[文档][3]中了解其他两个关键词。 @@ -42,7 +43,6 @@ Git 的 [git config][2] 命令可以让你为 Git 设置仓库或全局选项。 这里是一个例子 `$HOME/priv_scm/.gitconfig` 的片段: - ``` $ cat $HOME/priv_scm/.gitconfig [user] @@ -63,7 +63,7 @@ via: https://opensource.com/article/20/10/git-config 作者:[Ramanathan M][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From c080849bfa1b8843d7c9579e2093579691925ad0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 12 Nov 2020 01:38:59 +0800 Subject: [PATCH 0724/1156] PUB @geekpi https://linux.cn/article-12814-1.html --- .../20201105 Tweak your Git config for multiple user IDs.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201105 Tweak your Git config for multiple user IDs.md (98%) diff --git a/translated/tech/20201105 Tweak your Git config for multiple user IDs.md b/published/20201105 Tweak your Git config for multiple user IDs.md similarity index 98% rename from translated/tech/20201105 Tweak your Git config for multiple user IDs.md rename to published/20201105 Tweak your Git config for multiple user IDs.md index 2b8745d98c..746d6fc422 100644 --- a/translated/tech/20201105 Tweak your Git config for multiple user IDs.md +++ b/published/20201105 Tweak your Git config for multiple user IDs.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12814-1.html) [#]: subject: (Tweak your Git config for multiple user IDs) [#]: via: (https://opensource.com/article/20/10/git-config) [#]: author: (Ramanathan M https://opensource.com/users/muthiahramanathan) From 5c29a9c5fd891fed043c9be08c625e19b36e16bd Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 12 Nov 2020 08:43:32 +0800 Subject: [PATCH 0725/1156] translated --- ...owerful Open Source Accounting Software.md | 95 ------------------- ...owerful Open Source Accounting Software.md | 95 +++++++++++++++++++ 2 files changed, 95 insertions(+), 95 deletions(-) delete mode 100644 sources/tech/20201103 GnuCash- A Powerful Open Source Accounting Software.md create mode 100644 translated/tech/20201103 GnuCash- A Powerful Open Source Accounting Software.md diff --git a/sources/tech/20201103 GnuCash- A Powerful Open Source Accounting Software.md b/sources/tech/20201103 GnuCash- A Powerful Open Source Accounting Software.md deleted file mode 100644 index 56be77dbaa..0000000000 --- a/sources/tech/20201103 GnuCash- A Powerful Open Source Accounting Software.md +++ /dev/null @@ -1,95 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (GnuCash: A Powerful Open Source Accounting Software) -[#]: via: (https://itsfoss.com/gnucash/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -GnuCash: A Powerful Open Source Accounting Software -====== - -_**Brief: GnuCash is a popular free and open-source accounting software that can be used to manage personal finance as well as business transactions.**_ - -Considering the complexities of managing personal finances and business transactions, you will find a lot of online services or software tools that aim to simplify things. Some tools simply let you add expenses and income to keep track of your savings while others offer different features. - -I have already covered several [open source account software][1] in the past. Here, I will be focusing on one of the options — **GnuCash**, which is a popular free accounting software with plenty of features for every user. - -### GnuCash: Free & Open Source Accounting Software - -![][2] - -GnuCash is a free accounting software tailored for professional requirements to track transactions, stocks, etc. It is available for Linux, BSD, macOS, and Windows as well. - -Even though it can be overwhelming to start with, it is easy to use for managing personal transactions as well. You can get a detailed report to analyze after you’ve started managing an account and added transactions to it. - -### Features of GnuCash - -![][3] - -As I mentioned earlier, GnuCash comes loaded with a bunch of features which could be overwhelming for someone new to accounting, but I think it should be worth it: - - * Double-entry Accounting - * Stock/Bond/Mutual Fund accounts - * Small-business accounting with tax support (like GST in India) - * Detailed report for breakdown - * Graph for easy analysis - * Financial calculations support - * Auto-saving feature - * Color coding - * Online Banking Wizard - * Journal - * Loan repayment calculator - * Price database for quick calculation - * Budget balance sheet, flow, graph for each category - * Ability to export as CSV - * Add Customer, Vendor, and Employee records separately - * Scheduled transactions - * Ability to set a Budget - * Configuring bill generator to ease up the accounting process - - - -I’m no expert but this is just the tip of the iceberg. You will find a host of options to customize and set for your accounting needs. - -![Gnucash Report][4] - -### Installing GnuCash on Linux - -You can find GnuCash in the software center of your Linux distribution. Install it from there or use the [package manager of your distribution][5]. - -A [Flatpak package][6] is also available for those who want the latest version. In case you didn’t know, I’d suggest you to go through our [Flatpak guide][7]. - -Alternatively, you can build it from source or you can head to their [official download page][8] to explore options for your Linux distribution. - -[GnuCash][9] - -### Wrapping Up - -For basic personal finance management, it was a little overwhelming for me because I prefer to use an Android app for simplicity. However, if you take a look around for a few minutes, it is easy to understand and GnuCash seems flexible for most requirements. - -If you like to manage your or your business’s finances, you may give it a try. It is definitely better than keeping data in spreadsheet :) - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/gnucash/ - -作者:[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/open-source-accounting-software/ -[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/gnucash.jpg?resize=800%2C633&ssl=1 -[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/gnucash-screenshot.jpg?resize=800%2C636&ssl=1 -[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/gnucash-report.jpg?resize=800%2C638&ssl=1 -[5]: https://itsfoss.com/package-manager/ -[6]: https://flathub.org/apps/details/org.gnucash.GnuCash -[7]: https://itsfoss.com/flatpak-guide/ -[8]: https://www.gnucash.org/download.phtml#distribution -[9]: https://www.gnucash.org diff --git a/translated/tech/20201103 GnuCash- A Powerful Open Source Accounting Software.md b/translated/tech/20201103 GnuCash- A Powerful Open Source Accounting Software.md new file mode 100644 index 0000000000..8c294b870a --- /dev/null +++ b/translated/tech/20201103 GnuCash- A Powerful Open Source Accounting Software.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (GnuCash: A Powerful Open Source Accounting Software) +[#]: via: (https://itsfoss.com/gnucash/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +GnuCash:一个强大的开源会计软件 +====== + +_**简介:GnuCash 是一款流行的免费开源会计软件,可用于管理个人财务和商业交易。**_ + +考虑到管理个人财务和商业交易的复杂性,你会发现有很多旨在简化这些的在线服务或软件工具。有些工具只是让你添加支出和收入来跟踪你的储蓄,而其他一些工具则提供不同的功能。 + +我在过去已经介绍过几个[开源会计软件][1]。在这里,我将重点介绍其中一个 — **GnuCash**,它是一款很流行的免费会计软件,为所有用户提供了很多功能。 + +### GnuCash: 免费且开源的会计软件 + +![][2] + +GnuCash 是一款为专业需求量身定做的免费会计软件,可以追踪交易、股票等。它适用于 Linux、BSD、macOS 和 Windows。 + +虽然刚开始使用可能会让人不知所措,但对于管理个人交易而言很容易使用。在你开始管理一个账户,并添加交易后,你可以得到一个详细的报告。 + +### GnuCash 的功能 + +![][3] + +正如我前面提到的,GnuCash 带来了一大堆功能,这对于一个刚接触会计的人来说可能会让人不知所措,但我认为它应该是值得的: + + * 复式记账 + * 股票/债券/共同基金账户 + * 有税务支持的小企业会计(如印度的商品和服务税) + * 详细的分类报告 + * 便于分析的图表 + * 支持财务计算 + * 自动保存功能 + * 彩色编码 + * 网上银行向导 + * 日志 + * 贷款还款计算器 + * 用于快速计算的价格数据库 + * 每个类别的预算平衡表、流程、图表 + * 能够以 CSV 格式导出 + * 分别添加客户、供应商和雇员记录。 + * 计划交易记录 + * 制定预算的能力 + * 配置账单生成器,以简化会计程序。 + + + +我不是专家,但这只是冰山一角。你会发现有很多选项可以根据你的会计需求进行定制和设置。 + +![Gnucash Report][4] + +### 在 Linux 上安装 GnuCash + +你可以在你的 Linux 发行版的软件中心找到 GnuCash。从那里安装或使用[发行版的软件包管理器][5]。 + +对于那些想要最新版本的人来说,还可以使用 [Flatpak 包][6]。如果你不知道它,我建议你去看看我们的 [Flatpak 指南][7]。 + +另外,你也可以从源码构建,或者你可以前往他们的[官方下载页面][8]来探索适合你的 Linux 发行版选项。 + +[GnuCash][9] + +### 总结 + +对于基本的个人理财来说,这对我来说有点复杂,因为我更喜欢安卓应用的简单。不过,如果你试上几分钟,就会发现它很容易理解,GnuCash 似乎可以灵活地满足大多数要求。 + +如果你想管理自己或企业的财务,你可以尝试一下。它绝对比在电子表格中保存数据要好。 :) + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gnucash/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者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/open-source-accounting-software/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/gnucash.jpg?resize=800%2C633&ssl=1 +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/gnucash-screenshot.jpg?resize=800%2C636&ssl=1 +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/gnucash-report.jpg?resize=800%2C638&ssl=1 +[5]: https://itsfoss.com/package-manager/ +[6]: https://flathub.org/apps/details/org.gnucash.GnuCash +[7]: https://itsfoss.com/flatpak-guide/ +[8]: https://www.gnucash.org/download.phtml#distribution +[9]: https://www.gnucash.org From a6c9be370caafd24bdf0e106f911db0bd7d7d37c Mon Sep 17 00:00:00 2001 From: xiao-song-123 <463020345@qq.com> Date: Thu, 12 Nov 2020 08:46:46 +0800 Subject: [PATCH 0726/1156] Update --- ...steps to learn any programming language.md | 87 +++++++++---------- 1 file changed, 43 insertions(+), 44 deletions(-) diff --git a/sources/tech/20201022 5 steps to learn any programming language.md b/sources/tech/20201022 5 steps to learn any programming language.md index e47125a9b9..8eae0b5d43 100644 --- a/sources/tech/20201022 5 steps to learn any programming language.md +++ b/sources/tech/20201022 5 steps to learn any programming language.md @@ -1,35 +1,34 @@ -[#]: collector: (lujun9972) -[#]: translator: (xiao-song-123) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (5 steps to learn any programming language) -[#]: via: (https://opensource.com/article/20/10/learn-any-programming-language) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) +[#]: collector: "lujun9972" +[#]: translator: "xiao-song-123" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "5 steps to learn any programming language" +[#]: via: "https://opensource.com/article/20/10/learn-any-programming-language" +[#]: author: "Seth Kenlon https://opensource.com/users/seth" -5 steps to learn any programming language +学习任何编程语言的 5 个步骤 ====== -With just a little programming experience, you can learn a new language -in just a few days (sometimes less). +只需一点编程经验,您就可以在几天内(有时更少)学习一种新语言。 ![Learning to program][1] -Some people love learning new programming languages. Other people can't imagine having to learn even one. In this article, I'm going to show you how to think like a coder so that you can confidently learn any programming language you want. +有些人喜欢学习新的编程语言,也有一些人连学习一种都是可望不可即的事情。在本文中,我将向您展示如何像程序员一样思考,以便您可以自信地学习所需的任何编程语言。 -The truth is, once you've learned how to program, the language you use becomes less of a hurdle and more of a formality. In fact, that's just one of the many reasons educators say to [teach kids to code early][2]. Regardless of how simple their introductory language may be, the logic remains the same across everything else children (or adult learners) are likely to encounter later. +事实上,一旦您学会了如何编程,您使用的语言就不再是一个障碍,而更像是一种形式。这只是教育家们倡导 [让孩子尽早学习编程][2] 的众多原因之一。不管他们的入门语言有多简单,这种编程的逻辑和儿童(或成人学习者)以后可能遇到的其他东西的逻辑有着相同之处。 -With just a little programming experience, which you can gain from any one of several introductory articles here on Opensource.com, you can go on to learn _any_ programming language in just a few days (sometimes less). Now, this isn't magic, and you do have to put some effort into it. And admittedly, it takes a lot longer than just a few days to learn every library available to a language or to learn the nuances of packaging your code for delivery. But getting started is easier than you might think, and the rest comes naturally with practice. +只需有一点编程经验(您可以从 Opensource.com 上的任何一篇介绍性文章中获得),您就可以在几天内(有时更短)学习任何编程语言。这并不是魔法,现在您也必须要为此付出一些努力。诚然,学习一种语言每个的可用库,或者学习打包代码以及进行交付的细微差别,需要的时间远远不止几天。但是,就入门来说,比您想像中的要容易许多,剩下的则要通过不断练习来完成。 -When experienced programmers sit down to learn a new language, they're looking for five things. Once you know those five things, you're ready to start coding. +当有经验的程序员静下心来学习一门新的编程语言时,他们会寻找五样东西。只要您知道了这五件事,您就可以开始编码了。 -### 1\. Syntax +### 1\. 语法 ![Syntax][3] (Seth Kenlon, [CC BY-SA 4.0][4]) -The syntax of a language describes the structure of code. This encompasses both how the code is written on a line-by-line basis as well as the actual words used to construct code statements. +语言的语法描述了代码的结构。这包括如何逐行编写代码,以及用于构造代码语句的实际单词。 -[Python][5], for instance, is known for using indentation to indicate where one block ends and another one starts: +例如,[Python][5] 因使用缩进来指示一个代码块在哪里结束以及另一代码块在哪里开始而闻名: ``` @@ -42,7 +41,7 @@ while j < rows:     k = 0 ``` -[Lua][6] just uses the keyword `end`: +[Lua][6] 只是使用关键字 `end`: ``` @@ -53,7 +52,7 @@ for i,obj in ipairs(hit) do end ``` -[Java][7], [C][8], C++, and similar languages use braces: +[Java][7], [C][8], C++, 和类似的编程语言使用花括号: ``` @@ -62,23 +61,23 @@ while (std::getline(e,r)) {   } ``` -A language's syntax also involves things like including libraries, setting variables, and terminating lines. With practice, you'll learn to recognize syntactical requirements (and conventions) almost subliminally as you read sample code. +编程语言的语法还包括包括库、设置变量和终止行等内容。通过练习,您将学会在阅读示例代码时下意识地识别语法需求(和惯例)。 -#### Take action +#### 实践 -When learning a new programming language, strive to understand its syntax. You don't have to memorize it, just know where to look, should you forget. It also helps to use a good [IDE][9], because many of them alert you of syntax errors as they occur. +当学习一门新的编程语言时,要努力理解它的语法。您不需要去记住它,只需要知道如果忘记了以后去哪里看。使用好的 [IDE][9] 也很有帮助,因为很多 IDE 在出现语法错误时会提醒您。 -### 2\. Built-ins and conditionals +### 2\. 内置函数和条件 ![built-in words][10] (Seth Kenlon, [CC BY-SA 4.0][4]) -A programming language, just like a natural language, has a finite number of words it recognizes as valid. This vocabulary can be expanded with additional libraries, but the core language knows a specific set of keywords. Most languages don't have as many keywords as you probably think. Even in a very low-level language like C, there are only 32 words, such as `for`, `do`, `while`, `int`, `float`, `char`, `break`, and so on. +就像自然语言一样,编程语言可以识别的合法单词是有限的。这个词汇表可以使用其他库进行扩展,但是核心语言知道一组特定的关键字。大多数语言并没有您想的那么多关键字。即使在像 C 语言这样非常低级的语言中,也只有 32 个关键字,比如 `for`, `do`, `while`, `int`, `float`, `char`, `break` 等等。 -Knowing these keywords gives you the ability to write basic expressions, the building blocks of a program. Many of the built-in words help you construct conditional statements, which influence the flow of your program. For instance, if you want to write a program that lets you click and drag an icon, then your code must detect when the user's mouse cursor is positioned over an icon. The code that causes the mouse to grab the icon must execute only _if_ the mouse cursor is within the same coordinates as the icon's outer edges. That's a classic if/then statement, but different languages can express that differently. +了解了这些关键字,您就可以编写基本的表达式,也就是构建程序的代码块。许多内置的关键字能帮助您构建条件语句,这些条件语句影响整个程序的流程。例如,如果您想编写一个允许单击和拖动图标的程序,那么您的代码就必须检测用户的鼠标指针何时位于图标上。只有当鼠标光标位于图标外部边缘相同的坐标时,才执行导致使鼠标抓取图标的代码。这是一个经典的 if / then 语句,不同的语言可以用不同的方式表达。 -Python uses a combination of `if`, `elif`, and `else` but doesn't explicitly close the statement: +Python 使用 `if`, `elif `和 `else` 的组合来实现条件语句,但是并不显式的关闭语句: ``` @@ -90,7 +89,7 @@ else:     # some other action ``` -[Bash][11] uses `if`, `elif`, `else`, and uses `fi` to end the statement: +[Bash][11] 使用 `if`, `elif`, `else`, 并且使用 `fi` 来结束语句: ``` @@ -103,7 +102,7 @@ else fi ``` -C and Java, however, use `if`, `else`, and `else if`, enclosed by braces: +然而 C 和 Java, 使用 `if`, `else` 和 `else if`, 用花括号把它们括起来: ``` @@ -116,27 +115,27 @@ if (boolean) { } ``` -While there are small variations in word choice and syntax, the basics are always the same. Learn the ways to define conditions in the programming language you're learning, including `if/then`, `do...while`, and `case` statements. +各种编程语言虽然在关键字的选择和语法上有细微的变化,但基本是相同的。学习如何在所学的编程语言中定义条件语句,包括 `if/then`, `do...while` 和 `case` 语句。 -#### Take action +#### 实践 -Get familiar with the core set of keywords a programming language understands. In practice, your code will contain more than just a language's core words, because there are almost certainly libraries containing lots of simple functions to help you do things like print output to the screen or display a window. The logic that drives those libraries, however, starts with a language's built-in keywords. +要去熟悉编程语言能够理解的关键字集。在实践中,您的代码将不仅仅包含一种语言的关键字。可以肯定的是,有许多库中包含一些简单的函数,它们可以帮助您完成诸如将输出打印到屏幕或显示窗口之类的操作。然而,驱动这些库的逻辑始于编程语言的内置关键字。 -### 3\. Data types +### 3\. 数据类型 ![Data types][12] (Seth Kenlon, [CC BY-SA 4.0][4]) -Code deals with data, so you must learn how a programming language recognizes different kinds of data. All languages understand integers and most understand decimals and individual characters (a, b, c, and so on). These are often denoted as `int`, `float` and `double`, and `char`, but of course, the language's built-in vocabulary informs you of how to refer to these entities. +代码是用来处理数据的,因此您必须学习编程语言如何识别不同类型的数据。所有编程语言都能理解整数,大多数的语言能理解小数和单个字符 (a, b, c 等等)。它们通常被表示为 `int` , `float`,`double` 和 `char`, 当然,语言的内置词汇表会告诉您如何引用这些实体。 -Sometimes a language has extra data types built into it, and other times complex data types are enabled with libraries. For instance, Python recognizes a string of characters with the keyword `str`, but C code must include the `string.h` header file for string features. +有时候,在编程语言中内置了一些额外的数据类型,也有时是通过引用库来启用复杂的数据类型。例如,Python 可以识别关键字为 `str` 的字符串,但是 C 语言的代码中必须包含 `string.h` 头文件才能实现字符串特性。 -#### Take action +#### 实践 -Libraries can unlock all manner of data types for your code, but learning the basic ones included with a language is a sensible starting point. +库可以为您的代码解锁所有类型的数据,但是学习编程语言中包含的基本数据类型是一个明智的起点。 -### 4\. Operators and parsers +### 4\. 运算符和解析器 ![Operators][13] @@ -183,17 +182,17 @@ via: https://opensource.com/article/20/10/learn-any-programming-language [a]: https://opensource.com/users/seth [b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/learn-programming-code-keyboard.png?itok=xaLyptT4 (Learning to program) +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/learn-programming-code-keyboard.png?itok=xaLyptT4 "Learning to program" [2]: https://opensource.com/article/20/9/scratch -[3]: https://opensource.com/sites/default/files/uploads/syntax_0.png (Syntax) +[3]: https://opensource.com/sites/default/files/uploads/syntax_0.png "Syntax" [4]: https://creativecommons.org/licenses/by-sa/4.0/ [5]: https://opensource.com/downloads/cheat-sheet-python-37-beginners [6]: https://opensource.com/article/20/2/lua-cheat-sheet [7]: https://opensource.com/downloads/java-cheat-sheet [8]: https://opensource.com/downloads/c-programming-cheat-sheet [9]: https://opensource.com/resources/what-ide -[10]: https://opensource.com/sites/default/files/uploads/builtin.png (built-in words) +[10]: https://opensource.com/sites/default/files/uploads/builtin.png "built-in words" [11]: https://opensource.com/downloads/bash-cheat-sheet -[12]: https://opensource.com/sites/default/files/uploads/type.png (Data types) -[13]: https://opensource.com/sites/default/files/uploads/operator.png (Operators) -[14]: https://opensource.com/sites/default/files/uploads/class.png (Class) +[12]: https://opensource.com/sites/default/files/uploads/type.png "Data types" +[13]: https://opensource.com/sites/default/files/uploads/operator.png "Operators" +[14]: https://opensource.com/sites/default/files/uploads/class.png "Class" From 6e07125c6fc67b9ab33e31741f30cd6576093201 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 12 Nov 2020 08:55:42 +0800 Subject: [PATCH 0727/1156] translating --- ...mit Computer Usage Per Account in Linux With Timekpr-nExt.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md b/sources/tech/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md index 0b3ed25c39..8212c74841 100644 --- a/sources/tech/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md +++ b/sources/tech/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 5e665e94b94edd8e97d736615939e183673c1dba Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 12 Nov 2020 10:23:52 +0800 Subject: [PATCH 0728/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201111?= =?UTF-8?q?=20Using=20Fedora=2033=20with=20Microsoft=E2=80=99s=20WSL2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201111 Using Fedora 33 with Microsoft-s WSL2.md --- ...1 Using Fedora 33 with Microsoft-s WSL2.md | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 sources/tech/20201111 Using Fedora 33 with Microsoft-s WSL2.md diff --git a/sources/tech/20201111 Using Fedora 33 with Microsoft-s WSL2.md b/sources/tech/20201111 Using Fedora 33 with Microsoft-s WSL2.md new file mode 100644 index 0000000000..ba5f635617 --- /dev/null +++ b/sources/tech/20201111 Using Fedora 33 with Microsoft-s WSL2.md @@ -0,0 +1,146 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using Fedora 33 with Microsoft’s WSL2) +[#]: via: (https://fedoramagazine.org/wsl-fedora-33/) +[#]: author: (Jim Perrin https://fedoramagazine.org/author/jperrin/) + +Using Fedora 33 with Microsoft’s WSL2 +====== + +![][1] + +Photo by [Matthias Heil][2] on [Unsplash][3] + +If you’re 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 don’t 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 you’ll 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 you’re finished. Microsoft recommends setting wsl2 as the distro default for simplicity. This guide assumes you’ve done that. + +Next, you’re 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 doesn’t ship an actual rootfs archive, we’re 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 don’t unpack it. You want to end up with something like fedora-33-_datestamp_.tar. Once you have that, you’re 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 it’s 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 wsl’s 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 Fedora’s wsl instance as the root user. From here, you’re going to install a few core packages and set a new default user. You’re also going to need to configure sudo, otherwise you won’t 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 they’re useful to have around. Since you need to use a Copr repo for this, you want the added dnf functionality. + +### Add your user + +Now it’s time to add your user, and set it as the default. +``` + +``` + +useradd -G wheel yourusername +passwd yourusername +``` + +``` + +Now that you’ve created your username and added a password, make sure they work. Exit the wsl instance, and launch it again, this time specifying the username. You’re 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, you’re 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, you’re done getting the basic Fedora 33 setup running in wsl, but it doesn’t have the Windows integration piece yet. If this is something you want, there’s a Copr repo to enable. If you choose to add this piece, you’ll 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 From 10799fecc50883544b2ca4c2e1c3ba64cb49dea2 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 12 Nov 2020 10:24:13 +0800 Subject: [PATCH 0729/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201109?= =?UTF-8?q?=20Getting=20started=20with=20Stratis=20encryption?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201109 Getting started with Stratis encryption.md --- ...Getting started with Stratis encryption.md | 201 ++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 sources/tech/20201109 Getting started with Stratis encryption.md diff --git a/sources/tech/20201109 Getting started with Stratis encryption.md b/sources/tech/20201109 Getting started with Stratis encryption.md new file mode 100644 index 0000000000..1aa0df1c7b --- /dev/null +++ b/sources/tech/20201109 Getting started with Stratis encryption.md @@ -0,0 +1,201 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with Stratis encryption) +[#]: via: (https://fedoramagazine.org/getting-started-with-stratis-encryption/) +[#]: author: (briansmith https://fedoramagazine.org/author/briansmith/) + +Getting started with Stratis encryption +====== + +![][1] + +Stratis is described on its [official website][2] as an “_easy to use local storage management for Linux_.” See this [short video][3] for a quick demonstration of the basics. The video was recorded on a Red Hat Enterprise Linux 8 system. The concepts shown in the video also apply to Stratis in Fedora. + +Stratis version 2.1 introduces support for encryption. Continue reading to learn how to get started with encryption in Stratis. + +### Prerequisites + +Encryption requires Stratis version 2.1 or greater. The examples in this post use a pre-release of Fedora 33. Stratis 2.1 will be available in the final release of Fedora 33. + +You’ll also need at least one available block device to create an encrypted pool. The examples shown below were done on a KVM virtual machine with a 5 GB virtual disk drive _(/dev/vdb_). + +### Create a key in the kernel keyring + +The Linux kernel keyring is used to store the encryption key. For more information on the kernel keyring, refer to the _keyrings_ manual page (_man keyrings_).   + +Use the _stratis key set_ command to set up the key within the kernel keyring.  You must specify where the key should be read from. To read the key from standard input, use the _–capture-key_ option. To retrieve the key from a file, use the _–keyfile-path <file>_ option. The last parameter is a key description. It will be used later when you create the encrypted Stratis pool. + +For example, to create a key with the description _pool1key_, and to read the key from standard input, you would enter: + +``` +# stratis key set --capture-key pool1key +Enter desired key data followed by the return key: +``` + +The command prompts us to type the key data / passphrase, and the key is then created within the kernel keyring.   + +To verify that the key was created, run _stratis key list_: + +``` +# stratis key list +Key Description +pool1key +``` + +This verifies that the _pool1key_ was created. Note that these keys are not persistent. If the host is rebooted, the key will need to be provided again before the encrypted Stratis pool can be accessed (this process is covered later). + +If you have multiple encrypted pools, they can have a separate keys, or they can share the same key. + +The keys can also be viewed using the following _keyctl_ commands: + +``` +# keyctl get_persistent @s +318044983 +# keyctl show +Session Keyring + 701701270 --alswrv 0 0 keyring: _ses + 649111286 --alswrv 0 65534 \_ keyring: _uid.0 + 318044983 ---lswrv 0 65534 \_ keyring: _persistent.0 +1051260141 --alswrv 0 0 \_ user: stratis-1-key-pool1key +``` + +### Create the encrypted Stratis pool + +Now that a key has been created for Stratis, the next step is to create the encrypted Stratis pool. Encrypting a pool can only be done at pool creation. It isn’t currently possible to encrypt an existing pool. + +Use the _stratis pool create_ command to create a pool. Add _–key-desc_ and the key description that you provided in the previous step (_pool1key_). This will signal to Stratis that the pool should be encrypted using the provided key. The below example creates the Stratis pool on _/dev/vdb_, and names it _pool1_. Be sure to specify an empty/available device on your system. + +``` +# stratis pool create --key-desc pool1key pool1 /dev/vdb +``` + +You can verify that the pool has been created with the _stratis pool list_ command: + +``` +# stratis pool list +Name Total Physical Properties +pool1 4.98 GiB / 37.63 MiB / 4.95 GiB ~Ca, Cr +``` + +In the sample output shown above, _~Ca_ indicates that caching is disabled (the tilde negates the property). _Cr_ indicates that encryption is enabled.  Note that caching and encryption are mutually exclusive. Both features cannot be simultaneously enabled. + +Next, create a filesystem. The below example, demonstrates creating a filesystem named _filesystem1_, mounting it at the _/filesystem1_ mountpoint, and creating a test file in the new filesystem: + +``` +# stratis filesystem create pool1 filesystem1 +# mkdir /filesystem1 +# mount /stratis/pool1/filesystem1 /filesystem1 +# cd /filesystem1 +# echo "this is a test file" > testfile +``` + +### Access the encrypted pool after a reboot + +When you reboot you’ll notice that Stratis no longer shows your encrypted pool or its block device: + +``` +# stratis pool list +Name Total Physical Properties +``` + +``` +# stratis blockdev list +Pool Name Device Node Physical Size Tier +``` + +To access the encrypted pool, first re-create the key with the same key description and key data / passphrase that you used previously: + +``` +# stratis key set --capture-key pool1key +Enter desired key data followed by the return key: +``` + +Next, run the _stratis pool unlock_ command, and verify that you can now see the pool and its block device: + +``` +# stratis pool unlock +# stratis pool list +Name Total Physical Properties +pool1 4.98 GiB / 583.65 MiB / 4.41 GiB ~Ca, Cr +# stratis blockdev list +Pool Name Device Node Physical Size Tier +pool1 /dev/dm-2 4.98 GiB Data +``` + +Next, mount the filesystem and verify that you can access the test file you created previously: + +``` +# mount /stratis/pool1/filesystem1 /filesystem1/ +# cat /filesystem1/testfile +this is a test file +``` + +### Use a systemd unit file to automatically unlock a Stratis pool at boot + +It is possible to automatically unlock your Stratis pool at boot without manual intervention. However, a file containing the key must be available. Storing the key in a file might be a security concern in some environments. + +The systemd unit file shown below provides a simple method to unlock a Stratis pool at boot and mount the filesystem. Feedback on a better/alternative methods is welcome. You can provide suggestions in the comment section at the end of this article. + +Start by creating your key file with the following command. Be sure to substitute _passphrase_ with the same key data / passphrase you entered previously. + +``` +# echo -n passphrase > /root/pool1key +``` + +Make sure that the file is only readable by root: + +``` +# chmod 400 /root/pool1key +# chown root:root /root/pool1key +``` + +Create a systemd unit file at _/etc/systemd/system/stratis-filesystem1.service_ with the following content: + +``` +[Unit] +Description = stratis mount pool1 filesystem1 file system +After = stratisd.service + +[Service] +ExecStartPre=sleep 2 +ExecStartPre=stratis key set --keyfile-path /root/pool1key pool1key +ExecStartPre=stratis pool unlock +ExecStartPre=sleep 3 +ExecStart=mount /stratis/pool1/filesystem1 /filesystem1 +RemainAfterExit=yes + +[Install] +WantedBy = multi-user.target +``` + +Next, enable the service so that it will run at boot: + +``` +# systemctl enable stratis-filesystem1.service +``` + +Now reboot and verify that the Stratis pool has been automatically unlocked and that its filesystem is mounted. + +### Summary and conclusion + +In today’s environment, encryption is a must for many people and organizations. This post demonstrated how to enable encryption in Stratis 2.1. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/getting-started-with-stratis-encryption/ + +作者:[briansmith][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/briansmith/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/11/stratis-encryption-2-816x345.jpg +[2]: https://stratis-storage.github.io/ +[3]: https://www.youtube.com/watch?v=CJu3kmY-f5o From 7859abcba72dc2e83659b91c8d893fabd018d2b4 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 12 Nov 2020 10:24:35 +0800 Subject: [PATCH 0730/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201106?= =?UTF-8?q?=20Reclaim=20hard-drive=20space=20with=20LVM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201106 Reclaim hard-drive space with LVM.md --- ...01106 Reclaim hard-drive space with LVM.md | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 sources/tech/20201106 Reclaim hard-drive space with LVM.md diff --git a/sources/tech/20201106 Reclaim hard-drive space with LVM.md b/sources/tech/20201106 Reclaim hard-drive space with LVM.md new file mode 100644 index 0000000000..14be3ae564 --- /dev/null +++ b/sources/tech/20201106 Reclaim hard-drive space with LVM.md @@ -0,0 +1,90 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Reclaim hard-drive space with LVM) +[#]: via: (https://fedoramagazine.org/reclaim-hard-drive-space-with-lvm/) +[#]: author: (Troy Curtis Jr https://fedoramagazine.org/author/troycurtisjr/) + +Reclaim hard-drive space with LVM +====== + +![Hard drive image][1] + +Photo by Frank R @ Unsplash.com + +LVM is a tool for logical volume management which includes allocating disks, striping, mirroring and resizing logical volumes. It is commonly used on Fedora installations (prior to BTRFS as default it was LVM+Ext4). But have you ever started up your system to find out that Gnome just said the home volume is almost out of space! Luckily, there is likely some space sitting around in another volume, unused and ready to re-alocate. Here’s how to reclaim hard-drive space with LVM. + +The key to easily re-alocate space between volumes is the [Logical Volume Manager (LVM)][2]. Fedora 32 and before use LVM to divide disk space by default. This technology is similar to standard hard-drive partitions, but LVM is a lot more flexible. LVM enables not only flexible volume size management, but also advanced capabilities such as read-write snapshots, striping or mirroring data across multiple drives, using a high-speed drive as a cache for a slower drive, and much more. All of these advanced options can get a bit overwhelming, but resizing a volume is straight-forward. + +### LVM basics + +The _volume group_ serves as the main container in the LVM system. By default Fedora only defines a single volume group, but there can be as many as needed. Actual hard-drive and hard-drive partitions are added to the _volume group_ as _physical volumes_. _Physical volumes_ add available free space to the _volume group_. A typical Fedora install has one formatted boot partition, and the rest of the drive is a partition configured as an LVM _physical volume_. + +Out of this pool of available space, the _volume group_ allocates one or more _logical volumes_. These volumes are similar to hard-drive partitions, but without the limitation of contiguous space on the disk. LVM _logical volumes_ can even span multiple devices! Just like hard-drive partitions, _logical volumes_ have a defined size and can contain any filesystem which can then be mounted to specific directories. + +### What’s needed + +Confirm the system uses LVM with the _gnome-disks_ application, and make sure there is free space available in some other volume. Without space to reclaim from another volume, this guide isn’t useful. A [Fedora live CD/USB][3] is also needed. Any file system that needs to shrink must be unmounted. Running from a live image allows all the volumes on the hard-disk to remain unmounted, even important directories like _/_ and _/home_. + +![Use gnome-disks to verify free space][4] + +### A word of warning + +No data should be lost by following this guide, but it does muck around with some very low-level and powerful commands. One mistake could destroy all data on the hard-drive. So backup all the data on the disk first! + +### Resizing LVM volumes + +To begin, boot the Fedora live image and select _Try Fedora_ at the dialog. Next, use the _Run Command_ to launch the _blivet-gui_ application (accessible by pressing _Alt-F2_, typing _blivet-gui_, then pressing _enter_). Select the volume group on the left under _LVM_. The logical volumes are on the right. + +![Explore logical volumes in blivet-gui][5] + +The logical volume labels consist of both the volume group name and the logical volume name. In the example, the volume group is “fedora_localhost-live” and there are “home”, “root”, and “swap” logical volumes allocated. To find the full volume, select each one, click on the _gear_ icon, and choose _resize_. The slider in the resize dialog indicates the allowable sizes for the volume. The minimum value on the left is the space already in use within the file system, so this is the minimum possible volume size (without deleting data). The maximum value on the right is the greatest size the volume can have based on available free space in the _volume group_. + +![Resize dialog in blivet-gui][6] + +A grayed out _resize_ option means the volume is full and there is no free space in the volume group. It’s time to change that! Look through all of the volumes to find one with plenty of extra space, like in the screenshot above. Move the slider to the left to set the new size. Free up enough space to be useful for the full volume, but still leave plenty of space for future data growth. Otherwise, this volume will be the next to fill up. + +Click _resize_ and note that a new item appears in the volume listing: _free space_. Now select the full volume that started this whole endeavor, and move the slider all the way to the right. Press _resize_ and marvel at the new improved volume layout. However, nothing has changed on the hard drive yet. Click on the _check-mark_ to commit the changes to disk. + +![Review changes in blivet-gui][7] + +Review the summary of the changes, and if everything looks right, click _Ok_ to proceed. Wait for _blivet-gui_ to finish. Now reboot back into the main Fedora install and enjoy all the new space in the previously full volume. + +### Planning for the future + +It is challenging to know how much space any particular volume will need in the future. Instead of immediately allocating all available free space, consider leaving it free in the volume group. In fact, Fedora Server reserves space in the volume group by default. Extending a volume is possible while it is online and in use. No live image or reboot needed. When a volume is almost full, easily extend the volume using part of the available free space and keep working. Unfortunately the default disk manager, _gnome-disks_, does not support LVM volume resizing, so install _[blivet-gui][8]_ for a graphical management tool. Alternately, there is a simple terminal command to extend a volume: + +``` +lvresize -r -L +1G /dev/fedora_localhost-live/root +``` + +### Wrap-up + +Reclaiming hard-drive space with LVM just scratches the surface of LVM capabilities. Most people, especially on the desktop, probably don’t need the more advanced features. However, LVM is there when the need arises, though it can get a bit complex to implement. [BTRFS][9] is the default filesystem, without LVM, starting with [Fedora 33][10]. BTRFS can be easier to manage while still flexible enough for most common usages. Check out the recent [Fedora Magazine articles on BTRFS][11] to learn more. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/reclaim-hard-drive-space-with-lvm/ + +作者:[Troy Curtis Jr][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/troycurtisjr/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/11/lvm-resize-816x345.jpg +[2]: http://sourceware.org/lvm2/ +[3]: https://getfedora.org/en/workstation/download/ +[4]: https://fedoramagazine.org/wp-content/uploads/2020/11/gnome-disks.png +[5]: https://fedoramagazine.org/wp-content/uploads/2020/11/blivet-overview.png +[6]: https://fedoramagazine.org/wp-content/uploads/2020/11/blivet-resize-1024x525.png +[7]: https://fedoramagazine.org/wp-content/uploads/2020/11/blivet-summary-1024x525.png +[8]: https://fedoraproject.org/wiki/Blivet-gui +[9]: https://fedoramagazine.org/btrfs-coming-to-fedora-33/ +[10]: https://fedoramagazine.org/whats-new-fedora-33-workstation/ +[11]: https://fedoramagazine.org/btrfs-snapshots-backup-incremental/ From d8ec623071497962f591a33f500140e6f888b29b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 12 Nov 2020 10:25:16 +0800 Subject: [PATCH 0731/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201109?= =?UTF-8?q?=20DevOps=20Replaces=20Developers=20As=20Most=20Sought=20After?= =?UTF-8?q?=20Skill=20Set?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201109 DevOps Replaces Developers As Most Sought After Skill Set.md --- ...velopers As Most Sought After Skill Set.md | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 sources/tech/20201109 DevOps Replaces Developers As Most Sought After Skill Set.md diff --git a/sources/tech/20201109 DevOps Replaces Developers As Most Sought After Skill Set.md b/sources/tech/20201109 DevOps Replaces Developers As Most Sought After Skill Set.md new file mode 100644 index 0000000000..8b66610ede --- /dev/null +++ b/sources/tech/20201109 DevOps Replaces Developers As Most Sought After Skill Set.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (DevOps Replaces Developers As Most Sought After Skill Set) +[#]: via: (https://www.linux.com/interviews/devops-replaces-developers-as-most-sought-after-skill-set/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +DevOps Replaces Developers As Most Sought After Skill Set +====== + +[_The_ 2020 Open Source Jobs Report][1] _just came out so we took the opportunity to speak with Clyde Seepersad, Senior Vice President and General Manager of Training and Certification at the Linux Foundation, about the significance of the report and the insights it provides on the current open source landscape. He touched on the effects of COVID-19 on hiring trends, the open source skills that are in high demand, and how the Foundation is helping organizations meet this demand through high-quality intensive training. Bottom line, he says “We still don’t have enough open source talent. The urgency of finding new ways to bring talent into the market continues to be something that should be front and center for all of us.”_ + +**Swapnil Bhartiya: What is the importance of this report? Not only for the open source ecosystem, but companies outside of the open source ecosystem, because today almost everybody’s leveraging open source in one capacity or another.** + +Clyde Seepersad: One of the things that we didn’t realize several years ago is that there is a lot of data around general employment reports and a few around IT and technology in general, but there was really this gap when it comes to what’s happening on open source talent, and we kept hearing anecdotally that people can’t hire or can’t find enough talent. + +And so what we wanted to do was put a really clear spotlight on what’s going on specifically when it comes to the talent pool around open source, to be able to share with the market a sort of non-anecdotal state of the world, but also to be able to inform our own strategy and our own mission, which is to try to ensure not just that there is fantastic code coming out of open source projects, but also that there is enough talent to implement and use it as tool. + +**Swapnil Bhartiya: What are some of the key highlights of this report?** + +Clyde Seepersad: A couple of things. One is the rise of DevOps skills. I think everybody knows cloud is hot. It’s been that way for a while, but the companion piece to that around DevOps and the importance of understanding CI/CD pipelines and also the cultural difference of working in that sort of continuous delivery. The rise of that, I think, is something that maybe most people are not quite as aware of. + +The second thing I would highlight is that there were a lot of questions about what’s happening to tech hiring in response to the COVID pandemic. We have some answers for that, that says that although hiring slowed down, it did not slow down nearly as much as people might have worried at the outset. In fact, it’s now accelerating. + +The top-level thing, which is continuing to be the case, is we still don’t have enough open-source talent. The urgency of finding new ways to bring talent into the market continues to be something that should be front and center for all of us. + +**Swapnil Bhartiya: So if we look at this report, what are the skills that are kind of not only most in demand, but also hardest to find? That is like a chicken-and-egg solution, right?** + +Clyde Seepersad: Yeah. Obviously, it’s the cloud skills, right? A lot of the smaller companies, more conservative companies, they kind of make us push them to be much more active on the cloud. What that’s done is raise the stakes in terms of people who are familiar with cloud-native development, cloud-native architecture, Kubernetes orchestration, and then what does CI/CD pipelines look like in a cloud world because obviously, there’s some changes there when you’re running that sort of infrastructure. So those interwoven skillsets, right? + +Of course, sitting underneath all of that is what operating system does the cloud run on? I think we all know now that the vast, fast 98% of instances are running on Linux. So you have this tiered approach where understanding from basic Linux competence is a baseline and then you’re building on top of that, looking for cloud-native development, cloud-native orchestration, and then what the CI/CD pipelines look like to bring that to life. + +**Swapnil Bhartiya: So when we look at this shortage of talent and, at the same time, the demand for talent, in addition to just coming out with this report, do you have any kind of advice or suggestion to the hiring managers? What can they do to attract top developers or talent to their organizations because there is heavy demand and everybody wants them?** + +Clyde Seepersad: Right. Well, some of the things actually have happened in response to the pandemic, right? One of the trends we saw last year was people wanting the flexibility to be able to work from home. Of course, now we all work from home so that helps. But what came out in the report that was really interesting is that more and more talent managers are realizing that you don’t just have to go externally for talent, that you can, in fact, upskill people who are currently in your organization. + +The data suggests that a lot more people are waking up and realizing that trolling LinkedIn for your next hire is a zero-sum game because other people are doing the same. They’re starting to invest more in training, especially online training. They’re starting to invest more in certifications for their employees. And just in general, they’re starting to be much more proactive in looking at investing into their talent pool and finding ways to provide new opportunities for development. Of course, that also comes with new job opportunities for the existing employee base. + +**Swapnil Bhartiya: I just want to talk a little bit more about COVID-19. A couple of things are happening with COVID-19: a lot of companies that are scaling down. They’re cutting budgets and everything. At the same time, since people are able to work remotely, you don’t have to relocate yourself or you don’t have to find talent in the same area. You have access to almost everybody wherever they are. So how has COVID-19 affected the hiring process itself in terms of while they do have to scale down to some extent, the beauty is, I should not say that, the world that we are living in is all powered by cloud and technology. All the purchases that I was making even in my Indian grocery, they now have a website. I can just go and place an order. It was not the case earlier. So, cloud actually enabled companies to stay in business. That also means that you do need developers and all those talents to keep those businesses running. At the same time, you have the advantage of not having to relocate. So talk a bit about it.** + +Clyde Seepersad: Yeah, that’s true. I don’t think that’s tied together, right? So as people have been forced to use the cloud more, I had the same experience you did. My local Chinese restaurant suddenly developed a website and they have an ordering business that they did not previously have. Every business is now an e-commerce business is true, right? So there’s this broader footprint. + +On the flip side of it, you also have people who are now having to work from home, where they maybe didn’t use to, either for practical or maybe cultural reasons within the company. That also then intersects with the sort of cultural change and the cultural norms of CI/CD and DevOps, right? This idea that you have to be in person together versus this idea that you have a well-documented pipeline and everybody can contribute to that pipeline and do their commits and do their code, that whole tooling ecosystem of cloud native and DevOps has actually made it, made it easier—and I would argue, possible—to do what’s happened and what we’ve seen over the past several months, which is people being productive, working from home, working with people they haven’t worked with before, onboarding new team members, and being able to get them provisioned with the right access and up skill on the right systems. It’s all really come together. In my view, we have been lucky that we’ve got the technology infrastructure that we have today because I don’t know that we would have been able to stay as productive and focused in a sudden shift to remote work if we were trying to do this even five years ago, + +**Swapnil Bhartiya: I’m a good example of that because I have been working from home ever since I moved out of India. What I realized was that I work when I feel that I’m most productive instead of hey, I have to clock in at 9:00 AM and I have to clock out at 5:00 PM. I have to sit there and do something. It doesn’t matter how I feel. And then sometimes, there are personal issues. Somebody is sick in the family and your mind is there, but you have to come to the office. I think remote working offers the best balance between work and life. Of course, it is actually more challenging because you may end up working all the time, but still, it offers a better balance. Earlier you were talking about how you don’t have to go out to hire people; you can also internally train people. So when we look at organizations and they look at all these new cloud-native technologies and they want to retain or prepare their own workforce, what resources are available there, especially from the Linux Foundation so that they can better equip their own workforce when there is already a shortage of a lot of talent?** + +Clyde Seepersad: Yeah, it’s a good question, Swapnil. From a practical perspective, the portfolio that we have provided, which is very heavily focused on self-paced e-learning that you take online, but at the same time, very skills-based, very lab-intensive online training, because ultimately, what do you care about as a colleague or as a hiring manager? It’s not whether they check the box and they have a certificate saying they completed a course. What you care about is the skills, right? Did they actually develop those skills? So, we’ve got a pretty big portfolio of very hands-on, self-paced e-learning programs to help people develop the skills. And then we’ve continued to build our portfolio of performance-based certification exams. So this is not your grandad’s pick an answer out of a lineup, right? These are live systems with variable questions, and you have to demonstrate your skills under the pressure of time, under the pressure of being proctored by an independent person. I think it’s that one-two punch of really focusing on skills. + +I joke with people all the time. We get feedback sometimes that our courses aren’t don’t have enough video. And I say, “Well, true, because we’re not trying to entertain you. We’re trying to develop skills and the way you develop skills is not by staring at a screen and listening to a video. The way you develop skills is by doing a lab.” So we’ve got a very lab-centric mindset in terms of the training side of it and that carries on into the certification side of it, where it’s all about performance. Show that you can do the work, take the time to develop the skills because that’s what your colleagues are going to be looking for. That’s what your employers are going to be looking for. That’s what’s going to benefit you personally, as an individual — to be able to have that broader skill set and to be able to do that in a remote way and not have to rely on a senior trainer coming onto site and working with you. I think that’s going to be the new normal. + +**Swapnil Bhartiya: The advantage of this crisis is that people are realizing that they don’t have to move. Actually, they can move to the ideal pace they wanted to live. It could be a big ranch, it could be a beach, and they can work for companies who are operating in Silicon Valley, which also means you can also cross national boundaries. The whole idea of hope is open source is the best and the brightest people from around the globe. So how do you enable these people? People come from different cultural backgrounds, different education backgrounds, and different languages. Do you also help them irrespective of where they’re coming from, whether it’s internationalizing or supporting different languages so people can get training?** + +Clyde Seepersad: Yeah. Our LS training, we do that. Obviously, the online format helps because it’s truly available 24/7 globally, nights and weekends. So that really has expanded the footprint of what we’re able to do and who we are able to reach. We’ve also done some translations, particularly for the certification exams to make those available in languages that we know folks may not otherwise be comfortable with, for Japan and China, for instance. + +What we’re trying to do is mirror what we’re seeing in the workforce. The shift towards more remote work has actually opened up the pipeline. When you think about hiring and talent management, if you think about somebody who is in the US or in Western Europe, your pool is not as limited. You really can reach out to this global pool of talent in non-traditional markets. We’ve seen sectors get hot. Obviously, India has a lot of workshops today. There’s a ton of stuff happening in Eastern Europe now, but it really is global, right? We’ve got folks on our team in South America being super productive in this new remote way of working. I think that’s becoming more and more typical. Because of the rise of cloud native, because of the rise of Cloud Native, because of the rise of this sort of collaborative DevOps mindset, we are able to collaborate across regions, across countries, across time zones, much more effectively than they ever have before. + +**Swapnil Bhartiya: Awesome. Clyde, thank you so much for talking to me today about not only this report, but also how to help hiring managers not only get more talent, but also not retrain their own employees. I look forward to talking to you again. Thank you.** + +Clyde Seepersad: Hey, it’s always a pleasure to be with you, Swap. Thank you. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/interviews/devops-replaces-developers-as-most-sought-after-skill-set/ + +作者:[Swapnil Bhartiya][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://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 +[1]: https://www.prnewswire.com/news-releases/2020-open-source-jobs-report-reveals-spike-in-demand-for-devops-talent-continued-dearth-of-open-source-skills-301159394.html#:~:text=The%202020%20Open%20Source%20Jobs%20Report%20examines%20trends,and%20how%20employers%20attract%20and%20retain%20qualified%20talent. From 12456e70c9844d8db33bb066b33260ce6ea27c0e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 12 Nov 2020 10:26:54 +0800 Subject: [PATCH 0732/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201112?= =?UTF-8?q?=20How=20to=20Install=20and=20Use=20Etcher=20on=20Linux=20for?= =?UTF-8?q?=20Making=20Live=20Linux=20USB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md --- ...cher on Linux for Making Live Linux USB.md | 136 ++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 sources/tech/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md diff --git a/sources/tech/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md b/sources/tech/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md new file mode 100644 index 0000000000..2a443bcb64 --- /dev/null +++ b/sources/tech/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md @@ -0,0 +1,136 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Install and Use Etcher on Linux for Making Live Linux USB) +[#]: via: (https://itsfoss.com/install-etcher-linux/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +How to Install and Use Etcher on Linux for Making Live Linux USB +====== + +_**Etcher is a popular USB flasher app for creating bootable Linux USB drives. Let me show you how to install it and how to use it for making a live Linux disk.**_ + +### Etcher: An open source tool to flash Linux ISO on SD Cards & USB drives + +Etcher is an open-source project by [Balena][1] to help flash SD cards for Raspberry Pi. In fact, we used it in our tutorial on [how to install Raspbian OS on a SD Card][2]. + +Not just limited to SD Cards, you can also use Etcher to [make a bootable USB drive][3] just like we created a [live USB of Manjaro in Linux][4] with the help of it. + +Ever since its first release, Etcher caught the attention for its neat interface and simplicity of use. + +![][5] + +In this article, I will be focusing on the steps to help you install Etcher on Linux. And then, I’ll also show how to use it. Before I do that, let me give you an overview of the features it offers: + +### Features of Etcher + + * Validate drive before flashing + * Beautiful user interface + * Auto-detects USB drive/SD card to prevent wiping the HDD on your computer + * Cross-platform support (Windows, macOS, and Linux) + * Fast flashing + * Simple three-step process + + + +On paper, you get everything one would need to flash OS images on an SD card and a USB drive. It is also exciting to know that they plan to add the support simultaneous writing to multiple devices as per their [roadmap][6]. + +### Installing Etcher on Linux + +To get started, you have to grab the AppImage file that it offers (suitable for any Linux distribution) from its official website. + +You just need to head on to its [homepage][7] and download the one for your system (32-bit/64-bit): + +![][8] + +In my case, I got the 64-bit AppImage file for Ubuntu. You can go through our guide on [using AppImage files on Linux][9], but I’ll give you a head start on what you need to do next. + +You need to give the file permissions to execute and you can do that by right-clicking on the **AppImage file -> Properties**. + +![][10] + +Next, click on “**Allow executing as a program**” under the Permissions tab as shown in the image below. + +![][11] + +Now, just double-click on the AppImage file to launch balenaEtcher! + +This should work on any Linux distribution. In either case, you can also head over to its [GitHub releases se][12][c][12][tion][12] to find RPM, DEB, and the source file if you want to build it from source or just install it using the .rpm or .deb files. + +You can also refer to our guide on [using deb file in Ubuntu][13] to install applications. + +Attention! + +It’s been noticed that when you use Etcher to create live USB of Linux distributions, it leaves the USB in an apparent unusable state where it has only a few MB of free state and cannot be formatted directly. On Linux, you can [use the Disks tool to manually delete the partitions and then format it][14]. + +### Using Etcher on Linux + +It is just a three-step process to get started using Etcher. It should be self-explanatory as per the on-screen instructions after you launch it, but just to give you a head start, here’s what you have to do: + +**Step 1:** Select the appropriate ISO image file or the URL of the file that you need to flash (as shown in the image below). + +![][15] + +**Step 2**: Next, you will have to select the target device. It automatically detects and highlights removable devices to help you prevent selecting any internal storage locations. + +![][16] + +In this case, I have a USB drive connected, and I have it selected as well (as shown in the screenshot below). + +![][17] + +**Step 3:** Now, all you have to do is — flash the image and wait for it to complete successfully. + +![][18] + +Here’s how the progress looks: + +![][19] + +And, it is done! + +![][20] + +[Download balenaEtcher][7] + +### Wrapping Up + +Etcher is a useful tool to flash OS images for both SD cards and USB drives. I tend to use it primarily to create live USB drives to test Linux distros and I’m happy with it. + +What do you prefer to use to create bootable drives? Have you tried Etcher already? Let me know your thoughts in the comments down below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-etcher-linux/ + +作者:[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://www.balena.io/ +[2]: https://itsfoss.com/tutorial-how-to-install-raspberry-pi-os-raspbian-wheezy/ +[3]: https://itsfoss.com/create-bootable-ubuntu-usb-drive-mac-os/ +[4]: https://itsfoss.com/create-live-usb-manjaro-linux/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/etcher-mxlinux-2.png?resize=800%2C518&ssl=1 +[6]: https://github.com/balena-io/etcher/milestones +[7]: https://www.balena.io/etcher +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/etcher-official-site-download.png?resize=800%2C580&ssl=1 +[9]: https://itsfoss.com/use-appimage-linux/ +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/balena-etcher-permission.jpg?resize=800%2C378&ssl=1 +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/balena-etcher-execute.jpg?resize=800%2C445&ssl=1 +[12]: https://github.com/balena-io/etcher/releases/tag/v1.5.109 +[13]: https://itsfoss.com/install-deb-files-ubuntu/ +[14]: https://itsfoss.com/cant-format-usb-disk/ +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/balena-etcher-select.jpg?resize=800%2C521&ssl=1 +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/etcher-select-target.jpg?resize=800%2C509&ssl=1 +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/etcher-target-device.jpg?resize=800%2C521&ssl=1 +[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/etcher-flash.jpg?resize=800%2C516&ssl=1 +[19]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/etcher-flashing.jpg?resize=800%2C510&ssl=1 +[20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/etcher-flash-complete.jpg?resize=800%2C507&ssl=1 From dbbcaaaeaa964015c5b7d4f346e804b0117a1db1 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 12 Nov 2020 10:27:46 +0800 Subject: [PATCH 0733/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201112?= =?UTF-8?q?=20MuditaOS:=20A=20Beautiful=20and=20Minimal=20Open=20Source=20?= =?UTF-8?q?Mobile=20Operating=20System=20for=20Feature=20Phones?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201112 MuditaOS- A Beautiful and Minimal Open Source Mobile Operating System for Feature Phones.md --- ...ile Operating System for Feature Phones.md | 116 ++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 sources/tech/20201112 MuditaOS- A Beautiful and Minimal Open Source Mobile Operating System for Feature Phones.md diff --git a/sources/tech/20201112 MuditaOS- A Beautiful and Minimal Open Source Mobile Operating System for Feature Phones.md b/sources/tech/20201112 MuditaOS- A Beautiful and Minimal Open Source Mobile Operating System for Feature Phones.md new file mode 100644 index 0000000000..288a5b0bf8 --- /dev/null +++ b/sources/tech/20201112 MuditaOS- A Beautiful and Minimal Open Source Mobile Operating System for Feature Phones.md @@ -0,0 +1,116 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (MuditaOS: A Beautiful and Minimal Open Source Mobile Operating System for Feature Phones) +[#]: via: (https://itsfoss.com/mudita-os/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +MuditaOS: A Beautiful and Minimal Open Source Mobile Operating System for Feature Phones +====== + +_**Find the always connected smartphones too distracting and privacy invasive? Let’s go back to the pre-2010 era and enjoy the simplicity of feature phones but with a modern design with MuditaOS.**_ + +There are a [few open source mobile operating systems][1] existing already. Let me add one more to this list. + +Unlike most other mobile operating systems, MuditaOS is not interested in serving smartphones. Let’s have a look at it. + +### Meet MuditaOS: A minimalistic, yet powerful mobile operating system + +![][2] + +[MuditaOS][3] is a beautifully designed [E Ink][4] mobile operating system. You might have come across the E Ink display with electronic eBook readers like Kindle or Nook. + +The E Ink display itself is soothing to the eyes and MuditaOS makes it even more beautiful with its minimalist approach. + +Here are the components of a basic phone running MuditaOS: + + * Home Screen (with clock and notification) + * Calls + * Phonebook + * Messaging + * Settings + * Music Player (Thanks goodness!) + * Alarm clock + * Calendar + * Meditation Timer + * Tools + * Onboarding + + + +Since this is all too 2007-ish, MuditaOS has a companion desktop application available to manage the phone. + +### Mudita Center desktop app to manage your Mudita Phone + +![][5] + +Mudita Center application is available on Linux, Windows and macOS. Connecting the phone to the computer and using this application, you can do the following: + + * Update MuditaOS + * Upload and manage audio on Pure + * Export notes and voice memos + * Create longer messages and notes (because typing on phone with limited keys is a pain) + * Synchronize calendar + * Use your phone as mobile hotspot (if you have the 3G/4G data connection) + + + +### What devices are available? + +![][6] + +MuditaOS is specially created for their own [Mudita Pure phones][7] that come on pebble gray and charcoal black colors. + +The phones are water resistant with IP54 rating and though it supports 4G network, you cannot use internet on the phone. You’ll have to tether it with your computer to use the data network on the computer. + +It also has ultralow SAR antenna to minimize the mobile radiation exposure. Another good thing is that their speakers and microphones are by [Harman][8] so expect top quality audio. + +Here are more technical specifications: + + * Processor: Arm Cortex-M7 600MHz, 512KB Tightly Coupled Memory (TCM) + * Memory: 16 MB SDRAM and 16 GB eMMC flash storage + * Network and connectivity: 2G, 3G, 4G/LTE, GSM, Bluetooth 4.2, USB type-C, No WiFi, no mobile data on the phone + * Display: 2.84’’ E Ink (600x480px), 16-grayscale, scratch resistant + * Weight: 140 g + * Sim card: 2 nano SIM card slots + * Audio: Loudspeaker, earspeaker & microphone by Harman, Audio playback format: MP3, WAV, FLAC, Headphone jack, Bluetooth audio playback + * Battery: ~1600mAh, Li-Po, replacable + * Sensors: Ambient Light + + + +You can preorder a Mudita Pure phone on the link below Keep in mind that pricing is astronomical compared to other feature phones. + +[Pre-order Mudita Pure][7] + +As of now, I am not aware of any device other than the ones from Mudita running MuditaOS. This is rather new on the scene. + +### Conclusion + +The name Mudita is inspired by the Sanskrit word ‘Mudit’ which means ‘happy’. Recently when the developers open sourced their project they mentioned, “open-sourcing MuditaOS goes along the line of our “You’re happy – I’m Happy” philosophy”. + +I know that working on feature phones in the age of smartphones may sound like a bad idea but keep in mind that feature phones are still not obsolete. There is still market for these phones among older people and for people who don’t want to spend too much on phones just for making calls. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/mudita-os/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/open-source-alternatives-android/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/muditaos.jpg?resize=800%2C450&ssl=1 +[3]: https://mudita.com/products/pure/muditaos +[4]: https://www.eink.com +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/muditaos-desktop-app.jpg?resize=800%2C581&ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/mudita-pure.jpg?resize=800%2C600&ssl=1 +[7]: https://mudita.com/products/pure/ +[8]: https://www.harmanaudio.com/ From 4e0421e98ee24e3ddaaf975450c09f311e61af43 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 12 Nov 2020 10:28:04 +0800 Subject: [PATCH 0734/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201112?= =?UTF-8?q?=20Quick=20Lookup=20is=20a=20Simple=20Open=20Source=20Word=20Lo?= =?UTF-8?q?okup=20Tool=20to=20Find=20Meaning=20of=20Words=20You=20Come=20A?= =?UTF-8?q?cross?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201112 Quick Lookup is a Simple Open Source Word Lookup Tool to Find Meaning of Words You Come Across.md --- ...o Find Meaning of Words You Come Across.md | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 sources/tech/20201112 Quick Lookup is a Simple Open Source Word Lookup Tool to Find Meaning of Words You Come Across.md diff --git a/sources/tech/20201112 Quick Lookup is a Simple Open Source Word Lookup Tool to Find Meaning of Words You Come Across.md b/sources/tech/20201112 Quick Lookup is a Simple Open Source Word Lookup Tool to Find Meaning of Words You Come Across.md new file mode 100644 index 0000000000..4146d08fcf --- /dev/null +++ b/sources/tech/20201112 Quick Lookup is a Simple Open Source Word Lookup Tool to Find Meaning of Words You Come Across.md @@ -0,0 +1,133 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Quick Lookup is a Simple Open Source Word Lookup Tool to Find Meaning of Words You Come Across) +[#]: via: (https://itsfoss.com/quick-lookup/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Quick Lookup is a Simple Open Source Word Lookup Tool to Find Meaning of Words You Come Across +====== + +_**It is always handy to have a quick word lookup tool while browsing the web or reading an e-book. Quick Lookup is one such free and open-source tool to try.**_ + +Whenever I come across a word that I don’t know the meaning of, I just open a new tab and search for the meaning. However, it is a hit and trial every time depending on what search engine you’re on. + +Even if you do get an idea for the meaning with a quick search, you do not get all the details required along with it. Especially, if you do not know the meaning of the word that describes your target word. You will end up performing another quick search. + +So, to get rid of all that hassle, a quick lookup tool should prove to be useful! + +### Quick Lookup: A Simple Dictionary App Powered by Wiktionary + +![][1] + +Whatever is your [idea of what is Linux][2], this is what Wiktionary thinks of Linux. + +As you might have guessed already, Quick Lookup needs an active Internet connection to give you the results for your words utilizing [Wiktionary][3]. + +It is a completely free and open-source application that offers essential features to make it a handy [productive tool for Linux users][4]. Let us take a look at what it offers. + +**Recommended Read:** + +![][5] + +#### [Artha: An Offline English Thesaurus App for Linux][6] + +Artha is a feature rich thesaurus application available for all major Linux distributions.  + +### Features of Quick Lookup + +![][7] + + * Ability to look for the definitions of the words and phrases + * It lets you manually enter the word or phrase + * Multiple languages supported but the description and meaning of words/phrases will be displayed only in English + * Open internal links from within app (if you’re curious about a related word) + * Remembers your last search with the help of the back button + * You can also launch the app in selection mode to automatically capture the word you select + + + +### Installing Quick Lookup on Linux + +Quick Look is [available primarily][8] as a [Flatpak package][9] for every Linux user. If Flatpak is integrated with your software center like Pop!_Shop on [Pop OS][10], you can find it listed there. + +If you have Flatpak enabled, you can always use this command to install it: + +``` +flatpak install flathub com.github.johnfactotum.QuickLookup +``` + +You can learn more about [using Flatpak][11] in case you don’t know how about it. + +It is worth noting that if you want to select texts on your browser (or any other app) while using a Flatpak package and have it look for the meaning, you will have to type this command (launching it in the selection mode): + +``` +flatpak run com.github.johnfactotum.QuickLookup --selection +``` + +In either case, you can simply [download the source][12] archive and get it installed using the installation script. You can also run it without needing to install it by simply navigating the source folder and typing this command: + +``` +gjs quick-lookup.js +``` + +If you’ve installed it from source and want it to automatically fetch the text that you select on any app, you will have to launch it using the following command: + +``` +quick-lookup --selection +``` + +You also get an option to use the [GNOME Builder][13] if you’re familiar with it. For more details, you can check out its [GitHub page][14]. + +[Quick Lookup][14] + +**Recommended Read:** + +![][15] + +#### [LanguageTool Review: Free and Open Source Grammar Checker][16] + +LanguageTool is a free and open source proofreading software that checks the grammar, style and spelling in more than 20 languages. + +### Closing Thoughts on Quick Look + +Quick Look is definitely a useful dictionary app (even without an offline functionality) to quickly look for the meanings of words/phrases. I’m not much into eBooks, but you can try using an [eBook reader][17] along with this app to quickly be able to decipher words. + +Personally, I like to use it while browsing the web. To make things convenient, I like to keep its Window on top of every window on my workspace. So, you can easily select a text and then click on it to get the meaning and continue working. + +An offline functionality would be great for users who do not spend most of their time online. But, for the time being, it’s only online. + +Have you tried something like Quick Look? Let us know your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/quick-lookup/ + +作者:[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://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/quick-lookup-dictionary.jpg?resize=800%2C559&ssl=1 +[2]: https://itsfoss.com/what-is-linux/ +[3]: https://www.wiktionary.org/ +[4]: https://itsfoss.com/productivity-tips-ubuntu/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/08/thesaurus-app-linux.jpeg?fit=300%2C169&ssl=1 +[6]: https://itsfoss.com/artha-thesaurus-app-linux/ +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/quick-lookup-itsfoss.png?resize=800%2C405&ssl=1 +[8]: https://flathub.org/apps/details/com.github.johnfactotum.QuickLookup +[9]: https://itsfoss.com/what-is-flatpak/ +[10]: https://itsfoss.com/pop-os-20-04-review/ +[11]: https://itsfoss.com/flatpak-guide/ +[12]: https://github.com/johnfactotum/quick-lookup/releases/tag/1.2.0 +[13]: https://wiki.gnome.org/Apps/Builder +[14]: https://github.com/johnfactotum/quick-lookup +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/LanguageTool-grammar-checker.png?fit=800%2C450&ssl=1 +[16]: https://itsfoss.com/languagetool-review/ +[17]: https://itsfoss.com/best-ebook-readers-linux/ From b734671240a8ef64211a6a3cca5bba0799249eb7 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 12 Nov 2020 10:28:22 +0800 Subject: [PATCH 0735/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201112?= =?UTF-8?q?=20How=20to=20Install=20Google=20Chrome=20on=20Fedora=20[Beginn?= =?UTF-8?q?er=E2=80=99s=20Tutorial]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201112 How to Install Google Chrome on Fedora -Beginner-s Tutorial.md --- ...e Chrome on Fedora -Beginner-s Tutorial.md | 126 ++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 sources/tech/20201112 How to Install Google Chrome on Fedora -Beginner-s Tutorial.md diff --git a/sources/tech/20201112 How to Install Google Chrome on Fedora -Beginner-s Tutorial.md b/sources/tech/20201112 How to Install Google Chrome on Fedora -Beginner-s Tutorial.md new file mode 100644 index 0000000000..47fa289a72 --- /dev/null +++ b/sources/tech/20201112 How to Install Google Chrome on Fedora -Beginner-s Tutorial.md @@ -0,0 +1,126 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Install Google Chrome on Fedora [Beginner’s Tutorial]) +[#]: via: (https://itsfoss.com/install-google-chrome-fedora/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +How to Install Google Chrome on Fedora [Beginner’s Tutorial] +====== + +Fedora comes with Firefox as the default web browser. Despite it being an excellent web browser, you may prefer the popular Google Chrome browser. + +If you are wondering how to install Google Chrome on Fedora, let me show you two ways of installing Google Chrome, graphical method and command line method. + + * [GUI method 1: Install Chrome from the software center by enabling Fedora third-party repository][1] + * [GUI method 2: Download RPM file from Google Chrome’s website][2] + * [CLI method: Install Chrome from the Fedora third-party repository, everything using commands (same as GUI method 1)][3] + + + +It is up to you which method you prefer. Your Google Chrome on [Fedora][4] will be getting regular updates via the system updates in all the three methods. + +### Method 1: Install Google Chrome on Fedora from the Software Center + +Fedora provides a third-party repository that contains some popular proprietary software, graphics driver. Google Chrome is one of them. + +First step, make sure to enable third-party repositories in Fedora. You should see this option in the software center itself. + +![Step1: Fedora Third Party Repositories][5] + +Once you have it enabled, simply search for Chrome in the software center: + +![Step 2: Search for Chrome In Fedora Software Center][6] + +And install it from there: + +![Step 3: Install Chrome Fedora][7] + +Can it be any easier than this? I don’t think either :) + +### Method 2: Installing Google Chrome on Fedora from Chrome website + +If you do not want to enable the third-party repository, that’s okay. You don’t have to. You can download the RPM file from Chrome’s website, double-click on it and install it. + +Visit Google Chrome’s website and click on the download button. + +[Get Google Chrome][8] + +![][9] + +Then select the .rpm package and click on “Accept and Install”. + +![][10] + +Once the download is over, double click on the file and click install when prompted at the package manager. Type your password and wait until the process is done. + +![][11] + +That’s super easy, right? Let’s see somewhat complicated method (if you are not a terminal fan). + +### Method 3: Install Chrome on Fedora using command line + +Firstly, you need to add extra Fedora repositories (that you saw in method 1): + +``` +sudo dnf install fedora-workstation-repositories +``` + +And then enable Google Chrome repository. + +``` +sudo dnf config-manager --set-enabled google-chrome +``` + +![][12] + +To install the Google Chrome stable release, run the following command at your terminal. + +``` +sudo dnf install google-chrome-stable +``` + +You should get a warning for importing the GPG key, enter y to continue. + +![][13] + +You are adding the Google Chrome repository. The package comes from this repository, directly from Google. + +#### Conclusion + +Installing Google chrome on Fedora is fairly easy, even if you use the command line. It’s pretty much the [same as installing Chrome on Ubuntu][14] except the third-party repository part. + +Now that you have installed it, you may want to [check our list of Google Chrome keyboard shortcuts][15] to use the browser faster. + +Don’t forget to subscribe, to get the latest news and tutorials about Fedora, and if you have any questions please leave a comment below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-google-chrome-fedora/ + +作者:[Dimitrios Savvopoulos][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/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: tmp.VFVwBw56ac#gui-method-1 +[2]: tmp.VFVwBw56ac#gui-method-2 +[3]: tmp.VFVwBw56ac#cli-method +[4]: https://getfedora.org/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/fedora-third-party-repositories.jpg?resize=800%2C400&ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/chrome-in-fedora.png?resize=800%2C400&ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/installing-chrome-fedora.png?resize=800%2C400&ssl=1 +[8]: https://www.google.com/chrome/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/install-google-chrome-ubuntu-1.jpeg?resize=800%2C374&ssl=1 +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/3.-download-rpm-chrome.png?resize=800%2C600&ssl=1 +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/4.-install-chrome-fedora.png?resize=800%2C550&ssl=1 +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/1.-Fedora-extra-repos.png?resize=800%2C550&ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/2.-Fedora-GPG-key.png?resize=800%2C550&ssl=1 +[14]: https://itsfoss.com/install-chrome-ubuntu/ +[15]: https://itsfoss.com/google-chrome-shortcuts/ From b08a11eb4a9e807b47056b6d1ec6ebcd6b4982f0 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 12 Nov 2020 10:29:03 +0800 Subject: [PATCH 0736/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201111?= =?UTF-8?q?=20How=20I=20use=20Cockpit=20for=20my=20home's=20Linux=20server?= =?UTF-8?q?=20management?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201111 How I use Cockpit for my home-s Linux server management.md --- ...t for my home-s Linux server management.md | 175 ++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 sources/tech/20201111 How I use Cockpit for my home-s Linux server management.md diff --git a/sources/tech/20201111 How I use Cockpit for my home-s Linux server management.md b/sources/tech/20201111 How I use Cockpit for my home-s Linux server management.md new file mode 100644 index 0000000000..9accd1a2d0 --- /dev/null +++ b/sources/tech/20201111 How I use Cockpit for my home-s Linux server management.md @@ -0,0 +1,175 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How I use Cockpit for my home's Linux server management) +[#]: via: (https://opensource.com/article/20/11/cockpit-server-management) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) + +How I use Cockpit for my home's Linux server management +====== +Anyone—from home users to large-network admins—can access +enterprise-grade server management with Cockpit. +![People work on a computer server with devices][1] + +[Cockpit][2] is a service for Linux that provides a web-based interface for managing and monitoring hosts. It can be deployed in any size organization, even a small office, and it's a great way for home users to maintain the family IT infrastructure. I use it to manage and monitor all of the computers in my house—including Raspberry Pi. + +Cockpit is a free and open source software project released under the LGPL v2.1+. It is sponsored by Red Hat and included in Red Hat Enterprise Linux as the RHEL Web Console. + +### Using Cockpit + +Cockpit allows you to manage Linux devices on your network remotely. You can add or remove users, connect Network File System (NFS) shares, and start and stop services. One of my favorite simple Cockpit tasks is doing updates. I no longer have to walk around the office or house to collect each device to log in, update, reboot, and wait. Enterprise administrators don't need to badge into a data center; instead, they can manage devices from the comfort of their office. + +This isn't all, though. Cockpit's advanced capabilities include managing an LDAP server, virtual machines, and storage. You can also use it to install Docker or Podman containers. + +In terms of monitoring, Cockpit provides visibility into the expected CPU, memory, and disk space metrics. But it also exposes information like the manufacturer, BIOS, and CPU branding and gives a detailed look at hardware elements such as the [northbridge][3] and [southbridge][4] chips and various controllers. It lists the graphics, storage, and network communications devices and the memory controller and memory type. Cockpit can also be used to review logs. + +### Install Cockpit + +Cockpit is included in most major distributions. The website provides [documentation][5] for installing on Red Hat, Fedora, Ubuntu, Debian, Arch, and several others. You can install it with the standard package management commands on your Linux distribution. You can also usually find it in your graphical utility, such as GNOME Software Center, for a one-click process. + + * **Fedora: **`dnf install cockpit` + * **Ubuntu: **`apt install cockpit` + + + +### Access and login + +The default listen port is 9090. To access the Cockpit interface on a server, just point your browser to `hostname:9090`. You can use `localhost:9090` for the local server where you are logged on. Log in with a common account, as it will be advantageous to have root privileges on this account. + +![Cockpit Login Screen][6] + +(Alan Formy Duvall, [CC BY-SA 4.0][7]) + +To access other servers remotely, you would use their hostname, e.g., `https://hostname:9090`. However, you could designate one host as a management server and add all your servers to the Dashboard for a unified view. + +Once you log in, the first screen you see is the Dashboard; the other option is Host view.  + +### Dashboard view + +The Dashboard view is clean and uncluttered. The image below shows a performance monitor for all of a system's connected servers. It graphs CPU, memory, network, and disk I/O. If this is your first run and you haven't yet connected any servers, you will see graphs for the local system only. + +![Cockpit Dashboard][8] + +(Alan Formy Duvall, [CC BY-SA 4.0][7]) + +Add a server by clicking the blue plus (**+**) button. + +![Adding a machine to Cockpit][9] + +(Alan Formy Duvall, [CC BY-SA 4.0][7]) + +After you add servers, scroll down to see the full list. I have a few systems set up already. + +![Cockpit server list][10] + +(Alan Formy Duvall, [CC BY-SA 4.0][7]) + +### Host view + +Host view is where all the fun begins. This section shows and gives access to each server added to the Dashboard. The main area of interest here is the column toward the left that includes **Overview**, **Logs**, **Storage**, **Networking**, and a few other items, with **Terminal** at the bottom. Clicking on each item enables you to manage these parts of the system. The items in this section can vary depending on other features that may be installed. + +#### Overview + +When you select a server, the Host screen opens to the **Overview** section with controls for the specific host system. The Overview screen is divided into quadrants for _Health_, _Usage_, _Configuration_, and _System information_. + +![Cockpit Host Overview][11] + +(Alan Formy Duvall, [CC BY-SA 4.0][7]) + +Usage links to a detailed performance graph view, and System information links to hardware details. Some management controls are directly available on this screen. For example, you can change the system hostname or join the server to an enterprise domain. + +#### Storage + +In this image of the **Storage** section, the top part has a graph of read/write activity, and below that is a list of local filesystems. Further down, you can add NFS mounts or view logs. You can even create RAID devices and volume groups. + +![Cockpit Host Storage View][12] + +(Alan Formy Duvall, [CC BY-SA 4.0][7]) + +#### Networking + +The **Networking** section allows you to manage firewall and network interfaces. You can edit firewall rules and zones and manipulate networking with bonding, teaming, bridges, and VLANs. + +![Cockpit Host Networking View][13] + +(Alan Formy Duvall, [CC BY-SA 4.0][7]) + +#### Software updates + +Being able to apply updates on servers remotely is super-convenient. Even a family may have five or 10 computers. But an enterprise with hundreds or thousands of headless servers racked in a dry, dark data center miles away definitely needs this capability. The **Software updates** section lists the updates available to you. + +![Cockpit host updates][14] + +(Alan Formy Duvall, [CC BY-SA 4.0][7]) + +You can select whether to install all updates or just those related to security, and Cockpit displays a progress bar while updates are installed. Once the process is complete, you can restart the system. + +#### Terminal + +The last item in Host view is a **Terminal**, where you can do all the normal command-line options. One way I've used the Terminal is to overcome inconsistencies in Cockpit feature sets, most likely due to Linux version differences. I discovered this on [my Media Center PC][15] running Ubuntu Linux 18.04. In this version of Ubuntu, the Overview section is labeled System. It indicates available bug-fix updates but does not have a button for applying updates. This is not the case with the newer Ubuntu 20.04 LTS, which has the expected Overview section and update facility. Either way, there is no need to fret because I can leverage the terminal to run the normal Apt update commands. + +![Cockpit Terminal][16] + +(Alan Formy Duvall, [CC BY-SA 4.0][7]) + +#### Applications + +You may have noticed that I skipped the **Applications** section in Host view. This section deserves your attention because it can manipulate the view and functionality of your Cockpit service. From here, you can install additional functionality or applications, such as 389 LDAP Server or tools for collecting diagnostic reports and kernel dumps or building server images. The _Machines_ section enables virtual machine management, and _Podman_ provides container management capabilities. Once you have Cockpit up and running, it's a good idea to explore the Applications section. + +![Cockpit Applications][17] + +(Alan Formy Duvall, [CC BY-SA 4.0][7]) + +### Final thoughts + +Cockpit uses a secure shell (SSH) client to access remote servers, so there may be some resource impact on a system where you create the unified view that I described above since each managed server will have an associated SSH connection. + + +``` +$ ps fax |grep cockpit +2064515 ?        Ssl    0:50 /usr/libexec/cockpit-tls +2064521 ?        Ssl    0:41 /usr/libexec/cockpit-ws --for-tls-proxy --port=0 +2064527 ?        S      0:00  \\_ /usr/libexec/cockpit-session localhost +2064537 ?        Sl     0:38      \\_ cockpit-bridge +2064636 ?        S      1:37          \\_ /usr/libexec/cockpit-ssh webserver +2064639 ?        S      1:37          \\_ /usr/libexec/cockpit-ssh smtpserver +2064640 ?        S      1:37          \\_ /usr/libexec/cockpit-ssh ftpserver +2064670 ?        Sl     0:02          \\_ /usr/bin/cockpit-bridge --privileged +2076607 ?        S      0:21          \\_ /usr/libexec/cockpit-ssh ldapserver +2078182 ?        S      0:10          \\_ /usr/libexec/cockpit-ssh teaserver +``` + +I've used many operations tools like this, both closed and open source, for management, monitoring, provisioning, deployment, and security tasks. Cockpit is a great tool that fits organizations of all sizes. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/cockpit-server-management + +作者:[Alan Formy-Duval][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://opensource.com/users/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_linux11x_cc.png?itok=XMDOouJR (People work on a computer server with devices) +[2]: https://cockpit-project.org/ +[3]: https://en.wikipedia.org/wiki/Northbridge_%28computing%29 +[4]: https://en.wikipedia.org/wiki/Southbridge_%28computing%29 +[5]: https://cockpit-project.org/running.html +[6]: https://opensource.com/sites/default/files/uploads/cockpitlogin.png (Cockpit Login Screen) +[7]: https://creativecommons.org/licenses/by-sa/4.0/ +[8]: https://opensource.com/sites/default/files/uploads/cockpitdashboard.png (Cockpit Dashboard) +[9]: https://opensource.com/sites/default/files/uploads/cockpitaddmachine.png (Adding a machine to Cockpit) +[10]: https://opensource.com/sites/default/files/uploads/cockpitservers.png (Cockpit server list) +[11]: https://opensource.com/sites/default/files/uploads/cockpithostoverview.png (Cockpit Host Overview) +[12]: https://opensource.com/sites/default/files/uploads/cockpithoststorage.png (Cockpit Host Storage View) +[13]: https://opensource.com/sites/default/files/uploads/cockpithostnetwork.png (Cockpit Host Networking View) +[14]: https://opensource.com/sites/default/files/uploads/cockpithostupdates.png (Cockpit host updates) +[15]: https://opensource.com/article/18/11/old-linux-desktop-new-home-media-center +[16]: https://opensource.com/sites/default/files/uploads/cockpitterminal.png (Cockpit Terminal) +[17]: https://opensource.com/sites/default/files/uploads/cockpitapplications.png (Cockpit Applications) From 4c1bc984fbd158cd3b058b04b7ed04d84437c5ff Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 12 Nov 2020 10:29:25 +0800 Subject: [PATCH 0737/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201111?= =?UTF-8?q?=20Create=20your=20first=20Knative=20app?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201111 Create your first Knative app.md --- .../20201111 Create your first Knative app.md | 469 ++++++++++++++++++ 1 file changed, 469 insertions(+) create mode 100644 sources/tech/20201111 Create your first Knative app.md diff --git a/sources/tech/20201111 Create your first Knative app.md b/sources/tech/20201111 Create your first Knative app.md new file mode 100644 index 0000000000..6213ddd329 --- /dev/null +++ b/sources/tech/20201111 Create your first Knative app.md @@ -0,0 +1,469 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Create your first Knative app) +[#]: via: (https://opensource.com/article/20/11/knative) +[#]: author: (Jessica Cherry https://opensource.com/users/cherrybomb) + +Create your first Knative app +====== +Knative is a great way to get started quickly on serverless development +with Kubernetes. +![Working from home at a laptop][1] + +[Knative][2] is an open source community project that adds components to [Kubernetes][3] for deploying, running, and managing [serverless, cloud-native][4] applications. It enables more productive development with less interaction with Kubernetes' infrastructure. + +There is a large amount of information out there about Knative, networking, and serverless deployments, and this introductory tutorial covers just a bite-size amount of it. In this walkthrough, I'll use Knative with [Minikube][5] to create a Knative app—a simple container that prints messages in response to a `curl` command or in a web browser at a link provided by the deployment. + +### First, some background + +Knative uses custom resource definitions (CRDs), a network layer, and a service core. For this walkthrough, I used Ubuntu 18.04, Kubernetes 1.19.0, Knative 0.17.2, and [Kourier][6] 0.17.0 as the Knative networking layer, as well as the Knative command-line interface (CLI). + +A CRD is a custom resource definition within Kubernetes. A resource is an endpoint in the Kubernetes API that stores a collection of API objects of a certain kind; for example, the built-in pod's resource contains a collection of pod objects. This allows an expansion of the Kubernetes API with new definitions. One example is the Knative serving core, which is defined to have internal autoscaling and rapid deployment of pods with the correct roles and access predefined. + +Kourier is an [Ingress][7] (a service to let in external network traffic) for Knative serving and a lightweight alternative for the [Istio][8] ingress. Its deployment consists only of an [Envoy proxy][9] and a control plane for it. + +To understand the concepts in this tutorial, I recommend you are somewhat familiar with: + + * Serverless, cloud-native applications + * Ingress with Envoy proxies, i.e., Istio + * DNS in Kubernetes + * Kubernetes patching configurations + * Custom resource definitions in Kubernetes + * Configuring YAML files for Kubernetes + + + +### Set up and installation + +There are some prerequisites you must do before you can use Knative. + +#### Configure Minikube + +Before doing anything else, you must configure Minikube to run Knative locally in your homelab. Below are the configurations I suggest and the commands to set them: + + +``` +$ minikube config set kubernetes-version v1.19.0 +$ minikube config set memory 4000 +$ minikube config set cpus 4 +``` + +To make sure those configurations are set up correctly in your environment, run the Minikube commands to delete and start your cluster: + + +``` +$ minikube delete +$ minikube start +``` + +#### Install the Knative CLI + +You need the Knative CLI to make a deployment, and you need [Go v1.14][10] or later to work with the CLI. I created a separate directory to make it easier to find and install these tools. Use the following commands to set up the command line: + + +``` +$ mkdir knative +$ cd knative/ +$ git clone +$ cd client/ +$ hack/build.sh -f +$ sudo cp kn /usr/local/bin +$ kn version +Version:        v20201018-local-40a84036 +Build Date:   2020-10-18 20:00:37 +Git Revision: 40a84036 +Supported APIs: +* Serving +  - serving.knative.dev/v1 (knative-serving v0.18.0) +* Eventing +  - sources.knative.dev/v1alpha2 (knative-eventing v0.18.0) +  - eventing.knative.dev/v1beta1 (knative-eventing v0.18.0) +``` + +Once the CLI is installed, you can configure Knative in the Minikube cluster. + +#### Install Knative + +Since Knative is composed of CRDs, much of its installation uses YAML files with `kubectl` commands. To make this easier, set up some environment variables in the terminal so that you can get the needed YAML files a little faster and in the same version: + + +``` +`$ export KNATIVE="0.17.2"` +``` + +First, apply the service resource definitions: + + +``` +`$ kubectl apply -f https://github.com/knative/serving/releases/download/v$KNATIVE/serving-crds.yaml` +``` + +Then apply the core components to Knative: + + +``` +`$ kubectl apply -f https://github.com/knative/serving/releases/download/v$KNATIVE/serving-core.yaml` +``` + +This deploys the services and deployments to the namespace `knative-serving`. You may have to wait a couple of moments for the deployment to finish. + +To confirm the deployment finished, run the `kubectl` command to get the deployments from the namespace: + + +``` +$ kubectl get deployments -n knative-serving +NAME                    READY   UP-TO-DATE   AVAILABLE   AGE +3scale-kourier-control   1/1    1               1               107m +activator               1/1     1               1               108m +autoscaler              1/1     1               1               108m +controller              1/1     1               1               108m +webhook                 1/1     1               1               108m +``` + +#### Install Kourier + +Because you want to use a specific version and collect the correct YAML file, use another environment variable: + + +``` +`$ export KOURIER="0.17.0"` +``` + +Then apply your networking layer YAML file: + + +``` +`$ kubectl apply -f https://github.com/knative/net-kourier/releases/download/v$KOURIER/kourier.yaml` +``` + +You will find the deployment in the `kourier-system` namespace. To confirm the deployment is correctly up and functioning, use the `kubectl` command to get the deployments: + + +``` +$ kubectl get deployments -n kourier-system +NAME                    READY   UP-TO-DATE   AVAILABLE   AGE +3scale-kourier-gateway   1/1    1               1               110m +``` + +Next, configure the Knative serving to use Kourier as default. If you don't set this, the external networking traffic will not function. Set it with this `kubectl patch` command: + + +``` +$ kubectl patch configmap/config-network \ +  --namespace knative-serving \ +  --type merge \ +  --patch '{"data":{"ingress.class":"kourier.ingress.networking.knative.dev"}}' +``` + +#### Configure the DNS + +Before you can access the load balancer, you need to run the `minikube tunnel` command in a separate terminal window. This command creates a route to services deployed with type `LoadBalancer` and sets their Ingress to their `ClusterIP`. Without this command, you will never get an `External-IP` from the load balancer. Your output will look like this: + + +``` +Status:     +    machine: minikube +    pid: 57123 +    route: 10.96.0.0/12 -> 192.168.39.67 +    minikube: Running +    services: [kourier] +        errors: +         minikube: no errors +         router: no errors +         loadbalancer emulator: no errors +Status:     +    machine: minikube +    pid: 57123 +    route: 10.96.0.0/12 -> 192.168.39.67 +    minikube: Running +    services: [kourier] +        errors: +         minikube: no errors +         router: no errors +         loadbalancer emulator: no errors +``` + +Now that the services and deployments are complete, configure the DNS for the cluster. This enables your future deployable application to support DNS web addresses. To configure this, you need to get some information from your Kourier service by using the `kubectl get` command: + + +``` +$ kubectl get service kourier -n kourier-system +NAME    TYPE            CLUSTER-IP      EXTERNAL-IP     PORT(S)                         +kourier   LoadBalancer   10.103.12.15   10.103.12.15   80:32676/TCP,443:30558/TCP +``` + +Get the `CLUSTER-IP` address and save it for the next step. Next, configure the domain to determine your internal website on local DNS. (I ended mine in `nip.io`, and you can also use `xip.io`.) This requires another `kubectl patch` command: + + +``` +`$ kubectl patch configmap -n knative-serving config-domain -p "{\"data\": {\"10.103.12.15.nip.io\": \"\"}}"` +``` + +Once it's patched, you will see this output: + + +``` +`configmap/config-domain patched` +``` + +### Use the Knative CLI + +Now that your configurations are done, you can create an example application to see what happens. + +#### Deploy a service + +Earlier in this walkthrough, you installed the Knative CLI, which is used for Serving and Eventing resources in a Kubernetes cluster. This means you can deploy a sample application and manage services and routes. To bring up the command-line menu, type `kn`. Here is a snippet of the output: + + +``` +$ kn +kn is the command line interface for managing Knative Serving and Eventing resources + + Find more information about Knative at: + +Serving Commands: +  service       Manage Knative services +  revision      Manage service revisions +  route         List and describe service routes +``` + +Next, use the Knative CLI to deploy a basic "hello world" application with a web frontend. Knative provides some examples you can use; this one does a basic deployment: + + +``` +`kn service create hello --image gcr.io/knative-samples/helloworld-go` +``` + +Your output should look something like this: + + +``` +$ kn service create hello --image gcr.io/knative-samples/helloworld-go +Creating service 'hello' in namespace 'default': + +  0.032s The Configuration is still working to reflect the latest desired specification. +  0.071s The Route is still working to reflect the latest desired specification. +  0.116s Configuration "hello" is waiting for a Revision to become ready. + 34.908s ... + 34.961s Ingress has not yet been reconciled. + 35.020s unsuccessfully observed a new generation + 35.208s Ready to serve. + +Service 'hello' created to latest revision 'hello-dydlw-1' is available at URL: + +``` + +This shows that the service was deployed with a URL into the namespace default. You can deploy to another namespace by running something like the following, then look at the output: + + +``` +$ kn service create hello --image gcr.io/knative-samples/helloworld-go --namespace hello +Creating service 'hello' in namespace 'hello': + +  0.015s The Configuration is still working to reflect the latest desired specification. +  0.041s The Route is still working to reflect the latest desired specification. +  0.070s Configuration "hello" is waiting for a Revision to become ready. +  5.911s ... +  5.958s Ingress has not yet been reconciled. +  6.043s unsuccessfully observed a new generation +  6.213s Ready to serve. + +Service 'hello' created to latest revision 'hello-wpbwj-1' is available at URL: + +``` + +#### Test your new deployment + +Check to see if the new service you deployed is up and running. There are two ways to check: + + 1. Check your web address in a browser + 2. Run a `curl` command to see what returns + + + +If you check the address in a web browser, you should see something like this: + +![Checking Knative deployment][11] + +(Jess Cherry, [CC BY-SA 4.0][12]) + +Good! It looks like your application's frontend is up! + +Next, test the `curl` command to confirm everything works from the command line. Here is an example of a `curl` to my application and the output: + + +``` +$ curl +Hello World! +``` + +#### Interact with the Knative app + +From here, you can use the Knative CLI to make some basic changes and test the functionality. Describe the service and check the output: + + +``` +$ kn service describe hello +Name:           hello +Namespace:  default +Age:            12h +URL:            + +Revisions:   +  100%  @latest (hello-dydlw-1) [1] (12h) +        Image:  gcr.io/knative-samples/helloworld-go (pinned to 5ea96b) + +Conditions:   +  OK TYPE                       AGE REASON +  ++ Ready                      12h +  ++ ConfigurationsReady        12h +  ++ RoutesReady                12h +``` + +It looks like everything is up and ready as you configured it. Some other things you can do with the Knative CLI (which won't show up now due to the minimal configuration in this example) are to describe and list the routes with the app: + + +``` +$ kn route describe hello +Name:           hello +Namespace:  default +Age:            12h +URL:            +Service:        hello + +Traffic Targets:   +  100%  @latest (hello-dydlw-1) + +Conditions:   +  OK TYPE                       AGE REASON +  ++ Ready                      12h +  ++ AllTrafficAssigned         12h +  ++ CertificateProvisioned     12h TLSNotEnabled +  ++ IngressReady               12h +jess@Athena:~/knative/client$ kn route list hello +NAME    URL                                     READY +hello     True +``` + +This can come in handy later when you need to troubleshoot issues with your deployments. + +#### Clean up + +Just as easily as you deployed your application, you can clean it up: + + +``` +$ kn service delete hello +Service 'hello' successfully deleted in namespace 'default'. + +jess@Athena:~/knative/client$ kn service delete hello --namespace hello +Service 'hello' successfully deleted in namespace 'hello'. +``` + +### Make your own app + +This walkthrough used an existing Knative example, but you are probably wondering about making something that _you_ want. You are right, so I'll provide this example YAML then explain how you can apply it with kubectl and manage it with the Knative CLI. + +**Example YAML** + + +``` +apiVersion: serving.knative.dev/v1 +kind: Service +metadata: +  name: helloworld +  namespace: default +spec: + template: +  spec: +   containers: +     - image: gcr.io/knative-samples/helloworld-go +       ports: +             - containerPort: 8080 +       env: +        - name: TARGET +          value: "This is my app" +``` + +Save this to `apps.yaml`, and then you can make changes to some things. For example, you can change your `metadata`, `name`, and `namespace`. You can also change the value of the target (which I set to `This is my app`) so that, rather than `Hello World`, you'll see a new message that says `Hello ${TARGET} !` when you deploy the file. + +To deploy a file like this, you will have to use `kubectl apply -f apps.yaml`. + +First, deploy your new service using the `apply` command: + + +``` +$ kubectl apply -f apps.yaml +service.serving.knative.dev/helloworld created +``` + +Next, you can describe your new deployment, which is the name provided in the YAML file: + + +``` +$ kn service describe helloworld +Name:           helloworld +Namespace:  default +Age:            50s +URL:            + +Revisions:   +  100%  @latest (helloworld-qfr9s) [1] (50s) +        Image:  gcr.io/knative-samples/helloworld-go (at 5ea96b) + +Conditions:   +  OK TYPE                       AGE REASON +  ++ Ready                      43s +  ++ ConfigurationsReady        43s +  ++ RoutesReady                43s +``` + +Run a `curl` command to confirm it produces the new output you defined in your YAML file: + + +``` +$ curl   +Hello This is my app! +``` + +Double-check by going to the simple web frontend. + +![Checking Knative deployment][13] + +(Jess Cherry, [CC BY-SA 4.0][12]) + +This proves your application is running! Congratulations! + +### Final thoughts + +Knative is a great way for developers to move quickly on serverless development with networking services that allow users to see changes in apps immediately. It is fun to play with and lets you take a deeper dive into serverless and other exploratory uses of Kubernetes! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/knative + +作者:[Jessica Cherry][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://opensource.com/users/cherrybomb +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/wfh_work_home_laptop_work.png?itok=VFwToeMy (Working from home at a laptop) +[2]: https://knative.dev/ +[3]: https://opensource.com/resources/what-is-kubernetes +[4]: https://en.wikipedia.org/wiki/Cloud_native_computing +[5]: https://minikube.sigs.k8s.io/docs/ +[6]: https://github.com/knative-sandbox/net-kourier +[7]: https://kubernetes.io/docs/concepts/services-networking/ingress/ +[8]: https://istio.io/ +[9]: https://www.envoyproxy.io/ +[10]: https://golang.org/doc/install +[11]: https://opensource.com/sites/default/files/uploads/knative_browser-check.png (Checking Knative deployment) +[12]: https://creativecommons.org/licenses/by-sa/4.0/ +[13]: https://opensource.com/sites/default/files/uploads/knativebrowser2.png (Checking Knative deployment) From 001485a9fd5c2e876cd8dbe361ee8a3707ab65f7 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 12 Nov 2020 10:30:36 +0800 Subject: [PATCH 0738/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201111?= =?UTF-8?q?=20Why=20I=20use=20Home=20Assistant=20for=20open=20source=20hom?= =?UTF-8?q?e=20automation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201111 Why I use Home Assistant for open source home automation.md --- ...sistant for open source home automation.md | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 sources/tech/20201111 Why I use Home Assistant for open source home automation.md diff --git a/sources/tech/20201111 Why I use Home Assistant for open source home automation.md b/sources/tech/20201111 Why I use Home Assistant for open source home automation.md new file mode 100644 index 0000000000..6d85628c8d --- /dev/null +++ b/sources/tech/20201111 Why I use Home Assistant for open source home automation.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why I use Home Assistant for open source home automation) +[#]: via: (https://opensource.com/article/20/11/home-assistant) +[#]: author: (Steve Ovens https://opensource.com/users/stratusss) + +Why I use Home Assistant for open source home automation +====== +Home automation can be a slippery slope. The right open source tools can +get you on firmer footing. +![Houses in a row][1] + +Home automation is a slippery slope; you have been warned! In this multipart series, I will discuss home automation using the open source project Home Assistant. This introductory article will cover my journey to [Home Assistant][2], what the application does, and why it's important. + +### How my journey began + +Some time ago, when I set out on this journey, my goal was not lofty. I was solving a need. You see, I have a fairly sizable [homelab][3]. Nothing on the scale of some notable YouTubers, but I have eight machines ranging from 16GB RAM all the way up to 96GB. I have a Netgear 10G Ethernet switch as the backbone of my networking infrastructure. However, I have a small problem. Every once in a while, this switch's state table fills up, and then it crashes, taking the network with it. This is a known issue with this model (although it was not known to me ahead of time). The only way to resolve the issue, without replacing the switch, is to power it off for a few seconds and then power it back on. + +This would not seem like a big deal. Especially because I live in an apartment, so I don't even have to travel up or down a flight of stairs to do this. However, I work for Red Hat as a senior OpenShift consultant, which means I am often on the road (at least pre-COVID). I use my lab almost every day for work-related activities, and my family uses the network as well for things like playing games, watching our Blu-ray collection, etc. So, it's a giant pain to have the network go down when I don't have physical access. My solution was to get a smart plug and join it to a completely different network with nothing else on it, completely firewalled off from other equipment. If the Netgear switch needs to be rebooted, I should be able to access the smart plug remotely to reboot the switch. + +### My journey away from the cloud + +Being privacy-conscious, perhaps bordering on the tinfoil hat breed, I am immediately uncomfortable with a "cloud"-connected anything. We run [Plex][4], [Kodi][5], [Nextcloud][6], and a host of other services because, well, I am "that guy." But I'm not "anti-cloud." In fact, a large part of my day job is working with the big three: AWS, Google Compute, and Azure. But when it comes to standing up services that I rely on, I have an almost irrational need to host things locally. + +After doing a significant amount of digging and speaking to my coworker Alex Kretzschmar (who also hosts the [Self-Hosted][7] podcast), I discovered alternative firmware projects, such as [Tasmota][8] and [ESPHome][9], available for certain wireless chipsets. I'll cover the different chipsets and protocols (Zigbee, WiFi, Z-Wave, and the like) in a future article, but suffice it to say, you are not stuck buying products that are dependent on the cloud. There are online stores such as [CloudFree][10] that sell devices pre-flashed with Tasmota. There are even companies like [Shelly][11] that produce high-quality products with an optional cloud component, but the buyer maintains local control. + +Anyway, back to my story. I bought a plug, flashed the firmware to run Tasmota, and remotely power-cycled my switch on occasion, and that was the end of it, right? Well, if it was, I imagine I would not be writing this article. I currently have 43 Internet of Things (IoT) devices—from sensors I built to smart bulbs, smart LED strips, infrared blasters, and more. Remember how I said home automation is a slippery slope? + +Did I mention that I have had virtually no experience with soldering, electronic theory/repairs, or anything remotely related to home automation? In fact, outside of Linux and related technology, I am one of the least "handy" people I know. Sure, I can punch a hole in a wall or put some screws in a board, but up to the age of 30, the only tools that I ever owned were a Dremel and some screwdrivers for installing computer components. + +Why mention this? So you understand exactly how far behind square one I was when I started. If I can take this on, so can you! + +### Centralized local control + +Great, I have a ton of IoT devices, and I can toggle things on and off from a phone. For a while, I was satisfied with simply calling up the Tasmota web UI and using its sparse but functional controls. + +![Tasmota user interface][12] + +(Steve Ovens, [CC BY-SA 4.0][13]) + +Even my wife, God bless her willingness and patience while I constantly learned and attempted new things, got used to using the Tasmota interface. After a while, as the number of devices grew, this method of managing things became untenable and did not scale well at all. + +I began to poke around to learn how other people were managing their "smart homes." Let's be honest; at this point, it wasn't a smart home as much as a small but growing number of lights we could remotely control. + +The big open source projects in this area are [openHAB][14] and [Home Assistant][15]. This series won't compare them in any manner. Partly, it's because I am not qualified for this, as I have only been using Home Assistant for the last year or so, but also because for me to feel comfortable making such a comparison, I would have to set up openHAB as a drop-in replacement and, frankly, I have too much invested in Home Assistant to explore this avenue. + +### About Home Assistant + +You may be wondering what Home Assistant is and what it has to offer. Imagine a house that reacts to its inhabitants, like in sci-fi movies. Perhaps you have a couple of bedside lamps, a TV, some floor lighting, a fan, and a few other gizmos in your bedroom. As you walk into the bedroom, the lights turn on. Big deal, you say; we have had this technology for some time. Of course, you are right. But what if it's late and your significant other is already in bed? You might be in for a rather cold greeting if the lights come on as you enter the bedroom. Yikes! + +What if, instead, when you walk into the room at night, the floor LED lights turn on to a soft glow—enough so that you can move around without killing yourself but not bright enough to wake a sleeping partner. You climb into bed, and a few minutes later, the floor lighting turns off. This is what Home Assistant can do for you. + +"But wait!" I hear you screaming at your monitor. "I can just ask Alexa or Google to turn off my lights for me." You're correct again, of course. However, what happens when these services suffer some sort of disruption? Also, you may need to consider how loudly you need to speak to trigger the listening device. And remember that thing I said about privacy? Do you really want these big companies to learn your habits? Even discarding the privacy issue, consider that others may use your home as well. This means visitors need to know what commands you have available for controlling your smart devices. + +Lots of "smart" products on the market can set timers, schedules, and scenes, but none of them can really _react_ to any given situation. This is where a home automation hub like Home Assistant comes into play. + +At its core, Home Assistant is software that helps centralize all of the sensors, gizmos, and gadgets you have in your home. With all of these products working together in concert, you can set all kinds of conditions that would not otherwise be possible. + +Has someone entered the room? Is it a certain time of the day? Is the room warmer than a certain value? Is someone in bed? All of these data points are of limited use on their own, but together, you can use them to set the brightness of a light at dusk, turn a fan on because it's above 26ºC (80ºF) in the room, but don't turn on Steve's desk lamp because his side of the bed is occupied. + +If you can imagine it, you can accomplish it using Home Assistant and the right sensor inputs. + +### Sustainable and open source + +One thing I like about Home Assistant is that it seems to be reaching a critical mass of adoption from various vendors. But more important to me is that the company behind it, [Nabu Casa][16], creates a focal point for the community. The company hired developers directly from the community, and it does not penalize you if you don't pay a monthly fee. The revenue Nabu Casa generates comes from value-added items, like being able to access your local Home Assistant easily and from anywhere in the world. + +This is important because it means that there is a path forward for the project, and it has a sustainable income for future development. Unlike "open core" models, Home Assistant is fully open source, which means that if the community disagrees strongly enough with Nabu Casa's direction, it could fork Home Assistant at its current state and take a divergent path. Because my family has chosen to make this piece of software integral to how we interact with our devices, that Home Assistant has a revenue stream and is fully open source are invaluable to me. + +In the next article, I will discuss some of the common standards for IoT devices as well as the benefits of local control. Future articles will walk through the basics of installing Home Assistant, setting up essential add-ons (e.g., MQTT), Node-RED, the Community Store, making backups, and more. + +In the meantime, comment or [tweet][17] at me if you would like to explore something specific in-depth. If I have used it, I can talk about it. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/home-assistant + +作者:[Steve Ovens][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://opensource.com/users/stratusss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/house_home_colors_live_building.jpg?itok=HLpsIfIL (Houses in a row) +[2]: https://www.home-assistant.io/ +[3]: https://opensource.com/article/19/3/home-lab +[4]: https://www.plex.tv/ +[5]: https://opensource.com/article/19/1/manage-your-media-kodi +[6]: https://nextcloud.com/ +[7]: https://selfhosted.show/ +[8]: https://tasmota.github.io/docs/ +[9]: https://esphome.io/ +[10]: https://cloudfree.shop/ +[11]: https://shelly.cloud/ +[12]: https://opensource.com/sites/default/files/uploads/tasmota_ui.png (Tasmota user interface) +[13]: https://creativecommons.org/licenses/by-sa/4.0/ +[14]: https://www.openhab.org/ +[15]: https://opensource.com/article/18/3/smart-home-assistant +[16]: https://www.nabucasa.com/ +[17]: https://twitter.com/linuxovens From 7c711d444f9205df3bab148ecd63a1a1e0a4ab7d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 12 Nov 2020 10:31:05 +0800 Subject: [PATCH 0739/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201110?= =?UTF-8?q?=20Use=20your=20favorite=20open=20source=20apps=20on=20your=20M?= =?UTF-8?q?ac=20with=20MacPorts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201110 Use your favorite open source apps on your Mac with MacPorts.md --- ...n source apps on your Mac with MacPorts.md | 225 ++++++++++++++++++ 1 file changed, 225 insertions(+) create mode 100644 sources/tech/20201110 Use your favorite open source apps on your Mac with MacPorts.md diff --git a/sources/tech/20201110 Use your favorite open source apps on your Mac with MacPorts.md b/sources/tech/20201110 Use your favorite open source apps on your Mac with MacPorts.md new file mode 100644 index 0000000000..4ba1adebbd --- /dev/null +++ b/sources/tech/20201110 Use your favorite open source apps on your Mac with MacPorts.md @@ -0,0 +1,225 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use your favorite open source apps on your Mac with MacPorts) +[#]: via: (https://opensource.com/article/20/11/macports) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Use your favorite open source apps on your Mac with MacPorts +====== +MacPorts is an easy way to get open source applications and keep them +updated on macOS. +![Coffee and laptop][1] + +"Package manager" is a generic name for software to install, upgrade, and uninstall applications. Commands like `dnf` or `apt` on Linux, or `pkg_add` on BSD, or even `pip` on Python and `luarocks` on Lua, make it trivial for users to add new applications to their system. Once you've tried it, you're likely to find it hard to live without, and it's a convenience every operating system ought to include. Not all do, but the open source community tends to ensure the best ideas in computing are propagated across all platforms. + +There are several package managers designed just for macOS, and one of the oldest is the [MacPorts][2] project. + +### Darwin and MacPorts + +When Apple shifted to Unix at the turn of the century, it essentially built a Unix operating system called [Darwin][3]. Shortly thereafter, a group of resourceful hackers promptly began work on a project called OpenDarwin, with the intent of creating an independent branch of Darwin. They hoped that OpenDarwin and Apple developers could work on related codebases, borrowing from each other whenever it was useful. Unfortunately, OpenDarwin didn't gain traction within Apple and it eventually [came to an end][4]. However, the OpenDarwin package manager project, MacPorts, is alive and well and continues to provide great open source software for macOS. + +MacOS already comes with a healthy set of default terminal commands, some borrowed from GNU, others from BSD, and still others written especially for Darwin. You can use MacPorts to add new commands and even graphical applications. + +### Install MacPorts + +Your macOS version dictates which MacPorts installer package you need. So first, get the version of macOS you're currently running: + + +``` +$ sw_vers -productVersion +10.xx.y +``` + +MacPorts releases for recent macOS versions are available on [macports.org/install.php][5]. You can download an installer from the website, or just copy the link and download using the [curl][6] command: + + +``` +$ curl \ +\--output MacPorts-2.6.3-10.14-Mojave.pkg +``` + +Once you download the installer, you can double-click to install it or install it using a terminal: + + +``` +$ sudo installer -verbose \ +-pkg MacPorts*.pkg +-tgt / +``` + +### Configure MacPorts + +Once the package is installed, you must add the relevant paths to your system so that your terminal knows where to find your new MacPorts commands. Add the path to MacPorts, and add its manual pages to your `PATH` environment variable by adding this to `~/.bashrc`: + + +``` +export PATH=/opt/local/bin:/opt/local/sbin:$PATH +export MANPATH=/opt/local/share/man:$MANPATH +``` + +Load your new environment: + + +``` +`$ source ~/.bashrc` +``` + +Run an update so your MacPorts installation has access to the latest versions of software: + + +``` +`$ sudo port -v selfupdate` +``` + +### Use MacPorts + +Some package managers install pre-built software from a server onto your local system. This is called _binary installation_ because it installs code that's been compiled into an executable binary file. Other package managers, MacPorts among them, pull source code from a server, compile it into a binary executable on your computer, and install it into the correct directories. The end result is the same: you have the software you want. + +The way they get there is different. + +There are advantages to both methods. A binary install is quicker because the only transaction required is copying files from a server onto your computer. This is something [Homebrew][7] does with its "bottles," but there are sometimes issues with [non-relocatable][8] builds. Installing from source code means it's easy for you to modify how software is built and where it gets installed. + +MacPorts provides the **port** command, and calls it packages **ports** (inherited terminology from projects like NetBSD's [Pkgsrc][9] and FreeBSD's port system.) The typical MacPorts workflow is to search for an application and then install it. + +#### Search for an application + +If you know the specific command or application you need to install, search for it to ensure it's in the MacPorts tree: + + +``` +`$ sudo port search parallel` +``` + +By default, `port` searches both the names and descriptions of packages. You can search on just the name field by adding the `--name` option: + + +``` +`$ sudo port search --name parallel` +``` + +You can make your searches "fuzzy" with common shell wildcards. For instance, to search for `parallel` only at the start of a name field: + + +``` +`$ sudo port search --name --glob "parallel*"` +``` + +List all ports + +If you don't know what you're searching for and you want to see all the packages (or "ports" in MacPorts and BSD terminology) available, use the `list` subcommand: + + +``` +`$ sudo port list` +``` + +The list is long but complete. You can, of course, redirect the output into a text for reference or pipe it to `more` or `less` for closer examination: + + +``` +$ sudo port list > all-ports.txt +$ sudo port list | less +``` + +#### Get information about a package + +You can get all the important details about a package with the `info` subcommand: + + +``` +$ sudo port info parallel +parallel @20200922 (sysutils) + +Description:          Build and execute shell command lines from standard input in parallel +Homepage:             + +Library Dependencies: perl5 +Platforms:            darwin +License:              GPL-3+ +Maintainers:          Email: [example@example.com][10] +``` + +This displays important metadata about each application, including a brief description of what it is and the project homepage, in case you need more information. It also lists dependencies, which are _other_ ports that must be on your system for a package to run correctly. Dependencies are resolved automatically by MacPorts, meaning that if you install, for example, the `parallel` package, MacPorts also installs `perl5` if it's not already on your system. Finally, it provides the license and port maintainer. + +#### Install a package + +When you're ready to install a package, use the `install` subcommand: + + +``` +`$ sudo port install parallel` +``` + +It can take some time to compile the code depending on your CPU, the size of the code base, and the number of packages being installed, so be patient. It'll be worth it. + +Once the installation is done, the new application is available immediately: + + +``` +$ parallel echo ::: "hello" "world" +hello +world +``` + +Applications installed by MacPorts are placed into `/opt/local`. + +#### View what is installed + +Once a package has been installed on your system, you can see exactly what it placed on your drive using the `contents` subcommand: + + +``` +$ sudo port contents parallel +/opt/local/bin/parallel +[...] +``` + +#### Clean up + +Installing a package with MacPorts often leaves build files in your ports tree. These files are useful for debugging a failed install, but normally you don't need to keep them lying around. Purge these files from your system with the `port clean` command: + + +``` +`$ port clean parallel` +``` + +#### Uninstall packages + +Uninstall a package with the `port uninstall` command: + + +``` +`$ port uninstall parallel` +``` + +### Open source package management + +The MacPorts project is a remnant of an early movement to build upon the open source work that served as macOS's foundation. While that effort failed, there have been efforts to revive it as a project called [PureDarwin][11]. The push to open more of Apple's code is important work, and the byproducts of this effort are beneficial to everyone running macOS. If you're looking for an easy way to get open source applications on your Mac and a reliable way to keep them up to date, install and use MacPorts. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/macports + +作者:[Seth Kenlon][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://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_cafe_brew_laptop_desktop.jpg?itok=G-n1o1-o (Coffee and laptop) +[2]: http://macports.org +[3]: https://en.wikipedia.org/wiki/Darwin_%28operating_system%29 +[4]: https://web.archive.org/web/20070111155348/opendarwin.org/en/news/shutdown.html +[5]: https://www.macports.org/install.php +[6]: https://opensource.com/article/20/5/curl-cheat-sheet +[7]: https://opensource.com/article/20/6/homebrew-linux +[8]: https://discourse.brew.sh/t/why-do-bottles-need-to-be-in-home-linuxbrew-linuxbrew/4346/3 +[9]: https://opensource.com/article/19/11/pkgsrc-netbsd-linux +[10]: mailto:example@example.com +[11]: http://www.puredarwin.org/ From c07dc85cceb14297e31fe213152d70db294ee30e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 12 Nov 2020 10:31:35 +0800 Subject: [PATCH 0740/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201110?= =?UTF-8?q?=20What=20I=20love=20about=20the=20newest=20GNOME=20desktop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201110 What I love about the newest GNOME desktop.md --- ...t I love about the newest GNOME desktop.md | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 sources/tech/20201110 What I love about the newest GNOME desktop.md diff --git a/sources/tech/20201110 What I love about the newest GNOME desktop.md b/sources/tech/20201110 What I love about the newest GNOME desktop.md new file mode 100644 index 0000000000..31b0c2cc12 --- /dev/null +++ b/sources/tech/20201110 What I love about the newest GNOME desktop.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What I love about the newest GNOME desktop) +[#]: via: (https://opensource.com/article/20/11/new-gnome) +[#]: author: (Jim Hall https://opensource.com/users/jim-hall) + +What I love about the newest GNOME desktop +====== +Check out the top new features in the GNOME 3.38 desktop. +![Digital images of a computer desktop][1] + +Fedora 33 [just came out][2], and I installed it right away. Among the many features in this new version of the Linux distribution is the latest GNOME desktop. GNOME 3.38 was released in September 2020, and I'm loving it. + +### Why I love GNOME 3.38 + +The [GNOME 3.38 release notes][3] list some great new features in this update. Among other things, the Welcome Tour for new users received a major facelift and is now much easier to use and provides more useful information if you're new to GNOME. + +![The new "Welcome GNOME"][4] + +([GNOME][5], [CC BY-SA 4.0][6]) + +I also love that I can drag to reorder application icons in the GNOME Application Overview. This makes it a breeze to organize the applications I use all the time under GNOME. You can even drag and drop icons together to automatically put them into folders. + +![GNOME 3.38 Application Overview][7] + +([GNOME][5], [CC BY-SA 4.0][6]) + +I have family in different time zones, and the updated GNOME Clocks makes it much easier to add new world clocks, so I don't have to figure out what time it is when I call a family member. Are they an hour ahead or an hour behind? I just check the GNOME clock, and I can see everyone's local times at a glance. And while I don't use the alarms feature very often, I like that I can set my own ring duration and default "snooze" time on each alarm. + +![Adding a new world clock in GNOME Clocks][8] + +([GNOME][5], [CC BY-SA 4.0][6]) + +Aside from all the feature updates, the biggest improvement in GNOME 3.38 is performance. As GNOME developer Emmanuele Bassi [explained earlier this year][9], there's been "lots of work by everyone in GNOME to make things faster, even for people running on more limited systems like the Raspberry Pi. There's been a lot of work to get GNOME to perform better … because people really care about it." And that shows in the new release! The GNOME desktop feels much more responsive. + +![Applications running on GNOME 3.38][10] + +([GNOME][5], [CC BY-SA 4.0][6]) + +As part of my consulting and training business, I regularly flip between several open applications, including LibreOffice, GIMP, Inkscape, a web browser, and others. Starting a new application or switching between open applications just feels faster in GNOME 3.38. + +### Except one thing + +If there's one thing I'm not fond of in the new version of GNOME, it's the redesigned Screenshot tool. I use this all the time to grab a portion of what's on the screen and insert it into my presentations and training documents. + +![GNOME Screenshot tool][11] + +(Jim Hall, [CC BY-SA 4.0][6]) + +When I read a user interface or computer screen, I naturally navigate as I would a book or magazine: left to right and top to bottom. When I make screenshots with the new Screenshot tool, I start in the upper-left and make my selections as I go. Most of the time, I only need to change the capture area for a selection, so I click that button and then look for the button that will take a screenshot. But it always takes me a moment to find the **Take Screenshot** button in the upper-left corner. It's not at the bottom of the window, where I expect to find it. + +![GNOME Screenshot tool][12] + +(Jim Hall, [CC BY-SA 4.0][6]) + +So far, that seems to be my only annoyance in GNOME 3.38. Overall, I'm very excited for the new GNOME. And I hope you are, too! + +To learn more about GNOME 3.38, visit the [GNOME website][13] or read the [GNOME 3.38 announcement][5]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/new-gnome + +作者:[Jim Hall][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://opensource.com/users/jim-hall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_browser_web_desktop.png?itok=Bw8ykZMA (Digital images of a computer desktop) +[2]: https://fedoramagazine.org/announcing-fedora-33/ +[3]: https://help.gnome.org/misc/release-notes/3.38/ +[4]: https://opensource.com/sites/default/files/uploads/welcome-tour.png (The new "Welcome GNOME" ) +[5]: https://www.gnome.org/news/2020/09/gnome-3-38-released/ +[6]: https://creativecommons.org/licenses/by-sa/4.0/ +[7]: https://opensource.com/sites/default/files/uploads/app-overview.png (GNOME 3.38 Application Overview) +[8]: https://opensource.com/sites/default/files/uploads/world-clocks.png (Adding a new world clock in GNOME Clocks) +[9]: https://opensource.com/article/20/7/new-gnome-features +[10]: https://opensource.com/sites/default/files/uploads/desktop-busy.png (Applications running on GNOME 3.38) +[11]: https://opensource.com/sites/default/files/uploads/gnome-screenshot-tool.png (GNOME Screenshot tool) +[12]: https://opensource.com/sites/default/files/uploads/screenshot-tool-path.png (GNOME Screenshot tool) +[13]: https://www.gnome.org/ From a86f669837f1dcb25a9cf25883d0f9334947761b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 12 Nov 2020 10:31:53 +0800 Subject: [PATCH 0741/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201110?= =?UTF-8?q?=20Load=20balance=20network=20traffic=20with=20HAProxy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201110 Load balance network traffic with HAProxy.md --- ...ad balance network traffic with HAProxy.md | 249 ++++++++++++++++++ 1 file changed, 249 insertions(+) create mode 100644 sources/tech/20201110 Load balance network traffic with HAProxy.md diff --git a/sources/tech/20201110 Load balance network traffic with HAProxy.md b/sources/tech/20201110 Load balance network traffic with HAProxy.md new file mode 100644 index 0000000000..cafe4f457c --- /dev/null +++ b/sources/tech/20201110 Load balance network traffic with HAProxy.md @@ -0,0 +1,249 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Load balance network traffic with HAProxy) +[#]: via: (https://opensource.com/article/20/11/load-balancing-haproxy) +[#]: author: (Jim O'Connell https://opensource.com/users/jimoconnell) + +Load balance network traffic with HAProxy +====== +Install, configure, and run HAProxy to distribute network traffic across +several web or application servers. +![eight stones balancing][1] + +You don't have to work at a huge company to justify using a load balancer. You might be a hobbyist, self-hosting a website from a couple of Raspberry Pi computers. Perhaps you're the server administrator for a small business; maybe you _do_ work for a huge company. Whatever your situation, you can benefit from using the [HAProxy][2] load balancer to manage your traffic. + +HAProxy is known as "the world's fastest and most widely used software load balancer." It packs in many features that can make your applications more secure and reliable, including built-in rate limiting, anomaly detection, connection queuing, health checks, and detailed logs and metrics. Learning the basic skills and concepts covered in this tutorial will help you use HAProxy to build a more robust, far more powerful infrastructure. + +### Why would you need a load balancer? + +A load balancer is a way to easily distribute connections across several web or application servers. In fact, HAProxy can balance any type of Transmission Control Protocol ([TCP][3]) traffic, including RDP, FTP, WebSockets, or database connections. The ability to distribute load means you don't need to purchase a massive web server with zillions of gigs of RAM just because your website gets more traffic than Google. + +A load balancer also gives you flexibility. Perhaps your existing web server isn't robust enough to meet peak demand during busy times of the year and you'd like to add another, but only temporarily. Maybe you want to add some redundancy in case one server fails. With HAProxy, you can add more servers to the backend pool when you need them and remove them when you don't. + +You can also route requests to different servers depending on the context. For example, you might want to handle your static content with a couple of cache servers, such as [Varnish][4], but route anything that requires dynamic content, such as an API endpoint, to a more powerful machine. + +In this article, I will walk through setting up a very basic HAProxy installation to use HTTPS to listen on secure port 443 and utilize a couple of backend web servers. It will even send all traffic that comes to a predefined URL (like `/api/`) to a different server or pool of servers. + +### Install HAProxy + +To get started, spin up a new CentOS 8 server or instance and bring the system up to date: + + +``` +`sudo yum update -y` +``` + +This typically runs for a while. Grab yourself a coffee while you wait. + +This installation has two parts: the first part installs the yum version of HAProxy, and the second part compiles and installs your binary from source to overwrite the previous HAProxy with the latest version. Installing with yum does a lot of the heavy lifting as far as generating systemd startup scripts, etc., so run the `yum install` and then overwrite the HAProxy binary with the latest version by compiling it from its source code: + + +``` +`sudo yum install -y haproxy` +``` + +Enable the HAProxy service: + + +``` +`sudo systemctl enable haproxy` +``` + +To upgrade to the latest version ([version 2.2][5], as of this writing), compile the source code. Many people assume that compiling and installing a program from its source code requires a high degree of technical ability, but it's a pretty straightforward process. Start by using `yum` to install a few packages that provide the tools for compiling code: + + +``` +sudo yum install dnf-plugins-core +sudo yum config-manager --set-enabled PowerTools +# (Multiline command next 3 lines. Copy and paste together:)  + +sudo yum install -y git ca-certificates gcc glibc-devel \ +  lua-devel pcre-devel openssl-devel systemd-devel \ +  make curl zlib-devel  +``` + +Use `git` to get the latest source code and change to the `haproxy` directory: + + +``` +git clone +cd haproxy +``` + +Run the following three commands to build and install HAProxy with integrated Prometheus support: + + +``` +# Multiline command next 3 lines copy and paste together:  +make TARGET=linux-glibc USE_LUA=1 USE_OPENSSL=1 USE_PCRE=1 \ +PCREDIR= USE_ZLIB=1 USE_SYSTEMD=1 \ EXTRA_OBJS="contrib/ + +sudo make PREFIX=/usr install # Install to /usr/sbin/haproxy +``` + +Test it by querying the version: + + +``` +`haproxy -v` +``` + +You should get the following output: + + +``` +`HA-Proxy version 2.2.4-b16390-23 2020/10/09 - https://haproxy.org/` +``` + +### Create the backend server + +HAProxy doesn't serve any traffic directly—this is the job of backend servers, which are typically web or application servers. For this exercise, I'm using a tool called [Ncat][6], the "Swiss Army knife" of networking, to create some exceedingly simple servers. Install it: + + +``` +`sudo yum install nc -y` +``` + +If your system has [SELinux][7] enabled, you'll need to enable port 8404, the port used for accessing the HAProxy Stats page (explained below), and the ports for your backend servers: + + +``` +sudo dnf install policycoreutils-python-utils +sudo semanage port -a -t http_port_t  -p tcp 8404 +sudo semanage port -a -t http_port_t  -p tcp 10080; +sudo semanage port -a -t http_port_t  -p tcp 10081; +sudo semanage port -a -t http_port_t  -p tcp 10082; +``` + +Create two Ncat web servers and an API server: + + +``` +while true ; +do +nc -l -p 10080 -c 'echo -e "HTTP/1.1 200 OK\n\n This is Server ONE"' ; +done & + +while true ; +do +nc -l -p 10081 -c 'echo -e "HTTP/1.1 200 OK\n\n This is Server TWO"' ; +done & + +while true ; +do +nc -l -p 10082 -c 'echo -e "HTTP/1.1 200 OK\nContent-Type: application/json\n\n { \"Message\" :\"Hello, World!\" }"' ; +done & +``` + +These simple servers print out a message (such as "This is Server ONE") and run until the server is stopped. In a real-world setup, you would use actual web and app servers. + +### Modify the HAProxy config file + +HAProxy's configuration file is `/etc/haproxy/haproxy.cfg`. This is where you make the changes to define your load balancer. This [basic configuration][8] will get you started with a working server: + + +``` +global +    log         127.0.0.1 local2 +    user        haproxy +    group       haproxy + +defaults  +    mode                    http +    log                     global +    option                  httplog + +frontend main +    bind *:80 +         +    default_backend web +    use_backend api if { path_beg -i /api/ } +     +    #------------------------- +    # SSL termination - HAProxy handles the encryption. +    #    To use it, put your PEM file in /etc/haproxy/certs   +    #    then edit and uncomment the bind line (75) +    #------------------------- +    # bind *:443 ssl crt /etc/haproxy/certs/haproxy.pem ssl-min-ver TLSv1.2 +    # redirect scheme https if !{ ssl_fc } + +#----------------------------- +# Enable stats at +#----------------------------- + +frontend stats +    bind *:8404 +    stats enable +    stats uri /stats +#----------------------------- +# round robin balancing between the various backends +#----------------------------- + +backend web +    server web1 127.0.0.1:10080 check +    server web2 127.0.0.1:10081 check + +#----------------------------- + +# API backend for serving up API content +#----------------------------- +backend api +    server api1 127.0.0.1:10082 check +``` + +### Restart and reload HAProxy + +HAProxy is probably not running yet, so issue the command `sudo systemctl restart haproxy` to start (or restart) it. The `restart` method is fine for non-production situations, but once you are up and running, you'll want to get in the habit of using `sudo systemctl reload haproxy` to avoid service interruptions, even if you have an error in your config. + +For example, after you make changes to `/etc/haproxy/haproxy.cfg`, you need to reload the daemon with `sudo systemctl reload haproxy` to effect the changes. If there is an error, it will let you know but continue running with the previous configuration. Check your HAProxy status with `sudo systemctl status haproxy`. + +If it doesn't report any errors, you have a running server. Test it with curl on the server, by typing `curl http://localhost/` on the command line. If you see "_This is Server ONE_," then it all worked! Run `curl` a few times and watch it cycle through your backend pool, then see what happens when you type `curl http://localhost/api/`. Adding `/api/` to the end of the URL will send all of that traffic to the third server in your pool. At this point, you should have a functioning load balancer! + +### Check your stats + +You may have noted that the configuration defined a frontend called `stats` that is listening on port 8404: + + +``` +frontend stats +    bind *:8404 +    stats uri /stats +    stats enable +``` + +In your browser, load up `http://localhost:8404/stats`. Read HAProxy's blog "[Exploring the HAProxy Stats page][9]" to find out what you can do here. + +### A powerful load balancer + +Although I covered just a few of HAProxy's features, you now have a server that listens on ports 80 and 443, redirecting HTTP traffic to HTTPS, balancing traffic between several backend servers, and even sending traffic matching a specific URL pattern to a different backend server. You also unlocked the very powerful HAProxy Stats page that gives you a great overview of your systems. + +This exercise might seem simple, make no mistake about it—you have just built and configured a very powerful load balancer capable of handling a significant amount of traffic. + +For your convenience, I put all the commands in this article in a [GitHub Gist][10]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/load-balancing-haproxy + +作者:[Jim O'Connell][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://opensource.com/users/jimoconnell +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/water-stone-balance-eight-8.png?itok=1aht_V5V (eight stones balancing) +[2]: https://www.haproxy.org/ +[3]: https://en.wikipedia.org/wiki/Transmission_Control_Protocol +[4]: https://varnish-cache.org/ +[5]: https://www.haproxy.com/blog/announcing-haproxy-2-2/ +[6]: https://nmap.org/ncat +[7]: https://www.redhat.com/en/topics/linux/what-is-selinux +[8]: https://gist.github.com/haproxytechblog/38ef4b7d42f16cfe5c30f28ee3304dce +[9]: https://www.haproxy.com/blog/exploring-the-haproxy-stats-page/ +[10]: https://gist.github.com/haproxytechblog/d656422754f1b5eb1f7bbeb1452d261e From 13ef67944aababe4e39555f12bd15f4834eed8ce Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 12 Nov 2020 10:32:46 +0800 Subject: [PATCH 0742/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201109?= =?UTF-8?q?=20Set=20up=20Minishift=20and=20run=20Jenkins=20on=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201109 Set up Minishift and run Jenkins on Linux.md --- ...t up Minishift and run Jenkins on Linux.md | 311 ++++++++++++++++++ 1 file changed, 311 insertions(+) create mode 100644 sources/tech/20201109 Set up Minishift and run Jenkins on Linux.md diff --git a/sources/tech/20201109 Set up Minishift and run Jenkins on Linux.md b/sources/tech/20201109 Set up Minishift and run Jenkins on Linux.md new file mode 100644 index 0000000000..44d5f2ca9a --- /dev/null +++ b/sources/tech/20201109 Set up Minishift and run Jenkins on Linux.md @@ -0,0 +1,311 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Set up Minishift and run Jenkins on Linux) +[#]: via: (https://opensource.com/article/20/11/minishift-linux) +[#]: author: (Jessica Cherry https://opensource.com/users/cherrybomb) + +Set up Minishift and run Jenkins on Linux +====== +Install, configure, and use Minishift to create your first pipeline. +![cubes coming together to create a larger cube][1] + +[Minishift][2] is a tool that helps you run [OKD][3] (Red Hat's open source OpenShift container platform) locally by launching a single-node OKD cluster inside a virtual machine. It is powered by [Kubernetes][4], which is one of my favorite things to talk about. + +In this article, I will demonstrate how to get started with Minishift on Linux. This was written for Ubuntu 18.04, and you'll need [sudo access][5] on your Linux machine to run some commands. + +### Prerequisites + +Before starting the installation, your Linux machine must have either [KVM][6] for Linux or [VirtualBox][7], which runs on every platform. This demo uses KVM, which you can install along with all the required dependencies: + + +``` +$ sudo apt install qemu-kvm \ +libvirt-clients libvirt-daemon-system \ +bridge-utils virt-manager   +``` + +After installing KVM, you must make some modifications to allow your user to use it. Specifically, you must add your user name to the `libvirt` group: + + +``` +$ sudo usermod --append --groups libvirt $(whoami) +$ newgrp libvirt +``` + +Next, install the Docker KVM driver, which is needed to run containers on Minishift. I downloaded the Docker machine driver directly to `/usr/local/bin`. You don't have to save it to `/usr/local/bin`, but you must ensure that its location is in your [PATH][8]: + + +``` +$ curl -L \ +-o /usr/local/bin/docker-machine-driver-kvm + +$ sudo chmod +x /usr/local/bin/docker-machine-driver-kvm +``` + +### Install Minishift + +Now that the prerequisites are in place, visit the Minishift [releases page][9] and determine which version of Minishift you want to install. I used Minishift [v1.34.3][10]. + +[Download the Linux .tar file][11] to a directory you will be able to find easily. I used the `minishift` directory: + + +``` +$ ls +Minishift-1.34.3-linux-amd64.tgz +``` + +Next, untar your new file using [the `tar` command][12]: + + +``` +$ tar zxvf minishift-1.34.3-linux-amd64.tgz +minishift-1.34.3-linux-amd64/ +minishift-1.34.3-linux-amd64/LICENSE +minishift-1.34.3-linux-amd64/README.adoc +minishift-1.34.3-linux-amd64/minishift +``` + +By using the `v` (for _verbose_) option in your command, you can see all the files and their locations in your directory structure. + +Run the `ls` command to confirm that the new directory was created: + + +``` +$ ls +minishift-1.34.3-linux-amd64 +``` + +Next, change to the new directory and find the binary file you need; it is named `minishift`: + + +``` +$ cd minishift-1.34.3-linux-amd64 +$ ls +LICENSE  minishift  README.adoc +$ +``` + +Move the `minishift `binary file to your PATH, which you can find by running the following and looking at the output: + + +``` +$ echo $PATH +/home/jess/.local/bin:/usr/local/sbin:/usr/local/bin +``` + +I used `/usr/local/bin` as the `minishift` binary file's location: + + +``` +$ sudo mv minishift /usr/local/bin +[sudo] password for jess: +$ ls /usr/local/bin +minishift +``` + +Run the `minishift` command and look at the output: + + +``` +$ minishift +Minishift is a command-line tool that provisions and manages single-node OpenShift clusters optimized for development workflows. + +Usage: +  minishift [command] + +Available Commands: +  addons        Manages Minishift add-ons. +  completion  Outputs minishift shell completion for the given shell +  config        Modifies Minishift configuration properties. +  console       Opens or displays the OpenShift Web Console URL. +[...] + +Use "minishift [command] --help" for more information about a command. +``` + +### Log into Minishift's web console + +Now that Minishift is installed, you can walk through it and play with some cool new software. Begin with `minishift start`. This, as you might guess, starts Minishift—specifically, it starts a one-node cluster on your computer: + + +``` +$ minishift start +  Starting profile 'minishift' +  Check if deprecated options are used … OK +  Checking if is reachable … OK +[...] +  Minishift will be configured with… +  Memory: 4GB +  vCPUs : 2GB +  Disk size: 20 GB +Starting Minishift VM ……….OK +``` + +This process can take a long time, depending on your hardware, so be patient. When it ends, you'll get information about where to find your imaginary cluster on your virtualized network: + + +``` +Server Information ... +MiniShift server started. +The server is accessible via web console at: + +``` + +Now, MiniShift is running, complete with a web console. You can log into the OKD console using **developer** as the user name and any password you want. I chose **developer** / **developer**. + +![Minishift web console login][13] + +(Jess Cherry, [CC BY-SA 4.0][14]) + +The web console is an easy control panel you can use to administer your humble cluster. It's a place for you to create and load container images, add and monitor pods, and ensure your instance is healthy. + +![Minishift web console][15] + +(Jess Cherry, [CC BY-SA 4.0][14]) + +### Build a pipeline + +To start building your first pipeline, click **Pipeline Build Example** on the console. Click **Next** to show the parameters available to create the pipeline project. + +![Pipeline Build Example][16] + +(Jess Cherry, [CC BY-SA 4.0][14]) + +A window appears with parameters to fill in if you want; you can use what's already there for this example. Walk through the rest of the screen choices to create a sample pipeline. + +![Pipeline options][17] + +(Jess Cherry, [CC BY-SA 4.0][14]) + +Click **Create**, and let Minishift create the project for you. It shows your success (or failure). + +![Successful pipeline build][18] + +(Jess Cherry, [CC BY-SA 4.0][14]) + +You can also click **Show Parameters** and scroll through the list of parameters configured for this project. Click **Close** and look for a confirmation message on the left.  + +![Show Parameters Minishift][19] + +(Jess Cherry, [CC BY-SA 4.0][14]) + +![List of projects][20] + +(Jess Cherry, [CC BY-SA 4.0][14]) + +When you click on **My Project**, you can see the details and pods created for the project to run. + +![Project details][21] + +(Jess Cherry, [CC BY-SA 4.0][14]) + +Open the `jenkins-ephemeral` link that was generated. Log in again with the **developer** credentials and allow access to run a pipeline in Jenkins. + +![Authorize access interface][22] + +(Jess Cherry, [CC BY-SA 4.0][14]) + +Now you can look through the Jenkins interface to get a feel for what it has to offer. + +![Jenkins interface][23] + +(Jess Cherry, [CC BY-SA 4.0][14]) + +Find your project. + +![Jenkins projects][24] + +(Jess Cherry, [CC BY-SA 4.0][14]) + +When you're ready, click **Build Now**. + +![Jenkins "build now"][25] + +(Jess Cherry, [CC BY-SA 4.0][14]) + +Then you can view the job's output in the console output. + +![Jenkins console output][26] + +(Jess Cherry, [CC BY-SA 4.0][14]) + +Once the job completes successfully, you will see a success message at the bottom of the console. + +What did this pipeline do? It updated the deployment manually. + +![Pipeline result][27] + +(Jess Cherry, [CC BY-SA 4.0][14]) + +Congratulations, you successfully created an example automated deployment using Minishift! + +### Clean it up + +The last thing to do is to clean up everything by running two commands: + + +``` +$ minishift stop +$ minishift delete +``` + +Why `stop` and then `delete`? Well, I like to make sure nothing is running before I run a delete command of any kind. This results in a cleaner delete without the possibility of having any leftover or hung processes. Here are the commands' output. + +![minishift stop command][28] + +(Jess Cherry, [CC BY-SA 4.0][14]) + +![minishift delete command][29] + +(Jess Cherry, [CC BY-SA 4.0][14]) + +### Final notes + +Minishift is a great tool with great built-in automation. The user interface is comfortable to work with and easy on the eyes. I found it a fun new tool to play with at home, and if you want to dive in deeper, just look over the great [documentation][30] and many [online tutorials][3]. I recommend exploring this application in depth. Have a happy time Minishifting! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/minishift-linux + +作者:[Jessica Cherry][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://opensource.com/users/cherrybomb +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cube_innovation_process_block_container.png?itok=vkPYmSRQ (cubes coming together to create a larger cube) +[2]: https://www.okd.io/minishift/ +[3]: https://www.redhat.com/sysadmin/learn-openshift-minishift +[4]: https://opensource.com/resources/what-is-kubernetes +[5]: https://en.wikipedia.org/wiki/Sudo +[6]: https://en.wikipedia.org/wiki/Kernel-based_Virtual_Machine +[7]: https://www.virtualbox.org/wiki/Downloads +[8]: https://opensource.com/article/17/6/set-path-linux +[9]: https://github.com/minishift/minishift/releases +[10]: https://github.com/minishift/minishift/releases/tag/v1.34.3 +[11]: https://github.com/minishift/minishift/releases/download/v1.34.3/minishift-1.34.3-linux-amd64.tgz +[12]: https://opensource.com/article/17/7/how-unzip-targz-file +[13]: https://opensource.com/sites/default/files/uploads/minishift_web-console-login.png (Minishift web console login) +[14]: https://creativecommons.org/licenses/by-sa/4.0/ +[15]: https://opensource.com/sites/default/files/uploads/minishift_web-console.png (Minishift web console) +[16]: https://opensource.com/sites/default/files/uploads/minishift_pipeline-build-example.png (Pipeline Build Example) +[17]: https://opensource.com/sites/default/files/uploads/minishift_pipeline-build-config.png (Pipeline options) +[18]: https://opensource.com/sites/default/files/uploads/minishift_pipeline-build-success.png (Successful pipeline build) +[19]: https://opensource.com/sites/default/files/pictures/params-minishift.jpg (Show Parameters Minishift) +[20]: https://opensource.com/sites/default/files/uploads/minishift_myprojects.png (List of projects) +[21]: https://opensource.com/sites/default/files/uploads/minishift_project-details.png (Project details) +[22]: https://opensource.com/sites/default/files/uploads/minishift_authorize-access.png (Authorize access interface) +[23]: https://opensource.com/sites/default/files/uploads/jenkins-interface.png (Jenkins interface) +[24]: https://opensource.com/sites/default/files/uploads/jenkins-project.png (Jenkins projects) +[25]: https://opensource.com/sites/default/files/uploads/jenkins_build-now.png (Jenkins "build now") +[26]: https://opensource.com/sites/default/files/uploads/jenkins_console-output.png (Jenkins console output) +[27]: https://opensource.com/sites/default/files/uploads/pipelineresult.png (Pipeline result) +[28]: https://opensource.com/sites/default/files/uploads/minishift-stop.png (minishift stop command) +[29]: https://opensource.com/sites/default/files/uploads/minishift-delete.png (minishift delete command) +[30]: https://docs.okd.io/3.11/minishift/using/index.html From 93f117e36ff05ece31841ec8ae0a1d079830ca5d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 12 Nov 2020 10:33:08 +0800 Subject: [PATCH 0743/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201109?= =?UTF-8?q?=20Program=20your=20microcontroller=20with=20MicroBlocks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201109 Program your microcontroller with MicroBlocks.md --- ...m your microcontroller with MicroBlocks.md | 144 ++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 sources/tech/20201109 Program your microcontroller with MicroBlocks.md diff --git a/sources/tech/20201109 Program your microcontroller with MicroBlocks.md b/sources/tech/20201109 Program your microcontroller with MicroBlocks.md new file mode 100644 index 0000000000..9325db5574 --- /dev/null +++ b/sources/tech/20201109 Program your microcontroller with MicroBlocks.md @@ -0,0 +1,144 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Program your microcontroller with MicroBlocks) +[#]: via: (https://opensource.com/article/20/11/microblocks) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +Program your microcontroller with MicroBlocks +====== +MicroBlocks brings a Scratch-like interface to programming the +Micro:bit, Circuit Playground Express, and other microcontroller boards. +![Computer hardware components, generic][1] + +If you like to tinker with technology, you may be familiar with programmable microcontroller boards, such as AdaFruit's [Circuit Playground Express][2] and the [BBC Micro:bit][3]. Now there's a new programming option for you to try: [MicroBlocks][4]. It's a simple Scratch-like programming interface that works well with several microcontrollers, including those two. + +I own both the Circuit Playground Express and the BBC Micro:bit and was eager to try MicroBlocks after discovering it on [Twitter][5]. + +### Install MicroBlocks + +To set up MicroBlocks on a Debian-based Linux distribution, [download][6] and install the .deb file. If you use an RPM-based Linux distribution, you can download the Linux [64-bit][7] or [32-bit][8] standalone executable. MicroBlocks also offers installers for [Windows][9], [macOS][10], and [Raspberry Pi][11]. + +MicroBlocks can also run in a Chrome, Chromium, or Edge [browser][12] using its experimental web platform, which enables special web serial connections. The Chrome web store also has a [browser extension][13] for MicroBlocks. + +### Connect your microcontroller + +Before you can access your microcontroller on Linux, you must add yourself to your computer's dialout group. Linux uses this group to communicate with serial devices, and if your user account isn't in that group, you won't be able to control your device. + +Run the following in a terminal to add yourself to the dialout group: + + +``` +`$ sudo usermod -G dialout -a `whoami`` +``` + +Log out of your desktop and then log back in (or just reboot). Then connect your BBC Micro:bit, Circuit Playground Express, or other microcontroller board to an available USB port on your computer. My [Intel NUC][14] recognized my microcontroller without issue. + +After connecting your microcontroller, you may be asked to update the device's firmware. It's safe to do so. + +![Update firmware option][15] + +(Don Watkins, [CC BY-SA 4.0][16]) + +Once that's done, you're all ready to go. + +### Start programming + +Use the programming interface to set what language you want to use when interacting with MicroBlocks. + +![MicroBlocks language options][17] + +(Don Watkins, [CC BY-SA 4.0][16]) + +You can verify that your microcontroller is connected by checking the Connect icon on the menu. + +![MicroBlocks Connection icon][18] + +(Don Watkins, [CC BY-SA 4.0][16]) + +Now you're ready to start exploring. One of my favorite ways to learn is to tinker with a user interface's different options. What makes MicroBlocks special is that it's a live coding environment, so you get to see changes you make right away. + +Try this: Go to the Display category (in the left-hand column) and drag the display array into the scripting area. Use the menu to change A to B in one of them. + +Click on a programming block, and your code, simple though it may be, runs immediately on the board. + +### Use programming blocks + +If you are familiar with [Scratch][19], you are likely to find MicroBlocks extremely easy to use. Students love it because of the instant feedback from the board and the program. + +My first program was very simple. I wanted to make a simple "smiley face" on my Micro:bit. + +First, I clicked on the Control block and selected: "When button 'a' is pressed." + +Then I selected a smiley face from the LED Display library and connected that to the Control block.  + +Finally, I pressed Button A on my Micro:bit. Feedback is instantaneous. + +![Smiley face displayed on Micro:bit][20] + +(Don Watkins, [CC BY-SA 4.0][16]) + +### Save your code + +Saving your program is easy. On the top menu bar, click on the third icon from the left (the document icon). Choose the Save option from the drop-down menu. + +![Save file in MicroBlocks][21] + +(Don Watkins, [CC BY-SA 4.0][16]) + +Try experimenting with the interface to program your board however you want. For my second program, I used the Control and LED Display blocks to spell out "Bills," which is my favorite NFL team. But there are lots of other functions available, so try designing something that interests you. + +!["Bills" on Micro:Bit][22] + +(Don Watkins, [CC BY-SA 4.0][16]) + +### Do more with MicroBlocks + +Be sure to check out the [quickstart][23] guide on the MicroBlocks website for more information. The site also contains [activity guides][24] with easy-to-follow code examples for students and teachers. These will help anyone get started programming the Micro:bit or the Circuit Playground Express with MicroBlocks. + +MicroBlocks is fully [open source][25] and released under the [Mozilla Public License 2.0][26]. + +MicroBlocks is still under active development by the core team, and they're not currently soliciting code contributions or pull requests. However, they are interested in any MicroBlocks tutorials, lesson plans, or examples from the community, so please [contact them][27] if you have something to share. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/microblocks + +作者:[Don Watkins][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://opensource.com/users/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/hardware_disk_components.png?itok=W1fhbwYp (Computer hardware components, generic) +[2]: https://opensource.com/article/19/7/circuit-playground-express +[3]: https://opensource.com/article/19/8/getting-started-bbc-microbit +[4]: https://microblocks.fun/ +[5]: https://twitter.com/microblocksfun +[6]: https://microblocks.fun/download +[7]: https://microblocks.fun/downloads/latest/standalone/ublocks-linux64bit.zip +[8]: https://microblocks.fun/downloads/latest/standalone/ublocks-linux32bit.zip +[9]: https://microblocks.fun/downloads/latest/packages/microBlocks%20setup.exe +[10]: https://microblocks.fun/downloads/latest/packages/MicroBlocks.app.zip +[11]: https://microblocks.fun/downloads/latest/packages/ublocks-armhf.deb +[12]: https://microblocks.fun/run/microblocks.html +[13]: https://chrome.google.com/webstore/detail/microblocks/cbmcbhgijipgdmlnieolilhghfmnngbb?hl=en +[14]: https://opensource.com/article/20/9/linux-intel-nuc +[15]: https://opensource.com/sites/default/files/uploads/microblocks_update-firmware.png (Update firmware option) +[16]: https://creativecommons.org/licenses/by-sa/4.0/ +[17]: https://opensource.com/sites/default/files/uploads/microblocks_set-language.png (MicroBlocks language options) +[18]: https://opensource.com/sites/default/files/uploads/microblocks_connected.png (MicroBlocks Connection icon) +[19]: https://scratch.mit.edu/ +[20]: https://opensource.com/sites/default/files/uploads/smileyface.jpg (Smiley face displayed on Micro:bit) +[21]: https://opensource.com/sites/default/files/uploads/microblocks_save.png (Save file in MicroBlocks) +[22]: https://opensource.com/sites/default/files/uploads/microblocks_bills.png ("Bills" on Micro:Bit) +[23]: https://microblocks.fun/learn#getstarted +[24]: https://microblocks.fun/learn#activity_cards +[25]: https://bitbucket.org/john_maloney/smallvm/src/master/ +[26]: https://www.mozilla.org/en-US/MPL/2.0/ +[27]: https://microblocks.fun/info#contact From f9e1f345e31c91c91bc14fc9f0a5e0b3ecc82fa5 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 12 Nov 2020 10:33:25 +0800 Subject: [PATCH 0744/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201109?= =?UTF-8?q?=20What's=20the=20difference=20between=20orchestration=20and=20?= =?UTF-8?q?automation=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201109 What-s the difference between orchestration and automation.md --- ...ce between orchestration and automation.md | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 sources/tech/20201109 What-s the difference between orchestration and automation.md diff --git a/sources/tech/20201109 What-s the difference between orchestration and automation.md b/sources/tech/20201109 What-s the difference between orchestration and automation.md new file mode 100644 index 0000000000..610042b557 --- /dev/null +++ b/sources/tech/20201109 What-s the difference between orchestration and automation.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What's the difference between orchestration and automation?) +[#]: via: (https://opensource.com/article/20/11/orchestration-vs-automation) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +What's the difference between orchestration and automation? +====== +Both terms imply that things happen without your direct intervention. +But the way you get to those results, and the tools you use to make them +happen, differ. +![doodles of arrows moving in different directions][1] + +For the longest time, it seemed the only thing any sysadmin cared about was automation. Recently, though, the mantra seems to have changed from automation to orchestration, leading many puzzled admins to wonder: "What's the difference?" + +The difference between automation and orchestration is primarily in intent and tooling. Technically, automation can be considered a subset of orchestration. While orchestration suggests many moving parts, automation usually refers to a singular task or a small number of strongly related tasks. Orchestration works at a higher level and is expected to make decisions based on changing conditions and requirements. + +However, this view shouldn't be taken too literally because both terms—_automation_ and _orchestration_—do have implications when they're used. The results of both are functionally the same: things happen without your direct intervention. But the way you get to those results, and the tools you use to make them happen, are different, or at least the terms are used differently depending on what tools you've used. + +For instance, automation usually involves scripting, often in Bash or Python or similar, and it often suggests scheduling something to happen at either a precise time or upon a specific event. However, orchestration often begins with an application that's purpose-built for a set of tasks that may happen irregularly, on demand, or as a result of any number of trigger events, and the exact results may even depend on a variety of conditions. + +### Decisionmaking and IT orchestration + +Automation suggests that a sysadmin has invented a system to cause a computer to do something that would normally have to be done manually. In automation, the sysadmin has already made most of the decisions on what needs to be done, and all the computer must do is execute a "recipe" of tasks. + +Orchestration suggests that a sysadmin has set up a system to do something on its own based on a set of rules, parameters, and observations. In orchestration, the sysadmin knows the desired end result but leaves it up to the computer to decide what to do. + +Consider Ansible and Bash. Bash is a popular shell and scripting language used by sysadmins to accomplish practically everything they do during a given workday. Automating with Bash is straightforward: Instead of typing commands into an interactive session, you type them into a text document and save the file as a shell script. Bash runs the shell script, executing each command in succession. There's room for some conditional decisionmaking, but usually, it's no more complex than simple if-then statements, each of which must be coded into the script. + +Ansible, on the other hand, uses playbooks in which a sysadmin describes the desired state of the computer. It lists requirements that must be met before Ansible can consider the job done. When Ansible runs, it takes action based on the current state of the computer compared to the desired state, based on the computer's operating system, and so on. A playbook doesn't contain specific commands, instead leaving those decisions up to Ansible itself. + +Of course, it's particularly revealing that Ansible is referred to as an automation—not an orchestration—tool. The difference can be subtle, and the terms definitely overlap. + +### Orchestration and the cloud + +Say you need to convert a file type that's regularly uploaded to your server by your users. + +The manual solution would be to check a directory for uploaded content every morning, open the file, and then save it in a different format. This solution is slow, inefficient, and probably could happen only once every 24 hours because you're a busy person. + +**[Read next: [How to explain orchestration][2]]** + +You could automate the task. Were you to do that, you might write a PHP or a Node.js script to detect when a file has been uploaded. The script would perform the conversion and send an alert or make a log entry to confirm the conversion was successful. You could improve the script over time to allow users to interact with the upload and conversion process. + +Were you to orchestrate the process, you might instead start with an application. Your custom app would be designed to accept and convert files. You might run the application in a container on your cloud, and using OpenShift, you could launch additional instances of your app when the traffic or workload increases beyond a certain threshold. + +### Learning automation and orchestration + +There isn't just one discipline for automation or orchestration. These are broad practices that are applied to many different tasks across many different industries. The first step to learning, though, is to become proficient with the technology you're meant to orchestrate and automate. It's difficult to orchestrate (safely) the scaling a series of web servers if you don't understand how a web server works, or what ports need to be open or closed, or what a port is. In practice, you may not be the person opening ports or configuring the server; you could be tasked with administrating OpenShift without really knowing or caring what's inside a container. But basic concepts are important because they broadly apply to usability, troubleshooting, and security. + +You also need to get familiar with the most common tools of the orchestration and automation world. Learn some [Bash][3], start using [Git][4] and design some [Git hooks][5], learn some Python, get comfortable with [YAML][6] and [Ansible][7], and try out Minikube, [OKD][8], and [OpenShift][9]. + +Orchestration and automation are important skills, both to make your work more efficient and as something to bring to your team. Invest in it today, and get twice as much done tomorrow. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/orchestration-vs-automation + +作者:[Seth Kenlon][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://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/arrows_operation_direction_system_orchestrate.jpg?itok=NUgoZYY1 (doodles of arrows moving in different directions) +[2]: https://enterprisersproject.com/article/2020/8/orchestration-explained-plain-english +[3]: https://www.redhat.com/sysadmin/using-bash-automation +[4]: https://opensource.com/life/16/7/stumbling-git +[5]: https://opensource.com/life/16/8/how-construct-your-own-git-server-part-6 +[6]: https://www.redhat.com/sysadmin/understanding-yaml-ansible +[7]: https://opensource.com/downloads/ansible-k8s-cheat-sheet +[8]: https://www.redhat.com/sysadmin/learn-openshift-minishift +[9]: http://openshift.io From 35f8db014f8fab0509e4cbbfe3b6c7d382188ef0 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 12 Nov 2020 10:33:52 +0800 Subject: [PATCH 0745/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201108?= =?UTF-8?q?=20Open=20environments=20are=20where=20innovative=20ideas=20thr?= =?UTF-8?q?ive?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201108 Open environments are where innovative ideas thrive.md --- ...ments are where innovative ideas thrive.md | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 sources/tech/20201108 Open environments are where innovative ideas thrive.md diff --git a/sources/tech/20201108 Open environments are where innovative ideas thrive.md b/sources/tech/20201108 Open environments are where innovative ideas thrive.md new file mode 100644 index 0000000000..8850c43cae --- /dev/null +++ b/sources/tech/20201108 Open environments are where innovative ideas thrive.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open environments are where innovative ideas thrive) +[#]: via: (https://opensource.com/open-organization/20/11/environments-for-innovation) +[#]: author: (Ron McFarland https://opensource.com/users/ron-mcfarland) + +Open environments are where innovative ideas thrive +====== +Certain environments are more conducive to innovation. A better +understanding of innovation's true nature could help us build them. +![A sprout in a forest][1] + +In the [first article of this series][2], I examined the nature of the innovation process in great detail. I also discussed some sources of resistance to it. In this second part of my review of [Matt Ridley's][3] book [_How Innovation Works_][4], I will explain the ideal environment in which discoveries are born, protected, and progress into useful products and services, considering certain essential conditions for innovations to flourish. And I will argue that [open organization principles][5] are the keys to establishing those conditions. + +### Better when shared + +Unfortunately, Ridley explains, history has shown that economic instability, downturns, and recessionary periods spur people toward more self-sufficiency and protectionism at the expense of productivity. That is, our attitude toward cooperation and interaction changes; people separate themselves from outsiders and tend to restrict interaction. In this environment, people, communities, and even entire countries fear dependence on others. Collaboration breaks down, feeding costly and counterproductive recessions (it's almost like reverting back to [subsistence-living societies][6], where everyone only consumes and benefits from what they produce by themselves). + +This attitude stifles innovation, as innovation occurs primarily when people are able to work _with_ each other and utilize the principles of community, collaboration, inclusion, transparency, and adaptability. + +Periods of economic stability and expansion, on the other hand, tend to create strong feelings of safety, which encourages mutual interdependence between people. As Ridley writes, "By concentrating on serving other people's needs for forty hours a week—which we call a job—you can spend the other seventy-two hours (not counting fifty-six hours in bed) drawing upon the services provided to you by other people." We do what we are good at and what we enjoy most, and then depend on others to do the things we do not do well and perhaps even dislike. When interdependence and cooperation are commonplace in a society, there tends to be an increase in innovative economic breakthroughs, specifically because of work providing specialized services. Simply put, working together to come up with new things leads to increased human productivity for all. + +In this environment, open organizations come alive. + +So let's examine the qualities that make those environments so fertile for innovation. + +### Where innovation thrives + +Several factors are common throughout the innovation process, Ridley notes in _How Innovation Works_. Notice that open organization principles are involved in each of these factors. + +#### 1\. Innovation is gradual. + +If you look closely, you'll see that innovation does not often involve single breakthroughs. Instead, it's often [a series of discoveries over months and even years][2]. Innovations are gradual, incremental, and _collective_—over time. Unfortunately, we still tend to view innovations as the result of singular actors. This is due to several factors, Ridley explains: + + 1. Human nature and a love of heroes: People love telling stories starring single heroes with key events as turning points in a linear series (what [Jim Whitehurst][7] calls "[the innovation delusion][8]"). These stories are more exciting and inspiring, perhaps, but not necessarily historically accurate (years of testing and making trial-and-error mistakes are not as interesting!). + 2. Intellectual property laws: Contemporary intellectual property systems attempt to ascribe all credit to single inventors and magnify that person's importance, overshadowing collaborators, competitors, and predecessors who contributed "stepping stone discoveries." + + + +In truth, _innovations are the result of gradual progress_. + +If you look closely, you'll see that innovation does not often involve single breakthroughs. + +#### 2\. Innovation is serendipitous. + +More often than not, innovative ideas come when one is looking for something else or trying to solve a completely different problem. They are accidental discoveries. + +For example, [Roy Plunkett][9] was trying to improve a refrigerant fluid when he discovered Teflon. Other times, certain historical events turn researchers in directions they had not considered. This is a good reason why broad inclusivity and openness to the unexpected (adaptability) while working on a project are so important. + +Sometimes, broad peripheral vision is far more important than what you're _directly_ looking at. As serendipity plays a big part in innovation, societies that embrace a more free-roving, experimental nature do so well. This approach increases the chance of a lucky idea appearing. Innovation happens when people are free to think, experiment, and speculate. It happens when people can trade things, concepts, and ideas with each other (in other words, they collaborate—see below). This explains why innovative ideas seem to emerge more from cities than from rural areas, Ridley argues. + +#### 3\. Innovation is a process of combining existing components. + +Innovation is often the result of combining pre-existing products in new ways, or applying well-known components to unanticipated problems. Again, this occurs in places where people can meet and exchange goods, services, and thoughts (where they can collaborate). This explains why innovation happens in places where trade and exchange are frequent, and not in isolated or under-populated places. Innovation is born out of communities. + +#### 4\. Innovation is iterative. + +To innovate successfully, one must be willing to experiment and develop a high tolerance for error. One must not be shocked by set-backs; instead, we need to be overjoyed by learning from them. Most great discoveries come from data gleaned and lessons learned during failed experiments. Therefore, while collaborating, there should be an environment of _playfulness_. By just playing around, we help ideas come to the surface. This is why I prefer approaching problems with others by using the expression "let's just kick this idea around a bit." It keeps everyone open to new ideas and does not allow bias or strong narrowing positions to creep in, avoiding the tendency to shut down discussion too quickly. + +The more and faster you make errors, the better. As Ridley states: + +> "Amazon is a good example of failure on the road to success, as Jeff Bezos has often proudly insisted. 'Our success at Amazon is a function of how many experiments we do per year, per month, per week. Being wrong might hurt you a bit, but being slow will kill you.' Bezos once said: 'If you can increase the number of experiments you try from a hundred to a thousand, you dramatically increase the number of innovations you produce.'" + +This is where open organization principles are important. If you have a wide community experimenting and feeding their results back to you, imagine how quickly you will find a solution (or new opportunities, for that matter) while looking at a failure with many eyes and perspectives. + +#### 5\. Innovation is collaborative. + +No one innovates in isolation. Others always play a role—whether large or small—in your innovations. The best ideas are stored between two or more minds, not in one single mind. + +Therefore, _transparency_ to what is in everyone's minds and _collaboration_ on that content are vital. Quite often, one person comes up with a product idea, then another person finds ways to manufacture it, then a third person looks at that manufacturing process and comes up with a way to execute it in a far less expensive way. All these phases are part of the overall innovation—but we focus only on one in the stories we tell about it. More often than recognized, it was a _team_, a collective effort, that led to success. + +Moreover, Matt Ridley argues that most innovations _do not_ come from producers. More frequently, they come from _consumers_ that want to _improve_ on what they are using. So when we explore open organization communities, we must remain focused on the ways these communities incorporate feedback they receive from _outside_ themselves, perhaps from _users_ of related products, and find someone among them that wants to improve on them. + +### Free to innovate + +"The main ingredient in the secret sauce that leads to innovation is freedom," Ridley writes. "Freedom to exchange, experiment, imagine, invest and fail; freedom from expropriation or restriction; freedom on the part of consumers to reward the innovations they like and reject the ones they do not." This freedom will have to be supported by sensible regulations that are permissive, encouraging, and quick to give decisions (Ridley is critical of current intellectual property regulations, citing a negative impact on the innovation process). We have to take a good look at the hurdles blocking innovation, as this exploration process should be promoted. + +In the next part of this series, I'll provide an overview of actual cases of various innovations throughout history and explain how open organization principles played a role in shaping them. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/11/environments-for-innovation + +作者:[Ron McFarland][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://opensource.com/users/ron-mcfarland +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_redwoods2.png?itok=H-iasPEv (A sprout in a forest) +[2]: https://opensource.com/open-organization/20/10/best-ideas-recognition-innovation +[3]: https://en.wikipedia.org/wiki/Matt_Ridley +[4]: https://www.goodreads.com/en/book/show/45449488-how-innovation-works +[5]: https://theopenorganization.org/definition/ +[6]: https://opensource.com/open-organization/20/8/global-history-collaboration +[7]: https://opensource.com/users/jwhitehurst +[8]: https://opensource.com/open-organization/19/6/innovation-delusion +[9]: https://en.wikipedia.org/wiki/Roy_J._Plunkett From 375fdf33f444e2b1cdf5b9db907cb0c478cd0f08 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 12 Nov 2020 10:34:53 +0800 Subject: [PATCH 0746/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201109?= =?UTF-8?q?=20Day=201:=20a=20confusing=20Rails=20error=20message?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201109 Day 1- a confusing Rails error message.md --- ... Day 1- a confusing Rails error message.md | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 sources/tech/20201109 Day 1- a confusing Rails error message.md diff --git a/sources/tech/20201109 Day 1- a confusing Rails error message.md b/sources/tech/20201109 Day 1- a confusing Rails error message.md new file mode 100644 index 0000000000..06035d62c4 --- /dev/null +++ b/sources/tech/20201109 Day 1- a confusing Rails error message.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Day 1: a confusing Rails error message) +[#]: via: (https://jvns.ca/blog/2020/11/09/day-1--a-little-rails-/) +[#]: author: (Julia Evans https://jvns.ca/) + +Day 1: a confusing Rails error message +====== + +Today I started an Recurse Center batch! I got to meet a few people, and started on a tiny fun Rails project. I think I won’t talk too much about what the project actually is today, but here are some quick notes on a day with Rails: + +### some notes on getting started + +The main thing I learned about setting up a Rails project is that + + 1. it uses sqlite by default, you have to tell it to use Postgres + 2. there are a ton of things that Rails includes by default that you can disable. + + + +I installed and `rm -rf`’d Rails maybe 7 times before I was satisfied with it and ended up with this incantation: + +``` +rails new . -d postgresql --skip-sprockets --skip-javascript` +``` + +Basically because I definitely wanted to use Postgres and not sqlite, and skipping sprockets and javascript seemed to make installing Rails faster, and I figured I could install them later if I decided I wanted them. + +### the official Rails guide is really good + +I used 2 main resources for creating my starter Rails app: + + * DHH’s original Rails talk from 2005 (which I didn’t watch this time, but I watched the last time I spent a day with Rails, and I found it pretty inspiring and helpful) + * The official Rails “getting started” guide, which seems pretty short and clear + + + +### a mysterious error message: `undefined method 'user'` + +I love bugs, so here’s a weird Rails error I ran into today! I had some code that looked like this: + +``` +@user = User.new(user_params) +@user.save +``` + +Pretty simple, right? But when that code ran, I got this baffling error message: + +``` +undefined method `user' for # Did you mean? super +``` + +I was EXTREMELY confused about what was going on here because I hadn’t _called_ a method called `user`. I’d called `.save`. What???? I stayed confused and frustrated about this for maybe 20 minutes, and then finally I looked at my `User` model and found this code: + +``` +class User < ApplicationRecord + has_secure_password + + validates :user, presence: true, uniqueness: true +end +``` + +`validates :user...` was _supposed_ to be some Rails magic validating that every `User` had a `username`, and that usernames had to be unique. But I’d made a typo, and I’d written `user` and not `username`. I fixed this and then everything worked! hooray! + +I still don’t understand how I was supposed to debug this though: the stack trace told me the problem was with the `@user.save` line, and never mentioned that `validates :user` thing at all. I feel like there must be a way to debug this but I don’t know what it is. + +The whole point of me playing with Rails is to see how the Rails magic plays out in practice so this was a fun bug to hit early on. + +### a simple user management system + +I decided I wanted users in my toy app. Some Googling showed me that there’s an extremely popular gem called [devise][1] that handles users. I found the README a little overwhelming and I knew that I wanted a very minimal user management system in my toy app, so instead I followed this guide called [Authentication from Scratch with Rails 5.2][2] which seems to be working out so far. Rails seems to already have a bunch of built in stuff for managing users – I was really surprised by how short that guide was and how little code I needed to write. + +I learned while implementing users that Rails has a built in magical session management system (see [How Rails Sessions Work][3]. By default all the session data seems to be stored in a cookie on the user’s computer, though I guess you can also store the session data in a database if it gets too big for a cookie. + +It’s definitely kind of strange to already have a session management system and cookies and users without quite knowing what’s going on exactly, but it’s also kind of fun! We’ll see how it goes. + +### tomorrow: more rails! + +Maybe tomorrow I can actually make some progress on implementing my fun rails app idea! + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/11/09/day-1--a-little-rails-/ + +作者:[Julia Evans][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://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://github.com/heartcombo/devise +[2]: https://medium.com/@wintermeyer/authentication-from-scratch-with-rails-5-2-92d8676f6836 +[3]: https://www.justinweiss.com/articles/how-rails-sessions-work/ From 8432a8eab93b7f96c96455d56bb0b84b317c2c0e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 12 Nov 2020 10:36:14 +0800 Subject: [PATCH 0747/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201106?= =?UTF-8?q?=20I'm=20doing=20another=20Recurse=20Center=20batch!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201106 I-m doing another Recurse Center batch.md --- ... I-m doing another Recurse Center batch.md | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 sources/tech/20201106 I-m doing another Recurse Center batch.md diff --git a/sources/tech/20201106 I-m doing another Recurse Center batch.md b/sources/tech/20201106 I-m doing another Recurse Center batch.md new file mode 100644 index 0000000000..1efce36ebb --- /dev/null +++ b/sources/tech/20201106 I-m doing another Recurse Center batch.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (I'm doing another Recurse Center batch!) +[#]: via: (https://jvns.ca/blog/2020/11/05/i-m-doing-another-recurse-center-batch-/) +[#]: author: (Julia Evans https://jvns.ca/) + +I'm doing another Recurse Center batch! +====== + +Hello! I’m going to do a batch (virtually) at the [Recurse Center][1], starting on Monday. I’ll probably be blogging about what I learn there, so I want to talk a bit about my plans! + +I’m excited about this because: + + * I love RC, it’s my favourite programming community, and I’ve always been able to do fun programming projects there. + * they’ve put a lot of care into building a great virtual experience (including building some very fun [custom software][2]) + * there’s a pandemic, it’s going to be cold outside, and I think having a little bit more structure in my life is going to make me a lot happier this winter :) + + + +### what’s the Recurse Center? + +The Recurse Center (which I’ll abbreviate to “RC”) is a self-directed programming retreat. It’s free to attend. + +A “batch” is 1 or 6 or 12 weeks, and the idea is that during that time, you: + + 1. choose what things you want to learn + 2. come up with a plan to learn the things (often the plan is “do some kind of fun project”, like [“write a TCP stack”][3]) + 3. learn the things + + + +Also there are a bunch of other delightful people learning things, so there’s lots of inspiration for what to learn and people to collaborate with. There are always people who are early in their programming life and looking to get their first programming job, as well as people who have been programming for a long time. + +Their business model is recruiting – they [partner with][4] a bunch of companies, and if you want a job at the end of your batch, then they’ll match you with companies, and if you accept a job with one of those companies then the company pays them a fee. + +I won’t say too much more about it because I’ve written 50+ other posts about how much I love RC on this blog that probably cover it :) + +### some ideas for what I’ll do at RC + +Last time I did RC I had a bunch of plans going in and did not do any of them. I think this time it’ll probably be the same but I’ll list my ideas anyway: here are some possible things I might do. + + * learn Rails! I’ve been making small websites for a very long time but I haven’t really worked as a professional web developer, and I think it might be fun to have the superpower of being able to build websites quickly. I have an idea for a silly website that I think would be a fun starter rails project. + * experiment with generative neural networks (I’ve been curious about this for years but haven’t made any progress yet) + * maybe finish up this “incidents as a service” system that I started a year and a half ago to help people learn by practicing responding to weird computer situations + * deal with some of the [rbspy][5] issues that I’ve been ignoring for months/years + * maybe build a game! (there’s a games theme week during the batch!) + * maybe learn about graphics or shaders? + + + +In my first batch I spent a lot of time on systems / networking stuff because that felt like the hardest thing I could do. This time I feel pretty comfortable with my ability to learn about systems stuff, so I think I’ll focus on different topics! + +### so that’s what I’ll be writing about for a while! + +I’m hoping to blog more while I’m there, maybe not “every day” exactly (it turns out that blogging every day is a lot of work!), but I think it might be fun to write a bunch of tiny blog posts about things I’m learning. + +I’m also planning to release a couple of zines this month – I finished a zine about CSS, and also wrote another entire zine about bash while I was procrastinating on finishing the CSS zine in a self-imposed “write an entire zine in October” challenge, so you should see those here soon too. I’m pretty excited about both of them. + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/11/05/i-m-doing-another-recurse-center-batch-/ + +作者:[Julia Evans][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://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://www.recurse.com/ +[2]: https://www.recurse.com/virtual-rc +[3]: https://jvns.ca/blog/2014/08/12/what-happens-if-you-write-a-tcp-stack-in-python/ +[4]: https://www.recurse.com/hire +[5]: https://github.com/rbspy/rbspy From 24d6f94fd580f6c30f080a97c8779729174454e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Thu, 12 Nov 2020 14:28:52 +0800 Subject: [PATCH 0748/1156] Translated --- ...pace on Linux -Terminal and GUI Methods.md | 129 ------------------ ...pace on Linux -Terminal and GUI Methods.md | 129 ++++++++++++++++++ 2 files changed, 129 insertions(+), 129 deletions(-) delete mode 100644 sources/tech/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md create mode 100644 translated/tech/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md diff --git a/sources/tech/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md b/sources/tech/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md deleted file mode 100644 index 0afc1f1e32..0000000000 --- a/sources/tech/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md +++ /dev/null @@ -1,129 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (robsean) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Check Free Disk Space on Linux [Terminal and GUI Methods]) -[#]: via: (https://itsfoss.com/check-free-disk-space-linux/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -How to Check Free Disk Space on Linux [Terminal and GUI Methods] -====== - -_**How much disk space I have utilized?**_ - -The simplest way to find the free disk space on Linux is to [use df command][1]. The df command stands for disk-free and quite obviously, it shows you the free and available disk space on Linux systems. - -``` -df -h -``` - -With `-h` option, it shows the disk space in human-readable format (MB and GB). - -Here’s the output of the df command for my Dell XPS system that has only Linux installed with encrypted disk: - -![Checking free disk space with df command in Linux][2] - -If the above output is confusing for you, don’t worry. I’ll explain a few things around checking available disk space in Linux. _**I’ll also show the GUI method for desktop Linux users.**_ - -### Method 1: Checking free disk space in Linux with df command (and understanding its output) - -When you use the df command to check disk space, it will show a bunch of ‘file systems’ with their size, used space and free space. Your actual disks should normally be listed as one of the following: - - * /dev/sda - * /dev/sdb - * /dev/nvme0n1p - - - -This is not a hard and fast rule but it gives you an indication to easily recognize the actual disk from the crowd. - -Your Linux system might have several partitions on your disk for boot, EFI, root, swap, home etc. In such cases, these partitions are reflected with a number at the end of the ‘disk name’, like /dev/sda1, /dev/nvme0n1p2 etc. - -You could identify which partition is used for what purpose from its mount point. Root is mounted on /, EFI in /boot/EFI etc. - -In my case, I have used 41% of the 232 GB of disk space under root. If you have 2-3 big partitions (like root, home etc), you’ll have to make a calculation here. - -![Understanding df command output][3] - - * **tmpfs**: The [tmpfs][4] (temporary filesystem) used for keeping files in virtual memory. You can ignore this virtual filesystem comfortably. - * **udev**: The [udev filesystem][5] is used for storing information related to devices (like USB, network card, CD ROM etc) plugged to your system. You may ignore it as well. - * **/dev/loop**: These are loop devices. You’ll see plenty of them while checking disk space in Ubuntu because of snap applications. Loops are virtual devices that allow normal files to be accessed as block devices. With the loop devices, snap applications are sandboxed in their own virtual disk. Since they are under root, you don’t need to count their used disk space separately. - - - -#### Missing disk space? Check if you have mounted all disks and partitions - -Keep in mind that the df command only shows disk space for mounted filesystems. If you are using more than one Linux distribution (or operating systems) on the same disk or you have multiple disks on your system, you need to mount them first in order to see the free space available on those partitions and disks. - -For example, my [Intel NUC][6] has two SSDs and 4 or 5 Linux distributions installed on them. It shows additional disks only when I mount them explicitly. - -![][7] - -You can use the lsblk command to see all the disks and partitions on your system. - -![][8] - -Once you have the disk partition name, you can mount it in this fashion: - -``` -sudo mount /dev/sdb2 /mnt -``` - -I hope this gives you a pretty good idea about checking hard drive space on Linux. Let’s see how to do it graphically. - -### Method 2: Check free disk usage graphically - -Checking free disk space graphically is much easier in Ubuntu with the Disk Usage Analyzer tool. - -![Disk Usage Analyzer Tool][9] - -You’ll see all the actual disks and partitions here. You may have to mount some partitions by clicking on them. It displays the disk usage for all the mounted partitions. - -![Disk usage check][10] - -#### Checking free disk space with GNOME Disks utility - -Otherwise, the GNOME Disks utility is also pretty handy tool. - -![GNOME Disks Tool][11] - -Start the tool and select the disk. Select a partition to see the free disk space. If a partition is not mounted, mount it first by clicking the ‘play’ icon. - -![Free Disk Space Check in Ubuntu Desktop][12] - -I think all major desktop environments have some sort of graphical tool to check the disk usage on Linux. You can search for it in the menu of your desktop Linux system. - -**Conclusion** - -There can be more ways and tools to check the disk space of course. I showed you the most common command line and GUI methods for this purpose. - -I also explained a few things that might trouble you in understanding the disk usage. Hope you like it. - -If you have questions or suggestions, please let me know in the comment section. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/check-free-disk-space-linux/ - -作者:[Abhishek Prakash][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/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://linuxhandbook.com/df-command/ -[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/free-disk-space-linux-df-command-output.png?resize=786%2C475&ssl=1 -[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/df-command-output.png?resize=800%2C600&ssl=1 -[4]: https://www.kernel.org/doc/html/latest/filesystems/tmpfs.html -[5]: https://wiki.debian.org/udev -[6]: https://itsfoss.com/install-linux-on-intel-nuc/ -[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/df-command-ubuntu-1.png?resize=786%2C443&ssl=1 -[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/lsblk-command-to-see-disks-linux.png?resize=786%2C538&ssl=1 -[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/disk-usage-analyzer-tool-linux.jpg?resize=800%2C250&ssl=1 -[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/free-disk-space-ubuntu-desktop.png?resize=800%2C648&ssl=1 -[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/disks-tool-linux.jpg?resize=800%2C250&ssl=1 -[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/free-disk-space-check-ubuntu-desktop.png?resize=800%2C600&ssl=1 diff --git a/translated/tech/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md b/translated/tech/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md new file mode 100644 index 0000000000..cdbc40ff60 --- /dev/null +++ b/translated/tech/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md @@ -0,0 +1,129 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Check Free Disk Space on Linux [Terminal and GUI Methods]) +[#]: via: (https://itsfoss.com/check-free-disk-space-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Linux 上检查可用的磁盘空间 [终端和 GUI 方法] +====== + +_**我已经使用了多少磁盘空间?**_ + +在 Linux 上查找可用磁盘空间的最简单的方法是 [使用 df 命令][1] 。df 命令从字面意思上代表着可用空间,很明显,它将向你显示在 Linux 系统上的可用磁盘空间。 + +``` +df -h +``` + +使用 `-h` 选项,它将以人类可读的格式 (MB 和 GB) 来显示磁盘空间。 + +这里是针对我 Dell XPS 系统的 df 命令的输出,它使用了加密磁盘并且只安装了 Linux : + +![在 Linux 中使用 df 命令检查可用磁盘空间][2] + +如果上面的输出使你感到困惑,不用担心。我将介绍一些关于在 Linux 中检查可用磁盘空间的东西。_**我也将为桌面 Linux 用户展示 GUI 方法。**_ + +### 方法 1: 使用 df 命令来检查在 Linux 中的可用磁盘空间(并理解它的输出) + +当你使用 df 命令来检查磁盘空间时,它将显示一组 ‘文件系统’,包括它们的大小,使用的空间和可用的空间。你实际的磁盘通常应该下面列表中的一个: + + * /dev/sda + * /dev/sdb + * /dev/nvme0n1p + + + +这不是硬性的标准,但是它给予你一个标志,它可以让你能够很容易地从一堆文字中辨别出真正是磁盘。 + +你的 Linux 系统在你的磁盘上可能有一些用于 boot, EFI, root, swap, home 等的分区。在这种情况下,这些分区在 ‘磁盘名称’ 的结尾处使用一个数字来标示,像 /dev/sda1, /dev/nvme0n1p2 等等。 + +你可以从它们的挂载点来辨认出哪个分区是用于做什么的。Root 挂载在 /, EFI 在 /boot/EFI 等等。 + +就我的情况来说,我已经使用了 root 分区下磁盘空间 ( 232 GB ) 的 41% 。如果你有 2 到 3 个大分区(像 root, home 等等),你将不得不在这里计算一下已使用的磁盘空间。 + +![理解 df 命令输出][3] + + * **tmpfs**: [tmpfs][4] (临时文件系统) 用于在虚拟存储器中保持文件。你可以随意地忽略这个虚拟文件系统。 + * **udev**: [udev 文件系统][5] 用于存储插入到你系统的设备(像 USB,网卡,CD ROM 等等) 的相关信息。你也可以忽略它。 + * **/dev/loop**: 它们是 loop 设备。由于 snap 应用程序,在 Ubuntu 中检查磁盘时,你将看到很多的这样的设备。loop 设备是虚拟设备,它们允许普通文件作为块设备文件来访问。使用 loop 设备,snap 应用程序在它们自己的虚拟磁盘中进行沙盒处理。尽管它们是在 root 下,但是你不需要单独计算它们使用的磁盘空间。 + + + +#### 丢失磁盘空间?检查你是否挂载了所有是磁盘和分区 + +记住,df 命令仅显示已挂载文件系统的磁盘空间。如果你在同一块磁盘上使用多个 Linux 发行版 (或者多个操作系统),或者在你的系统上有多个磁盘 ,你需要先挂载它们,以便查看在这些分区和磁盘上的可用磁盘空间。 + +例如,我的 [Intel NUC][6] 有两个 SSD 磁盘,并且在其上有4个或5个 Linux 分区。仅当我明确地挂载它们时,df 命令才会显示附加的磁盘。 + +![][7] + +你可以使用 lsblk 命令来查看在你系统上的所有磁盘和分区。 + +![][8] + +在你有了磁盘分区名称后,你可以用这种方式来挂载它: + +``` +sudo mount /dev/sdb2 /mnt +``` + +我希望这种方法能够给你提供一个在 Linux 上检查硬盘驱动器空间的好主意。让我们看看如何在 GUI 下来完成。 + +### 方法 2: 在 GUI 下检查可用磁盘使用情况 + +在 Ubuntu 中使用 Disk Usage Analyzer 工具来在 GUI 的方式下检查可用磁盘空间是很容易的。 + +![Disk Usage Analyzer 工具][9] + +在这里,你将看到所有实际的磁盘和分区。你可能需要单击一些分区来挂载它们。它显示所有已挂载分区的磁盘使用情况。 + +![磁盘使用情况检查][10] + +#### 使用 GNOME 的 Disks 实用程序来检查可用磁盘空间 + +除此之外,GNOME 的 Disks 实用程序也是非常容易使用的工具。 + +![GNOME 的 Disks 工具][11] + +启动工具和选择磁盘。选择一个分区来查看可用磁盘空间。如果没有挂载分区,那么先通过单击 ‘play’ 图标来挂载它。 + +![检查 Ubuntu 的桌面版本的可用磁盘空间][12] + +我认为在 Linux 上的所有主要桌面环境都有某种图形工具来检查磁盘使用情况。你可以在你是桌面 Linux 系统的菜单中搜索它。 + +**结束语** + +当然,这里可能有很多方法和工具来检查磁盘空间。为此,我向你显示了最常用的命令行方法和 GUI 方法。 + +我也解释一些可能会让你很难理解磁盘使用情况的东西。希望你喜欢它。 + +如果你有问题或建议,请在评论区告诉我。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/check-free-disk-space-linux/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://linuxhandbook.com/df-command/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/free-disk-space-linux-df-command-output.png?resize=786%2C475&ssl=1 +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/df-command-output.png?resize=800%2C600&ssl=1 +[4]: https://www.kernel.org/doc/html/latest/filesystems/tmpfs.html +[5]: https://wiki.debian.org/udev +[6]: https://itsfoss.com/install-linux-on-intel-nuc/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/df-command-ubuntu-1.png?resize=786%2C443&ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/lsblk-command-to-see-disks-linux.png?resize=786%2C538&ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/disk-usage-analyzer-tool-linux.jpg?resize=800%2C250&ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/free-disk-space-ubuntu-desktop.png?resize=800%2C648&ssl=1 +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/disks-tool-linux.jpg?resize=800%2C250&ssl=1 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/free-disk-space-check-ubuntu-desktop.png?resize=800%2C600&ssl=1 From fca84f95d3f24521bf3cc9ddf7ff5f192b63c1e5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 12 Nov 2020 22:43:23 +0800 Subject: [PATCH 0749/1156] PUB @wxy https://linux.cn/article-12816-1.html --- ...05 5 surprising ways I use Jupyter to improve my life.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20201105 5 surprising ways I use Jupyter to improve my life.md (96%) diff --git a/translated/tech/20201105 5 surprising ways I use Jupyter to improve my life.md b/published/20201105 5 surprising ways I use Jupyter to improve my life.md similarity index 96% rename from translated/tech/20201105 5 surprising ways I use Jupyter to improve my life.md rename to published/20201105 5 surprising ways I use Jupyter to improve my life.md index 15ba339821..8caca94e32 100644 --- a/translated/tech/20201105 5 surprising ways I use Jupyter to improve my life.md +++ b/published/20201105 5 surprising ways I use Jupyter to improve my life.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12816-1.html) [#]: subject: (5 surprising ways I use Jupyter to improve my life) [#]: via: (https://opensource.com/article/20/11/surprising-jupyter) [#]: author: (Moshe Zadka https://opensource.com/users/moshez) @@ -12,7 +12,7 @@ > Jupyter 不仅仅是一个数据分析工具,让我们看看如何以最有创意的方式使用这个基于 Python 的软件。 -!["太空中的电脑笔记本"[1] +![](https://img.linux.net.cn/data/attachment/album/202011/12/224138d99jlp3q5qjqv5v7.jpg) [Jupyter][2] 项目提供了用 JupyterLab 和 Jupyter Notebook 等交互式编写软件的技术方式。这个软件通常用于数据分析,但你可能不知道(Jupyter 社区也没有想到),你可以用它做多少事情。 From 5d024410a714de4815d89037f43bd4acdd8b1987 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 12 Nov 2020 23:08:19 +0800 Subject: [PATCH 0750/1156] Rename sources/tech/20201108 Open environments are where innovative ideas thrive.md to sources/talk/20201108 Open environments are where innovative ideas thrive.md --- ...0201108 Open environments are where innovative ideas thrive.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20201108 Open environments are where innovative ideas thrive.md (100%) diff --git a/sources/tech/20201108 Open environments are where innovative ideas thrive.md b/sources/talk/20201108 Open environments are where innovative ideas thrive.md similarity index 100% rename from sources/tech/20201108 Open environments are where innovative ideas thrive.md rename to sources/talk/20201108 Open environments are where innovative ideas thrive.md From 839952de634d1d257ab47921e58f23898d2262d4 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 12 Nov 2020 23:17:01 +0800 Subject: [PATCH 0751/1156] PRF&PUB: @chenmu-kk https://linux.cn/article-12817-1.html --- ...channel architecture is the best option.md | 75 ++++++++++++++++ ...channel architecture is the best option.md | 90 ------------------- 2 files changed, 75 insertions(+), 90 deletions(-) create mode 100644 published/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md delete mode 100644 translated/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md diff --git a/published/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md b/published/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md new file mode 100644 index 0000000000..e121eea3b0 --- /dev/null +++ b/published/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: (chenmu-kk) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12817-1.html) +[#]: subject: (When Wi-Fi is mission-critical, a mixed-channel architecture is the best option) +[#]: via: (https://www.networkworld.com/article/3386376/when-wi-fi-is-mission-critical-a-mixed-channel-architecture-is-the-best-option.html#tk.rss_all) +[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/) + +当 Wi-Fi 成为关键业务时,混合信道架构是最好的多信道选择 +====== + +> 混合信道架构是最好的多信道选择,但它并不总是最佳的选择。当需要可靠的 Wi-Fi 时,单信道和混合 AP 提供了令人信服的替代方案。 + +![Getty Images][1] + +我曾与许多实施数字项目的公司合作过,结果却发现它们失败了。正确的想法,健全地施行,现存的市场机遇。哪里是薄弱的环节?是 Wi-Fi 网络。 + +例如,一家大型医院希望通过将遥测信息发送到移动设备,来提高临床医生对患者警报的响应时间。如果没有这个系统,护士了解病人警报的唯一途径就是通过声音警报。在所有嘈杂的背景音中,通常很难分辨噪音来自哪里。问题是这家医院中的 Wi-Fi 网络已经很多年未升级了,这导致信息传递严重延迟(通常需要 4~5 分钟)。过长的信息传递导致人们对该系统失去信心,因此许多临床医生停止使用该系统,转而使用手动警报。最终,人们认为这个项目是失败的。 + +我曾在制造业、K-12 教育、娱乐和其他行业中见过类似的案例。企业竞争的基础是客户体验,而竞争的动力来自不断扩展又无处不在的无线优势。好的 Wi-Fi 并不意味着市场领导地位,但是劣质的 Wi-Fi 将会对客户和员工产生负面影响。而在当今竞争激烈的环境下,这是灾难的根源。 + +### Wi-Fi 性能历来不一致 + +Wi-Fi 的问题在于它本身就很脆弱。我相信每个阅读这篇文章的人都经历过下载失败、连接中断、性能不一致以及连接公用热点的漫长等待时间等缺陷。 + +想象一下,你在一个会议上,在一个主题演讲之前,你可以随意地发推特、发电子邮件、浏览网页以及做其他事情。然后主讲人上台,所有观众开始拍照,上传并流传信息——然后网络崩溃了。我发现这不仅仅是一个例外,更是一种常态,强调了对[无损 Wi-Fi][3]的需求。 + +对于网络技术人员的问题是如何让一个地方的 Wi-Fi 达到全部时间都保持不间断。有人说只要加强现存的网络可以做到,这也许可以,但在某些情况下,Wi-Fi 的类型可能并不合适。 + +最常见的 Wi-Fi 部署类型是多信道,也称为微蜂窝,每个客户端通过无线信道连接到接入点(AP)。高质量的通话体验基于两点:良好的信号强度和最小的干扰。有几个因素会导致干扰,例如接入点距离太近、布局问题或者来自其他设备的干扰。为了最大程度地减少干扰,企业需要投入大量的时间和资金在[现场调查中规划最佳的信道地图][2],但即使这些做得很好,Wi-Fi 故障仍然可能发生。 + +## 多通道 Wi-Fi 并非总是最佳选择 + +对于许多铺着地毯的办公室来说,多通道 Wi-Fi 可能是可靠的,但在某些环境中,外部环境会影响性能。一个很好的例子是多租户建筑,其中有多个 Wi-Fi 网络在同一信道上传输并相互干扰。另一个例子是医院,这里有许多工作人员在多个接入点间流动。客户端将试图连接到最佳接入点,导致客户端不断断开连接并重新连接,从而导致会话中断。还有一些环境,例如学校、机场和会议设施,那里存在大量的瞬态设备,而多通道则难以跟上。 + +## 单通道 Wi-Fi 提供更好的可靠性但与此同时性能会受到影响 + +网络管理器要做什么?不一致的 Wi-Fi 只是一个既成事实吗?多信道是一种标准,但它并非是为动态物理环境或那些需要可靠的连接环境而设计的。 + +几年前提出了一项解决这些问题的替代架构。顾名思义,“单信道”Wi-Fi 在网络中为所有接入点使用单一的无线频道。可以把它想象成在一个信道上运行的单个 Wi-Fi 结构。这种架构中,接入点的位置无关紧要,因为它们都利用相同的通道,因此不会互相干扰。这有一个显而易见的简化优势,比如,如果覆盖率很低,那就没有理由再做一次昂贵的现场调查。相反,只需在需要的地方布置接入点就可以了。 + +单通道的缺点之一是总网络吞吐量低于多通道,因为只能使用一个通道。在可靠性高于性能的环境中,这可能会很好,但许多组织希望二者兼而有之。 + +## 混合接入点提供了两全其美的优势 + +单信道系统制造商最近进行了创新,将信道架构混合在一起,创造了一种“两全其美”的部署,可提供多信道的吞吐量和单信道的可靠性。举个例子,Allied Telesis 提供了混合接入点,可以同时在多信道和单信道模式下运行。这意味着可以分配一些 Web 客户端到多信道以获得最大的吞吐量,而其他的 Web 客户端则可使用单信道来获得无缝漫游体验。 + +这种混合的实际用例可能是物流设施,办公室工作人员使用多通道,但叉车操作员在整个仓库移动时使用单一通道持续连接。 + +Wi-Fi 曾是一个便利的网络,但如今它或许是所有网络中最关键的任务。传统的多信道体系也许可以工作,但应该做一些尽职调查来看看它在重负下如何运转。IT 领导者需要了解 Wi-Fi 对数字转型计划的重要性,并进行适当的测试,以确保它不是基础设施链中的薄弱环节,并为当今环境选择最佳技术。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3386376/when-wi-fi-is-mission-critical-a-mixed-channel-architecture-is-the-best-option.html + +作者:[Zeus Kerravala][a] +选题:[lujun9972][b] +译者:[chenmu-kk](https://github.com/chenmu-kk) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Zeus-Kerravala/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2018/09/tablet_graph_wifi_analytics-100771638-large.jpg +[2]: https://www.networkworld.com/article/3315269/wi-fi-site-survey-tips-how-to-avoid-interference-dead-spots.html +[3]: https://www.alliedtelesis.com/blog/no-compromise-wi-fi +[4]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fcourses%2Fmobile-device-management-big-picture +[5]: https://www.networkworld.com/article/3273439/review-icinga-enterprise-grade-open-source-network-monitoring-that-scales.html?nsdr=true#nww-fsb +[6]: https://www.networkworld.com/article/3304307/nagios-core-monitoring-software-lots-of-plugins-steep-learning-curve.html +[7]: https://www.networkworld.com/article/3269279/review-observium-open-source-network-monitoring-won-t-run-on-windows-but-has-a-great-user-interface.html?nsdr=true#nww-fsb +[8]: https://www.networkworld.com/article/3304253/zabbix-delivers-effective-no-frills-network-monitoring.html +[9]: https://www.facebook.com/NetworkWorld/ +[10]: https://www.linkedin.com/company/network-world diff --git a/translated/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md b/translated/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md deleted file mode 100644 index e0133ea9e9..0000000000 --- a/translated/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md +++ /dev/null @@ -1,90 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (chenmu-kk) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (When Wi-Fi is mission-critical, a mixed-channel architecture is the best option) -[#]: via: (https://www.networkworld.com/article/3386376/when-wi-fi-is-mission-critical-a-mixed-channel-architecture-is-the-best-option.html#tk.rss_all) -[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/) - -当Wi-Fi 成为关键业务时,混合信道架构是最好的多信道选择 -====== - -### 当Wi-Fi 成为关键业务时,对于如今的它来说,混合信道架构是最好的多信道选择,但它并不总是最佳的选择。当需要可靠的Wi-Fi时,单信道和混合Aps提供了令人信服的替代方案。 - -![Getty Images][1] - -我曾与许多实施数字项目的公司合作,结果却发现它们失败了。正确的想法,健全地施行,现存的市场机遇。哪里是薄弱的环节?是Wi-Fi网络。 - -例如,一家大型医院希望通过将遥测信息发送到移动设备,来提高临床医生对患者警报的响应时间。如果没有这个系统,护士了解病人警报的唯一途径就是通过声音警报。在所有嘈杂的背景音中,通常很难分辨噪音来自哪里。问题是这家医院中的Wi-Fi网络已经很多年未升级了,这导致信息传递严重延迟(通常需要4~5分钟)。过长的信息传递导致人们对该系统失去信心,因此许多临床医生停止使用该系统,转而使用手动警报。最终,人们认为这个项目是失败的。 - -我曾在制造业、K-12教育、娱乐和其他行业中见过类似的案例。企业竞争的基础是客户体验,而竞争的动力来自不断扩展又无处不在的无线优势。好的 Wi-Fi并不意味着市场领导地位,但是劣质的Wi-Fi将会对客户和员工产生负面影响。而在当今竞争激烈的环境下,这是灾难的根源。 - -**[ Read also:[Wi-Fi site-survey tips: How to avoid interference, dead spots][2] ]** - -## Wi-Fi性能历来不一致 - -Wi-Fi的问题在于它本身就很脆弱。我相信每个阅读这篇文章的人都经历过下载失败、连接中断、性能不一致以及连接公用热点的漫长等待时间等缺陷。 - -想象一下,你坐在一个会议上,在一个主题演讲之前,你可以随意地发推特、发电子邮件、浏览网页以及做其他事情。然后主讲人上台,所有观众开始拍照,上传并流传信息——然后网络崩溃了。我发现这不仅仅是一个例外,更是一种常态,强调了对[不妥协Wi-Fi][3]的需求。 - -对于网络技术人员的问题是如何到达一个Wi-Fi一直不间断保持100%的地方。有人说只要加强现存的网络可以做到,这也许可以,但在某些情况下,Wi-Fi的类型可能并不合适。 - -最常见的Wi-Fi部署类型是多信道,也称为微蜂窝,每个客户端通过无线信道连接到接入点(AP)。高质量的通话体验基于两点:良好的信号强度和最小的干扰。有几个因素会导致干扰,例如接入点太靠近,布局问题或者来自其他设备的干扰。为了最大程度地减少干扰,企业需要投入大量的时间和资金在 [现场调查中规划最佳的信道地图][2],但即使这些做得很好,Wi-Fi故障仍然可能发生。 - -**[[Take this mobile device management course from PluralSight and learn how to secure devices in your company without degrading the user experience.][4] ]** - -## 多通道Wi-Fi并非总是最佳选择 - -对于许多铺着地毯的办公室来说,多通道Wi-Fi可能是可靠的,但在某些环境中,外部环境会影响性能。一个很好的例子是多租户建筑,其中有多个Wi-Fi网络在同一信道上传输并相互干扰。另一个例子是医院,这里有许多工作人员在多个接入点间流动。有并联Wi-Fi网络传输在相同通道并相互干扰。客户端将试图连接到最佳接入点,导致客户端不断断开连接并重新连接,从而导致会话中断。还有一些环境,例如学校、机场和会议设施,那里存在大量的瞬态设备,而多通道则难以跟上。 - -## 单通道Wi-Fi提供更好的可靠性但与此同时性能会受到影响 - -网络管理器要做什么?不一致的Wi-Fi只是一个既定事实吗?多信道是一种标准,但它并非是为动态物理环境或那些需要可靠的连接环境而设计的。 - -几年前提出了一项解决这些问题的替代架构。顾名思义,“单信道”Wi-Fi在网络中为所有接入点使用单一的无线频道。可以把它想象成在一个信道上运行的单个Wi-Fi结构。这种架构中,接入点的位置无关紧要,因为他们都利用相同的通道,因此不会互相干扰。这有一个显而易见的简化优势,比如,如果覆盖率很低,那就没有理由再做一次昂贵的现场调查。相反,只需在需要的地方布置接入点就可以了。 - -单通道的缺点之一是总网络吞吐量低于多通道,因为只能使用一个通道。在可靠性高于性能的环境中,这可能会很好,但许多组织希望二者兼而有之。 - -## 混合接入点提供了两全其美的优势 - -单信道系统制造商最近进行了创新,将信道架构混合在一起,创造了一种“两全其美”的部署,可提供多信道的吞吐量和单信道的可靠性。举个例子,安奈特提供了混合接入点,可以同时在多信道和单信道模式下运行。这意味着可以分配一些web客户端到多信道以获得最大的吞吐量,而其他的web客户端则可使用单信道来获得无缝漫游体验。 - -这种混合的实际用例可能是物流设施,办公室工作人员使用多通道,但叉车操作员在整个仓库移动时使用单一通道持续连接。 - -Wi-Fi曾是一个便利的网络,但如今他或许是所有网络中最关键的任务。传统的多信道体系也许可以工作,但应该做一些尽职调查来看看它在重负下如何运转。IT领导者需要了解Wi-Fi对数字转型计划的重要性,并进行适当的测试,以确保它不是基础设施链中的薄弱环节,并为当今环境选择最佳技术。 - -**综述:4个免费的开源网络监控工具** - - * [Icinga:可扩展的企业级开源网络监控][5] - * [Nagios Core: 包含大量插件、陡峭学习曲线的网络监控软件][6] - * [Observium 开源网络监控工具: 无法在Windows系统上运行,但有着出色的用户界面][7] - * [Zabbix 提供有效的网络监控][8] - - - -Join the Network World communities on [Facebook][9] and [LinkedIn][10] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3386376/when-wi-fi-is-mission-critical-a-mixed-channel-architecture-is-the-best-option.html#tk.rss_all - -作者:[Zeus Kerravala][a] -选题:[lujun9972][b] -译者:[chenmu-kk](https://github.com/chenmu-kk) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.networkworld.com/author/Zeus-Kerravala/ -[b]: https://github.com/lujun9972 -[1]: https://images.idgesg.net/images/article/2018/09/tablet_graph_wifi_analytics-100771638-large.jpg -[2]: https://www.networkworld.com/article/3315269/wi-fi-site-survey-tips-how-to-avoid-interference-dead-spots.html -[3]: https://www.alliedtelesis.com/blog/no-compromise-wi-fi -[4]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fcourses%2Fmobile-device-management-big-picture -[5]: https://www.networkworld.com/article/3273439/review-icinga-enterprise-grade-open-source-network-monitoring-that-scales.html?nsdr=true#nww-fsb -[6]: https://www.networkworld.com/article/3304307/nagios-core-monitoring-software-lots-of-plugins-steep-learning-curve.html -[7]: https://www.networkworld.com/article/3269279/review-observium-open-source-network-monitoring-won-t-run-on-windows-but-has-a-great-user-interface.html?nsdr=true#nww-fsb -[8]: https://www.networkworld.com/article/3304253/zabbix-delivers-effective-no-frills-network-monitoring.html -[9]: https://www.facebook.com/NetworkWorld/ -[10]: https://www.linkedin.com/company/network-world From ab164bfecaa311fd102c52791e1d0feb46bc16b1 Mon Sep 17 00:00:00 2001 From: xiao-song-123 <463020345@qq.com> Date: Fri, 13 Nov 2020 00:26:17 +0800 Subject: [PATCH 0752/1156] translated --- ...steps to learn any programming language.md | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/sources/tech/20201022 5 steps to learn any programming language.md b/sources/tech/20201022 5 steps to learn any programming language.md index 8eae0b5d43..8104c71dbb 100644 --- a/sources/tech/20201022 5 steps to learn any programming language.md +++ b/sources/tech/20201022 5 steps to learn any programming language.md @@ -115,7 +115,7 @@ if (boolean) { } ``` -各种编程语言虽然在关键字的选择和语法上有细微的变化,但基本是相同的。学习如何在所学的编程语言中定义条件语句,包括 `if/then`, `do...while` 和 `case` 语句。 +各种编程语言虽然在关键字的选择和语法上有细微的变化,但基本是相同的。学习如何在编程语言中定义条件语句,包括 `if/then`, `do...while` 和 `case` 语句。 #### 实践 @@ -141,33 +141,33 @@ if (boolean) { (Seth Kenlon, [CC BY-SA 4.0][4]) -Once you understand the types of data a programming language deals in, you can learn how to analyze that data. Luckily, the discipline of mathematics is pretty stable, so math operators are often the same (or at least very similar) across many languages. For instance, adding two integers is usually done with a `+` symbol, and testing whether one integer is greater than another is usually done with the `>` symbol. Testing for equality is usually done with `==` (yes, that's two equal symbols, because a single equal symbol is usually reserved to _set_ a value). +一旦您理解了编程语言可处理的数据类型,就可以学习如何分析这些数据了。幸运的是,数学这门学科是相当稳定的,所以算数运算符在许多语言中通常是相同的(或至少非常相似)。例如,两个整数相加通常用 `+` 符号完成,而测试一个整数是否大于另一个整数通常用 `>` 符号完成。测试是否相等通常使用 `==` 来完成(是的,是两个等号,因为通常一个等号用来赋值)。 -There are notable exceptions to the obvious in languages like Lisp and Bash, but as with everything else, it's just a matter of mental transliteration. Once you know _how_ the expression is different, it's trivial for you to adapt. A quick review of a language's math operators is usually enough to get a feel for how math is done. +当然也有一些例外,比如像 Lisp 和 Bash 语言算数运算符就不是如此,但与其他语言一样,这只是一个音译的问题。一旦您了解了表达方式有何不同,很快就可以适应它。快速回顾一门编程语言的算数运算符通常足以让您了解算数操作是如何完成的。 -You also need to know how to compare and operate on non-numerical data, such as characters and strings. These are often done with a language's core libraries. For instance, Python features the `split()` method, while C requires `string.h` to provide the `strtok()` function. +您还需要知道如何比较和操作非数值数据,比如字符和字符串。这些通常是通过编程语言的核心库来进行的的。例如,Python 提供了 `split()` 方法,而 C 语言需要引入头文件 `string.h` 来提供 `strtok()` 函数。 -#### Take action +#### 实践 -Learn the basic functions and keywords for manipulating basic data types, and look for core libraries that help you accomplish complex actions. +了解用于处理基本数据类型的基本函数和关键字,并寻找可帮助您完成复杂操作的核心库。 -### 5\. Functions +### 5\. 函数 ![Class][14] (Seth Kenlon, [CC BY-SA 4.0][4]) -Code usually isn't just a to-do list for a computer. Typically when you write code, you're looking to present a computer with a set of theoretical conditions and a set of instructions for actions that must be taken when each condition is met. While flow control with conditional statements and math and logic operators can do a lot, code is a lot more efficient once functions and classes are introduced because they let you define subroutines. For instance, should an application require a confirmation dialogue box very frequently, it's a lot easier to write that box _once_ as an instance of a class rather than re-writing it each time you need it to appear throughout your code. +代码不只是计算机的待办清单。通常情况下,在编写代码时您往往希望向计算机提供一组理论条件和一组操作指令,当满足每个条件时计算机就会采取这些操作。尽管使用条件语句以及数学和逻辑运算符进行流控制可以做很多事情,但是引入了函数和类之后,代码会变得更加高效,因为它们使您可以定义子程序。 例如,如果应用程序需要非常频繁地确认一个对话框,那么将其作为类的实例编写一次要比每次需要它时重新编写实现起来要容易得多。 -You need to learn how classes and functions are defined in the programming language you're learning. More precisely, first, you need to learn whether classes and functions are available in the programming language. Most modern languages do support functions, but classes are specialized constructs common to object-oriented languages. +您需要学习如何在编程语言中定义类和函数。更准确地说,您首先需要了解编程语言中是否支持类和函数。大多数现代语言都支持函数,但是类是面向对象的编程语言中所特有的。 -#### Take action +#### 实践 -Learn the constructs available in a language that help you write and use code efficiently. +学习语言中可用的结构,这些结构可以帮助您高效地编写和使用代码。 -### You can learn anything +### 您可以学到任何东西 -Learning a programming language is, in itself, a sort of subroutine of the coding process. Once you understand the theory behind how code works, the language you use is just a medium for delivering logic. The process of learning a new language is almost always the same: learn syntax through simple exercises, learn vocabulary so you can build up to performing complex actions, and then practice, practice, practice. +学习编程语言,就其本身而言,是一种编码过程中的子程序。一旦理解了代码如何工作,您所使用的语言就只是一种传递逻辑的媒介。学习一门新语言的过程几乎都是一样的:通过简单的练习来学习语法,通过学习词汇来积累进行复杂动作的能力,然后练习、练习、再练习。 -------------------------------------------------------------------------------- @@ -175,7 +175,7 @@ via: https://opensource.com/article/20/10/learn-any-programming-language 作者:[Seth Kenlon][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[xiao-song-123](https://github.com/xiao-song-123) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 514a76af2e777bb432bc87fc2f513a513f06d1fa Mon Sep 17 00:00:00 2001 From: xiao-song-123 <463020345@qq.com> Date: Fri, 13 Nov 2020 00:28:44 +0800 Subject: [PATCH 0753/1156] translated --- .../tech/20201022 5 steps to learn any programming language.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20201022 5 steps to learn any programming language.md (100%) diff --git a/sources/tech/20201022 5 steps to learn any programming language.md b/translated/tech/20201022 5 steps to learn any programming language.md similarity index 100% rename from sources/tech/20201022 5 steps to learn any programming language.md rename to translated/tech/20201022 5 steps to learn any programming language.md From 160d2a2484fac77e6fa7088c64532ff7d2e7b1c4 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 13 Nov 2020 04:24:25 +0800 Subject: [PATCH 0754/1156] Rename sources/tech/20201111 Why I use Home Assistant for open source home automation.md to sources/talk/20201111 Why I use Home Assistant for open source home automation.md --- ...11 Why I use Home Assistant for open source home automation.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20201111 Why I use Home Assistant for open source home automation.md (100%) diff --git a/sources/tech/20201111 Why I use Home Assistant for open source home automation.md b/sources/talk/20201111 Why I use Home Assistant for open source home automation.md similarity index 100% rename from sources/tech/20201111 Why I use Home Assistant for open source home automation.md rename to sources/talk/20201111 Why I use Home Assistant for open source home automation.md From f53763b641a42caae15cc3c6ba692dd8093a6112 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 13 Nov 2020 05:02:53 +0800 Subject: [PATCH 0755/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201112?= =?UTF-8?q?=20Test=20GNOME=20apps=20on=20this=20Linux=20reference=20platfo?= =?UTF-8?q?rm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201112 Test GNOME apps on this Linux reference platform.md --- ...E apps on this Linux reference platform.md | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 sources/tech/20201112 Test GNOME apps on this Linux reference platform.md diff --git a/sources/tech/20201112 Test GNOME apps on this Linux reference platform.md b/sources/tech/20201112 Test GNOME apps on this Linux reference platform.md new file mode 100644 index 0000000000..ace15dfa50 --- /dev/null +++ b/sources/tech/20201112 Test GNOME apps on this Linux reference platform.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Test GNOME apps on this Linux reference platform) +[#]: via: (https://opensource.com/article/20/11/gnome-os) +[#]: author: (Jim Hall https://opensource.com/users/jim-hall) + +Test GNOME apps on this Linux reference platform +====== +Introducing GNOME OS, the plain-vanilla Linux reference platform that +makes it easier to test GNOME applications and bug reports. +![Penguin with green background][1] + +I'm very excited about [GNOME 3.38][2]. The new version of the Linux desktop environment includes [lots of new features and a noticeable performance boost][3]. But in the background, mostly unnoticed, is another neat new thing about GNOME: the development of GNOME OS. + +As you might guess from its name, GNOME OS is a Linux distribution that uses GNOME as its desktop. But unlike Pop!_OS, Fedora, or Ubuntu, GNOME OS isn't meant as a complete Linux distribution. Instead, it is a reference platform for GNOME. + +The idea is to have a standard operating system image running GNOME to give developers a consistent platform to test on. As GNOME makes new releases, the GNOME development team can share that image with testers, so they can experience the new version. + +This is significant for GNOME testing. Previously, if someone reported a bug in a GNOME application, a developer would have to dig into the bug report and determine if the bug is really in the GNOME desktop or if it happened because the distribution did something or tweaked something in GNOME that had a knockdown effect on a GNOME application. But with GNOME OS, developers have a standard reference platform that is always a _vanilla_ version of GNOME. Developers can reproduce bug reports using GNOME OS; if they can reproduce the bug, they know it's really with GNOME and not someone else's "spin" on GNOME. + +As such, GNOME OS is not meant to be a full desktop operating system. It's just meant to be a place to test GNOME and GNOME applications. + +![Installing GNOME OS][4] + +Installing GNOME OS (Jim Hall, [CC BY-SA 4.0][5]) + +GNOME OS also helps GNOME developers add new features. Imagine having a virtual machine where a developer can test new changes to GNOME Shell and the extensions. In previous GNOME releases, GNOME extensions would usually break in every release. With GNOME OS, developers can test those extensions against a full version of GNOME. Developers and testers don't have to reinstall their full desktop OS—they can just run GNOME OS in a virtual machine and test it there. + +![Booting GNOME OS][6] + +Booting GNOME OS (Jim Hall, [CC BY-SA 4.0][5]) + +That's the big value in GNOME OS. Now extension writers can do their tests using GNOME OS and don't have to wait for a new version of the full GNOME to become available in a standard distribution. This allows GNOME to better support development and testing processes. + +GNOME OS also makes it easier for testers to join the project. If you want to work on GNOME, just download the GNOME OS image and test against that. Because GNOME OS is a reference platform, you know that any bugs you find will be only against GNOME. + +![Running GNOME OS][7] + +Running GNOME OS (Jim Hall, [CC BY-SA 4.0][5]) + +GNOME OS is automatically generated from new builds, so it's always the latest version of GNOME. Whenever there's a change in GNOME, it gets pushed to the GNOME OS image. GNOME OS is managed with [OSTree][8], so you don't have to keep downloading new versions. This also makes it easy to roll back if an update is broken. + +Interested in GNOME OS? Learn more about it at [GNOME OS Nightly][9], or visit the [GitLab project][10] to download a bootable GNOME OS image. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/gnome-os + +作者:[Jim Hall][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://opensource.com/users/jim-hall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_penguin_green.png?itok=ENdVzW22 (Penguin with green background) +[2]: https://help.gnome.org/misc/release-notes/3.38/ +[3]: https://opensource.com/article/20/10/whats-new-gnome-338 +[4]: https://opensource.com/sites/default/files/uploads/installing-gnome-os.png (Installing GNOME OS) +[5]: https://creativecommons.org/licenses/by-sa/4.0/ +[6]: https://opensource.com/sites/default/files/uploads/booting-gnome-os.png (Booting GNOME OS) +[7]: https://opensource.com/sites/default/files/uploads/running-gnome-os.png (Running GNOME OS) +[8]: https://ostreedev.github.io/ostree/ +[9]: https://os.gnome.org/ +[10]: https://gitlab.gnome.org/GNOME/gnome-build-meta/-/wikis/home From 92d7390595c3b5e129614fd3464a46c21298af71 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 13 Nov 2020 05:03:05 +0800 Subject: [PATCH 0756/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201112?= =?UTF-8?q?=20Improve=20open=20source=20community=20sustainability=20by=20?= =?UTF-8?q?tracking=20these=20two=20metrics?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201112 Improve open source community sustainability by tracking these two metrics.md --- ...inability by tracking these two metrics.md | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 sources/tech/20201112 Improve open source community sustainability by tracking these two metrics.md diff --git a/sources/tech/20201112 Improve open source community sustainability by tracking these two metrics.md b/sources/tech/20201112 Improve open source community sustainability by tracking these two metrics.md new file mode 100644 index 0000000000..7ac4f2becb --- /dev/null +++ b/sources/tech/20201112 Improve open source community sustainability by tracking these two metrics.md @@ -0,0 +1,146 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Improve open source community sustainability by tracking these two metrics) +[#]: via: (https://opensource.com/article/20/11/open-source-community-sustainability) +[#]: author: (Kevin Xu https://opensource.com/users/kevin-xu) + +Improve open source community sustainability by tracking these two metrics +====== +Focusing on metrics around community ownership and incentives can +increase your odds of building a sustainable open source project. +![Person using a laptop][1] + +In early 2020, I wrote an article on [three metrics][2] for tracking and measuring offline, in-person community-building activities. Little did I (or the world) know then that offline, in-person activities of any kind would soon become unfeasible for the foreseeable future. + +So, I started thinking: With open source projects being online by default, and with everything else moving online and virtual, what should creators of open source technologies measure as we continue in this COVID and (hopefully soon) post-COVID world? + +There are plenty of metrics you _can_ track—stars, forks, pull requests (PRs), merge requests (MRs), contributor counts, etc.—_but more data doesn't necessarily mean clearer insights_. I've previously shared my skepticism about the value of these [surface-level metrics][3], especially when assessing an open source project's health and sustainability. + +In this article, I propose two second-order metrics to track, measure, and continually optimize to build a strong, self-sustaining open source community: + + * Breakdowns of PR or MR reviewers + * Leaderboards of different community interactions + + + +### Why these metrics? + +The long-term goal of any open source community-building effort is to reach a tipping point where the project can live beyond the initial creators' or maintainers' day-to-day involvement. It's an especially important goal if you also are building a commericial open source software (COSS) company around that open source technology, whether it's bootstrapped or venture capital-backed. Your company will eventually have to divert resources and people power to build commercial services or paid features. + +It's a lofty goal that few projects achieve. Meanwhile, maintainer burnout is a real problem. The latest and most high-profile example is Redis creator Salvatore Sanfilippo, who shared his [struggles as an open source maintainer][4] last year and [bowed out as CEO][5] of Redis Labs earlier this year. Maintainers of various projects, big or small, struggle through similar challenges every day. + +Focusing on the two metrics above, especially early in your open source journey, can increase your odds of building something sustainable because they illuminate two important elements that drive sustainability: **ownership** and **incentive**. + +#### Breaking down PR/MR reviewers = Ownership + +Tracking who in your community is actively reviewing contributions is a good indicator of ownership. In the beginning, you, the creator, do the bulk of reviewing, but this will be unsustainable over time. Being intentional about building your community so that more people have the _contextual knowledge, confidence, and welcoming attitude_ to review incoming PRs/MRs (which should increase in frequency as your project gains traction) is crucial to long-term sustainability. + +There's a customer service-like element to reviewing contributions, which can deteriorate if not enough people feel ownership to do it. And one of the worst signals you can give to an otherwise enthusiastic newcomer is a PR or MR left unattended for two or more weeks. + +#### Community interaction leaderboards = Incentive + +Tracking a few community-facing interactions and possibly gamifying them within your community with rewards can help drive the right incentives and behaviors among community members with all levels of experience. Some of the interactions you can track are the number of PRs/MRs filed, comments, reactions, and reviews (which has some overlap with reactions). These interactions may have different values and quality, but the bigger goal here is _to understand who's doing what, who's good at doing what_, and intentionally _foster more behaviors based on people's strengths and interests_. + +Perhaps some people are great at providing helpful comments but don't have enough context (yet) to review a PR/MR. It would be good to identify who they are and provide them with more info so that they can become a reviewer one day. Perhaps some people are super-engaged with monitoring the project, as shown by their frequent reactions, but don't feel comfortable chiming in with comments and suggestions. It would be good to know who they are and help them gain more context into the project's inner workings, so they can add more value to a community they clearly care about.  + +### How to use the metrics + +So how can you track and read into these metrics? I'll illustrate with an example comparing two open source projects: [Kong][6], an API gateway, and [Apache Pulsar][7], a pub-sub messaging system. + +In May 2020, I used [Apache Superset][8], an open source data visualization tool, along with a tutorial written by [Max Beauchemin][9], one of the project's creators, to crawl and visualize some data from Kong, Apache Pulsar, and [a few other projects][10]. Using [the tutorial][11], I crawled two years' worth of data (from May 2018 to May 2020) to see changes over time. (Note: The tutorial is an example of Superset's own data with some hard-coded linkage to its history inside Airbnb and Lyft, so to use it, you will need to do some customization of the dashboard JSON to make it work more generally.) + +Two caveats: First, the data was last gathered in May, so it will surely look different today. Second, the projects were open sourced at different times, and this comparison is not a judgment on the current state or potential of either project. (Kong's first commit was in November 2014, and Pulsar's was in September 2016. Of course, both were worked on in private before being open sourced.) Some of the differences you see may simply be due to the passage of time and community effort paying off at different times; _community building is a long, persistent slog_. + +#### PR reviewer metrics + +The following two charts show Kong and Pulsar's PR reviews by GitHub handle: + +![Kong PR reviews by GitHub handle][12] + +Kong's PR reviews by GitHub handle (COSS Media, ©2020) + +![Pulsar's PR reviews by GitHub handle][13] + +Pulsar's PR reviews by GitHub handle (COSS Media, ©2020) + +Based on this data, I observe that Kong has a better balance of people reviewing PRs than Pulsar has. That balance was achieved over time as the Kong project grew in maturity. The most important thing to note is that neither of Kong's creators, [Aghi][14] nor [Marco][15], is anywhere close to being the top reviewers. _That's a good thing!_ They certainly were during the early days, but their involvement became less visible as the project matured, as it should. + +As a younger project, Pulsar isn't at the same level yet but is on its way to achieving that balance. [Sijie][16], [Jia][17], and [Penghui][18] are doing the bulk of the reviewing for now; all three are project management committee members and lead SteamNative, Pulsar's COSS company. Other major players, including Splunk (especially after it [acquired][19] Streamlio), also contribute to the project, which is a good leading indicator of eventually achieving balance. + +One factor I'm intentionally glossing over is the difference in the governance process of an Apache Software Foundation project and a non-ASF project, which would impact the speed and procedure for a contributor to become a reviewer or maintainer. In that regard, this comparison is not 100% apples-to-apples. + +#### Community interaction metrics + +Following are two leaderboard charts showing Kong and Pulsar's community interactions by GitHub handle in the 90 days since the most recent data gathered (roughly from March to May 2020): + +![Kong's 90-day leaderboard chart][20] + +Kong's 90-day leaderboard chart (COSS Media, ©2020) + +![Pulsar's 90-day leaderboard chart][21] + +Pulsar's 90-day leaderboard chart (COSS Media, ©2020) + +These leaderboards reflect the same "level of balance" shown in the previous chart, which makes sense. The more interesting takeaway is who is doing what kind of interaction, how much _interacting_ is happening, and who seems to be doing it all (Sijie!). + +As far as building the right incentive structure, this leaderboard-type view can help you get a sense of where interactions are coming from and what sort of reward or motivational system you want to design to accelerate positive behaviors. + +This data is also useful for internal management _and_ external community building. As close watchers can tell, many of the leaders on these charts are employees of the projects' COSS companies, Kong Inc. and StreamNative. It's quite common for active community contributors (or enthusiasts) to become employees of the company commercializing the project. Regardless of where these folks are employed, to foster a sustainable project beyond its initial creators (which in turn would influence the sustainability of the COSS company), you would need to measure, track, and incentivize the same behaviors. + +Also, I'm aware that the Pulsar chart does not have a "reactions" column, which could either be because there wasn't much reaction data to merit a top-10 entry or due to my own faulty configuration of the chart. I apologize for this inconsistency. + +### Tips on driving balanced sustainability + +No matter how pretty the charts are, data doesn't tell the whole story. And no matter how successful a particular project is, its experience should not be templatized and applied directly to a different project. That said, I'd like to share a few actionable tips I've seen work in the wild that can help you improve these two metrics over time: + + * **Provide high-quality documentation:** In a previous article, I focused on [documentation][22], and I encourage you to give it a read. The most important point is: a project's documentation gets the most amount of traffic. It's the place where people decide whether to continue learning about your project or move on. _You never want to give people a reason to move on_. Generally, I recommend spending 10% to 20% of your time writing documentation. Putting it in context: if you are working on your project full-time, it's about half a day to one full day per week. + * **Make your contributor guide a living document:** Every project has a CONTRIBUTING.MD document (or a variation of it). But projects that grow and mature make that document the best it can be and continually refresh, update, and refine it. Why? Because that's where people who are enthusiastic about participating in the project go. If the guide is clear, succinct, and actionable, you'll get contributions in no time. If it's outdated, convoluted, and lacks an easy onramp (e.g., beginner issues, simple bugs, etc.), then that enthusiasm will go somewhere else. _Make your CONTRIBUTING.MD a killer feature_. + * **Set clear quality guidelines:** There _is_ such a thing as a "noisy contribution"—low-quality PRs/MRs that require more energy than it's worth to review (and oftentimes reject). However, the responsibility of communicating to the public what is and is not a "quality contribution" is on you, the creator or maintainer, because you have the most context and institutional knowledge about the project, by far. _Make your expectations clear, and don't compromise on quality._ Make it a prominent section of your CONTRIBUTING.MD or a separate document to give it more visibility. Combine it with your project's roadmap, which should be part of your public documentation anyway, so your new contributors know what's expected of them and why. + + + +I hope this provides some useful insight into the two second-order metrics that matter when building a sustainable open source community and some actionable items you can use to track and improve them. + +* * * + +_This article originally appeared on_ _[COSS Media][23]_ _and is republished with permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/open-source-community-sustainability + +作者:[Kevin Xu][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://opensource.com/users/kevin-xu +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) +[2]: https://opensource.com/article/20/3/community-metrics +[3]: https://softwareengineeringdaily.com/2019/04/04/project-health-assessing-open-source-projects-with-more-context/ +[4]: http://antirez.com/news/129 +[5]: http://antirez.com/news/133 +[6]: https://github.com/Kong/kong +[7]: https://github.com/apache/pulsar +[8]: https://superset.apache.org/ +[9]: https://github.com/mistercrunch +[10]: https://twitter.com/kevinsxu/status/1275072801511059456 +[11]: https://preset.io/blog/2020-04-15-github-community-dashboard/ +[12]: https://opensource.com/sites/default/files/uploads/kongpr-reviews.jpg (Kong PR reviews by GitHub handle) +[13]: https://opensource.com/sites/default/files/uploads/pulsarpr-reviews.jpg (Pulsar's PR reviews by GitHub handle) +[14]: https://github.com/sonicaghi +[15]: https://github.com/subnetmarco +[16]: https://github.com/sijie +[17]: https://github.com/jiazhai +[18]: https://github.com/codelipenghui +[19]: https://www.splunk.com/en_us/blog/leadership/splunk-to-expand-streaming-expertise-announces-intent-to-acquire-streamlio-open-source-distributed-messaging-leader.html +[20]: https://opensource.com/sites/default/files/uploads/kong_leaderboard.jpg (Kong's 90-day leaderboard chart) +[21]: https://opensource.com/sites/default/files/uploads/pulsarleaderboard.jpg (Pulsar's 90-day leaderboard chart) +[22]: https://opensource.com/article/20/3/documentation +[23]: https://coss.media/2-things-to-measure-and-improve-open-source-community-sustainability/ From 739dafb8dd36376dc6c5eab3b419d768c5defefb Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 13 Nov 2020 08:41:21 +0800 Subject: [PATCH 0757/1156] translated --- ...erence Between the Two KDE Distribution.md | 125 ------------------ ...erence Between the Two KDE Distribution.md | 120 +++++++++++++++++ 2 files changed, 120 insertions(+), 125 deletions(-) delete mode 100644 sources/tech/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md create mode 100644 translated/tech/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md diff --git a/sources/tech/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md b/sources/tech/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md deleted file mode 100644 index e596275232..0000000000 --- a/sources/tech/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md +++ /dev/null @@ -1,125 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (KDE Neon vs Kubuntu: What’s the Difference Between the Two KDE Distribution?) -[#]: via: (https://itsfoss.com/kde-neon-vs-kubuntu/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -KDE Neon vs Kubuntu: What’s the Difference Between the Two KDE Distribution? -====== - -When you find two Linux distributions based on [Ubuntu][1] and powered up by [KDE][2], which one do you choose? - - * [Kubuntu][3] is the official KDE flavor from Ubuntu. - * [KDE Neon][4] is the Ubuntu-based distribution by KDE itself. - - - -I know it is often confusing especially if you have never used either of them but got them as recommendations for usage. Hence, to help you make a decision, I thought of compiling a list of differences (and similarities) between KDE Neon and Kubuntu. - -Let’s start with getting to know the similarities and then proceed with the differences. - -**Note:** _Depending on your system, your experience with the distributions might differ. So, take this article as a reference and not a “what’s better” comparison._ - -### KDE Neon vs Kubuntu: Feature wise comparison - -![][5] - -It’s always good to compare distribution based on their similarities. So, theoretically, I’ve tried to put down the most important differences. - -However, it is worth noting that the compatibility, performance, and the stability of the distros will vary depending on your hardware and hence, that has not been accounted here. - -#### Ubuntu as the Base - -![][6] - -Yes, both the Linux distributions are based on Ubuntu. However, KDE Neon is based only on the latest Ubuntu LTS release while Kubuntu offers an Ubuntu LTS based edition and a non-LTS edition as well. - -So, with KDE Neon, you would expect to get your hands on the latest Ubuntu features right after a few months of the next Ubuntu LTS release (2 years). But, with Kubuntu, you have got the option to opt for a non-LTS release and try on the latest Ubuntu releases with 6 months of software updates. - -KDE Neon does offer testing editions and developer editions but those are meant to test pre-release KDE software. - -#### KDE Plasma Desktop - -![][7] - -Even though both of the distros feature KDE plasma desktop and you can get the same level of customization, KDE Neon gets the latest KDE Plasma desktop release first. - -If you did not know already, KDE Neon is developed by the official KDE team and was announced by Jonathan Riddell (Founder of Kubuntu) after he was [forced out of Kubuntu by Canonical][8]. - -So, not just limited to the latest Plasma desktop, but if you want the latest and greatest of KDE as soon as possible, KDE Neon is the perfect choice for that. - -Kubuntu will eventually get the update for newer KDE software — but it will take time. If you’re not too sure about the latest KDE software/desktop and all you need is a stable KDE-powered system, you should go with Kubuntu LTS releases. - -#### Pre-installed Software - -Out of the box, you will find Kubuntu to have several essential tools and applications pre-installed. But, with KDE Neon, you would need to find and install several applications and tools. - -To give you some perspective, KDE Neon might turn out to be a lightweight distro when compared to Kubuntu. However, for new Linux users, they might find Kubuntu as an easy-to-use experience with more essential software and tools pre-installed. - -**Recommended Read:** - -![][9] - -#### [KDE Neon: KDE’s Very Own Linux Distribution Provides the Latest and Greatest of KDE With the Simplicity of Ubuntu][10] - -#### Software Updates - -If you are not using a metered connection, this may not matter at all. But, just for the sake of it, I should mention that KDE Neon gets more software updates considering the regular Ubuntu LTS fixes/updates along with KDE software updates. - -With Kubuntu, you just get the Ubuntu LTS updates (unless you’re using the non-LTS edition). So, technically, you can expect less number of updates. - -#### Ubuntu with KDE vs Plasma Experience - -![][11] - -I know if you haven’t tried both of them, you might think of them as pretty similar. But, Kubuntu is an official flavour of Ubuntu that focused more on the experience with Ubuntu on a KDE desktop environment. - -While KDE Neon is technically the same thing, but it is all about getting the best-in-class Plasma desktop experience with the latest stuff on board. - -Even though both the distributions work amazing out of the box, they have a different vision and the development proceeds on both them accordingly. You just have to decide what you want for yourself and choose one of them. - -#### Hardware Compatibility - -![Kubuntu Focus Laptop][12] - -As I mentioned earlier, this is not a fact-based point here. But, as per my quick look on the feedback or experiences shared by the users online, it seems that Kubuntu works with a wide range of old hardware along with new hardware (potentially dating back to 2012) while KDE Neon may not. - -It’s just a thing to keep in mind if you try KDE Neon and it doesn’t work for some reason. You know what to do. - -**Wrapping Up** - -So, what would it be? KDE Neon or Kubuntu? That’s really is your choice. - -Both are good choices for a [beginner-friendly Linux distribution][13] but if you want the latest KDE Plasma desktop, KDE Neon gets the edge here. You can read more about it in our [review of KDE Neon][10]. - -Feel free to let me know your thoughts in the comments down below and what do you find good/bad on either of them. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/kde-neon-vs-kubuntu/ - -作者:[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://ubuntu.com/ -[2]: https://kde.org/ -[3]: https://kubuntu.org -[4]: https://neon.kde.org -[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/kde-neon-vs-kubuntu.png?resize=800%2C450&ssl=1 -[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/install_ubuntu_8.jpg?resize=796%2C611&ssl=1 -[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/kde-plasma-5-20-feat.png?resize=800%2C394&ssl=1 -[8]: https://lwn.net/Articles/645973/ -[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/kde-neon-review.jpg?fit=800%2C450&ssl=1 -[10]: https://itsfoss.com/kde-neon-review/ -[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/kubuntu-kde.jpg?resize=800%2C450&ssl=1 -[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/kubuntu-focus-laptop.jpg?resize=800%2C600&ssl=1 -[13]: https://itsfoss.com/best-linux-beginners/ diff --git a/translated/tech/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md b/translated/tech/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md new file mode 100644 index 0000000000..247bbb7938 --- /dev/null +++ b/translated/tech/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md @@ -0,0 +1,120 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (KDE Neon vs Kubuntu: What’s the Difference Between the Two KDE Distribution?) +[#]: via: (https://itsfoss.com/kde-neon-vs-kubuntu/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +KDE Neon vs Kubuntu:两款 KDE 发行版有什么区别? +====== + +当你发现两款基于 [Ubuntu][1] 并由 [KDE][2] 驱动的 Linux 发行版,你会选择哪一个? + + * [Kubuntu][3] 是 Ubuntu 的官方 KDE 版本。 + * [KDE Neon][4] 是 KDE 自己发布的基于 Ubuntu 的发行版。 + + + +我知道这常常会让人感到困惑,尤其是当你从来没有使用过这两个版本,但得到了使用它们的建议。因此,为了帮助你做出决定,我想整理了一份 KDE Neon 和 Kubuntu 的区别(和相似之处)。 + +让我们先开始了解相似之处,然后再继续了解不同之处。 + +**注:**_根据你的系统,你对这两个发行版的体验可能有所不同。所以,请把这篇文章作为一个参考,而不是一个”哪个更好“的比较。_ + +### KDE Neon vs Kubuntu:功能上的比较 + +![][5] + +比较发行版相似性来总是好的。所以,从理论上,我试图把最重要的区别写下来。 + +然而,值得注意的是,发行版的兼容性、性能和稳定性会根据你的硬件而有所不同,而这里没有考虑到这一点。 + +#### Ubuntu 作为基础 + +![][6] + +是的,这两个 Linux 发行版都是基于 Ubuntu 的,但 KDE Neon 只基于最新的 Ubuntu LTS 版本,而 Kubuntu 则提供了基于 Ubuntu LTS 的版本和非 LTS 版本。 + +所以,如果使用 KDE Neon,你可以期望在下一个 Ubuntu LTS 版本(2 年)的几个月后就能用上最新的 Ubuntu 功能。但是,对于 Kubuntu 来说,你可以选择一个非 LTS 版本,并尝试使用最新的 Ubuntu 版本的 6 个月的软件更新。 + +KDE Neon 确实提供了测试版和开发者版,但这些都是为了测试预发布的 KDE 软件。 + +#### KDE Plasma 桌面 + +![][7] + +尽管这两个发行版都采用了 KDE plasma 桌面,而且你可以获得相同程度的定制,但 KDE Neon 会首先获得最新的 KDE Plasma 桌面。 + +如果你还不知道,KDE Neon 是由 KDE 官方团队开发的,由 Jonathan Riddell(Kubuntu 创始人)在[被 Canonical 强制退出 Kubuntu][8] 后宣布的。 + +所以,不仅仅局限于最新的 Plasma 桌面,如果你想尽快获得最新最好的 KDE,KDE Neon 是最佳选择。 + +Kubuntu 最终会得到更新的 KDE 软件的更新,但这需要时间。如果你不太确定最新的 KDE 软件/桌面,而你需要的只是一个稳定的 KDE 系统,你应该选择 Kubuntu LTS 版本。 + +#### 预装软件 + +开箱即用,你会发现 Kubuntu 已经预装了一些必要的工具和应用程序,但是,对于 KDE Neon,你需要找到并安装一些应用和工具。 + +为了给你一些视角,与 Kubuntu 相比,KDE Neon 可能是一个轻量级的发行版。然而,对于新的 Linux 用户来说,他们可能会发现 Kubuntu 是一个易于使用的体验,并预装了更多必要的软件和工具。 + + +#### 软件更新 + +如果你没有使用按流量计费的连接,这可能根本不重要。但是,我应该提一下,考虑到常规的 Ubuntu LTS 修复/更新以及 KDE 软件更新,KDE Neon 会得到更多的软件更新。 + +对于 Kubuntu,你只会得到 Ubuntu LTS 的更新(除非你使用的是非 LTS 版本)。所以,从技术上讲,你会得到更少的更新数量。 + +#### Ubuntu KDE 版与 Plasma 的体验差异 + +![][11] + +我知道如果你没有尝试过这两个版本,你可能会认为它们很相似。但是,Kubuntu 是 Ubuntu 的官方版本,它更注重在 KDE 桌面环境上使用 Ubuntu 的体验。 + +而 KDE Neon 在技术上是一样的,但它的目的是为了获得一流的 Plasma 桌面体验,并搭载最新的东西。 + +尽管这两个发行版开箱即可完美工作,但它们有不同的愿景,而开发也相应地进行。你只需要决定你自己想要什么,然后选择其中之一。 + +#### 硬件兼容性 + +![Kubuntu Focus Laptop][12] + +正如我前面提到的,这不是一个基于事实的观点。但是,根据我在网上快速了解用户分享的反馈或经验,似乎 Kubuntu 可以与各种旧硬件以及新硬件(可能追溯到 2012 年)一起工作,而 KDE Neon 可能不能。 + +只需要记住,如果你尝试 KDE Neon,但由于某些原因不能工作。你知道该怎么做。 + +**总结** + +那么,你会选择哪个呢?KDE Neon 还是 Kubuntu?这完全是你的选择。 + +两者都是[初学者友好的 Linux 发行版][13]的不错选择,但如果你想要最新的 KDE Plasma 桌面,KDE Neon 会更有优势。你可以在我们的 [KDE Neon 评测][10]中阅读更多关于它的内容。 + +欢迎在下面的评论中告诉我你的想法,你觉得它们中的任何一个有什么好的/坏的地方。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/kde-neon-vs-kubuntu/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者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://ubuntu.com/ +[2]: https://kde.org/ +[3]: https://kubuntu.org +[4]: https://neon.kde.org +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/kde-neon-vs-kubuntu.png?resize=800%2C450&ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/install_ubuntu_8.jpg?resize=796%2C611&ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/kde-plasma-5-20-feat.png?resize=800%2C394&ssl=1 +[8]: https://lwn.net/Articles/645973/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/kde-neon-review.jpg?fit=800%2C450&ssl=1 +[10]: https://itsfoss.com/kde-neon-review/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/kubuntu-kde.jpg?resize=800%2C450&ssl=1 +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/kubuntu-focus-laptop.jpg?resize=800%2C600&ssl=1 +[13]: https://itsfoss.com/best-linux-beginners/ From 593115551fbabd0bbf3ebe9debf09c02180bf02b Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 13 Nov 2020 08:50:17 +0800 Subject: [PATCH 0758/1156] translating --- .../tech/20201110 What I love about the newest GNOME desktop.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201110 What I love about the newest GNOME desktop.md b/sources/tech/20201110 What I love about the newest GNOME desktop.md index 31b0c2cc12..1404b55975 100644 --- a/sources/tech/20201110 What I love about the newest GNOME desktop.md +++ b/sources/tech/20201110 What I love about the newest GNOME desktop.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 02f011cc78a737433cb2ff609fc2ab70169dde88 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 13 Nov 2020 23:00:43 +0800 Subject: [PATCH 0759/1156] Rename sources/tech/20201109 DevOps Replaces Developers As Most Sought After Skill Set.md to sources/talk/20201109 DevOps Replaces Developers As Most Sought After Skill Set.md\ --- ...evOps Replaces Developers As Most Sought After Skill Set.md\\" | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/tech/20201109 DevOps Replaces Developers As Most Sought After Skill Set.md => "sources/talk/20201109 DevOps Replaces Developers As Most Sought After Skill Set.md\\" (100%) diff --git a/sources/tech/20201109 DevOps Replaces Developers As Most Sought After Skill Set.md "b/sources/talk/20201109 DevOps Replaces Developers As Most Sought After Skill Set.md\\" similarity index 100% rename from sources/tech/20201109 DevOps Replaces Developers As Most Sought After Skill Set.md rename to "sources/talk/20201109 DevOps Replaces Developers As Most Sought After Skill Set.md\\" From fd40ed9d891868645a4bf9998831fcb0ecb198a7 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 13 Nov 2020 23:09:59 +0800 Subject: [PATCH 0760/1156] PRF&PUB:20201102 Understand your Python code with this open source visualization tool.md @chenmu-kk https://linux.cn/article-12819-1.html --- ...ith this open source visualization tool.md | 63 ++++++++----------- 1 file changed, 26 insertions(+), 37 deletions(-) rename {translated/tech => published}/20201102 Understand your Python code with this open source visualization tool.md (57%) diff --git a/translated/tech/20201102 Understand your Python code with this open source visualization tool.md b/published/20201102 Understand your Python code with this open source visualization tool.md similarity index 57% rename from translated/tech/20201102 Understand your Python code with this open source visualization tool.md rename to published/20201102 Understand your Python code with this open source visualization tool.md index 8cbaf0b286..460bdbee1f 100644 --- a/translated/tech/20201102 Understand your Python code with this open source visualization tool.md +++ b/published/20201102 Understand your Python code with this open source visualization tool.md @@ -1,90 +1,79 @@ [#]: collector: "lujun9972" [#]: translator: "xiao-song-123" -[#]: reviewer: " " -[#]: publisher: " " -[#]: url: " " +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12819-1.html" [#]: subject: "Understand your Python code with this open source visualization tool" [#]: via: "https://opensource.com/article/20/11/python-code-viztracer" [#]: author: "Tian Gao https://opensource.com/users/gaogaotiantian" -使用开源可视化工具来理解您的 Python 代码 +使用开源可视化工具来理解你的 Python 代码 ====== -VizTracer 工具可以可视化并跟踪 Python 代码,让您可以更深入地了解其工作原理。 -![Python programming language logo with question marks][1] -随之 Python 项目变得越来越大、越复杂,理解起它来就变得充满挑战性。即使是您自己独自编写了整个项目,也不可能完全知道项目是如何工作的。为了能更好的理解您的代码,调试和分析代码变得至关重要。 +> VizTracer 工具可以可视化并跟踪 Python 代码,让你可以更深入地了解其工作原理。 -[VizTracer][2] 是一个这样的工具,它通过跟踪和可视化 Python 代码的执行过程,来帮助您对代码的理解。无需对源代码进行任何更改,VizTracer 即可记录函数的入口 / 出口,函数参数 / 返回值以及任意变量,然后通过 [Trace-Viewer][3] 使用直观的谷歌前端界面来显示数据。 +![](https://img.linux.net.cn/data/attachment/album/202011/13/225531g64gdav22n6d6va9.jpg) + +随着 Python 项目变得越来越大、越复杂,理解起它来就变得充满挑战性。即使是你自己独自编写了整个项目,也不可能完全知道项目是如何工作的。为了能更好的理解你的代码,调试和分析代码变得至关重要。 + +[VizTracer][2] 是一个这样的工具,它通过跟踪和可视化 Python 代码的执行过程,来帮助你对代码的理解。无需对源代码进行任何更改,VizTracer 即可记录函数的入口 / 出口,函数参数 / 返回值以及任意变量,然后通过 [Trace-Viewer][3] 使用直观的谷歌前端界面来显示数据。 下面是一个运行[蒙特卡洛树搜索][4]的例子: ![Monte Carlo tree search visualization][5] -(Tian Gao, [CC BY-SA 4.0][6]) - -每个函数都在时间线上以堆栈的形式记录和可视化,这样您就可以看到在运行程序时发生了什么。您可以放大查看任意特定点的详细信息: +每个函数都在时间线上以堆栈的形式记录和可视化,这样你就可以看到在运行程序时发生了什么。你可以放大查看任意特定点的详细信息: ![Zooming in on VizTracer visualization][7] -(Tian Gao, [CC BY-SA 4.0][6]) - -VizTracer 还可以自动记录函数参数和返回值。您可以单击功能条目并查看详细信息: +VizTracer 还可以自动记录函数参数和返回值。你可以单击函数条目并查看详细信息: ![Viewing VizTracer details][8] -(Tian Gao, [CC BY-SA 4.0][6]) - -或者您可以创建一个全新的信号,并用它来记录变量。例如,这显示了执行梯度下降时的代价值: +或者你可以创建一个全新的信号,并用它来记录变量。例如,这显示了执行梯度下降时的成本值: ![VizTracer gradient descent][9] -(Tian Gao, [CC BY-SA 4.0][6]) - -与其他设置复杂的工具相比,VizTracer 使用起来非常简单,并且没有任何依赖关系。您可以从 pip 安装它: - +与其他设置复杂的工具相比,VizTracer 使用起来非常简单,并且没有任何依赖关系。你可以从 pip 安装它: ``` -`pip install viztracer` +pip install viztracer ``` -您也可以通过输入来跟踪你的程序 ( `` 是您脚本的名称): - +你也可以通过输入来跟踪你的程序(`` 是你脚本的名称): ``` -`viztracer ` +viztracer ``` -VizTracer 将在您的工作目录中生成一个 HTML 报告,您可以在 Chrome 浏览器中打开它。 - -VizTracer 还提供了其他高级功能,比如过滤器功能,您可以使用它过滤掉不想跟踪的函数,获得更清晰的报告。例如,要仅包含文件中的函数,您需要: +VizTracer 将在你的工作目录中生成一个 HTML 报告,你可以在 Chrome 浏览器中打开它。 +VizTracer 还提供了其他高级功能,比如过滤器功能,你可以使用它过滤掉不想跟踪的函数,获得更清晰的报告。例如,要仅包含文件中的函数,你需要: ``` -`viztracer include_files ./ --run ` +viztracer include_files ./ --run ``` 记录函数参数和返回值: - ``` -`viztracer --log_function_args --log_return_value ` +viztracer --log_function_args --log_return_value ``` -记录与某个正则表达式匹配的任意变量: - +记录与某个正则表达式匹配的任意变量: ``` # log variables starts with a viztracer --log_var a.* --run <your_script.py> ``` -您可以通过对源代码进行较小的修改来获得其他功能,例如自定义事件来记录数值和对象。 +你可以通过对源代码进行较小的修改来获得其他功能,例如自定义事件来记录数值和对象。 -VizTracer 还包括一个虚拟调试器( vdb ),它可以调试 VizTracer 的日志文件。可以用 vdb 调试您运行中的代码 (与 [pdb][10] 非常相似 ) 以便您了解代码流。有用的是,它还支持时间回溯,因为它知道发生的一切。 +VizTracer 还包括一个虚拟调试器(vdb),它可以调试 VizTracer 的日志文件。可以用 vdb 调试你运行中的代码(与 [pdb][10] 非常相似)以便你了解代码流。有用的是,它还支持时间回溯,因为它知道发生的一切。 与一些原型不同,VizTracer 使用纯 C 语言实现其核心,这将极大地减少开销,使其达到类似于 [cProfile][11] 的水平。 -VizTracer 是开源的,在 Apache 2.0 许可下发布,支持所有常见的操作系统平台(Linux、macOS和Windows)。你可以在 [GitHub][2] 上了解关于它的更多特性并访问源代码。 +VizTracer 是开源的,在 Apache 2.0 许可下发布,支持所有常见的操作系统平台(Linux、macOS 和 Windows)。你可以在 [GitHub][2] 上了解关于它的更多特性并访问源代码。 -------------------------------------------------------------------------------- @@ -93,7 +82,7 @@ via: https://opensource.com/article/20/11/python-code-viztracer 作者:[Tian Gao][a] 选题:[lujun9972][b] 译者:[xiao-song-123](https://github.com/xiao-song-123) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a9e0a73c84e0c70f13043aeb0dfada6b08bc1e41 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 13 Nov 2020 23:29:17 +0800 Subject: [PATCH 0761/1156] Rename sources/tech/20201112 Improve open source community sustainability by tracking these two metrics.md to sources/talk/20201112 Improve open source community sustainability by tracking these two metrics.md --- ...urce community sustainability by tracking these two metrics.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20201112 Improve open source community sustainability by tracking these two metrics.md (100%) diff --git a/sources/tech/20201112 Improve open source community sustainability by tracking these two metrics.md b/sources/talk/20201112 Improve open source community sustainability by tracking these two metrics.md similarity index 100% rename from sources/tech/20201112 Improve open source community sustainability by tracking these two metrics.md rename to sources/talk/20201112 Improve open source community sustainability by tracking these two metrics.md From e45c3b450f382c210990b692259de3286da4b148 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 14 Nov 2020 00:16:39 +0800 Subject: [PATCH 0762/1156] PRF @geekpi --- ...Detect New LUNs and SCSI Disks on Linux.md | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/translated/tech/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md b/translated/tech/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md index 9fc298c259..759e8fa671 100644 --- a/translated/tech/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md +++ b/translated/tech/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md @@ -1,20 +1,22 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Scan/Detect New LUNs and SCSI Disks on Linux) [#]: via: (https://www.2daygeek.com/scan-detect-luns-scsi-disks-on-redhat-centos-oracle-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -如何在 Linux 上扫描/检测新的 LUN 和 SCSI 磁盘? +如何在 Linux 上扫描/检测新的 LUN 和 SCSI 磁盘 ====== +![](https://img.linux.net.cn/data/attachment/album/202011/14/001530vgyym7779ys09y7m.jpg) + 当 Linux 系统连接到 SAN(存储区域网络)后,你需要重新扫描 iSCSI 服务以发现新的 LUN。 要做到这一点,你必须向存储团队提供 Linux 主机的 WWN 号和所需的 LUN 大小。 -下文将帮助你[**查找 Linux 主机的 WWN 号**][1]。 +这篇文章将帮助你[查找 Linux 主机的 WWN 号][1]。 当存储团队将 LUN 与给定的 Linux 主机进行了映射,他们将为你提供新的 LUN 详细信息。 @@ -22,9 +24,9 @@ LUN 在存储术语中被称为 LUN 的串行十六进制。 你需要扫描 SCSI 主机来寻找存储团队分配的新 LUN。 -这可以通过两种方式进行,扫描每个 scsi 主机设备或运行 “rescan-scsi-bus.sh” 脚本来检测新磁盘。 +这可以通过两种方式进行,扫描每个 scsi 主机设备或运行 `rescan-scsi-bus.sh` 脚本来检测新磁盘。 -扫描后可以在 “/dev/disk/by-id” 目录下找到它们。 +扫描后可以在 `/dev/disk/by-id` 目录下找到它们。 ``` # ll /dev/disk/by-id @@ -39,9 +41,9 @@ lrwxrwxrwx 1 root root 10 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684e -> . lrwxrwxrwx 1 root root 9 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684f -> ../../sdh ``` -另外,如果你已经用 Multipath 配置了它们,那么可以用 Multipath 命令找到。 +另外,如果你已经用 `multipath` 配置了它们,那么可以用 `multipath` 命令找到。 -Multipath 主要是配置到 Oracle 数据库服务器中,以提高性能。 +`multipath 主要是配置到 Oracle 数据库服务器中,以提高性能。 ``` # multipath -ll @@ -66,21 +68,21 @@ size=512G features='3 queue_if_no_path pg_init_retries 50' hwhandler='1 alua' wp 这个过程适用于基于 Red Hat 6.x、7.x 和 8.x(RHEL - Red Hat Enterprise Linux)的系统,如 CentOS 和 Oracle Linux。 -### 方法 1:如何使用 “/sys” 类文件在 Linux 上扫描新的 LUN 和 SCSI 磁盘 +### 方法 1:如何使用 /sys 类文件在 Linux 上扫描新的 LUN 和 SCSI 磁盘 sysfs 文件系统是一个伪文件系统,它为内核数据结构提供了一个接口。 sysfs 下的文件提供了关于设备、内核模块、文件系统和其他内核组件的信息。 -sysfs 文件系统通常被挂载在 “/sys”。通常,它是由系统自动挂载的。 +sysfs 文件系统通常被挂载在 `/sys`。通常,它是由系统自动挂载的。 -你可以使用 echo 命令来扫描每个 scsi 主机设备,如下所示: +你可以使用 `echo` 命令来扫描每个 SCSI 主机设备,如下所示: ``` # echo "- - -" > /sys/class/scsi_host/host[n]/scan ``` -当你运行上面的重新扫描所有的命令时,三个破折号(“- – -“)指的是通配符选项。这些值如下: +当你运行上面的重新扫描所有的命令时,三个破折号(`- – -`)指的是通配符选项。这些值如下: ``` # echo "c t l" > /sys/class/scsi_host/host[n]/scan @@ -88,12 +90,10 @@ sysfs 文件系统通常被挂载在 “/sys”。通常,它是由系统自动 这里: -* **c –** HBA 上的通道 -* **t –** SCSI 目标 ID -* **l –** LUN ID -* **n –** HBA 编号 - - +* `c`:HBA 上的通道 +* `t`:SCSI 目标 ID +* `l`:LUN ID +* `n`:HBA 编号 运行下面的命令来查找系统中所有的主机总线编号: @@ -110,13 +110,13 @@ host0 host1 host2 # echo "- - -" > /sys/class/scsi_host/host2/scan ``` -另外,还可以用 ”for 循环“用一条命令进行扫描。 +另外,还可以用 `for` 循环用一条命令进行扫描。 ``` # for host in ls /sys/class/scsi_host/;do echo "- - -" >/sys/class/scsi_host/${host}/scan; done ``` -你可以使用文章开头提到的 **[ls 命令][2]**来检查它们。 +你可以使用文章开头提到的 [ls 命令][2]来检查它们。 ``` # ls /dev/disk/by-id | grep -i "serial-hex of LUN" @@ -124,21 +124,21 @@ host0 host1 host2 ### 方法 2:如何使用 rescan-scsi-bus.sh 脚本在 Linux 上扫描新的 LUN 和 SCSI 磁盘 -确保你已经安装了 “sg3_utils” 包来使用这个脚本。否则,运行以下命令来安装它。 +确保你已经安装了 `sg3_utils` 包来使用这个脚本。否则,运行以下命令来安装它。 -对于 **RHEL/CentOS 6/7** 系统,使用 **[yum 命令][3]**安装 sg3_utils。 +对于 RHEL/CentOS 6/7 系统,使用 [yum 命令][3]安装 `sg3_utils`。 ``` # yum install -y sg3_utils ``` -对于 **RHEL/CentOS 8** 和 Fedora 系统,使用 **[dnf 命令][4]**安装 sg3_utils。 +对于 RHEL/CentOS 8 和 Fedora 系统,使用 [dnf 命令][4]安装 sg3_utils。 ``` # dnf install -y sg3_utils ``` -现在你可以使用 rescan-scsi-bus.sh 脚本重新扫描 LUN。 +现在你可以使用 `rescan-scsi-bus.sh` 脚本重新扫描 LUN。 ``` # ./rescan-scsi-bus.sh @@ -151,7 +151,7 @@ via: https://www.2daygeek.com/scan-detect-luns-scsi-disks-on-redhat-centos-oracl 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 86831e740f8a7f4be09cb6e84924f18b2e8b0617 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 14 Nov 2020 00:17:07 +0800 Subject: [PATCH 0763/1156] PUB @geekpi https://linux.cn/article-12820-1.html --- ...105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md (98%) diff --git a/translated/tech/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md b/published/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md similarity index 98% rename from translated/tech/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md rename to published/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md index 759e8fa671..7946201c1d 100644 --- a/translated/tech/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md +++ b/published/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12820-1.html) [#]: subject: (How to Scan/Detect New LUNs and SCSI Disks on Linux) [#]: via: (https://www.2daygeek.com/scan-detect-luns-scsi-disks-on-redhat-centos-oracle-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) From 97051335db572c1219685b4eb989b43aae865169 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 14 Nov 2020 05:02:32 +0800 Subject: [PATCH 0764/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201113?= =?UTF-8?q?=20The=20state=20of=20the=20art=20of=20microservices=20in=20202?= =?UTF-8?q?0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201113 The state of the art of microservices in 2020.md --- ...ate of the art of microservices in 2020.md | 147 ++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 sources/tech/20201113 The state of the art of microservices in 2020.md diff --git a/sources/tech/20201113 The state of the art of microservices in 2020.md b/sources/tech/20201113 The state of the art of microservices in 2020.md new file mode 100644 index 0000000000..0fa6e11733 --- /dev/null +++ b/sources/tech/20201113 The state of the art of microservices in 2020.md @@ -0,0 +1,147 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The state of the art of microservices in 2020) +[#]: via: (https://www.linux.com/news/the-state-of-the-art-of-microservices-in-2020/) +[#]: author: (Linux.com Editorial Staff https://www.linux.com/author/linuxdotcom/) + +The state of the art of microservices in 2020 +====== + +### _“The microservice architectural style is an approach to developing a_ _**single application**_ _as a suite of_ _**small services**_*, each running in its* _**own process and communicating with lightweight mechanisms**_*, often an HTTP resource API. These services are* _**built around business capabilities**_ _and_ _**independently deployable**_ _by_ _**fully automated deployment machinery**_*. There is a bare minimum of centralized management of these services, which may be written in* _**different programming languages**_ _and_ _**use different data storage technologies.**__“_ + +### James Lewis and Martin Fowler (2014) [6] + +## Introduction + +It is expected that in 2020, the global cloud microservices market will grow at a rate of 22.5%, with the US market projected to maintain a growth rate of 27.4% [5]. The tendency is that developers will move away from locally hosted applications and shift into the cloud. Consequently, this will help businesses minimize downtime, optimize resources, and reduce infrastructure costs. Experts also predict that by 2022, 90% of all applications will be developed using microservices architecture [5]. This article will help you to learn what microservices are and how companies have been using it nowadays.  + +## What are microservices? + +Microservices have been widely used around the world. But what are microservices? Microservice is an architectural pattern in which the application is based on many small interconnected services. They are based on the **single responsibility principle**, which according to Robert C. Martin is “gathering things that change for the same reason, and separate those things that change for different reasons” [2]. The microservices architecture is also extended to the **loosely coupled services** that can be **developed, deployed, and maintained independently** [2].  + +## Moving away from monolithic architectures + +Microservices are often compared to traditional monolithic software architecture. In a monolithic architecture, a software is designed to be self-contained, i.e., the program’s components are interconnected and interdependent rather than loosely coupled. In a tightly-coupled architecture (monolithic), each component and its associated components must be present in order for the code to be executed or compiled [7]. Additionally, if any component needs to be updated, the whole application needs to be rewritten. + +That’s not the case for applications using the microservices architecture. Since each module is independent, it can be changed without affecting other parts of the program. Consequently, reducing the risk that a change made to one component will create unanticipated changes in other components.  + +Companies might run in trouble if they cannot scale a monolithic architecture if their architecture is difficult to upgrade or the maintenance is too complex and costly [4]. Breaking down a complex task into smaller components that work independently from each other is the solution to this problem. + +![Monolithic vs. microservices architecture. Image extracted from \[3\].][1] + +## How developers around the world build their microservices + +Microservices are well known for improving _scalability_ and _performance_. However, are those the main reasons that developers around the world build their microservices? The State of Microservices 2020 research project [1] has found out how developers worldwide build their microservices and what they think about it. The report was created with the help of 660 microservice experts from Europe, North America, Central and South America, the Middle East, South-East Asia, Australia, and New Zealand. The table below presents the average rating on questions related to the maturity of microservices [1].  + +**Category** | **Average rating (out of 5)** +---|--- +Setting up a new project | 3.8 +Maintenance and debugging | 3.4 +Efficiency of work | 3.9 +Solving scalability issues | 4.3 +Solving performance issues | 3.9 +Teamwork | 3.9 + +  + +As observed on the table, most experts are happy with microservices for solving scalability issues. On the contrary, maintenance and debugging seem to be a challenge for them. + +According to their architecture’s leading technologies, most experts reported that they use Javascript/Typescript (almost ⅔ of microservices are built on those languages). In the second place, they mostly use Java. + +Although there are plenty of options to choose to deploy microservices, most experts use Amazon Web Services (49%), followed by their own server. Additionally, 62% prefer AWS Lambda as a serverless solution. + +Most microservices used by the experts use HTTP for communication, followed by events and gRPC. Additionally, most experts use RabbitMQ for message-brokers, followed by Kafka and Redis. + +Also, most people work with microservices continuous integration (CI). In the report, 87% of the respondents use CI solutions such as GitLab CI, Jenkins, or GitHub Actions. + +The most popular debugging solution among 86% of the respondents was logging, in which 27% of the respondents ONLY use logs.  + +Finally, most people think that microservice architecture will become either a standard for more complex systems or backend development. + +## Successful use cases of Microservices + +Many companies have changed from a monolithic architecture to microservices.  + +### Amazon + +In 2001, development delays, coding challenges, and service interdependencies didn’t allow Amazon to address its growing user base’s scalability requirements. With the need to refactor their monolithic architecture from scratch, Amazon broke its monolithic applications into small, independent, and service-specific applications [3][9]. + +In 2001, Amazon decided to change to microservices, which was years before the term came into fashion. This change led Amazon to develop several solutions to support microservices architectures, such as Amazon AWS. With the rapid growth and adaptation to microservices, Amazon became the most valuable company globally, valued by market cap at $1.433 trillion on July 1st, 2020 [8]. + +### Netflix + +Netflix started its movie-streaming service in 2007, and by 2008 it was suffering scaling challenges. They experienced a major database corruption, and for three days, they could not ship DVDs to their members [10]. This was the starting point when they realized the need to move away from single points of failure (e.g., relational databases) towards a more scalable and reliable distributed system in the cloud. In 2009, Netflix started to refactor its monolithic architecture into microservices. They began by migrating its non-customer-facing, movie-coding platform to run on the cloud as an independent microservices [11]. Changing to microservices allowed Netflix to overcome its scaling challenges and service outages. Despite that, it allowed them to reduce costs by having cloud costs per streaming instead of costs with a data center [10]. Today, Netflix streams approximately 250 million hours of content daily to over 139 million subscribers in 190 countries [11]. + +### Uber + +After launching Uber, they struggled to develop and launch new features, fix bugs, and rapidly integrate new changes. Thus, they decided to change to microservices, and they broke the application structure into cloud-based microservices. In other words, Uber created one microservice for each function, such as passenger management and trip management. Moving to microservices brought Uber many benefits, such as having a clear idea of each service ownership. This boosted speed and quality, facilitating fast scaling by allowing teams to focus only on the services they needed to scale, updating virtual services without disrupting other services, and achieving more reliable fault tolerance [11]. + +## It’s all about scalability! + +A good example of how to provide scalability is by looking at China. With its vast number of inhabitants, China had to adapt by creating and testing new solutions to solve new challenges at scale. Statistics show that China serves roughly 900 million Internet users nowadays [14]. During the 2019 Single’s Day (the equivalent of Black Friday in China), the peak transaction of Alibaba’s various shopping platforms was 544,00 transactions per second. The total amount of data processed on Alibaba Cloud was around 970 petabytes [15]. So, what’s the implication of these numbers of users in technology? + +Many technologies have emerged from the need to address scalability. For example, [Tars][2] was created in 2008 by Tencent and [contributed to the Linux Foundation in 2018][3]. It’s being used at scale and enhanced for ten years [12]. Tars is open source, and many organizations are significantly contributing and extending the framework’s features and value [12]. Tars supports multiple programming languages, including C++, Golang, Java, Node.js, PHP, and Python; and it can quickly build systems and automatically generate code, allowing the developer to focus on the business logic to improve operational efficiency effectively. Tars has been widely used in Tencent’s QQ, WeChat social network, financial services, edge computing, automotive, video, online games, maps, application market, security, and many other core businesses. [In March of 2020, the Tars project transitioned into the TARS Foundation][4], an open source microservice foundation to support the rapid growth of contributions and membership for a community focused on building an open microservices platform [12]. + +**Be sure to check out the Linux Foundation’s new free training course,** [Building Microservice Platforms with TARS][5] + +*About the authors: * + +_Isabella Ferreira is an Advocate at TARS Foundation,_ a cloud-native open-source microservice foundation under the Linux Foundation*. * + +*Mark Shan is Chairman at Tencent Open Source Alliance and also Board Chair at TARS Foundation. * + +**References:** + +[1] + +[2] + +[3] + +[4] + +[5] + +[6] + +[7] + +[8] + +[9] + +[10] + +[11] + +[12] + +[13] + +[14] + +[15] + +#### _This Linux Foundation Platinum Sponsor content was contributed by Tencent._ + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/news/the-state-of-the-art-of-microservices-in-2020/ + +作者:[Linux.com Editorial Staff][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://www.linux.com/author/linuxdotcom/ +[b]: https://github.com/lujun9972 +[1]: https://www.linux.com/wp-content/uploads/2020/11/microservices_diagram_a.png +[2]: https://tarscloud.org/foundation/index +[3]: https://www.linuxfoundation.org/press-release/2018/06/tars-and-tseer-form-open-source-project-communities-under-the-linux-foundation-to-expand-adoption-and-pace-of-development/ +[4]: https://www.linuxfoundation.org/blog/2020/03/the-tars-foundation-the-formation-of-a-microservices-ecosystem/ +[5]: https://www.edx.org/course/building-microservice-platforms-with-tars From d9eef39577a1f32b6f117f56619a10b7101ee6c3 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 14 Nov 2020 05:03:11 +0800 Subject: [PATCH 0765/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201114?= =?UTF-8?q?=20How=20to=20Install=20Fedora=20in=20VirtualBox=20[With=20Step?= =?UTF-8?q?s=20for=20USB,=20Clipboard=20and=20Folder=20Sharing]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md --- ...s for USB, Clipboard and Folder Sharing.md | 275 ++++++++++++++++++ 1 file changed, 275 insertions(+) create mode 100644 sources/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md diff --git a/sources/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md b/sources/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md new file mode 100644 index 0000000000..1d5095113f --- /dev/null +++ b/sources/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md @@ -0,0 +1,275 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Install Fedora in VirtualBox [With Steps for USB, Clipboard and Folder Sharing]) +[#]: via: (https://itsfoss.com/install-fedora-in-virtualbox/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +How to Install Fedora in VirtualBox [With Steps for USB, Clipboard and Folder Sharing] +====== + +If you are curious about Fedora Linux, there are several ways to try it. + +The easiest way that won’t affect your current operating system is to [create a live USB of Fedora.][1] + +An alternative way to try Fedora, is to get advantage of virtualization technology through an installation in VirtualBox. This way, you use Fedora like an application on your current operating system. + +This way, you can perform more thorough testing without messing up your current operating system. + +You can even copy your virtual setup and re-install it on some other system. Sounds handy? Let me show you how to do it. + +### Installing Fedora in VirtualBox + +![][2] + +Let’s see the steps for installing Fedora Linux in Oracle VirtualBox. + +#### Step 1: Install VirtualBox + +If you haven’t already installed VirtualBox on your system, you can download it from the official website. You can find instructions for Windows, Mac OS and Linux. [Ubuntu users can refer to this detailed tutorial on installing VirtualBox][3]. + +![][4] + +[Download VirtualBox][5] + +#### **Step 2: Download the Fedora ISO** + +If you are not familiar with fedora, there are a few images to be aware of. + +[Fedora IoT][6] is to be used for scalable infrastructure, [Fedora workstation][7] is an image with a set of tools oriented for a desktop in a vanilla GNOME desktop environment and [Fedora server][8] as its name reveals, is tailored for a server or data center. + +If GNOME isn’t your first choice, you can download a [spin][9] of Fedora desktop with an alternative desktop environment. For this tutorial, I chose [Fedora 33][10] with the GNOME desktop environment. + +[Download Fedora][11] + +#### Step 3: Create an empty virtual machine and configure it + +Fedora requires a minimum of 20GB disk space & 2GB RAM, to install and run successfully. Although double those amounts is recommended for a smoother user experience. Based on that I will create and configure the virtual machine. + +Start Virtual Box and click on New. + +![Create a new virtual machine][12] + +The most important option to pay attention, is the **type to be set to Linux and the version to Fedora (64-bit)**. If you start typing Fedora at the name prompt, VirtualBox will automatically pick the correct settings for you. Although the name doesn’t have to be Fedora, it can be anything you like. + +_If you have access to 32-bit version only, you need to enable virtualization technology on BIOS, if you have an AMD CPU it is called SVM. Worst-case scenario is that your CPU doesn’t support virtualization technology. If you are not sure, check this first._ + +Once you have similar settings with me, click on the create button. + +![Name your VM and assign it at least 3 GB RAM][13] + +As mentioned before, you need at least 20 GB of disk space to be able to install Fedora. I have 32 GB of RAM on my system so I assigned 8 GB here. You should be fine with 3 GB of RAM. + +A word about RAM consumption, the RAM will only be consumed by the virtual machine when you are running it. Otherwise, it will be available for regular usage. + +Make sure that the rest of the settings match the example and click Create. + +![Assign 15-20 GB of disk space in VDI format][14] + +Before you click the start button of your virtual machine, you need to load the ISO as shown below [Optical Drive]. + +![Add the Fedora ISO to optical drive storage][15] + +As your virtual hard drive is empty, the virtual machine will boot from this ISO. Think of it as using a live USB or disk for installing Linux. + +![Go to Settings and add ISO as optical drive][16] + +Then, if you have a multi-core CPU it is recommended to assign 2 or more cores for your virtual machine. You may find the CPU cores under the system tab. When you configure your system click ok and start the virtual machine. + +![Optional step: Assign number of CPU cores][17] + +Once you have configured everything, click on the start button to begin the installation. + +#### Step 4: Install Fedora in VirtualBox + +If you have followed the process correctly, when you start the virtual machine you will boot directly from the ISO file. When you see a similar to below screen select Start Fedora, and press the enter key. + +![Fedora running in live environment in virtual machine][18] + +To start the installation dialog box, click on Install to Hard Drive. + +![Click on “install to hard drive”][19] + +Before you proceed to the installation, it is essential to define your keyboard layout, your timezone and finally where the operating system will be installed. + +![Choose keyboard, time and date and then go to Installation Destination][20] + +The partitioning process is straight forward. You made some free space as VDI earlier. It should be automatically recognized. + +Select your disk and set the storage configuration to automatic. Click on Done to go to the previous dialog box. + +![Disk should be automatically recognized][21] + +Once you have configured the above, click on “Begin Installation”. + +![Begin installation of Fedora][22] + +Now you just need to wait for five-six minutes for installation completion. Click on the “Finish installation” button when installation is finished. + +As a last step, you need to power off your system. If you are unfamiliar with the GNOME desktop environment you can do it like so. + +![Turn off Fedora live environment after installation][23] + +You have to manually unload the ISO file that you loaded at the initial steps. + +![Remove Fedora ISO From Optical Drive][24] + +The next time you start the virtual machine with Fedora, you will be prompted to create a user account and set your password for Fedora Linux. + +### Use VirtualBox guest additions for additional features like clipboard sharing, folder sharing and more + +[Guest Additions][25] are designed to be installed inside a virtual machine post installation of the guest operating system. They contain device drivers and system applications that optimize the guest operating system for better performance and usability. + +The Guest Additions ISO file is mounted as a virtual CD-ROM in order to be installed. + +This is a straightforward process. Simply click on the devices tab and then click on “Insert Guest Additions CD image” + +![][26] + +You will be prompted to download the guest additions image, when prompt click on Download. + +![Install VirtualBox Guest Additions][27] + +#### **Shared clipboard** + +At some point you’ll need to move some content between your virtual machine and the host operating system. The shared clipboard/drag and drop support will allow you to copy items on one platform and paste them on the other. + +To enable this feature, choose **Settings** on the VirtualBox home page and follow the instructions as below. I find the **Bidirectional** option the most convenient. + +![Enable clipboard sharing between guest and host systems][28] + +#### **Shared folders** + +There are two types of shares: + + * Permanent shares, that are saved with the Virtual Machine settings. + * Transient shares, that are disappear when the Virtual Machine is powered off. These can be created using a checkbox in the VirtualBox Manager. + + + +In this tutorial, I will make a permanent shared folder. In the VM settings add the host system folder you want to share and choose the name that you want to appear at your VM. + +![][29] + +The next time you start the virtual machine, the folder should appear as a network drive. + +![][30] + +#### **Better video support** + +While the virtual graphics card which Oracle VirtualBox provides all the basic features, the custom video drivers that are installed with the Guest Additions provide you with extra high and non-standard video modes, as well as accelerated video performance. + +Using Guest Additions, the guest OS’s resolution will dynamically resize as you adjust the VirtualBox window on your computer. + +Finally, Guest Additions can take advantage of your computer’s graphics card. If you’re a gamer or using productivity software in a WM, this makes a huge difference. + +#### USB and Network Devices sharing + +With VirtualBox, users have the ability to use a fully-functional operating system, without having to do the setup on different hardware. However, sharing USB and network devices between the host and guest machine is not as straightforward as it should be. + +To access USB devices, you will need to install [the VirtualBox extension pack][31]. + +![Install VirtualBox Extensions pack][32] + +_**This is for Linux only**_ because I am using all this in Linux. + +In order for VirtualBox to have access to the USB subsystem, the user (on host system) running VirtualBox must belong to the vboxuser group. To do this, open up a terminal and issue the following command: + +``` +sudo usermod -aG vboxusers 'your username' +``` + +Once you run the command, you should either log out and log back in, or restart your host machine. + +At this step, plug in your USB stick and through your VM settings you should be able to find and add the medium as shown at the example. + +![][33] + +Your USB will be accessible the next time you start your virtual machine. + +![][34] + +### Bonus Tip: Save and export the Virtual Machine so that you can use it later on any system + +You may want to use your virtual machine to another computer or it is time to build a new machine and you need to keep your virtual machine as it is. You can easily export your current setup and import it to another machine at a few easy steps. + +At the VirtualBox home panel, click on file and the export appliance. If you prefer keyboard shortcuts, you can simply click **Ctrl+E**. + +![][35] + +Choose the virtual machine you want to export and click on next. + +![][36] + +The Format option needs some attention. There are three different options of Open Virtualization Format 0.9, 1.0 and 2.0, which can be either ovf or ova extensions. + +With ovf extension, several files will be written separately, compared to ova extension, which combines all the files into one Open Virtualization Format archive. + +The default format, Open Virtualization Format 1.0, should be fine. + +![][37] + +To finish the process, click next and at the next dialog box click export. + +#### Conclusion + +By using a virtual machine you can’t just test an operating system but deploy a fully functioning system, equally comparable to a physical machine. Nowadays, hardware has become so powerful and affordable that most of its power is not being utilized. + +Through virtualization technology, you can use those wasted resources. The need for physical machines is reduced, and consequently the energy consumption is less. You can save money both from hardware and reduced running costs. + +On a larger scale, server virtualization is more of a basic requirement than an advanced concept. + +I hope you found this tutorial helpful in installing Fedora Linux in VirtualBox. If you face any issues, please let me know in the comments. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-fedora-in-virtualbox/ + +作者:[Dimitrios Savvopoulos][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/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/create-fedora-live-usb-ubuntu/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/install-fedora-in-virtualbox.png?resize=800%2C450&ssl=1 +[3]: https://itsfoss.com/install-virtualbox-ubuntu/ +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/download-virtulabox.jpg?resize=799%2C294&ssl=1 +[5]: https://www.virtualbox.org/ +[6]: https://getfedora.org/en/iot/ +[7]: https://getfedora.org/en/workstation/ +[8]: https://getfedora.org/en/server/ +[9]: https://spins.fedoraproject.org/ +[10]: https://itsfoss.com/fedora-33/ +[11]: https://getfedora.org/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/0.-create-a-new-vm.png?resize=800%2C550&ssl=1 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/1-create-vm-fedora.png?resize=800%2C533&ssl=1 +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/2-fedora-vm-disk.png?resize=800%2C533&ssl=1 +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/fedora-vm-settings-iso.png?resize=800%2C640&ssl=1 +[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/3-fedora-vm-settings2.png?resize=800%2C600&ssl=1 +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/4-fedora-vm-cpu.png?resize=800%2C533&ssl=1 +[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/6-fedora-vm-boot.png?resize=800%2C600&ssl=1 +[19]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/7-fedora-vm-install-1.png?resize=800%2C622&ssl=1 +[20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/9-fedora-vm-partitioning-2.png?resize=800%2C706&ssl=1 +[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/10-fedora-vm-hdd.png?resize=732%2C645&ssl=1 +[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/12-fedora-vm-installation-1.png?resize=800%2C706&ssl=1 +[23]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/15-power-off-fedora-gnome.png?resize=800%2C706&ssl=1 +[24]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/remove-fedora-iso-from-optical-drive.png?resize=800%2C589&ssl=1 +[25]: https://www.virtualbox.org/manual/ch04.html +[26]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/16-Fedora-vm-guest-additions.png?resize=800%2C706&ssl=1 +[27]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/17-Fedora-vm-guest-additions.png?resize=800%2C686&ssl=1 +[28]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/19-fedora-vm-shared-clipboard-2.png?resize=800%2C650&ssl=1 +[29]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/20-fedora-vm-shared-folders-1.png?resize=800%2C650&ssl=1 +[30]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/22-fedora-vm-shared-folders2-1.png?resize=800%2C547&ssl=1 +[31]: https://download.virtualbox.org/virtualbox/6.1.16/Oracle_VM_VirtualBox_Extension_Pack-6.1.16.vbox-extpack +[32]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/21.-fedora-vm-extension-pack.png?resize=800%2C600&ssl=1 +[33]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/25.-fedora-vm-usb-1.png?resize=800%2C527&ssl=1 +[34]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/26.-fedora-vm-usb-1.png?resize=800%2C578&ssl=1 +[35]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/23.-fedora-vm-export.png?resize=800%2C600&ssl=1 +[36]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/24.-fedora-vm-export-1.png?resize=800%2C545&ssl=1 +[37]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/25.-fedora-vm-export-800x545.png?resize=800%2C545&ssl=1 From 901bd20d410822034b58d2b5011574127b9b65fe Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 14 Nov 2020 05:03:32 +0800 Subject: [PATCH 0766/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201113?= =?UTF-8?q?=20How=20to=20create=20trust=20in=20artificial=20intelligence?= =?UTF-8?q?=20using=20open=20source?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201113 How to create trust in artificial intelligence using open source.md --- ...tificial intelligence using open source.md | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 sources/tech/20201113 How to create trust in artificial intelligence using open source.md diff --git a/sources/tech/20201113 How to create trust in artificial intelligence using open source.md b/sources/tech/20201113 How to create trust in artificial intelligence using open source.md new file mode 100644 index 0000000000..9c9340d3fc --- /dev/null +++ b/sources/tech/20201113 How to create trust in artificial intelligence using open source.md @@ -0,0 +1,60 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to create trust in artificial intelligence using open source) +[#]: via: (https://opensource.com/article/20/11/ai-open-source) +[#]: author: (Rebecca Whitworth https://opensource.com/users/rsimmond) + +How to create trust in artificial intelligence using open source +====== +Opening up the "black box" helps remove uncertainties about AI outcomes, +providing insight into the modeling process and identifying biases and +errors. +![Brain on a computer screen][1] + +Artificial intelligence (AI) is being used more frequently in our daily lives, with systems such as Siri and Alexa becoming commonplace in many households. Many households themselves are "smart," powered by devices that can control your lights, heating and air, and even the music playing. And those music players are powered by AI that recommends songs and artists you may like. + +However, these systems are often referred to as "black box" systems because we do not know how the data is processed—how do the users know why the model has made that prediction? The advent and widespread adoption of deep neural networks, while providing impressive results, made this even more critical, since humans can't logically interpret how information is processed within thousands of neurons. + +A more safety-critical example of AI systems is when doctors use them to reduce stress loads. These systems do this by quickly ingesting data at a rapid rate; for example, thousands of medical journals could be read and parsed by AI exponentially faster than by a human. This data can then be used to train predictive models, which are used to help doctors diagnose patients, this time armed with far more data points than were available before and in a quicker time. People assume that, with all this information, a machine can make "better" decisions than humans. However, how can we trust a machine to make such critical decisions when we do not fully understand the data processing techniques? + +Open source supports many methods and applications that can lead to better trust in AI systems. In this article, we will explore some of those open source projects as well as the open source mentality, and how by becoming part of the open source community, you can gain more trust in your AI. + +Projects like [LIME][2] and [SHAP][3], which are open source, can explain the outcome of a prediction. To illustrate how this works, let's look at a loan request use case. Based on an AI outcome, a bank rejects a customer who has made a loan request, but why did the algorithm return that outcome? Projects like these aim to make the model more explainable by showing feature importance graphs, i.e., which features were significant to the outcome of the model. Features are the inputs that generate the prediction. In this example, if an important feature used to reject the loan had been "gender," then this would mean the model is biased or incorrect. If the model is known to be wrong, then retraining it will give improved predictions. + +These projects help to build trust in AI systems by explaining the black box model and introspecting decision-making. By open sourcing projects such as this, we can ensure confidence in the system due to the openness of the predictive modeling process. It can give stakeholders confidence that the model is correct and that its recommendations can be trusted, so there is less business risk. + +Open source can stop unfairness, such as the gender-bias example above, by iteratively testing the system's potential outcomes quickly and effectively. If the model is biased, then a notification to the community can be made in a timely fashion, as there are more developers in the community than there would be if the project was closed source. Therefore, if there is trust in the community, then there can be trust in the system. + +Open source platforms leverage ideas from a broad group of peers and offer greater opportunity to innovate and create worthwhile features in a system. These ideas focus the project in a user-driven direction, and improvements come from the developers/users themselves. The system is trustworthy because it has a user-centric design pattern and fosters knowledge of system development and execution. Essentially, the people who have made the system can trust the system. + +When an AI system fails, people may be offended or misled. The project or organization loses people's confidence, and it creates distrust of the system overall. Credibility can be protected by making an AI project open source, because with more testers in the community, the more the data and performance can be verified. + +By leveraging the community-focused nature of open source, we can also ensure that more people with a wider variety of skill sets routinely check the codebase. Predictive models are very good at recognizing patterns; however, they can fail when faced with an outlier. Humans, on the other hand, are very good at being able to recognize and respond to anomalies and nuance. Therefore, having humans involved in the AI system is integral to stopping mistakes, which, in the example use case of the doctor, could actually be deadly. It is essential to have domain experts to check the system's outcomes, and the more, the better. + +Community-focused feature development can also improve trust by ensuring that the project meets company regulations. The community can include stakeholders from the business who can then lead the development focus and reduce business risk. + +A closed approach to AI can lead to inadequate feature design choices that are not relevant to the current needs of the community and businesses. Such features can be harmful to the system; for example, if a medical system's patient diagnostic function has poor accuracy due to lack of testing, then this will mean more human intervention and, ultimately, less trust. + +A closed approach can also stifle creativity and freedom to develop innovative ideas, and it stops the feedback loop on ideas from community users or people outside of the company. A feedback loop is useful, as the people who are developing it have a greater knowledge of the system and how it works, and if the community knows it works, then they are more likely to use it. + +Trusting AI can be hard when people use black box models, due to the lack of understanding of what they are doing and how they work. Open source mentality and models help users and developers to create more trust in AI by opening up the black box, encouraging iterative and collaborative development, and using the community to ensure proper functionality and fewer bugs. Open source allows AI to reach its potential in a trustworthy and meaningful way for users. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/ai-open-source + +作者:[Rebecca Whitworth][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://opensource.com/users/rsimmond +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/brain_computer_solve_fix_tool.png?itok=okq8joti (Brain on a computer screen) +[2]: https://github.com/marcotcr/lime +[3]: https://github.com/slundberg/shap From a3f91c3d68dc14398fe0a61eb5ed8a21ff32e694 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 14 Nov 2020 05:03:43 +0800 Subject: [PATCH 0767/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201113?= =?UTF-8?q?=203=20ways=20managers=20build=20team=20culture=20around=20open?= =?UTF-8?q?=20source?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201113 3 ways managers build team culture around open source.md --- ...s build team culture around open source.md | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 sources/tech/20201113 3 ways managers build team culture around open source.md diff --git a/sources/tech/20201113 3 ways managers build team culture around open source.md b/sources/tech/20201113 3 ways managers build team culture around open source.md new file mode 100644 index 0000000000..b7f52a78aa --- /dev/null +++ b/sources/tech/20201113 3 ways managers build team culture around open source.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 ways managers build team culture around open source) +[#]: via: (https://opensource.com/article/20/11/selfless-culture) +[#]: author: (Shishir Kamboj https://opensource.com/users/shishirkamboj) + +3 ways managers build team culture around open source +====== +Contributing to open source prevents complacency and teaches people the +value of giving to the greater good. +![Teammates shaking hands and smiling in an office][1] + +Whether you are a senior leader or an individual contributor, you make decisions based on your personal, peers', and colleagues' experiences and feedback. If the people around you are evolving, you will grow with them, as will the organization you support. If the backgrounds and knowledge of the people around you are diverse and changing, you and your team will benefit. + +I've noticed that my skillset and contributions give diminishing returns if I am not challenged. Human beings tend to get into their comfort zones quickly. We get used to working a certain way, and we start to depend on key people to make decisions for us. This leads to complacency, which does not change unless we are challenged due to market shifts or other external forces. + +A selfless approach contributes to growth in career and skillsets as well as helps others grow. When we not only promote ourselves but the right person for the right job, we can be better team players. Our focus becomes what is right for the organization, not what is right for us. It helps both individuals and organizations when we are more flexible and ready for change. + +The big question is: How can you create opportunities for change and create a selfless approach on your team? It may be difficult to ask your employees to be completely selfless. But as leaders, we can align our teams' and employees' growth to the organization's development. The following are a few ways to achieve this. + +### 1\. Help employees create a career + +Invest in your teams. Set a career path for each team member. You may find employees who are happy working on the same things year after year. While I agree that it is essential to have expertise, this can easily lead to complacency and hoarding. I see these as significant concerns. + +When you like what you do, you can excel at it. You should achieve consistent improvement in the knowledge and exposure you get. It helps if you have a forte in an area where you are a point person across the board. At the same time, it's essential to move forward while looking for new avenues to contribute. Working on open source software is an excellent way to make that happen. + +In one of my earlier roles, I led an infrastructure services team. For a long time, this group focused on data center design, hardware, and network engineering. As cloud services started emerging, the team found itself in an identity crisis. The group had not added any new skill sets over the previous few years. The team's motivation scores were at an all-time low. Work became more limited as deployments shrunk to legacy applications. + +It was imperative to invest in the team to help boost morale and connect with the company's vision. The team members needed to see how they added to the company's growth while gaining knowledge and new skills. + +As we investigated our customers' pain points and their needs, we realized an open source strategy around cloud computing would be an ideal investment area. The team's experience made the transition challenging, but the members were ready for the change. The group swiftly jumped on the initiative and brought much success to themselves and the organization. + +Carving out time for your team to work on open source software and contribute upstream is a great way to put your team members out there and help them gain different experiences while working with the broader community. It is imperative for leadership to move team members around to transition them to something new. It is also necessary to remind your team that every initiative, technology, or project follows a curve that starts with innovation, then shows heightened expectation, goes into a growth phase, and eventually declines. + +This point is even more critical for managers and leaders. Sometimes I see leaders who are stuck in the status quo. A leader's attitude can impact a team's culture—negatively or positively. + +### 2\. Correlate the team's success with the organization's success + +Leaders can motivate teams by showing appreciation to contributors. It is critical for teams to understand the impact their work has on customers and the world. It's also vital for them to correlate their role with the company's success. Every employee should know the value they bring to the table. + +Understanding the financial value your team brings to the company is part of this. Share how the product or service your team provides contributes to revenue. This will show how your team how critical their product or service is for your customers and how it impacts the customer experience. This has really worked for me and the teams I lead. + +### 3\. Bring pride to what you do + +Bringing pride to your work is a crucial element in developing ownership. If you take pride in what you do, you will enjoy it more. Employees who are proud of their work will be more eager to share and also look for ways to improve. As a manager or leader, it is your responsibility to bring visibility to your team's work. Appreciation for your team goes a long way, especially if you show your gratitude in front of the broader organization. + +Open source community participation can provide opportunities to contribute to a greater good, give visibility to your work, challenge your thought process, and drive you to think out of the box. What suggestions do you have to helping teams overcome complacency and become more selfless? Please share your thoughts in the comments.  + +Learn how companies can get started in contributing to open source projects, including encouraging... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/selfless-culture + +作者:[Shishir Kamboj][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://opensource.com/users/shishirkamboj +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/handshake_teamwork_meeting_office_space.png?itok=6H0GEyoc (Community and team smiling) From cd04f915eb86cc5c3ace18ec4ce1cbe7d0243223 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 14 Nov 2020 06:56:09 +0800 Subject: [PATCH 0768/1156] PRF @lxbwolf --- ...with this MariaDB and MySQL cheat sheet.md | 131 ++++++++---------- 1 file changed, 55 insertions(+), 76 deletions(-) diff --git a/translated/tech/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md b/translated/tech/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md index a3e1c0b339..4d396aee77 100644 --- a/translated/tech/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md +++ b/translated/tech/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md @@ -1,17 +1,18 @@ [#]: collector: "lujun9972" [#]: translator: "lxbwolf" -[#]: reviewer: " " +[#]: reviewer: "wxy" [#]: publisher: " " [#]: url: " " [#]: subject: "Improve your database knowledge with this MariaDB and MySQL cheat sheet" [#]: via: "https://opensource.com/article/20/10/mariadb-mysql-cheat-sheet" [#]: author: "Seth Kenlon https://opensource.com/users/seth" -使用这个 MariaDB 和 MySQL 备忘单提升你的数据库技能 +备忘单:提升你的 MariaDB 和 MySQL 数据库技能 ====== -阅读本文并下载我们的免费备忘单,去使用开源的数据库吧。 -![Cheat Sheet cover image][1] +> 阅读本文并下载我们的免费备忘单,去使用开源的数据库吧。 + +![](https://img.linux.net.cn/data/attachment/album/202011/14/065421hq1qocmk3rf4npq1.jpg) 当你写一个程序或配置一个服务时,你最终都要持久化存储信息。有时候,你只需要一个 INI 或者 [YAML][2] 配置文件就够了。而有时候,一个自定义格式的 XML 或者 JSON 或其他类似的文件会更好。 @@ -25,7 +26,6 @@ 你可以使用 `mysql` 命令与 MariaDB 进行交互。首先使用子命令 `ping` 确认你的服务是运行着的,在提示后输入密码: - ``` $ mysqladmin -u root -p ping Enter password: @@ -34,7 +34,6 @@ mysqld is alive 为了易于读者理解,打开一个交互式的 MariaDB 会话: - ``` $ mysql -u root -p Enter password: @@ -44,20 +43,19 @@ Commands end with ; or \g. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. -MariaDB [(none)]> +MariaDB [(none)]> ``` -你现在是在一个 MariaDB 子 shell 中,提示框是 MariaDB 提示框。普通的 Bash 命令在这里不能使用,只能用 MariaDB 命令。输入 `help` (或 `?`)查看命令列表。这些是你的 MariaDB shell 的管理命令,使用它们可以定制你的 shell,但它们不属于 SQL 语言。 +你现在是在一个 MariaDB 子 shell 中,提示符是 MariaDB 提示符。普通的 Bash 命令在这里不能使用,只能用 MariaDB 命令。输入 `help` (或 `?`)查看命令列表。这些是你的 MariaDB shell 的管理命令,使用它们可以定制你的 shell,但它们不属于 SQL 语言。 ### 学习 SQL 基本知识 -[结构化查询语言][8] 是基于它们的能力定义的:一种通过有规则且一致的语法来查询数据库中的内容得到有用的结果的方法。SQL 看起来像是普通的英文语句,有一点点生硬。例如,如果你登入数据库服务器,想查看有哪些库,输入 `SHOW DATABASES;` 并回车就能看到结果。 +[结构化查询语言][8]是基于它们的能力定义的:一种通过有规则且一致的语法来查询数据库中的内容以得到有用的结果的方法。SQL 看起来像是普通的英文语句,有一点点生硬。例如,如果你登入数据库服务器,想查看有哪些库,输入 `SHOW DATABASES;` 并回车就能看到结果。 SQL 命令以分号作为结尾。如果你忘记输入分号,MariaDB 会认为你是想在下一行继续输入你的查询命令,在下一行你可以继续输入命令也可以输入分号结束命令。 - ``` -MariaDB [(NONE)]> SHOW DATABASES; +MariaDB [(NONE)]> SHOW DATABASES; +--------------------+ | DATABASE | +--------------------+ @@ -69,32 +67,29 @@ MariaDB [(NONE)]> SHOW DATABASES; 4 ROWS IN SET (0.000 sec) ``` -上面的例子显示当前有四个数据库:information_schema、mysql、performance_schema 和 test。你必须指定 MariaDB 使用哪个库,才能对该库使用查询语句。指定数据库的命令是 `use`。当你选择了一个库后,MariaDB 提示框会切换为选择的库。 - +上面的例子显示当前有四个数据库:`information_schema`、`mysql`、`performance_schema` 和 `test`。你必须指定 MariaDB 使用哪个库,才能对该库使用查询语句。指定数据库的命令是 `use`。当你选择了一个库后,MariaDB 提示框会切换为选择的库。 ``` -MariaDB [(NONE)]> USE test; -MariaDB [(test)]> +MariaDB [(NONE)]> USE test; +MariaDB [(test)]> ``` #### 显示数据库的表 -数据库里有_表_,与电子表格类似:有一系列的行(在数据库中称为_记录_)和列。一个行和一个列唯一确定一个 _filed_。 - -查看一个数据库中可用的表(可以理解为多表单电子表格中的一页),使用 SQL 关键字 `SHOW`: +数据库里有*表*,与电子表格类似:有一系列的行(在数据库中称为*记录*)和列。一个行和一个列唯一确定一个*字段*。 +查看一个数据库中可用的表(可以理解为多表单电子表格中的一页),使用 SQL 关键字 `SHOW`: ``` -MariaDB [(test)]> SHOW TABLES; +MariaDB [(test)]> SHOW TABLES; empty SET ``` `test` 数据库是空的,所以使用 `use` 命令切换到 `mysql` 数据库: - ``` -MariaDB [(test)]> USE mysql; -MariaDB [(mysql)]> SHOW TABLES; +MariaDB [(test)]> USE mysql; +MariaDB [(mysql)]> SHOW TABLES; +---------------------------+ | Tables_in_mysql | @@ -114,12 +109,11 @@ MariaDB [(mysql)]> SHOW TABLES; #### 检查一个表 -这个实例的 `mysql` 数据库的最后一个表名为 `user`。这个表包含了可以访问这个数据库的用户。当前里面只有一个 root 用户,但是你可以添加不同权限的用户,赋予它们查看、更新或创建数据的权限。你可以查看一个表的列首来了解一个 MariaDB 用户的所有属性: - +这个实例的 `mysql` 数据库的最后一个表名为 `USER`。这个表包含了可以访问这个数据库的用户。当前里面只有一个 root 用户,但是你可以添加不同权限的用户,赋予它们查看、更新或创建数据的权限。你可以查看一个表的列首来了解一个 MariaDB 用户的所有属性: ``` -> SHOW COLUMNS IN USER; -MariaDB [mysql]> SHOW COLUMNS IN USER; +> SHOW COLUMNS IN USER; +MariaDB [mysql]> SHOW COLUMNS IN USER; +-------------+---------------+------+-----+----------+ | FIELD | TYPE | NULL | KEY | DEFAULT | +-------------+---------------+------+-----+----------+ @@ -138,20 +132,18 @@ MariaDB [mysql]> SHOW COLUMNS IN USER; #### 创建一个新的用户 -不论你是否需要一个普通的账号来管理数据库或者为计算机配置数据库(例如安装 WordPress、Drupal 或 Joomla时),在 MariaDB 中多建一个用户账号是很普遍的。你可以通过向 `mysql` 数据库的 `user` 表中添加一个用户或使用 SQL 关键字 `CREATE` 来提示 MariaDB 创建一个 MariaDB 用户。使用 `CREATE` 来创建新用户会默认执行一些有用的方法,因此你不需要手动生成所有的信息: - +不论你是否需要一个普通的账号来管理数据库或者为计算机配置数据库(例如安装 WordPress、Drupal 或 Joomla时),在 MariaDB 中多建一个用户账号是很普遍的。你可以通过向 `mysql` 数据库的 `USER` 表中添加一个用户或使用 SQL 关键字 `CREATE` 来提示 MariaDB 创建一个 MariaDB 用户。使用 `CREATE` 来创建新用户会默认执行一些有用的方法,因此你不需要手动生成所有的信息: ``` -`> CREATE USER 'tux'@'localhost' IDENTIFIED BY 'really_secure_password';` +> CREATE USER 'tux'@'localhost' IDENTIFIED BY 'really_secure_password'; ``` #### 查看表的字段 -你可以使用 `SELECT` 关键字来查看数据库表的字段和值。这本例中,你创建了一个名为 `tux` 的用户,因此查询 `user` 表中的列: - +你可以使用 `SELECT` 关键字来查看数据库表的字段和值。这本例中,你创建了一个名为 `tux` 的用户,因此查询 `USER` 表中的列: ``` -> SELECT USER,host FROM USER; +> SELECT USER,host FROM USER; +------+------------+ | USER | host | +------+------------+ @@ -164,11 +156,10 @@ MariaDB [mysql]> SHOW COLUMNS IN USER; #### 为一个用户赋予权限 -通过查看 `user` 表列出的信息,你可以看到用户的状态。例如,新用户 `tux` 对这个数据库没有任何权限。使用 `WHERE` 语句你可以只查 `tux` 那一条记录。 - +通过查看 `USER` 表列出的信息,你可以看到用户的状态。例如,新用户 `tux` 对这个数据库没有任何权限。使用 `WHERE` 语句你可以只查 `tux` 那一条记录。 ``` -> SELECT USER,select_priv,insert_priv,update_priv FROM USER WHERE USER='tux'; +> SELECT USER,select_priv,insert_priv,update_priv FROM USER WHERE USER='tux'; +------+-------------+-------------+-------------+ | USER | select_priv | insert_priv | update_priv | +------+-------------+-------------+-------------+ @@ -178,17 +169,15 @@ MariaDB [mysql]> SHOW COLUMNS IN USER; 使用 `GRANT` 命令修改用户的权限: - ``` -> GRANT SELECT ON *.* TO 'tux'@'localhost'; -> FLUSH PRIVILEGES; +> GRANT SELECT ON *.* TO 'tux'@'localhost'; +> FLUSH PRIVILEGES; ``` 验证你的修改: - ``` -> SELECT USER,select_priv,insert_priv,update_priv FROM USER WHERE USER='tux'; +> SELECT USER,select_priv,insert_priv,update_priv FROM USER WHERE USER='tux'; +------+-------------+-------------+-------------+ | USER | select_priv | insert_priv | update_priv | +------+-------------+-------------+-------------+ @@ -206,11 +195,10 @@ MariaDB [mysql]> SHOW COLUMNS IN USER; 你可能已经可以自己在 MariaDB 中创建新数据库了。创建数据库跟新建用户差不多。 - ``` -> CREATE DATABASE example; +> CREATE DATABASE example; Query OK, 1 ROW affected (0.000 sec) -> SHOW DATABASES; +> SHOW DATABASES; +--------------------+ | DATABASE | +--------------------+ @@ -220,9 +208,8 @@ Query OK, 1 ROW affected (0.000 sec) 使用 `use` 命令来把这个新建的数据库作为当前使用的库: - ``` -`> USE example;` +> USE example; ``` #### 创建一个表 @@ -231,12 +218,11 @@ Query OK, 1 ROW affected (0.000 sec) 下面是用来描述一系列用户的一个简单的表: - ``` -> CREATE TABLE IF NOT EXISTS member ( - -> id INT AUTO_INCREMENT PRIMARY KEY, - -> name VARCHAR(128) NOT NULL, - -> startdate TIMESTAMP DEFAULT CURRENT_TIMESTAMP); +> CREATE TABLE IF NOT EXISTS member ( + -> id INT AUTO_INCREMENT PRIMARY KEY, + -> name VARCHAR(128) NOT NULL, + -> startdate TIMESTAMP DEFAULT CURRENT_TIMESTAMP); Query OK, 0 ROWS affected (0.030 sec) ``` @@ -244,23 +230,21 @@ Query OK, 0 ROWS affected (0.030 sec) 使用 SQL 关键字 `INSERT` 向这个表填充一些示例数据: - ``` -> INSERT INTO member (name) VALUES ('Alice'); +> INSERT INTO member (name) VALUES ('Alice'); Query OK, 1 ROW affected (0.011 sec) -> INSERT INTO member (name) VALUES ('Bob'); +> INSERT INTO member (name) VALUES ('Bob'); Query OK, 1 ROW affected (0.011 sec) -> INSERT INTO member (name) VALUES ('Carol'); +> INSERT INTO member (name) VALUES ('Carol'); Query OK, 1 ROW affected (0.011 sec) -> INSERT INTO member (name) VALUES ('David'); +> INSERT INTO member (name) VALUES ('David'); Query OK, 1 ROW affected (0.011 sec) ``` 验证一下表里的数据: - ``` -> SELECT * FROM member; +> SELECT * FROM member; +----+-------+---------------------+ | id | name | startdate | +----+-------+---------------------+ @@ -276,23 +260,21 @@ Query OK, 1 ROW affected (0.011 sec) 再创建一个表: - ``` -> CREATE TABLE IF NOT EXISTS linux ( - -> id INT AUTO_INCREMENT PRIMARY KEY, - -> distro VARCHAR(128) NOT NULL, +> CREATE TABLE IF NOT EXISTS linux ( + -> id INT AUTO_INCREMENT PRIMARY KEY, + -> distro VARCHAR(128) NOT NULL); Query OK, 0 ROWS affected (0.030 sec) ``` 填充一些示例数据,这次使用 `VALUES` 快捷方式,这样你可以一次添加多行数据。`VALUES` 关键字需要一个用括号包围的列表作为参数,也可以用逗号分隔的多个列表作为参数。 - ``` -> INSERT INTO linux (distro) - -> VALUES ('Slackware'), ('RHEL'),('Fedora'),('Debian'); +> INSERT INTO linux (distro) + -> VALUES ('Slackware'), ('RHEL'),('Fedora'),('Debian'); Query OK, 4 ROWS affected (0.011 sec) Records: 4 Duplicates: 0 Warnings: 0 -> SELECT * FROM linux; +> SELECT * FROM linux; +----+-----------+ | id | distro | +----+-----------+ @@ -309,14 +291,13 @@ Records: 4 Duplicates: 0 Warnings: 0 你可以在表一中新增一列对应表二中的值。因为两个表都有唯一的标识符(自动递增的 `id` 字段),关联的它们的最简单的方式是,使用表一中的 `id` 字段作为表二的查询条件。 -在表一中创建一列用来表示表二中的一个值。 - +在表一中创建一列用来表示表二中的一个值: ``` -> ALTER TABLE member ADD COLUMN (os INT); +> ALTER TABLE member ADD COLUMN (os INT); Query OK, 0 ROWS affected (0.012 sec) Records: 0 Duplicates: 0 Warnings: 0 -> DESCRIBE member; +> DESCRIBE member; DESCRIBE member; +-----------+--------------+------+-----+---------+------+ | FIELD | TYPE | NULL | KEY | DEFAULT | Extra| @@ -328,11 +309,10 @@ DESCRIBE member; +-----------+--------------+------+-----+---------+------+ ``` -把 `linux` 表中的独一无二的 ID 分配给每个成员。因为记录已经存在,使用 `UPDATE` 关键字而不是 `INSERT`。尤其是当你想查询某行然后再更新某列值时。语法上,表达方式有点倒装,先更新后查询: - +把 `linux` 表中的唯一 ID 分配给每个成员。因为记录已经存在,使用 `UPDATE` 关键字而不是 `INSERT`。尤其是当你想查询某行然后再更新某列值时。语法上,表达方式有点倒装,先更新后查询: ``` -> UPDATE member SET os=1 WHERE name='Alice'; +> UPDATE member SET os=1 WHERE name='Alice'; Query OK, 1 ROW affected (0.007 sec) ROWS matched: 1 Changed: 1 Warnings: 0 ``` @@ -343,7 +323,6 @@ ROWS matched: 1 Changed: 1 Warnings: 0 现在这两个表彼此有了关联,你可以使用 SQL 来展示关联的数据。数据库中有很多种连接方式,你可以尽请尝试。下面的例子是关联 `member` 表中 `os` 字段和 `linux` 表中 `id` 字段: - ``` SELECT * FROM member JOIN linux ON member.os=linux.id; +----+-------+---------------------+------+----+-----------+ @@ -359,9 +338,9 @@ SELECT * FROM member JOIN linux ON member.os=linux.id; 连接 `os` 和 `id` 字段。 -在图像化的应用中,你可以想象 `os` 字段可以在下拉菜单中设置,值的来源是 `linux` 表中的 `distro` 字段。通过使用多个表中独立却有关联的数据,你可以保证数据的一致性和有效性,使用 SQL 你可以动态地关联它们。 +在图形化的应用中,你可以想象 `os` 字段可以在下拉菜单中设置,值的来源是 `linux` 表中的 `distro` 字段。通过使用多个表中独立却有关联的数据,你可以保证数据的一致性和有效性,使用 SQL 你可以动态地关联它们。 -### [下载 MariaDB 和 MySQL 备忘单][9] +### 下载 MariaDB 和 MySQL 备忘单 MariaDB 是企业级的数据库。它是健壮、强大、高效的数据库引擎。学习它是你向管理 web 应用和编写语言库迈出的伟大的一步。你可以[下载 MariaDB 和 MySQL 备忘单][9],在你使用 MariaDB 时可以快速参考。 @@ -372,7 +351,7 @@ via: https://opensource.com/article/20/10/mariadb-mysql-cheat-sheet 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[lxbwolf](https://github.com/lxbwolf) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 5e29f02a4c37a13a5e3cfc5bbd7eaf43f9229407 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 14 Nov 2020 06:56:42 +0800 Subject: [PATCH 0769/1156] PUB @lxbwolf https://linux.cn/article-12822-1.html --- ...abase knowledge with this MariaDB and MySQL cheat sheet.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md (99%) diff --git a/translated/tech/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md b/published/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md similarity index 99% rename from translated/tech/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md rename to published/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md index 4d396aee77..6ef5aef401 100644 --- a/translated/tech/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md +++ b/published/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md @@ -1,8 +1,8 @@ [#]: collector: "lujun9972" [#]: translator: "lxbwolf" [#]: reviewer: "wxy" -[#]: publisher: " " -[#]: url: " " +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12822-1.html" [#]: subject: "Improve your database knowledge with this MariaDB and MySQL cheat sheet" [#]: via: "https://opensource.com/article/20/10/mariadb-mysql-cheat-sheet" [#]: author: "Seth Kenlon https://opensource.com/users/seth" From 18ea113e3d0b34f234b9ac11e5ab06e06d0b234d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 14 Nov 2020 07:07:09 +0800 Subject: [PATCH 0770/1156] PRF @geekpi --- ...A Powerful Open Source Accounting Software.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/translated/tech/20201103 GnuCash- A Powerful Open Source Accounting Software.md b/translated/tech/20201103 GnuCash- A Powerful Open Source Accounting Software.md index 8c294b870a..62e813d317 100644 --- a/translated/tech/20201103 GnuCash- A Powerful Open Source Accounting Software.md +++ b/translated/tech/20201103 GnuCash- A Powerful Open Source Accounting Software.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (GnuCash: A Powerful Open Source Accounting Software) @@ -10,13 +10,15 @@ GnuCash:一个强大的开源会计软件 ====== -_**简介:GnuCash 是一款流行的免费开源会计软件,可用于管理个人财务和商业交易。**_ +> GnuCash 是一款流行的自由开源的会计软件,可用于管理个人财务和商业交易。 + +![](https://img.linux.net.cn/data/attachment/album/202011/14/070431j1547hbh3v2j4vhh.jpg) 考虑到管理个人财务和商业交易的复杂性,你会发现有很多旨在简化这些的在线服务或软件工具。有些工具只是让你添加支出和收入来跟踪你的储蓄,而其他一些工具则提供不同的功能。 我在过去已经介绍过几个[开源会计软件][1]。在这里,我将重点介绍其中一个 — **GnuCash**,它是一款很流行的免费会计软件,为所有用户提供了很多功能。 -### GnuCash: 免费且开源的会计软件 +### GnuCash: 自由开源的会计软件 ![][2] @@ -32,7 +34,7 @@ GnuCash 是一款为专业需求量身定做的免费会计软件,可以追踪 * 复式记账 * 股票/债券/共同基金账户 - * 有税务支持的小企业会计(如印度的商品和服务税) + * 有税务支持的小企业会计(如印度的商品和服务税) * 详细的分类报告 * 便于分析的图表 * 支持财务计算 @@ -49,8 +51,6 @@ GnuCash 是一款为专业需求量身定做的免费会计软件,可以追踪 * 制定预算的能力 * 配置账单生成器,以简化会计程序。 - - 我不是专家,但这只是冰山一角。你会发现有很多选项可以根据你的会计需求进行定制和设置。 ![Gnucash Report][4] @@ -63,7 +63,7 @@ GnuCash 是一款为专业需求量身定做的免费会计软件,可以追踪 另外,你也可以从源码构建,或者你可以前往他们的[官方下载页面][8]来探索适合你的 Linux 发行版选项。 -[GnuCash][9] +- [GnuCash][9] ### 总结 @@ -78,7 +78,7 @@ via: https://itsfoss.com/gnucash/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 860ef48bf5df68c87d546ce1c0bf1d44bbd89961 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 14 Nov 2020 07:07:35 +0800 Subject: [PATCH 0771/1156] PUB @geekpi https://linux.cn/article-12823-1.html --- ...103 GnuCash- A Powerful Open Source Accounting Software.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201103 GnuCash- A Powerful Open Source Accounting Software.md (98%) diff --git a/translated/tech/20201103 GnuCash- A Powerful Open Source Accounting Software.md b/published/20201103 GnuCash- A Powerful Open Source Accounting Software.md similarity index 98% rename from translated/tech/20201103 GnuCash- A Powerful Open Source Accounting Software.md rename to published/20201103 GnuCash- A Powerful Open Source Accounting Software.md index 62e813d317..f8086ecdaa 100644 --- a/translated/tech/20201103 GnuCash- A Powerful Open Source Accounting Software.md +++ b/published/20201103 GnuCash- A Powerful Open Source Accounting Software.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12823-1.html) [#]: subject: (GnuCash: A Powerful Open Source Accounting Software) [#]: via: (https://itsfoss.com/gnucash/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From b2820fe5d55a06fab8f91986ab9aa0d6d125d69d Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Sat, 14 Nov 2020 19:26:19 +0800 Subject: [PATCH 0772/1156] =?UTF-8?q?=E7=94=B3=E9=A2=86=E8=AF=91=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20191003 4 open source eBook readers for Android.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191003 4 open source eBook readers for Android.md b/sources/tech/20191003 4 open source eBook readers for Android.md index f2c6638bc4..b4f76f0099 100644 --- a/sources/tech/20191003 4 open source eBook readers for Android.md +++ b/sources/tech/20191003 4 open source eBook readers for Android.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (chenmu-kk) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 6426eba89c57dc2bf2333981d45c029402ca318a Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Sat, 14 Nov 2020 20:29:36 +0800 Subject: [PATCH 0773/1156] Update 20191003 4 open source eBook readers for Android.md --- ...4 open source eBook readers for Android.md | 46 ++++++++++++------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/sources/tech/20191003 4 open source eBook readers for Android.md b/sources/tech/20191003 4 open source eBook readers for Android.md index b4f76f0099..c407511235 100644 --- a/sources/tech/20191003 4 open source eBook readers for Android.md +++ b/sources/tech/20191003 4 open source eBook readers for Android.md @@ -8,60 +8,72 @@ [#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) 4 open source eBook readers for Android +四大开源安卓电子书阅读器 ====== Looking for a new eBook app? Check out these four solid, open source eBook readers for Android. +你在寻找新的电子书阅读软件吗?看一看这四个开源可靠的安卓电子书阅读器吧。 ![Computer browser with books on the screen][1] Who doesn't like a good read? Instead of frittering away your time on social media or a [messaging app][2], you can enjoy a book, magazine, or another document on your Android-powered phone or tablet. +谁不想有一个好的阅读体验?你可以在自己安卓手机或平板上阅读一本书、杂志或其他文本,而非在社交媒体或即时信息软件中浪费你的时间。 To do that, all you need is the right eBook reader app. So let's take a look at four solid, open source eBook readers for Android. +要做到这一点,你需要的只是一个正确的电子书阅读软件。接下来让我们来看一看四款开源可靠的安卓电子书阅读器。 ### Book Reader Let's start off with my favorite open source Android eBook reader: [Book Reader][3]. It's based on the older, open source version of the now-proprietary FBReader app. Like earlier versions of its progenitor, Book Reader is simple and minimal, but it does a great job. +那我们先从我最喜欢的一款开源安卓电子书阅读器开始:Book Reader。它是基于更老版本而现在已拥有专利的FBReader软件。像它祖先的更古老的版本,Book Reader简易又轻巧,但好用。 **Pros of Book Reader:** +Book Reader的支持者 - * It's easy to use. - * The app's interface follows Android's [Material Design guidelines][4], so it's very clean. - * You can add bookmarks to an eBook and share text with other apps on your device. - * There's growing support for languages other than English. + * It's easy to use.它容易上手。 + * The app's interface follows Android's [Material Design guidelines][4], so it's very clean.软件接口继承安卓的材料设计指南,因此它非常整洁。 + * You can add bookmarks to an eBook and share text with other apps on your device.你可以给电子书添加书签并把文本分享到你设备上的其他app里。 + * There's growing support for languages other than English.支持英语外的更多其他语言 **Cons of Book Reader:** +Book Reader的反对者 - * Book Reader has a limited number of configuration options. - * There's no built-in dictionary or support for an external dictionary. + * Book Reader has a limited number of configuration options.Book Reader有许多限制配置选项。 + * There's no built-in dictionary or support for an external dictionary.没有内置词典或支持外部词典的功能 **Supported eBook formats:** +支持的电子书格式 Book Reader supports EPUB, .mobi, PDF, [DjVu][5], HTML, plain text, Word documents, RTF, and [FictionBook][6]. +Book Reader支持。。。 ![Book Reader Android app][7] Book Reader's source code is licensed under the GNU General Public License version 3.0, and you can find it on [GitLab][8]. +Book Reader可在GNU通用公共许可版本3.0下运行,你可以在GitLab中找到它。 ### Cool Reader [Cool Reader][9] is a zippy and easy-to-use eBook app. While I think the app's icons are reminiscent of those found in Windows Vista, Cool Reader does have several useful features. +Cool Reader是一个灵活且易于使用的电子书app。!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! **Pros of Cool Reader:** - * It's highly configurable. You can change fonts, line and paragraph spacing, hyphenation, font sizes, margins, and background colors. - * You can override the stylesheet in a book. I found this useful with two or three books that set all text in small capital letters. + * It's highly configurable. You can change fonts, line and paragraph spacing, hyphenation, font sizes, margins, and background colors.它高度自定义,你可以改变字体、行宽、段间距、连字符、字体大小、页边距和背景色。 + * You can override the stylesheet in a book. I found this useful with two or three books that set all text in small capital letters.你可以覆盖书中的样式表。我发现它在两三本设置所有文本为小写字母的书中很有用。 * It automatically scans your device for new books when you start it up. You can also access books on [Project Gutenberg][10] and the [Internet Archive][11]. + 它会在启动时自动搜索你的设备来寻找新的电子书资源。你也可以查阅古登堡计划和互联网档案馆中的书籍。 **Cons of Cool Reader:** - * Cool Reader doesn't have the cleanest or most modern interface. - * While it's usable out of the box, you really need to do a bit of configuration to make Cool Reader comfortable to use. - * The app's default dictionary is proprietary, although you can swap it out for [an open one][12]. + * Cool Reader doesn't have the cleanest or most modern interface.Cool Reader没有极简或者前卫的接口。 + * While it's usable out of the box, you really need to do a bit of configuration to make Cool Reader comfortable to use.虽然它开箱即用,但你真的需要调整一些配置来更舒适地使用Cool Reader。 + * The app's default dictionary is proprietary, although you can swap it out for [an open one][12].app的默认词典是有专利的,尽管你可以用开源的词典来替换掉它。 @@ -76,19 +88,20 @@ Cool Reader's source code is licensed under the GNU General Public License versi ### KOReader [KOReader][16] was originally created for [E Ink][17] eBook readers but found its way to Android. While testing it, I found KOReader to be both useful and frustrating in equal measures. It's definitely not a bad app, but it's not my first choice. +KOReader最初是为了电子墨水电子书阅读器发明的,但发现它适用于安卓。在同等条件下测试它时,我发现KOReader既有用又让人失望。很明显它是一个不错的软件,但不会是我的首选。 **Pros of KOReader:** - * It's highly configurable. - * It supports multiple languages. - * It allows you to look up words using a [dictionary][18] (if you have one installed) or Wikipedia (if you're connected to the internet). + * It's highly configurable.高度自定义 + * It supports multiple languages.支持多种语言 + * It allows you to look up words using a [dictionary][18] (if you have one installed) or Wikipedia (if you're connected to the internet).它允许你使用词典(如果你已安装)或者Wikipedia(如果你有网)来查单词。 **Cons of KOReader:** - * You need to change the settings for each book you read. KOReader doesn't remember settings when you open a new book. - * The interface is reminiscent of a dedicated eBook reader. The app doesn't have that Android look and feel. + * You need to change the settings for each book you read. KOReader doesn't remember settings when you open a new book.每读一本书你都需要改变设置。在你新阅读一本书书时,KOReader不会保存相关配置 + * The interface is reminiscent of a dedicated eBook reader. The app doesn't have that Android look and feel.它的界面让人觉得是一个专用电子书阅读器。app没有安卓的外形和感觉。 @@ -97,6 +110,7 @@ Cool Reader's source code is licensed under the GNU General Public License versi You can view PDF, DjVu, CBT, and [CBZ][5] eBooks. It also supports EPUB, FictionBook, .mobi, Word documents, text files, and [Compiled HTML Help][13] (.chm) files. ![KOReader Android app][19] +你可以查看PDF, DjVu, CBT, 和CBZ格式的电子书,同时也支持!!!!!!!!文件。 KOReader's source code is licensed under the GNU Affero General Public License version 3.0, and you can find it on [GitHub][20]. From ba64a732e429dd97b6820c7b400c060128d2ff97 Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Sat, 14 Nov 2020 20:52:11 +0800 Subject: [PATCH 0774/1156] Update 20191003 4 open source eBook readers for Android.md --- ...4 open source eBook readers for Android.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/sources/tech/20191003 4 open source eBook readers for Android.md b/sources/tech/20191003 4 open source eBook readers for Android.md index c407511235..99aa579df1 100644 --- a/sources/tech/20191003 4 open source eBook readers for Android.md +++ b/sources/tech/20191003 4 open source eBook readers for Android.md @@ -116,21 +116,22 @@ KOReader's source code is licensed under the GNU Affero General Public License v ### Booky McBookface -Yes, that really is the name of [this eBook reader][21]. It's the most basic of the eBook readers in this article but don't let that (or the goofy name) put you off. Booky McBookface is easy to use and does the one thing it does quite well. +Yes, that really is the name of [this eBook reader][21]. It's the most basic of the eBook readers in this article but don't let that (or the goofy name) put you off. Booky McBookface is easy to use and does the one thing it does quite well. +是的,那真的是这个电子书阅读器的名字。它是这篇文章中最基础的电子书阅读器,但不要让它(或者说这个傻乎乎的名字)阻止你。Booky McBookface易于使用并且有一件事它做的很好。 **Pros of Booky McBookface:** - * There are no frills. It's just you and your eBook. - * The interface is simple and clean. - * Long-tapping the app's icon in the Android Launcher pops up a menu from which you can open the last book you were reading, get a list of unread books, or find and open a book on your device. + * There are no frills. It's just you and your eBook.它没有虚假修饰。只有你和你的电子书。 + * The interface is simple and clean.界面简洁干净。 + * Long-tapping the app's icon in the Android Launcher pops up a menu from which you can open the last book you were reading, get a list of unread books, or find and open a book on your device.在安卓启动栏中的长期软件图标突然出现一个菜单,菜单包括上一次阅读的书、所有未读书单列表、或者发现并打开设备上的一本书。 **Cons of Booky McBookface:** - * The app has few configuration options—you can change the size of the font and the brightness, and that's about it. - * You need to use the buttons at the bottom of the screen to navigate through an eBook. Tapping the edges of the screen doesn't work. - * You can't add bookmarks to an eBook. + * The app has few configuration options—you can change the size of the font and the brightness, and that's about it.app中只有少量的配置选项——你可以改变字体的大小和亮度,也只有这样。 + * You need to use the buttons at the bottom of the screen to navigate through an eBook. Tapping the edges of the screen doesn't work.你需要使用屏幕底部的按钮来浏览电子书。滑动侧边栏无法操作。 + * You can't add bookmarks to an eBook.不可以为电子书添加书签。 @@ -142,7 +143,7 @@ You can read eBooks in EPUB, HTML, or plain text formats with Booky McBookface. Booky McBookface's source code is available under the GNU General Public License version 3.0, and you can find it [on GitHub][23]. -Do you have a favorite open source eBook reader for Android? Share it with the community by leaving a comment. +Do you have a favorite open source eBook reader for Android? Share it with the community by leaving a comment.你有最喜欢的安卓开源电子书阅读器吗?在社区中留言分享一下吧 Have you ever downloaded an Android app only to find that it wants access to all your phone's... @@ -156,7 +157,7 @@ via: https://opensource.com/article/19/10/open-source-ereaders-android 作者:[Scott Nesbitt][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[chenmu-kk](https://github.com/chenmu-kk) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 71a84a3d275a237957f1b4c17e9342976538b25f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 15 Nov 2020 05:02:39 +0800 Subject: [PATCH 0775/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201114?= =?UTF-8?q?=20How=20I=20channel=20my=20inner=20Star=20Trek=20character=20a?= =?UTF-8?q?t=20work?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201114 How I channel my inner Star Trek character at work.md --- ...el my inner Star Trek character at work.md | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 sources/tech/20201114 How I channel my inner Star Trek character at work.md diff --git a/sources/tech/20201114 How I channel my inner Star Trek character at work.md b/sources/tech/20201114 How I channel my inner Star Trek character at work.md new file mode 100644 index 0000000000..ed902f4bfd --- /dev/null +++ b/sources/tech/20201114 How I channel my inner Star Trek character at work.md @@ -0,0 +1,57 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How I channel my inner Star Trek character at work) +[#]: via: (https://opensource.com/article/20/11/inner-star-trek) +[#]: author: (Jen Wike Huger https://opensource.com/users/jen-wike) + +How I channel my inner Star Trek character at work +====== +I am more of a Deanna Troi in my role as a community manager. How about +you? +![Open source stars.][1] + +In a recent [Twitter thread][2], I self-identified as "some days Deanna, some days Riker." Others shared their own "Star Trek Spectrum," from Worf to O'Brien and McCoy to Neelix. That led me to think more about Deanna Troi: the half-human, half-Betazoid empath who served as Lieutenant Commander and the ship's counselor for most of _Star Trek: The Next Generation_. + +Ever since my middle school days, I felt a kinship with her as I watched her observe and respond to situations and the people in them. Today, as an open source community manager, I think about how these traits are vital to the role of nurturing and guiding a group of people. Here's how I channel my inner Deanna Troi at work. + +![][3] + +opensource.com + +### Holding space + +Instead of speaking the next word, I take a breath. I try not to rush in with something to say in response to the things that happen and in response to conversations with the people that make up our community. I listen, and then when the time is right, I speak. That can be hard especially when I am feeling confident in how to move forward and am eager to show the way. I've learned that taking a beat and slowing down, rarely does harm if coupled with clarity around the situation. Sometimes it is important to act quickly, to step in and guide the community around an issue, but even swift action can be accompanied with thoughtful deliberation.  + +To achieve this, also give yourself space to think and slow down. If you need to think through something, go for a walk, make a tea or meal, and say no to that next meeting to give yourself the time you need to do your job with integrity.  + +### Radical empathy + +Truly hearing and listening to others, then digesting that information, often leads to empathy. Even when we don't feel the same way—often due to differing perspectives—we can get closer to empathizing with others when we listen closely and fully. And why would we want to do that? Because understanding someone allows us to relate to them, and then we can find a solid place from which to nurture and guide them. + +Getting to know each person individually is something I recommend, and if the community you are a part of is too big for that, don't shut down the idea of reaching out at all. Start from where you are, and connect with the next closest person—you have a meeting set up to onboard them, you interacted on social media, you fixed a bug they submitted, etc. This kind of growth is authentic and sustainable. + +### Tapping into intuition + +At first glance, it may seem that those best fit for a role at the helm are those who identify as extroverted and easily heard, however, I've found those who know how to silence the noise and follow their own inner certainty are those who can inspire others to do the same. And that is where the power is, inside all of us, not just one of us. + +Open source communities are continuing to be called upon to innovate, act, and lead, and these traits are important not just for leaders to cultivate but for everyone involved in working together as a group to achieve a goal or collaborate on a project. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/inner-star-trek + +作者:[Jen Wike Huger][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://opensource.com/users/jen-wike +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_520x292_opensourcestars.png?itok=hnrMETFh (Open source stars.) +[2]: https://twitter.com/JenWike/status/1318188923298906113 +[3]: https://opensource.com/sites/default/files/pictures/deannacover001.jpg From b75d27d233b1a4bcf51996cd1d56d49b912b9f98 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 15 Nov 2020 05:02:57 +0800 Subject: [PATCH 0776/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201114?= =?UTF-8?q?=20Woothee=20(HTTP=20User=20Agent=20Parser)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201114 Woothee (HTTP User Agent Parser).md --- ...201114 Woothee (HTTP User Agent Parser).md | 158 ++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 sources/tech/20201114 Woothee (HTTP User Agent Parser).md diff --git a/sources/tech/20201114 Woothee (HTTP User Agent Parser).md b/sources/tech/20201114 Woothee (HTTP User Agent Parser).md new file mode 100644 index 0000000000..0c0806070e --- /dev/null +++ b/sources/tech/20201114 Woothee (HTTP User Agent Parser).md @@ -0,0 +1,158 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Woothee (HTTP User Agent Parser)) +[#]: via: (https://theartofmachinery.com/2020/11/14/woothee.html) +[#]: author: (Simon Arneaud https://theartofmachinery.com) + +Woothee (HTTP User Agent Parser) +====== + +I’ve written [a D implementation of the Project Woothee multi-language HTTP user agent parser][1]. Here are some notes about what it’s useful for, and few things special about the D implementation. + +### Project Woothee + +HTTP clients (like normal browsers and search engine crawlers) usually identify themselves to web servers with a user agent string. These strings often contain interesting information like the client name, client version and operating system, but the HTTP spec makes no rules about how this information should be structured (it’s free-form text). Parsing them requires a bunch of rules based on what real clients use in the wild. + +There’s a project called [ua-parser][2] that maintains a list of (currently) ~1000 regular expressions for parsing user agent strings. Project Woothee is another project that’s less comprehensive, but faster than testing 1000 regexes. Sometimes you want a more comprehensive parser, but sometimes it doesn’t really help. For example, suppose you want to estimate the proportion of your users running Firefox versus Chrome versus whatever by processing a big web log dump. The answer will never be 100% accurate (even with 100% accurate parsing) because bots pretending to be Chrome browsers will skew the results a bit anyway. + +Woothee has some quirks (e.g., it doesn’t distinguish RSS reader clients) but it has uses, too. + +### The D version + +I wanted to keep the D version code simple so that it can be easily updated when the upstream project data gets updated. I took some easy opportunities to make it faster, though. In a quick, unscientific test, it parsed ~1M strings from a web log on a five-year-old laptop in about 5s. I’m sure it could be made faster, but that’s good enough for me right now. + +#### Preprocessing regexes and HTTP client data + +Woothee still uses some regexes (about 50). In most languages, these are strings that need to be processed at runtime, every time the program is run. I don’t know if [Boost Xpressive][3] was the first to support compile-time regex parsing, but I remember being impressed by it at the time. The downside is having to use an operator overloading hack that manages to make regexes even harder to read: + +``` +sregex re = '$' >> +_d >> '.' >> _d >> _d; +``` + +We’ve come a long way since 2007. [D’s standard library has a compile-time regex][4], but it’s not even needed. This works: + +``` +void foo() +{ + import std.regex; + static immutable re = regex(`\$\d+\.\d\d`); + // ... +} +``` + +If you’re wondering: `static` puts the `re` into the same storage space as a global variable would be in (instead of the stack, which is run time only), while `immutable` allows the compiler to avoid copying the variable into thread-local storage for every thread. If you’re from C++, you might expect that `regex()` will still get called once at run time to initialise `re`, but thanks to [CTFE][5] it’s processed at compile time and turned into normal data in the compiled binary. + +There’s one big downside: this kind of complex CTFE is still slow. Compiling all the regexes using DMD takes ~10s, long enough to be annoying. So I added a [version flag][6] `WootheePrecompute`. Switching regex CTFE is simpler because the regex matching functions in `std.regex` also have overloads that take plain strings for regexes (which then get compiled and passed to the overload that takes a pre-compiled regex). `woothee-d` uses a helper function defined like this: + +``` +version(WootheePrecompute) +{ + auto buildRegex(string r) + { + return regex(r); + } +} +else +{ + auto buildRegex(string r) + { + return r; + } +} +``` + +Then regexes get used in the code like this: + +``` +static immutable version_re = buildRegex(`Sleipnir/([.0-9]+)`); +const caps = _agent.matchFirst(version_re); +``` + +Without `WootheePrecompute`, `buildRegex()` has no effect, and `version_re` is just a plain string that gets compiled on use. With `WootheePrecompute` enabled, `buildRegex()` actually compiles the regex using CTFE. + +`WootheePrecompute` also enables processing the Project Woothee HTTP client data at compile time instead of at startup. + +#### More precomputation for faster string searching + +Woothee requires a lot of searching for strings inside the user agent string. Here’s a small sample: + +``` +if (contains!"Yahoo" || contains!"help.yahoo.co.jp/help/jp/" || contains!"listing.yahoo.co.jp/support/faq/") +{ + if (contains!"compatible; Yahoo! Slurp") return populateDataset("YahooSlurp"); + if (contains!"YahooFeedSeekerJp" || contains!"YahooFeedSeekerBetaJp" || contains!"crawler (http://listing.yahoo.co.jp/support/faq/" || contains!"crawler (http://help.yahoo.co.jp/help/jp/" || contains!"Y!J-BRZ/YATSHA crawler" || contains!"Y!J-BRY/YATSH crawler") return populateDataset("YahooJP"); + if (contains!"Yahoo Pipes") return populateDataset("YahooPipes"); +} +``` + +You may have noticed that `contains` is a template function taking the “needle” string as compile-time parameter. There are many famous ways to make searching for a “needle” string in a “haystack” string faster if you can preprocess either one. The Boyer-Moore algorithm is one algorithm, and there’s actually [an implementation in Phobos][7], but sadly it doesn’t work in CTFE. + +I tried another trick that’s simple and fast for short strings. The key idea is that there’s no point searching for a needle like “foo” if the haystack doesn’t even contain both the letters “f” and “o” in the first place. We can create a 64b hash of both strings that lets us do an approximate character subset test with a super-fast bitwise operation (like a [bloom filter][8]). The hashes for all the needle strings can be calculated at compile time, and the hash for the haystack (the user agent string) only needs to calculated once. + +The hash is super simple. Each byte in the string just sets one of the 64 bits of the output. Specifically, the hash takes each byte in the string, calculates the value modulo 64 (equivalently, takes the lower 6 bits), then sets the corresponding bit of the 64b output. Here’s the code: + +``` +ulong bloomHashOf(string s) pure +{ + ulong ret; + foreach (char c; s) + { + ret |= 1UL << (c & 63); + } + return ret; +} +``` + +Here’s an example with the string, “X11; FreeBSD ”: + +![Bloom-filter-style 64b hash of the string “X11; FreeBSD ”. The string starts with the letter “X”, which has ASCII code 88, which is 64 + 24, which is why bit #24 is set.][9] + +Note that the hash doesn’t count occurrences of a character; it just flags whether a particular character occurs at all. It also loses all information about order. It’s still useful for avoiding a lot of futile searches. For example, “Tiny Tiny RSS/20.05-c8243b0 ( doesn’t contain the character “X”, so there’s no way it can contain the string “X11; FreeBSD ”, as is easily detected by the hashes: + +![Hashes of the string “Tiny Tiny RSS/20.05-c8243b0 \(http://tt-rss.org/\)” and the string “X11; FreeBSD ”. The first hash doesn't have bit #24 set, proving that the first string can't contain a letter “X”, proving that the second string can't be contained inside it.][10] + +Here’s the D code. It does a quick bitwise op to check if _all_ the bits set in the needle hash are also set in the (previously calculated) user agent string hash. `bloomHashOf(needle)` is calculated as a constant at compile time. In fact, LDC with `-O2` inlines very sensibly, basically putting some bit ops with a 64b constant in front of a conditional jump in front of the call to `canFind()`. This precomputation is dirt cheap, so I didn’t even bother putting a `version(WootheePrecompute)` in there, as you can see for yourself: + +``` +bool contains(string needle)() +{ + import std.algorithm.searching : canFind; + enum needle_bloom = bloomHashOf(needle); + if ((needle_bloom & _agent_bloom) != needle_bloom) return false; + return _agent.canFind(needle); +} +``` + +The quick check is one sided. If it fails, we know we don’t need to search. If it passes, that doesn’t prove we have a substring match because the hash doesn’t account for repeated characters, or character order, and can also have different characters colliding to set the same bit value. + +Simply taking the bottom 6 bits is a pretty unsophisticated hashing technique, but if you look at an ASCII chart (`man ascii`), most of the characters that typically appear in HTTP user agents are in the range 64-127, which all have different values in the bottom 6 bits. So collisions aren’t a real problem, and actually [most pseuodorandom hashes would do a worse job][11]. + +In a simple test with real HTTP user agents from a log, 89% of potential `canFind()` calls were skipped thanks to the quick check, 9% were followed but failed and 2% were followed and found a real match. Overall, the quick check made `woothee-d` almost twice as fast, which is a nice win for some cheap precomputation. I think there’s more performance that could be gained, but it looks like most of the low-hanging fruit for string search has been taken. + +-------------------------------------------------------------------------------- + +via: https://theartofmachinery.com/2020/11/14/woothee.html + +作者:[Simon Arneaud][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://theartofmachinery.com +[b]: https://github.com/lujun9972 +[1]: https://gitlab.com/sarneaud/woothee-d +[2]: https://github.com/ua-parser +[3]: https://www.boost.org/doc/libs/1_74_0/doc/html/xpressive/user_s_guide.html#boost_xpressive.user_s_guide.creating_a_regex_object.static_regexes +[4]: https://dlang.org/phobos/std_regex.html#ctRegex +[5]: https://tour.dlang.org/tour/en/gems/compile-time-function-evaluation-ctfe +[6]: https://dlang.org/spec/version.html +[7]: https://dlang.org/phobos/std_algorithm_searching.html#boyerMooreFinder +[8]: https://en.wikipedia.org/wiki/Bloom_filter +[9]: https://theartofmachinery.com/images/woothee/bloom.svg +[10]: https://theartofmachinery.com/images/woothee/bloom_mismatch.svg +[11]: https://theartofmachinery.com/2020/01/27/systems_programming_probability.html From 5eae33f10b77f9a0a4020dfc468ef45d4b042b49 Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Sun, 15 Nov 2020 17:52:46 +0800 Subject: [PATCH 0777/1156] Update 20191003 4 open source eBook readers for Android.md --- ...4 open source eBook readers for Android.md | 121 ++++++++---------- 1 file changed, 53 insertions(+), 68 deletions(-) diff --git a/sources/tech/20191003 4 open source eBook readers for Android.md b/sources/tech/20191003 4 open source eBook readers for Android.md index 99aa579df1..1f0eb1db60 100644 --- a/sources/tech/20191003 4 open source eBook readers for Android.md +++ b/sources/tech/20191003 4 open source eBook readers for Android.md @@ -7,143 +7,128 @@ [#]: via: (https://opensource.com/article/19/10/open-source-ereaders-android) [#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) -4 open source eBook readers for Android -四大开源安卓电子书阅读器 +四款安卓开源电子书阅读器 ====== -Looking for a new eBook app? Check out these four solid, open source -eBook readers for Android. -你在寻找新的电子书阅读软件吗?看一看这四个开源可靠的安卓电子书阅读器吧。 +你在寻找新的电子书阅读软件吗?来看看这四个适用于安卓的可靠开源电子书阅读器吧。 ![Computer browser with books on the screen][1] -Who doesn't like a good read? Instead of frittering away your time on social media or a [messaging app][2], you can enjoy a book, magazine, or another document on your Android-powered phone or tablet. -谁不想有一个好的阅读体验?你可以在自己安卓手机或平板上阅读一本书、杂志或其他文本,而非在社交媒体或即时信息软件中浪费你的时间。 +谁不想有一个好的阅读体验?你可以在自己安卓手机或平板上阅读一本书、杂志或其他文本,而非将时间浪费在社交媒体或[即时消息软件][2]上。 -To do that, all you need is the right eBook reader app. So let's take a look at four solid, open source eBook readers for Android. -要做到这一点,你需要的只是一个正确的电子书阅读软件。接下来让我们来看一看四款开源可靠的安卓电子书阅读器。 +要做到这一点,你需要的是一个适合的电子书阅读软件。接下来让我们来看一看四款可靠、开源的安卓电子书阅读器。 ### Book Reader -Let's start off with my favorite open source Android eBook reader: [Book Reader][3]. It's based on the older, open source version of the now-proprietary FBReader app. Like earlier versions of its progenitor, Book Reader is simple and minimal, but it does a great job. -那我们先从我最喜欢的一款开源安卓电子书阅读器开始:Book Reader。它是基于更老版本而现在已拥有专利的FBReader软件。像它祖先的更古老的版本,Book Reader简易又轻巧,但好用。 +那我们先从我最喜欢的一款开源安卓电子书阅读器开始:[Book Reader][3]。它基于现在已有专利的FBReader应用的开源老版本。像FBReader的早期版本一样,Book Reader小而简单,但是好用。 -**Pros of Book Reader:** -Book Reader的支持者 +**优点:** - * It's easy to use.它容易上手。 - * The app's interface follows Android's [Material Design guidelines][4], so it's very clean.软件接口继承安卓的材料设计指南,因此它非常整洁。 - * You can add bookmarks to an eBook and share text with other apps on your device.你可以给电子书添加书签并把文本分享到你设备上的其他app里。 - * There's growing support for languages other than English.支持英语外的更多其他语言 + + * 易于操作。 + * 该应用界面遵循安卓的 [Material Design 指南][4],因此非常干净。 + * 你可以为电子书添加书签,并将文本分享至你设备上的其他应用。 + * 不断提供除英语外的其他语言的支持 -**Cons of Book Reader:** -Book Reader的反对者 +**缺点** - * Book Reader has a limited number of configuration options.Book Reader有许多限制配置选项。 - * There's no built-in dictionary or support for an external dictionary.没有内置词典或支持外部词典的功能 + * Book Reader的自定义选项较少 + * 没有内置词典或支持外部词典的功能 -**Supported eBook formats:** -支持的电子书格式 +**支持的电子书格式:** -Book Reader supports EPUB, .mobi, PDF, [DjVu][5], HTML, plain text, Word documents, RTF, and [FictionBook][6]. -Book Reader支持。。。 +Book Reader支持EPUB、 .mobi、PDF、[DjVu][5]、HTML、纯文本、 Word文本、RTF和[FictionBook][6]。 ![Book Reader Android app][7] -Book Reader's source code is licensed under the GNU General Public License version 3.0, and you can find it on [GitLab][8]. -Book Reader可在GNU通用公共许可版本3.0下运行,你可以在GitLab中找到它。 +Book Reader的源码已获得GNU通用公共许可证版本3.0的许可,你可以在[GitLab][8]中找到它。 ### Cool Reader -[Cool Reader][9] is a zippy and easy-to-use eBook app. While I think the app's icons are reminiscent of those found in Windows Vista, Cool Reader does have several useful features. -Cool Reader是一个灵活且易于使用的电子书app。!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +[Cool Reader][9]是一个灵活易用的电子书软件。虽然我觉得该软件的图标会让想起Windows vista中的图标,但它确实有一些好用的功能。 -**Pros of Cool Reader:** +**优点** - * It's highly configurable. You can change fonts, line and paragraph spacing, hyphenation, font sizes, margins, and background colors.它高度自定义,你可以改变字体、行宽、段间距、连字符、字体大小、页边距和背景色。 - * You can override the stylesheet in a book. I found this useful with two or three books that set all text in small capital letters.你可以覆盖书中的样式表。我发现它在两三本设置所有文本为小写字母的书中很有用。 - * It automatically scans your device for new books when you start it up. You can also access books on [Project Gutenberg][10] and the [Internet Archive][11]. - 它会在启动时自动搜索你的设备来寻找新的电子书资源。你也可以查阅古登堡计划和互联网档案馆中的书籍。 + * 高度自定义,你可以更改字体、行宽、段间距、连字符、字体大小、页边距以及背景色。 + * 你可以覆盖书中的样式表。我发现这对于两三本书将所有文本设置为大小写字母很有用。 + * 它会在设备启动时自动搜寻设备中的新书资源。你也可以查阅有关[Gutenberg计划][10] 和 [互联网档案馆][11]中的书籍。 -**Cons of Cool Reader:** +**优点** - * Cool Reader doesn't have the cleanest or most modern interface.Cool Reader没有极简或者前卫的接口。 - * While it's usable out of the box, you really need to do a bit of configuration to make Cool Reader comfortable to use.虽然它开箱即用,但你真的需要调整一些配置来更舒适地使用Cool Reader。 - * The app's default dictionary is proprietary, although you can swap it out for [an open one][12].app的默认词典是有专利的,尽管你可以用开源的词典来替换掉它。 + * Cool Reader没有极简或者说最现代化的界面。 + * 虽然它开箱即用,但实际上你需要调整一些配置来更舒适地使用Cool Reader。 + * 应用的默认词典是专有的,尽管你可以用[开源的词典][12]来替换掉它。 -**Supported eBook formats:** +**支持的电子书格式:** -You can use Cool Reader to browse EPUB, FictionBook, plain text, RTF, HTML, [Compiled HTML Help][13] (.chm), and TCR (the eBook format for the Psion series of handheld computers) files. +你可以使用Cool Reader来浏览EPUB、小说、纯文本、RTF、HTML、[Compiled HTML Help][13] (.chm)和TCR (Psion系列掌上电脑的电子书格式)文件。 ![Cool Reader Android app][14] -Cool Reader's source code is licensed under the GNU General Public License version 2, and you can find it on [Sourceforge][15]. +Cool Reader的源码已获得GNU通用公共许可证版本2的许可,你可以在[Sourceforge][15]中找到它。 ### KOReader -[KOReader][16] was originally created for [E Ink][17] eBook readers but found its way to Android. While testing it, I found KOReader to be both useful and frustrating in equal measures. It's definitely not a bad app, but it's not my first choice. -KOReader最初是为了电子墨水电子书阅读器发明的,但发现它适用于安卓。在同等条件下测试它时,我发现KOReader既有用又让人失望。很明显它是一个不错的软件,但不会是我的首选。 +[KOReader][16]最初是为了[E Ink][17] 电子书阅读器创建的,但后来发现它可用于安卓。 在测试它时,我发现KOReader在同等程度下既有用又令人沮丧。很明显它绝不是一款不好的应用,但不会是我的首选。 -**Pros of KOReader:** +**优点** - * It's highly configurable.高度自定义 - * It supports multiple languages.支持多种语言 - * It allows you to look up words using a [dictionary][18] (if you have one installed) or Wikipedia (if you're connected to the internet).它允许你使用词典(如果你已安装)或者Wikipedia(如果你有网)来查单词。 + * 高度自定义 + * 支持多种语言 + * 它允许你使用[词典][18](若你已安装)或者Wikipedia(若你已连接至网络)来查单词 -**Cons of KOReader:** +**缺点** - * You need to change the settings for each book you read. KOReader doesn't remember settings when you open a new book.每读一本书你都需要改变设置。在你新阅读一本书书时,KOReader不会保存相关配置 - * The interface is reminiscent of a dedicated eBook reader. The app doesn't have that Android look and feel.它的界面让人觉得是一个专用电子书阅读器。app没有安卓的外形和感觉。 + * 每一本书你都需要改变设置。在你打开一本新书时,KOReader不会保存相关设置 + * 它的界面会让人觉得是一款专用电子书阅读器。该应用没有安卓的外形和感受。 -**Supported eBook formats:** +**支持的电子书格式:** -You can view PDF, DjVu, CBT, and [CBZ][5] eBooks. It also supports EPUB, FictionBook, .mobi, Word documents, text files, and [Compiled HTML Help][13] (.chm) files. +你可以查阅PDF、DjVu、CBT、以及[CBZ][5]电子书。它也支持EPUB、小说、.mobi、Word文档、文本文件和[Compiled HTML Help][13] (.chm)文件。 ![KOReader Android app][19] -你可以查看PDF, DjVu, CBT, 和CBZ格式的电子书,同时也支持!!!!!!!!文件。 -KOReader's source code is licensed under the GNU Affero General Public License version 3.0, and you can find it on [GitHub][20]. +Cool Reader的源码已获得GNU Affero通用公共许可证版本3.0的许可,你可以在[GitHub][20]上找到它。 ### Booky McBookface -Yes, that really is the name of [this eBook reader][21]. It's the most basic of the eBook readers in this article but don't let that (or the goofy name) put you off. Booky McBookface is easy to use and does the one thing it does quite well. -是的,那真的是这个电子书阅读器的名字。它是这篇文章中最基础的电子书阅读器,但不要让它(或者说这个傻乎乎的名字)阻止你。Booky McBookface易于使用并且有一件事它做的很好。 +是的,那真的是[这个电子书阅读器][21]的名字。它是这篇文章中最基础的电子书阅读器,但不要让它(或者说这个傻乎乎的名字)使你失望。Booky McBookface易于使用并且有一件事它做的很好。 -**Pros of Booky McBookface:** +**优点** - * There are no frills. It's just you and your eBook.它没有虚假修饰。只有你和你的电子书。 - * The interface is simple and clean.界面简洁干净。 - * Long-tapping the app's icon in the Android Launcher pops up a menu from which you can open the last book you were reading, get a list of unread books, or find and open a book on your device.在安卓启动栏中的长期软件图标突然出现一个菜单,菜单包括上一次阅读的书、所有未读书单列表、或者发现并打开设备上的一本书。 + * 没有多余的装饰。只有你和你的电子书。 + * 界面简洁。 + * 在安卓启动栏中的长按软件图标会弹出一个菜单,你可以从中打开正在阅读的最后一本书、获得所有未读书单列表、或者查找并打开设备上的一本书。 -**Cons of Booky McBookface:** +**优点** - * The app has few configuration options—you can change the size of the font and the brightness, and that's about it.app中只有少量的配置选项——你可以改变字体的大小和亮度,也只有这样。 - * You need to use the buttons at the bottom of the screen to navigate through an eBook. Tapping the edges of the screen doesn't work.你需要使用屏幕底部的按钮来浏览电子书。滑动侧边栏无法操作。 - * You can't add bookmarks to an eBook.不可以为电子书添加书签。 + * 软件中几乎没有配置选项——你可以更改字体大小和亮度,仅此而已。 + * 你需要使用屏幕底部的按钮浏览电子书。点击屏幕边缘无法操作。 + * 无法为电子书添加书签。 -**Supported eBook formats:** +**优点** -You can read eBooks in EPUB, HTML, or plain text formats with Booky McBookface. +你可以使用该软件阅读EPUB格式、HTML文本,或纯文本格式的电子书 ![Booky McBookface Android app][22] -Booky McBookface's source code is available under the GNU General Public License version 3.0, and you can find it [on GitHub][23]. +Booky McBookface的源码已获得GNU通用公共许可证版本3.0的许可,你可以在[GitHub][23]中找到它。 -Do you have a favorite open source eBook reader for Android? Share it with the community by leaving a comment.你有最喜欢的安卓开源电子书阅读器吗?在社区中留言分享一下吧 +你有最喜欢的安卓开源电子书阅读器吗?在社区中留言分享一下吧。 Have you ever downloaded an Android app only to find that it wants access to all your phone's... From 36366d1f9cccb42183b7be8ccf39b8ed517fe158 Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Sun, 15 Nov 2020 17:53:27 +0800 Subject: [PATCH 0778/1156] Update 20191003 4 open source eBook readers for Android.md --- .../tech/20191003 4 open source eBook readers for Android.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191003 4 open source eBook readers for Android.md b/sources/tech/20191003 4 open source eBook readers for Android.md index 1f0eb1db60..327c53ee69 100644 --- a/sources/tech/20191003 4 open source eBook readers for Android.md +++ b/sources/tech/20191003 4 open source eBook readers for Android.md @@ -126,7 +126,7 @@ Cool Reader的源码已获得GNU Affero通用公共许可证版本3.0的许可 ![Booky McBookface Android app][22] -Booky McBookface的源码已获得GNU通用公共许可证版本3.0的许可,你可以在[GitHub][23]中找到它。 +Booky McBookface的源码在GNU通用公共许可证版本3.0下可用,你可以在[GitHub][23]中找到它。 你有最喜欢的安卓开源电子书阅读器吗?在社区中留言分享一下吧。 From 1cb154508118751284ebb65b1e3d94d87975b14d Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Sun, 15 Nov 2020 17:54:44 +0800 Subject: [PATCH 0779/1156] Rename sources/tech/20191003 4 open source eBook readers for Android.md to translated/tech/20191003 4 open source eBook readers for Android.md --- .../tech/20191003 4 open source eBook readers for Android.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20191003 4 open source eBook readers for Android.md (100%) diff --git a/sources/tech/20191003 4 open source eBook readers for Android.md b/translated/tech/20191003 4 open source eBook readers for Android.md similarity index 100% rename from sources/tech/20191003 4 open source eBook readers for Android.md rename to translated/tech/20191003 4 open source eBook readers for Android.md From 468c2a624511c66d00c8a03d17abd6f3576c1420 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 16 Nov 2020 03:50:16 +0800 Subject: [PATCH 0780/1156] Revert "update translator" This reverts commit d99abfa2237b520b0155d928cad7cd78b7f389b9. --- ... A beginner-s guide to SSH for remote connection on Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200907 A beginner-s guide to SSH for remote connection on Linux.md b/sources/tech/20200907 A beginner-s guide to SSH for remote connection on Linux.md index a2da86eb65..64c7c297b7 100644 --- a/sources/tech/20200907 A beginner-s guide to SSH for remote connection on Linux.md +++ b/sources/tech/20200907 A beginner-s guide to SSH for remote connection on Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (lihongjie224) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d61788554ad015409962094d0a8ce1e13e5dd9f1 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 16 Nov 2020 05:02:28 +0800 Subject: [PATCH 0781/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201116?= =?UTF-8?q?=20Linux=20Jargon=20Buster:=20What=20is=20Grub=20in=20Linux=3F?= =?UTF-8?q?=20What=20is=20it=20Used=20for=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201116 Linux Jargon Buster- What is Grub in Linux- What is it Used for.md --- ...t is Grub in Linux- What is it Used for.md | 130 ++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 sources/tech/20201116 Linux Jargon Buster- What is Grub in Linux- What is it Used for.md diff --git a/sources/tech/20201116 Linux Jargon Buster- What is Grub in Linux- What is it Used for.md b/sources/tech/20201116 Linux Jargon Buster- What is Grub in Linux- What is it Used for.md new file mode 100644 index 0000000000..74dfda57dc --- /dev/null +++ b/sources/tech/20201116 Linux Jargon Buster- What is Grub in Linux- What is it Used for.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux Jargon Buster: What is Grub in Linux? What is it Used for?) +[#]: via: (https://itsfoss.com/what-is-grub/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Linux Jargon Buster: What is Grub in Linux? What is it Used for? +====== + +If you ever used a desktop Linux system, you must have seen this screen. This is called the GRUB screen. Yes, it is written in all capital letters. + +![Remember this screen? This is GRUB][1] + +In this chapter of the Linux Jargon Buster series, I’ll tell you what is Grub and what is it used for. I’ll also briefly touch upon the configuration and customization part. + +### What is GRUB? + +[GRUB][2] is complete program for loading and managing boot. It is the most common bootloader for Linux distributions. A bootloader is the first software that runs when a computer starts. It loads the [kernel of the operating system][3] and then the kernel initializes the rest of the operating systems (shell, [display manager][4], [desktop environment][5] etc). + +#### Boot loader vs boot manager + +I didn’t want to confuse you at this stage but I see no option to avoid bringing this topic. There is a blur line between a bootloader and a boot manager. + +You already know that bootloader starts first and then loads the kernel into memory and executes it. A boot manager program allows you to choose between operating systems (if there are more than one OS on your system). A boot manager doesn’t load the OS directly, + +With Linux kernel version 3.3, the [Linux kernel includes a built-in EFI bootloader][6]. In fact, any operating system that is capable of working [EFI system includes an EFI bootloader][7]. In EFI capable systems, the firmware reads the EFI System Partition (ESP) for the EFI files for boot information. + +_**Insert Image: Show partition table with ESP partition.**_ + +![][8] + +GRUB is both a bootloader and a boot manager. I’ll come back to GRUB in a moment. Let’s see other GRUB like programs. + +Trivia + +GRUB is acronym for **GR**and **U**nified **B**ootloader. + +### What are some other boot managing programs like GRUB? + +GRUB is the most popular boot manager for Linux. But it is not the only one. There is this highly customizable [rEFInd boot manager][9] that some Linux users love to use. + +![Customized rEFInd Boot Manager Screen | Image Credit][10] + +There is [systemd-boot][11] text-based boot manager. You can guess that this is exclusively for systemd-based Linux distributions. Some distributions like Pop OS use the systemd-boot. + +![systemd-Boot in Pop OS | Image Credit][12] + +### Accessing or editing GRUB + +The usual GRUB screen you see is its menu interface. It allows you to choose the operating systems if there are more than one operating system. You can also choose to load a different kernel if your Linux distribution as more than one kernel installed. + +Depending upon the configuration set by the Linux distribution, you may have some other entries on the GRUB menu. + +You can edit GRUB menu entry by pressing the key `e`. This way, you can change the kernel parameters before loading it. For example, in some cases, [disabling the graphics driver from the kernel helps you with Linux system stuck at boot][13]. + +![][14] + +You can also enter the command line menu of GRUB using the key `c` at the GRUB menu interface. + +#### GRUB configuration file + +Any changes you make to the GRUB from the menu interface is temporary. If you want to make some permanent changes to GRUB like changing the default timeout, you can change the configuration file after you boot into your Linux system. + +The default GRUB configuration file is located at /etc/default/grub. There is also a /etc/default/grub.d directory. You may edit the /etc/default/grub file directly, however it is advised to make additional changes by adding config files (.cfg files) in this directory. + +![Default GRUB Config File][15] + +You must [update GRUB for the changes to take into effect][16]. + +#### GRUB customizer in Ubuntu + +If you think [editing file with a text editor in the terminal][17] is not something you feel comfortable with, you can [use a graphical tool called GRUB Customizer][18]. + +![][19] + +It allows you to change the boot order, default timeout etc. You can also use it to change the background of GRUB with a custom wallpaper. + +This tool is unfortunately available for Ubuntu-based Linux distributions only. + +### Conclusion + +I have touched everything on the surface. EFI, boot loading and GRUB itself is detailed and complicated topic and not in the scope of this article. This article intended to give you a high level overview of GRUB boot program. + +Perhaps I’ll write a detailed guide on GRUB explaining the low level details. For now, if you want to learn more on GRUB, you can access the GRUB documentation in your Linux terminal using `info grub` command. + +![GRUB Manual can be accessed via Terminal][20] + +I hope you have a tad bit better understanding of what is GRUB now. Here’s a GIF to humor you. + +![What Is GRUB? UEFI don’t hurt me, no more… :\)][21] + +I may not have answered all questions you have about GRUB. Please feel free to let me know in the comment section. I may update the article with your questions or suggestions. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/what-is-grub/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/grub-screen-linux.png?resize=800%2C450&ssl=1 +[2]: https://www.gnu.org/software/grub/ +[3]: https://itsfoss.com/what-is-linux/ +[4]: https://itsfoss.com/display-manager/ +[5]: https://itsfoss.com/what-is-desktop-environment/ +[6]: https://www.rodsbooks.com/efi-bootloaders/efistub.html +[7]: https://jdebp.eu/FGA/efi-boot-process.html +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/disk-partition-gparted.png?resize=744%2C385&ssl=1 +[9]: https://www.rodsbooks.com/refind/ +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/refind-boot-manager.png?resize=800%2C602&ssl=1 +[11]: https://wiki.gentoo.org/wiki/Systemd-boot +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/systemd-boot.png?resize=714%2C333&ssl=1 +[13]: https://itsfoss.com/fix-ubuntu-freezing/ +[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/04/editing-grub-to-fix-nvidia-issue.jpg?resize=800%2C343&ssl=1 +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/default-grub-config-file.png?resize=759%2C437&ssl=1 +[16]: https://itsfoss.com/update-grub/ +[17]: https://itsfoss.com/command-line-text-editors-linux/ +[18]: https://itsfoss.com/grub-customizer-ubuntu/ +[19]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2013/05/make-windows-default-grub-2.jpeg?resize=799%2C435&ssl=1 +[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/grub-manual-Linux-terminal.png?resize=800%2C462&ssl=1 +[21]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/what_is_GRUB.gif?resize=500%2C343&ssl=1 From 2d4e152c5124f763126d237892b0015104906c46 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 16 Nov 2020 08:50:03 +0800 Subject: [PATCH 0782/1156] translated --- ... Per Account in Linux With Timekpr-nExt.md | 111 ------------------ 1 file changed, 111 deletions(-) delete mode 100644 sources/tech/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md diff --git a/sources/tech/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md b/sources/tech/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md deleted file mode 100644 index 8212c74841..0000000000 --- a/sources/tech/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md +++ /dev/null @@ -1,111 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Got Kids? Limit Computer Usage Per Account in Linux With Timekpr-nExt) -[#]: via: (https://itsfoss.com/timekpr-next/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -Got Kids? Limit Computer Usage Per Account in Linux With Timekpr-nExt -====== - -_**Open source software highlight of this week is Timekpr-nExt. It is a GUI application to limit the computer usage for certain accounts on a Linux system. This is a handy utility for parents who do not want children to spend excessive time on the computer.**_ - -### Use Timekpr-nExt to limit computer usage on Linux - -If you have young children at home who spend too much time on computer, you may want to put some sort of restriction on the usage. - -Timekpr-nExt enables you to limit computer usage for certain accounts based on the time of day, number of hours a day, week or month. You may also set time interval to force the account user to take break. - -![][1] - -After the given time expires, the user is automatically logged out and cannot log back in until the restriction conditions are satisfied. - -![][2] - -Of course, this means that you need to have separate non-admin (no sudo access) accounts for the children. If the kids accounts also have admin access, they can change the settings easily. Kids are smart, you know. - -### Features of Timekpr-nExt - -Apart from an annoyingly stylized name, Timekpr-nExt has the following features: - - * Limit system usage as day wise limit, daily limit, weekly or monthly limit - * You can also set access restrictions based on time and hour - * Users can be shown notification about how much time they have left - * Set the lockout action (terminate session, shutdown, suspend or lock screen) - * Track the time usage of the accounts - - - -Keep the following things in mind: - - * Check carefully which account you are configuring. _**Do not lock yourself out**_. - * Hit the apply or set button for each configuration changes otherwise the changes won’t be set. - * Children accounts should not have admin action otherwise they can overwrite the settings. - - - -Read the [documents about more information on using Timekpr-nExt][3]. - -### Installing Timekpr-nExt on Linux - -For Ubuntu-based Linux distributions (like Mint, Linux Lite etc), there is an [official PPA available][4]. You can install it by using the following commands one by one: - -``` -sudo add-apt-repository ppa:mjasnik/ppa -sudo apt update -sudo apt install timekpr-next -``` - -Arch Linux users can [find it in AUR][5]. For others, please check your distribution’s repository. If there is no such package, you may try using the source code. - -[Timekpr-nExt Source Code][6] - -_**Again, do not use Timekpr-nExt for your own main account. You may lock yourself out.**_ - -You’ll see two instances of the application. Use the one with (SU) at the beginning. - -![][7] - -#### Removing Timekpr-nExt - -I cannot say for certain if removing Timekpr-nExt will also remove the restrictions you put in place for the users. It will be a good idea to manually restore them (putting 24 hr interval a day). There is no reset button here. - -To remove this application (if you used PPA to install it), use the following command: - -``` -sudo apt-get remove --purge timekpr-next -``` - -Delete the PPA repository as well: - -``` -sudo add-apt-repository -r ppa:mjasnik/ppa -``` - -Like [blocking adult content on Linux][8], this application is also children specific. Not everyone would find it useful but people with young children at home may use it if they feel the need. - -Do you use some other application to monitor/restrict children from accessing computer? - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/timekpr-next/ - -作者:[Abhishek Prakash][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/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/timekpr-next-ubuntu.png?resize=800%2C612&ssl=1 -[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/timekpr-next-icon-system-notification-area.png?resize=640%2C94&ssl=1 -[3]: https://mjasnik.gitlab.io/timekpr-next/ -[4]: https://launchpad.net/~mjasnik/+archive/ubuntu/ppa -[5]: https://aur.archlinux.org/packages/timekpr-next/ -[6]: https://launchpad.net/timekpr-next -[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/timekeeper-next.jpg?resize=799%2C250&ssl=1 -[8]: https://itsfoss.com/how-to-block-porn-by-content-filtering-on-ubuntu/ From 140d44821662dec5e04f17f3d9886ccc2f5727fa Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 16 Nov 2020 08:51:19 +0800 Subject: [PATCH 0783/1156] translated --- ... Per Account in Linux With Timekpr-nExt.md | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 translated/tech/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md diff --git a/translated/tech/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md b/translated/tech/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md new file mode 100644 index 0000000000..28537ef98a --- /dev/null +++ b/translated/tech/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md @@ -0,0 +1,111 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Got Kids? Limit Computer Usage Per Account in Linux With Timekpr-nExt) +[#]: via: (https://itsfoss.com/timekpr-next/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +有孩子吗?使用 Timekpr-nExt 限制 Linux 中每个账户的电脑使用 +====== + +_**本周的开源软件亮点是 Timekpr-nExt。它是一个 GUI 应用,用于限制 Linux 系统中某些账户的电脑使用。对于不想让孩子花太多时间在电脑上的父母来说,这是一个方便的工具。**_ + +### 使用 Timekpr-nExt 在 Linux 上限制电脑使用 + +如果你家里有小孩,他们花太多时间在电脑上,你可能想对他们的使用进行一些限制。 + +可以让你根据一天的时间、一天、一周或者一月的小时数来限制某些账户的电脑使用。你也可以设置时间间隔来强制账户用户休息。 + +![][1] + +给定的时间超过后,用户会自动注销,直到满足限制条件才可以重新登录。 + +![][2] + +当然,这意味着你需要为孩子们单独设置非管理员(无 sudo 权限)账户。如果孩子们的账户也有管理员权限,他们可以很容易地改变设置。孩子们很聪明,你知道的。 + +### Timekpr-nExt 的功能 + +除了一个令人讨厌的风格化的名字,Timekpr-nExt 有以下功能: + +* 将系统使用限制设置为日智能限制、每日限制、每周或每月限制 +* 你还可以根据时间和小时设置访问限制 +* 用户可以看到关于他们还剩多少时间的通知 +* 设置锁定动作(终止会话、关闭、暂停或锁定屏幕) +* 追踪账户的时间使用情况 + + + +请注意以下事项: + +* 仔细检查你正在配置的账户。_**不要把自己锁定**_。 +* 每次更改配置时,请点击应用或设置按钮,否则更改将不会被设置。 +* 儿童帐户不应该有管理员操作,否则他们会覆盖设置。 + + + +阅读[关于使用 Timekpr-nExt 的更多信息的文档][3]。 + +### 在 Linux 中安装 Timekpr-nExt + +对于基于 Ubuntu 的 Linux 发行版(如 Mint、Linux Lite 等),有一个[官方 PPA 可用][4]。你可以通过以下命令逐步安装它: + +``` +sudo add-apt-repository ppa:mjasnik/ppa +sudo apt update +sudo apt install timekpr-next +``` + +Arch Linux 用户可以[在 AUR 中找到它][5]。对于其他用户,请检查你的发行版仓库。如果没有这样的包,你可以尝试使用源码。 + +[Timekpr-nExt 源码][6] + +_**再说一次,不要在主账户中使用 Timekpr-nExt。你可能会把自己锁在外面。**_ + +你会看到两个应用的实例。使用开头有 (SU) 的那个。 + +![][7] + +#### 删除 Timekpr-nExt + +我不能确定删除 Timekpr-nExt 是否也会删除你为用户设置的限制。手动恢复他们(间隔一天 24 小时)会是一个好主意。这里没有重置按钮。 + +要删除这个应用(如果你使用 PPA 安装它),使用以下命令: + +``` +sudo apt-get remove --purge timekpr-next +``` + +同时删除 PPA 仓库: + +``` +sudo add-apt-repository -r ppa:mjasnik/ppa +``` + +和[在 Linux 上屏蔽成人内容][8]一样,这个应用也是专门针对儿童的。并不是每个人都会觉得它有用,但家里有小孩的人如果觉得有必要的话,可以使用它。 + +你是否使用其他应用来监控/限制儿童访问计算机? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/timekpr-next/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/timekpr-next-ubuntu.png?resize=800%2C612&ssl=1 +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/timekpr-next-icon-system-notification-area.png?resize=640%2C94&ssl=1 +[3]: https://mjasnik.gitlab.io/timekpr-next/ +[4]: https://launchpad.net/~mjasnik/+archive/ubuntu/ppa +[5]: https://aur.archlinux.org/packages/timekpr-next/ +[6]: https://launchpad.net/timekpr-next +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/timekeeper-next.jpg?resize=799%2C250&ssl=1 +[8]: https://itsfoss.com/how-to-block-porn-by-content-filtering-on-ubuntu/ \ No newline at end of file From 6d0d606c7be1b9efa7005a02b09ed3c84a244ae1 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 16 Nov 2020 09:02:43 +0800 Subject: [PATCH 0784/1156] translating --- ...w to Install Google Chrome on Fedora -Beginner-s Tutorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201112 How to Install Google Chrome on Fedora -Beginner-s Tutorial.md b/sources/tech/20201112 How to Install Google Chrome on Fedora -Beginner-s Tutorial.md index 47fa289a72..0d2b487ebd 100644 --- a/sources/tech/20201112 How to Install Google Chrome on Fedora -Beginner-s Tutorial.md +++ b/sources/tech/20201112 How to Install Google Chrome on Fedora -Beginner-s Tutorial.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 86d08891d3978e889fe432ad3e0accb030083c28 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 16 Nov 2020 09:39:11 +0800 Subject: [PATCH 0785/1156] Rename 20201109 DevOps Replaces Developers As Most Sought After Skill Set.md\ to 20201109 DevOps Replaces Developers As Most Sought After Skill Set.md --- ...9 DevOps Replaces Developers As Most Sought After Skill Set.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename "sources/talk/20201109 DevOps Replaces Developers As Most Sought After Skill Set.md\\" => sources/talk/20201109 DevOps Replaces Developers As Most Sought After Skill Set.md (100%) diff --git "a/sources/talk/20201109 DevOps Replaces Developers As Most Sought After Skill Set.md\\" b/sources/talk/20201109 DevOps Replaces Developers As Most Sought After Skill Set.md similarity index 100% rename from "sources/talk/20201109 DevOps Replaces Developers As Most Sought After Skill Set.md\\" rename to sources/talk/20201109 DevOps Replaces Developers As Most Sought After Skill Set.md From 7c80cb739f3b4d8efb93abb35ce41c7e177cad44 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 16 Nov 2020 13:22:59 +0800 Subject: [PATCH 0786/1156] PRF @geekpi --- ...201103 4 ways to run Kubernetes locally.md | 49 +++++++------------ 1 file changed, 17 insertions(+), 32 deletions(-) diff --git a/translated/tech/20201103 4 ways to run Kubernetes locally.md b/translated/tech/20201103 4 ways to run Kubernetes locally.md index 41b9f835c0..2457176a22 100644 --- a/translated/tech/20201103 4 ways to run Kubernetes locally.md +++ b/translated/tech/20201103 4 ways to run Kubernetes locally.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (4 ways to run Kubernetes locally) @@ -9,80 +9,67 @@ 本地运行 Kubernetes 的 4 种方法 ====== -设置一个本地开发环境,或者直接用这些工具尝试容器编排平台。 -![Business woman on laptop sitting in front of window][1] + +> 设置一个本地开发环境,或者直接用这些工具尝试容器编排平台。 + +![](https://img.linux.net.cn/data/attachment/album/202011/16/132219hn9q9dszudbdtn35.jpg) [Kubernetes][2] 是一个开源的容器编排平台。它由 Google 开发,为自动化部署、扩展和管理容器化应用提供了一个开源系统。虽然大多数人在云环境中运行 Kubernetes,但在本地运行 Kubernetes 集群不仅是可能的,它还至少有两个好处: * 在决定使用 Kubernetes 作为主要平台部署应用之前,你可以快速试用它。 * 在将任何东西推送到公共云之前,你可以将其设置为本地开发环境,从而实现开发环境和生产环境之间的分离。 - - 无论你的情况如何,将本地 Kubernetes 环境设置为你的开发环境都是推荐的选择,因为这种设置可以创建一个安全而敏捷的应用部署流程。 幸运的是,有多个平台可以让你尝试在本地运行 Kubernetes,它们都是开源的,并且都是 [Apache 2.0][3] 许可。 * [Minikube][4] 的主要目标是成为本地 Kubernetes 应用开发的最佳工具,并支持所有适合的 Kubernetes 特性。 * [kind][5] 使用 Docker 容器“节点”运行本地 Kubernetes 集群。 -* [CodeReady Containers][6] (CRC) 管理为测试和开发目的优化的本地 OpenShift 4.x 集群。 -* [Minishift][7] 通过在虚拟机 (VM) 内运行单节点 OpenShift 集群,帮助你在本地运行 OpenShift 3.x 集群。 - - +* [CodeReady Containers][6](CRC)用来管理为测试和开发目的优化的本地 OpenShift 4.x 集群。 +* [Minishift][7] 通过在虚拟机 (VM) 内运行单节点的 OpenShift 集群,帮助你在本地运行 OpenShift 3.x 集群。 ### Minikube ![Minikube][8] -(Bryant Son, [CC BY-SA 4.0][9]) - -[Minikube][10] 是在本地计算机上运行 Kubernetes 环境的最知名和最流行的选择。无论你使用什么操作系统,[Minikube 的文档][11]都会为你提供一个简单的[安装][12]指南。一般来说,安装 Minikube 只需运行两条命令: - +[Minikube][10] 是在本地计算机上运行 Kubernetes 环境的最知名、最流行的选择。无论你使用什么操作系统,[Minikube 的文档][11]都会为你提供一个简单的[安装][12]指南。一般来说,安装 Minikube 只需运行两条命令: ``` -$ curl -LO +$ curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-PLATFORM-amd64 $ sudo install minikube-PLATFORM-amd64 /usr/local/bin/minikube ``` -Minikube 可在Linux、macOS 或 Windows 上快速设置本地 Kubernetes 集群,其功能如下: +Minikube 可在 Linux、macOS 或 Windows 上快速设置本地 Kubernetes 集群,其功能如下: * 支持最新的 Kubernetes 版本(包括 6 个以前的小版本) -* 跨平台 (Linux、macOS、Windows) +* 跨平台(Linux、macOS、Windows) * 以虚拟机、容器或裸机的形式部署 -* 多个容器运行时 (CRI-O、containerd、Docker) +* 支持多个容器运行时(CRI-O、containerd、Docker) * 用于快速推送镜像的 Docker API 端点 * 负载均衡器、文件系统挂载、FeatureGates 和其他高级功能 * 用于轻松安装 Kubernetes 应用的附加组件 - - 因为 Minikube 是一个开源项目,你可以对它的[源代码][4]做贡献。 ### kind ![kind][13] -(Bryant Son, [CC BY-SA 4.0][9]) - -[kind][14] 的开发者将其描述为“一个使用 Docker 容器“节点”运行本地 Kubernetes 集群的工具”。它是为测试 Kubernetes 而设计的,但也可能用于本地开发或持续集成。 +[kind][14] 的开发者将其描述为“一个使用 Docker 容器‘节点’运行本地 Kubernetes 集群的工具”。它是为测试 Kubernetes 而设计的,但也可能用于本地开发或持续集成。 kind 支持: -* 多节点(包括高可用性)集群。 +* 多节点(包括高可用性)集群 * 从源码构建 Kubernetes 版本 -* Make/Bash/Docker 或 Bazel,以及预发布构建。 +* Make/Bash/Docker 或 Bazel,以及预发布构建 * Linux、MacOS 和 Windows - - -此外,kind 是一个经过云原生计算基金会 (CNCF) 认证的 Kubernetes 合规安装程序。因为它是开源的,你可以在它的 GitHub 仓库中找到 kind 的[源码][5]。 +此外,kind 是一个经过云原生计算基金会(CNCF)认证的 Kubernetes 合规安装程序。因为它是开源的,你可以在它的 GitHub 仓库中找到 kind 的[源码][5]。 ### CodeReady Container (CRC) ![CodeReady Container][15] -(Bryant Son, [CC BY-SA 4.0][9]) - 如果你想在本地尝试最新版本的 OpenShift,可以尝试红帽的 [CodeReady Containers][16] (CRC)。CRC 将一个最小的 OpenShift 4.x 集群带到你的本地计算机上,为开发和测试目的提供一个最小的环境。CRC 主要针对开发者的桌面使用。 你可以在 GitHub 上找到 CodeReady Container 的[源码][6],也是在 Apache 2.0 许可下提供的。 @@ -91,8 +78,6 @@ kind 支持: ![Minishift][17] -(Bryant Son, [CC BY-SA 4.0][9]) - [Minishift][7] 项目帮助你在本地用 [OKD][19] 在虚拟机内的单节点 OpenShift 集群[运行一个版本的 OpenShift][18]。你可以用它来[尝试 OpenShift][20],或者在你的本地主机上为云开发。 和这个列表中的其他工具一样,Minishift 也是开源的,你可以在 GitHub 上访问它的[源码][7]。 @@ -108,7 +93,7 @@ via: https://opensource.com/article/20/11/run-kubernetes-locally 作者:[Bryant Son][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a0752e56ae36040d76f2d80a102f8681ef033235 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 16 Nov 2020 13:25:51 +0800 Subject: [PATCH 0787/1156] PUB @geekpi https://linux.cn/article-12825-1.html --- .../20201103 4 ways to run Kubernetes locally.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201103 4 ways to run Kubernetes locally.md (98%) diff --git a/translated/tech/20201103 4 ways to run Kubernetes locally.md b/published/20201103 4 ways to run Kubernetes locally.md similarity index 98% rename from translated/tech/20201103 4 ways to run Kubernetes locally.md rename to published/20201103 4 ways to run Kubernetes locally.md index 2457176a22..9778b00d30 100644 --- a/translated/tech/20201103 4 ways to run Kubernetes locally.md +++ b/published/20201103 4 ways to run Kubernetes locally.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12825-1.html) [#]: subject: (4 ways to run Kubernetes locally) [#]: via: (https://opensource.com/article/20/11/run-kubernetes-locally) [#]: author: (Bryant Son https://opensource.com/users/brson) From 4be208267165fa08e38cb5d84a309e25f03d5504 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 16 Nov 2020 13:58:15 +0800 Subject: [PATCH 0788/1156] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @chenmu-kk 这篇翻译不太仔细。 --- ...4 open source eBook readers for Android.md | 123 ++++++++---------- 1 file changed, 51 insertions(+), 72 deletions(-) diff --git a/translated/tech/20191003 4 open source eBook readers for Android.md b/translated/tech/20191003 4 open source eBook readers for Android.md index 327c53ee69..529f5c8258 100644 --- a/translated/tech/20191003 4 open source eBook readers for Android.md +++ b/translated/tech/20191003 4 open source eBook readers for Android.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (chenmu-kk) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (4 open source eBook readers for Android) @@ -9,133 +9,112 @@ 四款安卓开源电子书阅读器 ====== -你在寻找新的电子书阅读软件吗?来看看这四个适用于安卓的可靠开源电子书阅读器吧。 -![Computer browser with books on the screen][1] -谁不想有一个好的阅读体验?你可以在自己安卓手机或平板上阅读一本书、杂志或其他文本,而非将时间浪费在社交媒体或[即时消息软件][2]上。 +> 你在寻找新的电子书阅读软件吗?来看看这四款适用于安卓的可靠的开源电子书阅读器吧。 -要做到这一点,你需要的是一个适合的电子书阅读软件。接下来让我们来看一看四款可靠、开源的安卓电子书阅读器。 +![](https://img.linux.net.cn/data/attachment/album/202011/16/135728ayhh1aiqwrva50zy.jpg) + +谁不想有一个好的阅读体验?与其将时间浪费在社交媒体或[即时消息软件][2]上,不如在自己的安卓手机或平板上阅读一本书、杂志或其他文档。 + +要做到这一点,你需要的是一个适合的电子书阅读软件。接下来让我们来看一看四款可靠的、开源安卓电子书阅读器。 ### Book Reader -那我们先从我最喜欢的一款开源安卓电子书阅读器开始:[Book Reader][3]。它基于现在已有专利的FBReader应用的开源老版本。像FBReader的早期版本一样,Book Reader小而简单,但是好用。 +那我们先从我最喜欢的一款开源安卓电子书阅读器开始:[Book Reader][3]。它基于现在专有的 FBReader 应用的开源老版本。像 FBReader 的早期版本一样,Book Reader 小而简单,但是好用。 **优点:** - * 易于操作。 * 该应用界面遵循安卓的 [Material Design 指南][4],因此非常干净。 * 你可以为电子书添加书签,并将文本分享至你设备上的其他应用。 - * 不断提供除英语外的其他语言的支持 - - + * 不断提供除英语外的其他语言的支持。 **缺点** - * Book Reader的自定义选项较少 - * 没有内置词典或支持外部词典的功能 - - + * Book Reader 的自定义选项较少。 + * 没有内置词典或支持外部词典的功能。 **支持的电子书格式:** -Book Reader支持EPUB、 .mobi、PDF、[DjVu][5]、HTML、纯文本、 Word文本、RTF和[FictionBook][6]。 +Book Reader 支持 EPUB、.mobi、PDF、[DjVu][5]、HTML、纯文本、 Word 文档、RTF 和 [FictionBook][6]。 ![Book Reader Android app][7] -Book Reader的源码已获得GNU通用公共许可证版本3.0的许可,你可以在[GitLab][8]中找到它。 +Book Reader 的源码在 GNU GPL 3.0 下授权,你可以在[GitLab][8]中找到它。 ### Cool Reader -[Cool Reader][9]是一个灵活易用的电子书软件。虽然我觉得该软件的图标会让想起Windows vista中的图标,但它确实有一些好用的功能。 +[Cool Reader][9] 是一个灵活易用的电子书软件。虽然我觉得该软件的图标会让想起 Windows vista 中的图标,但它确实有一些好用的功能。 **优点** * 高度自定义,你可以更改字体、行宽、段间距、连字符、字体大小、页边距以及背景色。 - * 你可以覆盖书中的样式表。我发现这对于两三本书将所有文本设置为大小写字母很有用。 - * 它会在设备启动时自动搜寻设备中的新书资源。你也可以查阅有关[Gutenberg计划][10] 和 [互联网档案馆][11]中的书籍。 - - - -**优点** - - * Cool Reader没有极简或者说最现代化的界面。 - * 虽然它开箱即用,但实际上你需要调整一些配置来更舒适地使用Cool Reader。 - * 应用的默认词典是专有的,尽管你可以用[开源的词典][12]来替换掉它。 - - - -**支持的电子书格式:** - -你可以使用Cool Reader来浏览EPUB、小说、纯文本、RTF、HTML、[Compiled HTML Help][13] (.chm)和TCR (Psion系列掌上电脑的电子书格式)文件。 - -![Cool Reader Android app][14] - -Cool Reader的源码已获得GNU通用公共许可证版本2的许可,你可以在[Sourceforge][15]中找到它。 - -### KOReader - -[KOReader][16]最初是为了[E Ink][17] 电子书阅读器创建的,但后来发现它可用于安卓。 在测试它时,我发现KOReader在同等程度下既有用又令人沮丧。很明显它绝不是一款不好的应用,但不会是我的首选。 - -**优点** - - * 高度自定义 - * 支持多种语言 - * 它允许你使用[词典][18](若你已安装)或者Wikipedia(若你已连接至网络)来查单词 - - + * 你可以覆盖书中的样式表。我发现这对于两三本将所有文本设置为小写字母的书很有用。 + * 它会在设备启动时自动搜寻设备中的新书资源。你也可以查阅[古腾堡计划][10]和[互联网档案馆][11]中的书籍。 **缺点** - * 每一本书你都需要改变设置。在你打开一本新书时,KOReader不会保存相关设置 - * 它的界面会让人觉得是一款专用电子书阅读器。该应用没有安卓的外形和感受。 - - + * Cool Reader 的界面并不是极简或者说最现代化的。 + * 虽然它开箱即用,但实际上你需要调整一些配置来更舒适地使用 Cool Reader。 + * 应用的默认词典是专有的,尽管你可以用[开源的词典][12]来替换掉它。 **支持的电子书格式:** -你可以查阅PDF、DjVu、CBT、以及[CBZ][5]电子书。它也支持EPUB、小说、.mobi、Word文档、文本文件和[Compiled HTML Help][13] (.chm)文件。 +你可以使用 Cool Reader 来浏览 EPUB、小说、纯文本、RTF、HTML、[CHM][13] 和 TCR(Psion 系列掌上电脑的电子书格式)文件。 + +![Cool Reader Android app][14] + +Cool Reader 的源码在 GNU GPL 2 下授权,你可以在 [Sourceforge][15] 中找到它。 + +### KOReader + +[KOReader][16] 最初是为了 [E Ink][17] 电子书阅读器创建的,但后来发现它可用于安卓。在测试它时,我发现 KOReader 在同等程度下既有用又令人沮丧。很明显它绝不是一款不好的应用,但不会是我的首选。 + +**优点** + + * 高度自定义。 + * 支持多种语言。 + * 它允许你使用[词典][18](若你已安装)或者 Wikipedia(若你已连接至网络)来查单词。 + +**缺点** + + * 每一本书你都需要改变设置。在你打开一本新书时,KOReader 不会记住相关设置 + * 它的界面会让人觉得是一款专门的电子书阅读器。该应用没有安卓的外形和感受。 + +**支持的电子书格式:** + +你可以查阅 PDF、DjVu、CBT、以及 [CBZ][5] 电子书。它也支持 EPUB、小说、.mobi、Word 文档、文本文件和 [CHM][13] 文件。 ![KOReader Android app][19] -Cool Reader的源码已获得GNU Affero通用公共许可证版本3.0的许可,你可以在[GitHub][20]上找到它。 +Cool Reader 的源码在 GNU Affero GPL 3.0 下授权,你可以在 [GitHub][20] 上找到它。 ### Booky McBookface -是的,那真的是[这个电子书阅读器][21]的名字。它是这篇文章中最基础的电子书阅读器,但不要让它(或者说这个傻乎乎的名字)使你失望。Booky McBookface易于使用并且有一件事它做的很好。 +是的,这确实是[这款电子书阅读器][21]的名字。它是这篇文章中最基础的电子书阅读器,但不要因此(或者这个傻乎乎的名字)使你失望。Booky McBookface 易于使用,并且有一件事它做的很好。 **优点** * 没有多余的装饰。只有你和你的电子书。 * 界面简洁。 - * 在安卓启动栏中的长按软件图标会弹出一个菜单,你可以从中打开正在阅读的最后一本书、获得所有未读书单列表、或者查找并打开设备上的一本书。 + * 在安卓启动栏中的长按软件图标会弹出一个菜单,你可以从中打开正在阅读的最后一本书、获得未读书籍的列表、或者查找并打开设备上的一本书。 - - -**优点** +**缺点** * 软件中几乎没有配置选项——你可以更改字体大小和亮度,仅此而已。 * 你需要使用屏幕底部的按钮浏览电子书。点击屏幕边缘无法操作。 * 无法为电子书添加书签。 +**支持的电子书格式** - -**优点** - -你可以使用该软件阅读EPUB格式、HTML文本,或纯文本格式的电子书 +你可以使用该软件阅读 EPUB 格式、HTML 文档,或纯文本格式的电子书。 ![Booky McBookface Android app][22] -Booky McBookface的源码在GNU通用公共许可证版本3.0下可用,你可以在[GitHub][23]中找到它。 +Booky McBookface 的源码在 GNU GPL 3.0 下授权,你可以在 [GitHub][23] 中找到它。 你有最喜欢的安卓开源电子书阅读器吗?在社区中留言分享一下吧。 -Have you ever downloaded an Android app only to find that it wants access to all your phone's... - -There is a rich and growing ecosystem of open source applications for mobile devices, just like the... - -With these seven open source apps, you can play chess against your phone or an online opponent,... - -------------------------------------------------------------------------------- via: https://opensource.com/article/19/10/open-source-ereaders-android @@ -143,7 +122,7 @@ via: https://opensource.com/article/19/10/open-source-ereaders-android 作者:[Scott Nesbitt][a] 选题:[lujun9972][b] 译者:[chenmu-kk](https://github.com/chenmu-kk) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 24c5880288bacf4b80a1afdc603b0c38f68fe2f1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 16 Nov 2020 13:58:59 +0800 Subject: [PATCH 0789/1156] PUB @chenmu-kk https://linux.cn/article-12826-1.html --- .../tech/20191003 4 open source eBook readers for Android.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translated/tech/20191003 4 open source eBook readers for Android.md b/translated/tech/20191003 4 open source eBook readers for Android.md index 529f5c8258..89cbee1312 100644 --- a/translated/tech/20191003 4 open source eBook readers for Android.md +++ b/translated/tech/20191003 4 open source eBook readers for Android.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (chenmu-kk) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12826-1.html) [#]: subject: (4 open source eBook readers for Android) [#]: via: (https://opensource.com/article/19/10/open-source-ereaders-android) [#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) From 69161e5c2a9f76720ba598e9ba97370bce05b17f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 16 Nov 2020 18:41:43 +0800 Subject: [PATCH 0790/1156] PRF @robsean --- .../20200928 Add sound to your Python game.md | 80 ++++++++----------- 1 file changed, 35 insertions(+), 45 deletions(-) diff --git a/translated/tech/20200928 Add sound to your Python game.md b/translated/tech/20200928 Add sound to your Python game.md index 916f54cc64..4f0fc228a1 100644 --- a/translated/tech/20200928 Add sound to your Python game.md +++ b/translated/tech/20200928 Add sound to your Python game.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Add sound to your Python game) @@ -9,10 +9,12 @@ 添加声音到你的 Python 游戏 ====== -通过添加声音到你的游戏中,听听当你的英雄战斗,跳跃,收集战利品时会发生什么。学习如何在这一 Pygame 系列的第十三篇文章中,创建一个声音平台类精灵。 + +> 通过添加声音到你的游戏中,听听当你的英雄战斗、跳跃、收集战利品时会发生什么。学习如何在这个 Pygame 系列的第十三篇文章中,创建一个声音平台类精灵。 + ![彩色声波图][1] -这是仍在进行中的关于使用 [Pygame][3] 模块来在 [Python 3][2] 中创建电脑游戏的第十三部分。先前的文章是: +在 [Python 3][2] 中使用 [Pygame][3] 模块来创建电脑游戏的系列文章仍在进行中,这是第十三部分。先前的文章是: 1. [通过构建一个简单的掷骰子游戏去学习怎么用 Python 编程][4] 2. [使用 Python 和 Pygame 模块构建一个游戏框架][5] @@ -25,18 +27,15 @@ 9. [使你的 Python 游戏玩家能够向前和向后跑][12] 10. [在你的 Python 平台类游戏中放一些奖励][13] 11. [添加计分到你的 Python 游戏][14] - 12. [在你的Python游戏中加入投掷技巧][15] - - + 12. [在你的 Python 游戏中加入投掷技巧][15] Pygame 提供了一种简单的方法来集成声音到你的 Python 电脑游戏中。Pygame 的 [mixer 模块][16] 可以依据命令播放一个或多个声音,并且你也可以将这些声音混合在一起,例如,你能够在听到你的英雄收集奖励或跳过敌人声音的同时播放背景音乐。 -集成 mixer 模块到一个已存在的游戏中是很容易的,因此 — 并不是给予你代码示例来向你展示放置它们的准确位置 — 这篇文章分四个所需要的步骤来阐明如何在你应用程序中的获取声音。 +集成 `mixer` 模块到一个已存在的游戏中是很容易的,因此,与其给你代码示例来向你展示放置它们的位置,不如在这篇文章解释在你的应用程序中获得声音所需的四个步骤。 ### 启动 mixer -首先,在你代码的 setup 部分,启动 mixer 进程。你的代码已经启动 Pygame 和 Pygame 字体,因此将它们归类到一起是一个很好的主意: - +首先,在你代码的设置部分,启动 `mixer` 进程。你的代码已经启动 Pygame 和 Pygame 字体,因此将它们归类到一起是一个很好的主意: ``` pygame.init() @@ -48,16 +47,15 @@ pygame.mixer.init() # add this line 接下来,你必需定义你想要使用的声音。这样就要求你的计算机上有声音文件,就像使用字体就要求你有字体文件,使用图像就要求你有图像文件一样。 -你还必需把这些声音与你的游戏捆绑在一起,以便任何玩你游戏的人都有声音文件。 +你还必需把这些声音与你的游戏捆绑在一起,以便任何玩你游戏的人都有这些声音文件。 为将一个声音与你的游戏捆绑在一起,首先在你的游戏目录中创建一个新的目录,就像你为你图像和字体创建的目录一样。称它为 `sound`: - ``` s = 'sound' ``` -尽管在互联网上有很多声音文件,下载这些声音文件并将其与你的游戏一起分发并不一定是合法的。这看起来是很奇怪的,因为这么多来自著名电脑游戏的声音是流行文化的一部分,但法律就是这样运作的。如果你想与你的游戏一起分发一个声音文件,你必需找到一个开放源码或 [Creative Commons][17] 声音文件,它们准许与游戏一起提供声音。 +尽管在互联网上有很多声音文件,下载这些声音文件并将其与你的游戏一起分发并不一定是合法的。这看起来是很奇怪的,因为这么多来自著名电脑游戏的声音是流行文化的一部分,但法律就是这样运作的。如果你想与你的游戏一起分发一个声音文件,你必需找到一个开源或[共创许可][17]的声音文件,它们准许与游戏一起提供声音。 这里有一些专门提供自由和合法的声音文件的网站,包括: @@ -65,28 +63,23 @@ s = 'sound' * [Incompetech][19] 托管存储背景音乐。 * [Open Game Art][20] 托管存储一些音效和音乐。 +一些声音文件只要你给予作曲家或声音设计师一个致谢就可以自由使用。在与你的游戏捆绑前,仔细阅读使用条件!音乐家和声音设计师在声音上的工作就像你在代码上的工作一样努力,因此即使他们不要求,给予他们致谢也是极好的。 +给予你的声音源文件一些致谢,在一个名为 `CREDIT` 的文本文件中列出你使用的声音,并在你的游戏文件夹中放置该文本文件。 - - -一些声音文件只有当你给予作曲家或声音设计师一下费用时才是可以自由使用的。在与你的游戏捆绑前,仔细阅读使用条件!音乐家和声音设计师在声音上的工作就像你在代码上的工作一样努力,因此当他们不要一些费用时,给予他们一些费用也是极好的。 - -给予你的声音源文件一些费用,在一个名称为 `CREDIT` 的文本文件中列出你使用的声音,并在你的游戏文件夹中放置该文本文件。 - -你也可以尝试制作你自己的音乐。极好的 [LMMS][21] 音频工作站易于使用,并携带很多有趣的声音。它在所有主要的平台上都可以使用,也可以导出为 [Ogg Vorbis][22] (OGG) 音频格式。 +你也可以尝试制作你自己的音乐。优秀的 [LMMS][21] 音频工作站易于使用,并带有很多有趣的声音。它在所有主要的平台上都可以使用,也可以导出为 [Ogg Vorbis][22](OGG)音频格式。 ### 添加声音到 Pygame -当你找到你喜欢的一个声音文件时,下载它。如果它来自一个 ZIP 或 TAR 文件中,提取它并将其移动到你游戏目录中的 `sound` 文件夹中。 +当你找到你喜欢的一个声音文件时,下载它。如果它是一个 ZIP 或 TAR 文件,提取它并将其移动到你游戏目录中的 `sound` 文件夹中。 -如果声音文件有一个带有空格或特殊字符的名字,重新命名它。文件名称是完全随意的,它的名称越简单,你就越容易输入到你的代码中。 +如果声音文件的名字带有空格或特殊字符,重新命名它。文件名称是完全随意的,它的名称越简单,你就越容易输入到你的代码中。 -大多数的电脑游戏使用 OGG 格式声音文件,因为这种格式在占有较小空间的情况下提供高质量的声音。当你下载一个声音文件时,它可能是一个 MP3, WAVE, FLAC, 或者其它的音频格式。为保持你的文件的较高兼容性和降低下载文件大小,使用一个工具 (像 [fre:ac][23] 或 [Miro][24]) 来转换这些的文件格式为 Ogg 格式。 +大多数的电脑游戏使用 OGG 格式声音文件,因为这种格式可以占有较小空间而提供高质量的声音。当你下载一个声音文件时,它可能是一个 MP3、WAVE、FLAC 或者其它的音频格式。为保持你的文件的较高兼容性和降低下载文件大小,使用一个像 [fre:ac][23] 或 [Miro][24] 这样的工具来转换这些的文件格式为 Ogg 格式。 -例如,假设你已经下载一个称为 ouch.ogg 的声音文件。 - -在你代码的 setup 部分中,创建一个代表这你想使用的声音文件的变量: +例如,假设你已经下载一个称为 `ouch.ogg` 的声音文件。 +在你代码的设置部分中,创建一个变量,代表你想使用的声音文件: ``` ouch = pygame.mixer.Sound(os.path.join(s, 'ouch.ogg')) @@ -94,8 +87,7 @@ ouch = pygame.mixer.Sound(os.path.join(s, 'ouch.ogg')) ### 触发一个声音 -为使用一个声音,你所需要做的全部工作是,当你想触发声音时来调用变量。例如,当你的玩家击中一名敌人时,触发 `OUCH` 声音效果: - +为使用一个声音,你所要做的就是在你想触发它的时候调用这个变量。例如,当你的玩家击中一名敌人时,触发 `OUCH` 声音效果: ``` for enemy in enemy_hit_list: @@ -103,12 +95,11 @@ for enemy in enemy_hit_list: score -= 1 ``` -你可以为所有的动作类型创建声音,例如,跳跃,收集奖励,投掷,碰撞,和任何你可以想象到的东西。 +你可以为各种动作创建声音,例如,跳跃、收集奖励、投掷、碰撞,以及其他任何你能想象到的动作。 ### 添加背景音乐 -如果你有你想在你的游戏的背景中播放的音乐或令人激动的音效,你可以使用 Pygame 中的 mixer 模块中的`music` 函数。在你的 setup 部分中,加载音乐文件: - +如果你有想在你的游戏的背景中播放的音乐或令人激动的音效,你可以使用 Pygame 中的 `mixer` 模块中的 `music` 函数。在你的设置部分中,加载音乐文件: ``` music = pygame.mixer.music.load(os.path.join(s, 'music.ogg')) @@ -116,14 +107,13 @@ music = pygame.mixer.music.load(os.path.join(s, 'music.ogg')) 然后,开始音乐: - ``` pygame.mixer.music.play(-1) ``` -`-1` 值来告诉 Pygame 无限循环音乐文件。你可以将其设置为 `0` 或任意更高的数值,以定义音乐在停止前循环多少次。 +`-1` 值告诉 Pygame 无限循环音乐文件。你可以将其设置为从 0 到更高的值之间的任意数值,以定义音乐在停止前循环多少次。 -### 享受声音时空 +### 享受音效 音乐和声音可以为你的游戏添加很多韵味。尝试添加一些声音到你的 Pygame 工程! @@ -134,7 +124,7 @@ via: https://opensource.com/article/20/9/add-sound-python-game 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[robsean](https://github.com/robsean) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -143,17 +133,17 @@ via: https://opensource.com/article/20/9/add-sound-python-game [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/colorful_sound_wave.png?itok=jlUJG0bM (Colorful sound wave graph) [2]: https://www.python.org/ [3]: https://www.pygame.org/news -[4]: https://opensource.com/article/17/10/python-101 -[5]: https://opensource.com/article/17/12/game-framework-python -[6]: https://opensource.com/article/17/12/game-python-add-a-player -[7]: https://opensource.com/article/17/12/game-python-moving-player -[8]: https://opensource.com/article/18/5/pygame-enemy -[9]: https://opensource.com/article/18/7/put-platforms-python-game -[10]: https://opensource.com/article/19/11/simulate-gravity-python -[11]: https://opensource.com/article/19/12/jumping-python-platformer-game -[12]: https://opensource.com/article/19/12/python-platformer-game-run -[13]: https://opensource.com/article/19/12/loot-python-platformer-game -[14]: https://opensource.com/article/20/1/add-scorekeeping-your-python-game +[4]: https://linux.cn/article-9071-1.html +[5]: https://linux.cn/article-10850-1.html +[6]: https://linux.cn/article-10858-1.html +[7]: https://linux.cn/article-10874-1.html +[8]: https://linux.cn/article-10883-1.html +[9]: https://linux.cn/article-10902-1.html +[10]: https://linux.cn/article-11780-1.html +[11]: https://linux.cn/article-11790-1.html +[12]: https://linux.cn/article-11819-1.html +[13]: https://linux.cn/article-11828-1.html +[14]: https://linux.cn/article-11839-1.html [15]: https://opensource.com/article/20/9/add-throwing-python-game [16]: https://www.pygame.org/docs/ref/mixer.html [17]: https://opensource.com/article/20/1/what-creative-commons From dd711bbb7ba734e3f14ed8150e2bce6445004e5f Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Mon, 16 Nov 2020 19:27:35 +0800 Subject: [PATCH 0791/1156] Update 20190115 Linux Desktop Setup - HookRace Blog.md --- sources/tech/20190115 Linux Desktop Setup - HookRace Blog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190115 Linux Desktop Setup - HookRace Blog.md b/sources/tech/20190115 Linux Desktop Setup - HookRace Blog.md index 29d5f63d2a..ee621d6234 100644 --- a/sources/tech/20190115 Linux Desktop Setup - HookRace Blog.md +++ b/sources/tech/20190115 Linux Desktop Setup - HookRace Blog.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (chenmu-kk) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 2cf788c8bffa7964e3670f46186940c7b5906f4f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 16 Nov 2020 21:54:40 +0800 Subject: [PATCH 0792/1156] PUB @chenmu-kk https://linux.cn/article-12826-1.html --- .../20191003 4 open source eBook readers for Android.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20191003 4 open source eBook readers for Android.md (100%) diff --git a/translated/tech/20191003 4 open source eBook readers for Android.md b/published/20191003 4 open source eBook readers for Android.md similarity index 100% rename from translated/tech/20191003 4 open source eBook readers for Android.md rename to published/20191003 4 open source eBook readers for Android.md From 92c19288e7f6a07a5789f1f25a2afd7f202e3baf Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 17 Nov 2020 05:02:18 +0800 Subject: [PATCH 0793/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201116?= =?UTF-8?q?=20Podman=20with=20capabilities=20on=20Fedora?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201116 Podman with capabilities on Fedora.md --- ...1116 Podman with capabilities on Fedora.md | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 sources/tech/20201116 Podman with capabilities on Fedora.md diff --git a/sources/tech/20201116 Podman with capabilities on Fedora.md b/sources/tech/20201116 Podman with capabilities on Fedora.md new file mode 100644 index 0000000000..236ea0072e --- /dev/null +++ b/sources/tech/20201116 Podman with capabilities on Fedora.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Podman with capabilities on Fedora) +[#]: via: (https://fedoramagazine.org/podman-with-capabilities-on-fedora/) +[#]: author: (shiwanibiradar https://fedoramagazine.org/author/shiwanibiradar/) + +Podman with capabilities on Fedora +====== + +![][1] + +Containerization is a booming technology. As many as seventy-five percent of global organizations could be running some type of containerization technology in the near future. Since widely used technologies are more likely to be targeted by hackers, securing containers is especially important. This article will demonstrate how [POSIX capabilities][2] are used to secure Podman containers. Podman is the default container management tool in RHEL8. + +### Determine the Podman container’s privilege mode + +Containers run in either privileged or unprivileged mode. In privileged mode, [the container uid 0 is mapped to the host’s uid 0][3]. For some use cases, unprivileged containers [lack sufficient access][4] to the resources of the host machine. Technologies and techniques including Mandatory Access Control (apparmor, SELinux), seccomp filters, dropping of capabilities, and namespaces help to secure containers regardless of their mode of operation. + +**To determine the privilege mode from outside the container:** + +``` +$ podman inspect --format="{{.HostConfig.Privileged}}" +``` + +If the above command returns _true_ then the container is running in privileged mode. If it returns _false_ then the container is running in unprivileged mode. + +**To determine the privilege mode from inside the container:** + +``` +$ ip link add dummy0 type dummy +``` + +If this command allows you to create an interface then you are running a privileged container. Otherwise you are running an unprivileged container. + +### Capabilities + +Namespaces isolate a container’s processes from arbitrary access to the resources of its host and from access to the resources of other containers running on the same host. Processes within _privileged_ containers, however, might still be able to do things like alter the IP routing table, trace arbitrary processes, and load kernel modules. Capabilities allow one to apply finer-grained restrictions on what resources the processes within a container can access or alter; even when the container is running in privileged mode. Capabilities also allow one to assign privileges to an unprivileged container that it would not otherwise have. + +For example, to add the _NET_ADMIN_ capability to an unprivileged container so that a network interface can be created inside of the container, you would run _podman_ with parameters similar to the following: + +``` +[root@vm1 ~]# podman run -it --cap-add=NET_ADMIN centos +[root@b27fea33ccf1 /]# ip link add dummy0 type dummy +[root@b27fea33ccf1 /]# ip link +``` + +The above commands demonstrate a _dummy0_ interface being created in an unprivileged container. Without the _NET_ADMIN_ capability, an unprivileged container would not be able to create an interface. The above commands demonstrate how to grant a capability to an unprivileged container. + +Currently, there are about [39 capabilities][5] that can be granted or denied. Privileged containers are granted many capabilities by default. It is advisable to drop unneeded capabilities from privileged containers to make them more secure. + +**To drop all capabilities from a container:** + +``` +$ podman run -it -d --name mycontainer --cap-drop=all centos +``` + +**To list a container’s capabilities:** + +``` +$ podman exec -it 48f11d9fa512 capsh --print +``` + +The above command should show that no capabilities are granted to the container. + +**Refer to the _capabilities_ man page for a complete list of capabilities:** + +``` +$ man capabilities +``` + +**Use the _capsh_ command to list the capabilities you currently possess:** + +``` +$ capsh --print +``` + +As another example, the below command demonstrates dropping the _NET_RAW_ capability from a container. Without the _NET_RAW_ capability, servers on the internet cannot be pinged from within the container. + +``` +$ podman run -it --name mycontainer1 --cap-drop=net_raw centos +>>> ping google.com (will output error, operation not permitted) +``` + +As a final example, if your container were to only need the _SETUID_ and _SETGID_ capabilities, you could achieve such a permission set by dropping all capabilities and then re-adding only those two. + +``` +$ podman run -d --cap-drop=all --cap-add=setuid --cap-add=setgid fedora sleep 5 > /dev/null; pscap | grep sleep +``` + +The _pscap_ command shown above should show the capabilities that have been granted to the container. + +I hope you enjoyed this brief exploration of how capabilities are used to secure Podman containers. + +Thank You! + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/podman-with-capabilities-on-fedora/ + +作者:[shiwanibiradar][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/shiwanibiradar/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2018/10/podman-816x345.jpg +[2]: https://www.linuxjournal.com/magazine/making-root-unprivileged +[3]: https://linuxcontainers.org/lxc/security/#privileged-containers +[4]: https://github.com/containers/podman/blob/master/rootless.md +[5]: https://man7.org/linux/man-pages/man7/capabilities.7.html From 4f3f78fd4f141a93b5ceb9c75a2e7bd97048e65c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 17 Nov 2020 05:02:41 +0800 Subject: [PATCH 0794/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201116?= =?UTF-8?q?=20Manage=20multiple=20Terraform=20versions=20with=20tfenv?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201116 Manage multiple Terraform versions with tfenv.md --- ... multiple Terraform versions with tfenv.md | 262 ++++++++++++++++++ 1 file changed, 262 insertions(+) create mode 100644 sources/tech/20201116 Manage multiple Terraform versions with tfenv.md diff --git a/sources/tech/20201116 Manage multiple Terraform versions with tfenv.md b/sources/tech/20201116 Manage multiple Terraform versions with tfenv.md new file mode 100644 index 0000000000..28ddcd0b4c --- /dev/null +++ b/sources/tech/20201116 Manage multiple Terraform versions with tfenv.md @@ -0,0 +1,262 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Manage multiple Terraform versions with tfenv) +[#]: via: (https://opensource.com/article/20/11/tfenv) +[#]: author: (Jessica Cherry https://opensource.com/users/cherrybomb) + +Manage multiple Terraform versions with tfenv +====== +If you use multiple Terraform versions in your environment, tfenv will +make your life much easier. +![Computer screen with files or windows open][1] + +In my [Terraform for Kubernetes beginners][2] article, I used Terraform 11, and in an upcoming article, I'll cover upgrading from Terraform 11 to 12. To prepare for that, in this article, I'll show you how to use [tfenv][3], a tool that makes it much easier to convert from one version to another, as well as to manage multiple Terraform versions in your work environment. + +### Install tfenv + +Many coding languages have tools that allow you to go back and forth between versions based on environmental rules. One example (which tfenv is based on) is [rbenv][4], which allows you to choose which version of [Ruby][5] you want to work with. + +tfenv works on Linux, macOS, and Windows; I'll cover the Linux installation using Ubuntu 18.04, but the tool's GitHub repository has [installation instructions][6] for the other operating systems. + +The Linux installation uses some Git commands (check out the [intro to Git][7] series if you're not already familiar with it). + +First, create a `.tfenv` folder in your `${HOME}` directory: + + +``` +`jess@Athena:~$ mkdir .tfenv` +``` + +Clone the `tfenv` repository: + + +``` +jess@Athena:~$ git clone ~/.tfenv +Cloning into '/home/jess/.tfenv'... +remote: Enumerating objects: 21, done. +remote: Counting objects: 100% (21/21), done. +remote: Compressing objects: 100% (19/19), done. +remote: Total 1105 (delta 8), reused 10 (delta 2), pack-reused 1084 +Receiving objects: 100% (1105/1105), 216.01 KiB | 2.84 MiB/s, done. +Resolving deltas: 100% (703/703), done. +``` + +If you prefer [Homebrew][8], you can use: + + +``` +`$ brew install tfenv` +``` + +Export your path into your Bash profile: + + +``` +`jess@Athena:~$ echo 'export PATH="$HOME/.tfenv/bin:$PATH"' >> ~/.bash_profile` +``` + +If you want to use just the base commands for Ubuntu/Debian-based systems, there is another option that makes things a little easier. After doing the clone in the `.tfenv` directory, set your profile to put the `tfenv` command into your profile in your next session: + + +``` +`jess@Athena:~/.tfenv$ . ~/.profile` +``` + +Once the profile is set, you can symlink your directory to your `.local/bin` directory to make `tfenv` an executable binary: + + +``` +`jess@Athena:~/.tfenv$ ln -s ~/.tfenv/bin/* ~/.local/bin` +``` + +Run the `which` command, and you should see `tfenv`'s location: + + +``` +jess@Athena:~/.tfenv$ which tfenv +/home/jess/.local/bin/tfenv +``` + +### How to use tfenv + +Now that everything is installed, check out what commands are available: + + +``` +jess@Athena:~$ tfenv +tfenv 2.0.0-37-g0494129 +Usage: tfenv <command> [<options>] + +Commands: +   install      Install a specific version of Terraform +   use          Switch a version to use +   uninstall    Uninstall a specific version of Terraform +   list         List all installed versions +   list-remote  List all installable versions +``` + +As you can see, it's a pretty straightforward tool that enables you to install and uninstall Terraform versions as needed. + +Before you decide what to install, check which versions are available. This is a small snippet, as the list is about a mile long: + + +``` +jess@Athena:~$ tfenv list-remote +0.14.0-beta1 +0.14.0-alpha20201007 +0.14.0-alpha20200923 +0.14.0-alpha20200910 +0.13.5 +0.13.4 +0.13.3 +0.13.2 +0.13.1 +0.13.0 +0.13.0-rc1 +0.13.0-beta3 +0.13.0-beta2 +0.13.0-beta1 +0.12.29 +0.12.28 +0.12.27 +``` + +#### Install Terraform versions + +To install the latest version of Terraform: + + +``` +jess@Athena:~$ tfenv install latest +Installing Terraform v0.13.5 +Downloading release tarball from +###################################################################################################################################################################################### 100.0% +Downloading SHA hash file from +No keybase install found, skipping OpenPGP signature verification +Archive:  tfenv_download.N3bzZ2/terraform_0.13.5_linux_amd64.zip +  inflating: /home/jess/.tfenv/versions/0.13.5/terraform   +Installation of terraform v0.13.5 successful. To make this your default version, run 'tfenv use 0.13.5' +``` + +To install a specific Terraform version (in this case, 0.12.29): + + +``` +jess@Athena:~$ tfenv install 0.12.29 +Installing Terraform v0.12.29 +Downloading release tarball from +###################################################################################################################################################################################### 100.0% +Downloading SHA hash file from +No keybase install found, skipping OpenPGP signature verification +Archive:  tfenv_download.1YFOLh/terraform_0.12.29_linux_amd64.zip +  inflating: /home/jess/.tfenv/versions/0.12.29/terraform   +Installation of terraform v0.12.29 successful. To make this your default version, run 'tfenv use 0.12.29' +``` + +Finally, to install the latest version of Terraform 0.11: + + +``` +jess@Athena:~$ tfenv install latest:^0.11 +Installing Terraform v0.11.15-oci +Downloading release tarball from +###################################################################################################################################################################################### 100.0% +Downloading SHA hash file from +No keybase install found, skipping OpenPGP signature verification +Archive:  tfenv_download.8OxQ8k/terraform_0.11.15-oci_linux_amd64.zip +  inflating: /home/jess/.tfenv/versions/0.11.15-oci/terraform   +Installation of terraform v0.11.15-oci successful. To make this your default version, run 'tfenv use 0.11.15-oci' +``` + +That was simple, and now you can put them to use! + +#### Change Terraform versions + +Once you have installed several versions of Terraform, you can pick one to use. First, find out your options by listing the installed versions: + + +``` +jess@Athena:~$ tfenv list +  0.13.5 (set by /home/jess/.tfenv/version) +  0.12.29 +  0.11.15-oci +``` + +By default, tfenv chooses the most up-to-date version of Terraform you have installed. Find out the default by running the `tfenv use` command: + + +``` +jess@Athena:~$ tfenv use +Switching default version to v0.13.5 +Switching completed + +jess@Athena:~$ terraform --version +Terraform v0.13.5 +``` + +But what if you need to use an older version? This example switches to the oldest version I have installed: + + +``` +jess@Athena:~$ tfenv use 0.11.15-oci +Switching default version to v0.11.15-oci +Switching completed + +jess@Athena:~$ terraform -version +Terraform v0.11.15-oci + +Your version of Terraform is out of date! The latest version +is 0.13.5. You can update by downloading from [www.terraform.io/downloads.html][9] +``` + +It's easy as pie! Just run the `list` command and use the naming convention provided. + +#### Uninstall Terraform versions + +If you have a version of Terraform you don't want or need any more, you can remove it with the `uninstall` command. For example, I don't need Terraform version 0.13: + + +``` +jess@Athena:~$ tfenv uninstall 0.13.5 +Uninstall Terraform v0.13.5 +Terraform v0.13.5 is successfully uninstalled +``` + +To confirm it's no longer installed: + + +``` +jess@Athena:~$ tfenv list +  0.12.29 +  0.11.15-oci +``` + +### Final thoughts + +The tfenv tool is great for many reasons. If you need to update from one version of Terraform to another, this is one of the faster ways to upgrade and test the outcome. If your environment has things running on several Terraform versions, it's easy to switch back and forth as needed. If you use Terraform, try tfenv and see how it can transform your environment. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/tfenv + +作者:[Jessica Cherry][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://opensource.com/users/cherrybomb +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_screen_windows_files.png?itok=kLTeQUbY (Computer screen with files or windows open) +[2]: https://opensource.com/article/20/7/terraform-kubernetes +[3]: https://github.com/tfutils/tfenv +[4]: https://github.com/rbenv/rbenv +[5]: https://www.ruby-lang.org/en/ +[6]: https://github.com/tfutils/tfenv#installation +[7]: https://opensource.com/life/16/7/stumbling-git +[8]: https://opensource.com/article/20/6/homebrew-linux +[9]: http://www.terraform.io/downloads.html From de77a6abdb4fc04170672ef9111a90d783ebb215 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 17 Nov 2020 05:02:54 +0800 Subject: [PATCH 0795/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201116?= =?UTF-8?q?=20Unlock=20encrypted=20disks=20on=20Linux=20automatically?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201116 Unlock encrypted disks on Linux automatically.md --- ... encrypted disks on Linux automatically.md | 272 ++++++++++++++++++ 1 file changed, 272 insertions(+) create mode 100644 sources/tech/20201116 Unlock encrypted disks on Linux automatically.md diff --git a/sources/tech/20201116 Unlock encrypted disks on Linux automatically.md b/sources/tech/20201116 Unlock encrypted disks on Linux automatically.md new file mode 100644 index 0000000000..14eb34ad20 --- /dev/null +++ b/sources/tech/20201116 Unlock encrypted disks on Linux automatically.md @@ -0,0 +1,272 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Unlock encrypted disks on Linux automatically) +[#]: via: (https://opensource.com/article/20/11/nbde-linux) +[#]: author: (Curt Warfield https://opensource.com/users/rcurtiswarfield) + +Unlock encrypted disks on Linux automatically +====== +Open encrypted disks without having to manually enter a passcode by +using Network-Bound Disk Encryption (NBDE). +![Lock][1] + +From a security viewpoint, it's important to encrypt your sensitive data to protect it from prying eyes and hackers. Linux Unified Key Setup ([LUKS][2]) is a great tool and a common standard for Linux disk encryption. Because it stores all pertinent setup information in the partition header, it makes migrating data easy. + +To configure encrypted disks or partitions with LUKS, you will need to use the [cryptsetup][3] utility. Unfortunately, one of the downsides of encrypting your disks is that you have to manually provide the password every time the system is rebooted or the disk is remounted. + +However, Network-Bound Disk Encryption (NBDE) can automatically and securely unlock encrypted disks without any user intervention. It is available in several Linux distributions, beginning with Red Hat Enterprise Linux 7.4, CentOS 7.4, and Fedora 24, and in later versions of each. + +NBDE is implemented with the following technologies: + + * **[Clevis framework][4]:** A pluggable framework tool that automatically decrypts and unlocks LUKS volumes + * **[Tang server][5]:** A service for binding cryptographic keys to network presence + + + +Tang provides the encryption keys to the Clevis client. According to Tang's developers, this provides a secure, stateless, anonymous alternative to key escrow services. + +Because NBDE uses the client-server architecture, you must configure both the client and the server. You can use a virtual machine on your local network for your Tang server. + +### Server installation + +Install Tang using sudo: + + +``` +`sudo yum install tang -y` +``` + +Enable the Tang server: + + +``` +`sudo systemctl enable tangd.socket --now` +``` + +The Tang server works on port 80 and must be added to firewalld. Add the appropriate firewalld rule: + + +``` +sudo  firewall-cmd --add-port=tcp/80 --perm +sudo firewall-cmd --reload +``` + +The server should now be installed. + +### Client installation + +For this example, assume you have added a new 1GB disk named `/dev/vdc` to your system. + +Create the primary partition using fdisk or parted: + + +``` +sudo fdisk /dev/vdc +``` + +Complete the following steps to install the client. + + +``` +Welcome to fdisk (util-linux 2.23.2). + +Changes will remain in memory only, until you decide to write them. +Be careful before using the write command. + +Device does not contain a recognized partition table +Building a new DOS disklabel with disk identifier 0x4a6812d4. + +Command (m for help): +``` + +Enter **n** to create the new partition: + + +``` +Partition type: +   p   primary (0 primary, 0 extended, 4 free) +   e   extended   +Select (default p): +``` + +Hit the **Enter** key to select the primary partition: + + +``` +Using default response p +Partition number (1-4, default 1): +``` + +Hit the **Enter** key to select the default partition number: + + +``` +First sector (2048-2097151, default 2048): +Using default value 2048 +Last sector, +sectors or +size{K,M,G} (2048-2097151, default 2097151): +``` + +Hit the **Enter** key to select the last sector: + + +``` +Using default value 2097151 +Partition 1 of type Linux and of size 1023 MiB is set + +Command (m for help): wq +``` + +Type **wq** to save the changes and exit fdisk: + + +``` +The partition table has been altered! + +Calling ioctl() to re-read partition table. +Syncing disks. +``` + +Run `partprobe` to inform the system of the partition table changes: + + +``` +`sudo partprobe` +``` + +Install the cryptsetup package using sudo: + + +``` +`sudo yum install cryptsetup -y` +``` + +Use the `cryptsetup luksFormat` command to encrypt the disk. You will need to type **YES** when prompted and also choose and enter a passphrase to encrypt the disk: + + +``` +sudo cryptsetup luksFormat /dev/vdc1 +WARNING! +======== +This will overwrite data on /dev/vdc1 irrevocably. + +Are you sure? (Type uppercase yes): + +Enter passphrase for /dev/vdc1: +Verify passphrase: +``` + +Use the `cryptsetup luksOpen` command to map the encrypted partition to a logical device. For example, use `encryptedvdc1` as the name. You will also need to enter the passphrase again: + + +``` +sudo cryptsetup luksOpen /dev/vdc1 encryptedvdc1 +Enter passphrase for /dev/vdc1: +``` + +The encrypted partition is now available at `/dev/mapper/encryptedvdc1`. + +Create an XFS filesystem on the encrypted partition: + + +``` +`sudo mkfs.xfs /dev/mapper/encryptedvdc1` +``` + +Create a directory for mounting the encrypted partition: + + +``` +`sudo mkdir /encrypted` +``` + +Use the `cryptsetup luksClose` command to lock the partition: + + +``` +`cryptsetup luksClose encryptedvdc1` +``` + +Install the Clevis packages using sudo: + + +``` +`sudo yum install clevis clevis-luks clevis-dracut -y` +``` + +Modify /etc/crypttab to open the encrypted volume at boot time: + + +``` +`sudo vim /etc/crypttab` +``` + +Add the following line: + + +``` +`encryptedvdc1       /dev/vdc1  none   _netdev` +``` + +Modify /etc/fstab to automatically mount the encrypted volume during a reboot or at boot time: + + +``` +`sudo vim /etc/fstab` +``` + +Add the following line: + + +``` +`/dev/mapper/encryptedvdc1   /encrypted       xfs    _netdev        1 2` +``` + +For this example, assume the Tang server's IP address is `192.168.1.20`. You can also use the hostname or domain if you prefer. + +Run the following `clevis` command: + + +``` +sudo clevis bind luks -d /dev/vdc1 tang '{"url":"' +The advertisement contains the following signing keys: + +rwA2BAITfYLuyNiIeYUMBzkhk7M + +Do you wish to trust these keys? [ynYN] Y +Enter existing LUKS password: +``` + +Type **Y** to accept the keys for the Tang server and provide the existing LUKS password for the initial setup. + +Enable clevis-luks-askpass.path via systemctl in order to prevent being prompted for the passphrase for non-root partitions. + + +``` +`sudo systemctl enable clevis-luks-askpass.path` +``` + +The client is installed. Now, whenever you reboot the server, the encrypted disk should automatically be decrypted and mounted by retrieving the keys from the Tang server. + +If the Tang server is unavailable for any reason, you'll need to provide the passphrase manually in order to decrypt and mount the partition. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/nbde-linux + +作者:[Curt Warfield][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://opensource.com/users/rcurtiswarfield +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security-lock-password.jpg?itok=KJMdkKum (Lock) +[2]: https://en.wikipedia.org/wiki/Linux_Unified_Key_Setup +[3]: https://gitlab.com/cryptsetup/cryptsetup +[4]: https://github.com/latchset/clevis +[5]: https://github.com/latchset/tang From 4ef99ae3750f7b49a62188bc2c4676bf4fcd6782 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 17 Nov 2020 05:03:08 +0800 Subject: [PATCH 0796/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201116?= =?UTF-8?q?=20How=20to=20use=20Serializers=20in=20the=20Django=20Python=20?= =?UTF-8?q?web=20framework?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201116 How to use Serializers in the Django Python web framework.md --- ...zers in the Django Python web framework.md | 258 ++++++++++++++++++ 1 file changed, 258 insertions(+) create mode 100644 sources/tech/20201116 How to use Serializers in the Django Python web framework.md diff --git a/sources/tech/20201116 How to use Serializers in the Django Python web framework.md b/sources/tech/20201116 How to use Serializers in the Django Python web framework.md new file mode 100644 index 0000000000..9a5f441221 --- /dev/null +++ b/sources/tech/20201116 How to use Serializers in the Django Python web framework.md @@ -0,0 +1,258 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to use Serializers in the Django Python web framework) +[#]: via: (https://opensource.com/article/20/11/django-rest-framework-serializers) +[#]: author: (Renato Oliveira https://opensource.com/users/renato-oliveira) + +How to use Serializers in the Django Python web framework +====== +Serialization transforms data into a format that can be stored or +transmitted and then reconstructs it for use. DRF has the best-known +serializers. +![Net catching 1s and 0s or data in the clouds][1] + +Serialization is the process of transforming data into a format that can be stored or transmitted and then reconstructing it. It's used all the time when developing applications or storing data in databases, in memory, or converting it into files. + +I recently helped two junior developers at [Labcodes][2] understand serializers, and I thought it would be good to share my approach with Opensource.com readers. + +Suppose you're creating software for an e-commerce site and you have an Order that registers the purchase of a single product, by someone, at a price, on a date: + + +``` +class Order: +    def __init__(self, product, customer, price, date): +        self.product = product +        self.customer = customer +        self.price = price +        self.date = date +``` + +Now, imagine you want to store and retrieve order data from a key-value database. Luckily, its interface accepts and return dictionaries, so you need to convert your object into a dictionary: + + +``` +def serialize_order(order): +    return { +        'product': order.product, +        'customer': order.customer, +        'price': order.price, +        'date': order.date +    } +``` + +And if you want to get some data from that database, you can get the dict data and turn that into your Order object: + + +``` +def deserialize_order(order_data): +    return Order( +        product=order_data['product'], +        customer=order_data['customer'], +        price=order_data['price'], +        date=order_data['date'], +    ) +``` + +This is pretty straightforward to do with simple data, but when you need to deal with complex objects made of complex attributes, this approach doesn't scale well. You also need to handle the validation of different types of fields, and that's a lot of work to do manually. + +That's where frameworks' serializers are handy. They allow you to create serializers with little boilerplates that will work for your complex cases. + +[Django][3] comes with a serialization module that allows you to "translate" Models into other formats: + + +``` +from django.core import serializers + +serializers.serialize('json', Order.objects.all()) +``` + +It covers the most-used cases for web applications, such as JSON, YAML, and XML. But you can also use third-party serializers or create your own. You just need to register it in your settings.py file: + + +``` +# settings.py +SERIALIZATION_MODULES = { +    'my_format': appname.serializers.MyFormatSerializer, +} +``` + +To create your own `MyFormatSerializer`, you need to implement the `.serialize()` method and accept a queryset and extra options as params: + + +``` +class MyFormatSerializer: +    def serialize(self, queryset, **options): +        # serious serialization happening +``` + +Now you can serialize your queryset to your new format: + + +``` +from django.core import serializers + +serializers.serialize('my_format', Order.objects.all()) +``` + +You can use the options parameters to define the behavior of your serializer. For example, if you want to define that you're going to work with nested serialization when dealing with `ForeignKeys` or you just want that data to return its primary keys, you can pass a `flat=True` param as an option and deal with that within your method: + + +``` +class MyFormatSerializer: +    def serializer(self, queryset, **options): +        if options.get('flat', False): +            # don't recursively serialize relationships +        # recursively serialize relationships +``` + +One way to use Django serialization is with the `loaddata` and `dumpdata` management commands. + +### DRF serializers + +In the Django community, the [Django REST framework][4] (DRF) offers the best-known serializers. Although you can use Django's serializers to build the JSON you'll respond to in your API, the one from the REST framework comes with nice features that help you deal with and easily validate complex data. + +In the Order example, you could create a serializer like this: + + +``` +from restframework import serializers + +class OrderSerializer(serializers.Serializer): +    product = serializers.CharField(max_length=255) +    customer = serializers.CharField(max_lenght=255) +    price = serializers.DecimalField(max_digits=5, decimal_places=2) +    date = serializers.DateField() +``` + +And easily serialize its data: + + +``` +order = Order('pen', 'renato', 10.50, date.today()) +serializer = OrderSerializer(order) + +serializer.data +# {'product': 'pen', 'customer': 'renato', 'price': '10.50', 'date': '2020-08-16'} +``` + +To be able to return an instance from data, you need to implement two methods—create and update: + + +``` +from rest_framework import serializers + +class OrderSerializer(serializers.Serializer): +    product = serializers.CharField(max_length=255) +    customer = serializers.CharField(max_length=255) +    price = serializers.DecimalField(max_digits=5, decimal_places=2) +    date = serializers.DateField() + +    def create(self, validated_data): +        # perform order creation +        return order + +    def update(self, instance, validated_data): +       # perform instance update +       return instance +``` + +After that, you can create or update instances by calling `is_valid()` to validate the data and `save()` to create or update an instance: + + +``` +serializer = OrderSerializer(**data) +## to validate data, mandatory before calling save +serializer.is_valid() +serializer.save() +``` + +### Model serializers + +When serializing data, you often need to do it from a database, therefore, from your models. A ModelSerializer, like a ModelForm, provides an API to create serializers from your models. Suppose you have an Order model: + + +``` +from django.db import models + +class Order(models.Model): +    product = models.CharField(max_length=255) +    customer = models.CharField(max_length=255) +    price = models.DecimalField(max_digits=5, decimal_places=2) +    date = models.DateField()     +``` + +You can create a serializer for it like this: + + +``` +from rest_framework import serializers + +class OrderSerializer(serializers.ModelSerializer): +    class Meta: +        model = Order +        fields = '__all__' +``` + +Django automatically includes all model fields in the serializer and creates the `create` and `update` methods. + +### Using serializers in class-based views (CBVs) + +Like Forms with Django's CBVs, serializers integrate well with DRFs. You can set the `serializer_class` attribute so that the serializer will be available to the view: + + +``` +from rest_framework import generics + +class OrderListCreateAPIView(generics.ListCreateAPIView): +    queryset = Order.objects.all() +    serializer_class = OrderSerializer +``` + +You can also define the `get_serializer_class()` method: + + +``` +from rest_framework import generics + +class OrderListCreateAPIView(generics.ListCreateAPIView): +    queryset = Order.objects.all() +    +    def get_serializer_class(self): +        if is_free_order(): +            return FreeOrderSerializer +        return OrderSerializer +``` + +There are other methods in CBVs that interact with serializers. For example, [get_serializer()][5] returns an already-instantiated serializer, while [get_serializer_context()][6] returns the arguments you'll pass to the serializer when creating its instance. For views that create or update data, there are `create` and `update` that validate the data with the `is_valid` method to be saved, and [perform_create][7] and [perform_update][8] that call the serializer's save method. + +### Learn more + +For other resources, see my friend André Ericson's [Classy Django REST Framework][9] website. It is a [Classy Class-Based Views][10] REST Framework version that gives you an in-depth inspection of the classes that compose DRF. Of course, the official [documentation][11] is an awesome resource. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/django-rest-framework-serializers + +作者:[Renato Oliveira][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://opensource.com/users/renato-oliveira +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_analytics_cloud.png?itok=eE4uIoaB (Net catching 1s and 0s or data in the clouds) +[2]: http://www.labcodes.com.br +[3]: https://www.djangoproject.com/ +[4]: https://www.django-rest-framework.org/ +[5]: http://www.cdrf.co/3.9/rest_framework.generics/CreateAPIView.html#get_serializer +[6]: http://www.cdrf.co/3.9/rest_framework.generics/CreateAPIView.html#get_serializer_context +[7]: http://www.cdrf.co/3.9/rest_framework.generics/CreateAPIView.html#perform_create +[8]: http://www.cdrf.co/3.9/rest_framework.generics/RetrieveUpdateAPIView.html#perform_update +[9]: http://www.cdrf.co/ +[10]: https://ccbv.co.uk/ +[11]: https://www.django-rest-framework.org/api-guide/serializers/#serializers From 7dfcc6ad35b0a3a440d21e31e4e5306b9c29625e Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 17 Nov 2020 08:35:08 +0800 Subject: [PATCH 0797/1156] translated --- ...t I love about the newest GNOME desktop.md | 88 ------------------- ...t I love about the newest GNOME desktop.md | 88 +++++++++++++++++++ 2 files changed, 88 insertions(+), 88 deletions(-) delete mode 100644 sources/tech/20201110 What I love about the newest GNOME desktop.md create mode 100644 translated/tech/20201110 What I love about the newest GNOME desktop.md diff --git a/sources/tech/20201110 What I love about the newest GNOME desktop.md b/sources/tech/20201110 What I love about the newest GNOME desktop.md deleted file mode 100644 index 1404b55975..0000000000 --- a/sources/tech/20201110 What I love about the newest GNOME desktop.md +++ /dev/null @@ -1,88 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (What I love about the newest GNOME desktop) -[#]: via: (https://opensource.com/article/20/11/new-gnome) -[#]: author: (Jim Hall https://opensource.com/users/jim-hall) - -What I love about the newest GNOME desktop -====== -Check out the top new features in the GNOME 3.38 desktop. -![Digital images of a computer desktop][1] - -Fedora 33 [just came out][2], and I installed it right away. Among the many features in this new version of the Linux distribution is the latest GNOME desktop. GNOME 3.38 was released in September 2020, and I'm loving it. - -### Why I love GNOME 3.38 - -The [GNOME 3.38 release notes][3] list some great new features in this update. Among other things, the Welcome Tour for new users received a major facelift and is now much easier to use and provides more useful information if you're new to GNOME. - -![The new "Welcome GNOME"][4] - -([GNOME][5], [CC BY-SA 4.0][6]) - -I also love that I can drag to reorder application icons in the GNOME Application Overview. This makes it a breeze to organize the applications I use all the time under GNOME. You can even drag and drop icons together to automatically put them into folders. - -![GNOME 3.38 Application Overview][7] - -([GNOME][5], [CC BY-SA 4.0][6]) - -I have family in different time zones, and the updated GNOME Clocks makes it much easier to add new world clocks, so I don't have to figure out what time it is when I call a family member. Are they an hour ahead or an hour behind? I just check the GNOME clock, and I can see everyone's local times at a glance. And while I don't use the alarms feature very often, I like that I can set my own ring duration and default "snooze" time on each alarm. - -![Adding a new world clock in GNOME Clocks][8] - -([GNOME][5], [CC BY-SA 4.0][6]) - -Aside from all the feature updates, the biggest improvement in GNOME 3.38 is performance. As GNOME developer Emmanuele Bassi [explained earlier this year][9], there's been "lots of work by everyone in GNOME to make things faster, even for people running on more limited systems like the Raspberry Pi. There's been a lot of work to get GNOME to perform better … because people really care about it." And that shows in the new release! The GNOME desktop feels much more responsive. - -![Applications running on GNOME 3.38][10] - -([GNOME][5], [CC BY-SA 4.0][6]) - -As part of my consulting and training business, I regularly flip between several open applications, including LibreOffice, GIMP, Inkscape, a web browser, and others. Starting a new application or switching between open applications just feels faster in GNOME 3.38. - -### Except one thing - -If there's one thing I'm not fond of in the new version of GNOME, it's the redesigned Screenshot tool. I use this all the time to grab a portion of what's on the screen and insert it into my presentations and training documents. - -![GNOME Screenshot tool][11] - -(Jim Hall, [CC BY-SA 4.0][6]) - -When I read a user interface or computer screen, I naturally navigate as I would a book or magazine: left to right and top to bottom. When I make screenshots with the new Screenshot tool, I start in the upper-left and make my selections as I go. Most of the time, I only need to change the capture area for a selection, so I click that button and then look for the button that will take a screenshot. But it always takes me a moment to find the **Take Screenshot** button in the upper-left corner. It's not at the bottom of the window, where I expect to find it. - -![GNOME Screenshot tool][12] - -(Jim Hall, [CC BY-SA 4.0][6]) - -So far, that seems to be my only annoyance in GNOME 3.38. Overall, I'm very excited for the new GNOME. And I hope you are, too! - -To learn more about GNOME 3.38, visit the [GNOME website][13] or read the [GNOME 3.38 announcement][5]. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/11/new-gnome - -作者:[Jim Hall][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://opensource.com/users/jim-hall -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_browser_web_desktop.png?itok=Bw8ykZMA (Digital images of a computer desktop) -[2]: https://fedoramagazine.org/announcing-fedora-33/ -[3]: https://help.gnome.org/misc/release-notes/3.38/ -[4]: https://opensource.com/sites/default/files/uploads/welcome-tour.png (The new "Welcome GNOME" ) -[5]: https://www.gnome.org/news/2020/09/gnome-3-38-released/ -[6]: https://creativecommons.org/licenses/by-sa/4.0/ -[7]: https://opensource.com/sites/default/files/uploads/app-overview.png (GNOME 3.38 Application Overview) -[8]: https://opensource.com/sites/default/files/uploads/world-clocks.png (Adding a new world clock in GNOME Clocks) -[9]: https://opensource.com/article/20/7/new-gnome-features -[10]: https://opensource.com/sites/default/files/uploads/desktop-busy.png (Applications running on GNOME 3.38) -[11]: https://opensource.com/sites/default/files/uploads/gnome-screenshot-tool.png (GNOME Screenshot tool) -[12]: https://opensource.com/sites/default/files/uploads/screenshot-tool-path.png (GNOME Screenshot tool) -[13]: https://www.gnome.org/ diff --git a/translated/tech/20201110 What I love about the newest GNOME desktop.md b/translated/tech/20201110 What I love about the newest GNOME desktop.md new file mode 100644 index 0000000000..2422efa87d --- /dev/null +++ b/translated/tech/20201110 What I love about the newest GNOME desktop.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What I love about the newest GNOME desktop) +[#]: via: (https://opensource.com/article/20/11/new-gnome) +[#]: author: (Jim Hall https://opensource.com/users/jim-hall) + +我对最新的 GNOME 桌面的喜爱之处 +====== +看看 GNOME 3.38 桌面的最新功能。 +![Digital images of a computer desktop][1] + +Fedora 33 [刚出来][2],我就马上安装了它。在这个新版 Linux 发行版的众多功能中,其中之一是最新的 GNOME 桌面。GNOME 3.38 于 2020 年 9 月发布,我很喜欢它。 + +### 我为什么喜欢 GNOME 3.38? + +GNOME 3.38 [发布说明][3]中列出了这次更新中的一些重大的新功能。其中,如果你是新用户的话,新用户的欢迎页面得到了重大的改版,现在更加容易使用,并且提供了更多有用的信息。 + +![The new "Welcome GNOME"][4] + +([GNOME][5], [CC BY-SA 4.0][6]) + +我还喜欢在 GNOME 应用概览中拖动来重新排列应用图标的功能。这让我在 GNOME 下组织我一直使用的应用变得轻而易举。你甚至可以将图标拖放在一起,并自动将它们放入文件夹。 + +![GNOME 3.38 Application Overview][7] + +([GNOME][5], [CC BY-SA 4.0][6]) + +我的家人在不同的时区,更新后的 GNOME 时钟使得添加新的世界时钟变得更加容易,所以当我给家人打电话时,我不必弄清楚现在是什么时间。他们是提前一个小时还是晚了一个小时?我只需查看 GNOME 时钟,就能一目了然地看到每个人的当地时间。另外,虽然我并不经常使用闹钟功能,但我喜欢我可以自己设置铃声持续时间和每个闹钟的默认”打盹“时间。 + +![Adding a new world clock in GNOME Clocks][8] + +([GNOME][5], [CC BY-SA 4.0][6]) + +除了所有的功能更新之外,GNOME 3.38 中最大的改进是性能。正如 GNOME 开发者 Emmanuele Bassi [今年早些时候的解释][9]:“GNOME 中的每个人都为使速度更快而做了很多工作,即使是在树莓派等更有限的系统上运行的人。为了让 GNOME 表现得更好,大家做了很多工作。因为人们真的很关心它”。而这一点在新版本中体现得淋漓尽致!GNOME 桌面感觉反应更灵敏。 + +![Applications running on GNOME 3.38][10] + +([GNOME][5], [CC BY-SA 4.0][6]) + +作为我的咨询和培训业务的一部分,我经常在几个开放的应用之间切换,包括 LibreOffice、GIMP、Inkscape、一个网络浏览器等。在 GNOME 3.38 中,启动一个新的应用或在开放应用之间切换感觉更快。 + +### 除了一件事 + +如果说新版 GNOME 中有什么我不喜欢的地方,那就是重新设计的屏幕截图工具。我一直使用这个工具来抓取屏幕上的一部分内容,并将其插入到我的演示文稿和培训文档中。 + +![GNOME Screenshot tool][11] + +(Jim Hall, [CC BY-SA 4.0][6]) + +当我浏览用户界面或电脑屏幕时,我自然会像阅读书籍或杂志那样浏览:从左到右,从上到下。当我使用新的屏幕截图工具进行屏幕截图时,我从左上角开始,然后进行选择。大多数时候,我只需要改变选区的捕捉区域,所以我点击那个按钮,然后寻找截图的按钮。但我总是要花点时间才能找到左上角的**截图**按钮。它并不在窗口的底部,也不是我希望找到它的地方。 + +![GNOME Screenshot tool][12] + +(Jim Hall, [CC BY-SA 4.0][6]) + +到目前为止,这似乎是我在 GNOME 3.38 中唯一的烦恼。总的来说,我对新的 GNOME 感到非常兴奋。我希望你也是! + +要了解更多关于 GNOME 3.38 的信息,请访问 [GNOME 网站][13]或阅读 [GNOME 3.38 公告][5]。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/new-gnome + +作者:[Jim Hall][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jim-hall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_browser_web_desktop.png?itok=Bw8ykZMA (Digital images of a computer desktop) +[2]: https://fedoramagazine.org/announcing-fedora-33/ +[3]: https://help.gnome.org/misc/release-notes/3.38/ +[4]: https://opensource.com/sites/default/files/uploads/welcome-tour.png (The new "Welcome GNOME" ) +[5]: https://www.gnome.org/news/2020/09/gnome-3-38-released/ +[6]: https://creativecommons.org/licenses/by-sa/4.0/ +[7]: https://opensource.com/sites/default/files/uploads/app-overview.png (GNOME 3.38 Application Overview) +[8]: https://opensource.com/sites/default/files/uploads/world-clocks.png (Adding a new world clock in GNOME Clocks) +[9]: https://opensource.com/article/20/7/new-gnome-features +[10]: https://opensource.com/sites/default/files/uploads/desktop-busy.png (Applications running on GNOME 3.38) +[11]: https://opensource.com/sites/default/files/uploads/gnome-screenshot-tool.png (GNOME Screenshot tool) +[12]: https://opensource.com/sites/default/files/uploads/screenshot-tool-path.png (GNOME Screenshot tool) +[13]: https://www.gnome.org/ From 51de2acc55d1cfb41d47e4a8453e6782e32db82e Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 17 Nov 2020 08:48:26 +0800 Subject: [PATCH 0798/1156] translating --- ...Install and Use Etcher on Linux for Making Live Linux USB.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md b/sources/tech/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md index 2a443bcb64..cb7c463b33 100644 --- a/sources/tech/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md +++ b/sources/tech/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 7f4dfb6db5bf7f72ccb09b4aa24fdb1ee33b1528 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 17 Nov 2020 10:30:39 +0800 Subject: [PATCH 0799/1156] PRF @wxy --- ...0201102 4 reasons why JavaScript is so popular.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/translated/tech/20201102 4 reasons why JavaScript is so popular.md b/translated/tech/20201102 4 reasons why JavaScript is so popular.md index 6baa765416..a5d03202cd 100644 --- a/translated/tech/20201102 4 reasons why JavaScript is so popular.md +++ b/translated/tech/20201102 4 reasons why JavaScript is so popular.md @@ -12,7 +12,7 @@ JavaScript 如此受欢迎的 4 个原因 > JavaScript 之所以能在编程语言中名列前茅,是有充分的理由的。 -![JavaScript in Vim][1] +![](https://img.linux.net.cn/data/attachment/album/202011/17/102936u1hghm95bbu7xjxg.jpg) 如 GitHub 的 [The State of the Octoverse][2] 报告的这张图所示,如果按 GitHub 上项目的贡献者数量统计,[JavaScript][3] 一直是最受欢迎的编程语言。 @@ -30,15 +30,15 @@ JavaScript 不需要任何环境设置,只要打开浏览器,比如 Chrome console.log("Hello World"); ``` -JavaScript 的灵活性最适合中级开发人员。该语言只是通过让开发人员专注于解决问题来帮助完成任务。开发者可以混合使用插件和自己的代码片段来让一个应用程序工作。 +JavaScript 的灵活性最适合中级开发人员。该语言通过让开发人员专注于解决问题来帮助你完成任务。开发者可以混合使用插件和自己的代码片段来让一个应用程序工作。 -虽然 JavaScript 比较容易上手,但它并不是一下子就能掌握的。如果你想达到高级水平,这里有一些你需要了解的概念: +虽然 JavaScript 比较容易上手,但它也并不是一下子就能掌握的。如果你想达到高级水平,这里有一些你需要了解的概念: * **JavaScript 的[多范式][8]特性:** JavaScript 同时支持函数式编程和面向对象编程(OOP)。 * **在 JavaScript 中应用[设计模式][9]:** 模型-视图-*([MV*][10])设计模式一直是最流行的模式之一,并促成了[多个现代框架][11]的发展。 * **[带原型链的继承][12]:** JavaScript 由于其动态的特性,无法实现传统的 Java 基于类的模式下的 OOP。JavaScript 中的 OOP 是通过原型继承模型实现的。 * **[闭包][13]:** 闭包可以从内部函数中访问外部函数的作用域。 - * **[Currying][14]:** Currying 是函数的一种转换,它将函数从 `f(a, b, c)` 的调用形式转换为 `f(a)(b)(c)` 调用形式。 + * **[柯里化][14]Currying:** 柯里化是函数的一种转换,它将函数从 `f(a, b, c)` 的调用形式转换为 `f(a)(b)(c)` 调用形式。 * **[Promises][15] 和 [Observables][16]:** 这些可以帮助你处理异步函数。 * **[TypeScript][17]:** 在 JavaScript 中添加了静态类型。 @@ -63,7 +63,7 @@ JavaScript 已经存在了 25 年,背后有一个庞大的社区。开发者 ### 未来 -JavaScript 是永恒的。全栈开发和现代前端框架继续帮助 JavaScript 巩固其作为最受欢迎的编程语言之一的地位。 +JavaScript 将长期存在。全栈开发和现代前端框架继续帮助 JavaScript 巩固其作为最受欢迎的编程语言之一的地位。 JavaScript 的[下一波][26]可能会将焦点放在。 @@ -88,7 +88,7 @@ via: https://opensource.com/article/20/11/javascript-popular [2]: https://octoverse.github.com/ [3]: https://en.wikipedia.org/wiki/JavaScript [4]: https://opensource.com/sites/default/files/uploads/toplanguages-the_state_of_the_octoverse.png (Top Languages from The State of the Octoverse report) -[5]: https://opensource.com/article/20/10/javascript-part-1 +[5]: https://linux.cn/article-12813-1.html [6]: https://medium.com/paul-heintzelman/so-why-is-javascript-so-popular-f35bd6cfeb39 [7]: https://developers.google.com/web/tools/chrome-devtools [8]: https://medium.com/javascript-in-plain-english/what-are-javascript-programming-paradigms-3ef0f576dfdb From 1ccef93cdde5d2e6b90c8727105b2d86c7eb7786 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 17 Nov 2020 10:31:14 +0800 Subject: [PATCH 0800/1156] PUB @wxy https://linux.cn/article-12830-1.html --- .../20201102 4 reasons why JavaScript is so popular.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201102 4 reasons why JavaScript is so popular.md (98%) diff --git a/translated/tech/20201102 4 reasons why JavaScript is so popular.md b/published/20201102 4 reasons why JavaScript is so popular.md similarity index 98% rename from translated/tech/20201102 4 reasons why JavaScript is so popular.md rename to published/20201102 4 reasons why JavaScript is so popular.md index a5d03202cd..4ac7718161 100644 --- a/translated/tech/20201102 4 reasons why JavaScript is so popular.md +++ b/published/20201102 4 reasons why JavaScript is so popular.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12830-1.html) [#]: subject: (4 reasons why JavaScript is so popular) [#]: via: (https://opensource.com/article/20/11/javascript-popular) [#]: author: (Nimisha Mukherjee https://opensource.com/users/nimisha) From c665c45936ef7f98932d5400cbdd65a95c2547db Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 17 Nov 2020 11:14:37 +0800 Subject: [PATCH 0801/1156] PRF @robsean --- ...pace on Linux -Terminal and GUI Methods.md | 62 +++++++++---------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/translated/tech/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md b/translated/tech/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md index cdbc40ff60..4f2f5de2de 100644 --- a/translated/tech/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md +++ b/translated/tech/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md @@ -1,66 +1,64 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Check Free Disk Space on Linux [Terminal and GUI Methods]) [#]: via: (https://itsfoss.com/check-free-disk-space-linux/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -如何在 Linux 上检查可用的磁盘空间 [终端和 GUI 方法] +如何在 Linux 上检查可用的磁盘空间 ====== -_**我已经使用了多少磁盘空间?**_ +![](https://img.linux.net.cn/data/attachment/album/202011/17/111346h0vrdvldsy6hlhlh.jpg) -在 Linux 上查找可用磁盘空间的最简单的方法是 [使用 df 命令][1] 。df 命令从字面意思上代表着可用空间,很明显,它将向你显示在 Linux 系统上的可用磁盘空间。 +> 我已经使用了多少磁盘空间? + +在 Linux 上查找可用磁盘空间的最简单的方法是[使用 df 命令][1] 。`df` 命令从字面意思上代表着磁盘可用空间disk free,很明显,它将向你显示在 Linux 系统上的可用磁盘空间。 ``` df -h ``` -使用 `-h` 选项,它将以人类可读的格式 (MB 和 GB) 来显示磁盘空间。 +使用 `-h` 选项,它将以人类可读的格式(MB 和 GB)来显示磁盘空间。 -这里是针对我 Dell XPS 系统的 df 命令的输出,它使用了加密磁盘并且只安装了 Linux : +这里是针对我 Dell XPS 系统的 `df` 命令的输出,它使用了加密磁盘并且只安装了 Linux: ![在 Linux 中使用 df 命令检查可用磁盘空间][2] -如果上面的输出使你感到困惑,不用担心。我将介绍一些关于在 Linux 中检查可用磁盘空间的东西。_**我也将为桌面 Linux 用户展示 GUI 方法。**_ +如果上面的输出使你感到困惑,不用担心。我将介绍一些关于在 Linux 中检查可用磁盘空间的东西。我也将为桌面 Linux 用户展示 GUI 方法。 -### 方法 1: 使用 df 命令来检查在 Linux 中的可用磁盘空间(并理解它的输出) +### 方法 1: 使用 df 命令来检查在 Linux 中的可用磁盘空间(并理解它的输出) -当你使用 df 命令来检查磁盘空间时,它将显示一组 ‘文件系统’,包括它们的大小,使用的空间和可用的空间。你实际的磁盘通常应该下面列表中的一个: +当你使用 `df` 命令来检查磁盘空间时,它将显示一组“文件系统”,包括它们的大小、使用的空间和可用的空间。你实际的磁盘通常应该下面列表中的一个: - * /dev/sda - * /dev/sdb - * /dev/nvme0n1p + * `/dev/sda` + * `/dev/sdb` + * `/dev/nvme0n1p` +这不是硬性的标准,但是它可以给予你一个指示,它可以让你能够很容易地从一堆文字中辨别出真正的磁盘。 +你的 Linux 系统在你的磁盘上可能有一些用于引导 分区、EFI 分区、根分区、交换分区、家目录等的分区。在这种情况下,这些分区在“磁盘名称”的结尾处使用一个数字来标示,像 `/dev/sda1`、`/dev/nvme0n1p2` 等等。 -这不是硬性的标准,但是它给予你一个标志,它可以让你能够很容易地从一堆文字中辨别出真正是磁盘。 +你可以从它们的挂载点来辨认出哪个分区是用于做什么的。根分区挂载在 `/`、EFI 分区在 `/boot/EFI` 等等。 -你的 Linux 系统在你的磁盘上可能有一些用于 boot, EFI, root, swap, home 等的分区。在这种情况下,这些分区在 ‘磁盘名称’ 的结尾处使用一个数字来标示,像 /dev/sda1, /dev/nvme0n1p2 等等。 - -你可以从它们的挂载点来辨认出哪个分区是用于做什么的。Root 挂载在 /, EFI 在 /boot/EFI 等等。 - -就我的情况来说,我已经使用了 root 分区下磁盘空间 ( 232 GB ) 的 41% 。如果你有 2 到 3 个大分区(像 root, home 等等),你将不得不在这里计算一下已使用的磁盘空间。 +就我的情况来说,我已经使用了根分区下磁盘空间(232 GB)的 41% 。如果你有 2 到 3 个大分区(像根分区、家目录分区等等),你将不得不在这里计算一下已使用的磁盘空间。 ![理解 df 命令输出][3] - * **tmpfs**: [tmpfs][4] (临时文件系统) 用于在虚拟存储器中保持文件。你可以随意地忽略这个虚拟文件系统。 - * **udev**: [udev 文件系统][5] 用于存储插入到你系统的设备(像 USB,网卡,CD ROM 等等) 的相关信息。你也可以忽略它。 - * **/dev/loop**: 它们是 loop 设备。由于 snap 应用程序,在 Ubuntu 中检查磁盘时,你将看到很多的这样的设备。loop 设备是虚拟设备,它们允许普通文件作为块设备文件来访问。使用 loop 设备,snap 应用程序在它们自己的虚拟磁盘中进行沙盒处理。尽管它们是在 root 下,但是你不需要单独计算它们使用的磁盘空间。 + * `tmpfs`:[tmpfs][4](临时文件系统)用于在虚拟存储器中保持文件。你可以随意地忽略这个虚拟文件系统。 + * `udev`:[udev 文件系统][5] 用于存储插入到你系统的设备(像 USB、网卡、CD ROM 等等)的相关信息。你也可以忽略它。 + * `/dev/loop`: 它们是环回设备。由于 snap 应用程序,在 Ubuntu 中查看磁盘时,你将看到很多的这样的设备。环回设备是虚拟设备,它们允许普通文件作为块设备文件来访问。使用环回设备,snap 应用程序在它们自己的虚拟磁盘中进行沙盒处理。尽管它们是在根分区下,但是你不需要单独计算它们使用的磁盘空间。 +#### 丢失了磁盘空间?检查你是否挂载了所有是磁盘和分区 +记住,`df` 命令仅显示已挂载文件系统的磁盘空间。如果你在同一块磁盘上使用多个 Linux 发行版(或者多个操作系统),或者在你的系统上有多个磁盘,你需要先挂载它们,以便查看在这些分区和磁盘上的可用磁盘空间。 -#### 丢失磁盘空间?检查你是否挂载了所有是磁盘和分区 - -记住,df 命令仅显示已挂载文件系统的磁盘空间。如果你在同一块磁盘上使用多个 Linux 发行版 (或者多个操作系统),或者在你的系统上有多个磁盘 ,你需要先挂载它们,以便查看在这些分区和磁盘上的可用磁盘空间。 - -例如,我的 [Intel NUC][6] 有两个 SSD 磁盘,并且在其上有4个或5个 Linux 分区。仅当我明确地挂载它们时,df 命令才会显示附加的磁盘。 +例如,我的 [Intel NUC][6] 有两个 SSD 磁盘,并且在其上有 4 个或 5 个 Linux 分区。仅当我明确地挂载它们时,`df` 命令才会显示更多磁盘。 ![][7] -你可以使用 lsblk 命令来查看在你系统上的所有磁盘和分区。 +你可以使用 `lsblk` 命令来查看在你系统上的所有磁盘和分区。 ![][8] @@ -74,7 +72,7 @@ sudo mount /dev/sdb2 /mnt ### 方法 2: 在 GUI 下检查可用磁盘使用情况 -在 Ubuntu 中使用 Disk Usage Analyzer 工具来在 GUI 的方式下检查可用磁盘空间是很容易的。 +在 Ubuntu 中使用 “Disk Usage Analyzer” 工具来在 GUI 的方式下检查可用磁盘空间是很容易的。 ![Disk Usage Analyzer 工具][9] @@ -88,15 +86,15 @@ sudo mount /dev/sdb2 /mnt ![GNOME 的 Disks 工具][11] -启动工具和选择磁盘。选择一个分区来查看可用磁盘空间。如果没有挂载分区,那么先通过单击 ‘play’ 图标来挂载它。 +启动工具和选择磁盘。选择一个分区来查看可用磁盘空间。如果没有挂载分区,那么先通过单击 “▶” 图标来挂载它。 ![检查 Ubuntu 的桌面版本的可用磁盘空间][12] 我认为在 Linux 上的所有主要桌面环境都有某种图形工具来检查磁盘使用情况。你可以在你是桌面 Linux 系统的菜单中搜索它。 -**结束语** +### 结束语 -当然,这里可能有很多方法和工具来检查磁盘空间。为此,我向你显示了最常用的命令行方法和 GUI 方法。 +当然,有很多方法和工具来检查磁盘空间。为此,我向你显示了最常用的命令行方法和 GUI 方法。 我也解释一些可能会让你很难理解磁盘使用情况的东西。希望你喜欢它。 @@ -109,7 +107,7 @@ via: https://itsfoss.com/check-free-disk-space-linux/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[robsean](https://github.com/robsean) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From b2b91f6fa3029261a03568fb1de167d4b3c6bbb1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 17 Nov 2020 11:15:56 +0800 Subject: [PATCH 0802/1156] PUB @robsean https://linux.cn/article-12831-1.html --- ...heck Free Disk Space on Linux -Terminal and GUI Methods.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md (98%) diff --git a/translated/tech/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md b/published/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md similarity index 98% rename from translated/tech/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md rename to published/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md index 4f2f5de2de..f8ac5b6f0e 100644 --- a/translated/tech/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md +++ b/published/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12831-1.html) [#]: subject: (How to Check Free Disk Space on Linux [Terminal and GUI Methods]) [#]: via: (https://itsfoss.com/check-free-disk-space-linux/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From 9f3f61777f2ba010388ad97ca1f2bb8d91ebc283 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 17 Nov 2020 23:59:45 +0800 Subject: [PATCH 0803/1156] PRF @geekpi --- ...erence Between the Two KDE Distribution.md | 37 +++++++++---------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/translated/tech/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md b/translated/tech/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md index 247bbb7938..e97ea06107 100644 --- a/translated/tech/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md +++ b/translated/tech/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md @@ -1,13 +1,13 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (KDE Neon vs Kubuntu: What’s the Difference Between the Two KDE Distribution?) [#]: via: (https://itsfoss.com/kde-neon-vs-kubuntu/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -KDE Neon vs Kubuntu:两款 KDE 发行版有什么区别? +KDE Neon vs Kubuntu:这两款 KDE 发行版有什么区别? ====== 当你发现两款基于 [Ubuntu][1] 并由 [KDE][2] 驱动的 Linux 发行版,你会选择哪一个? @@ -15,19 +15,17 @@ KDE Neon vs Kubuntu:两款 KDE 发行版有什么区别? * [Kubuntu][3] 是 Ubuntu 的官方 KDE 版本。 * [KDE Neon][4] 是 KDE 自己发布的基于 Ubuntu 的发行版。 - - -我知道这常常会让人感到困惑,尤其是当你从来没有使用过这两个版本,但得到了使用它们的建议。因此,为了帮助你做出决定,我想整理了一份 KDE Neon 和 Kubuntu 的区别(和相似之处)。 +我知道这常常会让人感到困惑,尤其是当你从来没有使用过这两个版本,但有人推荐你使用它们。因此,为了帮助你做出决定,我想整理一份 KDE Neon 和 Kubuntu 的区别(和相似之处)。 让我们先开始了解相似之处,然后再继续了解不同之处。 -**注:**_根据你的系统,你对这两个发行版的体验可能有所不同。所以,请把这篇文章作为一个参考,而不是一个”哪个更好“的比较。_ +注:根据你的系统,你对这两个发行版的体验可能有所不同。所以,请把这篇文章作为一个参考,而不是一个”哪个更好“的比较。 ### KDE Neon vs Kubuntu:功能上的比较 ![][5] -比较发行版相似性来总是好的。所以,从理论上,我试图把最重要的区别写下来。 +基于相似性比较发行版是一个不错的做法。所以,从理论上,我试图把最重要的区别写下来。 然而,值得注意的是,发行版的兼容性、性能和稳定性会根据你的硬件而有所不同,而这里没有考虑到这一点。 @@ -37,9 +35,9 @@ KDE Neon vs Kubuntu:两款 KDE 发行版有什么区别? 是的,这两个 Linux 发行版都是基于 Ubuntu 的,但 KDE Neon 只基于最新的 Ubuntu LTS 版本,而 Kubuntu 则提供了基于 Ubuntu LTS 的版本和非 LTS 版本。 -所以,如果使用 KDE Neon,你可以期望在下一个 Ubuntu LTS 版本(2 年)的几个月后就能用上最新的 Ubuntu 功能。但是,对于 Kubuntu 来说,你可以选择一个非 LTS 版本,并尝试使用最新的 Ubuntu 版本的 6 个月的软件更新。 +所以,如果使用 KDE Neon,你可以期望在下一个 Ubuntu LTS 版本(每 2 年)的几个月后就能用上最新的 Ubuntu 功能。但是,对于 Kubuntu 来说,你可以选择一个非 LTS 版本,并尝试使用带有 6 个月的软件更新的最新 Ubuntu 版本。 -KDE Neon 确实提供了测试版和开发者版,但这些都是为了测试预发布的 KDE 软件。 +KDE Neon 确实提供了测试版和开发者版,但这些都是为了测试预发布的 KDE 软件而提供的。 #### KDE Plasma 桌面 @@ -47,34 +45,33 @@ KDE Neon 确实提供了测试版和开发者版,但这些都是为了测试 尽管这两个发行版都采用了 KDE plasma 桌面,而且你可以获得相同程度的定制,但 KDE Neon 会首先获得最新的 KDE Plasma 桌面。 -如果你还不知道,KDE Neon 是由 KDE 官方团队开发的,由 Jonathan Riddell(Kubuntu 创始人)在[被 Canonical 强制退出 Kubuntu][8] 后宣布的。 +如果你还不知道,KDE Neon 是由 KDE 官方团队开发的,由 Jonathan Riddell(Kubuntu 创始人)在[被 Canonical 强制赶出 Kubuntu][8] 后宣布的。 -所以,不仅仅局限于最新的 Plasma 桌面,如果你想尽快获得最新最好的 KDE,KDE Neon 是最佳选择。 +所以,不仅限于最新的 Plasma 桌面,如果你想尽快获得最新最好的 KDE,KDE Neon 是最佳选择。 -Kubuntu 最终会得到更新的 KDE 软件的更新,但这需要时间。如果你不太确定最新的 KDE 软件/桌面,而你需要的只是一个稳定的 KDE 系统,你应该选择 Kubuntu LTS 版本。 +Kubuntu 最终会得到更新的 KDE 软件的更新,但这需要时间。如果你不太确定需要最新的 KDE 软件/桌面,而只是需要一个稳定的 KDE 系统,你应该选择 Kubuntu LTS 版本。 #### 预装软件 开箱即用,你会发现 Kubuntu 已经预装了一些必要的工具和应用程序,但是,对于 KDE Neon,你需要找到并安装一些应用和工具。 -为了给你一些视角,与 Kubuntu 相比,KDE Neon 可能是一个轻量级的发行版。然而,对于新的 Linux 用户来说,他们可能会发现 Kubuntu 是一个易于使用的体验,并预装了更多必要的软件和工具。 - +从某些方面看,与 Kubuntu 相比,KDE Neon 可能是一个轻量级的发行版。然而,对于新的 Linux 用户来说,他们可能会发现 Kubuntu 是一个易于使用的体验,并预装了更多必要的软件和工具。 #### 软件更新 -如果你没有使用按流量计费的连接,这可能根本不重要。但是,我应该提一下,考虑到常规的 Ubuntu LTS 修复/更新以及 KDE 软件更新,KDE Neon 会得到更多的软件更新。 +如果你没有使用按流量计费的连接,这可能根本不重要。但是,我应该提一下,考虑到常规的 Ubuntu LTS 修复/更新以及 KDE 软件更新,KDE Neon 会有更多的软件更新。 -对于 Kubuntu,你只会得到 Ubuntu LTS 的更新(除非你使用的是非 LTS 版本)。所以,从技术上讲,你会得到更少的更新数量。 +对于 Kubuntu,你只会得到 Ubuntu LTS 的更新(除非你使用的是非 LTS 版本)。所以,从技术上讲,你会有更少的更新数量。 #### Ubuntu KDE 版与 Plasma 的体验差异 ![][11] -我知道如果你没有尝试过这两个版本,你可能会认为它们很相似。但是,Kubuntu 是 Ubuntu 的官方版本,它更注重在 KDE 桌面环境上使用 Ubuntu 的体验。 +我知道如果你没有尝试过这两个版本,你可能会认为它们很相似。但是,Kubuntu 是 Ubuntu 的官方版本,它更注重 Ubuntu 在 KDE 桌面环境上的使用体验。 而 KDE Neon 在技术上是一样的,但它的目的是为了获得一流的 Plasma 桌面体验,并搭载最新的东西。 -尽管这两个发行版开箱即可完美工作,但它们有不同的愿景,而开发也相应地进行。你只需要决定你自己想要什么,然后选择其中之一。 +尽管这两个发行版开箱即可完美工作,但它们有不同的愿景和相应的开发工作。你只需要决定你自己想要什么,然后选择其中之一。 #### 硬件兼容性 @@ -84,7 +81,7 @@ Kubuntu 最终会得到更新的 KDE 软件的更新,但这需要时间。如 只需要记住,如果你尝试 KDE Neon,但由于某些原因不能工作。你知道该怎么做。 -**总结** +### 总结 那么,你会选择哪个呢?KDE Neon 还是 Kubuntu?这完全是你的选择。 @@ -99,7 +96,7 @@ via: https://itsfoss.com/kde-neon-vs-kubuntu/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 5a037bddb3fb14fdb0243f41ff081bd3ae2aba95 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 18 Nov 2020 00:06:52 +0800 Subject: [PATCH 0804/1156] PUB @geekpi https://linux.cn/article-12834-1.html --- ... What-s the Difference Between the Two KDE Distribution.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md (98%) diff --git a/translated/tech/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md b/published/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md similarity index 98% rename from translated/tech/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md rename to published/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md index e97ea06107..79b0f00628 100644 --- a/translated/tech/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md +++ b/published/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12834-1.html) [#]: subject: (KDE Neon vs Kubuntu: What’s the Difference Between the Two KDE Distribution?) [#]: via: (https://itsfoss.com/kde-neon-vs-kubuntu/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From c95d2783b80dba13a59ab75b8f8bf6dc4b1de949 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 18 Nov 2020 00:41:10 +0800 Subject: [PATCH 0805/1156] PRF @geekpi --- ... Per Account in Linux With Timekpr-nExt.md | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/translated/tech/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md b/translated/tech/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md index 28537ef98a..1f55e4fcde 100644 --- a/translated/tech/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md +++ b/translated/tech/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Got Kids? Limit Computer Usage Per Account in Linux With Timekpr-nExt) @@ -10,7 +10,9 @@ 有孩子吗?使用 Timekpr-nExt 限制 Linux 中每个账户的电脑使用 ====== -_**本周的开源软件亮点是 Timekpr-nExt。它是一个 GUI 应用,用于限制 Linux 系统中某些账户的电脑使用。对于不想让孩子花太多时间在电脑上的父母来说,这是一个方便的工具。**_ +![](https://img.linux.net.cn/data/attachment/album/202011/18/004039svxva9wrvva2xias.jpg) + +> 本周的开源软件亮点是 Timekpr-nExt。它是一个 GUI 应用,用于限制 Linux 系统中某些账户的电脑使用。对于不想让孩子花太多时间在电脑上的父母来说,这是一个方便的工具。 ### 使用 Timekpr-nExt 在 Linux 上限制电脑使用 @@ -20,33 +22,29 @@ _**本周的开源软件亮点是 Timekpr-nExt。它是一个 GUI 应用,用 ![][1] -给定的时间超过后,用户会自动注销,直到满足限制条件才可以重新登录。 +给定的时间超过后,用户会自动登出,直到满足限制条件才可以重新登录。 ![][2] -当然,这意味着你需要为孩子们单独设置非管理员(无 sudo 权限)账户。如果孩子们的账户也有管理员权限,他们可以很容易地改变设置。孩子们很聪明,你知道的。 +当然,这意味着你需要为孩子们单独设置非管理员(无 `sudo` 权限)账户。如果孩子们的账户也有管理员权限,他们可以很容易地改变设置。孩子们很聪明,你知道的。 ### Timekpr-nExt 的功能 除了一个令人讨厌的风格化的名字,Timekpr-nExt 有以下功能: -* 将系统使用限制设置为日智能限制、每日限制、每周或每月限制 +* 将系统使用限制设置为按日智能限制、每日、每周或每月限制 * 你还可以根据时间和小时设置访问限制 * 用户可以看到关于他们还剩多少时间的通知 * 设置锁定动作(终止会话、关闭、暂停或锁定屏幕) * 追踪账户的时间使用情况 - - 请注意以下事项: -* 仔细检查你正在配置的账户。_**不要把自己锁定**_。 -* 每次更改配置时,请点击应用或设置按钮,否则更改将不会被设置。 -* 儿童帐户不应该有管理员操作,否则他们会覆盖设置。 +* 仔细检查你正在配置的账户。**不要把自己锁定** +* 每次更改配置时,请点击应用或设置按钮,否则更改将不会被设置 +* 儿童帐户不应该有管理员操作,否则他们会覆盖设置 - - -阅读[关于使用 Timekpr-nExt 的更多信息的文档][3]。 +这里阅读[关于使用 Timekpr-nExt 的更多信息的文档][3]。 ### 在 Linux 中安装 Timekpr-nExt @@ -60,9 +58,9 @@ sudo apt install timekpr-next Arch Linux 用户可以[在 AUR 中找到它][5]。对于其他用户,请检查你的发行版仓库。如果没有这样的包,你可以尝试使用源码。 -[Timekpr-nExt 源码][6] +- [Timekpr-nExt 源码][6] -_**再说一次,不要在主账户中使用 Timekpr-nExt。你可能会把自己锁在外面。**_ +**再说一次,不要在主账户中使用 Timekpr-nExt。你可能会把自己锁在外面。** 你会看到两个应用的实例。使用开头有 (SU) 的那个。 @@ -95,7 +93,7 @@ via: https://itsfoss.com/timekpr-next/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a0498060cb9aba429ccd73dd715ebe7f4e8bf58a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 18 Nov 2020 00:41:41 +0800 Subject: [PATCH 0806/1156] PUB @geekpi https://linux.cn/article-12835-1.html --- ...t Computer Usage Per Account in Linux With Timekpr-nExt.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md (98%) diff --git a/translated/tech/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md b/published/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md similarity index 98% rename from translated/tech/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md rename to published/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md index 1f55e4fcde..50d25c00a5 100644 --- a/translated/tech/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md +++ b/published/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12835-1.html) [#]: subject: (Got Kids? Limit Computer Usage Per Account in Linux With Timekpr-nExt) [#]: via: (https://itsfoss.com/timekpr-next/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From ea99949a0a02f66e8b4a264916f4f28e989739fe Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 18 Nov 2020 05:03:11 +0800 Subject: [PATCH 0807/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201118?= =?UTF-8?q?=20How=20to=20Write,=20Compile=20and=20Run=20a=20C=20Program=20?= =?UTF-8?q?in=20Ubuntu=20and=20Other=20Linux=20Distributions=20[Beginner?= =?UTF-8?q?=E2=80=99s=20Tip]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201118 How to Write, Compile and Run a C Program in Ubuntu and Other Linux Distributions -Beginner-s Tip.md --- ...her Linux Distributions -Beginner-s Tip.md | 138 ++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 sources/tech/20201118 How to Write, Compile and Run a C Program in Ubuntu and Other Linux Distributions -Beginner-s Tip.md diff --git a/sources/tech/20201118 How to Write, Compile and Run a C Program in Ubuntu and Other Linux Distributions -Beginner-s Tip.md b/sources/tech/20201118 How to Write, Compile and Run a C Program in Ubuntu and Other Linux Distributions -Beginner-s Tip.md new file mode 100644 index 0000000000..5fa80a38de --- /dev/null +++ b/sources/tech/20201118 How to Write, Compile and Run a C Program in Ubuntu and Other Linux Distributions -Beginner-s Tip.md @@ -0,0 +1,138 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Write, Compile and Run a C Program in Ubuntu and Other Linux Distributions [Beginner’s Tip]) +[#]: via: (https://itsfoss.com/run-c-program-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +How to Write, Compile and Run a C Program in Ubuntu and Other Linux Distributions [Beginner’s Tip] +====== + +How do you program in C on Linux? It is indeed very easy and consists of three simple steps. + +**Step 1**: You write your program and save the file with a .c extension. For example, my_program.c. + +**Step 2**: You compile the program and generate the object file using gcc compiler in a terminal like this: + +``` +gcc -o my_program my_program.c +``` + +**Step 3**: You run the generated object file to run your C program in Linux: + +``` +./my_program +``` + +![][1] + +This was just the quick summary on how to compile and run C program in Linux. If you are new to either C or Linux, I’ll show these steps in detail so that you feel comfortable coding C program in Linux environment. + +In fact, I’ll discuss how to run C programs in Linux terminal as well as in code editor. + +![][2] + +### Method 1: How to run C programs in Linux terminal + +In order to run a C program in Linux, you need to have a C compiler present on your systems. The most popular compiler is gcc ([GNU Compiler Collection][3]). + +You can install gcc using your distribution’s package manager. In Debian and Ubuntu-based Linux distributions, use the apt command: + +``` +sudo apt install gcc +``` + +Switch to directory where you have kept your C program (or provide the path) and then generate the object file by compiling the program: + +``` +gcc -o my_program my_program.c +``` + +Keep in mind that it is optional to provide the output object file (-o my_program). If you won’t do that, an object file named a.out will be automatically generated. But this is not good because it will be overwritten for each C program and you won’t be able to know which program the a.out object file belongs to. + +Once you have your object file generated, run it to run the C program. It is already executable. Simple use it like this: + +``` +./my_program +``` + +And it will display the desired output, if your program is correct. As you can see, this is not very different from [running C++ programs in Linux][4]. + +_**Every time you make a change in your program, you have to compile it first and then run the generated object file to run the C program.**_ + +### Method 2: How to run C programs in Linux using a code editor like Visual Studio Code + +Not everyone is comfortable with command line and terminal and I totally understand that. + +You can use a proper C/C++ IDE like Eclipse or Code Blocks but they are often too heavy programs and more suitable for large projects. + +I recommend using an open source code editor like Visual Studio Code or Atom. These are basically text editors and you can install add-ons to compile and run programs directly from the graphical code editor. + +I am using [Visual Studio Code editor][5] in this example. It’s a hugely [popular open source code editor][6] from Microsoft. + +First thing first, [install Visual Studio Code in Ubuntu][7] from the software center. For other distributions, please check your Linux distribution’s package manager or software center. You may also check the official website for more information. + +Start Visual Studio Code and open/create a project and create your C program here. I am using a sample Hello World program. + +![][8] + +You must ensure that you have gcc compiler installed on your Linux system. + +``` +sudo apt install gcc +``` + +Next thing you would want is to use an extension that allows you to run the C code. Microsoft may prompt you for installing its own extension for C/C++ program but it is complicated to setup and hence I won’t recommend it. + +Instead, I suggest using the Code Runner extension. It’s a no-nonsense extension and you can run C and C++ code easily without additional configuration. + +Go to the Extensions tab and search for ‘Code Runner’ and install it. + +![Install Code Runner extension for running C/C++ program][9] + +Restart Visual Studio Code. Now, you should be able to run the C code by using one of the following way: + + * Using the shortcut Ctrl+Alt+N. + * Press F1 and then select or type Run Code. + * Right click the text editor and the click Run code from context menu. + + + +![Right click the program file and choose Run Code][10] + +When you run the program, it is compiled automatically and then run. You can see the output in terminal that is opened at the bottom of the editor. What could be better than this? + +![Program output is displayed in the bottom section of the editor][11] + +Which method do you prefer? + +Running a few C programs in Linux command line is okay but using a code editor is much easier and saves time. Won’t you agree? + +I let you decide whichever method you want to use. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/run-c-program-linux/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/running-c-program-linux.png?resize=795%2C399&ssl=1 +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/Run-C-Program-Linux.png?resize=800%2C450&ssl=1 +[3]: https://gcc.gnu.org/ +[4]: https://itsfoss.com/c-plus-plus-ubuntu/ +[5]: https://code.visualstudio.com +[6]: https://itsfoss.com/best-modern-open-source-code-editors-for-linux/ +[7]: https://itsfoss.com/install-visual-studio-code-ubuntu/ +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/c-program-visual-studio-code-linux.png?resize=800%2C441&ssl=1 +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/running-c-program-in-linux-with-visual-studio-code.png?resize=800%2C500&ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/running-c-program-in-linux-with-visual-studio-code.jpg?resize=800%2C500&ssl=1 +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/run-c-program-in-linux-with-visual-studio-code.jpg?resize=800%2C500&ssl=1 From c1c2557c62084c81f6c79f0e473877c1fe128725 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 18 Nov 2020 05:03:25 +0800 Subject: [PATCH 0808/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201118?= =?UTF-8?q?=20LazPaint:=20A=20Free=20&=20Open=20Source=20Paint.NET=20Alter?= =?UTF-8?q?native?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201118 LazPaint- A Free - Open Source Paint.NET Alternative.md --- ...ree - Open Source Paint.NET Alternative.md | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 sources/tech/20201118 LazPaint- A Free - Open Source Paint.NET Alternative.md diff --git a/sources/tech/20201118 LazPaint- A Free - Open Source Paint.NET Alternative.md b/sources/tech/20201118 LazPaint- A Free - Open Source Paint.NET Alternative.md new file mode 100644 index 0000000000..ad0c5f6594 --- /dev/null +++ b/sources/tech/20201118 LazPaint- A Free - Open Source Paint.NET Alternative.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (LazPaint: A Free & Open Source Paint.NET Alternative) +[#]: via: (https://itsfoss.com/lazpaint/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +LazPaint: A Free & Open Source Paint.NET Alternative +====== + +_**Brief: LazPaint is an open-source Paint.NET alternative with cross-platform support. It is a lightweight program with a bunch of essential options to edit images quickly. Here’s an overview of LazPaint.**_ + +### LazPaint: Open Source Paint.NET Alternative for Linux + +![][1] + +If you are fond of using tools to quickly edit and manipulate images and screenshots, you may have heard about [Paint.NET][2], which is available only for Windows systems. + +It is a popular nifty tool to get a lot of basic editing tasks done along with a bunch of options available. You might be aware of several [ima][3][ge editing tools][3] but Paint.NET is a pretty popular option just because it is easy to use without any bloated feature for an average user. + +[LazPaint][4] comes to the rescue as an impressive open source replacement to Paint.NET for Linux, Windows, and macOS. It offers most of the essential features one would need to manipulate images while being easy to use. + +![][5] + +Since it is cross-platform application, even if you’re not using a Linux system, you could still start using it as a no-nonsense free and open-source tool, if that’s your priority. Now, let us take a look at some features it offers. + +### Features of LazPaint + +![][6] + +As I mentioned earlier, LazPaint offers a bunch of essential features. Here, I’ll list the key highlights that can help you decide if you need it. However, I’d recommend you to explore it to know more about it. + + * All major file formats supported (including layered Bitmaps and 3D files) + * Selection Tools, Crop to Selection, Selection Pen, Invert Selection + * Export to [Krita][7] supported + * Image resampling with various quality settings + * Motion Blur, Custom Blur, Radial Blur, and Pixelate tool + * Ability to remove transparency and flatten the image + * Rotate and Flip images + * Convert images to Negatives + * Ability to re-size Canvas + * Deforming tool (perspective) + * Advanced Drawing tools + * Set workspace color + * Dark theme + * Supports script functionality + * Layer support with essential management options + * Layer effects + * Filters + * Grayscale effect + * Ability to enable/disable the toolbar in or attach them to the Dock + + + +**Recommended Read:** + +![][8] + +#### [Drawing is an Open Source MS-Paint Type of App for Linux Desktop][9] + +### Installing LazPaint on Linux + +You should find it available in your official repositories to install it via your default package manager but to get the latest version, you will have to download the .**deb** file or compile it from source on non-Debian based Distributions. + +I wish there was a Flatpak available to get the latest version on every Linux distribution — but nothing as of now. + +It is available for Windows and macOS as well. You will also find a portable version available for Windows, that could come in handy. + +[LazPaint][4] + +### Closing Thoughts on LazPaint + +I found it really easy to use and the variety of quality settings to re-sample (or resize) an image is definitely a good addition. If you’ve already installed it, you must have noticed that it does not take a significant amount of storage to get installed and is a lightweight program overall. + +It’s snappy, and most of the functions that I tested in my quick usage worked quite well without any issues. + +What do you think about LazPaint as a Paint.NET alternative? Let me know your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/lazpaint/ + +作者:[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://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/lazpaint.jpg?resize=800%2C397&ssl=1 +[2]: https://www.getpaint.net +[3]: https://itsfoss.com/image-applications-ubuntu-linux/ +[4]: https://lazpaint.github.io/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/lazpaint-screenshot-2.png?resize=800%2C481&ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/lazpaint-screenshot.jpg?resize=800%2C484&ssl=1 +[7]: https://krita.org/en +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/drawing-app-interface.jpg?fit=789%2C449&ssl=1 +[9]: https://itsfoss.com/drawing-app/ From 347e077e9a545f6265d4ad09fc7d7ce83ed18511 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 18 Nov 2020 05:03:44 +0800 Subject: [PATCH 0809/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201117?= =?UTF-8?q?=20My=20top=207=20Rust=20commands=20for=20using=20Cargo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201117 My top 7 Rust commands for using Cargo.md --- ... My top 7 Rust commands for using Cargo.md | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 sources/tech/20201117 My top 7 Rust commands for using Cargo.md diff --git a/sources/tech/20201117 My top 7 Rust commands for using Cargo.md b/sources/tech/20201117 My top 7 Rust commands for using Cargo.md new file mode 100644 index 0000000000..14f6672be1 --- /dev/null +++ b/sources/tech/20201117 My top 7 Rust commands for using Cargo.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My top 7 Rust commands for using Cargo) +[#]: via: (https://opensource.com/article/20/11/commands-rusts-cargo) +[#]: author: (Mike Bursell https://opensource.com/users/mikecamel) + +My top 7 Rust commands for using Cargo +====== +Spend some time investigating Rust's package manager, Cargo. +![Person drinking a hot drink at the computer][1] + +I've been using Rust for a little over six months now. I'm far from an expert, but I have stumbled across many, many gotchas and learned many, many things along the way; things that I hope will be of use to those who are learning what is easily my favourite programming language. + +This is the third article in my miniseries for Rust newbs like me. You can find my other excursions into Rust in: + + * [My top 7 keywords in Rust][2] + * [My top 7 functions in Rust][3] + + + +I plan to write more, and this article is about Rust's package manager, [Cargo][4]. I'm ashamed to admit that I don't use Cargo's power as widely as I should, but researching this article gave me a better view of its commands' capabilities. In fact, I wasn't even aware of some of the options available until I started looking in more detail. + +For this list of my top seven Cargo commands, I'll assume you have basic familiarity with Cargo—that you have it installed, and you can create a package using `cargo new `, for instance. I could have provided more commands (there are many options!), but here are my "lucky 7." + + 1. **cargo help <command>:** You can always find out more about a command with the `--help` option. The same goes for Cargo itself: `cargo --help` will give you a quick intro to what's out there. To get more information on a command (more like a man page), you can try using the command `new`. For instance, `cargo help new` will give extended information about `cargo new`. This behaviour is pretty typical for command-line tools, particularly in the Linux/Unix world, but it's very expressively implemented for Cargo, and you can gain lots of quick information with it. + + 2. **cargo build --bin <target>:** What happens when you have multiple .rs files in your package, but you want to build just one of them? I have a package called `test-and-try` that I use for, well, testing and trying functionality, features, commands, and crates. It has around a dozen different files in it. By default, `cargo build` will try to build _all_ of them, and as they're often in various states of repair (some of them generating lots of warnings, some of them not even fully compiling), this can be a real pain. Instead, I place a section in my `Cargo.toml` file for each one like this: [code] + +[[bin]] +name = "warp-body" +path = "src/warp-body.rs" + +[/code] I can then use `cargo build --bin warp-body` to build _just_ this file (and any dependencies). I can then run it with a similar command: `cargo run --bin warp-body`. + + 3. **cargo test:** I have an admission; I am not as assiduous about creating automatic tests in my Rust code as I ought to be. This is because I'm currently mainly writing proof of concept rather than production code, and also because I'm lazy. Maybe changing this behaviour should be a New Year's resolution, but when I _do_ get round to writing tests, Cargo is there to help me (as it is for you). All you need to do is add a line before the test code in your .rs file: [code]`#[cfg(test)]`[/code] When you run `cargo test`, Cargo will "automagically" find these tests, run them, and tell you if you have problems. As with many of the commands here, you'll find much more information online, but it's particularly worth familiarising yourself with the basics of this capability in the relevant [Rust By Example section][5]. + + 4. **cargo search <query>:** This is one of the commands that I didn't even know existed until I started researching this article—and which would have saved me so much time over the past few months if I'd known about it. It searches [Crates.io][6], Rust's repository of public (and _sometimes_ maintained) packages and tells you which ones may be relevant. (You can specify a different repository if you want, with the intuitively named `--registry` option.) I've recently been doing some work on network protocols for non-String data, so I've been working with Concise Binary Object Representation ([CBOR][7]). Here's what happens if I use `cargo search`: + +![Cargo search output][8] + +(Mike Bursell, [CC BY-SA 4.0][9]) + +This is great! I can, of course, also combine this command with tools like grep to narrow down the search yet further, like so: `cargo search cbor --limit 70 | grep serde`. + + 5. **cargo tree:** Spoiler alert: this one may scare you. You've probably noticed that when you first build a new package, or when you add a new dependency, or just do a `cargo clean` and then `cargo build`, you see a long list of crates printed out as Cargo pulls them down from the relevant repositories and compiles them. How can you tell ahead of time, however, what will be pulled down and what version it will be? More importantly, how can you know what other dependencies a new crate has pulled into your build? The answer is `cargo tree`. Just to warn you: For any marginally complex project, you can expect to have a _lot_ of dependencies. I tried `cargo tree | wc -l` to count the number of dependent crates for a smallish project I'm working on and got an answer of 350! I tried providing an example, but it didn't display well, so I recommend that you try it yourself—be prepared for lots of output! + + 6. **cargo clippy:** If you try running this and it doesn't work, that's because I cheated a little with these last two commands: you may have to install them explicitly (depending on your setup). For this one, run `cargo install clippy`—you'll be glad you did. Clippy is Rust's linter; it goes through your code, looking at ways to reduce and declutter it by removing or changing commands. I try to run `cargo clippy` before every `git commit`—partly because the Git repositories I tend to commit to have automatic actions to reject files that need linting, and partly to keep my code generally more tidy. Here's an example: + +![Cargo clippy output][10] + +(Mike Bursell, [CC BY-SA 4.0][9]) + +Let's face it; this isn't a major issue (though clippy will find errors, too, if you run it on non-compiling code), but it's an easy fix, so you might as well deal with it—either by removing the code or prefixing the variable with an underscore. As I plan to use this variable later but haven't yet implemented the function to consume it, I will perform the latter fix. + + 7. **cargo readme:** While it's not the most earth-shattering of commands, this is another that is very useful (and that, as with `cargo clippy`, you may need to install explicitly). If you add the relevant lines to your .rs files, you can output README files from Cargo. For instance, I have the following lines at the beginning of my main.rs file: + +![Cargo readme input][11] + +(Mike Bursell, [CC BY-SA 4.0][9]) + +I'll leave the `cargo readme` command's output as an exercise for the reader, but it's interesting to me that the Licence (or "License," if you must) declaration is added. Use this to create simple documentation for your users and make them happy with minimal effort (always a good approach!). + + + + +I've just scratched the surface of Cargo's capabilities in this article; all the commands above are actually way more powerful than I described. I heartily recommend that you spend some time investigating Cargo and finding out how it can make your life better. + +* * * + +_This article was originally published on [Alice, Eve, and Bob][12] and is reprinted with the author's permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/commands-rusts-cargo + +作者:[Mike Bursell][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://opensource.com/users/mikecamel +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hot drink at the computer) +[2]: https://opensource.com/article/20/10/keywords-rust +[3]: https://opensource.com/article/20/10/rust-functions +[4]: https://doc.rust-lang.org/cargo/ +[5]: https://doc.rust-lang.org/stable/rust-by-example/testing/unit_testing.html +[6]: https://crates.io/ +[7]: https://cbor.io/ +[8]: https://opensource.com/sites/default/files/uploads/cargo-search-output-5.png (Cargo search output) +[9]: https://creativecommons.org/licenses/by-sa/4.0/ +[10]: https://opensource.com/sites/default/files/uploads/cargo-clippy-output-1.png (Cargo clippy output) +[11]: https://opensource.com/sites/default/files/uploads/cargo-readme-input.png (Cargo readme input) +[12]: https://aliceevebob.com/2020/11/03/my-top-7-cargo-rust-commands/ From 5b41acccb86b046e7db2c79113e667448063e658 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 18 Nov 2020 05:03:58 +0800 Subject: [PATCH 0810/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201117?= =?UTF-8?q?=20Getting=20started=20with=20btrfs=20for=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201117 Getting started with btrfs for Linux.md --- ...17 Getting started with btrfs for Linux.md | 250 ++++++++++++++++++ 1 file changed, 250 insertions(+) create mode 100644 sources/tech/20201117 Getting started with btrfs for Linux.md diff --git a/sources/tech/20201117 Getting started with btrfs for Linux.md b/sources/tech/20201117 Getting started with btrfs for Linux.md new file mode 100644 index 0000000000..484638c901 --- /dev/null +++ b/sources/tech/20201117 Getting started with btrfs for Linux.md @@ -0,0 +1,250 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with btrfs for Linux) +[#]: via: (https://opensource.com/article/20/11/btrfs-linux) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) + +Getting started with btrfs for Linux +====== +The B-tree filesystem is a filesystem and volume manager rolled into +one. It offers a lot of promise for delivering an advanced filesystem +feature set to Linux. +![Filing cabinet for organization][1] + +Btrfs has been available for Linux for several years, so you may already be familiar with it. If not, you may have questions about it, especially if you use Fedora Workstation (Btrfs is now its default filesystem). This article aims to help you get familiar with it and its advanced features, such as [copy-on-write][2] and [checksums][3]. + +Btrfs, short for B-Tree Filesystem, is actually a filesystem and volume manager rolled into one. It's often seen as a response to ZFS, introduced in Sun Microsystem's Solaris OS back in 2005, now largely replaced by an open source implementation called OpenZFS. Ubuntu Linux and FreeBSD often feature OpenZFS. Other examples with similar features are Red Hat's Stratis and the Linux Logical Volume Manager (LVM). + +### Setup + +To try Btrfs, I [downloaded][4] the Fedora 33 Workstation ISO file and installed it into a new virtual machine (VM). The installation process has not changed from previous versions. I did not customize any settings, including drive partitioning and formatting, to maintain an accurate "out of the box" setup for this tutorial. Once the VM was up and running, I installed and ran the GNOME Partition Editor ([GParted][5]) for a nice, factory-fresh view of the drive layout. + +![GParted's view of Btrfs on Fedora 33 Workstation using GParted][6] + +(Alan Formy-Duvall, [CC BY-SA 4.0][7]) + +From this point, it's not much different from what you're used to; in fact, you can use the system normally, and you might not even notice that the filesystem is Btrfs. However, having this new default enables you to leverage several cool features. + +### Examine the Btrfs filesystem + +I am not aware of any Btrfs-specific graphical tools, although some of its functions have been incorporated into existing disk-management tools. + +From the command line, you can get a closer look at the Btrfs format: + + +``` +# btrfs filesystem show +Label: 'fedora_localhost-live'  uuid: f2bb02f9-5c41-4c91-8eae-827a801ee58a +        Total devices 1 FS bytes used 6.36GiB +        devid    1 size 10.41GiB used 8.02GiB path /dev/vda3 +``` + +### Change Btrfs labels + +The first thing I noticed was the filesystem label set by the installer: `fedora_localhost-live`. This is inaccurate because it is now an installed system and no longer a [live CD][8]. So I changed it using the `btrfs filesystem label` command. + +Changing a Btrfs filesystem label is simple: + + +``` +# btrfs filesystem label / +fedora_localhost-live +# btrfs filesystem label / fedora33workstation +# btrfs filesystem label / +fedora33workstation +``` + +### Manage Btrfs subvolumes + +A subvolume appears to be a standard directory that can be managed by Btrfs. There are several subvolumes on my new Fedora 33 Workstation: + + +``` +# btrfs subvolume list / +ID 256 gen 2458 top level 5 path home +ID 258 gen 2461 top level 5 path root +ID 265 gen 1593 top level 258 path var/lib/machines +``` + +Create a new subvolume using the `btrfs subvolume create` command, or delete a subvolume with `btrfs subvolume delete`: + + +``` +# btrfs subvolume create /opt/foo +Create subvolume '/opt/foo' +# btrfs subvolume list / +ID 256 gen 2884 top level 5 path home +ID 258 gen 2888 top level 5 path root +ID 265 gen 1593 top level 258 path var/lib/machines +ID 276 gen 2888 top level 258 path opt/foo +# btrfs subvolume delete /opt/foo +Delete subvolume (no-commit): '/opt/foo' +``` + +Subvolumes allow actions like setting a quota, taking a snapshot, and replicating to other locations and hosts. How can system administrators take advantage of these capabilities? How about for user home directories? + +#### Add a user + +As has been the case since olden times, adding a new user account creates a home directory for the account to use: + + +``` +# useradd student1 +# getent passwd student1 +student1❌1006:1006::/home/student1:/bin/bash +# ls -l /home +drwx------. 1 student1 student1  80 Oct 29 00:21 student1 +``` + +Traditionally, a user's home directory is a subdirectory of `/home`. Ownership and privileges are tailored to the owner, but there are no special functions for managing them. The enterprise server environment is another scenario. Often, a directory is reserved for use by a particular application and its user. You can take advantage of Btrfs to manage and apply constraints to these directories. + +To accommodate Btrfs subvolumes as user homes, there is a new option to the `useradd` command: `--btrfs-subvolume-home`. Although the man pages have not been updated (as of this writing), you can see the option by running `useradd --help`. By passing this option when adding a new user, a new Btrfs subvolume will be created. It functions just like the `-d` option does for creating a regular directory: + + +``` +# useradd --btrfs-subvolume-home student2 +Create subvolume '/home/student2' +``` + +Verify the user with `getent passwd student2`, and it will appear normal. However, run the `btrfs subvolume` command to list subvolumes, and you will see something interesting: the new user's home directory! + + +``` +# btrfs subvolume list / +ID 256 gen 2458 top level 5 path home +ID 258 gen 2461 top level 5 path root +ID 265 gen 1593 top level 258 path var/lib/machines +ID 272 gen 2459 top level 256 path home/student2 +``` + +Explore the second scenario of an enterprise server environment. Suppose you need to install a [WildFly][9] server in `/opt` and deploy a Java web application. Often, your first step is to create a `wildfly` user.  Do this using the new `--btrfs-subvolume-home` option along with the `-b` option to specify `/opt` as the base directory: + + +``` +# useradd -b /opt --btrfs-subvolume-home wildfly +Create subvolume '/opt/wildfly' +``` + +Now, the `wildfly` user can log in and complete the installation in `/opt/wildfly`. + +#### Delete a user + +When you delete a user, sometimes you want to delete that user's files and the home directory at the same time. The `userdel` command has the `-r` option for this, and it also deletes Btrfs subvolumes: + + +``` +# userdel -r student2 +Delete subvolume (commit): '/home/student2' +``` + +#### Set disk-usage quotas + +In one of my computer science classes, a student ran a C program that went out of control and wrote to the disk until the entire `/home` was filled on the department's Unix system! The server became unavailable until the admin killed the runaway process and cleared some space. The same is true for the scenario above; that Wildfly enterprise application will have a growing number of log files and content stores for its users. How can you prevent a server from grinding to a halt because the disk has filled up? Setting disk-usage constraints is a good idea. Fortunately, Btrfs supports this by way of quotas. + +There are several steps required to configure quotas. The first step is to enable `quota` on the Btrfs filesystem: + + +``` +`# btrfs quota enable /` +``` + +Make sure you know each subvolume's quota group (qgroup) ID number, which is displayed by the `btrfs subvolume list` command. Each subvolume needs an associated qgroup based on its ID number. This can be done on an individual basis with `btrfs qgroup create`, but, conveniently, the Btrfs wiki provides the following command to expedite creating qgroups for subvolumes on a filesystem: + + +``` +`>btrfs subvolume list \ | cut -d' ' -f2 | xargs -I{} -n1 btrfs qgroup destroy 0/{} \` +``` + +In a freshly installed Fedora 33 workstation system, you are operating on the root filesystem path, `/`. Substitute `\` with the root path: + + +``` +`# btrfs subvolume list / | cut -d' ' -f2 | xargs -I{} -n1 btrfs qgroup create 0/{} /` +``` + +Then run `btrfs quota rescan` and take a look at the new qgroups: + + +``` +# btrfs quota rescan / +quota rescan started +# btrfs qgroup show / +qgroupid         rfer         excl +\--------         ----         ---- +0/5          16.00KiB     16.00KiB +0/256       272.04MiB    272.04MiB +0/258         6.08GiB      6.08GiB +0/265        16.00KiB     16.00KiB +0/271        16.00KiB     16.00KiB +0/273        16.00KiB     16.00KiB +``` + +Now you can assign a quota to one of the qgroups, which, in turn, is applied to its associated subvolume. So, if you want to limit student3's home directory usage to 1GB, use the `btrfs qgroup limit` command: + + +``` +`# btrfs qgroup limit 1G /home/student3` +``` + +Confirm the quota for the specific subvolume: + + +``` +# btrfs qgroup show -reF /home/student3 +qgroupid         rfer         excl     max_rfer     max_excl +\--------         ----         ----     --------     -------- +0/271        16.00KiB     16.00KiB      1.00GiB         none +``` + +Slightly different options will show all qgroups and any quotas that are set: + + +``` +# btrfs qgroup show -re / +qgroupid         rfer         excl     max_rfer     max_excl +\--------         ----         ----     --------     -------- +0/5          16.00KiB     16.00KiB         none         none +0/256       272.04MiB    272.04MiB         none         none +0/258         6.08GiB      6.08GiB         none         none +0/265        16.00KiB     16.00KiB         none         none +0/271        16.00KiB     16.00KiB      1.00GiB         none +0/273        16.00KiB     16.00KiB         none         none +``` + +### Other features + +These examples provide some idea of Btrfs' features. Run `btrfs --help` to see the full list of commands. Many other notable capabilities exist; for instance, snapshots and send/receive are two worth learning. + +### Final thoughts + +Btrfs offers a lot of promise for delivering an advanced filesystem feature set to Linux. It wasn't the first; I credit ZFS for my introduction to this type of filesystem some 15 years ago, but Btrfs is fully open source and unencumbered by patents. + +I advise starting with a virtual machine or spare system if you want to explore this filesystem. + +I would like to see some graphical management utilities produced for system administrators who like to operate in the GUI world. Fortunately, Btrfs has strong development activity, as evidenced by the Fedora project's decision to make it default on Workstation 33. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/btrfs-linux + +作者:[Alan Formy-Duval][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://opensource.com/users/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_organize_letter.png?itok=GTtiiabr (Filing cabinet for organization) +[2]: https://en.wikipedia.org/wiki/Copy-on-write +[3]: https://en.wikipedia.org/wiki/Checksum +[4]: https://getfedora.org/en/workstation/download/ +[5]: https://gparted.org/ +[6]: https://opensource.com/sites/default/files/uploads/gparted_btrfs.png (GParted's view of Btrfs on Fedora 33 Workstation using GParted) +[7]: https://creativecommons.org/licenses/by-sa/4.0/ +[8]: https://en.wikipedia.org/wiki/Live_CD +[9]: https://www.wildfly.org/ From e1bfacc70311451f97bfa53914913998c3c60f99 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 18 Nov 2020 05:04:11 +0800 Subject: [PATCH 0811/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201117?= =?UTF-8?q?=20How=20to=20upgrade=20to=20Terraform=200.12?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201117 How to upgrade to Terraform 0.12.md --- ...201117 How to upgrade to Terraform 0.12.md | 503 ++++++++++++++++++ 1 file changed, 503 insertions(+) create mode 100644 sources/tech/20201117 How to upgrade to Terraform 0.12.md diff --git a/sources/tech/20201117 How to upgrade to Terraform 0.12.md b/sources/tech/20201117 How to upgrade to Terraform 0.12.md new file mode 100644 index 0000000000..6f38dd9201 --- /dev/null +++ b/sources/tech/20201117 How to upgrade to Terraform 0.12.md @@ -0,0 +1,503 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to upgrade to Terraform 0.12) +[#]: via: (https://opensource.com/article/20/11/update-terraform) +[#]: author: (Jessica Cherry https://opensource.com/users/cherrybomb) + +How to upgrade to Terraform 0.12 +====== +Updating your environment to Terraform 0.12 is not for the faint of +heart, but this how-to will make it less painful. +![Green graph of measurements][1] + +In [getting started with Terraform][2], I used Terraform version 0.11. As some readers pointed out, this version lacks some significant features, so in this article, I'll explain how to update Terraform to the more feature-rich version 0.12. + +You may be surprised to learn that many people still use Terraform 0.11, including large organizations and stubborn users who like to stay on tried-and-true technology. Converting from Terraform 0.11 to 0.12 can be very complex. If you want to take advantage of the newer features but think you're not ready to update, this article should help make the conversion easier. + +In this article, I'll use the code from my "getting started" article and the [tfenv][3] tool, which enables you to use different versions of Terraform on the same machine. I'll also assume that you're familiar with two versions of Terraform (the one you're using, and the one you're migrating to), and how to use the `terraform` command in general. + +### Code changes needed for version 12 + +Some things work in Terraform version 0.11 that do not work in version 0.12. Here is an example of code I used in my previous article: + + +``` +resource "kubernetes_namespace" "1-minikube-namespace" { +  metadata { +        name = "my-first-terraform-namespace" +  } +} +``` + +As one reader pointed out, this code block does not work in version 0.12 due to changes in the way the latest Terraform works. This is a simple example, and it gets more complicated. Here are some examples of how much things may need to change in a production environment. + +The new Terraform needs slightly different syntax and structure. For starters, add a `vars.tf` file: + + +``` +variable "namespace" { +  type = "string" +  default = "helloworld" +} + +variable "cluster" { +  type = "string" +  default = "minikube" +} +``` + +Then, change parts of the `main.tf` file to incorporate the new `vars.tf` file. The Kubernetes provider now looks like this: + + +``` +provider "kubernetes" { +  config_context_cluster   = "${var.cluster}" +} +``` + +Here is the revised namespace resource: + + +``` +resource "kubernetes_namespace" "1-minikube-namespace" { +  metadata { +        name = "${var.namespace}" +  } +} +``` + +Finally, the changed [Helm provider][4]: + + +``` +provider "helm" { +  kubernetes { +        config_context_cluster   = "${var.cluster}" +  } +} +``` + +Beware! These small changes will matter when switching between versions. + +### Deploy before conversion + +Before moving forward, [set up tfenv][5] to use the correct version of Terraform: + + +``` +jess@Athena:~/terraform_doc$ tfenv list +  0.12.29 +  0.11.15-oci +jess@Athena:~/terraform_doc$ tfenv use 0.11.15-oci +Switching default version to v0.11.15-oci +Switching completed +jess@Athena:~/terraform_doc$ terraform --version +Terraform v0.11.15-oci +\+ provider.helm v1.2.2 +\+ provider.kubernetes v1.11.2 + +Your version of Terraform is out of date! The latest version +is 0.xx.y. You can update by downloading from [www.terraform.io/downloads.html][6] +``` + +If you (like me) have done other work with Terraform after using the code in my previous Terraform article, you need to redeploy everything. Set up the Minikube cluster for this Terraform deployment by starting a new, clean cluster: + + +``` +$ minikube delete +🔥  Deleting "minikube" in kvm2 ... +💀  Removed all traces of the "minikube" cluster. +jess@Athena:~/terraform_doc$ minikube start +😄  minikube v1.14.0 on Ubuntu 18.04 +``` + +After the cluster is set up, you can deploy your modified Terraform code. Start with the `init` command: + + +``` +$ terraform init + +Initializing provider plugins... + +The following providers do not have any version constraints in configuration, +so the latest version was installed. + +To prevent automatic upgrades to new major versions that may contain breaking +changes, it is recommended to add version = "..." constraints to the +corresponding provider blocks in configuration, with the constraint strings +suggested below. + +* provider.helm: version = "~> 1.2" +* provider.kubernetes: version = "~> 1.11" + +Terraform has been successfully initialized! + +You may now begin working with Terraform. Try running "terraform plan" to see +any changes that are required for your infrastructure. All Terraform commands +should now work. [...] +``` + +Next, run your plan: + + +``` +$ terraform plan +Refreshing Terraform state in-memory prior to plan... +helm_release.local: Refreshing state... (ID: buildachart) +kubernetes_namespace.1-minikube-namespace: Refreshing state... (ID: my-first-terraform-namespace) [...] + +Terraform will perform the following actions: + +  + helm_release.local +        id:                            <computed> +        atomic:                        "false" +        chart:                         "./buildachart" +        cleanup_on_fail:               "false" +        create_namespace:              "false" +        dependency_update:             "false" +        disable_crd_hooks:             "false" +        disable_openapi_validation: "false" +        [...] +  + kubernetes_namespace.1-minikube-namespace +        id:                            <computed> +        metadata.#:                     "1" +        [...] + +Note: You didn't specify an "-out" parameter to save this plan, so Terraform +can't guarantee that exactly these actions will be performed if +"terraform apply" is subsequently run. +``` + +Finally, apply the Terraform: + + +``` +$ terraform apply --auto-approve +helm_release.local: Refreshing state... (ID: buildachart) +kubernetes_namespace.1-minikube-namespace: Refreshing state... (ID: my-first-terraform-namespace) +kubernetes_namespace.1-minikube-namespace: Creating... +  metadata.#:                   "" => "1" +  metadata.0.generation:       "" => "<computed>" +  [...] +helm_release.local: Creating... +  atomic:                      "" => "false" +  chart:                       "" => "./buildachart" +  cleanup_on_fail:             "" => "false" +  create_namespace:            "" => "false" + [...] +  version:                     "" => "0.1.0" +  wait:                        "" => "true" +kubernetes_namespace.1-minikube-namespace: Creation complete after 1s (ID: helloworld) +helm_release.local: Still creating... (10s elapsed) +helm_release.local: Creation complete after 13s (ID: buildachart) + +Apply complete! Resources: 2 added, 0 changed, 0 destroyed. +``` + +Now you have a local backup of the Terraform state: + + +``` +$ ls -lrt + +drwxr-xr-x 6 jess jess 4096 May 16 14:15 buildachart +-rw-r--r-- 1 jess jess  363 Oct 24 13:06 main.tf +-rw-rw-r-- 1 jess jess  132 Oct 24 13:17 vars.tf +-rw-rw-r-- 1 jess jess 3897 Oct 24 13:20 terraform.tfstate.backup +-rw-rw-r-- 1 jess jess 3821 Oct 24 13:21 terraform.tfstate +``` + +### Convert from Terraform 0.11 to 0.12 + +Once everything is deployed using Terraform 0.11, you must work through the conversion process without damaging what you have in your new production cluster. First, change your Terraform version to 0.12 using tfenv: + + +``` +$ tfenv list +  0.12.29 +* 0.11.15-oci (set by /home/jess/.tfenv/version) +jess@Athena:~/terraform_doc$ tfenv use 0.12.29 +Switching default version to v0.12.29 +Switching completed +jess@Athena:~/terraform_doc$ terraform --version +Terraform v0.12.29 +\+ provider.helm v1.2.2 +\+ provider.kubernetes v1.11.2 +``` + +Now that you're on Terraform 0.12, you're ready to convert. Luckily, Terraform has a built-in command for this, as shown in this snippet from the Terraform command list: + + +``` +All other commands: +        0.12upgrade     Rewrites pre-0.12 module source code for v0.12 +``` + +Test the `upgrade` command to see what will be rewritten, then enter `yes` to do the upgrade: + + +``` +$ terraform 0.12upgrade + +This command will rewrite the configuration files in the given directory so +that they use the new syntax features from Terraform v0.12, and will identify +any constructs that may need to be adjusted for correct operation with +Terraform v0.12. +[...] +Would you like to upgrade the module in the current directory? +  Only 'yes' will be accepted to confirm. + +  Enter a value: yes + +\----------------------------------------------------------------------------- + +Upgrade complete! + +The configuration files were upgraded successfully. Use your version control +system to review the proposed changes, make any necessary adjustments, and +then commit. +``` + +It seems to have gone well. It may have rewritten some things, but that will not account for everything that needs to be changed with the Terraform files. However, it does a great job of making notes within the files. Here are the changes it made to the `vars.tf` file: + + +``` +variable "namespace" { +  type  = string +  default = "helloworld" +} + +variable "cluster" { +  type  = string +  default = "minikube" +} +``` + +The `type` changed to remove quotes around the word `string` (quoting in Terraform files has changed over time). Next, look at the `main.tf` file: + + +``` +provider "kubernetes" { +  config_context_cluster = var.cluster +} + +# TF-UPGRADE-TODO: In Terraform v0.11 and earlier, it was possible to begin a +# resource name with a number, but it is no longer possible in Terraform v0.12. +# +# Rename the resource and run `terraform state mv` to apply the rename in the +# state. Detailed information on the `state move` command can be found in the +# documentation online: +resource "kubernetes_namespace" "1-minikube-namespace" { +  metadata { +        name = var.namespace +  } +} + +provider "helm" { +  kubernetes { +        config_context_cluster = var.cluster +  } +} + +resource "helm_release" "local" { +  name  = "buildachart" +  chart = "./buildachart" +} +``` + +The quotes changed here, too, and variables are no longer wrapped in `${}` characters. The biggest section is a large TODO note that the conversion command placed in the code to show what needs to change in the resource name to be acceptable in version 0.12. Even better, it explains how to fix this issue and the command you need to run. The other major changes are the new `versions.tf` file and a new backup file: + + +``` +$ ls -lrt +drwxr-xr-x 6 jess jess 4096 May 16 14:15 buildachart +-rw-rw-r-- 1 jess jess 3897 Oct 24 13:20 terraform.tfstate.backup +-rw-r--r-- 1 jess jess   46 Oct 24 13:28 versions.tf +-rw-rw-r-- 1 jess jess  140 Oct 24 13:55 vars.tf +-rw-r--r-- 1 jess jess  369 Oct 24 13:56 main.tf +-rw-rw-r-- 1 jess jess 3821 Oct 24 13:56 terraform.tfstate.1603562212.backup +-rw-rw-r-- 1 jess jess 3827 Oct 24 13:56 terraform.tfstate +``` + +To update your production cluster, start with a different name that is better suited for this version: + + +``` +resource "kubernetes_namespace" "upgrade-minikube-namespace" { +  metadata { +        name = var.namespace +  } +} +``` + +#### Smoothing the rough edges + +After that change, you must run the `terraform state mv` command (as referenced in the large TODO note). But first, run `state list` to see what you're working with: + + +``` +$ terraform state list +helm_release.local +Kubernetes_namespace.1-minikube-namespace +``` + +The namespace is still set in the state as `1-minikube-namespace`, and that's the state you need to move. This can be done by ensuring you have the new and old resource names, then running the `terraform state mv` command. But before that, you must switch back to 0.11, using tfenv to make those changes, because this was deployed using Terraform 0.11, and 0.12 doesn't recognize the numbers at the start of the resource name (as the TODO says). You'll have to revert all the code changes the Terraform upgrade made except for the resource name change: + +**main.tf** + + +``` +provider "kubernetes" { +  config_context_cluster   = "${var.cluster}" +} + +resource "kubernetes_namespace" "upgrade-minikube-namespace" { +  metadata { +        name = "${var.namespace}" +  } +} + +provider "helm" { +  kubernetes { +        config_context_cluster   = "${var.cluster}" +  } +} +resource "helm_release" "local" { +  name          = "buildachart" +  chart         = "./buildachart" +} +``` + +**Vars.tf** + + +``` +variable "namespace" { +  type  = "string" +  default = "helloworld" +} + +variable "cluster" { +  type  = "string" +  default = "minikube" +} +``` + +Once the changes are back in place, switch tfenv back to version 0.11, and run the `state mv` command: + + +``` +$ tfenv use 0.11.15-oci +Switching default version to v0.11.15-oci +Switching completed +jess@Athena:~/terraform_doc$ terraform state mv 'kubernetes_namespace.1-minikube-namespace' 'kubernetes_namespace.upgrade-minikube-namespace' +Moved kubernetes_namespace.1-minikube-namespace to kubernetes_namespace.upgrade-minikube-namespace +``` + +### Final steps + +After this is complete, change tfenv back to version 0.12, and then remove your `versions.tf` file to make sure the conversion completes. If you don't remove this file, you'll get an error message: + + +``` +$ terraform 0.12upgrade +Error: Module already upgraded + +  on versions.tf line 3, in terraform: +   3:  required_version = ">= 0.12" + +The module in directory . has a version constraint that suggests it has +already been upgraded for v0.12. If this is incorrect, either remove this +constraint or override this heuristic with the -force argument. Upgrading a +module that was already upgraded may change the meaning of that module. +``` + +Remove the file and run the command: + + +``` +$ terraform 0.12upgrade + +This command will rewrite the configuration files in the given directory so +that they use the new syntax features from Terraform v0.12, and will identify +any constructs that may need to be adjusted for correct operation with +Terraform v0.12. [...] + +Would you like to upgrade the module in the current directory? +  Enter a value: yes + +\----------------------------------------------------------------------------- + +Upgrade complete! +``` + +#### Test the conversion with another deployment + +Test your new conversion by re-running your `init`, `plan`, and `apply` commands (I omitted chunks of the output in these snippets): + + +``` +$ terraform init + +Initializing the backend... +Initializing provider plugins... +[...] +Terraform has been successfully initialized! + +$ terraform plan +Refreshing Terraform state in-memory prior to plan... +The refreshed state will be used to calculate this plan, but will not be +persisted to local or remote state storage. + +helm_release.local: Refreshing state... [id=buildachart] +kubernetes_namespace.upgrade-minikube-namespace: Refreshing state... [id=helloworld] + +\------------------------------------------------------------------------ + +No changes. Infrastructure is up-to-date + +$ terraform apply +helm_release.local: Refreshing state... [id=buildachart] +kubernetes_namespace.upgrade-minikube-namespace: Refreshing state... [id=helloworld] + +Apply complete! Resources: 0 added, 0 changed, 0 destroyed. +``` + +As this shows, once everything was preconfigured and the state moved and reapplied during the conversion, no other changes were made because the infrastructure is in place. + +### Final thoughts + +Code and application upgrades are hard to do, especially in a live production environment. This is very true when converting from Terraform 0.11 to 0.12. I've done this on a large scale, and it involved extensive planning over a two-week timeframe. + +If you're going to do this in your production environment, make sure you: + + * Start by removing any resources or modules with prepended numbers. + * Move the state before running the upgrade. + * Keep your upgraded Terraform files in a forked repo for safety. + + + +I hope this article helps you move forward more quickly and easily than I did. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/update-terraform + +作者:[Jessica Cherry][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://opensource.com/users/cherrybomb +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_lead-steps-measure.png?itok=DG7rFZPk (Green graph of measurements) +[2]: https://opensource.com/article/20/7/terraform-kubernetes +[3]: https://github.com/tfutils/tfenv +[4]: https://opensource.com/article/20/3/helm-kubernetes-charts +[5]: https://opensource.com/article/20/11/tfenv +[6]: http://www.terraform.io/downloads.html From f2d1d0491ee56186d5d3ef731e9865643d2eacc0 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 18 Nov 2020 05:04:25 +0800 Subject: [PATCH 0812/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201116?= =?UTF-8?q?=20Day=205:=20drawing=20lots=20of=20faces=20with=20sketch-rnn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201116 Day 5- drawing lots of faces with sketch-rnn.md --- ...- drawing lots of faces with sketch-rnn.md | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 sources/tech/20201116 Day 5- drawing lots of faces with sketch-rnn.md diff --git a/sources/tech/20201116 Day 5- drawing lots of faces with sketch-rnn.md b/sources/tech/20201116 Day 5- drawing lots of faces with sketch-rnn.md new file mode 100644 index 0000000000..0b1e0a4d5f --- /dev/null +++ b/sources/tech/20201116 Day 5- drawing lots of faces with sketch-rnn.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Day 5: drawing lots of faces with sketch-rnn) +[#]: via: (https://jvns.ca/blog/2020/11/16/day-5--lots-of-faces-with-sketch-rnn/) +[#]: author: (Julia Evans https://jvns.ca/) + +Day 5: drawing lots of faces with sketch-rnn +====== + +Hello! This week it’s generative art week at RC, and I thought it would be fun to generate drawings of faces. + +Someone suggested the [Google Quickdraw][1] dataset, which has a lot of pictures of faces. And even though I think most of the faces in there are not really that interesting, I really quite like some of them, like these two: + +![][2] ![][3] + +So that seems like somewhere to start! + +### step 1: get the sketch-rnn model + +sketch-rnn is an RNN trained on the quickdraw dataset that generates line drawings. You can see it in action in Monica Dinculescu’s very fun [magic sketchpad][4] demo here – you start making a drawing, and it’ll complete you drawing as a cat / bridge / whatever you want. + +I figured that would be a fun place to start, and [ml5js][5] has a [tutorial showing how to write Javascript code to draw things with sketch-rnn][6], which I followed. + +### step 2: make the tutorial code use async/await + +The ml5js example had a bunch of global variables and callbacks and I found it difficult to work with, so I spent a while refactoring it to use async/await so that I could play around with it more easily. This took a while but I got it to work. + +### step 3: make sketch-rnn draw lots of faces and put them into a gallery + +I started out with making a more interactive website, but decided to instead do something really simple to start: just get the model to draw a lot of faces and see how I felt about them. + +Here’s the resulting (very janky, not responsive) website I made, which draws faces and then puts them into a little “gallery” on the right: [lots of sketch-rnn faces][7]. You can see it “live” drawing the faces which is fun. + +The set of images that comes out looks something like this: + +![][8] + +I don’t really like _any_ of these faces, but it’s a start! It’s also very slow on my 2015 laptop, but faster on the iPad. I didn’t spend a lot of time profiling it, but it seems to spend a lot of time in some function with `lstm` in its name – I don’t know what an LSTM is exactly but I know it’s a component of an RNN, so I guess (as you’d expect) it just has a lot of math to do in Javascript to calculate the next line to draw and that’s slow. + +### next step: maybe find out if sketch-rnn can tell the difference between “interesting” and “boring” faces + +I think that this face: + +![][2] + +is a lot more interesting than this face: + +![][9] + +Can I convince the neural network to distinguish between faces that I think are ‘interesting’ and ‘boring’ and maybe only generate more “interesting” faces? We’ll see! Right now I am stuck on trying to get a pre-trained model loaded into Python, so there’s a long way to go. + +I did find someone who’d done something kind of similar, on [bad flamingos vs good flamingos][10] in the quickdraw dataset. + +I still don’t really know anything about RNNs, but maybe if I can answer this question I will learn something about them. + +### also there’s a refrigerator poetry forum + +Here’s that refrigerator poetry forum I was talking about last week: . You can write magnet poetry-style poems on a refrigerator. People wrote some charming poems and I’m happy with it. I think I might use Rails for another project in the future. + +Hopefully people won’t abuse it, if there’s abuse I’ll just take it off the internet probably. + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/11/16/day-5--lots-of-faces-with-sketch-rnn/ + +作者:[Julia Evans][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://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://quickdraw.withgoogle.com/data/face +[2]: https://jvns.ca/images/face1.jpg +[3]: https://jvns.ca/images/face2.jpg +[4]: https://magic-sketchpad.glitch.me/ +[5]: https://learn.ml5js.org +[6]: https://github.com/ml5js/ml5-library/tree/main/examples/javascript/SketchRNN/SketchRNN_interactive +[7]: https://lots-of-sketchrnn-faces.netlify.app/ +[8]: https://jvns.ca/images/faces.png +[9]: https://jvns.ca/images/boring-face.png +[10]: https://colinmorris.github.io/blog/bad_flamingos From 0f25f0041931c32fa9f983e54f64b8ff8e93c626 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 18 Nov 2020 08:52:15 +0800 Subject: [PATCH 0813/1156] translating --- ...e Chrome on Fedora -Beginner-s Tutorial.md | 126 ----------------- ...e Chrome on Fedora -Beginner-s Tutorial.md | 127 ++++++++++++++++++ 2 files changed, 127 insertions(+), 126 deletions(-) delete mode 100644 sources/tech/20201112 How to Install Google Chrome on Fedora -Beginner-s Tutorial.md create mode 100644 translated/tech/20201112 How to Install Google Chrome on Fedora -Beginner-s Tutorial.md diff --git a/sources/tech/20201112 How to Install Google Chrome on Fedora -Beginner-s Tutorial.md b/sources/tech/20201112 How to Install Google Chrome on Fedora -Beginner-s Tutorial.md deleted file mode 100644 index 0d2b487ebd..0000000000 --- a/sources/tech/20201112 How to Install Google Chrome on Fedora -Beginner-s Tutorial.md +++ /dev/null @@ -1,126 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Install Google Chrome on Fedora [Beginner’s Tutorial]) -[#]: via: (https://itsfoss.com/install-google-chrome-fedora/) -[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) - -How to Install Google Chrome on Fedora [Beginner’s Tutorial] -====== - -Fedora comes with Firefox as the default web browser. Despite it being an excellent web browser, you may prefer the popular Google Chrome browser. - -If you are wondering how to install Google Chrome on Fedora, let me show you two ways of installing Google Chrome, graphical method and command line method. - - * [GUI method 1: Install Chrome from the software center by enabling Fedora third-party repository][1] - * [GUI method 2: Download RPM file from Google Chrome’s website][2] - * [CLI method: Install Chrome from the Fedora third-party repository, everything using commands (same as GUI method 1)][3] - - - -It is up to you which method you prefer. Your Google Chrome on [Fedora][4] will be getting regular updates via the system updates in all the three methods. - -### Method 1: Install Google Chrome on Fedora from the Software Center - -Fedora provides a third-party repository that contains some popular proprietary software, graphics driver. Google Chrome is one of them. - -First step, make sure to enable third-party repositories in Fedora. You should see this option in the software center itself. - -![Step1: Fedora Third Party Repositories][5] - -Once you have it enabled, simply search for Chrome in the software center: - -![Step 2: Search for Chrome In Fedora Software Center][6] - -And install it from there: - -![Step 3: Install Chrome Fedora][7] - -Can it be any easier than this? I don’t think either :) - -### Method 2: Installing Google Chrome on Fedora from Chrome website - -If you do not want to enable the third-party repository, that’s okay. You don’t have to. You can download the RPM file from Chrome’s website, double-click on it and install it. - -Visit Google Chrome’s website and click on the download button. - -[Get Google Chrome][8] - -![][9] - -Then select the .rpm package and click on “Accept and Install”. - -![][10] - -Once the download is over, double click on the file and click install when prompted at the package manager. Type your password and wait until the process is done. - -![][11] - -That’s super easy, right? Let’s see somewhat complicated method (if you are not a terminal fan). - -### Method 3: Install Chrome on Fedora using command line - -Firstly, you need to add extra Fedora repositories (that you saw in method 1): - -``` -sudo dnf install fedora-workstation-repositories -``` - -And then enable Google Chrome repository. - -``` -sudo dnf config-manager --set-enabled google-chrome -``` - -![][12] - -To install the Google Chrome stable release, run the following command at your terminal. - -``` -sudo dnf install google-chrome-stable -``` - -You should get a warning for importing the GPG key, enter y to continue. - -![][13] - -You are adding the Google Chrome repository. The package comes from this repository, directly from Google. - -#### Conclusion - -Installing Google chrome on Fedora is fairly easy, even if you use the command line. It’s pretty much the [same as installing Chrome on Ubuntu][14] except the third-party repository part. - -Now that you have installed it, you may want to [check our list of Google Chrome keyboard shortcuts][15] to use the browser faster. - -Don’t forget to subscribe, to get the latest news and tutorials about Fedora, and if you have any questions please leave a comment below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/install-google-chrome-fedora/ - -作者:[Dimitrios Savvopoulos][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/dimitrios/ -[b]: https://github.com/lujun9972 -[1]: tmp.VFVwBw56ac#gui-method-1 -[2]: tmp.VFVwBw56ac#gui-method-2 -[3]: tmp.VFVwBw56ac#cli-method -[4]: https://getfedora.org/ -[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/fedora-third-party-repositories.jpg?resize=800%2C400&ssl=1 -[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/chrome-in-fedora.png?resize=800%2C400&ssl=1 -[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/installing-chrome-fedora.png?resize=800%2C400&ssl=1 -[8]: https://www.google.com/chrome/ -[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/install-google-chrome-ubuntu-1.jpeg?resize=800%2C374&ssl=1 -[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/3.-download-rpm-chrome.png?resize=800%2C600&ssl=1 -[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/4.-install-chrome-fedora.png?resize=800%2C550&ssl=1 -[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/1.-Fedora-extra-repos.png?resize=800%2C550&ssl=1 -[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/2.-Fedora-GPG-key.png?resize=800%2C550&ssl=1 -[14]: https://itsfoss.com/install-chrome-ubuntu/ -[15]: https://itsfoss.com/google-chrome-shortcuts/ diff --git a/translated/tech/20201112 How to Install Google Chrome on Fedora -Beginner-s Tutorial.md b/translated/tech/20201112 How to Install Google Chrome on Fedora -Beginner-s Tutorial.md new file mode 100644 index 0000000000..cf3c0361d3 --- /dev/null +++ b/translated/tech/20201112 How to Install Google Chrome on Fedora -Beginner-s Tutorial.md @@ -0,0 +1,127 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Install Google Chrome on Fedora [Beginner’s Tutorial]) +[#]: via: (https://itsfoss.com/install-google-chrome-fedora/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +如何在 Fedora 上安装 Google Chrome 浏览器(入门教程) +====== + +Fedora 的默认网页浏览器是 Firefox。尽管它是一个优秀的网络浏览器,你可能更喜欢流行的 Google Chrome 浏览器。 + +如果你想知道如何在 Fedora 上安装 Google Chrome 浏览器,让我告诉你两种安装 Google Chrome 浏览器的方法:图形化法和命令行法。 + +* [图形化方法 1:通过启用 Fedora 第三方仓库从软件中心安装 Chrom e浏览器][1] 。 +* [图形化方法 2:从谷歌浏览器网站下载 RPM 文件][2] +* [命令行方法:从 Fedora 第三方仓库安装 Chrome,一切使用命令(与 GUI 方法 1 相同)][3]。 + + + +这全取决于你喜欢哪种方法。你在 [Fedora][4] 上的 Google Chrome 浏览器都将通过这三种方法的系统更新获取定期更新。 + +### 方法 1:在 Fedora 中从软件中心安装 Google Chrome + +Fedora 提供了一个第三方仓库,其中包含了一些流行的专有软件、图形驱动程序。Google Chrome 就是其中之一。 + +第一步,确保在 Fedora 中启用第三方仓库。你应该在软件中心中看到这个选项。 + +![Step1: Fedora Third Party Repositories][5] + +启用后,只需在软件中心搜索 Chrome: + +![Step 2: Search for Chrome In Fedora Software Center][6] + +并从那里安装它: + +![Step 3: Install Chrome Fedora][7] + +Can it be any easier than this? I don’t think either :) +还有比这更简单的吗?我不这么认为 :) + +### 方法 2:在 Fedora 上从 Chrome 网站安装 Google Chrome + +如果你不想启用第三方仓库,也没关系。你不必这样做。你可以从 Chrome 的网站上下载 RPM 文件,双击并安装它。 + +访问 Google Chrome 的网站,点击下载按钮。 + +[Get Google Chrome][8] + +![][9] + +然后选择 .rpm 包,点击“接受并安装”。 + +![][10] + +下载结束后,双击文件,在包管理器提示时点击安装。输入密码,等待安装完成。 + +![][11] + +这是超级简单的,对吧?让我们来看看有点复杂的方法(如果你不是一个终端爱好者)。 + +### 方法 3:使用命令行在 Fedora 上安装 Chrome + +首先,你需要添加额外的 Fedora 仓库(你在方法 1 中看到的): + +``` +sudo dnf install fedora-workstation-repositories +``` + +然后启用 Google Chrome 仓库。 + +``` +sudo dnf config-manager --set-enabled google-chrome +``` + +![][12] + +要安装 Google Chrome 稳定版,请在终端运行以下命令。 + +``` +sudo dnf install google-chrome-stable +``` + +你会看到一个导入 GPG 密钥的警告,输入 y 继续。 + +![][13] + +你正在添加 Google Chrome 仓库。这个软件包来自这个仓库,它直接来自 Google。 + +#### 总结 + +即使你使用命令行,在 Fedora 上安装 Google chrome 也相当简单。除了第三方仓库的部分,这和[在 Ubuntu 上安装 Chrome][14] 差不多。 + +现在你已经安装好了,你可能会想[查看我们的 Google Chrome 键盘快捷键列表][15]来更快地使用浏览器。 + +不要忘记订阅,获取关于 Fedora 的最新消息和教程,如果你有任何问题,请在下方留言。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-google-chrome-fedora/ + +作者:[Dimitrios Savvopoulos][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: tmp.VFVwBw56ac#gui-method-1 +[2]: tmp.VFVwBw56ac#gui-method-2 +[3]: tmp.VFVwBw56ac#cli-method +[4]: https://getfedora.org/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/fedora-third-party-repositories.jpg?resize=800%2C400&ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/chrome-in-fedora.png?resize=800%2C400&ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/installing-chrome-fedora.png?resize=800%2C400&ssl=1 +[8]: https://www.google.com/chrome/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/install-google-chrome-ubuntu-1.jpeg?resize=800%2C374&ssl=1 +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/3.-download-rpm-chrome.png?resize=800%2C600&ssl=1 +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/4.-install-chrome-fedora.png?resize=800%2C550&ssl=1 +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/1.-Fedora-extra-repos.png?resize=800%2C550&ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/2.-Fedora-GPG-key.png?resize=800%2C550&ssl=1 +[14]: https://itsfoss.com/install-chrome-ubuntu/ +[15]: https://itsfoss.com/google-chrome-shortcuts/ \ No newline at end of file From 83a83be5f296d321fa3059593649db2def70e3ac Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 18 Nov 2020 09:01:38 +0800 Subject: [PATCH 0814/1156] translating --- .../20201116 Unlock encrypted disks on Linux automatically.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201116 Unlock encrypted disks on Linux automatically.md b/sources/tech/20201116 Unlock encrypted disks on Linux automatically.md index 14eb34ad20..d8460ba951 100644 --- a/sources/tech/20201116 Unlock encrypted disks on Linux automatically.md +++ b/sources/tech/20201116 Unlock encrypted disks on Linux automatically.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 1eb0a38af798442b4fb7ce8b92aa963725b00d2a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 18 Nov 2020 10:06:01 +0800 Subject: [PATCH 0815/1156] Rename sources/tech/20201114 How I channel my inner Star Trek character at work.md to sources/talk/20201114 How I channel my inner Star Trek character at work.md --- ...20201114 How I channel my inner Star Trek character at work.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20201114 How I channel my inner Star Trek character at work.md (100%) diff --git a/sources/tech/20201114 How I channel my inner Star Trek character at work.md b/sources/talk/20201114 How I channel my inner Star Trek character at work.md similarity index 100% rename from sources/tech/20201114 How I channel my inner Star Trek character at work.md rename to sources/talk/20201114 How I channel my inner Star Trek character at work.md From 12e11bae964730cfc6f1036c98a0e389c736fb56 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 18 Nov 2020 10:06:54 +0800 Subject: [PATCH 0816/1156] Rename sources/tech/20201113 3 ways managers build team culture around open source.md to sources/talk/20201113 3 ways managers build team culture around open source.md --- ...01113 3 ways managers build team culture around open source.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20201113 3 ways managers build team culture around open source.md (100%) diff --git a/sources/tech/20201113 3 ways managers build team culture around open source.md b/sources/talk/20201113 3 ways managers build team culture around open source.md similarity index 100% rename from sources/tech/20201113 3 ways managers build team culture around open source.md rename to sources/talk/20201113 3 ways managers build team culture around open source.md From 0b339984ed8c9a9525bd6ddfdf1fd4be973b8658 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 18 Nov 2020 10:09:14 +0800 Subject: [PATCH 0817/1156] Rename sources/tech/20201113 How to create trust in artificial intelligence using open source.md to sources/talk/20201113 How to create trust in artificial intelligence using open source.md --- ...o create trust in artificial intelligence using open source.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20201113 How to create trust in artificial intelligence using open source.md (100%) diff --git a/sources/tech/20201113 How to create trust in artificial intelligence using open source.md b/sources/talk/20201113 How to create trust in artificial intelligence using open source.md similarity index 100% rename from sources/tech/20201113 How to create trust in artificial intelligence using open source.md rename to sources/talk/20201113 How to create trust in artificial intelligence using open source.md From ca80c4d29538b137ec600f3785ec307ee365b0b0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 18 Nov 2020 11:39:04 +0800 Subject: [PATCH 0818/1156] Rename sources/tech/20201113 The state of the art of microservices in 2020.md to sources/talk/20201113 The state of the art of microservices in 2020.md --- .../20201113 The state of the art of microservices in 2020.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20201113 The state of the art of microservices in 2020.md (100%) diff --git a/sources/tech/20201113 The state of the art of microservices in 2020.md b/sources/talk/20201113 The state of the art of microservices in 2020.md similarity index 100% rename from sources/tech/20201113 The state of the art of microservices in 2020.md rename to sources/talk/20201113 The state of the art of microservices in 2020.md From e92a69376da31c4ecf4e7f2569c184fd6a477766 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 18 Nov 2020 19:40:21 +0800 Subject: [PATCH 0819/1156] APL --- sources/tech/20201111 Using Fedora 33 with Microsoft-s WSL2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201111 Using Fedora 33 with Microsoft-s WSL2.md b/sources/tech/20201111 Using Fedora 33 with Microsoft-s WSL2.md index ba5f635617..f2d0bf45e9 100644 --- a/sources/tech/20201111 Using Fedora 33 with Microsoft-s WSL2.md +++ b/sources/tech/20201111 Using Fedora 33 with Microsoft-s WSL2.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From e9371d88cd45b487510878e846685edcd1987a35 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 18 Nov 2020 20:27:45 +0800 Subject: [PATCH 0820/1156] TSL&PRF --- ...1 Using Fedora 33 with Microsoft-s WSL2.md | 146 ------------------ ...1 Using Fedora 33 with Microsoft-s WSL2.md | 112 ++++++++++++++ 2 files changed, 112 insertions(+), 146 deletions(-) delete mode 100644 sources/tech/20201111 Using Fedora 33 with Microsoft-s WSL2.md create mode 100644 translated/tech/20201111 Using Fedora 33 with Microsoft-s WSL2.md diff --git a/sources/tech/20201111 Using Fedora 33 with Microsoft-s WSL2.md b/sources/tech/20201111 Using Fedora 33 with Microsoft-s WSL2.md deleted file mode 100644 index f2d0bf45e9..0000000000 --- a/sources/tech/20201111 Using Fedora 33 with Microsoft-s WSL2.md +++ /dev/null @@ -1,146 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Using Fedora 33 with Microsoft’s WSL2) -[#]: via: (https://fedoramagazine.org/wsl-fedora-33/) -[#]: author: (Jim Perrin https://fedoramagazine.org/author/jperrin/) - -Using Fedora 33 with Microsoft’s WSL2 -====== - -![][1] - -Photo by [Matthias Heil][2] on [Unsplash][3] - -If you’re 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 don’t 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 you’ll 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 you’re finished. Microsoft recommends setting wsl2 as the distro default for simplicity. This guide assumes you’ve done that. - -Next, you’re 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 doesn’t ship an actual rootfs archive, we’re 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 don’t unpack it. You want to end up with something like fedora-33-_datestamp_.tar. Once you have that, you’re 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 it’s 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 wsl’s 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 Fedora’s wsl instance as the root user. From here, you’re going to install a few core packages and set a new default user. You’re also going to need to configure sudo, otherwise you won’t 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 they’re useful to have around. Since you need to use a Copr repo for this, you want the added dnf functionality. - -### Add your user - -Now it’s time to add your user, and set it as the default. -``` - -``` - -useradd -G wheel yourusername -passwd yourusername -``` - -``` - -Now that you’ve created your username and added a password, make sure they work. Exit the wsl instance, and launch it again, this time specifying the username. You’re 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, you’re 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, you’re done getting the basic Fedora 33 setup running in wsl, but it doesn’t have the Windows integration piece yet. If this is something you want, there’s a Copr repo to enable. If you choose to add this piece, you’ll 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 diff --git a/translated/tech/20201111 Using Fedora 33 with Microsoft-s WSL2.md b/translated/tech/20201111 Using Fedora 33 with Microsoft-s WSL2.md new file mode 100644 index 0000000000..b94d6b5cdc --- /dev/null +++ b/translated/tech/20201111 Using Fedora 33 with Microsoft-s WSL2.md @@ -0,0 +1,112 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using Fedora 33 with Microsoft’s 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 From 54c19dda69ac7ecf1122a576a6299a3616883b60 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 18 Nov 2020 20:36:38 +0800 Subject: [PATCH 0821/1156] APL --- ...ternet in Linux Terminal With These Command Line Browsers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201027 You can Surf Internet in Linux Terminal With These Command Line Browsers.md b/sources/tech/20201027 You can Surf Internet in Linux Terminal With These Command Line Browsers.md index 7c00882a6b..9f841a910c 100644 --- a/sources/tech/20201027 You can Surf Internet in Linux Terminal With These Command Line Browsers.md +++ b/sources/tech/20201027 You can Surf Internet in Linux Terminal With These Command Line Browsers.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 222cdd80798407fc1665b544cbaea1e977ae382b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 18 Nov 2020 21:20:51 +0800 Subject: [PATCH 0822/1156] TSL --- ...rminal With These Command Line Browsers.md | 170 ------------------ ...rminal With These Command Line Browsers.md | 170 ++++++++++++++++++ 2 files changed, 170 insertions(+), 170 deletions(-) delete mode 100644 sources/tech/20201027 You can Surf Internet in Linux Terminal With These Command Line Browsers.md create mode 100644 translated/tech/20201027 You can Surf Internet in Linux Terminal With These Command Line Browsers.md diff --git a/sources/tech/20201027 You can Surf Internet in Linux Terminal With These Command Line Browsers.md b/sources/tech/20201027 You can Surf Internet in Linux Terminal With These Command Line Browsers.md deleted file mode 100644 index 9f841a910c..0000000000 --- a/sources/tech/20201027 You can Surf Internet in Linux Terminal With These Command Line Browsers.md +++ /dev/null @@ -1,170 +0,0 @@ -[#]: 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/) - -You can Surf Internet in Linux Terminal With These Command Line Browsers -====== - -I’m 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 didn’t 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 you’re 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 it’s 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 I’d 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, that’s a good thing. - -On the other hand, the window does not re-size well while using it from the terminal. I haven’t looked for any solutions to that, so if you’re 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 you’re 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 you’d 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 - -It’s no surprise that there aren’t 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/ diff --git a/translated/tech/20201027 You can Surf Internet in Linux Terminal With These Command Line Browsers.md b/translated/tech/20201027 You can Surf Internet in Linux Terminal With These Command Line Browsers.md new file mode 100644 index 0000000000..53d2eb571a --- /dev/null +++ b/translated/tech/20201027 You can Surf Internet in Linux Terminal With These Command Line Browsers.md @@ -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/ From dda5d01ddf60f3a68920672b97cbd854f639fa86 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 18 Nov 2020 22:59:25 +0800 Subject: [PATCH 0823/1156] PRF @geekpi --- ...t I love about the newest GNOME desktop.md | 34 +++++++------------ 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/translated/tech/20201110 What I love about the newest GNOME desktop.md b/translated/tech/20201110 What I love about the newest GNOME desktop.md index 2422efa87d..9169285098 100644 --- a/translated/tech/20201110 What I love about the newest GNOME desktop.md +++ b/translated/tech/20201110 What I love about the newest GNOME desktop.md @@ -1,46 +1,40 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (What I love about the newest GNOME desktop) [#]: via: (https://opensource.com/article/20/11/new-gnome) [#]: author: (Jim Hall https://opensource.com/users/jim-hall) -我对最新的 GNOME 桌面的喜爱之处 +我喜欢最新的 GNOME 桌面 ====== -看看 GNOME 3.38 桌面的最新功能。 -![Digital images of a computer desktop][1] + +> 看看 GNOME 3.38 桌面最重要的新功能。 + +![](https://img.linux.net.cn/data/attachment/album/202011/18/225213tmv6aeev1x0t1p4k.jpg) Fedora 33 [刚出来][2],我就马上安装了它。在这个新版 Linux 发行版的众多功能中,其中之一是最新的 GNOME 桌面。GNOME 3.38 于 2020 年 9 月发布,我很喜欢它。 ### 我为什么喜欢 GNOME 3.38? -GNOME 3.38 [发布说明][3]中列出了这次更新中的一些重大的新功能。其中,如果你是新用户的话,新用户的欢迎页面得到了重大的改版,现在更加容易使用,并且提供了更多有用的信息。 +GNOME 3.38 [发布说明][3]中列出了这次更新中的一些重大的新功能。其中,新用户的欢迎页面有了重大改版,现在更加容易使用,如果你是新用户的话,它提供了更多有用的信息。 ![The new "Welcome GNOME"][4] -([GNOME][5], [CC BY-SA 4.0][6]) - -我还喜欢在 GNOME 应用概览中拖动来重新排列应用图标的功能。这让我在 GNOME 下组织我一直使用的应用变得轻而易举。你甚至可以将图标拖放在一起,并自动将它们放入文件夹。 +我还喜欢在 GNOME 应用概览中拖动来重新排列应用图标的功能。这让我在 GNOME 下组织我一直使用的应用变得轻而易举。你甚至可以将图标拖放到一起,并自动将它们放入一个文件夹。 ![GNOME 3.38 Application Overview][7] -([GNOME][5], [CC BY-SA 4.0][6]) - -我的家人在不同的时区,更新后的 GNOME 时钟使得添加新的世界时钟变得更加容易,所以当我给家人打电话时,我不必弄清楚现在是什么时间。他们是提前一个小时还是晚了一个小时?我只需查看 GNOME 时钟,就能一目了然地看到每个人的当地时间。另外,虽然我并不经常使用闹钟功能,但我喜欢我可以自己设置铃声持续时间和每个闹钟的默认”打盹“时间。 +我的家人在不同的时区,更新后的 GNOME 时钟使得添加新的世界时钟变得更加容易,所以当我给家人打电话时,我不必弄清楚现在是什么时间,他们是早一个小时还是晚一个小时?我只需查看 GNOME 时钟,就能一目了然地看到每个人的当地时间。另外,虽然我并不经常使用闹钟功能,但我喜欢我可以自己设置铃声持续时间和每个闹钟的默认“打盹”时间。 ![Adding a new world clock in GNOME Clocks][8] -([GNOME][5], [CC BY-SA 4.0][6]) - -除了所有的功能更新之外,GNOME 3.38 中最大的改进是性能。正如 GNOME 开发者 Emmanuele Bassi [今年早些时候的解释][9]:“GNOME 中的每个人都为使速度更快而做了很多工作,即使是在树莓派等更有限的系统上运行的人。为了让 GNOME 表现得更好,大家做了很多工作。因为人们真的很关心它”。而这一点在新版本中体现得淋漓尽致!GNOME 桌面感觉反应更灵敏。 +除了所有这些功能更新之外,GNOME 3.38 中最大的改进是性能。正如 GNOME 开发者 Emmanuele Bassi [今年早些时候的解释][9]:“GNOME 中的每个人都为使速度更快而做了很多工作,即使是在树莓派等这样受限的系统上运行的人也是如此。为了让 GNOME 表现得更好,大家做了很多工作。因为人们真的很关心它”。而这一点在新版本中体现得淋漓尽致!GNOME 桌面感觉反应更灵敏。 ![Applications running on GNOME 3.38][10] -([GNOME][5], [CC BY-SA 4.0][6]) - -作为我的咨询和培训业务的一部分,我经常在几个开放的应用之间切换,包括 LibreOffice、GIMP、Inkscape、一个网络浏览器等。在 GNOME 3.38 中,启动一个新的应用或在开放应用之间切换感觉更快。 +作为我的咨询和培训业务的一部分,我经常在几个打开的应用之间切换,包括 LibreOffice、GIMP、Inkscape、Web 浏览器等。在 GNOME 3.38 中,启动一个新的应用或在打开的应用之间切换感觉更快。 ### 除了一件事 @@ -48,14 +42,10 @@ GNOME 3.38 [发布说明][3]中列出了这次更新中的一些重大的新功 ![GNOME Screenshot tool][11] -(Jim Hall, [CC BY-SA 4.0][6]) - 当我浏览用户界面或电脑屏幕时,我自然会像阅读书籍或杂志那样浏览:从左到右,从上到下。当我使用新的屏幕截图工具进行屏幕截图时,我从左上角开始,然后进行选择。大多数时候,我只需要改变选区的捕捉区域,所以我点击那个按钮,然后寻找截图的按钮。但我总是要花点时间才能找到左上角的**截图**按钮。它并不在窗口的底部,也不是我希望找到它的地方。 ![GNOME Screenshot tool][12] -(Jim Hall, [CC BY-SA 4.0][6]) - 到目前为止,这似乎是我在 GNOME 3.38 中唯一的烦恼。总的来说,我对新的 GNOME 感到非常兴奋。我希望你也是! 要了解更多关于 GNOME 3.38 的信息,请访问 [GNOME 网站][13]或阅读 [GNOME 3.38 公告][5]。 @@ -67,7 +57,7 @@ via: https://opensource.com/article/20/11/new-gnome 作者:[Jim Hall][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From da1eab251784057110eff4180d4d0bd602dbc2e9 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 18 Nov 2020 23:00:10 +0800 Subject: [PATCH 0824/1156] PUB @geekpi https://linux.cn/article-12839-1.html --- .../20201110 What I love about the newest GNOME desktop.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201110 What I love about the newest GNOME desktop.md (98%) diff --git a/translated/tech/20201110 What I love about the newest GNOME desktop.md b/published/20201110 What I love about the newest GNOME desktop.md similarity index 98% rename from translated/tech/20201110 What I love about the newest GNOME desktop.md rename to published/20201110 What I love about the newest GNOME desktop.md index 9169285098..0246663267 100644 --- a/translated/tech/20201110 What I love about the newest GNOME desktop.md +++ b/published/20201110 What I love about the newest GNOME desktop.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12839-1.html) [#]: subject: (What I love about the newest GNOME desktop) [#]: via: (https://opensource.com/article/20/11/new-gnome) [#]: author: (Jim Hall https://opensource.com/users/jim-hall) From 1a57b376cde7b779708a7e00f8094a5414e077e6 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 19 Nov 2020 03:50:18 +0800 Subject: [PATCH 0825/1156] =?UTF-8?q?Revert=20"Revert=20"=E8=B6=85?= =?UTF-8?q?=E6=9C=9F=E5=9B=9E=E6=94=B6:=20sources/talk/20191009=20Why=20to?= =?UTF-8?q?=20choose=20Rust=20as=20your=20next=20programming=20language.md?= =?UTF-8?q?""?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 39c610369b794f68ed736c2276384c579ad324a2. --- ...1009 Why to choose Rust as your next programming language.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20191009 Why to choose Rust as your next programming language.md b/sources/talk/20191009 Why to choose Rust as your next programming language.md index 871b31abc6..d8cad5c342 100644 --- a/sources/talk/20191009 Why to choose Rust as your next programming language.md +++ b/sources/talk/20191009 Why to choose Rust as your next programming language.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (MATRIXKOO) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From de4c0371aacdf0e1a888160139818387f21b7083 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 19 Nov 2020 05:02:40 +0800 Subject: [PATCH 0826/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201118?= =?UTF-8?q?=20Cloud=20control=20vs=20local=20control:=20What=20to=20choose?= =?UTF-8?q?=20for=20your=20home=20automation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201118 Cloud control vs local control- What to choose for your home automation.md --- ...What to choose for your home automation.md | 134 ++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 sources/tech/20201118 Cloud control vs local control- What to choose for your home automation.md diff --git a/sources/tech/20201118 Cloud control vs local control- What to choose for your home automation.md b/sources/tech/20201118 Cloud control vs local control- What to choose for your home automation.md new file mode 100644 index 0000000000..b1d86bd080 --- /dev/null +++ b/sources/tech/20201118 Cloud control vs local control- What to choose for your home automation.md @@ -0,0 +1,134 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Cloud control vs local control: What to choose for your home automation) +[#]: via: (https://opensource.com/article/20/11/cloud-vs-local-home-automation) +[#]: author: (Steve Ovens https://opensource.com/users/stratusss) + +Cloud control vs local control: What to choose for your home automation +====== +Cloud may be more convenient, but local control gives you more privacy +and other options in your Home Assistant ecosystem. +![clouds in windows][1] + +There are a lot of factors to consider when investing in a home automation ecosystem. In my first article in this series, I explained [why I picked Home Assistant][2], and in this article, I'll explain some of the foundational issues and technologies in home automation, which may influence how you approach and configure your Internet of Things (IoT) devices. + +### Cloud connectivity + +Most devices you can buy today are tied to some type of cloud service. While the cloud brings a certain level of convenience, it also opens a host of problems. For starters, there are privacy issues related to a company having access to your personal habits—when you are home, what shows you watch, what time you go to bed, etc. Although most people are not as concerned about these issues as I am, privacy should still be a consideration, even if it is a small one. + +Cloud access also creates issues around being reliant on something outside your control. In 2019, Sonos came under fire for [remotely bricking][3] older smart speakers. Speakers usually continue to work for years after their warranty ends; in fact, they usually function until they physically break. There's also the case of Automatic, which produced a cloud-based car tracker. When it announced in May 2020 that it would be [shutting down][4] its services, it advised customers to "please discard your adapter by following standard electronic recycling procedures." + +Being dependent on a third-party provider for critical functionality can come back to bite you. [IFTTT][5], a popular service for programming events based on external conditions, recently altered its free plan's [terms and conditions][6] to severely limit the number of events you can create—from an unlimited number to three. This is even though IFTTT charges device manufacturers for certification with its system, which allows products like [Meross smart bulbs][7] to proudly display their compatibility with IFTTT. + +![Meross screenshot from Amazon][8] + +(Amazon screenshot by Steve Ovens, [CC BY-SA 4.0][9]) + +Some of these decisions are purely financial, but there are more than a few anecdotal cases where a company blocks a person's access to a device they purchased simply because they [did not like what the user said][10] about them. How crazy is that? + +Another consideration with cloud connectivity is a device's responsivity if its signals must travel from your home to a cloud server (which may be halfway around the world) and then back to the device. This can lead to a two-second (or more) delay on any action. For some people, this is not a deal-breaker. For others, that delay is unbearable. + +Finally, what happens if there is an internet outage? While most modern home internet connections are quite reliable, they do happen. [Some large][11], well-known cloud [service providers][12] have experienced outages this year. Are you OK trading convenience for possibly having your automations break and losing control of your smart devices for periods of time? + +### Local control + +There are several ways you can regain control over your smart devices. Commercially, you could try something like [Hubitat][13], which is a proprietary platform that emphasizes local control. I have no experience with these devices, as I don't like to rely on an intermediary. + +In my home, I standardized on WiFi (although I may branch out to [Zigbee][14] in the future) and [Home Assistant][15]. Using WiFi means I need to buy or make my devices based on their compatibility with alternative open source firmware, such as [Tasmota][16] or [ESPHome][17]. I admit that neither of these options is "plug-and-play friendly" unless you buy devices from sources like [Shelly][18], which is very friendly to the community, or [CloudFree][19], which has Tasmota installed by default. + +(As a small aside, I have both flashed my own devices and purchased them from CloudFree. There are some savings with the DIY approach, but I buy pre-flashed devices for my father's house because this eliminates a lot of hassle.) + +I won't go into more detail about alternative firmware, how to flash it, and so on. I simply want to introduce you to the idea that there are options for local control. + +### Achieving local control with MQTT + +A local control device probably uses either a direct [API][20] call, where Home Assistant talks directly to the device, or Message Queuing Telemetry Transport ([MQTT][21]). + +MQTT is one of the most widely used protocols for local IoT communication. I'll share some of the basics, but the Hook Up has an [in-depth video][22] you can watch if you want to learn more, and HiveMQ has an [entire series][23] on MQTT essentials. + +MQTT uses three components for communication. The first, the **sender**, is the component that triggers the action. The second, the **broker**, is kind of like a bulletin board where messages are posted. The final component is the **device** that will perform the action. This process is called the _publish-subscribe_ model. + +Say you have a button on the wall that you want to use to turn on the projector, lower the blinds, and turn on a fan. The button (sender) posts the _message_ **ON** to a specific section of the broker, called a _topic_. The topic might be something like `/livingroom/POWER`. The fan, the projector, and the blinds _subscribe_ to this topic. When the message **ON** is posted to the topic, all of the devices activate their respective functions, turning on the projector, lowering the blinds, and starting the fan. + +Unlike a message board, messages have different Quality of Service (QoS) states. The HiveMQ website has a good explanation of the [three QoS levels][24]. In short: + + * **QoS 0:** The message is sent to the broker in a fire-and-forget way. No attempt is made to verify that the broker received the message. + + + +![MQTTT QoS 0][25] + +(© 2015 [HiveMQ][24], reused with permission) + + * **QoS 1**: The message is posted, and the broker replies once the message is received. Multiple messages can be sent before the broker replies. For example, if you are trying to raise the projector's brightness, multiple brightness bars may be inadvertantly adjusted before the broker tells the sender to stop publishing messages. + + + +![MQTTT QoS 1][26] + +(© 2015 [HiveMQ][24], reused with permission) + + * **QoS 2:** This is the slowest but safest level. It guarantees that the message is received only once. Similar to TCP, if a message is lost, the sender will resend the message. + + + +![MQTTT QoS 2][27] + +(© 2015 [HiveMQ][24], reused with permission) + +In addition, MQTT has a **retain** flag that can be enabled on the messages, but it is not set by default. Going back to the bulletin board analogy, it's like if someone posts a message to a bulletin board, but another person walks up to the board, takes the message down, reads it, and throws it away. If a third person looks at the bulletin board five minutes later, they would have no knowledge of the message. However, if the **retain** flag is set to true, it's like leaving the message pinned on the board until a new message is received. This means that no matter when people come to read messages, they will all know the latest message. + +In home automation terms, whether or not the **retain** flag is set depends completely on the use case. + +In this series, I will use Home Assistant's [Mosquitto MQTT broker][28] add-on. Most of my devices use MQTT; however, I do have a couple of non-critical Tuya devices that require a cloud account. I may replace them with locally controllable ones in the future. + +### Wrapping up + +Home Assistant is a large, wonderful piece of software. It is complex in some areas, and it will help you to be familiar with these fundamental technologies when you need to troubleshoot and coordinate your setup. + +In the next article, I will talk about the "big three" wireless protocols that you are likely to encounter in smart devices: Zigbee, Z-Wave, and WiFi. Don't worry—I'm almost done with the underlying theories, and soon I'll get on with installing Home Assistant. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/cloud-vs-local-home-automation + +作者:[Steve Ovens][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://opensource.com/users/stratusss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cloud-windows-building-containers.png?itok=0XvZLZ8k (clouds in windows) +[2]: https://opensource.com/article/20/11/home-assistant +[3]: https://www.bbc.com/news/technology-51768574 +[4]: https://www.cnet.com/roadshow/news/automatic-connected-car-service-dead-may-coronavirus/ +[5]: https://ifttt.com/ +[6]: https://ifttt.com/plans +[7]: https://www.amazon.ca/meross-Dimmable-Equivalent-Compatible-Required/dp/B07WN2J3C7 +[8]: https://opensource.com/sites/default/files/uploads/ifttt_add.png (Meross screenshot from Amazon) +[9]: https://creativecommons.org/licenses/by-sa/4.0/ +[10]: https://www.techrepublic.com/article/iot-company-bricks-customers-device-after-negative-review/ +[11]: https://www.theverge.com/2020/9/28/21492688/microsoft-outlook-office-teams-azure-outage-down +[12]: https://www.cnn.com/2020/08/30/tech/internet-outage-cloudflare/index.html +[13]: https://hubitat.com/ +[14]: https://zigbeealliance.org/ +[15]: https://www.home-assistant.io/ +[16]: https://tasmota.github.io/docs/ +[17]: https://esphome.io/ +[18]: https://shelly.cloud/ +[19]: https://cloudfree.shop/ +[20]: https://en.wikipedia.org/wiki/API +[21]: https://en.wikipedia.org/wiki/MQTT +[22]: https://www.youtube.com/watch?v=NjKK5ab0-Kk +[23]: https://www.hivemq.com/tags/mqtt-essentials/ +[24]: https://www.hivemq.com/blog/mqtt-essentials-part-6-mqtt-quality-of-service-levels/ +[25]: https://opensource.com/sites/default/files/uploads/ha-config8-qos0.png (MQTTT QoS 0) +[26]: https://opensource.com/sites/default/files/uploads/ha-config8-qos1.png (MQTTT QoS 1) +[27]: https://opensource.com/sites/default/files/uploads/ha-config9-qos2.png (MQTTT QoS 2) +[28]: https://mosquitto.org/ From ec534cdec42ca28fa6a68659f7b839b8515f8806 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 19 Nov 2020 05:02:53 +0800 Subject: [PATCH 0827/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201118?= =?UTF-8?q?=20Secure=20your=20containers=20with=20SELinux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201118 Secure your containers with SELinux.md --- ...118 Secure your containers with SELinux.md | 275 ++++++++++++++++++ 1 file changed, 275 insertions(+) create mode 100644 sources/tech/20201118 Secure your containers with SELinux.md diff --git a/sources/tech/20201118 Secure your containers with SELinux.md b/sources/tech/20201118 Secure your containers with SELinux.md new file mode 100644 index 0000000000..1f63e033cc --- /dev/null +++ b/sources/tech/20201118 Secure your containers with SELinux.md @@ -0,0 +1,275 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Secure your containers with SELinux) +[#]: via: (https://opensource.com/article/20/11/selinux-containers) +[#]: author: (Mike Calizo https://opensource.com/users/mcalizo) + +Secure your containers with SELinux +====== +Hack your system to understand why it's important to configure SELinux +to be your first line of container defense. +![Three closed doors][1] + +When things aren't working correctly in your Linux environment, the easiest thing to do is disable Security-Enhanced Linux ([SELinux][2]). Things suddenly begin to work, and you forget about it—but this is a common pitfall that means you've lost a very powerful security tool. + +Threats are rising alongside the rise of containers, microservices, and distributed architecture. This is due to an old, well-known issue: velocity. The advantage of containers is that they enable you to move fast, do more, and change quickly. This means container adoption has gone off the roof, but the speed it affords also means you will encounter more issues and vulnerabilities. This happens naturally when you're doing more things faster and quicker. + +### How to mitigate threats + +As Sun Tzu said, "The wise warrior avoids the battle." This quote really resonates when it comes to containers' basic defense. To avoid problems (battles), make sure that your container host is secure and that you can use SELinux as your first line of defense. + +SELinux is an open source project released in 2000 and integrated into the Linux kernel in 2003. According to [Red Hat's explainer][3], "SELinux is a security architecture for [Linux systems][4] that allows administrators to have more control over who can access the system. It was originally developed by the United States National Security Agency (NSA) as a series of patches to the [Linux kernel][5] using Linux Security Modules (LSM)." + +### Get started + +When you think about containers, the first thing that probably comes into mind is [Docker][6]. Docker started a container adoption revolution after it emerged in 2013. It is one of the main reasons that containers exploded in popularity, but as mentioned above, the high level of adoption increased users' vulnerability to security risks. + +Before you can secure your Docker containers with SELinux, you need to set some things up. + +#### Prerequisites: + + * CentOS 8/RHEL 8 installed and configured + * Docker CE installed and configured + * Two accounts created: root and non-root (`mcalizo` in the examples below) + + + +If you need to set up Docker on your RHEL 8/CentOS 8 server, you can follow these [instructions][7]. If you're running RHEL 8, you need to remove the pre-installed Podman and runc packages before beginning. + +First, make sure SELinux is enabled: + + +``` +[mcalizo@Rhel82 ~]$ sestatus +SELinux status:                 enabled +SELinuxfs mount:                /sys/fs/selinux +SELinux root directory:         /etc/selinux +Loaded policy name:             targeted +Current mode:                   enforcing +Mode from config file:          enforcing +Policy MLS status:              enabled +Policy deny_unknown status:     allowed +Memory protection checking:     actual (secure) +Max kernel policy version:      31 +[mcalizo@Rhel82 ~]$ +``` + +Then, verify your OS version and that Docker is running. Log in as root and run: + + +``` +[root@rhel82 ~]# cat /etc/redhat-release +Red Hat Enterprise Linux release 8.2 (Ootpa) +[root@rhel82 ~]# + +[root@rhel82 ~]# systemctl status docker +● docker.service - Docker Application Container Engine +   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled) +   Active: active (running) since Wed 2020-10-28 19:10:14 EDT; 15s ago +     Docs: + Main PID: 30768 (dockerd) +    Tasks: 8 +   Memory: 39.0M +   CGroup: /system.slice/docker.service +           └─30768 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock + +Oct 28 19:10:13 rhel82.home.labs.com dockerd[30768]: time="2020-10-28T19:10:13.889602941-04:00" level=error msg="> +Oct 28 19:10:13 rhel82.home.labs.com dockerd[30768]: time="2020-10-28T19:10:13.903413613-04:00" level=warning msg> +Oct 28 19:10:13 rhel82.home.labs.com dockerd[30768]: time="2020-10-28T19:10:13.903427451-04:00" level=warning msg> +Oct 28 19:10:13 rhel82.home.labs.com dockerd[30768]: time="2020-10-28T19:10:13.903538271-04:00" level=info msg="L> +Oct 28 19:10:14 rhel82.home.labs.com dockerd[30768]: time="2020-10-28T19:10:14.132060506-04:00" level=info msg="D> +Oct 28 19:10:14 rhel82.home.labs.com dockerd[30768]: time="2020-10-28T19:10:14.308943088-04:00" level=info msg="L> +Oct 28 19:10:14 rhel82.home.labs.com dockerd[30768]: time="2020-10-28T19:10:14.319438549-04:00" level=info msg="D> +Oct 28 19:10:14 rhel82.home.labs.com dockerd[30768]: time="2020-10-28T19:10:14.319570298-04:00" level=info msg="D> +Oct 28 19:10:14 rhel82.home.labs.com dockerd[30768]: time="2020-10-28T19:10:14.333419209-04:00" level=info msg="A> +Oct 28 19:10:14 rhel82.home.labs.com systemd[1]: Started Docker Application Container Engine +``` + +Check your Docker version: + + +``` +[root@rhel82 ~]# docker --version +Docker version 19.03.13, build 4484c46d9d +``` + +### Hack your host + +One of the best ways to understand a problem is to experience it. So, I'll show you how easy it is to inject malicious code into a Docker host if your security is not set up properly. + +To be able to do something bad on the Docker host, the malicious non-root user (`mcalizo` in this tutorial) must be part of the group that can instantiate Docker containers. + +First, confirm what group the `mcalizo` user belongs to: + + +``` +[root@Rhel82 ~]# groups mcalizo +mcalizo : mcalizo +``` + +The output shows that `mcalizo` belongs only to its own group. This means `mcalizo` can't instantiate Docker containers and will get this error if it tries: + + +``` +[mcalizo@Rhel82 ~]$ docker run -it --rm centos:latest /bin/sh +docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/create: dial unix /var/run/docker.sock: connect: permission denied. +See 'docker run --help'. +``` + +To allow `mcalizo` to instantiate the container, add the user to the `docker` group: + + +``` +[root@Rhel82 ~]# usermod -G docker -a mcalizo +[root@Rhel82 ~]# groups mcalizo +mcalizo : mcalizo docker +``` + +Next, deploy a `fedora:latest` container and log into the instantiated container to explore it: + + +``` +[mcalizo@Rhel82 ~]$ docker run -it --rm fedora:latest /bin/sh +Unable to find image 'fedora:latest' locally +latest: Pulling from library/fedora +ee7e89337106: Pull complete +Digest: sha256:b9ec86d36fca7b1d3de39cd7c258e8d90c377d312c21a7748071ce49069b8db4 +Status: Downloaded newer image for fedora:latest +sh-5.0# cat /etc/redhat-release +Fedora release 33 (Thirty Three) +``` + +While you're logged into the newly created container, you can see you are automatically logged in as root: + + +``` +sh-5.0# whoami +root +sh-5.0# +``` + +As `root` user, you can do anything in this container, which means you can exploit the container host and do a lot of damage. Because you can instantiate a container, you can do things to the host even if you are not part of the host's sudoers account. + +Exit the container you just created, and create a new container to demonstrate the exploit: + + +``` +[mcalizo@Rhel82 ~]$ docker run -it --rm -v /:/exploit fedora:latest /bin/bash +[root@131043f2e306 /]# +``` + +The [-v option][8] mounts the Docker host's `/` directory to the container under the `/exploit` directory: + + +``` +[root@131043f2e306 /]#ls exploit/ +bin  boot  dev  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var +``` + +Because it is mounted, you can do _anything_ on the Docker host. For example, you can delete files, edit specific configurations to harm the system, or even install a Trojan horse application or other malware to steal important information. + +### Why does this happen? + +You may be wondering why this is possible since SELinux is in enforcing mode. Dig deeper into SELinux to see where things went wrong. + +Verify that SELinux has a [Docker context][9]: + + +``` +[mcalizo@Rhel82 ~]$ ps -eZ | grep docker +system_u:system_r:container_runtime_t:s0 30768 ? 00:00:04 dockerd +[mcalizo@Rhel82 ~]$ +``` + +As expected, it does. This means SELinux manages the Docker daemon. Inspect the Docker daemon to see if SELinux is enabled by default: + + +``` +[mcalizo@Rhel82 ~]$ docker info | grep Security -A3 + Security Options: +  seccomp +   Profile: default + Kernel Version: 4.18.0-193.el8.x86_64 +``` + +SELinux is _not_ enabled by default. This is the problem! To fix it, enable SELinux to control and manage Docker by updating or creating the file `/etc/docker/daemon.json` as [documented here][10] (you must have root access to do this): + + +``` +[root@Rhel82 ~]# cat /etc/docker/daemon.json +{ +  "selinux-enabled": true +} +[root@Rhel82 ~]# +[root@Rhel82 ~]# systemctl restart docker +``` + +After creating or updating the file and restarting Docker, you should see that SELinux support is enabled in the Docker daemon: + + +``` +[root@Rhel82 ~]# systemctl restart docker +[mcalizo@Rhel82 root]$ docker info | grep Security -A3 + Security Options: +  seccomp +   Profile: default +  selinux +[mcalizo@Rhel82 root]$ +``` + +While it's still possible to mount a specific filesystem in your Docker host on your Docker container, updating or accessing the file is no longer allowed: + + +``` +[mcalizo@Rhel82 root]$ docker run -it --rm -v /:/exploit fedora:latest /bin/bash +[root@ecb5836da1f6 /]# touch /exploit/etc/shadow.sh +touch: cannot touch '/exploit/etc/shadow.sh': Permission denied +[root@ecb5836da1f6 /]# +``` + +### Learn more + +Your first line of defense in the container world depends on how strongly you set up your container hosts' operating system. There are numerous ways to implement Linux security, including options available on the market to augment your security posture. + +SELinux is an additional layer of security that is built into [Linux distributions][11] by default. To take advantage of it and protect your system against compromise, make sure SELinux remains on. + +If you want to learn more, see: + + * [How to install Docker CE on CentOS 8 / RH][7] + * [Docker security cheat sheet][12] + * [dockerd documentation][10] + * [Use volumes documentation][8] + * [What is SELinux?][3] + + + +Few things in the Linux world evoke a strong reaction like SELinux , the security enhancement for... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/selinux-containers + +作者:[Mike Calizo][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://opensource.com/users/mcalizo +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDU_UnspokenBlockers_1110_A.png?itok=x8A9mqVA (Three closed doors) +[2]: https://en.wikipedia.org/wiki/Security-Enhanced_Linux +[3]: https://www.redhat.com/en/topics/linux/what-is-selinux +[4]: https://www.redhat.com/en/topics/linux/what-is-linux +[5]: https://www.redhat.com/en/topics/linux/what-is-the-linux-kernel +[6]: https://opensource.com/resources/what-docker +[7]: https://www.linuxtechi.com/install-docker-ce-centos-8-rhel-8/ +[8]: https://docs.docker.com/storage/volumes/ +[9]: https://docs.docker.com/engine/reference/commandline/context/ +[10]: https://docs.docker.com/engine/reference/commandline/dockerd/ +[11]: https://www.redhat.com/en/topics/linux/whats-the-best-linux-distro-for-you +[12]: https://cheatsheetseries.owasp.org/cheatsheets/Docker_Security_Cheat_Sheet.html From ee8f5512e35de36788c1fa0087aea2b5045db1a6 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 19 Nov 2020 05:03:08 +0800 Subject: [PATCH 0828/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201118?= =?UTF-8?q?=20Apply=20the=20Scientific=20Method=20to=20agile=20development?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201118 Apply the Scientific Method to agile development.md --- ... Scientific Method to agile development.md | 170 ++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 sources/tech/20201118 Apply the Scientific Method to agile development.md diff --git a/sources/tech/20201118 Apply the Scientific Method to agile development.md b/sources/tech/20201118 Apply the Scientific Method to agile development.md new file mode 100644 index 0000000000..983e15a972 --- /dev/null +++ b/sources/tech/20201118 Apply the Scientific Method to agile development.md @@ -0,0 +1,170 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Apply the Scientific Method to agile development) +[#]: via: (https://opensource.com/article/20/11/hypothesis-driven-development) +[#]: author: (Alex Bunardzic https://opensource.com/users/alex-bunardzic) + +Apply the Scientific Method to agile development +====== +Hypothesis-driven development allows constant analysis of new +information to implement new insights (and deliver new customer value) +on an ongoing basis. +![Science lab with beakers][1] + +> "The only way it’s all going to go according to plan is if you don’t learn anything." —Kent Beck + +Experimentation is the foundation of the scientific method, which is a systematic means of exploring the world around us. But experimentation is not only reserved for the field of scientific research. It has a central place in the world of business too. + +Most of us are by now familiar with the business methodology called [Minimum Viable Product (MVP)][2]. This Minimum Viable Product is basically just an experiment. By building and launching MVPs, business operations are engaging in a systematic means of exploring the markets. + +If we look at market leaders today, we learn that they’re not doing projects anymore; the only thing they’re doing is experiments. Customer discovery and lean strategies are only used to test assumptions about the markets. Such an approach is equivalent to Test-Driven Development (TDD), which is the process we are intimately familiar with. In TDD, we write the hypothesis (the test) first. We then use that test to guide our implementation. Ultimately, product or service development is no different than TDD—we first write a hypothesis, then that hypothesis guides our implementation, which serves as measurable validation of the hypothesis. + +### Information discovery + +Back in the pre-agile days, requirements gathering was an important activity that used to always kick off the project. A bunch of subject matter experts (SMEs) would get assigned to the project and be tasked with gathering the requirements. After a prolonged period of upfront information discovery, the gathered requirements got reviewed and, if agreed upon, signed off and frozen. No more changes allowed! + +Back then, it seemed a perfectly reasonable thing to do. The fly in the ointment always showed up once the build phase commenced. Sooner or later, as the project progresses, new information comes to light. Suddenly, what we initially viewed as incontrovertible truth gets challenged by the newly acquired information and evidence. + +But the clincher was in the gated phases. Remember, once requirements get signed off, they get frozen—no more changes, no scope creep allowed—which means newly obtained market insights get willfully ignored. + +Well, that’s kind of foolish neglect. The newly emerging evidence could be of critical importance to the health of the business operation. Can we afford to ignore it? Absolutely not! We have no choice but to embrace the change. + +After a number of prominent fiascos in the industry, many software development projects switched to the agile approach. With agile, information discovery is partial. With agile, we never claim that we have gathered the requirements and are now ready to implement them. We discover information and implement it on an ongoing basis. We do it in tiny steps, keeping our efforts interruptible and steerable at all times. + +### How to leverage the scientific method + +The scientific method is empirical and consists of the following steps: + +Step 1: Make and record careful observations. + +Step 2: Perform orientation with regard to observed evidence. + +Step 3: Formulate a hypothesis, including measurable indicators for hypothesis evaluation. + +Step 4: Design an experiment that will enable testing of the hypothesis. + +Step 5: Conduct the experiment (i.e., release the partial implementation). + +Step 6: Collect the telemetry that results from running the experiment. + +Step 7: Evaluate the results of the experiment. + +Step 8: Accept or reject the hypothesis. + +Step 9: Return to Step 1. + +### How to formulate a hypothesis + +When switching from project to experiments, the traditional user story framework (As a__I want to__so that__) has proven insufficient. The traditional user story format does not expose the signals needed in order to evaluate the outcomes. Instead, the old school user story format is focused on outputs. + +The problem with doing an experiment without first formulating a hypothesis is that there is a danger of introducing a bias when interpreting the results of an experiment. Defining the measurable signals that will enable us to corroborate our hypothesis must be done before we conduct the experiment. That way, we can remain completely impartial when interpreting the results of the experiment. We cannot be swayed by wishful thinking. + +The best way to proceed with formulating a hypothesis is to use the following format: + +We believe [this capability] will result in [this outcome]. We will have the confidence to proceed when [we see a measurable signal]. + +### Working software is not a measure of progress + +Output-based metrics and concepts (definition of "done," acceptance criteria, burndown charts, and velocity) are good for detecting working software but fall miserably when it comes to detecting if working software adds value. + +"Done" only matters if it adds value. Working software that doesn’t add value cannot be declared "done." + +### The forgotten column + +Technology-centric projects break activities down into four columns: + + 1. Backlog of ideas + 2. Analysis + 3. In progress + 4. Shipped + + + +The above structure is based on the strong belief that all software that works is valuable. That focus must now shift toward continuously delivering real value, something that serves customers. Agilists value outcomes (value to the customers) over features. + +The new breakdown for hypothesis-driven development looks something like this: + +Ideas Backlog + +| + +Analysis + +| + +In Progress + +| + +Shipped + +| + +Achieved Desired Outcome + +---|---|---|---|--- + +Hypothesis 11 + +Hypothesis 12 + +Hypothesis 13 + +Hypothesis 14 + +Hypothesis 15 + +Hypothesis 16 + +Hypothesis 17 + +Hypothesis 18 + +Hypothesis 19 + +| + +Hypothesis 20 + +Hypothesis 21 + +| + +Hypothesis 26 + +| + +Hypothesis 2 + +Hypothesis 5 + +Hypothesis 9 + +Hypothesis 10 + +| + +Hypothesis 1 + +Hypothesis 5 + +All eyes must remain on the Achieved Desired Outcome column. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/hypothesis-driven-development + +作者:[Alex Bunardzic][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://opensource.com/users/alex-bunardzic +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/science_experiment_beaker_lab.png?itok=plKWRhlU (Science lab with beakers) +[2]: https://en.wikipedia.org/wiki/Minimum_viable_product#:~:text=A%20minimum%20viable%20product%20%28MVP,feedback%20for%20future%20product%20development.&text=The%20concept%20can%20be%20used,developments%20of%20an%20existing%20product. From cd895c2fc9b6a020904ab5ee471f3095134c30d9 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 19 Nov 2020 08:50:55 +0800 Subject: [PATCH 0829/1156] translated --- ...cher on Linux for Making Live Linux USB.md | 136 ----------------- ...cher on Linux for Making Live Linux USB.md | 137 ++++++++++++++++++ 2 files changed, 137 insertions(+), 136 deletions(-) delete mode 100644 sources/tech/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md create mode 100644 translated/tech/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md diff --git a/sources/tech/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md b/sources/tech/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md deleted file mode 100644 index cb7c463b33..0000000000 --- a/sources/tech/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md +++ /dev/null @@ -1,136 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Install and Use Etcher on Linux for Making Live Linux USB) -[#]: via: (https://itsfoss.com/install-etcher-linux/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -How to Install and Use Etcher on Linux for Making Live Linux USB -====== - -_**Etcher is a popular USB flasher app for creating bootable Linux USB drives. Let me show you how to install it and how to use it for making a live Linux disk.**_ - -### Etcher: An open source tool to flash Linux ISO on SD Cards & USB drives - -Etcher is an open-source project by [Balena][1] to help flash SD cards for Raspberry Pi. In fact, we used it in our tutorial on [how to install Raspbian OS on a SD Card][2]. - -Not just limited to SD Cards, you can also use Etcher to [make a bootable USB drive][3] just like we created a [live USB of Manjaro in Linux][4] with the help of it. - -Ever since its first release, Etcher caught the attention for its neat interface and simplicity of use. - -![][5] - -In this article, I will be focusing on the steps to help you install Etcher on Linux. And then, I’ll also show how to use it. Before I do that, let me give you an overview of the features it offers: - -### Features of Etcher - - * Validate drive before flashing - * Beautiful user interface - * Auto-detects USB drive/SD card to prevent wiping the HDD on your computer - * Cross-platform support (Windows, macOS, and Linux) - * Fast flashing - * Simple three-step process - - - -On paper, you get everything one would need to flash OS images on an SD card and a USB drive. It is also exciting to know that they plan to add the support simultaneous writing to multiple devices as per their [roadmap][6]. - -### Installing Etcher on Linux - -To get started, you have to grab the AppImage file that it offers (suitable for any Linux distribution) from its official website. - -You just need to head on to its [homepage][7] and download the one for your system (32-bit/64-bit): - -![][8] - -In my case, I got the 64-bit AppImage file for Ubuntu. You can go through our guide on [using AppImage files on Linux][9], but I’ll give you a head start on what you need to do next. - -You need to give the file permissions to execute and you can do that by right-clicking on the **AppImage file -> Properties**. - -![][10] - -Next, click on “**Allow executing as a program**” under the Permissions tab as shown in the image below. - -![][11] - -Now, just double-click on the AppImage file to launch balenaEtcher! - -This should work on any Linux distribution. In either case, you can also head over to its [GitHub releases se][12][c][12][tion][12] to find RPM, DEB, and the source file if you want to build it from source or just install it using the .rpm or .deb files. - -You can also refer to our guide on [using deb file in Ubuntu][13] to install applications. - -Attention! - -It’s been noticed that when you use Etcher to create live USB of Linux distributions, it leaves the USB in an apparent unusable state where it has only a few MB of free state and cannot be formatted directly. On Linux, you can [use the Disks tool to manually delete the partitions and then format it][14]. - -### Using Etcher on Linux - -It is just a three-step process to get started using Etcher. It should be self-explanatory as per the on-screen instructions after you launch it, but just to give you a head start, here’s what you have to do: - -**Step 1:** Select the appropriate ISO image file or the URL of the file that you need to flash (as shown in the image below). - -![][15] - -**Step 2**: Next, you will have to select the target device. It automatically detects and highlights removable devices to help you prevent selecting any internal storage locations. - -![][16] - -In this case, I have a USB drive connected, and I have it selected as well (as shown in the screenshot below). - -![][17] - -**Step 3:** Now, all you have to do is — flash the image and wait for it to complete successfully. - -![][18] - -Here’s how the progress looks: - -![][19] - -And, it is done! - -![][20] - -[Download balenaEtcher][7] - -### Wrapping Up - -Etcher is a useful tool to flash OS images for both SD cards and USB drives. I tend to use it primarily to create live USB drives to test Linux distros and I’m happy with it. - -What do you prefer to use to create bootable drives? Have you tried Etcher already? Let me know your thoughts in the comments down below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/install-etcher-linux/ - -作者:[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://www.balena.io/ -[2]: https://itsfoss.com/tutorial-how-to-install-raspberry-pi-os-raspbian-wheezy/ -[3]: https://itsfoss.com/create-bootable-ubuntu-usb-drive-mac-os/ -[4]: https://itsfoss.com/create-live-usb-manjaro-linux/ -[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/etcher-mxlinux-2.png?resize=800%2C518&ssl=1 -[6]: https://github.com/balena-io/etcher/milestones -[7]: https://www.balena.io/etcher -[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/etcher-official-site-download.png?resize=800%2C580&ssl=1 -[9]: https://itsfoss.com/use-appimage-linux/ -[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/balena-etcher-permission.jpg?resize=800%2C378&ssl=1 -[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/balena-etcher-execute.jpg?resize=800%2C445&ssl=1 -[12]: https://github.com/balena-io/etcher/releases/tag/v1.5.109 -[13]: https://itsfoss.com/install-deb-files-ubuntu/ -[14]: https://itsfoss.com/cant-format-usb-disk/ -[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/balena-etcher-select.jpg?resize=800%2C521&ssl=1 -[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/etcher-select-target.jpg?resize=800%2C509&ssl=1 -[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/etcher-target-device.jpg?resize=800%2C521&ssl=1 -[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/etcher-flash.jpg?resize=800%2C516&ssl=1 -[19]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/etcher-flashing.jpg?resize=800%2C510&ssl=1 -[20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/etcher-flash-complete.jpg?resize=800%2C507&ssl=1 diff --git a/translated/tech/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md b/translated/tech/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md new file mode 100644 index 0000000000..bb8aa29cde --- /dev/null +++ b/translated/tech/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md @@ -0,0 +1,137 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Install and Use Etcher on Linux for Making Live Linux USB) +[#]: via: (https://itsfoss.com/install-etcher-linux/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +如何在 Linux 上安装和使用 Etcher 来制作 Live Linux USB +====== + +_**Etcher 是一款流行的 USB 烧录应用,可用于创建可启动的 Linux USB。让我来告诉你如何安装它,以及如何使用它来制作一个 Live Linux 盘。**_ + +### Etcher:一个用于在 SD 卡和 USB 驱动器中烧录 Linux ISO 的开源工具 + +Etcher 是一个由 [Balena][1] 开发的开源项目,来用于为树莓派烧录 SD 卡。事实上,我们在[如何在 SD 卡上安装 Raspbian OS][2] 的教程中就使用了它。 + +它不仅仅局限于 SD 卡,你还可以使用 Etcher 来[制作一个可启动的 USB 驱动器][3],就像我们在它的帮助下在 Linux 中制作了一个 [Manjaro 的 Live USB][4]。 + +自首次发布以来,Etcher 就以其整洁的界面和简单的使用方式引起了人们的注意。 + +![][5] + +在本文中,我将重点介绍帮助你在 Linux 上安装 Etcher 的步骤。然后,我还将展示如何使用它。在这之前,让我先给大家介绍一下它的功能。 + +### Etcher 的功能 + + * 在烧录前验证驱动器 + * 漂亮的用户界面 + * 自动检测 USB 驱动器/SD 卡,防止电脑上的硬盘被擦除。 + * 跨平台支持(Windows、macOS 和 Linux)。 + * 快速烧录 + * 简单的三步过程 + + + +理论上,你已经有了在 SD 卡和 USB 驱动器上烧录操作系统镜像所需的一切。同样令人激动的是,他们计划根据他们的[路线图][6],增加对多个设备的同步写入支持。 + +### 在 Linux 上安装 Etcher + +要开始使用,你需要从它的官方网站上下载它提供的 AppImage 文件(适用于任何 Linux 发行版)。 + +你只需要前往它的[主页][7],并根据你的系统(32 位/64 位)下载一个程序: + +![][8] + + +在我的例子中,我下载了 Ubuntu 的 64 位 AppImage 文件。你可以通过我们的指南来了解[在 Linux 上使用 AppImage文件][9],但我会让你先知道下一步需要做什么。 + +你需要给文件执行权限,你可以右击**AppImage 文件 -> 属性**来实现。 + +![][10] + +接下来,点击权限选项卡下的“**允许作为程序执行**”,如下图所示。 + +![][11] + +现在,只需双击 AppImage 文件即可启动 Etcher! + +这应该可以在任何 Linux 发行版上运行。在任何情况下,如果你想从源码构建或者直接使用 .rpm 或 .deb 文件安装,你也可以前往它的 [Github 发布页][12]找到 RPM、DEB 和源码。 + +你也可以参考我们的[在 Ubuntu 中使用 deb 文件][13]来安装应用。 + +注意! + +我们注意到,当你使用 Etcher 创建 Linux 发行版的 Live USB 时,它会使 USB 处于明显的不可使用状态,即它只有几 MB 的空闲空间,并且不能直接格式化。在 Linux 上,你可以[使用磁盘工具手动删除分区,然后格式化它][14]。 + +### 在 Linux 上使用 Etcher + +只需三步就可以开始使用 Etcher。在你启动它之后,根据屏幕上的提示应该是清晰的,但为了给你一个好的开始,以下是你要做的事情: + +**步骤 1:**选择合适的 ISO 镜像文件或你需要烧录的文件的 URL(如下图所示)。 + +![][15] + +**步骤 2:**接下来,你需要选择目标设备。它会自动检测并高亮显示可移动设备,以防止你选择任何内部存储位置。 + +![][16] + +在这里,我连接了一个 USB 驱动器,我也选择了它(如下图所示)。 + +![][17] + +**步骤 3:**现在,你所有需要做的就是烧录镜像并等待它成功完成。 + +![][18] + +这是进度的样子: + +![][19] + +完成了! + +![][20] + +[Download balenaEtcher][7] + +### 总结 + +Etcher 是一个有用的工具,可以为 SD 卡和 USB 驱动器烧录操作系统镜像。我倾向于主要使用它来创建 Live USB 驱动器来测试 Linux 发行版,我对它很满意。 + +你更喜欢用什么来创建可启动驱动器?你是否已经尝试过 Etcher?请在下面的评论中告诉我你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-etcher-linux/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者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://www.balena.io/ +[2]: https://itsfoss.com/tutorial-how-to-install-raspberry-pi-os-raspbian-wheezy/ +[3]: https://itsfoss.com/create-bootable-ubuntu-usb-drive-mac-os/ +[4]: https://itsfoss.com/create-live-usb-manjaro-linux/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/etcher-mxlinux-2.png?resize=800%2C518&ssl=1 +[6]: https://github.com/balena-io/etcher/milestones +[7]: https://www.balena.io/etcher +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/etcher-official-site-download.png?resize=800%2C580&ssl=1 +[9]: https://itsfoss.com/use-appimage-linux/ +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/balena-etcher-permission.jpg?resize=800%2C378&ssl=1 +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/balena-etcher-execute.jpg?resize=800%2C445&ssl=1 +[12]: https://github.com/balena-io/etcher/releases/tag/v1.5.109 +[13]: https://itsfoss.com/install-deb-files-ubuntu/ +[14]: https://itsfoss.com/cant-format-usb-disk/ +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/balena-etcher-select.jpg?resize=800%2C521&ssl=1 +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/etcher-select-target.jpg?resize=800%2C509&ssl=1 +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/etcher-target-device.jpg?resize=800%2C521&ssl=1 +[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/etcher-flash.jpg?resize=800%2C516&ssl=1 +[19]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/etcher-flashing.jpg?resize=800%2C510&ssl=1 +[20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/etcher-flash-complete.jpg?resize=800%2C507&ssl=1 From c564796d66d0570e84e186abccba86e594643e78 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 19 Nov 2020 08:53:33 +0800 Subject: [PATCH 0830/1156] translating --- sources/tech/20201116 Podman with capabilities on Fedora.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201116 Podman with capabilities on Fedora.md b/sources/tech/20201116 Podman with capabilities on Fedora.md index 236ea0072e..dd8ab976e8 100644 --- a/sources/tech/20201116 Podman with capabilities on Fedora.md +++ b/sources/tech/20201116 Podman with capabilities on Fedora.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 02a6191d92d0d10a27c4f9a295812d030ebc9400 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 19 Nov 2020 23:00:04 +0800 Subject: [PATCH 0831/1156] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @xiao-song-123 翻译的不错! --- ...steps to learn any programming language.md | 116 ++++++++---------- 1 file changed, 51 insertions(+), 65 deletions(-) diff --git a/translated/tech/20201022 5 steps to learn any programming language.md b/translated/tech/20201022 5 steps to learn any programming language.md index 8104c71dbb..695bfab59a 100644 --- a/translated/tech/20201022 5 steps to learn any programming language.md +++ b/translated/tech/20201022 5 steps to learn any programming language.md @@ -1,84 +1,78 @@ [#]: collector: "lujun9972" [#]: translator: "xiao-song-123" -[#]: reviewer: " " +[#]: reviewer: "wxy" [#]: publisher: " " [#]: url: " " [#]: subject: "5 steps to learn any programming language" [#]: via: "https://opensource.com/article/20/10/learn-any-programming-language" [#]: author: "Seth Kenlon https://opensource.com/users/seth" -学习任何编程语言的 5 个步骤 +五步学会任何编程语言 ====== -只需一点编程经验,您就可以在几天内(有时更少)学习一种新语言。 -![Learning to program][1] -有些人喜欢学习新的编程语言,也有一些人连学习一种都是可望不可即的事情。在本文中,我将向您展示如何像程序员一样思考,以便您可以自信地学习所需的任何编程语言。 +> 只需一点编程经验,你就可以在短短几天内(有时更少)学会一种新编程语言。 -事实上,一旦您学会了如何编程,您使用的语言就不再是一个障碍,而更像是一种形式。这只是教育家们倡导 [让孩子尽早学习编程][2] 的众多原因之一。不管他们的入门语言有多简单,这种编程的逻辑和儿童(或成人学习者)以后可能遇到的其他东西的逻辑有着相同之处。 +![](https://img.linux.net.cn/data/attachment/album/202011/19/225851j7miw3kd17joowa7.jpg) -只需有一点编程经验(您可以从 Opensource.com 上的任何一篇介绍性文章中获得),您就可以在几天内(有时更短)学习任何编程语言。这并不是魔法,现在您也必须要为此付出一些努力。诚然,学习一种语言每个的可用库,或者学习打包代码以及进行交付的细微差别,需要的时间远远不止几天。但是,就入门来说,比您想像中的要容易许多,剩下的则要通过不断练习来完成。 +有些人喜欢学习新的编程语言,也有一些人觉得学习一种都是可望不可及的事情。在本文中,我将向你展示如何像程序员一样思考,这样你就可以自信地学习任何一门你想要学习的编程语言。 -当有经验的程序员静下心来学习一门新的编程语言时,他们会寻找五样东西。只要您知道了这五件事,您就可以开始编码了。 +事实上,一旦你学会了如何编程,你使用的编程语言就不再是一个障碍,而更像是一种形式。实际上,这就是教育家们倡导 [让孩子尽早学习编程][2] 的众多原因之一。不管他们的入门语言有多简单,这种编程的逻辑和儿童们(或成人学习者)以后可能遇到的其他语言的逻辑有着想通之处。 -### 1\. 语法 +只需有一点编程经验(你可以从我们这里的几篇介绍性文章中获得),你就可以在短短几天内(有时更短)学习任何编程语言。这并不是魔法,你也确实要为此付出一些努力。诚然,学习一种编程语言每个的可用库,或者学习打包代码以及进行交付的细微差别,需要的时间远远不止几天。但是,就入门来说,比你想像中的要容易许多,剩下的则要通过不断练习来完成。 + +当有经验的程序员静下心来学习一门新的编程语言时,他们会寻找五样东西。只要你知道了这五件事,你就可以开始编码了。 + +### 1、语法 ![Syntax][3] -(Seth Kenlon, [CC BY-SA 4.0][4]) - 语言的语法描述了代码的结构。这包括如何逐行编写代码,以及用于构造代码语句的实际单词。 -例如,[Python][5] 因使用缩进来指示一个代码块在哪里结束以及另一代码块在哪里开始而闻名: - +例如,[Python][5] 以使用缩进来指示一个代码块在哪里结束以及另一代码块在哪里开始而闻名: ``` -while j < rows: -    while k < columns: -        tile = Tile(k * w) -        board.add(tile) -        k += 1 -    j += 1 -    k = 0 +while j < rows: + while k < columns: + tile = Tile(k * w) + board.add(tile) + k += 1 + j += 1 + k = 0 ``` -[Lua][6] 只是使用关键字 `end`: - +[Lua][6] 只是使用关键字 `end`: ``` for i,obj in ipairs(hit) do -  if obj.moving == 1 then -     obj.x,obj.y = v.mouse.getPosition() -  end + if obj.moving == 1 then + obj.x,obj.y = v.mouse.getPosition() + end end ``` -[Java][7], [C][8], C++, 和类似的编程语言使用花括号: - +[Java][7]、[C][8]、C++ 之类的编程语言使用花括号: ``` while (std::getline(e,r)) { -  wc++; -  } + wc++; + } ``` -编程语言的语法还包括包括库、设置变量和终止行等内容。通过练习,您将学会在阅读示例代码时下意识地识别语法需求(和惯例)。 +编程语言的语法还包括包括库、设置变量和终止行等内容。通过练习,你将学会在阅读示例代码时下意识地识别语法需求(和惯例)。 #### 实践 -当学习一门新的编程语言时,要努力理解它的语法。您不需要去记住它,只需要知道如果忘记了以后去哪里看。使用好的 [IDE][9] 也很有帮助,因为很多 IDE 在出现语法错误时会提醒您。 +当学习一门新的编程语言时,要努力理解它的语法。你不需要去记住它,只需要知道如果忘记了以后去哪里查找。使用好的 [IDE][9] 也很有帮助,因为很多 IDE 在出现语法错误时会提醒你。 -### 2\. 内置函数和条件 +### 2、内置函数和条件 ![built-in words][10] -(Seth Kenlon, [CC BY-SA 4.0][4]) +就像自然语言一样,编程语言可以识别的合法单词是有限的。这个词汇表可以使用其他库进行扩展,但是核心语言知道一组特定的关键字。大多数语言并没有你想的那么多关键字。即使在像 C 语言这样非常低级的语言中,也只有 32 个关键字,比如 `for`、`do`、`while`、`int`、`float`、`char`、`break` 等等。 -就像自然语言一样,编程语言可以识别的合法单词是有限的。这个词汇表可以使用其他库进行扩展,但是核心语言知道一组特定的关键字。大多数语言并没有您想的那么多关键字。即使在像 C 语言这样非常低级的语言中,也只有 32 个关键字,比如 `for`, `do`, `while`, `int`, `float`, `char`, `break` 等等。 - -了解了这些关键字,您就可以编写基本的表达式,也就是构建程序的代码块。许多内置的关键字能帮助您构建条件语句,这些条件语句影响整个程序的流程。例如,如果您想编写一个允许单击和拖动图标的程序,那么您的代码就必须检测用户的鼠标指针何时位于图标上。只有当鼠标光标位于图标外部边缘相同的坐标时,才执行导致使鼠标抓取图标的代码。这是一个经典的 if / then 语句,不同的语言可以用不同的方式表达。 - -Python 使用 `if`, `elif `和 `else` 的组合来实现条件语句,但是并不显式的关闭语句: +了解了这些关键字,你就可以编写基本的表达式,也就是构建程序的代码块。许多内置的关键字能帮助你构建条件语句,这些条件语句影响整个程序的流程。例如,如果你想编写一个允许单击和拖动图标的程序,那么你的代码就必须检测用户的鼠标指针何时位于图标上。只有当鼠标光标位于图标外部边缘相同的坐标时,才执行导致使鼠标抓取图标的代码。这是一个经典的 `if` / `then` 语句,但不同的语言可以用不同的方式表达。 +Python 使用 `if`、`elif `和 `else` 的组合来实现条件语句,但是并不显式的关闭语句: ``` if var == 1: @@ -89,8 +83,7 @@ else:     # some other action ``` -[Bash][11] 使用 `if`, `elif`, `else`, 并且使用 `fi` 来结束语句: - +[Bash][11] 使用 `if`、`elif`、`else`,并且使用 `fi` 来结束语句: ``` if [ "$var" = "foo" ]; then @@ -102,8 +95,7 @@ else fi ``` -然而 C 和 Java, 使用 `if`, `else` 和 `else if`, 用花括号把它们括起来: - +然而 C 和 Java, 使用 `if`、`else` 和 `else if`,用花括号把它们括起来: ``` if (boolean) { @@ -115,59 +107,53 @@ if (boolean) { } ``` -各种编程语言虽然在关键字的选择和语法上有细微的变化,但基本是相同的。学习如何在编程语言中定义条件语句,包括 `if/then`, `do...while` 和 `case` 语句。 +各种编程语言虽然在关键字的选择和语法上有细微的变化,但基本是相同的。学习如何在编程语言中定义条件语句,包括 `if` / `then`、`do...while` 和 `case` 语句。 #### 实践 -要去熟悉编程语言能够理解的关键字集。在实践中,您的代码将不仅仅包含一种语言的关键字。可以肯定的是,有许多库中包含一些简单的函数,它们可以帮助您完成诸如将输出打印到屏幕或显示窗口之类的操作。然而,驱动这些库的逻辑始于编程语言的内置关键字。 +要熟悉编程语言能够理解的关键字集。在实践中,你的代码将不仅仅包含编程语言的关键字,可以肯定的是,有包含很多简单函数的库来帮助你做一些事情,诸如将输出打印到屏幕或显示窗口之类。然而,驱动这些库的逻辑始于编程语言的内置关键字。 -### 3\. 数据类型 +### 3、数据类型 ![Data types][12] -(Seth Kenlon, [CC BY-SA 4.0][4]) - -代码是用来处理数据的,因此您必须学习编程语言如何识别不同类型的数据。所有编程语言都能理解整数,大多数的语言能理解小数和单个字符 (a, b, c 等等)。它们通常被表示为 `int` , `float`,`double` 和 `char`, 当然,语言的内置词汇表会告诉您如何引用这些实体。 +代码是用来处理数据的,因此你必须学习编程语言如何识别不同类型的数据。所有编程语言都能理解整数,大多数的语言能理解小数和单个字符(`a`、`b`、`c` 等等)。它们通常被表示为 `int`、 `float`、`double` 和 `char`,当然,语言的内置词汇表会告诉你如何引用这些实体。 有时候,在编程语言中内置了一些额外的数据类型,也有时是通过引用库来启用复杂的数据类型。例如,Python 可以识别关键字为 `str` 的字符串,但是 C 语言的代码中必须包含 `string.h` 头文件才能实现字符串特性。 #### 实践 -库可以为您的代码解锁所有类型的数据,但是学习编程语言中包含的基本数据类型是一个明智的起点。 +库可以为你的代码解锁各种类型的数据,但是学习编程语言中包含的基本数据类型是一个明智的起点。 -### 4\. 运算符和解析器 +### 4、运算符和解析器 ![Operators][13] -(Seth Kenlon, [CC BY-SA 4.0][4]) +一旦你理解了编程语言可处理的数据类型,就可以学习如何分析这些数据了。幸运的是,数学这门学科是相当稳定的,所以算数运算符在许多语言中通常是相同的(或至少非常相似)。例如,两个整数相加通常用 `+` 符号完成,而测试一个整数是否大于另一个整数通常用 `>` 符号完成。测试是否相等通常使用 `==` 来完成(是的,是两个等号,因为通常一个等号用来赋值)。 -一旦您理解了编程语言可处理的数据类型,就可以学习如何分析这些数据了。幸运的是,数学这门学科是相当稳定的,所以算数运算符在许多语言中通常是相同的(或至少非常相似)。例如,两个整数相加通常用 `+` 符号完成,而测试一个整数是否大于另一个整数通常用 `>` 符号完成。测试是否相等通常使用 `==` 来完成(是的,是两个等号,因为通常一个等号用来赋值)。 +当然也有一些例外,比如像 Lisp 和 Bash 语言算数运算符就不是如此,但与其他语言一样,这只是一个心理翻译的问题。一旦你了解了表达方式有何不同,很快就可以适应它。快速浏览一下一门编程语言的算数运算符通常足以让你了解算数操作是如何完成的。 -当然也有一些例外,比如像 Lisp 和 Bash 语言算数运算符就不是如此,但与其他语言一样,这只是一个音译的问题。一旦您了解了表达方式有何不同,很快就可以适应它。快速回顾一门编程语言的算数运算符通常足以让您了解算数操作是如何完成的。 - -您还需要知道如何比较和操作非数值数据,比如字符和字符串。这些通常是通过编程语言的核心库来进行的的。例如,Python 提供了 `split()` 方法,而 C 语言需要引入头文件 `string.h` 来提供 `strtok()` 函数。 +你还需要知道如何比较和操作非数值数据,比如字符和字符串。这些通常是通过编程语言的核心库来进行的的。例如,Python 提供了 `split()` 方法,而 C 语言需要引入头文件 `string.h` 来提供 `strtok()` 函数。 #### 实践 -了解用于处理基本数据类型的基本函数和关键字,并寻找可帮助您完成复杂操作的核心库。 +了解用于处理基本数据类型的基本函数和关键字,并寻找可帮助你完成复杂操作的核心库。 -### 5\. 函数 +### 5、函数 ![Class][14] -(Seth Kenlon, [CC BY-SA 4.0][4]) +代码不只是计算机的待办清单。通常情况下,在编写代码时你往往希望向计算机提供一组理论条件和一组操作指令,当满足每个条件时计算机就会采取这些操作。尽管使用条件语句以及数学和逻辑运算符进行流控制可以做很多事情,但是引入了函数和类之后,代码会变得更加高效,因为它们使你可以定义子程序。例如,如果应用程序非常频繁地需要一个确认对话框,那么将其作为类的实例编写一次要比每次需要它时重新编写实现起来要容易得多。 -代码不只是计算机的待办清单。通常情况下,在编写代码时您往往希望向计算机提供一组理论条件和一组操作指令,当满足每个条件时计算机就会采取这些操作。尽管使用条件语句以及数学和逻辑运算符进行流控制可以做很多事情,但是引入了函数和类之后,代码会变得更加高效,因为它们使您可以定义子程序。 例如,如果应用程序需要非常频繁地确认一个对话框,那么将其作为类的实例编写一次要比每次需要它时重新编写实现起来要容易得多。 - -您需要学习如何在编程语言中定义类和函数。更准确地说,您首先需要了解编程语言中是否支持类和函数。大多数现代语言都支持函数,但是类是面向对象的编程语言中所特有的。 +你需要学习如何在编程语言中定义类和函数。更准确地说,你首先需要了解编程语言中是否支持类和函数。大多数现代语言都支持函数,但是类是面向对象的编程语言中所特有的。 #### 实践 -学习语言中可用的结构,这些结构可以帮助您高效地编写和使用代码。 +学习语言中可用的结构,这些结构可以帮助你高效地编写和使用代码。 -### 您可以学到任何东西 +### 你可以学到任何东西 -学习编程语言,就其本身而言,是一种编码过程中的子程序。一旦理解了代码如何工作,您所使用的语言就只是一种传递逻辑的媒介。学习一门新语言的过程几乎都是一样的:通过简单的练习来学习语法,通过学习词汇来积累进行复杂动作的能力,然后练习、练习、再练习。 +学习编程语言,就其本身而言,是一种编码过程中的子程序。一旦理解了代码如何工作,你所使用的语言就只是一种传递逻辑的媒介。学习一门新编程语言的过程几乎都是一样的:通过简单的练习来学习语法,通过学习词汇来积累进行复杂动作的能力,然后练习、练习、再练习。 -------------------------------------------------------------------------------- @@ -176,7 +162,7 @@ via: https://opensource.com/article/20/10/learn-any-programming-language 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[xiao-song-123](https://github.com/xiao-song-123) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 2f31c7248a956acc06355652c28110d1758d1b27 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 19 Nov 2020 23:03:38 +0800 Subject: [PATCH 0832/1156] PUB @xiao-song-123 https://linux.cn/article-12842-1.html --- .../20201022 5 steps to learn any programming language.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201022 5 steps to learn any programming language.md (99%) diff --git a/translated/tech/20201022 5 steps to learn any programming language.md b/published/20201022 5 steps to learn any programming language.md similarity index 99% rename from translated/tech/20201022 5 steps to learn any programming language.md rename to published/20201022 5 steps to learn any programming language.md index 695bfab59a..e4fae4c258 100644 --- a/translated/tech/20201022 5 steps to learn any programming language.md +++ b/published/20201022 5 steps to learn any programming language.md @@ -1,8 +1,8 @@ [#]: collector: "lujun9972" [#]: translator: "xiao-song-123" [#]: reviewer: "wxy" -[#]: publisher: " " -[#]: url: " " +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12842-1.html" [#]: subject: "5 steps to learn any programming language" [#]: via: "https://opensource.com/article/20/10/learn-any-programming-language" [#]: author: "Seth Kenlon https://opensource.com/users/seth" From 7033d39583a5d99ebdd21b8ff94deecef44335f1 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 20 Nov 2020 05:02:52 +0800 Subject: [PATCH 0833/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201120?= =?UTF-8?q?=20How=20to=20Increase=20Disk=20Size=20of=20Your=20Existing=20V?= =?UTF-8?q?irtual=20Machines=20in=20VirtualBox?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201120 How to Increase Disk Size of Your Existing Virtual Machines in VirtualBox.md --- ...Existing Virtual Machines in VirtualBox.md | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 sources/tech/20201120 How to Increase Disk Size of Your Existing Virtual Machines in VirtualBox.md diff --git a/sources/tech/20201120 How to Increase Disk Size of Your Existing Virtual Machines in VirtualBox.md b/sources/tech/20201120 How to Increase Disk Size of Your Existing Virtual Machines in VirtualBox.md new file mode 100644 index 0000000000..f0240e9ad7 --- /dev/null +++ b/sources/tech/20201120 How to Increase Disk Size of Your Existing Virtual Machines in VirtualBox.md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Increase Disk Size of Your Existing Virtual Machines in VirtualBox) +[#]: via: (https://itsfoss.com/increase-disk-size-virtualbox/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +How to Increase Disk Size of Your Existing Virtual Machines in VirtualBox +====== + +Here’s the scenario you may come across sooner or later. + +You installed one or more operating systems in [VirtualBox][1]. While creating those virtual operating systems, you also created virtual hard disks for them in VirtualBox. + +You specified the maximum size of the virtual disk to say 15 or 20 GB but now after using it for some time, you realize that your virtual machine is running out of space. + +While [there are ways to free up disk space on Ubuntu][2] and other operating systems, a more robust way of handling the situation is to increase the disk size of your virtual machines created in VirtualBox. + +Yes, you can enlarge the virtual hard disk in VirtualBox even after creation. Although this is a safe and tested procedure, it is highly recommended to create a backup of your virtual machine before you perform such an action. + +### How to enlarge VirtualBox disk size + +![][3] + +I will show you how to resize disk in VirtualBox graphically and via command line (for Linux geeks). Both methods are easy and straightforward. + +#### Method 1: Using the Virtual Media Manager in VirtualBox + +VirtualBox 6 added a graphical option for resizing virtual disks. You can find it at the file tab of VirtualBox home page. + +Go to _**File->Virtual Media Manager**_: + +![][4] + +Select one of your virtual machines in the list and use the “Size” slider or type the size value that you need. Once done click “Apply”. + +![][5] + +Keep in mind that though you increased the size of your virtual disk, the **actual partition size remains the same if your space is dynamically allocated**. + +#### Method 2: Increase VirtualBox disk space using Linux command line + +If you are using a Linux operating system as a host, open the terminal and type the following command to resize VDI: + +``` +VBoxManage modifymedium "/path_to_vdi_file" --resize +``` + +The resize process should finish right after you click the enter button to execute the command. + +Note + +The commands **modifyvdi** and **modifyhd** of earlier versions of VirtualBox commands are also supported and mapped internally to the **modifymedium** command. + +![][6] + +If you are not sure where your virtual machines are saved, you can find the default location from the VirtualBox home page by clicking on **Files -> Preferences** or by using the keyboard shortcut **Ctrl+G**. + +![][7] + +#### Conclusion + +Personally, I prefer to use the terminal on every Linux distribution that I use for expanding disk, the graphical option is a very handy addition to the latest VirtualBox release. + +This is an easy and quick tip but a great addition to VirtualBox fundamentals. If you find this tip useful, check out a few features of [VirtualBox guest additions][8]. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/increase-disk-size-virtualbox/ + +作者:[Dimitrios Savvopoulos][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/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://www.virtualbox.org/ +[2]: https://itsfoss.com/free-up-space-ubuntu-linux/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/enlarge-disk-size-virtualbox.png?resize=800%2C450&ssl=1 +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/1-virtual-box-media-manager.png?resize=800%2C600&ssl=1 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/2-virtual-box-increase-disc-space.png?resize=800%2C505&ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/3-virtual-box-increase-disc-space-terminal.png?resize=800%2C600&ssl=1 +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/4-virtual-box-preferences.png?resize=800%2C450&ssl=1 +[8]: https://itsfoss.com/install-fedora-in-virtualbox/ From 21badcf98225456344051dd1174245ee98845724 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 20 Nov 2020 05:03:09 +0800 Subject: [PATCH 0834/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201119?= =?UTF-8?q?=20Automate=20your=20tasks=20with=20this=20Ansible=20cheat=20sh?= =?UTF-8?q?eet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201119 Automate your tasks with this Ansible cheat sheet.md --- ...our tasks with this Ansible cheat sheet.md | 224 ++++++++++++++++++ 1 file changed, 224 insertions(+) create mode 100644 sources/tech/20201119 Automate your tasks with this Ansible cheat sheet.md diff --git a/sources/tech/20201119 Automate your tasks with this Ansible cheat sheet.md b/sources/tech/20201119 Automate your tasks with this Ansible cheat sheet.md new file mode 100644 index 0000000000..4ef4961a33 --- /dev/null +++ b/sources/tech/20201119 Automate your tasks with this Ansible cheat sheet.md @@ -0,0 +1,224 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Automate your tasks with this Ansible cheat sheet) +[#]: via: (https://opensource.com/article/20/11/ansible-cheat-sheet) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Automate your tasks with this Ansible cheat sheet +====== +Start automating your repetitive tasks by getting to know Ansible's +modules, YAML structure, and more. +![Cheat Sheet cover image][1] + +Ansible is one of the primary tools in the world of [automation and orchestration][2] because of its broad usefulness and flexibility. However, those same traits are the very reason it can be difficult to get started with [Ansible][3]. It isn't a graphical application, and yet it also isn't a scripting or programming language. But like a programming language, the answer to the common question of "what can I do with it?" is "everything," which makes it difficult to know where to begin doing _anything_. + +Here's how I view Ansible: It's an "engine" that uses other people's modules to accomplish complex tasks you describe in a special "pseudo-code" text format called YAML. This means you need to have three things to get started with Ansible: + + 1. Ansible + 2. A repetitive task you want to automate + 3. A basic understanding of YAML + + + +This article aims to help you get started with these three things. + +### Install Ansible + +Part of Ansible's widespread popularity can be attributed to how it lets you (the user) completely ignore what operating system (OS) you're targeting. Generally, you don't have to think about whether your Ansible task will be executed on Linux, macOS, Windows, or BSD. Ansible takes care of the messy platform-specific bits for you. + +However, to _run_ Ansible, you do need to have Ansible installed somewhere. The computer where Ansible is installed is called the _control node_. Any computer that Ansible targets is called a _host_. + +Only the control node needs to have Ansible installed. + +If you're on Linux, you can install Ansible from your software repository with your package manager. + +As yet, Windows is unable to serve as an Ansible control node, although the more progress it makes toward [POSIX][4], the better things look for it, so keep a close watch on Microsoft's [Windows Subsystem for Linux (WSL)][5] product. + +On macOS, you can use a third-party package manager like [Homebrew][6] or [MacPorts][7]. + +### Ansible modules + +Ansible is just an engine. The parts that do 90% of the work are [Ansible modules][8]. These modules are programmed by lots of different people all over the world. Some have become so popular that the Ansible team adopts them and helps maintain them. + +As a user, much of your interaction with Ansible is directed to its modules. Choosing a module is like choosing an app on your phone or computer: you have a task you want done, so you look for an Ansible module that claims to assist. + +Most modules are tied to specific applications. For instance, the [file][9] module helps create and manage files. The [authorized_key][10] module helps manage SSH keys, [Database][11] modules help control and manipulate databases, and so on. + +Part of deciding on a task to offload onto Ansible is finding the module that will help you accomplish it. Ansible plays run _tasks_, and tasks consist of Ansible keywords or Ansible modules. + +### YAML and Ansible + +The YAML text format is a highly structured way to feed instructions to an application, making it almost a form of code. Like a programming language, you must write YAML according to a specific set of syntax rules. A YAML file intended for Ansible is called a _playbook_, and it consists of one or more Ansible _plays_. + +An Ansible play, like YAML, has a very limited structure. There are two kinds of instructions: a _sequence_ and a _mapping_. An Ansible play, as with YAML, always starts with 3 dashes (`---`). + +#### Sequences + +A _sequence_ element is a list. For example, here's a list of penguin species in YAML: + + +``` +\--- +\- Emperor +\- Gentoo +\- Yellow-eyed +\---- +``` + +#### Mapping + +A _mapping_ element consists of two parts: a key and a value. A _key_ in Ansible is usually a keyword defined by an Ansible module, and the value is sometimes Boolean (`true` or `false`) or some choice of parameters defined by the module, or something arbitrary, a variable, depending on what's being set. + +Here's a simple mapping in YAML: + + +``` +\--- +\- Name: "A list of penguin species" +\---- +``` + +#### Sequences and mapping + +These two data types aren't mutually exclusive. + +You can put a sequence into a mapping. In such a case, the sequence is a value for a mapping's key. When placing a sequence into a mapping, you indent the sequence so that it is a "descendent" (or "child") of its key: + + +``` +\--- +\- Penguins: + - Emperor +  - Gentoo +  - Yellow-eyed +\---- +``` + +You can also place mappings in a sequence: + + +``` +\--- +\- Penguin: Emperor +\- Mammal: Gnu +\- Planar: Demon +\---- +``` + +Those are all the rules you need to be familiar with to write valid YAML. + +### Write an Ansible play + +For Ansible plays, whether you use a sequence or a mapping (or a mapping in a sequence, or a sequence in a mapping) is dictated by Ansible or the Ansible module you're using. The "language" of Ansible mostly speaks to configuration options to help you determine how and where your play will run. A quick reference to all Ansible keywords is available in the [Ansible playbook documentation][12]. + +From the list of keywords, you can create an opening for your play. You start with three dashes because that's how a YAML file always starts. Then you give your play a name in a mapping block. You must also define what hosts (computers) you want the play to run on, and how Ansible is meant to reach the computer. + +For this example, I set the host to `localhost`, so the play runs only on _this_ computer, and the connection type to `local` (the default is `ssh`): + + +``` +\--- +\- name: "My first Ansible play" +  hosts: localhost +  connection: local +\---- +``` + +Most of the YAML you'll write in a play is probably configuration options for a specific Ansible module. To find out what instructions a module expects from your Ansible play, refer to that module's documentation. [Modules maintained by Ansible][8] are documented on Ansible's website. + +For this example, I'll use the debug module. + +![Documentation for Ansible debugger module][13] + +On [debug's documentation page][14], three parameters are listed: + + * `msg` is an optional string to print to the terminal. + * `var` is an optional variable, interpreted as a string. This is mutually exclusive with `msg`, so you can use one or the other—not both. + * `verbosity` is an integer you can use to control how verbose this debugger is. Its default is 0, so there is no threshold to pass. + + + +It's a simple module, but the thing to look for is the YAML data type of each parameter. Can you determine from my description whether these parameters are a sequence (a list) or a mapping (a key and value pair)? Knowing what kind of YAML block to use in your play helps you write valid plays. + +Here's a simple "hello world" Ansible play: + + +``` +\--- +\- name: "My first Ansible play" +  hosts: localhost +  connection: local +  tasks: +    - name: "Print a greeting" +      debug: +        msg: "Hello world" +\---- +``` + +Notice that the play contains a `task`. This task is a mapping that contains a sequence of exactly one item. The item in this task is `name` (and its value), the module being used by the task, and a `msg` parameter (along with its value). These are all part of the task mapping, so they're indented to show inheritance. + +You can test this Ansible play by using the `ansible-playbook` command with the `--check` option: + + +``` +$ ansible-playbook --check hello.yaml +PLAY [My first Ansible play] ************************* + +TASK [Gathering Facts] ******************************* +ok: [localhost] + +TASK [Print a greeting] ****************************** +ok: [localhost] => { +    "msg": "Hello world" +} + +PLAY RECAP ******************************************* +localhost: ok=2  changed=0  unreachable=0  failed=0 +``` + +It's verbose, but you can debug the message in your "Print a greeting" task, right where you put it. + +### Testing modules + +Using a new Ansible module is like trying out a new Linux command. You read its documentation, study its syntax, and then try some tests. + +There are at least two other modules you could use to write a "hello world" play: [assert][15] and [meta][16]. Try reading through the documentation for these modules, and see if you can create a simple test play based on what you learned above. + +For further examples of how modules are used to get work done, visit [Ansible Galaxy][17], an open source repository of community-contributed plays. + +### For a quick reference of important Ansible commands, download our [Ansible cheat sheet][18]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/ansible-cheat-sheet + +作者:[Seth Kenlon][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://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coverimage_cheat_sheet.png?itok=lYkNKieP (Cheat Sheet cover image) +[2]: https://opensource.com/article/20/11/orchestration-vs-automation +[3]: https://opensource.com/resources/what-ansible +[4]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains +[5]: https://docs.microsoft.com/en-us/windows/wsl/install-win10 +[6]: https://opensource.com/article/20/6/homebrew-mac +[7]: https://opensource.com/article/20/11/macports +[8]: https://docs.ansible.com/ansible/2.8/modules/modules_by_category.html +[9]: https://docs.ansible.com/ansible/2.8/modules/file_module.html#file-module +[10]: https://docs.ansible.com/ansible/2.8/modules/authorized_key_module.html#authorized-key-module +[11]: https://docs.ansible.com/ansible/2.8/modules/list_of_database_modules.html +[12]: https://docs.ansible.com/ansible/latest/reference_appendices/playbooks_keywords.html +[13]: https://opensource.com/sites/default/files/screenshot_from_2020-11-13_20-44-15.png (Documentation for Ansible debugger module) +[14]: https://docs.ansible.com/ansible/2.8/modules/debug_module.html +[15]: https://docs.ansible.com/ansible/2.8/modules/assert_module.html +[16]: https://docs.ansible.com/ansible/2.8/modules/meta_module.html +[17]: https://galaxy.ansible.com/ +[18]: https://opensource.com/downloads/ansible-cheat-sheet From 475fa148b7c3000a3e1a4cce3ed25cd0f2b28344 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 20 Nov 2020 05:03:22 +0800 Subject: [PATCH 0835/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201119?= =?UTF-8?q?=20The=20relationship=20between=20labor=20and=20open=20source?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201119 The relationship between labor and open source.md --- ...ationship between labor and open source.md | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 sources/tech/20201119 The relationship between labor and open source.md diff --git a/sources/tech/20201119 The relationship between labor and open source.md b/sources/tech/20201119 The relationship between labor and open source.md new file mode 100644 index 0000000000..bd600b76fe --- /dev/null +++ b/sources/tech/20201119 The relationship between labor and open source.md @@ -0,0 +1,51 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The relationship between labor and open source) +[#]: via: (https://opensource.com/article/20/11/working-public-review) +[#]: author: (Joshua Allen Holm https://opensource.com/users/holmja) + +The relationship between labor and open source +====== +Readers of all levels of involvement in open source will find value in +this informative and illustrative book. +![Stack of books for reading][1] + +The open source software ecosystem is a fascinating blend of personal passion projects and massive, collaborative corporate efforts. Sometimes there is even overlap when the passion projects are actually key components of the huge corporate projects or when a corporate project is abandoned by the original maintainers, but someone takes up the cause and makes it their personal passion project. Regardless of where an open source project falls on that spectrum, there is a lot of labor involved in the development and maintenance of open source projects. [_Working in Public: The Making and Maintenance of Open Source Software_][2] by Nadia Eghbal thoroughly examines the relationship between labor and open source. + +In addition to an introduction and conclusion, _Working in Public_ consists of five chapters split between two parts: "Part 1: How People Make" and "Part 2: How People Maintain." The first part covers "GitHub as a platform," "The Structure of an Open Source Project," and "Roles, Incentives, and Relationships." The second part explores "The Work Required by Software" and "Managing the Costs of Production." Each chapter deftly covers the topic at hand and provides copious footnotes and end-notes to support the information presented. + +** + +** + +** + +_![Book cover][3]_ + +_Working in Public_ begins with a brief overview of the history of open software development that covers the free software movement, the open source movement, and the modern, GitHub-centered version of open, which Eghbal notes is more focused on the practical aspects of open than philosophical aspects that are key parts of the free software and open source movements. The book provides a solid history of open source software development before transitioning to an examination of how things—and people—work in open source. There are many examples of the whys and the hows of working in open source, often including amusing analogies to make these complex topics easy to understand for readers who are not already enmeshed in open source. Eghbal’s writing manages to strike a balance between informative and entertaining. + +There is sometimes a tendency to treat coding as the only form of open source labor, but _Working in Public_ does not make that mistake. For example, there is an interesting discussion in the introduction about maintainers having to spend time dealing with minor pull requests instead of writing in-depth, substantive code of their own. Throughout the book, Eghbal explores labor in open source beyond just code. It provides valuable insights for readers of all levels and all manners of open source involvement—project maintainers, casual contributors, and users. + +The only flaw with _Working in Public_ is that it tries to serve as both an introduction to open source and an exploration of the labor involved in open source projects. This makes the book extremely approachable for readers with limited knowledge of open source, but that means that more experienced readers might find themselves skipping over lengthy passages that explain basic concepts. For example, half of the first full paragraph on page 12 is a parenthetical explanation of what software libraries are. The tendency to overexplain basic concepts does not distract from the overarching narrative too much, but it might turn some readers off before they get to the interesting parts. + +Overall, I really recommend picking up a copy of this book. It is enjoyable to read and does a good job of covering its topic, though there are issues brought up in some of the footnotes that are worthy of further exploration by the author or by other researchers. Even the parts of the book that overexplain basic concepts are interesting but, as noted above, may fail to capture the attention of readers who are already well versed in open source development. Minor issues aside, the book provides an engaging overview of the history of open source and an insightful examination of the labor involved in open source development. In short, _Working in Public_ is worth reading whether you are a maintainer, contributor, or user of open source. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/working-public-review + +作者:[Joshua Allen Holm][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://opensource.com/users/holmja +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/books_read_list_stack_study.png?itok=GZxb9OAv (Stack of books for reading) +[2]: https://www.amazon.com/dp/0578675862/ +[3]: https://opensource.com/sites/default/files/uploads/working_in_public.jpg (Book cover) From e8aaa5faa2d93a8c3b44eb937fda2ef36afd0c2b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 20 Nov 2020 05:03:35 +0800 Subject: [PATCH 0836/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201118?= =?UTF-8?q?=20Day=208:=20Start=20with=20something=20that=20works?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201118 Day 8- Start with something that works.md --- ... Day 8- Start with something that works.md | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 sources/tech/20201118 Day 8- Start with something that works.md diff --git a/sources/tech/20201118 Day 8- Start with something that works.md b/sources/tech/20201118 Day 8- Start with something that works.md new file mode 100644 index 0000000000..3ba5299dbd --- /dev/null +++ b/sources/tech/20201118 Day 8- Start with something that works.md @@ -0,0 +1,66 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Day 8: Start with something that works) +[#]: via: (https://jvns.ca/blog/2020/11/18/how-to-do-hard-projects--start-with-something-that-works/) +[#]: author: (Julia Evans https://jvns.ca/) + +Day 8: Start with something that works +====== + +Today at RC I’m a little stuck so here’s a very short reflection on how to do hard programming problems :) + +I was talking to a friend yesterday about how to do programming projects that are a bit out of your comfort zone, and I realized that there’s a pattern to how I approach new-to-me topics! Here I’m especially thinking about little side projects where you want to get the thing done pretty efficiently. + +When I start on a new project using some technology I haven’t worked with before, I often: + + 1. Find some code on the internet that already does something a little like what I want + 2. Incrementally modify that code until it does what I want, often completely changing everything about the original code in the process + + + +Here are a couple of quick thoughts about this process: + +### it’s important that the initial code _works_ + +Often when I’m out looking for examples, I’ll find a lot of code that I can’t get to work quickly, often because the code is kind of old and things have changed since then. Whenever possible, I try to find code that I can get to work on my computer pretty quickly. + +It’s been pretty helpful to me to give up relatively quickly on code that I can’t get to work right away and look for another example – often there is something out there that’s more recent and that I can get to work more quickly! + +### you have to be able to incrementally change the code into what you want + +Today I’ve been working with some neural network code, and one thing I’m really struggling with for the last couple of days is that I find it pretty easy to find somewhat relevant Jupyter notebooks that do RNN things, and pretty hard to modify those examples to do something closer to what I want. They keep breaking and I then don’t know how to fix them. + +Last week I was working on a Rails app, which I think is something that’s very easy to incrementally change into the program you want: `rails new` gives you a webserver that does almost nothing, but it works! And then you just need to change it one tiny step at a time into the website you want to build. + +### examples of “something that works” + + * If you want to write a window manager, [tinywm][1] is a window manager in 50 lines of C! + * this tiny kernel written in Rust that does nothing was a fun starting point for an operating system (probably it’s not a good starting point today) + * `rails new`, like I talked about above + * I love that projects let you “view source” on the backend of any Glitch project + * Jupyter notebooks, like [these great NLP tutorials by Allison Parrish][2] + + + +### that’s all! + +I think little starting points like this are so important and can be really magical. Finding the right starting point can be hard, but when I find a good one it makes everything so much easier! + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/11/18/how-to-do-hard-projects--start-with-something-that-works/ + +作者:[Julia Evans][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://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: http://incise.org/tinywm.html +[2]: https://twitter.com/aparrish/status/876117075567284225 From d3cf8fe1abfe5abe1c7f18f995d64d0f71fe1949 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 20 Nov 2020 08:32:37 +0800 Subject: [PATCH 0837/1156] translated --- ... encrypted disks on Linux automatically.md | 272 ------------------ ... encrypted disks on Linux automatically.md | 271 +++++++++++++++++ 2 files changed, 271 insertions(+), 272 deletions(-) delete mode 100644 sources/tech/20201116 Unlock encrypted disks on Linux automatically.md create mode 100644 translated/tech/20201116 Unlock encrypted disks on Linux automatically.md diff --git a/sources/tech/20201116 Unlock encrypted disks on Linux automatically.md b/sources/tech/20201116 Unlock encrypted disks on Linux automatically.md deleted file mode 100644 index d8460ba951..0000000000 --- a/sources/tech/20201116 Unlock encrypted disks on Linux automatically.md +++ /dev/null @@ -1,272 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Unlock encrypted disks on Linux automatically) -[#]: via: (https://opensource.com/article/20/11/nbde-linux) -[#]: author: (Curt Warfield https://opensource.com/users/rcurtiswarfield) - -Unlock encrypted disks on Linux automatically -====== -Open encrypted disks without having to manually enter a passcode by -using Network-Bound Disk Encryption (NBDE). -![Lock][1] - -From a security viewpoint, it's important to encrypt your sensitive data to protect it from prying eyes and hackers. Linux Unified Key Setup ([LUKS][2]) is a great tool and a common standard for Linux disk encryption. Because it stores all pertinent setup information in the partition header, it makes migrating data easy. - -To configure encrypted disks or partitions with LUKS, you will need to use the [cryptsetup][3] utility. Unfortunately, one of the downsides of encrypting your disks is that you have to manually provide the password every time the system is rebooted or the disk is remounted. - -However, Network-Bound Disk Encryption (NBDE) can automatically and securely unlock encrypted disks without any user intervention. It is available in several Linux distributions, beginning with Red Hat Enterprise Linux 7.4, CentOS 7.4, and Fedora 24, and in later versions of each. - -NBDE is implemented with the following technologies: - - * **[Clevis framework][4]:** A pluggable framework tool that automatically decrypts and unlocks LUKS volumes - * **[Tang server][5]:** A service for binding cryptographic keys to network presence - - - -Tang provides the encryption keys to the Clevis client. According to Tang's developers, this provides a secure, stateless, anonymous alternative to key escrow services. - -Because NBDE uses the client-server architecture, you must configure both the client and the server. You can use a virtual machine on your local network for your Tang server. - -### Server installation - -Install Tang using sudo: - - -``` -`sudo yum install tang -y` -``` - -Enable the Tang server: - - -``` -`sudo systemctl enable tangd.socket --now` -``` - -The Tang server works on port 80 and must be added to firewalld. Add the appropriate firewalld rule: - - -``` -sudo  firewall-cmd --add-port=tcp/80 --perm -sudo firewall-cmd --reload -``` - -The server should now be installed. - -### Client installation - -For this example, assume you have added a new 1GB disk named `/dev/vdc` to your system. - -Create the primary partition using fdisk or parted: - - -``` -sudo fdisk /dev/vdc -``` - -Complete the following steps to install the client. - - -``` -Welcome to fdisk (util-linux 2.23.2). - -Changes will remain in memory only, until you decide to write them. -Be careful before using the write command. - -Device does not contain a recognized partition table -Building a new DOS disklabel with disk identifier 0x4a6812d4. - -Command (m for help): -``` - -Enter **n** to create the new partition: - - -``` -Partition type: -   p   primary (0 primary, 0 extended, 4 free) -   e   extended   -Select (default p): -``` - -Hit the **Enter** key to select the primary partition: - - -``` -Using default response p -Partition number (1-4, default 1): -``` - -Hit the **Enter** key to select the default partition number: - - -``` -First sector (2048-2097151, default 2048): -Using default value 2048 -Last sector, +sectors or +size{K,M,G} (2048-2097151, default 2097151): -``` - -Hit the **Enter** key to select the last sector: - - -``` -Using default value 2097151 -Partition 1 of type Linux and of size 1023 MiB is set - -Command (m for help): wq -``` - -Type **wq** to save the changes and exit fdisk: - - -``` -The partition table has been altered! - -Calling ioctl() to re-read partition table. -Syncing disks. -``` - -Run `partprobe` to inform the system of the partition table changes: - - -``` -`sudo partprobe` -``` - -Install the cryptsetup package using sudo: - - -``` -`sudo yum install cryptsetup -y` -``` - -Use the `cryptsetup luksFormat` command to encrypt the disk. You will need to type **YES** when prompted and also choose and enter a passphrase to encrypt the disk: - - -``` -sudo cryptsetup luksFormat /dev/vdc1 -WARNING! -======== -This will overwrite data on /dev/vdc1 irrevocably. - -Are you sure? (Type uppercase yes): - -Enter passphrase for /dev/vdc1: -Verify passphrase: -``` - -Use the `cryptsetup luksOpen` command to map the encrypted partition to a logical device. For example, use `encryptedvdc1` as the name. You will also need to enter the passphrase again: - - -``` -sudo cryptsetup luksOpen /dev/vdc1 encryptedvdc1 -Enter passphrase for /dev/vdc1: -``` - -The encrypted partition is now available at `/dev/mapper/encryptedvdc1`. - -Create an XFS filesystem on the encrypted partition: - - -``` -`sudo mkfs.xfs /dev/mapper/encryptedvdc1` -``` - -Create a directory for mounting the encrypted partition: - - -``` -`sudo mkdir /encrypted` -``` - -Use the `cryptsetup luksClose` command to lock the partition: - - -``` -`cryptsetup luksClose encryptedvdc1` -``` - -Install the Clevis packages using sudo: - - -``` -`sudo yum install clevis clevis-luks clevis-dracut -y` -``` - -Modify /etc/crypttab to open the encrypted volume at boot time: - - -``` -`sudo vim /etc/crypttab` -``` - -Add the following line: - - -``` -`encryptedvdc1       /dev/vdc1  none   _netdev` -``` - -Modify /etc/fstab to automatically mount the encrypted volume during a reboot or at boot time: - - -``` -`sudo vim /etc/fstab` -``` - -Add the following line: - - -``` -`/dev/mapper/encryptedvdc1   /encrypted       xfs    _netdev        1 2` -``` - -For this example, assume the Tang server's IP address is `192.168.1.20`. You can also use the hostname or domain if you prefer. - -Run the following `clevis` command: - - -``` -sudo clevis bind luks -d /dev/vdc1 tang '{"url":"' -The advertisement contains the following signing keys: - -rwA2BAITfYLuyNiIeYUMBzkhk7M - -Do you wish to trust these keys? [ynYN] Y -Enter existing LUKS password: -``` - -Type **Y** to accept the keys for the Tang server and provide the existing LUKS password for the initial setup. - -Enable clevis-luks-askpass.path via systemctl in order to prevent being prompted for the passphrase for non-root partitions. - - -``` -`sudo systemctl enable clevis-luks-askpass.path` -``` - -The client is installed. Now, whenever you reboot the server, the encrypted disk should automatically be decrypted and mounted by retrieving the keys from the Tang server. - -If the Tang server is unavailable for any reason, you'll need to provide the passphrase manually in order to decrypt and mount the partition. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/11/nbde-linux - -作者:[Curt Warfield][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://opensource.com/users/rcurtiswarfield -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security-lock-password.jpg?itok=KJMdkKum (Lock) -[2]: https://en.wikipedia.org/wiki/Linux_Unified_Key_Setup -[3]: https://gitlab.com/cryptsetup/cryptsetup -[4]: https://github.com/latchset/clevis -[5]: https://github.com/latchset/tang diff --git a/translated/tech/20201116 Unlock encrypted disks on Linux automatically.md b/translated/tech/20201116 Unlock encrypted disks on Linux automatically.md new file mode 100644 index 0000000000..7e97ec99a6 --- /dev/null +++ b/translated/tech/20201116 Unlock encrypted disks on Linux automatically.md @@ -0,0 +1,271 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Unlock encrypted disks on Linux automatically) +[#]: via: (https://opensource.com/article/20/11/nbde-linux) +[#]: author: (Curt Warfield https://opensource.com/users/rcurtiswarfield) + +自动解锁 Linux 上的加密磁盘 +====== +通过使用网络绑定磁盘加密 (NBDE),无需手动输入密码即可打开加密磁盘。 +![Lock][1] + +从安全的角度来看,对敏感数据进行加密以保护其免受窥探和黑客的攻击是很重要的。Linux 统一密钥设置([LUKS][2])是一个很好的工具,也是 Linux 磁盘加密的通用标准。因为它将所有相关的设置信息存储在分区头中,所以它使数据迁移变得简单。 + +要使用 LUKS 配置加密磁盘或分区,你需要使用 [cryptsetup][3] 工具。不幸的是,加密磁盘的一个缺点是,每次系统重启或磁盘重新挂载时,你都必须手动提供密码。 + +然而,网络绑定磁盘加密 (NBDE) 可以在没有任何用户干预的情况下自动安全地解锁加密磁盘。它可以在一些 Linux 发行版中使用,从 Red Hat Enterprise Linux 7.4、CentOS 7.4 和 Fedora 24 开始,以及之后的后续版本。 + +NBDE 采用以下技术实现: + +* **[Clevis 框架][4]:**一个可插拔的框架工具,可自动解密和解锁 LUKS 卷 +* **[Tang 服务器][5]:**用于将加密密钥绑定到网络状态的服务 + + + +Tang 向 Clevis 客户端提供加密密钥。 据 Tang 的开发人员介绍,这为密钥托管服务提供了一个安全、无状态、匿名的替代方案。 + +由于 NBDE 使用客户端-服务器架构,你必须同时配置客户端和服务器。你可以在你的本地网络上使用一个虚拟机作为 Tang 服务器。 + +### 服务器安装 + +用 sudo 安装 Tang: + + +``` +`sudo yum install tang -y` +``` + +启用 Tang 服务器: + + +``` +`sudo systemctl enable tangd.socket --now` +``` + +Tang 服务器工作在 80 端口,且必须加入 firewalld。 添加相应的 firewalld 规则: + + +``` +sudo firewall-cmd --add-port=tcp/80 --perm +sudo firewall-cmd --reload +``` + +现在安装好了服务器。 + +### 客户端安装 + +在本例中,假设你已经添加了一个名为 `/dev/vdc` 的新的 1GB 磁盘到你的系统中。 + +使用 fdisk 或 parted 创建主分区: + + +``` +sudo fdisk /dev/vdc +``` + +完成以下步骤来安装客户端。 + + +``` +Welcome to fdisk (util-linux 2.23.2). + +Changes will remain in memory only, until you decide to write them. +Be careful before using the write command. + +Device does not contain a recognized partition table +Building a new DOS disklabel with disk identifier 0x4a6812d4. + +Command (m for help): +``` + +输入 **n** 来创建新的分区: + + +``` +Partition type: + p primary (0 primary, 0 extended, 4 free) + e extended +Select (default p): +``` + +按下**回车**键选择主分区: + + +``` +Using default response p +Partition number (1-4, default 1): +``` + +按下**回车**键选择默认分区号: + + +``` +First sector (2048-2097151, default 2048): +Using default value 2048 +Last sector, +sectors or +size{K,M,G} (2048-2097151, default 2097151): +``` + +按**回车**键选择最后一个扇区: + + +``` +Using default value 2097151 +Partition 1 of type Linux and of size 1023 MiB is set + +Command (m for help): wq +``` + +输入 **wq** 保存更改并退出 fdisk: + + +``` +The partition table has been altered! + +Calling ioctl() to re-read partition table. +Syncing disks. +``` + +运行 `partprobe` 通知系统分区表的变化: + + +``` +`sudo partprobe` +``` + +使用 sudo 安装 cryptsetup 软件包: + + +``` +`sudo yum install cryptsetup -y` +``` + +使用 `cryptsetup luksFormat` 命令对磁盘进行加密。当提示时,你需要输入 **YES**,并选择和输入密码来加密磁盘: + + +``` +sudo cryptsetup luksFormat /dev/vdc1 +WARNING! +======== +This will overwrite data on /dev/vdc1 irrevocably. + +Are you sure? (Type uppercase yes): + +Enter passphrase for /dev/vdc1: +Verify passphrase: +``` + +使用 `cryptsetup luksOpen` 命令将加密的分区映射到一个逻辑设备上。例如,使用 `encryptedvdc1` 作为名称。你还需要再次输入密码: + + +``` +sudo cryptsetup luksOpen /dev/vdc1 encryptedvdc1 +Enter passphrase for /dev/vdc1: +``` + +加密分区现在在 `/dev/mapper/encryptedvdc1` 中可用。 + +在加密的分区上创建一个 XFS 文件系统: + + +``` +`sudo mkfs.xfs /dev/mapper/encryptedvdc1` +``` + +创建一个挂载加密分区的目录: + + +``` +`sudo mkdir /encrypted` +``` + +使用 `cryptsetup luksClose` 命令锁定分区: + + +``` +`cryptsetup luksClose encryptedvdc1` +``` + +使用 sudo 安装 Clevis 软件包: + + +``` +`sudo yum install clevis clevis-luks clevis-dracut -y` +``` + +修改 /etc/crypttab,在启动时打开加密卷: + + +``` +`sudo vim /etc/crypttab` +``` + +增加以下一行: + + +``` +`encryptedvdc1 /dev/vdc1 none _netdev` +``` + +修改 /etc/fstab,在重启时或启动时自动挂载加密卷: + + +``` +`sudo vim /etc/fstab` +``` + +增加以下一行: + + +``` +`/dev/mapper/encryptedvdc1 /encrypted xfs _netdev 1 2` +``` + +在这个例子中,假设 Tang 服务器的 IP 地址是 `192.168.1.20`。如果你喜欢,也可以使用主机名或域名。 + +运行以下 `clevis` 命令: + + +``` +sudo clevis bind luks -d /dev/vdc1 tang '{"url":"' +The advertisement contains the following signing keys: + +rwA2BAITfYLuyNiIeYUMBzkhk7M + +Do you wish to trust these keys? [ynYN] Y +Enter existing LUKS password: +``` + +输入 **Y** 接受 Tang 服务器的密钥,并提供现有的 LUKS 密码进行初始设置。 + +通过 systemctl 启用 clevis-luks-askpass.path,以防止非 root 分区被提示输入密码。 + + +``` +`sudo systemctl enable clevis-luks-askpass.path` +``` + +客户端已经安装完毕。 现在,每当你重启服务器时,加密后的磁盘应该会自动解密,并通过 Tang 服务器取回密钥进行挂载。 + +如果 Tang 服务器因为任何原因不可用,你需要手动提供密码,才能解密和挂载分区。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/nbde-linux + +作者:[Curt Warfield][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/rcurtiswarfield +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security-lock-password.jpg?itok=KJMdkKum (Lock) +[2]: https://en.wikipedia.org/wiki/Linux_Unified_Key_Setup +[3]: https://gitlab.com/cryptsetup/cryptsetup +[4]: https://github.com/latchset/clevis +[5]: https://github.com/latchset/tang \ No newline at end of file From 78622bdd6e00d87aaa4592ec5da0259c1f024e3d Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 20 Nov 2020 08:38:06 +0800 Subject: [PATCH 0838/1156] translating --- sources/tech/20201106 Reclaim hard-drive space with LVM.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201106 Reclaim hard-drive space with LVM.md b/sources/tech/20201106 Reclaim hard-drive space with LVM.md index 14be3ae564..dcd1a96f7b 100644 --- a/sources/tech/20201106 Reclaim hard-drive space with LVM.md +++ b/sources/tech/20201106 Reclaim hard-drive space with LVM.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 40a26b26c3685f0bef8b403cdaf26863c137fcfc Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 20 Nov 2020 20:06:57 +0800 Subject: [PATCH 0839/1156] PUB @wxy https://linux.cn/article-12845-1.html --- .../20201111 Using Fedora 33 with Microsoft-s WSL2.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201111 Using Fedora 33 with Microsoft-s WSL2.md (98%) diff --git a/translated/tech/20201111 Using Fedora 33 with Microsoft-s WSL2.md b/published/20201111 Using Fedora 33 with Microsoft-s WSL2.md similarity index 98% rename from translated/tech/20201111 Using Fedora 33 with Microsoft-s WSL2.md rename to published/20201111 Using Fedora 33 with Microsoft-s WSL2.md index b94d6b5cdc..fb2f0d24bd 100644 --- a/translated/tech/20201111 Using Fedora 33 with Microsoft-s WSL2.md +++ b/published/20201111 Using Fedora 33 with Microsoft-s WSL2.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12845-1.html) [#]: subject: (Using Fedora 33 with Microsoft’s WSL2) [#]: via: (https://fedoramagazine.org/wsl-fedora-33/) [#]: author: (Jim Perrin https://fedoramagazine.org/author/jperrin/) From c68d8a821e691db363b3901c6b3b5a6036ede427 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 20 Nov 2020 21:06:53 +0800 Subject: [PATCH 0840/1156] APL --- sources/tech/20201023 Secure NTP with NTS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201023 Secure NTP with NTS.md b/sources/tech/20201023 Secure NTP with NTS.md index 00cfdfd20d..6572c0f133 100644 --- a/sources/tech/20201023 Secure NTP with NTS.md +++ b/sources/tech/20201023 Secure NTP with NTS.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From eb99ce38d2ffa66dad2b6206cb5d61e9e4ddfea1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 20 Nov 2020 23:00:32 +0800 Subject: [PATCH 0841/1156] TSL --- sources/tech/20201023 Secure NTP with NTS.md | 171 ------------------ .../tech/20201023 Secure NTP with NTS.md | 167 +++++++++++++++++ 2 files changed, 167 insertions(+), 171 deletions(-) delete mode 100644 sources/tech/20201023 Secure NTP with NTS.md create mode 100644 translated/tech/20201023 Secure NTP with NTS.md diff --git a/sources/tech/20201023 Secure NTP with NTS.md b/sources/tech/20201023 Secure NTP with NTS.md deleted file mode 100644 index 6572c0f133..0000000000 --- a/sources/tech/20201023 Secure NTP with NTS.md +++ /dev/null @@ -1,171 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Secure NTP with NTS) -[#]: via: (https://fedoramagazine.org/secure-ntp-with-nts/) -[#]: author: (Miroslav Lichvar https://fedoramagazine.org/author/mlichvar/) - -Secure NTP with NTS -====== - -![][1] - -Many computers use the Network Time Protocol (NTP) to synchronize their system clocks over the internet. NTP is one of the few unsecured internet protocols still in common use. An attacker that can observe network traffic between a client and server can feed the client with bogus data and, depending on the client’s implementation and configuration, force it to set its system clock to any time and date. Some programs and services might not work if the client’s system clock is not accurate. For example, a web browser will not work correctly if the web servers’ certificates appear to be expired according to the client’s system clock. Use Network Time Security (NTS) to secure NTP. - -Fedora 33[1][2] is the first Fedora release to support NTS. NTS is a new authentication mechanism for NTP. It enables clients to verify that the packets they receive from the server have not been modified while in transit. The only thing an attacker can do when NTS is enabled is drop or delay packets. See [RFC8915][3] for further details about NTS. - -NTP can be secured well with symmetric keys. Unfortunately, the server has to have a different key for each client and the keys have to be securely distributed. That might be practical with a private server on a local network, but it does not scale to a public server with millions of clients. - -NTS includes a Key Establishment (NTS-KE) protocol that automatically creates the encryption keys used between the server and its clients. It uses Transport Layer Security (TLS) on TCP port 4460. It is designed to scale to very large numbers of clients with a minimal impact on accuracy. The server does not need to keep any client-specific state. It provides clients with cookies, which are encrypted and contain the keys needed to authenticate the NTP packets. Privacy is one of the goals of NTS. The client gets a new cookie with each server response, so it doesn’t have to reuse cookies. This prevents passive observers from tracking clients migrating between networks. - -The default NTP client in Fedora is _chrony_. Chrony added NTS support in version 4.0. The default configuration hasn’t changed. Chrony still uses public servers from the [pool.ntp.org][4] project and NTS is not enabled by default. - -Currently, there are very few public NTP servers that support NTS. The two major providers are Cloudflare and Netnod. The [Cloudflare servers][5] are in various places around the world. They use anycast addresses that should allow most clients to reach a close server. The [Netnod servers][6] are located in Sweden. In the future we will probably see more public NTP servers with NTS support. - -A general recommendation for configuring NTP clients for best reliability is to have at least three working servers. For best accuracy, it is recommended to select close servers to minimize network latency and asymmetry caused by asymmetric network routing. If you are not concerned about fine-grained accuracy, you can ignore this recommendation and use any NTS servers you trust, no matter where they are located. - -If you do want high accuracy, but you don’t have a close NTS server, you can mix distant NTS servers with closer non-NTS servers. However, such a configuration is less secure than a configuration using NTS servers only. The attackers still cannot force the client to accept arbitrary time, but they do have a greater control over the client’s clock and its estimate of accuracy, which may be unacceptable in some environments. - -### Enable client NTS in the installer - -When installing Fedora 33, you can enable NTS in the _Time & Date_ dialog in the _Network Time_ configuration. Enter the name of the server and check the NTS support before clicking the **+** (Add) button. You can add one or more servers or pools with NTS. To remove the default pool of servers (_2.fedora.pool.ntp.org_), uncheck the corresponding mark in the _Use_ column. - -![Network Time configuration in Fedora installer][7] - -### Enable client NTS in the configuration file - -If you upgraded from a previous Fedora release, or you didn’t enable NTS in the installer, you can enable NTS directly in _/etc/chrony.conf_. Specify the server with the _nts_ option in addition to the recommended _iburst_ option. For example: - -``` -server time.cloudflare.com iburst nts -server nts.sth1.ntp.se iburst nts -server nts.sth2.ntp.se iburst nts -``` - -You should also allow the client to save the NTS keys and cookies to disk, so it doesn’t have to repeat the NTS-KE session on each start. Add the following line to _chrony.conf_, if it is not already present: - -``` -ntsdumpdir /var/lib/chrony -``` - -If you don’t want NTP servers provided by DHCP to be mixed with the servers you have specified, remove or comment out the following line in _chrony.conf_: - -``` -sourcedir /run/chrony-dhcp -``` - -After you have finished editing _chrony.conf_, save your changes and restart the _chronyd_ service: - -``` -systemctl restart chronyd -``` - -### Check client status - -Run the following command under the root user to check whether the NTS key establishment was successful: - -``` -# chronyc -N authdata -Name/IP address Mode KeyID Type KLen Last Atmp NAK Cook CLen -========================================================================= -time.cloudflare.com NTS 1 15 256 33m 0 0 8 100 -nts.sth1.ntp.se NTS 1 15 256 33m 0 0 8 100 -nts.sth2.ntp.se NTS 1 15 256 33m 0 0 8 100 -``` - -The _KeyID_, _Type_, and _KLen_ columns should have non-zero values. If they are zero, check the system log for error messages from _chronyd_. One possible cause of failure is a firewall is blocking the client’s connection to the server’s TCP port ( port 4460). - -Another possible cause of failure is a certificate that is failing to verify because the client’s clock is wrong. This is a chicken-or-the-egg type problem with NTS. You may need to manually correct the date or temporarily disable NTS in order to get NTS working. If your computer has a real-time clock, as almost all computers do, and it’s backed up by a good battery, this operation should be needed only once. - -If the computer doesn’t have a real-time clock or battery, as is common with some small ARM computers like the Raspberry Pi, you can add the _-s_ option to _/etc/sysconfig/chronyd_ to restore time saved on the last shutdown or reboot. The clock will be behind the true time, but if the computer wasn’t shut down for too long and the server’s certificates were not renewed too close to their expiration, it should be sufficient for the time checks to succeed. As a last resort, you can disable the time checks with the _nocerttimecheck_ directive. See the _chrony.conf(5)_ man page for details. - -Run the following command to confirm that the client is making NTP measurements: - -``` -# chronyc -N sources -MS Name/IP address Stratum Poll Reach LastRx Last sample -=============================================================================== -^* time.cloudflare.com 3 6 377 45 +355us[ +375us] +/- 11ms -^+ nts.sth1.ntp.se 1 6 377 44 +237us[ +237us] +/- 23ms -^+ nts.sth2.ntp.se 1 6 377 44 -170us[ -170us] +/- 22ms -``` - -The _Reach_ column should have a non-zero value; ideally 377. The value 377 shown above is an octal number. It indicates that the last eight requests all had a valid response. The validation check will include NTS authentication if enabled. If the value only rarely or never gets to 377, it indicates that NTP requests or responses are getting lost in the network. Some major network operators are known to have middleboxes that block or limit rate of large NTP packets as a mitigation for amplification attacks that exploit the monitoring protocol of _ntpd_. Unfortunately, this impacts NTS-protected NTP packets, even though they don’t cause any amplification. The NTP working group is considering an alternative port for NTP as a workaround for this issue. - -### Enable NTS on the server - -If you have your own NTP server running _chronyd_, you can enable server NTS support to allow its clients to be synchronized securely. If the server is a client of other servers, it should use NTS or a symmetric key for its own synchronization. The clients assume the synchronization chain is secured between all servers up to the primary time servers. - -Enabling server NTS is similar to enabling HTTPS on a web server. You just need a private key and certificate. The certificate could be signed by the Let’s Encrypt authority using the _certbot_ tool, for example. When you have the key and certificate file (including intermediate certificates), specify them in _chrony.conf_ with the following directives: - -``` -ntsserverkey /etc/pki/tls/private/foo.example.net.key -ntsservercert /etc/pki/tls/certs/foo.example.net.crt -``` - -Make sure the _ntsdumpdir_ directive mentioned previously in the client configuration is present in _chrony.conf_. It allows the server to save its keys to disk, so the clients of the server don’t have to get new keys and cookies when the server is restarted. - -Restart the _chronyd_ service: - -``` -systemctl restart chronyd -``` - -If there are no error messages in the system log from _chronyd_, it should be accepting client connections. If the server has a firewall, it needs to allow both the UDP 123 and TCP 4460 ports for NTP and NTS-KE respectively. - -You can perform a quick test from a client machine with the following command: - -``` -$ chronyd -Q -t 3 'server foo.example.net iburst nts maxsamples 1' -2020-10-13T12:00:52Z chronyd version 4.0 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +NTS +SECHASH +IPV6 +DEBUG) -2020-10-13T12:00:52Z Disabled control of system clock -2020-10-13T12:00:55Z System clock wrong by -0.001032 seconds (ignored) -2020-10-13T12:00:55Z chronyd exiting -``` - -If you see a _System clock wrong_ message, it’s working correctly. - -On the server, you can use the following command to check how many NTS-KE connections and authenticated NTP packets it has handled: - -``` -# chronyc serverstats -NTP packets received : 2143106240 -NTP packets dropped : 117180834 -Command packets received : 16819527 -Command packets dropped : 0 -Client log records dropped : 574257223 -NTS-KE connections accepted: 104 -NTS-KE connections dropped : 0 -Authenticated NTP packets : 52139 -``` - -If you see non-zero _NTS-KE connections accepted_ and _Authenticated NTP packets_, it means at least some clients were able to connect to the NTS-KE port and send an authenticated NTP request. - -_— Cover photo by Louis. K on Unsplash —_ - -* * * - -1\. The Fedora 33 _Beta_ installer contains an older chrony prerelease which doesn’t work with current NTS servers because the NTS-KE port has changed. Consequently, in the Network Time configuration in the installer, the servers will always appear as not working. After installation, the chrony package needs to be updated before it will work with current servers. - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/secure-ntp-with-nts/ - -作者:[Miroslav Lichvar][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/mlichvar/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2020/10/secure-ntp-with-nts-816x345.jpg -[2]: tmp.rl0XC1HIGm#footnote1 -[3]: https://tools.ietf.org/html/rfc8915 -[4]: https://www.pool.ntp.org -[5]: https://developers.cloudflare.com/time-services/nts/usage -[6]: https://www.netnod.se/time-and-frequency/how-to-use-nts -[7]: https://fedoramagazine.org/wp-content/uploads/2020/10/anaconda-nts.png diff --git a/translated/tech/20201023 Secure NTP with NTS.md b/translated/tech/20201023 Secure NTP with NTS.md new file mode 100644 index 0000000000..2146e717e2 --- /dev/null +++ b/translated/tech/20201023 Secure NTP with NTS.md @@ -0,0 +1,167 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Secure NTP with NTS) +[#]: via: (https://fedoramagazine.org/secure-ntp-with-nts/) +[#]: author: (Miroslav Lichvar https://fedoramagazine.org/author/mlichvar/) + +用 NTS 保证 NTP 的安全 +====== + +![][1] + +许多计算机使用网络时间协议Network Time Protocol(NTP)通过互联网同步系统时钟。NTP 是少数几个仍在普遍使用的不安全的互联网协议之一。攻击者如果能够观察到客户端和服务器之间的网络流量,就可以向客户端提供虚假的数据,并根据客户端的实现和配置,强迫其将系统时钟设置为任何时间和日期。如果客户端的系统时钟不准确,一些程序和服务可能无法工作。例如,如果根据客户端的系统时钟,Web 服务器的证书似乎已经过期,Web 浏览器将无法正常工作。可以使用网络时间安全Network Time Security(NTS)来保证 NTP 的安全。 + +Fedora 33 [^1] 是第一个支持 NTS 的 Fedora 版本。NTS 是一种新的 NTP 验证机制。它使客户端能够验证他们从服务器接收的数据包在传输过程中有没有被修改。当 NTS 启用时,攻击者唯一能做的就是丢弃或延迟数据包。关于 NTS 的更多细节,请参见 [RFC8915][3]。 + +使用对称密钥可以很好地保证 NTP 的安全。遗憾的是,服务器必须为每个客户端配备不同的密钥,而且密钥必须安全地分发。这对于本地网络上的私有服务器来说可能是实用的,但它不能扩展到有着数百万客户端的公共服务器上。 + +NTS 包括一个密钥建立Key Establishment(NTS-KE)协议,它可以自动创建服务器与其客户端之间使用的加密密钥。它在 TCP 端口 4460 上使用传输层安全Transport Layer Security(TLS)。它被设计成可以扩展到非常多的客户端,而对准确性的影响最小。服务器不需要保存任何客户端特定的状态。它为客户提供 cookie,cookie 是加密的,包含验证 NTP 数据包所需的密钥。隐私是 NTS 的目标之一。客户端在每次服务器响应时都会得到一个新的 cookie,所以它不必重复使用 cookie。这可以防止被动观察者跟踪在网络之间迁移的客户端。 + +Fedora 中默认的 NTP 客户端是 Chrony。Chrony 在 4.0 版本中增加了 NTS 支持,但并没有改变默认配置。Chrony 仍然使用 [pool.ntp.org][4] 项目中的公共服务器,而且默认情况下 NTS 没有启用。 + +目前,支持 NTS 的公共 NTP 服务器非常少。两个主要的提供商是 Cloudflare 和 Netnod。[Cloudflare 服务器][5]分布在世界各地的不同地方。他们使用的是任播anycast地址,应该可以让大多数客户到达一个接近的服务器。[Netnod 服务器][6]位于瑞典。在未来,我们可能会看到更多支持 NTS 的公共 NTP 服务器。 + +为了获得最佳的可靠性,配置 NTP 客户端的一般建议是至少有三个工作的服务器。为了达到最好的精度,建议选择距离较近的服务器,以减少网络延迟和非对称网络路由造成的不对称性。如果你不关心细粒度的精度,你可以忽略这个建议,使用任何你信任的 NTS 服务器,无论它们位于哪里。 + +如果你确实想要高准确度,但又没有近距离的 NTS 服务器,你可以将远处的 NTS 服务器和近处的非 NTS 服务器混合使用。但是,这样的配置不如只使用 NTS 服务器的配置安全。攻击者仍然不能强迫客户机接受任意时间,但他们确实对客户机的时钟及其估计精度有更大的控制权,这在某些环境下可能是不可接受的。 + +### 在安装程序中启用客户端 NTS + +安装 Fedora 33 时,你可以在“Network Time”配置的“Time & Date”对话框中启用 NTS。在点击“+”(添加)按钮之前,请输入服务器的名称并检查 NTS 支持情况。你可以添加一个或多个具有 NTS 的服务器或池。要删除默认的服务器池(`2.fedora.pool.ntp.org`),请取消选中“Use”列中的相应标记。 + +![Fedora 安装程序中的网络时间配置][7] + +### 在配置文件中启用客户端 NTS + +如果你从之前的 Fedora 版本升级,或者你没有在安装程序中启用 NTS,你可以直接在 `/etc/chrony.conf` 中启用 NTS。除了推荐的 `iburst` 选项外,还可以对指定服务器使用 `nts` 选项。例如: + +``` +server time.cloudflare.com iburst nts +server nts.sth1.ntp.se iburst nts +server nts.sth2.ntp.se iburst nts +``` + +你还应该允许客户端将 NTS 密钥和 cookie 保存到磁盘上,这样它就不必在每次启动时重复 NTS-KE 会话。在 `chrony.conf` 中添加以下一行,如果还没有的话: + +``` +ntsdumpdir /var/lib/chrony +``` + +如果不想让 DHCP 提供的 NTP 服务器与你指定的服务器混在一起,请在 `chrony.conf` 中删除或注释以下一行: + +``` +sourcedir /run/chrony-dhcp +``` + +当你完成编辑 `chrony.conf` 后,保存你的更改并重新启动 `chronyd` 服务: + +``` +systemctl restart chronyd +``` + +### 检查客户端状态 + +在 root 用户下运行以下命令,检查 NTS 密钥建立是否成功: + +``` +# chronyc -N authdata +Name/IP address Mode KeyID Type KLen Last Atmp NAK Cook CLen +========================================================================= +time.cloudflare.com NTS 1 15 256 33m 0 0 8 100 +nts.sth1.ntp.se NTS 1 15 256 33m 0 0 8 100 +nts.sth2.ntp.se NTS 1 15 256 33m 0 0 8 100 +``` + +`KeyID`、`Type` 和 `KLen` 列应该有非零值。如果它们为零,请检查系统日志中是否有来自 `chronyd` 的错误信息。一个可能的故障原因是防火墙阻止了客户端与服务器的 TCP 端口(端口 4460)的连接。 + +另一个可能的故障原因是由于客户机的时钟错误而导致证书无法验证。这是 NTS 的先有鸡还是先有蛋的问题。你可能需要手动修正日期或暂时禁用 NTS,以使 NTS 正常工作。如果你的电脑有实时时钟,几乎所有的电脑都有,而且有好的电池做备份,这种操作应该只需要一次。 + +如果计算机没有实时时钟或电池,就像一些常见的小型 ARM 计算机(如树莓派)那样,你可以在 `/etc/sysconfig/chronyd` 中添加 `-s` 选项来恢复上次关机或重启时保存的时间。时钟会落后于真实时间,但如果电脑没有关机太久,服务器的证书也没有在离到期时间太近的时候更新,应该足以让时间检查成功。作为最后的手段,你可以用 `nocerttimecheck` 指令禁用时间检查。详情请参见`chrony.conf(5)` 手册页。 + +运行下面的命令来确认客户端是否在进行 NTP 测量: + +``` +# chronyc -N sources +MS Name/IP address Stratum Poll Reach LastRx Last sample +=============================================================================== +^* time.cloudflare.com 3 6 377 45 +355us[ +375us] +/- 11ms +^+ nts.sth1.ntp.se 1 6 377 44 +237us[ +237us] +/- 23ms +^+ nts.sth2.ntp.se 1 6 377 44 -170us[ -170us] +/- 22ms +``` + +`Reach` 列应该有一个非零值,最好是 377。上图所示的值 377 是一个八进制数,它表示最后八个请求都有有效的响应。如果启用了 NTS 的话,验证检查将包括 NTS 认证。如果该值一直很少或从未达到 377,则表明 NTP 请求或响应在网络中丢失了。众所周知,一些主要的网络运营商有中间机器,它可以阻止或限制大的 NTP 数据包的速率,以缓解利用 `ntpd` 的监控协议进行的放大攻击。不幸的是,这影响了受 NTS 保护的 NTP 数据包,尽管它们不会引起任何放大。NTP 工作组正在考虑为 NTP 提供一个替代端口,作为解决这个问题的办法。 + +### 在服务器上启用 NTS + +如果你有自己的 NTP 服务器,运行着 `chronyd`,你可以启用服务器的 NTS 支持,让它的客户端安全同步。如果该服务器是其他服务器的客户端,它应该使用 NTS 或对称密钥与之同步。客户端假设同步链在所有服务器到主时间服务器之间是安全的。 + +启用服务器 NTS 类似于在 Web 服务器上启用HTTPS。你只需要一个私钥和证书。例如,证书可以由 Let's Encrypt 权威机构使用 `certbot` 工具签署。当你有了密钥和证书文件(包括中间证书),在 `chrony.conf` 中用以下指令指定它们: + +``` +ntsserverkey /etc/pki/tls/private/foo.example.net.key +ntsservercert /etc/pki/tls/certs/foo.example.net.crt +``` + +确保之前在客户端配置中提到的 `ntsdumpdir` 指令存在于 `chrony.conf` 中。它允许服务器将其密钥保存到磁盘上,这样服务器的客户端在重启服务器时就不必获取新的密钥和 cookie 了。 + +重新启动 `chronyd` 服务: + +``` +systemctl restart chronyd +``` + +如果系统日志中没有来自 `chronyd` 的错误信息,那么它应该是可以接受客户端连接的,如果服务器有防火墙,则需要同时允许 UDP 123 和 TCP 4460 端口的 NTP 和 NTS-KE 服务。 + +你可以用下面的命令在客户端机器上进行快速测试: + +``` +$ chronyd -Q -t 3 'server foo.example.net iburst nts maxsamples 1' +2020-10-13T12:00:52Z chronyd version 4.0 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +NTS +SECHASH +IPV6 +DEBUG) +2020-10-13T12:00:52Z Disabled control of system clock +2020-10-13T12:00:55Z System clock wrong by -0.001032 seconds (ignored) +2020-10-13T12:00:55Z chronyd exiting +``` + +如果你看到一个“System clock wrong”消息,说明它是正确工作的。 + +在服务器上,你可以使用下面的命令来检查它已经处理了多少个 NTS-KE 连接和认证的 NTP 数据包: + +``` +# chronyc serverstats +NTP packets received : 2143106240 +NTP packets dropped : 117180834 +Command packets received : 16819527 +Command packets dropped : 0 +Client log records dropped : 574257223 +NTS-KE connections accepted: 104 +NTS-KE connections dropped : 0 +Authenticated NTP packets : 52139 +``` + +如果你看到非零的 “NTS-KE connections accepted” 和 “Authenticated NTP packets”,这意味着至少有一些客户端能够连接到 NTS-KE 端口,并发送一个认证的 NTP 请求。 + +[^1]: Fedora 33 Beta 安装程序包含一个较旧的 Chrony 预发布版本,它不能与当前的 NTS 服务器一起工作,因为 NTS-KE 端口已经改变。因此,在安装程序中的网络时间配置中,服务器总是显示为不工作。安装后,需要更新 chrony 包,才能与当前的服务器配合使用。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/secure-ntp-with-nts/ + +作者:[Miroslav Lichvar][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://fedoramagazine.org/author/mlichvar/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/10/secure-ntp-with-nts-816x345.jpg +[2]: tmp.rl0XC1HIGm#footnote1 +[3]: https://tools.ietf.org/html/rfc8915 +[4]: https://www.pool.ntp.org +[5]: https://developers.cloudflare.com/time-services/nts/usage +[6]: https://www.netnod.se/time-and-frequency/how-to-use-nts +[7]: https://fedoramagazine.org/wp-content/uploads/2020/10/anaconda-nts.png From dc7192f7ef219efbdbb4f790edabb53efd00f1cf Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 21 Nov 2020 05:02:56 +0800 Subject: [PATCH 0842/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201120?= =?UTF-8?q?=20How=20we=20develop=20success=20metrics=20for=20open=20source?= =?UTF-8?q?=20events?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201120 How we develop success metrics for open source events.md --- ... success metrics for open source events.md | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 sources/tech/20201120 How we develop success metrics for open source events.md diff --git a/sources/tech/20201120 How we develop success metrics for open source events.md b/sources/tech/20201120 How we develop success metrics for open source events.md new file mode 100644 index 0000000000..392164e686 --- /dev/null +++ b/sources/tech/20201120 How we develop success metrics for open source events.md @@ -0,0 +1,98 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How we develop success metrics for open source events) +[#]: via: (https://opensource.com/article/20/11/chaoss-open-source-events) +[#]: author: (Neofytos Kolokotronis https://opensource.com/users/neofytosk) + +How we develop success metrics for open source events +====== +The CHAOSS App Ecosystem Working Group is establishing ways to measure +how well virtual and in-person events meet their goals. +![Metrics and a graph illustration][1] + +As many open source communities grow larger and older, they may face problems managing members' engagement. People turn towards metrics to understand large systems and prioritize resources, but there has not been a consensus set of metrics for understanding open source communities. + +The Community Health Analytics Open Source Software ([CHAOSS][2]) project, a Linux Foundation-sponsored community of industry professionals and academics, is working to solve this problem by defining metrics for open source projects. The CHAOSS project focused first on developing metrics for open source event organizers because open source communities often depend on events like hackathons, meetups, conferences, and user group meetings to grow their communities and work on important project updates. + +The [CHAOSS App Ecosystem Working Group][3], which developed the metrics for events and worked together on this article, is comprised of [members][4] who have organized and participated in many open source events. While we developed these metrics to help the GNOME and KDE communities, we believe they can help other open source event organizers create their own metrics strategy. We also hope that more people will be inspired by this work and join us to improve it. + +### How we began + +The CHAOSS App Ecosystem Working Group emerged from the [SCALE 18x][5] conference in March 2020, when CHAOSS and GNOME members began talking about how to measure the [Linux App Summit][6] (LAS) community, an event co-hosted by GNOME and KDE.  + +We realized that we did not have sufficient data to measure our progress towards LAS's goals, and that hindered our ability to make important decisions to support those goals. For LAS (and the whole Linux app ecosystem) to thrive, we recognized the need to be more data-driven in our approach. We also realized the importance of extending this mindset to other similarly organized communities. + +From our experience at [CHAOSScon][7], we found opportunities to partner with the CHAOSS community around open source metrics. Therefore, we organized ourselves under the CHAOSS project, which provides a platform for working on metrics. + +We chose the name App Ecosystem Working Group because one of the GNOME and KDE communities' primary goals is to grow the Linux app ecosystem. Although we had the GNOME and KDE communities in mind at the start, we are creating the metrics to help everyone involved in the effort to grow the Linux app ecosystem. + +We chose to begin with the event organizer use case because of the nature of events: Events tend to have clearly defined boundaries, with a set start and end date, a list of registered attendees, and activities like talks, presentations, and workshops. This clarity does not generally exist in open source projects and communities, where the various projects, contributors, and users are less often strictly defined. + +The GNOME and KDE communities both had events coming up in 2020, so we believed we could iterate faster using feedback gathered from the events we organized, separately and together. + +### Approach to data gathering + +The CHAOSS project uses the [goal-question-metric][8] (GQM) approach to gathering data. One problem with metrics is that often we try to measure everything without understanding how the data will be helpful. But data should help inform decisions. Therefore, the GQM approach starts with a list of high-level goals that are important to a particular persona. + +The goals are the community's strategic objectives. For each goal, we look at questions that help determine whether we are achieving the goal. Metrics then provide quantitative information that helps answer those questions. + +Before diving into metrics, the App Ecosystem Working Group brainstormed goals and the personas that those goals affect. We collected [17 different goals][9], spread across seven stakeholder personas, that a community or project ecosystem might have. + +We collected and curated these goals from community members' experience in major open source projects like GNOME and KDE. Although each community is different, we think most of these goals are relevant to and will help a wide variety of open source projects. + +### Metrics for event organizers + +The [full list of metrics for event organizers][10] focus on three goals that event organizers care about: + + * Attracting and retaining contributors + * Understanding company contributions to an event + * Ensuring events contribute towards diversity goals and closing skill gaps in the community + + + +We came up with 19 questions that event organizers have about how well they are doing in reaching these goals. The metrics are directly linked to these questions to give the event organizers actionable insights. + +### Privacy implications + +While this work was developed by and for the GNOME and KDE communities, we hope that the metrics will help other open source communities. + +While GNOME and KDE have not implemented the metrics yet (and do not yet have a timeline to do so), one known limitation is privacy concerns around data collection. Every geographic location has laws that may limit data collection, which open source and free software projects must take into account. + +Once GNOME and KDE implement these metrics in their communities, they plan to share the legal considerations they took into account. + +### Join us + +We are hopeful that these metrics will be useful to open source event organizers interested in integrating virtual and in-person events into their community-building and engagement strategies. + +If you'd like to participate in developing these metrics, we welcome your experience, insight, and voice! The CHAOSS App Ecosystem Working Group [meets biweekly][11]; please join us. + +You can also communicate with us asynchronously through our [GitHub repository][3]. For more information on other ways to contribute or connect with us, we encourage you to visit the [CHAOSS community participation page][12]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/chaoss-open-source-events + +作者:[Neofytos Kolokotronis][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://opensource.com/users/neofytosk +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_graph_stats_blue.png?itok=OKCc_60D (Metrics and a graph illustration) +[2]: https://chaoss.community/ +[3]: https://github.com/chaoss/wg-app-ecosystem +[4]: https://github.com/chaoss/wg-app-ecosystem#contributors +[5]: https://www.socallinuxexpo.org/scale/18x +[6]: https://linuxappsummit.org/ +[7]: https://chaoss.community/chaosscon-2020-eu/ +[8]: https://en.wikipedia.org/wiki/GQM +[9]: https://docs.google.com/document/d/1ghREXIO5C9PLiwXMtouOR4AjPLGz9pD34LIxO8N2-xo/edit +[10]: https://github.com/chaoss/wg-app-ecosystem/blob/master/event-organizers.md +[11]: https://github.com/chaoss/wg-app-ecosystem#workflow +[12]: https://chaoss.community/participate From a14e9e4c31cd7ce81c451a7221f930ba40baa491 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 21 Nov 2020 05:03:09 +0800 Subject: [PATCH 0843/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201120?= =?UTF-8?q?=20What=20do=20open=20source=20product=20teams=20do=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201120 What do open source product teams do.md --- ...20 What do open source product teams do.md | 113 ++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 sources/tech/20201120 What do open source product teams do.md diff --git a/sources/tech/20201120 What do open source product teams do.md b/sources/tech/20201120 What do open source product teams do.md new file mode 100644 index 0000000000..c227ff3b8e --- /dev/null +++ b/sources/tech/20201120 What do open source product teams do.md @@ -0,0 +1,113 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What do open source product teams do?) +[#]: via: (https://opensource.com/article/20/11/open-source-product-teams) +[#]: author: (Scott McCarty https://opensource.com/users/fatherlinux) + +What do open source product teams do? +====== +Product managers play an essential role in creating differentiated value +that customers will pay for. +![a checklist for a team][1] + +If you go to any hip product management conference, you'll hear about product teams. At a minimum, a product team has a product manager, but it often includes roles in marketing, technical architecture, and even user experience (UX). Previous articles in this series have covered [open source as a supply chain model][2] and [defining products in the open source software supply chain][3], and this article specifically focuses on the role of product management within the product team. + +### Who's on the product team? + +Product managers and product marketing managers are the two most common product management roles, but product management can be further split into any number of roles, including competitive analysis, business strategy, sales enablement, revenue growth, content creation, sales tools, and more. With a very large product, even the product management role may be broken up into separate roles. You may even hear titles like technical marketing manager, product evangelist, and business owner, not to mention people-management roles for groups of individual contributor roles. For the purpose of this article, I refer to all of these roles collectively as "product management." + +Product management is a [tough career][4], and there are many frameworks for learning and understanding it. One of the oldest and most mature is the [Pragmatic Framework][5], which defines 37 different areas of responsibility. The Pragmatic Framework is a bit too complex for this article. Instead, I'll emphasize a subset of tasks that are applicable in open source products: + + * **Market problems:** Talk to customers and figure out what they need + * **Product roadmap:** Determine what features will be added to the product and when + * **Build:** Invest in building technology in-house + * **Buy:** Purchase technology from another company + * **Partner:** Deliver a solution to a customer by leveraging a partner's technology + * **Pricing:** Determine the price + * **Packaging:** Determine what's included in the price + * **Channel training:** Train the salespeople so that they can educate potential customers + + + +The rest of this series will look into how these different roles affect and are affected by an open source supply chain. + +### Build, buy, or partner? + +Which is more important, the business need or the technology? This is probably the classic paradox of business strategy. The answer is neither. Execution is what matters. The product management team is tasked with creating and retaining customers. This can be done by building technology, buying technology, or partnering to acquire technology or services that, when combined, provide value to customers. For example, if customers need an encryption feature that's missing from a software product, the product manager can: + + * Ask engineering to build it, test it, document it, and maintain it. + * Influence the executive team to buy a company or software package that provides it. (However, less than 2% of product managers have access to P&L data, [much less the budget to buy companies][6].) + * Deliver it to the customer through a verified partner. If a partner already provides a solution, this is the quickest way to deliver a solution, but it could raise the product's price or require the customer to purchase additional software. + + + +With traditional proprietary software products and services, this could mean building, buying, or partnering for a foundational piece of software, like a database. With products built on open source software, this can be thought of as choosing an open source project as a supplier. The purchase is made by contributing engineering time, code, documentation, testing, infrastructure, etc. Because open source is not free as in beer, somebody has to write it, test it, document it, etc. It's very difficult to provide value to customers if you don't contribute upstream. + +This combination of built, bought, and partner-delivered capabilities is what differentiates a product, whether open source or proprietary. Proprietary licensing does not differentiate a product. Let me repeat: _proprietary licensing does not differentiate a product_. People confuse proprietary licensing with providing value to a customer. Proprietary licenses are a perfectly valid and useful way to monetize users, but they do not provide customers with more value. Licenses do not create value; they help extract it. If you believe [open core][7] or hybrid licensing are the only way to make money with open source, read this paragraph five times until it sinks in (hint, focus on creating value). + +Both open source and proprietary products must create value. Customers buy capabilities as part of a solution (i.e., new things they couldn't do before). If product management spends more brainpower on delivering capabilities than determining what can be held back with proprietary licensing, the customer will be happier, more loyal, and receive more value. + +### Types of products built on open source + +Most modern software products are delivered by adding new value to the value provided by the open source supply chain. This could include extra downstream testing, documentation, quality engineering, performance testing, security testing, industry certifications, a partner ecosystem, training, professional services, or even extra proprietary code not included upstream (open core). By considering this new model, many of the old debates about open source can be clarified: + + * **Open source products:** The entire supply chain of code that goes into the product is open source. This can include multiple upstream projects like enterprise Linux distributions or sophisticated products like [Red Hat Satellite][8] or [OpenShift][9]. + * **Open core products:** Some of the supply chain of code that goes into the product is open source while other parts are proprietary. This mix of licensing can be used to control pricing, packaging, and distribution. It can also have the downside of putting engineering contributions to the product at odds with the open source supply chain (see _[Goodbye open core—good riddance to bad rubbish][10]_). + * **Paid software-as-a-service products:** The supply chain of SaaS products can be made up of open source languages and libraries, while the business logic built in-house is often proprietary. This allows product managers to tightly control pricing and packaging through very measurable distribution channels. There are many examples of online companies using this model, including customer resource management platforms, databases, caching layers, identity management, document management, and office and email solutions. + * **Free SaaS products:** The supply chain of free SaaS products (e.g., Facebook, Google Search, YouTube, etc.) is essentially the same as paid SaaS products. Instead of tightly controlling the pricing and packaging, the product is monetized through user data or advertisements. + * **Cloud providers vs. software vendors:** The recent interest in and creation of new quasi-open source licenses like the [Server Side Public License][11], [Redis Source Available License][12], or [PolyForm][13] are better understood by thinking of open source as a supply chain and SaaS as a pricing and packaging model. These new licenses exert some control on how buyers from the open source supply chain can price and package their products (e.g., limiting how a large cloud provider can deliver a service built on freely available code and binaries). This is not unheard of, even in traditional manufacturing supply chains. It's a defensive play because these licenses don't deliver new value to customers. + * **Open source as awareness:** In this model, the buzz around the upstream project is used to deliver awareness for the products built on it. In marketing, awareness of a technology is a critical first step for having a product's customers build on it. For example, if users are aware of and believe in Kubernetes, they are potential customers for products built on Kubernetes; when people looking for a Kubernetes solution hear that your product is built on Kubernetes, they immediately become potential customers. In a way, this is similar to Lenovo laptops advertising "Intel inside" or [Arm & Hammer laundry detergent advertising OxiClean][14] as part of their supply chain. If you like OxiClean, you'll love Arm & Hammer detergent. + * **Open core as marketing:** This goes a step further than open source as awareness. A single vendor almost always controls the upstream open source projects that go into open core products. They attempt to use the supply chain, often unsuccessfully, to generate market awareness in what's perceived to be free or inexpensive marketing and lead generation. Open core products advertise that they include the open source project to provide core value propositions. Going back to the Arm & Hammer example: If you like open source, you'll love our proprietary software with open source goodness inside. + + + +### The supply chain + +Continuing the analogy from my [last article][3], when General Motors develops a car, the product team doesn't tell Bosch what fuel injectors they want. They tell Bosch how much power the new vehicle will generate, how much towing capacity it needs to have, etc. They give Bosch a set of technical requirements. Then Bosch provides GM with a fuel-injection solution that not only includes the fuel injectors but also the wiring harnesses and perhaps even software that makes it run. It's cheaper and often better quality to rely on a supply chain for components that are shared among virtually every vehicle in the marketplace. + +Like an automobile, the sum of a software product is greater than the individual parts. When a manufacturer delivers a car, it's more than the braking, steering, power plant, infotainment system, financing, and mechanical service program. It has an associated brand, build quality, reliability, and an experience. Most of the parts aren't differentiated between vendors. Software products, especially ones built on an open source supply chain, are no different. Product management needs to differentiate their products from the underlying software components in the supply chain. The value of a software product is a layer of differentiation built on top of a supply chain of dependencies. This value is what product management must focus on. + +### Differentiated value + +Product management is not about picking and choosing what bugs are fixed upstream or downstream. It's not about holding back enough value in the open source project so that users purchase the product. It's not about coming up with special licenses to monetize an open source project's user base. It's about creating differentiated value that customers will pay for. It's about listening to their needs, internalizing them, and knowing them intimately. It's about influencing a supply chain, switching supply chains, and building a partner ecosystem that gives your product gravity. + +Product managers who think about differentiated value on top of an open source supply chain can easily answer the following questions: + + * As an open source product manager, should I attend conferences for the upstream projects? _Sure, because it's like attending a trade show for one of your suppliers._ + * How should product management handle a situation where the upstream project isn't delivering what their customers need? _Add more investment. If the open source community is healthy, it will produce what you need._ + * What should product management do when an upstream community is struggling with contributions or is unhealthy? _The same thing that a manufacturer would do if their supplier lost contracts with their two biggest competitors because they were failing: switch suppliers._ + + + +In the next article, I will delve into the distinct value created in products, focusing on the value that upstream projects can't provide. If product management is done well, there is no unnatural tension between upstream suppliers and downstream products. When done right, both the upstream projects and downstream products create unique and differentiated value that satisfies the needs of users and customers alike. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/open-source-product-teams + +作者:[Scott McCarty][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://opensource.com/users/fatherlinux +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk (a checklist for a team) +[2]: https://opensource.com/article/20/10/open-source-supply-chain +[3]: https://opensource.com/article/20/10/defining-product-open-source +[4]: https://www.mindtheproduct.com/forget-product-management-tough-career/ +[5]: https://www.pragmaticinstitute.com/framework +[6]: http://developmentcorporate.com/2019/04/02/the-myth-of-the-product-management-pl/ +[7]: https://medium.com/open-consensus/2-open-core-definition-examples-tradeoffs-e4d0c044da7c +[8]: https://en.wikipedia.org/wiki/Satellite_(software) +[9]: https://en.wikipedia.org/wiki/OpenShift +[10]: https://medium.com/@adamhjk/goodbye-open-core-good-riddance-to-bad-rubbish-ae3355316494 +[11]: https://www.mongodb.com/licensing/server-side-public-license +[12]: https://redislabs.com/wp-content/uploads/2019/03/Redis-Source-Available-License-PDF-2.pdf +[13]: https://polyformproject.org/licenses/ +[14]: https://www.armandhammer.com/laundry/liquid-laundry-detergent/liquid-laundry-detergent/plus-oxiclean-with-fade-defense-liquid-laundry-detergent From 52e51f02a9c980df92a5640f409fbdc9e9b0eaf5 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 21 Nov 2020 05:03:23 +0800 Subject: [PATCH 0844/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201119?= =?UTF-8?q?=20Day=209:=20Generating=20a=20lot=20of=20nonsense=20with=20an?= =?UTF-8?q?=20RNN?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201119 Day 9- Generating a lot of nonsense with an RNN.md --- ...enerating a lot of nonsense with an RNN.md | 151 ++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 sources/tech/20201119 Day 9- Generating a lot of nonsense with an RNN.md diff --git a/sources/tech/20201119 Day 9- Generating a lot of nonsense with an RNN.md b/sources/tech/20201119 Day 9- Generating a lot of nonsense with an RNN.md new file mode 100644 index 0000000000..5b6c7c22f6 --- /dev/null +++ b/sources/tech/20201119 Day 9- Generating a lot of nonsense with an RNN.md @@ -0,0 +1,151 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Day 9: Generating a lot of nonsense with an RNN) +[#]: via: (https://jvns.ca/blog/2020/11/19/day-9--generating-a-lot-of-nonsense-with-an-rnn/) +[#]: author: (Julia Evans https://jvns.ca/) + +Day 9: Generating a lot of nonsense with an RNN +====== + +Hello! On Monday I posted about [generating faces with sketch-rnn][1], which I did using a pre-trained RNN model. + +I want to train that model to genreate more complicated faces (which may or may not work!), but I decided that since I knew literally nothing about neural networks it would be good to start with something simpler: [this char-rnn model from Karpathy that generates text that sounds vaguely Shakespearean][2]. + +After spending some time playing with Tensorflow, I decided to use PyTorch with the [fast.ai][3] helper libraries because it’s what my friend Ray was using for his project. + +Here are some initial things I’ve learned about training neural networks. All of this is pretty disjointed and I still have no idea what I’m doing. + +### there are a lot of tensors + +All the data seems to be tensors! A 1-d tensor is a vector, a 2-d tensor is a matrix, and a 3-d tensor is, well, who knows. This is a little new but I have some vague intuition about tensor products from learning about quantum computing ten [years][4] ago so this seems okay. + +They seem not too bad to manipulate, like `tensor.flatten()` will flatten a multidimensional tensor into a vector. I still feel a bit uncertain about the exact order things get flattened in, I need to experiment & think it through. + +The word “dimension” for tensors is also used in a different way than I expected, like I’d usually think that the “dimension” of a 8x9 matrix is 72 (becuase that’s the dimension of the vector space of 8x9 matrices), but in Torch land the “dimension” of a 8x9 matrix seems to be 2. That seems fine though. + +### there are a lot of dimension mismatches + +I’ve spent a lot of hours over the last couple of days staring at error messages like + +``` +ValueError: Expected target size (77, 64) got torch.Size (77, 70) +``` + +Some reasons I’ve gotten errors like this so far + + * I tried to pass a 3-dimensional tensor to a loss function that wanted a 2-dimensional tensor + * I forgot to embed my input data (which is a bunch of class labels) into a higher dimensional space so that every number turns into a 64-dimensional vector + * I multiplied a vector by a matrix with the wrong dimensions + + + +Something that I find a bit confusing about the tensors and dimension mismatches is that a lot of the time you seem to be able to pass in both a 2-dimensional tensor and a 3-dimensional tensor to the same method. For example, if I have a 2x3 matrix, I can multiply that by a 3x4 tensor, or by a 3x4x89 tensor, or by a 3x92x12x238 tensor, or whatever. This corresponds to what I remember about tensors from quantum computing, but I find a bit harder to think about in terms of numbers in a matrix on a computer. + +I tweeted about this and a bunch of people agreed with me that they have also spent a bunch of time debugging dimension mismatches so at least I’m not alone :) + +### the cross entropy loss in pytorch isn’t the cross entropy + +A “loss function” is basically a function you use to check how similar 2 vectors are. Lower is better. + +Today I got pretty confused because I was trying to compute the cross entropy loss for two identical vectors, and the result wasn’t 0! I thought that the result was going to be 0, because the vectors were identical! + +It turns out that in PyTorch the “cross entropy loss” of x and y isn’t actually the [cross entropy][5] of x and y (which would be 0 if x and y are identical!), instead it’s `cross_entropy(softmax(x), y)` – you apply a “softmax” function to x first. + +### it goes a LOT faster with a GPU + +At some point I was training a model on a CPU, and then I switched to a GPU and every batch trained literally 10x faster. + +### colab is pretty useful + +I’ve been using Google’s [Colab][6], which seems to be a fork of Jupyter notebook. It comes with some free GPUs that you can use, which is nice. + +The main annoying thing I’ve run into about Colab is that they pretty aggressively kill your running notebooks if they’re idle to reduce resource usage. This is actually fine on its own (you can save your data to Google Drive and restore it!). + +BUT as far as I can tell, if I want to use the Google Drive to get my files, I need to reauthenticate the notebook to Google Drive every single time by clicking a link and pasting in an OAuth (or something) code. I don’t really understand why it can’t just authenticate me once and then have it work forever. + +### it’s bad if your training loss never goes down + +I’ve been having the same problem for most of yesterday and today, which is that I have a model and some training data, and when I try to train the model my training loss never improves, which measn that basically the model isn’t training. + +And then when I make predictions from the model, I get results like this: + +``` +eto e enaih eet codosueonites st tne esee ob nmnoesnrertieieeu ooe +``` + +which makes it seem like it’s learned _something_ – those letters are common letters in the English language, sure! It’s better than generating `zxisqqqqxw`, which is more like the results I’d expect if the network hadn’t learned anything at all. But it definitely hasn’t learned a lot. + +### some code that does not work + +If you’re interested in what some code for an RNN that DOES NOT WORK looks like, here’s [the code I’ve written so far][7] + +the neural network part looks like this: + +``` +class RNN(nn.Module): + def __init__(self): + super().__init__() + self.i2h = nn.Linear(nv, nh) # Wxh + self.h2h = nn.Linear(nh, nh) # Whh + self.h2o = nn.Linear(nh, nv) # Why + self.hidden = torch.zeros(1, nh).cuda() + + def forward(self, input): + x = self.i2h(torch.nn.functional.one_hot(input, num_classes=nv).type(torch.FloatTensor).cuda()) + y = self.h2h(self.hidden) + hidden = torch.tanh(y + x) + self.hidden = hidden.detach() + z = self.h2o(hidden) + return z +``` + +and it basically sets up a bunch of matrices that are meant to correspond to this code from Karpathy’s blog post: + +``` +def step(self, x): + # update the hidden state + self.h = np.tanh(np.dot(self.W_hh, self.h) + np.dot(self.W_xh, x)) + # compute the output vector + y = np.dot(self.W_hy, self.h) + return y +``` + +but unlike his code, it does not generate text that looks vaguely Shakespeare after I train it, it generates gibberish! Maybe tomorrow I will find out why. + +Here’s a snippet of code that samples from the model’s output probability vector using a “temperature” – at a very low temperature it just always picks the letter that the model thinks is most likely (which by the way right now in my case is LITERALLY ALWAYS A SPACE which is also a sign that something is wrong). At higher temperatures it might pick another likely letter. + +``` +temperature = 1 +prediction_vector = F.softmax(learn.model(x)[0]/temperature) +v.textify(torch.multinomial(prediction_vector, 1).flatten(), sep='') +``` + +### that’s all! + +As usual when I learn things I am mostly trying to do it without reading any books or watching any videos – there’s this whole video course from that seems pretty good, but for whatever reason I prefer to just bang my head against a problem I’m trying to solve until I get VERY CONFUSED and then resort to reading things that might help me understand what’s going on then. So that’s the plan, we’ll see how it goes. + +It’s been pretty fun so far, I know a bunch of things about loss functions that I didn’t know before at least, and now I kind of know what a softmax is! + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/11/19/day-9--generating-a-lot-of-nonsense-with-an-rnn/ + +作者:[Julia Evans][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://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://lots-of-sketchrnn-faces.netlify.app/ +[2]: https://karpathy.github.io/2015/05/21/rnn-effectiveness/ +[3]: https://www.fast.ai/ +[4]: https://github.com/jvns/masters-thesis/ +[5]: https://en.wikipedia.org/wiki/Cross_entropy +[6]: https://colab.research.google.com/ +[7]: https://gist.github.com/jvns/ce24d85c9d645c32b0d552b69359979f From b46ba16213a6c283314dce2777b1ccc816383976 Mon Sep 17 00:00:00 2001 From: niko Date: Sat, 21 Nov 2020 15:51:41 +0800 Subject: [PATCH 0845/1156] frogOAO translating --- ...tualBox -With Steps for USB, Clipboard and Folder Sharing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md b/sources/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md index 1d5095113f..69b067c82b 100644 --- a/sources/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md +++ b/sources/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (frogOAO) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 3cbbd1432a8db41b893c4acb5cd0d8b4e2dc24b1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 21 Nov 2020 21:44:44 +0800 Subject: [PATCH 0846/1156] PRF @geekpi --- ...cher on Linux for Making Live Linux USB.md | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/translated/tech/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md b/translated/tech/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md index bb8aa29cde..00313094e7 100644 --- a/translated/tech/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md +++ b/translated/tech/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md @@ -1,22 +1,24 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Install and Use Etcher on Linux for Making Live Linux USB) [#]: via: (https://itsfoss.com/install-etcher-linux/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -如何在 Linux 上安装和使用 Etcher 来制作 Live Linux USB +如何在 Linux 上安装和使用 Etcher 来制作 Linux 临场 USB ====== -_**Etcher 是一款流行的 USB 烧录应用,可用于创建可启动的 Linux USB。让我来告诉你如何安装它,以及如何使用它来制作一个 Live Linux 盘。**_ +![](https://img.linux.net.cn/data/attachment/album/202011/21/214209xor9upp7jznd9djd.jpg) + +> Etcher 是一款流行的 USB 烧录应用,可用于创建可启动的 Linux USB。让我来告诉你如何安装它,以及如何使用它来制作一个 Linux 临场盘。 ### Etcher:一个用于在 SD 卡和 USB 驱动器中烧录 Linux ISO 的开源工具 Etcher 是一个由 [Balena][1] 开发的开源项目,来用于为树莓派烧录 SD 卡。事实上,我们在[如何在 SD 卡上安装 Raspbian OS][2] 的教程中就使用了它。 -它不仅仅局限于 SD 卡,你还可以使用 Etcher 来[制作一个可启动的 USB 驱动器][3],就像我们在它的帮助下在 Linux 中制作了一个 [Manjaro 的 Live USB][4]。 +它不仅仅局限于 SD 卡,你还可以使用 Etcher 来[制作一个可启动的 USB 驱动器][3],我们就通过它的帮助在 Linux 中制作了一个 [Manjaro 的临场 USB][4]。 自首次发布以来,Etcher 就以其整洁的界面和简单的使用方式引起了人们的注意。 @@ -33,9 +35,7 @@ Etcher 是一个由 [Balena][1] 开发的开源项目,来用于为树莓派烧 * 快速烧录 * 简单的三步过程 - - -理论上,你已经有了在 SD 卡和 USB 驱动器上烧录操作系统镜像所需的一切。同样令人激动的是,他们计划根据他们的[路线图][6],增加对多个设备的同步写入支持。 +理论上,你已经有了在 SD 卡和 USB 驱动器上烧录操作系统镜像所需的一切。同样令人激动的是,根据他们的[路线图][6],他们计划增加对多个设备的同步写入支持。 ### 在 Linux 上安装 Etcher @@ -45,10 +45,9 @@ Etcher 是一个由 [Balena][1] 开发的开源项目,来用于为树莓派烧 ![][8] - 在我的例子中,我下载了 Ubuntu 的 64 位 AppImage 文件。你可以通过我们的指南来了解[在 Linux 上使用 AppImage文件][9],但我会让你先知道下一步需要做什么。 -你需要给文件执行权限,你可以右击**AppImage 文件 -> 属性**来实现。 +你需要给文件执行权限,你可以右击**AppImage 文件 -> 属性**来实现。 ![][10] @@ -62,19 +61,19 @@ Etcher 是一个由 [Balena][1] 开发的开源项目,来用于为树莓派烧 你也可以参考我们的[在 Ubuntu 中使用 deb 文件][13]来安装应用。 -注意! - -我们注意到,当你使用 Etcher 创建 Linux 发行版的 Live USB 时,它会使 USB 处于明显的不可使用状态,即它只有几 MB 的空闲空间,并且不能直接格式化。在 Linux 上,你可以[使用磁盘工具手动删除分区,然后格式化它][14]。 +> 注意! +> +> 我们注意到,当你使用 Etcher 创建 Linux 发行版的临场 USB 时,它会使 USB 处于明显的不可使用状态,即它只有几 MB 的空闲空间,并且不能直接格式化。在 Linux 上,你可以[使用磁盘工具手动删除分区,然后格式化它][14]。 ### 在 Linux 上使用 Etcher 只需三步就可以开始使用 Etcher。在你启动它之后,根据屏幕上的提示应该是清晰的,但为了给你一个好的开始,以下是你要做的事情: -**步骤 1:**选择合适的 ISO 镜像文件或你需要烧录的文件的 URL(如下图所示)。 +**步骤 1:** 选择合适的 ISO 镜像文件或你需要烧录的文件的 URL(如下图所示)。 ![][15] -**步骤 2:**接下来,你需要选择目标设备。它会自动检测并高亮显示可移动设备,以防止你选择任何内部存储位置。 +**步骤 2:** 接下来,你需要选择目标设备。它会自动检测并高亮显示可移动设备,以防止你选择任何内部存储位置。 ![][16] @@ -82,7 +81,7 @@ Etcher 是一个由 [Balena][1] 开发的开源项目,来用于为树莓派烧 ![][17] -**步骤 3:**现在,你所有需要做的就是烧录镜像并等待它成功完成。 +**步骤 3:** 现在,你所有需要做的就是烧录镜像并等待它成功完成。 ![][18] @@ -94,11 +93,11 @@ Etcher 是一个由 [Balena][1] 开发的开源项目,来用于为树莓派烧 ![][20] -[Download balenaEtcher][7] +- [下载 balenaEtcher][7] ### 总结 -Etcher 是一个有用的工具,可以为 SD 卡和 USB 驱动器烧录操作系统镜像。我倾向于主要使用它来创建 Live USB 驱动器来测试 Linux 发行版,我对它很满意。 +Etcher 是一个有用的工具,可以为 SD 卡和 USB 驱动器烧录操作系统镜像。我倾向于主要使用它来创建临场 USB 驱动器来测试 Linux 发行版,我对它很满意。 你更喜欢用什么来创建可启动驱动器?你是否已经尝试过 Etcher?请在下面的评论中告诉我你的想法。 @@ -109,7 +108,7 @@ via: https://itsfoss.com/install-etcher-linux/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From de3fa29c78adceb9040aa7f77a674a9856fc5e63 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 21 Nov 2020 21:56:34 +0800 Subject: [PATCH 0847/1156] PUB @geekpi https://linux.cn/article-12847-1.html --- ...stall and Use Etcher on Linux for Making Live Linux USB.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md (98%) diff --git a/translated/tech/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md b/published/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md similarity index 98% rename from translated/tech/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md rename to published/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md index 00313094e7..74ab8519d5 100644 --- a/translated/tech/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md +++ b/published/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12847-1.html) [#]: subject: (How to Install and Use Etcher on Linux for Making Live Linux USB) [#]: via: (https://itsfoss.com/install-etcher-linux/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From be6e59c65cb251853085ddd7890906a5fb05de90 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sun, 22 Nov 2020 00:00:46 +0800 Subject: [PATCH 0848/1156] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...roduction to mutation testing in Python.md | 160 ------------------ ...roduction to mutation testing in Python.md | 147 ++++++++++++++++ 2 files changed, 147 insertions(+), 160 deletions(-) delete mode 100644 sources/tech/20200720 An introduction to mutation testing in Python.md create mode 100644 translated/tech/20200720 An introduction to mutation testing in Python.md diff --git a/sources/tech/20200720 An introduction to mutation testing in Python.md b/sources/tech/20200720 An introduction to mutation testing in Python.md deleted file mode 100644 index 4a946fe59c..0000000000 --- a/sources/tech/20200720 An introduction to mutation testing in Python.md +++ /dev/null @@ -1,160 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (An introduction to mutation testing in Python) -[#]: via: (https://opensource.com/article/20/7/mutmut-python) -[#]: author: (Moshe Zadka https://opensource.com/users/moshez) - -An introduction to mutation testing in Python -====== -Turn invisible bugs into visible fixes with mutation testing. -![Searching for code][1] - -You have tests for everything; maybe you even have a badge in your project repository stating 100% test coverage. But what are these tests helping you do? How do you know? - -The _costs_ of unit tests are clear to developers. Tests have to be written. Occasionally they don't work as intended: there are false alarms or flapping tests that alternate success and failure without any code changes. The small bugs you can find through unit tests are valuable, but often they happen quietly on a developer machine and are fixed before a commit ever goes into version control. But the truly alarming bugs are mostly invisible. And the worst of all, the _missing alarms_ are completely invisible: you don't see the bugs you failed to catch until the code gets into a user's hands—and sometimes not even then. - -There is one type of test that makes it possible to make the invisible visible: [mutation testing][2]. - -Mutation testing algorithmically modifies source code and checks if any "mutants" survived each test. Any mutant that survives the unit test is a problem: it means that a modification to the code, likely introducing a bug, was not caught by the standard test suite. - -One framework for mutation testing in [Python][3] is `mutmut`. - -Imagine you need to write code that calculates the angle between the hour hand and the minute hand in an analog clock to the nearest degree. The code might look something like: - - -``` -def hours_hand(hour, minutes): -    base = (hour % 12 ) * (360 // 12) -    correction = int((minutes / 60) * (360 // 12)) -    return base + correction - -def minutes_hand(hour, minutes): -    return minutes * (360 // 60) - -def between(hour, minutes): -    return abs(hours_hand(hour, minutes) - minutes_hand(hour, minutes)) -``` - -To begin, write a simple unit test: - - -``` -import angle - -def test_twelve(): -    assert angle.between(12, 00) == 0 -``` - -Is this enough? The code has no `if` statement, so if you check coverage: - - -``` -$ coverage run `which pytest` -============================= test session starts ============================== -platform linux -- Python 3.8.3, pytest-5.4.3, py-1.8.2, pluggy-0.13.1 -rootdir: /home/moshez/src/mut-mut-test -collected 1 item                                                               - -tests/test_angle.py .                                                    [100%] - -============================== 1 passed in 0.01s =============================== -``` - -Perfect! The tests pass, and coverage is at 100%. Testing expert, you are. But what does that coverage look like when you use mutation testing? - - -``` -$ mutmut run --paths-to-mutate angle.py -<snip> -Legend for output: -🎉 Killed mutants.   The goal is for everything to end up in this bucket. -⏰ Timeout.          Test suite took 10 times as long as the baseline so were killed. -🤔 Suspicious.       Tests took a long time, but not long enough to be fatal. -🙁 Survived.         This means your tests needs to be expanded. -🔇 Skipped.          Skipped. -<snip> -⠋ 21/21  🎉 5  ⏰ 0  🤔 0  🙁 16  🔇 0 -``` - -Oh no. Out of 21 mutants, 16 survived. Only five cases passed the mutation testing. But what does that mean? - -For each mutation test, `mutmut` modified portions of your source code that simulates potential bugs. An example of a modification is changing a `>` comparison to `>=` to see what happens. If there is no unit test for this boundary condition, this mutation will "survive": this is a potential bug that none of the tests will detect. - -It's time to write better unit tests. It is easy to check which changes were made with `results`: - - -``` -$ mutmut results -<snip> -Survived 🙁 (16) - -\---- angle.py (16) ---- - -4-7, 9-14, 16-21 -$ mutmut apply 4 -$ git diff -diff --git a/angle.py b/angle.py -index b5dca41..3939353 100644 -\--- a/angle.py -+++ b/angle.py -@@ -1,6 +1,6 @@ - def hours_hand(hour, minutes): -     hour = hour % 12 -\-    base = hour * (360 // 12) -\+    base = hour / (360 // 12) -     correction = int((minutes / 60) * (360 // 12)) -     return base + correction -``` - -This is a typical example of a mutation `mutmut` performs; it analyzes the source code and changes operators to different operators: addition to subtraction or, in this case, multiplication to division. Unit tests, generally speaking, should catch bugs when an operator changes; otherwise, they are not testing the behavior effectively. Following this logic, `mutmut` twiddles through source code to double-check your tests. - -You can use `mutmut apply` to apply a failed mutant. Wow, it turns out you barely checked whether the `hour` parameter was used correctly. Fix that: - - -``` -$ git diff -diff --git a/tests/test_angle.py b/tests/test_angle.py -index f51d43a..1a2e4df 100644 -\--- a/tests/test_angle.py -+++ b/tests/test_angle.py -@@ -2,3 +2,6 @@ import angle -  - def test_twelve(): -     assert angle.between(12, 00) == 0 -+ -+def test_three(): -\+    assert angle.between(3, 00) == 90 -``` - -Previously, you tested only for 12. Will adding a test for three be enough to improve? - - -``` -$ mutmut run --paths-to-mutate angle.py -<snip> -⠋ 21/21  🎉 7  ⏰ 0  🤔 0  🙁 14  🔇 0 -``` - -This new test managed to kill two of the mutants—better than before, but still a long way to go. I won't work through each of the 14 cases left to fix, because I think the pattern is clear. (Can you get them down to zero?) - -Mutation testing is another tool, along with coverage measurement, that allows you to see how comprehensive your test suite is. Using it makes the case that tests need to be improved: any one of those surviving mutants is a mistake a human being can make while fat-fingering code, as well as a potential bug creeping into your program. Keep testing and happy hunting. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/7/mutmut-python - -作者:[Moshe Zadka][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://opensource.com/users/moshez -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_python_programming.png?itok=ynSL8XRV (Searching for code) -[2]: https://opensource.com/article/19/8/mutation-testing-evolution-tdd -[3]: https://opensource.com/resources/python diff --git a/translated/tech/20200720 An introduction to mutation testing in Python.md b/translated/tech/20200720 An introduction to mutation testing in Python.md new file mode 100644 index 0000000000..f6bfc3ff6a --- /dev/null +++ b/translated/tech/20200720 An introduction to mutation testing in Python.md @@ -0,0 +1,147 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (An introduction to mutation testing in Python) +[#]: via: (https://opensource.com/article/20/7/mutmut-python) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +Python 突变测试简介 +====== +通过突变测试来修复未知的 bug。 +![Searching for code][1] + +你一定对所有内容都进行了测试,也许你甚至在项目仓库中有一个徽章,标明有 100% 的测试覆盖率,但是这些测试真的帮到你了吗?你怎么知道的? + +开发人员很清楚单元测试的 _成本_,必须编写测试。有时它们无法按照预期工作:存在假告警或者抖动测试。在不更改任何代码的情况下有时成功,有时失败。通过单元测试发现的小问题很有价值,但是通常它们悄无声息的出现在开发人员的机器上,并且在提交到版本控制之前就已得到修复。但真正令人担忧的问题大多是不可见的。最糟糕的是,_丢失的告警_ 是完全不可见的:你看不到没能捕获的错误,直到出现在用户手上--有时甚至连用户都看不到。 + +有一种测试可以使不可见的错误变为可见:[突变测试][2]。 + +变异测试通过算法修改源代码,并检查每次测试是否都有“变异体”存活。任何在单元测试中幸存下来的变异体都是问题:这意味着对代码的修改(可能会引入错误)没有被标准测试套件捕获。 + +[Python][3] 中用于突变测试的一个框架是 `mutmut`。 + +假设你需要编写代码来计算钟表中时针和分针之间的角度,直到最接近的度数,代码可能会这样写: +``` +def hours_hand(hour, minutes): +    base = (hour % 12 ) * (360 // 12) +    correction = int((minutes / 60) * (360 // 12)) +    return base + correction + +def minutes_hand(hour, minutes): +    return minutes * (360 // 60) + +def between(hour, minutes): +    return abs(hours_hand(hour, minutes) - minutes_hand(hour, minutes)) +``` + +首先,写一个简单的单元测试: +``` +import angle + +def test_twelve(): +    assert angle.between(12, 00) == 0 +``` + +足够了吗?代码没有 `if` 语句,所以如果你查看覆盖率: +``` +$ coverage run `which pytest` +============================= test session starts ============================== +platform linux -- Python 3.8.3, pytest-5.4.3, py-1.8.2, pluggy-0.13.1 +rootdir: /home/moshez/src/mut-mut-test +collected 1 item                                                               + +tests/test_angle.py .                                                    [100%] + +============================== 1 passed in 0.01s =============================== +``` + +完美!测试通过,覆盖率为 100%,你真的是一个测试专家。但是,当你使用突变测试时,覆盖率会变成多少? +``` +$ mutmut run --paths-to-mutate angle.py +<snip> +Legend for output: +🎉 Killed mutants.   The goal is for everything to end up in this bucket. +⏰ Timeout.          Test suite took 10 times as long as the baseline so were killed. +🤔 Suspicious.       Tests took a long time, but not long enough to be fatal. +🙁 Survived.         This means your tests needs to be expanded. +🔇 Skipped.          Skipped. +<snip> +⠋ 21/21  🎉 5  ⏰ 0  🤔 0  🙁 16  🔇 0 +``` + +天啊,在 21 个突变体中,只有 16 个存活。只有 5 个通过了突变测试,但是,这意味着什么呢? + +对于每个突变测试,`mutmut` 会修改部分源代码,以模拟潜在的错误,修改的一个例子是将 `>` 比较更改为 `>=`,查看会发生什么。如果没有针对这个边界条件的单元测试,那么这个突变将会“存活”:这是一个没有任何测试用例能够检测到的潜在错误。 + +是时候编写更好的单元测试了。很容易检查使用 `results` 所做的更改: +``` +$ mutmut results +<snip> +Survived 🙁 (16) + +\---- angle.py (16) ---- + +4-7, 9-14, 16-21 +$ mutmut apply 4 +$ git diff +diff --git a/angle.py b/angle.py +index b5dca41..3939353 100644 +\--- a/angle.py ++++ b/angle.py +@@ -1,6 +1,6 @@ + def hours_hand(hour, minutes): +     hour = hour % 12 +\-    base = hour * (360 // 12) +\+    base = hour / (360 // 12) +     correction = int((minutes / 60) * (360 // 12)) +     return base + correction +``` + +这是 `mutmut` 执行突变的一个典型例子,它会分析源代码并将运算符更改为不同的运算符:减法变加法。在本例中由乘法变为除法。一般来说,单元测试应该在操作符更换时捕获错误。否则,它们将无法有效地测试行为。按照这种逻辑,`mutmut` 会遍历源代码仔细检查你的测试。 + +你可以使用 `mutmut apply` 来应用失败的突变体。事实证明你几乎没有检查过 `hour` 参数是否被正确使用。修复它: +``` +$ git diff +diff --git a/tests/test_angle.py b/tests/test_angle.py +index f51d43a..1a2e4df 100644 +\--- a/tests/test_angle.py ++++ b/tests/test_angle.py +@@ -2,3 +2,6 @@ import angle +  + def test_twelve(): +     assert angle.between(12, 00) == 0 ++ ++def test_three(): +\+    assert angle.between(3, 00) == 90 +``` + +以前,你只测试了 12 点钟,现在增加一个 3 点钟的测试就足够了吗? + +``` +$ mutmut run --paths-to-mutate angle.py +<snip> +⠋ 21/21  🎉 7  ⏰ 0  🤔 0  🙁 14  🔇 0 +``` + +这项新测试成功杀死了两个突变体,比以前更好,当然还有很长的路要走。我不会一一解决剩下的 14 个测试用例,因为我认为模式已经很明确了。(你能将它们降低到零吗?) + +变异测试和覆盖率一样,是一种工具,它允许你查看测试套件的全面程度。使用它使得测试用例需要改进:那些幸存的突变体中的任何一个都是人类在篡改代码时可能犯的错误,以及潜伏在程序中的隐藏错误。继续测试,愉快地搜寻 bug 吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/mutmut-python + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[MjSeven](https://github.com/MjSeven) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_python_programming.png?itok=ynSL8XRV (Searching for code) +[2]: https://opensource.com/article/19/8/mutation-testing-evolution-tdd +[3]: https://opensource.com/resources/python From 3774f144c81fbe522139658c38ea470f4fd2cd14 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 22 Nov 2020 05:02:18 +0800 Subject: [PATCH 0849/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201122?= =?UTF-8?q?=20How=20to=20Save=20the=20Output=20of=20a=20Command=20to=20a?= =?UTF-8?q?=20File=20in=20Linux=20Terminal=20[Beginner=E2=80=99s=20Tip]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201122 How to Save the Output of a Command to a File in Linux Terminal -Beginner-s Tip.md --- ... File in Linux Terminal -Beginner-s Tip.md | 114 ++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 sources/tech/20201122 How to Save the Output of a Command to a File in Linux Terminal -Beginner-s Tip.md diff --git a/sources/tech/20201122 How to Save the Output of a Command to a File in Linux Terminal -Beginner-s Tip.md b/sources/tech/20201122 How to Save the Output of a Command to a File in Linux Terminal -Beginner-s Tip.md new file mode 100644 index 0000000000..1abd6c775d --- /dev/null +++ b/sources/tech/20201122 How to Save the Output of a Command to a File in Linux Terminal -Beginner-s Tip.md @@ -0,0 +1,114 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Save the Output of a Command to a File in Linux Terminal [Beginner’s Tip]) +[#]: via: (https://itsfoss.com/save-command-output-to-file-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +How to Save the Output of a Command to a File in Linux Terminal [Beginner’s Tip] +====== + +When you run a command or script in the Linux terminal, it prints the output on the screen for your immediate viewing. + +There will be times when you need to save the output to a file for future references. Now, [you can surely copy and paste in Linux terminal][1] but there are better ways to save the output of a shell script or command in Linux command line. Let me show them to you. + +### Method 1: Use redirection to save command output to file in Linux + +You can [use redirection in Linux for this purpose][2]. With redirection operator, instead of showing the output on the screen, it goes to the provided file. + + * The > redirects the command output to a file replacing any existing content on the file. + * The >> redirects adds the command output at the end of the existing content (if any) of the file. + + + +Use the STDOUT redirection operator > for redirecting the output to a file like this: + +``` +command > file.txt +``` + +If the file.txt doesn’t exist, it will be created automatically. If you use the > redirect again with the same file, the file content is replaced by the new output. + +The example below demonstrates it better. It first saves the output of _ls -l_ command. And then later, it replaces the content of the file with the output of _ls *.c_ command. + +![Redirecting command output to file][3] + +If you don’t want to lose the content of the existing file while saving the output of a script or command, use the redirection operation in append mode with >>. + +``` +command >> file.txt +``` + +This example demonstrates it better: + +![Redirecting command output to file in append mode][4] + +Even here if the file doesn’t exist, it is created automatically. + +Bonus Tip: Save Linux command output as well as error to a file + +If your Linux command returns an error, it doesn’t get saved in the file. You can save both the command output and command error in the same file using 2>&1 like this: + +**command > file.txt 2>&1** + +Basically, 0 stands for standard input, 1 for standard output and 2 for standard error. Here, you are redirecting (>) standard error (2) to same address (&) as standard output (1). + +### Method 2: Use tee command to display the output and save it to a file as well + +By the way, did you notice that when you send the command output to a file, you cannot see it anymore on the display? The [tee command in Linux][5] solves this problem for you. + +Like a tee pipe that sends water stream into two directions, the tee command send the output to the display as well as to a file (or as input to another command). You can use it like this: + +``` +command | tee file.txt +``` + +Again, the file will be created automatically, if it doesn’t exist already. + +You may also use the tee command in append mode with option -a in this manner: + +``` +command | tee -a file.txt +``` + +Let me demonstrate it with some easy to follow examples: + +![][6] + +I have used simple Linux commands in my examples. But rest assured, you can use these methods to save the output of bash scripts as well. + +### Note: Avoid pipe pitfall while saving command output to file + +You probably are familiar with pipe redirection. You may use it to combine Linux commands but you cannot pipe the output to a file. It will result in error that filename command not found: + +![][7] + +This is because pipe redirects the output of one command to input of another command. And in this case, you give it a file name while it was expecting a command. + +If you are new to Linux command line, I hope this quick tutorial added to your Linux knowledge a bit. [I/O redirection][8] is an essential concept that one should be aware of. + +As always, questions and suggestions are always welcome. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/save-command-output-to-file-linux/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/copy-paste-linux-terminal/ +[2]: https://linuxhandbook.com/redirection-linux/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/redirecting_command_output_to_file_in_linux.png?resize=741%2C456&ssl=1 +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/redirecting_command_output_to_file.png?resize=741%2C494&ssl=1 +[5]: https://linuxhandbook.com/tee-command/ +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/display-and-save-linux-command-output.png?resize=741%2C494&ssl=1 +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/pipe-output-to-file-linux.png?resize=687%2C266&ssl=1 +[8]: https://tldp.org/LDP/abs/html/io-redirection.html#FTN.AEN17894 From 0afab5d94e1b193d60ab1742757d5737257a7b50 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 22 Nov 2020 05:02:35 +0800 Subject: [PATCH 0850/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201121?= =?UTF-8?q?=20Open=20source=20brings=20musicians=20together=20virtually?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201121 Open source brings musicians together virtually.md --- ...rce brings musicians together virtually.md | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 sources/tech/20201121 Open source brings musicians together virtually.md diff --git a/sources/tech/20201121 Open source brings musicians together virtually.md b/sources/tech/20201121 Open source brings musicians together virtually.md new file mode 100644 index 0000000000..943f21e8ad --- /dev/null +++ b/sources/tech/20201121 Open source brings musicians together virtually.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open source brings musicians together virtually) +[#]: via: (https://opensource.com/article/20/11/open-source-drum-bugle-corps) +[#]: author: (Vicki Walker https://opensource.com/users/vicki-walker) + +Open source brings musicians together virtually +====== +The open source ethos is embedded in many areas of life, including music +and art. +![Drums ][1] + +When the COVID-19 pandemic began canceling live music events in spring 2020, it wasn't just the big arena shows, music festivals, and small, local venues that suffered—the big annual marching band competition leagues, like [Drum Corps International][2] (DCI) and [WGI World Championships][3], were also called off. This was a huge disappointment for the thousands of musicians and band directors who were already preparing for the spring and summer competition season. But the members of the [Drumcorps subreddit][4] saw it as an opportunity to take drum corps virtual. + +The [Open Source Drum and Bugle Corps][5] (OSDBC) is one such organization bringing open source to drum corps. The group was founded on the principles of openness, inclusiveness, and collaboration. And, like most things in open source, OSDBC was created to solve a problem. + +OSDBC launched in early April 2020, in the early weeks of US pandemic-related shutdowns, and immediately had 100 members in the group's Discord; within half a year, its membership approached 400 brass and percussion players across the United States. To date, the organization has released two performances and is working on its third. + +All of the content OSDBC produces—including guides, documentation, sheet music, clicktracks, and virtual performances—is released under [Creative Commons][6] licenses so that other groups can replicate the project if they wish. + +### Who's involved? + +Most OSDBC members are professional musicians, teachers, and high school and college students. Because the drum corps community is relatively small, there's a strong possibility that students and their teachers might be participating together on the same project, leading to uncomfortableness or even potential legal issues relating to students and teachers being in the same group chats. Therefore, OSDBC members work anonymously, wearing hats and sunglasses in their performance videos, and many use pseudonyms within the group. It's an imperfect solution, but it does provide "plausible deniability" about someone's identity, says one member, a high school senior who serves on the project's all-volunteer staff. + +Anonymity also levels the playing field among musicians with different levels of experience, which helps open up collaboration and personal growth opportunities, including the ability to ask for help without fear of embarrassment or judgment. + +Members come from multiple disciplines—musicians, artists, composers, and audio engineers—volunteering their time and talent to produce multimedia content. Because everyone is a volunteer, there is no cost to be involved in the project. + +### How it works + +Unlike a typical drum corps, OSDBC can't perform together in person, first, because of the pandemic, and second because of the members' geographical distribution. Selecting a composition is a community effort, with votes taken both to pick a public domain musical piece to play and then to choose a composer (based on members' original compositions of the selected piece). The winner of the composition contest distributes sheet music, clicktracks, and advice for playing the piece, and the audio and video editors share [submission guidelines][7] about how to record and submit videos for inclusion in the project. Approximately a fifth of the members have submitted performances for each of the first three projects. + +Once the submission deadline has passed and all the performances are collected, the design team begins to mix the individual videos into a cohesive performance. + +Because editing a performance is a significant amount of work that requires specialized audio and video production knowledge and tools, the work is distributed among section leaders (e.g., trumpets, low brass, percussion, etc.). They use a mix of open source and proprietary software, chiefly [Audacity][8], Reaper, and FL Studios, to produce the videos; while open source is the preference, the members must use the applications that they are familiar with and have access to at their universities or jobs. + +### Get involved + +OSDBC plans to continue working together even after the COVID-19 pandemic. Given the uncertainty around the 2021 drum corps season, with WGI planning a virtual season and DCI weighing the feasibility of an abbreviated season, OSDBC provides a valuable option for the tight-knit community to collaborate and make music together. + +The project eagerly welcomes new performers, organizers, arrangers, and others. If you would like to get involved, visit the [website][5] and join the project's [Discord][9] for updated information and opportunities to participate in the next project. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/open-source-drum-bugle-corps + +作者:[Vicki Walker][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://opensource.com/users/vicki-walker +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/drums-beat.png?itok=vhr6E_f1 (Drums ) +[2]: https://www.dci.org/ +[3]: https://www.wgi.org/ +[4]: https://www.reddit.com/r/drumcorps/ +[5]: https://opensourcedbc.org/ +[6]: https://creativecommons.org/ +[7]: https://opensourcedbc.org/info-for-members/ +[8]: https://opensource.com/education/16/9/audacity-classroom +[9]: https://discord.gg/6QmCSK3 From a6afd8247bd9b56c26b9838a2626b3bc101ba9ea Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 22 Nov 2020 05:02:49 +0800 Subject: [PATCH 0851/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201120?= =?UTF-8?q?=20Day=2010:=20Training=20an=20RNN=20to=20count=20to=20three?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201120 Day 10- Training an RNN to count to three.md --- ...y 10- Training an RNN to count to three.md | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 sources/tech/20201120 Day 10- Training an RNN to count to three.md diff --git a/sources/tech/20201120 Day 10- Training an RNN to count to three.md b/sources/tech/20201120 Day 10- Training an RNN to count to three.md new file mode 100644 index 0000000000..a8352615fb --- /dev/null +++ b/sources/tech/20201120 Day 10- Training an RNN to count to three.md @@ -0,0 +1,56 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Day 10: Training an RNN to count to three) +[#]: via: (https://jvns.ca/blog/2020/11/20/day-10--training-an-rnn-to-count-to-three/) +[#]: author: (Julia Evans https://jvns.ca/) + +Day 10: Training an RNN to count to three +====== + +Yesterday I was trying to train an RNN to generate English that sounds kind of like Shakespeare. That was not working, so today I instead tried to do something MUCH simpler: train an RNN to generate sequences like + +``` +0 1 2 0 1 2 0 1 2 0 1 2 +``` + +and slightly more complicated sequences like + +``` +0 1 2 1 0 1 2 1 0 1 2 1 0 1 2 1 0 +``` + +I used (I think) the exact same RNN that I couldn’t get to work yesterday to generate English by training it on Shakespeare, so it was cool to see that I could at least use it for this much simpler task (memorize short sequences of numbers). + +### the jupyter notebook + +It’s late so I won’t explain all the code in this blog post, but here’s the PyTorch code I wrote to train the RNN to count to three. + + * Here it is as a [github gist][1] + * and [here it is on Colab][2] if you want to run it yourself + + + +In the gist there are a few experiments with different sequence lengths, like (unsurprisingly) it takes longer to train it to memorize a sequence of length 20 than a sequence of length 5. + +### simplifying is nice + +I’m super happy that I got an RNN to do something that I actually understand! I feel pretty hopeful that on Monday I’ll be able to go back to the character RNN problem of trying to get the RNN to generate English words now that I have this simpler thing working. + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/11/20/day-10--training-an-rnn-to-count-to-three/ + +作者:[Julia Evans][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://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://gist.github.com/jvns/b8804fb9d0672ce147a28d22648b4bd7 +[2]: https://colab.research.google.com/gist/jvns/b8804fb9d0672ce147a28d22648b4bd7/rnn-123.ipynb From 303ed50e92c158eb2cc6b47e4ab547f94a33b9de Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 22 Nov 2020 21:29:56 +0800 Subject: [PATCH 0852/1156] PRF&PUB @wxy https://linux.cn/article-12850-1.html --- ...rminal With These Command Line Browsers.md | 60 ++++++++++--------- 1 file changed, 31 insertions(+), 29 deletions(-) rename {translated/tech => published}/20201027 You can Surf Internet in Linux Terminal With These Command Line Browsers.md (68%) diff --git a/translated/tech/20201027 You can Surf Internet in Linux Terminal With These Command Line Browsers.md b/published/20201027 You can Surf Internet in Linux Terminal With These Command Line Browsers.md similarity index 68% rename from translated/tech/20201027 You can Surf Internet in Linux Terminal With These Command Line Browsers.md rename to published/20201027 You can Surf Internet in Linux Terminal With These Command Line Browsers.md index 53d2eb571a..54811507c5 100644 --- a/translated/tech/20201027 You can Surf Internet in Linux Terminal With These Command Line Browsers.md +++ b/published/20201027 You can Surf Internet in Linux Terminal With These Command Line Browsers.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12850-1.html) [#]: 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/) @@ -10,33 +10,35 @@ 使用命令行浏览器在 Linux 终端上网浏览 ====== -我猜你可能是用 Firefox 或基于 Chrome 的浏览器(如 [Brave][1])来阅读这篇文章。或者,也可能是 Chrome 浏览器或 [Chromium][2]。 +![](https://img.linux.net.cn/data/attachment/album/202011/22/212007f9s7aabmcj4aa9lo.jpg) -换句话说,你正在利用基于 GUI 的方式浏览网页。然而,在以前,人们使用终端来获取资源和浏览网页,因为所有的东西大多是基于文本的信息。 +我猜你阅读这篇文章可能是用 Firefox 或基于 Chrome 的浏览器(如 [Brave][1]),或者,也可能是 Chrome 浏览器或 [Chromium][2]。 -虽然现在不能从终端上获取每一个信息,但对于一些文本信息,还是可以尝试使用命令行浏览器,从 Linux 终端上打开网页。 +换句话说,你正在利用基于 GUI 的方式浏览网页。然而,在以前,人们使用终端来获取资源和浏览网页,因为所有的东西大多是基于文本的。 -不仅如此,如果你访问的是远程服务器,或者只有一个没有 GUI 的终端,终端网页浏览器也可以证明它是有用的。 +虽然现在不能从终端上获取每个信息,但对于一些文本信息,还是可以尝试使用命令行浏览器,从 Linux 终端上打开网页。 -因此,在本文中,我将介绍一些基于终端的网络浏览器,你可以在 Linux 上尝试它们。 +不仅如此,如果你访问的是远程服务器,或者只有一个没有 GUI 的终端,终端网页浏览器就可以发挥用处了。 + +因此,在本文中,我将介绍一些基于终端的 Web 浏览器,你可以在 Linux 上尝试它们。 ### Linux 用户的最佳终端 Web 浏览器 -注:榜单排名不分先后。 +注:此榜单排名不分先后。 #### 1、W3M ![][3] -`w3m` 是一个流行的基于文本的开源终端 Web 浏览器。尽管最初的项目已经不再活跃,但它的一个活跃版本正由另一个开发者 Tatsuya Kinoshita 维护。 +`w3m` 是一个流行的基于文本的开源终端 Web 浏览器。尽管其初始项目已经不再活跃,但另一个开发者 Tatsuya Kinoshita 正在维护着它的一个活跃分支。 -`w3m` 相当简单,支持 SSL 连接、彩色,也支持内嵌图片。当然,根据你试图访问的资源,你那边的情况可能会有所不同。根据我的简单测试,它似乎无法加载 [DuckDuckGo][4],但我可以[在终端中使用 Google][5]就可以了。 +`w3m` 相当简单,支持 SSL 连接、色彩,也支持内嵌图片。当然,根据你试图访问的资源,你那边的情况可能会有所不同。根据我的简单测试,它似乎无法加载 [DuckDuckGo][4],但我可以[在终端中使用 Google][5]就够了。 安装后,你可以简单的在终端中输入 `w3m` 以得到帮助。如果你感兴趣的话,也可以到 [GitHub][6] 上去查看它的仓库。 **如何安装和使用 w3m?** -`w3m` 在任何基于 Debian 的 Linux 发行版的默认仓库中都是可用的。如果你有一个基于 Arch 的发行版,如果没有直接可用的软件包,你可能需要查看一下 [AUR][7]。 +`w3m` 在任何基于 Debian 的 Linux 发行版的默认仓库中都是可用的。如果你有一个基于 Arch 的发行版,但没有直接可用的软件包,你可能需要查看一下 [AUR][7]。 对于 Ubuntu,你可以通过键入以下内容来安装它: @@ -50,27 +52,27 @@ sudo apt install w3m w3m-img w3m xyz.com ``` -当然,你需要将 `xyz.com` 替换成任何你想浏览/测试的网站。最后,你应该知道,你可以使用键盘上的方向键来导航,当你想采取一个动作时,按回车键。 +当然,你需要将 `xyz.com` 替换成任何你想浏览或测试的网站。最后,你应该知道,你可以使用键盘上的方向键来导航,当你想采取一个动作时,按回车键。 -要退出,你可以按 `SHIFT+Q`,返回上一页是 `SHIFT+B`。其他快捷键包括 `SHIFT+T` 打开新标签页和 `SHIFT+U` 打开新的 URL。 +要退出,你可以按 `SHIFT+Q`,返回上一页是 `SHIFT+B`。其他快捷键包括用 `SHIFT+T` 打开新标签页和用 `SHIFT+U` 打开新的 URL。 -你可以通过访问它的手册页面来了解更多信息。 +你可以通过访问它的手册页来了解更多信息。 #### 2、Lynx ![][8] -Lynx 是又一个开源的命令行浏览器,你可以试试。幸运的是,很多的网站在使用 Lynx 时往往能正常工作,所以我说它在这方面肯定更好。我能够加载 DuckDuckGo,并使其工作。 +Lynx 是另一个开源的命令行浏览器,你可以试试。幸运的是,很多的网站在使用 Lynx 时往往能正常工作,所以我说它在这方面肯定更好。我能够加载 DuckDuckGo,并使其工作。 -除此之外,我还注意到它可以让你在访问各种网络资源时接受或拒绝 cookie。你也可以将它设置为总是接受或拒绝。所以,这是件好事。 +除此之外,我还注意到它可以让你在访问各种 Web 资源时接受或拒绝 cookie。你也可以将它设置为总是接受或拒绝。所以,这是件好事。 -另一方面,在终端上使用时,窗口不能很好地调整大小。我还没有寻找到任何解决方法,所以如果你正在尝试这个,你可能会想要这样做。不管是哪种情况,它都很好用,当你在终端启动它时,你会得到所有键盘快捷键的说明。 +另一方面,在终端上使用时,窗口不能很好地调整大小。我还没有寻找到任何解决方法,所以如果你正在尝试这个,你可能会想要这样做。不论如何,它都很好用,当你在终端启动它时,你会得到所有键盘快捷键的说明。 请注意,它与系统终端主题不匹配,所以无论你的终端看起来如何,它都会看起来不同。 **如何安装 Lynx?** -与 w3m 不同的是,如果你有兴趣尝试的话,确实可以找到一些 Win32 上的安装程序。但是,在 Linux 上,它在大多数的默认仓库中都是可用的。 +与 w3m 不同的是,如果你有兴趣尝试的话,确实可以找到一些 Win32 上的安装程序。不过,在 Linux 上,它在大多数的默认仓库中都是可用的。 对于 Ubuntu 来说,你只需要输入: @@ -92,17 +94,17 @@ lynx examplewebsite.com ![][10] -Links2 是一款有趣的基于文本的浏览器,你可以在你的终端上轻松使用,用户体验良好。它给你提供了一个很好的界面,你启动它后,只要输入网址就可以了 +Links2 是一款有趣的基于文本的浏览器,你可以在你的终端上轻松使用,用户体验良好。它提供了一个很好的界面,你启动它后,只要输入网址就可以了。 ![][11] -值得注意的是,主题将取决于你的终端设置,我设置为“黑绿色”主题,因此你看到的就是这个。当你以命令行浏览器的方式启动它后,你只需要按任意键就会出现 URL 提示,或者按 `Q` 键退出。它足够好用,可以渲染大多数网站的文字。 +值得注意的是,主题将取决于你的终端设置,我设置为“黑绿色”主题,因此你看到的就是这个。当你以命令行浏览器的方式启动它后,你只需要按任意键就会出现 URL 提示,或者按 `Q` 键退出。它相当好用,可以渲染大多数网站的文字。 与 Lynx 不同的是,你没有接受或拒绝 cookie 的功能。除此之外,它似乎工作的还不错。 **如何安装 Links2?** -正如你所期望的,你会发现它在大多数默认的资源库中都有。对于 Ubuntu,你可以在终端输入以下命令来安装它: +正如你所期望的,你会发现它在大多数默认的仓库中都有。对于 Ubuntu,你可以在终端输入以下命令来安装它: ``` sudo apt install links2 @@ -126,7 +128,7 @@ eLinks 类似于 Links2,但它已经不再维护了。你仍然可以在各种 sudo apt install elinks ``` -对于其他 Linux 发行版,你应该可以在标准软件库中找到它。但是,如果你在软件库中找不到它,你可以参考[官方安装说明][14]。 +对于其他 Linux 发行版,你应该可以在标准软件仓库中找到它。但是,如果你在软件仓库中找不到它,你可以参考[官方安装说明][14]。 ### 总结 @@ -145,7 +147,7 @@ via: https://itsfoss.com/terminal-web-browsers/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -153,17 +155,17 @@ via: https://itsfoss.com/terminal-web-browsers/ [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 +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/w3m-google.jpg [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 +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/lynx-terminal.jpg [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 +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/links2-terminal.jpg +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/links2-terminal-welcome.jpg [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 +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/elinks-terminal.jpg [14]: http://elinks.or.cz/documentation/installation.html [15]: https://www.brow.sh/ [16]: https://itsfoss.com/download-files-from-linux-terminal/ From 1a00e763e7a9859070becb6cc573df98a6d3fd27 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sun, 22 Nov 2020 21:34:04 +0800 Subject: [PATCH 0853/1156] Translating --- ...How to use Serializers in the Django Python web framework.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201116 How to use Serializers in the Django Python web framework.md b/sources/tech/20201116 How to use Serializers in the Django Python web framework.md index 9a5f441221..54e18e6a1e 100644 --- a/sources/tech/20201116 How to use Serializers in the Django Python web framework.md +++ b/sources/tech/20201116 How to use Serializers in the Django Python web framework.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 5e7bd627614de0154ebac2db33e534a2ca5430ca Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 23 Nov 2020 08:39:42 +0800 Subject: [PATCH 0854/1156] translated --- ...1116 Podman with capabilities on Fedora.md | 115 ------------------ ...1116 Podman with capabilities on Fedora.md | 115 ++++++++++++++++++ 2 files changed, 115 insertions(+), 115 deletions(-) delete mode 100644 sources/tech/20201116 Podman with capabilities on Fedora.md create mode 100644 translated/tech/20201116 Podman with capabilities on Fedora.md diff --git a/sources/tech/20201116 Podman with capabilities on Fedora.md b/sources/tech/20201116 Podman with capabilities on Fedora.md deleted file mode 100644 index dd8ab976e8..0000000000 --- a/sources/tech/20201116 Podman with capabilities on Fedora.md +++ /dev/null @@ -1,115 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Podman with capabilities on Fedora) -[#]: via: (https://fedoramagazine.org/podman-with-capabilities-on-fedora/) -[#]: author: (shiwanibiradar https://fedoramagazine.org/author/shiwanibiradar/) - -Podman with capabilities on Fedora -====== - -![][1] - -Containerization is a booming technology. As many as seventy-five percent of global organizations could be running some type of containerization technology in the near future. Since widely used technologies are more likely to be targeted by hackers, securing containers is especially important. This article will demonstrate how [POSIX capabilities][2] are used to secure Podman containers. Podman is the default container management tool in RHEL8. - -### Determine the Podman container’s privilege mode - -Containers run in either privileged or unprivileged mode. In privileged mode, [the container uid 0 is mapped to the host’s uid 0][3]. For some use cases, unprivileged containers [lack sufficient access][4] to the resources of the host machine. Technologies and techniques including Mandatory Access Control (apparmor, SELinux), seccomp filters, dropping of capabilities, and namespaces help to secure containers regardless of their mode of operation. - -**To determine the privilege mode from outside the container:** - -``` -$ podman inspect --format="{{.HostConfig.Privileged}}" -``` - -If the above command returns _true_ then the container is running in privileged mode. If it returns _false_ then the container is running in unprivileged mode. - -**To determine the privilege mode from inside the container:** - -``` -$ ip link add dummy0 type dummy -``` - -If this command allows you to create an interface then you are running a privileged container. Otherwise you are running an unprivileged container. - -### Capabilities - -Namespaces isolate a container’s processes from arbitrary access to the resources of its host and from access to the resources of other containers running on the same host. Processes within _privileged_ containers, however, might still be able to do things like alter the IP routing table, trace arbitrary processes, and load kernel modules. Capabilities allow one to apply finer-grained restrictions on what resources the processes within a container can access or alter; even when the container is running in privileged mode. Capabilities also allow one to assign privileges to an unprivileged container that it would not otherwise have. - -For example, to add the _NET_ADMIN_ capability to an unprivileged container so that a network interface can be created inside of the container, you would run _podman_ with parameters similar to the following: - -``` -[root@vm1 ~]# podman run -it --cap-add=NET_ADMIN centos -[root@b27fea33ccf1 /]# ip link add dummy0 type dummy -[root@b27fea33ccf1 /]# ip link -``` - -The above commands demonstrate a _dummy0_ interface being created in an unprivileged container. Without the _NET_ADMIN_ capability, an unprivileged container would not be able to create an interface. The above commands demonstrate how to grant a capability to an unprivileged container. - -Currently, there are about [39 capabilities][5] that can be granted or denied. Privileged containers are granted many capabilities by default. It is advisable to drop unneeded capabilities from privileged containers to make them more secure. - -**To drop all capabilities from a container:** - -``` -$ podman run -it -d --name mycontainer --cap-drop=all centos -``` - -**To list a container’s capabilities:** - -``` -$ podman exec -it 48f11d9fa512 capsh --print -``` - -The above command should show that no capabilities are granted to the container. - -**Refer to the _capabilities_ man page for a complete list of capabilities:** - -``` -$ man capabilities -``` - -**Use the _capsh_ command to list the capabilities you currently possess:** - -``` -$ capsh --print -``` - -As another example, the below command demonstrates dropping the _NET_RAW_ capability from a container. Without the _NET_RAW_ capability, servers on the internet cannot be pinged from within the container. - -``` -$ podman run -it --name mycontainer1 --cap-drop=net_raw centos ->>> ping google.com (will output error, operation not permitted) -``` - -As a final example, if your container were to only need the _SETUID_ and _SETGID_ capabilities, you could achieve such a permission set by dropping all capabilities and then re-adding only those two. - -``` -$ podman run -d --cap-drop=all --cap-add=setuid --cap-add=setgid fedora sleep 5 > /dev/null; pscap | grep sleep -``` - -The _pscap_ command shown above should show the capabilities that have been granted to the container. - -I hope you enjoyed this brief exploration of how capabilities are used to secure Podman containers. - -Thank You! - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/podman-with-capabilities-on-fedora/ - -作者:[shiwanibiradar][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/shiwanibiradar/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2018/10/podman-816x345.jpg -[2]: https://www.linuxjournal.com/magazine/making-root-unprivileged -[3]: https://linuxcontainers.org/lxc/security/#privileged-containers -[4]: https://github.com/containers/podman/blob/master/rootless.md -[5]: https://man7.org/linux/man-pages/man7/capabilities.7.html diff --git a/translated/tech/20201116 Podman with capabilities on Fedora.md b/translated/tech/20201116 Podman with capabilities on Fedora.md new file mode 100644 index 0000000000..c35e7fbfc3 --- /dev/null +++ b/translated/tech/20201116 Podman with capabilities on Fedora.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Podman with capabilities on Fedora) +[#]: via: (https://fedoramagazine.org/podman-with-capabilities-on-fedora/) +[#]: author: (shiwanibiradar https://fedoramagazine.org/author/shiwanibiradar/) + +在 Fedora 中使用 Podman 结合 Capabilities +====== + +![][1] + +容器化是一项蓬勃发展的技术。在不久的将来,多达百分之七十五的全球组织可能会运行某种类型的容器化技术。由于广泛使用的技术更容易成为黑客攻击的目标,因此保护容器的安全就显得尤为重要。本文将演示如何使用 [POSIX Capabilities][2] 来保护 Podman 容器的安全。Podman 是 RHEL8 中默认的容器管理工具。 + +### 确定 Podman 容器的权限模式 + +容器以特权模式或无特权模式运行。在特权模式下,[容器的 uid 0 被映射到主机的 uid 0][3]。对于某些情况,无特权的容器[缺乏对主机资源的充足访问][4]。包括强制访问控制(apparmor、SELinux)、seccomp 过滤器、删除 Capabilities 和命名空间在内的技有助于确保容器的安全,而不管其操作模式如何。 + +**要从容器外部确定特权模式:** + +``` +$ podman inspect --format="{{.HostConfig.Privileged}}" +``` + +如果上面的命令返回 _true_,那么容器在特权模式下运行。如果返回 _false_,那么容器在非特权模式下运行。 + +**要从容器内部确定特权模式:** + +``` +$ ip link add dummy0 type dummy +``` + +如果该命令允许你创建一个接口,那么你运行的是一个特权容器,否则你运行的是一个非特权容器。 + +### Capabilities + +命名空间隔离了容器的进程,使其无法任意访问主机的资源,也无法访问在同一主机上运行的其他容器的资源。然而,在_特权_容器内的进程仍然可以做一些事情,如改变 IP 路由表、跟踪任意进程和加载内核模块。Capabilities 允许人们对容器内的进程可以访问或更改的资源施加更细微的限制,即使容器在特权模式下运行也一样。Capabilities 还允许人们为无特权的容器分配它本来不会拥有的特权。 + +例如,如果要将 _NET_ADMIN_ 功能添加到一个无特权的容器中,以便在容器内部创建一个网络接口,你可以用下面的参数运行 _podman_: + +``` +[root@vm1 ~]# podman run -it --cap-add=NET_ADMIN centos +[root@b27fea33ccf1 /]# ip link add dummy0 type dummy +[root@b27fea33ccf1 /]# ip link +``` + +上面的命令演示了在一个无特权的容器中创建一个_dummy0_ 接口。如果没有 _NET_ADMIN_ Capability,非特权容器将无法创建接口。上面的命令演示了如何将一个 Capability 授予一个无特权的容器。 + +目前,大约有 [39 种 Capabilities][5] 可以被授予或拒绝。特权容器默认会被授予许多 Capability。建议从特权容器中删除不需要的 Capability,以使其更加安全。 + +**要从容器中删除所有 Capability:** + +``` +$ podman run -it -d --name mycontainer --cap-drop=all centos +``` + +**列出一个容器的 Capability:** + +``` +$ podman exec -it 48f11d9fa512 capsh --print +``` + +上述命令显示没有向容器授予任何 Capability。 + +**请参考 _capabilities_ 手册页以获取完整的 Capability 列表:** + +``` +$ man capabilities +``` + +**使用 _capsh_ 命令来列出目前拥有的 Capability:** + +``` +$ capsh --print +``` + +作为另一个例子,下面的命令演示了如何从容器中删除 _NET_RAW_ Capability。如果没有 _NET_RAW_ Capability,就不能从容器中 ping 互联网上的服务器。 + +``` +$ podman run -it --name mycontainer1 --cap-drop=net_raw centos +>>> ping google.com (will output error, operation not permitted) +``` + +最后一个例子,如果你的容器只需要 _SETUID_ 和 _SETGID_ 功能,你可以删除所有 Capability,然后只重新添加这两个 Capability 来实现这样的权限设置。 + +``` +$ podman run -d --cap-drop=all --cap-add=setuid --cap-add=setgid fedora sleep 5 > /dev/null; pscap | grep sleep +``` + +上面的 _pscap_ 命令会显示容器被授予的 Capability。 + +我希望你喜欢这个关于如何使用 Capabilities 来保护 Podman 容器的简短探索。 + +谢谢! + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/podman-with-capabilities-on-fedora/ + +作者:[shiwanibiradar][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/shiwanibiradar/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2018/10/podman-816x345.jpg +[2]: https://www.linuxjournal.com/magazine/making-root-unprivileged +[3]: https://linuxcontainers.org/lxc/security/#privileged-containers +[4]: https://github.com/containers/podman/blob/master/rootless.md +[5]: https://man7.org/linux/man-pages/man7/capabilities.7.html From ee1d456c3e77ab552dce3d8b1bd355dc1e0a1e0a Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 23 Nov 2020 08:43:54 +0800 Subject: [PATCH 0855/1156] translating --- ...1118 LazPaint- A Free - Open Source Paint.NET Alternative.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201118 LazPaint- A Free - Open Source Paint.NET Alternative.md b/sources/tech/20201118 LazPaint- A Free - Open Source Paint.NET Alternative.md index ad0c5f6594..0481069619 100644 --- a/sources/tech/20201118 LazPaint- A Free - Open Source Paint.NET Alternative.md +++ b/sources/tech/20201118 LazPaint- A Free - Open Source Paint.NET Alternative.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From ec54953c90c8a3e96ec18ceb0639f782fecbb4c7 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 23 Nov 2020 10:48:35 +0800 Subject: [PATCH 0856/1156] PRF @geekpi --- ... encrypted disks on Linux automatically.md | 106 +++++++----------- 1 file changed, 42 insertions(+), 64 deletions(-) diff --git a/translated/tech/20201116 Unlock encrypted disks on Linux automatically.md b/translated/tech/20201116 Unlock encrypted disks on Linux automatically.md index 7e97ec99a6..e7a44a312b 100644 --- a/translated/tech/20201116 Unlock encrypted disks on Linux automatically.md +++ b/translated/tech/20201116 Unlock encrypted disks on Linux automatically.md @@ -1,31 +1,31 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12851-1.html) [#]: subject: (Unlock encrypted disks on Linux automatically) [#]: via: (https://opensource.com/article/20/11/nbde-linux) [#]: author: (Curt Warfield https://opensource.com/users/rcurtiswarfield) 自动解锁 Linux 上的加密磁盘 ====== -通过使用网络绑定磁盘加密 (NBDE),无需手动输入密码即可打开加密磁盘。 -![Lock][1] -从安全的角度来看,对敏感数据进行加密以保护其免受窥探和黑客的攻击是很重要的。Linux 统一密钥设置([LUKS][2])是一个很好的工具,也是 Linux 磁盘加密的通用标准。因为它将所有相关的设置信息存储在分区头中,所以它使数据迁移变得简单。 +> 通过使用网络绑定磁盘加密(NBDE),无需手动输入密码即可打开加密磁盘。 + +![](https://img.linux.net.cn/data/attachment/album/202011/23/104735lmx18sxxs18f4xcc.jpg) + +从安全的角度来看,对敏感数据进行加密以保护其免受窥探和黑客的攻击是很重要的。Linux 统一密钥设置Linux Unified Key Setup([LUKS][2])是一个很好的工具,也是 Linux 磁盘加密的通用标准。因为它将所有相关的设置信息存储在分区头部中,所以它使数据迁移变得简单。 要使用 LUKS 配置加密磁盘或分区,你需要使用 [cryptsetup][3] 工具。不幸的是,加密磁盘的一个缺点是,每次系统重启或磁盘重新挂载时,你都必须手动提供密码。 -然而,网络绑定磁盘加密 (NBDE) 可以在没有任何用户干预的情况下自动安全地解锁加密磁盘。它可以在一些 Linux 发行版中使用,从 Red Hat Enterprise Linux 7.4、CentOS 7.4 和 Fedora 24 开始,以及之后的后续版本。 +然而,网络绑定磁盘加密Network-Bound Disk Encryption(NBDE) 可以在没有任何用户干预的情况下自动安全地解锁加密磁盘。它可以在一些 Linux 发行版中使用,包括从 Red Hat Enterprise Linux 7.4、CentOS 7.4 和 Fedora 24 开始,以及之后的后续版本。 NBDE 采用以下技术实现: -* **[Clevis 框架][4]:**一个可插拔的框架工具,可自动解密和解锁 LUKS 卷 -* **[Tang 服务器][5]:**用于将加密密钥绑定到网络状态的服务 +* [Clevis 框架][4]:一个可插拔的框架工具,可自动解密和解锁 LUKS 卷 +* [Tang 服务器][5]:用于将加密密钥绑定到网络状态的服务 - - -Tang 向 Clevis 客户端提供加密密钥。 据 Tang 的开发人员介绍,这为密钥托管服务提供了一个安全、无状态、匿名的替代方案。 +Tang 向 Clevis 客户端提供加密密钥。据 Tang 的开发人员介绍,这为密钥托管服务提供了一个安全、无状态、匿名的替代方案。 由于 NBDE 使用客户端-服务器架构,你必须同时配置客户端和服务器。你可以在你的本地网络上使用一个虚拟机作为 Tang 服务器。 @@ -33,19 +33,17 @@ Tang 向 Clevis 客户端提供加密密钥。 据 Tang 的开发人员介绍, 用 sudo 安装 Tang: - ``` -`sudo yum install tang -y` +sudo yum install tang -y ``` 启用 Tang 服务器: - ``` -`sudo systemctl enable tangd.socket --now` +sudo systemctl enable tangd.socket --now ``` -Tang 服务器工作在 80 端口,且必须加入 firewalld。 添加相应的 firewalld 规则: +Tang 服务器工作在 80 端口,需加入到 firewalld 防火墙。添加相应的 firewalld 规则: ``` @@ -59,15 +57,13 @@ sudo firewall-cmd --reload 在本例中,假设你已经添加了一个名为 `/dev/vdc` 的新的 1GB 磁盘到你的系统中。 -使用 fdisk 或 parted 创建主分区: - +使用 `fdisk` 或 `parted` 创建主分区: ``` sudo fdisk /dev/vdc ``` -完成以下步骤来安装客户端。 - +完成以下步骤来安装客户端: ``` Welcome to fdisk (util-linux 2.23.2). @@ -81,8 +77,7 @@ Building a new DOS disklabel with disk identifier 0x4a6812d4. Command (m for help): ``` -输入 **n** 来创建新的分区: - +输入 `n` 来创建新的分区: ``` Partition type: @@ -99,8 +94,7 @@ Using default response p Partition number (1-4, default 1): ``` -按下**回车**键选择默认分区号: - +按下回车键选择默认分区号: ``` First sector (2048-2097151, default 2048): @@ -108,8 +102,7 @@ Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-2097151, default 2097151): ``` -按**回车**键选择最后一个扇区: - +按回车键选择最后一个扇区: ``` Using default value 2097151 @@ -118,8 +111,7 @@ Partition 1 of type Linux and of size 1023 MiB is set Command (m for help): wq ``` -输入 **wq** 保存更改并退出 fdisk: - +输入 `wq` 保存更改并退出 `fdisk`: ``` The partition table has been altered! @@ -130,20 +122,17 @@ Syncing disks. 运行 `partprobe` 通知系统分区表的变化: - ``` -`sudo partprobe` +sudo partprobe ``` -使用 sudo 安装 cryptsetup 软件包: - +使用 `sudo` 安装 cryptsetup 软件包: ``` -`sudo yum install cryptsetup -y` +sudo yum install cryptsetup -y ``` -使用 `cryptsetup luksFormat` 命令对磁盘进行加密。当提示时,你需要输入 **YES**,并选择和输入密码来加密磁盘: - +使用 `cryptsetup luksFormat` 命令对磁盘进行加密。当提示时,你需要输入大写的 `YES`,并输入密码来加密磁盘: ``` sudo cryptsetup luksFormat /dev/vdc1 @@ -159,7 +148,6 @@ Verify passphrase: 使用 `cryptsetup luksOpen` 命令将加密的分区映射到一个逻辑设备上。例如,使用 `encryptedvdc1` 作为名称。你还需要再次输入密码: - ``` sudo cryptsetup luksOpen /dev/vdc1 encryptedvdc1 Enter passphrase for /dev/vdc1: @@ -169,67 +157,58 @@ Enter passphrase for /dev/vdc1: 在加密的分区上创建一个 XFS 文件系统: - ``` -`sudo mkfs.xfs /dev/mapper/encryptedvdc1` +sudo mkfs.xfs /dev/mapper/encryptedvdc1 ``` 创建一个挂载加密分区的目录: - ``` -`sudo mkdir /encrypted` +sudo mkdir /encrypted ``` 使用 `cryptsetup luksClose` 命令锁定分区: - ``` -`cryptsetup luksClose encryptedvdc1` +cryptsetup luksClose encryptedvdc1 ``` -使用 sudo 安装 Clevis 软件包: - +使用 `sudo` 安装 Clevis 软件包: ``` -`sudo yum install clevis clevis-luks clevis-dracut -y` +sudo yum install clevis clevis-luks clevis-dracut -y ``` -修改 /etc/crypttab,在启动时打开加密卷: - +修改 `/etc/crypttab`,在启动时打开加密卷: ``` -`sudo vim /etc/crypttab` +sudo vim /etc/crypttab ``` 增加以下一行: - ``` -`encryptedvdc1 /dev/vdc1 none _netdev` +encryptedvdc1 /dev/vdc1 none _netdev ``` -修改 /etc/fstab,在重启时或启动时自动挂载加密卷: - +修改 `/etc/fstab`,在重启时或启动时自动挂载加密卷: ``` -`sudo vim /etc/fstab` +sudo vim /etc/fstab ``` 增加以下一行: - ``` -`/dev/mapper/encryptedvdc1 /encrypted xfs _netdev 1 2` +/dev/mapper/encryptedvdc1 /encrypted xfs _netdev 1 2 ``` 在这个例子中,假设 Tang 服务器的 IP 地址是 `192.168.1.20`。如果你喜欢,也可以使用主机名或域名。 运行以下 `clevis` 命令: - ``` -sudo clevis bind luks -d /dev/vdc1 tang '{"url":"' +sudo clevis bind luks -d /dev/vdc1 tang '{"url":"http://192.168.1.20"}' The advertisement contains the following signing keys: rwA2BAITfYLuyNiIeYUMBzkhk7M @@ -238,16 +217,15 @@ Do you wish to trust these keys? [ynYN] Y Enter existing LUKS password: ``` -输入 **Y** 接受 Tang 服务器的密钥,并提供现有的 LUKS 密码进行初始设置。 - -通过 systemctl 启用 clevis-luks-askpass.path,以防止非 root 分区被提示输入密码。 +输入 `Y` 接受 Tang 服务器的密钥,并提供现有的 LUKS 密码进行初始设置。 +通过 `systemctl` 启用 `clevis-luks-askpass.path`,以防止非根分区被提示输入密码。 ``` -`sudo systemctl enable clevis-luks-askpass.path` +sudo systemctl enable clevis-luks-askpass.path ``` -客户端已经安装完毕。 现在,每当你重启服务器时,加密后的磁盘应该会自动解密,并通过 Tang 服务器取回密钥进行挂载。 +客户端已经安装完毕。现在,每当你重启服务器时,加密后的磁盘应该会自动解密,并通过 Tang 服务器取回密钥进行挂载。 如果 Tang 服务器因为任何原因不可用,你需要手动提供密码,才能解密和挂载分区。 @@ -258,7 +236,7 @@ via: https://opensource.com/article/20/11/nbde-linux 作者:[Curt Warfield][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6b02deeffacfa29f4ed73ce249cb0b3fad8ad501 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 23 Nov 2020 10:49:09 +0800 Subject: [PATCH 0857/1156] PUB @geekpi https://linux.cn/article-12851-1.html --- .../20201116 Unlock encrypted disks on Linux automatically.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20201116 Unlock encrypted disks on Linux automatically.md (100%) diff --git a/translated/tech/20201116 Unlock encrypted disks on Linux automatically.md b/published/20201116 Unlock encrypted disks on Linux automatically.md similarity index 100% rename from translated/tech/20201116 Unlock encrypted disks on Linux automatically.md rename to published/20201116 Unlock encrypted disks on Linux automatically.md From 6824b07cced48e37da9847d1cd54cc0cea51c2d0 Mon Sep 17 00:00:00 2001 From: niko Date: Mon, 23 Nov 2020 21:12:27 +0800 Subject: [PATCH 0858/1156] frogOAO --- ...s for USB, Clipboard and Folder Sharing.md | 168 +++++++++--------- 1 file changed, 87 insertions(+), 81 deletions(-) diff --git a/sources/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md b/sources/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md index 69b067c82b..4ccd0f00f6 100644 --- a/sources/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md +++ b/sources/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md @@ -7,221 +7,227 @@ [#]: via: (https://itsfoss.com/install-fedora-in-virtualbox/) [#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) -How to Install Fedora in VirtualBox [With Steps for USB, Clipboard and Folder Sharing] +如何在 Fedora 中安装 VirtualBox 【附带 USB,剪切板,文件夹共享教程】 ====== -If you are curious about Fedora Linux, there are several ways to try it. +如果您对 Fedora Linux 感兴趣,这有几种方式可以尝试它。 -The easiest way that won’t affect your current operating system is to [create a live USB of Fedora.][1] +最简单还不影响您操作系统的方式是 [制作 Fedora 的 USB 启动盘][1] -An alternative way to try Fedora, is to get advantage of virtualization technology through an installation in VirtualBox. This way, you use Fedora like an application on your current operating system. +另一种方式是安装 VirtualBox 利用虚拟化技术来尝试 Fedora。这样,你可以在你的操作系统上像使用应用程序一样使用 Fedora。 -This way, you can perform more thorough testing without messing up your current operating system. +通过这种方式,您可以执行更彻底的测试,而不会搞乱当前的操作系统。 -You can even copy your virtual setup and re-install it on some other system. Sounds handy? Let me show you how to do it. +您甚至可以复制您的虚拟安装程序,并在其他系统上重新安装它。听起来方便吗?让我来教你怎么做。 -### Installing Fedora in VirtualBox +### 在 Fedora 上安装 Fedora ![][2] -Let’s see the steps for installing Fedora Linux in Oracle VirtualBox. +让我们分步在 Oracle VirtualBox 上安装 Fedora。 -#### Step 1: Install VirtualBox +#### 步骤一:安装 VirtualBox -If you haven’t already installed VirtualBox on your system, you can download it from the official website. You can find instructions for Windows, Mac OS and Linux. [Ubuntu users can refer to this detailed tutorial on installing VirtualBox][3]. +如果您的系统还没有安装 VirtualBox,您可以从官方网站下载。您可以找到 Windows,MacOs 和 Linux 的说明。 [Ubuntu 用户可以参考这个关于安装 VirtualBox 的详细教程。][3]. ![][4] -[Download VirtualBox][5] +[下载 VirtualBox][5] -#### **Step 2: Download the Fedora ISO** +#### **步骤二: 下载 Fedora ISO** -If you are not familiar with fedora, there are a few images to be aware of. +如果您不熟悉 Fedora,那么这些镜像您需要知道。 -[Fedora IoT][6] is to be used for scalable infrastructure, [Fedora workstation][7] is an image with a set of tools oriented for a desktop in a vanilla GNOME desktop environment and [Fedora server][8] as its name reveals, is tailored for a server or data center. +[Fedora IoT][6] 是用于可扩展基础设施的, [Fedora workstation][7] 是一个镜像,带有一组面向普通GNOME桌面环境中的桌面的工具。[Fedora server][8] 顾名思义,是为服务器或数据中心定制的。 -If GNOME isn’t your first choice, you can download a [spin][9] of Fedora desktop with an alternative desktop environment. For this tutorial, I chose [Fedora 33][10] with the GNOME desktop environment. +如果GNOME不是您的首选,您可以下载一个带有替代桌面环境的[定制版][9]Fedora桌面。 对于本教程,我选择了带有GNOME桌面环境的[Fedora 33][10]。 -[Download Fedora][11] +[下载 Fedora][11] -#### Step 3: Create an empty virtual machine and configure it +#### 步骤三: 创建一个空虚拟机并对其进行配置 -Fedora requires a minimum of 20GB disk space & 2GB RAM, to install and run successfully. Although double those amounts is recommended for a smoother user experience. Based on that I will create and configure the virtual machine. +要成功安装和运行 Fedora,至少需要 20GB 磁盘空间和 2GB RAM。不过,为了获得更流畅的用户体验,建议增加一倍。在此基础上,我将创建并配置虚拟机。 -Start Virtual Box and click on New. +开启 Virtual Box 点击 New。 -![Create a new virtual machine][12] +![创建一个新的虚拟机][12] -The most important option to pay attention, is the **type to be set to Linux and the version to Fedora (64-bit)**. If you start typing Fedora at the name prompt, VirtualBox will automatically pick the correct settings for you. Although the name doesn’t have to be Fedora, it can be anything you like. +需要注意,最重要的选项是 **将类型设置为 Linux and 版本设置为 Fedora (64-bit)**。如果您在名称提示符处开始输入 Fedora,VirtualBox 将自动为您选择正确的设置。虽然名字不一定非得是 Fedora,它可以是任何你喜欢的。 -_If you have access to 32-bit version only, you need to enable virtualization technology on BIOS, if you have an AMD CPU it is called SVM. Worst-case scenario is that your CPU doesn’t support virtualization technology. If you are not sure, check this first._ +_如果您只能访问32位版本,那么您需要在 BIOS 上启用虚拟化技术,如果您有一个 AMD CPU,它被称为 SVM。最坏的情况是您的 CPU 不支持虚拟化技术。如果你不确定,先检查这个。_ -Once you have similar settings with me, click on the create button. +如果您的设置和我一样,点击 create 按钮。 ![Name your VM and assign it at least 3 GB RAM][13] -As mentioned before, you need at least 20 GB of disk space to be able to install Fedora. I have 32 GB of RAM on my system so I assigned 8 GB here. You should be fine with 3 GB of RAM. +如前所述,至少需要 20gb 的磁盘空间才能安装 Fedora。我的系统上有 32gb 的内存,所以我分配了 8gb。3 GB 的内存应该没问题。 -A word about RAM consumption, the RAM will only be consumed by the virtual machine when you are running it. Otherwise, it will be available for regular usage. +顺便说下内存的使用,只有在运行虚拟机时,虚拟机才会使用内存。否则,它将可用于常规使用。 -Make sure that the rest of the settings match the example and click Create. +确保其余设置与示例匹配,并点击 Create。 ![Assign 15-20 GB of disk space in VDI format][14] -Before you click the start button of your virtual machine, you need to load the ISO as shown below [Optical Drive]. +在你点击虚拟机的 Start 按钮之前,你需要加载如下所示的 ISO [光驱]。 ![Add the Fedora ISO to optical drive storage][15] -As your virtual hard drive is empty, the virtual machine will boot from this ISO. Think of it as using a live USB or disk for installing Linux. +因为你的虚拟硬盘是空的,虚拟机将从这个 ISO 启动。可以把它看作是使用 live USB 或磁盘安装 Linux。 ![Go to Settings and add ISO as optical drive][16] -Then, if you have a multi-core CPU it is recommended to assign 2 or more cores for your virtual machine. You may find the CPU cores under the system tab. When you configure your system click ok and start the virtual machine. +然后,如果您有一个多核CPU,建议为虚拟机分配 2 个或更多的核。您可以在 system 选项卡下找到 CPU 核心。配置系统时,单击 ok 并启动虚拟机。 ![Optional step: Assign number of CPU cores][17] -Once you have configured everything, click on the start button to begin the installation. +配置好所有内容后,单击 start 按钮开始安装。 -#### Step 4: Install Fedora in VirtualBox +#### 步骤四:在 VirtualBox 中安装 Fedora。 -If you have followed the process correctly, when you start the virtual machine you will boot directly from the ISO file. When you see a similar to below screen select Start Fedora, and press the enter key. +如果您正确地遵循了这个过程,那么当您启动虚拟机时,您将直接从 ISO 文件启动。当您看到类似下面的屏幕时,选择 Start Fedora,并按 enter 键。 ![Fedora running in live environment in virtual machine][18] -To start the installation dialog box, click on Install to Hard Drive. +要启动安装对话框,单击 Install To Hard Drive。 ![Click on “install to hard drive”][19] -Before you proceed to the installation, it is essential to define your keyboard layout, your timezone and finally where the operating system will be installed. +在您继续安装之前,有必要定义您的键盘布局、您的时区以及最终安装操作系统的位置。 ![Choose keyboard, time and date and then go to Installation Destination][20] -The partitioning process is straight forward. You made some free space as VDI earlier. It should be automatically recognized. +划分过程很简单。您像前面的 VDI 那样划分一些空闲空间。它应该被自动识别。 -Select your disk and set the storage configuration to automatic. Click on Done to go to the previous dialog box. + +选择您的磁盘并将存储配置设置为 automatic。单击 Done 进入上一个对话框。 ![Disk should be automatically recognized][21] -Once you have configured the above, click on “Begin Installation”. +一旦你配置了上面的,点击 “Begin Installation”。 ![Begin installation of Fedora][22] -Now you just need to wait for five-six minutes for installation completion. Click on the “Finish installation” button when installation is finished. +现在只需等待 5 - 6 分钟即可完成安装。安装完成后,点击 “Finish installation” 按钮。 -As a last step, you need to power off your system. If you are unfamiliar with the GNOME desktop environment you can do it like so. +最后一步,需要关闭系统的电源。如果您不熟悉 GNOME 桌面环境,您可以这样做。 ![Turn off Fedora live environment after installation][23] -You have to manually unload the ISO file that you loaded at the initial steps. +您必须手动卸载在初始步骤中加载的 ISO 文件。 ![Remove Fedora ISO From Optical Drive][24] -The next time you start the virtual machine with Fedora, you will be prompted to create a user account and set your password for Fedora Linux. +下一次使用 Fedora 启动虚拟机时,系统将提示您为 Fedora Linux 创建用户帐户并设置密码。 -### Use VirtualBox guest additions for additional features like clipboard sharing, folder sharing and more +### 使用 VirtualBox 客户添加的附加功能,如剪贴板共享,文件夹共享等 -[Guest Additions][25] are designed to be installed inside a virtual machine post installation of the guest operating system. They contain device drivers and system applications that optimize the guest operating system for better performance and usability. +[增强功能包][25] 客户附加程序设计为在客户操作系统安装后安装在虚拟机中。它们包含对客户操作系统进行优化的设备驱动程序和系统应用程序,以获得更好的性能和可用性。 -The Guest Additions ISO file is mounted as a virtual CD-ROM in order to be installed. +客户添加 ISO 文件被安装为虚拟 CD-ROM 以便安装。 -This is a straightforward process. Simply click on the devices tab and then click on “Insert Guest Additions CD image” +这是一个简单的过程。只需单击设备选项卡,然后单击 “Insert Guest Additions CD image”。 ![][26] -You will be prompted to download the guest additions image, when prompt click on Download. +当提示符单击 download 时,系统将弹出您下载增强功能包界面。 ![Install VirtualBox Guest Additions][27] -#### **Shared clipboard** +#### **共享剪贴板** -At some point you’ll need to move some content between your virtual machine and the host operating system. The shared clipboard/drag and drop support will allow you to copy items on one platform and paste them on the other. +有时候,您需要在虚拟机和主机操作系统之间移动一些内容。共享剪贴板/拖放支持将允许您在一个平台上复制项目,并将它们粘贴到另一个平台上。 -To enable this feature, choose **Settings** on the VirtualBox home page and follow the instructions as below. I find the **Bidirectional** option the most convenient. +要启用此功能,请在VirtualBox主页上选择 **Settings**,并按照下面的说明操作。**双向** 的选项是最方便的。 ![Enable clipboard sharing between guest and host systems][28] -#### **Shared folders** +#### **共享文件夹** -There are two types of shares: +有两种类型的分享: - * Permanent shares, that are saved with the Virtual Machine settings. - * Transient shares, that are disappear when the Virtual Machine is powered off. These can be created using a checkbox in the VirtualBox Manager. + * 永久共享,与虚拟机设置一起保存。 + * 暂态共享,当虚拟机关闭时就会消失。可以使用 VirtualBox 管理器中的复选框创建暂态共享。 -In this tutorial, I will make a permanent shared folder. In the VM settings add the host system folder you want to share and choose the name that you want to appear at your VM. +在本教程中,我将创建一个永久共享文件夹。在 VM 设置中添加您想要共享的主机系统文件夹,并选择您想要在 VM 中出现的名称。 ![][29] -The next time you start the virtual machine, the folder should appear as a network drive. +下次启动虚拟机时,该文件夹应该显示为网络驱动器。 ![][30] -#### **Better video support** +#### **更好的视频支持** -While the virtual graphics card which Oracle VirtualBox provides all the basic features, the custom video drivers that are installed with the Guest Additions provide you with extra high and non-standard video modes, as well as accelerated video performance. +虽然 Oracle VirtualBox 提供了所有基本功能的虚拟显卡,但客户添加的自定义视频驱动程序为您提供了超高和非标准的视频模式,以及加速的视频性能。 -Using Guest Additions, the guest OS’s resolution will dynamically resize as you adjust the VirtualBox window on your computer. +使用增强安装包,操作系统的分辨率将随着您调整计算机上的 VirtualBox 窗口而动态调整大小。 -Finally, Guest Additions can take advantage of your computer’s graphics card. If you’re a gamer or using productivity software in a WM, this makes a huge difference. +最后,增强安装包可以利用您的计算机的显卡。如果你是一名游戏玩家或在 WM 中使用高效软件,这就会产生巨大的改变。 -#### USB and Network Devices sharing +#### USB 和网络设备共享 -With VirtualBox, users have the ability to use a fully-functional operating system, without having to do the setup on different hardware. However, sharing USB and network devices between the host and guest machine is not as straightforward as it should be. +有了 VirtualBox,用户就可以使用一个功能齐全的操作系统,而不必在不同的硬件上进行设置。然而,在主机和客户机器之间共享USB和网络设备并不像想的那样简单。 -To access USB devices, you will need to install [the VirtualBox extension pack][31]. +要访问USB设备,您将需要安装 [VirtualBox 扩展包][31]. ![Install VirtualBox Extensions pack][32] -_**This is for Linux only**_ because I am using all this in Linux. +_**下面这些仅对 Linux**_,因为我使用的是 Linux。 -In order for VirtualBox to have access to the USB subsystem, the user (on host system) running VirtualBox must belong to the vboxuser group. To do this, open up a terminal and issue the following command: +为了使 VirtualBox 能够访问 USB 子系统,运行 VirtualBox 的用户(在主机系统上)必须属于 vboxuser 组。为此,打开一个终端并发出以下命令: ``` sudo usermod -aG vboxusers 'your username' ``` -Once you run the command, you should either log out and log back in, or restart your host machine. +运行该命令后,您应该注销并重新登录,或者重新启动主机。 -At this step, plug in your USB stick and through your VM settings you should be able to find and add the medium as shown at the example. +在这一步,插入你的 u 盘,通过你的 VM 设置,你应该能够找到并添加介质,如例子中所示。 ![][33] -Your USB will be accessible the next time you start your virtual machine. +当您下次启动虚拟机,您的USB将是可访问的。 ![][34] -### Bonus Tip: Save and export the Virtual Machine so that you can use it later on any system +### 额外提示:保存并导出虚拟机,以便以后可以在任何系统上使用它 -You may want to use your virtual machine to another computer or it is time to build a new machine and you need to keep your virtual machine as it is. You can easily export your current setup and import it to another machine at a few easy steps. +您可能想在另一台计算机上使用虚拟机,或者是时候构建一台新机器了,并且您需要保持虚拟机的原样。只需几个简单的步骤,就可以轻松地导出当前设置并将其导入到另一台机器。 -At the VirtualBox home panel, click on file and the export appliance. If you prefer keyboard shortcuts, you can simply click **Ctrl+E**. +在 VirtualBox 主面板上,单击 file 和 export 工具。如果你喜欢键盘快捷键,你可以简单地点击 **Ctrl+E** ![][35] -Choose the virtual machine you want to export and click on next. +选择要导出的虚拟机,然后单击 next。 ![][36] -The Format option needs some attention. There are three different options of Open Virtualization Format 0.9, 1.0 and 2.0, which can be either ovf or ova extensions. +格式选项需要注意一下。开放虚拟化格式 0.9、1.0 和 2.0 有三种不同的选项,可以是 ovf 或 ova 扩展。 -With ovf extension, several files will be written separately, compared to ova extension, which combines all the files into one Open Virtualization Format archive. -The default format, Open Virtualization Format 1.0, should be fine. +使用 ovf 扩展名,可以分别编写几个文件,而 ova 扩展名则将所有文件合并到一个开放的虚拟化格式归档文件中。 + + +默认格式 Open Virtualization format 1.0 应该没问题。 ![][37] -To finish the process, click next and at the next dialog box click export. +要完成该过程,单击 next,然后在下一个对话框中单击 export。 -#### Conclusion +#### 总结 -By using a virtual machine you can’t just test an operating system but deploy a fully functioning system, equally comparable to a physical machine. Nowadays, hardware has become so powerful and affordable that most of its power is not being utilized. +通过使用虚拟机,您不仅可以测试操作系统,还可以部署与物理机器同等重要的功能完整的系统。如今,硬件已经变得如此强大和廉价,它的大部分功能都没有被利用。 -Through virtualization technology, you can use those wasted resources. The need for physical machines is reduced, and consequently the energy consumption is less. You can save money both from hardware and reduced running costs. -On a larger scale, server virtualization is more of a basic requirement than an advanced concept. +通过虚拟化技术,您可以使用这些浪费的资源。对物理机器的需求减少了,因此能源消耗也减少了。您可以从硬件和降低运行成本两方面省钱。 -I hope you found this tutorial helpful in installing Fedora Linux in VirtualBox. If you face any issues, please let me know in the comments. + +在更大的范围内,服务器虚拟化更多的是一种基本需求,而不是一种高级概念。 + + +我希望本教程对您在 VirtualBox 中安装 Fedora Linux 有帮助。如果你遇到任何问题,请在评论中告诉我。 -------------------------------------------------------------------------------- @@ -229,7 +235,7 @@ via: https://itsfoss.com/install-fedora-in-virtualbox/ 作者:[Dimitrios Savvopoulos][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[译者ID](https://github.com/frogOAO) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 758d562504481e23146df1f7c21f3d18831f8f7d Mon Sep 17 00:00:00 2001 From: niko Date: Mon, 23 Nov 2020 21:21:38 +0800 Subject: [PATCH 0859/1156] frogOAO --- ...s for USB, Clipboard and Folder Sharing.md | 281 ------------------ 1 file changed, 281 deletions(-) delete mode 100644 sources/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md diff --git a/sources/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md b/sources/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md deleted file mode 100644 index 4ccd0f00f6..0000000000 --- a/sources/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md +++ /dev/null @@ -1,281 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (frogOAO) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Install Fedora in VirtualBox [With Steps for USB, Clipboard and Folder Sharing]) -[#]: via: (https://itsfoss.com/install-fedora-in-virtualbox/) -[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) - -如何在 Fedora 中安装 VirtualBox 【附带 USB,剪切板,文件夹共享教程】 -====== - -如果您对 Fedora Linux 感兴趣,这有几种方式可以尝试它。 - -最简单还不影响您操作系统的方式是 [制作 Fedora 的 USB 启动盘][1] - -另一种方式是安装 VirtualBox 利用虚拟化技术来尝试 Fedora。这样,你可以在你的操作系统上像使用应用程序一样使用 Fedora。 - -通过这种方式,您可以执行更彻底的测试,而不会搞乱当前的操作系统。 - -您甚至可以复制您的虚拟安装程序,并在其他系统上重新安装它。听起来方便吗?让我来教你怎么做。 - -### 在 Fedora 上安装 Fedora - -![][2] - -让我们分步在 Oracle VirtualBox 上安装 Fedora。 - -#### 步骤一:安装 VirtualBox - -如果您的系统还没有安装 VirtualBox,您可以从官方网站下载。您可以找到 Windows,MacOs 和 Linux 的说明。 [Ubuntu 用户可以参考这个关于安装 VirtualBox 的详细教程。][3]. - -![][4] - -[下载 VirtualBox][5] - -#### **步骤二: 下载 Fedora ISO** - -如果您不熟悉 Fedora,那么这些镜像您需要知道。 - -[Fedora IoT][6] 是用于可扩展基础设施的, [Fedora workstation][7] 是一个镜像,带有一组面向普通GNOME桌面环境中的桌面的工具。[Fedora server][8] 顾名思义,是为服务器或数据中心定制的。 - -如果GNOME不是您的首选,您可以下载一个带有替代桌面环境的[定制版][9]Fedora桌面。 对于本教程,我选择了带有GNOME桌面环境的[Fedora 33][10]。 - -[下载 Fedora][11] - -#### 步骤三: 创建一个空虚拟机并对其进行配置 - -要成功安装和运行 Fedora,至少需要 20GB 磁盘空间和 2GB RAM。不过,为了获得更流畅的用户体验,建议增加一倍。在此基础上,我将创建并配置虚拟机。 - -开启 Virtual Box 点击 New。 - -![创建一个新的虚拟机][12] - -需要注意,最重要的选项是 **将类型设置为 Linux and 版本设置为 Fedora (64-bit)**。如果您在名称提示符处开始输入 Fedora,VirtualBox 将自动为您选择正确的设置。虽然名字不一定非得是 Fedora,它可以是任何你喜欢的。 - -_如果您只能访问32位版本,那么您需要在 BIOS 上启用虚拟化技术,如果您有一个 AMD CPU,它被称为 SVM。最坏的情况是您的 CPU 不支持虚拟化技术。如果你不确定,先检查这个。_ - -如果您的设置和我一样,点击 create 按钮。 - -![Name your VM and assign it at least 3 GB RAM][13] - -如前所述,至少需要 20gb 的磁盘空间才能安装 Fedora。我的系统上有 32gb 的内存,所以我分配了 8gb。3 GB 的内存应该没问题。 - -顺便说下内存的使用,只有在运行虚拟机时,虚拟机才会使用内存。否则,它将可用于常规使用。 - -确保其余设置与示例匹配,并点击 Create。 - -![Assign 15-20 GB of disk space in VDI format][14] - -在你点击虚拟机的 Start 按钮之前,你需要加载如下所示的 ISO [光驱]。 - -![Add the Fedora ISO to optical drive storage][15] - -因为你的虚拟硬盘是空的,虚拟机将从这个 ISO 启动。可以把它看作是使用 live USB 或磁盘安装 Linux。 - -![Go to Settings and add ISO as optical drive][16] - -然后,如果您有一个多核CPU,建议为虚拟机分配 2 个或更多的核。您可以在 system 选项卡下找到 CPU 核心。配置系统时,单击 ok 并启动虚拟机。 - -![Optional step: Assign number of CPU cores][17] - -配置好所有内容后,单击 start 按钮开始安装。 - -#### 步骤四:在 VirtualBox 中安装 Fedora。 - -如果您正确地遵循了这个过程,那么当您启动虚拟机时,您将直接从 ISO 文件启动。当您看到类似下面的屏幕时,选择 Start Fedora,并按 enter 键。 - -![Fedora running in live environment in virtual machine][18] - -要启动安装对话框,单击 Install To Hard Drive。 - -![Click on “install to hard drive”][19] - -在您继续安装之前,有必要定义您的键盘布局、您的时区以及最终安装操作系统的位置。 - -![Choose keyboard, time and date and then go to Installation Destination][20] - -划分过程很简单。您像前面的 VDI 那样划分一些空闲空间。它应该被自动识别。 - - -选择您的磁盘并将存储配置设置为 automatic。单击 Done 进入上一个对话框。 - -![Disk should be automatically recognized][21] - -一旦你配置了上面的,点击 “Begin Installation”。 - -![Begin installation of Fedora][22] - -现在只需等待 5 - 6 分钟即可完成安装。安装完成后,点击 “Finish installation” 按钮。 - -最后一步,需要关闭系统的电源。如果您不熟悉 GNOME 桌面环境,您可以这样做。 - -![Turn off Fedora live environment after installation][23] - -您必须手动卸载在初始步骤中加载的 ISO 文件。 - -![Remove Fedora ISO From Optical Drive][24] - -下一次使用 Fedora 启动虚拟机时,系统将提示您为 Fedora Linux 创建用户帐户并设置密码。 - -### 使用 VirtualBox 客户添加的附加功能,如剪贴板共享,文件夹共享等 - -[增强功能包][25] 客户附加程序设计为在客户操作系统安装后安装在虚拟机中。它们包含对客户操作系统进行优化的设备驱动程序和系统应用程序,以获得更好的性能和可用性。 - -客户添加 ISO 文件被安装为虚拟 CD-ROM 以便安装。 - -这是一个简单的过程。只需单击设备选项卡,然后单击 “Insert Guest Additions CD image”。 - -![][26] - -当提示符单击 download 时,系统将弹出您下载增强功能包界面。 - -![Install VirtualBox Guest Additions][27] - -#### **共享剪贴板** - -有时候,您需要在虚拟机和主机操作系统之间移动一些内容。共享剪贴板/拖放支持将允许您在一个平台上复制项目,并将它们粘贴到另一个平台上。 - -要启用此功能,请在VirtualBox主页上选择 **Settings**,并按照下面的说明操作。**双向** 的选项是最方便的。 - -![Enable clipboard sharing between guest and host systems][28] - -#### **共享文件夹** - -有两种类型的分享: - - * 永久共享,与虚拟机设置一起保存。 - * 暂态共享,当虚拟机关闭时就会消失。可以使用 VirtualBox 管理器中的复选框创建暂态共享。 - - - -在本教程中,我将创建一个永久共享文件夹。在 VM 设置中添加您想要共享的主机系统文件夹,并选择您想要在 VM 中出现的名称。 - -![][29] - -下次启动虚拟机时,该文件夹应该显示为网络驱动器。 - -![][30] - -#### **更好的视频支持** - -虽然 Oracle VirtualBox 提供了所有基本功能的虚拟显卡,但客户添加的自定义视频驱动程序为您提供了超高和非标准的视频模式,以及加速的视频性能。 - -使用增强安装包,操作系统的分辨率将随着您调整计算机上的 VirtualBox 窗口而动态调整大小。 - -最后,增强安装包可以利用您的计算机的显卡。如果你是一名游戏玩家或在 WM 中使用高效软件,这就会产生巨大的改变。 - -#### USB 和网络设备共享 - -有了 VirtualBox,用户就可以使用一个功能齐全的操作系统,而不必在不同的硬件上进行设置。然而,在主机和客户机器之间共享USB和网络设备并不像想的那样简单。 - -要访问USB设备,您将需要安装 [VirtualBox 扩展包][31]. - -![Install VirtualBox Extensions pack][32] - -_**下面这些仅对 Linux**_,因为我使用的是 Linux。 - -为了使 VirtualBox 能够访问 USB 子系统,运行 VirtualBox 的用户(在主机系统上)必须属于 vboxuser 组。为此,打开一个终端并发出以下命令: - -``` -sudo usermod -aG vboxusers 'your username' -``` - -运行该命令后,您应该注销并重新登录,或者重新启动主机。 - -在这一步,插入你的 u 盘,通过你的 VM 设置,你应该能够找到并添加介质,如例子中所示。 - -![][33] - -当您下次启动虚拟机,您的USB将是可访问的。 - -![][34] - -### 额外提示:保存并导出虚拟机,以便以后可以在任何系统上使用它 - -您可能想在另一台计算机上使用虚拟机,或者是时候构建一台新机器了,并且您需要保持虚拟机的原样。只需几个简单的步骤,就可以轻松地导出当前设置并将其导入到另一台机器。 - -在 VirtualBox 主面板上,单击 file 和 export 工具。如果你喜欢键盘快捷键,你可以简单地点击 **Ctrl+E** - -![][35] - -选择要导出的虚拟机,然后单击 next。 - -![][36] - -格式选项需要注意一下。开放虚拟化格式 0.9、1.0 和 2.0 有三种不同的选项,可以是 ovf 或 ova 扩展。 - - -使用 ovf 扩展名,可以分别编写几个文件,而 ova 扩展名则将所有文件合并到一个开放的虚拟化格式归档文件中。 - - -默认格式 Open Virtualization format 1.0 应该没问题。 - -![][37] - -要完成该过程,单击 next,然后在下一个对话框中单击 export。 - -#### 总结 - -通过使用虚拟机,您不仅可以测试操作系统,还可以部署与物理机器同等重要的功能完整的系统。如今,硬件已经变得如此强大和廉价,它的大部分功能都没有被利用。 - - -通过虚拟化技术,您可以使用这些浪费的资源。对物理机器的需求减少了,因此能源消耗也减少了。您可以从硬件和降低运行成本两方面省钱。 - - -在更大的范围内,服务器虚拟化更多的是一种基本需求,而不是一种高级概念。 - - -我希望本教程对您在 VirtualBox 中安装 Fedora Linux 有帮助。如果你遇到任何问题,请在评论中告诉我。 - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/install-fedora-in-virtualbox/ - -作者:[Dimitrios Savvopoulos][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/frogOAO) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/dimitrios/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/create-fedora-live-usb-ubuntu/ -[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/install-fedora-in-virtualbox.png?resize=800%2C450&ssl=1 -[3]: https://itsfoss.com/install-virtualbox-ubuntu/ -[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/download-virtulabox.jpg?resize=799%2C294&ssl=1 -[5]: https://www.virtualbox.org/ -[6]: https://getfedora.org/en/iot/ -[7]: https://getfedora.org/en/workstation/ -[8]: https://getfedora.org/en/server/ -[9]: https://spins.fedoraproject.org/ -[10]: https://itsfoss.com/fedora-33/ -[11]: https://getfedora.org/ -[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/0.-create-a-new-vm.png?resize=800%2C550&ssl=1 -[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/1-create-vm-fedora.png?resize=800%2C533&ssl=1 -[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/2-fedora-vm-disk.png?resize=800%2C533&ssl=1 -[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/fedora-vm-settings-iso.png?resize=800%2C640&ssl=1 -[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/3-fedora-vm-settings2.png?resize=800%2C600&ssl=1 -[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/4-fedora-vm-cpu.png?resize=800%2C533&ssl=1 -[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/6-fedora-vm-boot.png?resize=800%2C600&ssl=1 -[19]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/7-fedora-vm-install-1.png?resize=800%2C622&ssl=1 -[20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/9-fedora-vm-partitioning-2.png?resize=800%2C706&ssl=1 -[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/10-fedora-vm-hdd.png?resize=732%2C645&ssl=1 -[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/12-fedora-vm-installation-1.png?resize=800%2C706&ssl=1 -[23]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/15-power-off-fedora-gnome.png?resize=800%2C706&ssl=1 -[24]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/remove-fedora-iso-from-optical-drive.png?resize=800%2C589&ssl=1 -[25]: https://www.virtualbox.org/manual/ch04.html -[26]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/16-Fedora-vm-guest-additions.png?resize=800%2C706&ssl=1 -[27]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/17-Fedora-vm-guest-additions.png?resize=800%2C686&ssl=1 -[28]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/19-fedora-vm-shared-clipboard-2.png?resize=800%2C650&ssl=1 -[29]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/20-fedora-vm-shared-folders-1.png?resize=800%2C650&ssl=1 -[30]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/22-fedora-vm-shared-folders2-1.png?resize=800%2C547&ssl=1 -[31]: https://download.virtualbox.org/virtualbox/6.1.16/Oracle_VM_VirtualBox_Extension_Pack-6.1.16.vbox-extpack -[32]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/21.-fedora-vm-extension-pack.png?resize=800%2C600&ssl=1 -[33]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/25.-fedora-vm-usb-1.png?resize=800%2C527&ssl=1 -[34]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/26.-fedora-vm-usb-1.png?resize=800%2C578&ssl=1 -[35]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/23.-fedora-vm-export.png?resize=800%2C600&ssl=1 -[36]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/24.-fedora-vm-export-1.png?resize=800%2C545&ssl=1 -[37]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/25.-fedora-vm-export-800x545.png?resize=800%2C545&ssl=1 From 147d3570e38e7ae3a69e379b6ea59bcac2504128 Mon Sep 17 00:00:00 2001 From: niko Date: Mon, 23 Nov 2020 21:26:32 +0800 Subject: [PATCH 0860/1156] frogOAO --- ...s for USB, Clipboard and Folder Sharing.md | 281 ++++++++++++++++++ 1 file changed, 281 insertions(+) create mode 100644 translated/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md diff --git a/translated/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md b/translated/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md new file mode 100644 index 0000000000..4ccd0f00f6 --- /dev/null +++ b/translated/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md @@ -0,0 +1,281 @@ +[#]: collector: (lujun9972) +[#]: translator: (frogOAO) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Install Fedora in VirtualBox [With Steps for USB, Clipboard and Folder Sharing]) +[#]: via: (https://itsfoss.com/install-fedora-in-virtualbox/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +如何在 Fedora 中安装 VirtualBox 【附带 USB,剪切板,文件夹共享教程】 +====== + +如果您对 Fedora Linux 感兴趣,这有几种方式可以尝试它。 + +最简单还不影响您操作系统的方式是 [制作 Fedora 的 USB 启动盘][1] + +另一种方式是安装 VirtualBox 利用虚拟化技术来尝试 Fedora。这样,你可以在你的操作系统上像使用应用程序一样使用 Fedora。 + +通过这种方式,您可以执行更彻底的测试,而不会搞乱当前的操作系统。 + +您甚至可以复制您的虚拟安装程序,并在其他系统上重新安装它。听起来方便吗?让我来教你怎么做。 + +### 在 Fedora 上安装 Fedora + +![][2] + +让我们分步在 Oracle VirtualBox 上安装 Fedora。 + +#### 步骤一:安装 VirtualBox + +如果您的系统还没有安装 VirtualBox,您可以从官方网站下载。您可以找到 Windows,MacOs 和 Linux 的说明。 [Ubuntu 用户可以参考这个关于安装 VirtualBox 的详细教程。][3]. + +![][4] + +[下载 VirtualBox][5] + +#### **步骤二: 下载 Fedora ISO** + +如果您不熟悉 Fedora,那么这些镜像您需要知道。 + +[Fedora IoT][6] 是用于可扩展基础设施的, [Fedora workstation][7] 是一个镜像,带有一组面向普通GNOME桌面环境中的桌面的工具。[Fedora server][8] 顾名思义,是为服务器或数据中心定制的。 + +如果GNOME不是您的首选,您可以下载一个带有替代桌面环境的[定制版][9]Fedora桌面。 对于本教程,我选择了带有GNOME桌面环境的[Fedora 33][10]。 + +[下载 Fedora][11] + +#### 步骤三: 创建一个空虚拟机并对其进行配置 + +要成功安装和运行 Fedora,至少需要 20GB 磁盘空间和 2GB RAM。不过,为了获得更流畅的用户体验,建议增加一倍。在此基础上,我将创建并配置虚拟机。 + +开启 Virtual Box 点击 New。 + +![创建一个新的虚拟机][12] + +需要注意,最重要的选项是 **将类型设置为 Linux and 版本设置为 Fedora (64-bit)**。如果您在名称提示符处开始输入 Fedora,VirtualBox 将自动为您选择正确的设置。虽然名字不一定非得是 Fedora,它可以是任何你喜欢的。 + +_如果您只能访问32位版本,那么您需要在 BIOS 上启用虚拟化技术,如果您有一个 AMD CPU,它被称为 SVM。最坏的情况是您的 CPU 不支持虚拟化技术。如果你不确定,先检查这个。_ + +如果您的设置和我一样,点击 create 按钮。 + +![Name your VM and assign it at least 3 GB RAM][13] + +如前所述,至少需要 20gb 的磁盘空间才能安装 Fedora。我的系统上有 32gb 的内存,所以我分配了 8gb。3 GB 的内存应该没问题。 + +顺便说下内存的使用,只有在运行虚拟机时,虚拟机才会使用内存。否则,它将可用于常规使用。 + +确保其余设置与示例匹配,并点击 Create。 + +![Assign 15-20 GB of disk space in VDI format][14] + +在你点击虚拟机的 Start 按钮之前,你需要加载如下所示的 ISO [光驱]。 + +![Add the Fedora ISO to optical drive storage][15] + +因为你的虚拟硬盘是空的,虚拟机将从这个 ISO 启动。可以把它看作是使用 live USB 或磁盘安装 Linux。 + +![Go to Settings and add ISO as optical drive][16] + +然后,如果您有一个多核CPU,建议为虚拟机分配 2 个或更多的核。您可以在 system 选项卡下找到 CPU 核心。配置系统时,单击 ok 并启动虚拟机。 + +![Optional step: Assign number of CPU cores][17] + +配置好所有内容后,单击 start 按钮开始安装。 + +#### 步骤四:在 VirtualBox 中安装 Fedora。 + +如果您正确地遵循了这个过程,那么当您启动虚拟机时,您将直接从 ISO 文件启动。当您看到类似下面的屏幕时,选择 Start Fedora,并按 enter 键。 + +![Fedora running in live environment in virtual machine][18] + +要启动安装对话框,单击 Install To Hard Drive。 + +![Click on “install to hard drive”][19] + +在您继续安装之前,有必要定义您的键盘布局、您的时区以及最终安装操作系统的位置。 + +![Choose keyboard, time and date and then go to Installation Destination][20] + +划分过程很简单。您像前面的 VDI 那样划分一些空闲空间。它应该被自动识别。 + + +选择您的磁盘并将存储配置设置为 automatic。单击 Done 进入上一个对话框。 + +![Disk should be automatically recognized][21] + +一旦你配置了上面的,点击 “Begin Installation”。 + +![Begin installation of Fedora][22] + +现在只需等待 5 - 6 分钟即可完成安装。安装完成后,点击 “Finish installation” 按钮。 + +最后一步,需要关闭系统的电源。如果您不熟悉 GNOME 桌面环境,您可以这样做。 + +![Turn off Fedora live environment after installation][23] + +您必须手动卸载在初始步骤中加载的 ISO 文件。 + +![Remove Fedora ISO From Optical Drive][24] + +下一次使用 Fedora 启动虚拟机时,系统将提示您为 Fedora Linux 创建用户帐户并设置密码。 + +### 使用 VirtualBox 客户添加的附加功能,如剪贴板共享,文件夹共享等 + +[增强功能包][25] 客户附加程序设计为在客户操作系统安装后安装在虚拟机中。它们包含对客户操作系统进行优化的设备驱动程序和系统应用程序,以获得更好的性能和可用性。 + +客户添加 ISO 文件被安装为虚拟 CD-ROM 以便安装。 + +这是一个简单的过程。只需单击设备选项卡,然后单击 “Insert Guest Additions CD image”。 + +![][26] + +当提示符单击 download 时,系统将弹出您下载增强功能包界面。 + +![Install VirtualBox Guest Additions][27] + +#### **共享剪贴板** + +有时候,您需要在虚拟机和主机操作系统之间移动一些内容。共享剪贴板/拖放支持将允许您在一个平台上复制项目,并将它们粘贴到另一个平台上。 + +要启用此功能,请在VirtualBox主页上选择 **Settings**,并按照下面的说明操作。**双向** 的选项是最方便的。 + +![Enable clipboard sharing between guest and host systems][28] + +#### **共享文件夹** + +有两种类型的分享: + + * 永久共享,与虚拟机设置一起保存。 + * 暂态共享,当虚拟机关闭时就会消失。可以使用 VirtualBox 管理器中的复选框创建暂态共享。 + + + +在本教程中,我将创建一个永久共享文件夹。在 VM 设置中添加您想要共享的主机系统文件夹,并选择您想要在 VM 中出现的名称。 + +![][29] + +下次启动虚拟机时,该文件夹应该显示为网络驱动器。 + +![][30] + +#### **更好的视频支持** + +虽然 Oracle VirtualBox 提供了所有基本功能的虚拟显卡,但客户添加的自定义视频驱动程序为您提供了超高和非标准的视频模式,以及加速的视频性能。 + +使用增强安装包,操作系统的分辨率将随着您调整计算机上的 VirtualBox 窗口而动态调整大小。 + +最后,增强安装包可以利用您的计算机的显卡。如果你是一名游戏玩家或在 WM 中使用高效软件,这就会产生巨大的改变。 + +#### USB 和网络设备共享 + +有了 VirtualBox,用户就可以使用一个功能齐全的操作系统,而不必在不同的硬件上进行设置。然而,在主机和客户机器之间共享USB和网络设备并不像想的那样简单。 + +要访问USB设备,您将需要安装 [VirtualBox 扩展包][31]. + +![Install VirtualBox Extensions pack][32] + +_**下面这些仅对 Linux**_,因为我使用的是 Linux。 + +为了使 VirtualBox 能够访问 USB 子系统,运行 VirtualBox 的用户(在主机系统上)必须属于 vboxuser 组。为此,打开一个终端并发出以下命令: + +``` +sudo usermod -aG vboxusers 'your username' +``` + +运行该命令后,您应该注销并重新登录,或者重新启动主机。 + +在这一步,插入你的 u 盘,通过你的 VM 设置,你应该能够找到并添加介质,如例子中所示。 + +![][33] + +当您下次启动虚拟机,您的USB将是可访问的。 + +![][34] + +### 额外提示:保存并导出虚拟机,以便以后可以在任何系统上使用它 + +您可能想在另一台计算机上使用虚拟机,或者是时候构建一台新机器了,并且您需要保持虚拟机的原样。只需几个简单的步骤,就可以轻松地导出当前设置并将其导入到另一台机器。 + +在 VirtualBox 主面板上,单击 file 和 export 工具。如果你喜欢键盘快捷键,你可以简单地点击 **Ctrl+E** + +![][35] + +选择要导出的虚拟机,然后单击 next。 + +![][36] + +格式选项需要注意一下。开放虚拟化格式 0.9、1.0 和 2.0 有三种不同的选项,可以是 ovf 或 ova 扩展。 + + +使用 ovf 扩展名,可以分别编写几个文件,而 ova 扩展名则将所有文件合并到一个开放的虚拟化格式归档文件中。 + + +默认格式 Open Virtualization format 1.0 应该没问题。 + +![][37] + +要完成该过程,单击 next,然后在下一个对话框中单击 export。 + +#### 总结 + +通过使用虚拟机,您不仅可以测试操作系统,还可以部署与物理机器同等重要的功能完整的系统。如今,硬件已经变得如此强大和廉价,它的大部分功能都没有被利用。 + + +通过虚拟化技术,您可以使用这些浪费的资源。对物理机器的需求减少了,因此能源消耗也减少了。您可以从硬件和降低运行成本两方面省钱。 + + +在更大的范围内,服务器虚拟化更多的是一种基本需求,而不是一种高级概念。 + + +我希望本教程对您在 VirtualBox 中安装 Fedora Linux 有帮助。如果你遇到任何问题,请在评论中告诉我。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-fedora-in-virtualbox/ + +作者:[Dimitrios Savvopoulos][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/frogOAO) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/create-fedora-live-usb-ubuntu/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/install-fedora-in-virtualbox.png?resize=800%2C450&ssl=1 +[3]: https://itsfoss.com/install-virtualbox-ubuntu/ +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/download-virtulabox.jpg?resize=799%2C294&ssl=1 +[5]: https://www.virtualbox.org/ +[6]: https://getfedora.org/en/iot/ +[7]: https://getfedora.org/en/workstation/ +[8]: https://getfedora.org/en/server/ +[9]: https://spins.fedoraproject.org/ +[10]: https://itsfoss.com/fedora-33/ +[11]: https://getfedora.org/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/0.-create-a-new-vm.png?resize=800%2C550&ssl=1 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/1-create-vm-fedora.png?resize=800%2C533&ssl=1 +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/2-fedora-vm-disk.png?resize=800%2C533&ssl=1 +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/fedora-vm-settings-iso.png?resize=800%2C640&ssl=1 +[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/3-fedora-vm-settings2.png?resize=800%2C600&ssl=1 +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/4-fedora-vm-cpu.png?resize=800%2C533&ssl=1 +[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/6-fedora-vm-boot.png?resize=800%2C600&ssl=1 +[19]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/7-fedora-vm-install-1.png?resize=800%2C622&ssl=1 +[20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/9-fedora-vm-partitioning-2.png?resize=800%2C706&ssl=1 +[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/10-fedora-vm-hdd.png?resize=732%2C645&ssl=1 +[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/12-fedora-vm-installation-1.png?resize=800%2C706&ssl=1 +[23]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/15-power-off-fedora-gnome.png?resize=800%2C706&ssl=1 +[24]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/remove-fedora-iso-from-optical-drive.png?resize=800%2C589&ssl=1 +[25]: https://www.virtualbox.org/manual/ch04.html +[26]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/16-Fedora-vm-guest-additions.png?resize=800%2C706&ssl=1 +[27]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/17-Fedora-vm-guest-additions.png?resize=800%2C686&ssl=1 +[28]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/19-fedora-vm-shared-clipboard-2.png?resize=800%2C650&ssl=1 +[29]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/20-fedora-vm-shared-folders-1.png?resize=800%2C650&ssl=1 +[30]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/22-fedora-vm-shared-folders2-1.png?resize=800%2C547&ssl=1 +[31]: https://download.virtualbox.org/virtualbox/6.1.16/Oracle_VM_VirtualBox_Extension_Pack-6.1.16.vbox-extpack +[32]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/21.-fedora-vm-extension-pack.png?resize=800%2C600&ssl=1 +[33]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/25.-fedora-vm-usb-1.png?resize=800%2C527&ssl=1 +[34]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/26.-fedora-vm-usb-1.png?resize=800%2C578&ssl=1 +[35]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/23.-fedora-vm-export.png?resize=800%2C600&ssl=1 +[36]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/24.-fedora-vm-export-1.png?resize=800%2C545&ssl=1 +[37]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/25.-fedora-vm-export-800x545.png?resize=800%2C545&ssl=1 From d662ae3082ccc6894ad1f991f30a095d5a5d8e4f Mon Sep 17 00:00:00 2001 From: niko Date: Mon, 23 Nov 2020 21:31:50 +0800 Subject: [PATCH 0861/1156] frogOAO --- ...tualBox -With Steps for USB, Clipboard and Folder Sharing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md b/translated/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md index 4ccd0f00f6..47d60deb03 100644 --- a/translated/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md +++ b/translated/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md @@ -54,7 +54,7 @@ 需要注意,最重要的选项是 **将类型设置为 Linux and 版本设置为 Fedora (64-bit)**。如果您在名称提示符处开始输入 Fedora,VirtualBox 将自动为您选择正确的设置。虽然名字不一定非得是 Fedora,它可以是任何你喜欢的。 -_如果您只能访问32位版本,那么您需要在 BIOS 上启用虚拟化技术,如果您有一个 AMD CPU,它被称为 SVM。最坏的情况是您的 CPU 不支持虚拟化技术。如果你不确定,先检查这个。_ +_如果您只能访问 32 位版本,那么您需要在 BIOS 上启用虚拟化技术,如果您有一个 AMD CPU,它被称为 SVM。最坏的情况是您的 CPU 不支持虚拟化技术。如果你不确定,先检查这个。_ 如果您的设置和我一样,点击 create 按钮。 From ca670ca18e48e515e8cbc5efb7eda08d13eadfff Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 24 Nov 2020 05:02:18 +0800 Subject: [PATCH 0862/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201124?= =?UTF-8?q?=20Compare=20Files=20and=20Folders=20Graphically=20in=20Linux?= =?UTF-8?q?=20With=20Meld?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201124 Compare Files and Folders Graphically in Linux With Meld.md --- ... Folders Graphically in Linux With Meld.md | 113 ++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 sources/tech/20201124 Compare Files and Folders Graphically in Linux With Meld.md diff --git a/sources/tech/20201124 Compare Files and Folders Graphically in Linux With Meld.md b/sources/tech/20201124 Compare Files and Folders Graphically in Linux With Meld.md new file mode 100644 index 0000000000..8fc78ae320 --- /dev/null +++ b/sources/tech/20201124 Compare Files and Folders Graphically in Linux With Meld.md @@ -0,0 +1,113 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Compare Files and Folders Graphically in Linux With Meld) +[#]: via: (https://itsfoss.com/meld-gui-diff/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Compare Files and Folders Graphically in Linux With Meld +====== + +How do you compare two similar files to check for differences? The obvious answer is [to use the diff command in Linux][1]. + +The problem is that not everyone would be comfortable comparing files in Linux terminal. And the diff command output could be confusing for some. + +Take this diff command output for example: + +![][2] + +There is definitely a learning curve involved here. However, if you are using desktop Linux, you can use [GUI][3] applications to easily compare two files for any differences. + +There are several GUI diff tools available for Linux. I am going to highlight my favorite tool Meld in this week’s Linux application highlight. + +### Meld: Visual Diff and Merge tool for Linux (and Windows) + +With [Meld][4], you can compare two files in side by side view. Not only that, you may also modify the files to make changes accordingly. That’s what you would want to do in most situations, right? + +![File Comparison][5] + +Meld is also capable of comparing directories and show which files are different. It will also show while files are new or missing. + +![Directory Comparison][6] + +You may also use Meld for a three-way comparison. + +![Three Way File Comparison][7] + +The graphical side-by-side comparison helps in a number of situations. If you are a developer, you can use it to understand code patches. Meld also supports version control systems like Git, [Mercurial][8], [Subversion][9] etc. + +### Features of Meld + +![][10] + +The open source Meld tools has the following main features: + + * Perform two and three-way difference comparison + * Edit files in-place and the difference comparison updates immediately + * Navigate between differences and conflicts + * Visualize global and local differences with insertions, changes and conflicts marked accordingly + * Use regex text filtering to ignore certain differences + * Syntax highlighting + * Compare two or three directories for newly added, missing and altered files + * Exclude some files from comparison + * Support for popular version control systems like Git, Mercurial, Bazaar and SVN + * Support for many international languages + * Open source GPL v2 license + * Available for Linux as well as Windows + + + +### Installing Meld on Linux + +Meld is a popular application and it is available in the official repositories of most Linux distributions. + +Check your distribution’s software center and see if Meld is available. + +![Meld In Ubuntu Software Center][11] + +Alternatively, you can also use command line package manager of your distribution to install Meld. On [Ubuntu, it is available in the Universe repository][12] and can be [installed using the apt command][13]: + +``` +sudo apt install meld +``` + +You may find the source code of Meld on GNOME’s GitLab repository: + +[Meld Source Code][14] + +### Worth it? + +I know that [most modern open source code editors][15] come with this feature but sometimes you just want a simple interface without the trouble of installing additional add-ons for comparing files. Meld provides you just that. + +Do you use some other tools for checking differences between files? Which tool would that be? What’s your experience with Meld, if you ever used it? The comment sections is all yours for sharing your opinion. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/meld-gui-diff/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://linuxhandbook.com/diff-command/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/diff-command-complicated-output.png?resize=795%2C551&ssl=1 +[3]: https://itsfoss.com/gui-cli-tui/ +[4]: https://meldmerge.org +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/file-comaprison-in-Linux-with-meld.png?resize=800%2C498&ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/directory-comparison-in-Linux-with_meld.png?resize=800%2C497&ssl=1 +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/three-way-file-comaprison-with-meld-in-linux.png?resize=800%2C466&ssl=1 +[8]: https://www.mercurial-scm.org/ +[9]: https://subversion.apache.org/ +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/meld-visual-diff.png?resize=786%2C455&ssl=1 +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/Meld-in-Ubuntu-Software-Center.png?resize=800%2C384&ssl=1 +[12]: https://itsfoss.com/ubuntu-repositories/ +[13]: https://itsfoss.com/apt-command-guide/ +[14]: https://gitlab.gnome.org/GNOME/meld +[15]: https://itsfoss.com/best-modern-open-source-code-editors-for-linux/ From 0c5149d14af9d575a0da0caa79a1b2c6fac2ed89 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 24 Nov 2020 05:02:36 +0800 Subject: [PATCH 0863/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201123?= =?UTF-8?q?=206=20predictions=20for=20JavaScript=20build=20tools?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201123 6 predictions for JavaScript build tools.md --- ... predictions for JavaScript build tools.md | 152 ++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 sources/tech/20201123 6 predictions for JavaScript build tools.md diff --git a/sources/tech/20201123 6 predictions for JavaScript build tools.md b/sources/tech/20201123 6 predictions for JavaScript build tools.md new file mode 100644 index 0000000000..630df77227 --- /dev/null +++ b/sources/tech/20201123 6 predictions for JavaScript build tools.md @@ -0,0 +1,152 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 predictions for JavaScript build tools) +[#]: via: (https://opensource.com/article/20/11/javascript-build-tools) +[#]: author: (Shedrack Akintayo https://opensource.com/users/shedrack-akintayo) + +6 predictions for JavaScript build tools +====== +The JavaScript frontend tooling ecosystem is dynamic and competitive, +and only the best survive. +![Magnifying glass on code][1] + +Code used in production is different from development code. In production, you need to build packages that run fast, manage dependencies, automate tasks, load external modules, and more. [JavaScript][2] tools that make it possible to turn development code into production code are called _build tools._ + +The reason frontend code is "built" can be explained by looking into the various build steps and their importance. + +### Steps in building frontend code + +There are four steps involved in building frontend code: + +#### 1\. Transpiling + +Transpiling lets developers take advantage of the newest, hottest updates to languages and extensions and maintain browser compatibility. Here is an example using [Babel][3]: + + +``` +// arrow function syntax in array map +const double = [1, 2, 3].map((num) => num * 2); +// after being transpiled +const double = [1, 2, 3].map(function(num) { +  return num * 2; +}); +``` + +#### 2\. Bundling + +Bundling is the process of taking all the "import" or "require" statements; finding the matching JavaScript snippets, packages, and libraries; adding them to the appropriate scope; and packaging it all into one big JavaScript file. Commonly used bundlers include Browserify, Webpack, and Parcel. + +#### 3\. Minifing + +Minifying reduces the final file size by removing white space and code comments. You can take this a step further by adding an obfuscate step, which changes variable names and method names, obscuring the code, so it is less human-readable once it's delivered to the client. Here is an example using Grunt: + + +``` +// before minifying +const double = [1, 2, 3].map(function(num) { +  return num * 2; +}); +// after minifying +const double = [1, 2, 3].map(function(num) { +  return num * 2; +}); +``` + +#### 4\. Packaging + +After all the steps above are finished, the compatible, bundled, minified/obfuscated file must be put somewhere. Packaging is the process of putting the results of the above steps somewhere specified by the developer. This is usually done by the bundler. + +### Frontend build tools + +Frontend tooling and build tools can be split into the following categories: + + * Package managers: NPM, Yarn + * Transpilers: Babel, etc. + * Bundlers: Webpack, Parcel, Browserify + * Minifiers: UglifyJS, Packer, Minify, etc. + + + +There are a variety of build tools you can use in the JavaScript ecosystem, including the following. + +#### Grunt and Bower + +[Grunt][4] was introduced as a command-line tool that provided just one script to specify and configure tasks. [Bower][5] followed shortly after as a way to manage client-side packages. The two, along with NPM, seemed to fulfill the majority of automation needs and were used regularly together. The problem with Grunt was that it didn't provide developers the freedom to configure more complex task chains, while Bower made developers manage twice as many packages as usual because it separates frontend and backend packages (i.e., Bower components vs. Node modules). + +**The future of Grunt and Bower:** Grunt and Bower are on their way out of the JavaScript tooling ecosystem, but there are several replacements. + +#### Gulp and Browserify + +[Gulp][6] was released a year and a half after Grunt. It felt natural. Writing a build script in JavaScript compared to JSON gave freedom. You could write functions, create variables on the fly, use conditionals anywhere—not that this would make for a particularly good-looking build script, but it was possible. [Browserify][7] and Gulp can be used in tandem. Browserify allows NPM packages (which are for backend Node servers) to be brought into the frontend, making Bower obsolete. It also looks and feels better, with one package manager for the frontend and backend. + +**The future of Gulp:** Gulp can be improved to match the current popular build tools, but this is entirely up to the creators. It is still in use but not as popular as it was before. + +#### Webpack and NPM/Yarn scripts + +[Webpack][8] is the hottest kid on the block in modern frontend development tooling. Webpack is an open-source JavaScript module bundler. It is made primarily for JavaScript, but it can transform frontend assets like HTML, CSS, and images if the corresponding loaders are included. With Webpack, you can also write scripts like Gulp and execute them with [NPM/Yarn][9]. + +**The future of Webpack:** Webpack is currently the hottest thing in the JavaScript tooling ecosystem, and all the JS cool kids are using React and Webpack these days. It is currently in version 4 and not going anywhere anytime soon. + +#### Parcel + +[Parcel][10] is a web application bundler that launched in 2018 and is differentiated by its developer experience. It offers blazing-fast performance utilizing multicore processing and requires zero configuration. Parcel is also a new kid on the block, but adoption hasn't been fast, especially for large applications. Developers prefer to use Webpack over Parcel because of the former's extensive support and customizability. + +**The future of Parcel:** Parcel is very easy to use, it is faster than Webpack if you measure bundle and build time, and it also offers a better developer experience. The reason Parcel hasn't been adopted much might be because it's still relatively new. Parcel has a very bright future in the frontend build tools ecosystem, and it will be around for a while. + +#### Rollup + +[Rollup][11] is a module bundler for JavaScript that compiles small pieces of code into something larger and more complex, such as a library or an application. It is advisable to use Rollup when building a library with minimal third-party imports. + +**The future of Rollup:** Rollup is super-cool and is being adopted rapidly. It has great features and will be part of the frontend tooling ecosystem for a long time. + +### Learn more + +The JavaScript tooling ecosystem is dynamic and competitive, and only the best tools survive. In the future, we will see tools that require less (or no) configuration, better customizability, more extensibility, and higher speed. + +The tools you use for an application's frontend are a personal call that you need to make based on your project's requirements. Choose what works best for you, and most of the time, there are tradeoffs. + +For more information, see: + + * [JavaScript tooling: The evolution and future of JS/frontend build tools][12] + * [Tools and modern workflow for frontend developers][13] + * [Modern frontend: The tools and build process explained][14] + * [Best build tools in frontend development][15] + + + +* * * + +_This article originally appeared on [Shedrack Akintayo's blog][16] and is republished with his permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/javascript-build-tools + +作者:[Shedrack Akintayo][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://opensource.com/users/shedrack-akintayo +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/find-file-linux-code_magnifying_glass_zero.png?itok=E2HoPDg0 (Magnifying glass on code) +[2]: https://www.javascript.com/ +[3]: https://babeljs.io/ +[4]: https://gruntjs.com/ +[5]: https://bower.io/ +[6]: https://gulpjs.com/ +[7]: http://browserify.org/ +[8]: https://webpack.js.org/ +[9]: https://github.com/yarnpkg/yarn +[10]: https://parceljs.org/ +[11]: https://rollupjs.org/guide/en/ +[12]: https://qmo.io/blog/javascript-tooling-the-evolution-and-future-of-js-front-end-build-tools/ +[13]: https://blog.logrocket.com/tools-and-modern-workflow-for-front-end-developers-505c7227e917/ +[14]: https://medium.com/@trevorpoppen/modern-front-end-the-tools-and-build-process-explained-36641b5c1a53 +[15]: https://www.developerdrive.com/best-build-tools-frontend-development/ +[16]: https://www.sheddy.xyz/posts/javascript-build-tools-past-and-beyond From a512d19bec9ce507712b14f4a76063e72c5c6604 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 24 Nov 2020 05:02:49 +0800 Subject: [PATCH 0864/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201123?= =?UTF-8?q?=20A=20beginner's=20guide=20to=20Kubernetes=20Jobs=20and=20Cron?= =?UTF-8?q?Jobs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201123 A beginner-s guide to Kubernetes Jobs and CronJobs.md --- ...s guide to Kubernetes Jobs and CronJobs.md | 233 ++++++++++++++++++ 1 file changed, 233 insertions(+) create mode 100644 sources/tech/20201123 A beginner-s guide to Kubernetes Jobs and CronJobs.md diff --git a/sources/tech/20201123 A beginner-s guide to Kubernetes Jobs and CronJobs.md b/sources/tech/20201123 A beginner-s guide to Kubernetes Jobs and CronJobs.md new file mode 100644 index 0000000000..21af972870 --- /dev/null +++ b/sources/tech/20201123 A beginner-s guide to Kubernetes Jobs and CronJobs.md @@ -0,0 +1,233 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A beginner's guide to Kubernetes Jobs and CronJobs) +[#]: via: (https://opensource.com/article/20/11/kubernetes-jobs-cronjobs) +[#]: author: (Mike Calizo https://opensource.com/users/mcalizo) + +A beginner's guide to Kubernetes Jobs and CronJobs +====== +Use Jobs and CronJobs to control and manage Kubernetes pods and +containers. +![Ships at sea on the web][1] + +[Kubernetes][2] is the default orchestration engine for containers. Its options for controlling and managing pods and containers include: + + 1. Deployments + 2. StatefulSets + 3. ReplicaSets + + + +Each of these features has its own purpose, with the common function to ensure that pods run continuously. In failure scenarios, these controllers either restart or reschedule pods to ensure the services in the pods continue running. + +As the [Kubernetes documentation explains][3], a Kubernetes Job creates one or more pods and ensures that a specified number of the pods terminates when the task (Job) completes. + +Just like in a typical operating system, the ability to perform automated, scheduled jobs without user interaction is important in the Kubernetes world. But Kubernetes Jobs do more than just run automated jobs, and there are multiple ways to utilize them through: + + 1. Jobs + 2. CronJobs + 3. Work queues (this is beyond the scope of this article) + + + +Sounds simple right? Well, maybe. Anyone who works on containers and microservice applications knows that some require services to be transient so that they can do specific tasks for applications or within the Kubernetes clusters. + +In this article, I will go into why Kubernetes Jobs are important, how to create Jobs and CronJobs, and when to use them for applications running on the Kubernetes cluster. + +### Differences between Kubernetes Jobs and CronJobs + +Kubernetes Jobs are used to create transient pods that perform specific tasks they are assigned to. [CronJobs][4] do the same thing, but they run tasks based on a defined schedule. + +Jobs play an important role in Kubernetes, especially for running batch processes or important ad-hoc operations. Jobs differ from other Kubernetes controllers in that they run tasks until completion, rather than managing the desired state such as in Deployments, ReplicaSets, and StatefulSets. + +### How to create Kubernetes Jobs and CronJobs + +With that background in hand, you can start creating Jobs and CronJobs. + +#### Prerequisites + +To do this exercise, you need to have the following: + + 1. A working Kubernetes cluster; you can install it with either: + * [CentOS 8][5] + * [Minikube][6] + 2. The [kubectl][7] Kubernetes command line + + + +Here is the Minikube deployment I used for this demonstration: + + +``` +$ minikube version +minikube version: v1.8.1 + +$ kubectl cluster-info +Kubernetes master is running at +KubeDNS is running at + +$ kubectl get nodes +NAME       STATUS   ROLES    AGE   VERSION +minikube   Ready    master   88s   v1.17.3 +``` + +#### Kubernetes Jobs + +Just like anything else in the Kubernetes world, you can create Kubernetes Jobs with a definition file. Create a file called `sample-jobs.yaml` using your favorite editor. + +Here is a snippet of the file that you can use to create an example Kubernetes Job: + + +``` +apiVersion: batch/v1          ## The version of the Kubernetes API +kind: Job                     ## The type of object for jobs +metadata: + name: job-test +spec:                        ## What state you desire for the object + template: +   metadata: +     name: job-test +   spec: +     containers: +     - name: job +       image: busybox                  ##  Image used +       command: ["echo", "job-test"]   ##  Command used to create logs for verification later +     restartPolicy: OnFailure          ##  Restart Policy in case container failed +``` + +Next, apply the Jobs in the cluster: + + +``` +`$ kubectl apply -f sample-jobs.yaml` +``` + +Wait a few minutes for the pods to be created. You can view the pod creation's status: + + +``` +`$ kubectl get pod –watch` +``` + +After a few seconds, you should see your pod created successfully: + + +``` +$ kubectl get pods +  NAME                  READY   STATUS          RESTARTS         AGE +  job-test                      0/1     Completed       0            11s +``` + +Once the pods are created, verify the Job's logs: + + +``` +`$ kubectl logs job-test job-test` +``` + +You have created your first Kubernetes Job, and you can explore details about it: + + +``` +`$ kubectl describe job job-test` +``` + +Clean up the Jobs: + + +``` +`$ kubectl delete jobs job-test` +``` + +#### Kubernetes CronJobs + +You can use CronJobs for cluster tasks that need to be executed on a predefined schedule. As the [documentation explains][8], they are useful for periodic and recurring tasks, like running backups, sending emails, or scheduling individual tasks for a specific time, such as when your cluster is likely to be idle. + +As with Jobs, you can create CronJobs via a definition file. Following is a snippet of the CronJob file `cron-test.yaml`. Use this file to create an example CronJob: + + +``` +apiVersion: batch/v1beta1            ## The version of the Kubernetes API +kind: CronJob                        ## The type of object for Cron jobs +metadata: +  name: cron-test +spec: +  schedule: "*/1 * * * *"            ## Defined schedule using the *nix style cron syntax +  jobTemplate: +    spec: +      template: +        spec: +          containers: +          - name: cron-test +            image: busybox            ## Image used +            args: +           - /bin/sh +            - -c +            - date; echo Hello this is Cron test +          restartPolicy: OnFailure    ##  Restart Policy in case container failed +``` + +Apply the CronJob to your cluster: + + +``` +$ kubectl apply -f cron-test.yaml + cronjob.batch/cron-test created +``` + +Verify that the CronJob was created with the schedule in the definition file: + + +``` +$ kubectl get cronjob cron-test + NAME        SCHEDULE      SUSPEND   ACTIVE   LAST SCHEDULE   AGE + cron-test   */1 * * * *   False     0        <none>          10s +``` + +After a few seconds, you can find the pods that the last scheduled job created and view the standard output of one of the pods: + + +``` +$ kubectl logs cron-test-1604870760 +  Sun Nov  8 21:26:09 UTC 2020 +  Hello from the Kubernetes cluster +``` + +You have created a Kubernetes CronJob that creates an object once per execution based on the schedule `schedule: "*/1 * * * *"`. Sometimes the creation can be missed because of environmental issues in the cluster. Therefore, they need to be [idempotent][9]. + +### Other things to know + +Unlike deployments and services in Kubernetes, you can't change the same Job configuration file and reapply it at once. When you make changes in the Job configuration file, you must delete the previous Job from the cluster before you apply it. + +Generally, creating a Job creates a single pod and performs the given task, as in the example above. But by using completions and [parallelism][10], you can initiate several pods, one after the other. + +### Use your Jobs + +You can use Kubernetes Jobs and CronJobs to manage your containerized applications. Jobs are important in Kubernetes application deployment patterns where you need a communication mechanism along with interactions between pods and the platforms. This may include cases where an application needs a "controller" or a "watcher" to complete tasks or needs to be scheduled to run periodically. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/kubernetes-jobs-cronjobs + +作者:[Mike Calizo][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://opensource.com/users/mcalizo +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/kubernetes_containers_ship_lead.png?itok=9EUnSwci (Ships at sea on the web) +[2]: https://kubernetes.io/ +[3]: https://kubernetes.io/docs/concepts/workloads/controllers/job/ +[4]: https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/ +[5]: https://phoenixnap.com/kb/how-to-install-kubernetes-on-centos +[6]: https://minikube.sigs.k8s.io/docs/start/ +[7]: https://kubernetes.io/docs/reference/kubectl/kubectl/ +[8]: https://v1-18.docs.kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/ +[9]: https://en.wikipedia.org/wiki/Idempotence +[10]: https://kubernetes.io/docs/concepts/workloads/controllers/job/#parallel-jobs From 01f6e14b98072def62c9bcadb9b68f3034f2a657 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 24 Nov 2020 08:46:17 +0800 Subject: [PATCH 0865/1156] translated --- ...01106 Reclaim hard-drive space with LVM.md | 90 ------------------- ...01106 Reclaim hard-drive space with LVM.md | 90 +++++++++++++++++++ 2 files changed, 90 insertions(+), 90 deletions(-) delete mode 100644 sources/tech/20201106 Reclaim hard-drive space with LVM.md create mode 100644 translated/tech/20201106 Reclaim hard-drive space with LVM.md diff --git a/sources/tech/20201106 Reclaim hard-drive space with LVM.md b/sources/tech/20201106 Reclaim hard-drive space with LVM.md deleted file mode 100644 index dcd1a96f7b..0000000000 --- a/sources/tech/20201106 Reclaim hard-drive space with LVM.md +++ /dev/null @@ -1,90 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Reclaim hard-drive space with LVM) -[#]: via: (https://fedoramagazine.org/reclaim-hard-drive-space-with-lvm/) -[#]: author: (Troy Curtis Jr https://fedoramagazine.org/author/troycurtisjr/) - -Reclaim hard-drive space with LVM -====== - -![Hard drive image][1] - -Photo by Frank R @ Unsplash.com - -LVM is a tool for logical volume management which includes allocating disks, striping, mirroring and resizing logical volumes. It is commonly used on Fedora installations (prior to BTRFS as default it was LVM+Ext4). But have you ever started up your system to find out that Gnome just said the home volume is almost out of space! Luckily, there is likely some space sitting around in another volume, unused and ready to re-alocate. Here’s how to reclaim hard-drive space with LVM. - -The key to easily re-alocate space between volumes is the [Logical Volume Manager (LVM)][2]. Fedora 32 and before use LVM to divide disk space by default. This technology is similar to standard hard-drive partitions, but LVM is a lot more flexible. LVM enables not only flexible volume size management, but also advanced capabilities such as read-write snapshots, striping or mirroring data across multiple drives, using a high-speed drive as a cache for a slower drive, and much more. All of these advanced options can get a bit overwhelming, but resizing a volume is straight-forward. - -### LVM basics - -The _volume group_ serves as the main container in the LVM system. By default Fedora only defines a single volume group, but there can be as many as needed. Actual hard-drive and hard-drive partitions are added to the _volume group_ as _physical volumes_. _Physical volumes_ add available free space to the _volume group_. A typical Fedora install has one formatted boot partition, and the rest of the drive is a partition configured as an LVM _physical volume_. - -Out of this pool of available space, the _volume group_ allocates one or more _logical volumes_. These volumes are similar to hard-drive partitions, but without the limitation of contiguous space on the disk. LVM _logical volumes_ can even span multiple devices! Just like hard-drive partitions, _logical volumes_ have a defined size and can contain any filesystem which can then be mounted to specific directories. - -### What’s needed - -Confirm the system uses LVM with the _gnome-disks_ application, and make sure there is free space available in some other volume. Without space to reclaim from another volume, this guide isn’t useful. A [Fedora live CD/USB][3] is also needed. Any file system that needs to shrink must be unmounted. Running from a live image allows all the volumes on the hard-disk to remain unmounted, even important directories like _/_ and _/home_. - -![Use gnome-disks to verify free space][4] - -### A word of warning - -No data should be lost by following this guide, but it does muck around with some very low-level and powerful commands. One mistake could destroy all data on the hard-drive. So backup all the data on the disk first! - -### Resizing LVM volumes - -To begin, boot the Fedora live image and select _Try Fedora_ at the dialog. Next, use the _Run Command_ to launch the _blivet-gui_ application (accessible by pressing _Alt-F2_, typing _blivet-gui_, then pressing _enter_). Select the volume group on the left under _LVM_. The logical volumes are on the right. - -![Explore logical volumes in blivet-gui][5] - -The logical volume labels consist of both the volume group name and the logical volume name. In the example, the volume group is “fedora_localhost-live” and there are “home”, “root”, and “swap” logical volumes allocated. To find the full volume, select each one, click on the _gear_ icon, and choose _resize_. The slider in the resize dialog indicates the allowable sizes for the volume. The minimum value on the left is the space already in use within the file system, so this is the minimum possible volume size (without deleting data). The maximum value on the right is the greatest size the volume can have based on available free space in the _volume group_. - -![Resize dialog in blivet-gui][6] - -A grayed out _resize_ option means the volume is full and there is no free space in the volume group. It’s time to change that! Look through all of the volumes to find one with plenty of extra space, like in the screenshot above. Move the slider to the left to set the new size. Free up enough space to be useful for the full volume, but still leave plenty of space for future data growth. Otherwise, this volume will be the next to fill up. - -Click _resize_ and note that a new item appears in the volume listing: _free space_. Now select the full volume that started this whole endeavor, and move the slider all the way to the right. Press _resize_ and marvel at the new improved volume layout. However, nothing has changed on the hard drive yet. Click on the _check-mark_ to commit the changes to disk. - -![Review changes in blivet-gui][7] - -Review the summary of the changes, and if everything looks right, click _Ok_ to proceed. Wait for _blivet-gui_ to finish. Now reboot back into the main Fedora install and enjoy all the new space in the previously full volume. - -### Planning for the future - -It is challenging to know how much space any particular volume will need in the future. Instead of immediately allocating all available free space, consider leaving it free in the volume group. In fact, Fedora Server reserves space in the volume group by default. Extending a volume is possible while it is online and in use. No live image or reboot needed. When a volume is almost full, easily extend the volume using part of the available free space and keep working. Unfortunately the default disk manager, _gnome-disks_, does not support LVM volume resizing, so install _[blivet-gui][8]_ for a graphical management tool. Alternately, there is a simple terminal command to extend a volume: - -``` -lvresize -r -L +1G /dev/fedora_localhost-live/root -``` - -### Wrap-up - -Reclaiming hard-drive space with LVM just scratches the surface of LVM capabilities. Most people, especially on the desktop, probably don’t need the more advanced features. However, LVM is there when the need arises, though it can get a bit complex to implement. [BTRFS][9] is the default filesystem, without LVM, starting with [Fedora 33][10]. BTRFS can be easier to manage while still flexible enough for most common usages. Check out the recent [Fedora Magazine articles on BTRFS][11] to learn more. - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/reclaim-hard-drive-space-with-lvm/ - -作者:[Troy Curtis Jr][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/troycurtisjr/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2020/11/lvm-resize-816x345.jpg -[2]: http://sourceware.org/lvm2/ -[3]: https://getfedora.org/en/workstation/download/ -[4]: https://fedoramagazine.org/wp-content/uploads/2020/11/gnome-disks.png -[5]: https://fedoramagazine.org/wp-content/uploads/2020/11/blivet-overview.png -[6]: https://fedoramagazine.org/wp-content/uploads/2020/11/blivet-resize-1024x525.png -[7]: https://fedoramagazine.org/wp-content/uploads/2020/11/blivet-summary-1024x525.png -[8]: https://fedoraproject.org/wiki/Blivet-gui -[9]: https://fedoramagazine.org/btrfs-coming-to-fedora-33/ -[10]: https://fedoramagazine.org/whats-new-fedora-33-workstation/ -[11]: https://fedoramagazine.org/btrfs-snapshots-backup-incremental/ diff --git a/translated/tech/20201106 Reclaim hard-drive space with LVM.md b/translated/tech/20201106 Reclaim hard-drive space with LVM.md new file mode 100644 index 0000000000..7485899982 --- /dev/null +++ b/translated/tech/20201106 Reclaim hard-drive space with LVM.md @@ -0,0 +1,90 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Reclaim hard-drive space with LVM) +[#]: via: (https://fedoramagazine.org/reclaim-hard-drive-space-with-lvm/) +[#]: author: (Troy Curtis Jr https://fedoramagazine.org/author/troycurtisjr/) + +使用 LVM 回收硬盘空间 +====== + +![Hard drive image][1] + +照片:Frank R @ Unsplash.com + +LVM 是一个逻辑卷管理工具,包括分配磁盘、区代化、镜像和调整逻辑卷的大小。它在 Fedora 安装中被普遍使用(在 BTRFS 作为默认之前是 LVM+Ext4)。但是你是否曾经遇到过启动系统时,Gnome 提示主卷几乎没有空间了!幸运的是,很有可能有一些空间在另一个卷中,而未被使用,并准备重新分配。下面就来看看如何用 LVM 回收硬盘空间。 + +在卷之间轻松重新分配空间的关键是[逻辑卷管理器 (LVM)][2]。Fedora 32 及以前的系统默认使用 LVM 来划分磁盘空间。这种技术类似于标准的硬盘分区,但 LVM 更加灵活。LVM 不仅可以实现灵活的卷大小管理,还可以实现一些高级功能,比如读写快照、在多个硬盘上进行数据区带化或镜像、将高速硬盘作为慢速硬盘的缓存等等。所有这些高级选项可能会让人有点不知所措,但调整卷的大小很直接的。 + +### LVM 基础 + +_卷组_作为 LVM 系统中的主要容器。默认情况下,Fedora 只定义了一个卷组,但你可以根据需要定义多个卷组。实际的硬盘和硬盘分区被添加到 _卷组_中作为_物理卷_。_物理卷_会将可用的空间添加到_卷组_中。一个典型的 Fedora 安装有一个格式化的启动分区,其余的硬盘是一个配置为 LVM _物理卷_的分区。 + +从这个可用空间池中,_卷组_分配了一个或多个_逻辑卷_。这些卷类似于硬盘分区,但没有磁盘上连续空间的限制。LVM 的_逻辑卷_甚至可以跨越多个设备!就像硬盘分区一样,_逻辑卷_有一个定义的大小,可以包含任何文件系统,然后可以挂载到特定的目录。 + +### 需要什么 + +在 gnome-disks 应用中确认系统使用 LVM ,并确保其他卷中有可用的空间。如果没有从另一个卷中回收的空间,这个指南就没有用。还需要一个 [Fedora live CD/USB][3]。任何需要收缩的文件系统都必须卸载。从 Live 镜像运行可以让硬盘上的所有卷保持未挂载状态,甚至包括像 _/_ 和 _/home_ 这样的重要目录。 + +![Use gnome-disks to verify free space][4] + +### 一句话警告 + +按照这个指南,应该不会丢失任何数据,但它确实会使用一些非常底层和强大的命令。一个错误可能会破坏硬盘上的所有数据。所以要先备份磁盘上的所有数据! + +### 调整 LVM 卷的大小 + +开始时,启动 Fedora Live 镜像并在对话框中选择 _Try Fedora_。接下来,使用 _Run Command_ 启动 _blivet-gui_ 应用(按 _Alt-F2_,输入 _blivet-gui_,然后按_回车_)。选择左侧 _LVM_ 下的卷组。逻辑卷在右边。 + +![Explore logical volumes in blivet-gui][5] + +逻辑卷标签由卷组名称和逻辑卷名称组成。在本例中,卷组是 “fedora_localhost-live”,分配了 “home”、“root” 和 “swap” 逻辑卷。要找到完整的卷,选择每一个卷,点击_齿轮_图标,然后选择 _resize_。调整大小对话框中的滑块表示卷的允许大小。左边的最小值是文件系统中已经使用的空间,所以这是最小可能的体积大小(不删除数据)。右边的最大值是基于_卷组_中的最大可用空间。 + +![Resize dialog in blivet-gui][6] + +灰色的 _resize_ 选项意味着该卷已经满了,而且卷组中没有可用空间。现在可以更改大小了!查看所有的卷,就像上面的截图那样,找到一个有足够空间的卷。并像上面的截图那样,在所有的卷中找到一个有大量额外空间的卷。向左移动滑块来设置新的大小。腾出足够的空间对整个卷有用,但仍然为未来的数据增长留出足够的空间。否则,这个卷将是下一个被填满的卷。 + +点击 _resize_,注意卷列表中出现了一个新项目:_空闲空间_。现在选择这次要调整的卷,并将滑块一直向右移动。按 _resize_ 键,并查看新改进的卷的布局。然而,硬盘驱动器上的任何东西都还没有改变。点击_勾选按钮_将更改提交到磁盘。 + +![Review changes in blivet-gui][7] + +查看更改的摘要,如果一切看起来都是正确的,点击 _Ok_ 继续。等待 _blivet-gui_ 完成。现在重新启动回到 Fedora ,享受之前被充满的卷上的新空间。 + +### 为未来计划 + +要知道任何特定卷在未来需要多少空间是很困难的。与其立即分配所有可用的空闲空间,不如考虑在卷组中留出空闲空间。事实上,Fedora Server 默认在卷组中保留空间。当一个卷处于在线和使用中时,扩展卷是可能的。不需要 Live 镜像或重启。当一个卷几乎满的时候,可以使用部分可用空间轻松扩展卷并继续工作。遗憾的是,默认的磁盘管理器 _gnome-disks_ 不支持 LVM 卷的大小调整,所以安装 _[blivet-gui][8]_ 作为图形化管理工具。另外,还有一个简单的终端命令来扩展卷。 + +``` +lvresize -r -L +1G /dev/fedora_localhost-live/root +``` + +### 总结 + +用 LVM 回收硬盘空间只是 LVM 功能的表面。大多数人,特别是在桌面中,可能不需要更高级的功能。然而,当需要的时候,LVM 就在那里,尽管它的实现可能会变得有点复杂。从 [Fedora 33][10] 开始,[BTRFS][9] 是默认的文件系统,没有 LVM。BTRFS 可以更容易管理,同时对于大多数常见的使用来说也足够灵活。查看最近 [Fedora Magazine 关于 BTRFS 的文章][11]了解更多。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/reclaim-hard-drive-space-with-lvm/ + +作者:[Troy Curtis Jr][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/troycurtisjr/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/11/lvm-resize-816x345.jpg +[2]: http://sourceware.org/lvm2/ +[3]: https://getfedora.org/en/workstation/download/ +[4]: https://fedoramagazine.org/wp-content/uploads/2020/11/gnome-disks.png +[5]: https://fedoramagazine.org/wp-content/uploads/2020/11/blivet-overview.png +[6]: https://fedoramagazine.org/wp-content/uploads/2020/11/blivet-resize-1024x525.png +[7]: https://fedoramagazine.org/wp-content/uploads/2020/11/blivet-summary-1024x525.png +[8]: https://fedoraproject.org/wiki/Blivet-gui +[9]: https://fedoramagazine.org/btrfs-coming-to-fedora-33/ +[10]: https://fedoramagazine.org/whats-new-fedora-33-workstation/ +[11]: https://fedoramagazine.org/btrfs-snapshots-backup-incremental/ From c07498e1dd2392d61cf3dd8fb6648ab11095e915 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 24 Nov 2020 08:51:23 +0800 Subject: [PATCH 0866/1156] translating --- ...Disk Size of Your Existing Virtual Machines in VirtualBox.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201120 How to Increase Disk Size of Your Existing Virtual Machines in VirtualBox.md b/sources/tech/20201120 How to Increase Disk Size of Your Existing Virtual Machines in VirtualBox.md index f0240e9ad7..6922caa8de 100644 --- a/sources/tech/20201120 How to Increase Disk Size of Your Existing Virtual Machines in VirtualBox.md +++ b/sources/tech/20201120 How to Increase Disk Size of Your Existing Virtual Machines in VirtualBox.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 74f0da10e917c00399e8798ccf6435389fd1c84b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 24 Nov 2020 11:39:10 +0800 Subject: [PATCH 0867/1156] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @frogOAO 恭喜你,完成了第一篇翻译贡献! --- ...s for USB, Clipboard and Folder Sharing.md | 180 +++++++++--------- 1 file changed, 91 insertions(+), 89 deletions(-) diff --git a/translated/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md b/translated/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md index 47d60deb03..a216b01e74 100644 --- a/translated/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md +++ b/translated/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md @@ -1,24 +1,34 @@ [#]: collector: (lujun9972) [#]: translator: (frogOAO) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Install Fedora in VirtualBox [With Steps for USB, Clipboard and Folder Sharing]) [#]: via: (https://itsfoss.com/install-fedora-in-virtualbox/) [#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) -如何在 Fedora 中安装 VirtualBox 【附带 USB,剪切板,文件夹共享教程】 +如何在 Fedora 中安装 VirtualBox ====== -如果您对 Fedora Linux 感兴趣,这有几种方式可以尝试它。 +如果你对 Fedora Linux 感兴趣,这有几种方式可以尝试它。 -最简单还不影响您操作系统的方式是 [制作 Fedora 的 USB 启动盘][1] +最简单还不影响你操作系统的方式是 [制作 Fedora 的 USB 临场启动盘][1]。 + +> **LCTT 译注**: +> +> 在 Linux 发行版的使用方式上,有一种可以无需安装而通过光盘或 USB 存储棒直接在计算机上启动完整的 Linux 操作系统的方式,这种方式称之为 “Live” 方式,如 Live CD、Live USB。 +> +> 通常,Live 一词并不翻译,不过,我认为,除了英文缩写和部分历史原因造成直接使用的英文单词,大部分场景都应该使用本地化的语言来描述,否则,中英文混杂的港台式中文,实在有些不伦不类;抑或,外文翻译本身就不存在意义了。 +> +> 因此,对于 “Live” 一词如何翻译,我们也颇费心思。这个词,在维基百科中文中,被翻译为“[自生系统](https://zh.wikipedia.org/wiki/Live_CD)”,在某些场景下偶见 “现场”、“临场” 等翻译。考虑到 Live CD/USB 的特性,我认为翻译为 “临场” 比较好。 +> +> 于此抛出愚见,希望得到大家的积极反馈。wxy@LCTT 另一种方式是安装 VirtualBox 利用虚拟化技术来尝试 Fedora。这样,你可以在你的操作系统上像使用应用程序一样使用 Fedora。 -通过这种方式,您可以执行更彻底的测试,而不会搞乱当前的操作系统。 +通过这种方式,你可以执行更彻底的测试,而不会搞乱当前的操作系统。 -您甚至可以复制您的虚拟安装程序,并在其他系统上重新安装它。听起来方便吗?让我来教你怎么做。 +你甚至可以复制你的虚拟环境,并在其他系统上重新安装它。听起来方便吗?让我来教你怎么做。 ### 在 Fedora 上安装 Fedora @@ -28,129 +38,126 @@ #### 步骤一:安装 VirtualBox -如果您的系统还没有安装 VirtualBox,您可以从官方网站下载。您可以找到 Windows,MacOs 和 Linux 的说明。 [Ubuntu 用户可以参考这个关于安装 VirtualBox 的详细教程。][3]. +如果你的系统还没有安装 VirtualBox,你可以从官方网站下载。你可以找到 Windows、MacOs 和 Linux 的说明。 [Ubuntu 用户可以参考这个关于安装 VirtualBox 的详细教程。][3] ![][4] -[下载 VirtualBox][5] +- [下载 VirtualBox][5] -#### **步骤二: 下载 Fedora ISO** +#### 步骤二: 下载 Fedora ISO -如果您不熟悉 Fedora,那么这些镜像您需要知道。 +如果你不熟悉 Fedora,那么这些镜像你需要知道。 -[Fedora IoT][6] 是用于可扩展基础设施的, [Fedora workstation][7] 是一个镜像,带有一组面向普通GNOME桌面环境中的桌面的工具。[Fedora server][8] 顾名思义,是为服务器或数据中心定制的。 +[Fedora IoT][6] 是用于可扩展基础设施的,[Fedora workstation][7] 是一个带有一组面向普通 GNOME 桌面环境中的桌面工具的镜像。[Fedora server][8] 顾名思义,是为服务器或数据中心定制的。 -如果GNOME不是您的首选,您可以下载一个带有替代桌面环境的[定制版][9]Fedora桌面。 对于本教程,我选择了带有GNOME桌面环境的[Fedora 33][10]。 +如果 GNOME 不是你的首选,你可以下载一个带有替代桌面环境的[定制版][9] Fedora 桌面。对于本教程,我选择了带有 GNOME 桌面环境的[Fedora 33][10]。 -[下载 Fedora][11] +- [下载 Fedora][11] #### 步骤三: 创建一个空虚拟机并对其进行配置 要成功安装和运行 Fedora,至少需要 20GB 磁盘空间和 2GB RAM。不过,为了获得更流畅的用户体验,建议增加一倍。在此基础上,我将创建并配置虚拟机。 -开启 Virtual Box 点击 New。 +开启 Virtual Box 点击 “New”。 ![创建一个新的虚拟机][12] -需要注意,最重要的选项是 **将类型设置为 Linux and 版本设置为 Fedora (64-bit)**。如果您在名称提示符处开始输入 Fedora,VirtualBox 将自动为您选择正确的设置。虽然名字不一定非得是 Fedora,它可以是任何你喜欢的。 +需要注意,最重要的选项是 **将类型设置为 Linux ,版本设置为 Fedora (64-bit)**。如果你在名称提示符处开始输入 “Fedora”,VirtualBox 将自动为你选择正确的设置。虽然名字不一定非得是 Fedora,它可以是任何你喜欢的。 -_如果您只能访问 32 位版本,那么您需要在 BIOS 上启用虚拟化技术,如果您有一个 AMD CPU,它被称为 SVM。最坏的情况是您的 CPU 不支持虚拟化技术。如果你不确定,先检查这个。_ +*如果你只能访问 32 位版本,那么你需要在 BIOS 上启用虚拟化技术,如果你有一个 AMD CPU,它被称为 SVM。最坏的情况是你的 CPU 不支持虚拟化技术。如果你不确定,先检查这个。 -如果您的设置和我一样,点击 create 按钮。 +如果你的设置和我类似,点击 “create” 按钮。 -![Name your VM and assign it at least 3 GB RAM][13] +![命名你的虚拟机,并未它指定至少 3 GB RAM][13] -如前所述,至少需要 20gb 的磁盘空间才能安装 Fedora。我的系统上有 32gb 的内存,所以我分配了 8gb。3 GB 的内存应该没问题。 +如前所述,至少需要 20GB 的磁盘空间才能安装 Fedora。我的系统上有 32GB 的内存,所以我分配了 8GB 内存。3 GB 的内存应该也没问题。 顺便说下内存的使用,只有在运行虚拟机时,虚拟机才会使用内存。否则,它将可用于常规使用。 -确保其余设置与示例匹配,并点击 Create。 +确保其余设置与示例匹配,并点击 “Create” 按钮。 -![Assign 15-20 GB of disk space in VDI format][14] +![以 VDI 格式分配 15-20 GB 的磁盘空间][14] 在你点击虚拟机的 Start 按钮之前,你需要加载如下所示的 ISO [光驱]。 -![Add the Fedora ISO to optical drive storage][15] +![将 Fedora ISO 添加到光驱存储中][15] -因为你的虚拟硬盘是空的,虚拟机将从这个 ISO 启动。可以把它看作是使用 live USB 或磁盘安装 Linux。 +因为你的虚拟硬盘是空的,虚拟机将从这个 ISO 启动。可以把它看作是使用临场 USB 或磁盘安装 Linux。 -![Go to Settings and add ISO as optical drive][16] +![在设置中将 ISO 添加为光驱][16] -然后,如果您有一个多核CPU,建议为虚拟机分配 2 个或更多的核。您可以在 system 选项卡下找到 CPU 核心。配置系统时,单击 ok 并启动虚拟机。 +然后,如果你有一个多核 CPU,建议为虚拟机分配 2 个或更多的核。你可以在 “System” 选项卡下找到 CPU 核心。配置系统时,单击 “OK” 并启动虚拟机。 -![Optional step: Assign number of CPU cores][17] +![可选:分配 CPU 核数][17] -配置好所有内容后,单击 start 按钮开始安装。 +配置好所有内容后,单击 “Start” 按钮开始安装。 #### 步骤四:在 VirtualBox 中安装 Fedora。 -如果您正确地遵循了这个过程,那么当您启动虚拟机时,您将直接从 ISO 文件启动。当您看到类似下面的屏幕时,选择 Start Fedora,并按 enter 键。 +如果你正确地遵循了这个过程,那么当你启动虚拟机时,你将直接从 ISO 文件启动。当你看到类似下面的屏幕时,选择 “Start Fedora”,并按回车键。 -![Fedora running in live environment in virtual machine][18] +![Fedora 运行在虚拟机的临场环境中][18] -要启动安装对话框,单击 Install To Hard Drive。 +要启动安装对话框,单击 “Install To Hard Drive”。 -![Click on “install to hard drive”][19] +![点击 “install to hard drive”][19] -在您继续安装之前,有必要定义您的键盘布局、您的时区以及最终安装操作系统的位置。 +在你继续安装之前,有必要定义你的键盘布局、你的时区以及最终安装操作系统的位置。 -![Choose keyboard, time and date and then go to Installation Destination][20] +![选择键盘布局、日期和时间,然后是安装目标位置][20] -划分过程很简单。您像前面的 VDI 那样划分一些空闲空间。它应该被自动识别。 +分区过程很简单。你像前面的 VDI 那样划分一些空闲空间。它应该被自动识别。 +选择你的磁盘并将存储配置设置为 “Automatic”。单击 “Done” 进入上一个对话框。 -选择您的磁盘并将存储配置设置为 automatic。单击 Done 进入上一个对话框。 +![磁盘应该会自动识别][21] -![Disk should be automatically recognized][21] +一旦你配置完了上面的,点击 “Begin Installation”。 -一旦你配置了上面的,点击 “Begin Installation”。 - -![Begin installation of Fedora][22] +![开始 Fedora 的安装][22] 现在只需等待 5 - 6 分钟即可完成安装。安装完成后,点击 “Finish installation” 按钮。 -最后一步,需要关闭系统的电源。如果您不熟悉 GNOME 桌面环境,您可以这样做。 +最后一步,需要关闭系统的电源。如果你不熟悉 GNOME 桌面环境,你可以如下这样做。 -![Turn off Fedora live environment after installation][23] +![安装后关闭 Fedora 临场环境][23] -您必须手动卸载在初始步骤中加载的 ISO 文件。 +你必须手动卸载在初始步骤中加载的 ISO 文件。 -![Remove Fedora ISO From Optical Drive][24] +![从光驱中移走 Fedora ISO][24] -下一次使用 Fedora 启动虚拟机时,系统将提示您为 Fedora Linux 创建用户帐户并设置密码。 +下一次使用 Fedora 启动虚拟机时,系统将提示你为 Fedora Linux 创建用户帐户并设置密码。 -### 使用 VirtualBox 客户添加的附加功能,如剪贴板共享,文件夹共享等 +### 使用 VirtualBox Guest Additions 的附加功能,如剪贴板共享,文件夹共享等 -[增强功能包][25] 客户附加程序设计为在客户操作系统安装后安装在虚拟机中。它们包含对客户操作系统进行优化的设备驱动程序和系统应用程序,以获得更好的性能和可用性。 +[Guest Additions][25] 设计为在访客guest操作系统安装后安装在虚拟机中。它们包含对客户操作系统进行优化的设备驱动程序和系统应用程序,以获得更好的性能和可用性。 -客户添加 ISO 文件被安装为虚拟 CD-ROM 以便安装。 +Guest Additions ISO 文件被安装为虚拟 CD-ROM 以便安装。 这是一个简单的过程。只需单击设备选项卡,然后单击 “Insert Guest Additions CD image”。 ![][26] -当提示符单击 download 时,系统将弹出您下载增强功能包界面。 +当提示单击 “Download” 时,系统将弹出下载 Guest Additions 镜像界面。 -![Install VirtualBox Guest Additions][27] +![安装 VirtualBox Guest Additions][27] -#### **共享剪贴板** +#### 共享剪贴板 -有时候,您需要在虚拟机和主机操作系统之间移动一些内容。共享剪贴板/拖放支持将允许您在一个平台上复制项目,并将它们粘贴到另一个平台上。 +有时候,你需要在虚拟机和宿主机host操作系统之间移动一些内容。共享剪贴板/拖放支持将允许你在一个平台上复制项目,并将它们粘贴到另一个平台上。 -要启用此功能,请在VirtualBox主页上选择 **Settings**,并按照下面的说明操作。**双向** 的选项是最方便的。 +要启用此功能,请在 VirtualBox 主页上选择 “Settings”,并按照下面的说明操作。“Bidirectional” 的选项是最方便的。 -![Enable clipboard sharing between guest and host systems][28] +![启用访客和宿主系统间的剪贴板共享][28] -#### **共享文件夹** +#### 共享文件夹 有两种类型的分享: * 永久共享,与虚拟机设置一起保存。 - * 暂态共享,当虚拟机关闭时就会消失。可以使用 VirtualBox 管理器中的复选框创建暂态共享。 + * 暂时共享,当虚拟机关闭时就会消失。可以使用 VirtualBox 管理器中的复选框创建暂时共享。 - - -在本教程中,我将创建一个永久共享文件夹。在 VM 设置中添加您想要共享的主机系统文件夹,并选择您想要在 VM 中出现的名称。 +在本教程中,我将创建一个永久共享文件夹。在 VM 设置中添加你想要共享的宿主机系统文件夹,并选择你想要在 VM 中出现的名称。 ![][29] @@ -158,76 +165,71 @@ _如果您只能访问 32 位版本,那么您需要在 BIOS 上启用虚拟化 ![][30] -#### **更好的视频支持** +#### 更好的视频支持 -虽然 Oracle VirtualBox 提供了所有基本功能的虚拟显卡,但客户添加的自定义视频驱动程序为您提供了超高和非标准的视频模式,以及加速的视频性能。 +虽然 Oracle VirtualBox 提供了具有基本功能的虚拟显卡,但访客系统添加的自定义视频驱动程序为你提供了超高和非标准的视频模式,以及视频加速。 -使用增强安装包,操作系统的分辨率将随着您调整计算机上的 VirtualBox 窗口而动态调整大小。 +使用 Guest Additions,操作系统的分辨率将随着你调整计算机上的 VirtualBox 窗口而动态调整大小。 -最后,增强安装包可以利用您的计算机的显卡。如果你是一名游戏玩家或在 WM 中使用高效软件,这就会产生巨大的改变。 +最后,Guest Additions 可以利用你的计算机的显卡。如果你是一名游戏玩家或在 WM 中使用高效软件,这就会产生巨大的改变。 #### USB 和网络设备共享 -有了 VirtualBox,用户就可以使用一个功能齐全的操作系统,而不必在不同的硬件上进行设置。然而,在主机和客户机器之间共享USB和网络设备并不像想的那样简单。 +有了 VirtualBox,用户就可以使用一个功能齐全的操作系统,而不必在不同的硬件上进行设置。然而,在宿主机和访客机器之间共享 USB 和网络设备并不像想的那样简单。 -要访问USB设备,您将需要安装 [VirtualBox 扩展包][31]. +要访问 USB 设备,你将需要安装 [VirtualBox 扩展包][31]。 -![Install VirtualBox Extensions pack][32] +![安装 VirtualBox 扩展包][32] -_**下面这些仅对 Linux**_,因为我使用的是 Linux。 +**下面这些仅对 Linux**,因为我使用的是 Linux。 -为了使 VirtualBox 能够访问 USB 子系统,运行 VirtualBox 的用户(在主机系统上)必须属于 vboxuser 组。为此,打开一个终端并发出以下命令: +为了使 VirtualBox 能够访问 USB 子系统,运行 VirtualBox 的用户(在宿主机系统上)必须属于 `vboxuser` 组。为此,打开一个终端并发出以下命令: ``` sudo usermod -aG vboxusers 'your username' ``` -运行该命令后,您应该注销并重新登录,或者重新启动主机。 +运行该命令后,你应该注销并重新登录,或者重新启动主机。 -在这一步,插入你的 u 盘,通过你的 VM 设置,你应该能够找到并添加介质,如例子中所示。 +在这一步,插入你的 U 盘,通过你的 VM 设置,你应该能够找到并添加介质,如例子中所示。 ![][33] -当您下次启动虚拟机,您的USB将是可访问的。 +当你下次启动虚拟机,你的 USB 将是可访问的。 ![][34] ### 额外提示:保存并导出虚拟机,以便以后可以在任何系统上使用它 -您可能想在另一台计算机上使用虚拟机,或者是时候构建一台新机器了,并且您需要保持虚拟机的原样。只需几个简单的步骤,就可以轻松地导出当前设置并将其导入到另一台机器。 +你可能想在另一台计算机上使用虚拟机,或者是时候构建一台新机器了,并且你需要保持虚拟机的原样。只需几个简单的步骤,就可以轻松地导出当前设置并将其导入到另一台机器。 -在 VirtualBox 主面板上,单击 file 和 export 工具。如果你喜欢键盘快捷键,你可以简单地点击 **Ctrl+E** +在 VirtualBox 主面板上,单击 “file”、“Export Appliance”。如果你喜欢键盘快捷键,你可以简单地点击 `Ctrl+E`。 ![][35] -选择要导出的虚拟机,然后单击 next。 +选择要导出的虚拟机,然后单击 “Next”。 ![][36] -格式选项需要注意一下。开放虚拟化格式 0.9、1.0 和 2.0 有三种不同的选项,可以是 ovf 或 ova 扩展。 +“Format” 选项需要注意一下。有三种不同的选项:开放虚拟化格式Open Virtualization Format 0.9、1.0 和 2.0 ,可以是 ovf 或 ova 扩展名。 +使用 ovf 扩展名,会分别写入几个文件,而 ova 扩展名则将所有文件合并到一个开放虚拟化格式归档文件中。 -使用 ovf 扩展名,可以分别编写几个文件,而 ova 扩展名则将所有文件合并到一个开放的虚拟化格式归档文件中。 - - -默认格式 Open Virtualization format 1.0 应该没问题。 +默认格式 OVF 1.0 应该没问题。 ![][37] -要完成该过程,单击 next,然后在下一个对话框中单击 export。 +要完成该过程,单击 “Next”,然后在下一个对话框中单击 “Export”。 -#### 总结 +### 总结 -通过使用虚拟机,您不仅可以测试操作系统,还可以部署与物理机器同等重要的功能完整的系统。如今,硬件已经变得如此强大和廉价,它的大部分功能都没有被利用。 +通过使用虚拟机,你不仅可以测试操作系统,还可以部署与物理机器同等重要的功能完整的系统。如今,硬件已经变得如此强大和廉价,它的大部分功能都没有被利用。 +通过虚拟化技术,你可以使用这些浪费的资源。对物理机器的需求减少了,因此能源消耗也减少了。你可以从硬件和降低运行成本两方面省钱。 -通过虚拟化技术,您可以使用这些浪费的资源。对物理机器的需求减少了,因此能源消耗也减少了。您可以从硬件和降低运行成本两方面省钱。 +在大规模服务环境中,服务器虚拟化更多的是一种基本需求,而不是一种高级概念。 - -在更大的范围内,服务器虚拟化更多的是一种基本需求,而不是一种高级概念。 - - -我希望本教程对您在 VirtualBox 中安装 Fedora Linux 有帮助。如果你遇到任何问题,请在评论中告诉我。 +我希望本教程对你在 VirtualBox 中安装 Fedora Linux 有帮助。如果你遇到任何问题,请在评论中告诉我。 -------------------------------------------------------------------------------- @@ -235,8 +237,8 @@ via: https://itsfoss.com/install-fedora-in-virtualbox/ 作者:[Dimitrios Savvopoulos][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/frogOAO) -校对:[校对者ID](https://github.com/校对者ID) +译者:[frogOAO](https://github.com/frogOAO) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8ddf28dbb90ac89d1baa9a0d9bc9e9642f45c589 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 24 Nov 2020 11:40:32 +0800 Subject: [PATCH 0868/1156] PUB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @frogOAO 本文首发地址:https://linux.cn/article-12854-1.html 你的 LCTT 专页地址: https://linux.cn/lctt/frogOAO --- ...alBox -With Steps for USB, Clipboard and Folder Sharing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md (99%) diff --git a/translated/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md b/published/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md similarity index 99% rename from translated/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md rename to published/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md index a216b01e74..fa05060946 100644 --- a/translated/tech/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md +++ b/published/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (frogOAO) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12854-1.html) [#]: subject: (How to Install Fedora in VirtualBox [With Steps for USB, Clipboard and Folder Sharing]) [#]: via: (https://itsfoss.com/install-fedora-in-virtualbox/) [#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) From 35f7dd0bd41693088e851ca5d318d2e812fa8563 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 24 Nov 2020 17:58:10 +0800 Subject: [PATCH 0869/1156] PRF --- ...alBox -With Steps for USB, Clipboard and Folder Sharing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/published/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md b/published/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md index fa05060946..23edba8404 100644 --- a/published/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md +++ b/published/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md @@ -7,7 +7,7 @@ [#]: via: (https://itsfoss.com/install-fedora-in-virtualbox/) [#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) -如何在 Fedora 中安装 VirtualBox +如何在 VirtualBox 中安装 Fedora ====== 如果你对 Fedora Linux 感兴趣,这有几种方式可以尝试它。 @@ -30,7 +30,7 @@ 你甚至可以复制你的虚拟环境,并在其他系统上重新安装它。听起来方便吗?让我来教你怎么做。 -### 在 Fedora 上安装 Fedora +### 在 VirtualBox 上安装 Fedora ![][2] From 56fb211c91ee3234fccdfe77c000193da65a5917 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 24 Nov 2020 18:14:09 +0800 Subject: [PATCH 0870/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201124?= =?UTF-8?q?=20Customize=20Task=20Switching=20Experience=20on=20GNOME=20Des?= =?UTF-8?q?ktop=20With=20These=20Nifty=20Tools?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201124 Customize Task Switching Experience on GNOME Desktop With These Nifty Tools.md --- ...on GNOME Desktop With These Nifty Tools.md | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 sources/tech/20201124 Customize Task Switching Experience on GNOME Desktop With These Nifty Tools.md diff --git a/sources/tech/20201124 Customize Task Switching Experience on GNOME Desktop With These Nifty Tools.md b/sources/tech/20201124 Customize Task Switching Experience on GNOME Desktop With These Nifty Tools.md new file mode 100644 index 0000000000..251f2e5edb --- /dev/null +++ b/sources/tech/20201124 Customize Task Switching Experience on GNOME Desktop With These Nifty Tools.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Customize Task Switching Experience on GNOME Desktop With These Nifty Tools) +[#]: via: (https://itsfoss.com/customize-gnome-task-switcher/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Customize Task Switching Experience on GNOME Desktop With These Nifty Tools +====== + +Unless you’re new to Linux, you know that there are several [popular desktop environment][1] choices for users. And if you’re that newbie, I recommend you to learn [what a desktop environment is][2] along with this tutorial. + +Here, I shall be focusing on tweaking the task switching experience on GNOME. I know that the majority of users just tend to use it as is and stock settings are good enough for the most part. + +I mean there is nothing wrong with the application switcher that [you use with Alt+Tab keyboard shortcut in Ubuntu][3]. + +![][4] + +However, if you are a tinkerer who wants to [customize the look and feel of your GNOME desktop][5], including the task switcher and animation effects when launching or minimizing an app — you might want to continue reading this article. + +### Change GNOME Task Switcher to Windows 7 Style Effect + +![][6] + +Switching between running applications using the key bind **Alt+Tab** is fast but it may not be the most intuitive experience for some. You just get to cycle through a bunch of icons depending on the number of active applications. + +What if you want to change how the task switcher looks? + +Well, you can easily give it a look of Windows 7 Aero Flip 3D effect. And, here’s how it will look: + +![][7] + +It definitely looks interesting to have a different task switcher. Why? Just for fun or to share your desktop’s screenshot on Linux communities. + +Now, to get this on your GNOME desktop, here’s what you have to do: + +Step 1: Enable GNOME extensions if you haven’t already. You can follow our guide to [learn how to use GNOME shell extensions][8]. + +Step 2: Once you are done with the setup, you can proceed downloading and installing the [Coverflow GNOME extension][9] from GNOME extensions website. + +In case you haven’t installed the browser extension, you can just click on the link “**Click here to install browser extension**” from the notice as shown in the screenshot below. + +![][10] + +Step 3: Next, you just have to refresh the web page and enable the extension as shown in the screenshot below. + +![][11] + +You also get some customization options if you click on the “gear” icon right to the toggle button. + +![][12] + +Of course, depending on how fast you want it to be or how good you want it to look, you will have to adjust the animation speed accordingly. + +Next, why not some kind of cool effect when you interact with applications (minimize/close)? I have just the solution for you. + +### Add Genie Animation Effect While Minimizing & Re-opening Applications + +There’s an interesting effect (sort of like genie popping out of a lamp) that you can add to see when you minimize or re-open an app. + +This also comes as a GNOME extension, so you do not need to do anything else to get started. + +You just have to head to the extensions page, which is [Compiz alike Magic Lamp effect][13] and then enable the extension to see it in action. + +![][14] + +Here’s how it looks in action: + +![][15] + +It would look even cooler if you switch the Ubuntu dock to the bottom. + +Exciting GNOME extensions, right? You can play around to tweak your GNOME experience using the [GNOME tweaks app][16] and [install some beautiful icon themes][17] or explore different options. + +How do you prefer to customize your GNOME experience? Is there any other cool GNOME extension or an app that you tend to utilize? Feel free to share your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/customize-gnome-task-switcher/ + +作者:[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/best-linux-desktop-environments/ +[2]: https://itsfoss.com/what-is-desktop-environment/ +[3]: https://itsfoss.com/ubuntu-shortcuts/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/10/gnome-app-switcher.jpeg?resize=800%2C255&ssl=1 +[5]: https://itsfoss.com/gnome-tricks-ubuntu/ +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/ubuntu-coverflow-screenshot.jpg?resize=800%2C387&ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/coverflow-task-switcher.jpg?resize=800%2C392&ssl=1 +[8]: https://itsfoss.com/gnome-shell-extensions/ +[9]: https://extensions.gnome.org/extension/97/coverflow-alt-tab/ +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/gnome-shell-extension-browser.jpg?resize=800%2C401&ssl=1 +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/coverflow-enable.jpg?resize=800%2C303&ssl=1 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/coverflow-settings.png?resize=800%2C481&ssl=1 +[13]: https://extensions.gnome.org/extension/3740/compiz-alike-magic-lamp-effect/ +[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/magic-lamp-extension.jpg?resize=800%2C355&ssl=1 +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/magic-lamp-effect-800x380.gif?resize=800%2C380&ssl=1 +[16]: https://itsfoss.com/gnome-tweak-tool/ +[17]: https://itsfoss.com/best-icon-themes-ubuntu-16-04/ From fc99ed2f7d4440481597bba1a21dd3708c1a40ce Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 24 Nov 2020 18:14:19 +0800 Subject: [PATCH 0871/1156] APL --- .../20201028 5 new sudo features you need to know in 2020.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20201028 5 new sudo features you need to know in 2020.md b/sources/tech/20201028 5 new sudo features you need to know in 2020.md index 1a341c50ca..6459d389f9 100644 --- a/sources/tech/20201028 5 new sudo features you need to know in 2020.md +++ b/sources/tech/20201028 5 new sudo features you need to know in 2020.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 3cbec139d64768993b5f067e5ddd31d523eeef8c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 24 Nov 2020 18:17:08 +0800 Subject: [PATCH 0872/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201124?= =?UTF-8?q?=20Build=20a=20motion=20detection=20system=20with=20a=20Raspber?= =?UTF-8?q?ry=20Pi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201124 Build a motion detection system with a Raspberry Pi.md --- ...on detection system with a Raspberry Pi.md | 295 ++++++++++++++++++ 1 file changed, 295 insertions(+) create mode 100644 sources/tech/20201124 Build a motion detection system with a Raspberry Pi.md diff --git a/sources/tech/20201124 Build a motion detection system with a Raspberry Pi.md b/sources/tech/20201124 Build a motion detection system with a Raspberry Pi.md new file mode 100644 index 0000000000..f32e2c848e --- /dev/null +++ b/sources/tech/20201124 Build a motion detection system with a Raspberry Pi.md @@ -0,0 +1,295 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Build a motion detection system with a Raspberry Pi) +[#]: via: (https://opensource.com/article/20/11/motion-detection-raspberry-pi) +[#]: author: (Lukas Janėnas https://opensource.com/users/lukasjan) + +Build a motion detection system with a Raspberry Pi +====== +Set up an inexpensive home security system to alert you when someone is +lurking around your house. +![Houses in a row][1] + +If you want a home security system to tell you if someone is lurking around your property, you don't need an expensive, proprietary solution from a third-party vendor. You can set up your own system using a Raspberry Pi, a passive infrared (PIR) motion sensor, and an LTE modem that will send SMS messages whenever it detects movement. + +### Prerequisites + +You will need: + + * A Raspberry Pi with Ethernet connection and Raspberry Pi OS + * An HC-SR501 PIR motion sensor + * 1 red LED + * 1 green LED + * An LTE modem (I used the Teltonika [TRM240][2]) + * A SIM card + + + +#### The PIR motion sensor + +The PIR motion sensor will sense motion when something that emits infrared rays (e.g., a human, animal, or anything that emits heat) moves in the range of the sensor's field or reach. PIR motion sensors are low power and inexpensive, so they're used in many products that detect motion. They can't say how many people are in the area and how close they are to the sensor; they just detect motion. + +![PIR sensor][3] + +(Lukas Janenas, [CC BY-SA 4.0][4]) + +A PIR sensor has two potentiometers, one for setting the delay time and another for sensitivity. The delay time adjustment sets how long the output should remain high after detecting motion; it can be anywhere from five seconds to five minutes. The sensitivity adjustment sets the detection range, which can be anywhere from three to seven meters. + +#### The LTE modem + +Long-term evolution (LTE) is a standard for wireless broadband communication based on the GSM/EDGE and UMTS/HSPA technologies. The LTE modem I'm using is a USB device that can add 3G or 4G (LTE) cellular connectivity to a Raspberry PI computer. In this project, I'm not using the modem for cellular connectivity, but to send messages to my phone when motion is detected. I can control the modem with serial communication and AT commands; the latter send messages from the modem to my phone number. + +![LTE modem][5] + +(Lukas Janenas, [CC BY-SA 4.0][4]) + +### How to set up your home security system + +#### Step 1: Install the software + +First, install the necessary software on your Raspberry Pi. In the Raspberry Pi's terminal, enter: + + +``` +`sudo apt install python3 python3-gpiozero python-serial -y` +``` + +#### Step 2: Set up the modem + +Insert your SIM card into your LTE modem by following these [instructions][6] for the TRM240. Make sure to mount the antenna on the modem for a better signal. + +#### Step 3: Connect the modem to the Raspberry Pi + +Connect the LTE modem to one of the Raspberry Pi's USB ports, then wait for the device to boot up. You should see four new USB ports in the `/dev` directory. You can check them by executing this command in the terminal: + + +``` +`ls /dev/ttyUSB*` +``` + +You should now see these devices: + +![USB ports output][7] + +(Lukas Janenas, [CC BY-SA 4.0][4]) + +You will use the **ttyUSB2** port to communicate with the device by sending AT commands. + +#### Step 4: Connect the sensors to the Raspberry Pi + + 1. **Connect the PIR sensor:** +Connect the **VCC** and **GND** pins to the respective pins on the Raspberry Pi, and connect the motion sensor's output pin to the **8 pin** on the Raspberry Pi. See below for a schematic on these connections, and you can learn more about [Raspberry Pi pin numbering][8] in the GPIO Zero docs. + + 2. **Connect the LED lights:** +If you want indicator LEDs to light up when motion is detected, connect the cathode (short leg, flat side) of the LED to a ground pin; connect the anode (longer leg) to a current-limiting resistor; and connect the other side of the resistor to a GPIO pin (the limiting resistor can be placed either side of the LED). Connect the red LED to the **38 pin** on the board and the green LED to the **40 pin**. + + + + +Note that this step is optional. If you don't want indicator LEDs when motion is detected, delete the LED sections from the example code below. + +![Raspberry Pi wiring diagram][9] + +(Lukas Janenas, [CC BY-SA 4.0][4]) + +#### Step 5: Launch the program + +Using the terminal (or any text editor), create a file named `motion_sensor.py`, and paste in the [example code][10] below. + +Find and change these fields: + + * `phone_number` + * `message` + + + +If you used different pins to connect the sensors, make sure to change the code accordingly. + +When everything is set and ready to go, start the program from the terminal by entering: + + +``` +`python3 motion_sensor.py` +``` + +If you don't have the required privileges to start the program, try this command: + + +``` +`sudo python3 motion_sensor.py` +``` + +![Motion sensor hardware][11] + +(Lukas Janenas, [CC BY-SA 4.0][4]) + +### Example code + + +``` +from gpiozero import MotionSensor, LED +from time import sleep, time +from sys import exit +import serial +import threading + +# Raspberry Pi GPIO pin config +sensor = MotionSensor(14) +green = LED(21) +red = LED(20) + +# Modem configuration +device = '/dev/ttyUSB2' +message = '<message>' +phone_number = '<phone_number>' +sms_timeout = 120 # min seconds between SMS messages + +def setup(): +    port.close() + +    try: +        port.open() +    except serial.SerialException as e: +        print('Error opening device: ' + str(e)) +        return False + +    # Turn off echo mode +    port.write(b'ATE0 \r') +    if not check_response('OK', 10): +        print('Failed on ATE0') +        return False + +    # Enter SMS text mode +    port.write(b'AT+CMGF=1 \r') +    if not check_response('OK', 6): +        print('Failed on CMGF') +        return False + +    # Switch character set to 'international reference alphabet' +    # Note: this still doesn't support all characters +    port.write(b'AT+CSCS="IRA" \r') +    if not check_response('OK', 6): +        print('Failed on CSCS') +        return False + +    return True + +def check_response(string, amount): +    result = '' + +    try: +        result = port.read(amount).decode() +    except: +        return False + +    if not string in result: +        try: +            # Write 'ESC' to exit SMS input mode, just in case +            port.write(b'\x1B \r') +        except: +            return False + +    return string in result + +def send_sms(): +    global currently_sending, last_msg_time +    currently_sending = True + +    try: +        port.write('AT+CMGS="{}" \r'.format(phone_number).encode()) +        if not check_response('>', 6): +            print('Failed on CMGS') +            currently_sending = False +            return + +        # Write the message terminated by 'Ctrl+Z' or '1A' in ASCII +        port.write('{}\x1A \r'.format(message).encode()) + +        while True: +            result = port.readline().decode() + +            if 'OK' in result: +                print('> SMS sent successfully') +                last_msg_time = time() +                currently_sending = False +                return + +            if 'ERROR' in result: +                print('> Failed to send SMS [{}]'.format(result.rstrip())) +                currently_sending = False +                return +    except: +        # Initiate setup if the got while the program was running +        setup() +        currently_sending = False + +def on_motion(): +    print('Motion detected!') +    green.off() +    red.on() + +    if time() - last_msg_time > sms_timeout and not currently_sending: +        print('> Sending SMS...') +        threading.Thread(target=send_sms).start() + +def no_motion(): +    green.on() +    red.off() + +print('* Setting up...') +green.on() +red.on() + +port = serial.Serial() +port.port = device +port.baudrate = 115200 +port.timeout = 2 + +last_msg_time = 0 +currently_sending = False + +if not setup(): +    print('* Retrying...') +    if not setup(): +        print('* Try restarting the modem') +        exit(1) + +print('* Do not move, setting up the PIR sensor...') +sensor.wait_for_no_motion() + +print('* Device ready! ', end='', flush=True) +green.on() +red.off() + +sensor.when_motion = on_motion +sensor.when_no_motion = no_motion +input('Press Enter or Ctrl+C to exit\n\n') +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/motion-detection-raspberry-pi + +作者:[Lukas Janėnas][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://opensource.com/users/lukasjan +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/house_home_colors_live_building.jpg?itok=HLpsIfIL (Houses in a row) +[2]: https://teltonika-networks.com/product/trm240/ +[3]: https://opensource.com/sites/default/files/uploads/pir-sensor.jpg (PIR sensor) +[4]: https://creativecommons.org/licenses/by-sa/4.0/ +[5]: https://opensource.com/sites/default/files/uploads/modem.jpg (LTE modem) +[6]: https://wiki.teltonika-networks.com/view/TRM240_SIM_Card +[7]: https://opensource.com/sites/default/files/uploads/deviceoutput.png (USB ports output) +[8]: https://gpiozero.readthedocs.io/en/stable/recipes.html#pin-numbering +[9]: https://opensource.com/sites/default/files/uploads/wiring.png (Raspberry Pi wiring diagram) +[10]: tmp.4ePb9Wjuou#code +[11]: https://opensource.com/sites/default/files/uploads/motionssensorsetup.jpg (Motion sensor hardware) From 72bae07c53ab967ea14874b58d607a03a31c0323 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 24 Nov 2020 18:17:26 +0800 Subject: [PATCH 0873/1156] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020201124?= =?UTF-8?q?=20A=20beginner's=20guide=20to=20developing=20with=20React?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20201124 A beginner-s guide to developing with React.md --- ...ginner-s guide to developing with React.md | 284 ++++++++++++++++++ 1 file changed, 284 insertions(+) create mode 100644 sources/tech/20201124 A beginner-s guide to developing with React.md diff --git a/sources/tech/20201124 A beginner-s guide to developing with React.md b/sources/tech/20201124 A beginner-s guide to developing with React.md new file mode 100644 index 0000000000..7928fb6b43 --- /dev/null +++ b/sources/tech/20201124 A beginner-s guide to developing with React.md @@ -0,0 +1,284 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A beginner's guide to developing with React) +[#]: via: (https://opensource.com/article/20/11/reactjs-tutorial) +[#]: author: (Shedrack Akintayo https://opensource.com/users/shedrack-akintayo) + +A beginner's guide to developing with React +====== +A step-by-step guide to using React in your web and mobile user +interfaces. +![Gears connecting][1] + +[React][2] is a JavaScript user interface (UI) library that was built and is maintained by Facebook. React helps JavaScript developers think logically and functionally about how they want to build a UI. + +With React, you can build: + + 1. Single-page applications + 2. Applications that are easy to understand + 3. Scalable applications + 4. Cross-platform applications + + + +React allows developers to build applications declaratively and offers a unidirectional flow of data. + +### React's advantages + +The following features explain why React is one of the [most popular][3] web frameworks. + + * **It is declarative:** React makes it extremely painless to build interactive user interfaces, design basic views for your application based on various states, and update and render new views when the data in your application changes. + * **It is component-based:** React gives you the ability to build encapsulated components that can manage their own state, then puts them together to build complex UIs. The logic of these components is written in JavaScript instead of templates, so you easily pass actual data and keep state out of the [document object model][4] (DOM). + * **You can learn once, write anywhere:** React gives you the ability to build for both mobile (React Native) and the web. There's no need to rewrite your existing codebase; you can just integrate React with your existing code. + * **The virtual DOM:** React introduced a wrapper around the regular DOM called the virtual DOM (VDOM). This allows React to render elements and update its state faster than the regular DOM. + * **Performance:** React has great performance benefits due to the VDOM and one-way flow of data. + + + +### The virtual DOM + +React's VDOM is like a virtual copy of the original DOM. It offers one-way data binding, which makes manipulating and updating the VDOM quicker than updating the original DOM. The VDOM can handle multiple operations in milliseconds without affecting the general page performance. + +This VDOM supports React's declarative API: You basically tell React what state you want the UI to be in, and it ensures that the DOM matches that state. + +### Prerequisites for learning React + +Learning React requires basic knowledge of JavaScript, HTML, and CSS. To use React's power effectively, it helps to be familiar with [ECMAScript 6][5] (ES6) and functional and object-oriented programming. + +You also need the following things installed on your computer: + + * [NodeJS][6] + * [npm][7] (comes bundled with NodeJS) + * [Yarn][8] (an alternative to NPM) + + + +### Basic React concepts + +It also helps to have an understanding of React's concepts. + +#### Components + +Components are standalone, reusable pieces of code. They have the same purpose as JavaScript functions but work alone and return HTML via a built-in render function. They are two main types of components: + + * **Class components** offer more control in the form of lifecycle hooks, managing and handling state, and API calls. For example: [code] class MyComponent extends React.Component { +  render() { +    return <div>This is a class component</div>; +  } +} +``` + * **Functional components** were used for rendering just views without any form of state management or data request until [React Hooks][9] was introduced. For example: [code] Function myComponent() { +  return ( +      <div>A functional Component</div> +  ) + } +``` + + + +#### Props + +React props are like function arguments in JavaScript and attributes in HTML. They are read-only. For example: + + +``` +function Welcome(props) { +  return <h1>Hello, {props.name}</h1>; +} +``` + +#### State + +React components have a built-in object called _state_, which is where you store property values that belong to a particular component. If a component's state changes at any point in time, the component re-renders. For example: + + +``` +class Car extends React.Component { +  constructor(props) { +    super(props); +    this.state = { brand: 'Ford' }; +  } +  render() { +    return ( +      <div> +        <h1>My Car</h1> +      </div> +    ); +  } +} +``` + +#### JSX + +JSX is a syntax extension to JavaScript. It is similar to a template language but has the full power of JavaScript. JSX is compiled to `React.createElement()` calls, which return plain JavaScript objects called _React elements_. For example: + + +``` +return ( +  <div> +    <h1>My Car</h1> +  </div> +); +``` + +The code between the return method that looks like HTML is JSX. + +### How to use React + +Ready to get started? I'll go step-by-step through two options for using React in your app: + + * Adding its content delivery network (CDN) to your HTML file + * Starting a blank React app with Create React App + + + +#### Add its CDN to your HTML file + +You can quickly use React in your HTML page by adding its CDN directly to your HTML file using the following steps: + +**Step 1:** In the HTML page you want to add React to, add an empty `
      ` tag to create a container where you want to render something with React. For example: + + +``` +<!-- ... old HTML ... --> + +<[div][10] id="button_container"></[div][10]> + +<!-- ... old HTML ... --> +``` + +**Step 2:** Add three `